db

package
v0.0.0-...-200412a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultDb             Database
	DBTypes               = map[string]Database{}
	ErrNoDatabaseFound    = "No database with name %v registered"
	ErrNoDatabaseSelected = errors.New("No DB selected")
)

Functions

func CreateAddress

func CreateAddress(a *users.Address, userid string) error

func CreateCard

func CreateCard(c *users.Card, userid string) error

func CreateUser

func CreateUser(u *users.User) error

func Delete

func Delete(entity, id string) error

func GetAddress

func GetAddress(n string) (users.Address, error)

func GetAddresses

func GetAddresses() ([]users.Address, error)

func GetCard

func GetCard(n string) (users.Card, error)

func GetCards

func GetCards() ([]users.Card, error)

func GetUser

func GetUser(n string) (users.User, error)

func GetUserAttributes

func GetUserAttributes(u *users.User) error

func GetUserByName

func GetUserByName(n string) (users.User, error)

func GetUsers

func GetUsers() ([]users.User, error)

func Init

func Init() error

func Ping

func Ping() error

func Register

func Register(name string, db Database)

func Set

func Set() error

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)
	CreateCard(*users.Card, string) error
	Delete(string, string) error
	Ping() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL