diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 00000000..5c091b5c --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,7 @@ +## v0.0.2 + +* Fixed issue with goqu.New not returning a pointer to a Database + +## v0.0.1 + +* Initial release \ No newline at end of file diff --git a/adapters/mysql/mysql_test.go b/adapters/mysql/mysql_test.go index 80fa7f37..0c9eb7ac 100644 --- a/adapters/mysql/mysql_test.go +++ b/adapters/mysql/mysql_test.go @@ -53,7 +53,7 @@ type ( logger struct{} mysqlTest struct { suite.Suite - db goqu.Database + db *goqu.Database } entry struct { Id uint32 `db:"id" goqu:"skipinsert,skipupdate"` diff --git a/adapters/postgres/postgres_test.go b/adapters/postgres/postgres_test.go index da993a84..e0d758b4 100644 --- a/adapters/postgres/postgres_test.go +++ b/adapters/postgres/postgres_test.go @@ -47,7 +47,7 @@ func init() { type ( postgresTest struct { suite.Suite - db goqu.Database + db *goqu.Database } entry struct { Id uint32 `db:"id" goqu:"skipinsert,skipupdate"` diff --git a/crud_exec_test.go b/crud_exec_test.go new file mode 100644 index 00000000..ccfd4709 --- /dev/null +++ b/crud_exec_test.go @@ -0,0 +1 @@ +package goqu diff --git a/database.go b/database.go index 262b90de..581ff7f2 100644 --- a/database.go +++ b/database.go @@ -50,21 +50,21 @@ type ( // panic(err.Error()) // } // fmt.Printf("%+v", ids) -func New(dialect string, db *sql.DB) Database { - return Database{Dialect: dialect, Db: db} +func New(dialect string, db *sql.DB) *Database { + return &Database{Dialect: dialect, Db: db} } //Starts a new Transaction. -func (me Database) Begin() (TxDatabase, error) { +func (me *Database) Begin() (*TxDatabase, error) { tx, err := me.Db.Begin() if err != nil { - return TxDatabase{}, err + return nil, err } - return TxDatabase{Dialect: me.Dialect, Tx: tx}, nil + return &TxDatabase{Dialect: me.Dialect, Tx: tx}, nil } //used internally to create a new Adapter for a dataset -func (me Database) queryAdapter(dataset *Dataset) Adapter { +func (me *Database) queryAdapter(dataset *Dataset) Adapter { return NewAdapter(me.Dialect, dataset) }