db

package
v0.5.21 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: Zlib Imports: 17 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 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