database

package
v0.0.0-...-ff1555e Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(file string, remigrateCount int) error

Types

type AddTicketParams

type AddTicketParams struct {
	Title       string
	Description sql.NullString
}

type AddTicketRow

type AddTicketRow struct {
	ID   int64
	Rank int64
}

type Connection

type Connection interface {
	Querier
	BeginTransaction() (TransactionQuerier, error)
}

func Open

func Open(file string) (Connection, error)

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Querier

type Querier interface {
	AddTicket(ctx context.Context, arg AddTicketParams) (AddTicketRow, error)
	DeleteTicket(ctx context.Context, id int64) error
	GetTicketById(ctx context.Context, id int64) (Ticket, error)
	GetTickets(ctx context.Context) ([]Ticket, error)
	UpdateRank(ctx context.Context, arg UpdateRankParams) error
	UpdateStatus(ctx context.Context, arg UpdateStatusParams) error
	UpdateTicketContent(ctx context.Context, arg UpdateTicketContentParams) error
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddTicket

func (q *Queries) AddTicket(ctx context.Context, arg AddTicketParams) (AddTicketRow, error)

func (*Queries) DeleteTicket

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

func (*Queries) GetTicketById

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

func (*Queries) GetTickets

func (q *Queries) GetTickets(ctx context.Context) ([]Ticket, error)

func (*Queries) UpdateRank

func (q *Queries) UpdateRank(ctx context.Context, arg UpdateRankParams) error

func (*Queries) UpdateStatus

func (q *Queries) UpdateStatus(ctx context.Context, arg UpdateStatusParams) error

func (*Queries) UpdateTicketContent

func (q *Queries) UpdateTicketContent(ctx context.Context, arg UpdateTicketContentParams) error

func (*Queries) WithTx

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

type Ticket

type Ticket struct {
	ID          int64
	Status      string
	Title       string
	Description sql.NullString
	Rank        int64
}

type TransactionQuerier

type TransactionQuerier interface {
	Querier
	Commit() error
	Rollback() error
}

type UpdateRankParams

type UpdateRankParams struct {
	Rank int64
	ID   int64
}

type UpdateStatusParams

type UpdateStatusParams struct {
	Status string
	ID     int64
}

type UpdateTicketContentParams

type UpdateTicketContentParams struct {
	Title       string
	Description sql.NullString
	ID          int64
}

Jump to

Keyboard shortcuts

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