Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is the struct which contains the database client and the config.
func New ¶
New returns a new backend struct mainly containing a database connection, according to the read config file.
func (*Backend) AddGarden ¶
AddGarden adds a new garden to the database. It returns the uuid of the added garden.
func (*Backend) DeleteGarden ¶
DeleteGarden deletes a garden corresponding to the given uuid from the database. It returns the uuid of the deleted garden.
func (*Backend) EditGarden ¶
EditGarden updates the garden corresponding to the given id with the updated value of name and color. It returns the uuid of the updated faction.
type Config ¶
type Config struct { // DBName is the database name DBName string `json:"db_name"` // User is the database user User string `json:"user"` // Password is the database password for the used user Password string `json:"password"` // Addr is the database address Addr string `json:"addr"` // Port is the database port Port int `json:"port"` // SkipVerify is a bool which determines if the backend // must skips the ssl mode or not. SkipVerify bool `json:"skip_verify,omitempty"` // contains filtered or unexported fields }
Config is the backend configuration.
type Garden ¶
type Garden struct { // UUID is the garden uuid. UUID uuid.UUID `json:"uuid" description:"Garden UUID"` // Name is the garden name. Name string `json:"name" description:"Garden name"` // Address is the garden address. Address string `json:"address" description:"Garden address"` // Size is the garden size. Size int `json:"size" description:"Garden size"` // Floor is the garden floor quality. Floor int `json:"floor" description:"Garden floor quality"` // HasTools defined if the tools are provided. HasTools bool `json:"hasTools" description:"Defines if the tools are provided"` // HasWater defines if the garden has a water access. HasWater bool `json:"hasWater" description:"Defines if the garden has a water access"` // HasShed defines if the garden has a shed. HasShed bool `json:"hasShed" description:"Defines if the garden has a shed"` }
Garden is the struct containing informations about a faction.