diff --git a/chainable_api.go b/chainable_api.go index f0bf8018..6f80d4be 100644 --- a/chainable_api.go +++ b/chainable_api.go @@ -128,6 +128,7 @@ func (db *DB) Or(query interface{}, args ...interface{}) (tx *DB) { } // Joins specify Joins conditions +// db.Joins("Account").Find(&user) // db.Joins("JOIN emails ON emails.user_id = users.id AND emails.email = ?", "jinzhu@example.org").Find(&user) func (db *DB) Joins(query string, args ...interface{}) (tx *DB) { tx = db.getInstance() diff --git a/clause/joins.go b/clause/joins.go new file mode 100644 index 00000000..4983d6fd --- /dev/null +++ b/clause/joins.go @@ -0,0 +1,8 @@ +package clause + +// Joins joins clause +type Joins struct { + Name string + Query string + Vars []interface{} +} diff --git a/tests/joins.go b/tests/joins.go new file mode 100644 index 00000000..3c4bfbb5 --- /dev/null +++ b/tests/joins.go @@ -0,0 +1,10 @@ +package tests + +import ( + "testing" + + "github.com/jinzhu/gorm" +) + +func TestJoins(t *testing.T, db *gorm.DB) { +} diff --git a/tests/tests.go b/tests/tests.go index 65c1ca96..33013032 100644 --- a/tests/tests.go +++ b/tests/tests.go @@ -22,6 +22,7 @@ func RunTestsSuit(t *testing.T, db *gorm.DB) { TestDelete(t, db) TestGroupBy(t, db) + TestJoins(t, db) } func TestCreate(t *testing.T, db *gorm.DB) {