db

package
v0.0.0-...-eaf11b8 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Open(dsn string) error

	UserByID(id int) (*models.User, error)
	UserByUsername(username string) (*models.User, error)
	AddUser(user *models.User) error
	UpdateUser(user *models.User) error
	DeleteUser(user *models.User) error

	RecentUserLogs(user *models.User, count int) ([]*models.Log, error)
	UserLogYears(user *models.User) ([]int, error)
	UserLogByID(user *models.User, id int) (*models.Log, error)
	UserLogsByYear(user *models.User, year int) ([]*models.Log, error)
	AddUserLog(user *models.User, log *models.Log) error
	UpdateLog(log *models.Log) error
	DeleteLog(log *models.Log) error
}

func Driver

func Driver(name string) DB

type Postgres

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

func (*Postgres) AddUser

func (d *Postgres) AddUser(user *models.User) error

func (*Postgres) AddUserLog

func (d *Postgres) AddUserLog(user *models.User, log *models.Log) error

func (*Postgres) DeleteLog

func (d *Postgres) DeleteLog(log *models.Log) error

func (*Postgres) DeleteUser

func (d *Postgres) DeleteUser(user *models.User) error

func (*Postgres) Open

func (d *Postgres) Open(dsn string) error

func (*Postgres) RecentUserLogs

func (d *Postgres) RecentUserLogs(user *models.User, count int) ([]*models.Log, error)

func (*Postgres) UpdateLog

func (d *Postgres) UpdateLog(log *models.Log) error

func (*Postgres) UpdateUser

func (d *Postgres) UpdateUser(user *models.User) error

func (*Postgres) UserByID

func (d *Postgres) UserByID(id int) (*models.User, error)

func (*Postgres) UserByUsername

func (d *Postgres) UserByUsername(username string) (*models.User, error)

func (*Postgres) UserLogByID

func (d *Postgres) UserLogByID(user *models.User, id int) (*models.Log, error)

func (*Postgres) UserLogYears

func (d *Postgres) UserLogYears(user *models.User) ([]int, error)

func (*Postgres) UserLogsByYear

func (d *Postgres) UserLogsByYear(user *models.User, year int) ([]*models.Log, error)

Jump to

Keyboard shortcuts

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