def

package
v0.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderAes  = iota //从久到近排序
	OrderDesc        //时间从近到久排序
)
View Source
const (
	GatewayBind   = 1 //绑定
	GatewayUnbind = 2 //解绑
)
View Source
const (
	True  = 1 //是
	False = 2 //否
)
View Source
const (
	Enable  = 1 //启用
	Disable = 2 //禁用
)
View Source
const (
	Male   = 1 //男性
	Female = 2 //女鞋
)
View Source
const DeviceGroupLevel = 3
View Source
const Unknown = 0

Variables

View Source
var LogLevelTextToIntMap = map[string]LogLevel{
	"关闭": LogClose,
	"错误": LogError,
	"告警": LogWarn,
	"信息": LogInfo,
	"调试": LogDebug,
}
View Source
var SystemCoordinate = CoordinateSystemBaidu //默认坐标系

Functions

func ToBool

func ToBool[boolType constraints.Integer](in boolType) bool

func ToIntBool

func ToIntBool[boolType constraints.Integer](in bool) boolType

Types

type AuthMode

type AuthMode = int64
const (
	AuthModePwd  AuthMode = 1 //账密认证
	AuthModeCert AuthMode = 2 //证书认证
)

type AutoReg

type AutoReg = int64
const (
	AutoRegClose AutoReg = 1 //关闭
	AutoRegOpen  AutoReg = 2 //打开
	AutoRegAuto  AutoReg = 3 //打开并自动创建设备
)

type CoordinateSystem added in v0.5.1

type CoordinateSystem string
const (
	CoordinateSystemEarth CoordinateSystem = "WGS84" //GPS坐标系:地球系
	CoordinateSystemMars  CoordinateSystem = "GCJ02" //GPS坐标系:火星系
	CoordinateSystemBaidu CoordinateSystem = "BD09"  //GPS坐标系:百度系
)

type DataProto

type DataProto = int64
const (
	DataProtoCustom   DataProto = 1 //自定义
	DataProtoTemplate DataProto = 2 //数据模板
)

type DeviceStatus added in v0.3.0

type DeviceStatus = int64
const (
	DeviceStatusInactive DeviceStatus = 0 // 未激活
	DeviceStatusOnline   DeviceStatus = 1 //在线
	DeviceStatusOffline  DeviceStatus = 2 //离线
)

type DeviceType

type DeviceType = int64
const (
	DeviceTypeDevice  DeviceType = 1 //设备
	DeviceTypeGateway DeviceType = 2 //网关
	DeviceTypeSubset  DeviceType = 3 //子设备
)

type LogLevel

type LogLevel = int64
const (
	LogClose LogLevel = 1 //关闭
	LogError LogLevel = 2 //错误
	LogWarn  LogLevel = 3 //告警
	LogInfo  LogLevel = 4 //信息
	LogDebug LogLevel = 5 //调试
)

type Net

type Net = int64
const (
	NetOther Net = 1 //其他
	NetWifi  Net = 2 //wi-fi
	NetG234  Net = 3 //2G/3G/4G
	NetG5    Net = 4 //5G
	NetBle   Net = 5 //蓝牙
	NetLora  Net = 6 //LoRaWAN
)

type Opt

type Opt = int64
const (
	OptAdd    Opt = 0 //增加
	OptModify Opt = 1 //修改
	OptDel    Opt = 2 //删除
)

type OrderBy added in v0.5.1

type OrderBy struct {
	Filed string `json:"filed" form:"filed"` //要排序的字段名
	Sort  int64  `json:"sort" form:"sort"`   //排序的方式:0 OrderAes、1 OrderDesc
}

排序结构体

type PageInfo

type PageInfo struct {
	Page   int64     `json:"page" form:"page"`         // 页码
	Size   int64     `json:"pageSize" form:"pageSize"` // 每页大小
	Orders []OrderBy `json:"orderBy" form:"orderBy"`   // 排序信息
}

func (*PageInfo) GetLimit

func (p *PageInfo) GetLimit() int64

func (*PageInfo) GetOffset

func (p *PageInfo) GetOffset() int64

func (*PageInfo) GetOrders added in v0.5.1

func (p *PageInfo) GetOrders() (arr []string)

获取排序参数

func (*PageInfo) ToGorm added in v0.6.0

func (p *PageInfo) ToGorm(db *gorm.DB) *gorm.DB

type PageInfo2

type PageInfo2 struct {
	TimeStart int64     `json:"timeStart"`
	TimeEnd   int64     `json:"timeEnd"`
	Page      int64     `json:"page" form:"page"`       // 页码
	Size      int64     `json:"size" form:"size"`       // 每页大小
	Orders    []OrderBy `json:"orderBy" form:"orderBy"` // 排序信息
}

func (PageInfo2) FmtSql

func (p PageInfo2) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder

func (PageInfo2) FmtWhere

func (p PageInfo2) FmtWhere(sql sq.SelectBuilder) sq.SelectBuilder

func (PageInfo2) GetLimit

func (p PageInfo2) GetLimit() int64

func (PageInfo2) GetOffset

func (p PageInfo2) GetOffset() int64

func (PageInfo2) GetTimeEnd

func (p PageInfo2) GetTimeEnd() time.Time

func (PageInfo2) GetTimeStart

func (p PageInfo2) GetTimeStart() time.Time

type Point added in v0.5.1

type Point struct {
	CoordinateSystem CoordinateSystem `json:"coordinateSystem,omitempty"` //坐标系:WGS84(地球系),GCJ02(火星系),BD09(百度系)<br/>参考解释:https://www.cnblogs.com/bigroc/p/16423120.html
	Longitude        float64          `json:"longitude,range=[0:180]"`    //经度
	Latitude         float64          `json:"latitude,range=[0:90]"`      //纬度
}

坐标,

type RoleID added in v0.5.1

type RoleID int64
const (
	RoleIDSuper RoleID = 1
)

type TimeRange added in v0.4.1

type TimeRange struct {
	Start int64
	End   int64
}

func (TimeRange) FmtSql added in v0.4.1

func (t TimeRange) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL