Versions in this module Expand all Collapse all v1 v1.0.0 Jan 22, 2026 Changes in this version + var ErrKindMismatch = errors.New("kind mismatch") + func EnsureRootUser(db *gorm.DB) error + func Migrate(db *gorm.DB) error + type Array struct + CreatedAt time.Time + Name string + Site Site + SiteID string + UUID string + UpdatedAt time.Time + func (Array) TableName() string + type AuditLog struct + Action string + CreatedAt time.Time + Detail string + ID uint + IP string + Method string + Path string + Resource string + UserAgent string + UserID uint + Username string + func (AuditLog) TableName() string + type AuthToken struct + CreatedAt time.Time + ExpiresAt *time.Time + ID uint + IdleTimeoutSeconds int + IssuedAt time.Time + JTI string + LastSeenAt *time.Time + Name string + RevokedAt *time.Time + RevokedBy *uint + Type TokenType + UpdatedAt time.Time + User User + UserID uint + type Base struct + CreatedAt time.Time + DeletedAt gorm.DeletedAt + ID string + UpdatedAt time.Time + func (b *Base) BeforeCreate(tx *gorm.DB) error + type Channel struct + AddrStart bool + BackupTCPIPAddr string + BackupTCPPort uint16 + DebugExpiry time.Time + DebugLog bool + Delay time.Duration + Disable bool + Downgrade bool + Endianness uint + OnnectTimeout time.Duration + PhysicalLink string + Plugin string + RetryInterval time.Duration + RetryMax uint64 + SendInterval time.Duration + Status InstanceStatus + TCPIPAddr string + TCPPort uint16 + VerifyHeader bool + WordOrder uint + func GetDefaultChannelRow(device, device2 string) *Channel + func (Channel) TableName() string + func (c *Channel) AfterCreate(tx *gorm.DB) error + func (c *Channel) AfterDelete(tx *gorm.DB) error + func (c *Channel) AfterSave(tx *gorm.DB) error + func (c *Channel) AfterUpdate(tx *gorm.DB) error + func (c *Channel) BeforeCreate(tx *gorm.DB) error + func (c *Channel) BeforeDelete(tx *gorm.DB) error + func (c *Channel) BeforeSave(tx *gorm.DB) error + func (c *Channel) BeforeUpdate(tx *gorm.DB) error + type DeveltypePointBase struct + Address uint16 + ByteOrder string + DataType string + Desc string + Disable bool + Gain float64 + Name string + NameCn string + Offset float64 + PointType string + Quantity uint32 + RW string + Unit string + type Device struct + ChannelID string + DevicePlugin string + DeviceType string + Disable bool + Endpoint string + Model string + Name string + PollIntervalMs int + SN string + SlaveID uint + SoftwareVersion string + Transport string + func (Device) TableName() string + type DeviceState struct + Online bool + type DeviceTypePoint struct + Index uint + Model string + TypeKey string + func (DeviceTypePoint) TableName() string + type Goose struct + DebugExpiry time.Time + DebugLog bool + Delay time.Duration + Disable bool + Downgrade bool + OnnectTimeout time.Duration + Plugin string + RetryInterval time.Duration + RetryMax uint64 + Status InstanceStatus + TCPIPAddr string + TCPPort uint16 + func (Goose) TableName() string + func (c *Goose) AfterCreate(tx *gorm.DB) error + func (c *Goose) AfterDelete(tx *gorm.DB) error + func (c *Goose) AfterSave(tx *gorm.DB) error + func (c *Goose) AfterUpdate(tx *gorm.DB) error + func (c *Goose) BeforeCreate(tx *gorm.DB) error + func (c *Goose) BeforeDelete(tx *gorm.DB) error + func (c *Goose) BeforeSave(tx *gorm.DB) error + func (c *Goose) BeforeUpdate(tx *gorm.DB) error + type InstanceStatus struct + BytesReceived uint64 + BytesSent uint64 + CurrentDelay time.Duration + Linking bool + PointsErrorRead uint64 + PointsToalRead uint64 + Working bool + type Kind uint8 + const KindBitMask + const KindBool + const KindBytes + const KindFloat32 + const KindFloat64 + const KindInvalid + const KindSint16 + const KindSint32 + const KindSint64 + const KindString + const KindUint16 + const KindUint32 + const KindUint64 + func ParseKind(s string) (Kind, error) + func (k Kind) String() string + type LogrusLogger struct + Log *logrus.Entry + LogLevel logger.LogLevel + SlowThreshold time.Duration + func NewLogrusLogger(log *logrus.Logger) *LogrusLogger + func (l *LogrusLogger) Error(ctx context.Context, msg string, args ...interface{}) + func (l *LogrusLogger) Info(ctx context.Context, msg string, args ...interface{}) + func (l *LogrusLogger) LogMode(level logger.LogLevel) logger.Interface + func (l *LogrusLogger) Trace(ctx context.Context, begin time.Time, ...) + func (l *LogrusLogger) Warn(ctx context.Context, msg string, args ...interface{}) + type MQTT struct + CreatedAt time.Time + DebugExpiry time.Time + DebugLog bool + Delay time.Duration + Disable bool + Downgrade bool + ID string + OnnectTimeout time.Duration + Plugin string + RetryInterval time.Duration + RetryMax uint64 + Status InstanceStatus + TCPIPAddr string + TCPPort uint16 + UpdatedAt time.Time + func (MQTT) TableName() string + func (c *MQTT) AfterCreate(tx *gorm.DB) error + func (c *MQTT) AfterDelete(tx *gorm.DB) error + func (c *MQTT) AfterSave(tx *gorm.DB) error + func (c *MQTT) AfterUpdate(tx *gorm.DB) error + func (c *MQTT) BeforeCreate(tx *gorm.DB) error + func (c *MQTT) BeforeDelete(tx *gorm.DB) error + func (c *MQTT) BeforeSave(tx *gorm.DB) error + func (c *MQTT) BeforeUpdate(tx *gorm.DB) error + type ModelInfo struct + DefaultPreloads []string + StructType reflect.Type + Table string + type ModelOpt func(*ModelInfo) + func WithDefaultPreloads(paths ...string) ModelOpt + type QueryOpt func(*queryOptions) + func WithPreloads(paths ...string) QueryOpt + func WithScopes(scopes ...func(*gorm.DB) *gorm.DB) QueryOpt + type RegAccess string + const RegRO + const RegRW + const RegWO + type RegType string + const RegCoil + const RegDiscrete + const RegHolding + const RegInput + type Registry struct + func NewRegistry() *Registry + func (r *Registry) FindByTablePK(ctx context.Context, db *gorm.DB, table string, pkValue any) (any, error) + func (r *Registry) FindByTablePKValue(ctx context.Context, db *gorm.DB, table string, pkValue any) (any, error) + func (r *Registry) FindByTablePKWith(ctx context.Context, db *gorm.DB, table string, pkValue any, qopts ...QueryOpt) (any, error) + func (r *Registry) Register(db *gorm.DB, model any, opts ...ModelOpt) error + type Scalar struct + Kind Kind + Raw []byte + func (s *Scalar) IsZero() bool + func (s *Scalar) Reset() + func (s *Scalar) Scan(src any) error + func (s *Scalar) SetBool(v bool) + func (s *Scalar) SetBytes(v []byte) + func (s *Scalar) SetFloat32(v float32) + func (s *Scalar) SetFloat64(v float64) + func (s *Scalar) SetSint16(v int16) + func (s *Scalar) SetSint32(v int32) + func (s *Scalar) SetSint64(v int64) + func (s *Scalar) SetString(v string) + func (s *Scalar) SetUint16(v uint16) + func (s *Scalar) SetUint32(v uint32) + func (s *Scalar) SetUint64(v uint64) + func (s *Scalar) UnmarshalJSON(b []byte) error + func (s Scalar) Bool() (bool, error) + func (s Scalar) Bytes() ([]byte, error) + func (s Scalar) Equal(other Scalar) bool + func (s Scalar) Float32() (float32, error) + func (s Scalar) Float64() (float64, error) + func (s Scalar) MarshalJSON() ([]byte, error) + func (s Scalar) Sint16() (int16, error) + func (s Scalar) Sint32() (int32, error) + func (s Scalar) Sint64() (int64, error) + func (s Scalar) String() (string, error) + func (s Scalar) Uint16() (uint16, error) + func (s Scalar) Uint32() (uint32, error) + func (s Scalar) Uint64() (uint64, error) + func (s Scalar) Value() (driver.Value, error) + type ScalarJSON []byte + func (j *ScalarJSON) Scan(src any) error + func (j ScalarJSON) Value() (driver.Value, error) + type Serial struct + CreatedAt time.Time + DataBits uint + DebugExpiry time.Time + DebugLog bool + Delay time.Duration + Device string + Device2 string + Disable bool + Downgrade bool + Endianness uint + ID string + OnnectTimeout time.Duration + Parity uint + PhysicalLink string + Plugin string + RetryInterval time.Duration + RetryMax uint64 + SendInterval time.Duration + Speed uint + Status InstanceStatus + StopBits uint + UpdatedAt time.Time + VerifyHeader bool + WordOrder uint + func GetDefaultSerialRow(device, device2 string) *Serial + func (Serial) TableName() string + func (c *Serial) AfterCreate(tx *gorm.DB) error + func (c *Serial) AfterDelete(tx *gorm.DB) error + func (c *Serial) AfterSave(tx *gorm.DB) error + func (c *Serial) AfterUpdate(tx *gorm.DB) error + func (c *Serial) BeforeCreate(tx *gorm.DB) error + func (c *Serial) BeforeDelete(tx *gorm.DB) error + func (c *Serial) BeforeSave(tx *gorm.DB) error + func (c *Serial) BeforeUpdate(tx *gorm.DB) error + type Setting struct + CreatedAt time.Time + ID string + Name string + UpdatedAt time.Time + ValueJSON ScalarJSON + ValueType string + func (Setting) TableName() string + func (s *Setting) BeforeCreate(tx *gorm.DB) error + type Site struct + CreatedAt time.Time + GridConTime time.Time + Name string + Power uint64 + Store uint64 + UUID string + UpdatedAt time.Time + func (Site) TableName() string + type TokenType string + const TokenTypeAPI + const TokenTypeWeb + type User struct + CreatedAt time.Time + ID uint + IsRoot bool + LastLogin *time.Time + PasswordHash string + UpdatedAt time.Time + Username string + func (User) TableName() string