Documentation ¶
Index ¶
- func Register(ctx context.Context, conn RegisterConn) error
- 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 net.HardwareAddr, 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 RegisterConn
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompositeUserRow ¶
type CompositeUserRow struct { Mac net.HardwareAddr `json:"mac"` Type DeviceType `json:"type"` User *User `json:"user"` }
type DBQuerier ¶
type DBQuerier struct {
// contains filtered or unexported fields
}
func NewQuerier ¶
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 net.HardwareAddr, 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 []net.HardwareAddr `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 net.HardwareAddr, owner int) (pgconn.CommandTag, error) }
Querier is a typesafe Go interface backed by SQL queries.
type RegisterConn ¶ added in v1.6.0
Click to show internal directories.
Click to hide internal directories.