dep upgrade, regenerate
This commit is contained in:
parent
2c11283b4b
commit
2750cadc8b
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/account"
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@ -30,7 +31,8 @@ type Account struct {
|
||||
Active bool `json:"active,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the AccountQuery when eager-loading is set.
|
||||
Edges AccountEdges `json:"edges"`
|
||||
Edges AccountEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// AccountEdges holds the relations/edges for other nodes in the graph.
|
||||
@ -63,8 +65,8 @@ func (e AccountEdges) LogsOrErr() ([]*Logentry, error) {
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Account) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Account) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case account.FieldPassword:
|
||||
@ -78,7 +80,7 @@ func (*Account) scanValues(columns []string) ([]interface{}, error) {
|
||||
case account.FieldCreated, account.FieldModified:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Account", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@ -86,7 +88,7 @@ func (*Account) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Account fields.
|
||||
func (a *Account) assignValues(columns []string, values []interface{}) error {
|
||||
func (a *Account) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@ -134,36 +136,44 @@ func (a *Account) assignValues(columns []string, values []interface{}) error {
|
||||
} else if value.Valid {
|
||||
a.Active = value.Bool
|
||||
}
|
||||
default:
|
||||
a.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Account.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (a *Account) Value(name string) (ent.Value, error) {
|
||||
return a.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryDomains queries the "domains" edge of the Account entity.
|
||||
func (a *Account) QueryDomains() *DomainQuery {
|
||||
return (&AccountClient{config: a.config}).QueryDomains(a)
|
||||
return NewAccountClient(a.config).QueryDomains(a)
|
||||
}
|
||||
|
||||
// QueryLogs queries the "logs" edge of the Account entity.
|
||||
func (a *Account) QueryLogs() *LogentryQuery {
|
||||
return (&AccountClient{config: a.config}).QueryLogs(a)
|
||||
return NewAccountClient(a.config).QueryLogs(a)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Account.
|
||||
// Note that you need to call Account.Unwrap() before calling this method if this Account
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (a *Account) Update() *AccountUpdateOne {
|
||||
return (&AccountClient{config: a.config}).UpdateOne(a)
|
||||
return NewAccountClient(a.config).UpdateOne(a)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the Account entity that was returned from a transaction after it was closed,
|
||||
// so that all future queries will be executed through the driver which created the transaction.
|
||||
func (a *Account) Unwrap() *Account {
|
||||
tx, ok := a.config.driver.(*txDriver)
|
||||
_tx, ok := a.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Account is not a transactional entity")
|
||||
}
|
||||
a.config.driver = tx.drv
|
||||
a.config.driver = _tx.drv
|
||||
return a
|
||||
}
|
||||
|
||||
@ -171,17 +181,22 @@ func (a *Account) Unwrap() *Account {
|
||||
func (a *Account) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("Account(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v", a.ID))
|
||||
builder.WriteString(", created=")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", a.ID))
|
||||
builder.WriteString("created=")
|
||||
builder.WriteString(a.Created.Format(time.ANSIC))
|
||||
builder.WriteString(", modified=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("modified=")
|
||||
builder.WriteString(a.Modified.Format(time.ANSIC))
|
||||
builder.WriteString(", username=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("username=")
|
||||
builder.WriteString(a.Username)
|
||||
builder.WriteString(", password=<sensitive>")
|
||||
builder.WriteString(", super=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("password=<sensitive>")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("super=")
|
||||
builder.WriteString(fmt.Sprintf("%v", a.Super))
|
||||
builder.WriteString(", active=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("active=")
|
||||
builder.WriteString(fmt.Sprintf("%v", a.Active))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
@ -189,9 +204,3 @@ func (a *Account) String() string {
|
||||
|
||||
// Accounts is a parsable slice of Account.
|
||||
type Accounts []*Account
|
||||
|
||||
func (a Accounts) config(cfg config) {
|
||||
for _i := range a {
|
||||
a[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package account
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -78,3 +81,78 @@ var (
|
||||
// UpdateDefaultModified holds the default value on update for the "modified" field.
|
||||
UpdateDefaultModified func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Account queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreated orders the results by the created field.
|
||||
func ByCreated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModified orders the results by the modified field.
|
||||
func ByModified(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModified, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUsername orders the results by the username field.
|
||||
func ByUsername(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUsername, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySuper orders the results by the super field.
|
||||
func BySuper(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSuper, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByActive orders the results by the active field.
|
||||
func ByActive(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldActive, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDomainsCount orders the results by domains count.
|
||||
func ByDomainsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newDomainsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByDomains orders the results by domains terms.
|
||||
func ByDomains(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newDomainsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByLogsCount orders the results by logs count.
|
||||
func ByLogsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newLogsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByLogs orders the results by logs terms.
|
||||
func ByLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newLogsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newDomainsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DomainsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, DomainsTable, DomainsPrimaryKey...),
|
||||
)
|
||||
}
|
||||
func newLogsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(LogsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, LogsTable, LogsColumn),
|
||||
)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package account
|
||||
|
||||
@ -12,508 +12,292 @@ import (
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Account(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(ids) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
v := make([]interface{}, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Account(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(ids) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
v := make([]interface{}, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Account(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Account(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Account(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Account(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Account(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Created applies equality check predicate on the "created" field. It's identical to CreatedEQ.
|
||||
func Created(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldCreated, v))
|
||||
}
|
||||
|
||||
// Modified applies equality check predicate on the "modified" field. It's identical to ModifiedEQ.
|
||||
func Modified(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldModified, v))
|
||||
}
|
||||
|
||||
// Username applies equality check predicate on the "username" field. It's identical to UsernameEQ.
|
||||
func Username(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldUsername, v))
|
||||
}
|
||||
|
||||
// Password applies equality check predicate on the "password" field. It's identical to PasswordEQ.
|
||||
func Password(v []byte) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldPassword), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldPassword, v))
|
||||
}
|
||||
|
||||
// Super applies equality check predicate on the "super" field. It's identical to SuperEQ.
|
||||
func Super(v bool) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldSuper), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldSuper, v))
|
||||
}
|
||||
|
||||
// Active applies equality check predicate on the "active" field. It's identical to ActiveEQ.
|
||||
func Active(v bool) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldActive), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldActive, v))
|
||||
}
|
||||
|
||||
// CreatedEQ applies the EQ predicate on the "created" field.
|
||||
func CreatedEQ(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldCreated, v))
|
||||
}
|
||||
|
||||
// CreatedNEQ applies the NEQ predicate on the "created" field.
|
||||
func CreatedNEQ(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldNEQ(FieldCreated, v))
|
||||
}
|
||||
|
||||
// CreatedIn applies the In predicate on the "created" field.
|
||||
func CreatedIn(vs ...time.Time) predicate.Account {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldCreated), v...))
|
||||
})
|
||||
return predicate.Account(sql.FieldIn(FieldCreated, vs...))
|
||||
}
|
||||
|
||||
// CreatedNotIn applies the NotIn predicate on the "created" field.
|
||||
func CreatedNotIn(vs ...time.Time) predicate.Account {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldCreated), v...))
|
||||
})
|
||||
return predicate.Account(sql.FieldNotIn(FieldCreated, vs...))
|
||||
}
|
||||
|
||||
// CreatedGT applies the GT predicate on the "created" field.
|
||||
func CreatedGT(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldGT(FieldCreated, v))
|
||||
}
|
||||
|
||||
// CreatedGTE applies the GTE predicate on the "created" field.
|
||||
func CreatedGTE(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldGTE(FieldCreated, v))
|
||||
}
|
||||
|
||||
// CreatedLT applies the LT predicate on the "created" field.
|
||||
func CreatedLT(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldLT(FieldCreated, v))
|
||||
}
|
||||
|
||||
// CreatedLTE applies the LTE predicate on the "created" field.
|
||||
func CreatedLTE(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldLTE(FieldCreated, v))
|
||||
}
|
||||
|
||||
// ModifiedEQ applies the EQ predicate on the "modified" field.
|
||||
func ModifiedEQ(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedNEQ applies the NEQ predicate on the "modified" field.
|
||||
func ModifiedNEQ(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldNEQ(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedIn applies the In predicate on the "modified" field.
|
||||
func ModifiedIn(vs ...time.Time) predicate.Account {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldModified), v...))
|
||||
})
|
||||
return predicate.Account(sql.FieldIn(FieldModified, vs...))
|
||||
}
|
||||
|
||||
// ModifiedNotIn applies the NotIn predicate on the "modified" field.
|
||||
func ModifiedNotIn(vs ...time.Time) predicate.Account {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldModified), v...))
|
||||
})
|
||||
return predicate.Account(sql.FieldNotIn(FieldModified, vs...))
|
||||
}
|
||||
|
||||
// ModifiedGT applies the GT predicate on the "modified" field.
|
||||
func ModifiedGT(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldGT(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedGTE applies the GTE predicate on the "modified" field.
|
||||
func ModifiedGTE(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldGTE(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedLT applies the LT predicate on the "modified" field.
|
||||
func ModifiedLT(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldLT(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedLTE applies the LTE predicate on the "modified" field.
|
||||
func ModifiedLTE(v time.Time) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldLTE(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedIsNil applies the IsNil predicate on the "modified" field.
|
||||
func ModifiedIsNil() predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldModified)))
|
||||
})
|
||||
return predicate.Account(sql.FieldIsNull(FieldModified))
|
||||
}
|
||||
|
||||
// ModifiedNotNil applies the NotNil predicate on the "modified" field.
|
||||
func ModifiedNotNil() predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldModified)))
|
||||
})
|
||||
return predicate.Account(sql.FieldNotNull(FieldModified))
|
||||
}
|
||||
|
||||
// UsernameEQ applies the EQ predicate on the "username" field.
|
||||
func UsernameEQ(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameNEQ applies the NEQ predicate on the "username" field.
|
||||
func UsernameNEQ(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldNEQ(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameIn applies the In predicate on the "username" field.
|
||||
func UsernameIn(vs ...string) predicate.Account {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldUsername), v...))
|
||||
})
|
||||
return predicate.Account(sql.FieldIn(FieldUsername, vs...))
|
||||
}
|
||||
|
||||
// UsernameNotIn applies the NotIn predicate on the "username" field.
|
||||
func UsernameNotIn(vs ...string) predicate.Account {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldUsername), v...))
|
||||
})
|
||||
return predicate.Account(sql.FieldNotIn(FieldUsername, vs...))
|
||||
}
|
||||
|
||||
// UsernameGT applies the GT predicate on the "username" field.
|
||||
func UsernameGT(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldGT(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameGTE applies the GTE predicate on the "username" field.
|
||||
func UsernameGTE(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldGTE(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameLT applies the LT predicate on the "username" field.
|
||||
func UsernameLT(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldLT(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameLTE applies the LTE predicate on the "username" field.
|
||||
func UsernameLTE(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldLTE(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameContains applies the Contains predicate on the "username" field.
|
||||
func UsernameContains(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.Contains(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldContains(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameHasPrefix applies the HasPrefix predicate on the "username" field.
|
||||
func UsernameHasPrefix(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.HasPrefix(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldHasPrefix(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameHasSuffix applies the HasSuffix predicate on the "username" field.
|
||||
func UsernameHasSuffix(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.HasSuffix(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldHasSuffix(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameEqualFold applies the EqualFold predicate on the "username" field.
|
||||
func UsernameEqualFold(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EqualFold(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEqualFold(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameContainsFold applies the ContainsFold predicate on the "username" field.
|
||||
func UsernameContainsFold(v string) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.ContainsFold(s.C(FieldUsername), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldContainsFold(FieldUsername, v))
|
||||
}
|
||||
|
||||
// PasswordEQ applies the EQ predicate on the "password" field.
|
||||
func PasswordEQ(v []byte) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldPassword), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldPassword, v))
|
||||
}
|
||||
|
||||
// PasswordNEQ applies the NEQ predicate on the "password" field.
|
||||
func PasswordNEQ(v []byte) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldPassword), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldNEQ(FieldPassword, v))
|
||||
}
|
||||
|
||||
// PasswordIn applies the In predicate on the "password" field.
|
||||
func PasswordIn(vs ...[]byte) predicate.Account {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldPassword), v...))
|
||||
})
|
||||
return predicate.Account(sql.FieldIn(FieldPassword, vs...))
|
||||
}
|
||||
|
||||
// PasswordNotIn applies the NotIn predicate on the "password" field.
|
||||
func PasswordNotIn(vs ...[]byte) predicate.Account {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldPassword), v...))
|
||||
})
|
||||
return predicate.Account(sql.FieldNotIn(FieldPassword, vs...))
|
||||
}
|
||||
|
||||
// PasswordGT applies the GT predicate on the "password" field.
|
||||
func PasswordGT(v []byte) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldPassword), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldGT(FieldPassword, v))
|
||||
}
|
||||
|
||||
// PasswordGTE applies the GTE predicate on the "password" field.
|
||||
func PasswordGTE(v []byte) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldPassword), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldGTE(FieldPassword, v))
|
||||
}
|
||||
|
||||
// PasswordLT applies the LT predicate on the "password" field.
|
||||
func PasswordLT(v []byte) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldPassword), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldLT(FieldPassword, v))
|
||||
}
|
||||
|
||||
// PasswordLTE applies the LTE predicate on the "password" field.
|
||||
func PasswordLTE(v []byte) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldPassword), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldLTE(FieldPassword, v))
|
||||
}
|
||||
|
||||
// SuperEQ applies the EQ predicate on the "super" field.
|
||||
func SuperEQ(v bool) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldSuper), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldSuper, v))
|
||||
}
|
||||
|
||||
// SuperNEQ applies the NEQ predicate on the "super" field.
|
||||
func SuperNEQ(v bool) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldSuper), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldNEQ(FieldSuper, v))
|
||||
}
|
||||
|
||||
// ActiveEQ applies the EQ predicate on the "active" field.
|
||||
func ActiveEQ(v bool) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldActive), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldEQ(FieldActive, v))
|
||||
}
|
||||
|
||||
// ActiveNEQ applies the NEQ predicate on the "active" field.
|
||||
func ActiveNEQ(v bool) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldActive), v))
|
||||
})
|
||||
return predicate.Account(sql.FieldNEQ(FieldActive, v))
|
||||
}
|
||||
|
||||
// HasDomains applies the HasEdge predicate on the "domains" edge.
|
||||
@ -521,7 +305,6 @@ func HasDomains() predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DomainsTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, DomainsTable, DomainsPrimaryKey...),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
@ -531,11 +314,7 @@ func HasDomains() predicate.Account {
|
||||
// HasDomainsWith applies the HasEdge predicate on the "domains" edge with a given conditions (other predicates).
|
||||
func HasDomainsWith(preds ...predicate.Domain) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DomainsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, DomainsTable, DomainsPrimaryKey...),
|
||||
)
|
||||
step := newDomainsStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@ -549,7 +328,6 @@ func HasLogs() predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(LogsTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, LogsTable, LogsColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
@ -559,11 +337,7 @@ func HasLogs() predicate.Account {
|
||||
// HasLogsWith applies the HasEdge predicate on the "logs" edge with a given conditions (other predicates).
|
||||
func HasLogsWith(preds ...predicate.Logentry) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(LogsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, LogsTable, LogsColumn),
|
||||
)
|
||||
step := newLogsStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@ -574,32 +348,15 @@ func HasLogsWith(preds ...predicate.Logentry) predicate.Account {
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Account) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for _, p := range predicates {
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Account(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Account) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for i, p := range predicates {
|
||||
if i > 0 {
|
||||
s1.Or()
|
||||
}
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Account(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Account) predicate.Account {
|
||||
return predicate.Account(func(s *sql.Selector) {
|
||||
p(s.Not())
|
||||
})
|
||||
return predicate.Account(sql.NotPredicates(p))
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -117,44 +117,8 @@ func (ac *AccountCreate) Mutation() *AccountMutation {
|
||||
|
||||
// Save creates the Account in the database.
|
||||
func (ac *AccountCreate) Save(ctx context.Context) (*Account, error) {
|
||||
var (
|
||||
err error
|
||||
node *Account
|
||||
)
|
||||
ac.defaults()
|
||||
if len(ac.hooks) == 0 {
|
||||
if err = ac.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = ac.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*AccountMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = ac.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ac.mutation = mutation
|
||||
if node, err = ac.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(ac.hooks) - 1; i >= 0; i-- {
|
||||
if ac.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = ac.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, ac.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
return withHooks(ctx, ac.sqlSave, ac.mutation, ac.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@ -212,10 +176,13 @@ func (ac *AccountCreate) check() error {
|
||||
}
|
||||
|
||||
func (ac *AccountCreate) sqlSave(ctx context.Context) (*Account, error) {
|
||||
if err := ac.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := ac.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, ac.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@ -223,70 +190,42 @@ func (ac *AccountCreate) sqlSave(ctx context.Context) (*Account, error) {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
ac.mutation.id = &_node.ID
|
||||
ac.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (ac *AccountCreate) createSpec() (*Account, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Account{config: ac.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: account.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
}
|
||||
_spec = sqlgraph.NewCreateSpec(account.Table, sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := ac.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := ac.mutation.Created(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: account.FieldCreated,
|
||||
})
|
||||
_spec.SetField(account.FieldCreated, field.TypeTime, value)
|
||||
_node.Created = value
|
||||
}
|
||||
if value, ok := ac.mutation.Modified(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: account.FieldModified,
|
||||
})
|
||||
_spec.SetField(account.FieldModified, field.TypeTime, value)
|
||||
_node.Modified = value
|
||||
}
|
||||
if value, ok := ac.mutation.Username(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: account.FieldUsername,
|
||||
})
|
||||
_spec.SetField(account.FieldUsername, field.TypeString, value)
|
||||
_node.Username = value
|
||||
}
|
||||
if value, ok := ac.mutation.Password(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBytes,
|
||||
Value: value,
|
||||
Column: account.FieldPassword,
|
||||
})
|
||||
_spec.SetField(account.FieldPassword, field.TypeBytes, value)
|
||||
_node.Password = value
|
||||
}
|
||||
if value, ok := ac.mutation.Super(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: account.FieldSuper,
|
||||
})
|
||||
_spec.SetField(account.FieldSuper, field.TypeBool, value)
|
||||
_node.Super = value
|
||||
}
|
||||
if value, ok := ac.mutation.Active(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: account.FieldActive,
|
||||
})
|
||||
_spec.SetField(account.FieldActive, field.TypeBool, value)
|
||||
_node.Active = value
|
||||
}
|
||||
if nodes := ac.mutation.DomainsIDs(); len(nodes) > 0 {
|
||||
@ -297,10 +236,7 @@ func (ac *AccountCreate) createSpec() (*Account, *sqlgraph.CreateSpec) {
|
||||
Columns: account.DomainsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -316,10 +252,7 @@ func (ac *AccountCreate) createSpec() (*Account, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{account.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -333,11 +266,15 @@ func (ac *AccountCreate) createSpec() (*Account, *sqlgraph.CreateSpec) {
|
||||
// AccountCreateBulk is the builder for creating many Account entities in bulk.
|
||||
type AccountCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*AccountCreate
|
||||
}
|
||||
|
||||
// Save creates the Account entities in the database.
|
||||
func (acb *AccountCreateBulk) Save(ctx context.Context) ([]*Account, error) {
|
||||
if acb.err != nil {
|
||||
return nil, acb.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(acb.builders))
|
||||
nodes := make([]*Account, len(acb.builders))
|
||||
mutators := make([]Mutator, len(acb.builders))
|
||||
@ -354,8 +291,8 @@ func (acb *AccountCreateBulk) Save(ctx context.Context) ([]*Account, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, acb.builders[i+1].mutation)
|
||||
} else {
|
||||
@ -363,7 +300,7 @@ func (acb *AccountCreateBulk) Save(ctx context.Context) ([]*Account, error) {
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, acb.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -371,11 +308,11 @@ func (acb *AccountCreateBulk) Save(ctx context.Context) ([]*Account, error) {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
mutation.done = true
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
|
@ -1,10 +1,9 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/account"
|
||||
"code.icod.de/postfix/manager/ent/predicate"
|
||||
@ -28,34 +27,7 @@ func (ad *AccountDelete) Where(ps ...predicate.Account) *AccountDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (ad *AccountDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(ad.hooks) == 0 {
|
||||
affected, err = ad.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*AccountMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
ad.mutation = mutation
|
||||
affected, err = ad.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(ad.hooks) - 1; i >= 0; i-- {
|
||||
if ad.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = ad.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, ad.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, ad.sqlExec, ad.mutation, ad.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
@ -68,15 +40,7 @@ func (ad *AccountDelete) ExecX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
func (ad *AccountDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: account.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewDeleteSpec(account.Table, sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64))
|
||||
if ps := ad.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@ -84,7 +48,12 @@ func (ad *AccountDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, ad.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, ad.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
ad.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// AccountDeleteOne is the builder for deleting a single Account entity.
|
||||
@ -92,6 +61,12 @@ type AccountDeleteOne struct {
|
||||
ad *AccountDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the AccountDelete builder.
|
||||
func (ado *AccountDeleteOne) Where(ps ...predicate.Account) *AccountDeleteOne {
|
||||
ado.ad.mutation.Where(ps...)
|
||||
return ado
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (ado *AccountDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := ado.ad.Exec(ctx)
|
||||
@ -107,5 +82,7 @@ func (ado *AccountDeleteOne) Exec(ctx context.Context) error {
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (ado *AccountDeleteOne) ExecX(ctx context.Context) {
|
||||
ado.ad.ExecX(ctx)
|
||||
if err := ado.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -48,6 +48,14 @@ func (au *AccountUpdate) SetUsername(s string) *AccountUpdate {
|
||||
return au
|
||||
}
|
||||
|
||||
// SetNillableUsername sets the "username" field if the given value is not nil.
|
||||
func (au *AccountUpdate) SetNillableUsername(s *string) *AccountUpdate {
|
||||
if s != nil {
|
||||
au.SetUsername(*s)
|
||||
}
|
||||
return au
|
||||
}
|
||||
|
||||
// SetPassword sets the "password" field.
|
||||
func (au *AccountUpdate) SetPassword(b []byte) *AccountUpdate {
|
||||
au.mutation.SetPassword(b)
|
||||
@ -60,12 +68,28 @@ func (au *AccountUpdate) SetSuper(b bool) *AccountUpdate {
|
||||
return au
|
||||
}
|
||||
|
||||
// SetNillableSuper sets the "super" field if the given value is not nil.
|
||||
func (au *AccountUpdate) SetNillableSuper(b *bool) *AccountUpdate {
|
||||
if b != nil {
|
||||
au.SetSuper(*b)
|
||||
}
|
||||
return au
|
||||
}
|
||||
|
||||
// SetActive sets the "active" field.
|
||||
func (au *AccountUpdate) SetActive(b bool) *AccountUpdate {
|
||||
au.mutation.SetActive(b)
|
||||
return au
|
||||
}
|
||||
|
||||
// SetNillableActive sets the "active" field if the given value is not nil.
|
||||
func (au *AccountUpdate) SetNillableActive(b *bool) *AccountUpdate {
|
||||
if b != nil {
|
||||
au.SetActive(*b)
|
||||
}
|
||||
return au
|
||||
}
|
||||
|
||||
// AddDomainIDs adds the "domains" edge to the Domain entity by IDs.
|
||||
func (au *AccountUpdate) AddDomainIDs(ids ...int64) *AccountUpdate {
|
||||
au.mutation.AddDomainIDs(ids...)
|
||||
@ -145,35 +169,8 @@ func (au *AccountUpdate) RemoveLogs(l ...*Logentry) *AccountUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (au *AccountUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
au.defaults()
|
||||
if len(au.hooks) == 0 {
|
||||
affected, err = au.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*AccountMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
au.mutation = mutation
|
||||
affected, err = au.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(au.hooks) - 1; i >= 0; i-- {
|
||||
if au.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = au.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, au.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, au.sqlSave, au.mutation, au.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@ -207,16 +204,7 @@ func (au *AccountUpdate) defaults() {
|
||||
}
|
||||
|
||||
func (au *AccountUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: account.Table,
|
||||
Columns: account.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(account.Table, account.Columns, sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64))
|
||||
if ps := au.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@ -225,45 +213,22 @@ func (au *AccountUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
}
|
||||
if value, ok := au.mutation.Modified(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: account.FieldModified,
|
||||
})
|
||||
_spec.SetField(account.FieldModified, field.TypeTime, value)
|
||||
}
|
||||
if au.mutation.ModifiedCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Column: account.FieldModified,
|
||||
})
|
||||
_spec.ClearField(account.FieldModified, field.TypeTime)
|
||||
}
|
||||
if value, ok := au.mutation.Username(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: account.FieldUsername,
|
||||
})
|
||||
_spec.SetField(account.FieldUsername, field.TypeString, value)
|
||||
}
|
||||
if value, ok := au.mutation.Password(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBytes,
|
||||
Value: value,
|
||||
Column: account.FieldPassword,
|
||||
})
|
||||
_spec.SetField(account.FieldPassword, field.TypeBytes, value)
|
||||
}
|
||||
if value, ok := au.mutation.Super(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: account.FieldSuper,
|
||||
})
|
||||
_spec.SetField(account.FieldSuper, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := au.mutation.Active(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: account.FieldActive,
|
||||
})
|
||||
_spec.SetField(account.FieldActive, field.TypeBool, value)
|
||||
}
|
||||
if au.mutation.DomainsCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@ -273,10 +238,7 @@ func (au *AccountUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: account.DomainsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -289,10 +251,7 @@ func (au *AccountUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: account.DomainsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -308,10 +267,7 @@ func (au *AccountUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: account.DomainsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -327,10 +283,7 @@ func (au *AccountUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{account.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -343,10 +296,7 @@ func (au *AccountUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{account.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -362,10 +312,7 @@ func (au *AccountUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{account.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -377,10 +324,11 @@ func (au *AccountUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{account.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
au.mutation.done = true
|
||||
return n, nil
|
||||
}
|
||||
|
||||
@ -410,6 +358,14 @@ func (auo *AccountUpdateOne) SetUsername(s string) *AccountUpdateOne {
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetNillableUsername sets the "username" field if the given value is not nil.
|
||||
func (auo *AccountUpdateOne) SetNillableUsername(s *string) *AccountUpdateOne {
|
||||
if s != nil {
|
||||
auo.SetUsername(*s)
|
||||
}
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetPassword sets the "password" field.
|
||||
func (auo *AccountUpdateOne) SetPassword(b []byte) *AccountUpdateOne {
|
||||
auo.mutation.SetPassword(b)
|
||||
@ -422,12 +378,28 @@ func (auo *AccountUpdateOne) SetSuper(b bool) *AccountUpdateOne {
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetNillableSuper sets the "super" field if the given value is not nil.
|
||||
func (auo *AccountUpdateOne) SetNillableSuper(b *bool) *AccountUpdateOne {
|
||||
if b != nil {
|
||||
auo.SetSuper(*b)
|
||||
}
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetActive sets the "active" field.
|
||||
func (auo *AccountUpdateOne) SetActive(b bool) *AccountUpdateOne {
|
||||
auo.mutation.SetActive(b)
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetNillableActive sets the "active" field if the given value is not nil.
|
||||
func (auo *AccountUpdateOne) SetNillableActive(b *bool) *AccountUpdateOne {
|
||||
if b != nil {
|
||||
auo.SetActive(*b)
|
||||
}
|
||||
return auo
|
||||
}
|
||||
|
||||
// AddDomainIDs adds the "domains" edge to the Domain entity by IDs.
|
||||
func (auo *AccountUpdateOne) AddDomainIDs(ids ...int64) *AccountUpdateOne {
|
||||
auo.mutation.AddDomainIDs(ids...)
|
||||
@ -505,6 +477,12 @@ func (auo *AccountUpdateOne) RemoveLogs(l ...*Logentry) *AccountUpdateOne {
|
||||
return auo.RemoveLogIDs(ids...)
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the AccountUpdate builder.
|
||||
func (auo *AccountUpdateOne) Where(ps ...predicate.Account) *AccountUpdateOne {
|
||||
auo.mutation.Where(ps...)
|
||||
return auo
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (auo *AccountUpdateOne) Select(field string, fields ...string) *AccountUpdateOne {
|
||||
@ -514,35 +492,8 @@ func (auo *AccountUpdateOne) Select(field string, fields ...string) *AccountUpda
|
||||
|
||||
// Save executes the query and returns the updated Account entity.
|
||||
func (auo *AccountUpdateOne) Save(ctx context.Context) (*Account, error) {
|
||||
var (
|
||||
err error
|
||||
node *Account
|
||||
)
|
||||
auo.defaults()
|
||||
if len(auo.hooks) == 0 {
|
||||
node, err = auo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*AccountMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
auo.mutation = mutation
|
||||
node, err = auo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(auo.hooks) - 1; i >= 0; i-- {
|
||||
if auo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = auo.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, auo.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
return withHooks(ctx, auo.sqlSave, auo.mutation, auo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@ -576,16 +527,7 @@ func (auo *AccountUpdateOne) defaults() {
|
||||
}
|
||||
|
||||
func (auo *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: account.Table,
|
||||
Columns: account.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(account.Table, account.Columns, sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64))
|
||||
id, ok := auo.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Account.id" for update`)}
|
||||
@ -611,45 +553,22 @@ func (auo *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err e
|
||||
}
|
||||
}
|
||||
if value, ok := auo.mutation.Modified(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: account.FieldModified,
|
||||
})
|
||||
_spec.SetField(account.FieldModified, field.TypeTime, value)
|
||||
}
|
||||
if auo.mutation.ModifiedCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Column: account.FieldModified,
|
||||
})
|
||||
_spec.ClearField(account.FieldModified, field.TypeTime)
|
||||
}
|
||||
if value, ok := auo.mutation.Username(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: account.FieldUsername,
|
||||
})
|
||||
_spec.SetField(account.FieldUsername, field.TypeString, value)
|
||||
}
|
||||
if value, ok := auo.mutation.Password(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBytes,
|
||||
Value: value,
|
||||
Column: account.FieldPassword,
|
||||
})
|
||||
_spec.SetField(account.FieldPassword, field.TypeBytes, value)
|
||||
}
|
||||
if value, ok := auo.mutation.Super(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: account.FieldSuper,
|
||||
})
|
||||
_spec.SetField(account.FieldSuper, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := auo.mutation.Active(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: account.FieldActive,
|
||||
})
|
||||
_spec.SetField(account.FieldActive, field.TypeBool, value)
|
||||
}
|
||||
if auo.mutation.DomainsCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@ -659,10 +578,7 @@ func (auo *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err e
|
||||
Columns: account.DomainsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -675,10 +591,7 @@ func (auo *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err e
|
||||
Columns: account.DomainsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -694,10 +607,7 @@ func (auo *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err e
|
||||
Columns: account.DomainsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -713,10 +623,7 @@ func (auo *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err e
|
||||
Columns: []string{account.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -729,10 +636,7 @@ func (auo *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err e
|
||||
Columns: []string{account.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -748,10 +652,7 @@ func (auo *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err e
|
||||
Columns: []string{account.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -766,9 +667,10 @@ func (auo *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err e
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{account.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
auo.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
61
ent/alias.go
61
ent/alias.go
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"code.icod.de/postfix/manager/ent/alias"
|
||||
"code.icod.de/postfix/manager/ent/domain"
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@ -29,7 +30,8 @@ type Alias struct {
|
||||
Active bool `json:"active,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the AliasQuery when eager-loading is set.
|
||||
Edges AliasEdges `json:"edges"`
|
||||
Edges AliasEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// AliasEdges holds the relations/edges for other nodes in the graph.
|
||||
@ -44,20 +46,17 @@ type AliasEdges struct {
|
||||
// DomainOrErr returns the Domain value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e AliasEdges) DomainOrErr() (*Domain, error) {
|
||||
if e.loadedTypes[0] {
|
||||
if e.Domain == nil {
|
||||
// The edge domain was loaded in eager-loading,
|
||||
// but was not found.
|
||||
return nil, &NotFoundError{label: domain.Label}
|
||||
}
|
||||
if e.Domain != nil {
|
||||
return e.Domain, nil
|
||||
} else if e.loadedTypes[0] {
|
||||
return nil, &NotFoundError{label: domain.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "domain"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Alias) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Alias) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case alias.FieldActive:
|
||||
@ -69,7 +68,7 @@ func (*Alias) scanValues(columns []string) ([]interface{}, error) {
|
||||
case alias.FieldCreated, alias.FieldModified:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Alias", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@ -77,7 +76,7 @@ func (*Alias) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Alias fields.
|
||||
func (a *Alias) assignValues(columns []string, values []interface{}) error {
|
||||
func (a *Alias) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@ -120,31 +119,39 @@ func (a *Alias) assignValues(columns []string, values []interface{}) error {
|
||||
} else if value.Valid {
|
||||
a.Active = value.Bool
|
||||
}
|
||||
default:
|
||||
a.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Alias.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (a *Alias) Value(name string) (ent.Value, error) {
|
||||
return a.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryDomain queries the "domain" edge of the Alias entity.
|
||||
func (a *Alias) QueryDomain() *DomainQuery {
|
||||
return (&AliasClient{config: a.config}).QueryDomain(a)
|
||||
return NewAliasClient(a.config).QueryDomain(a)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Alias.
|
||||
// Note that you need to call Alias.Unwrap() before calling this method if this Alias
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (a *Alias) Update() *AliasUpdateOne {
|
||||
return (&AliasClient{config: a.config}).UpdateOne(a)
|
||||
return NewAliasClient(a.config).UpdateOne(a)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the Alias entity that was returned from a transaction after it was closed,
|
||||
// so that all future queries will be executed through the driver which created the transaction.
|
||||
func (a *Alias) Unwrap() *Alias {
|
||||
tx, ok := a.config.driver.(*txDriver)
|
||||
_tx, ok := a.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Alias is not a transactional entity")
|
||||
}
|
||||
a.config.driver = tx.drv
|
||||
a.config.driver = _tx.drv
|
||||
return a
|
||||
}
|
||||
|
||||
@ -152,18 +159,22 @@ func (a *Alias) Unwrap() *Alias {
|
||||
func (a *Alias) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("Alias(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v", a.ID))
|
||||
builder.WriteString(", created=")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", a.ID))
|
||||
builder.WriteString("created=")
|
||||
builder.WriteString(a.Created.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := a.Modified; v != nil {
|
||||
builder.WriteString(", modified=")
|
||||
builder.WriteString("modified=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", domain_id=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("domain_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", a.DomainID))
|
||||
builder.WriteString(", goto=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("goto=")
|
||||
builder.WriteString(a.Goto)
|
||||
builder.WriteString(", active=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("active=")
|
||||
builder.WriteString(fmt.Sprintf("%v", a.Active))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
@ -171,9 +182,3 @@ func (a *Alias) String() string {
|
||||
|
||||
// AliasSlice is a parsable slice of Alias.
|
||||
type AliasSlice []*Alias
|
||||
|
||||
func (a AliasSlice) config(cfg config) {
|
||||
for _i := range a {
|
||||
a[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package alias
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -62,3 +65,50 @@ var (
|
||||
// UpdateDefaultModified holds the default value on update for the "modified" field.
|
||||
UpdateDefaultModified func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Alias queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreated orders the results by the created field.
|
||||
func ByCreated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModified orders the results by the modified field.
|
||||
func ByModified(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModified, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDomainID orders the results by the domain_id field.
|
||||
func ByDomainID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDomainID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGoto orders the results by the goto field.
|
||||
func ByGoto(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGoto, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByActive orders the results by the active field.
|
||||
func ByActive(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldActive, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDomainField orders the results by domain field.
|
||||
func ByDomainField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newDomainStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newDomainStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DomainInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, DomainTable, DomainColumn),
|
||||
)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package alias
|
||||
|
||||
@ -12,473 +12,267 @@ import (
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(ids) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
v := make([]interface{}, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Alias(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(ids) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
v := make([]interface{}, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Alias(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Alias(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Alias(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Alias(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Created applies equality check predicate on the "created" field. It's identical to CreatedEQ.
|
||||
func Created(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldCreated, v))
|
||||
}
|
||||
|
||||
// Modified applies equality check predicate on the "modified" field. It's identical to ModifiedEQ.
|
||||
func Modified(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldModified, v))
|
||||
}
|
||||
|
||||
// DomainID applies equality check predicate on the "domain_id" field. It's identical to DomainIDEQ.
|
||||
func DomainID(v int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldDomainID), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldDomainID, v))
|
||||
}
|
||||
|
||||
// Goto applies equality check predicate on the "goto" field. It's identical to GotoEQ.
|
||||
func Goto(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldGoto, v))
|
||||
}
|
||||
|
||||
// Active applies equality check predicate on the "active" field. It's identical to ActiveEQ.
|
||||
func Active(v bool) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldActive), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldActive, v))
|
||||
}
|
||||
|
||||
// CreatedEQ applies the EQ predicate on the "created" field.
|
||||
func CreatedEQ(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldCreated, v))
|
||||
}
|
||||
|
||||
// CreatedNEQ applies the NEQ predicate on the "created" field.
|
||||
func CreatedNEQ(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNEQ(FieldCreated, v))
|
||||
}
|
||||
|
||||
// CreatedIn applies the In predicate on the "created" field.
|
||||
func CreatedIn(vs ...time.Time) predicate.Alias {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldCreated), v...))
|
||||
})
|
||||
return predicate.Alias(sql.FieldIn(FieldCreated, vs...))
|
||||
}
|
||||
|
||||
// CreatedNotIn applies the NotIn predicate on the "created" field.
|
||||
func CreatedNotIn(vs ...time.Time) predicate.Alias {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldCreated), v...))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNotIn(FieldCreated, vs...))
|
||||
}
|
||||
|
||||
// CreatedGT applies the GT predicate on the "created" field.
|
||||
func CreatedGT(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldGT(FieldCreated, v))
|
||||
}
|
||||
|
||||
// CreatedGTE applies the GTE predicate on the "created" field.
|
||||
func CreatedGTE(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldGTE(FieldCreated, v))
|
||||
}
|
||||
|
||||
// CreatedLT applies the LT predicate on the "created" field.
|
||||
func CreatedLT(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldLT(FieldCreated, v))
|
||||
}
|
||||
|
||||
// CreatedLTE applies the LTE predicate on the "created" field.
|
||||
func CreatedLTE(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldCreated), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldLTE(FieldCreated, v))
|
||||
}
|
||||
|
||||
// ModifiedEQ applies the EQ predicate on the "modified" field.
|
||||
func ModifiedEQ(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedNEQ applies the NEQ predicate on the "modified" field.
|
||||
func ModifiedNEQ(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNEQ(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedIn applies the In predicate on the "modified" field.
|
||||
func ModifiedIn(vs ...time.Time) predicate.Alias {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldModified), v...))
|
||||
})
|
||||
return predicate.Alias(sql.FieldIn(FieldModified, vs...))
|
||||
}
|
||||
|
||||
// ModifiedNotIn applies the NotIn predicate on the "modified" field.
|
||||
func ModifiedNotIn(vs ...time.Time) predicate.Alias {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldModified), v...))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNotIn(FieldModified, vs...))
|
||||
}
|
||||
|
||||
// ModifiedGT applies the GT predicate on the "modified" field.
|
||||
func ModifiedGT(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldGT(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedGTE applies the GTE predicate on the "modified" field.
|
||||
func ModifiedGTE(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldGTE(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedLT applies the LT predicate on the "modified" field.
|
||||
func ModifiedLT(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldLT(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedLTE applies the LTE predicate on the "modified" field.
|
||||
func ModifiedLTE(v time.Time) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldModified), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldLTE(FieldModified, v))
|
||||
}
|
||||
|
||||
// ModifiedIsNil applies the IsNil predicate on the "modified" field.
|
||||
func ModifiedIsNil() predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldModified)))
|
||||
})
|
||||
return predicate.Alias(sql.FieldIsNull(FieldModified))
|
||||
}
|
||||
|
||||
// ModifiedNotNil applies the NotNil predicate on the "modified" field.
|
||||
func ModifiedNotNil() predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldModified)))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNotNull(FieldModified))
|
||||
}
|
||||
|
||||
// DomainIDEQ applies the EQ predicate on the "domain_id" field.
|
||||
func DomainIDEQ(v int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldDomainID), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldDomainID, v))
|
||||
}
|
||||
|
||||
// DomainIDNEQ applies the NEQ predicate on the "domain_id" field.
|
||||
func DomainIDNEQ(v int64) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldDomainID), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNEQ(FieldDomainID, v))
|
||||
}
|
||||
|
||||
// DomainIDIn applies the In predicate on the "domain_id" field.
|
||||
func DomainIDIn(vs ...int64) predicate.Alias {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldDomainID), v...))
|
||||
})
|
||||
return predicate.Alias(sql.FieldIn(FieldDomainID, vs...))
|
||||
}
|
||||
|
||||
// DomainIDNotIn applies the NotIn predicate on the "domain_id" field.
|
||||
func DomainIDNotIn(vs ...int64) predicate.Alias {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldDomainID), v...))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNotIn(FieldDomainID, vs...))
|
||||
}
|
||||
|
||||
// DomainIDIsNil applies the IsNil predicate on the "domain_id" field.
|
||||
func DomainIDIsNil() predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldDomainID)))
|
||||
})
|
||||
return predicate.Alias(sql.FieldIsNull(FieldDomainID))
|
||||
}
|
||||
|
||||
// DomainIDNotNil applies the NotNil predicate on the "domain_id" field.
|
||||
func DomainIDNotNil() predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldDomainID)))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNotNull(FieldDomainID))
|
||||
}
|
||||
|
||||
// GotoEQ applies the EQ predicate on the "goto" field.
|
||||
func GotoEQ(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldGoto, v))
|
||||
}
|
||||
|
||||
// GotoNEQ applies the NEQ predicate on the "goto" field.
|
||||
func GotoNEQ(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNEQ(FieldGoto, v))
|
||||
}
|
||||
|
||||
// GotoIn applies the In predicate on the "goto" field.
|
||||
func GotoIn(vs ...string) predicate.Alias {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldGoto), v...))
|
||||
})
|
||||
return predicate.Alias(sql.FieldIn(FieldGoto, vs...))
|
||||
}
|
||||
|
||||
// GotoNotIn applies the NotIn predicate on the "goto" field.
|
||||
func GotoNotIn(vs ...string) predicate.Alias {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldGoto), v...))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNotIn(FieldGoto, vs...))
|
||||
}
|
||||
|
||||
// GotoGT applies the GT predicate on the "goto" field.
|
||||
func GotoGT(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldGT(FieldGoto, v))
|
||||
}
|
||||
|
||||
// GotoGTE applies the GTE predicate on the "goto" field.
|
||||
func GotoGTE(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldGTE(FieldGoto, v))
|
||||
}
|
||||
|
||||
// GotoLT applies the LT predicate on the "goto" field.
|
||||
func GotoLT(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldLT(FieldGoto, v))
|
||||
}
|
||||
|
||||
// GotoLTE applies the LTE predicate on the "goto" field.
|
||||
func GotoLTE(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldLTE(FieldGoto, v))
|
||||
}
|
||||
|
||||
// GotoContains applies the Contains predicate on the "goto" field.
|
||||
func GotoContains(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.Contains(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldContains(FieldGoto, v))
|
||||
}
|
||||
|
||||
// GotoHasPrefix applies the HasPrefix predicate on the "goto" field.
|
||||
func GotoHasPrefix(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.HasPrefix(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldHasPrefix(FieldGoto, v))
|
||||
}
|
||||
|
||||
// GotoHasSuffix applies the HasSuffix predicate on the "goto" field.
|
||||
func GotoHasSuffix(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.HasSuffix(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldHasSuffix(FieldGoto, v))
|
||||
}
|
||||
|
||||
// GotoEqualFold applies the EqualFold predicate on the "goto" field.
|
||||
func GotoEqualFold(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EqualFold(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEqualFold(FieldGoto, v))
|
||||
}
|
||||
|
||||
// GotoContainsFold applies the ContainsFold predicate on the "goto" field.
|
||||
func GotoContainsFold(v string) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.ContainsFold(s.C(FieldGoto), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldContainsFold(FieldGoto, v))
|
||||
}
|
||||
|
||||
// ActiveEQ applies the EQ predicate on the "active" field.
|
||||
func ActiveEQ(v bool) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldActive), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldEQ(FieldActive, v))
|
||||
}
|
||||
|
||||
// ActiveNEQ applies the NEQ predicate on the "active" field.
|
||||
func ActiveNEQ(v bool) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldActive), v))
|
||||
})
|
||||
return predicate.Alias(sql.FieldNEQ(FieldActive, v))
|
||||
}
|
||||
|
||||
// HasDomain applies the HasEdge predicate on the "domain" edge.
|
||||
@ -486,7 +280,6 @@ func HasDomain() predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DomainTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, DomainTable, DomainColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
@ -496,11 +289,7 @@ func HasDomain() predicate.Alias {
|
||||
// HasDomainWith applies the HasEdge predicate on the "domain" edge with a given conditions (other predicates).
|
||||
func HasDomainWith(preds ...predicate.Domain) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DomainInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, DomainTable, DomainColumn),
|
||||
)
|
||||
step := newDomainStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@ -511,32 +300,15 @@ func HasDomainWith(preds ...predicate.Domain) predicate.Alias {
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Alias) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for _, p := range predicates {
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Alias(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Alias) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for i, p := range predicates {
|
||||
if i > 0 {
|
||||
s1.Or()
|
||||
}
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Alias(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Alias) predicate.Alias {
|
||||
return predicate.Alias(func(s *sql.Selector) {
|
||||
p(s.Not())
|
||||
})
|
||||
return predicate.Alias(sql.NotPredicates(p))
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -93,44 +93,8 @@ func (ac *AliasCreate) Mutation() *AliasMutation {
|
||||
|
||||
// Save creates the Alias in the database.
|
||||
func (ac *AliasCreate) Save(ctx context.Context) (*Alias, error) {
|
||||
var (
|
||||
err error
|
||||
node *Alias
|
||||
)
|
||||
ac.defaults()
|
||||
if len(ac.hooks) == 0 {
|
||||
if err = ac.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = ac.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*AliasMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = ac.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ac.mutation = mutation
|
||||
if node, err = ac.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(ac.hooks) - 1; i >= 0; i-- {
|
||||
if ac.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = ac.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, ac.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
return withHooks(ctx, ac.sqlSave, ac.mutation, ac.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@ -182,10 +146,13 @@ func (ac *AliasCreate) check() error {
|
||||
}
|
||||
|
||||
func (ac *AliasCreate) sqlSave(ctx context.Context) (*Alias, error) {
|
||||
if err := ac.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := ac.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, ac.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@ -193,54 +160,34 @@ func (ac *AliasCreate) sqlSave(ctx context.Context) (*Alias, error) {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
ac.mutation.id = &_node.ID
|
||||
ac.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (ac *AliasCreate) createSpec() (*Alias, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Alias{config: ac.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: alias.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
}
|
||||
_spec = sqlgraph.NewCreateSpec(alias.Table, sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := ac.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := ac.mutation.Created(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: alias.FieldCreated,
|
||||
})
|
||||
_spec.SetField(alias.FieldCreated, field.TypeTime, value)
|
||||
_node.Created = value
|
||||
}
|
||||
if value, ok := ac.mutation.Modified(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: alias.FieldModified,
|
||||
})
|
||||
_spec.SetField(alias.FieldModified, field.TypeTime, value)
|
||||
_node.Modified = &value
|
||||
}
|
||||
if value, ok := ac.mutation.Goto(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: alias.FieldGoto,
|
||||
})
|
||||
_spec.SetField(alias.FieldGoto, field.TypeString, value)
|
||||
_node.Goto = value
|
||||
}
|
||||
if value, ok := ac.mutation.Active(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: alias.FieldActive,
|
||||
})
|
||||
_spec.SetField(alias.FieldActive, field.TypeBool, value)
|
||||
_node.Active = value
|
||||
}
|
||||
if nodes := ac.mutation.DomainIDs(); len(nodes) > 0 {
|
||||
@ -251,10 +198,7 @@ func (ac *AliasCreate) createSpec() (*Alias, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{alias.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -269,11 +213,15 @@ func (ac *AliasCreate) createSpec() (*Alias, *sqlgraph.CreateSpec) {
|
||||
// AliasCreateBulk is the builder for creating many Alias entities in bulk.
|
||||
type AliasCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*AliasCreate
|
||||
}
|
||||
|
||||
// Save creates the Alias entities in the database.
|
||||
func (acb *AliasCreateBulk) Save(ctx context.Context) ([]*Alias, error) {
|
||||
if acb.err != nil {
|
||||
return nil, acb.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(acb.builders))
|
||||
nodes := make([]*Alias, len(acb.builders))
|
||||
mutators := make([]Mutator, len(acb.builders))
|
||||
@ -290,8 +238,8 @@ func (acb *AliasCreateBulk) Save(ctx context.Context) ([]*Alias, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, acb.builders[i+1].mutation)
|
||||
} else {
|
||||
@ -299,7 +247,7 @@ func (acb *AliasCreateBulk) Save(ctx context.Context) ([]*Alias, error) {
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, acb.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -307,11 +255,11 @@ func (acb *AliasCreateBulk) Save(ctx context.Context) ([]*Alias, error) {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
mutation.done = true
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
|
@ -1,10 +1,9 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/alias"
|
||||
"code.icod.de/postfix/manager/ent/predicate"
|
||||
@ -28,34 +27,7 @@ func (ad *AliasDelete) Where(ps ...predicate.Alias) *AliasDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (ad *AliasDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(ad.hooks) == 0 {
|
||||
affected, err = ad.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*AliasMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
ad.mutation = mutation
|
||||
affected, err = ad.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(ad.hooks) - 1; i >= 0; i-- {
|
||||
if ad.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = ad.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, ad.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, ad.sqlExec, ad.mutation, ad.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
@ -68,15 +40,7 @@ func (ad *AliasDelete) ExecX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
func (ad *AliasDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: alias.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewDeleteSpec(alias.Table, sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64))
|
||||
if ps := ad.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@ -84,7 +48,12 @@ func (ad *AliasDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, ad.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, ad.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
ad.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// AliasDeleteOne is the builder for deleting a single Alias entity.
|
||||
@ -92,6 +61,12 @@ type AliasDeleteOne struct {
|
||||
ad *AliasDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the AliasDelete builder.
|
||||
func (ado *AliasDeleteOne) Where(ps ...predicate.Alias) *AliasDeleteOne {
|
||||
ado.ad.mutation.Where(ps...)
|
||||
return ado
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (ado *AliasDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := ado.ad.Exec(ctx)
|
||||
@ -107,5 +82,7 @@ func (ado *AliasDeleteOne) Exec(ctx context.Context) error {
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (ado *AliasDeleteOne) ExecX(ctx context.Context) {
|
||||
ado.ad.ExecX(ctx)
|
||||
if err := ado.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/alias"
|
||||
"code.icod.de/postfix/manager/ent/domain"
|
||||
"code.icod.de/postfix/manager/ent/predicate"
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
@ -19,13 +19,10 @@ import (
|
||||
// AliasQuery is the builder for querying Alias entities.
|
||||
type AliasQuery struct {
|
||||
config
|
||||
limit *int
|
||||
offset *int
|
||||
unique *bool
|
||||
order []OrderFunc
|
||||
fields []string
|
||||
ctx *QueryContext
|
||||
order []alias.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Alias
|
||||
// eager-loading edges.
|
||||
withDomain *DomainQuery
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
@ -38,34 +35,34 @@ func (aq *AliasQuery) Where(ps ...predicate.Alias) *AliasQuery {
|
||||
return aq
|
||||
}
|
||||
|
||||
// Limit adds a limit step to the query.
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (aq *AliasQuery) Limit(limit int) *AliasQuery {
|
||||
aq.limit = &limit
|
||||
aq.ctx.Limit = &limit
|
||||
return aq
|
||||
}
|
||||
|
||||
// Offset adds an offset step to the query.
|
||||
// Offset to start from.
|
||||
func (aq *AliasQuery) Offset(offset int) *AliasQuery {
|
||||
aq.offset = &offset
|
||||
aq.ctx.Offset = &offset
|
||||
return aq
|
||||
}
|
||||
|
||||
// Unique configures the query builder to filter duplicate records on query.
|
||||
// By default, unique is set to true, and can be disabled using this method.
|
||||
func (aq *AliasQuery) Unique(unique bool) *AliasQuery {
|
||||
aq.unique = &unique
|
||||
aq.ctx.Unique = &unique
|
||||
return aq
|
||||
}
|
||||
|
||||
// Order adds an order step to the query.
|
||||
func (aq *AliasQuery) Order(o ...OrderFunc) *AliasQuery {
|
||||
// Order specifies how the records should be ordered.
|
||||
func (aq *AliasQuery) Order(o ...alias.OrderOption) *AliasQuery {
|
||||
aq.order = append(aq.order, o...)
|
||||
return aq
|
||||
}
|
||||
|
||||
// QueryDomain chains the current query on the "domain" edge.
|
||||
func (aq *AliasQuery) QueryDomain() *DomainQuery {
|
||||
query := &DomainQuery{config: aq.config}
|
||||
query := (&DomainClient{config: aq.config}).Query()
|
||||
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
|
||||
if err := aq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
@ -88,7 +85,7 @@ func (aq *AliasQuery) QueryDomain() *DomainQuery {
|
||||
// First returns the first Alias entity from the query.
|
||||
// Returns a *NotFoundError when no Alias was found.
|
||||
func (aq *AliasQuery) First(ctx context.Context) (*Alias, error) {
|
||||
nodes, err := aq.Limit(1).All(ctx)
|
||||
nodes, err := aq.Limit(1).All(setContextOp(ctx, aq.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -111,7 +108,7 @@ func (aq *AliasQuery) FirstX(ctx context.Context) *Alias {
|
||||
// Returns a *NotFoundError when no Alias ID was found.
|
||||
func (aq *AliasQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = aq.Limit(1).IDs(ctx); err != nil {
|
||||
if ids, err = aq.Limit(1).IDs(setContextOp(ctx, aq.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
@ -134,7 +131,7 @@ func (aq *AliasQuery) FirstIDX(ctx context.Context) int64 {
|
||||
// Returns a *NotSingularError when more than one Alias entity is found.
|
||||
// Returns a *NotFoundError when no Alias entities are found.
|
||||
func (aq *AliasQuery) Only(ctx context.Context) (*Alias, error) {
|
||||
nodes, err := aq.Limit(2).All(ctx)
|
||||
nodes, err := aq.Limit(2).All(setContextOp(ctx, aq.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -162,7 +159,7 @@ func (aq *AliasQuery) OnlyX(ctx context.Context) *Alias {
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (aq *AliasQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = aq.Limit(2).IDs(ctx); err != nil {
|
||||
if ids, err = aq.Limit(2).IDs(setContextOp(ctx, aq.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
@ -187,10 +184,12 @@ func (aq *AliasQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
|
||||
// All executes the query and returns a list of AliasSlice.
|
||||
func (aq *AliasQuery) All(ctx context.Context) ([]*Alias, error) {
|
||||
ctx = setContextOp(ctx, aq.ctx, ent.OpQueryAll)
|
||||
if err := aq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return aq.sqlAll(ctx)
|
||||
qr := querierAll[[]*Alias, *AliasQuery]()
|
||||
return withInterceptors[[]*Alias](ctx, aq, qr, aq.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
@ -203,9 +202,12 @@ func (aq *AliasQuery) AllX(ctx context.Context) []*Alias {
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of Alias IDs.
|
||||
func (aq *AliasQuery) IDs(ctx context.Context) ([]int64, error) {
|
||||
var ids []int64
|
||||
if err := aq.Select(alias.FieldID).Scan(ctx, &ids); err != nil {
|
||||
func (aq *AliasQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if aq.ctx.Unique == nil && aq.path != nil {
|
||||
aq.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, aq.ctx, ent.OpQueryIDs)
|
||||
if err = aq.Select(alias.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
@ -222,10 +224,11 @@ func (aq *AliasQuery) IDsX(ctx context.Context) []int64 {
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (aq *AliasQuery) Count(ctx context.Context) (int, error) {
|
||||
ctx = setContextOp(ctx, aq.ctx, ent.OpQueryCount)
|
||||
if err := aq.prepareQuery(ctx); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return aq.sqlCount(ctx)
|
||||
return withInterceptors[int](ctx, aq, querierCount[*AliasQuery](), aq.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
@ -239,10 +242,15 @@ func (aq *AliasQuery) CountX(ctx context.Context) int {
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (aq *AliasQuery) Exist(ctx context.Context) (bool, error) {
|
||||
if err := aq.prepareQuery(ctx); err != nil {
|
||||
return false, err
|
||||
ctx = setContextOp(ctx, aq.ctx, ent.OpQueryExist)
|
||||
switch _, err := aq.FirstID(ctx); {
|
||||
case IsNotFound(err):
|
||||
return false, nil
|
||||
case err != nil:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
return aq.sqlExist(ctx)
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
@ -262,22 +270,21 @@ func (aq *AliasQuery) Clone() *AliasQuery {
|
||||
}
|
||||
return &AliasQuery{
|
||||
config: aq.config,
|
||||
limit: aq.limit,
|
||||
offset: aq.offset,
|
||||
order: append([]OrderFunc{}, aq.order...),
|
||||
ctx: aq.ctx.Clone(),
|
||||
order: append([]alias.OrderOption{}, aq.order...),
|
||||
inters: append([]Interceptor{}, aq.inters...),
|
||||
predicates: append([]predicate.Alias{}, aq.predicates...),
|
||||
withDomain: aq.withDomain.Clone(),
|
||||
// clone intermediate query.
|
||||
sql: aq.sql.Clone(),
|
||||
path: aq.path,
|
||||
unique: aq.unique,
|
||||
sql: aq.sql.Clone(),
|
||||
path: aq.path,
|
||||
}
|
||||
}
|
||||
|
||||
// WithDomain tells the query-builder to eager-load the nodes that are connected to
|
||||
// the "domain" edge. The optional arguments are used to configure the query builder of the edge.
|
||||
func (aq *AliasQuery) WithDomain(opts ...func(*DomainQuery)) *AliasQuery {
|
||||
query := &DomainQuery{config: aq.config}
|
||||
query := (&DomainClient{config: aq.config}).Query()
|
||||
for _, opt := range opts {
|
||||
opt(query)
|
||||
}
|
||||
@ -299,17 +306,13 @@ func (aq *AliasQuery) WithDomain(opts ...func(*DomainQuery)) *AliasQuery {
|
||||
// GroupBy(alias.FieldCreated).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (aq *AliasQuery) GroupBy(field string, fields ...string) *AliasGroupBy {
|
||||
group := &AliasGroupBy{config: aq.config}
|
||||
group.fields = append([]string{field}, fields...)
|
||||
group.path = func(ctx context.Context) (prev *sql.Selector, err error) {
|
||||
if err := aq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return aq.sqlQuery(ctx), nil
|
||||
}
|
||||
return group
|
||||
aq.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &AliasGroupBy{build: aq}
|
||||
grbuild.flds = &aq.ctx.Fields
|
||||
grbuild.label = alias.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
@ -324,14 +327,31 @@ func (aq *AliasQuery) GroupBy(field string, fields ...string) *AliasGroupBy {
|
||||
// client.Alias.Query().
|
||||
// Select(alias.FieldCreated).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (aq *AliasQuery) Select(fields ...string) *AliasSelect {
|
||||
aq.fields = append(aq.fields, fields...)
|
||||
return &AliasSelect{AliasQuery: aq}
|
||||
aq.ctx.Fields = append(aq.ctx.Fields, fields...)
|
||||
sbuild := &AliasSelect{AliasQuery: aq}
|
||||
sbuild.label = alias.Label
|
||||
sbuild.flds, sbuild.scan = &aq.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a AliasSelect configured with the given aggregations.
|
||||
func (aq *AliasQuery) Aggregate(fns ...AggregateFunc) *AliasSelect {
|
||||
return aq.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (aq *AliasQuery) prepareQuery(ctx context.Context) error {
|
||||
for _, f := range aq.fields {
|
||||
for _, inter := range aq.inters {
|
||||
if inter == nil {
|
||||
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
|
||||
}
|
||||
if trv, ok := inter.(Traverser); ok {
|
||||
if err := trv.Traverse(ctx, aq); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range aq.ctx.Fields {
|
||||
if !alias.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
@ -346,7 +366,7 @@ func (aq *AliasQuery) prepareQuery(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (aq *AliasQuery) sqlAll(ctx context.Context) ([]*Alias, error) {
|
||||
func (aq *AliasQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Alias, error) {
|
||||
var (
|
||||
nodes = []*Alias{}
|
||||
_spec = aq.querySpec()
|
||||
@ -354,89 +374,81 @@ func (aq *AliasQuery) sqlAll(ctx context.Context) ([]*Alias, error) {
|
||||
aq.withDomain != nil,
|
||||
}
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*Alias).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &Alias{config: aq.config}
|
||||
nodes = append(nodes, node)
|
||||
return node.scanValues(columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
if len(nodes) == 0 {
|
||||
return fmt.Errorf("ent: Assign called without calling ScanValues")
|
||||
}
|
||||
node := nodes[len(nodes)-1]
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
return node.assignValues(columns, values)
|
||||
}
|
||||
for i := range hooks {
|
||||
hooks[i](ctx, _spec)
|
||||
}
|
||||
if err := sqlgraph.QueryNodes(ctx, aq.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
if query := aq.withDomain; query != nil {
|
||||
ids := make([]int64, 0, len(nodes))
|
||||
nodeids := make(map[int64][]*Alias)
|
||||
for i := range nodes {
|
||||
fk := nodes[i].DomainID
|
||||
if _, ok := nodeids[fk]; !ok {
|
||||
ids = append(ids, fk)
|
||||
}
|
||||
nodeids[fk] = append(nodeids[fk], nodes[i])
|
||||
}
|
||||
query.Where(domain.IDIn(ids...))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
if err := aq.loadDomain(ctx, query, nodes, nil,
|
||||
func(n *Alias, e *Domain) { n.Edges.Domain = e }); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, n := range neighbors {
|
||||
nodes, ok := nodeids[n.ID]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf(`unexpected foreign-key "domain_id" returned %v`, n.ID)
|
||||
}
|
||||
for i := range nodes {
|
||||
nodes[i].Edges.Domain = n
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (aq *AliasQuery) loadDomain(ctx context.Context, query *DomainQuery, nodes []*Alias, init func(*Alias), assign func(*Alias, *Domain)) error {
|
||||
ids := make([]int64, 0, len(nodes))
|
||||
nodeids := make(map[int64][]*Alias)
|
||||
for i := range nodes {
|
||||
fk := nodes[i].DomainID
|
||||
if _, ok := nodeids[fk]; !ok {
|
||||
ids = append(ids, fk)
|
||||
}
|
||||
nodeids[fk] = append(nodeids[fk], nodes[i])
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
return nil
|
||||
}
|
||||
query.Where(domain.IDIn(ids...))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, n := range neighbors {
|
||||
nodes, ok := nodeids[n.ID]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "domain_id" returned %v`, n.ID)
|
||||
}
|
||||
for i := range nodes {
|
||||
assign(nodes[i], n)
|
||||
}
|
||||
}
|
||||
|
||||
return nodes, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (aq *AliasQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
_spec := aq.querySpec()
|
||||
_spec.Node.Columns = aq.fields
|
||||
if len(aq.fields) > 0 {
|
||||
_spec.Unique = aq.unique != nil && *aq.unique
|
||||
_spec.Node.Columns = aq.ctx.Fields
|
||||
if len(aq.ctx.Fields) > 0 {
|
||||
_spec.Unique = aq.ctx.Unique != nil && *aq.ctx.Unique
|
||||
}
|
||||
return sqlgraph.CountNodes(ctx, aq.driver, _spec)
|
||||
}
|
||||
|
||||
func (aq *AliasQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := aq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
}
|
||||
return n > 0, nil
|
||||
}
|
||||
|
||||
func (aq *AliasQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := &sqlgraph.QuerySpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: alias.Table,
|
||||
Columns: alias.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
},
|
||||
From: aq.sql,
|
||||
Unique: true,
|
||||
}
|
||||
if unique := aq.unique; unique != nil {
|
||||
_spec := sqlgraph.NewQuerySpec(alias.Table, alias.Columns, sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64))
|
||||
_spec.From = aq.sql
|
||||
if unique := aq.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if aq.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := aq.fields; len(fields) > 0 {
|
||||
if fields := aq.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, alias.FieldID)
|
||||
for i := range fields {
|
||||
@ -444,6 +456,9 @@ func (aq *AliasQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
if aq.withDomain != nil {
|
||||
_spec.Node.AddColumnOnce(alias.FieldDomainID)
|
||||
}
|
||||
}
|
||||
if ps := aq.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
@ -452,10 +467,10 @@ func (aq *AliasQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := aq.limit; limit != nil {
|
||||
if limit := aq.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := aq.offset; offset != nil {
|
||||
if offset := aq.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := aq.order; len(ps) > 0 {
|
||||
@ -471,7 +486,7 @@ func (aq *AliasQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
func (aq *AliasQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(aq.driver.Dialect())
|
||||
t1 := builder.Table(alias.Table)
|
||||
columns := aq.fields
|
||||
columns := aq.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = alias.Columns
|
||||
}
|
||||
@ -480,7 +495,7 @@ func (aq *AliasQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
selector = aq.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if aq.unique != nil && *aq.unique {
|
||||
if aq.ctx.Unique != nil && *aq.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range aq.predicates {
|
||||
@ -489,12 +504,12 @@ func (aq *AliasQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
for _, p := range aq.order {
|
||||
p(selector)
|
||||
}
|
||||
if offset := aq.offset; offset != nil {
|
||||
if offset := aq.ctx.Offset; offset != nil {
|
||||
// limit is mandatory for offset clause. We start
|
||||
// with default value, and override it below if needed.
|
||||
selector.Offset(*offset).Limit(math.MaxInt32)
|
||||
}
|
||||
if limit := aq.limit; limit != nil {
|
||||
if limit := aq.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
@ -502,12 +517,8 @@ func (aq *AliasQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
|
||||
// AliasGroupBy is the group-by builder for Alias entities.
|
||||
type AliasGroupBy struct {
|
||||
config
|
||||
fields []string
|
||||
fns []AggregateFunc
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
selector
|
||||
build *AliasQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
@ -516,471 +527,77 @@ func (agb *AliasGroupBy) Aggregate(fns ...AggregateFunc) *AliasGroupBy {
|
||||
return agb
|
||||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (agb *AliasGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
query, err := agb.path(ctx)
|
||||
if err != nil {
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (agb *AliasGroupBy) Scan(ctx context.Context, v any) error {
|
||||
ctx = setContextOp(ctx, agb.build.ctx, ent.OpQueryGroupBy)
|
||||
if err := agb.build.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
agb.sql = query
|
||||
return agb.sqlScan(ctx, v)
|
||||
return scanWithInterceptors[*AliasQuery, *AliasGroupBy](ctx, agb.build, agb, agb.build.inters, v)
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (agb *AliasGroupBy) ScanX(ctx context.Context, v interface{}) {
|
||||
if err := agb.Scan(ctx, v); err != nil {
|
||||
panic(err)
|
||||
func (agb *AliasGroupBy) sqlScan(ctx context.Context, root *AliasQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
aggregation := make([]string, 0, len(agb.fns))
|
||||
for _, fn := range agb.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
}
|
||||
|
||||
// Strings returns list of strings from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (agb *AliasGroupBy) Strings(ctx context.Context) ([]string, error) {
|
||||
if len(agb.fields) > 1 {
|
||||
return nil, errors.New("ent: AliasGroupBy.Strings is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []string
|
||||
if err := agb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// StringsX is like Strings, but panics if an error occurs.
|
||||
func (agb *AliasGroupBy) StringsX(ctx context.Context) []string {
|
||||
v, err := agb.Strings(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// String returns a single string from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (agb *AliasGroupBy) String(ctx context.Context) (_ string, err error) {
|
||||
var v []string
|
||||
if v, err = agb.Strings(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{alias.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: AliasGroupBy.Strings returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StringX is like String, but panics if an error occurs.
|
||||
func (agb *AliasGroupBy) StringX(ctx context.Context) string {
|
||||
v, err := agb.String(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Ints returns list of ints from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (agb *AliasGroupBy) Ints(ctx context.Context) ([]int, error) {
|
||||
if len(agb.fields) > 1 {
|
||||
return nil, errors.New("ent: AliasGroupBy.Ints is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []int
|
||||
if err := agb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IntsX is like Ints, but panics if an error occurs.
|
||||
func (agb *AliasGroupBy) IntsX(ctx context.Context) []int {
|
||||
v, err := agb.Ints(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Int returns a single int from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (agb *AliasGroupBy) Int(ctx context.Context) (_ int, err error) {
|
||||
var v []int
|
||||
if v, err = agb.Ints(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{alias.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: AliasGroupBy.Ints returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IntX is like Int, but panics if an error occurs.
|
||||
func (agb *AliasGroupBy) IntX(ctx context.Context) int {
|
||||
v, err := agb.Int(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64s returns list of float64s from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (agb *AliasGroupBy) Float64s(ctx context.Context) ([]float64, error) {
|
||||
if len(agb.fields) > 1 {
|
||||
return nil, errors.New("ent: AliasGroupBy.Float64s is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []float64
|
||||
if err := agb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Float64sX is like Float64s, but panics if an error occurs.
|
||||
func (agb *AliasGroupBy) Float64sX(ctx context.Context) []float64 {
|
||||
v, err := agb.Float64s(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64 returns a single float64 from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (agb *AliasGroupBy) Float64(ctx context.Context) (_ float64, err error) {
|
||||
var v []float64
|
||||
if v, err = agb.Float64s(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{alias.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: AliasGroupBy.Float64s returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Float64X is like Float64, but panics if an error occurs.
|
||||
func (agb *AliasGroupBy) Float64X(ctx context.Context) float64 {
|
||||
v, err := agb.Float64(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bools returns list of bools from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (agb *AliasGroupBy) Bools(ctx context.Context) ([]bool, error) {
|
||||
if len(agb.fields) > 1 {
|
||||
return nil, errors.New("ent: AliasGroupBy.Bools is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []bool
|
||||
if err := agb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoolsX is like Bools, but panics if an error occurs.
|
||||
func (agb *AliasGroupBy) BoolsX(ctx context.Context) []bool {
|
||||
v, err := agb.Bools(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bool returns a single bool from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (agb *AliasGroupBy) Bool(ctx context.Context) (_ bool, err error) {
|
||||
var v []bool
|
||||
if v, err = agb.Bools(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{alias.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: AliasGroupBy.Bools returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BoolX is like Bool, but panics if an error occurs.
|
||||
func (agb *AliasGroupBy) BoolX(ctx context.Context) bool {
|
||||
v, err := agb.Bool(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func (agb *AliasGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
for _, f := range agb.fields {
|
||||
if !alias.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
if len(selector.SelectedColumns()) == 0 {
|
||||
columns := make([]string, 0, len(*agb.flds)+len(agb.fns))
|
||||
for _, f := range *agb.flds {
|
||||
columns = append(columns, selector.C(f))
|
||||
}
|
||||
columns = append(columns, aggregation...)
|
||||
selector.Select(columns...)
|
||||
}
|
||||
selector := agb.sqlQuery()
|
||||
selector.GroupBy(selector.Columns(*agb.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := agb.driver.Query(ctx, query, args, rows); err != nil {
|
||||
if err := agb.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
func (agb *AliasGroupBy) sqlQuery() *sql.Selector {
|
||||
selector := agb.sql.Select()
|
||||
aggregation := make([]string, 0, len(agb.fns))
|
||||
for _, fn := range agb.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
// If no columns were selected in a custom aggregation function, the default
|
||||
// selection is the fields used for "group-by", and the aggregation functions.
|
||||
if len(selector.SelectedColumns()) == 0 {
|
||||
columns := make([]string, 0, len(agb.fields)+len(agb.fns))
|
||||
for _, f := range agb.fields {
|
||||
columns = append(columns, selector.C(f))
|
||||
}
|
||||
columns = append(columns, aggregation...)
|
||||
selector.Select(columns...)
|
||||
}
|
||||
return selector.GroupBy(selector.Columns(agb.fields...)...)
|
||||
}
|
||||
|
||||
// AliasSelect is the builder for selecting fields of Alias entities.
|
||||
type AliasSelect struct {
|
||||
*AliasQuery
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (as *AliasSelect) Aggregate(fns ...AggregateFunc) *AliasSelect {
|
||||
as.fns = append(as.fns, fns...)
|
||||
return as
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (as *AliasSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (as *AliasSelect) Scan(ctx context.Context, v any) error {
|
||||
ctx = setContextOp(ctx, as.ctx, ent.OpQuerySelect)
|
||||
if err := as.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
as.sql = as.AliasQuery.sqlQuery(ctx)
|
||||
return as.sqlScan(ctx, v)
|
||||
return scanWithInterceptors[*AliasQuery, *AliasSelect](ctx, as.AliasQuery, as, as.inters, v)
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (as *AliasSelect) ScanX(ctx context.Context, v interface{}) {
|
||||
if err := as.Scan(ctx, v); err != nil {
|
||||
panic(err)
|
||||
func (as *AliasSelect) sqlScan(ctx context.Context, root *AliasQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(as.fns))
|
||||
for _, fn := range as.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
}
|
||||
|
||||
// Strings returns list of strings from a selector. It is only allowed when selecting one field.
|
||||
func (as *AliasSelect) Strings(ctx context.Context) ([]string, error) {
|
||||
if len(as.fields) > 1 {
|
||||
return nil, errors.New("ent: AliasSelect.Strings is not achievable when selecting more than 1 field")
|
||||
switch n := len(*as.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
var v []string
|
||||
if err := as.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// StringsX is like Strings, but panics if an error occurs.
|
||||
func (as *AliasSelect) StringsX(ctx context.Context) []string {
|
||||
v, err := as.Strings(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// String returns a single string from a selector. It is only allowed when selecting one field.
|
||||
func (as *AliasSelect) String(ctx context.Context) (_ string, err error) {
|
||||
var v []string
|
||||
if v, err = as.Strings(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{alias.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: AliasSelect.Strings returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StringX is like String, but panics if an error occurs.
|
||||
func (as *AliasSelect) StringX(ctx context.Context) string {
|
||||
v, err := as.String(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Ints returns list of ints from a selector. It is only allowed when selecting one field.
|
||||
func (as *AliasSelect) Ints(ctx context.Context) ([]int, error) {
|
||||
if len(as.fields) > 1 {
|
||||
return nil, errors.New("ent: AliasSelect.Ints is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []int
|
||||
if err := as.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IntsX is like Ints, but panics if an error occurs.
|
||||
func (as *AliasSelect) IntsX(ctx context.Context) []int {
|
||||
v, err := as.Ints(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Int returns a single int from a selector. It is only allowed when selecting one field.
|
||||
func (as *AliasSelect) Int(ctx context.Context) (_ int, err error) {
|
||||
var v []int
|
||||
if v, err = as.Ints(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{alias.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: AliasSelect.Ints returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IntX is like Int, but panics if an error occurs.
|
||||
func (as *AliasSelect) IntX(ctx context.Context) int {
|
||||
v, err := as.Int(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
|
||||
func (as *AliasSelect) Float64s(ctx context.Context) ([]float64, error) {
|
||||
if len(as.fields) > 1 {
|
||||
return nil, errors.New("ent: AliasSelect.Float64s is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []float64
|
||||
if err := as.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Float64sX is like Float64s, but panics if an error occurs.
|
||||
func (as *AliasSelect) Float64sX(ctx context.Context) []float64 {
|
||||
v, err := as.Float64s(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
|
||||
func (as *AliasSelect) Float64(ctx context.Context) (_ float64, err error) {
|
||||
var v []float64
|
||||
if v, err = as.Float64s(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{alias.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: AliasSelect.Float64s returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Float64X is like Float64, but panics if an error occurs.
|
||||
func (as *AliasSelect) Float64X(ctx context.Context) float64 {
|
||||
v, err := as.Float64(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bools returns list of bools from a selector. It is only allowed when selecting one field.
|
||||
func (as *AliasSelect) Bools(ctx context.Context) ([]bool, error) {
|
||||
if len(as.fields) > 1 {
|
||||
return nil, errors.New("ent: AliasSelect.Bools is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []bool
|
||||
if err := as.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoolsX is like Bools, but panics if an error occurs.
|
||||
func (as *AliasSelect) BoolsX(ctx context.Context) []bool {
|
||||
v, err := as.Bools(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bool returns a single bool from a selector. It is only allowed when selecting one field.
|
||||
func (as *AliasSelect) Bool(ctx context.Context) (_ bool, err error) {
|
||||
var v []bool
|
||||
if v, err = as.Bools(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{alias.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: AliasSelect.Bools returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BoolX is like Bool, but panics if an error occurs.
|
||||
func (as *AliasSelect) BoolX(ctx context.Context) bool {
|
||||
v, err := as.Bool(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func (as *AliasSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := as.sql.Query()
|
||||
query, args := selector.Query()
|
||||
if err := as.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -67,12 +67,28 @@ func (au *AliasUpdate) SetGoto(s string) *AliasUpdate {
|
||||
return au
|
||||
}
|
||||
|
||||
// SetNillableGoto sets the "goto" field if the given value is not nil.
|
||||
func (au *AliasUpdate) SetNillableGoto(s *string) *AliasUpdate {
|
||||
if s != nil {
|
||||
au.SetGoto(*s)
|
||||
}
|
||||
return au
|
||||
}
|
||||
|
||||
// SetActive sets the "active" field.
|
||||
func (au *AliasUpdate) SetActive(b bool) *AliasUpdate {
|
||||
au.mutation.SetActive(b)
|
||||
return au
|
||||
}
|
||||
|
||||
// SetNillableActive sets the "active" field if the given value is not nil.
|
||||
func (au *AliasUpdate) SetNillableActive(b *bool) *AliasUpdate {
|
||||
if b != nil {
|
||||
au.SetActive(*b)
|
||||
}
|
||||
return au
|
||||
}
|
||||
|
||||
// SetDomain sets the "domain" edge to the Domain entity.
|
||||
func (au *AliasUpdate) SetDomain(d *Domain) *AliasUpdate {
|
||||
return au.SetDomainID(d.ID)
|
||||
@ -91,35 +107,8 @@ func (au *AliasUpdate) ClearDomain() *AliasUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (au *AliasUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
au.defaults()
|
||||
if len(au.hooks) == 0 {
|
||||
affected, err = au.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*AliasMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
au.mutation = mutation
|
||||
affected, err = au.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(au.hooks) - 1; i >= 0; i-- {
|
||||
if au.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = au.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, au.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, au.sqlSave, au.mutation, au.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@ -153,16 +142,7 @@ func (au *AliasUpdate) defaults() {
|
||||
}
|
||||
|
||||
func (au *AliasUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: alias.Table,
|
||||
Columns: alias.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(alias.Table, alias.Columns, sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64))
|
||||
if ps := au.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@ -171,31 +151,16 @@ func (au *AliasUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
}
|
||||
if value, ok := au.mutation.Modified(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: alias.FieldModified,
|
||||
})
|
||||
_spec.SetField(alias.FieldModified, field.TypeTime, value)
|
||||
}
|
||||
if au.mutation.ModifiedCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Column: alias.FieldModified,
|
||||
})
|
||||
_spec.ClearField(alias.FieldModified, field.TypeTime)
|
||||
}
|
||||
if value, ok := au.mutation.Goto(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: alias.FieldGoto,
|
||||
})
|
||||
_spec.SetField(alias.FieldGoto, field.TypeString, value)
|
||||
}
|
||||
if value, ok := au.mutation.Active(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: alias.FieldActive,
|
||||
})
|
||||
_spec.SetField(alias.FieldActive, field.TypeBool, value)
|
||||
}
|
||||
if au.mutation.DomainCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@ -205,10 +170,7 @@ func (au *AliasUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{alias.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -221,10 +183,7 @@ func (au *AliasUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{alias.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -236,10 +195,11 @@ func (au *AliasUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{alias.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
au.mutation.done = true
|
||||
return n, nil
|
||||
}
|
||||
|
||||
@ -289,12 +249,28 @@ func (auo *AliasUpdateOne) SetGoto(s string) *AliasUpdateOne {
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetNillableGoto sets the "goto" field if the given value is not nil.
|
||||
func (auo *AliasUpdateOne) SetNillableGoto(s *string) *AliasUpdateOne {
|
||||
if s != nil {
|
||||
auo.SetGoto(*s)
|
||||
}
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetActive sets the "active" field.
|
||||
func (auo *AliasUpdateOne) SetActive(b bool) *AliasUpdateOne {
|
||||
auo.mutation.SetActive(b)
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetNillableActive sets the "active" field if the given value is not nil.
|
||||
func (auo *AliasUpdateOne) SetNillableActive(b *bool) *AliasUpdateOne {
|
||||
if b != nil {
|
||||
auo.SetActive(*b)
|
||||
}
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetDomain sets the "domain" edge to the Domain entity.
|
||||
func (auo *AliasUpdateOne) SetDomain(d *Domain) *AliasUpdateOne {
|
||||
return auo.SetDomainID(d.ID)
|
||||
@ -311,6 +287,12 @@ func (auo *AliasUpdateOne) ClearDomain() *AliasUpdateOne {
|
||||
return auo
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the AliasUpdate builder.
|
||||
func (auo *AliasUpdateOne) Where(ps ...predicate.Alias) *AliasUpdateOne {
|
||||
auo.mutation.Where(ps...)
|
||||
return auo
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (auo *AliasUpdateOne) Select(field string, fields ...string) *AliasUpdateOne {
|
||||
@ -320,35 +302,8 @@ func (auo *AliasUpdateOne) Select(field string, fields ...string) *AliasUpdateOn
|
||||
|
||||
// Save executes the query and returns the updated Alias entity.
|
||||
func (auo *AliasUpdateOne) Save(ctx context.Context) (*Alias, error) {
|
||||
var (
|
||||
err error
|
||||
node *Alias
|
||||
)
|
||||
auo.defaults()
|
||||
if len(auo.hooks) == 0 {
|
||||
node, err = auo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*AliasMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
auo.mutation = mutation
|
||||
node, err = auo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(auo.hooks) - 1; i >= 0; i-- {
|
||||
if auo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = auo.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, auo.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
return withHooks(ctx, auo.sqlSave, auo.mutation, auo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@ -382,16 +337,7 @@ func (auo *AliasUpdateOne) defaults() {
|
||||
}
|
||||
|
||||
func (auo *AliasUpdateOne) sqlSave(ctx context.Context) (_node *Alias, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: alias.Table,
|
||||
Columns: alias.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(alias.Table, alias.Columns, sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64))
|
||||
id, ok := auo.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Alias.id" for update`)}
|
||||
@ -417,31 +363,16 @@ func (auo *AliasUpdateOne) sqlSave(ctx context.Context) (_node *Alias, err error
|
||||
}
|
||||
}
|
||||
if value, ok := auo.mutation.Modified(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: alias.FieldModified,
|
||||
})
|
||||
_spec.SetField(alias.FieldModified, field.TypeTime, value)
|
||||
}
|
||||
if auo.mutation.ModifiedCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Column: alias.FieldModified,
|
||||
})
|
||||
_spec.ClearField(alias.FieldModified, field.TypeTime)
|
||||
}
|
||||
if value, ok := auo.mutation.Goto(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: alias.FieldGoto,
|
||||
})
|
||||
_spec.SetField(alias.FieldGoto, field.TypeString, value)
|
||||
}
|
||||
if value, ok := auo.mutation.Active(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: alias.FieldActive,
|
||||
})
|
||||
_spec.SetField(alias.FieldActive, field.TypeBool, value)
|
||||
}
|
||||
if auo.mutation.DomainCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@ -451,10 +382,7 @@ func (auo *AliasUpdateOne) sqlSave(ctx context.Context) (_node *Alias, err error
|
||||
Columns: []string{alias.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -467,10 +395,7 @@ func (auo *AliasUpdateOne) sqlSave(ctx context.Context) (_node *Alias, err error
|
||||
Columns: []string{alias.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -485,9 +410,10 @@ func (auo *AliasUpdateOne) sqlSave(ctx context.Context) (_node *Alias, err error
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{alias.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
auo.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
397
ent/client.go
397
ent/client.go
@ -1,11 +1,13 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/migrate"
|
||||
|
||||
@ -14,7 +16,7 @@ import (
|
||||
"code.icod.de/postfix/manager/ent/domain"
|
||||
"code.icod.de/postfix/manager/ent/logentry"
|
||||
"code.icod.de/postfix/manager/ent/mailbox"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -39,9 +41,7 @@ type Client struct {
|
||||
|
||||
// NewClient creates a new client configured with the given options.
|
||||
func NewClient(opts ...Option) *Client {
|
||||
cfg := config{log: log.Println, hooks: &hooks{}}
|
||||
cfg.options(opts...)
|
||||
client := &Client{config: cfg}
|
||||
client := &Client{config: newConfig(opts...)}
|
||||
client.init()
|
||||
return client
|
||||
}
|
||||
@ -55,6 +55,62 @@ func (c *Client) init() {
|
||||
c.Mailbox = NewMailboxClient(c.config)
|
||||
}
|
||||
|
||||
type (
|
||||
// config is the configuration for the client and its builder.
|
||||
config struct {
|
||||
// driver used for executing database requests.
|
||||
driver dialect.Driver
|
||||
// debug enable a debug logging.
|
||||
debug bool
|
||||
// log used for logging on debug mode.
|
||||
log func(...any)
|
||||
// hooks to execute on mutations.
|
||||
hooks *hooks
|
||||
// interceptors to execute on queries.
|
||||
inters *inters
|
||||
}
|
||||
// Option function to configure the client.
|
||||
Option func(*config)
|
||||
)
|
||||
|
||||
// newConfig creates a new config for the client.
|
||||
func newConfig(opts ...Option) config {
|
||||
cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}}
|
||||
cfg.options(opts...)
|
||||
return cfg
|
||||
}
|
||||
|
||||
// options applies the options on the config object.
|
||||
func (c *config) options(opts ...Option) {
|
||||
for _, opt := range opts {
|
||||
opt(c)
|
||||
}
|
||||
if c.debug {
|
||||
c.driver = dialect.Debug(c.driver, c.log)
|
||||
}
|
||||
}
|
||||
|
||||
// Debug enables debug logging on the ent.Driver.
|
||||
func Debug() Option {
|
||||
return func(c *config) {
|
||||
c.debug = true
|
||||
}
|
||||
}
|
||||
|
||||
// Log sets the logging function for debug mode.
|
||||
func Log(fn func(...any)) Option {
|
||||
return func(c *config) {
|
||||
c.log = fn
|
||||
}
|
||||
}
|
||||
|
||||
// Driver configures the client driver.
|
||||
func Driver(driver dialect.Driver) Option {
|
||||
return func(c *config) {
|
||||
c.driver = driver
|
||||
}
|
||||
}
|
||||
|
||||
// Open opens a database/sql.DB specified by the driver name and
|
||||
// the data source name, and returns a new client attached to it.
|
||||
// Optional parameters can be added for configuring the client.
|
||||
@ -71,11 +127,14 @@ func Open(driverName, dataSourceName string, options ...Option) (*Client, error)
|
||||
}
|
||||
}
|
||||
|
||||
// ErrTxStarted is returned when trying to start a new transaction from a transactional client.
|
||||
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
|
||||
|
||||
// Tx returns a new transactional client. The provided context
|
||||
// is used until the transaction is committed or rolled back.
|
||||
func (c *Client) Tx(ctx context.Context) (*Tx, error) {
|
||||
if _, ok := c.driver.(*txDriver); ok {
|
||||
return nil, fmt.Errorf("ent: cannot start a transaction within a transaction")
|
||||
return nil, ErrTxStarted
|
||||
}
|
||||
tx, err := newTx(ctx, c.driver)
|
||||
if err != nil {
|
||||
@ -97,7 +156,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
|
||||
// BeginTx returns a transactional client with specified options.
|
||||
func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
|
||||
if _, ok := c.driver.(*txDriver); ok {
|
||||
return nil, fmt.Errorf("ent: cannot start a transaction within a transaction")
|
||||
return nil, errors.New("ent: cannot start a transaction within a transaction")
|
||||
}
|
||||
tx, err := c.driver.(interface {
|
||||
BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)
|
||||
@ -124,7 +183,6 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
|
||||
// Account.
|
||||
// Query().
|
||||
// Count(ctx)
|
||||
//
|
||||
func (c *Client) Debug() *Client {
|
||||
if c.debug {
|
||||
return c
|
||||
@ -151,6 +209,34 @@ func (c *Client) Use(hooks ...Hook) {
|
||||
c.Mailbox.Use(hooks...)
|
||||
}
|
||||
|
||||
// Intercept adds the query interceptors to all the entity clients.
|
||||
// In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
|
||||
func (c *Client) Intercept(interceptors ...Interceptor) {
|
||||
c.Account.Intercept(interceptors...)
|
||||
c.Alias.Intercept(interceptors...)
|
||||
c.Domain.Intercept(interceptors...)
|
||||
c.Logentry.Intercept(interceptors...)
|
||||
c.Mailbox.Intercept(interceptors...)
|
||||
}
|
||||
|
||||
// Mutate implements the ent.Mutator interface.
|
||||
func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
|
||||
switch m := m.(type) {
|
||||
case *AccountMutation:
|
||||
return c.Account.mutate(ctx, m)
|
||||
case *AliasMutation:
|
||||
return c.Alias.mutate(ctx, m)
|
||||
case *DomainMutation:
|
||||
return c.Domain.mutate(ctx, m)
|
||||
case *LogentryMutation:
|
||||
return c.Logentry.mutate(ctx, m)
|
||||
case *MailboxMutation:
|
||||
return c.Mailbox.mutate(ctx, m)
|
||||
default:
|
||||
return nil, fmt.Errorf("ent: unknown mutation type %T", m)
|
||||
}
|
||||
}
|
||||
|
||||
// AccountClient is a client for the Account schema.
|
||||
type AccountClient struct {
|
||||
config
|
||||
@ -167,7 +253,13 @@ func (c *AccountClient) Use(hooks ...Hook) {
|
||||
c.hooks.Account = append(c.hooks.Account, hooks...)
|
||||
}
|
||||
|
||||
// Create returns a create builder for Account.
|
||||
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||
// A call to `Intercept(f, g, h)` equals to `account.Intercept(f(g(h())))`.
|
||||
func (c *AccountClient) Intercept(interceptors ...Interceptor) {
|
||||
c.inters.Account = append(c.inters.Account, interceptors...)
|
||||
}
|
||||
|
||||
// Create returns a builder for creating a Account entity.
|
||||
func (c *AccountClient) Create() *AccountCreate {
|
||||
mutation := newAccountMutation(c.config, OpCreate)
|
||||
return &AccountCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
@ -178,6 +270,21 @@ func (c *AccountClient) CreateBulk(builders ...*AccountCreate) *AccountCreateBul
|
||||
return &AccountCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||
// a builder and applies setFunc on it.
|
||||
func (c *AccountClient) MapCreateBulk(slice any, setFunc func(*AccountCreate, int)) *AccountCreateBulk {
|
||||
rv := reflect.ValueOf(slice)
|
||||
if rv.Kind() != reflect.Slice {
|
||||
return &AccountCreateBulk{err: fmt.Errorf("calling to AccountClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||
}
|
||||
builders := make([]*AccountCreate, rv.Len())
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
builders[i] = c.Create()
|
||||
setFunc(builders[i], i)
|
||||
}
|
||||
return &AccountCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// Update returns an update builder for Account.
|
||||
func (c *AccountClient) Update() *AccountUpdate {
|
||||
mutation := newAccountMutation(c.config, OpUpdate)
|
||||
@ -202,12 +309,12 @@ func (c *AccountClient) Delete() *AccountDelete {
|
||||
return &AccountDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// DeleteOne returns a delete builder for the given entity.
|
||||
// DeleteOne returns a builder for deleting the given entity.
|
||||
func (c *AccountClient) DeleteOne(a *Account) *AccountDeleteOne {
|
||||
return c.DeleteOneID(a.ID)
|
||||
}
|
||||
|
||||
// DeleteOneID returns a delete builder for the given id.
|
||||
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||
func (c *AccountClient) DeleteOneID(id int64) *AccountDeleteOne {
|
||||
builder := c.Delete().Where(account.ID(id))
|
||||
builder.mutation.id = &id
|
||||
@ -219,6 +326,8 @@ func (c *AccountClient) DeleteOneID(id int64) *AccountDeleteOne {
|
||||
func (c *AccountClient) Query() *AccountQuery {
|
||||
return &AccountQuery{
|
||||
config: c.config,
|
||||
ctx: &QueryContext{Type: TypeAccount},
|
||||
inters: c.Interceptors(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,8 +347,8 @@ func (c *AccountClient) GetX(ctx context.Context, id int64) *Account {
|
||||
|
||||
// QueryDomains queries the domains edge of a Account.
|
||||
func (c *AccountClient) QueryDomains(a *Account) *DomainQuery {
|
||||
query := &DomainQuery{config: c.config}
|
||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||
query := (&DomainClient{config: c.config}).Query()
|
||||
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||
id := a.ID
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(account.Table, account.FieldID, id),
|
||||
@ -254,8 +363,8 @@ func (c *AccountClient) QueryDomains(a *Account) *DomainQuery {
|
||||
|
||||
// QueryLogs queries the logs edge of a Account.
|
||||
func (c *AccountClient) QueryLogs(a *Account) *LogentryQuery {
|
||||
query := &LogentryQuery{config: c.config}
|
||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||
query := (&LogentryClient{config: c.config}).Query()
|
||||
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||
id := a.ID
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(account.Table, account.FieldID, id),
|
||||
@ -273,6 +382,26 @@ func (c *AccountClient) Hooks() []Hook {
|
||||
return c.hooks.Account
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
func (c *AccountClient) Interceptors() []Interceptor {
|
||||
return c.inters.Account
|
||||
}
|
||||
|
||||
func (c *AccountClient) mutate(ctx context.Context, m *AccountMutation) (Value, error) {
|
||||
switch m.Op() {
|
||||
case OpCreate:
|
||||
return (&AccountCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdate:
|
||||
return (&AccountUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdateOne:
|
||||
return (&AccountUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpDelete, OpDeleteOne:
|
||||
return (&AccountDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||
default:
|
||||
return nil, fmt.Errorf("ent: unknown Account mutation op: %q", m.Op())
|
||||
}
|
||||
}
|
||||
|
||||
// AliasClient is a client for the Alias schema.
|
||||
type AliasClient struct {
|
||||
config
|
||||
@ -289,7 +418,13 @@ func (c *AliasClient) Use(hooks ...Hook) {
|
||||
c.hooks.Alias = append(c.hooks.Alias, hooks...)
|
||||
}
|
||||
|
||||
// Create returns a create builder for Alias.
|
||||
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||
// A call to `Intercept(f, g, h)` equals to `alias.Intercept(f(g(h())))`.
|
||||
func (c *AliasClient) Intercept(interceptors ...Interceptor) {
|
||||
c.inters.Alias = append(c.inters.Alias, interceptors...)
|
||||
}
|
||||
|
||||
// Create returns a builder for creating a Alias entity.
|
||||
func (c *AliasClient) Create() *AliasCreate {
|
||||
mutation := newAliasMutation(c.config, OpCreate)
|
||||
return &AliasCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
@ -300,6 +435,21 @@ func (c *AliasClient) CreateBulk(builders ...*AliasCreate) *AliasCreateBulk {
|
||||
return &AliasCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||
// a builder and applies setFunc on it.
|
||||
func (c *AliasClient) MapCreateBulk(slice any, setFunc func(*AliasCreate, int)) *AliasCreateBulk {
|
||||
rv := reflect.ValueOf(slice)
|
||||
if rv.Kind() != reflect.Slice {
|
||||
return &AliasCreateBulk{err: fmt.Errorf("calling to AliasClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||
}
|
||||
builders := make([]*AliasCreate, rv.Len())
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
builders[i] = c.Create()
|
||||
setFunc(builders[i], i)
|
||||
}
|
||||
return &AliasCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// Update returns an update builder for Alias.
|
||||
func (c *AliasClient) Update() *AliasUpdate {
|
||||
mutation := newAliasMutation(c.config, OpUpdate)
|
||||
@ -324,12 +474,12 @@ func (c *AliasClient) Delete() *AliasDelete {
|
||||
return &AliasDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// DeleteOne returns a delete builder for the given entity.
|
||||
// DeleteOne returns a builder for deleting the given entity.
|
||||
func (c *AliasClient) DeleteOne(a *Alias) *AliasDeleteOne {
|
||||
return c.DeleteOneID(a.ID)
|
||||
}
|
||||
|
||||
// DeleteOneID returns a delete builder for the given id.
|
||||
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||
func (c *AliasClient) DeleteOneID(id int64) *AliasDeleteOne {
|
||||
builder := c.Delete().Where(alias.ID(id))
|
||||
builder.mutation.id = &id
|
||||
@ -341,6 +491,8 @@ func (c *AliasClient) DeleteOneID(id int64) *AliasDeleteOne {
|
||||
func (c *AliasClient) Query() *AliasQuery {
|
||||
return &AliasQuery{
|
||||
config: c.config,
|
||||
ctx: &QueryContext{Type: TypeAlias},
|
||||
inters: c.Interceptors(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -360,8 +512,8 @@ func (c *AliasClient) GetX(ctx context.Context, id int64) *Alias {
|
||||
|
||||
// QueryDomain queries the domain edge of a Alias.
|
||||
func (c *AliasClient) QueryDomain(a *Alias) *DomainQuery {
|
||||
query := &DomainQuery{config: c.config}
|
||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||
query := (&DomainClient{config: c.config}).Query()
|
||||
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||
id := a.ID
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(alias.Table, alias.FieldID, id),
|
||||
@ -379,6 +531,26 @@ func (c *AliasClient) Hooks() []Hook {
|
||||
return c.hooks.Alias
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
func (c *AliasClient) Interceptors() []Interceptor {
|
||||
return c.inters.Alias
|
||||
}
|
||||
|
||||
func (c *AliasClient) mutate(ctx context.Context, m *AliasMutation) (Value, error) {
|
||||
switch m.Op() {
|
||||
case OpCreate:
|
||||
return (&AliasCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdate:
|
||||
return (&AliasUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdateOne:
|
||||
return (&AliasUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpDelete, OpDeleteOne:
|
||||
return (&AliasDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||
default:
|
||||
return nil, fmt.Errorf("ent: unknown Alias mutation op: %q", m.Op())
|
||||
}
|
||||
}
|
||||
|
||||
// DomainClient is a client for the Domain schema.
|
||||
type DomainClient struct {
|
||||
config
|
||||
@ -395,7 +567,13 @@ func (c *DomainClient) Use(hooks ...Hook) {
|
||||
c.hooks.Domain = append(c.hooks.Domain, hooks...)
|
||||
}
|
||||
|
||||
// Create returns a create builder for Domain.
|
||||
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||
// A call to `Intercept(f, g, h)` equals to `domain.Intercept(f(g(h())))`.
|
||||
func (c *DomainClient) Intercept(interceptors ...Interceptor) {
|
||||
c.inters.Domain = append(c.inters.Domain, interceptors...)
|
||||
}
|
||||
|
||||
// Create returns a builder for creating a Domain entity.
|
||||
func (c *DomainClient) Create() *DomainCreate {
|
||||
mutation := newDomainMutation(c.config, OpCreate)
|
||||
return &DomainCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
@ -406,6 +584,21 @@ func (c *DomainClient) CreateBulk(builders ...*DomainCreate) *DomainCreateBulk {
|
||||
return &DomainCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||
// a builder and applies setFunc on it.
|
||||
func (c *DomainClient) MapCreateBulk(slice any, setFunc func(*DomainCreate, int)) *DomainCreateBulk {
|
||||
rv := reflect.ValueOf(slice)
|
||||
if rv.Kind() != reflect.Slice {
|
||||
return &DomainCreateBulk{err: fmt.Errorf("calling to DomainClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||
}
|
||||
builders := make([]*DomainCreate, rv.Len())
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
builders[i] = c.Create()
|
||||
setFunc(builders[i], i)
|
||||
}
|
||||
return &DomainCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// Update returns an update builder for Domain.
|
||||
func (c *DomainClient) Update() *DomainUpdate {
|
||||
mutation := newDomainMutation(c.config, OpUpdate)
|
||||
@ -430,12 +623,12 @@ func (c *DomainClient) Delete() *DomainDelete {
|
||||
return &DomainDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// DeleteOne returns a delete builder for the given entity.
|
||||
// DeleteOne returns a builder for deleting the given entity.
|
||||
func (c *DomainClient) DeleteOne(d *Domain) *DomainDeleteOne {
|
||||
return c.DeleteOneID(d.ID)
|
||||
}
|
||||
|
||||
// DeleteOneID returns a delete builder for the given id.
|
||||
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||
func (c *DomainClient) DeleteOneID(id int64) *DomainDeleteOne {
|
||||
builder := c.Delete().Where(domain.ID(id))
|
||||
builder.mutation.id = &id
|
||||
@ -447,6 +640,8 @@ func (c *DomainClient) DeleteOneID(id int64) *DomainDeleteOne {
|
||||
func (c *DomainClient) Query() *DomainQuery {
|
||||
return &DomainQuery{
|
||||
config: c.config,
|
||||
ctx: &QueryContext{Type: TypeDomain},
|
||||
inters: c.Interceptors(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -466,8 +661,8 @@ func (c *DomainClient) GetX(ctx context.Context, id int64) *Domain {
|
||||
|
||||
// QueryMailboxes queries the mailboxes edge of a Domain.
|
||||
func (c *DomainClient) QueryMailboxes(d *Domain) *MailboxQuery {
|
||||
query := &MailboxQuery{config: c.config}
|
||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||
query := (&MailboxClient{config: c.config}).Query()
|
||||
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||
id := d.ID
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(domain.Table, domain.FieldID, id),
|
||||
@ -482,8 +677,8 @@ func (c *DomainClient) QueryMailboxes(d *Domain) *MailboxQuery {
|
||||
|
||||
// QueryAliases queries the aliases edge of a Domain.
|
||||
func (c *DomainClient) QueryAliases(d *Domain) *AliasQuery {
|
||||
query := &AliasQuery{config: c.config}
|
||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||
query := (&AliasClient{config: c.config}).Query()
|
||||
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||
id := d.ID
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(domain.Table, domain.FieldID, id),
|
||||
@ -498,8 +693,8 @@ func (c *DomainClient) QueryAliases(d *Domain) *AliasQuery {
|
||||
|
||||
// QueryLogs queries the logs edge of a Domain.
|
||||
func (c *DomainClient) QueryLogs(d *Domain) *LogentryQuery {
|
||||
query := &LogentryQuery{config: c.config}
|
||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||
query := (&LogentryClient{config: c.config}).Query()
|
||||
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||
id := d.ID
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(domain.Table, domain.FieldID, id),
|
||||
@ -514,8 +709,8 @@ func (c *DomainClient) QueryLogs(d *Domain) *LogentryQuery {
|
||||
|
||||
// QueryAccounts queries the accounts edge of a Domain.
|
||||
func (c *DomainClient) QueryAccounts(d *Domain) *AccountQuery {
|
||||
query := &AccountQuery{config: c.config}
|
||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||
query := (&AccountClient{config: c.config}).Query()
|
||||
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||
id := d.ID
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(domain.Table, domain.FieldID, id),
|
||||
@ -533,6 +728,26 @@ func (c *DomainClient) Hooks() []Hook {
|
||||
return c.hooks.Domain
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
func (c *DomainClient) Interceptors() []Interceptor {
|
||||
return c.inters.Domain
|
||||
}
|
||||
|
||||
func (c *DomainClient) mutate(ctx context.Context, m *DomainMutation) (Value, error) {
|
||||
switch m.Op() {
|
||||
case OpCreate:
|
||||
return (&DomainCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdate:
|
||||
return (&DomainUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdateOne:
|
||||
return (&DomainUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpDelete, OpDeleteOne:
|
||||
return (&DomainDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||
default:
|
||||
return nil, fmt.Errorf("ent: unknown Domain mutation op: %q", m.Op())
|
||||
}
|
||||
}
|
||||
|
||||
// LogentryClient is a client for the Logentry schema.
|
||||
type LogentryClient struct {
|
||||
config
|
||||
@ -549,7 +764,13 @@ func (c *LogentryClient) Use(hooks ...Hook) {
|
||||
c.hooks.Logentry = append(c.hooks.Logentry, hooks...)
|
||||
}
|
||||
|
||||
// Create returns a create builder for Logentry.
|
||||
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||
// A call to `Intercept(f, g, h)` equals to `logentry.Intercept(f(g(h())))`.
|
||||
func (c *LogentryClient) Intercept(interceptors ...Interceptor) {
|
||||
c.inters.Logentry = append(c.inters.Logentry, interceptors...)
|
||||
}
|
||||
|
||||
// Create returns a builder for creating a Logentry entity.
|
||||
func (c *LogentryClient) Create() *LogentryCreate {
|
||||
mutation := newLogentryMutation(c.config, OpCreate)
|
||||
return &LogentryCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
@ -560,6 +781,21 @@ func (c *LogentryClient) CreateBulk(builders ...*LogentryCreate) *LogentryCreate
|
||||
return &LogentryCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||
// a builder and applies setFunc on it.
|
||||
func (c *LogentryClient) MapCreateBulk(slice any, setFunc func(*LogentryCreate, int)) *LogentryCreateBulk {
|
||||
rv := reflect.ValueOf(slice)
|
||||
if rv.Kind() != reflect.Slice {
|
||||
return &LogentryCreateBulk{err: fmt.Errorf("calling to LogentryClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||
}
|
||||
builders := make([]*LogentryCreate, rv.Len())
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
builders[i] = c.Create()
|
||||
setFunc(builders[i], i)
|
||||
}
|
||||
return &LogentryCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// Update returns an update builder for Logentry.
|
||||
func (c *LogentryClient) Update() *LogentryUpdate {
|
||||
mutation := newLogentryMutation(c.config, OpUpdate)
|
||||
@ -584,12 +820,12 @@ func (c *LogentryClient) Delete() *LogentryDelete {
|
||||
return &LogentryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// DeleteOne returns a delete builder for the given entity.
|
||||
// DeleteOne returns a builder for deleting the given entity.
|
||||
func (c *LogentryClient) DeleteOne(l *Logentry) *LogentryDeleteOne {
|
||||
return c.DeleteOneID(l.ID)
|
||||
}
|
||||
|
||||
// DeleteOneID returns a delete builder for the given id.
|
||||
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||
func (c *LogentryClient) DeleteOneID(id int64) *LogentryDeleteOne {
|
||||
builder := c.Delete().Where(logentry.ID(id))
|
||||
builder.mutation.id = &id
|
||||
@ -601,6 +837,8 @@ func (c *LogentryClient) DeleteOneID(id int64) *LogentryDeleteOne {
|
||||
func (c *LogentryClient) Query() *LogentryQuery {
|
||||
return &LogentryQuery{
|
||||
config: c.config,
|
||||
ctx: &QueryContext{Type: TypeLogentry},
|
||||
inters: c.Interceptors(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -620,8 +858,8 @@ func (c *LogentryClient) GetX(ctx context.Context, id int64) *Logentry {
|
||||
|
||||
// QueryAccount queries the account edge of a Logentry.
|
||||
func (c *LogentryClient) QueryAccount(l *Logentry) *AccountQuery {
|
||||
query := &AccountQuery{config: c.config}
|
||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||
query := (&AccountClient{config: c.config}).Query()
|
||||
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||
id := l.ID
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(logentry.Table, logentry.FieldID, id),
|
||||
@ -636,8 +874,8 @@ func (c *LogentryClient) QueryAccount(l *Logentry) *AccountQuery {
|
||||
|
||||
// QueryDomain queries the domain edge of a Logentry.
|
||||
func (c *LogentryClient) QueryDomain(l *Logentry) *DomainQuery {
|
||||
query := &DomainQuery{config: c.config}
|
||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||
query := (&DomainClient{config: c.config}).Query()
|
||||
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||
id := l.ID
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(logentry.Table, logentry.FieldID, id),
|
||||
@ -655,6 +893,26 @@ func (c *LogentryClient) Hooks() []Hook {
|
||||
return c.hooks.Logentry
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
func (c *LogentryClient) Interceptors() []Interceptor {
|
||||
return c.inters.Logentry
|
||||
}
|
||||
|
||||
func (c *LogentryClient) mutate(ctx context.Context, m *LogentryMutation) (Value, error) {
|
||||
switch m.Op() {
|
||||
case OpCreate:
|
||||
return (&LogentryCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdate:
|
||||
return (&LogentryUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdateOne:
|
||||
return (&LogentryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpDelete, OpDeleteOne:
|
||||
return (&LogentryDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||
default:
|
||||
return nil, fmt.Errorf("ent: unknown Logentry mutation op: %q", m.Op())
|
||||
}
|
||||
}
|
||||
|
||||
// MailboxClient is a client for the Mailbox schema.
|
||||
type MailboxClient struct {
|
||||
config
|
||||
@ -671,7 +929,13 @@ func (c *MailboxClient) Use(hooks ...Hook) {
|
||||
c.hooks.Mailbox = append(c.hooks.Mailbox, hooks...)
|
||||
}
|
||||
|
||||
// Create returns a create builder for Mailbox.
|
||||
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||
// A call to `Intercept(f, g, h)` equals to `mailbox.Intercept(f(g(h())))`.
|
||||
func (c *MailboxClient) Intercept(interceptors ...Interceptor) {
|
||||
c.inters.Mailbox = append(c.inters.Mailbox, interceptors...)
|
||||
}
|
||||
|
||||
// Create returns a builder for creating a Mailbox entity.
|
||||
func (c *MailboxClient) Create() *MailboxCreate {
|
||||
mutation := newMailboxMutation(c.config, OpCreate)
|
||||
return &MailboxCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
@ -682,6 +946,21 @@ func (c *MailboxClient) CreateBulk(builders ...*MailboxCreate) *MailboxCreateBul
|
||||
return &MailboxCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||
// a builder and applies setFunc on it.
|
||||
func (c *MailboxClient) MapCreateBulk(slice any, setFunc func(*MailboxCreate, int)) *MailboxCreateBulk {
|
||||
rv := reflect.ValueOf(slice)
|
||||
if rv.Kind() != reflect.Slice {
|
||||
return &MailboxCreateBulk{err: fmt.Errorf("calling to MailboxClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||
}
|
||||
builders := make([]*MailboxCreate, rv.Len())
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
builders[i] = c.Create()
|
||||
setFunc(builders[i], i)
|
||||
}
|
||||
return &MailboxCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// Update returns an update builder for Mailbox.
|
||||
func (c *MailboxClient) Update() *MailboxUpdate {
|
||||
mutation := newMailboxMutation(c.config, OpUpdate)
|
||||
@ -706,12 +985,12 @@ func (c *MailboxClient) Delete() *MailboxDelete {
|
||||
return &MailboxDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// DeleteOne returns a delete builder for the given entity.
|
||||
// DeleteOne returns a builder for deleting the given entity.
|
||||
func (c *MailboxClient) DeleteOne(m *Mailbox) *MailboxDeleteOne {
|
||||
return c.DeleteOneID(m.ID)
|
||||
}
|
||||
|
||||
// DeleteOneID returns a delete builder for the given id.
|
||||
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||
func (c *MailboxClient) DeleteOneID(id int64) *MailboxDeleteOne {
|
||||
builder := c.Delete().Where(mailbox.ID(id))
|
||||
builder.mutation.id = &id
|
||||
@ -723,6 +1002,8 @@ func (c *MailboxClient) DeleteOneID(id int64) *MailboxDeleteOne {
|
||||
func (c *MailboxClient) Query() *MailboxQuery {
|
||||
return &MailboxQuery{
|
||||
config: c.config,
|
||||
ctx: &QueryContext{Type: TypeMailbox},
|
||||
inters: c.Interceptors(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -742,8 +1023,8 @@ func (c *MailboxClient) GetX(ctx context.Context, id int64) *Mailbox {
|
||||
|
||||
// QueryDomain queries the domain edge of a Mailbox.
|
||||
func (c *MailboxClient) QueryDomain(m *Mailbox) *DomainQuery {
|
||||
query := &DomainQuery{config: c.config}
|
||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||
query := (&DomainClient{config: c.config}).Query()
|
||||
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
||||
id := m.ID
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(mailbox.Table, mailbox.FieldID, id),
|
||||
@ -760,3 +1041,33 @@ func (c *MailboxClient) QueryDomain(m *Mailbox) *DomainQuery {
|
||||
func (c *MailboxClient) Hooks() []Hook {
|
||||
return c.hooks.Mailbox
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
func (c *MailboxClient) Interceptors() []Interceptor {
|
||||
return c.inters.Mailbox
|
||||
}
|
||||
|
||||
func (c *MailboxClient) mutate(ctx context.Context, m *MailboxMutation) (Value, error) {
|
||||
switch m.Op() {
|
||||
case OpCreate:
|
||||
return (&MailboxCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdate:
|
||||
return (&MailboxUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdateOne:
|
||||
return (&MailboxUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpDelete, OpDeleteOne:
|
||||
return (&MailboxDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||
default:
|
||||
return nil, fmt.Errorf("ent: unknown Mailbox mutation op: %q", m.Op())
|
||||
}
|
||||
}
|
||||
|
||||
// hooks and interceptors per client, for fast access.
|
||||
type (
|
||||
hooks struct {
|
||||
Account, Alias, Domain, Logentry, Mailbox []ent.Hook
|
||||
}
|
||||
inters struct {
|
||||
Account, Alias, Domain, Logentry, Mailbox []ent.Interceptor
|
||||
}
|
||||
)
|
||||
|
@ -1,63 +0,0 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
)
|
||||
|
||||
// Option function to configure the client.
|
||||
type Option func(*config)
|
||||
|
||||
// Config is the configuration for the client and its builder.
|
||||
type config struct {
|
||||
// driver used for executing database requests.
|
||||
driver dialect.Driver
|
||||
// debug enable a debug logging.
|
||||
debug bool
|
||||
// log used for logging on debug mode.
|
||||
log func(...interface{})
|
||||
// hooks to execute on mutations.
|
||||
hooks *hooks
|
||||
}
|
||||
|
||||
// hooks per client, for fast access.
|
||||
type hooks struct {
|
||||
Account []ent.Hook
|
||||
Alias []ent.Hook
|
||||
Domain []ent.Hook
|
||||
Logentry []ent.Hook
|
||||
Mailbox []ent.Hook
|
||||
}
|
||||
|
||||
// Options applies the options on the config object.
|
||||
func (c *config) options(opts ...Option) {
|
||||
for _, opt := range opts {
|
||||
opt(c)
|
||||
}
|
||||
if c.debug {
|
||||
c.driver = dialect.Debug(c.driver, c.log)
|
||||
}
|
||||
}
|
||||
|
||||
// Debug enables debug logging on the ent.Driver.
|
||||
func Debug() Option {
|
||||
return func(c *config) {
|
||||
c.debug = true
|
||||
}
|
||||
}
|
||||
|
||||
// Log sets the logging function for debug mode.
|
||||
func Log(fn func(...interface{})) Option {
|
||||
return func(c *config) {
|
||||
c.log = fn
|
||||
}
|
||||
}
|
||||
|
||||
// Driver configures the client driver.
|
||||
func Driver(driver dialect.Driver) Option {
|
||||
return func(c *config) {
|
||||
c.driver = driver
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type clientCtxKey struct{}
|
||||
|
||||
// FromContext returns a Client stored inside a context, or nil if there isn't one.
|
||||
func FromContext(ctx context.Context) *Client {
|
||||
c, _ := ctx.Value(clientCtxKey{}).(*Client)
|
||||
return c
|
||||
}
|
||||
|
||||
// NewContext returns a new context with the given Client attached.
|
||||
func NewContext(parent context.Context, c *Client) context.Context {
|
||||
return context.WithValue(parent, clientCtxKey{}, c)
|
||||
}
|
||||
|
||||
type txCtxKey struct{}
|
||||
|
||||
// TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
|
||||
func TxFromContext(ctx context.Context) *Tx {
|
||||
tx, _ := ctx.Value(txCtxKey{}).(*Tx)
|
||||
return tx
|
||||
}
|
||||
|
||||
// NewTxContext returns a new context with the given Tx attached.
|
||||
func NewTxContext(parent context.Context, tx *Tx) context.Context {
|
||||
return context.WithValue(parent, txCtxKey{}, tx)
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/domain"
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@ -40,7 +41,8 @@ type Domain struct {
|
||||
Active bool `json:"active,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the DomainQuery when eager-loading is set.
|
||||
Edges DomainEdges `json:"edges"`
|
||||
Edges DomainEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// DomainEdges holds the relations/edges for other nodes in the graph.
|
||||
@ -95,8 +97,8 @@ func (e DomainEdges) AccountsOrErr() ([]*Account, error) {
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Domain) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Domain) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case domain.FieldBackupMx, domain.FieldActive:
|
||||
@ -108,7 +110,7 @@ func (*Domain) scanValues(columns []string) ([]interface{}, error) {
|
||||
case domain.FieldCreated, domain.FieldModified:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Domain", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@ -116,7 +118,7 @@ func (*Domain) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Domain fields.
|
||||
func (d *Domain) assignValues(columns []string, values []interface{}) error {
|
||||
func (d *Domain) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@ -196,46 +198,54 @@ func (d *Domain) assignValues(columns []string, values []interface{}) error {
|
||||
} else if value.Valid {
|
||||
d.Active = value.Bool
|
||||
}
|
||||
default:
|
||||
d.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Domain.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (d *Domain) Value(name string) (ent.Value, error) {
|
||||
return d.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryMailboxes queries the "mailboxes" edge of the Domain entity.
|
||||
func (d *Domain) QueryMailboxes() *MailboxQuery {
|
||||
return (&DomainClient{config: d.config}).QueryMailboxes(d)
|
||||
return NewDomainClient(d.config).QueryMailboxes(d)
|
||||
}
|
||||
|
||||
// QueryAliases queries the "aliases" edge of the Domain entity.
|
||||
func (d *Domain) QueryAliases() *AliasQuery {
|
||||
return (&DomainClient{config: d.config}).QueryAliases(d)
|
||||
return NewDomainClient(d.config).QueryAliases(d)
|
||||
}
|
||||
|
||||
// QueryLogs queries the "logs" edge of the Domain entity.
|
||||
func (d *Domain) QueryLogs() *LogentryQuery {
|
||||
return (&DomainClient{config: d.config}).QueryLogs(d)
|
||||
return NewDomainClient(d.config).QueryLogs(d)
|
||||
}
|
||||
|
||||
// QueryAccounts queries the "accounts" edge of the Domain entity.
|
||||
func (d *Domain) QueryAccounts() *AccountQuery {
|
||||
return (&DomainClient{config: d.config}).QueryAccounts(d)
|
||||
return NewDomainClient(d.config).QueryAccounts(d)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Domain.
|
||||
// Note that you need to call Domain.Unwrap() before calling this method if this Domain
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (d *Domain) Update() *DomainUpdateOne {
|
||||
return (&DomainClient{config: d.config}).UpdateOne(d)
|
||||
return NewDomainClient(d.config).UpdateOne(d)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the Domain entity that was returned from a transaction after it was closed,
|
||||
// so that all future queries will be executed through the driver which created the transaction.
|
||||
func (d *Domain) Unwrap() *Domain {
|
||||
tx, ok := d.config.driver.(*txDriver)
|
||||
_tx, ok := d.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Domain is not a transactional entity")
|
||||
}
|
||||
d.config.driver = tx.drv
|
||||
d.config.driver = _tx.drv
|
||||
return d
|
||||
}
|
||||
|
||||
@ -243,32 +253,42 @@ func (d *Domain) Unwrap() *Domain {
|
||||
func (d *Domain) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("Domain(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v", d.ID))
|
||||
builder.WriteString(", created=")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", d.ID))
|
||||
builder.WriteString("created=")
|
||||
builder.WriteString(d.Created.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := d.Modified; v != nil {
|
||||
builder.WriteString(", modified=")
|
||||
builder.WriteString("modified=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", domain=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("domain=")
|
||||
builder.WriteString(d.Domain)
|
||||
builder.WriteString(", ")
|
||||
if v := d.Description; v != nil {
|
||||
builder.WriteString(", description=")
|
||||
builder.WriteString("description=")
|
||||
builder.WriteString(*v)
|
||||
}
|
||||
builder.WriteString(", max_aliases=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("max_aliases=")
|
||||
builder.WriteString(fmt.Sprintf("%v", d.MaxAliases))
|
||||
builder.WriteString(", max_mailboxes=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("max_mailboxes=")
|
||||
builder.WriteString(fmt.Sprintf("%v", d.MaxMailboxes))
|
||||
builder.WriteString(", max_quota=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("max_quota=")
|
||||
builder.WriteString(fmt.Sprintf("%v", d.MaxQuota))
|
||||
builder.WriteString(", quota=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("quota=")
|
||||
builder.WriteString(fmt.Sprintf("%v", d.Quota))
|
||||
builder.WriteString(", transport=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("transport=")
|
||||
builder.WriteString(d.Transport)
|
||||
builder.WriteString(", backup_mx=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("backup_mx=")
|
||||
builder.WriteString(fmt.Sprintf("%v", d.BackupMx))
|
||||
builder.WriteString(", active=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("active=")
|
||||
builder.WriteString(fmt.Sprintf("%v", d.Active))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
@ -276,9 +296,3 @@ func (d *Domain) String() string {
|
||||
|
||||
// Domains is a parsable slice of Domain.
|
||||
type Domains []*Domain
|
||||
|
||||
func (d Domains) config(cfg config) {
|
||||
for _i := range d {
|
||||
d[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -111,3 +114,150 @@ var (
|
||||
// UpdateDefaultModified holds the default value on update for the "modified" field.
|
||||
UpdateDefaultModified func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Domain queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreated orders the results by the created field.
|
||||
func ByCreated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModified orders the results by the modified field.
|
||||
func ByModified(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModified, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDomain orders the results by the domain field.
|
||||
func ByDomain(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDomain, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDescription orders the results by the description field.
|
||||
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDescription, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMaxAliases orders the results by the max_aliases field.
|
||||
func ByMaxAliases(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMaxAliases, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMaxMailboxes orders the results by the max_mailboxes field.
|
||||
func ByMaxMailboxes(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMaxMailboxes, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMaxQuota orders the results by the max_quota field.
|
||||
func ByMaxQuota(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMaxQuota, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByQuota orders the results by the quota field.
|
||||
func ByQuota(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldQuota, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTransport orders the results by the transport field.
|
||||
func ByTransport(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTransport, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBackupMx orders the results by the backup_mx field.
|
||||
func ByBackupMx(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBackupMx, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByActive orders the results by the active field.
|
||||
func ByActive(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldActive, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMailboxesCount orders the results by mailboxes count.
|
||||
func ByMailboxesCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newMailboxesStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByMailboxes orders the results by mailboxes terms.
|
||||
func ByMailboxes(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMailboxesStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByAliasesCount orders the results by aliases count.
|
||||
func ByAliasesCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newAliasesStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByAliases orders the results by aliases terms.
|
||||
func ByAliases(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newAliasesStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByLogsCount orders the results by logs count.
|
||||
func ByLogsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newLogsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByLogs orders the results by logs terms.
|
||||
func ByLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newLogsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByAccountsCount orders the results by accounts count.
|
||||
func ByAccountsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newAccountsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByAccounts orders the results by accounts terms.
|
||||
func ByAccounts(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newAccountsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newMailboxesStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MailboxesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, MailboxesTable, MailboxesColumn),
|
||||
)
|
||||
}
|
||||
func newAliasesStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(AliasesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, AliasesTable, AliasesColumn),
|
||||
)
|
||||
}
|
||||
func newLogsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(LogsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, LogsTable, LogsColumn),
|
||||
)
|
||||
}
|
||||
func newAccountsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(AccountsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, true, AccountsTable, AccountsPrimaryKey...),
|
||||
)
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -187,44 +187,8 @@ func (dc *DomainCreate) Mutation() *DomainMutation {
|
||||
|
||||
// Save creates the Domain in the database.
|
||||
func (dc *DomainCreate) Save(ctx context.Context) (*Domain, error) {
|
||||
var (
|
||||
err error
|
||||
node *Domain
|
||||
)
|
||||
dc.defaults()
|
||||
if len(dc.hooks) == 0 {
|
||||
if err = dc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = dc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*DomainMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = dc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dc.mutation = mutation
|
||||
if node, err = dc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(dc.hooks) - 1; i >= 0; i-- {
|
||||
if dc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = dc.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, dc.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
return withHooks(ctx, dc.sqlSave, dc.mutation, dc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@ -294,10 +258,13 @@ func (dc *DomainCreate) check() error {
|
||||
}
|
||||
|
||||
func (dc *DomainCreate) sqlSave(ctx context.Context) (*Domain, error) {
|
||||
if err := dc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := dc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, dc.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@ -305,110 +272,62 @@ func (dc *DomainCreate) sqlSave(ctx context.Context) (*Domain, error) {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
dc.mutation.id = &_node.ID
|
||||
dc.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (dc *DomainCreate) createSpec() (*Domain, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Domain{config: dc.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: domain.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
}
|
||||
_spec = sqlgraph.NewCreateSpec(domain.Table, sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := dc.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := dc.mutation.Created(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: domain.FieldCreated,
|
||||
})
|
||||
_spec.SetField(domain.FieldCreated, field.TypeTime, value)
|
||||
_node.Created = value
|
||||
}
|
||||
if value, ok := dc.mutation.Modified(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: domain.FieldModified,
|
||||
})
|
||||
_spec.SetField(domain.FieldModified, field.TypeTime, value)
|
||||
_node.Modified = &value
|
||||
}
|
||||
if value, ok := dc.mutation.Domain(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: domain.FieldDomain,
|
||||
})
|
||||
_spec.SetField(domain.FieldDomain, field.TypeString, value)
|
||||
_node.Domain = value
|
||||
}
|
||||
if value, ok := dc.mutation.Description(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: domain.FieldDescription,
|
||||
})
|
||||
_spec.SetField(domain.FieldDescription, field.TypeString, value)
|
||||
_node.Description = &value
|
||||
}
|
||||
if value, ok := dc.mutation.MaxAliases(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxAliases,
|
||||
})
|
||||
_spec.SetField(domain.FieldMaxAliases, field.TypeInt64, value)
|
||||
_node.MaxAliases = value
|
||||
}
|
||||
if value, ok := dc.mutation.MaxMailboxes(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxMailboxes,
|
||||
})
|
||||
_spec.SetField(domain.FieldMaxMailboxes, field.TypeInt64, value)
|
||||
_node.MaxMailboxes = value
|
||||
}
|
||||
if value, ok := dc.mutation.MaxQuota(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxQuota,
|
||||
})
|
||||
_spec.SetField(domain.FieldMaxQuota, field.TypeInt64, value)
|
||||
_node.MaxQuota = value
|
||||
}
|
||||
if value, ok := dc.mutation.Quota(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldQuota,
|
||||
})
|
||||
_spec.SetField(domain.FieldQuota, field.TypeInt64, value)
|
||||
_node.Quota = value
|
||||
}
|
||||
if value, ok := dc.mutation.Transport(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: domain.FieldTransport,
|
||||
})
|
||||
_spec.SetField(domain.FieldTransport, field.TypeString, value)
|
||||
_node.Transport = value
|
||||
}
|
||||
if value, ok := dc.mutation.BackupMx(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: domain.FieldBackupMx,
|
||||
})
|
||||
_spec.SetField(domain.FieldBackupMx, field.TypeBool, value)
|
||||
_node.BackupMx = value
|
||||
}
|
||||
if value, ok := dc.mutation.Active(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: domain.FieldActive,
|
||||
})
|
||||
_spec.SetField(domain.FieldActive, field.TypeBool, value)
|
||||
_node.Active = value
|
||||
}
|
||||
if nodes := dc.mutation.MailboxesIDs(); len(nodes) > 0 {
|
||||
@ -419,10 +338,7 @@ func (dc *DomainCreate) createSpec() (*Domain, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{domain.MailboxesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -438,10 +354,7 @@ func (dc *DomainCreate) createSpec() (*Domain, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{domain.AliasesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -457,10 +370,7 @@ func (dc *DomainCreate) createSpec() (*Domain, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{domain.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -476,10 +386,7 @@ func (dc *DomainCreate) createSpec() (*Domain, *sqlgraph.CreateSpec) {
|
||||
Columns: domain.AccountsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -493,11 +400,15 @@ func (dc *DomainCreate) createSpec() (*Domain, *sqlgraph.CreateSpec) {
|
||||
// DomainCreateBulk is the builder for creating many Domain entities in bulk.
|
||||
type DomainCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*DomainCreate
|
||||
}
|
||||
|
||||
// Save creates the Domain entities in the database.
|
||||
func (dcb *DomainCreateBulk) Save(ctx context.Context) ([]*Domain, error) {
|
||||
if dcb.err != nil {
|
||||
return nil, dcb.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(dcb.builders))
|
||||
nodes := make([]*Domain, len(dcb.builders))
|
||||
mutators := make([]Mutator, len(dcb.builders))
|
||||
@ -514,8 +425,8 @@ func (dcb *DomainCreateBulk) Save(ctx context.Context) ([]*Domain, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, dcb.builders[i+1].mutation)
|
||||
} else {
|
||||
@ -523,7 +434,7 @@ func (dcb *DomainCreateBulk) Save(ctx context.Context) ([]*Domain, error) {
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, dcb.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -531,11 +442,11 @@ func (dcb *DomainCreateBulk) Save(ctx context.Context) ([]*Domain, error) {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
mutation.done = true
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
|
@ -1,10 +1,9 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/domain"
|
||||
"code.icod.de/postfix/manager/ent/predicate"
|
||||
@ -28,34 +27,7 @@ func (dd *DomainDelete) Where(ps ...predicate.Domain) *DomainDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (dd *DomainDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(dd.hooks) == 0 {
|
||||
affected, err = dd.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*DomainMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
dd.mutation = mutation
|
||||
affected, err = dd.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(dd.hooks) - 1; i >= 0; i-- {
|
||||
if dd.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = dd.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, dd.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, dd.sqlExec, dd.mutation, dd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
@ -68,15 +40,7 @@ func (dd *DomainDelete) ExecX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
func (dd *DomainDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: domain.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewDeleteSpec(domain.Table, sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64))
|
||||
if ps := dd.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@ -84,7 +48,12 @@ func (dd *DomainDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, dd.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, dd.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
dd.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// DomainDeleteOne is the builder for deleting a single Domain entity.
|
||||
@ -92,6 +61,12 @@ type DomainDeleteOne struct {
|
||||
dd *DomainDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the DomainDelete builder.
|
||||
func (ddo *DomainDeleteOne) Where(ps ...predicate.Domain) *DomainDeleteOne {
|
||||
ddo.dd.mutation.Where(ps...)
|
||||
return ddo
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (ddo *DomainDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := ddo.dd.Exec(ctx)
|
||||
@ -107,5 +82,7 @@ func (ddo *DomainDeleteOne) Exec(ctx context.Context) error {
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (ddo *DomainDeleteOne) ExecX(ctx context.Context) {
|
||||
ddo.dd.ExecX(ctx)
|
||||
if err := ddo.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -50,6 +50,14 @@ func (du *DomainUpdate) SetDomain(s string) *DomainUpdate {
|
||||
return du
|
||||
}
|
||||
|
||||
// SetNillableDomain sets the "domain" field if the given value is not nil.
|
||||
func (du *DomainUpdate) SetNillableDomain(s *string) *DomainUpdate {
|
||||
if s != nil {
|
||||
du.SetDomain(*s)
|
||||
}
|
||||
return du
|
||||
}
|
||||
|
||||
// SetDescription sets the "description" field.
|
||||
func (du *DomainUpdate) SetDescription(s string) *DomainUpdate {
|
||||
du.mutation.SetDescription(s)
|
||||
@ -77,6 +85,14 @@ func (du *DomainUpdate) SetMaxAliases(i int64) *DomainUpdate {
|
||||
return du
|
||||
}
|
||||
|
||||
// SetNillableMaxAliases sets the "max_aliases" field if the given value is not nil.
|
||||
func (du *DomainUpdate) SetNillableMaxAliases(i *int64) *DomainUpdate {
|
||||
if i != nil {
|
||||
du.SetMaxAliases(*i)
|
||||
}
|
||||
return du
|
||||
}
|
||||
|
||||
// AddMaxAliases adds i to the "max_aliases" field.
|
||||
func (du *DomainUpdate) AddMaxAliases(i int64) *DomainUpdate {
|
||||
du.mutation.AddMaxAliases(i)
|
||||
@ -90,6 +106,14 @@ func (du *DomainUpdate) SetMaxMailboxes(i int64) *DomainUpdate {
|
||||
return du
|
||||
}
|
||||
|
||||
// SetNillableMaxMailboxes sets the "max_mailboxes" field if the given value is not nil.
|
||||
func (du *DomainUpdate) SetNillableMaxMailboxes(i *int64) *DomainUpdate {
|
||||
if i != nil {
|
||||
du.SetMaxMailboxes(*i)
|
||||
}
|
||||
return du
|
||||
}
|
||||
|
||||
// AddMaxMailboxes adds i to the "max_mailboxes" field.
|
||||
func (du *DomainUpdate) AddMaxMailboxes(i int64) *DomainUpdate {
|
||||
du.mutation.AddMaxMailboxes(i)
|
||||
@ -103,6 +127,14 @@ func (du *DomainUpdate) SetMaxQuota(i int64) *DomainUpdate {
|
||||
return du
|
||||
}
|
||||
|
||||
// SetNillableMaxQuota sets the "max_quota" field if the given value is not nil.
|
||||
func (du *DomainUpdate) SetNillableMaxQuota(i *int64) *DomainUpdate {
|
||||
if i != nil {
|
||||
du.SetMaxQuota(*i)
|
||||
}
|
||||
return du
|
||||
}
|
||||
|
||||
// AddMaxQuota adds i to the "max_quota" field.
|
||||
func (du *DomainUpdate) AddMaxQuota(i int64) *DomainUpdate {
|
||||
du.mutation.AddMaxQuota(i)
|
||||
@ -116,6 +148,14 @@ func (du *DomainUpdate) SetQuota(i int64) *DomainUpdate {
|
||||
return du
|
||||
}
|
||||
|
||||
// SetNillableQuota sets the "quota" field if the given value is not nil.
|
||||
func (du *DomainUpdate) SetNillableQuota(i *int64) *DomainUpdate {
|
||||
if i != nil {
|
||||
du.SetQuota(*i)
|
||||
}
|
||||
return du
|
||||
}
|
||||
|
||||
// AddQuota adds i to the "quota" field.
|
||||
func (du *DomainUpdate) AddQuota(i int64) *DomainUpdate {
|
||||
du.mutation.AddQuota(i)
|
||||
@ -128,18 +168,42 @@ func (du *DomainUpdate) SetTransport(s string) *DomainUpdate {
|
||||
return du
|
||||
}
|
||||
|
||||
// SetNillableTransport sets the "transport" field if the given value is not nil.
|
||||
func (du *DomainUpdate) SetNillableTransport(s *string) *DomainUpdate {
|
||||
if s != nil {
|
||||
du.SetTransport(*s)
|
||||
}
|
||||
return du
|
||||
}
|
||||
|
||||
// SetBackupMx sets the "backup_mx" field.
|
||||
func (du *DomainUpdate) SetBackupMx(b bool) *DomainUpdate {
|
||||
du.mutation.SetBackupMx(b)
|
||||
return du
|
||||
}
|
||||
|
||||
// SetNillableBackupMx sets the "backup_mx" field if the given value is not nil.
|
||||
func (du *DomainUpdate) SetNillableBackupMx(b *bool) *DomainUpdate {
|
||||
if b != nil {
|
||||
du.SetBackupMx(*b)
|
||||
}
|
||||
return du
|
||||
}
|
||||
|
||||
// SetActive sets the "active" field.
|
||||
func (du *DomainUpdate) SetActive(b bool) *DomainUpdate {
|
||||
du.mutation.SetActive(b)
|
||||
return du
|
||||
}
|
||||
|
||||
// SetNillableActive sets the "active" field if the given value is not nil.
|
||||
func (du *DomainUpdate) SetNillableActive(b *bool) *DomainUpdate {
|
||||
if b != nil {
|
||||
du.SetActive(*b)
|
||||
}
|
||||
return du
|
||||
}
|
||||
|
||||
// AddMailboxIDs adds the "mailboxes" edge to the Mailbox entity by IDs.
|
||||
func (du *DomainUpdate) AddMailboxIDs(ids ...int64) *DomainUpdate {
|
||||
du.mutation.AddMailboxIDs(ids...)
|
||||
@ -291,35 +355,8 @@ func (du *DomainUpdate) RemoveAccounts(a ...*Account) *DomainUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (du *DomainUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
du.defaults()
|
||||
if len(du.hooks) == 0 {
|
||||
affected, err = du.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*DomainMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
du.mutation = mutation
|
||||
affected, err = du.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(du.hooks) - 1; i >= 0; i-- {
|
||||
if du.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = du.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, du.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, du.sqlSave, du.mutation, du.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@ -353,16 +390,7 @@ func (du *DomainUpdate) defaults() {
|
||||
}
|
||||
|
||||
func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: domain.Table,
|
||||
Columns: domain.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(domain.Table, domain.Columns, sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64))
|
||||
if ps := du.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@ -371,114 +399,52 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
}
|
||||
if value, ok := du.mutation.Modified(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: domain.FieldModified,
|
||||
})
|
||||
_spec.SetField(domain.FieldModified, field.TypeTime, value)
|
||||
}
|
||||
if du.mutation.ModifiedCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Column: domain.FieldModified,
|
||||
})
|
||||
_spec.ClearField(domain.FieldModified, field.TypeTime)
|
||||
}
|
||||
if value, ok := du.mutation.Domain(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: domain.FieldDomain,
|
||||
})
|
||||
_spec.SetField(domain.FieldDomain, field.TypeString, value)
|
||||
}
|
||||
if value, ok := du.mutation.Description(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: domain.FieldDescription,
|
||||
})
|
||||
_spec.SetField(domain.FieldDescription, field.TypeString, value)
|
||||
}
|
||||
if du.mutation.DescriptionCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: domain.FieldDescription,
|
||||
})
|
||||
_spec.ClearField(domain.FieldDescription, field.TypeString)
|
||||
}
|
||||
if value, ok := du.mutation.MaxAliases(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxAliases,
|
||||
})
|
||||
_spec.SetField(domain.FieldMaxAliases, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := du.mutation.AddedMaxAliases(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxAliases,
|
||||
})
|
||||
_spec.AddField(domain.FieldMaxAliases, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := du.mutation.MaxMailboxes(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxMailboxes,
|
||||
})
|
||||
_spec.SetField(domain.FieldMaxMailboxes, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := du.mutation.AddedMaxMailboxes(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxMailboxes,
|
||||
})
|
||||
_spec.AddField(domain.FieldMaxMailboxes, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := du.mutation.MaxQuota(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxQuota,
|
||||
})
|
||||
_spec.SetField(domain.FieldMaxQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := du.mutation.AddedMaxQuota(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxQuota,
|
||||
})
|
||||
_spec.AddField(domain.FieldMaxQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := du.mutation.Quota(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldQuota,
|
||||
})
|
||||
_spec.SetField(domain.FieldQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := du.mutation.AddedQuota(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldQuota,
|
||||
})
|
||||
_spec.AddField(domain.FieldQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := du.mutation.Transport(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: domain.FieldTransport,
|
||||
})
|
||||
_spec.SetField(domain.FieldTransport, field.TypeString, value)
|
||||
}
|
||||
if value, ok := du.mutation.BackupMx(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: domain.FieldBackupMx,
|
||||
})
|
||||
_spec.SetField(domain.FieldBackupMx, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := du.mutation.Active(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: domain.FieldActive,
|
||||
})
|
||||
_spec.SetField(domain.FieldActive, field.TypeBool, value)
|
||||
}
|
||||
if du.mutation.MailboxesCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@ -488,10 +454,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{domain.MailboxesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -504,10 +467,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{domain.MailboxesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -523,10 +483,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{domain.MailboxesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -542,10 +499,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{domain.AliasesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -558,10 +512,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{domain.AliasesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -577,10 +528,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{domain.AliasesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -596,10 +544,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{domain.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -612,10 +557,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{domain.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -631,10 +573,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{domain.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -650,10 +589,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: domain.AccountsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -666,10 +602,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: domain.AccountsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -685,10 +618,7 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: domain.AccountsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -700,10 +630,11 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{domain.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
du.mutation.done = true
|
||||
return n, nil
|
||||
}
|
||||
|
||||
@ -733,6 +664,14 @@ func (duo *DomainUpdateOne) SetDomain(s string) *DomainUpdateOne {
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetNillableDomain sets the "domain" field if the given value is not nil.
|
||||
func (duo *DomainUpdateOne) SetNillableDomain(s *string) *DomainUpdateOne {
|
||||
if s != nil {
|
||||
duo.SetDomain(*s)
|
||||
}
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetDescription sets the "description" field.
|
||||
func (duo *DomainUpdateOne) SetDescription(s string) *DomainUpdateOne {
|
||||
duo.mutation.SetDescription(s)
|
||||
@ -760,6 +699,14 @@ func (duo *DomainUpdateOne) SetMaxAliases(i int64) *DomainUpdateOne {
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetNillableMaxAliases sets the "max_aliases" field if the given value is not nil.
|
||||
func (duo *DomainUpdateOne) SetNillableMaxAliases(i *int64) *DomainUpdateOne {
|
||||
if i != nil {
|
||||
duo.SetMaxAliases(*i)
|
||||
}
|
||||
return duo
|
||||
}
|
||||
|
||||
// AddMaxAliases adds i to the "max_aliases" field.
|
||||
func (duo *DomainUpdateOne) AddMaxAliases(i int64) *DomainUpdateOne {
|
||||
duo.mutation.AddMaxAliases(i)
|
||||
@ -773,6 +720,14 @@ func (duo *DomainUpdateOne) SetMaxMailboxes(i int64) *DomainUpdateOne {
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetNillableMaxMailboxes sets the "max_mailboxes" field if the given value is not nil.
|
||||
func (duo *DomainUpdateOne) SetNillableMaxMailboxes(i *int64) *DomainUpdateOne {
|
||||
if i != nil {
|
||||
duo.SetMaxMailboxes(*i)
|
||||
}
|
||||
return duo
|
||||
}
|
||||
|
||||
// AddMaxMailboxes adds i to the "max_mailboxes" field.
|
||||
func (duo *DomainUpdateOne) AddMaxMailboxes(i int64) *DomainUpdateOne {
|
||||
duo.mutation.AddMaxMailboxes(i)
|
||||
@ -786,6 +741,14 @@ func (duo *DomainUpdateOne) SetMaxQuota(i int64) *DomainUpdateOne {
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetNillableMaxQuota sets the "max_quota" field if the given value is not nil.
|
||||
func (duo *DomainUpdateOne) SetNillableMaxQuota(i *int64) *DomainUpdateOne {
|
||||
if i != nil {
|
||||
duo.SetMaxQuota(*i)
|
||||
}
|
||||
return duo
|
||||
}
|
||||
|
||||
// AddMaxQuota adds i to the "max_quota" field.
|
||||
func (duo *DomainUpdateOne) AddMaxQuota(i int64) *DomainUpdateOne {
|
||||
duo.mutation.AddMaxQuota(i)
|
||||
@ -799,6 +762,14 @@ func (duo *DomainUpdateOne) SetQuota(i int64) *DomainUpdateOne {
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetNillableQuota sets the "quota" field if the given value is not nil.
|
||||
func (duo *DomainUpdateOne) SetNillableQuota(i *int64) *DomainUpdateOne {
|
||||
if i != nil {
|
||||
duo.SetQuota(*i)
|
||||
}
|
||||
return duo
|
||||
}
|
||||
|
||||
// AddQuota adds i to the "quota" field.
|
||||
func (duo *DomainUpdateOne) AddQuota(i int64) *DomainUpdateOne {
|
||||
duo.mutation.AddQuota(i)
|
||||
@ -811,18 +782,42 @@ func (duo *DomainUpdateOne) SetTransport(s string) *DomainUpdateOne {
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetNillableTransport sets the "transport" field if the given value is not nil.
|
||||
func (duo *DomainUpdateOne) SetNillableTransport(s *string) *DomainUpdateOne {
|
||||
if s != nil {
|
||||
duo.SetTransport(*s)
|
||||
}
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetBackupMx sets the "backup_mx" field.
|
||||
func (duo *DomainUpdateOne) SetBackupMx(b bool) *DomainUpdateOne {
|
||||
duo.mutation.SetBackupMx(b)
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetNillableBackupMx sets the "backup_mx" field if the given value is not nil.
|
||||
func (duo *DomainUpdateOne) SetNillableBackupMx(b *bool) *DomainUpdateOne {
|
||||
if b != nil {
|
||||
duo.SetBackupMx(*b)
|
||||
}
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetActive sets the "active" field.
|
||||
func (duo *DomainUpdateOne) SetActive(b bool) *DomainUpdateOne {
|
||||
duo.mutation.SetActive(b)
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetNillableActive sets the "active" field if the given value is not nil.
|
||||
func (duo *DomainUpdateOne) SetNillableActive(b *bool) *DomainUpdateOne {
|
||||
if b != nil {
|
||||
duo.SetActive(*b)
|
||||
}
|
||||
return duo
|
||||
}
|
||||
|
||||
// AddMailboxIDs adds the "mailboxes" edge to the Mailbox entity by IDs.
|
||||
func (duo *DomainUpdateOne) AddMailboxIDs(ids ...int64) *DomainUpdateOne {
|
||||
duo.mutation.AddMailboxIDs(ids...)
|
||||
@ -972,6 +967,12 @@ func (duo *DomainUpdateOne) RemoveAccounts(a ...*Account) *DomainUpdateOne {
|
||||
return duo.RemoveAccountIDs(ids...)
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the DomainUpdate builder.
|
||||
func (duo *DomainUpdateOne) Where(ps ...predicate.Domain) *DomainUpdateOne {
|
||||
duo.mutation.Where(ps...)
|
||||
return duo
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (duo *DomainUpdateOne) Select(field string, fields ...string) *DomainUpdateOne {
|
||||
@ -981,35 +982,8 @@ func (duo *DomainUpdateOne) Select(field string, fields ...string) *DomainUpdate
|
||||
|
||||
// Save executes the query and returns the updated Domain entity.
|
||||
func (duo *DomainUpdateOne) Save(ctx context.Context) (*Domain, error) {
|
||||
var (
|
||||
err error
|
||||
node *Domain
|
||||
)
|
||||
duo.defaults()
|
||||
if len(duo.hooks) == 0 {
|
||||
node, err = duo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*DomainMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
duo.mutation = mutation
|
||||
node, err = duo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(duo.hooks) - 1; i >= 0; i-- {
|
||||
if duo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = duo.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, duo.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
return withHooks(ctx, duo.sqlSave, duo.mutation, duo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@ -1043,16 +1017,7 @@ func (duo *DomainUpdateOne) defaults() {
|
||||
}
|
||||
|
||||
func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: domain.Table,
|
||||
Columns: domain.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(domain.Table, domain.Columns, sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64))
|
||||
id, ok := duo.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Domain.id" for update`)}
|
||||
@ -1078,114 +1043,52 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
}
|
||||
}
|
||||
if value, ok := duo.mutation.Modified(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: domain.FieldModified,
|
||||
})
|
||||
_spec.SetField(domain.FieldModified, field.TypeTime, value)
|
||||
}
|
||||
if duo.mutation.ModifiedCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Column: domain.FieldModified,
|
||||
})
|
||||
_spec.ClearField(domain.FieldModified, field.TypeTime)
|
||||
}
|
||||
if value, ok := duo.mutation.Domain(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: domain.FieldDomain,
|
||||
})
|
||||
_spec.SetField(domain.FieldDomain, field.TypeString, value)
|
||||
}
|
||||
if value, ok := duo.mutation.Description(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: domain.FieldDescription,
|
||||
})
|
||||
_spec.SetField(domain.FieldDescription, field.TypeString, value)
|
||||
}
|
||||
if duo.mutation.DescriptionCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: domain.FieldDescription,
|
||||
})
|
||||
_spec.ClearField(domain.FieldDescription, field.TypeString)
|
||||
}
|
||||
if value, ok := duo.mutation.MaxAliases(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxAliases,
|
||||
})
|
||||
_spec.SetField(domain.FieldMaxAliases, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := duo.mutation.AddedMaxAliases(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxAliases,
|
||||
})
|
||||
_spec.AddField(domain.FieldMaxAliases, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := duo.mutation.MaxMailboxes(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxMailboxes,
|
||||
})
|
||||
_spec.SetField(domain.FieldMaxMailboxes, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := duo.mutation.AddedMaxMailboxes(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxMailboxes,
|
||||
})
|
||||
_spec.AddField(domain.FieldMaxMailboxes, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := duo.mutation.MaxQuota(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxQuota,
|
||||
})
|
||||
_spec.SetField(domain.FieldMaxQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := duo.mutation.AddedMaxQuota(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldMaxQuota,
|
||||
})
|
||||
_spec.AddField(domain.FieldMaxQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := duo.mutation.Quota(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldQuota,
|
||||
})
|
||||
_spec.SetField(domain.FieldQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := duo.mutation.AddedQuota(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: domain.FieldQuota,
|
||||
})
|
||||
_spec.AddField(domain.FieldQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := duo.mutation.Transport(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: domain.FieldTransport,
|
||||
})
|
||||
_spec.SetField(domain.FieldTransport, field.TypeString, value)
|
||||
}
|
||||
if value, ok := duo.mutation.BackupMx(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: domain.FieldBackupMx,
|
||||
})
|
||||
_spec.SetField(domain.FieldBackupMx, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := duo.mutation.Active(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: domain.FieldActive,
|
||||
})
|
||||
_spec.SetField(domain.FieldActive, field.TypeBool, value)
|
||||
}
|
||||
if duo.mutation.MailboxesCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@ -1195,10 +1098,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: []string{domain.MailboxesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -1211,10 +1111,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: []string{domain.MailboxesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -1230,10 +1127,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: []string{domain.MailboxesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -1249,10 +1143,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: []string{domain.AliasesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -1265,10 +1156,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: []string{domain.AliasesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -1284,10 +1172,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: []string{domain.AliasesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: alias.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(alias.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -1303,10 +1188,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: []string{domain.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -1319,10 +1201,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: []string{domain.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -1338,10 +1217,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: []string{domain.LogsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -1357,10 +1233,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: domain.AccountsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -1373,10 +1246,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: domain.AccountsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -1392,10 +1262,7 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
Columns: domain.AccountsPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -1410,9 +1277,10 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{domain.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
duo.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
439
ent/ent.go
439
ent/ent.go
@ -1,10 +1,13 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/account"
|
||||
"code.icod.de/postfix/manager/ent/alias"
|
||||
@ -13,52 +16,82 @@ import (
|
||||
"code.icod.de/postfix/manager/ent/mailbox"
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
// ent aliases to avoid import conflicts in user's code.
|
||||
type (
|
||||
Op = ent.Op
|
||||
Hook = ent.Hook
|
||||
Value = ent.Value
|
||||
Query = ent.Query
|
||||
Policy = ent.Policy
|
||||
Mutator = ent.Mutator
|
||||
Mutation = ent.Mutation
|
||||
MutateFunc = ent.MutateFunc
|
||||
Op = ent.Op
|
||||
Hook = ent.Hook
|
||||
Value = ent.Value
|
||||
Query = ent.Query
|
||||
QueryContext = ent.QueryContext
|
||||
Querier = ent.Querier
|
||||
QuerierFunc = ent.QuerierFunc
|
||||
Interceptor = ent.Interceptor
|
||||
InterceptFunc = ent.InterceptFunc
|
||||
Traverser = ent.Traverser
|
||||
TraverseFunc = ent.TraverseFunc
|
||||
Policy = ent.Policy
|
||||
Mutator = ent.Mutator
|
||||
Mutation = ent.Mutation
|
||||
MutateFunc = ent.MutateFunc
|
||||
)
|
||||
|
||||
type clientCtxKey struct{}
|
||||
|
||||
// FromContext returns a Client stored inside a context, or nil if there isn't one.
|
||||
func FromContext(ctx context.Context) *Client {
|
||||
c, _ := ctx.Value(clientCtxKey{}).(*Client)
|
||||
return c
|
||||
}
|
||||
|
||||
// NewContext returns a new context with the given Client attached.
|
||||
func NewContext(parent context.Context, c *Client) context.Context {
|
||||
return context.WithValue(parent, clientCtxKey{}, c)
|
||||
}
|
||||
|
||||
type txCtxKey struct{}
|
||||
|
||||
// TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
|
||||
func TxFromContext(ctx context.Context) *Tx {
|
||||
tx, _ := ctx.Value(txCtxKey{}).(*Tx)
|
||||
return tx
|
||||
}
|
||||
|
||||
// NewTxContext returns a new context with the given Tx attached.
|
||||
func NewTxContext(parent context.Context, tx *Tx) context.Context {
|
||||
return context.WithValue(parent, txCtxKey{}, tx)
|
||||
}
|
||||
|
||||
// OrderFunc applies an ordering on the sql selector.
|
||||
// Deprecated: Use Asc/Desc functions or the package builders instead.
|
||||
type OrderFunc func(*sql.Selector)
|
||||
|
||||
// columnChecker returns a function indicates if the column exists in the given column.
|
||||
func columnChecker(table string) func(string) error {
|
||||
checks := map[string]func(string) bool{
|
||||
account.Table: account.ValidColumn,
|
||||
alias.Table: alias.ValidColumn,
|
||||
domain.Table: domain.ValidColumn,
|
||||
logentry.Table: logentry.ValidColumn,
|
||||
mailbox.Table: mailbox.ValidColumn,
|
||||
}
|
||||
check, ok := checks[table]
|
||||
if !ok {
|
||||
return func(string) error {
|
||||
return fmt.Errorf("unknown table %q", table)
|
||||
}
|
||||
}
|
||||
return func(column string) error {
|
||||
if !check(column) {
|
||||
return fmt.Errorf("unknown column %q for table %q", column, table)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
var (
|
||||
initCheck sync.Once
|
||||
columnCheck sql.ColumnCheck
|
||||
)
|
||||
|
||||
// checkColumn checks if the column exists in the given table.
|
||||
func checkColumn(table, column string) error {
|
||||
initCheck.Do(func() {
|
||||
columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
|
||||
account.Table: account.ValidColumn,
|
||||
alias.Table: alias.ValidColumn,
|
||||
domain.Table: domain.ValidColumn,
|
||||
logentry.Table: logentry.ValidColumn,
|
||||
mailbox.Table: mailbox.ValidColumn,
|
||||
})
|
||||
})
|
||||
return columnCheck(table, column)
|
||||
}
|
||||
|
||||
// Asc applies the given fields in ASC order.
|
||||
func Asc(fields ...string) OrderFunc {
|
||||
func Asc(fields ...string) func(*sql.Selector) {
|
||||
return func(s *sql.Selector) {
|
||||
check := columnChecker(s.TableName())
|
||||
for _, f := range fields {
|
||||
if err := check(f); err != nil {
|
||||
if err := checkColumn(s.TableName(), f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.Asc(s.C(f)))
|
||||
@ -67,11 +100,10 @@ func Asc(fields ...string) OrderFunc {
|
||||
}
|
||||
|
||||
// Desc applies the given fields in DESC order.
|
||||
func Desc(fields ...string) OrderFunc {
|
||||
func Desc(fields ...string) func(*sql.Selector) {
|
||||
return func(s *sql.Selector) {
|
||||
check := columnChecker(s.TableName())
|
||||
for _, f := range fields {
|
||||
if err := check(f); err != nil {
|
||||
if err := checkColumn(s.TableName(), f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.Desc(s.C(f)))
|
||||
@ -87,7 +119,6 @@ type AggregateFunc func(*sql.Selector) string
|
||||
// GroupBy(field1, field2).
|
||||
// Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func As(fn AggregateFunc, end string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
return sql.As(fn(s), end)
|
||||
@ -104,8 +135,7 @@ func Count() AggregateFunc {
|
||||
// Max applies the "max" aggregation function on the given field of each group.
|
||||
func Max(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@ -116,8 +146,7 @@ func Max(field string) AggregateFunc {
|
||||
// Mean applies the "mean" aggregation function on the given field of each group.
|
||||
func Mean(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@ -128,8 +157,7 @@ func Mean(field string) AggregateFunc {
|
||||
// Min applies the "min" aggregation function on the given field of each group.
|
||||
func Min(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@ -140,8 +168,7 @@ func Min(field string) AggregateFunc {
|
||||
// Sum applies the "sum" aggregation function on the given field of each group.
|
||||
func Sum(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@ -265,3 +292,325 @@ func IsConstraintError(err error) bool {
|
||||
var e *ConstraintError
|
||||
return errors.As(err, &e)
|
||||
}
|
||||
|
||||
// selector embedded by the different Select/GroupBy builders.
|
||||
type selector struct {
|
||||
label string
|
||||
flds *[]string
|
||||
fns []AggregateFunc
|
||||
scan func(context.Context, any) error
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (s *selector) ScanX(ctx context.Context, v any) {
|
||||
if err := s.scan(ctx, v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Strings returns list of strings from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Strings(ctx context.Context) ([]string, error) {
|
||||
if len(*s.flds) > 1 {
|
||||
return nil, errors.New("ent: Strings is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []string
|
||||
if err := s.scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// StringsX is like Strings, but panics if an error occurs.
|
||||
func (s *selector) StringsX(ctx context.Context) []string {
|
||||
v, err := s.Strings(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// String returns a single string from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) String(ctx context.Context) (_ string, err error) {
|
||||
var v []string
|
||||
if v, err = s.Strings(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{s.label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: Strings returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StringX is like String, but panics if an error occurs.
|
||||
func (s *selector) StringX(ctx context.Context) string {
|
||||
v, err := s.String(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Ints returns list of ints from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Ints(ctx context.Context) ([]int, error) {
|
||||
if len(*s.flds) > 1 {
|
||||
return nil, errors.New("ent: Ints is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []int
|
||||
if err := s.scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IntsX is like Ints, but panics if an error occurs.
|
||||
func (s *selector) IntsX(ctx context.Context) []int {
|
||||
v, err := s.Ints(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Int returns a single int from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Int(ctx context.Context) (_ int, err error) {
|
||||
var v []int
|
||||
if v, err = s.Ints(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{s.label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: Ints returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IntX is like Int, but panics if an error occurs.
|
||||
func (s *selector) IntX(ctx context.Context) int {
|
||||
v, err := s.Int(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Float64s(ctx context.Context) ([]float64, error) {
|
||||
if len(*s.flds) > 1 {
|
||||
return nil, errors.New("ent: Float64s is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []float64
|
||||
if err := s.scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Float64sX is like Float64s, but panics if an error occurs.
|
||||
func (s *selector) Float64sX(ctx context.Context) []float64 {
|
||||
v, err := s.Float64s(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Float64(ctx context.Context) (_ float64, err error) {
|
||||
var v []float64
|
||||
if v, err = s.Float64s(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{s.label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: Float64s returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Float64X is like Float64, but panics if an error occurs.
|
||||
func (s *selector) Float64X(ctx context.Context) float64 {
|
||||
v, err := s.Float64(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bools returns list of bools from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Bools(ctx context.Context) ([]bool, error) {
|
||||
if len(*s.flds) > 1 {
|
||||
return nil, errors.New("ent: Bools is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []bool
|
||||
if err := s.scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoolsX is like Bools, but panics if an error occurs.
|
||||
func (s *selector) BoolsX(ctx context.Context) []bool {
|
||||
v, err := s.Bools(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bool returns a single bool from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Bool(ctx context.Context) (_ bool, err error) {
|
||||
var v []bool
|
||||
if v, err = s.Bools(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{s.label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: Bools returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BoolX is like Bool, but panics if an error occurs.
|
||||
func (s *selector) BoolX(ctx context.Context) bool {
|
||||
v, err := s.Bool(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// withHooks invokes the builder operation with the given hooks, if any.
|
||||
func withHooks[V Value, M any, PM interface {
|
||||
*M
|
||||
Mutation
|
||||
}](ctx context.Context, exec func(context.Context) (V, error), mutation PM, hooks []Hook) (value V, err error) {
|
||||
if len(hooks) == 0 {
|
||||
return exec(ctx)
|
||||
}
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutationT, ok := any(m).(PM)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
// Set the mutation to the builder.
|
||||
*mutation = *mutationT
|
||||
return exec(ctx)
|
||||
})
|
||||
for i := len(hooks) - 1; i >= 0; i-- {
|
||||
if hooks[i] == nil {
|
||||
return value, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = hooks[i](mut)
|
||||
}
|
||||
v, err := mut.Mutate(ctx, mutation)
|
||||
if err != nil {
|
||||
return value, err
|
||||
}
|
||||
nv, ok := v.(V)
|
||||
if !ok {
|
||||
return value, fmt.Errorf("unexpected node type %T returned from %T", v, mutation)
|
||||
}
|
||||
return nv, nil
|
||||
}
|
||||
|
||||
// setContextOp returns a new context with the given QueryContext attached (including its op) in case it does not exist.
|
||||
func setContextOp(ctx context.Context, qc *QueryContext, op string) context.Context {
|
||||
if ent.QueryFromContext(ctx) == nil {
|
||||
qc.Op = op
|
||||
ctx = ent.NewQueryContext(ctx, qc)
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
func querierAll[V Value, Q interface {
|
||||
sqlAll(context.Context, ...queryHook) (V, error)
|
||||
}]() Querier {
|
||||
return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
|
||||
query, ok := q.(Q)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected query type %T", q)
|
||||
}
|
||||
return query.sqlAll(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
func querierCount[Q interface {
|
||||
sqlCount(context.Context) (int, error)
|
||||
}]() Querier {
|
||||
return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
|
||||
query, ok := q.(Q)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected query type %T", q)
|
||||
}
|
||||
return query.sqlCount(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
func withInterceptors[V Value](ctx context.Context, q Query, qr Querier, inters []Interceptor) (v V, err error) {
|
||||
for i := len(inters) - 1; i >= 0; i-- {
|
||||
qr = inters[i].Intercept(qr)
|
||||
}
|
||||
rv, err := qr.Query(ctx, q)
|
||||
if err != nil {
|
||||
return v, err
|
||||
}
|
||||
vt, ok := rv.(V)
|
||||
if !ok {
|
||||
return v, fmt.Errorf("unexpected type %T returned from %T. expected type: %T", vt, q, v)
|
||||
}
|
||||
return vt, nil
|
||||
}
|
||||
|
||||
func scanWithInterceptors[Q1 ent.Query, Q2 interface {
|
||||
sqlScan(context.Context, Q1, any) error
|
||||
}](ctx context.Context, rootQuery Q1, selectOrGroup Q2, inters []Interceptor, v any) error {
|
||||
rv := reflect.ValueOf(v)
|
||||
var qr Querier = QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
|
||||
query, ok := q.(Q1)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected query type %T", q)
|
||||
}
|
||||
if err := selectOrGroup.sqlScan(ctx, query, v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if k := rv.Kind(); k == reflect.Pointer && rv.Elem().CanInterface() {
|
||||
return rv.Elem().Interface(), nil
|
||||
}
|
||||
return v, nil
|
||||
})
|
||||
for i := len(inters) - 1; i >= 0; i-- {
|
||||
qr = inters[i].Intercept(qr)
|
||||
}
|
||||
vv, err := qr.Query(ctx, rootQuery)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch rv2 := reflect.ValueOf(vv); {
|
||||
case rv.IsNil(), rv2.IsNil(), rv.Kind() != reflect.Pointer:
|
||||
case rv.Type() == rv2.Type():
|
||||
rv.Elem().Set(rv2.Elem())
|
||||
case rv.Elem().Type() == rv2.Type():
|
||||
rv.Elem().Set(rv2)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// queryHook describes an internal hook for the different sqlAll methods.
|
||||
type queryHook func(context.Context, *sqlgraph.QuerySpec)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package enttest
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
// required by schema hooks.
|
||||
_ "code.icod.de/postfix/manager/ent/runtime"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/migrate"
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
)
|
||||
|
||||
@ -17,7 +18,7 @@ type (
|
||||
// testing.T and testing.B and used by enttest.
|
||||
TestingT interface {
|
||||
FailNow()
|
||||
Error(...interface{})
|
||||
Error(...any)
|
||||
}
|
||||
|
||||
// Option configures client creation.
|
||||
@ -59,10 +60,7 @@ func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *ent.Cl
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
if err := c.Schema.Create(context.Background(), o.migrateOpts...); err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
migrateSchema(t, c, o)
|
||||
return c
|
||||
}
|
||||
|
||||
@ -70,9 +68,17 @@ func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *ent.Cl
|
||||
func NewClient(t TestingT, opts ...Option) *ent.Client {
|
||||
o := newOptions(opts)
|
||||
c := ent.NewClient(o.opts...)
|
||||
if err := c.Schema.Create(context.Background(), o.migrateOpts...); err != nil {
|
||||
migrateSchema(t, c, o)
|
||||
return c
|
||||
}
|
||||
func migrateSchema(t TestingT, c *ent.Client, o *options) {
|
||||
tables, err := schema.CopyTables(migrate.Tables)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
if err := migrate.Create(context.Background(), c.Schema, tables, o.migrateOpts...); err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package hook
|
||||
|
||||
@ -15,11 +15,10 @@ type AccountFunc func(context.Context, *ent.AccountMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f AccountFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.AccountMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AccountMutation", m)
|
||||
if mv, ok := m.(*ent.AccountMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AccountMutation", m)
|
||||
}
|
||||
|
||||
// The AliasFunc type is an adapter to allow the use of ordinary
|
||||
@ -28,11 +27,10 @@ type AliasFunc func(context.Context, *ent.AliasMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f AliasFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.AliasMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AliasMutation", m)
|
||||
if mv, ok := m.(*ent.AliasMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AliasMutation", m)
|
||||
}
|
||||
|
||||
// The DomainFunc type is an adapter to allow the use of ordinary
|
||||
@ -41,11 +39,10 @@ type DomainFunc func(context.Context, *ent.DomainMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f DomainFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.DomainMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.DomainMutation", m)
|
||||
if mv, ok := m.(*ent.DomainMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.DomainMutation", m)
|
||||
}
|
||||
|
||||
// The LogentryFunc type is an adapter to allow the use of ordinary
|
||||
@ -54,11 +51,10 @@ type LogentryFunc func(context.Context, *ent.LogentryMutation) (ent.Value, error
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f LogentryFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.LogentryMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.LogentryMutation", m)
|
||||
if mv, ok := m.(*ent.LogentryMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.LogentryMutation", m)
|
||||
}
|
||||
|
||||
// The MailboxFunc type is an adapter to allow the use of ordinary
|
||||
@ -67,11 +63,10 @@ type MailboxFunc func(context.Context, *ent.MailboxMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f MailboxFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.MailboxMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MailboxMutation", m)
|
||||
if mv, ok := m.(*ent.MailboxMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MailboxMutation", m)
|
||||
}
|
||||
|
||||
// Condition is a hook condition function.
|
||||
@ -169,7 +164,6 @@ func HasFields(field string, fields ...string) Condition {
|
||||
// If executes the given hook under condition.
|
||||
//
|
||||
// hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...)))
|
||||
//
|
||||
func If(hk ent.Hook, cond Condition) ent.Hook {
|
||||
return func(next ent.Mutator) ent.Mutator {
|
||||
return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
@ -184,7 +178,6 @@ func If(hk ent.Hook, cond Condition) ent.Hook {
|
||||
// On executes the given hook only for the given operation.
|
||||
//
|
||||
// hook.On(Log, ent.Delete|ent.Create)
|
||||
//
|
||||
func On(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
return If(hk, HasOp(op))
|
||||
}
|
||||
@ -192,7 +185,6 @@ func On(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
// Unless skips the given hook only for the given operation.
|
||||
//
|
||||
// hook.Unless(Log, ent.Update|ent.UpdateOne)
|
||||
//
|
||||
func Unless(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
return If(hk, Not(HasOp(op)))
|
||||
}
|
||||
@ -213,7 +205,6 @@ func FixedError(err error) ent.Hook {
|
||||
// Reject(ent.Delete|ent.Update),
|
||||
// }
|
||||
// }
|
||||
//
|
||||
func Reject(op ent.Op) ent.Hook {
|
||||
hk := FixedError(fmt.Errorf("%s operation is not allowed", op))
|
||||
return On(hk, op)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -10,6 +10,7 @@ import (
|
||||
"code.icod.de/postfix/manager/ent/account"
|
||||
"code.icod.de/postfix/manager/ent/domain"
|
||||
"code.icod.de/postfix/manager/ent/logentry"
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@ -30,7 +31,8 @@ type Logentry struct {
|
||||
DomainID int64 `json:"domain_id,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the LogentryQuery when eager-loading is set.
|
||||
Edges LogentryEdges `json:"edges"`
|
||||
Edges LogentryEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// LogentryEdges holds the relations/edges for other nodes in the graph.
|
||||
@ -47,13 +49,10 @@ type LogentryEdges struct {
|
||||
// AccountOrErr returns the Account value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e LogentryEdges) AccountOrErr() (*Account, error) {
|
||||
if e.loadedTypes[0] {
|
||||
if e.Account == nil {
|
||||
// The edge account was loaded in eager-loading,
|
||||
// but was not found.
|
||||
return nil, &NotFoundError{label: account.Label}
|
||||
}
|
||||
if e.Account != nil {
|
||||
return e.Account, nil
|
||||
} else if e.loadedTypes[0] {
|
||||
return nil, &NotFoundError{label: account.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "account"}
|
||||
}
|
||||
@ -61,20 +60,17 @@ func (e LogentryEdges) AccountOrErr() (*Account, error) {
|
||||
// DomainOrErr returns the Domain value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e LogentryEdges) DomainOrErr() (*Domain, error) {
|
||||
if e.loadedTypes[1] {
|
||||
if e.Domain == nil {
|
||||
// The edge domain was loaded in eager-loading,
|
||||
// but was not found.
|
||||
return nil, &NotFoundError{label: domain.Label}
|
||||
}
|
||||
if e.Domain != nil {
|
||||
return e.Domain, nil
|
||||
} else if e.loadedTypes[1] {
|
||||
return nil, &NotFoundError{label: domain.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "domain"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Logentry) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Logentry) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case logentry.FieldID, logentry.FieldAccountID, logentry.FieldDomainID:
|
||||
@ -84,7 +80,7 @@ func (*Logentry) scanValues(columns []string) ([]interface{}, error) {
|
||||
case logentry.FieldTimestamp:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Logentry", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@ -92,7 +88,7 @@ func (*Logentry) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Logentry fields.
|
||||
func (l *Logentry) assignValues(columns []string, values []interface{}) error {
|
||||
func (l *Logentry) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@ -135,36 +131,44 @@ func (l *Logentry) assignValues(columns []string, values []interface{}) error {
|
||||
} else if value.Valid {
|
||||
l.DomainID = value.Int64
|
||||
}
|
||||
default:
|
||||
l.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Logentry.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (l *Logentry) Value(name string) (ent.Value, error) {
|
||||
return l.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryAccount queries the "account" edge of the Logentry entity.
|
||||
func (l *Logentry) QueryAccount() *AccountQuery {
|
||||
return (&LogentryClient{config: l.config}).QueryAccount(l)
|
||||
return NewLogentryClient(l.config).QueryAccount(l)
|
||||
}
|
||||
|
||||
// QueryDomain queries the "domain" edge of the Logentry entity.
|
||||
func (l *Logentry) QueryDomain() *DomainQuery {
|
||||
return (&LogentryClient{config: l.config}).QueryDomain(l)
|
||||
return NewLogentryClient(l.config).QueryDomain(l)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Logentry.
|
||||
// Note that you need to call Logentry.Unwrap() before calling this method if this Logentry
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (l *Logentry) Update() *LogentryUpdateOne {
|
||||
return (&LogentryClient{config: l.config}).UpdateOne(l)
|
||||
return NewLogentryClient(l.config).UpdateOne(l)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the Logentry entity that was returned from a transaction after it was closed,
|
||||
// so that all future queries will be executed through the driver which created the transaction.
|
||||
func (l *Logentry) Unwrap() *Logentry {
|
||||
tx, ok := l.config.driver.(*txDriver)
|
||||
_tx, ok := l.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Logentry is not a transactional entity")
|
||||
}
|
||||
l.config.driver = tx.drv
|
||||
l.config.driver = _tx.drv
|
||||
return l
|
||||
}
|
||||
|
||||
@ -172,18 +176,22 @@ func (l *Logentry) Unwrap() *Logentry {
|
||||
func (l *Logentry) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("Logentry(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v", l.ID))
|
||||
builder.WriteString(", timestamp=")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", l.ID))
|
||||
builder.WriteString("timestamp=")
|
||||
builder.WriteString(l.Timestamp.Format(time.ANSIC))
|
||||
builder.WriteString(", action=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("action=")
|
||||
builder.WriteString(l.Action)
|
||||
builder.WriteString(", ")
|
||||
if v := l.Data; v != nil {
|
||||
builder.WriteString(", data=")
|
||||
builder.WriteString("data=")
|
||||
builder.WriteString(*v)
|
||||
}
|
||||
builder.WriteString(", account_id=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("account_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", l.AccountID))
|
||||
builder.WriteString(", domain_id=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("domain_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", l.DomainID))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
@ -191,9 +199,3 @@ func (l *Logentry) String() string {
|
||||
|
||||
// Logentries is a parsable slice of Logentry.
|
||||
type Logentries []*Logentry
|
||||
|
||||
func (l Logentries) config(cfg config) {
|
||||
for _i := range l {
|
||||
l[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package logentry
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -67,3 +70,64 @@ var (
|
||||
// DefaultTimestamp holds the default value on creation for the "timestamp" field.
|
||||
DefaultTimestamp func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Logentry queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTimestamp orders the results by the timestamp field.
|
||||
func ByTimestamp(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTimestamp, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAction orders the results by the action field.
|
||||
func ByAction(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAction, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByData orders the results by the data field.
|
||||
func ByData(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldData, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAccountID orders the results by the account_id field.
|
||||
func ByAccountID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAccountID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDomainID orders the results by the domain_id field.
|
||||
func ByDomainID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDomainID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAccountField orders the results by account field.
|
||||
func ByAccountField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newAccountStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
|
||||
// ByDomainField orders the results by domain field.
|
||||
func ByDomainField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newDomainStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newAccountStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(AccountInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, AccountTable, AccountColumn),
|
||||
)
|
||||
}
|
||||
func newDomainStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DomainInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, DomainTable, DomainColumn),
|
||||
)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package logentry
|
||||
|
||||
@ -12,556 +12,312 @@ import (
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(ids) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
v := make([]interface{}, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(ids) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
v := make([]interface{}, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Timestamp applies equality check predicate on the "timestamp" field. It's identical to TimestampEQ.
|
||||
func Timestamp(v time.Time) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldTimestamp), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldTimestamp, v))
|
||||
}
|
||||
|
||||
// Action applies equality check predicate on the "action" field. It's identical to ActionEQ.
|
||||
func Action(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldAction, v))
|
||||
}
|
||||
|
||||
// Data applies equality check predicate on the "data" field. It's identical to DataEQ.
|
||||
func Data(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldData, v))
|
||||
}
|
||||
|
||||
// AccountID applies equality check predicate on the "account_id" field. It's identical to AccountIDEQ.
|
||||
func AccountID(v int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldAccountID), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldAccountID, v))
|
||||
}
|
||||
|
||||
// DomainID applies equality check predicate on the "domain_id" field. It's identical to DomainIDEQ.
|
||||
func DomainID(v int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldDomainID), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldDomainID, v))
|
||||
}
|
||||
|
||||
// TimestampEQ applies the EQ predicate on the "timestamp" field.
|
||||
func TimestampEQ(v time.Time) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldTimestamp), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldTimestamp, v))
|
||||
}
|
||||
|
||||
// TimestampNEQ applies the NEQ predicate on the "timestamp" field.
|
||||
func TimestampNEQ(v time.Time) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldTimestamp), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNEQ(FieldTimestamp, v))
|
||||
}
|
||||
|
||||
// TimestampIn applies the In predicate on the "timestamp" field.
|
||||
func TimestampIn(vs ...time.Time) predicate.Logentry {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldTimestamp), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldIn(FieldTimestamp, vs...))
|
||||
}
|
||||
|
||||
// TimestampNotIn applies the NotIn predicate on the "timestamp" field.
|
||||
func TimestampNotIn(vs ...time.Time) predicate.Logentry {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldTimestamp), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNotIn(FieldTimestamp, vs...))
|
||||
}
|
||||
|
||||
// TimestampGT applies the GT predicate on the "timestamp" field.
|
||||
func TimestampGT(v time.Time) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldTimestamp), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldGT(FieldTimestamp, v))
|
||||
}
|
||||
|
||||
// TimestampGTE applies the GTE predicate on the "timestamp" field.
|
||||
func TimestampGTE(v time.Time) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldTimestamp), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldGTE(FieldTimestamp, v))
|
||||
}
|
||||
|
||||
// TimestampLT applies the LT predicate on the "timestamp" field.
|
||||
func TimestampLT(v time.Time) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldTimestamp), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldLT(FieldTimestamp, v))
|
||||
}
|
||||
|
||||
// TimestampLTE applies the LTE predicate on the "timestamp" field.
|
||||
func TimestampLTE(v time.Time) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldTimestamp), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldLTE(FieldTimestamp, v))
|
||||
}
|
||||
|
||||
// ActionEQ applies the EQ predicate on the "action" field.
|
||||
func ActionEQ(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldAction, v))
|
||||
}
|
||||
|
||||
// ActionNEQ applies the NEQ predicate on the "action" field.
|
||||
func ActionNEQ(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNEQ(FieldAction, v))
|
||||
}
|
||||
|
||||
// ActionIn applies the In predicate on the "action" field.
|
||||
func ActionIn(vs ...string) predicate.Logentry {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldAction), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldIn(FieldAction, vs...))
|
||||
}
|
||||
|
||||
// ActionNotIn applies the NotIn predicate on the "action" field.
|
||||
func ActionNotIn(vs ...string) predicate.Logentry {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldAction), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNotIn(FieldAction, vs...))
|
||||
}
|
||||
|
||||
// ActionGT applies the GT predicate on the "action" field.
|
||||
func ActionGT(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldGT(FieldAction, v))
|
||||
}
|
||||
|
||||
// ActionGTE applies the GTE predicate on the "action" field.
|
||||
func ActionGTE(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldGTE(FieldAction, v))
|
||||
}
|
||||
|
||||
// ActionLT applies the LT predicate on the "action" field.
|
||||
func ActionLT(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldLT(FieldAction, v))
|
||||
}
|
||||
|
||||
// ActionLTE applies the LTE predicate on the "action" field.
|
||||
func ActionLTE(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldLTE(FieldAction, v))
|
||||
}
|
||||
|
||||
// ActionContains applies the Contains predicate on the "action" field.
|
||||
func ActionContains(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.Contains(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldContains(FieldAction, v))
|
||||
}
|
||||
|
||||
// ActionHasPrefix applies the HasPrefix predicate on the "action" field.
|
||||
func ActionHasPrefix(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.HasPrefix(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldHasPrefix(FieldAction, v))
|
||||
}
|
||||
|
||||
// ActionHasSuffix applies the HasSuffix predicate on the "action" field.
|
||||
func ActionHasSuffix(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.HasSuffix(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldHasSuffix(FieldAction, v))
|
||||
}
|
||||
|
||||
// ActionEqualFold applies the EqualFold predicate on the "action" field.
|
||||
func ActionEqualFold(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EqualFold(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEqualFold(FieldAction, v))
|
||||
}
|
||||
|
||||
// ActionContainsFold applies the ContainsFold predicate on the "action" field.
|
||||
func ActionContainsFold(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.ContainsFold(s.C(FieldAction), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldContainsFold(FieldAction, v))
|
||||
}
|
||||
|
||||
// DataEQ applies the EQ predicate on the "data" field.
|
||||
func DataEQ(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldData, v))
|
||||
}
|
||||
|
||||
// DataNEQ applies the NEQ predicate on the "data" field.
|
||||
func DataNEQ(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNEQ(FieldData, v))
|
||||
}
|
||||
|
||||
// DataIn applies the In predicate on the "data" field.
|
||||
func DataIn(vs ...string) predicate.Logentry {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldData), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldIn(FieldData, vs...))
|
||||
}
|
||||
|
||||
// DataNotIn applies the NotIn predicate on the "data" field.
|
||||
func DataNotIn(vs ...string) predicate.Logentry {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldData), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNotIn(FieldData, vs...))
|
||||
}
|
||||
|
||||
// DataGT applies the GT predicate on the "data" field.
|
||||
func DataGT(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldGT(FieldData, v))
|
||||
}
|
||||
|
||||
// DataGTE applies the GTE predicate on the "data" field.
|
||||
func DataGTE(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldGTE(FieldData, v))
|
||||
}
|
||||
|
||||
// DataLT applies the LT predicate on the "data" field.
|
||||
func DataLT(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldLT(FieldData, v))
|
||||
}
|
||||
|
||||
// DataLTE applies the LTE predicate on the "data" field.
|
||||
func DataLTE(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldLTE(FieldData, v))
|
||||
}
|
||||
|
||||
// DataContains applies the Contains predicate on the "data" field.
|
||||
func DataContains(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.Contains(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldContains(FieldData, v))
|
||||
}
|
||||
|
||||
// DataHasPrefix applies the HasPrefix predicate on the "data" field.
|
||||
func DataHasPrefix(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.HasPrefix(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldHasPrefix(FieldData, v))
|
||||
}
|
||||
|
||||
// DataHasSuffix applies the HasSuffix predicate on the "data" field.
|
||||
func DataHasSuffix(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.HasSuffix(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldHasSuffix(FieldData, v))
|
||||
}
|
||||
|
||||
// DataIsNil applies the IsNil predicate on the "data" field.
|
||||
func DataIsNil() predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldData)))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldIsNull(FieldData))
|
||||
}
|
||||
|
||||
// DataNotNil applies the NotNil predicate on the "data" field.
|
||||
func DataNotNil() predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldData)))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNotNull(FieldData))
|
||||
}
|
||||
|
||||
// DataEqualFold applies the EqualFold predicate on the "data" field.
|
||||
func DataEqualFold(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EqualFold(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEqualFold(FieldData, v))
|
||||
}
|
||||
|
||||
// DataContainsFold applies the ContainsFold predicate on the "data" field.
|
||||
func DataContainsFold(v string) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.ContainsFold(s.C(FieldData), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldContainsFold(FieldData, v))
|
||||
}
|
||||
|
||||
// AccountIDEQ applies the EQ predicate on the "account_id" field.
|
||||
func AccountIDEQ(v int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldAccountID), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldAccountID, v))
|
||||
}
|
||||
|
||||
// AccountIDNEQ applies the NEQ predicate on the "account_id" field.
|
||||
func AccountIDNEQ(v int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldAccountID), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNEQ(FieldAccountID, v))
|
||||
}
|
||||
|
||||
// AccountIDIn applies the In predicate on the "account_id" field.
|
||||
func AccountIDIn(vs ...int64) predicate.Logentry {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldAccountID), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldIn(FieldAccountID, vs...))
|
||||
}
|
||||
|
||||
// AccountIDNotIn applies the NotIn predicate on the "account_id" field.
|
||||
func AccountIDNotIn(vs ...int64) predicate.Logentry {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldAccountID), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNotIn(FieldAccountID, vs...))
|
||||
}
|
||||
|
||||
// AccountIDIsNil applies the IsNil predicate on the "account_id" field.
|
||||
func AccountIDIsNil() predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldAccountID)))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldIsNull(FieldAccountID))
|
||||
}
|
||||
|
||||
// AccountIDNotNil applies the NotNil predicate on the "account_id" field.
|
||||
func AccountIDNotNil() predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldAccountID)))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNotNull(FieldAccountID))
|
||||
}
|
||||
|
||||
// DomainIDEQ applies the EQ predicate on the "domain_id" field.
|
||||
func DomainIDEQ(v int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldDomainID), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldEQ(FieldDomainID, v))
|
||||
}
|
||||
|
||||
// DomainIDNEQ applies the NEQ predicate on the "domain_id" field.
|
||||
func DomainIDNEQ(v int64) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldDomainID), v))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNEQ(FieldDomainID, v))
|
||||
}
|
||||
|
||||
// DomainIDIn applies the In predicate on the "domain_id" field.
|
||||
func DomainIDIn(vs ...int64) predicate.Logentry {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldDomainID), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldIn(FieldDomainID, vs...))
|
||||
}
|
||||
|
||||
// DomainIDNotIn applies the NotIn predicate on the "domain_id" field.
|
||||
func DomainIDNotIn(vs ...int64) predicate.Logentry {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldDomainID), v...))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNotIn(FieldDomainID, vs...))
|
||||
}
|
||||
|
||||
// DomainIDIsNil applies the IsNil predicate on the "domain_id" field.
|
||||
func DomainIDIsNil() predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldDomainID)))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldIsNull(FieldDomainID))
|
||||
}
|
||||
|
||||
// DomainIDNotNil applies the NotNil predicate on the "domain_id" field.
|
||||
func DomainIDNotNil() predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldDomainID)))
|
||||
})
|
||||
return predicate.Logentry(sql.FieldNotNull(FieldDomainID))
|
||||
}
|
||||
|
||||
// HasAccount applies the HasEdge predicate on the "account" edge.
|
||||
@ -569,7 +325,6 @@ func HasAccount() predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(AccountTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, AccountTable, AccountColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
@ -579,11 +334,7 @@ func HasAccount() predicate.Logentry {
|
||||
// HasAccountWith applies the HasEdge predicate on the "account" edge with a given conditions (other predicates).
|
||||
func HasAccountWith(preds ...predicate.Account) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(AccountInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, AccountTable, AccountColumn),
|
||||
)
|
||||
step := newAccountStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@ -597,7 +348,6 @@ func HasDomain() predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DomainTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, DomainTable, DomainColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
@ -607,11 +357,7 @@ func HasDomain() predicate.Logentry {
|
||||
// HasDomainWith applies the HasEdge predicate on the "domain" edge with a given conditions (other predicates).
|
||||
func HasDomainWith(preds ...predicate.Domain) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DomainInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, DomainTable, DomainColumn),
|
||||
)
|
||||
step := newDomainStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@ -622,32 +368,15 @@ func HasDomainWith(preds ...predicate.Domain) predicate.Logentry {
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Logentry) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for _, p := range predicates {
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Logentry(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Logentry) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for i, p := range predicates {
|
||||
if i > 0 {
|
||||
s1.Or()
|
||||
}
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Logentry(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Logentry) predicate.Logentry {
|
||||
return predicate.Logentry(func(s *sql.Selector) {
|
||||
p(s.Not())
|
||||
})
|
||||
return predicate.Logentry(sql.NotPredicates(p))
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -107,44 +107,8 @@ func (lc *LogentryCreate) Mutation() *LogentryMutation {
|
||||
|
||||
// Save creates the Logentry in the database.
|
||||
func (lc *LogentryCreate) Save(ctx context.Context) (*Logentry, error) {
|
||||
var (
|
||||
err error
|
||||
node *Logentry
|
||||
)
|
||||
lc.defaults()
|
||||
if len(lc.hooks) == 0 {
|
||||
if err = lc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = lc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*LogentryMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = lc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
lc.mutation = mutation
|
||||
if node, err = lc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(lc.hooks) - 1; i >= 0; i-- {
|
||||
if lc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = lc.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, lc.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
return withHooks(ctx, lc.sqlSave, lc.mutation, lc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@ -189,10 +153,13 @@ func (lc *LogentryCreate) check() error {
|
||||
}
|
||||
|
||||
func (lc *LogentryCreate) sqlSave(ctx context.Context) (*Logentry, error) {
|
||||
if err := lc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := lc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, lc.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@ -200,46 +167,30 @@ func (lc *LogentryCreate) sqlSave(ctx context.Context) (*Logentry, error) {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
lc.mutation.id = &_node.ID
|
||||
lc.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (lc *LogentryCreate) createSpec() (*Logentry, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Logentry{config: lc.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: logentry.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
}
|
||||
_spec = sqlgraph.NewCreateSpec(logentry.Table, sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := lc.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := lc.mutation.Timestamp(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: logentry.FieldTimestamp,
|
||||
})
|
||||
_spec.SetField(logentry.FieldTimestamp, field.TypeTime, value)
|
||||
_node.Timestamp = value
|
||||
}
|
||||
if value, ok := lc.mutation.Action(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: logentry.FieldAction,
|
||||
})
|
||||
_spec.SetField(logentry.FieldAction, field.TypeString, value)
|
||||
_node.Action = value
|
||||
}
|
||||
if value, ok := lc.mutation.Data(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: logentry.FieldData,
|
||||
})
|
||||
_spec.SetField(logentry.FieldData, field.TypeString, value)
|
||||
_node.Data = &value
|
||||
}
|
||||
if nodes := lc.mutation.AccountIDs(); len(nodes) > 0 {
|
||||
@ -250,10 +201,7 @@ func (lc *LogentryCreate) createSpec() (*Logentry, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{logentry.AccountColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -270,10 +218,7 @@ func (lc *LogentryCreate) createSpec() (*Logentry, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{logentry.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -288,11 +233,15 @@ func (lc *LogentryCreate) createSpec() (*Logentry, *sqlgraph.CreateSpec) {
|
||||
// LogentryCreateBulk is the builder for creating many Logentry entities in bulk.
|
||||
type LogentryCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*LogentryCreate
|
||||
}
|
||||
|
||||
// Save creates the Logentry entities in the database.
|
||||
func (lcb *LogentryCreateBulk) Save(ctx context.Context) ([]*Logentry, error) {
|
||||
if lcb.err != nil {
|
||||
return nil, lcb.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(lcb.builders))
|
||||
nodes := make([]*Logentry, len(lcb.builders))
|
||||
mutators := make([]Mutator, len(lcb.builders))
|
||||
@ -309,8 +258,8 @@ func (lcb *LogentryCreateBulk) Save(ctx context.Context) ([]*Logentry, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, lcb.builders[i+1].mutation)
|
||||
} else {
|
||||
@ -318,7 +267,7 @@ func (lcb *LogentryCreateBulk) Save(ctx context.Context) ([]*Logentry, error) {
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, lcb.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,11 +275,11 @@ func (lcb *LogentryCreateBulk) Save(ctx context.Context) ([]*Logentry, error) {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
mutation.done = true
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
|
@ -1,10 +1,9 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/logentry"
|
||||
"code.icod.de/postfix/manager/ent/predicate"
|
||||
@ -28,34 +27,7 @@ func (ld *LogentryDelete) Where(ps ...predicate.Logentry) *LogentryDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (ld *LogentryDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(ld.hooks) == 0 {
|
||||
affected, err = ld.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*LogentryMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
ld.mutation = mutation
|
||||
affected, err = ld.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(ld.hooks) - 1; i >= 0; i-- {
|
||||
if ld.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = ld.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, ld.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, ld.sqlExec, ld.mutation, ld.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
@ -68,15 +40,7 @@ func (ld *LogentryDelete) ExecX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
func (ld *LogentryDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: logentry.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewDeleteSpec(logentry.Table, sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64))
|
||||
if ps := ld.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@ -84,7 +48,12 @@ func (ld *LogentryDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, ld.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, ld.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
ld.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// LogentryDeleteOne is the builder for deleting a single Logentry entity.
|
||||
@ -92,6 +61,12 @@ type LogentryDeleteOne struct {
|
||||
ld *LogentryDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the LogentryDelete builder.
|
||||
func (ldo *LogentryDeleteOne) Where(ps ...predicate.Logentry) *LogentryDeleteOne {
|
||||
ldo.ld.mutation.Where(ps...)
|
||||
return ldo
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (ldo *LogentryDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := ldo.ld.Exec(ctx)
|
||||
@ -107,5 +82,7 @@ func (ldo *LogentryDeleteOne) Exec(ctx context.Context) error {
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (ldo *LogentryDeleteOne) ExecX(ctx context.Context) {
|
||||
ldo.ld.ExecX(ctx)
|
||||
if err := ldo.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -35,6 +35,14 @@ func (lu *LogentryUpdate) SetAction(s string) *LogentryUpdate {
|
||||
return lu
|
||||
}
|
||||
|
||||
// SetNillableAction sets the "action" field if the given value is not nil.
|
||||
func (lu *LogentryUpdate) SetNillableAction(s *string) *LogentryUpdate {
|
||||
if s != nil {
|
||||
lu.SetAction(*s)
|
||||
}
|
||||
return lu
|
||||
}
|
||||
|
||||
// SetData sets the "data" field.
|
||||
func (lu *LogentryUpdate) SetData(s string) *LogentryUpdate {
|
||||
lu.mutation.SetData(s)
|
||||
@ -124,34 +132,7 @@ func (lu *LogentryUpdate) ClearDomain() *LogentryUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (lu *LogentryUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(lu.hooks) == 0 {
|
||||
affected, err = lu.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*LogentryMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
lu.mutation = mutation
|
||||
affected, err = lu.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(lu.hooks) - 1; i >= 0; i-- {
|
||||
if lu.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = lu.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, lu.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, lu.sqlSave, lu.mutation, lu.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@ -177,16 +158,7 @@ func (lu *LogentryUpdate) ExecX(ctx context.Context) {
|
||||
}
|
||||
|
||||
func (lu *LogentryUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: logentry.Table,
|
||||
Columns: logentry.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(logentry.Table, logentry.Columns, sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64))
|
||||
if ps := lu.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@ -195,24 +167,13 @@ func (lu *LogentryUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
}
|
||||
if value, ok := lu.mutation.Action(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: logentry.FieldAction,
|
||||
})
|
||||
_spec.SetField(logentry.FieldAction, field.TypeString, value)
|
||||
}
|
||||
if value, ok := lu.mutation.Data(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: logentry.FieldData,
|
||||
})
|
||||
_spec.SetField(logentry.FieldData, field.TypeString, value)
|
||||
}
|
||||
if lu.mutation.DataCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: logentry.FieldData,
|
||||
})
|
||||
_spec.ClearField(logentry.FieldData, field.TypeString)
|
||||
}
|
||||
if lu.mutation.AccountCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@ -222,10 +183,7 @@ func (lu *LogentryUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{logentry.AccountColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -238,10 +196,7 @@ func (lu *LogentryUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{logentry.AccountColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -257,10 +212,7 @@ func (lu *LogentryUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{logentry.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -273,10 +225,7 @@ func (lu *LogentryUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{logentry.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -288,10 +237,11 @@ func (lu *LogentryUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{logentry.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
lu.mutation.done = true
|
||||
return n, nil
|
||||
}
|
||||
|
||||
@ -309,6 +259,14 @@ func (luo *LogentryUpdateOne) SetAction(s string) *LogentryUpdateOne {
|
||||
return luo
|
||||
}
|
||||
|
||||
// SetNillableAction sets the "action" field if the given value is not nil.
|
||||
func (luo *LogentryUpdateOne) SetNillableAction(s *string) *LogentryUpdateOne {
|
||||
if s != nil {
|
||||
luo.SetAction(*s)
|
||||
}
|
||||
return luo
|
||||
}
|
||||
|
||||
// SetData sets the "data" field.
|
||||
func (luo *LogentryUpdateOne) SetData(s string) *LogentryUpdateOne {
|
||||
luo.mutation.SetData(s)
|
||||
@ -396,6 +354,12 @@ func (luo *LogentryUpdateOne) ClearDomain() *LogentryUpdateOne {
|
||||
return luo
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the LogentryUpdate builder.
|
||||
func (luo *LogentryUpdateOne) Where(ps ...predicate.Logentry) *LogentryUpdateOne {
|
||||
luo.mutation.Where(ps...)
|
||||
return luo
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (luo *LogentryUpdateOne) Select(field string, fields ...string) *LogentryUpdateOne {
|
||||
@ -405,34 +369,7 @@ func (luo *LogentryUpdateOne) Select(field string, fields ...string) *LogentryUp
|
||||
|
||||
// Save executes the query and returns the updated Logentry entity.
|
||||
func (luo *LogentryUpdateOne) Save(ctx context.Context) (*Logentry, error) {
|
||||
var (
|
||||
err error
|
||||
node *Logentry
|
||||
)
|
||||
if len(luo.hooks) == 0 {
|
||||
node, err = luo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*LogentryMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
luo.mutation = mutation
|
||||
node, err = luo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(luo.hooks) - 1; i >= 0; i-- {
|
||||
if luo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = luo.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, luo.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
return withHooks(ctx, luo.sqlSave, luo.mutation, luo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@ -458,16 +395,7 @@ func (luo *LogentryUpdateOne) ExecX(ctx context.Context) {
|
||||
}
|
||||
|
||||
func (luo *LogentryUpdateOne) sqlSave(ctx context.Context) (_node *Logentry, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: logentry.Table,
|
||||
Columns: logentry.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: logentry.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(logentry.Table, logentry.Columns, sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64))
|
||||
id, ok := luo.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Logentry.id" for update`)}
|
||||
@ -493,24 +421,13 @@ func (luo *LogentryUpdateOne) sqlSave(ctx context.Context) (_node *Logentry, err
|
||||
}
|
||||
}
|
||||
if value, ok := luo.mutation.Action(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: logentry.FieldAction,
|
||||
})
|
||||
_spec.SetField(logentry.FieldAction, field.TypeString, value)
|
||||
}
|
||||
if value, ok := luo.mutation.Data(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: logentry.FieldData,
|
||||
})
|
||||
_spec.SetField(logentry.FieldData, field.TypeString, value)
|
||||
}
|
||||
if luo.mutation.DataCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: logentry.FieldData,
|
||||
})
|
||||
_spec.ClearField(logentry.FieldData, field.TypeString)
|
||||
}
|
||||
if luo.mutation.AccountCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@ -520,10 +437,7 @@ func (luo *LogentryUpdateOne) sqlSave(ctx context.Context) (_node *Logentry, err
|
||||
Columns: []string{logentry.AccountColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -536,10 +450,7 @@ func (luo *LogentryUpdateOne) sqlSave(ctx context.Context) (_node *Logentry, err
|
||||
Columns: []string{logentry.AccountColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: account.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -555,10 +466,7 @@ func (luo *LogentryUpdateOne) sqlSave(ctx context.Context) (_node *Logentry, err
|
||||
Columns: []string{logentry.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -571,10 +479,7 @@ func (luo *LogentryUpdateOne) sqlSave(ctx context.Context) (_node *Logentry, err
|
||||
Columns: []string{logentry.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -589,9 +494,10 @@ func (luo *LogentryUpdateOne) sqlSave(ctx context.Context) (_node *Logentry, err
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{logentry.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
luo.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"code.icod.de/postfix/manager/ent/domain"
|
||||
"code.icod.de/postfix/manager/ent/mailbox"
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@ -45,7 +46,8 @@ type Mailbox struct {
|
||||
Gid *int32 `json:"gid,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the MailboxQuery when eager-loading is set.
|
||||
Edges MailboxEdges `json:"edges"`
|
||||
Edges MailboxEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// MailboxEdges holds the relations/edges for other nodes in the graph.
|
||||
@ -60,20 +62,17 @@ type MailboxEdges struct {
|
||||
// DomainOrErr returns the Domain value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e MailboxEdges) DomainOrErr() (*Domain, error) {
|
||||
if e.loadedTypes[0] {
|
||||
if e.Domain == nil {
|
||||
// The edge domain was loaded in eager-loading,
|
||||
// but was not found.
|
||||
return nil, &NotFoundError{label: domain.Label}
|
||||
}
|
||||
if e.Domain != nil {
|
||||
return e.Domain, nil
|
||||
} else if e.loadedTypes[0] {
|
||||
return nil, &NotFoundError{label: domain.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "domain"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Mailbox) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Mailbox) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case mailbox.FieldPassword:
|
||||
@ -87,7 +86,7 @@ func (*Mailbox) scanValues(columns []string) ([]interface{}, error) {
|
||||
case mailbox.FieldCreated, mailbox.FieldModified:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Mailbox", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@ -95,7 +94,7 @@ func (*Mailbox) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Mailbox fields.
|
||||
func (m *Mailbox) assignValues(columns []string, values []interface{}) error {
|
||||
func (m *Mailbox) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@ -191,31 +190,39 @@ func (m *Mailbox) assignValues(columns []string, values []interface{}) error {
|
||||
m.Gid = new(int32)
|
||||
*m.Gid = int32(value.Int64)
|
||||
}
|
||||
default:
|
||||
m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Mailbox.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (m *Mailbox) Value(name string) (ent.Value, error) {
|
||||
return m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryDomain queries the "domain" edge of the Mailbox entity.
|
||||
func (m *Mailbox) QueryDomain() *DomainQuery {
|
||||
return (&MailboxClient{config: m.config}).QueryDomain(m)
|
||||
return NewMailboxClient(m.config).QueryDomain(m)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Mailbox.
|
||||
// Note that you need to call Mailbox.Unwrap() before calling this method if this Mailbox
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (m *Mailbox) Update() *MailboxUpdateOne {
|
||||
return (&MailboxClient{config: m.config}).UpdateOne(m)
|
||||
return NewMailboxClient(m.config).UpdateOne(m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the Mailbox entity that was returned from a transaction after it was closed,
|
||||
// so that all future queries will be executed through the driver which created the transaction.
|
||||
func (m *Mailbox) Unwrap() *Mailbox {
|
||||
tx, ok := m.config.driver.(*txDriver)
|
||||
_tx, ok := m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Mailbox is not a transactional entity")
|
||||
}
|
||||
m.config.driver = tx.drv
|
||||
m.config.driver = _tx.drv
|
||||
return m
|
||||
}
|
||||
|
||||
@ -223,43 +230,55 @@ func (m *Mailbox) Unwrap() *Mailbox {
|
||||
func (m *Mailbox) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("Mailbox(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v", m.ID))
|
||||
builder.WriteString(", active=")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", m.ID))
|
||||
builder.WriteString("active=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.Active))
|
||||
builder.WriteString(", created=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("created=")
|
||||
builder.WriteString(m.Created.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := m.Modified; v != nil {
|
||||
builder.WriteString(", modified=")
|
||||
builder.WriteString("modified=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", domain_id=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("domain_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.DomainID))
|
||||
builder.WriteString(", username=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("username=")
|
||||
builder.WriteString(m.Username)
|
||||
builder.WriteString(", password=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("password=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.Password))
|
||||
builder.WriteString(", ")
|
||||
if v := m.Name; v != nil {
|
||||
builder.WriteString(", name=")
|
||||
builder.WriteString("name=")
|
||||
builder.WriteString(*v)
|
||||
}
|
||||
builder.WriteString(", quota=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("quota=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.Quota))
|
||||
builder.WriteString(", local_part=")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("local_part=")
|
||||
builder.WriteString(m.LocalPart)
|
||||
builder.WriteString(", ")
|
||||
if v := m.Homedir; v != nil {
|
||||
builder.WriteString(", homedir=")
|
||||
builder.WriteString("homedir=")
|
||||
builder.WriteString(*v)
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
if v := m.Maildir; v != nil {
|
||||
builder.WriteString(", maildir=")
|
||||
builder.WriteString("maildir=")
|
||||
builder.WriteString(*v)
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
if v := m.UID; v != nil {
|
||||
builder.WriteString(", uid=")
|
||||
builder.WriteString("uid=")
|
||||
builder.WriteString(fmt.Sprintf("%v", *v))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
if v := m.Gid; v != nil {
|
||||
builder.WriteString(", gid=")
|
||||
builder.WriteString("gid=")
|
||||
builder.WriteString(fmt.Sprintf("%v", *v))
|
||||
}
|
||||
builder.WriteByte(')')
|
||||
@ -268,9 +287,3 @@ func (m *Mailbox) String() string {
|
||||
|
||||
// Mailboxes is a parsable slice of Mailbox.
|
||||
type Mailboxes []*Mailbox
|
||||
|
||||
func (m Mailboxes) config(cfg config) {
|
||||
for _i := range m {
|
||||
m[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package mailbox
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -86,3 +89,85 @@ var (
|
||||
// UpdateDefaultModified holds the default value on update for the "modified" field.
|
||||
UpdateDefaultModified func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Mailbox queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByActive orders the results by the active field.
|
||||
func ByActive(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldActive, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreated orders the results by the created field.
|
||||
func ByCreated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModified orders the results by the modified field.
|
||||
func ByModified(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModified, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDomainID orders the results by the domain_id field.
|
||||
func ByDomainID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDomainID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUsername orders the results by the username field.
|
||||
func ByUsername(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUsername, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByName orders the results by the name field.
|
||||
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByQuota orders the results by the quota field.
|
||||
func ByQuota(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldQuota, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLocalPart orders the results by the local_part field.
|
||||
func ByLocalPart(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLocalPart, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHomedir orders the results by the homedir field.
|
||||
func ByHomedir(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHomedir, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMaildir orders the results by the maildir field.
|
||||
func ByMaildir(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMaildir, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUID orders the results by the uid field.
|
||||
func ByUID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGid orders the results by the gid field.
|
||||
func ByGid(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGid, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDomainField orders the results by domain field.
|
||||
func ByDomainField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newDomainStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newDomainStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DomainInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, DomainTable, DomainColumn),
|
||||
)
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -181,44 +181,8 @@ func (mc *MailboxCreate) Mutation() *MailboxMutation {
|
||||
|
||||
// Save creates the Mailbox in the database.
|
||||
func (mc *MailboxCreate) Save(ctx context.Context) (*Mailbox, error) {
|
||||
var (
|
||||
err error
|
||||
node *Mailbox
|
||||
)
|
||||
mc.defaults()
|
||||
if len(mc.hooks) == 0 {
|
||||
if err = mc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = mc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MailboxMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = mc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mc.mutation = mutation
|
||||
if node, err = mc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(mc.hooks) - 1; i >= 0; i-- {
|
||||
if mc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = mc.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, mc.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
return withHooks(ctx, mc.sqlSave, mc.mutation, mc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@ -279,10 +243,13 @@ func (mc *MailboxCreate) check() error {
|
||||
}
|
||||
|
||||
func (mc *MailboxCreate) sqlSave(ctx context.Context) (*Mailbox, error) {
|
||||
if err := mc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := mc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, mc.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@ -290,118 +257,66 @@ func (mc *MailboxCreate) sqlSave(ctx context.Context) (*Mailbox, error) {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
mc.mutation.id = &_node.ID
|
||||
mc.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (mc *MailboxCreate) createSpec() (*Mailbox, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Mailbox{config: mc.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: mailbox.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
}
|
||||
_spec = sqlgraph.NewCreateSpec(mailbox.Table, sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := mc.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := mc.mutation.Active(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: mailbox.FieldActive,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldActive, field.TypeBool, value)
|
||||
_node.Active = value
|
||||
}
|
||||
if value, ok := mc.mutation.Created(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: mailbox.FieldCreated,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldCreated, field.TypeTime, value)
|
||||
_node.Created = value
|
||||
}
|
||||
if value, ok := mc.mutation.Modified(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: mailbox.FieldModified,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldModified, field.TypeTime, value)
|
||||
_node.Modified = &value
|
||||
}
|
||||
if value, ok := mc.mutation.Username(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldUsername,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldUsername, field.TypeString, value)
|
||||
_node.Username = value
|
||||
}
|
||||
if value, ok := mc.mutation.Password(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBytes,
|
||||
Value: value,
|
||||
Column: mailbox.FieldPassword,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldPassword, field.TypeBytes, value)
|
||||
_node.Password = value
|
||||
}
|
||||
if value, ok := mc.mutation.Name(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldName,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldName, field.TypeString, value)
|
||||
_node.Name = &value
|
||||
}
|
||||
if value, ok := mc.mutation.Quota(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: mailbox.FieldQuota,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldQuota, field.TypeInt64, value)
|
||||
_node.Quota = value
|
||||
}
|
||||
if value, ok := mc.mutation.LocalPart(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldLocalPart,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldLocalPart, field.TypeString, value)
|
||||
_node.LocalPart = value
|
||||
}
|
||||
if value, ok := mc.mutation.Homedir(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldHomedir,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldHomedir, field.TypeString, value)
|
||||
_node.Homedir = &value
|
||||
}
|
||||
if value, ok := mc.mutation.Maildir(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldMaildir,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldMaildir, field.TypeString, value)
|
||||
_node.Maildir = &value
|
||||
}
|
||||
if value, ok := mc.mutation.UID(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Value: value,
|
||||
Column: mailbox.FieldUID,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldUID, field.TypeInt32, value)
|
||||
_node.UID = &value
|
||||
}
|
||||
if value, ok := mc.mutation.Gid(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Value: value,
|
||||
Column: mailbox.FieldGid,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldGid, field.TypeInt32, value)
|
||||
_node.Gid = &value
|
||||
}
|
||||
if nodes := mc.mutation.DomainIDs(); len(nodes) > 0 {
|
||||
@ -412,10 +327,7 @@ func (mc *MailboxCreate) createSpec() (*Mailbox, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{mailbox.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -430,11 +342,15 @@ func (mc *MailboxCreate) createSpec() (*Mailbox, *sqlgraph.CreateSpec) {
|
||||
// MailboxCreateBulk is the builder for creating many Mailbox entities in bulk.
|
||||
type MailboxCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*MailboxCreate
|
||||
}
|
||||
|
||||
// Save creates the Mailbox entities in the database.
|
||||
func (mcb *MailboxCreateBulk) Save(ctx context.Context) ([]*Mailbox, error) {
|
||||
if mcb.err != nil {
|
||||
return nil, mcb.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(mcb.builders))
|
||||
nodes := make([]*Mailbox, len(mcb.builders))
|
||||
mutators := make([]Mutator, len(mcb.builders))
|
||||
@ -451,8 +367,8 @@ func (mcb *MailboxCreateBulk) Save(ctx context.Context) ([]*Mailbox, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, mcb.builders[i+1].mutation)
|
||||
} else {
|
||||
@ -460,7 +376,7 @@ func (mcb *MailboxCreateBulk) Save(ctx context.Context) ([]*Mailbox, error) {
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, mcb.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -468,11 +384,11 @@ func (mcb *MailboxCreateBulk) Save(ctx context.Context) ([]*Mailbox, error) {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
mutation.done = true
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
|
@ -1,10 +1,9 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/mailbox"
|
||||
"code.icod.de/postfix/manager/ent/predicate"
|
||||
@ -28,34 +27,7 @@ func (md *MailboxDelete) Where(ps ...predicate.Mailbox) *MailboxDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (md *MailboxDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(md.hooks) == 0 {
|
||||
affected, err = md.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MailboxMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
md.mutation = mutation
|
||||
affected, err = md.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(md.hooks) - 1; i >= 0; i-- {
|
||||
if md.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = md.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, md.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, md.sqlExec, md.mutation, md.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
@ -68,15 +40,7 @@ func (md *MailboxDelete) ExecX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
func (md *MailboxDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: mailbox.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewDeleteSpec(mailbox.Table, sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64))
|
||||
if ps := md.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@ -84,7 +48,12 @@ func (md *MailboxDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, md.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, md.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
md.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// MailboxDeleteOne is the builder for deleting a single Mailbox entity.
|
||||
@ -92,6 +61,12 @@ type MailboxDeleteOne struct {
|
||||
md *MailboxDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the MailboxDelete builder.
|
||||
func (mdo *MailboxDeleteOne) Where(ps ...predicate.Mailbox) *MailboxDeleteOne {
|
||||
mdo.md.mutation.Where(ps...)
|
||||
return mdo
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (mdo *MailboxDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := mdo.md.Exec(ctx)
|
||||
@ -107,5 +82,7 @@ func (mdo *MailboxDeleteOne) Exec(ctx context.Context) error {
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (mdo *MailboxDeleteOne) ExecX(ctx context.Context) {
|
||||
mdo.md.ExecX(ctx)
|
||||
if err := mdo.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"code.icod.de/postfix/manager/ent/domain"
|
||||
"code.icod.de/postfix/manager/ent/mailbox"
|
||||
"code.icod.de/postfix/manager/ent/predicate"
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
@ -19,13 +19,10 @@ import (
|
||||
// MailboxQuery is the builder for querying Mailbox entities.
|
||||
type MailboxQuery struct {
|
||||
config
|
||||
limit *int
|
||||
offset *int
|
||||
unique *bool
|
||||
order []OrderFunc
|
||||
fields []string
|
||||
ctx *QueryContext
|
||||
order []mailbox.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Mailbox
|
||||
// eager-loading edges.
|
||||
withDomain *DomainQuery
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
@ -38,34 +35,34 @@ func (mq *MailboxQuery) Where(ps ...predicate.Mailbox) *MailboxQuery {
|
||||
return mq
|
||||
}
|
||||
|
||||
// Limit adds a limit step to the query.
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (mq *MailboxQuery) Limit(limit int) *MailboxQuery {
|
||||
mq.limit = &limit
|
||||
mq.ctx.Limit = &limit
|
||||
return mq
|
||||
}
|
||||
|
||||
// Offset adds an offset step to the query.
|
||||
// Offset to start from.
|
||||
func (mq *MailboxQuery) Offset(offset int) *MailboxQuery {
|
||||
mq.offset = &offset
|
||||
mq.ctx.Offset = &offset
|
||||
return mq
|
||||
}
|
||||
|
||||
// Unique configures the query builder to filter duplicate records on query.
|
||||
// By default, unique is set to true, and can be disabled using this method.
|
||||
func (mq *MailboxQuery) Unique(unique bool) *MailboxQuery {
|
||||
mq.unique = &unique
|
||||
mq.ctx.Unique = &unique
|
||||
return mq
|
||||
}
|
||||
|
||||
// Order adds an order step to the query.
|
||||
func (mq *MailboxQuery) Order(o ...OrderFunc) *MailboxQuery {
|
||||
// Order specifies how the records should be ordered.
|
||||
func (mq *MailboxQuery) Order(o ...mailbox.OrderOption) *MailboxQuery {
|
||||
mq.order = append(mq.order, o...)
|
||||
return mq
|
||||
}
|
||||
|
||||
// QueryDomain chains the current query on the "domain" edge.
|
||||
func (mq *MailboxQuery) QueryDomain() *DomainQuery {
|
||||
query := &DomainQuery{config: mq.config}
|
||||
query := (&DomainClient{config: mq.config}).Query()
|
||||
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
|
||||
if err := mq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
@ -88,7 +85,7 @@ func (mq *MailboxQuery) QueryDomain() *DomainQuery {
|
||||
// First returns the first Mailbox entity from the query.
|
||||
// Returns a *NotFoundError when no Mailbox was found.
|
||||
func (mq *MailboxQuery) First(ctx context.Context) (*Mailbox, error) {
|
||||
nodes, err := mq.Limit(1).All(ctx)
|
||||
nodes, err := mq.Limit(1).All(setContextOp(ctx, mq.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -111,7 +108,7 @@ func (mq *MailboxQuery) FirstX(ctx context.Context) *Mailbox {
|
||||
// Returns a *NotFoundError when no Mailbox ID was found.
|
||||
func (mq *MailboxQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = mq.Limit(1).IDs(ctx); err != nil {
|
||||
if ids, err = mq.Limit(1).IDs(setContextOp(ctx, mq.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
@ -134,7 +131,7 @@ func (mq *MailboxQuery) FirstIDX(ctx context.Context) int64 {
|
||||
// Returns a *NotSingularError when more than one Mailbox entity is found.
|
||||
// Returns a *NotFoundError when no Mailbox entities are found.
|
||||
func (mq *MailboxQuery) Only(ctx context.Context) (*Mailbox, error) {
|
||||
nodes, err := mq.Limit(2).All(ctx)
|
||||
nodes, err := mq.Limit(2).All(setContextOp(ctx, mq.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -162,7 +159,7 @@ func (mq *MailboxQuery) OnlyX(ctx context.Context) *Mailbox {
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (mq *MailboxQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = mq.Limit(2).IDs(ctx); err != nil {
|
||||
if ids, err = mq.Limit(2).IDs(setContextOp(ctx, mq.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
@ -187,10 +184,12 @@ func (mq *MailboxQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
|
||||
// All executes the query and returns a list of Mailboxes.
|
||||
func (mq *MailboxQuery) All(ctx context.Context) ([]*Mailbox, error) {
|
||||
ctx = setContextOp(ctx, mq.ctx, ent.OpQueryAll)
|
||||
if err := mq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mq.sqlAll(ctx)
|
||||
qr := querierAll[[]*Mailbox, *MailboxQuery]()
|
||||
return withInterceptors[[]*Mailbox](ctx, mq, qr, mq.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
@ -203,9 +202,12 @@ func (mq *MailboxQuery) AllX(ctx context.Context) []*Mailbox {
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of Mailbox IDs.
|
||||
func (mq *MailboxQuery) IDs(ctx context.Context) ([]int64, error) {
|
||||
var ids []int64
|
||||
if err := mq.Select(mailbox.FieldID).Scan(ctx, &ids); err != nil {
|
||||
func (mq *MailboxQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if mq.ctx.Unique == nil && mq.path != nil {
|
||||
mq.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, mq.ctx, ent.OpQueryIDs)
|
||||
if err = mq.Select(mailbox.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
@ -222,10 +224,11 @@ func (mq *MailboxQuery) IDsX(ctx context.Context) []int64 {
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (mq *MailboxQuery) Count(ctx context.Context) (int, error) {
|
||||
ctx = setContextOp(ctx, mq.ctx, ent.OpQueryCount)
|
||||
if err := mq.prepareQuery(ctx); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return mq.sqlCount(ctx)
|
||||
return withInterceptors[int](ctx, mq, querierCount[*MailboxQuery](), mq.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
@ -239,10 +242,15 @@ func (mq *MailboxQuery) CountX(ctx context.Context) int {
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (mq *MailboxQuery) Exist(ctx context.Context) (bool, error) {
|
||||
if err := mq.prepareQuery(ctx); err != nil {
|
||||
return false, err
|
||||
ctx = setContextOp(ctx, mq.ctx, ent.OpQueryExist)
|
||||
switch _, err := mq.FirstID(ctx); {
|
||||
case IsNotFound(err):
|
||||
return false, nil
|
||||
case err != nil:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
return mq.sqlExist(ctx)
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
@ -262,22 +270,21 @@ func (mq *MailboxQuery) Clone() *MailboxQuery {
|
||||
}
|
||||
return &MailboxQuery{
|
||||
config: mq.config,
|
||||
limit: mq.limit,
|
||||
offset: mq.offset,
|
||||
order: append([]OrderFunc{}, mq.order...),
|
||||
ctx: mq.ctx.Clone(),
|
||||
order: append([]mailbox.OrderOption{}, mq.order...),
|
||||
inters: append([]Interceptor{}, mq.inters...),
|
||||
predicates: append([]predicate.Mailbox{}, mq.predicates...),
|
||||
withDomain: mq.withDomain.Clone(),
|
||||
// clone intermediate query.
|
||||
sql: mq.sql.Clone(),
|
||||
path: mq.path,
|
||||
unique: mq.unique,
|
||||
sql: mq.sql.Clone(),
|
||||
path: mq.path,
|
||||
}
|
||||
}
|
||||
|
||||
// WithDomain tells the query-builder to eager-load the nodes that are connected to
|
||||
// the "domain" edge. The optional arguments are used to configure the query builder of the edge.
|
||||
func (mq *MailboxQuery) WithDomain(opts ...func(*DomainQuery)) *MailboxQuery {
|
||||
query := &DomainQuery{config: mq.config}
|
||||
query := (&DomainClient{config: mq.config}).Query()
|
||||
for _, opt := range opts {
|
||||
opt(query)
|
||||
}
|
||||
@ -299,17 +306,13 @@ func (mq *MailboxQuery) WithDomain(opts ...func(*DomainQuery)) *MailboxQuery {
|
||||
// GroupBy(mailbox.FieldActive).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (mq *MailboxQuery) GroupBy(field string, fields ...string) *MailboxGroupBy {
|
||||
group := &MailboxGroupBy{config: mq.config}
|
||||
group.fields = append([]string{field}, fields...)
|
||||
group.path = func(ctx context.Context) (prev *sql.Selector, err error) {
|
||||
if err := mq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mq.sqlQuery(ctx), nil
|
||||
}
|
||||
return group
|
||||
mq.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &MailboxGroupBy{build: mq}
|
||||
grbuild.flds = &mq.ctx.Fields
|
||||
grbuild.label = mailbox.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
@ -324,14 +327,31 @@ func (mq *MailboxQuery) GroupBy(field string, fields ...string) *MailboxGroupBy
|
||||
// client.Mailbox.Query().
|
||||
// Select(mailbox.FieldActive).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (mq *MailboxQuery) Select(fields ...string) *MailboxSelect {
|
||||
mq.fields = append(mq.fields, fields...)
|
||||
return &MailboxSelect{MailboxQuery: mq}
|
||||
mq.ctx.Fields = append(mq.ctx.Fields, fields...)
|
||||
sbuild := &MailboxSelect{MailboxQuery: mq}
|
||||
sbuild.label = mailbox.Label
|
||||
sbuild.flds, sbuild.scan = &mq.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a MailboxSelect configured with the given aggregations.
|
||||
func (mq *MailboxQuery) Aggregate(fns ...AggregateFunc) *MailboxSelect {
|
||||
return mq.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (mq *MailboxQuery) prepareQuery(ctx context.Context) error {
|
||||
for _, f := range mq.fields {
|
||||
for _, inter := range mq.inters {
|
||||
if inter == nil {
|
||||
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
|
||||
}
|
||||
if trv, ok := inter.(Traverser); ok {
|
||||
if err := trv.Traverse(ctx, mq); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range mq.ctx.Fields {
|
||||
if !mailbox.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
@ -346,7 +366,7 @@ func (mq *MailboxQuery) prepareQuery(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mq *MailboxQuery) sqlAll(ctx context.Context) ([]*Mailbox, error) {
|
||||
func (mq *MailboxQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Mailbox, error) {
|
||||
var (
|
||||
nodes = []*Mailbox{}
|
||||
_spec = mq.querySpec()
|
||||
@ -354,89 +374,81 @@ func (mq *MailboxQuery) sqlAll(ctx context.Context) ([]*Mailbox, error) {
|
||||
mq.withDomain != nil,
|
||||
}
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*Mailbox).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &Mailbox{config: mq.config}
|
||||
nodes = append(nodes, node)
|
||||
return node.scanValues(columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
if len(nodes) == 0 {
|
||||
return fmt.Errorf("ent: Assign called without calling ScanValues")
|
||||
}
|
||||
node := nodes[len(nodes)-1]
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
return node.assignValues(columns, values)
|
||||
}
|
||||
for i := range hooks {
|
||||
hooks[i](ctx, _spec)
|
||||
}
|
||||
if err := sqlgraph.QueryNodes(ctx, mq.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
if query := mq.withDomain; query != nil {
|
||||
ids := make([]int64, 0, len(nodes))
|
||||
nodeids := make(map[int64][]*Mailbox)
|
||||
for i := range nodes {
|
||||
fk := nodes[i].DomainID
|
||||
if _, ok := nodeids[fk]; !ok {
|
||||
ids = append(ids, fk)
|
||||
}
|
||||
nodeids[fk] = append(nodeids[fk], nodes[i])
|
||||
}
|
||||
query.Where(domain.IDIn(ids...))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
if err := mq.loadDomain(ctx, query, nodes, nil,
|
||||
func(n *Mailbox, e *Domain) { n.Edges.Domain = e }); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, n := range neighbors {
|
||||
nodes, ok := nodeids[n.ID]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf(`unexpected foreign-key "domain_id" returned %v`, n.ID)
|
||||
}
|
||||
for i := range nodes {
|
||||
nodes[i].Edges.Domain = n
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (mq *MailboxQuery) loadDomain(ctx context.Context, query *DomainQuery, nodes []*Mailbox, init func(*Mailbox), assign func(*Mailbox, *Domain)) error {
|
||||
ids := make([]int64, 0, len(nodes))
|
||||
nodeids := make(map[int64][]*Mailbox)
|
||||
for i := range nodes {
|
||||
fk := nodes[i].DomainID
|
||||
if _, ok := nodeids[fk]; !ok {
|
||||
ids = append(ids, fk)
|
||||
}
|
||||
nodeids[fk] = append(nodeids[fk], nodes[i])
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
return nil
|
||||
}
|
||||
query.Where(domain.IDIn(ids...))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, n := range neighbors {
|
||||
nodes, ok := nodeids[n.ID]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "domain_id" returned %v`, n.ID)
|
||||
}
|
||||
for i := range nodes {
|
||||
assign(nodes[i], n)
|
||||
}
|
||||
}
|
||||
|
||||
return nodes, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mq *MailboxQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
_spec := mq.querySpec()
|
||||
_spec.Node.Columns = mq.fields
|
||||
if len(mq.fields) > 0 {
|
||||
_spec.Unique = mq.unique != nil && *mq.unique
|
||||
_spec.Node.Columns = mq.ctx.Fields
|
||||
if len(mq.ctx.Fields) > 0 {
|
||||
_spec.Unique = mq.ctx.Unique != nil && *mq.ctx.Unique
|
||||
}
|
||||
return sqlgraph.CountNodes(ctx, mq.driver, _spec)
|
||||
}
|
||||
|
||||
func (mq *MailboxQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := mq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
}
|
||||
return n > 0, nil
|
||||
}
|
||||
|
||||
func (mq *MailboxQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := &sqlgraph.QuerySpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: mailbox.Table,
|
||||
Columns: mailbox.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
},
|
||||
From: mq.sql,
|
||||
Unique: true,
|
||||
}
|
||||
if unique := mq.unique; unique != nil {
|
||||
_spec := sqlgraph.NewQuerySpec(mailbox.Table, mailbox.Columns, sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64))
|
||||
_spec.From = mq.sql
|
||||
if unique := mq.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if mq.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := mq.fields; len(fields) > 0 {
|
||||
if fields := mq.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, mailbox.FieldID)
|
||||
for i := range fields {
|
||||
@ -444,6 +456,9 @@ func (mq *MailboxQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
if mq.withDomain != nil {
|
||||
_spec.Node.AddColumnOnce(mailbox.FieldDomainID)
|
||||
}
|
||||
}
|
||||
if ps := mq.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
@ -452,10 +467,10 @@ func (mq *MailboxQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := mq.limit; limit != nil {
|
||||
if limit := mq.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := mq.offset; offset != nil {
|
||||
if offset := mq.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := mq.order; len(ps) > 0 {
|
||||
@ -471,7 +486,7 @@ func (mq *MailboxQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
func (mq *MailboxQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(mq.driver.Dialect())
|
||||
t1 := builder.Table(mailbox.Table)
|
||||
columns := mq.fields
|
||||
columns := mq.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = mailbox.Columns
|
||||
}
|
||||
@ -480,7 +495,7 @@ func (mq *MailboxQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
selector = mq.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if mq.unique != nil && *mq.unique {
|
||||
if mq.ctx.Unique != nil && *mq.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range mq.predicates {
|
||||
@ -489,12 +504,12 @@ func (mq *MailboxQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
for _, p := range mq.order {
|
||||
p(selector)
|
||||
}
|
||||
if offset := mq.offset; offset != nil {
|
||||
if offset := mq.ctx.Offset; offset != nil {
|
||||
// limit is mandatory for offset clause. We start
|
||||
// with default value, and override it below if needed.
|
||||
selector.Offset(*offset).Limit(math.MaxInt32)
|
||||
}
|
||||
if limit := mq.limit; limit != nil {
|
||||
if limit := mq.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
@ -502,12 +517,8 @@ func (mq *MailboxQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
|
||||
// MailboxGroupBy is the group-by builder for Mailbox entities.
|
||||
type MailboxGroupBy struct {
|
||||
config
|
||||
fields []string
|
||||
fns []AggregateFunc
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
selector
|
||||
build *MailboxQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
@ -516,471 +527,77 @@ func (mgb *MailboxGroupBy) Aggregate(fns ...AggregateFunc) *MailboxGroupBy {
|
||||
return mgb
|
||||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (mgb *MailboxGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
query, err := mgb.path(ctx)
|
||||
if err != nil {
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (mgb *MailboxGroupBy) Scan(ctx context.Context, v any) error {
|
||||
ctx = setContextOp(ctx, mgb.build.ctx, ent.OpQueryGroupBy)
|
||||
if err := mgb.build.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
mgb.sql = query
|
||||
return mgb.sqlScan(ctx, v)
|
||||
return scanWithInterceptors[*MailboxQuery, *MailboxGroupBy](ctx, mgb.build, mgb, mgb.build.inters, v)
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (mgb *MailboxGroupBy) ScanX(ctx context.Context, v interface{}) {
|
||||
if err := mgb.Scan(ctx, v); err != nil {
|
||||
panic(err)
|
||||
func (mgb *MailboxGroupBy) sqlScan(ctx context.Context, root *MailboxQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
aggregation := make([]string, 0, len(mgb.fns))
|
||||
for _, fn := range mgb.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
}
|
||||
|
||||
// Strings returns list of strings from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (mgb *MailboxGroupBy) Strings(ctx context.Context) ([]string, error) {
|
||||
if len(mgb.fields) > 1 {
|
||||
return nil, errors.New("ent: MailboxGroupBy.Strings is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []string
|
||||
if err := mgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// StringsX is like Strings, but panics if an error occurs.
|
||||
func (mgb *MailboxGroupBy) StringsX(ctx context.Context) []string {
|
||||
v, err := mgb.Strings(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// String returns a single string from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (mgb *MailboxGroupBy) String(ctx context.Context) (_ string, err error) {
|
||||
var v []string
|
||||
if v, err = mgb.Strings(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{mailbox.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: MailboxGroupBy.Strings returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StringX is like String, but panics if an error occurs.
|
||||
func (mgb *MailboxGroupBy) StringX(ctx context.Context) string {
|
||||
v, err := mgb.String(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Ints returns list of ints from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (mgb *MailboxGroupBy) Ints(ctx context.Context) ([]int, error) {
|
||||
if len(mgb.fields) > 1 {
|
||||
return nil, errors.New("ent: MailboxGroupBy.Ints is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []int
|
||||
if err := mgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IntsX is like Ints, but panics if an error occurs.
|
||||
func (mgb *MailboxGroupBy) IntsX(ctx context.Context) []int {
|
||||
v, err := mgb.Ints(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Int returns a single int from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (mgb *MailboxGroupBy) Int(ctx context.Context) (_ int, err error) {
|
||||
var v []int
|
||||
if v, err = mgb.Ints(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{mailbox.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: MailboxGroupBy.Ints returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IntX is like Int, but panics if an error occurs.
|
||||
func (mgb *MailboxGroupBy) IntX(ctx context.Context) int {
|
||||
v, err := mgb.Int(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64s returns list of float64s from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (mgb *MailboxGroupBy) Float64s(ctx context.Context) ([]float64, error) {
|
||||
if len(mgb.fields) > 1 {
|
||||
return nil, errors.New("ent: MailboxGroupBy.Float64s is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []float64
|
||||
if err := mgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Float64sX is like Float64s, but panics if an error occurs.
|
||||
func (mgb *MailboxGroupBy) Float64sX(ctx context.Context) []float64 {
|
||||
v, err := mgb.Float64s(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64 returns a single float64 from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (mgb *MailboxGroupBy) Float64(ctx context.Context) (_ float64, err error) {
|
||||
var v []float64
|
||||
if v, err = mgb.Float64s(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{mailbox.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: MailboxGroupBy.Float64s returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Float64X is like Float64, but panics if an error occurs.
|
||||
func (mgb *MailboxGroupBy) Float64X(ctx context.Context) float64 {
|
||||
v, err := mgb.Float64(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bools returns list of bools from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (mgb *MailboxGroupBy) Bools(ctx context.Context) ([]bool, error) {
|
||||
if len(mgb.fields) > 1 {
|
||||
return nil, errors.New("ent: MailboxGroupBy.Bools is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []bool
|
||||
if err := mgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoolsX is like Bools, but panics if an error occurs.
|
||||
func (mgb *MailboxGroupBy) BoolsX(ctx context.Context) []bool {
|
||||
v, err := mgb.Bools(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bool returns a single bool from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (mgb *MailboxGroupBy) Bool(ctx context.Context) (_ bool, err error) {
|
||||
var v []bool
|
||||
if v, err = mgb.Bools(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{mailbox.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: MailboxGroupBy.Bools returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BoolX is like Bool, but panics if an error occurs.
|
||||
func (mgb *MailboxGroupBy) BoolX(ctx context.Context) bool {
|
||||
v, err := mgb.Bool(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func (mgb *MailboxGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
for _, f := range mgb.fields {
|
||||
if !mailbox.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
if len(selector.SelectedColumns()) == 0 {
|
||||
columns := make([]string, 0, len(*mgb.flds)+len(mgb.fns))
|
||||
for _, f := range *mgb.flds {
|
||||
columns = append(columns, selector.C(f))
|
||||
}
|
||||
columns = append(columns, aggregation...)
|
||||
selector.Select(columns...)
|
||||
}
|
||||
selector := mgb.sqlQuery()
|
||||
selector.GroupBy(selector.Columns(*mgb.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := mgb.driver.Query(ctx, query, args, rows); err != nil {
|
||||
if err := mgb.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
func (mgb *MailboxGroupBy) sqlQuery() *sql.Selector {
|
||||
selector := mgb.sql.Select()
|
||||
aggregation := make([]string, 0, len(mgb.fns))
|
||||
for _, fn := range mgb.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
// If no columns were selected in a custom aggregation function, the default
|
||||
// selection is the fields used for "group-by", and the aggregation functions.
|
||||
if len(selector.SelectedColumns()) == 0 {
|
||||
columns := make([]string, 0, len(mgb.fields)+len(mgb.fns))
|
||||
for _, f := range mgb.fields {
|
||||
columns = append(columns, selector.C(f))
|
||||
}
|
||||
columns = append(columns, aggregation...)
|
||||
selector.Select(columns...)
|
||||
}
|
||||
return selector.GroupBy(selector.Columns(mgb.fields...)...)
|
||||
}
|
||||
|
||||
// MailboxSelect is the builder for selecting fields of Mailbox entities.
|
||||
type MailboxSelect struct {
|
||||
*MailboxQuery
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (ms *MailboxSelect) Aggregate(fns ...AggregateFunc) *MailboxSelect {
|
||||
ms.fns = append(ms.fns, fns...)
|
||||
return ms
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (ms *MailboxSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (ms *MailboxSelect) Scan(ctx context.Context, v any) error {
|
||||
ctx = setContextOp(ctx, ms.ctx, ent.OpQuerySelect)
|
||||
if err := ms.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
ms.sql = ms.MailboxQuery.sqlQuery(ctx)
|
||||
return ms.sqlScan(ctx, v)
|
||||
return scanWithInterceptors[*MailboxQuery, *MailboxSelect](ctx, ms.MailboxQuery, ms, ms.inters, v)
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (ms *MailboxSelect) ScanX(ctx context.Context, v interface{}) {
|
||||
if err := ms.Scan(ctx, v); err != nil {
|
||||
panic(err)
|
||||
func (ms *MailboxSelect) sqlScan(ctx context.Context, root *MailboxQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(ms.fns))
|
||||
for _, fn := range ms.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
}
|
||||
|
||||
// Strings returns list of strings from a selector. It is only allowed when selecting one field.
|
||||
func (ms *MailboxSelect) Strings(ctx context.Context) ([]string, error) {
|
||||
if len(ms.fields) > 1 {
|
||||
return nil, errors.New("ent: MailboxSelect.Strings is not achievable when selecting more than 1 field")
|
||||
switch n := len(*ms.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
var v []string
|
||||
if err := ms.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// StringsX is like Strings, but panics if an error occurs.
|
||||
func (ms *MailboxSelect) StringsX(ctx context.Context) []string {
|
||||
v, err := ms.Strings(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// String returns a single string from a selector. It is only allowed when selecting one field.
|
||||
func (ms *MailboxSelect) String(ctx context.Context) (_ string, err error) {
|
||||
var v []string
|
||||
if v, err = ms.Strings(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{mailbox.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: MailboxSelect.Strings returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StringX is like String, but panics if an error occurs.
|
||||
func (ms *MailboxSelect) StringX(ctx context.Context) string {
|
||||
v, err := ms.String(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Ints returns list of ints from a selector. It is only allowed when selecting one field.
|
||||
func (ms *MailboxSelect) Ints(ctx context.Context) ([]int, error) {
|
||||
if len(ms.fields) > 1 {
|
||||
return nil, errors.New("ent: MailboxSelect.Ints is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []int
|
||||
if err := ms.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IntsX is like Ints, but panics if an error occurs.
|
||||
func (ms *MailboxSelect) IntsX(ctx context.Context) []int {
|
||||
v, err := ms.Ints(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Int returns a single int from a selector. It is only allowed when selecting one field.
|
||||
func (ms *MailboxSelect) Int(ctx context.Context) (_ int, err error) {
|
||||
var v []int
|
||||
if v, err = ms.Ints(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{mailbox.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: MailboxSelect.Ints returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IntX is like Int, but panics if an error occurs.
|
||||
func (ms *MailboxSelect) IntX(ctx context.Context) int {
|
||||
v, err := ms.Int(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
|
||||
func (ms *MailboxSelect) Float64s(ctx context.Context) ([]float64, error) {
|
||||
if len(ms.fields) > 1 {
|
||||
return nil, errors.New("ent: MailboxSelect.Float64s is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []float64
|
||||
if err := ms.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Float64sX is like Float64s, but panics if an error occurs.
|
||||
func (ms *MailboxSelect) Float64sX(ctx context.Context) []float64 {
|
||||
v, err := ms.Float64s(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
|
||||
func (ms *MailboxSelect) Float64(ctx context.Context) (_ float64, err error) {
|
||||
var v []float64
|
||||
if v, err = ms.Float64s(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{mailbox.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: MailboxSelect.Float64s returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Float64X is like Float64, but panics if an error occurs.
|
||||
func (ms *MailboxSelect) Float64X(ctx context.Context) float64 {
|
||||
v, err := ms.Float64(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bools returns list of bools from a selector. It is only allowed when selecting one field.
|
||||
func (ms *MailboxSelect) Bools(ctx context.Context) ([]bool, error) {
|
||||
if len(ms.fields) > 1 {
|
||||
return nil, errors.New("ent: MailboxSelect.Bools is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []bool
|
||||
if err := ms.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoolsX is like Bools, but panics if an error occurs.
|
||||
func (ms *MailboxSelect) BoolsX(ctx context.Context) []bool {
|
||||
v, err := ms.Bools(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bool returns a single bool from a selector. It is only allowed when selecting one field.
|
||||
func (ms *MailboxSelect) Bool(ctx context.Context) (_ bool, err error) {
|
||||
var v []bool
|
||||
if v, err = ms.Bools(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{mailbox.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: MailboxSelect.Bools returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BoolX is like Bool, but panics if an error occurs.
|
||||
func (ms *MailboxSelect) BoolX(ctx context.Context) bool {
|
||||
v, err := ms.Bool(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func (ms *MailboxSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := ms.sql.Query()
|
||||
query, args := selector.Query()
|
||||
if err := ms.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -35,6 +35,14 @@ func (mu *MailboxUpdate) SetActive(b bool) *MailboxUpdate {
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetNillableActive sets the "active" field if the given value is not nil.
|
||||
func (mu *MailboxUpdate) SetNillableActive(b *bool) *MailboxUpdate {
|
||||
if b != nil {
|
||||
mu.SetActive(*b)
|
||||
}
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetModified sets the "modified" field.
|
||||
func (mu *MailboxUpdate) SetModified(t time.Time) *MailboxUpdate {
|
||||
mu.mutation.SetModified(t)
|
||||
@ -73,6 +81,14 @@ func (mu *MailboxUpdate) SetUsername(s string) *MailboxUpdate {
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetNillableUsername sets the "username" field if the given value is not nil.
|
||||
func (mu *MailboxUpdate) SetNillableUsername(s *string) *MailboxUpdate {
|
||||
if s != nil {
|
||||
mu.SetUsername(*s)
|
||||
}
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetPassword sets the "password" field.
|
||||
func (mu *MailboxUpdate) SetPassword(b []byte) *MailboxUpdate {
|
||||
mu.mutation.SetPassword(b)
|
||||
@ -106,6 +122,14 @@ func (mu *MailboxUpdate) SetQuota(i int64) *MailboxUpdate {
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetNillableQuota sets the "quota" field if the given value is not nil.
|
||||
func (mu *MailboxUpdate) SetNillableQuota(i *int64) *MailboxUpdate {
|
||||
if i != nil {
|
||||
mu.SetQuota(*i)
|
||||
}
|
||||
return mu
|
||||
}
|
||||
|
||||
// AddQuota adds i to the "quota" field.
|
||||
func (mu *MailboxUpdate) AddQuota(i int64) *MailboxUpdate {
|
||||
mu.mutation.AddQuota(i)
|
||||
@ -118,6 +142,14 @@ func (mu *MailboxUpdate) SetLocalPart(s string) *MailboxUpdate {
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetNillableLocalPart sets the "local_part" field if the given value is not nil.
|
||||
func (mu *MailboxUpdate) SetNillableLocalPart(s *string) *MailboxUpdate {
|
||||
if s != nil {
|
||||
mu.SetLocalPart(*s)
|
||||
}
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetHomedir sets the "homedir" field.
|
||||
func (mu *MailboxUpdate) SetHomedir(s string) *MailboxUpdate {
|
||||
mu.mutation.SetHomedir(s)
|
||||
@ -230,35 +262,8 @@ func (mu *MailboxUpdate) ClearDomain() *MailboxUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (mu *MailboxUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
mu.defaults()
|
||||
if len(mu.hooks) == 0 {
|
||||
affected, err = mu.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MailboxMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
mu.mutation = mutation
|
||||
affected, err = mu.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(mu.hooks) - 1; i >= 0; i-- {
|
||||
if mu.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = mu.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, mu.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, mu.sqlSave, mu.mutation, mu.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@ -292,16 +297,7 @@ func (mu *MailboxUpdate) defaults() {
|
||||
}
|
||||
|
||||
func (mu *MailboxUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: mailbox.Table,
|
||||
Columns: mailbox.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(mailbox.Table, mailbox.Columns, sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64))
|
||||
if ps := mu.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@ -310,138 +306,64 @@ func (mu *MailboxUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
}
|
||||
if value, ok := mu.mutation.Active(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: mailbox.FieldActive,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldActive, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := mu.mutation.Modified(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: mailbox.FieldModified,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldModified, field.TypeTime, value)
|
||||
}
|
||||
if mu.mutation.ModifiedCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Column: mailbox.FieldModified,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldModified, field.TypeTime)
|
||||
}
|
||||
if value, ok := mu.mutation.Username(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldUsername,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldUsername, field.TypeString, value)
|
||||
}
|
||||
if value, ok := mu.mutation.Password(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBytes,
|
||||
Value: value,
|
||||
Column: mailbox.FieldPassword,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldPassword, field.TypeBytes, value)
|
||||
}
|
||||
if value, ok := mu.mutation.Name(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldName,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldName, field.TypeString, value)
|
||||
}
|
||||
if mu.mutation.NameCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: mailbox.FieldName,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldName, field.TypeString)
|
||||
}
|
||||
if value, ok := mu.mutation.Quota(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: mailbox.FieldQuota,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := mu.mutation.AddedQuota(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: mailbox.FieldQuota,
|
||||
})
|
||||
_spec.AddField(mailbox.FieldQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := mu.mutation.LocalPart(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldLocalPart,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldLocalPart, field.TypeString, value)
|
||||
}
|
||||
if value, ok := mu.mutation.Homedir(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldHomedir,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldHomedir, field.TypeString, value)
|
||||
}
|
||||
if mu.mutation.HomedirCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: mailbox.FieldHomedir,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldHomedir, field.TypeString)
|
||||
}
|
||||
if value, ok := mu.mutation.Maildir(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldMaildir,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldMaildir, field.TypeString, value)
|
||||
}
|
||||
if mu.mutation.MaildirCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: mailbox.FieldMaildir,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldMaildir, field.TypeString)
|
||||
}
|
||||
if value, ok := mu.mutation.UID(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Value: value,
|
||||
Column: mailbox.FieldUID,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldUID, field.TypeInt32, value)
|
||||
}
|
||||
if value, ok := mu.mutation.AddedUID(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Value: value,
|
||||
Column: mailbox.FieldUID,
|
||||
})
|
||||
_spec.AddField(mailbox.FieldUID, field.TypeInt32, value)
|
||||
}
|
||||
if mu.mutation.UIDCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Column: mailbox.FieldUID,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldUID, field.TypeInt32)
|
||||
}
|
||||
if value, ok := mu.mutation.Gid(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Value: value,
|
||||
Column: mailbox.FieldGid,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldGid, field.TypeInt32, value)
|
||||
}
|
||||
if value, ok := mu.mutation.AddedGid(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Value: value,
|
||||
Column: mailbox.FieldGid,
|
||||
})
|
||||
_spec.AddField(mailbox.FieldGid, field.TypeInt32, value)
|
||||
}
|
||||
if mu.mutation.GidCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Column: mailbox.FieldGid,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldGid, field.TypeInt32)
|
||||
}
|
||||
if mu.mutation.DomainCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@ -451,10 +373,7 @@ func (mu *MailboxUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{mailbox.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -467,10 +386,7 @@ func (mu *MailboxUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{mailbox.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -482,10 +398,11 @@ func (mu *MailboxUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{mailbox.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
mu.mutation.done = true
|
||||
return n, nil
|
||||
}
|
||||
|
||||
@ -503,6 +420,14 @@ func (muo *MailboxUpdateOne) SetActive(b bool) *MailboxUpdateOne {
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetNillableActive sets the "active" field if the given value is not nil.
|
||||
func (muo *MailboxUpdateOne) SetNillableActive(b *bool) *MailboxUpdateOne {
|
||||
if b != nil {
|
||||
muo.SetActive(*b)
|
||||
}
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetModified sets the "modified" field.
|
||||
func (muo *MailboxUpdateOne) SetModified(t time.Time) *MailboxUpdateOne {
|
||||
muo.mutation.SetModified(t)
|
||||
@ -541,6 +466,14 @@ func (muo *MailboxUpdateOne) SetUsername(s string) *MailboxUpdateOne {
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetNillableUsername sets the "username" field if the given value is not nil.
|
||||
func (muo *MailboxUpdateOne) SetNillableUsername(s *string) *MailboxUpdateOne {
|
||||
if s != nil {
|
||||
muo.SetUsername(*s)
|
||||
}
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetPassword sets the "password" field.
|
||||
func (muo *MailboxUpdateOne) SetPassword(b []byte) *MailboxUpdateOne {
|
||||
muo.mutation.SetPassword(b)
|
||||
@ -574,6 +507,14 @@ func (muo *MailboxUpdateOne) SetQuota(i int64) *MailboxUpdateOne {
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetNillableQuota sets the "quota" field if the given value is not nil.
|
||||
func (muo *MailboxUpdateOne) SetNillableQuota(i *int64) *MailboxUpdateOne {
|
||||
if i != nil {
|
||||
muo.SetQuota(*i)
|
||||
}
|
||||
return muo
|
||||
}
|
||||
|
||||
// AddQuota adds i to the "quota" field.
|
||||
func (muo *MailboxUpdateOne) AddQuota(i int64) *MailboxUpdateOne {
|
||||
muo.mutation.AddQuota(i)
|
||||
@ -586,6 +527,14 @@ func (muo *MailboxUpdateOne) SetLocalPart(s string) *MailboxUpdateOne {
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetNillableLocalPart sets the "local_part" field if the given value is not nil.
|
||||
func (muo *MailboxUpdateOne) SetNillableLocalPart(s *string) *MailboxUpdateOne {
|
||||
if s != nil {
|
||||
muo.SetLocalPart(*s)
|
||||
}
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetHomedir sets the "homedir" field.
|
||||
func (muo *MailboxUpdateOne) SetHomedir(s string) *MailboxUpdateOne {
|
||||
muo.mutation.SetHomedir(s)
|
||||
@ -696,6 +645,12 @@ func (muo *MailboxUpdateOne) ClearDomain() *MailboxUpdateOne {
|
||||
return muo
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the MailboxUpdate builder.
|
||||
func (muo *MailboxUpdateOne) Where(ps ...predicate.Mailbox) *MailboxUpdateOne {
|
||||
muo.mutation.Where(ps...)
|
||||
return muo
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (muo *MailboxUpdateOne) Select(field string, fields ...string) *MailboxUpdateOne {
|
||||
@ -705,35 +660,8 @@ func (muo *MailboxUpdateOne) Select(field string, fields ...string) *MailboxUpda
|
||||
|
||||
// Save executes the query and returns the updated Mailbox entity.
|
||||
func (muo *MailboxUpdateOne) Save(ctx context.Context) (*Mailbox, error) {
|
||||
var (
|
||||
err error
|
||||
node *Mailbox
|
||||
)
|
||||
muo.defaults()
|
||||
if len(muo.hooks) == 0 {
|
||||
node, err = muo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MailboxMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
muo.mutation = mutation
|
||||
node, err = muo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(muo.hooks) - 1; i >= 0; i-- {
|
||||
if muo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = muo.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, muo.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
return withHooks(ctx, muo.sqlSave, muo.mutation, muo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@ -767,16 +695,7 @@ func (muo *MailboxUpdateOne) defaults() {
|
||||
}
|
||||
|
||||
func (muo *MailboxUpdateOne) sqlSave(ctx context.Context) (_node *Mailbox, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: mailbox.Table,
|
||||
Columns: mailbox.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: mailbox.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(mailbox.Table, mailbox.Columns, sqlgraph.NewFieldSpec(mailbox.FieldID, field.TypeInt64))
|
||||
id, ok := muo.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Mailbox.id" for update`)}
|
||||
@ -802,138 +721,64 @@ func (muo *MailboxUpdateOne) sqlSave(ctx context.Context) (_node *Mailbox, err e
|
||||
}
|
||||
}
|
||||
if value, ok := muo.mutation.Active(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: mailbox.FieldActive,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldActive, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := muo.mutation.Modified(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: mailbox.FieldModified,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldModified, field.TypeTime, value)
|
||||
}
|
||||
if muo.mutation.ModifiedCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Column: mailbox.FieldModified,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldModified, field.TypeTime)
|
||||
}
|
||||
if value, ok := muo.mutation.Username(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldUsername,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldUsername, field.TypeString, value)
|
||||
}
|
||||
if value, ok := muo.mutation.Password(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBytes,
|
||||
Value: value,
|
||||
Column: mailbox.FieldPassword,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldPassword, field.TypeBytes, value)
|
||||
}
|
||||
if value, ok := muo.mutation.Name(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldName,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldName, field.TypeString, value)
|
||||
}
|
||||
if muo.mutation.NameCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: mailbox.FieldName,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldName, field.TypeString)
|
||||
}
|
||||
if value, ok := muo.mutation.Quota(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: mailbox.FieldQuota,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := muo.mutation.AddedQuota(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Value: value,
|
||||
Column: mailbox.FieldQuota,
|
||||
})
|
||||
_spec.AddField(mailbox.FieldQuota, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := muo.mutation.LocalPart(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldLocalPart,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldLocalPart, field.TypeString, value)
|
||||
}
|
||||
if value, ok := muo.mutation.Homedir(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldHomedir,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldHomedir, field.TypeString, value)
|
||||
}
|
||||
if muo.mutation.HomedirCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: mailbox.FieldHomedir,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldHomedir, field.TypeString)
|
||||
}
|
||||
if value, ok := muo.mutation.Maildir(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: mailbox.FieldMaildir,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldMaildir, field.TypeString, value)
|
||||
}
|
||||
if muo.mutation.MaildirCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: mailbox.FieldMaildir,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldMaildir, field.TypeString)
|
||||
}
|
||||
if value, ok := muo.mutation.UID(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Value: value,
|
||||
Column: mailbox.FieldUID,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldUID, field.TypeInt32, value)
|
||||
}
|
||||
if value, ok := muo.mutation.AddedUID(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Value: value,
|
||||
Column: mailbox.FieldUID,
|
||||
})
|
||||
_spec.AddField(mailbox.FieldUID, field.TypeInt32, value)
|
||||
}
|
||||
if muo.mutation.UIDCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Column: mailbox.FieldUID,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldUID, field.TypeInt32)
|
||||
}
|
||||
if value, ok := muo.mutation.Gid(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Value: value,
|
||||
Column: mailbox.FieldGid,
|
||||
})
|
||||
_spec.SetField(mailbox.FieldGid, field.TypeInt32, value)
|
||||
}
|
||||
if value, ok := muo.mutation.AddedGid(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Value: value,
|
||||
Column: mailbox.FieldGid,
|
||||
})
|
||||
_spec.AddField(mailbox.FieldGid, field.TypeInt32, value)
|
||||
}
|
||||
if muo.mutation.GidCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt32,
|
||||
Column: mailbox.FieldGid,
|
||||
})
|
||||
_spec.ClearField(mailbox.FieldGid, field.TypeInt32)
|
||||
}
|
||||
if muo.mutation.DomainCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@ -943,10 +788,7 @@ func (muo *MailboxUpdateOne) sqlSave(ctx context.Context) (_node *Mailbox, err e
|
||||
Columns: []string{mailbox.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@ -959,10 +801,7 @@ func (muo *MailboxUpdateOne) sqlSave(ctx context.Context) (_node *Mailbox, err e
|
||||
Columns: []string{mailbox.DomainColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt64,
|
||||
Column: domain.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@ -977,9 +816,10 @@ func (muo *MailboxUpdateOne) sqlSave(ctx context.Context) (_node *Mailbox, err e
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{mailbox.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
muo.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package migrate
|
||||
|
||||
@ -28,9 +28,6 @@ var (
|
||||
// and therefore, it's recommended to enable this option to get more
|
||||
// flexibility in the schema changes.
|
||||
WithDropIndex = schema.WithDropIndex
|
||||
// WithFixture sets the foreign-key renaming option to the migration when upgrading
|
||||
// ent from v0.1.0 (issue-#285). Defaults to false.
|
||||
WithFixture = schema.WithFixture
|
||||
// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
|
||||
WithForeignKeys = schema.WithForeignKeys
|
||||
)
|
||||
@ -45,27 +42,23 @@ func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
|
||||
|
||||
// Create creates all schema resources.
|
||||
func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
|
||||
return Create(ctx, s, Tables, opts...)
|
||||
}
|
||||
|
||||
// Create creates all table resources using the given schema driver.
|
||||
func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error {
|
||||
migrate, err := schema.NewMigrate(s.drv, opts...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ent/migrate: %w", err)
|
||||
}
|
||||
return migrate.Create(ctx, Tables...)
|
||||
return migrate.Create(ctx, tables...)
|
||||
}
|
||||
|
||||
// WriteTo writes the schema changes to w instead of running them against the database.
|
||||
//
|
||||
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
|
||||
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
|
||||
drv := &schema.WriteDriver{
|
||||
Writer: w,
|
||||
Driver: s.drv,
|
||||
}
|
||||
migrate, err := schema.NewMigrate(drv, opts...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ent/migrate: %w", err)
|
||||
}
|
||||
return migrate.Create(ctx, Tables...)
|
||||
return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package migrate
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -15,8 +15,8 @@ import (
|
||||
"code.icod.de/postfix/manager/ent/logentry"
|
||||
"code.icod.de/postfix/manager/ent/mailbox"
|
||||
"code.icod.de/postfix/manager/ent/predicate"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -505,11 +505,26 @@ func (m *AccountMutation) Where(ps ...predicate.Account) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the AccountMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *AccountMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Account, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *AccountMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *AccountMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Account).
|
||||
func (m *AccountMutation) Type() string {
|
||||
return m.typ
|
||||
@ -1151,6 +1166,7 @@ func (m *AliasMutation) ResetActive() {
|
||||
// ClearDomain clears the "domain" edge to the Domain entity.
|
||||
func (m *AliasMutation) ClearDomain() {
|
||||
m.cleareddomain = true
|
||||
m.clearedFields[alias.FieldDomainID] = struct{}{}
|
||||
}
|
||||
|
||||
// DomainCleared reports if the "domain" edge to the Domain entity was cleared.
|
||||
@ -1179,11 +1195,26 @@ func (m *AliasMutation) Where(ps ...predicate.Alias) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the AliasMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *AliasMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Alias, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *AliasMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *AliasMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Alias).
|
||||
func (m *AliasMutation) Type() string {
|
||||
return m.typ
|
||||
@ -1406,8 +1437,6 @@ func (m *AliasMutation) RemovedEdges() []string {
|
||||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *AliasMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -2318,11 +2347,26 @@ func (m *DomainMutation) Where(ps ...predicate.Domain) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the DomainMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *DomainMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Domain, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *DomainMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *DomainMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Domain).
|
||||
func (m *DomainMutation) Type() string {
|
||||
return m.typ
|
||||
@ -3172,6 +3216,7 @@ func (m *LogentryMutation) ResetDomainID() {
|
||||
// ClearAccount clears the "account" edge to the Account entity.
|
||||
func (m *LogentryMutation) ClearAccount() {
|
||||
m.clearedaccount = true
|
||||
m.clearedFields[logentry.FieldAccountID] = struct{}{}
|
||||
}
|
||||
|
||||
// AccountCleared reports if the "account" edge to the Account entity was cleared.
|
||||
@ -3198,6 +3243,7 @@ func (m *LogentryMutation) ResetAccount() {
|
||||
// ClearDomain clears the "domain" edge to the Domain entity.
|
||||
func (m *LogentryMutation) ClearDomain() {
|
||||
m.cleareddomain = true
|
||||
m.clearedFields[logentry.FieldDomainID] = struct{}{}
|
||||
}
|
||||
|
||||
// DomainCleared reports if the "domain" edge to the Domain entity was cleared.
|
||||
@ -3226,11 +3272,26 @@ func (m *LogentryMutation) Where(ps ...predicate.Logentry) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the LogentryMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *LogentryMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Logentry, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *LogentryMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *LogentryMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Logentry).
|
||||
func (m *LogentryMutation) Type() string {
|
||||
return m.typ
|
||||
@ -3466,8 +3527,6 @@ func (m *LogentryMutation) RemovedEdges() []string {
|
||||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *LogentryMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -4280,6 +4339,7 @@ func (m *MailboxMutation) ResetGid() {
|
||||
// ClearDomain clears the "domain" edge to the Domain entity.
|
||||
func (m *MailboxMutation) ClearDomain() {
|
||||
m.cleareddomain = true
|
||||
m.clearedFields[mailbox.FieldDomainID] = struct{}{}
|
||||
}
|
||||
|
||||
// DomainCleared reports if the "domain" edge to the Domain entity was cleared.
|
||||
@ -4308,11 +4368,26 @@ func (m *MailboxMutation) Where(ps ...predicate.Mailbox) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the MailboxMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *MailboxMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Mailbox, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *MailboxMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *MailboxMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Mailbox).
|
||||
func (m *MailboxMutation) Type() string {
|
||||
return m.typ
|
||||
@ -4737,8 +4812,6 @@ func (m *MailboxMutation) RemovedEdges() []string {
|
||||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *MailboxMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package predicate
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package runtime
|
||||
|
||||
// The schema-stitching logic is generated in code.icod.de/postfix/manager/ent/runtime.go
|
||||
|
||||
const (
|
||||
Version = "v0.10.1" // Version of ent codegen.
|
||||
Sum = "h1:dM5h4Zk6yHGIgw4dCqVzGw3nWgpGYJiV4/kyHEF6PFo=" // Sum of ent codegen.
|
||||
Version = "v0.14.1" // Version of ent codegen.
|
||||
Sum = "h1:fUERL506Pqr92EPHJqr8EYxbPioflJo6PudkrEA8a/s=" // Sum of ent codegen.
|
||||
)
|
||||
|
42
ent/tx.go
42
ent/tx.go
@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@ -26,12 +26,6 @@ type Tx struct {
|
||||
// lazily loaded.
|
||||
client *Client
|
||||
clientOnce sync.Once
|
||||
|
||||
// completion callbacks.
|
||||
mu sync.Mutex
|
||||
onCommit []CommitHook
|
||||
onRollback []RollbackHook
|
||||
|
||||
// ctx lives for the life of the transaction. It is
|
||||
// the same context used by the underlying connection.
|
||||
ctx context.Context
|
||||
@ -76,9 +70,9 @@ func (tx *Tx) Commit() error {
|
||||
var fn Committer = CommitFunc(func(context.Context, *Tx) error {
|
||||
return txDriver.tx.Commit()
|
||||
})
|
||||
tx.mu.Lock()
|
||||
hooks := append([]CommitHook(nil), tx.onCommit...)
|
||||
tx.mu.Unlock()
|
||||
txDriver.mu.Lock()
|
||||
hooks := append([]CommitHook(nil), txDriver.onCommit...)
|
||||
txDriver.mu.Unlock()
|
||||
for i := len(hooks) - 1; i >= 0; i-- {
|
||||
fn = hooks[i](fn)
|
||||
}
|
||||
@ -87,9 +81,10 @@ func (tx *Tx) Commit() error {
|
||||
|
||||
// OnCommit adds a hook to call on commit.
|
||||
func (tx *Tx) OnCommit(f CommitHook) {
|
||||
tx.mu.Lock()
|
||||
defer tx.mu.Unlock()
|
||||
tx.onCommit = append(tx.onCommit, f)
|
||||
txDriver := tx.config.driver.(*txDriver)
|
||||
txDriver.mu.Lock()
|
||||
txDriver.onCommit = append(txDriver.onCommit, f)
|
||||
txDriver.mu.Unlock()
|
||||
}
|
||||
|
||||
type (
|
||||
@ -131,9 +126,9 @@ func (tx *Tx) Rollback() error {
|
||||
var fn Rollbacker = RollbackFunc(func(context.Context, *Tx) error {
|
||||
return txDriver.tx.Rollback()
|
||||
})
|
||||
tx.mu.Lock()
|
||||
hooks := append([]RollbackHook(nil), tx.onRollback...)
|
||||
tx.mu.Unlock()
|
||||
txDriver.mu.Lock()
|
||||
hooks := append([]RollbackHook(nil), txDriver.onRollback...)
|
||||
txDriver.mu.Unlock()
|
||||
for i := len(hooks) - 1; i >= 0; i-- {
|
||||
fn = hooks[i](fn)
|
||||
}
|
||||
@ -142,9 +137,10 @@ func (tx *Tx) Rollback() error {
|
||||
|
||||
// OnRollback adds a hook to call on rollback.
|
||||
func (tx *Tx) OnRollback(f RollbackHook) {
|
||||
tx.mu.Lock()
|
||||
defer tx.mu.Unlock()
|
||||
tx.onRollback = append(tx.onRollback, f)
|
||||
txDriver := tx.config.driver.(*txDriver)
|
||||
txDriver.mu.Lock()
|
||||
txDriver.onRollback = append(txDriver.onRollback, f)
|
||||
txDriver.mu.Unlock()
|
||||
}
|
||||
|
||||
// Client returns a Client that binds to current transaction.
|
||||
@ -180,6 +176,10 @@ type txDriver struct {
|
||||
drv dialect.Driver
|
||||
// tx is the underlying transaction.
|
||||
tx dialect.Tx
|
||||
// completion hooks.
|
||||
mu sync.Mutex
|
||||
onCommit []CommitHook
|
||||
onRollback []RollbackHook
|
||||
}
|
||||
|
||||
// newTx creates a new transactional driver.
|
||||
@ -210,12 +210,12 @@ func (*txDriver) Commit() error { return nil }
|
||||
func (*txDriver) Rollback() error { return nil }
|
||||
|
||||
// Exec calls tx.Exec.
|
||||
func (tx *txDriver) Exec(ctx context.Context, query string, args, v interface{}) error {
|
||||
func (tx *txDriver) Exec(ctx context.Context, query string, args, v any) error {
|
||||
return tx.tx.Exec(ctx, query, args, v)
|
||||
}
|
||||
|
||||
// Query calls tx.Query.
|
||||
func (tx *txDriver) Query(ctx context.Context, query string, args, v interface{}) error {
|
||||
func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error {
|
||||
return tx.tx.Query(ctx, query, args, v)
|
||||
}
|
||||
|
||||
|
76
go.mod
76
go.mod
@ -1,66 +1,74 @@
|
||||
module code.icod.de/postfix/manager
|
||||
|
||||
go 1.18
|
||||
go 1.23.0
|
||||
|
||||
toolchain go1.23.6
|
||||
|
||||
require (
|
||||
code.icod.de/dalu/ginpongo2 v0.0.0-20221121130103-8abf6c96b7be
|
||||
entgo.io/ent v0.12.4
|
||||
entgo.io/ent v0.14.1
|
||||
github.com/flosch/pongo2/v6 v6.0.0
|
||||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/go-sql-driver/mysql v1.7.1
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/spf13/viper v1.17.0
|
||||
github.com/gin-gonic/gin v1.10.0
|
||||
github.com/go-sql-driver/mysql v1.8.1
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/spf13/viper v1.19.0
|
||||
)
|
||||
|
||||
require (
|
||||
ariga.io/atlas v0.15.0 // indirect
|
||||
ariga.io/atlas v0.30.0 // indirect
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||
github.com/bytedance/sonic v1.10.2 // indirect
|
||||
github.com/bmatcuk/doublestar v1.3.4 // indirect
|
||||
github.com/bytedance/sonic v1.12.8 // indirect
|
||||
github.com/bytedance/sonic/loader v0.2.3 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
|
||||
github.com/chenzhuoyu/iasm v0.9.1 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-openapi/inflect v0.19.0 // indirect
|
||||
github.com/cloudwego/base64x v0.1.5 // indirect
|
||||
github.com/fsnotify/fsnotify v1.8.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
|
||||
github.com/gin-contrib/sse v1.0.0 // indirect
|
||||
github.com/go-openapi/inflect v0.21.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.16.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/go-playground/validator/v10 v10.24.0 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/uuid v1.4.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.19.1 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.23.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/magiconair/properties v1.8.9 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.3.0 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||
github.com/sagikazarmark/locafero v0.7.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spf13/afero v1.10.0 // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/afero v1.12.0 // indirect
|
||||
github.com/spf13/cast v1.7.1 // indirect
|
||||
github.com/spf13/pflag v1.0.6 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||
github.com/zclconf/go-cty v1.14.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
github.com/zclconf/go-cty v1.16.2 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/arch v0.6.0 // indirect
|
||||
golang.org/x/crypto v0.15.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
|
||||
golang.org/x/mod v0.14.0 // indirect
|
||||
golang.org/x/net v0.18.0 // indirect
|
||||
golang.org/x/sys v0.14.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
golang.org/x/arch v0.14.0 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c // indirect
|
||||
golang.org/x/mod v0.23.0 // indirect
|
||||
golang.org/x/net v0.34.0 // indirect
|
||||
golang.org/x/sync v0.11.0 // indirect
|
||||
golang.org/x/sys v0.30.0 // indirect
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
golang.org/x/tools v0.29.0 // indirect
|
||||
google.golang.org/protobuf v1.36.4 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
88
go.sum
88
go.sum
@ -1,5 +1,7 @@
|
||||
ariga.io/atlas v0.15.0 h1:9lwSVcO/D3WgaCzstSGqR1hEDtsGibu6JqUofEI/0sY=
|
||||
ariga.io/atlas v0.15.0/go.mod h1:isZrlzJ5cpoCoKFoY9knZug7Lq4pP1cm8g3XciLZ0Pw=
|
||||
ariga.io/atlas v0.30.0 h1:Tyi4A1LXDp9VB+EO51e8Xacsw31uJge9fr5pmd3TL9U=
|
||||
ariga.io/atlas v0.30.0/go.mod h1:lkLAw/t2/P7g5CFYlYmHvNuShlmGujwm3OGsW00xowI=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
@ -42,6 +44,10 @@ code.icod.de/dalu/ginpongo2 v0.0.0-20221121130103-8abf6c96b7be/go.mod h1:bz+E7Dm
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
entgo.io/ent v0.12.4 h1:LddPnAyxls/O7DTXZvUGDj0NZIdGSu317+aoNLJWbD8=
|
||||
entgo.io/ent v0.12.4/go.mod h1:Y3JVAjtlIk8xVZYSn3t3mf8xlZIn5SAOXZQxD6kKI+Q=
|
||||
entgo.io/ent v0.14.1 h1:fUERL506Pqr92EPHJqr8EYxbPioflJo6PudkrEA8a/s=
|
||||
entgo.io/ent v0.14.1/go.mod h1:MH6XLG0KXpkcDQhKiHfANZSzR55TJyPL5IGNpI8wpco=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
|
||||
@ -49,10 +55,17 @@ github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7l
|
||||
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
|
||||
github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0=
|
||||
github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
|
||||
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
|
||||
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
|
||||
github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE=
|
||||
github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=
|
||||
github.com/bytedance/sonic v1.12.8 h1:4xYRVRlXIgvSZ4e8iVTlMF5szgpXd4AfvuWgA8I8lgs=
|
||||
github.com/bytedance/sonic v1.12.8/go.mod h1:uVvFidNmlt9+wa31S1urfwwthTWteBgG0hWuoKAXTx8=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/bytedance/sonic/loader v0.2.3 h1:yctD0Q3v2NOGfSWPLPvG2ggA2kV6TS6s4wioyEqssH0=
|
||||
github.com/bytedance/sonic/loader v0.2.3/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
|
||||
@ -65,10 +78,14 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
|
||||
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@ -79,6 +96,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
|
||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3 h1:fmFk0Wt3bBxxwZnu48jqMdaOR/IZ4vdtJFuaFV8MpIE=
|
||||
github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3/go.mod h1:bJWSKrZyQvfTnb2OudyUjurSG4/edverV7n82+K3JiM=
|
||||
github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8=
|
||||
github.com/flosch/pongo2/v5 v5.0.0/go.mod h1:6ysKu++8ANFXmc3x6uA6iVaS+PKUoDfdX3yPcv8TIzY=
|
||||
@ -87,18 +105,28 @@ github.com/flosch/pongo2/v6 v6.0.0/go.mod h1:CuDpFm47R0uGGE7z13/tTlt1Y6zdxvr2RLT
|
||||
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
|
||||
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
|
||||
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=
|
||||
github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=
|
||||
github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
|
||||
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
|
||||
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
||||
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
|
||||
github.com/go-openapi/inflect v0.21.0 h1:FoBjBTQEcbg2cJUWX6uwL9OyIW8eqc9k4KhN4lfbeYk=
|
||||
github.com/go-openapi/inflect v0.21.0/go.mod h1:INezMuUu7SJQc2AyR3WO0DqqYUJSj8Kb4hBd7WtjlAw=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
|
||||
@ -110,13 +138,19 @@ github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91
|
||||
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
|
||||
github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE=
|
||||
github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/go-playground/validator/v10 v10.24.0 h1:KHQckvo8G6hlWnrPX4NJJ+aBfWNAE/HH+qdL2cBpCmg=
|
||||
github.com/go-playground/validator/v10 v10.24.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
|
||||
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
|
||||
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
||||
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
@ -175,6 +209,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
||||
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||
@ -184,6 +220,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI=
|
||||
github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE=
|
||||
github.com/hashicorp/hcl/v2 v2.23.0 h1:Fphj1/gCylPxHutVSEOf2fBOh1VE4AuLV7+kbJf3qos=
|
||||
github.com/hashicorp/hcl/v2 v2.23.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
@ -196,6 +234,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc=
|
||||
github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY=
|
||||
github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
@ -210,11 +250,17 @@ github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3v
|
||||
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
|
||||
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
||||
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM=
|
||||
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
||||
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
||||
@ -226,10 +272,14 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
|
||||
github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
|
||||
@ -243,6 +293,8 @@ github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZV
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ=
|
||||
github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U=
|
||||
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
|
||||
github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||
@ -250,17 +302,28 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS
|
||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY=
|
||||
github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
|
||||
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
|
||||
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
|
||||
github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
|
||||
github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
|
||||
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
|
||||
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
|
||||
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
|
||||
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI=
|
||||
github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI=
|
||||
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
|
||||
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
@ -272,6 +335,7 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
@ -280,12 +344,16 @@ github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6
|
||||
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
|
||||
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
|
||||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA=
|
||||
github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
|
||||
github.com/zclconf/go-cty v1.16.2 h1:LAJSwc3v81IRBZyUVQDUdZ7hs3SYs9jv0eZJDWHD/70=
|
||||
github.com/zclconf/go-cty v1.16.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
@ -297,6 +365,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.6.0 h1:S0JTfE48HbRj80+4tbvZDYsJ3tGv6BUU3XxyZ7CirAc=
|
||||
golang.org/x/arch v0.6.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/arch v0.14.0 h1:z9JUEZWr8x4rR0OU6c4/4t6E6jOZ8/QBS2bBYBm4tx4=
|
||||
golang.org/x/arch v0.14.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
@ -307,6 +377,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
|
||||
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
|
||||
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
@ -319,6 +391,8 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
|
||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
|
||||
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c h1:KL/ZBHXgKGVmuZBZ01Lt57yE5ws8ZPSkkihmEyq7FXc=
|
||||
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
@ -344,6 +418,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
|
||||
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
|
||||
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@ -378,6 +454,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
|
||||
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
|
||||
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@ -397,6 +475,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
|
||||
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@ -438,6 +518,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
|
||||
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -449,6 +531,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@ -499,6 +583,8 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f
|
||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
|
||||
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@ -596,6 +682,8 @@ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM=
|
||||
google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
Loading…
x
Reference in New Issue
Block a user