db

package
v0.0.0-...-f501c68 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//MongoDBHosts = fmt.Sprintf("mongodb://%s:%s@%s:%s", os.Getenv("DB_USER"), os.Getenv("DB_PASSWORD"), os.Getenv("DB_HOST"), os.Getenv("DB_PORT"))
	MongoDBHosts = fmt.Sprintf("mongodb://%s:%s", os.Getenv("DB_HOST"), os.Getenv("DB_PORT"))
	AuthDatabase = os.Getenv("DB_NAME")
)
View Source
var (
	Session *mongo.Client
	DBError error
	Ctx     context.Context
)
View Source
var (
	COLLECTIONS_NAME = []string{
		"users",
		"modules",
		"operations",
	}
)

Functions

func CloseSession

func CloseSession(session *mongo.Client)

func ConnectDB

func ConnectDB() (*mongo.Client, context.Context, error)

func DropAndInitDataBase

func DropAndInitDataBase() bool

func GetBooleanData

func GetBooleanData(data map[string]interface{}, bsonData bson.M, field string) error

function get Boolean Data

func GetCollection

func GetCollection(collection string) (*mongo.Collection, error)

func GetFloat64Data

func GetFloat64Data(data map[string]interface{}, bsonData bson.M, field string) error

function get Float64 Data

func GetFloatMatrix

func GetFloatMatrix(data map[string]interface{}, data2Set bson.M, field string) error

Function for get root

func GetIdData

func GetIdData(data map[string]interface{}, bsonData bson.M, field string) error

func GetIntData

func GetIntData(data map[string]interface{}, bsonData bson.M, field string) error

func GetListData

func GetListData(data map[string]interface{}, data2Set bson.M, field string) error

Function for get root

func GetStringData

func GetStringData(data map[string]interface{}, bsonData bson.M, field string) error

function get String Data

func GetTimeData

func GetTimeData(data map[string]interface{}, bsonData bson.M, field string) error

func SetupSubTest

func SetupSubTest(t *testing.T) func(t *testing.T)

function for setup Sub test

func SetupTestCase

func SetupTestCase(t *testing.T) func(t *testing.T)

function for setup test case

Types

type CaseTest

type CaseTest struct {
	Name         string
	Id           primitive.ObjectID
	Idaux        primitive.ObjectID
	NAccess      int
	Order        int
	Position     string
	Nam          string
	Des          string
	Url          string
	Icon         string
	Dni          string
	Period       string
	Address      string
	Days         []string
	Start        time.Time
	End          time.Time
	Model        bson.M
	IdList       []primitive.ObjectID
	ObjectList   []interface{}
	Thereiserror bool
	Action       bool
}

test structure

Jump to

Keyboard shortcuts

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