Skip to content

Commit

Permalink
SetupConnections
Browse files Browse the repository at this point in the history
  • Loading branch information
amirrezaask committed Mar 18, 2022
1 parent e5b53e5 commit 3fb4308
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ type ConnectionConfig struct {
ValidateTablesSchemas bool
}

// Setup declares a new connections for ORM.
func Setup(configs ...ConnectionConfig) error {
// SetupConnections declares a new connections for ORM.
func SetupConnections(configs ...ConnectionConfig) error {

for _, c := range configs {
if err := setupConnection(c); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func setup() error {
if err != nil {
return err
}
return orm.Setup(orm.ConnectionConfig{
return orm.SetupConnections(orm.ConnectionConfig{
Name: "default",
DB: db,
Dialect: orm.Dialects.SQLite3,
Expand Down Expand Up @@ -518,7 +518,7 @@ func TestSetup(t *testing.T) {
_, err = db.Exec(`CREATE TABLE IF NOT EXISTS categories (id INTEGER PRIMARY KEY, title text)`)
// _, err = db.Exec(`CREATE TABLE IF NOT EXISTS post_categories (post_id INTEGER, category_id INTEGER, PRIMARY KEY(post_id, category_id))`)

err = orm.Setup(orm.ConnectionConfig{
err = orm.SetupConnections(orm.ConnectionConfig{
Name: "default",
DB: db,
Dialect: orm.Dialects.SQLite3,
Expand All @@ -538,7 +538,7 @@ func TestSetup(t *testing.T) {
_, err = db.Exec(`CREATE TABLE IF NOT EXISTS categories (id INTEGER PRIMARY KEY, title text)`)
_, err = db.Exec(`CREATE TABLE IF NOT EXISTS post_categories (post_id INTEGER, category_id INTEGER, PRIMARY KEY(post_id, category_id))`)

err = orm.Setup(orm.ConnectionConfig{
err = orm.SetupConnections(orm.ConnectionConfig{
Name: "default",
DB: db,
Dialect: orm.Dialects.SQLite3,
Expand Down
2 changes: 1 addition & 1 deletion schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func setup(t *testing.T) {
db, err := sql.Open("sqlite3", ":memory:")
err = Setup(ConnectionConfig{
err = SetupConnections(ConnectionConfig{
Name: "default",
DB: db,
Dialect: Dialects.SQLite3,
Expand Down

0 comments on commit 3fb4308

Please sign in to comment.