🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

github.com/dzeqkon/mysql-orm

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/dzeqkon/mysql-orm

v0.0.0-20210225060823-5836c20aaa4a
Source
Go
Version published
Created
Source

Go MySQL utils

Two main functions: database operation and automatic ORM(object(struct) relational mapping).

Installation

$ go get -u github.com/Dzeqkon/goutils
$ go get -u github.com/Dzeqkon/mysql-orm

Usage

1. Create a new mysql client:
func TestDbClient() *DBClient {
	var dbConfig dzgmysql.DBConfig
	dbConfig.DbHost = "127.0.0.1"
	dbConfig.DbUser = "root"
	dbConfig.DbPass = "123456"
	dbConfig.IsLocalTime = true
	dbConfig.DbName = "test"
	return dzgmysql.NewDbClient(dbConfig)
}
2. Create Object(struct) Relational Mapping:
func TestGenerateORM(t *testing.T) {
	client := TestDbClient()
	orm := dzgmysql.NewORMGenerator(client)
	orm.AddComment = true
	tabNames := []string{"we_test_tab1", "we_test_tab2"}
	orm.DefaultGenerators(tabNames)
	client.CloseConn()
}

FAQs

Package last updated on 25 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts