runtime

package
v0.0.0-...-bda1dd6 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// All available environmental variables made available to the runtime environment.
	// This is useful to store API keys and other secrets which may be different between servers run in production and in development.
	//   envs := ctx.Value(runtime.RUNTIME_CTX_ENV).(map[string]string)
	// This can always be safely cast into a `map[string]string`.
	RUNTIME_CTX_ENV = "env"

	// The node ID where the current runtime context is executing.
	RUNTIME_CTX_NODE = "node"

	// Http headers. Only applicable to HTTP RPC requests.
	RUNTIME_CTX_HEADERS = "headers"

	// Query params that was passed through from HTTP request.
	RUNTIME_CTX_QUERY_PARAMS = "query_params"

	// The user ID associated with the execution context.
	RUNTIME_CTX_USER_ID = "user_id"

	// The username associated with the execution context.
	RUNTIME_CTX_USERNAME = "username"

	// Variables stored in the user's session token.
	RUNTIME_CTX_VARS = "vars"

	// The user session expiry in seconds associated with the execution context.
	RUNTIME_CTX_USER_SESSION_EXP = "user_session_exp"

	// The user session associated with the execution context.
	RUNTIME_CTX_SESSION_ID = "session_id"

	// The user session's lang value, if one is set.
	RUNTIME_CTX_LANG = "lang"

	// The IP address of the client making the request.
	RUNTIME_CTX_CLIENT_IP = "client_ip"

	// The port number of the client making the request.
	RUNTIME_CTX_CLIENT_PORT = "client_port"
)

定义运行时常量

View Source
const INIT_MODULE_FUNC_NAME = "InitModule"

定义模块入口名称

Variables

This section is empty.

Functions

This section is empty.

Types

type Initializer

type Initializer interface {
	RegisterRpc(id string, fn func(ctx context.Context, logger Logger, db *sql.DB, m Module, payload string) (string, error)) error
	RegisterBeforeRt(id string, fn func(ctx context.Context, logger Logger, db *sql.DB, m Module, envelope *rtapi.Envelope) (*rtapi.Envelope, error)) error
	RegisterAfterRt(id string, fn func(ctx context.Context, logger Logger, db *sql.DB, m Module, out, in *rtapi.Envelope) error) error
}

type Logger

type Logger interface {
	Debug(format string, v ...interface{})
	Info(format string, v ...interface{})
	Warn(format string, v ...interface{})
	Error(format string, v ...interface{})
	WithField(key string, v interface{}) Logger
	WithFields(fields map[string]interface{}) Logger
	Fields() map[string]interface{}
}

Logger exposes a logging framework to use in modules. It exposes level-specific logging functions and a set of common functions for compatibility.

type Module

type Module interface {
	AuthenticateEmail()
}

Jump to

Keyboard shortcuts

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