Browse Source

En cours de développement

master
losyme 7 months ago
parent
commit
baea9af87a
  1. 4
      Taskfile.yml
  2. 12
      go.mod
  3. 16
      go.sum
  4. 4
      internal/application/application.go
  5. 38
      internal/application/model.go
  6. 21
      internal/application/storage.go
  7. 1
      internal/components/components.go

4
Taskfile.yml

@ -13,11 +13,15 @@ tasks:
update:
cmds:
- go get -u forge.chapril.org/dune/jw
- go get -u forge.chapril.org/dune/memory
- go get -u forge.chapril.org/dune/model
- go get -u forge.chapril.org/losyme/application
- go get -u forge.chapril.org/losyme/cmdline
- go get -u forge.chapril.org/losyme/config
- go get -u forge.chapril.org/losyme/errors
- go get -u forge.chapril.org/losyme/minikit
- go get -u forge.chapril.org/losyme/scheduler
- go get -u forge.chapril.org/losyme/uuid
- go mod tidy
lint:
cmds:

12
go.mod

@ -3,12 +3,16 @@ module forge.chapril.org/dune/dune
go 1.17
require (
forge.chapril.org/dune/jw v0.0.0-20211011190008-0d0af336164d
forge.chapril.org/dune/jw v0.0.0-20211020130157-3c3c3fe4d012
forge.chapril.org/dune/memory v0.0.0-20211020130347-474549465ac2
forge.chapril.org/dune/model v0.0.0-20211020130416-c773f1d2fa0b
forge.chapril.org/losyme/application v0.0.0-20211008200819-b014e639a171
forge.chapril.org/losyme/cmdline v0.0.0-20211010173716-509a4c1f872e
forge.chapril.org/losyme/config v0.0.0-20211005163519-b38ce8696276
forge.chapril.org/losyme/minikit v0.0.0-20211011130323-62377a4c4cdf
forge.chapril.org/losyme/errors v0.0.0-20211003204336-ad5510c24b40
forge.chapril.org/losyme/minikit v0.0.0-20211020130120-ea643bd48160
forge.chapril.org/losyme/scheduler v0.0.0-20211003204604-f14dada88faf
forge.chapril.org/losyme/uuid v0.0.0-20211007082235-8d502169e034
)
require (
@ -17,11 +21,9 @@ require (
forge.chapril.org/eckmuhl/server v0.0.0-20211011123843-d223bfacbad9 // indirect
forge.chapril.org/losyme/buffer v0.0.0-20211003203540-771701f5a518 // indirect
forge.chapril.org/losyme/crypto v0.0.0-20211003213528-e97d4ebea720 // indirect
forge.chapril.org/losyme/errors v0.0.0-20211003204336-ad5510c24b40 // indirect
forge.chapril.org/losyme/kvfmt v0.0.0-20211003204256-34ac32764dae // indirect
forge.chapril.org/losyme/logger v0.0.0-20211005171545-68273525f4af // indirect
forge.chapril.org/losyme/logger v0.0.0-20211020125912-674a399f933c // indirect
forge.chapril.org/losyme/util v0.0.0-20210914170439-20572e6207bf // indirect
forge.chapril.org/losyme/uuid v0.0.0-20211007082235-8d502169e034 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect

16
go.sum

@ -1,5 +1,9 @@
forge.chapril.org/dune/jw v0.0.0-20211011190008-0d0af336164d h1:WIUQkPby58OE0m+NsnULN0o8wuqHpZpWEhMR6FXIxX8=
forge.chapril.org/dune/jw v0.0.0-20211011190008-0d0af336164d/go.mod h1:4bBiRiEBc73tjk/Osfh+lmpoWR1p8p4xIkHdo8aLjdg=
forge.chapril.org/dune/jw v0.0.0-20211020130157-3c3c3fe4d012 h1:4e/BuwKlQcBJm3k7DdztDaTpJ1N8xntKjMOr79DaC4I=
forge.chapril.org/dune/jw v0.0.0-20211020130157-3c3c3fe4d012/go.mod h1:BNHjflFTnZI23b+5wmY17ruK/Yg13v+A30d/swZeDWk=
forge.chapril.org/dune/memory v0.0.0-20211020130347-474549465ac2 h1:gj9NfEbXMnYYQ9kVzNWgHNI99FVuLFy8oZl4r16JcdE=
forge.chapril.org/dune/memory v0.0.0-20211020130347-474549465ac2/go.mod h1:3/uYWmGaCQHUWsjyXjOYZJB36MPhsWEBjZ/i2Sj/FXs=
forge.chapril.org/dune/model v0.0.0-20211020130416-c773f1d2fa0b h1:Sjgl+8N4nVtOsQLCNpLuJK9XSccNsY54xKNp39cmBiY=
forge.chapril.org/dune/model v0.0.0-20211020130416-c773f1d2fa0b/go.mod h1:NbcPP22feQcoXHLo9EyWsPtwv+zD/lLERCReI4XNecM=
forge.chapril.org/eckmuhl/context v0.0.0-20211010163718-0742c5d7087c h1:X5LoqoVwBRU7nUliXNVS/yXcgoR9AUSsgCvJvTk08Ak=
forge.chapril.org/eckmuhl/context v0.0.0-20211010163718-0742c5d7087c/go.mod h1:mLBQDTayRooyfmrjPQWbIFobAIclOW3ERaikGuQLiUA=
forge.chapril.org/eckmuhl/router v0.0.0-20211010164023-a12c003438f7 h1:eVBWbgEpLqGjrGYlSniExbLt2AnEbk5Ab8nWQXmAxIw=
@ -20,10 +24,10 @@ forge.chapril.org/losyme/errors v0.0.0-20211003204336-ad5510c24b40 h1:EoVVFHoIsW
forge.chapril.org/losyme/errors v0.0.0-20211003204336-ad5510c24b40/go.mod h1:saYfIRBW9zjiCik+/+5ZaajMEnTPBNI00lF9EnO+2kM=
forge.chapril.org/losyme/kvfmt v0.0.0-20211003204256-34ac32764dae h1:RdYWXKy+OQNJueb4Qqqo7sL4OY3/TpfUvmoIoH8ua9E=
forge.chapril.org/losyme/kvfmt v0.0.0-20211003204256-34ac32764dae/go.mod h1:wnVjwnCO2vFLLZ1EgFuFws1n8XLluufsGsdozGYSA7c=
forge.chapril.org/losyme/logger v0.0.0-20211005171545-68273525f4af h1:Eun7tisbfRh2vUA6tfn2wlpYjbla8LElilEBUNSp8p8=
forge.chapril.org/losyme/logger v0.0.0-20211005171545-68273525f4af/go.mod h1:a3fN8yTjq5S/ramr03hIkutKM/35UsijUgRNKHjjlMU=
forge.chapril.org/losyme/minikit v0.0.0-20211011130323-62377a4c4cdf h1:QTQqyaqJhN2XDj6dPsSc0vG7RyPYAZrW4yWHUAAtfdU=
forge.chapril.org/losyme/minikit v0.0.0-20211011130323-62377a4c4cdf/go.mod h1:lxNZ/75KRyydbXJqeYOzZHkKZ/e1L2XDYSY2WEaLEvo=
forge.chapril.org/losyme/logger v0.0.0-20211020125912-674a399f933c h1:AsWWDqFMigGp33sHDqGdJVVACiPYcY1ChSmBN7olBrk=
forge.chapril.org/losyme/logger v0.0.0-20211020125912-674a399f933c/go.mod h1:a3fN8yTjq5S/ramr03hIkutKM/35UsijUgRNKHjjlMU=
forge.chapril.org/losyme/minikit v0.0.0-20211020130120-ea643bd48160 h1:VsIP7ZZRiCDVyVwi06wLW1YabqsehmQDjBTwMx0xsIA=
forge.chapril.org/losyme/minikit v0.0.0-20211020130120-ea643bd48160/go.mod h1:YqbLghDAKvW6lEYtSS3MOnDhH9GtqalvMw+mrHQJI6U=
forge.chapril.org/losyme/scheduler v0.0.0-20211003204604-f14dada88faf h1:5OIlwVBTdvjCXh2JHAh5rq8FgSe1lXuuKDFtO/ZRaRM=
forge.chapril.org/losyme/scheduler v0.0.0-20211003204604-f14dada88faf/go.mod h1:VNjFKl0Q2vvLDnR9tdNdTIZDLQNlR+gcIGNf2aIYv3o=
forge.chapril.org/losyme/util v0.0.0-20210914170439-20572e6207bf h1:JZQLbcldf8q/o5OjaYlcNCX/dA1oshGnY6YM2VidAtI=

4
internal/application/application.go

@ -61,6 +61,10 @@ func (app *Application) run() error {
return err
}
if err := app.model(); err != nil {
return err
}
if run := app.cmdLine.runAfter; run != nil {
return run()
}

38
internal/application/model.go

@ -0,0 +1,38 @@
/*
------------------------------------------------------------------------------------------------------------------------
####### dune ####### Copyright (c) 2021 losyme ##################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package application
import (
"forge.chapril.org/dune/model"
"forge.chapril.org/losyme/uuid"
)
func (app *Application) model() error {
cs := app.components
logger, err := cs.Logger.New(uuid.New(), "model", cs.Logger.Level())
if err != nil {
return err
}
c, err := model.New(&model.Config{
Logger: logger,
Storage: cs.Storage,
})
if err != nil {
return err
}
app.components.Model = c
return nil
}
/*
######################################################################################################## @(°_°)@ #######
*/

21
internal/application/storage.go

@ -6,8 +6,27 @@
package application
import (
"forge.chapril.org/dune/memory"
"forge.chapril.org/losyme/errors"
)
func (app *Application) storage() error {
return nil
impl, err := app.components.Config.GetString("storage")
if err != nil {
return err
}
switch impl {
case "memory":
app.components.Storage = memory.New()
return nil
default:
return errors.New( /////////////////////////////////////////////////////////////////////////////////////////////
"this storage implementation does not exist",
"storage", impl,
)
}
}
/*

1
internal/components/components.go

@ -13,6 +13,7 @@ import (
type Components struct {
*components.Components
Model jw.Model
Storage jw.Storage
}

Loading…
Cancel
Save