dialect/sqlgraph: add edges in node creation (#216)

Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/216

WIP - ignore for now

Reviewed By: alexsn

Differential Revision: D18795361

fbshipit-source-id: d3a4ef5562be5faf0837cad6364130ec203a9d37
This commit is contained in:
Ariel Mashraki
2019-12-04 09:43:29 -08:00
committed by Facebook Github Bot
parent a5e4a9cf54
commit bb051603ac
3 changed files with 385 additions and 27 deletions

View File

@@ -6,6 +6,7 @@ package sql
import (
"bytes"
"database/sql/driver"
"fmt"
"strconv"
"strings"
@@ -943,6 +944,11 @@ func InInts(col string, args ...int) *Predicate {
return (&Predicate{}).InInts(col, args...)
}
// InValues adds the `IN` predicate for slice of driver.Value.
func InValues(col string, args ...driver.Value) *Predicate {
return (&Predicate{}).InValues(col, args...)
}
// InInts adds the `IN` predicate for ints.
func (p *Predicate) InInts(col string, args ...int) *Predicate {
iface := make([]interface{}, len(args))
@@ -952,6 +958,15 @@ func (p *Predicate) InInts(col string, args ...int) *Predicate {
return p.In(col, iface...)
}
// InValues adds the `IN` predicate for slice of driver.Value.
func (p *Predicate) InValues(col string, args ...driver.Value) *Predicate {
iface := make([]interface{}, len(args))
for i := range args {
iface[i] = args[i]
}
return p.In(col, iface...)
}
// NotIn returns the `Not IN` predicate.
func NotIn(col string, args ...interface{}) *Predicate {
return (&Predicate{}).NotIn(col, args...)