Versions in this module Expand all Collapse all v1 v1.2.1 Oct 12, 2023 v1.2.0 Mar 18, 2023 v1.1.0 Dec 9, 2021 v1.0.1 Jan 15, 2019 v1.0.0 Jan 15, 2019 Changes in this version + const TransactionKey + const UserKey + var DeviceEventLocation = EventLocation + func CreateCreatedEvent(ctx context.Context, id int64, el EventLocation, c *CreatedContent) (eventID int64, err error) + func CreateDevice(ctx context.Context, device *Device) (id int64, err error) + func CreateEvent(ctx context.Context, id int64, el EventLocation, event *Event) (eventID int64, err error) + func CreateModel(ctx context.Context, model *Model) (id int64, err error) + func CreateModifiedEvent(ctx context.Context, id int64, el EventLocation, c *ModifiedContent) (eventID int64, err error) + func CreateNoteEvent(ctx context.Context, id int64, el EventLocation, note string) (eventID int64, err error) + func CreateUser(ctx context.Context, user *User) (id int64, err error) + func CreateUserWithCredentials(ctx context.Context, email, password, name string) (id int64, err error) + func UpdateDevice(ctx context.Context, device *Device) error + func UpdateModel(ctx context.Context, model *Model) error + func UpdateUser(ctx context.Context, user *User) error + func ValidateString(field, value string, max int) error + type CreatedContent struct + Fields []*CreatedField + type CreatedField struct + Model *Model + Name string + Value interface{} + type Device struct + Events []*Event + ID int64 + Location Location + Model *Model + ModelID int64 + SerialNumber string + Status Status + func QueryDevice(ctx context.Context, ...) ([]*Device, error) + func ReadDevice(ctx context.Context, id int64, includeEvents bool) (*Device, error) + func ReadDeviceBySerialNumber(ctx context.Context, serialNumber string, includeEvents bool) (*Device, error) + func SimpleQueryDevice(ctx context.Context, search string) ([]*Device, error) + func (d *Device) ReadModel(ctx context.Context) (*Model, error) + func (d *Device) Validate(ctx context.Context) error + type Error struct + Description string + DuplicateID int64 + Err error + Type ErrorType + func (e *Error) Error() string + type ErrorType int + const ErrorTypeDuplicate + const ErrorTypeServer + const ErrorTypeUser + type Event struct + Content interface{} + Date time.Time + ID int64 + Type string + User *User + UserID int64 + func ReadEvents(ctx context.Context, id int64, el EventLocation) ([]*Event, error) + type EventLocation struct + IDField string + Table string + Type string + type Location string + func ReadLocations(ctx context.Context) ([]Location, error) + func (s *Location) Scan(value interface{}) error + func (s Location) Value() (driver.Value, error) + type Model struct + ID int64 + Manufacturer string + Model string + func QueryModel(ctx context.Context, manufacturer, model string) ([]*Model, error) + func ReadModel(ctx context.Context, id int64) (*Model, error) + func ReadModelByManufacturerAndModel(ctx context.Context, manufacturer, model string) (*Model, error) + func (m *Model) Validate() error + type ModifiedContent struct + Fields []*ModifiedField + type ModifiedField struct + Name string + NewModel *Model + NewValue interface{} + OldModel *Model + OldValue interface{} + type NoteContent struct + Note string + type Stats struct + DeviceCount int + Devices []*Device + LocationCount int + Locations []*StatsLocation + ModelCount int + Models []*StatsModel + Statuses []*StatsStatus + func ReadStats(ctx context.Context) (*Stats, error) + type StatsLocation struct + Count int + Location string + type StatsModel struct + Count int + ID int64 + Manufacturer string + Model string + type StatsStatus struct + Count int + Status string + type Status string + func ReadStatuses(ctx context.Context) ([]Status, error) + func (s *Status) Scan(value interface{}) error + func (s Status) Value() (driver.Value, error) + type User struct + Email string + Hash []byte + ID int64 + Name string + func ReadUser(ctx context.Context, id int64) (*User, error) + func ReadUserByEmail(ctx context.Context, email string) (*User, error) + func (u *User) Authenticate(ctx context.Context, password string) error + func (u *User) ChangePassword(ctx context.Context, oldPassword, newPassword string) error + func (u *User) Validate() error