db

package
v0.0.0-...-7a189be Latest Latest
Warning

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

Go to latest
Published: Dec 2, 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 CreateSheepParams

type CreateSheepParams struct {
	Name  string `json:"name"`
	Breed string `json:"breed"`
	Wool  Wool   `json:"wool"`
	Color string `json:"color"`
}

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 ListSheepsParams

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

type NullWool

type NullWool struct {
	Wool  Wool `json:"wool"`
	Valid bool `json:"valid"` // Valid is true if Wool is not NULL
}

func (*NullWool) Scan

func (ns *NullWool) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullWool) Value

func (ns NullWool) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateSheep

func (q *Queries) CreateSheep(ctx context.Context, arg CreateSheepParams) (Sheep, error)

func (*Queries) DeleteSheep

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

func (*Queries) GetSheep

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

func (*Queries) ListSheeps

func (q *Queries) ListSheeps(ctx context.Context, arg ListSheepsParams) ([]Sheep, error)

func (*Queries) UpdateSheep

func (q *Queries) UpdateSheep(ctx context.Context, arg UpdateSheepParams) (Sheep, error)

func (*Queries) WithTx

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

type Sheep

type Sheep struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	Breed     string    `json:"breed"`
	Wool      Wool      `json:"wool"`
	Color     string    `json:"color"`
	CreatedAt time.Time `json:"created_at"`
}

type UpdateSheepParams

type UpdateSheepParams struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

type Wool

type Wool string
const (
	WoolCarpet Wool = "carpet"
	WoolMedium Wool = "medium"
	WoolLong   Wool = "long"
	WoolFur    Wool = "fur"
	WoolFine   Wool = "fine"
)

func (*Wool) Scan

func (e *Wool) Scan(src interface{}) error

Jump to

Keyboard shortcuts

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