forked from ALHP/ALHP.GO
updated deps + regen ent
This commit is contained in:
@@ -212,6 +212,7 @@ func (c *DbPackageClient) DeleteOneID(id int) *DbPackageDeleteOne {
|
||||
func (c *DbPackageClient) Query() *DbPackageQuery {
|
||||
return &DbPackageQuery{
|
||||
config: c.config,
|
||||
ctx: &QueryContext{Type: TypeDbPackage},
|
||||
inters: c.Interceptors(),
|
||||
}
|
||||
}
|
||||
|
@@ -254,7 +254,7 @@ func (dp *DbPackage) assignValues(columns []string, values []any) error {
|
||||
// Note that you need to call DbPackage.Unwrap() before calling this method if this DbPackage
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (dp *DbPackage) Update() *DbPackageUpdateOne {
|
||||
return (&DbPackageClient{config: dp.config}).UpdateOne(dp)
|
||||
return NewDbPackageClient(dp.config).UpdateOne(dp)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the DbPackage entity that was returned from a transaction after it was closed,
|
||||
|
@@ -17,11 +17,8 @@ import (
|
||||
// DbPackageQuery is the builder for querying DbPackage entities.
|
||||
type DbPackageQuery struct {
|
||||
config
|
||||
limit *int
|
||||
offset *int
|
||||
unique *bool
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
fields []string
|
||||
inters []Interceptor
|
||||
predicates []predicate.DbPackage
|
||||
modifiers []func(*sql.Selector)
|
||||
@@ -38,20 +35,20 @@ func (dpq *DbPackageQuery) Where(ps ...predicate.DbPackage) *DbPackageQuery {
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (dpq *DbPackageQuery) Limit(limit int) *DbPackageQuery {
|
||||
dpq.limit = &limit
|
||||
dpq.ctx.Limit = &limit
|
||||
return dpq
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (dpq *DbPackageQuery) Offset(offset int) *DbPackageQuery {
|
||||
dpq.offset = &offset
|
||||
dpq.ctx.Offset = &offset
|
||||
return dpq
|
||||
}
|
||||
|
||||
// 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 (dpq *DbPackageQuery) Unique(unique bool) *DbPackageQuery {
|
||||
dpq.unique = &unique
|
||||
dpq.ctx.Unique = &unique
|
||||
return dpq
|
||||
}
|
||||
|
||||
@@ -64,7 +61,7 @@ func (dpq *DbPackageQuery) Order(o ...OrderFunc) *DbPackageQuery {
|
||||
// First returns the first DbPackage entity from the query.
|
||||
// Returns a *NotFoundError when no DbPackage was found.
|
||||
func (dpq *DbPackageQuery) First(ctx context.Context) (*DbPackage, error) {
|
||||
nodes, err := dpq.Limit(1).All(newQueryContext(ctx, TypeDbPackage, "First"))
|
||||
nodes, err := dpq.Limit(1).All(setContextOp(ctx, dpq.ctx, "First"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -87,7 +84,7 @@ func (dpq *DbPackageQuery) FirstX(ctx context.Context) *DbPackage {
|
||||
// Returns a *NotFoundError when no DbPackage ID was found.
|
||||
func (dpq *DbPackageQuery) FirstID(ctx context.Context) (id int, err error) {
|
||||
var ids []int
|
||||
if ids, err = dpq.Limit(1).IDs(newQueryContext(ctx, TypeDbPackage, "FirstID")); err != nil {
|
||||
if ids, err = dpq.Limit(1).IDs(setContextOp(ctx, dpq.ctx, "FirstID")); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
@@ -110,7 +107,7 @@ func (dpq *DbPackageQuery) FirstIDX(ctx context.Context) int {
|
||||
// Returns a *NotSingularError when more than one DbPackage entity is found.
|
||||
// Returns a *NotFoundError when no DbPackage entities are found.
|
||||
func (dpq *DbPackageQuery) Only(ctx context.Context) (*DbPackage, error) {
|
||||
nodes, err := dpq.Limit(2).All(newQueryContext(ctx, TypeDbPackage, "Only"))
|
||||
nodes, err := dpq.Limit(2).All(setContextOp(ctx, dpq.ctx, "Only"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -138,7 +135,7 @@ func (dpq *DbPackageQuery) OnlyX(ctx context.Context) *DbPackage {
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (dpq *DbPackageQuery) OnlyID(ctx context.Context) (id int, err error) {
|
||||
var ids []int
|
||||
if ids, err = dpq.Limit(2).IDs(newQueryContext(ctx, TypeDbPackage, "OnlyID")); err != nil {
|
||||
if ids, err = dpq.Limit(2).IDs(setContextOp(ctx, dpq.ctx, "OnlyID")); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
@@ -163,7 +160,7 @@ func (dpq *DbPackageQuery) OnlyIDX(ctx context.Context) int {
|
||||
|
||||
// All executes the query and returns a list of DbPackages.
|
||||
func (dpq *DbPackageQuery) All(ctx context.Context) ([]*DbPackage, error) {
|
||||
ctx = newQueryContext(ctx, TypeDbPackage, "All")
|
||||
ctx = setContextOp(ctx, dpq.ctx, "All")
|
||||
if err := dpq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -183,7 +180,7 @@ func (dpq *DbPackageQuery) AllX(ctx context.Context) []*DbPackage {
|
||||
// IDs executes the query and returns a list of DbPackage IDs.
|
||||
func (dpq *DbPackageQuery) IDs(ctx context.Context) ([]int, error) {
|
||||
var ids []int
|
||||
ctx = newQueryContext(ctx, TypeDbPackage, "IDs")
|
||||
ctx = setContextOp(ctx, dpq.ctx, "IDs")
|
||||
if err := dpq.Select(dbpackage.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -201,7 +198,7 @@ func (dpq *DbPackageQuery) IDsX(ctx context.Context) []int {
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (dpq *DbPackageQuery) Count(ctx context.Context) (int, error) {
|
||||
ctx = newQueryContext(ctx, TypeDbPackage, "Count")
|
||||
ctx = setContextOp(ctx, dpq.ctx, "Count")
|
||||
if err := dpq.prepareQuery(ctx); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -219,7 +216,7 @@ func (dpq *DbPackageQuery) CountX(ctx context.Context) int {
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (dpq *DbPackageQuery) Exist(ctx context.Context) (bool, error) {
|
||||
ctx = newQueryContext(ctx, TypeDbPackage, "Exist")
|
||||
ctx = setContextOp(ctx, dpq.ctx, "Exist")
|
||||
switch _, err := dpq.FirstID(ctx); {
|
||||
case IsNotFound(err):
|
||||
return false, nil
|
||||
@@ -247,15 +244,13 @@ func (dpq *DbPackageQuery) Clone() *DbPackageQuery {
|
||||
}
|
||||
return &DbPackageQuery{
|
||||
config: dpq.config,
|
||||
limit: dpq.limit,
|
||||
offset: dpq.offset,
|
||||
ctx: dpq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, dpq.order...),
|
||||
inters: append([]Interceptor{}, dpq.inters...),
|
||||
predicates: append([]predicate.DbPackage{}, dpq.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: dpq.sql.Clone(),
|
||||
path: dpq.path,
|
||||
unique: dpq.unique,
|
||||
sql: dpq.sql.Clone(),
|
||||
path: dpq.path,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,9 +269,9 @@ func (dpq *DbPackageQuery) Clone() *DbPackageQuery {
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (dpq *DbPackageQuery) GroupBy(field string, fields ...string) *DbPackageGroupBy {
|
||||
dpq.fields = append([]string{field}, fields...)
|
||||
dpq.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &DbPackageGroupBy{build: dpq}
|
||||
grbuild.flds = &dpq.fields
|
||||
grbuild.flds = &dpq.ctx.Fields
|
||||
grbuild.label = dbpackage.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
@@ -295,10 +290,10 @@ func (dpq *DbPackageQuery) GroupBy(field string, fields ...string) *DbPackageGro
|
||||
// Select(dbpackage.FieldPkgbase).
|
||||
// Scan(ctx, &v)
|
||||
func (dpq *DbPackageQuery) Select(fields ...string) *DbPackageSelect {
|
||||
dpq.fields = append(dpq.fields, fields...)
|
||||
dpq.ctx.Fields = append(dpq.ctx.Fields, fields...)
|
||||
sbuild := &DbPackageSelect{DbPackageQuery: dpq}
|
||||
sbuild.label = dbpackage.Label
|
||||
sbuild.flds, sbuild.scan = &dpq.fields, sbuild.Scan
|
||||
sbuild.flds, sbuild.scan = &dpq.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
@@ -318,7 +313,7 @@ func (dpq *DbPackageQuery) prepareQuery(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range dpq.fields {
|
||||
for _, f := range dpq.ctx.Fields {
|
||||
if !dbpackage.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
@@ -366,9 +361,9 @@ func (dpq *DbPackageQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
if len(dpq.modifiers) > 0 {
|
||||
_spec.Modifiers = dpq.modifiers
|
||||
}
|
||||
_spec.Node.Columns = dpq.fields
|
||||
if len(dpq.fields) > 0 {
|
||||
_spec.Unique = dpq.unique != nil && *dpq.unique
|
||||
_spec.Node.Columns = dpq.ctx.Fields
|
||||
if len(dpq.ctx.Fields) > 0 {
|
||||
_spec.Unique = dpq.ctx.Unique != nil && *dpq.ctx.Unique
|
||||
}
|
||||
return sqlgraph.CountNodes(ctx, dpq.driver, _spec)
|
||||
}
|
||||
@@ -386,10 +381,10 @@ func (dpq *DbPackageQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
From: dpq.sql,
|
||||
Unique: true,
|
||||
}
|
||||
if unique := dpq.unique; unique != nil {
|
||||
if unique := dpq.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
}
|
||||
if fields := dpq.fields; len(fields) > 0 {
|
||||
if fields := dpq.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, dbpackage.FieldID)
|
||||
for i := range fields {
|
||||
@@ -405,10 +400,10 @@ func (dpq *DbPackageQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := dpq.limit; limit != nil {
|
||||
if limit := dpq.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := dpq.offset; offset != nil {
|
||||
if offset := dpq.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := dpq.order; len(ps) > 0 {
|
||||
@@ -424,7 +419,7 @@ func (dpq *DbPackageQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
func (dpq *DbPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(dpq.driver.Dialect())
|
||||
t1 := builder.Table(dbpackage.Table)
|
||||
columns := dpq.fields
|
||||
columns := dpq.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = dbpackage.Columns
|
||||
}
|
||||
@@ -433,7 +428,7 @@ func (dpq *DbPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
selector = dpq.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if dpq.unique != nil && *dpq.unique {
|
||||
if dpq.ctx.Unique != nil && *dpq.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, m := range dpq.modifiers {
|
||||
@@ -445,12 +440,12 @@ func (dpq *DbPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
for _, p := range dpq.order {
|
||||
p(selector)
|
||||
}
|
||||
if offset := dpq.offset; offset != nil {
|
||||
if offset := dpq.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 := dpq.limit; limit != nil {
|
||||
if limit := dpq.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
@@ -476,7 +471,7 @@ func (dpgb *DbPackageGroupBy) Aggregate(fns ...AggregateFunc) *DbPackageGroupBy
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (dpgb *DbPackageGroupBy) Scan(ctx context.Context, v any) error {
|
||||
ctx = newQueryContext(ctx, TypeDbPackage, "GroupBy")
|
||||
ctx = setContextOp(ctx, dpgb.build.ctx, "GroupBy")
|
||||
if err := dpgb.build.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -524,7 +519,7 @@ func (dps *DbPackageSelect) Aggregate(fns ...AggregateFunc) *DbPackageSelect {
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (dps *DbPackageSelect) Scan(ctx context.Context, v any) error {
|
||||
ctx = newQueryContext(ctx, TypeDbPackage, "Select")
|
||||
ctx = setContextOp(ctx, dps.ctx, "Select")
|
||||
if err := dps.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ type (
|
||||
Hook = ent.Hook
|
||||
Value = ent.Value
|
||||
Query = ent.Query
|
||||
QueryContext = ent.QueryContext
|
||||
Querier = ent.Querier
|
||||
QuerierFunc = ent.QuerierFunc
|
||||
Interceptor = ent.Interceptor
|
||||
@@ -503,10 +504,11 @@ func withHooks[V Value, M any, PM interface {
|
||||
return nv, nil
|
||||
}
|
||||
|
||||
// newQueryContext returns a new context with the given QueryContext attached in case it does not exist.
|
||||
func newQueryContext(ctx context.Context, typ, op string) context.Context {
|
||||
// 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 {
|
||||
ctx = ent.NewQueryContext(ctx, &ent.QueryContext{Type: typ, Op: op})
|
||||
qc.Op = op
|
||||
ctx = ent.NewQueryContext(ctx, qc)
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
@@ -5,6 +5,6 @@ package runtime
|
||||
// The schema-stitching logic is generated in git.harting.dev/ALHP/ALHP.GO/ent/runtime.go
|
||||
|
||||
const (
|
||||
Version = "v0.11.5" // Version of ent codegen.
|
||||
Sum = "h1:V2qhG91C4PMQTa82Q4StoESMQ4dzkMNeStCzszxi0jQ=" // Sum of ent codegen.
|
||||
Version = "v0.11.6" // Version of ent codegen.
|
||||
Sum = "h1:fMQwhuzbPv12AXdrAGyHoOcgh9r0D9F8WEsCRoUWxVc=" // Sum of ent codegen.
|
||||
)
|
||||
|
4
go.mod
4
go.mod
@@ -3,7 +3,7 @@ module git.harting.dev/ALHP/ALHP.GO
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
entgo.io/ent v0.11.5
|
||||
entgo.io/ent v0.11.6
|
||||
github.com/Jguer/go-alpm/v2 v2.1.2
|
||||
github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5
|
||||
github.com/Morganamilo/go-srcinfo v1.0.0
|
||||
@@ -19,7 +19,7 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
ariga.io/atlas v0.9.0 // indirect
|
||||
ariga.io/atlas v0.9.1-0.20230119123307-a3ab6808892b // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
|
||||
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
|
||||
|
6
go.sum
6
go.sum
@@ -1,7 +1,11 @@
|
||||
ariga.io/atlas v0.9.0 h1:q0JMtqyA3X1YWtPcn+E/kVPwLDslb+jAC8Ejl/vW6d0=
|
||||
ariga.io/atlas v0.9.0/go.mod h1:T230JFcENj4ZZzMkZrXFDSkv+2kXkUgpJ5FQQ5hMcKU=
|
||||
ariga.io/atlas v0.9.1-0.20230119123307-a3ab6808892b h1:f1868Z/5iWzfVMgjOBwjjP/mRCxOSbXtAl+9DAYb4kg=
|
||||
ariga.io/atlas v0.9.1-0.20230119123307-a3ab6808892b/go.mod h1:T230JFcENj4ZZzMkZrXFDSkv+2kXkUgpJ5FQQ5hMcKU=
|
||||
entgo.io/ent v0.11.5 h1:V2qhG91C4PMQTa82Q4StoESMQ4dzkMNeStCzszxi0jQ=
|
||||
entgo.io/ent v0.11.5/go.mod h1:u7eKwNWAo/VlHIKxgwbmsFy3J7cKDxwi3jyF5TW/okY=
|
||||
entgo.io/ent v0.11.6 h1:fMQwhuzbPv12AXdrAGyHoOcgh9r0D9F8WEsCRoUWxVc=
|
||||
entgo.io/ent v0.11.6/go.mod h1:d4yUWiwY3NQtjGvINzAhUyypopfeEKOxcxLN7D5yM7o=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
|
||||
github.com/Jguer/go-alpm/v2 v2.1.2 h1:CGTIxzuEpT9Q3a7IBrx0E6acoYoaHX2Z93UOApPDhgU=
|
||||
@@ -41,6 +45,7 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/hashicorp/hcl/v2 v2.15.0 h1:CPDXO6+uORPjKflkWCCwoWc9uRp+zSIPcCQ+BrxV7m8=
|
||||
github.com/hashicorp/hcl/v2 v2.15.0/go.mod h1:JRmR89jycNkrrqnMmvPDMd56n1rQJ2Q6KocSLCMCXng=
|
||||
github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
|
||||
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
|
||||
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
|
||||
@@ -61,6 +66,7 @@ github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5W
|
||||
github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
|
||||
github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
|
||||
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
|
||||
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
|
||||
|
Reference in New Issue
Block a user