Documentation
¶
Index ¶
- type DBQuerier
- func (q *DBQuerier) EnumInsideComposite(ctx context.Context) (Device, error)
- func (q *DBQuerier) FindAllDevices(ctx context.Context) ([]FindAllDevicesRow, error)
- func (q *DBQuerier) FindManyDeviceArray(ctx context.Context) ([][]DeviceType, error)
- func (q *DBQuerier) FindManyDeviceArrayWithNum(ctx context.Context) ([]FindManyDeviceArrayWithNumRow, error)
- func (q *DBQuerier) FindOneDeviceArray(ctx context.Context) ([]DeviceType, error)
- func (q *DBQuerier) InsertDevice(ctx context.Context, mac net.HardwareAddr, typePg DeviceType) (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 ¶
NewQuerier creates a DBQuerier that implements Querier.
func (*DBQuerier) EnumInsideComposite ¶
EnumInsideComposite implements Querier.EnumInsideComposite.
func (*DBQuerier) FindAllDevices ¶
func (q *DBQuerier) FindAllDevices(ctx context.Context) ([]FindAllDevicesRow, error)
FindAllDevices implements Querier.FindAllDevices.
func (*DBQuerier) FindManyDeviceArray ¶
func (q *DBQuerier) FindManyDeviceArray(ctx context.Context) ([][]DeviceType, error)
FindManyDeviceArray implements Querier.FindManyDeviceArray.
func (*DBQuerier) FindManyDeviceArrayWithNum ¶
func (q *DBQuerier) FindManyDeviceArrayWithNum(ctx context.Context) ([]FindManyDeviceArrayWithNumRow, error)
FindManyDeviceArrayWithNum implements Querier.FindManyDeviceArrayWithNum.
func (*DBQuerier) FindOneDeviceArray ¶
func (q *DBQuerier) FindOneDeviceArray(ctx context.Context) ([]DeviceType, error)
FindOneDeviceArray implements Querier.FindOneDeviceArray.
func (*DBQuerier) InsertDevice ¶
func (q *DBQuerier) InsertDevice(ctx context.Context, mac net.HardwareAddr, typePg DeviceType) (pgconn.CommandTag, error)
InsertDevice implements Querier.InsertDevice.
type Device ¶
type Device struct {
Mac net.HardwareAddr `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 net.HardwareAddr `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)
InsertDevice(ctx context.Context, mac net.HardwareAddr, typePg DeviceType) (pgconn.CommandTag, error)
// Select an array of all device_type enum values.
FindOneDeviceArray(ctx context.Context) ([]DeviceType, error)
// Select many rows of device_type enum values.
FindManyDeviceArray(ctx context.Context) ([][]DeviceType, error)
// Select many rows of device_type enum values with multiple output columns.
FindManyDeviceArrayWithNum(ctx context.Context) ([]FindManyDeviceArrayWithNumRow, error)
// Regression test for https://github.com/robbert229/pggen/issues/23.
EnumInsideComposite(ctx context.Context) (Device, error)
}
Querier is a typesafe Go interface backed by SQL queries.
Click to show internal directories.
Click to hide internal directories.