xorm: xorm.io/xorm/contexts Index | Files

package contexts

import "xorm.io/xorm/contexts"


Package Files

context_cache.go hook.go

func NewMemoryContextCache Uses

func NewMemoryContextCache() memoryContextCache

NewMemoryContextCache return memoryContextCache

type ContextCache Uses

type ContextCache interface {
    // Put puts value into cache with key.
    Put(key string, val interface{})
    // Get gets cached value by given key.
    Get(key string) interface{}

ContextCache is the interface that operates the cache data.

type ContextHook Uses

type ContextHook struct {
    Ctx         context.Context
    SQL         string        // log content or SQL
    Args        []interface{} // if it's a SQL, it's the arguments
    Result      sql.Result
    ExecuteTime time.Duration
    Err         error // SQL executed error
    // contains filtered or unexported fields

ContextHook represents a hook context

func NewContextHook Uses

func NewContextHook(ctx context.Context, sql string, args []interface{}) *ContextHook

NewContextHook return context for hook

func (*ContextHook) End Uses

func (c *ContextHook) End(ctx context.Context, result sql.Result, err error)

type Hook Uses

type Hook interface {
    BeforeProcess(c *ContextHook) (context.Context, error)
    AfterProcess(c *ContextHook) error

type Hooks Uses

type Hooks struct {
    // contains filtered or unexported fields

func (*Hooks) AddHook Uses

func (h *Hooks) AddHook(hooks ...Hook)

func (*Hooks) AfterProcess Uses

func (h *Hooks) AfterProcess(c *ContextHook) error

func (*Hooks) BeforeProcess Uses

func (h *Hooks) BeforeProcess(c *ContextHook) (context.Context, error)

Package contexts imports 3 packages (graph) and is imported by 7 packages. Updated 2021-01-19. Refresh now. Tools for package owners.