repositoty

package
v0.0.0-...-3a1fd7c Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(host, port, user, password, dbname string) (*sql.DB, error)

Open opens a database specified by the data source name. Format: host=foo port=5432 user=bar password=baz dbname=qux sslmode=disable"

func StringPtrToNullString

func StringPtrToNullString(s *string) sql.NullString

StringPtrToNullString converts *string to sql.NullString.

Types

type Repository

type Repository interface {
	// agent queries
	CreateAgent(ctx context.Context, arg sqlc.CreateAgentParams) (sqlc.Agent, error)
	DeleteAgent(ctx context.Context, id int64) (sqlc.Agent, error)
	GetAgent(ctx context.Context, id int64) (sqlc.Agent, error)
	ListAgents(ctx context.Context) ([]sqlc.Agent, error)
	UpdateAgent(ctx context.Context, arg sqlc.UpdateAgentParams) (sqlc.Agent, error)
	ListAgentsByAuthorIDs(ctx context.Context, authorIDs []int64) ([]sqlc.ListAgentsByAuthorIDsRow, error)

	// author queries
	CreateAuthor(ctx context.Context, arg sqlc.CreateAuthorParams) (sqlc.Author, error)
	DeleteAuthor(ctx context.Context, id int64) (sqlc.Author, error)
	GetAuthor(ctx context.Context, id int64) (sqlc.Author, error)
	ListAuthors(ctx context.Context) ([]sqlc.Author, error)
	UpdateAuthor(ctx context.Context, arg sqlc.UpdateAuthorParams) (sqlc.Author, error)
	ListAuthorsByAgentIDs(ctx context.Context, agentIDs []int64) ([]sqlc.Author, error)
	ListAuthorsByBookIDs(ctx context.Context, bookIDs []int64) ([]sqlc.ListAuthorsByBookIDsRow, error)

	// book queries
	CreateBook(ctx context.Context, bookArg sqlc.CreateBookParams, authorIDs []int64) (*sqlc.Book, error)
	UpdateBook(ctx context.Context, bookArg sqlc.UpdateBookParams, authorIDs []int64) (*sqlc.Book, error)
	DeleteBook(ctx context.Context, id int64) (sqlc.Book, error)
	GetBook(ctx context.Context, id int64) (sqlc.Book, error)
	ListBooks(ctx context.Context) ([]sqlc.Book, error)
	ListBooksByAuthorIDs(ctx context.Context, authorIDs []int64) ([]sqlc.ListBooksByAuthorIDsRow, error)
}

Repository is the application's data layer functionality.

func NewRepository

func NewRepository(db *sql.DB) Repository

NewRepository returns an implementation of the Repository interface.

Jump to

Keyboard shortcuts

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