forked from ALHP/ALHP.GO
Git-based package source layout (#193)
Co-authored-by: Giovanni Harting <539@idlegandalf.com> Reviewed-on: ALHP/ALHP.GO#193
This commit is contained in:
124
ent/client.go
124
ent/client.go
@@ -21,8 +21,8 @@ type Client struct {
|
||||
config
|
||||
// Schema is the client for creating, migrating and dropping schema.
|
||||
Schema *migrate.Schema
|
||||
// DbPackage is the client for interacting with the DbPackage builders.
|
||||
DbPackage *DbPackageClient
|
||||
// DBPackage is the client for interacting with the DBPackage builders.
|
||||
DBPackage *DBPackageClient
|
||||
}
|
||||
|
||||
// NewClient creates a new client configured with the given options.
|
||||
@@ -36,7 +36,7 @@ func NewClient(opts ...Option) *Client {
|
||||
|
||||
func (c *Client) init() {
|
||||
c.Schema = migrate.NewSchema(c.driver)
|
||||
c.DbPackage = NewDbPackageClient(c.config)
|
||||
c.DBPackage = NewDBPackageClient(c.config)
|
||||
}
|
||||
|
||||
type (
|
||||
@@ -119,7 +119,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
|
||||
return &Tx{
|
||||
ctx: ctx,
|
||||
config: cfg,
|
||||
DbPackage: NewDbPackageClient(cfg),
|
||||
DBPackage: NewDBPackageClient(cfg),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -139,14 +139,14 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
|
||||
return &Tx{
|
||||
ctx: ctx,
|
||||
config: cfg,
|
||||
DbPackage: NewDbPackageClient(cfg),
|
||||
DBPackage: NewDBPackageClient(cfg),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Debug returns a new debug-client. It's used to get verbose logging on specific operations.
|
||||
//
|
||||
// client.Debug().
|
||||
// DbPackage.
|
||||
// DBPackage.
|
||||
// Query().
|
||||
// Count(ctx)
|
||||
func (c *Client) Debug() *Client {
|
||||
@@ -168,111 +168,111 @@ func (c *Client) Close() error {
|
||||
// Use adds the mutation hooks to all the entity clients.
|
||||
// In order to add hooks to a specific client, call: `client.Node.Use(...)`.
|
||||
func (c *Client) Use(hooks ...Hook) {
|
||||
c.DbPackage.Use(hooks...)
|
||||
c.DBPackage.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.DbPackage.Intercept(interceptors...)
|
||||
c.DBPackage.Intercept(interceptors...)
|
||||
}
|
||||
|
||||
// Mutate implements the ent.Mutator interface.
|
||||
func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
|
||||
switch m := m.(type) {
|
||||
case *DbPackageMutation:
|
||||
return c.DbPackage.mutate(ctx, m)
|
||||
case *DBPackageMutation:
|
||||
return c.DBPackage.mutate(ctx, m)
|
||||
default:
|
||||
return nil, fmt.Errorf("ent: unknown mutation type %T", m)
|
||||
}
|
||||
}
|
||||
|
||||
// DbPackageClient is a client for the DbPackage schema.
|
||||
type DbPackageClient struct {
|
||||
// DBPackageClient is a client for the DBPackage schema.
|
||||
type DBPackageClient struct {
|
||||
config
|
||||
}
|
||||
|
||||
// NewDbPackageClient returns a client for the DbPackage from the given config.
|
||||
func NewDbPackageClient(c config) *DbPackageClient {
|
||||
return &DbPackageClient{config: c}
|
||||
// NewDBPackageClient returns a client for the DBPackage from the given config.
|
||||
func NewDBPackageClient(c config) *DBPackageClient {
|
||||
return &DBPackageClient{config: c}
|
||||
}
|
||||
|
||||
// Use adds a list of mutation hooks to the hooks stack.
|
||||
// A call to `Use(f, g, h)` equals to `dbpackage.Hooks(f(g(h())))`.
|
||||
func (c *DbPackageClient) Use(hooks ...Hook) {
|
||||
c.hooks.DbPackage = append(c.hooks.DbPackage, hooks...)
|
||||
func (c *DBPackageClient) Use(hooks ...Hook) {
|
||||
c.hooks.DBPackage = append(c.hooks.DBPackage, hooks...)
|
||||
}
|
||||
|
||||
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||
// A call to `Intercept(f, g, h)` equals to `dbpackage.Intercept(f(g(h())))`.
|
||||
func (c *DbPackageClient) Intercept(interceptors ...Interceptor) {
|
||||
c.inters.DbPackage = append(c.inters.DbPackage, interceptors...)
|
||||
func (c *DBPackageClient) Intercept(interceptors ...Interceptor) {
|
||||
c.inters.DBPackage = append(c.inters.DBPackage, interceptors...)
|
||||
}
|
||||
|
||||
// Create returns a builder for creating a DbPackage entity.
|
||||
func (c *DbPackageClient) Create() *DbPackageCreate {
|
||||
mutation := newDbPackageMutation(c.config, OpCreate)
|
||||
return &DbPackageCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
// Create returns a builder for creating a DBPackage entity.
|
||||
func (c *DBPackageClient) Create() *DBPackageCreate {
|
||||
mutation := newDBPackageMutation(c.config, OpCreate)
|
||||
return &DBPackageCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// CreateBulk returns a builder for creating a bulk of DbPackage entities.
|
||||
func (c *DbPackageClient) CreateBulk(builders ...*DbPackageCreate) *DbPackageCreateBulk {
|
||||
return &DbPackageCreateBulk{config: c.config, builders: builders}
|
||||
// CreateBulk returns a builder for creating a bulk of DBPackage entities.
|
||||
func (c *DBPackageClient) CreateBulk(builders ...*DBPackageCreate) *DBPackageCreateBulk {
|
||||
return &DBPackageCreateBulk{config: c.config, builders: builders}
|
||||
}
|
||||
|
||||
// Update returns an update builder for DbPackage.
|
||||
func (c *DbPackageClient) Update() *DbPackageUpdate {
|
||||
mutation := newDbPackageMutation(c.config, OpUpdate)
|
||||
return &DbPackageUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
// Update returns an update builder for DBPackage.
|
||||
func (c *DBPackageClient) Update() *DBPackageUpdate {
|
||||
mutation := newDBPackageMutation(c.config, OpUpdate)
|
||||
return &DBPackageUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// UpdateOne returns an update builder for the given entity.
|
||||
func (c *DbPackageClient) UpdateOne(dp *DbPackage) *DbPackageUpdateOne {
|
||||
mutation := newDbPackageMutation(c.config, OpUpdateOne, withDbPackage(dp))
|
||||
return &DbPackageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
func (c *DBPackageClient) UpdateOne(dp *DBPackage) *DBPackageUpdateOne {
|
||||
mutation := newDBPackageMutation(c.config, OpUpdateOne, withDBPackage(dp))
|
||||
return &DBPackageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// UpdateOneID returns an update builder for the given id.
|
||||
func (c *DbPackageClient) UpdateOneID(id int) *DbPackageUpdateOne {
|
||||
mutation := newDbPackageMutation(c.config, OpUpdateOne, withDbPackageID(id))
|
||||
return &DbPackageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
func (c *DBPackageClient) UpdateOneID(id int) *DBPackageUpdateOne {
|
||||
mutation := newDBPackageMutation(c.config, OpUpdateOne, withDBPackageID(id))
|
||||
return &DBPackageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// Delete returns a delete builder for DbPackage.
|
||||
func (c *DbPackageClient) Delete() *DbPackageDelete {
|
||||
mutation := newDbPackageMutation(c.config, OpDelete)
|
||||
return &DbPackageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
// Delete returns a delete builder for DBPackage.
|
||||
func (c *DBPackageClient) Delete() *DBPackageDelete {
|
||||
mutation := newDBPackageMutation(c.config, OpDelete)
|
||||
return &DBPackageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||
}
|
||||
|
||||
// DeleteOne returns a builder for deleting the given entity.
|
||||
func (c *DbPackageClient) DeleteOne(dp *DbPackage) *DbPackageDeleteOne {
|
||||
func (c *DBPackageClient) DeleteOne(dp *DBPackage) *DBPackageDeleteOne {
|
||||
return c.DeleteOneID(dp.ID)
|
||||
}
|
||||
|
||||
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||
func (c *DbPackageClient) DeleteOneID(id int) *DbPackageDeleteOne {
|
||||
func (c *DBPackageClient) DeleteOneID(id int) *DBPackageDeleteOne {
|
||||
builder := c.Delete().Where(dbpackage.ID(id))
|
||||
builder.mutation.id = &id
|
||||
builder.mutation.op = OpDeleteOne
|
||||
return &DbPackageDeleteOne{builder}
|
||||
return &DBPackageDeleteOne{builder}
|
||||
}
|
||||
|
||||
// Query returns a query builder for DbPackage.
|
||||
func (c *DbPackageClient) Query() *DbPackageQuery {
|
||||
return &DbPackageQuery{
|
||||
// Query returns a query builder for DBPackage.
|
||||
func (c *DBPackageClient) Query() *DBPackageQuery {
|
||||
return &DBPackageQuery{
|
||||
config: c.config,
|
||||
ctx: &QueryContext{Type: TypeDbPackage},
|
||||
ctx: &QueryContext{Type: TypeDBPackage},
|
||||
inters: c.Interceptors(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get returns a DbPackage entity by its id.
|
||||
func (c *DbPackageClient) Get(ctx context.Context, id int) (*DbPackage, error) {
|
||||
// Get returns a DBPackage entity by its id.
|
||||
func (c *DBPackageClient) Get(ctx context.Context, id int) (*DBPackage, error) {
|
||||
return c.Query().Where(dbpackage.ID(id)).Only(ctx)
|
||||
}
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *DbPackageClient) GetX(ctx context.Context, id int) *DbPackage {
|
||||
func (c *DBPackageClient) GetX(ctx context.Context, id int) *DBPackage {
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -281,36 +281,36 @@ func (c *DbPackageClient) GetX(ctx context.Context, id int) *DbPackage {
|
||||
}
|
||||
|
||||
// Hooks returns the client hooks.
|
||||
func (c *DbPackageClient) Hooks() []Hook {
|
||||
return c.hooks.DbPackage
|
||||
func (c *DBPackageClient) Hooks() []Hook {
|
||||
return c.hooks.DBPackage
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
func (c *DbPackageClient) Interceptors() []Interceptor {
|
||||
return c.inters.DbPackage
|
||||
func (c *DBPackageClient) Interceptors() []Interceptor {
|
||||
return c.inters.DBPackage
|
||||
}
|
||||
|
||||
func (c *DbPackageClient) mutate(ctx context.Context, m *DbPackageMutation) (Value, error) {
|
||||
func (c *DBPackageClient) mutate(ctx context.Context, m *DBPackageMutation) (Value, error) {
|
||||
switch m.Op() {
|
||||
case OpCreate:
|
||||
return (&DbPackageCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
return (&DBPackageCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdate:
|
||||
return (&DbPackageUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
return (&DBPackageUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpUpdateOne:
|
||||
return (&DbPackageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
return (&DBPackageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||
case OpDelete, OpDeleteOne:
|
||||
return (&DbPackageDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||
return (&DBPackageDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||
default:
|
||||
return nil, fmt.Errorf("ent: unknown DbPackage mutation op: %q", m.Op())
|
||||
return nil, fmt.Errorf("ent: unknown DBPackage mutation op: %q", m.Op())
|
||||
}
|
||||
}
|
||||
|
||||
// hooks and interceptors per client, for fast access.
|
||||
type (
|
||||
hooks struct {
|
||||
DbPackage []ent.Hook
|
||||
DBPackage []ent.Hook
|
||||
}
|
||||
inters struct {
|
||||
DbPackage []ent.Interceptor
|
||||
DBPackage []ent.Interceptor
|
||||
}
|
||||
)
|
||||
|
@@ -13,8 +13,8 @@ import (
|
||||
"somegit.dev/ALHP/ALHP.GO/ent/dbpackage"
|
||||
)
|
||||
|
||||
// DbPackage is the model entity for the DbPackage schema.
|
||||
type DbPackage struct {
|
||||
// DBPackage is the model entity for the DBPackage schema.
|
||||
type DBPackage struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
@@ -38,8 +38,6 @@ type DbPackage struct {
|
||||
BuildTimeStart time.Time `json:"build_time_start,omitempty"`
|
||||
// Updated holds the value of the "updated" field.
|
||||
Updated time.Time `json:"updated,omitempty"`
|
||||
// Hash holds the value of the "hash" field.
|
||||
Hash string `json:"hash,omitempty"`
|
||||
// Lto holds the value of the "lto" field.
|
||||
Lto dbpackage.Lto `json:"lto,omitempty"`
|
||||
// LastVersionBuild holds the value of the "last_version_build" field.
|
||||
@@ -58,17 +56,13 @@ type DbPackage struct {
|
||||
IoIn *int64 `json:"io_in,omitempty"`
|
||||
// IoOut holds the value of the "io_out" field.
|
||||
IoOut *int64 `json:"io_out,omitempty"`
|
||||
// Srcinfo holds the value of the "srcinfo" field.
|
||||
Srcinfo *string `json:"srcinfo,omitempty"`
|
||||
// SrcinfoHash holds the value of the "srcinfo_hash" field.
|
||||
SrcinfoHash string `json:"srcinfo_hash,omitempty"`
|
||||
// Pkgbuild holds the value of the "pkgbuild" field.
|
||||
Pkgbuild string `json:"pkgbuild,omitempty"`
|
||||
// TagRev holds the value of the "tag_rev" field.
|
||||
TagRev *string `json:"tag_rev,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*DbPackage) scanValues(columns []string) ([]any, error) {
|
||||
func (*DBPackage) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
@@ -76,7 +70,7 @@ func (*DbPackage) scanValues(columns []string) ([]any, error) {
|
||||
values[i] = new([]byte)
|
||||
case dbpackage.FieldID, dbpackage.FieldMaxRss, dbpackage.FieldUTime, dbpackage.FieldSTime, dbpackage.FieldIoIn, dbpackage.FieldIoOut:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case dbpackage.FieldPkgbase, dbpackage.FieldStatus, dbpackage.FieldSkipReason, dbpackage.FieldRepository, dbpackage.FieldMarch, dbpackage.FieldVersion, dbpackage.FieldRepoVersion, dbpackage.FieldHash, dbpackage.FieldLto, dbpackage.FieldLastVersionBuild, dbpackage.FieldDebugSymbols, dbpackage.FieldSrcinfo, dbpackage.FieldSrcinfoHash, dbpackage.FieldPkgbuild:
|
||||
case dbpackage.FieldPkgbase, dbpackage.FieldStatus, dbpackage.FieldSkipReason, dbpackage.FieldRepository, dbpackage.FieldMarch, dbpackage.FieldVersion, dbpackage.FieldRepoVersion, dbpackage.FieldLto, dbpackage.FieldLastVersionBuild, dbpackage.FieldDebugSymbols, dbpackage.FieldTagRev:
|
||||
values[i] = new(sql.NullString)
|
||||
case dbpackage.FieldBuildTimeStart, dbpackage.FieldUpdated, dbpackage.FieldLastVerified:
|
||||
values[i] = new(sql.NullTime)
|
||||
@@ -88,8 +82,8 @@ func (*DbPackage) scanValues(columns []string) ([]any, error) {
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the DbPackage fields.
|
||||
func (dp *DbPackage) assignValues(columns []string, values []any) error {
|
||||
// to the DBPackage fields.
|
||||
func (dp *DBPackage) 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)
|
||||
}
|
||||
@@ -163,12 +157,6 @@ func (dp *DbPackage) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
dp.Updated = value.Time
|
||||
}
|
||||
case dbpackage.FieldHash:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hash", values[i])
|
||||
} else if value.Valid {
|
||||
dp.Hash = value.String
|
||||
}
|
||||
case dbpackage.FieldLto:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field lto", values[i])
|
||||
@@ -228,24 +216,12 @@ func (dp *DbPackage) assignValues(columns []string, values []any) error {
|
||||
dp.IoOut = new(int64)
|
||||
*dp.IoOut = value.Int64
|
||||
}
|
||||
case dbpackage.FieldSrcinfo:
|
||||
case dbpackage.FieldTagRev:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field srcinfo", values[i])
|
||||
return fmt.Errorf("unexpected type %T for field tag_rev", values[i])
|
||||
} else if value.Valid {
|
||||
dp.Srcinfo = new(string)
|
||||
*dp.Srcinfo = value.String
|
||||
}
|
||||
case dbpackage.FieldSrcinfoHash:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field srcinfo_hash", values[i])
|
||||
} else if value.Valid {
|
||||
dp.SrcinfoHash = value.String
|
||||
}
|
||||
case dbpackage.FieldPkgbuild:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field pkgbuild", values[i])
|
||||
} else if value.Valid {
|
||||
dp.Pkgbuild = value.String
|
||||
dp.TagRev = new(string)
|
||||
*dp.TagRev = value.String
|
||||
}
|
||||
default:
|
||||
dp.selectValues.Set(columns[i], values[i])
|
||||
@@ -254,34 +230,34 @@ func (dp *DbPackage) assignValues(columns []string, values []any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the DbPackage.
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the DBPackage.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (dp *DbPackage) Value(name string) (ent.Value, error) {
|
||||
func (dp *DBPackage) Value(name string) (ent.Value, error) {
|
||||
return dp.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this DbPackage.
|
||||
// Note that you need to call DbPackage.Unwrap() before calling this method if this DbPackage
|
||||
// Update returns a builder for updating this DBPackage.
|
||||
// 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 NewDbPackageClient(dp.config).UpdateOne(dp)
|
||||
func (dp *DBPackage) Update() *DBPackageUpdateOne {
|
||||
return NewDBPackageClient(dp.config).UpdateOne(dp)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the DbPackage entity that was returned from a transaction after it was closed,
|
||||
// Unwrap unwraps the DBPackage 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 (dp *DbPackage) Unwrap() *DbPackage {
|
||||
func (dp *DBPackage) Unwrap() *DBPackage {
|
||||
_tx, ok := dp.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: DbPackage is not a transactional entity")
|
||||
panic("ent: DBPackage is not a transactional entity")
|
||||
}
|
||||
dp.config.driver = _tx.drv
|
||||
return dp
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (dp *DbPackage) String() string {
|
||||
func (dp *DBPackage) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("DbPackage(")
|
||||
builder.WriteString("DBPackage(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", dp.ID))
|
||||
builder.WriteString("pkgbase=")
|
||||
builder.WriteString(dp.Pkgbase)
|
||||
@@ -313,9 +289,6 @@ func (dp *DbPackage) String() string {
|
||||
builder.WriteString("updated=")
|
||||
builder.WriteString(dp.Updated.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hash=")
|
||||
builder.WriteString(dp.Hash)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("lto=")
|
||||
builder.WriteString(fmt.Sprintf("%v", dp.Lto))
|
||||
builder.WriteString(", ")
|
||||
@@ -353,19 +326,13 @@ func (dp *DbPackage) String() string {
|
||||
builder.WriteString(fmt.Sprintf("%v", *v))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
if v := dp.Srcinfo; v != nil {
|
||||
builder.WriteString("srcinfo=")
|
||||
if v := dp.TagRev; v != nil {
|
||||
builder.WriteString("tag_rev=")
|
||||
builder.WriteString(*v)
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("srcinfo_hash=")
|
||||
builder.WriteString(dp.SrcinfoHash)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("pkgbuild=")
|
||||
builder.WriteString(dp.Pkgbuild)
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// DbPackages is a parsable slice of DbPackage.
|
||||
type DbPackages []*DbPackage
|
||||
// DBPackages is a parsable slice of DBPackage.
|
||||
type DBPackages []*DBPackage
|
||||
|
@@ -33,8 +33,6 @@ const (
|
||||
FieldBuildTimeStart = "build_time_start"
|
||||
// FieldUpdated holds the string denoting the updated field in the database.
|
||||
FieldUpdated = "updated"
|
||||
// FieldHash holds the string denoting the hash field in the database.
|
||||
FieldHash = "hash"
|
||||
// FieldLto holds the string denoting the lto field in the database.
|
||||
FieldLto = "lto"
|
||||
// FieldLastVersionBuild holds the string denoting the last_version_build field in the database.
|
||||
@@ -53,12 +51,8 @@ const (
|
||||
FieldIoIn = "io_in"
|
||||
// FieldIoOut holds the string denoting the io_out field in the database.
|
||||
FieldIoOut = "io_out"
|
||||
// FieldSrcinfo holds the string denoting the srcinfo field in the database.
|
||||
FieldSrcinfo = "srcinfo"
|
||||
// FieldSrcinfoHash holds the string denoting the srcinfo_hash field in the database.
|
||||
FieldSrcinfoHash = "srcinfo_hash"
|
||||
// FieldPkgbuild holds the string denoting the pkgbuild field in the database.
|
||||
FieldPkgbuild = "pkgbuild"
|
||||
// FieldTagRev holds the string denoting the tag_rev field in the database.
|
||||
FieldTagRev = "tag_rev"
|
||||
// Table holds the table name of the dbpackage in the database.
|
||||
Table = "db_packages"
|
||||
)
|
||||
@@ -76,7 +70,6 @@ var Columns = []string{
|
||||
FieldRepoVersion,
|
||||
FieldBuildTimeStart,
|
||||
FieldUpdated,
|
||||
FieldHash,
|
||||
FieldLto,
|
||||
FieldLastVersionBuild,
|
||||
FieldLastVerified,
|
||||
@@ -86,9 +79,7 @@ var Columns = []string{
|
||||
FieldSTime,
|
||||
FieldIoIn,
|
||||
FieldIoOut,
|
||||
FieldSrcinfo,
|
||||
FieldSrcinfoHash,
|
||||
FieldPkgbuild,
|
||||
FieldTagRev,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
@@ -146,9 +137,8 @@ type Repository string
|
||||
|
||||
// Repository values.
|
||||
const (
|
||||
RepositoryExtra Repository = "extra"
|
||||
RepositoryCore Repository = "core"
|
||||
RepositoryCommunity Repository = "community"
|
||||
RepositoryExtra Repository = "extra"
|
||||
RepositoryCore Repository = "core"
|
||||
)
|
||||
|
||||
func (r Repository) String() string {
|
||||
@@ -158,7 +148,7 @@ func (r Repository) String() string {
|
||||
// RepositoryValidator is a validator for the "repository" field enum values. It is called by the builders before save.
|
||||
func RepositoryValidator(r Repository) error {
|
||||
switch r {
|
||||
case RepositoryExtra, RepositoryCore, RepositoryCommunity:
|
||||
case RepositoryExtra, RepositoryCore:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("dbpackage: invalid enum value for repository field: %q", r)
|
||||
@@ -220,7 +210,7 @@ func DebugSymbolsValidator(ds DebugSymbols) error {
|
||||
}
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the DbPackage queries.
|
||||
// OrderOption defines the ordering options for the DBPackage queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
@@ -273,11 +263,6 @@ func ByUpdated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHash orders the results by the hash field.
|
||||
func ByHash(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHash, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLto orders the results by the lto field.
|
||||
func ByLto(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLto, opts...).ToFunc()
|
||||
@@ -323,17 +308,7 @@ func ByIoOut(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldIoOut, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySrcinfo orders the results by the srcinfo field.
|
||||
func BySrcinfo(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSrcinfo, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySrcinfoHash orders the results by the srcinfo_hash field.
|
||||
func BySrcinfoHash(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSrcinfoHash, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByPkgbuild orders the results by the pkgbuild field.
|
||||
func ByPkgbuild(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPkgbuild, opts...).ToFunc()
|
||||
// ByTagRev orders the results by the tag_rev field.
|
||||
func ByTagRev(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTagRev, opts...).ToFunc()
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -13,33 +13,33 @@ import (
|
||||
"somegit.dev/ALHP/ALHP.GO/ent/dbpackage"
|
||||
)
|
||||
|
||||
// DbPackageCreate is the builder for creating a DbPackage entity.
|
||||
type DbPackageCreate struct {
|
||||
// DBPackageCreate is the builder for creating a DBPackage entity.
|
||||
type DBPackageCreate struct {
|
||||
config
|
||||
mutation *DbPackageMutation
|
||||
mutation *DBPackageMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetPkgbase sets the "pkgbase" field.
|
||||
func (dpc *DbPackageCreate) SetPkgbase(s string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetPkgbase(s string) *DBPackageCreate {
|
||||
dpc.mutation.SetPkgbase(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetPackages sets the "packages" field.
|
||||
func (dpc *DbPackageCreate) SetPackages(s []string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetPackages(s []string) *DBPackageCreate {
|
||||
dpc.mutation.SetPackages(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (dpc *DbPackageCreate) SetStatus(d dbpackage.Status) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetStatus(d dbpackage.Status) *DBPackageCreate {
|
||||
dpc.mutation.SetStatus(d)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableStatus sets the "status" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableStatus(d *dbpackage.Status) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableStatus(d *dbpackage.Status) *DBPackageCreate {
|
||||
if d != nil {
|
||||
dpc.SetStatus(*d)
|
||||
}
|
||||
@@ -47,13 +47,13 @@ func (dpc *DbPackageCreate) SetNillableStatus(d *dbpackage.Status) *DbPackageCre
|
||||
}
|
||||
|
||||
// SetSkipReason sets the "skip_reason" field.
|
||||
func (dpc *DbPackageCreate) SetSkipReason(s string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetSkipReason(s string) *DBPackageCreate {
|
||||
dpc.mutation.SetSkipReason(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableSkipReason sets the "skip_reason" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableSkipReason(s *string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableSkipReason(s *string) *DBPackageCreate {
|
||||
if s != nil {
|
||||
dpc.SetSkipReason(*s)
|
||||
}
|
||||
@@ -61,25 +61,25 @@ func (dpc *DbPackageCreate) SetNillableSkipReason(s *string) *DbPackageCreate {
|
||||
}
|
||||
|
||||
// SetRepository sets the "repository" field.
|
||||
func (dpc *DbPackageCreate) SetRepository(d dbpackage.Repository) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetRepository(d dbpackage.Repository) *DBPackageCreate {
|
||||
dpc.mutation.SetRepository(d)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetMarch sets the "march" field.
|
||||
func (dpc *DbPackageCreate) SetMarch(s string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetMarch(s string) *DBPackageCreate {
|
||||
dpc.mutation.SetMarch(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetVersion sets the "version" field.
|
||||
func (dpc *DbPackageCreate) SetVersion(s string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetVersion(s string) *DBPackageCreate {
|
||||
dpc.mutation.SetVersion(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableVersion sets the "version" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableVersion(s *string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableVersion(s *string) *DBPackageCreate {
|
||||
if s != nil {
|
||||
dpc.SetVersion(*s)
|
||||
}
|
||||
@@ -87,13 +87,13 @@ func (dpc *DbPackageCreate) SetNillableVersion(s *string) *DbPackageCreate {
|
||||
}
|
||||
|
||||
// SetRepoVersion sets the "repo_version" field.
|
||||
func (dpc *DbPackageCreate) SetRepoVersion(s string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetRepoVersion(s string) *DBPackageCreate {
|
||||
dpc.mutation.SetRepoVersion(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableRepoVersion sets the "repo_version" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableRepoVersion(s *string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableRepoVersion(s *string) *DBPackageCreate {
|
||||
if s != nil {
|
||||
dpc.SetRepoVersion(*s)
|
||||
}
|
||||
@@ -101,13 +101,13 @@ func (dpc *DbPackageCreate) SetNillableRepoVersion(s *string) *DbPackageCreate {
|
||||
}
|
||||
|
||||
// SetBuildTimeStart sets the "build_time_start" field.
|
||||
func (dpc *DbPackageCreate) SetBuildTimeStart(t time.Time) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetBuildTimeStart(t time.Time) *DBPackageCreate {
|
||||
dpc.mutation.SetBuildTimeStart(t)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableBuildTimeStart sets the "build_time_start" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableBuildTimeStart(t *time.Time) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableBuildTimeStart(t *time.Time) *DBPackageCreate {
|
||||
if t != nil {
|
||||
dpc.SetBuildTimeStart(*t)
|
||||
}
|
||||
@@ -115,41 +115,27 @@ func (dpc *DbPackageCreate) SetNillableBuildTimeStart(t *time.Time) *DbPackageCr
|
||||
}
|
||||
|
||||
// SetUpdated sets the "updated" field.
|
||||
func (dpc *DbPackageCreate) SetUpdated(t time.Time) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetUpdated(t time.Time) *DBPackageCreate {
|
||||
dpc.mutation.SetUpdated(t)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableUpdated sets the "updated" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableUpdated(t *time.Time) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableUpdated(t *time.Time) *DBPackageCreate {
|
||||
if t != nil {
|
||||
dpc.SetUpdated(*t)
|
||||
}
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetHash sets the "hash" field.
|
||||
func (dpc *DbPackageCreate) SetHash(s string) *DbPackageCreate {
|
||||
dpc.mutation.SetHash(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableHash sets the "hash" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableHash(s *string) *DbPackageCreate {
|
||||
if s != nil {
|
||||
dpc.SetHash(*s)
|
||||
}
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetLto sets the "lto" field.
|
||||
func (dpc *DbPackageCreate) SetLto(d dbpackage.Lto) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetLto(d dbpackage.Lto) *DBPackageCreate {
|
||||
dpc.mutation.SetLto(d)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableLto sets the "lto" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableLto(d *dbpackage.Lto) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableLto(d *dbpackage.Lto) *DBPackageCreate {
|
||||
if d != nil {
|
||||
dpc.SetLto(*d)
|
||||
}
|
||||
@@ -157,13 +143,13 @@ func (dpc *DbPackageCreate) SetNillableLto(d *dbpackage.Lto) *DbPackageCreate {
|
||||
}
|
||||
|
||||
// SetLastVersionBuild sets the "last_version_build" field.
|
||||
func (dpc *DbPackageCreate) SetLastVersionBuild(s string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetLastVersionBuild(s string) *DBPackageCreate {
|
||||
dpc.mutation.SetLastVersionBuild(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableLastVersionBuild sets the "last_version_build" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableLastVersionBuild(s *string) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableLastVersionBuild(s *string) *DBPackageCreate {
|
||||
if s != nil {
|
||||
dpc.SetLastVersionBuild(*s)
|
||||
}
|
||||
@@ -171,13 +157,13 @@ func (dpc *DbPackageCreate) SetNillableLastVersionBuild(s *string) *DbPackageCre
|
||||
}
|
||||
|
||||
// SetLastVerified sets the "last_verified" field.
|
||||
func (dpc *DbPackageCreate) SetLastVerified(t time.Time) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetLastVerified(t time.Time) *DBPackageCreate {
|
||||
dpc.mutation.SetLastVerified(t)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableLastVerified sets the "last_verified" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableLastVerified(t *time.Time) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableLastVerified(t *time.Time) *DBPackageCreate {
|
||||
if t != nil {
|
||||
dpc.SetLastVerified(*t)
|
||||
}
|
||||
@@ -185,13 +171,13 @@ func (dpc *DbPackageCreate) SetNillableLastVerified(t *time.Time) *DbPackageCrea
|
||||
}
|
||||
|
||||
// SetDebugSymbols sets the "debug_symbols" field.
|
||||
func (dpc *DbPackageCreate) SetDebugSymbols(ds dbpackage.DebugSymbols) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetDebugSymbols(ds dbpackage.DebugSymbols) *DBPackageCreate {
|
||||
dpc.mutation.SetDebugSymbols(ds)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableDebugSymbols sets the "debug_symbols" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableDebugSymbols(ds *dbpackage.DebugSymbols) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableDebugSymbols(ds *dbpackage.DebugSymbols) *DBPackageCreate {
|
||||
if ds != nil {
|
||||
dpc.SetDebugSymbols(*ds)
|
||||
}
|
||||
@@ -199,13 +185,13 @@ func (dpc *DbPackageCreate) SetNillableDebugSymbols(ds *dbpackage.DebugSymbols)
|
||||
}
|
||||
|
||||
// SetMaxRss sets the "max_rss" field.
|
||||
func (dpc *DbPackageCreate) SetMaxRss(i int64) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetMaxRss(i int64) *DBPackageCreate {
|
||||
dpc.mutation.SetMaxRss(i)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableMaxRss sets the "max_rss" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableMaxRss(i *int64) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableMaxRss(i *int64) *DBPackageCreate {
|
||||
if i != nil {
|
||||
dpc.SetMaxRss(*i)
|
||||
}
|
||||
@@ -213,13 +199,13 @@ func (dpc *DbPackageCreate) SetNillableMaxRss(i *int64) *DbPackageCreate {
|
||||
}
|
||||
|
||||
// SetUTime sets the "u_time" field.
|
||||
func (dpc *DbPackageCreate) SetUTime(i int64) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetUTime(i int64) *DBPackageCreate {
|
||||
dpc.mutation.SetUTime(i)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableUTime sets the "u_time" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableUTime(i *int64) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableUTime(i *int64) *DBPackageCreate {
|
||||
if i != nil {
|
||||
dpc.SetUTime(*i)
|
||||
}
|
||||
@@ -227,13 +213,13 @@ func (dpc *DbPackageCreate) SetNillableUTime(i *int64) *DbPackageCreate {
|
||||
}
|
||||
|
||||
// SetSTime sets the "s_time" field.
|
||||
func (dpc *DbPackageCreate) SetSTime(i int64) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetSTime(i int64) *DBPackageCreate {
|
||||
dpc.mutation.SetSTime(i)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableSTime sets the "s_time" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableSTime(i *int64) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableSTime(i *int64) *DBPackageCreate {
|
||||
if i != nil {
|
||||
dpc.SetSTime(*i)
|
||||
}
|
||||
@@ -241,13 +227,13 @@ func (dpc *DbPackageCreate) SetNillableSTime(i *int64) *DbPackageCreate {
|
||||
}
|
||||
|
||||
// SetIoIn sets the "io_in" field.
|
||||
func (dpc *DbPackageCreate) SetIoIn(i int64) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetIoIn(i int64) *DBPackageCreate {
|
||||
dpc.mutation.SetIoIn(i)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableIoIn sets the "io_in" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableIoIn(i *int64) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableIoIn(i *int64) *DBPackageCreate {
|
||||
if i != nil {
|
||||
dpc.SetIoIn(*i)
|
||||
}
|
||||
@@ -255,74 +241,46 @@ func (dpc *DbPackageCreate) SetNillableIoIn(i *int64) *DbPackageCreate {
|
||||
}
|
||||
|
||||
// SetIoOut sets the "io_out" field.
|
||||
func (dpc *DbPackageCreate) SetIoOut(i int64) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetIoOut(i int64) *DBPackageCreate {
|
||||
dpc.mutation.SetIoOut(i)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableIoOut sets the "io_out" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableIoOut(i *int64) *DbPackageCreate {
|
||||
func (dpc *DBPackageCreate) SetNillableIoOut(i *int64) *DBPackageCreate {
|
||||
if i != nil {
|
||||
dpc.SetIoOut(*i)
|
||||
}
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetSrcinfo sets the "srcinfo" field.
|
||||
func (dpc *DbPackageCreate) SetSrcinfo(s string) *DbPackageCreate {
|
||||
dpc.mutation.SetSrcinfo(s)
|
||||
// SetTagRev sets the "tag_rev" field.
|
||||
func (dpc *DBPackageCreate) SetTagRev(s string) *DBPackageCreate {
|
||||
dpc.mutation.SetTagRev(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableSrcinfo sets the "srcinfo" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableSrcinfo(s *string) *DbPackageCreate {
|
||||
// SetNillableTagRev sets the "tag_rev" field if the given value is not nil.
|
||||
func (dpc *DBPackageCreate) SetNillableTagRev(s *string) *DBPackageCreate {
|
||||
if s != nil {
|
||||
dpc.SetSrcinfo(*s)
|
||||
dpc.SetTagRev(*s)
|
||||
}
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetSrcinfoHash sets the "srcinfo_hash" field.
|
||||
func (dpc *DbPackageCreate) SetSrcinfoHash(s string) *DbPackageCreate {
|
||||
dpc.mutation.SetSrcinfoHash(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableSrcinfoHash sets the "srcinfo_hash" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableSrcinfoHash(s *string) *DbPackageCreate {
|
||||
if s != nil {
|
||||
dpc.SetSrcinfoHash(*s)
|
||||
}
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetPkgbuild sets the "pkgbuild" field.
|
||||
func (dpc *DbPackageCreate) SetPkgbuild(s string) *DbPackageCreate {
|
||||
dpc.mutation.SetPkgbuild(s)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillablePkgbuild sets the "pkgbuild" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillablePkgbuild(s *string) *DbPackageCreate {
|
||||
if s != nil {
|
||||
dpc.SetPkgbuild(*s)
|
||||
}
|
||||
return dpc
|
||||
}
|
||||
|
||||
// Mutation returns the DbPackageMutation object of the builder.
|
||||
func (dpc *DbPackageCreate) Mutation() *DbPackageMutation {
|
||||
// Mutation returns the DBPackageMutation object of the builder.
|
||||
func (dpc *DBPackageCreate) Mutation() *DBPackageMutation {
|
||||
return dpc.mutation
|
||||
}
|
||||
|
||||
// Save creates the DbPackage in the database.
|
||||
func (dpc *DbPackageCreate) Save(ctx context.Context) (*DbPackage, error) {
|
||||
// Save creates the DBPackage in the database.
|
||||
func (dpc *DBPackageCreate) Save(ctx context.Context) (*DBPackage, error) {
|
||||
dpc.defaults()
|
||||
return withHooks(ctx, dpc.sqlSave, dpc.mutation, dpc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (dpc *DbPackageCreate) SaveX(ctx context.Context) *DbPackage {
|
||||
func (dpc *DBPackageCreate) SaveX(ctx context.Context) *DBPackage {
|
||||
v, err := dpc.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -331,20 +289,20 @@ func (dpc *DbPackageCreate) SaveX(ctx context.Context) *DbPackage {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (dpc *DbPackageCreate) Exec(ctx context.Context) error {
|
||||
func (dpc *DBPackageCreate) Exec(ctx context.Context) error {
|
||||
_, err := dpc.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (dpc *DbPackageCreate) ExecX(ctx context.Context) {
|
||||
func (dpc *DBPackageCreate) ExecX(ctx context.Context) {
|
||||
if err := dpc.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (dpc *DbPackageCreate) defaults() {
|
||||
func (dpc *DBPackageCreate) defaults() {
|
||||
if _, ok := dpc.mutation.Status(); !ok {
|
||||
v := dbpackage.DefaultStatus
|
||||
dpc.mutation.SetStatus(v)
|
||||
@@ -360,50 +318,50 @@ func (dpc *DbPackageCreate) defaults() {
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (dpc *DbPackageCreate) check() error {
|
||||
func (dpc *DBPackageCreate) check() error {
|
||||
if _, ok := dpc.mutation.Pkgbase(); !ok {
|
||||
return &ValidationError{Name: "pkgbase", err: errors.New(`ent: missing required field "DbPackage.pkgbase"`)}
|
||||
return &ValidationError{Name: "pkgbase", err: errors.New(`ent: missing required field "DBPackage.pkgbase"`)}
|
||||
}
|
||||
if v, ok := dpc.mutation.Pkgbase(); ok {
|
||||
if err := dbpackage.PkgbaseValidator(v); err != nil {
|
||||
return &ValidationError{Name: "pkgbase", err: fmt.Errorf(`ent: validator failed for field "DbPackage.pkgbase": %w`, err)}
|
||||
return &ValidationError{Name: "pkgbase", err: fmt.Errorf(`ent: validator failed for field "DBPackage.pkgbase": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpc.mutation.Status(); ok {
|
||||
if err := dbpackage.StatusValidator(v); err != nil {
|
||||
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "DbPackage.status": %w`, err)}
|
||||
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "DBPackage.status": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := dpc.mutation.Repository(); !ok {
|
||||
return &ValidationError{Name: "repository", err: errors.New(`ent: missing required field "DbPackage.repository"`)}
|
||||
return &ValidationError{Name: "repository", err: errors.New(`ent: missing required field "DBPackage.repository"`)}
|
||||
}
|
||||
if v, ok := dpc.mutation.Repository(); ok {
|
||||
if err := dbpackage.RepositoryValidator(v); err != nil {
|
||||
return &ValidationError{Name: "repository", err: fmt.Errorf(`ent: validator failed for field "DbPackage.repository": %w`, err)}
|
||||
return &ValidationError{Name: "repository", err: fmt.Errorf(`ent: validator failed for field "DBPackage.repository": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := dpc.mutation.March(); !ok {
|
||||
return &ValidationError{Name: "march", err: errors.New(`ent: missing required field "DbPackage.march"`)}
|
||||
return &ValidationError{Name: "march", err: errors.New(`ent: missing required field "DBPackage.march"`)}
|
||||
}
|
||||
if v, ok := dpc.mutation.March(); ok {
|
||||
if err := dbpackage.MarchValidator(v); err != nil {
|
||||
return &ValidationError{Name: "march", err: fmt.Errorf(`ent: validator failed for field "DbPackage.march": %w`, err)}
|
||||
return &ValidationError{Name: "march", err: fmt.Errorf(`ent: validator failed for field "DBPackage.march": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpc.mutation.Lto(); ok {
|
||||
if err := dbpackage.LtoValidator(v); err != nil {
|
||||
return &ValidationError{Name: "lto", err: fmt.Errorf(`ent: validator failed for field "DbPackage.lto": %w`, err)}
|
||||
return &ValidationError{Name: "lto", err: fmt.Errorf(`ent: validator failed for field "DBPackage.lto": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpc.mutation.DebugSymbols(); ok {
|
||||
if err := dbpackage.DebugSymbolsValidator(v); err != nil {
|
||||
return &ValidationError{Name: "debug_symbols", err: fmt.Errorf(`ent: validator failed for field "DbPackage.debug_symbols": %w`, err)}
|
||||
return &ValidationError{Name: "debug_symbols", err: fmt.Errorf(`ent: validator failed for field "DBPackage.debug_symbols": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dpc *DbPackageCreate) sqlSave(ctx context.Context) (*DbPackage, error) {
|
||||
func (dpc *DBPackageCreate) sqlSave(ctx context.Context) (*DBPackage, error) {
|
||||
if err := dpc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -421,9 +379,9 @@ func (dpc *DbPackageCreate) sqlSave(ctx context.Context) (*DbPackage, error) {
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) {
|
||||
func (dpc *DBPackageCreate) createSpec() (*DBPackage, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &DbPackage{config: dpc.config}
|
||||
_node = &DBPackage{config: dpc.config}
|
||||
_spec = sqlgraph.NewCreateSpec(dbpackage.Table, sqlgraph.NewFieldSpec(dbpackage.FieldID, field.TypeInt))
|
||||
)
|
||||
if value, ok := dpc.mutation.Pkgbase(); ok {
|
||||
@@ -466,10 +424,6 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(dbpackage.FieldUpdated, field.TypeTime, value)
|
||||
_node.Updated = value
|
||||
}
|
||||
if value, ok := dpc.mutation.Hash(); ok {
|
||||
_spec.SetField(dbpackage.FieldHash, field.TypeString, value)
|
||||
_node.Hash = value
|
||||
}
|
||||
if value, ok := dpc.mutation.Lto(); ok {
|
||||
_spec.SetField(dbpackage.FieldLto, field.TypeEnum, value)
|
||||
_node.Lto = value
|
||||
@@ -506,38 +460,30 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(dbpackage.FieldIoOut, field.TypeInt64, value)
|
||||
_node.IoOut = &value
|
||||
}
|
||||
if value, ok := dpc.mutation.Srcinfo(); ok {
|
||||
_spec.SetField(dbpackage.FieldSrcinfo, field.TypeString, value)
|
||||
_node.Srcinfo = &value
|
||||
}
|
||||
if value, ok := dpc.mutation.SrcinfoHash(); ok {
|
||||
_spec.SetField(dbpackage.FieldSrcinfoHash, field.TypeString, value)
|
||||
_node.SrcinfoHash = value
|
||||
}
|
||||
if value, ok := dpc.mutation.Pkgbuild(); ok {
|
||||
_spec.SetField(dbpackage.FieldPkgbuild, field.TypeString, value)
|
||||
_node.Pkgbuild = value
|
||||
if value, ok := dpc.mutation.TagRev(); ok {
|
||||
_spec.SetField(dbpackage.FieldTagRev, field.TypeString, value)
|
||||
_node.TagRev = &value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// DbPackageCreateBulk is the builder for creating many DbPackage entities in bulk.
|
||||
type DbPackageCreateBulk struct {
|
||||
// DBPackageCreateBulk is the builder for creating many DBPackage entities in bulk.
|
||||
type DBPackageCreateBulk struct {
|
||||
config
|
||||
builders []*DbPackageCreate
|
||||
builders []*DBPackageCreate
|
||||
}
|
||||
|
||||
// Save creates the DbPackage entities in the database.
|
||||
func (dpcb *DbPackageCreateBulk) Save(ctx context.Context) ([]*DbPackage, error) {
|
||||
// Save creates the DBPackage entities in the database.
|
||||
func (dpcb *DBPackageCreateBulk) Save(ctx context.Context) ([]*DBPackage, error) {
|
||||
specs := make([]*sqlgraph.CreateSpec, len(dpcb.builders))
|
||||
nodes := make([]*DbPackage, len(dpcb.builders))
|
||||
nodes := make([]*DBPackage, len(dpcb.builders))
|
||||
mutators := make([]Mutator, len(dpcb.builders))
|
||||
for i := range dpcb.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := dpcb.builders[i]
|
||||
builder.defaults()
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*DbPackageMutation)
|
||||
mutation, ok := m.(*DBPackageMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
@@ -584,7 +530,7 @@ func (dpcb *DbPackageCreateBulk) Save(ctx context.Context) ([]*DbPackage, error)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (dpcb *DbPackageCreateBulk) SaveX(ctx context.Context) []*DbPackage {
|
||||
func (dpcb *DBPackageCreateBulk) SaveX(ctx context.Context) []*DBPackage {
|
||||
v, err := dpcb.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -593,13 +539,13 @@ func (dpcb *DbPackageCreateBulk) SaveX(ctx context.Context) []*DbPackage {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (dpcb *DbPackageCreateBulk) Exec(ctx context.Context) error {
|
||||
func (dpcb *DBPackageCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := dpcb.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (dpcb *DbPackageCreateBulk) ExecX(ctx context.Context) {
|
||||
func (dpcb *DBPackageCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := dpcb.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -12,26 +12,26 @@ import (
|
||||
"somegit.dev/ALHP/ALHP.GO/ent/predicate"
|
||||
)
|
||||
|
||||
// DbPackageDelete is the builder for deleting a DbPackage entity.
|
||||
type DbPackageDelete struct {
|
||||
// DBPackageDelete is the builder for deleting a DBPackage entity.
|
||||
type DBPackageDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *DbPackageMutation
|
||||
mutation *DBPackageMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the DbPackageDelete builder.
|
||||
func (dpd *DbPackageDelete) Where(ps ...predicate.DbPackage) *DbPackageDelete {
|
||||
// Where appends a list predicates to the DBPackageDelete builder.
|
||||
func (dpd *DBPackageDelete) Where(ps ...predicate.DBPackage) *DBPackageDelete {
|
||||
dpd.mutation.Where(ps...)
|
||||
return dpd
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (dpd *DbPackageDelete) Exec(ctx context.Context) (int, error) {
|
||||
func (dpd *DBPackageDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, dpd.sqlExec, dpd.mutation, dpd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (dpd *DbPackageDelete) ExecX(ctx context.Context) int {
|
||||
func (dpd *DBPackageDelete) ExecX(ctx context.Context) int {
|
||||
n, err := dpd.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -39,7 +39,7 @@ func (dpd *DbPackageDelete) ExecX(ctx context.Context) int {
|
||||
return n
|
||||
}
|
||||
|
||||
func (dpd *DbPackageDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
func (dpd *DBPackageDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(dbpackage.Table, sqlgraph.NewFieldSpec(dbpackage.FieldID, field.TypeInt))
|
||||
if ps := dpd.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
@@ -56,19 +56,19 @@ func (dpd *DbPackageDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// DbPackageDeleteOne is the builder for deleting a single DbPackage entity.
|
||||
type DbPackageDeleteOne struct {
|
||||
dpd *DbPackageDelete
|
||||
// DBPackageDeleteOne is the builder for deleting a single DBPackage entity.
|
||||
type DBPackageDeleteOne struct {
|
||||
dpd *DBPackageDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the DbPackageDelete builder.
|
||||
func (dpdo *DbPackageDeleteOne) Where(ps ...predicate.DbPackage) *DbPackageDeleteOne {
|
||||
// Where appends a list predicates to the DBPackageDelete builder.
|
||||
func (dpdo *DBPackageDeleteOne) Where(ps ...predicate.DBPackage) *DBPackageDeleteOne {
|
||||
dpdo.dpd.mutation.Where(ps...)
|
||||
return dpdo
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (dpdo *DbPackageDeleteOne) Exec(ctx context.Context) error {
|
||||
func (dpdo *DBPackageDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := dpdo.dpd.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
@@ -81,7 +81,7 @@ func (dpdo *DbPackageDeleteOne) Exec(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (dpdo *DbPackageDeleteOne) ExecX(ctx context.Context) {
|
||||
func (dpdo *DBPackageDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := dpdo.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -14,53 +14,53 @@ import (
|
||||
"somegit.dev/ALHP/ALHP.GO/ent/predicate"
|
||||
)
|
||||
|
||||
// DbPackageQuery is the builder for querying DbPackage entities.
|
||||
type DbPackageQuery struct {
|
||||
// DBPackageQuery is the builder for querying DBPackage entities.
|
||||
type DBPackageQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []dbpackage.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.DbPackage
|
||||
predicates []predicate.DBPackage
|
||||
modifiers []func(*sql.Selector)
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the DbPackageQuery builder.
|
||||
func (dpq *DbPackageQuery) Where(ps ...predicate.DbPackage) *DbPackageQuery {
|
||||
// Where adds a new predicate for the DBPackageQuery builder.
|
||||
func (dpq *DBPackageQuery) Where(ps ...predicate.DBPackage) *DBPackageQuery {
|
||||
dpq.predicates = append(dpq.predicates, ps...)
|
||||
return dpq
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (dpq *DbPackageQuery) Limit(limit int) *DbPackageQuery {
|
||||
func (dpq *DBPackageQuery) Limit(limit int) *DBPackageQuery {
|
||||
dpq.ctx.Limit = &limit
|
||||
return dpq
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (dpq *DbPackageQuery) Offset(offset int) *DbPackageQuery {
|
||||
func (dpq *DBPackageQuery) Offset(offset int) *DBPackageQuery {
|
||||
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 {
|
||||
func (dpq *DBPackageQuery) Unique(unique bool) *DBPackageQuery {
|
||||
dpq.ctx.Unique = &unique
|
||||
return dpq
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (dpq *DbPackageQuery) Order(o ...dbpackage.OrderOption) *DbPackageQuery {
|
||||
func (dpq *DBPackageQuery) Order(o ...dbpackage.OrderOption) *DBPackageQuery {
|
||||
dpq.order = append(dpq.order, o...)
|
||||
return dpq
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// 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(setContextOp(ctx, dpq.ctx, "First"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -72,7 +72,7 @@ func (dpq *DbPackageQuery) First(ctx context.Context) (*DbPackage, error) {
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (dpq *DbPackageQuery) FirstX(ctx context.Context) *DbPackage {
|
||||
func (dpq *DBPackageQuery) FirstX(ctx context.Context) *DBPackage {
|
||||
node, err := dpq.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
@@ -80,9 +80,9 @@ func (dpq *DbPackageQuery) FirstX(ctx context.Context) *DbPackage {
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first DbPackage ID from the query.
|
||||
// Returns a *NotFoundError when no DbPackage ID was found.
|
||||
func (dpq *DbPackageQuery) FirstID(ctx context.Context) (id int, err error) {
|
||||
// FirstID returns the first DBPackage ID from the query.
|
||||
// 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(setContextOp(ctx, dpq.ctx, "FirstID")); err != nil {
|
||||
return
|
||||
@@ -95,7 +95,7 @@ func (dpq *DbPackageQuery) FirstID(ctx context.Context) (id int, err error) {
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (dpq *DbPackageQuery) FirstIDX(ctx context.Context) int {
|
||||
func (dpq *DBPackageQuery) FirstIDX(ctx context.Context) int {
|
||||
id, err := dpq.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
@@ -103,10 +103,10 @@ func (dpq *DbPackageQuery) FirstIDX(ctx context.Context) int {
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single DbPackage entity found by the query, ensuring it only returns one.
|
||||
// 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) {
|
||||
// Only returns a single DBPackage entity found by the query, ensuring it only returns one.
|
||||
// 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(setContextOp(ctx, dpq.ctx, "Only"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -122,7 +122,7 @@ func (dpq *DbPackageQuery) Only(ctx context.Context) (*DbPackage, error) {
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (dpq *DbPackageQuery) OnlyX(ctx context.Context) *DbPackage {
|
||||
func (dpq *DBPackageQuery) OnlyX(ctx context.Context) *DBPackage {
|
||||
node, err := dpq.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -130,10 +130,10 @@ func (dpq *DbPackageQuery) OnlyX(ctx context.Context) *DbPackage {
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only DbPackage ID in the query.
|
||||
// Returns a *NotSingularError when more than one DbPackage ID is found.
|
||||
// OnlyID is like Only, but returns the only DBPackage ID in the query.
|
||||
// Returns a *NotSingularError when more than one DBPackage ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (dpq *DbPackageQuery) OnlyID(ctx context.Context) (id int, err error) {
|
||||
func (dpq *DBPackageQuery) OnlyID(ctx context.Context) (id int, err error) {
|
||||
var ids []int
|
||||
if ids, err = dpq.Limit(2).IDs(setContextOp(ctx, dpq.ctx, "OnlyID")); err != nil {
|
||||
return
|
||||
@@ -150,7 +150,7 @@ func (dpq *DbPackageQuery) OnlyID(ctx context.Context) (id int, err error) {
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (dpq *DbPackageQuery) OnlyIDX(ctx context.Context) int {
|
||||
func (dpq *DBPackageQuery) OnlyIDX(ctx context.Context) int {
|
||||
id, err := dpq.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -158,18 +158,18 @@ func (dpq *DbPackageQuery) OnlyIDX(ctx context.Context) int {
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of DbPackages.
|
||||
func (dpq *DbPackageQuery) All(ctx context.Context) ([]*DbPackage, error) {
|
||||
// All executes the query and returns a list of DBPackages.
|
||||
func (dpq *DBPackageQuery) All(ctx context.Context) ([]*DBPackage, error) {
|
||||
ctx = setContextOp(ctx, dpq.ctx, "All")
|
||||
if err := dpq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*DbPackage, *DbPackageQuery]()
|
||||
return withInterceptors[[]*DbPackage](ctx, dpq, qr, dpq.inters)
|
||||
qr := querierAll[[]*DBPackage, *DBPackageQuery]()
|
||||
return withInterceptors[[]*DBPackage](ctx, dpq, qr, dpq.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (dpq *DbPackageQuery) AllX(ctx context.Context) []*DbPackage {
|
||||
func (dpq *DBPackageQuery) AllX(ctx context.Context) []*DBPackage {
|
||||
nodes, err := dpq.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -177,8 +177,8 @@ func (dpq *DbPackageQuery) AllX(ctx context.Context) []*DbPackage {
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of DbPackage IDs.
|
||||
func (dpq *DbPackageQuery) IDs(ctx context.Context) (ids []int, err error) {
|
||||
// IDs executes the query and returns a list of DBPackage IDs.
|
||||
func (dpq *DBPackageQuery) IDs(ctx context.Context) (ids []int, err error) {
|
||||
if dpq.ctx.Unique == nil && dpq.path != nil {
|
||||
dpq.Unique(true)
|
||||
}
|
||||
@@ -190,7 +190,7 @@ func (dpq *DbPackageQuery) IDs(ctx context.Context) (ids []int, err error) {
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (dpq *DbPackageQuery) IDsX(ctx context.Context) []int {
|
||||
func (dpq *DBPackageQuery) IDsX(ctx context.Context) []int {
|
||||
ids, err := dpq.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -199,16 +199,16 @@ 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) {
|
||||
func (dpq *DBPackageQuery) Count(ctx context.Context) (int, error) {
|
||||
ctx = setContextOp(ctx, dpq.ctx, "Count")
|
||||
if err := dpq.prepareQuery(ctx); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return withInterceptors[int](ctx, dpq, querierCount[*DbPackageQuery](), dpq.inters)
|
||||
return withInterceptors[int](ctx, dpq, querierCount[*DBPackageQuery](), dpq.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (dpq *DbPackageQuery) CountX(ctx context.Context) int {
|
||||
func (dpq *DBPackageQuery) CountX(ctx context.Context) int {
|
||||
count, err := dpq.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -217,7 +217,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) {
|
||||
func (dpq *DBPackageQuery) Exist(ctx context.Context) (bool, error) {
|
||||
ctx = setContextOp(ctx, dpq.ctx, "Exist")
|
||||
switch _, err := dpq.FirstID(ctx); {
|
||||
case IsNotFound(err):
|
||||
@@ -230,7 +230,7 @@ func (dpq *DbPackageQuery) Exist(ctx context.Context) (bool, error) {
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (dpq *DbPackageQuery) ExistX(ctx context.Context) bool {
|
||||
func (dpq *DBPackageQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := dpq.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -238,18 +238,18 @@ func (dpq *DbPackageQuery) ExistX(ctx context.Context) bool {
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the DbPackageQuery builder, including all associated steps. It can be
|
||||
// Clone returns a duplicate of the DBPackageQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (dpq *DbPackageQuery) Clone() *DbPackageQuery {
|
||||
func (dpq *DBPackageQuery) Clone() *DBPackageQuery {
|
||||
if dpq == nil {
|
||||
return nil
|
||||
}
|
||||
return &DbPackageQuery{
|
||||
return &DBPackageQuery{
|
||||
config: dpq.config,
|
||||
ctx: dpq.ctx.Clone(),
|
||||
order: append([]dbpackage.OrderOption{}, dpq.order...),
|
||||
inters: append([]Interceptor{}, dpq.inters...),
|
||||
predicates: append([]predicate.DbPackage{}, dpq.predicates...),
|
||||
predicates: append([]predicate.DBPackage{}, dpq.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: dpq.sql.Clone(),
|
||||
path: dpq.path,
|
||||
@@ -266,13 +266,13 @@ func (dpq *DbPackageQuery) Clone() *DbPackageQuery {
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.DbPackage.Query().
|
||||
// client.DBPackage.Query().
|
||||
// GroupBy(dbpackage.FieldPkgbase).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (dpq *DbPackageQuery) GroupBy(field string, fields ...string) *DbPackageGroupBy {
|
||||
func (dpq *DBPackageQuery) GroupBy(field string, fields ...string) *DBPackageGroupBy {
|
||||
dpq.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &DbPackageGroupBy{build: dpq}
|
||||
grbuild := &DBPackageGroupBy{build: dpq}
|
||||
grbuild.flds = &dpq.ctx.Fields
|
||||
grbuild.label = dbpackage.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
@@ -288,23 +288,23 @@ func (dpq *DbPackageQuery) GroupBy(field string, fields ...string) *DbPackageGro
|
||||
// Pkgbase string `json:"pkgbase,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.DbPackage.Query().
|
||||
// client.DBPackage.Query().
|
||||
// Select(dbpackage.FieldPkgbase).
|
||||
// Scan(ctx, &v)
|
||||
func (dpq *DbPackageQuery) Select(fields ...string) *DbPackageSelect {
|
||||
func (dpq *DBPackageQuery) Select(fields ...string) *DBPackageSelect {
|
||||
dpq.ctx.Fields = append(dpq.ctx.Fields, fields...)
|
||||
sbuild := &DbPackageSelect{DbPackageQuery: dpq}
|
||||
sbuild := &DBPackageSelect{DBPackageQuery: dpq}
|
||||
sbuild.label = dbpackage.Label
|
||||
sbuild.flds, sbuild.scan = &dpq.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a DbPackageSelect configured with the given aggregations.
|
||||
func (dpq *DbPackageQuery) Aggregate(fns ...AggregateFunc) *DbPackageSelect {
|
||||
// Aggregate returns a DBPackageSelect configured with the given aggregations.
|
||||
func (dpq *DBPackageQuery) Aggregate(fns ...AggregateFunc) *DBPackageSelect {
|
||||
return dpq.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (dpq *DbPackageQuery) prepareQuery(ctx context.Context) error {
|
||||
func (dpq *DBPackageQuery) prepareQuery(ctx context.Context) error {
|
||||
for _, inter := range dpq.inters {
|
||||
if inter == nil {
|
||||
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
|
||||
@@ -330,16 +330,16 @@ func (dpq *DbPackageQuery) prepareQuery(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dpq *DbPackageQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*DbPackage, error) {
|
||||
func (dpq *DBPackageQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*DBPackage, error) {
|
||||
var (
|
||||
nodes = []*DbPackage{}
|
||||
nodes = []*DBPackage{}
|
||||
_spec = dpq.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*DbPackage).scanValues(nil, columns)
|
||||
return (*DBPackage).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &DbPackage{config: dpq.config}
|
||||
node := &DBPackage{config: dpq.config}
|
||||
nodes = append(nodes, node)
|
||||
return node.assignValues(columns, values)
|
||||
}
|
||||
@@ -358,7 +358,7 @@ func (dpq *DbPackageQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*D
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (dpq *DbPackageQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
func (dpq *DBPackageQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
_spec := dpq.querySpec()
|
||||
if len(dpq.modifiers) > 0 {
|
||||
_spec.Modifiers = dpq.modifiers
|
||||
@@ -370,7 +370,7 @@ func (dpq *DbPackageQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
return sqlgraph.CountNodes(ctx, dpq.driver, _spec)
|
||||
}
|
||||
|
||||
func (dpq *DbPackageQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
func (dpq *DBPackageQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(dbpackage.Table, dbpackage.Columns, sqlgraph.NewFieldSpec(dbpackage.FieldID, field.TypeInt))
|
||||
_spec.From = dpq.sql
|
||||
if unique := dpq.ctx.Unique; unique != nil {
|
||||
@@ -410,7 +410,7 @@ func (dpq *DbPackageQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (dpq *DbPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
func (dpq *DBPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(dpq.driver.Dialect())
|
||||
t1 := builder.Table(dbpackage.Table)
|
||||
columns := dpq.ctx.Fields
|
||||
@@ -446,33 +446,33 @@ func (dpq *DbPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
}
|
||||
|
||||
// Modify adds a query modifier for attaching custom logic to queries.
|
||||
func (dpq *DbPackageQuery) Modify(modifiers ...func(s *sql.Selector)) *DbPackageSelect {
|
||||
func (dpq *DBPackageQuery) Modify(modifiers ...func(s *sql.Selector)) *DBPackageSelect {
|
||||
dpq.modifiers = append(dpq.modifiers, modifiers...)
|
||||
return dpq.Select()
|
||||
}
|
||||
|
||||
// DbPackageGroupBy is the group-by builder for DbPackage entities.
|
||||
type DbPackageGroupBy struct {
|
||||
// DBPackageGroupBy is the group-by builder for DBPackage entities.
|
||||
type DBPackageGroupBy struct {
|
||||
selector
|
||||
build *DbPackageQuery
|
||||
build *DBPackageQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (dpgb *DbPackageGroupBy) Aggregate(fns ...AggregateFunc) *DbPackageGroupBy {
|
||||
func (dpgb *DBPackageGroupBy) Aggregate(fns ...AggregateFunc) *DBPackageGroupBy {
|
||||
dpgb.fns = append(dpgb.fns, fns...)
|
||||
return dpgb
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (dpgb *DbPackageGroupBy) Scan(ctx context.Context, v any) error {
|
||||
func (dpgb *DBPackageGroupBy) Scan(ctx context.Context, v any) error {
|
||||
ctx = setContextOp(ctx, dpgb.build.ctx, "GroupBy")
|
||||
if err := dpgb.build.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return scanWithInterceptors[*DbPackageQuery, *DbPackageGroupBy](ctx, dpgb.build, dpgb, dpgb.build.inters, v)
|
||||
return scanWithInterceptors[*DBPackageQuery, *DBPackageGroupBy](ctx, dpgb.build, dpgb, dpgb.build.inters, v)
|
||||
}
|
||||
|
||||
func (dpgb *DbPackageGroupBy) sqlScan(ctx context.Context, root *DbPackageQuery, v any) error {
|
||||
func (dpgb *DBPackageGroupBy) sqlScan(ctx context.Context, root *DBPackageQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
aggregation := make([]string, 0, len(dpgb.fns))
|
||||
for _, fn := range dpgb.fns {
|
||||
@@ -499,28 +499,28 @@ func (dpgb *DbPackageGroupBy) sqlScan(ctx context.Context, root *DbPackageQuery,
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// DbPackageSelect is the builder for selecting fields of DbPackage entities.
|
||||
type DbPackageSelect struct {
|
||||
*DbPackageQuery
|
||||
// DBPackageSelect is the builder for selecting fields of DBPackage entities.
|
||||
type DBPackageSelect struct {
|
||||
*DBPackageQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (dps *DbPackageSelect) Aggregate(fns ...AggregateFunc) *DbPackageSelect {
|
||||
func (dps *DBPackageSelect) Aggregate(fns ...AggregateFunc) *DBPackageSelect {
|
||||
dps.fns = append(dps.fns, fns...)
|
||||
return dps
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (dps *DbPackageSelect) Scan(ctx context.Context, v any) error {
|
||||
func (dps *DBPackageSelect) Scan(ctx context.Context, v any) error {
|
||||
ctx = setContextOp(ctx, dps.ctx, "Select")
|
||||
if err := dps.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return scanWithInterceptors[*DbPackageQuery, *DbPackageSelect](ctx, dps.DbPackageQuery, dps, dps.inters, v)
|
||||
return scanWithInterceptors[*DBPackageQuery, *DBPackageSelect](ctx, dps.DBPackageQuery, dps, dps.inters, v)
|
||||
}
|
||||
|
||||
func (dps *DbPackageSelect) sqlScan(ctx context.Context, root *DbPackageQuery, v any) error {
|
||||
func (dps *DBPackageSelect) sqlScan(ctx context.Context, root *DBPackageQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(dps.fns))
|
||||
for _, fn := range dps.fns {
|
||||
@@ -542,7 +542,7 @@ func (dps *DbPackageSelect) sqlScan(ctx context.Context, root *DbPackageQuery, v
|
||||
}
|
||||
|
||||
// Modify adds a query modifier for attaching custom logic to queries.
|
||||
func (dps *DbPackageSelect) Modify(modifiers ...func(s *sql.Selector)) *DbPackageSelect {
|
||||
func (dps *DBPackageSelect) Modify(modifiers ...func(s *sql.Selector)) *DBPackageSelect {
|
||||
dps.modifiers = append(dps.modifiers, modifiers...)
|
||||
return dps
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -9,16 +9,16 @@ import (
|
||||
"somegit.dev/ALHP/ALHP.GO/ent"
|
||||
)
|
||||
|
||||
// The DbPackageFunc type is an adapter to allow the use of ordinary
|
||||
// function as DbPackage mutator.
|
||||
type DbPackageFunc func(context.Context, *ent.DbPackageMutation) (ent.Value, error)
|
||||
// The DBPackageFunc type is an adapter to allow the use of ordinary
|
||||
// function as DBPackage mutator.
|
||||
type DBPackageFunc func(context.Context, *ent.DBPackageMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f DbPackageFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.DbPackageMutation); ok {
|
||||
func (f DBPackageFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.DBPackageMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.DbPackageMutation", m)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.DBPackageMutation", m)
|
||||
}
|
||||
|
||||
// Condition is a hook condition function.
|
||||
|
@@ -15,13 +15,12 @@ var (
|
||||
{Name: "packages", Type: field.TypeJSON, Nullable: true},
|
||||
{Name: "status", Type: field.TypeEnum, Nullable: true, Enums: []string{"skipped", "failed", "build", "queued", "delayed", "building", "latest", "signing", "unknown"}, Default: "unknown"},
|
||||
{Name: "skip_reason", Type: field.TypeString, Nullable: true},
|
||||
{Name: "repository", Type: field.TypeEnum, Enums: []string{"extra", "core", "community"}},
|
||||
{Name: "repository", Type: field.TypeEnum, Enums: []string{"extra", "core"}},
|
||||
{Name: "march", Type: field.TypeString},
|
||||
{Name: "version", Type: field.TypeString, Nullable: true},
|
||||
{Name: "repo_version", Type: field.TypeString, Nullable: true},
|
||||
{Name: "build_time_start", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updated", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "hash", Type: field.TypeString, Nullable: true},
|
||||
{Name: "lto", Type: field.TypeEnum, Nullable: true, Enums: []string{"enabled", "unknown", "disabled", "auto_disabled"}, Default: "unknown"},
|
||||
{Name: "last_version_build", Type: field.TypeString, Nullable: true},
|
||||
{Name: "last_verified", Type: field.TypeTime, Nullable: true},
|
||||
@@ -31,9 +30,7 @@ var (
|
||||
{Name: "s_time", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "io_in", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "io_out", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "srcinfo", Type: field.TypeString, Nullable: true, Size: 2147483647},
|
||||
{Name: "srcinfo_hash", Type: field.TypeString, Nullable: true},
|
||||
{Name: "pkgbuild", Type: field.TypeString, Nullable: true},
|
||||
{Name: "tag_rev", Type: field.TypeString, Nullable: true},
|
||||
}
|
||||
// DbPackagesTable holds the schema information for the "db_packages" table.
|
||||
DbPackagesTable = &schema.Table{
|
||||
|
737
ent/mutation.go
737
ent/mutation.go
File diff suppressed because it is too large
Load Diff
@@ -6,5 +6,5 @@ import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// DbPackage is the predicate function for dbpackage builders.
|
||||
type DbPackage func(*sql.Selector)
|
||||
// DBPackage is the predicate function for dbpackage builders.
|
||||
type DBPackage func(*sql.Selector)
|
||||
|
@@ -11,7 +11,7 @@ import (
|
||||
// (default values, validators, hooks and policies) and stitches it
|
||||
// to their package variables.
|
||||
func init() {
|
||||
dbpackageFields := schema.DbPackage{}.Fields()
|
||||
dbpackageFields := schema.DBPackage{}.Fields()
|
||||
_ = dbpackageFields
|
||||
// dbpackageDescPkgbase is the schema descriptor for pkgbase field.
|
||||
dbpackageDescPkgbase := dbpackageFields[0].Descriptor()
|
||||
|
@@ -5,26 +5,25 @@ import (
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// DbPackage holds the schema definition for the DbPackage entity.
|
||||
type DbPackage struct {
|
||||
// DBPackage holds the schema definition for the DbPackage entity.
|
||||
type DBPackage struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the DbPackage.
|
||||
func (DbPackage) Fields() []ent.Field {
|
||||
// Fields of the DBPackage.
|
||||
func (DBPackage) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("pkgbase").NotEmpty().Immutable(),
|
||||
field.Strings("packages").Optional(),
|
||||
field.Enum("status").Values("skipped", "failed", "build", "queued", "delayed", "building",
|
||||
"latest", "signing", "unknown").Default("unknown").Optional(),
|
||||
field.String("skip_reason").Optional(),
|
||||
field.Enum("repository").Values("extra", "core", "community"),
|
||||
field.Enum("repository").Values("extra", "core"),
|
||||
field.String("march").NotEmpty().Immutable(),
|
||||
field.String("version").Optional(),
|
||||
field.String("repo_version").Optional(),
|
||||
field.Time("build_time_start").Optional(),
|
||||
field.Time("updated").Optional(),
|
||||
field.String("hash").Optional(),
|
||||
field.Enum("lto").Values("enabled", "unknown", "disabled", "auto_disabled").Default("unknown").Optional(),
|
||||
field.String("last_version_build").Optional(),
|
||||
field.Time("last_verified").Optional(),
|
||||
@@ -34,13 +33,11 @@ func (DbPackage) Fields() []ent.Field {
|
||||
field.Int64("s_time").Optional().Nillable(),
|
||||
field.Int64("io_in").Optional().Nillable(),
|
||||
field.Int64("io_out").Optional().Nillable(),
|
||||
field.Text("srcinfo").Optional().Nillable(),
|
||||
field.String("srcinfo_hash").Optional(),
|
||||
field.String("pkgbuild").Optional(),
|
||||
field.String("tag_rev").Optional().Nillable(),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the DbPackage.
|
||||
func (DbPackage) Edges() []ent.Edge {
|
||||
// Edges of the DBPackage.
|
||||
func (DBPackage) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
|
@@ -12,8 +12,8 @@ import (
|
||||
// Tx is a transactional client that is created by calling Client.Tx().
|
||||
type Tx struct {
|
||||
config
|
||||
// DbPackage is the client for interacting with the DbPackage builders.
|
||||
DbPackage *DbPackageClient
|
||||
// DBPackage is the client for interacting with the DBPackage builders.
|
||||
DBPackage *DBPackageClient
|
||||
|
||||
// lazily loaded.
|
||||
client *Client
|
||||
@@ -145,7 +145,7 @@ func (tx *Tx) Client() *Client {
|
||||
}
|
||||
|
||||
func (tx *Tx) init() {
|
||||
tx.DbPackage = NewDbPackageClient(tx.config)
|
||||
tx.DBPackage = NewDBPackageClient(tx.config)
|
||||
}
|
||||
|
||||
// txDriver wraps the given dialect.Tx with a nop dialect.Driver implementation.
|
||||
@@ -155,7 +155,7 @@ func (tx *Tx) init() {
|
||||
// of them in order to commit or rollback the transaction.
|
||||
//
|
||||
// If a closed transaction is embedded in one of the generated entities, and the entity
|
||||
// applies a query, for example: DbPackage.QueryXXX(), the query will be executed
|
||||
// applies a query, for example: DBPackage.QueryXXX(), the query will be executed
|
||||
// through the driver which created this transaction.
|
||||
//
|
||||
// Note that txDriver is not goroutine safe.
|
||||
|
Reference in New Issue
Block a user