Documentation ¶
Index ¶
- Variables
- type Asset
- type AssetKind
- type Device
- type Flags
- type Kind
- type Manager
- type Relation
- type SQLStore
- func (s *SQLStore) CreateRelation(ctx context.Context, rel Relation) (err error)
- func (s *SQLStore) DeleteDeviceByID(ctx context.Context, deviceID uuid.UUID) (err error)
- func (s *SQLStore) DeleteRelation(ctx context.Context, rel Relation) (err error)
- func (s *SQLStore) FetchAllDevices(ctx context.Context) ([]Device, error)
- func (s *SQLStore) FetchAllRelations(ctx context.Context) (relations []Relation, err error)
- func (s *SQLStore) FetchClientRelations(ctx context.Context, groupID uuid.UUID) ([]Relation, error)
- func (s *SQLStore) FetchDeviceByID(ctx context.Context, groupID uuid.UUID) (Device, error)
- func (s *SQLStore) HasRelation(ctx context.Context, rel Relation) bool
- func (s *SQLStore) UpsertDevice(ctx context.Context, d Device) (_ Device, err error)
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidDeviceID = errors.New("device id is invalid") ErrDeviceNotFound = errors.New("device is not found") ErrRelationNotFound = errors.New("relation is not found") ErrRelationAlreadyExists = errors.New("relation already exists") ErrNilDatabase = errors.New("data is nil") ErrInvalidAssetID = errors.New("asset id is invalid") )
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { Name string `db:"name" json:"name"` ID uuid.UUID `db:"id" json:"id"` IMEI string `db:"imei" json:"imei"` MEID string `db:"meid" json:"meid"` SerialNumber string `db:"esn" json:"esn"` RegisteredAt time.Time `db:"registered_at" json:"registered_at"` ExpireAt time.Time `db:"expire_at" json:"expire_at"` Flags Flags `db:"flags" json:"flags"` // contains filtered or unexported fields }
Device represents
type SQLStore ¶
type SQLStore struct {
// contains filtered or unexported fields
}
func (*SQLStore) CreateRelation ¶
func (*SQLStore) DeleteDeviceByID ¶
func (*SQLStore) DeleteRelation ¶
func (*SQLStore) FetchAllDevices ¶
func (*SQLStore) FetchAllRelations ¶
func (*SQLStore) FetchClientRelations ¶
func (*SQLStore) FetchDeviceByID ¶
func (*SQLStore) HasRelation ¶
type Store ¶
type Store interface { UpsertDevice(ctx context.Context, d Device) (Device, error) CreateRelation(ctx context.Context, rel Relation) error HasRelation(ctx context.Context, rel Relation) bool FetchDeviceByID(ctx context.Context, deviceID uuid.UUID) (d Device, err error) FetchAllDevices(ctx context.Context) (ds []Device, err error) FetchAllRelations(ctx context.Context) ([]Relation, error) DeleteDeviceByID(ctx context.Context, deviceID uuid.UUID) error DeleteRelation(ctx context.Context, rel Relation) error }
func NewMemoryStore ¶
func NewMemoryStore() Store
Click to show internal directories.
Click to hide internal directories.