Esempio n. 1
0
func main() {
	conn = mssql.NewConnection(`192.168.0.200`, "sa", "Password.Sql", "2015_anz_comtrade_source")
	conn.Connect()
	testSelectFromWhere()
	// testSelectFromWhereOrderLimitOffset()
	conn.Close()
}
Esempio n. 2
0
func NewConnection(connectionType string, host string, username string, password string, dbname string) (base.IConnection, error) {
	connectionType = strings.ToLower(connectionType)
	if connectionType == "mongodb" {
		c := mongodb.NewConnection(host, username, password, dbname)
		return c, nil
	} else if connectionType == "mysql" {
		c := mysql.NewConnection(host, username, password, dbname)
		return c, nil
	} else if connectionType == "mssql" {
		c := mssql.NewConnection(host, username, password, dbname)
		return c, nil
	}
	// else if connectionType == "oracle" {
	// 	c := oracle.NewConnection(host, username, password, dbname)
	// 	return c, nil
	// }

	e := err.Error(packageName, "", "NewConnection", fmt.Sprintf("Connection type %s is not yet supported", connectionType))
	return nil, e
}