Documentation ¶
Overview ¶
internal message 内部服务间各类消息
Index ¶
- Constants
- Variables
- func BulkSaveInStateStore(ctx context.Context, client dapr.Client, stateStore string, key []string, ...) (err error)
- func CheckKeyInStateStore(ctx context.Context, client dapr.Client, stateStore, key string) (bool, error)
- func CommonDelete(w http.ResponseWriter, r *http.Request, client dapr.Client, tableName string, ...)
- func CommonGroupby(w http.ResponseWriter, r *http.Request, client dapr.Client, tableName string) (err error)
- func CommonPageQuery[T any](w http.ResponseWriter, r *http.Request, client dapr.Client, tableName string, ...)
- func CommonQuery[T any](w http.ResponseWriter, r *http.Request, client dapr.Client, tableName string, ...)
- func CommonUpsert(w http.ResponseWriter, r *http.Request, client dapr.Client, tableName string, ...) (err error)
- func CustomSql[T any](ctx context.Context, client dapr.Client, ...) (result []T, err error)
- func DaprCacheGet[T any](client dapr.Client, key string) (*T, error)
- func DaprCacheGetGeneric[T any](ctx context.Context, client dapr.Client, ...) (result *T, useStateStoreFlag bool, err error)
- func DaprCacheSet(ctx context.Context, client dapr.Client, key string, value interface{}, ...) error
- func DbBatchInsert[T any](ctx context.Context, client dapr.Client, val []T, tablename string) (err error)
- func DbBatchUpsert[T any](ctx context.Context, client dapr.Client, datas []T, tableName string, ...) (err error)
- func DbBatchUpsertIg[T any](ctx context.Context, client dapr.Client, datas []T, tableName string, ...) (err error)
- func DbDelete(ctx context.Context, client dapr.Client, tableName string, idField string, ...) (err error)
- func DbDeleteByOps(ctx context.Context, client dapr.Client, tableName string, field []string, ...) error
- func DbDeleteExpired(ctx context.Context, client dapr.Client, tableName string, timeField string, ...) (err error)
- func DbGetCount(ctx context.Context, client dapr.Client, tableName string, countField string, ...) (result int64, err error)
- func DbGetOne[T any](ctx context.Context, client dapr.Client, tableName string, queryString string) (result *T, err error)
- func DbQuery[T any](ctx context.Context, client dapr.Client, tableName string, queryString string) (result []T, err error)
- func DbRefreshContinuousAggregate(ctx context.Context, client dapr.Client, name, start, end string) (err error)
- func DbRefreshContinuousAggregateFull(ctx context.Context, client dapr.Client, name string) (err error)
- func DbUpdateByOps(ctx context.Context, client dapr.Client, tableName string, data map[string]any, ...) error
- func DbUpsert[T any](ctx context.Context, client dapr.Client, data T, tableName string, ...) (err error)
- func DbUpsertIg[T any](ctx context.Context, client dapr.Client, data T, tableName string, keys string, ...) (err error)
- func DeleteKeyInStateStore(ctx context.Context, client dapr.Client, stateStore, key string) (err error)
- func ExtractUserSub(r *http.Request) (sub string, err error)
- func GetBatchDeleteBeforeHook(key string) (f func(r *http.Request, in any) (out any, err error), exists bool)
- func GetDaprClient() client.Client
- func GetDeleteBeforeHook(key string) (f func(r *http.Request, in any) (out any, err error), exists bool)
- func GetIP(r *http.Request) string
- func GetInStateStore(ctx context.Context, client dapr.Client, stateStore, key string) ([]byte, error)
- func GetMD5Hash(text string) string
- func GetSha1Hash(text string) string
- func GetUpsertBeforeHook(key string) (f func(r *http.Request, in any) (out any, err error), exists bool)
- func HttpError(w http.ResponseWriter, response *Response, code int)
- func HttpResult(w http.ResponseWriter, response *Response)
- func HttpSuccess(w http.ResponseWriter, response *Response)
- func MarshalWithRemoveKey(v interface{}, key string) ([]byte, error)
- func NanoId() string
- func PublishDbUpsertMessage(ctx context.Context, client dapr.Client, table, keys, ignorekeys string, ...) error
- func PublishMethodInvokeMessage(ctx context.Context, client dapr.Client, event MethodInvokeInfo) error
- func ReadRequestBody(r *http.Request, v interface{}) error
- func ReadResponseBody(r *http.Response, v interface{}) error
- func RegisterBatchDeleteBeforeHook(key string, f func(r *http.Request, in any) (out any, err error))
- func RegisterDeleteBeforeHook(key string, f func(r *http.Request, in any) (out any, err error))
- func RegisterUpsertBeforeHook(key string, f func(r *http.Request, in any) (out any, err error))
- func SaveInStateStore(ctx context.Context, client dapr.Client, stateStore, key string, data []byte, ...) (err error)
- type AccessInfo
- type AutoRefreshCacher
- type BytesPage
- type CommonMessage
- type Count
- type DbUpsertEvent
- type Event
- type InternalMessage
- type LocalNullableTime
- func (t LocalNullableTime) DbString() string
- func (t LocalNullableTime) MarshalJSON() ([]byte, error)
- func (t *LocalNullableTime) Scan(v interface{}) error
- func (t LocalNullableTime) String() string
- func (t *LocalNullableTime) UnmarshalJSON(data []byte) (err error)
- func (t LocalNullableTime) Value() (driver.Value, error)
- type LocalTime
- type MethodInvokeInfo
- type MetricPanel
- type MyFormatter
- type Page
- type PageGeneric
- type Response
- type ResponseGeneric
- type SyslogMessage
Constants ¶
View Source
const DbTimeFormat = "2006-01-02T15:04:05"
View Source
const JsonTimeFormat = "2006-01-02 15:04:05"
Variables ¶
View Source
var ( OK = response(0, "服务调用成功") BaseErrorNo = OK.Status ErrNotFound = response(BaseErrorNo+1, "服务调用成功,但没有找到相应数据") ErrDeleteError = response(BaseErrorNo+2, "无法删除:") ErrParam = response(BaseErrorNo+3, "参数有误") ErrSignParam = response(BaseErrorNo+4, "签名参数有误") ErrReqBodyRead = response(BaseErrorNo+5, "读取body有误") ErrReqBodyParse = response(BaseErrorNo+6, "请求参数反序列化错误") ErrPubSubPublish = response(BaseErrorNo+7, "发布消息错误") ErrServiceInvokeDB = response(BaseErrorNo+8, "调用数据库异常") ErrAddEdgeToGraph = response(BaseErrorNo+9, "添加边到图异常") ErrService = response(BaseErrorNo+10, "服务异常") ErrListUnMashal = response(BaseErrorNo+11, "列表反序列化错误") ErrModelParse = response(BaseErrorNo+12, "对象反序列化错误") ErrExists = response(BaseErrorNo+13, "已存在") ErrAuthz = response(BaseErrorNo+14, "没有权限") )
View Source
var ( PLATFORM_ALARM_TOPIC_NAME = "platform-alarm" EVENT_TOPIC_NAME = "eventTopic" EVENT_DATA_TOPIC_NAME = "eventDataTopic" EVENT_POINT_RW_META_TOPIC = "pointRWMetaTopic" EventArchivedFlag = int32(1) EventTypePlatform = int32(1) EventTypeDevice = int32(2) EventTypeSecurity = int32(3) EventSubTypeService = int32(101) EventSubTypeInterface = int32(102) EventSubTypeComunication = int32(103) EventStatusActive = int32(1) EventStatusClosed = int32(0) EventLevelCritical = int32(1) EventLevelMajor = int32(2) EventLevelMinor = int32(3) EventLevelWarning = int32(4) )
event指告警类事件
View Source
var BASE_CONTEXT = ""
View Source
var CENTER_DAPR_STATESTORE_NAME = "center-statestore"
View Source
var CENTER_DB_SERVICE_NAME = "center-db-service"
View Source
var CENTER_DB_UPSERT_TOPIC = "center_db_upsert_event"
View Source
var CENTER_GLOBAL_STATESTOR_NAME = "center-global-redis"
View Source
var CENTER_METHOD_INVOKE_TOPIC = "centerMethodInvoke"
View Source
var CENTER_PUBSUB_NAME = "center_pubsub"
View Source
var COMMON_MESSAGE_KEY_BUSINESS_TYPE = "business_type"
View Source
var COMMON_MESSAGE_KEY_CONNECT_ID = "connect_id"
View Source
var COMMON_MESSAGE_KEY_MARK = "mark"
View Source
var COMMON_MESSAGE_KEY_MESSAGE = "message"
View Source
var COMMON_MESSAGE_KEY_TO_ID = "to_id"
View Source
var COMMON_MESSAGE_KEY_TYPE = "type"
View Source
var COMMON_MESSAGE_TYPE_PONG = "pong"
View Source
var DAPR_STATESTORE_NAME = "statestore"
View Source
var DBNAME = "thingsdb"
View Source
var DB_SCHEMA = "public"
View Source
var DB_SERVICE_NAME = "db-service"
View Source
var DB_UPSERT_TOPIC = "db_upsert_event"
View Source
var DEVICE_DATA_TOPIC = "deviceData"
View Source
var DefaultmetricsPanel = []MetricPanel{
{Row: 0, Col: 0, Title: "go协程数", Query: "go_goroutines{ident=\"${HOST}\",instance=\"${NAME}:80\"}", Type: "trend"},
{Row: 0, Col: 1, Title: "go gc秒数", Query: "go_gc_duration_seconds{ident=\"${HOST}\",instance=\"${NAME}:80\"}", Type: "trend"},
{Row: 0, Col: 2, Title: "go线程数", Query: "go_threads{ident=\"${HOST}\",instance=\"${NAME}:80\"}", Type: "trend"},
{Row: 0, Col: 3, Title: "go分配对象数", Query: "go_memstats_heap_objects{ident=\"${HOST}\",instance=\"${NAME}:80\"}", Type: "trend"},
}
View Source
var EDGE_ID = ""
View Source
var FILE_SERVICE_NAME = "file-service"
View Source
var GLOBAL_STATESTOR_NAME = "global-redis"
View Source
var INTERNAL_MESSAGE_KEY_BUSINESS_TYPE = "business_type"
View Source
var INTERNAL_MESSAGE_KEY_CONNECT_ID = "connect_id"
View Source
var INTERNAL_MESSAGE_KEY_MARK = "mark"
View Source
var INTERNAL_MESSAGE_KEY_MESSAGE = "message"
View Source
var INTERNAL_MESSAGE_KEY_TYPE = "type"
View Source
var INTERNAL_MESSAGE_KEY_USER_ID = "user_id"
View Source
var INTERNAL_MESSAGE_TOPIC_NAME = "internal_msg"
View Source
var INTERNAL_MESSAGE_TYPE_SYS_LOG = "sys_log"
View Source
var INTERNAL_MESSAGE_TYPE_USER_LOGIN = "user_login"
View Source
var INTERNAL_MESSAGE_TYPE_USER_LOGOUT = "user_logout"
View Source
var INTERNAL_MESSAGE_TYPE_WEB_CONNECT = "web_connect"
View Source
var INTERNAL_MESSAGE_TYPE_WEB_DISCONNECT = "web_disconnect"
View Source
var Logger = logrus.New()
View Source
var METHOD_INVOKE_TOPIC = "methodInvoke"
View Source
var PROPERTY_SET_TOPIC = "property_set_event"
View Source
var PUBSUB_NAME = "pubsub"
View Source
var RESOURCE_CHANGE_TOPIC = "resourceChange"
View Source
var RUNNING_MODE = "center_edge"
View Source
var RUNNING_MODE_CENTER = "center"
View Source
var RUNNING_MODE_CENTER_EDGE = "center_edge"
View Source
var RUNNING_MODE_EDGE = "edge"
View Source
var USER_EXPIRED_SECONDS = 7200
View Source
var USER_STATESTORE_KEY_PREFIX = "user#"
View Source
var WEB_MESSAGE_TOPIC_NAME = "web"
message 指发送到UI的各类消息
Functions ¶
func BulkSaveInStateStore ¶
func CheckKeyInStateStore ¶
func CommonDelete ¶
func CommonGroupby ¶
func CommonPageQuery ¶
func CommonQuery ¶
func CommonUpsert ¶
func DaprCacheGetGeneric ¶
func DaprCacheSet ¶
func DbBatchInsert ¶
func DbBatchUpsert ¶
func DbBatchUpsertIg ¶
func DbDeleteByOps ¶
func DbDeleteExpired ¶
func DbGetCount ¶
func DbUpdateByOps ¶
func DbUpsertIg ¶
func DeleteKeyInStateStore ¶
func GetDaprClient ¶
func GetDeleteBeforeHook ¶
func GetInStateStore ¶
func GetMD5Hash ¶
func GetSha1Hash ¶
func GetUpsertBeforeHook ¶
func HttpResult ¶
func HttpResult(w http.ResponseWriter, response *Response)
func HttpSuccess ¶
func HttpSuccess(w http.ResponseWriter, response *Response)
func MarshalWithRemoveKey ¶
func PublishDbUpsertMessage ¶
func ReadRequestBody ¶
func ReadResponseBody ¶
Types ¶
type AccessInfo ¶
type AccessInfo struct { Aud string `json:"aud"` //client_id Exp int `json:"exp"` //expired time Sub string `json:"sub"` //user_name }
func ExtractJwt ¶
func ExtractJwt(r *http.Request) (*AccessInfo, error)
func ExtractJwtFromMap ¶
func ExtractJwtFromMap(m map[string]string) (*AccessInfo, error)
func ExtractJwtFromString ¶
func ExtractJwtFromString(authVal string) (*AccessInfo, error)
type AutoRefreshCacher ¶
type AutoRefreshCacher[T any] struct { Name string Id string ExpiredSecond int // contains filtered or unexported fields }
func NewAutoRefreshCacher ¶
func (*AutoRefreshCacher[T]) DaprCacheGetGeneric ¶
func (*AutoRefreshCacher[T]) Invalid ¶
func (c *AutoRefreshCacher[T]) Invalid(client dapr.Client)
type CommonMessage ¶
type CommonMessage map[string]interface{}
type DbUpsertEvent ¶
type Event ¶
type Event struct { Dn string `json:"dn"` Title string `json:"title"` Type int32 `json:"type"` Description string `json:"description"` Status int32 `json:"status"` Level int32 `json:"level"` EventTime LocalTime `json:"event_time"` CreateAt LocalTime `json:"create_at"` UpdatedAt LocalTime `json:"updated_at"` ObjectID string `json:"object_id"` ObjectName string `json:"object_name"` Location string `json:"location"` }
type InternalMessage ¶
func (InternalMessage) FromStruct ¶
func (m InternalMessage) FromStruct(s any) (err error)
func (InternalMessage) GetType ¶
func (m InternalMessage) GetType() string
func (InternalMessage) SetType ¶
func (m InternalMessage) SetType(t string)
type LocalNullableTime ¶
func (LocalNullableTime) DbString ¶
func (t LocalNullableTime) DbString() string
func (LocalNullableTime) MarshalJSON ¶
func (t LocalNullableTime) MarshalJSON() ([]byte, error)
func (*LocalNullableTime) Scan ¶
func (t *LocalNullableTime) Scan(v interface{}) error
func (LocalNullableTime) String ¶
func (t LocalNullableTime) String() string
func (*LocalNullableTime) UnmarshalJSON ¶
func (t *LocalNullableTime) UnmarshalJSON(data []byte) (err error)
type MethodInvokeInfo ¶
type MetricPanel ¶
type MyFormatter ¶
type MyFormatter struct{}
type PageGeneric ¶
type Response ¶
type Response struct { Status int `json:"status"` Msg string `json:"msg"` Data interface{} `json:"data"` }
type ResponseGeneric ¶
type SyslogMessage ¶
type SyslogMessage struct { Type string `json:"type"` UserId string `json:"user_id"` Ip string `json:"ip"` Action int `json:"action"` Info string `json:"info"` }
func (*SyslogMessage) FromInternalMessage ¶
func (s *SyslogMessage) FromInternalMessage(m InternalMessage)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.