Documentation
¶
Index ¶
- func PrepareAllQueries(ctx context.Context, p preparer) error
- type DBQuerier
- func (q *DBQuerier) GetContainersForSchedule(ctx context.Context, scheduleID uuid.UUID) ([]GetContainersForScheduleRow, error)
- func (q *DBQuerier) GetContainersForScheduleBatch(batch genericBatch, scheduleID uuid.UUID)
- func (q *DBQuerier) GetContainersForScheduleScan(results pgx.BatchResults) ([]GetContainersForScheduleRow, error)
- func (q *DBQuerier) GetCurrentScheduleForDevice(ctx context.Context, deviceID uuid.UUID) (GetCurrentScheduleForDeviceRow, error)
- func (q *DBQuerier) GetCurrentScheduleForDeviceBatch(batch genericBatch, deviceID uuid.UUID)
- func (q *DBQuerier) GetCurrentScheduleForDeviceScan(results pgx.BatchResults) (GetCurrentScheduleForDeviceRow, error)
- func (q *DBQuerier) GetDeviceByName(ctx context.Context, name *string) (GetDeviceByNameRow, error)
- func (q *DBQuerier) GetDeviceByNameBatch(batch genericBatch, name *string)
- func (q *DBQuerier) GetDeviceByNameScan(results pgx.BatchResults) (GetDeviceByNameRow, error)
- func (q *DBQuerier) WithTx(tx pgx.Tx) (*DBQuerier, error)
- type GetContainersForScheduleRow
- type GetCurrentScheduleForDeviceRow
- type GetDeviceByNameRow
- type Querier
- type QuerierConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepareAllQueries ¶
PrepareAllQueries executes a PREPARE statement for all pggen generated SQL queries in querier files. Typical usage is as the AfterConnect callback for pgxpool.Config
pgx will use the prepared statement if available. Calling PrepareAllQueries is an optional optimization to avoid a network round-trip the first time pgx runs a query if pgx statement caching is enabled.
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 NewQuerierConfig ¶
func NewQuerierConfig(conn genericConn, cfg QuerierConfig) *DBQuerier
NewQuerierConfig creates a DBQuerier that implements Querier with the given config. conn is typically *pgx.Conn, pgx.Tx, or *pgxpool.Pool.
func (*DBQuerier) GetContainersForSchedule ¶
func (q *DBQuerier) GetContainersForSchedule(ctx context.Context, scheduleID uuid.UUID) ([]GetContainersForScheduleRow, error)
GetContainersForSchedule implements Querier.GetContainersForSchedule.
func (*DBQuerier) GetContainersForScheduleBatch ¶
GetContainersForScheduleBatch implements Querier.GetContainersForScheduleBatch.
func (*DBQuerier) GetContainersForScheduleScan ¶
func (q *DBQuerier) GetContainersForScheduleScan(results pgx.BatchResults) ([]GetContainersForScheduleRow, error)
GetContainersForScheduleScan implements Querier.GetContainersForScheduleScan.
func (*DBQuerier) GetCurrentScheduleForDevice ¶
func (q *DBQuerier) GetCurrentScheduleForDevice(ctx context.Context, deviceID uuid.UUID) (GetCurrentScheduleForDeviceRow, error)
GetCurrentScheduleForDevice implements Querier.GetCurrentScheduleForDevice.
func (*DBQuerier) GetCurrentScheduleForDeviceBatch ¶
GetCurrentScheduleForDeviceBatch implements Querier.GetCurrentScheduleForDeviceBatch.
func (*DBQuerier) GetCurrentScheduleForDeviceScan ¶
func (q *DBQuerier) GetCurrentScheduleForDeviceScan(results pgx.BatchResults) (GetCurrentScheduleForDeviceRow, error)
GetCurrentScheduleForDeviceScan implements Querier.GetCurrentScheduleForDeviceScan.
func (*DBQuerier) GetDeviceByName ¶
GetDeviceByName implements Querier.GetDeviceByName.
func (*DBQuerier) GetDeviceByNameBatch ¶
GetDeviceByNameBatch implements Querier.GetDeviceByNameBatch.
func (*DBQuerier) GetDeviceByNameScan ¶
func (q *DBQuerier) GetDeviceByNameScan(results pgx.BatchResults) (GetDeviceByNameRow, error)
GetDeviceByNameScan implements Querier.GetDeviceByNameScan.
type GetContainersForScheduleRow ¶
type GetContainersForScheduleRow struct {
ID uuid.UUID `json:"id"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
Name *string `json:"name"`
ContainerImage *string `json:"container_image"`
Env []byte `json:"env"`
Privileged bool `json:"privileged"`
NetworkMode *string `json:"network_mode"`
Ports []byte `json:"ports"`
BindDev bool `json:"bind_dev"`
BindProc bool `json:"bind_proc"`
BindSys bool `json:"bind_sys"`
BindShm bool `json:"bind_shm"`
BindCgroup bool `json:"bind_cgroup"`
BindDockerSocket bool `json:"bind_docker_socket"`
BindBoot bool `json:"bind_boot"`
Command *string `json:"command"`
Entrypoint *string `json:"entrypoint"`
ScheduleID uuid.UUID `json:"schedule_id"`
}
type GetDeviceByNameRow ¶
type Querier ¶
type Querier interface {
GetCurrentScheduleForDevice(ctx context.Context, deviceID uuid.UUID) (GetCurrentScheduleForDeviceRow, error)
// GetCurrentScheduleForDeviceBatch enqueues a GetCurrentScheduleForDevice query into batch to be executed
// later by the batch.
GetCurrentScheduleForDeviceBatch(batch genericBatch, deviceID uuid.UUID)
// GetCurrentScheduleForDeviceScan scans the result of an executed GetCurrentScheduleForDeviceBatch query.
GetCurrentScheduleForDeviceScan(results pgx.BatchResults) (GetCurrentScheduleForDeviceRow, error)
GetContainersForSchedule(ctx context.Context, scheduleID uuid.UUID) ([]GetContainersForScheduleRow, error)
// GetContainersForScheduleBatch enqueues a GetContainersForSchedule query into batch to be executed
// later by the batch.
GetContainersForScheduleBatch(batch genericBatch, scheduleID uuid.UUID)
// GetContainersForScheduleScan scans the result of an executed GetContainersForScheduleBatch query.
GetContainersForScheduleScan(results pgx.BatchResults) ([]GetContainersForScheduleRow, error)
GetDeviceByName(ctx context.Context, name *string) (GetDeviceByNameRow, error)
// GetDeviceByNameBatch enqueues a GetDeviceByName query into batch to be executed
// later by the batch.
GetDeviceByNameBatch(batch genericBatch, name *string)
// GetDeviceByNameScan scans the result of an executed GetDeviceByNameBatch query.
GetDeviceByNameScan(results pgx.BatchResults) (GetDeviceByNameRow, error)
}
Querier is a typesafe Go interface backed by SQL queries.
Methods ending with Batch enqueue a query to run later in a pgx.Batch. After calling SendBatch on pgx.Conn, pgxpool.Pool, or pgx.Tx, use the Scan methods to parse the results.
type QuerierConfig ¶
type QuerierConfig struct {
// DataTypes contains pgtype.Value to use for encoding and decoding instead
// of pggen-generated pgtype.ValueTranscoder.
//
// If OIDs are available for an input parameter type and all of its
// transitive dependencies, pggen will use the binary encoding format for
// the input parameter.
DataTypes []pgtype.DataType
}