db

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound         = errors.New("not found")
	ErrCredentialExists = errors.New("credential exists")
)

Functions

This section is empty.

Types

type Conn

type Conn struct {
	*sql.DB
}

func NewConn

func NewConn(dsn string) (*Conn, error)

func (*Conn) CreateCredential added in v1.2.0

func (c *Conn) CreateCredential(id int, cred *Credential) (int, error)

func (*Conn) DeleteCredential added in v1.2.0

func (c *Conn) DeleteCredential(id, credID int) error

func (*Conn) HasPictureIDs

func (c *Conn) HasPictureIDs() ([]int, error)

func (*Conn) ListAllCredentials added in v1.2.0

func (c *Conn) ListAllCredentials() (map[int][]*Credential, error)

func (*Conn) ListCredentials added in v1.2.0

func (c *Conn) ListCredentials(id int) ([]*Credential, error)

func (*Conn) ListDepartments added in v1.2.0

func (c *Conn) ListDepartments() (map[int]string, error)

func (*Conn) ReadPicture

func (c *Conn) ReadPicture(id int) ([]byte, error)

func (*Conn) UpdatePicture

func (c *Conn) UpdatePicture(id int, buf []byte) error

func (*Conn) WithTx

func (c *Conn) WithTx(fn func(tx *sql.Tx) error) error

type Credential added in v1.2.0

type Credential struct {
	ID       int
	Active   bool
	SiteCode int
	CardCode int
}

Jump to

Keyboard shortcuts

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