user

package
v0.0.0-...-2602c8a Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateUserParams

type CreateUserParams struct {
	UserID    uuid.UUID `json:"userID"`
	Email     string    `json:"email"`
	FirstName string    `json:"firstName"`
	LastName  string    `json:"lastName"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type ListPaginatedUsersParams

type ListPaginatedUsersParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type Querier

type Querier interface {
	CreateUser(ctx context.Context, arg CreateUserParams) (Users, error)
	DeleteUserByEmail(ctx context.Context, email string) error
	DeleteUserByID(ctx context.Context, userID uuid.UUID) error
	GetUserByEmail(ctx context.Context, email string) (Users, error)
	GetUserByID(ctx context.Context, userID uuid.UUID) (Users, error)
	ListPaginatedUsers(ctx context.Context, arg ListPaginatedUsersParams) ([]Users, error)
	ListUsers(ctx context.Context) ([]Users, error)
	UpdateUser(ctx context.Context, arg UpdateUserParams) (Users, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func Prepare

func Prepare(ctx context.Context, db DBTX) (*Queries, error)

func (*Queries) Close

func (q *Queries) Close() error

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (Users, error)

func (*Queries) DeleteUserByEmail

func (q *Queries) DeleteUserByEmail(ctx context.Context, email string) error

func (*Queries) DeleteUserByID

func (q *Queries) DeleteUserByID(ctx context.Context, userID uuid.UUID) error

func (*Queries) GetUserByEmail

func (q *Queries) GetUserByEmail(ctx context.Context, email string) (Users, error)

func (*Queries) GetUserByID

func (q *Queries) GetUserByID(ctx context.Context, userID uuid.UUID) (Users, error)

func (*Queries) ListPaginatedUsers

func (q *Queries) ListPaginatedUsers(ctx context.Context, arg ListPaginatedUsersParams) ([]Users, error)

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context) ([]Users, error)

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (Users, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Store

type Store interface {
	Querier
}

Store provides all functions to execute db queries

func NewStore

func NewStore(db *sql.DB) Store

NewStore instantiates a user store object returning the store interface.

type UpdateUserParams

type UpdateUserParams struct {
	UserID    uuid.UUID `json:"userID"`
	Email     string    `json:"email"`
	FirstName string    `json:"firstName"`
	LastName  string    `json:"lastName"`
}

type Users

type Users struct {
	TableID   sql.NullInt64 `json:"tableID"`
	UserID    uuid.UUID     `json:"userID"`
	Email     string        `json:"email"`
	FirstName string        `json:"firstName"`
	LastName  string        `json:"lastName"`
	CreatedAt sql.NullTime  `json:"createdAt"`
}

Directories

Path Synopsis
Package mockdbuser is a generated GoMock package.
Package mockdbuser is a generated GoMock package.

Jump to

Keyboard shortcuts

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