Documentation ¶
Index ¶
- Variables
- func CreateAddress(a *users.Address, userid string) error
- func CreateCard(c *users.Card, userid string) error
- func CreateUser(u *users.User) error
- func Delete(entity, id string) error
- func GetAddress(n string) (users.Address, error)
- func GetAddresses() ([]users.Address, error)
- func GetCard(n string) (users.Card, error)
- func GetCards() ([]users.Card, error)
- func GetUser(n string) (users.User, error)
- func GetUserAttributes(u *users.User) error
- func GetUserByName(n string) (users.User, error)
- func GetUsers() ([]users.User, error)
- func Init() error
- func Ping() error
- func Register(name string, db Database)
- func Set() error
- type Database
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //DefaultDb is the database set for the microservice DefaultDb Database //DBTypes is a map of DB interfaces that can be used for this service DBTypes = map[string]Database{} //ErrNoDatabaseFound error returnes when database interface does not exists in DBTypes ErrNoDatabaseFound = "No Database with Name %v registered" //ErrNoDatabaseSelected is returned when no database was designated in the flag or env ErrNoDatabaseSelected = errors.New("No DB selected") )
Functions ¶
func CreateAddress ¶
CreateAddress invokes DefaultDb method
func CreateCard ¶
CreateCard invokes DefaultDb method
func GetAddress ¶
GetAddress invokes DefaultDb method
func GetAddresses ¶
GetAddresses invokes DefaultDb method
func GetUserAttributes ¶
GetUserAttributes invokes DefaultDb method
func GetUserByName ¶
GetUserByName invokes DefaultDb method
Types ¶
type Database ¶
type Database interface { Init() error GetUserByName(string) (users.User, error) GetUser(string) (users.User, error) GetUsers() ([]users.User, error) CreateUser(*users.User) error GetUserAttributes(*users.User) error GetAddress(string) (users.Address, error) GetAddresses() ([]users.Address, error) CreateAddress(*users.Address, string) error GetCard(string) (users.Card, error) GetCards() ([]users.Card, error) Delete(string, string) error CreateCard(*users.Card, string) error Ping() error }
Database represents a simple interface so we can switch to a new system easily this is just basic and specific to this microservice
Click to show internal directories.
Click to hide internal directories.