Documentation
¶
Index ¶
- Variables
- func BuildWhereClause(where map[string]any) (string, []any, error)
- func BuildWhereClauseSorted(where map[string]any) (string, []any, error)
- func FormatToContext(input map[string]any) (map[string]string, error)
- func GetTxPreference(ctx map[string]any) (string, error)
- type AuthAuthenticateRequest
- type AuthAuthenticateResponse
- type AuthInitRequest
- type AuthInitResponse
- type AuthPlugin
- type AuthPluginPlugin
- type AuthPluginRPC
- type AuthPluginRPCServer
- type CacheGetRequest
- type CacheGetResponse
- type CacheInitConnectionRequest
- type CacheInitConnectionResponse
- type CachePlugin
- type CachePluginPlugin
- type CachePluginRPC
- type CachePluginRPCServer
- type CacheSetRequest
- type CacheSetResponse
- type CallFunctionRequest
- type CallFunctionResponse
- type DBPlugin
- type DBPluginPlugin
- type DBPluginRPC
- func (g *DBPluginRPC) CallFunction(userID, funcName string, data map[string]any, ctx map[string]any) (any, error)
- func (g *DBPluginRPC) GetSchema(ctx map[string]any) (any, error)
- func (g *DBPluginRPC) InitConnection(uri string) error
- func (g *DBPluginRPC) TableCreate(userID, table string, data []map[string]any, ctx map[string]any) ([]map[string]any, error)
- func (g *DBPluginRPC) TableDelete(userID, table string, where map[string]any, ctx map[string]any) (int, error)
- func (g *DBPluginRPC) TableGet(userID, table string, selectFields []string, where map[string]any, ...) ([]map[string]any, error)
- func (g *DBPluginRPC) TableUpdate(userID, table string, data map[string]any, where map[string]any, ...) (int, error)
- type DBPluginRPCServer
- func (s *DBPluginRPCServer) CallFunction(req CallFunctionRequest, resp *CallFunctionResponse) error
- func (s *DBPluginRPCServer) GetSchema(req GetSchemaRequest, resp *GetSchemaResponse) error
- func (s *DBPluginRPCServer) InitConnection(req InitConnectionRequest, resp *InitConnectionResponse) error
- func (s *DBPluginRPCServer) TableCreate(req TableCreateRequest, resp *TableCreateResponse) error
- func (s *DBPluginRPCServer) TableDelete(req TableDeleteRequest, resp *TableDeleteResponse) error
- func (s *DBPluginRPCServer) TableGet(req TableGetRequest, resp *TableGetResponse) error
- func (s *DBPluginRPCServer) TableUpdate(req TableUpdateRequest, resp *TableUpdateResponse) error
- type GetSchemaRequest
- type GetSchemaResponse
- type InitConnectionRequest
- type InitConnectionResponse
- type TableCreateRequest
- type TableCreateResponse
- type TableDeleteRequest
- type TableDeleteResponse
- type TableGetRequest
- type TableGetResponse
- type TableUpdateRequest
- type TableUpdateResponse
Constants ¶
This section is empty.
Variables ¶
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "EASYREST_PLUGIN",
MagicCookieValue: "easyrest",
}
Handshake configuration for plugin security.
var Version = "v0.16.2"
Version is the plugin version.
Functions ¶
func BuildWhereClause ¶
BuildWhereClause constructs a SQL WHERE clause from a given where map. The where map is expected to be in the form:
{ "field": {"=": value}, ... }
It returns the SQL string (starting with " WHERE ") and the list of arguments.
func BuildWhereClauseSorted ¶ added in v0.8.2
BuildWhereClauseSorted constructs a SQL WHERE clause from a given where map, but sorts the conditions (and their arguments) by field name and operator for deterministic output.
Types ¶
type AuthAuthenticateRequest ¶ added in v0.11.0
type AuthAuthenticateRequest struct {
Headers map[string]string
Method string
Path string
Query string
}
AuthAuthenticateRequest holds the data for authentication.
type AuthAuthenticateResponse ¶ added in v0.11.0
AuthAuthenticateResponse holds the claims or an error.
type AuthInitRequest ¶ added in v0.11.0
AuthInitRequest holds the settings for authentication plugin initialization.
type AuthInitResponse ¶ added in v0.11.0
type AuthInitResponse struct {
Schema map[string]any // Swagger 2.0 security definition
Error string
}
AuthInitResponse indicates success or error during authentication plugin initialization.
type AuthPlugin ¶ added in v0.11.0
type AuthPlugin interface {
Init(settings map[string]any) (map[string]any, error) // Returns Swagger 2.0 security definition and error
Authenticate(headers map[string]string, method string, path string, query string) (map[string]any, error)
}
--- AuthPlugin --- AuthPlugin defines the interface for authentication plugins.
type AuthPluginPlugin ¶ added in v0.11.0
type AuthPluginPlugin struct {
Impl AuthPlugin
}
AuthPluginPlugin wraps the AuthPlugin implementation for go-plugin.
type AuthPluginRPC ¶ added in v0.11.0
type AuthPluginRPC struct {
// contains filtered or unexported fields
}
AuthPluginRPC is the client wrapper for AuthPlugin.
func (*AuthPluginRPC) Authenticate ¶ added in v0.11.0
type AuthPluginRPCServer ¶ added in v0.11.0
type AuthPluginRPCServer struct {
Impl AuthPlugin
}
AuthPluginRPCServer is the server-side RPC implementation for AuthPlugin.
func (*AuthPluginRPCServer) Authenticate ¶ added in v0.11.0
func (s *AuthPluginRPCServer) Authenticate(req AuthAuthenticateRequest, resp *AuthAuthenticateResponse) error
func (*AuthPluginRPCServer) Init ¶ added in v0.11.0
func (s *AuthPluginRPCServer) Init(req AuthInitRequest, resp *AuthInitResponse) error
type CacheGetRequest ¶ added in v0.6.0
type CacheGetRequest struct {
Key string
}
CacheGetRequest holds the key for retrieving a cache entry.
type CacheGetResponse ¶ added in v0.6.0
CacheGetResponse holds the retrieved value or an error.
type CacheInitConnectionRequest ¶ added in v0.6.0
type CacheInitConnectionRequest struct {
URI string
}
CacheInitConnectionRequest holds the URI for cache connection initialization.
type CacheInitConnectionResponse ¶ added in v0.6.0
type CacheInitConnectionResponse struct {
Error string
}
CacheInitConnectionResponse indicates success or error during cache connection initialization.
type CachePlugin ¶ added in v0.6.0
type CachePlugin interface {
InitConnection(uri string) error
Set(key string, value string, ttl time.Duration) error
Get(key string) (string, error)
}
CachePlugin defines the interface for cache operations.
type CachePluginPlugin ¶ added in v0.6.0
type CachePluginPlugin struct {
Impl CachePlugin
}
CachePluginPlugin wraps the CachePlugin implementation for go-plugin.
type CachePluginRPC ¶ added in v0.6.0
type CachePluginRPC struct {
// contains filtered or unexported fields
}
CachePluginRPC is the client wrapper for CachePlugin.
func (*CachePluginRPC) Get ¶ added in v0.6.0
func (c *CachePluginRPC) Get(key string) (string, error)
func (*CachePluginRPC) InitConnection ¶ added in v0.6.0
func (c *CachePluginRPC) InitConnection(uri string) error
type CachePluginRPCServer ¶ added in v0.6.0
type CachePluginRPCServer struct {
Impl CachePlugin
}
CachePluginRPCServer is the server-side RPC implementation for CachePlugin.
func (*CachePluginRPCServer) Get ¶ added in v0.6.0
func (s *CachePluginRPCServer) Get(req CacheGetRequest, resp *CacheGetResponse) error
func (*CachePluginRPCServer) InitConnection ¶ added in v0.6.0
func (s *CachePluginRPCServer) InitConnection(req CacheInitConnectionRequest, resp *CacheInitConnectionResponse) error
func (*CachePluginRPCServer) Set ¶ added in v0.6.0
func (s *CachePluginRPCServer) Set(req CacheSetRequest, resp *CacheSetResponse) error
type CacheSetRequest ¶ added in v0.6.0
CacheSetRequest holds the key, value, and TTL for setting a cache entry.
type CacheSetResponse ¶ added in v0.6.0
type CacheSetResponse struct {
Error string
}
CacheSetResponse indicates success or error during cache set operation.
type CallFunctionRequest ¶
type CallFunctionResponse ¶
type DBPlugin ¶
type DBPlugin interface {
InitConnection(uri string) error
TableGet(userID string, table string, selectFields []string, where map[string]any,
ordering []string, groupBy []string, limit, offset int, ctx map[string]any) ([]map[string]any, error)
TableCreate(userID string, table string, data []map[string]any, ctx map[string]any) ([]map[string]any, error)
TableUpdate(userID string, table string, data map[string]any, where map[string]any, ctx map[string]any) (int, error)
TableDelete(userID string, table string, where map[string]any, ctx map[string]any) (int, error)
CallFunction(userID string, funcName string, data map[string]any, ctx map[string]any) (any, error)
GetSchema(ctx map[string]any) (any, error)
}
DBPlugin – interface for DB access plugins.
type DBPluginPlugin ¶
type DBPluginPlugin struct {
Impl DBPlugin
}
DBPluginPlugin wraps the DBPlugin implementation for go-plugin.
type DBPluginRPC ¶
type DBPluginRPC struct {
// contains filtered or unexported fields
}
DBPluginRPC is the client wrapper.
func (*DBPluginRPC) CallFunction ¶
func (*DBPluginRPC) GetSchema ¶ added in v0.2.0
func (g *DBPluginRPC) GetSchema(ctx map[string]any) (any, error)
New GetSchema method.
func (*DBPluginRPC) InitConnection ¶
func (g *DBPluginRPC) InitConnection(uri string) error
func (*DBPluginRPC) TableCreate ¶
func (*DBPluginRPC) TableDelete ¶
type DBPluginRPCServer ¶
type DBPluginRPCServer struct {
Impl DBPlugin
}
DBPluginRPCServer is the server-side RPC implementation.
func (*DBPluginRPCServer) CallFunction ¶
func (s *DBPluginRPCServer) CallFunction(req CallFunctionRequest, resp *CallFunctionResponse) error
func (*DBPluginRPCServer) GetSchema ¶ added in v0.2.0
func (s *DBPluginRPCServer) GetSchema(req GetSchemaRequest, resp *GetSchemaResponse) error
New GetSchema server method.
func (*DBPluginRPCServer) InitConnection ¶
func (s *DBPluginRPCServer) InitConnection(req InitConnectionRequest, resp *InitConnectionResponse) error
func (*DBPluginRPCServer) TableCreate ¶
func (s *DBPluginRPCServer) TableCreate(req TableCreateRequest, resp *TableCreateResponse) error
func (*DBPluginRPCServer) TableDelete ¶
func (s *DBPluginRPCServer) TableDelete(req TableDeleteRequest, resp *TableDeleteResponse) error
func (*DBPluginRPCServer) TableGet ¶
func (s *DBPluginRPCServer) TableGet(req TableGetRequest, resp *TableGetResponse) error
func (*DBPluginRPCServer) TableUpdate ¶
func (s *DBPluginRPCServer) TableUpdate(req TableUpdateRequest, resp *TableUpdateResponse) error
type GetSchemaRequest ¶ added in v0.2.0
New structures for GetSchema.
type GetSchemaResponse ¶ added in v0.2.0
type InitConnectionRequest ¶
type InitConnectionRequest struct {
URI string
}
RPC request/response structures.
type InitConnectionResponse ¶
type InitConnectionResponse struct {
Error string
}