Creates a layer of abstraction for database so we can change storage if needed

This commit is contained in:
Giorgos Komninos 2021-08-15 13:02:26 +03:00
parent 0f7acc4ec4
commit 5559e028e2
5 changed files with 210 additions and 231 deletions

19
store/store.go Normal file
View file

@ -0,0 +1,19 @@
package store
import (
"github.com/ngoduykhanh/wireguard-ui/model"
)
type IStore interface {
Init() error
GetUser() (model.User, error)
GetGlobalSettings() (model.GlobalSetting, error)
GetServer() (model.Server, error)
GetClients(hasQRCode bool) ([]model.ClientData, error)
GetClientByID(clientID string, hasQRCode bool) (model.ClientData, error)
SaveClient(client model.Client) error
DeleteClient(clientID string) error
SaveServerInterface(serverInterface model.ServerInterface) error
SaveServerKeyPair(serverKeyPair model.ServerKeypair) error
SaveGlobalSettings(globalSettings model.GlobalSetting) error
}