This section is empty.


This section is empty.


func NewMemoryContextCache

func NewMemoryContextCache() memoryContextCache

    NewMemoryContextCache return memoryContextCache


    type ContextCache

    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

      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

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

          NewContextHook return context for hook

          func (*ContextHook) End

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

          type Hook

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

          type Hooks

          type Hooks struct {
          	// contains filtered or unexported fields

          func (*Hooks) AddHook

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

          func (*Hooks) AfterProcess

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

          func (*Hooks) BeforeProcess

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