Documentation ¶
Index ¶
- Variables
- func Migrate(c conf.Database) (err error)
- type DataExample
- type DataStatisticsInfo
- type ExampleFilter
- type ExampleRepo
- func (p ExampleRepo) CountByFilter(ctx context.Context, f ExampleFilter) (size int64, err error)
- func (p ExampleRepo) Delete(ctx context.Context, id int64) error
- func (p ExampleRepo) DeleteByFilter(ctx context.Context, f ExampleFilter) error
- func (p ExampleRepo) FindByFilter(ctx context.Context, f ExampleFilter, page *stores.PageInfo) ([]*DataExample, error)
- func (p ExampleRepo) FindOne(ctx context.Context, id int64) (*DataExample, error)
- func (p ExampleRepo) FindOneByFilter(ctx context.Context, f ExampleFilter) (*DataExample, error)
- func (p ExampleRepo) Insert(ctx context.Context, data *DataExample) error
- func (p ExampleRepo) MultiInsert(ctx context.Context, data []*DataExample) error
- func (p ExampleRepo) Update(ctx context.Context, data *DataExample) error
- type FilterKeywords
- type StatisticsInfoFilter
- type StatisticsInfoRepo
- func (p StatisticsInfoRepo) CountByFilter(ctx context.Context, f StatisticsInfoFilter) (size int64, err error)
- func (p StatisticsInfoRepo) Delete(ctx context.Context, id int64) error
- func (p StatisticsInfoRepo) DeleteByFilter(ctx context.Context, f StatisticsInfoFilter) error
- func (p StatisticsInfoRepo) FindByFilter(ctx context.Context, f StatisticsInfoFilter, page *stores.PageInfo) ([]*DataStatisticsInfo, error)
- func (p StatisticsInfoRepo) FindOne(ctx context.Context, id int64) (*DataStatisticsInfo, error)
- func (p StatisticsInfoRepo) FindOneByFilter(ctx context.Context, f StatisticsInfoFilter) (*DataStatisticsInfo, error)
- func (p StatisticsInfoRepo) Insert(ctx context.Context, data *DataStatisticsInfo) error
- func (p StatisticsInfoRepo) MultiInsert(ctx context.Context, data []*DataStatisticsInfo) error
- func (p StatisticsInfoRepo) Update(ctx context.Context, data *DataStatisticsInfo) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MigrateStatisticsInfo = []DataStatisticsInfo{ { IsFilterTenant: 1, IsFilterProject: 1, IsFilterArea: 1, Code: "dmDevicePower", Type: "table", Table: "data_dm_device_power", Omits: "created_time,updated_time", IsToHump: 1, Sql: "", OrderBy: "", Filter: map[string]FilterKeywords{ "startDate": { Sql: "?>=date", ValNum: 1, Type: "date", }, "endDate": { Sql: "?<=date", ValNum: 1, Type: "date", }, }, }, { IsFilterTenant: 1, IsFilterProject: 1, IsFilterArea: 1, Code: "dmDeviceCount", Type: "table", Table: "dm_device_info", Omits: "created_time,updated_time", IsToHump: 1, Sql: "", OrderBy: "", Filter: map[string]FilterKeywords{ "startDate": { Sql: "?>=date", ValNum: 1, Type: "date", }, "endDate": { Sql: "?<=date", ValNum: 1, Type: "date", }, }, }, } )
Functions ¶
Types ¶
type DataExample ¶
type DataExample struct {
ID int64 `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"` // id编号
}
示例
type DataStatisticsInfo ¶
type DataStatisticsInfo struct { ID int64 `gorm:"column:id;type:BIGINT;primary_key;AUTO_INCREMENT"` // 编号 IsFilterTenant int64 `gorm:"column:is_filter_tenant;type:BIGINT;default:1;"` //是否要过滤租户 IsFilterProject int64 `gorm:"column:is_filter_project;type:BIGINT;default:1;"` //是否要过滤项目1 是 2 否 IsFilterArea int64 `gorm:"column:is_filter_area;type:BIGINT;default:1;"` //是否要过滤区域 FilterRoles string `gorm:"column:filter_roles;type:VARCHAR(120);default:'';"` //是否要过滤区域 IsSoftDelete int64 `gorm:"column:is_soft_delete;type:BIGINT;default:1;"` //是否是软删除,是的话会默认加过滤 Code string `gorm:"column:code;type:VARCHAR(120);not null;uniqueIndex:key"` //查询的code Type string `gorm:"column:type;type:VARCHAR(120);not null"` //查询的类别: sql:sql模板替换查询 table: 直接查表 Table string `gorm:"column:table;type:VARCHAR(120);default:''"` //table类型查询的表名 Omits string `gorm:"column:omits;type:VARCHAR(120);default:''"` //忽略的字段列表,table类型需要 IsToHump int64 `gorm:"column:is_to_hump;type:BIGINT;default:1;NOT NULL"` //是否转换为驼峰,入参转换为下划线 Sql string `gorm:"column:sql;type:VARCHAR(2000);default:''"` //sql类型的sql内容 OrderBy string `gorm:"column:order_by;type:VARCHAR(120);default:'created_time desc'"` //排序 Filter map[string]FilterKeywords `gorm:"column:filter;type:json;serializer:json;NOT NULL;default:'{}'"` FilterSlotCode string `gorm:"column:filter_slot_code;type:VARCHAR(120);default:''"` //第三方过滤插槽code stores.NoDelTime DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:key"` }
func (*DataStatisticsInfo) TableName ¶
func (m *DataStatisticsInfo) TableName() string
type ExampleFilter ¶
type ExampleFilter struct { }
type ExampleRepo ¶
type ExampleRepo struct {
// contains filtered or unexported fields
}
func NewExampleRepo ¶
func NewExampleRepo(in any) *ExampleRepo
func (ExampleRepo) CountByFilter ¶
func (p ExampleRepo) CountByFilter(ctx context.Context, f ExampleFilter) (size int64, err error)
func (ExampleRepo) DeleteByFilter ¶
func (p ExampleRepo) DeleteByFilter(ctx context.Context, f ExampleFilter) error
func (ExampleRepo) FindByFilter ¶
func (p ExampleRepo) FindByFilter(ctx context.Context, f ExampleFilter, page *stores.PageInfo) ([]*DataExample, error)
func (ExampleRepo) FindOne ¶
func (p ExampleRepo) FindOne(ctx context.Context, id int64) (*DataExample, error)
func (ExampleRepo) FindOneByFilter ¶
func (p ExampleRepo) FindOneByFilter(ctx context.Context, f ExampleFilter) (*DataExample, error)
func (ExampleRepo) Insert ¶
func (p ExampleRepo) Insert(ctx context.Context, data *DataExample) error
func (ExampleRepo) MultiInsert ¶
func (p ExampleRepo) MultiInsert(ctx context.Context, data []*DataExample) error
批量插入 LightStrategyDevice 记录
func (ExampleRepo) Update ¶
func (p ExampleRepo) Update(ctx context.Context, data *DataExample) error
type FilterKeywords ¶
type StatisticsInfoFilter ¶
type StatisticsInfoFilter struct {
Code string
}
type StatisticsInfoRepo ¶
type StatisticsInfoRepo struct {
// contains filtered or unexported fields
}
func NewStatisticsInfoRepo ¶
func NewStatisticsInfoRepo(in any) *StatisticsInfoRepo
func (StatisticsInfoRepo) CountByFilter ¶
func (p StatisticsInfoRepo) CountByFilter(ctx context.Context, f StatisticsInfoFilter) (size int64, err error)
func (StatisticsInfoRepo) Delete ¶
func (p StatisticsInfoRepo) Delete(ctx context.Context, id int64) error
func (StatisticsInfoRepo) DeleteByFilter ¶
func (p StatisticsInfoRepo) DeleteByFilter(ctx context.Context, f StatisticsInfoFilter) error
func (StatisticsInfoRepo) FindByFilter ¶
func (p StatisticsInfoRepo) FindByFilter(ctx context.Context, f StatisticsInfoFilter, page *stores.PageInfo) ([]*DataStatisticsInfo, error)
func (StatisticsInfoRepo) FindOne ¶
func (p StatisticsInfoRepo) FindOne(ctx context.Context, id int64) (*DataStatisticsInfo, error)
func (StatisticsInfoRepo) FindOneByFilter ¶
func (p StatisticsInfoRepo) FindOneByFilter(ctx context.Context, f StatisticsInfoFilter) (*DataStatisticsInfo, error)
func (StatisticsInfoRepo) Insert ¶
func (p StatisticsInfoRepo) Insert(ctx context.Context, data *DataStatisticsInfo) error
func (StatisticsInfoRepo) MultiInsert ¶
func (p StatisticsInfoRepo) MultiInsert(ctx context.Context, data []*DataStatisticsInfo) error
批量插入 LightStrategyDevice 记录
func (StatisticsInfoRepo) Update ¶
func (p StatisticsInfoRepo) Update(ctx context.Context, data *DataStatisticsInfo) error
Click to show internal directories.
Click to hide internal directories.