model

package
v0.0.0-...-82e8c21 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: MIT Imports: 6 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 {
	UserID pgtype.UUID `json:"user_id"`
	Title  string      `json:"title"`
	Note   pgtype.Text `json:"note"`
}

func NewCreateTodoParams

func NewCreateTodoParams(userID pgtype.UUID, title string, note pgtype.Text) *CreateTodoParams

type CreateTodoRow

type CreateTodoRow struct {
	ID    pgtype.UUID `json:"id"`
	Title string      `json:"title"`
	Note  pgtype.Text `json:"note"`
}

type CustomValidator

type CustomValidator struct {
	Validator *validator.Validate
}

func (*CustomValidator) Validate

func (cv *CustomValidator) Validate(i interface{}) error

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 ListTodosRow

type ListTodosRow struct {
	ID        pgtype.UUID        `json:"id"`
	Title     string             `json:"title"`
	Note      pgtype.Text        `json:"note"`
	Done      bool               `json:"done"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}

type Queries

type Queries struct {
}

func New

func New() *Queries

func (*Queries) AcquireConnection

func (q *Queries) AcquireConnection(ctx context.Context, pool *pgxpool.Pool, userID pgtype.UUID) (*pgxpool.Conn, error)

func (*Queries) CreateTodo

func (q *Queries) CreateTodo(ctx context.Context, db DBTX, arg CreateTodoParams) (*CreateTodoRow, error)

func (*Queries) DoneTodo

func (q *Queries) DoneTodo(ctx context.Context, db DBTX, id pgtype.UUID) error

func (*Queries) ListTodos

func (q *Queries) ListTodos(ctx context.Context, db DBTX) ([]*ListTodosRow, error)

func (*Queries) TruncateAllTables

func (q *Queries) TruncateAllTables(ctx context.Context, db DBTX) error

func (*Queries) UpdateTodo

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

type Todo

type Todo struct {
	ID        pgtype.UUID        `json:"id"`
	UserID    pgtype.UUID        `json:"user_id"`
	Title     string             `json:"title"`
	Note      pgtype.Text        `json:"note"`
	Done      bool               `json:"done"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}

type UpdateTodoParams

type UpdateTodoParams struct {
	ID    pgtype.UUID `json:"id"`
	Title string      `json:"title"`
	Note  pgtype.Text `json:"note"`
}

Jump to

Keyboard shortcuts

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