common

package module
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: May 17, 2025 License: MIT Imports: 6 Imported by: 0

README

common

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiCtxKey = ContextKey{}

Functions

func GenerateSpanID added in v0.1.18

func GenerateSpanID() string

GenerateSpanID generates a 64-bit Span ID

func GenerateTraceID added in v0.1.18

func GenerateTraceID() string

GenerateTraceID generates a 128-bit Trace ID

func GetLicenseCiphertext added in v0.1.21

func GetLicenseCiphertext(code string, version string) (string, error)

func SendNotification added in v0.1.21

func SendNotification(eventSource string, eventType string, eventData any) error

Types

type APIContext added in v0.1.0

APIContext combines request and response contexts

type AsmParam added in v0.1.19

type AsmParam struct {
	Api           string
	Param         []any
	SessionFilter map[string]string
	SessionValues map[string]string
}

type ContextKey added in v0.1.1

type ContextKey struct{}

type DalContext added in v0.1.9

type DalContext struct {
	DefaultEntity string
	Container     *sync.Map

	TraceID  string
	ParentID string
	SpanID   string
}

type EventHandler added in v0.1.21

type EventHandler interface {
	SendNotification(eventSource string, eventType string, eventData any) error
}
var DefaultEventManager EventHandler

type GlobalThisReader

type GlobalThisReader interface {
	Input() any
	Env() map[string]any
	Metas() map[string]any
	Session() map[string]any
	RequestHeaders() map[string]any

	Output() any
	ResponseHeaders() map[string]any
}

type Handler added in v0.1.3

type Handler interface {
	Process(APIContext) error
}

type HandlerFunc added in v0.1.3

type HandlerFunc func(APIContext) error

func (HandlerFunc) Process added in v0.1.13

func (hf HandlerFunc) Process(ctx APIContext) error

type LicenseHandler added in v0.1.21

type LicenseHandler interface {
	GetLicenseCiphertext(code string, version string) (string, error)
}
var DefaultLicenseManager LicenseHandler

type PreparedQuery

type PreparedQuery struct {
	Query     string `json:"query"`
	Bind      []any  `json:"bind"`
	QueryType string `json:"queryType"`

	CheckPoint      []*PreparedQuery `json:"checkPoint"`
	DatabaseUpdater []*PreparedQuery `json:"databaseUpdater"`
	ResultEnricher  []*PreparedQuery `json:"resultEnricher"`
}

type QueryResult

type QueryResult struct {
	QueryType    string
	LastInsertId int64
	RowsAffected int64
	Row          map[string]any
	Rows         []map[string]any
	Total        int64
}

type RequestContext added in v0.1.0

type RequestContext struct {
	ApiName     string
	RemoteAddr  string
	RemoteHost  string
	RequestTime time.Time
}

type RequestReader added in v0.1.15

type RequestReader interface {
	RequestID() string
	RequestContext() *RequestContext
	Method() string
	Params() any
	RawParams() []byte
	Metas() map[string]any
}

RequestReader contains request-related information

type RequestWriter added in v0.1.15

type RequestWriter interface {
	SetRequestID(string)
	SetMethod(string)
	SetParams(any)
	SetRawParams([]byte)
	SetMetas(map[string]any)
}

RequestWriter allows modification of request-related information

type ResponseReader added in v0.1.15

type ResponseReader interface {
	Result() any
	Err() error
}

ResponseReader contains response-related information

type ResponseWriter added in v0.1.15

type ResponseWriter interface {
	SetResult(any)
	SetErr(error)
}

ResponseWriter allows modification of response-related information

type ScriptRunner

type ScriptRunner interface {
	RunScript(globalThis map[string]any, dalCtx *DalContext, sourceCode string) (any, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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