Skip to content

Commit

Permalink
Support relate statement
Browse files Browse the repository at this point in the history
  • Loading branch information
zyazhb committed Sep 3, 2024
1 parent 8f4a698 commit b0ef3b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion db.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ func (db *DB) LiveNotifications(liveQueryID string) (chan model.Notification, er
return db.conn.LiveNotifications(liveQueryID)
}

// Create a relation between two records. The data parameter is optional.
func (db *DB) Relate(fromRecordId, table, toRecordId, data interface{}) (interface{}, error) {
return db.send("relate", fromRecordId, table, toRecordId, data)
}

// --------------------------------------------------
// Private methods
// --------------------------------------------------
Expand All @@ -143,7 +148,7 @@ func (db *DB) send(method string, params ...interface{}) (interface{}, error) {
}

switch method {
case "select", "create", "update", "merge", "patch", "insert":
case "select", "create", "update", "merge", "patch", "insert", "relate":
return db.resp(method, params, resp)
case "delete":
return nil, nil
Expand Down

0 comments on commit b0ef3b7

Please sign in to comment.