Documentation ¶
Index ¶
- type CompositeUserOneTwoColsRow
- type CompositeUserRow
- type DBQuerier
- func (q *DBQuerier) CompositeUser(ctx context.Context) ([]CompositeUserRow, error)
- func (q *DBQuerier) CompositeUserMany(ctx context.Context) ([]User, error)
- func (q *DBQuerier) CompositeUserOne(ctx context.Context) (User, error)
- func (q *DBQuerier) CompositeUserOneTwoCols(ctx context.Context) (CompositeUserOneTwoColsRow, error)
- func (q *DBQuerier) FindDevicesByUser(ctx context.Context, id int) ([]FindDevicesByUserRow, error)
- func (q *DBQuerier) InsertDevice(ctx context.Context, mac pgtype.Macaddr, owner int) (pgconn.CommandTag, error)
- func (q *DBQuerier) InsertUser(ctx context.Context, userID int, name string) (pgconn.CommandTag, error)
- type DeviceType
- type FindDevicesByUserRow
- type Querier
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompositeUserRow ¶
type CompositeUserRow struct { Mac pgtype.Macaddr `json:"mac"` Type DeviceType `json:"type"` User User `json:"user"` }
type DBQuerier ¶
type DBQuerier struct {
// contains filtered or unexported fields
}
func NewQuerier ¶
func NewQuerier(conn *pgx.Conn) *DBQuerier
NewQuerier creates a DBQuerier that implements Querier.
func (*DBQuerier) CompositeUser ¶
func (q *DBQuerier) CompositeUser(ctx context.Context) ([]CompositeUserRow, error)
CompositeUser implements Querier.CompositeUser.
func (*DBQuerier) CompositeUserMany ¶
CompositeUserMany implements Querier.CompositeUserMany.
func (*DBQuerier) CompositeUserOne ¶
CompositeUserOne implements Querier.CompositeUserOne.
func (*DBQuerier) CompositeUserOneTwoCols ¶
func (q *DBQuerier) CompositeUserOneTwoCols(ctx context.Context) (CompositeUserOneTwoColsRow, error)
CompositeUserOneTwoCols implements Querier.CompositeUserOneTwoCols.
func (*DBQuerier) FindDevicesByUser ¶
FindDevicesByUser implements Querier.FindDevicesByUser.
func (*DBQuerier) InsertDevice ¶
func (q *DBQuerier) InsertDevice(ctx context.Context, mac pgtype.Macaddr, owner int) (pgconn.CommandTag, error)
InsertDevice implements Querier.InsertDevice.
func (*DBQuerier) InsertUser ¶
func (q *DBQuerier) InsertUser(ctx context.Context, userID int, name string) (pgconn.CommandTag, error)
InsertUser implements Querier.InsertUser.
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 FindDevicesByUserRow ¶
type FindDevicesByUserRow struct { ID int `json:"id"` Name string `json:"name"` MacAddrs pgtype.MacaddrArray `json:"mac_addrs"` }
type Querier ¶
type Querier interface { FindDevicesByUser(ctx context.Context, id int) ([]FindDevicesByUserRow, error) CompositeUser(ctx context.Context) ([]CompositeUserRow, error) CompositeUserOne(ctx context.Context) (User, error) CompositeUserOneTwoCols(ctx context.Context) (CompositeUserOneTwoColsRow, error) CompositeUserMany(ctx context.Context) ([]User, error) InsertUser(ctx context.Context, userID int, name string) (pgconn.CommandTag, error) InsertDevice(ctx context.Context, mac pgtype.Macaddr, owner int) (pgconn.CommandTag, error) }
Querier is a typesafe Go interface backed by SQL queries.
Click to show internal directories.
Click to hide internal directories.