news

package
v0.0.0-...-bc15ebc Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateParams

type CreateParams struct {
	Content  string      `json:"content"`
	Category pgtype.Text `json:"category"`
}

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 News

type News struct {
	ID       int64            `json:"id"`
	Content  string           `json:"content"`
	Category pgtype.Text      `json:"category"`
	CreateAt pgtype.Timestamp `json:"create_at"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) Create

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

func (*Queries) Delete

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

func (*Queries) Get

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

func (*Queries) GetMany

func (q *Queries) GetMany(ctx context.Context) ([]News, error)

func (*Queries) Update

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

func (*Queries) WithTx

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

type UpdateParams

type UpdateParams struct {
	ID       int64       `json:"id"`
	Content  string      `json:"content"`
	Category pgtype.Text `json:"category"`
}

Jump to

Keyboard shortcuts

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