db

package
v0.0.0-...-f6ca644 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound variable
	ErrNotFound = mgo.ErrNotFound
	// ErrCursor variable
	ErrCursor = mgo.ErrCursor
)
View Source
var Resources = make(map[string]*Mongo)

Resources variable

View Source
var SqlResources = make(map[string]*Sql)

SqlResources variable

Functions

func Close

func Close(resourceName string)

Close function

func MgoParseURI

func MgoParseURI(url string, rootCAs *x509.CertPool) (*mgo.DialInfo, error)

MgoParseURI function

Types

type DBServer

type DBServer struct {
	DbServer []DbConfig `json:"dbResources" bson:"dbResources"`
}

DBServer struct

type DbConfig

type DbConfig struct {
	Name     string `json:"name" bson:"name"`
	Engine   string `json:"engine" bson:"engine"`
	Host     string `json:"host" bson:"host"`
	Port     string `json:"port" bson:"port"`
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
	Db       string `json:"db" bson:"db"`
	Ssl      bool   `json:"ssl" bson:"ssl"`
}

DbConfig struct

type Map

type Map map[string]interface{}

Map type

type Mongo

type Mongo struct {
	DbResource DbConfig
	Sess       *mgo.Session
	Conn       *mgo.Database
	Uri        string
	// contains filtered or unexported fields
}

Mongo struct

var Properties *Mongo

Properties variable

func DbConnect

func DbConnect(resourceName string) *Mongo

DbConnect function

func GetDB

func GetDB() *Mongo

GetDB function

func UriConnect

func UriConnect(uri string) *Mongo

UriConnect function

func (*Mongo) C

func (d *Mongo) C(name string, index ...mgo.Index) *mgo.Collection

C method

func (*Mongo) Close

func (d *Mongo) Close()

Close method

func (*Mongo) CloseAll

func (d *Mongo) CloseAll()

CloseAll method

func (*Mongo) Copy

func (d *Mongo) Copy() *mgo.Session

Copy method

func (*Mongo) CopyAll

func (d *Mongo) CopyAll() *Mongo

CopyAll method

func (*Mongo) DB

func (d *Mongo) DB(name string) *Mongo

DB method

func (*Mongo) Refresh

func (d *Mongo) Refresh()

Refresh method

type Sql

type Sql struct {
	DbResource DbConfig
	Sess       *sql.DB
	Conn       *sql.DB
}

Sql struct

var SqlProperties *Sql

SqlProperties variable

func SqlConnect

func SqlConnect(resourceName string) *Sql

SqlConnect function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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