You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
825 B
24 lines
825 B
package models
|
|
|
|
import "context"
|
|
|
|
// A Bridge is a device or service that holds lights.
|
|
type Bridge struct {
|
|
ID int `json:"id" db:"id"`
|
|
Name string `json:"name" db:"name"`
|
|
Driver string `json:"driver" db:"driver"`
|
|
Addr string `json:"addr" db:"addr"`
|
|
InternalID string `json:"-" db:"internal_id"`
|
|
Key []byte `json:"-" db:"key"`
|
|
}
|
|
|
|
// BridgeRepository is an interface for all database operations
|
|
// the Bridge model makes.
|
|
type BridgeRepository interface {
|
|
FindByID(ctx context.Context, id int) (Bridge, error)
|
|
List(ctx context.Context) ([]Bridge, error)
|
|
ListByDriver(ctx context.Context, driver string) ([]Bridge, error)
|
|
Insert(ctx context.Context, bridge Bridge) (Bridge, error)
|
|
Update(ctx context.Context, bridge Bridge) error
|
|
Remove(ctx context.Context, bridge Bridge) error
|
|
}
|