db

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Zlib Imports: 20 Imported by: 0

Documentation

Overview

*

  • @author huqiuyun
  • 数据Elasticsearch

*

  • @author huqiuyun
  • 数据服务

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDriver added in v1.6.1

func AddDriver(driverName string, dial DialFunc)

Types

type Adapter

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

Adapter represents the Gorm adapter for policy storage.

func NewAdapter

func NewAdapter(cfg *config.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(ctx context.Context, data interface{}, db *gorm.DB) *gorm.DB

type DialFunc added in v1.6.1

type DialFunc func(string) gorm.Dialector

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(confs []config.Elastic) (EsDatabase, error)

type Logger added in v0.5.27

type Logger struct {
	config.SqlLogger
}

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 []config.Sql) (SqlDatabase, error)

Jump to

Keyboard shortcuts

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