author

package
v0.0.0-...-ea11297 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 7 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.

func (*DBQuerier) ArrayAggFirstName

func (q *DBQuerier) ArrayAggFirstName(ctx context.Context, authorID int32) ([]string, error)

ArrayAggFirstName implements Querier.ArrayAggFirstName.

func (*DBQuerier) DeleteAuthors

func (q *DBQuerier) DeleteAuthors(ctx context.Context) (pgconn.CommandTag, error)

DeleteAuthors implements Querier.DeleteAuthors.

func (*DBQuerier) DeleteAuthorsByFirstName

func (q *DBQuerier) DeleteAuthorsByFirstName(ctx context.Context, firstName string) (pgconn.CommandTag, error)

DeleteAuthorsByFirstName implements Querier.DeleteAuthorsByFirstName.

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) FindAuthorNames

func (q *DBQuerier) FindAuthorNames(ctx context.Context, authorID int32) ([]FindAuthorNamesRow, error)

FindAuthorNames implements Querier.FindAuthorNames.

func (*DBQuerier) FindAuthors

func (q *DBQuerier) FindAuthors(ctx context.Context, firstName string) ([]FindAuthorsRow, error)

FindAuthors implements Querier.FindAuthors.

func (*DBQuerier) FindFirstNames

func (q *DBQuerier) FindFirstNames(ctx context.Context, authorID int32) ([]*string, error)

FindFirstNames implements Querier.FindFirstNames.

func (*DBQuerier) InsertAuthor

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

InsertAuthor implements Querier.InsertAuthor.

func (*DBQuerier) InsertAuthorSuffix

func (q *DBQuerier) InsertAuthorSuffix(ctx context.Context, params InsertAuthorSuffixParams) (InsertAuthorSuffixRow, error)

InsertAuthorSuffix implements Querier.InsertAuthorSuffix.

func (*DBQuerier) StringAggFirstName

func (q *DBQuerier) StringAggFirstName(ctx context.Context, authorID int32) (*string, error)

StringAggFirstName implements Querier.StringAggFirstName.

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 FindAuthorNamesRow

type FindAuthorNamesRow struct {
	FirstName *string `json:"first_name"`
	LastName  *string `json:"last_name"`
}

type FindAuthorsRow

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

type InsertAuthorSuffixParams

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

type InsertAuthorSuffixRow

type InsertAuthorSuffixRow 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 {
	// FindAuthorById finds one (or zero) authors by ID.
	FindAuthorByID(ctx context.Context, authorID int32) (FindAuthorByIDRow, error)

	// FindAuthors finds authors by first name.
	FindAuthors(ctx context.Context, firstName string) ([]FindAuthorsRow, error)

	// FindAuthorNames finds one (or zero) authors by ID.
	FindAuthorNames(ctx context.Context, authorID int32) ([]FindAuthorNamesRow, error)

	// FindFirstNames finds one (or zero) authors by ID.
	FindFirstNames(ctx context.Context, authorID int32) ([]*string, error)

	// DeleteAuthors deletes authors with a first name of "joe".
	DeleteAuthors(ctx context.Context) (pgconn.CommandTag, error)

	// DeleteAuthorsByFirstName deletes authors by first name.
	DeleteAuthorsByFirstName(ctx context.Context, firstName string) (pgconn.CommandTag, error)

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

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

	// InsertAuthorSuffix inserts an author by name and suffix and returns the
	// entire row.
	InsertAuthorSuffix(ctx context.Context, params InsertAuthorSuffixParams) (InsertAuthorSuffixRow, error)

	StringAggFirstName(ctx context.Context, authorID int32) (*string, error)

	ArrayAggFirstName(ctx context.Context, authorID int32) ([]string, error)
}

Querier is a typesafe Go interface backed by SQL queries.

type QueryName

type QueryName struct{}

Jump to

Keyboard shortcuts

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