Documentation
¶
Index ¶
- type DBQuerier
- func (q *DBQuerier) EnumInsideComposite(ctx context.Context) (Device, error)
- func (q *DBQuerier) EnumInsideCompositeBatch(batch genericBatch)
- func (q *DBQuerier) EnumInsideCompositeScan(results pgx.BatchResults) (Device, error)
- func (q *DBQuerier) FindAllDevices(ctx context.Context) ([]FindAllDevicesRow, error)
- func (q *DBQuerier) FindAllDevicesBatch(batch genericBatch)
- func (q *DBQuerier) FindAllDevicesScan(results pgx.BatchResults) ([]FindAllDevicesRow, error)
- func (q *DBQuerier) FindManyDeviceArray(ctx context.Context) ([][]DeviceType, error)
- func (q *DBQuerier) FindManyDeviceArrayBatch(batch genericBatch)
- func (q *DBQuerier) FindManyDeviceArrayScan(results pgx.BatchResults) ([][]DeviceType, error)
- func (q *DBQuerier) FindManyDeviceArrayWithNum(ctx context.Context) ([]FindManyDeviceArrayWithNumRow, error)
- func (q *DBQuerier) FindManyDeviceArrayWithNumBatch(batch genericBatch)
- func (q *DBQuerier) FindManyDeviceArrayWithNumScan(results pgx.BatchResults) ([]FindManyDeviceArrayWithNumRow, error)
- func (q *DBQuerier) FindOneDeviceArray(ctx context.Context) ([]DeviceType, error)
- func (q *DBQuerier) FindOneDeviceArrayBatch(batch genericBatch)
- func (q *DBQuerier) FindOneDeviceArrayScan(results pgx.BatchResults) ([]DeviceType, error)
- func (q *DBQuerier) InsertDevice(ctx context.Context, mac pgtype.Macaddr, typePg DeviceType) (pgconn.CommandTag, error)
- func (q *DBQuerier) InsertDeviceBatch(batch genericBatch, mac pgtype.Macaddr, typePg DeviceType)
- func (q *DBQuerier) InsertDeviceScan(results pgx.BatchResults) (pgconn.CommandTag, error)
- type Device
- type DeviceType
- type FindAllDevicesRow
- type FindManyDeviceArrayWithNumRow
- type Querier
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) EnumInsideComposite ¶
EnumInsideComposite implements Querier.EnumInsideComposite.
func (*DBQuerier) EnumInsideCompositeBatch ¶
func (q *DBQuerier) EnumInsideCompositeBatch(batch genericBatch)
EnumInsideCompositeBatch implements Querier.EnumInsideCompositeBatch.
func (*DBQuerier) EnumInsideCompositeScan ¶
EnumInsideCompositeScan implements Querier.EnumInsideCompositeScan.
func (*DBQuerier) FindAllDevices ¶
func (q *DBQuerier) FindAllDevices(ctx context.Context) ([]FindAllDevicesRow, error)
FindAllDevices implements Querier.FindAllDevices.
func (*DBQuerier) FindAllDevicesBatch ¶
func (q *DBQuerier) FindAllDevicesBatch(batch genericBatch)
FindAllDevicesBatch implements Querier.FindAllDevicesBatch.
func (*DBQuerier) FindAllDevicesScan ¶
func (q *DBQuerier) FindAllDevicesScan(results pgx.BatchResults) ([]FindAllDevicesRow, error)
FindAllDevicesScan implements Querier.FindAllDevicesScan.
func (*DBQuerier) FindManyDeviceArray ¶
func (q *DBQuerier) FindManyDeviceArray(ctx context.Context) ([][]DeviceType, error)
FindManyDeviceArray implements Querier.FindManyDeviceArray.
func (*DBQuerier) FindManyDeviceArrayBatch ¶
func (q *DBQuerier) FindManyDeviceArrayBatch(batch genericBatch)
FindManyDeviceArrayBatch implements Querier.FindManyDeviceArrayBatch.
func (*DBQuerier) FindManyDeviceArrayScan ¶
func (q *DBQuerier) FindManyDeviceArrayScan(results pgx.BatchResults) ([][]DeviceType, error)
FindManyDeviceArrayScan implements Querier.FindManyDeviceArrayScan.
func (*DBQuerier) FindManyDeviceArrayWithNum ¶
func (q *DBQuerier) FindManyDeviceArrayWithNum(ctx context.Context) ([]FindManyDeviceArrayWithNumRow, error)
FindManyDeviceArrayWithNum implements Querier.FindManyDeviceArrayWithNum.
func (*DBQuerier) FindManyDeviceArrayWithNumBatch ¶
func (q *DBQuerier) FindManyDeviceArrayWithNumBatch(batch genericBatch)
FindManyDeviceArrayWithNumBatch implements Querier.FindManyDeviceArrayWithNumBatch.
func (*DBQuerier) FindManyDeviceArrayWithNumScan ¶
func (q *DBQuerier) FindManyDeviceArrayWithNumScan(results pgx.BatchResults) ([]FindManyDeviceArrayWithNumRow, error)
FindManyDeviceArrayWithNumScan implements Querier.FindManyDeviceArrayWithNumScan.
func (*DBQuerier) FindOneDeviceArray ¶
func (q *DBQuerier) FindOneDeviceArray(ctx context.Context) ([]DeviceType, error)
FindOneDeviceArray implements Querier.FindOneDeviceArray.
func (*DBQuerier) FindOneDeviceArrayBatch ¶
func (q *DBQuerier) FindOneDeviceArrayBatch(batch genericBatch)
FindOneDeviceArrayBatch implements Querier.FindOneDeviceArrayBatch.
func (*DBQuerier) FindOneDeviceArrayScan ¶
func (q *DBQuerier) FindOneDeviceArrayScan(results pgx.BatchResults) ([]DeviceType, error)
FindOneDeviceArrayScan implements Querier.FindOneDeviceArrayScan.
func (*DBQuerier) InsertDevice ¶
func (q *DBQuerier) InsertDevice(ctx context.Context, mac pgtype.Macaddr, typePg DeviceType) (pgconn.CommandTag, error)
InsertDevice implements Querier.InsertDevice.
func (*DBQuerier) InsertDeviceBatch ¶
func (q *DBQuerier) InsertDeviceBatch(batch genericBatch, mac pgtype.Macaddr, typePg DeviceType)
InsertDeviceBatch implements Querier.InsertDeviceBatch.
func (*DBQuerier) InsertDeviceScan ¶
func (q *DBQuerier) InsertDeviceScan(results pgx.BatchResults) (pgconn.CommandTag, error)
InsertDeviceScan implements Querier.InsertDeviceScan.
type Device ¶
type Device struct { Mac pgtype.Macaddr `json:"mac"` Type DeviceType `json:"type"` }
Device represents the Postgres composite type "device".
type DeviceType ¶
type DeviceType string
DeviceType represents the Postgres enum "device_type".
const ( DeviceTypeUndefined DeviceType = "undefined" DeviceTypePhone DeviceType = "phone" DeviceTypeLaptop DeviceType = "laptop" DeviceTypeIpad DeviceType = "ipad" DeviceTypeDesktop DeviceType = "desktop" DeviceTypeIot DeviceType = "iot" )
func (DeviceType) String ¶
func (d DeviceType) String() string
type FindAllDevicesRow ¶
type FindAllDevicesRow struct { Mac pgtype.Macaddr `json:"mac"` Type DeviceType `json:"type"` }
type FindManyDeviceArrayWithNumRow ¶
type FindManyDeviceArrayWithNumRow struct { Num *int32 `json:"num"` DeviceTypes []DeviceType `json:"device_types"` }
type Querier ¶
type Querier interface { FindAllDevices(ctx context.Context) ([]FindAllDevicesRow, error) // FindAllDevicesBatch enqueues a FindAllDevices query into batch to be executed // later by the batch. FindAllDevicesBatch(batch genericBatch) // FindAllDevicesScan scans the result of an executed FindAllDevicesBatch query. FindAllDevicesScan(results pgx.BatchResults) ([]FindAllDevicesRow, error) InsertDevice(ctx context.Context, mac pgtype.Macaddr, typePg DeviceType) (pgconn.CommandTag, error) // InsertDeviceBatch enqueues a InsertDevice query into batch to be executed // later by the batch. InsertDeviceBatch(batch genericBatch, mac pgtype.Macaddr, typePg DeviceType) // InsertDeviceScan scans the result of an executed InsertDeviceBatch query. InsertDeviceScan(results pgx.BatchResults) (pgconn.CommandTag, error) // Select an array of all device_type enum values. FindOneDeviceArray(ctx context.Context) ([]DeviceType, error) // FindOneDeviceArrayBatch enqueues a FindOneDeviceArray query into batch to be executed // later by the batch. FindOneDeviceArrayBatch(batch genericBatch) // FindOneDeviceArrayScan scans the result of an executed FindOneDeviceArrayBatch query. FindOneDeviceArrayScan(results pgx.BatchResults) ([]DeviceType, error) // Select many rows of device_type enum values. FindManyDeviceArray(ctx context.Context) ([][]DeviceType, error) // FindManyDeviceArrayBatch enqueues a FindManyDeviceArray query into batch to be executed // later by the batch. FindManyDeviceArrayBatch(batch genericBatch) // FindManyDeviceArrayScan scans the result of an executed FindManyDeviceArrayBatch query. FindManyDeviceArrayScan(results pgx.BatchResults) ([][]DeviceType, error) // Select many rows of device_type enum values with multiple output columns. FindManyDeviceArrayWithNum(ctx context.Context) ([]FindManyDeviceArrayWithNumRow, error) // FindManyDeviceArrayWithNumBatch enqueues a FindManyDeviceArrayWithNum query into batch to be executed // later by the batch. FindManyDeviceArrayWithNumBatch(batch genericBatch) // FindManyDeviceArrayWithNumScan scans the result of an executed FindManyDeviceArrayWithNumBatch query. FindManyDeviceArrayWithNumScan(results pgx.BatchResults) ([]FindManyDeviceArrayWithNumRow, error) // Regression test for https://github.com/mbark/pggen/issues/23. EnumInsideComposite(ctx context.Context) (Device, error) // EnumInsideCompositeBatch enqueues a EnumInsideComposite query into batch to be executed // later by the batch. EnumInsideCompositeBatch(batch genericBatch) // EnumInsideCompositeScan scans the result of an executed EnumInsideCompositeBatch query. EnumInsideCompositeScan(results pgx.BatchResults) (Device, 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.