diff options
Diffstat (limited to 'repository/appRepository.go')
-rw-r--r-- | repository/appRepository.go | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/repository/appRepository.go b/repository/appRepository.go deleted file mode 100644 index 9e57fb7..0000000 --- a/repository/appRepository.go +++ /dev/null @@ -1,42 +0,0 @@ -package repository - -import ( - "encoding/json" - - "bloat/kv" - "bloat/model" -) - -type appRepository struct { - db *kv.Database -} - -func NewAppRepository(db *kv.Database) *appRepository { - return &appRepository{ - db: db, - } -} - -func (repo *appRepository) Add(a model.App) (err error) { - data, err := json.Marshal(a) - if err != nil { - return - } - err = repo.db.Set(a.InstanceDomain, data) - return -} - -func (repo *appRepository) Get(instanceDomain string) (a model.App, err error) { - data, err := repo.db.Get(instanceDomain) - if err != nil { - err = model.ErrAppNotFound - return - } - - err = json.Unmarshal(data, &a) - if err != nil { - return - } - - return -} |