pg

package
v0.0.0-...-f39411c Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionFinder

type SessionFinder struct {
	DB *sqlx.DB
}

SessionFinder is the PG implementation of the interface defined in the domain that allows to find session's information based on various parameters

func (*SessionFinder) ByID

func (s *SessionFinder) ByID(id string) (*backapi.Session, error)

ByID returns the associated session stored with, as ID, the parameter given

type SessionRecord

type SessionRecord struct {
	ID        string    `db:"id"`
	UserID    string    `db:"user_id"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
	ExpiresAt time.Time `db:"expires_at"`
}

SessionRecord defines fields of a session for pg usage

type SessionStore

type SessionStore struct {
	DB *sqlx.DB
}

SessionStore is the PG implementation of the interface defined in the domain that allows to insert and update session information

func (*SessionStore) Create

func (s *SessionStore) Create(sess *backapi.Session) (*backapi.Session, error)

Create tries to insert in DB a user

func (*SessionStore) Delete

func (s *SessionStore) Delete(ID string) error

func (*SessionStore) DeleteAllForUserID

func (s *SessionStore) DeleteAllForUserID(UserID string) error

type Store

type Store struct {
	*sqlx.DB
}

func NewStore

func NewStore(url string) (*Store, error)

NewStore returns a new store using postgresql. The returned struct could be mainly used to query the database and store / retrieve data on it.

type UserFinder

type UserFinder struct {
	DB *sqlx.DB
}

UserFinder is the PG implementation of the interface defined in the domain that allows to find user's information based on various parameters

func (*UserFinder) ByEmail

func (s *UserFinder) ByEmail(email string) (*backapi.User, error)

ByEmail returns the associated user stored with, as email, the parameter given

func (*UserFinder) ByID

func (s *UserFinder) ByID(id string) (*backapi.User, error)

ByID returns the associated user stored with, as ID, the parameter given

func (*UserFinder) List

func (s *UserFinder) List() ([]backapi.User, error)

List returns all the pronostics group stored

type UserRecord

type UserRecord struct {
	ID          string    `db:"id"`
	CustomerID  string    `db:"customer_id"`
	Firstname   string    `db:"firstname"`
	Lastname    string    `db:"lastname"`
	Username    string    `db:"username"`
	Email       string    `db:"email"`
	Password    string    `db:"password"`
	Admin       bool      `db:"admin"`
	CreatedAt   time.Time `db:"created_at"`
	UpdatedAt   time.Time `db:"updated_at"`
	ConfirmedAt time.Time `db:"confirmed_at"`
	DeletedAt   time.Time `db:"deleted_at"`
}

UserRecord defines fields of a user for pg usage

type UserStore

type UserStore struct {
	DB *sqlx.DB
}

UserStore is the PG implementation of the interface defined in the domain that allows to insert and update users information

func (*UserStore) Confirm

func (s *UserStore) Confirm(id string) error

func (*UserStore) Create

func (s *UserStore) Create(u *backapi.User) (*backapi.User, error)

Create tries to insert in DB a user

func (*UserStore) Delete

func (s *UserStore) Delete(id string) error

func (*UserStore) SetEmail

func (s *UserStore) SetEmail(id, email string) error

func (*UserStore) SetPassword

func (s *UserStore) SetPassword(id, password string) error

Jump to

Keyboard shortcuts

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