db

package
v0.0.0-...-407718c Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 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 Account

type Account struct {
	ID        int64     `json:"id"`
	Email     string    `json:"email"`
	Password  string    `json:"password"`
	CreatedAt time.Time `json:"created_at"`
}

type CreateAccountParams

type CreateAccountParams struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

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 ListAccountParams

type ListAccountParams struct {
	Offset sql.NullInt32 `json:"offset"`
	Limit  sql.NullInt32 `json:"limit"`
}

type Querier

type Querier interface {
	CreateAccount(ctx context.Context, arg CreateAccountParams) (*Account, error)
	DeleteAccount(ctx context.Context, id int64) error
	GetAccount(ctx context.Context, id int64) (*Account, error)
	// Add queries here:
	GetAccountWithEmail(ctx context.Context, email string) (*Account, error)
	ListAccount(ctx context.Context, arg ListAccountParams) ([]*Account, error)
	UpdateAccount(ctx context.Context, arg UpdateAccountParams) (*Account, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateAccount

func (q *Queries) CreateAccount(ctx context.Context, arg CreateAccountParams) (*Account, error)

func (*Queries) DeleteAccount

func (q *Queries) DeleteAccount(ctx context.Context, id int64) error

func (*Queries) GetAccount

func (q *Queries) GetAccount(ctx context.Context, id int64) (*Account, error)

func (*Queries) GetAccountWithEmail

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

Add queries here:

func (*Queries) ListAccount

func (q *Queries) ListAccount(ctx context.Context, arg ListAccountParams) ([]*Account, error)

func (*Queries) UpdateAccount

func (q *Queries) UpdateAccount(ctx context.Context, arg UpdateAccountParams) (*Account, error)

func (*Queries) WithTx

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

type SQLStore

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

SQLStore provides all functions to execute SQL queries and transactions

type Store

type Store interface {
	Querier
}

Store defines all functions to execute db queries and transactions

func NewStore

func NewStore(db *sql.DB) Store

NewStore creates a new store

type UpdateAccountParams

type UpdateAccountParams struct {
	ID       int64  `json:"id"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

Directories

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

Jump to

Keyboard shortcuts

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