relationDB

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

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", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{
			"startDate": {Sql: "?>=date", ValNum: 1, Type: "date"},
			"endDate":   {Sql: "?<=date", ValNum: 1, Type: "date"},
		}},
		{IsFilterTenant: 1, IsFilterProject: 1, IsFilterArea: 2, Code: "dmDeviceCount", Type: "table", Table: "dm_device_info", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{
			"areas": {Sql: "area_id in ?", ValNum: 1, Type: "array"},
		}},
		{IsFilterTenant: 2, IsFilterProject: 2, IsFilterArea: 2, Code: "sysOpsWorkOrder", Type: "table", Table: "sys_ops_work_order", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
		{IsFilterTenant: 2, IsFilterProject: 2, IsFilterArea: 2, Code: "sysUserAreaApply", Type: "table", Table: "sys_user_area_apply", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
		{IsFilterTenant: 1, IsFilterProject: 2, IsFilterArea: 2, Code: "dmDeviceCountDistributor", Type: "table", Table: "dm_device_info", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{
			"areas": {Sql: "area_id in ?", ValNum: 1, Type: "array"},
		}},
		{IsFilterTenant: 2, IsFilterProject: 2, IsFilterArea: 2, Code: "dmProductCount", Type: "table", Table: "dm_product_info", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
		{IsFilterTenant: 1, IsFilterProject: 2, IsFilterArea: 2, Code: "saleDistributorCount", Type: "table", Table: "sale_distributor_info", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
		{IsFilterTenant: 1, IsFilterProject: 2, IsFilterArea: 2, Code: "saleDistributorApplyCount", Type: "table", Table: "sale_distributor_apply", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
		{IsFilterTenant: 1, IsFilterProject: 2, IsFilterArea: 2, Code: "saleDistributorWaterCount", Type: "table", Table: "sale_distributor_water", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
		{IsFilterTenant: 1, IsFilterProject: 2, IsFilterArea: 2, Code: "sysUserInfo", Type: "table", Table: "sys_user_info", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
		{IsFilterTenant: 1, IsFilterProject: 2, IsFilterArea: 2, Code: "saleOrderInfoCount", Type: "table", Table: "sale_order_info", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
		{IsFilterTenant: 1, IsFilterProject: 2, IsFilterArea: 2, Code: "sysOperLog", Type: "table", Table: "sys_oper_log", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
		{IsFilterTenant: 1, IsFilterProject: 2, IsFilterArea: 2, Code: "sysLoginLog", Type: "table", Table: "sys_login_log", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
		{IsFilterTenant: 2, IsFilterProject: 2, IsFilterArea: 2, Code: "dmDeviceMsgCount", Type: "table", Table: "dm_device_msg_count", Omits: "created_time,updated_time", OrderBy: "created_time desc", Filter: map[string]FilterKeywords{}},
	}
)

Functions

func Migrate

func Migrate(c conf.Database) (err error)

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;"`                      //是否转换为驼峰,入参转换为下划线
	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) Delete

func (p ExampleRepo) Delete(ctx context.Context, id int64) 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 FilterKeywords struct {
	Sql    string `json:"sql"`
	ValNum int64  `json:"valNum"` //问号的数量
	Type   string `json:"type"`   //time:时间类型时间戳 date: 日期类型的字符串
}

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 (StatisticsInfoRepo) FindOne

func (StatisticsInfoRepo) FindOneByFilter

func (StatisticsInfoRepo) Insert

func (StatisticsInfoRepo) MultiInsert

func (p StatisticsInfoRepo) MultiInsert(ctx context.Context, data []*DataStatisticsInfo) error

批量插入 LightStrategyDevice 记录

func (StatisticsInfoRepo) Update

Jump to

Keyboard shortcuts

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