Documentation ¶
Index ¶
- Constants
- type Account
- type App
- type AppV2
- type Bank
- type BankRecord
- type DB
- func (d *DB) App(id string) (*App, error)
- func (d *DB) CreateDeviceRecord(t *DeviceRecord) error
- func (d *DB) Device(id string) (*Device, error)
- func (d *DB) ScannedBlockNumber() (uint64, error)
- func (d *DB) UpdateByID(id string, values map[string]any) error
- func (d *DB) UpsertApp(projectID uint64, name string, key [32]byte, value []byte) error
- func (d *DB) UpsertDevice(t *Device) error
- func (d *DB) UpsertScannedBlockNumber(number uint64) error
- type Device
- type DeviceRecord
- type Message
- type OperationTimes
- type Task
Constants ¶
View Source
const ( BankRecodeDeposit int32 = iota BankRecodeWithdraw BankRecodePaid )
View Source
const ( CREATED int32 = iota PROPOSAL CONFIRM )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID string `gorm:"primary_key"` Name string `gorm:"not null"` Avatar string `gorm:"not null"` OperationTimes }
type App ¶
type AppV2 ¶
type AppV2 struct { ID string `gorm:"primary_key"` Slug string `gorm:"not null;default:''"` Logo string `gorm:"not null;default:''"` Author string `gorm:"not null;default:''"` Status string `gorm:"not null;default:''"` Content string `gorm:"not null;default:''"` Data string `gorm:"not null;default:'{}'"` Previews string `gorm:"not null;default:'[]'"` Date string `gorm:"not null;default:''"` CreatedAt string `gorm:"not null;default:''"` UpdatedAt string `gorm:"not null;default:''"` URI string `gorm:"not null;default:''"` Category int32 `gorm:"not null;default:0"` DirectLink string `gorm:"not null;default:''"` Order int32 `gorm:"not null;default:0"` Firmware string `gorm:"not null;default:''"` OperationTimes }
type Bank ¶
type Bank struct { Address string `gorm:"primary_key"` Balance string `gorm:"not null;default:'0'"` OperationTimes }
type BankRecord ¶
type BankRecord struct { ID string `gorm:"primary_key"` From string `gorm:"not null;default:''"` To string `gorm:"not null;default:''"` Amount string `gorm:"not null;default:''"` Timestamp int64 `gorm:"not null;default:0"` Type int32 `gorm:"not null;default:0"` OperationTimes }
func (*BankRecord) TableName ¶
func (*BankRecord) TableName() string
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) CreateDeviceRecord ¶
func (d *DB) CreateDeviceRecord(t *DeviceRecord) error
func (*DB) ScannedBlockNumber ¶
func (*DB) UpsertDevice ¶
func (*DB) UpsertScannedBlockNumber ¶
type Device ¶
type Device struct { ID string `gorm:"primary_key"` Name string `gorm:"not null;default:''"` Owner string `gorm:"not null;default:''"` Address string `gorm:"not null;default:''"` Avatar string `gorm:"not null;default:''"` Status int32 `gorm:"not null;default:0"` Proposer string `gorm:"not null;default:''"` Firmware string `gorm:"not null;default:''"` Config string `gorm:"not null;default:''"` TotalGas int32 `gorm:"not null;default:0"` BulkUpload int32 `gorm:"not null;default:0"` DataChannel int32 `gorm:"not null;default:0"` UploadPeriod int32 `gorm:"not null;default:0"` BulkUploadSamplingCnt int32 `gorm:"not null;default:0"` BulkUploadSamplingFreq int32 `gorm:"not null;default:0"` Beep int32 `gorm:"not null;default:0"` RealFirmware string `gorm:"not null;default:''"` State int32 `gorm:"not null;default:0"` Type int32 `gorm:"not null;default:0"` Configurable bool `gorm:"not null;default:0;default:true"` OperationTimes }
type DeviceRecord ¶
type DeviceRecord struct { ID string `gorm:"primary_key"` Imei string `gorm:"index:device_record_imei;not null"` Operator string `gorm:"not null"` Snr string `gorm:"not null;type:numeric(10,2);default:0"` Vbat string `gorm:"not null;type:numeric(10,2);default:0"` GasResistance string `gorm:"not null;type:numeric(10,2);default:0"` Temperature string `gorm:"not null;type:numeric(10,2);default:0"` Temperature2 string `gorm:"not null;type:numeric(10,2);default:0"` Pressure string `gorm:"not null;type:numeric(10,2);default:0"` Humidity string `gorm:"not null;type:numeric(10,2);default:0"` Light string `gorm:"not null;type:numeric(10,2);default:0"` Gyroscope string `gorm:"not null;default:''"` Accelerometer string `gorm:"not null;default:''"` Latitude string `gorm:"not null;default:0"` Longitude string `gorm:"not null;default:0"` Signature string `gorm:"not null;default:''"` Timestamp int64 `gorm:"index:device_record_timestamp;not null;default:0"` OperationTimes }
func (*DeviceRecord) TableName ¶
func (*DeviceRecord) TableName() string
type Message ¶
type Message struct { gorm.Model MessageID string `gorm:"index:message_id,not null"` ClientID string `gorm:"index:message_fetch,not null,default:''"` ProjectID uint64 `gorm:"index:message_fetch,not null"` ProjectVersion string `gorm:"index:message_fetch,not null,default:'0.0'"` Data []byte `gorm:"size:4096"` InternalTaskID string `gorm:"index:internal_task_id,not null,default:''"` }
type OperationTimes ¶
type OperationTimes struct { CreatedAt time.Time `gorm:"not null"` UpdatedAt time.Time `gorm:"not null"` }
func NewOperationTimes ¶
func NewOperationTimes() OperationTimes
Click to show internal directories.
Click to hide internal directories.