Documentation ¶
Index ¶
- func AppDB() *gorm.DB
- func GormDB(connectionName string) *gorm.DB
- func InitModel()
- func MongoCol(ctx context.Context, collectionName string) *mongo.Collection
- func MongoColInConn(connectionName string, collectionName string) *mongo.Collection
- func MongoColInConnOnDatabase(connectionName string, collectionName string, database string) *mongo.Collection
- func MongoDb(connectionName string) *mongo.Client
- func NewModel()
- func TestInsertPerson()
- type BaseModel
- type Person
- type Product
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitModel ¶
func InitModel()
InitModel this function is the mean to init the model global var and start connections
func MongoColInConn ¶
func MongoColInConn(connectionName string, collectionName string) *mongo.Collection
func MongoColInConnOnDatabase ¶
func MongoColInConnOnDatabase(connectionName string, collectionName string, database string) *mongo.Collection
func MongoDb ¶
MongoDb return a MongoDB connection by name. If empty is empty so will try return the connection of MONGO_DB_CONNECTION env var
func TestInsertPerson ¶
func TestInsertPerson()
Types ¶
type BaseModel ¶
type BaseModel struct { DbConns map[string]interface{} //register your types here MysqlConn *gfmodel.MysqlConn MongoConn *gfmodel.MongoConn }
BaseModel is a datastruct that handler the connections
var Model *BaseModel
Model is a global var that handler connections of application
func (*BaseModel) CloseModels ¶
func (b *BaseModel) CloseModels()
Click to show internal directories.
Click to hide internal directories.