inline2

package
v0.0.0-...-c369810 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBQuerier

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

func NewQuerier

func NewQuerier(conn genericConn) *DBQuerier

NewQuerier creates a DBQuerier that implements Querier. conn is typically *pgx.Conn, pgx.Tx, or *pgxpool.Pool.

func (*DBQuerier) CountAuthors

func (q *DBQuerier) CountAuthors(ctx context.Context) (*int, error)

CountAuthors implements Querier.CountAuthors.

func (*DBQuerier) DeleteAuthorsByFullName

func (q *DBQuerier) DeleteAuthorsByFullName(ctx context.Context, params DeleteAuthorsByFullNameParams) (pgconn.CommandTag, error)

DeleteAuthorsByFullName implements Querier.DeleteAuthorsByFullName.

func (*DBQuerier) FindAuthorByID

func (q *DBQuerier) FindAuthorByID(ctx context.Context, authorID int32) (FindAuthorByIDRow, error)

FindAuthorByID implements Querier.FindAuthorByID.

func (*DBQuerier) InsertAuthor

func (q *DBQuerier) InsertAuthor(ctx context.Context, firstName string, lastName string) (int32, error)

InsertAuthor implements Querier.InsertAuthor.

func (*DBQuerier) WithTx

func (q *DBQuerier) WithTx(tx pgx.Tx) (*DBQuerier, error)

WithTx creates a new DBQuerier that uses the transaction to run all queries.

type DeleteAuthorsByFullNameParams

type DeleteAuthorsByFullNameParams struct {
	FirstName string `json:"FirstName"`
	LastName  string `json:"LastName"`
	Suffix    string `json:"Suffix"`
}

type FindAuthorByIDRow

type FindAuthorByIDRow struct {
	AuthorID  int32   `json:"author_id"`
	FirstName string  `json:"first_name"`
	LastName  string  `json:"last_name"`
	Suffix    *string `json:"suffix"`
}

type Querier

type Querier interface {
	// CountAuthors returns the number of authors (zero params).
	CountAuthors(ctx context.Context) (*int, error)

	// FindAuthorById finds one (or zero) authors by ID (one param).
	FindAuthorByID(ctx context.Context, authorID int32) (FindAuthorByIDRow, error)

	// InsertAuthor inserts an author by name and returns the ID (two params).
	InsertAuthor(ctx context.Context, firstName string, lastName string) (int32, error)

	// DeleteAuthorsByFullName deletes authors by the full name (three params).
	DeleteAuthorsByFullName(ctx context.Context, params DeleteAuthorsByFullNameParams) (pgconn.CommandTag, error)
}

Querier is a typesafe Go interface backed by SQL queries.

Jump to

Keyboard shortcuts

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