db

package
v0.0.0-...-a074784 Latest Latest
Warning

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

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

type CreateEntryParams struct {
	ID       uuid.UUID      `json:"id"`
	Domain   string         `json:"domain"`
	Login    sql.NullString `json:"login"`
	Password string         `json:"password"`
	Meta     sql.NullString `json:"meta"`
}

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 Entry

type Entry struct {
	ID uuid.UUID `json:"id"`
	// URL domain
	Domain string `json:"domain"`
	// login/user field content
	Login sql.NullString `json:"login"`
	// hashed password
	Password string `json:"password"`
	// date of creation
	Created time.Time `json:"created"`
	// date of last update
	Updated time.Time      `json:"updated"`
	Meta    sql.NullString `json:"meta"`
}

type GetEntriesParams

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

type Querier

type Querier interface {
	CreateEntry(ctx context.Context, arg CreateEntryParams) (Entry, error)
	DeleteEntry(ctx context.Context, id uuid.UUID) (Entry, error)
	GetEntries(ctx context.Context, arg GetEntriesParams) ([]Entry, error)
	GetEntriesByDomain(ctx context.Context, domainsubstr string) ([]Entry, error)
	GetEntryByID(ctx context.Context, id uuid.UUID) (Entry, error)
	UpdateEntry(ctx context.Context, arg UpdateEntryParams) (Entry, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateEntry

func (q *Queries) CreateEntry(ctx context.Context, arg CreateEntryParams) (Entry, error)

func (*Queries) DeleteEntry

func (q *Queries) DeleteEntry(ctx context.Context, id uuid.UUID) (Entry, error)

func (*Queries) GetEntries

func (q *Queries) GetEntries(ctx context.Context, arg GetEntriesParams) ([]Entry, error)

func (*Queries) GetEntriesByDomain

func (q *Queries) GetEntriesByDomain(ctx context.Context, domainsubstr string) ([]Entry, error)

func (*Queries) GetEntryByID

func (q *Queries) GetEntryByID(ctx context.Context, id uuid.UUID) (Entry, error)

func (*Queries) UpdateEntry

func (q *Queries) UpdateEntry(ctx context.Context, arg UpdateEntryParams) (Entry, error)

func (*Queries) WithTx

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

type UpdateEntryParams

type UpdateEntryParams struct {
	ID       uuid.UUID      `json:"id"`
	Login    sql.NullString `json:"login"`
	Password string         `json:"password"`
	Meta     sql.NullString `json:"meta"`
}

Jump to

Keyboard shortcuts

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