db

package
v0.0.0-...-d8065e1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func NullStrToStr

func NullStrToStr(ns sql.NullString) string

func RunMigrations

func RunMigrations(db *sql.DB) error

RunMigrations runs DB migrations at startup

Types

type Querier

type Querier struct {
	// contains filtered or unexported fields
}

Querier facilitates querying appbert objects from DB

func Get

func Get() *Querier

Get returns handle to DB

func (*Querier) AddUser

func (q *Querier) AddUser(user *objects.User) error

AddUser adds user to database

func (*Querier) DropData

func (db *Querier) DropData()

func (*Querier) GetHandle

func (db *Querier) GetHandle() *sql.DB

GetHandle returns DB handle

func (*Querier) GetUserByEmail

func (q *Querier) GetUserByEmail(userEmail string, user *objects.User) error

GetUserByEmail returns a user given userEmail

func (*Querier) GetUserByName

func (q *Querier) GetUserByName(userName string, user *objects.User) error

GetUserByName returns a user given userName

func (*Querier) GetUsers

func (q *Querier) GetUsers(users *[]objects.User) error

GetUsers returns a list of users from database

func (*Querier) Migrate

func (db *Querier) Migrate() error

Migrate initializes and upgrades database

func (*Querier) RemoveUserByEmail

func (q *Querier) RemoveUserByEmail(user *objects.User) error

RemoveUser removes user from database based on email

func (*Querier) RemoveUserByName

func (q *Querier) RemoveUserByName(user *objects.User) error

RemoveUser removes user from database based on name

Jump to

Keyboard shortcuts

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