dal

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package dal implements Data Access Layer using PostgreSQL DB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMetrics added in v0.4.0

func InitMetrics(reg *prometheus.Registry)

InitMetrics must be called once before using this package. It registers and initializes metrics used by this package.

Types

type Ctx

type Ctx = context.Context

type Repo

type Repo struct {
	*repo.Repo
}

func New

func New(ctx Ctx, dir string, cfg *def.PostgresConfig) (_ *Repo, err error)

New creates and returns new Repo. It will also run required DB migrations and connects to DB.

func (*Repo) AddAccessToken

func (r *Repo) AddAccessToken(ctx Ctx, accessToken app.AccessToken, userName dom.UserName) error

func (*Repo) AddUser

func (r *Repo) AddUser(ctx Ctx, user app.User) error

func (*Repo) DelAccessToken

func (r *Repo) DelAccessToken(ctx Ctx, accessToken app.AccessToken) error

func (*Repo) DelAccessTokens

func (r *Repo) DelAccessTokens(ctx Ctx, userName dom.UserName) error

func (*Repo) GetUser

func (r *Repo) GetUser(ctx Ctx, userName dom.UserName) (res *app.User, err error)

func (*Repo) GetUserByAccessToken

func (r *Repo) GetUserByAccessToken(ctx Ctx, accessToken app.AccessToken) (res *app.User, err error)

func (*Repo) GetUserByEmail

func (r *Repo) GetUserByEmail(ctx Ctx, email string) (res *app.User, err error)

Jump to

Keyboard shortcuts

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