sqlc

package
v0.0.0-...-8c06897 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	ID      int64              `json:"id"`
	Front   string             `json:"front"`
	Back    string             `json:"back"`
	Know    bool               `json:"know"`
	TagsID  int32              `json:"tags_id"`
	AddTime pgtype.Timestamptz `json:"add_Time"`
}

type CreateCardsParams

type CreateCardsParams struct {
	Front  string `json:"front"`
	Back   string `json:"back"`
	TagsID int32  `json:"tags_id"`
}

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 ListCardsParams

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

type ListTagsParams

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

type Querier

type Querier interface {
	CreateCards(ctx context.Context, arg CreateCardsParams) (Card, error)
	CreateTags(ctx context.Context, name string) (Tag, error)
	DeleteCards(ctx context.Context, id int64) error
	DeleteTags(ctx context.Context, id int64) error
	GetAllCard(ctx context.Context) ([]Card, error)
	GetAllTags(ctx context.Context) ([]Tag, error)
	GetCard(ctx context.Context, id int64) (Card, error)
	GetCardByKnow(ctx context.Context, know bool) ([]Card, error)
	GetCardByTag(ctx context.Context, tagsID int32) ([]Card, error)
	GetTags(ctx context.Context, id int64) (Tag, error)
	ListCards(ctx context.Context, arg ListCardsParams) ([]Card, error)
	ListTags(ctx context.Context, arg ListTagsParams) ([]Tag, error)
	UpdateCards(ctx context.Context, arg UpdateCardsParams) (Card, error)
	UpdateKnowards(ctx context.Context, arg UpdateKnowardsParams) (Card, error)
	UpdateTags(ctx context.Context, arg UpdateTagsParams) (Tag, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateCards

func (q *Queries) CreateCards(ctx context.Context, arg CreateCardsParams) (Card, error)

func (*Queries) CreateTags

func (q *Queries) CreateTags(ctx context.Context, name string) (Tag, error)

func (*Queries) DeleteCards

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

func (*Queries) DeleteTags

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

func (*Queries) GetAllCard

func (q *Queries) GetAllCard(ctx context.Context) ([]Card, error)

func (*Queries) GetAllTags

func (q *Queries) GetAllTags(ctx context.Context) ([]Tag, error)

func (*Queries) GetCard

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

func (*Queries) GetCardByKnow

func (q *Queries) GetCardByKnow(ctx context.Context, know bool) ([]Card, error)

func (*Queries) GetCardByTag

func (q *Queries) GetCardByTag(ctx context.Context, tagsID int32) ([]Card, error)

func (*Queries) GetTags

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

func (*Queries) ListCards

func (q *Queries) ListCards(ctx context.Context, arg ListCardsParams) ([]Card, error)

func (*Queries) ListTags

func (q *Queries) ListTags(ctx context.Context, arg ListTagsParams) ([]Tag, error)

func (*Queries) UpdateCards

func (q *Queries) UpdateCards(ctx context.Context, arg UpdateCardsParams) (Card, error)

func (*Queries) UpdateKnowards

func (q *Queries) UpdateKnowards(ctx context.Context, arg UpdateKnowardsParams) (Card, error)

func (*Queries) UpdateTags

func (q *Queries) UpdateTags(ctx context.Context, arg UpdateTagsParams) (Tag, error)

func (*Queries) WithTx

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

type SQLStore

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

SQLStore provides all functions to execute SQL queries and transactions

type Store

type Store interface {
	Querier
}

Store defines all functions to execute db queries and transactions

func NewStore

func NewStore(connPool *pgxpool.Pool) Store

NewStore creates a new store

type Tag

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

type UpdateCardsParams

type UpdateCardsParams struct {
	ID     int64  `json:"id"`
	Front  string `json:"front"`
	Back   string `json:"back"`
	TagsID int32  `json:"tags_id"`
	Know   bool   `json:"know"`
}

type UpdateKnowardsParams

type UpdateKnowardsParams struct {
	ID   int64 `json:"id"`
	Know bool  `json:"know"`
}

type UpdateTagsParams

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

Jump to

Keyboard shortcuts

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