gen

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchCreateParams

type BatchCreateParams struct {
	ID         []string
	Title      []string
	Author     []string
	UpdateTime []int64
}

type Book

type Book struct {
	ID         string
	Title      string
	Author     string
	UpdateTime int64
}

type CreateParams

type CreateParams struct {
	ID         string
	Title      string
	Author     string
	UpdateTime int64
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) BatchCreate

func (q *Queries) BatchCreate(ctx context.Context, arg BatchCreateParams) (int64, error)

func (*Queries) Create

func (q *Queries) Create(ctx context.Context, arg CreateParams) error

func (*Queries) Delete

func (q *Queries) Delete(ctx context.Context, id string) error

func (*Queries) Get

func (q *Queries) Get(ctx context.Context, id string) (Book, error)

func (*Queries) List

func (q *Queries) List(ctx context.Context) ([]Book, error)

TODO: Edit this file to create your own queries. Just some contrived examples to get you started.

func (*Queries) Update

func (q *Queries) Update(ctx context.Context, arg UpdateParams) error

func (*Queries) Upsert

func (q *Queries) Upsert(ctx context.Context, arg UpsertParams) error

only update if the new value is newer

func (*Queries) WithTx

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

type UpdateParams

type UpdateParams struct {
	Title      string
	SetAuthor  bool
	Author     string
	UpdateTime int64
	ID         string
}

type UpsertParams

type UpsertParams struct {
	ID         string
	Title      string
	Author     string
	UpdateTime int64
}

Jump to

Keyboard shortcuts

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