common

package module
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2025 License: MIT Imports: 1 Imported by: 0

README

common

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiCtxKey = ContextKey{}

Functions

This section is empty.

Types

type APIContext added in v0.1.0

APIContext combines request and response contexts

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 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 MutableRequestContext added in v0.1.0

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

MutableRequestContext allows modification of request context

type MutableResponseContext added in v0.1.0

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

MutableResponseContext allows modification of response context

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 interface {
	RequestID() string
	Method() string
	Params() any
	RawParams() []byte
	Metas() map[string]any
}

RequestContext contains request-related information

type ResponseContext added in v0.1.0

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

ResponseContext contains 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