db

package
v1.0.33 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Zlib Imports: 18 Imported by: 0

Documentation

Overview

*

  • @author huqiuyun
  • 数据Elasticsearch

*

  • @author huqiuyun
  • 数据服务

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter represents the Gorm adapter for policy storage.

func NewAdapter

func NewAdapter(cfg *server.Sql) (*Adapter, error)

NewAdapter is the constructor for Adapter.

func (*Adapter) Close

func (a *Adapter) Close()

func (*Adapter) Db

func (a *Adapter) Db() *gorm.DB

func (*Adapter) Name

func (a *Adapter) Name() string

type ConditionCallback

type ConditionCallback func(data interface{}, db *gorm.DB) *gorm.DB

type EsDatabase

type EsDatabase interface {
	Get(dbname string) (*elastic.Client, error)
	Do(name string, call func(es *elastic.Client) error) error
	Close(name string) error
	CloseAll()
	Select(name string)
}

func NewES

func NewES(cfg []server.Elastic) (EsDatabase, error)

type Logger added in v0.5.27

type Logger struct {
	LogLevel                  gormLogger.LogLevel
	SlowThreshold             time.Duration
	IgnoreRecordNotFoundError bool
}

func (*Logger) Error added in v0.5.30

func (l *Logger) Error(ctx context.Context, msg string, data ...interface{})

Error print error messages

func (*Logger) Info added in v0.5.30

func (l *Logger) Info(ctx context.Context, msg string, data ...interface{})

Info print info

func (*Logger) LogMode added in v0.5.30

func (l *Logger) LogMode(level gormLogger.LogLevel) gormLogger.Interface

LogMode log mode

func (Logger) Trace added in v0.5.30

func (l Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

Trace print sql message

func (*Logger) Warn added in v0.5.30

func (l *Logger) Warn(ctx context.Context, msg string, data ...interface{})

Warn print warn messages

type ScopesFunc

type ScopesFunc func(db *gorm.DB) *gorm.DB

type Sql

type Sql interface {
	Db() *gorm.DB
	Name() string
}

type SqlDatabase

type SqlDatabase interface {
	Get(dbname string) (Sql, error)
	Do(dbname string, c func(db Sql) error) error
	Close(dbname string)
	CloseAll()
	Select(name string)
}

func NewDB

func NewDB(cfgs []server.Sql) (SqlDatabase, error)

Jump to

Keyboard shortcuts

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