package database import ( "encoding/json" "os" "github.com/aziis98/lupus-lite/model" ) type Database interface { CreateUser(user model.User) error GetUsers() ([]model.User, error) GetUser(username string) (model.User, error) CreatePartita(ownerUid string, partitaConfig model.PartitaConfig) (model.Partita, error) GetPartita(uid string) (model.Partita, error) } func NewInMemoryDB() (Database, error) { var db memDB exampleFile, err := os.Open("example-db.local.json") if err != nil { return nil, err } if err := json.NewDecoder(exampleFile).Decode(&db); err != nil { return nil, err } return &db, nil }