db

package
v2.11.20 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App of package

func New

func New(db Database) App

New creates new App from dependencies

func (App) Create

func (a App) Create(ctx context.Context, o model.User) (uint64, error)

Create an user

func (App) Delete

func (a App) Delete(ctx context.Context, o model.User) error

Delete an user

func (App) DoAtomic added in v2.5.0

func (a App) DoAtomic(ctx context.Context, action func(context.Context) error) error

DoAtomic do things in a transaction

func (App) Get

func (a App) Get(ctx context.Context, id uint64) (model.User, error)

Get get an user

func (App) IsAuthorized

func (a App) IsAuthorized(ctx context.Context, user model.User, profile string) bool

IsAuthorized checks user on profile

func (App) Login

func (a App) Login(ctx context.Context, login, password string) (model.User, error)

Login checks given credentials

func (App) Update

func (a App) Update(ctx context.Context, o model.User) error

Update user

func (App) UpdatePassword added in v2.11.3

func (a App) UpdatePassword(ctx context.Context, o model.User) error

UpdatePassword of an user

type Database added in v2.11.11

type Database interface {
	Get(context.Context, func(pgx.Row) error, string, ...interface{}) error
	Create(context.Context, string, ...interface{}) (uint64, error)
	One(context.Context, string, ...interface{}) error
	DoAtomic(context.Context, func(context.Context) error) error
}

Database interface needed

Jump to

Keyboard shortcuts

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