Documentation
¶
Index ¶
- Variables
- func Connection(ctx context.Context, pool *pgxpool.Pool) (*pgx.Conn, error)
- func DatabasePool(ctx context.Context, cfg Config, ping bool) (*pgxpool.Pool, error)
- func Ping(ctx context.Context, pool *pgxpool.Pool) error
- type Config
- type CreateDogParams
- type DBTX
- type Dog
- type Querier
- type Queries
- func (q *Queries) AllDogs(ctx context.Context) ([]Dog, error)
- func (q *Queries) CreateDog(ctx context.Context, arg CreateDogParams) (Dog, error)
- func (q *Queries) DeleteDog(ctx context.Context, name string) error
- func (q *Queries) ReadDog(ctx context.Context, name string) (Dog, error)
- func (q *Queries) UpdateDog(ctx context.Context, arg UpdateDogParams) (Dog, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type UpdateDogParams
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidConfig = errors.New("invalid configuration: missing required fields")
Functions ¶
func DatabasePool ¶
Decide to ping db on creating connection pool or not.
Types ¶
type Config ¶
type CreateDogParams ¶
type Dog ¶
type Dog struct { ID int64 `json:"id"` Name string `json:"name"` Breed string `json:"breed"` CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` }
type Querier ¶
type Querier interface { AllDogs(ctx context.Context) ([]Dog, error) CreateDog(ctx context.Context, arg CreateDogParams) (Dog, error) DeleteDog(ctx context.Context, name string) error ReadDog(ctx context.Context, name string) (Dog, error) UpdateDog(ctx context.Context, arg UpdateDogParams) (Dog, error) }
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
type UpdateDogParams ¶
Click to show internal directories.
Click to hide internal directories.