model

package
v0.0.0-...-9337120 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

应用启动引擎层

Index

Constants

View Source
const (
	UserReportType  = 1
	EventReportType = 2
	Debug           = 1
	Release         = 0
)

Variables

View Source
var CmdName string

Functions

func Count

func Count(curd Curd) (count int, err error)

func DownloadConfigFile

func DownloadConfigFile(fname string) (err error)

下载配置文件

func SearchList

func SearchList(curd Curd, page, limit int, columns string, list interface{}) (err error)

Types

type App

type App struct {
	Page       uint64 `json:"page" db:"-"`
	Limit      uint64 `json:"limit" db:"-"`
	IsClose    *int   `db:"is_close" json:"is_close"`
	Id         int    `db:"id" json:"id"`
	CreateBy   int    `db:"create_by" json:"create_by"`
	UpdateBy   int    `db:"update_by" json:"update_by"`
	SaveMonth  int    `db:"save_mouth" json:"save_mouth"`
	AppName    string `db:"app_name" json:"app_name"`
	Descibe    string `db:"descibe" json:"descibe"`
	AppId      string `db:"app_id" json:"app_id"`
	AppKey     string `db:"app_key" json:"app_key"`
	CreateTime string `db:"create_time" json:"create_time"`
	UpdateTime string `db:"update_time" json:"update_time"`
	AppManager string `db:"app_manager" json:"app_manager"`
}

type BatchConfig

type BatchConfig struct {
	BufferSize    int `json:"bufferSize"`
	FlushInterval int `json:"flushInterval"`
}

type ClickHouseConfig

type ClickHouseConfig struct {
	Username             string `json:"username"`
	Pwd                  string `json:"pwd"`
	IP                   string `json:"ip"`
	Port                 string `json:"port"`
	DbName               string `json:"dbName"`
	MaxOpenConns         int    `json:"maxOpenConns"`
	MaxIdleConns         int    `json:"maxIdleConns"`
	MacrosShardKeyName   string `json:"macrosShardKeyName"`
	MacrosReplicaKeyName string `json:"macrosReplicaKeyName"`
	ClusterName          string `json:"clusterName"`
}

type Config

type Config struct {
	Manager ManagerConfig `json:"manager"`
	Report  ReportConfig  `json:"report"`
	Sinker  SinkerConfig  `json:"sinker"`
	Comm    struct {
		Log        LogConfig        `json:"log"`
		Mysql      MysqlConfig      `json:"mysql"`
		ClickHouse ClickHouseConfig `json:"clickhouse"`
		Kafka      KafkaCfg         `json:"kafka"`
		Redis      RedisConfig      `json:"redis"`
	} `json:"comm"`
}

全局配置结构体

var GlobConfig Config

func (*Config) GetCkQueryExpiration

func (this *Config) GetCkQueryExpiration() int

func (*Config) GetCkQueryLimit

func (this *Config) GetCkQueryLimit() int

func (*Config) GetKafkaCfgProducerType

func (this *Config) GetKafkaCfgProducerType() string

type Curd

type Curd interface {
	ProcessSqlWhere(sqlA db.SelectBuilder) db.SelectBuilder
	TableName() string
	ProcessSqlInsert(sqlA db.InsertBuilder) db.InsertBuilder
	ProcessSqlUpdate(id int, sqlA db.UpdateBuilder) db.UpdateBuilder
}

type DebugDevice

type DebugDevice struct {
	Id         int    `db:"id" json:"id"`
	Appid      int    `db:"appid" json:"appid"`
	DeviceId   string `db:"device_id" json:"device_id"`
	Remark     string `db:"remark" json:"remark"`
	CreateBy   int    `db:"create_by" json:"create_by"`
	CreateTime string `db:"create_time" json:"create_time"`
}

type EventData

type EventData struct {
	AccountId       string                 `json:"xwl_account_id"`
	XwlDistinctId   string                 `json:"xwl_distinct_id"`
	XwlUserId       string                 `json:"xwl_user_id"`
	XwlPartEvent    string                 `json:"xwl_part_event"`
	XwlPartDate     string                 `json:"xwl_part_date"`
	XwlMpPlatform   string                 `json:"xwl_mp_platform"`
	XwlLibVersion   string                 `json:"xwl_lib_version"`
	XwlOs           string                 `json:"xwl_os"`
	XwlScreenWidth  string                 `json:"xwl_screen_width"`
	XwlCountryCode  string                 `json:"xwl_country_code"`
	XwlScreenHeight string                 `json:"xwl_screen_height"`
	XwlDeviceId     string                 `json:"xwl_device_id"`
	XwlNetworkType  string                 `json:"xwl_network_type"`
	XwlDeviceModel  string                 `json:"xwl_device_model"`
	XwlCity         string                 `json:"xwl_city"`
	XwlProvince     string                 `json:"xwl_province"`
	XwlLib          string                 `json:"xwl_lib"`
	XwlScene        string                 `json:"xwl_scene"`
	XwlManufacturer string                 `json:"xwl_manufacturer"`
	XwlOsVersion    string                 `json:"xwl_os_version"`
	XwlKafkaOffset  int64                  `json:"xwl_kafka_offset"`
	XwlIp           string                 `json:"xwl_ip"`
	TableId         string                 `json:"table_id"`
	Properties      map[string]interface{} `json:"properties"`
}

type GmOperaterLog

type GmOperaterLog struct {
	Id             int      `db:"id" json:"id"`
	OperaterName   string   `db:"operater_name" json:"operater_name"`     //操作者id
	OperaterId     int      `db:"operater_id" json:"operater_id"`         //操作者id
	OperaterAction string   `db:"operater_action" json:"operater_action"` //请求路由
	Created        string   `db:"created" json:"created"`
	Method         string   `db:"method" json:"method"` //请求方法
	Body           []byte   `db:"body" json:"-"`        //请求body
	OperaterRoleId int      `db:"operater_role_id" json:"operater_role_id"`
	FilterDate     []string `db:"-" json:"date"`
	BodyStr        string   `db:"-" json:"body_str"` //请求body
}

func (*GmOperaterLog) Insert

func (this *GmOperaterLog) Insert() (err error)

func (*GmOperaterLog) ProcessSqlInsert

func (this *GmOperaterLog) ProcessSqlInsert(sqlA db.InsertBuilder) db.InsertBuilder

func (*GmOperaterLog) ProcessSqlUpdate

func (this *GmOperaterLog) ProcessSqlUpdate(id int, sqlA db.UpdateBuilder) db.UpdateBuilder

func (*GmOperaterLog) ProcessSqlWhere

func (this *GmOperaterLog) ProcessSqlWhere(sqlA db.SelectBuilder) db.SelectBuilder

func (*GmOperaterLog) TableName

func (this *GmOperaterLog) TableName() string

type GmRoleModel

type GmRoleModel struct {
	ID          int    `json:"id" db:"id"`
	RoleName    string `json:"name" db:"role_name"`
	Description string `json:"description" db:"description"`
	RoleList    string `json:"routes" db:"role_list"`
}

GmRoleModel

func (*GmRoleModel) Delete

func (this *GmRoleModel) Delete() (err error)

Delete

func (*GmRoleModel) GetById

func (this *GmRoleModel) GetById(roleId int) (model GmRoleModel, err error)

GetById

func (*GmRoleModel) Insert

func (this *GmRoleModel) Insert() (id int64, err error)

Insert

func (*GmRoleModel) Select

func (this *GmRoleModel) Select() (model []GmRoleModel, err error)

Select

func (*GmRoleModel) Update

func (this *GmRoleModel) Update() (err error)

Update

type GmUserModel

type GmUserModel struct {
	ID            int32  `json:"id" db:"id"`
	RoleId        int32  `json:"role_id" db:"role_id"`
	Username      string `json:"username" db:"username"`
	Password      string `json:"password" db:"password"`
	Realname      string `json:"realname" db:"realname"`
	CreateTime    string `db:"create_time" json:"create_time"`
	UpdateTime    string `db:"update_time" json:"update_time"`
	LastLoginTime string `db:"last_login_time" json:"last_login_time"`

	IsDel int8 `db:"is_del" json:"is_del"` //是否禁止该账号
}

GmUserModel BI用户

func (GmUserModel) Delete

func (this GmUserModel) Delete() (err error)

Delete

func (GmUserModel) Exsit

func (this GmUserModel) Exsit() (b bool)

是否存在该用户

func (GmUserModel) GetPassword

func (this GmUserModel) GetPassword() string

密码进行md5混淆

func (GmUserModel) GetUserById

func (this GmUserModel) GetUserById() (gmUser GmUserModel, err error)

通过id查询用户信息

func (GmUserModel) GetUserByUP

func (this GmUserModel) GetUserByUP() (gmUser GmUserModel, err error)

登录

func (GmUserModel) Insert

func (this GmUserModel) Insert() (id int64, err error)

新增用户

func (GmUserModel) Select

func (this GmUserModel) Select(appid string) (gmUser []GmUserModel, err error)

Select

func (GmUserModel) Update

func (this GmUserModel) Update() (err error)

Update

func (GmUserModel) UpdatePassById

func (this GmUserModel) UpdatePassById() (err error)

Update

type InputMessage

type InputMessage struct {
	Topic     string
	Partition int
	Key       []byte
	Value     []byte
	Offset    int64
	Timestamp *time.Time
}

type KafkaCfg

type KafkaCfg struct {
	NumPartitions      int32    `json:"numPartitions"`
	Addresses          []string `json:"addresses"`
	Username           string   `json:"username"`
	Password           string   `json:"password"`
	ReportTopicName    string   `json:"reportTopicName"`
	ConsumerGroupName  string   `json:"consumerGroupName"`
	RealTimeDataGroup  string   `json:"realTimeDataGroup"`
	ReportData2CKGroup string   `json:"reportData2CKGroup"`
	DebugDataTopicName string   `json:"debugDataTopicName"`
	DebugDataGroup     string   `json:"debugDataGroup"`
	ProducerType       string   `json:"producer_type"`
}

type KafkaData

type KafkaData struct {
	APPID           string `json:"appid"`
	DistinctId      string `json:"distinct_id"`
	TableId         string `json:"table_id"`
	Ip              string `json:"ip"`
	ReportType      int    `json:"report_type"`
	Debug           string `json:"debug"`
	ReqData         []byte `json:"req_data"`
	ReportTime      string `json:"report_time"`
	ConsumptionTime string `json:"consumption_time"`
	EventName       string `json:"event_name"`
	Offset          int64  `json:"offset"`
}

func (*KafkaData) GetReportTypeErr

func (this *KafkaData) GetReportTypeErr() (eventType string)

func (*KafkaData) GetTableName

func (this *KafkaData) GetTableName() (tableName string)

type LogConfig

type LogConfig struct {
	StorageDays int    `json:"storageDays"` //日志保留天数
	LogDir      string `json:"logDir"`      //日志保留文件夹地址
}

type ManagerConfig

type ManagerConfig struct {
	Port              uint16 `json:"port"`              //铸龙分析系统http启动端口
	CkQueryLimit      int    `json:"ckQueryLimit"`      //clickhouse 查询限流器阈值
	CkQueryExpiration int    `json:"ckQueryExpiration"` //clickhouse 查询限流器阈值
	JwtSecret         string `json:"jwtSecret"`
	DeBug             bool   `json:"deBug"`
}

type MysqlConfig

type MysqlConfig struct {
	Username     string `json:"username"`
	Pwd          string `json:"pwd"`
	IP           string `json:"ip"`
	Port         string `json:"port"`
	DbName       string `json:"dbName"`
	MaxOpenConns int    `json:"maxOpenConns"`
	MaxIdleConns int    `json:"maxIdleConns"`
}

type Pannel

type Pannel struct {
	Id           int    `db:"id" json:"id"`
	FolderId     int    `db:"folder_id" json:"folder_id"`
	PannelName   string `db:"pannel_name" json:"pannel_name"`
	Managers     string `db:"managers" json:"managers"`
	CreateBy     int    `db:"create_by" json:"create_by"`
	CreateTime   int64  `db:"create_time" json:"create_time"`
	UpdateTime   int64  `db:"update_time" json:"update_time"`
	ReportTables string `db:"report_tables" json:"report_tables"`
}

type PannelFolder

type PannelFolder struct {
	Id         int    `db:"id" json:"id"`
	FolderName string `db:"folder_name" json:"folder_name"`
	FolderType int8   `db:"folder_type" json:"folder_type"` //0为自己创建的
	CreateBy   int    `db:"create_by" json:"create_by"`
	CreateTime string `db:"create_time" json:"create_time"`
	UpdateTime string `db:"update_time" json:"update_time"`
	Appid      int    `db:"appid" json:"appid"`
}

type RedisConfig

type RedisConfig struct {
	Addr      string `json:"addr"`
	Passwd    string `json:"passwd"`
	Db        int    `json:"db"`
	MaxIdle   int    `json:"maxIdle"`
	MaxActive int    `json:"maxActive"`
}

type ReportConfig

type ReportConfig struct {
	ReportPort         uint16   `json:"reportPort"` //上报程序启动端口
	ReadTimeout        int      `json:"readTimeout"`
	WriteTimeout       int      `json:"writeTimeout"`
	MaxConnsPerIP      int      `json:"maxConnsPerIP"`
	MaxRequestsPerConn int      `json:"maxRequestsPerConn"`
	IdleTimeout        int      `json:"idleTimeout"`
	UserAgentBanList   []string `json:"userAgentBanList"`
}

type ReportTable

type ReportTable struct {
	Id         int    `db:"id" json:"id"`
	Appid      int    `db:"appid" json:"appid"`
	UserId     int    `db:"user_id" json:"user_id"`
	Name       string `db:"name" json:"name"`
	RtType     int8   `db:"rt_type" json:"rt_type"`
	Data       string `db:"data" json:"data"`
	CreateTime string `db:"create_time" json:"create_time"`
	UpdateTime string `db:"update_time" json:"update_time"`
	Remark     string `db:"remark" json:"remark"`
}

func (*ReportTable) InsertOrUpdate

func (this *ReportTable) InsertOrUpdate() (err error)

type SinkerConfig

type SinkerConfig struct {
	ReportAcceptStatus  BatchConfig `json:"reportAcceptStatus"`
	ReportData2CK       BatchConfig `json:"reportData2CK"`
	RealTimeWarehousing BatchConfig `json:"realTimeWarehousing"`
	PprofHttpPort       uint16      `json:"pprofHttpPort"`
}

type UserGroup

type UserGroup struct {
	Id           int      `db:"id" json:"id"`
	GroupName    string   `db:"group_name" json:"group_name"`
	GroupRemark  string   `db:"group_remark" json:"group_remark"`
	CreateBy     int      `db:"create_by" json:"create_by"`
	UserCount    int      `db:"user_count" json:"user_count"`
	UserList     []byte   `db:"user_list" json:"-"`
	UserListData []string `db:"-" json:"user_list"`
	CreateTime   string   `db:"create_time" json:"create_time"`
	UpdateTime   string   `db:"update_time" json:"update_time"`
}

func (*UserGroup) DeleteUserGroupById

func (this *UserGroup) DeleteUserGroupById(managerUid int32, appid int) (err error)

func (*UserGroup) GetSelectOptions

func (this *UserGroup) GetSelectOptions(managerUid int32, appid int) (list []UserGroup, err error)

func (*UserGroup) Insert

func (this *UserGroup) Insert(managerUid int32, appid int, userCount int, userList []byte) (err error)

func (*UserGroup) List

func (this *UserGroup) List(managerUid int32, appid int) (list []UserGroup, err error)

func (*UserGroup) ModifyUserGroup

func (this *UserGroup) ModifyUserGroup(managerUid int32, appid int) (err error)

Jump to

Keyboard shortcuts

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