db

package
v0.0.0-...-21a936c Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTodoParams

type CreateTodoParams struct {
	Title       string `db:"title" json:"title"`
	IsCompleted bool   `db:"is_completed" json:"is_completed"`
}

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 ListTodosParams

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

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateTodo

func (q *Queries) CreateTodo(ctx context.Context, arg CreateTodoParams) (Todo, error)

func (*Queries) DeleteTodo

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

func (*Queries) GetTodo

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

func (*Queries) ListTodos

func (q *Queries) ListTodos(ctx context.Context, arg ListTodosParams) ([]Todo, error)

func (*Queries) UpdateTodo

func (q *Queries) UpdateTodo(ctx context.Context, arg UpdateTodoParams) (Todo, error)

func (*Queries) WithTx

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

type Todo

type Todo struct {
	ID          int64  `db:"id" json:"id"`
	Title       string `db:"title" json:"title"`
	IsCompleted bool   `db:"is_completed" json:"is_completed"`
}

type UpdateTodoParams

type UpdateTodoParams struct {
	Title       string `db:"title" json:"title"`
	IsCompleted bool   `db:"is_completed" json:"is_completed"`
	ID          int64  `db:"id" json:"id"`
}

Jump to

Keyboard shortcuts

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