forked from ALHP/ALHP.GO
1088 lines
33 KiB
Go
1088 lines
33 KiB
Go
// Code generated by entc, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"sync"
|
|
"time"
|
|
|
|
"ALHP.go/ent/dbpackage"
|
|
"ALHP.go/ent/predicate"
|
|
|
|
"entgo.io/ent"
|
|
)
|
|
|
|
const (
|
|
// Operation types.
|
|
OpCreate = ent.OpCreate
|
|
OpDelete = ent.OpDelete
|
|
OpDeleteOne = ent.OpDeleteOne
|
|
OpUpdate = ent.OpUpdate
|
|
OpUpdateOne = ent.OpUpdateOne
|
|
|
|
// Node types.
|
|
TypeDbPackage = "DbPackage"
|
|
)
|
|
|
|
// DbPackageMutation represents an operation that mutates the DbPackage nodes in the graph.
|
|
type DbPackageMutation struct {
|
|
config
|
|
op Op
|
|
typ string
|
|
id *int
|
|
pkgbase *string
|
|
packages *[]string
|
|
status *dbpackage.Status
|
|
skip_reason *string
|
|
repository *dbpackage.Repository
|
|
march *string
|
|
version *string
|
|
repo_version *string
|
|
build_time_start *time.Time
|
|
build_time_end *time.Time
|
|
updated *time.Time
|
|
hash *string
|
|
clearedFields map[string]struct{}
|
|
done bool
|
|
oldValue func(context.Context) (*DbPackage, error)
|
|
predicates []predicate.DbPackage
|
|
}
|
|
|
|
var _ ent.Mutation = (*DbPackageMutation)(nil)
|
|
|
|
// dbpackageOption allows management of the mutation configuration using functional options.
|
|
type dbpackageOption func(*DbPackageMutation)
|
|
|
|
// newDbPackageMutation creates new mutation for the DbPackage entity.
|
|
func newDbPackageMutation(c config, op Op, opts ...dbpackageOption) *DbPackageMutation {
|
|
m := &DbPackageMutation{
|
|
config: c,
|
|
op: op,
|
|
typ: TypeDbPackage,
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
for _, opt := range opts {
|
|
opt(m)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// withDbPackageID sets the ID field of the mutation.
|
|
func withDbPackageID(id int) dbpackageOption {
|
|
return func(m *DbPackageMutation) {
|
|
var (
|
|
err error
|
|
once sync.Once
|
|
value *DbPackage
|
|
)
|
|
m.oldValue = func(ctx context.Context) (*DbPackage, error) {
|
|
once.Do(func() {
|
|
if m.done {
|
|
err = fmt.Errorf("querying old values post mutation is not allowed")
|
|
} else {
|
|
value, err = m.Client().DbPackage.Get(ctx, id)
|
|
}
|
|
})
|
|
return value, err
|
|
}
|
|
m.id = &id
|
|
}
|
|
}
|
|
|
|
// withDbPackage sets the old DbPackage of the mutation.
|
|
func withDbPackage(node *DbPackage) dbpackageOption {
|
|
return func(m *DbPackageMutation) {
|
|
m.oldValue = func(context.Context) (*DbPackage, error) {
|
|
return node, nil
|
|
}
|
|
m.id = &node.ID
|
|
}
|
|
}
|
|
|
|
// Client returns a new `ent.Client` from the mutation. If the mutation was
|
|
// executed in a transaction (ent.Tx), a transactional client is returned.
|
|
func (m DbPackageMutation) Client() *Client {
|
|
client := &Client{config: m.config}
|
|
client.init()
|
|
return client
|
|
}
|
|
|
|
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
|
|
// it returns an error otherwise.
|
|
func (m DbPackageMutation) Tx() (*Tx, error) {
|
|
if _, ok := m.driver.(*txDriver); !ok {
|
|
return nil, fmt.Errorf("ent: mutation is not running in a transaction")
|
|
}
|
|
tx := &Tx{config: m.config}
|
|
tx.init()
|
|
return tx, nil
|
|
}
|
|
|
|
// ID returns the ID value in the mutation. Note that the ID is only available
|
|
// if it was provided to the builder or after it was returned from the database.
|
|
func (m *DbPackageMutation) ID() (id int, exists bool) {
|
|
if m.id == nil {
|
|
return
|
|
}
|
|
return *m.id, true
|
|
}
|
|
|
|
// SetPkgbase sets the "pkgbase" field.
|
|
func (m *DbPackageMutation) SetPkgbase(s string) {
|
|
m.pkgbase = &s
|
|
}
|
|
|
|
// Pkgbase returns the value of the "pkgbase" field in the mutation.
|
|
func (m *DbPackageMutation) Pkgbase() (r string, exists bool) {
|
|
v := m.pkgbase
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldPkgbase returns the old "pkgbase" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldPkgbase(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldPkgbase is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldPkgbase requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldPkgbase: %w", err)
|
|
}
|
|
return oldValue.Pkgbase, nil
|
|
}
|
|
|
|
// ResetPkgbase resets all changes to the "pkgbase" field.
|
|
func (m *DbPackageMutation) ResetPkgbase() {
|
|
m.pkgbase = nil
|
|
}
|
|
|
|
// SetPackages sets the "packages" field.
|
|
func (m *DbPackageMutation) SetPackages(s []string) {
|
|
m.packages = &s
|
|
}
|
|
|
|
// Packages returns the value of the "packages" field in the mutation.
|
|
func (m *DbPackageMutation) Packages() (r []string, exists bool) {
|
|
v := m.packages
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldPackages returns the old "packages" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldPackages(ctx context.Context) (v []string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldPackages is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldPackages requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldPackages: %w", err)
|
|
}
|
|
return oldValue.Packages, nil
|
|
}
|
|
|
|
// ClearPackages clears the value of the "packages" field.
|
|
func (m *DbPackageMutation) ClearPackages() {
|
|
m.packages = nil
|
|
m.clearedFields[dbpackage.FieldPackages] = struct{}{}
|
|
}
|
|
|
|
// PackagesCleared returns if the "packages" field was cleared in this mutation.
|
|
func (m *DbPackageMutation) PackagesCleared() bool {
|
|
_, ok := m.clearedFields[dbpackage.FieldPackages]
|
|
return ok
|
|
}
|
|
|
|
// ResetPackages resets all changes to the "packages" field.
|
|
func (m *DbPackageMutation) ResetPackages() {
|
|
m.packages = nil
|
|
delete(m.clearedFields, dbpackage.FieldPackages)
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (m *DbPackageMutation) SetStatus(d dbpackage.Status) {
|
|
m.status = &d
|
|
}
|
|
|
|
// Status returns the value of the "status" field in the mutation.
|
|
func (m *DbPackageMutation) Status() (r dbpackage.Status, exists bool) {
|
|
v := m.status
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldStatus returns the old "status" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldStatus(ctx context.Context) (v dbpackage.Status, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldStatus is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldStatus requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldStatus: %w", err)
|
|
}
|
|
return oldValue.Status, nil
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (m *DbPackageMutation) ClearStatus() {
|
|
m.status = nil
|
|
m.clearedFields[dbpackage.FieldStatus] = struct{}{}
|
|
}
|
|
|
|
// StatusCleared returns if the "status" field was cleared in this mutation.
|
|
func (m *DbPackageMutation) StatusCleared() bool {
|
|
_, ok := m.clearedFields[dbpackage.FieldStatus]
|
|
return ok
|
|
}
|
|
|
|
// ResetStatus resets all changes to the "status" field.
|
|
func (m *DbPackageMutation) ResetStatus() {
|
|
m.status = nil
|
|
delete(m.clearedFields, dbpackage.FieldStatus)
|
|
}
|
|
|
|
// SetSkipReason sets the "skip_reason" field.
|
|
func (m *DbPackageMutation) SetSkipReason(s string) {
|
|
m.skip_reason = &s
|
|
}
|
|
|
|
// SkipReason returns the value of the "skip_reason" field in the mutation.
|
|
func (m *DbPackageMutation) SkipReason() (r string, exists bool) {
|
|
v := m.skip_reason
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldSkipReason returns the old "skip_reason" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldSkipReason(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldSkipReason is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldSkipReason requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldSkipReason: %w", err)
|
|
}
|
|
return oldValue.SkipReason, nil
|
|
}
|
|
|
|
// ClearSkipReason clears the value of the "skip_reason" field.
|
|
func (m *DbPackageMutation) ClearSkipReason() {
|
|
m.skip_reason = nil
|
|
m.clearedFields[dbpackage.FieldSkipReason] = struct{}{}
|
|
}
|
|
|
|
// SkipReasonCleared returns if the "skip_reason" field was cleared in this mutation.
|
|
func (m *DbPackageMutation) SkipReasonCleared() bool {
|
|
_, ok := m.clearedFields[dbpackage.FieldSkipReason]
|
|
return ok
|
|
}
|
|
|
|
// ResetSkipReason resets all changes to the "skip_reason" field.
|
|
func (m *DbPackageMutation) ResetSkipReason() {
|
|
m.skip_reason = nil
|
|
delete(m.clearedFields, dbpackage.FieldSkipReason)
|
|
}
|
|
|
|
// SetRepository sets the "repository" field.
|
|
func (m *DbPackageMutation) SetRepository(d dbpackage.Repository) {
|
|
m.repository = &d
|
|
}
|
|
|
|
// Repository returns the value of the "repository" field in the mutation.
|
|
func (m *DbPackageMutation) Repository() (r dbpackage.Repository, exists bool) {
|
|
v := m.repository
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldRepository returns the old "repository" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldRepository(ctx context.Context) (v dbpackage.Repository, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldRepository is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldRepository requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldRepository: %w", err)
|
|
}
|
|
return oldValue.Repository, nil
|
|
}
|
|
|
|
// ResetRepository resets all changes to the "repository" field.
|
|
func (m *DbPackageMutation) ResetRepository() {
|
|
m.repository = nil
|
|
}
|
|
|
|
// SetMarch sets the "march" field.
|
|
func (m *DbPackageMutation) SetMarch(s string) {
|
|
m.march = &s
|
|
}
|
|
|
|
// March returns the value of the "march" field in the mutation.
|
|
func (m *DbPackageMutation) March() (r string, exists bool) {
|
|
v := m.march
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldMarch returns the old "march" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldMarch(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldMarch is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldMarch requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldMarch: %w", err)
|
|
}
|
|
return oldValue.March, nil
|
|
}
|
|
|
|
// ResetMarch resets all changes to the "march" field.
|
|
func (m *DbPackageMutation) ResetMarch() {
|
|
m.march = nil
|
|
}
|
|
|
|
// SetVersion sets the "version" field.
|
|
func (m *DbPackageMutation) SetVersion(s string) {
|
|
m.version = &s
|
|
}
|
|
|
|
// Version returns the value of the "version" field in the mutation.
|
|
func (m *DbPackageMutation) Version() (r string, exists bool) {
|
|
v := m.version
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldVersion returns the old "version" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldVersion(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldVersion is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldVersion requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldVersion: %w", err)
|
|
}
|
|
return oldValue.Version, nil
|
|
}
|
|
|
|
// ClearVersion clears the value of the "version" field.
|
|
func (m *DbPackageMutation) ClearVersion() {
|
|
m.version = nil
|
|
m.clearedFields[dbpackage.FieldVersion] = struct{}{}
|
|
}
|
|
|
|
// VersionCleared returns if the "version" field was cleared in this mutation.
|
|
func (m *DbPackageMutation) VersionCleared() bool {
|
|
_, ok := m.clearedFields[dbpackage.FieldVersion]
|
|
return ok
|
|
}
|
|
|
|
// ResetVersion resets all changes to the "version" field.
|
|
func (m *DbPackageMutation) ResetVersion() {
|
|
m.version = nil
|
|
delete(m.clearedFields, dbpackage.FieldVersion)
|
|
}
|
|
|
|
// SetRepoVersion sets the "repo_version" field.
|
|
func (m *DbPackageMutation) SetRepoVersion(s string) {
|
|
m.repo_version = &s
|
|
}
|
|
|
|
// RepoVersion returns the value of the "repo_version" field in the mutation.
|
|
func (m *DbPackageMutation) RepoVersion() (r string, exists bool) {
|
|
v := m.repo_version
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldRepoVersion returns the old "repo_version" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldRepoVersion(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldRepoVersion is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldRepoVersion requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldRepoVersion: %w", err)
|
|
}
|
|
return oldValue.RepoVersion, nil
|
|
}
|
|
|
|
// ClearRepoVersion clears the value of the "repo_version" field.
|
|
func (m *DbPackageMutation) ClearRepoVersion() {
|
|
m.repo_version = nil
|
|
m.clearedFields[dbpackage.FieldRepoVersion] = struct{}{}
|
|
}
|
|
|
|
// RepoVersionCleared returns if the "repo_version" field was cleared in this mutation.
|
|
func (m *DbPackageMutation) RepoVersionCleared() bool {
|
|
_, ok := m.clearedFields[dbpackage.FieldRepoVersion]
|
|
return ok
|
|
}
|
|
|
|
// ResetRepoVersion resets all changes to the "repo_version" field.
|
|
func (m *DbPackageMutation) ResetRepoVersion() {
|
|
m.repo_version = nil
|
|
delete(m.clearedFields, dbpackage.FieldRepoVersion)
|
|
}
|
|
|
|
// SetBuildTimeStart sets the "build_time_start" field.
|
|
func (m *DbPackageMutation) SetBuildTimeStart(t time.Time) {
|
|
m.build_time_start = &t
|
|
}
|
|
|
|
// BuildTimeStart returns the value of the "build_time_start" field in the mutation.
|
|
func (m *DbPackageMutation) BuildTimeStart() (r time.Time, exists bool) {
|
|
v := m.build_time_start
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldBuildTimeStart returns the old "build_time_start" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldBuildTimeStart(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldBuildTimeStart is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldBuildTimeStart requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldBuildTimeStart: %w", err)
|
|
}
|
|
return oldValue.BuildTimeStart, nil
|
|
}
|
|
|
|
// ClearBuildTimeStart clears the value of the "build_time_start" field.
|
|
func (m *DbPackageMutation) ClearBuildTimeStart() {
|
|
m.build_time_start = nil
|
|
m.clearedFields[dbpackage.FieldBuildTimeStart] = struct{}{}
|
|
}
|
|
|
|
// BuildTimeStartCleared returns if the "build_time_start" field was cleared in this mutation.
|
|
func (m *DbPackageMutation) BuildTimeStartCleared() bool {
|
|
_, ok := m.clearedFields[dbpackage.FieldBuildTimeStart]
|
|
return ok
|
|
}
|
|
|
|
// ResetBuildTimeStart resets all changes to the "build_time_start" field.
|
|
func (m *DbPackageMutation) ResetBuildTimeStart() {
|
|
m.build_time_start = nil
|
|
delete(m.clearedFields, dbpackage.FieldBuildTimeStart)
|
|
}
|
|
|
|
// SetBuildTimeEnd sets the "build_time_end" field.
|
|
func (m *DbPackageMutation) SetBuildTimeEnd(t time.Time) {
|
|
m.build_time_end = &t
|
|
}
|
|
|
|
// BuildTimeEnd returns the value of the "build_time_end" field in the mutation.
|
|
func (m *DbPackageMutation) BuildTimeEnd() (r time.Time, exists bool) {
|
|
v := m.build_time_end
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldBuildTimeEnd returns the old "build_time_end" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldBuildTimeEnd(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldBuildTimeEnd is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldBuildTimeEnd requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldBuildTimeEnd: %w", err)
|
|
}
|
|
return oldValue.BuildTimeEnd, nil
|
|
}
|
|
|
|
// ClearBuildTimeEnd clears the value of the "build_time_end" field.
|
|
func (m *DbPackageMutation) ClearBuildTimeEnd() {
|
|
m.build_time_end = nil
|
|
m.clearedFields[dbpackage.FieldBuildTimeEnd] = struct{}{}
|
|
}
|
|
|
|
// BuildTimeEndCleared returns if the "build_time_end" field was cleared in this mutation.
|
|
func (m *DbPackageMutation) BuildTimeEndCleared() bool {
|
|
_, ok := m.clearedFields[dbpackage.FieldBuildTimeEnd]
|
|
return ok
|
|
}
|
|
|
|
// ResetBuildTimeEnd resets all changes to the "build_time_end" field.
|
|
func (m *DbPackageMutation) ResetBuildTimeEnd() {
|
|
m.build_time_end = nil
|
|
delete(m.clearedFields, dbpackage.FieldBuildTimeEnd)
|
|
}
|
|
|
|
// SetUpdated sets the "updated" field.
|
|
func (m *DbPackageMutation) SetUpdated(t time.Time) {
|
|
m.updated = &t
|
|
}
|
|
|
|
// Updated returns the value of the "updated" field in the mutation.
|
|
func (m *DbPackageMutation) Updated() (r time.Time, exists bool) {
|
|
v := m.updated
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldUpdated returns the old "updated" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldUpdated(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldUpdated is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldUpdated requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldUpdated: %w", err)
|
|
}
|
|
return oldValue.Updated, nil
|
|
}
|
|
|
|
// ClearUpdated clears the value of the "updated" field.
|
|
func (m *DbPackageMutation) ClearUpdated() {
|
|
m.updated = nil
|
|
m.clearedFields[dbpackage.FieldUpdated] = struct{}{}
|
|
}
|
|
|
|
// UpdatedCleared returns if the "updated" field was cleared in this mutation.
|
|
func (m *DbPackageMutation) UpdatedCleared() bool {
|
|
_, ok := m.clearedFields[dbpackage.FieldUpdated]
|
|
return ok
|
|
}
|
|
|
|
// ResetUpdated resets all changes to the "updated" field.
|
|
func (m *DbPackageMutation) ResetUpdated() {
|
|
m.updated = nil
|
|
delete(m.clearedFields, dbpackage.FieldUpdated)
|
|
}
|
|
|
|
// SetHash sets the "hash" field.
|
|
func (m *DbPackageMutation) SetHash(s string) {
|
|
m.hash = &s
|
|
}
|
|
|
|
// Hash returns the value of the "hash" field in the mutation.
|
|
func (m *DbPackageMutation) Hash() (r string, exists bool) {
|
|
v := m.hash
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldHash returns the old "hash" field's value of the DbPackage entity.
|
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
func (m *DbPackageMutation) OldHash(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, fmt.Errorf("OldHash is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, fmt.Errorf("OldHash requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldHash: %w", err)
|
|
}
|
|
return oldValue.Hash, nil
|
|
}
|
|
|
|
// ClearHash clears the value of the "hash" field.
|
|
func (m *DbPackageMutation) ClearHash() {
|
|
m.hash = nil
|
|
m.clearedFields[dbpackage.FieldHash] = struct{}{}
|
|
}
|
|
|
|
// HashCleared returns if the "hash" field was cleared in this mutation.
|
|
func (m *DbPackageMutation) HashCleared() bool {
|
|
_, ok := m.clearedFields[dbpackage.FieldHash]
|
|
return ok
|
|
}
|
|
|
|
// ResetHash resets all changes to the "hash" field.
|
|
func (m *DbPackageMutation) ResetHash() {
|
|
m.hash = nil
|
|
delete(m.clearedFields, dbpackage.FieldHash)
|
|
}
|
|
|
|
// Where appends a list predicates to the DbPackageMutation builder.
|
|
func (m *DbPackageMutation) Where(ps ...predicate.DbPackage) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// Op returns the operation name.
|
|
func (m *DbPackageMutation) Op() Op {
|
|
return m.op
|
|
}
|
|
|
|
// Type returns the node type of this mutation (DbPackage).
|
|
func (m *DbPackageMutation) Type() string {
|
|
return m.typ
|
|
}
|
|
|
|
// Fields returns all fields that were changed during this mutation. Note that in
|
|
// order to get all numeric fields that were incremented/decremented, call
|
|
// AddedFields().
|
|
func (m *DbPackageMutation) Fields() []string {
|
|
fields := make([]string, 0, 12)
|
|
if m.pkgbase != nil {
|
|
fields = append(fields, dbpackage.FieldPkgbase)
|
|
}
|
|
if m.packages != nil {
|
|
fields = append(fields, dbpackage.FieldPackages)
|
|
}
|
|
if m.status != nil {
|
|
fields = append(fields, dbpackage.FieldStatus)
|
|
}
|
|
if m.skip_reason != nil {
|
|
fields = append(fields, dbpackage.FieldSkipReason)
|
|
}
|
|
if m.repository != nil {
|
|
fields = append(fields, dbpackage.FieldRepository)
|
|
}
|
|
if m.march != nil {
|
|
fields = append(fields, dbpackage.FieldMarch)
|
|
}
|
|
if m.version != nil {
|
|
fields = append(fields, dbpackage.FieldVersion)
|
|
}
|
|
if m.repo_version != nil {
|
|
fields = append(fields, dbpackage.FieldRepoVersion)
|
|
}
|
|
if m.build_time_start != nil {
|
|
fields = append(fields, dbpackage.FieldBuildTimeStart)
|
|
}
|
|
if m.build_time_end != nil {
|
|
fields = append(fields, dbpackage.FieldBuildTimeEnd)
|
|
}
|
|
if m.updated != nil {
|
|
fields = append(fields, dbpackage.FieldUpdated)
|
|
}
|
|
if m.hash != nil {
|
|
fields = append(fields, dbpackage.FieldHash)
|
|
}
|
|
return fields
|
|
}
|
|
|
|
// Field returns the value of a field with the given name. The second boolean
|
|
// return value indicates that this field was not set, or was not defined in the
|
|
// schema.
|
|
func (m *DbPackageMutation) Field(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case dbpackage.FieldPkgbase:
|
|
return m.Pkgbase()
|
|
case dbpackage.FieldPackages:
|
|
return m.Packages()
|
|
case dbpackage.FieldStatus:
|
|
return m.Status()
|
|
case dbpackage.FieldSkipReason:
|
|
return m.SkipReason()
|
|
case dbpackage.FieldRepository:
|
|
return m.Repository()
|
|
case dbpackage.FieldMarch:
|
|
return m.March()
|
|
case dbpackage.FieldVersion:
|
|
return m.Version()
|
|
case dbpackage.FieldRepoVersion:
|
|
return m.RepoVersion()
|
|
case dbpackage.FieldBuildTimeStart:
|
|
return m.BuildTimeStart()
|
|
case dbpackage.FieldBuildTimeEnd:
|
|
return m.BuildTimeEnd()
|
|
case dbpackage.FieldUpdated:
|
|
return m.Updated()
|
|
case dbpackage.FieldHash:
|
|
return m.Hash()
|
|
}
|
|
return nil, false
|
|
}
|
|
|
|
// OldField returns the old value of the field from the database. An error is
|
|
// returned if the mutation operation is not UpdateOne, or the query to the
|
|
// database failed.
|
|
func (m *DbPackageMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
switch name {
|
|
case dbpackage.FieldPkgbase:
|
|
return m.OldPkgbase(ctx)
|
|
case dbpackage.FieldPackages:
|
|
return m.OldPackages(ctx)
|
|
case dbpackage.FieldStatus:
|
|
return m.OldStatus(ctx)
|
|
case dbpackage.FieldSkipReason:
|
|
return m.OldSkipReason(ctx)
|
|
case dbpackage.FieldRepository:
|
|
return m.OldRepository(ctx)
|
|
case dbpackage.FieldMarch:
|
|
return m.OldMarch(ctx)
|
|
case dbpackage.FieldVersion:
|
|
return m.OldVersion(ctx)
|
|
case dbpackage.FieldRepoVersion:
|
|
return m.OldRepoVersion(ctx)
|
|
case dbpackage.FieldBuildTimeStart:
|
|
return m.OldBuildTimeStart(ctx)
|
|
case dbpackage.FieldBuildTimeEnd:
|
|
return m.OldBuildTimeEnd(ctx)
|
|
case dbpackage.FieldUpdated:
|
|
return m.OldUpdated(ctx)
|
|
case dbpackage.FieldHash:
|
|
return m.OldHash(ctx)
|
|
}
|
|
return nil, fmt.Errorf("unknown DbPackage field %s", name)
|
|
}
|
|
|
|
// SetField sets the value of a field with the given name. It returns an error if
|
|
// the field is not defined in the schema, or if the type mismatched the field
|
|
// type.
|
|
func (m *DbPackageMutation) SetField(name string, value ent.Value) error {
|
|
switch name {
|
|
case dbpackage.FieldPkgbase:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetPkgbase(v)
|
|
return nil
|
|
case dbpackage.FieldPackages:
|
|
v, ok := value.([]string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetPackages(v)
|
|
return nil
|
|
case dbpackage.FieldStatus:
|
|
v, ok := value.(dbpackage.Status)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetStatus(v)
|
|
return nil
|
|
case dbpackage.FieldSkipReason:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetSkipReason(v)
|
|
return nil
|
|
case dbpackage.FieldRepository:
|
|
v, ok := value.(dbpackage.Repository)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetRepository(v)
|
|
return nil
|
|
case dbpackage.FieldMarch:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetMarch(v)
|
|
return nil
|
|
case dbpackage.FieldVersion:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetVersion(v)
|
|
return nil
|
|
case dbpackage.FieldRepoVersion:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetRepoVersion(v)
|
|
return nil
|
|
case dbpackage.FieldBuildTimeStart:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBuildTimeStart(v)
|
|
return nil
|
|
case dbpackage.FieldBuildTimeEnd:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBuildTimeEnd(v)
|
|
return nil
|
|
case dbpackage.FieldUpdated:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUpdated(v)
|
|
return nil
|
|
case dbpackage.FieldHash:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetHash(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown DbPackage field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *DbPackageMutation) AddedFields() []string {
|
|
return nil
|
|
}
|
|
|
|
// AddedField returns the numeric value that was incremented/decremented on a field
|
|
// with the given name. The second boolean return value indicates that this field
|
|
// was not set, or was not defined in the schema.
|
|
func (m *DbPackageMutation) AddedField(name string) (ent.Value, bool) {
|
|
return nil, false
|
|
}
|
|
|
|
// AddField adds the value to the field with the given name. It returns an error if
|
|
// the field is not defined in the schema, or if the type mismatched the field
|
|
// type.
|
|
func (m *DbPackageMutation) AddField(name string, value ent.Value) error {
|
|
switch name {
|
|
}
|
|
return fmt.Errorf("unknown DbPackage numeric field %s", name)
|
|
}
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
// mutation.
|
|
func (m *DbPackageMutation) ClearedFields() []string {
|
|
var fields []string
|
|
if m.FieldCleared(dbpackage.FieldPackages) {
|
|
fields = append(fields, dbpackage.FieldPackages)
|
|
}
|
|
if m.FieldCleared(dbpackage.FieldStatus) {
|
|
fields = append(fields, dbpackage.FieldStatus)
|
|
}
|
|
if m.FieldCleared(dbpackage.FieldSkipReason) {
|
|
fields = append(fields, dbpackage.FieldSkipReason)
|
|
}
|
|
if m.FieldCleared(dbpackage.FieldVersion) {
|
|
fields = append(fields, dbpackage.FieldVersion)
|
|
}
|
|
if m.FieldCleared(dbpackage.FieldRepoVersion) {
|
|
fields = append(fields, dbpackage.FieldRepoVersion)
|
|
}
|
|
if m.FieldCleared(dbpackage.FieldBuildTimeStart) {
|
|
fields = append(fields, dbpackage.FieldBuildTimeStart)
|
|
}
|
|
if m.FieldCleared(dbpackage.FieldBuildTimeEnd) {
|
|
fields = append(fields, dbpackage.FieldBuildTimeEnd)
|
|
}
|
|
if m.FieldCleared(dbpackage.FieldUpdated) {
|
|
fields = append(fields, dbpackage.FieldUpdated)
|
|
}
|
|
if m.FieldCleared(dbpackage.FieldHash) {
|
|
fields = append(fields, dbpackage.FieldHash)
|
|
}
|
|
return fields
|
|
}
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
// cleared in this mutation.
|
|
func (m *DbPackageMutation) FieldCleared(name string) bool {
|
|
_, ok := m.clearedFields[name]
|
|
return ok
|
|
}
|
|
|
|
// ClearField clears the value of the field with the given name. It returns an
|
|
// error if the field is not defined in the schema.
|
|
func (m *DbPackageMutation) ClearField(name string) error {
|
|
switch name {
|
|
case dbpackage.FieldPackages:
|
|
m.ClearPackages()
|
|
return nil
|
|
case dbpackage.FieldStatus:
|
|
m.ClearStatus()
|
|
return nil
|
|
case dbpackage.FieldSkipReason:
|
|
m.ClearSkipReason()
|
|
return nil
|
|
case dbpackage.FieldVersion:
|
|
m.ClearVersion()
|
|
return nil
|
|
case dbpackage.FieldRepoVersion:
|
|
m.ClearRepoVersion()
|
|
return nil
|
|
case dbpackage.FieldBuildTimeStart:
|
|
m.ClearBuildTimeStart()
|
|
return nil
|
|
case dbpackage.FieldBuildTimeEnd:
|
|
m.ClearBuildTimeEnd()
|
|
return nil
|
|
case dbpackage.FieldUpdated:
|
|
m.ClearUpdated()
|
|
return nil
|
|
case dbpackage.FieldHash:
|
|
m.ClearHash()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown DbPackage nullable field %s", name)
|
|
}
|
|
|
|
// ResetField resets all changes in the mutation for the field with the given name.
|
|
// It returns an error if the field is not defined in the schema.
|
|
func (m *DbPackageMutation) ResetField(name string) error {
|
|
switch name {
|
|
case dbpackage.FieldPkgbase:
|
|
m.ResetPkgbase()
|
|
return nil
|
|
case dbpackage.FieldPackages:
|
|
m.ResetPackages()
|
|
return nil
|
|
case dbpackage.FieldStatus:
|
|
m.ResetStatus()
|
|
return nil
|
|
case dbpackage.FieldSkipReason:
|
|
m.ResetSkipReason()
|
|
return nil
|
|
case dbpackage.FieldRepository:
|
|
m.ResetRepository()
|
|
return nil
|
|
case dbpackage.FieldMarch:
|
|
m.ResetMarch()
|
|
return nil
|
|
case dbpackage.FieldVersion:
|
|
m.ResetVersion()
|
|
return nil
|
|
case dbpackage.FieldRepoVersion:
|
|
m.ResetRepoVersion()
|
|
return nil
|
|
case dbpackage.FieldBuildTimeStart:
|
|
m.ResetBuildTimeStart()
|
|
return nil
|
|
case dbpackage.FieldBuildTimeEnd:
|
|
m.ResetBuildTimeEnd()
|
|
return nil
|
|
case dbpackage.FieldUpdated:
|
|
m.ResetUpdated()
|
|
return nil
|
|
case dbpackage.FieldHash:
|
|
m.ResetHash()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown DbPackage field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *DbPackageMutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 0)
|
|
return edges
|
|
}
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
// name in this mutation.
|
|
func (m *DbPackageMutation) AddedIDs(name string) []ent.Value {
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *DbPackageMutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 0)
|
|
return edges
|
|
}
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
// the given name in this mutation.
|
|
func (m *DbPackageMutation) RemovedIDs(name string) []ent.Value {
|
|
return nil
|
|
}
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
func (m *DbPackageMutation) ClearedEdges() []string {
|
|
edges := make([]string, 0, 0)
|
|
return edges
|
|
}
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
// was cleared in this mutation.
|
|
func (m *DbPackageMutation) EdgeCleared(name string) bool {
|
|
return false
|
|
}
|
|
|
|
// ClearEdge clears the value of the edge with the given name. It returns an error
|
|
// if that edge is not defined in the schema.
|
|
func (m *DbPackageMutation) ClearEdge(name string) error {
|
|
return fmt.Errorf("unknown DbPackage unique edge %s", name)
|
|
}
|
|
|
|
// ResetEdge resets all changes to the edge with the given name in this mutation.
|
|
// It returns an error if the edge is not defined in the schema.
|
|
func (m *DbPackageMutation) ResetEdge(name string) error {
|
|
return fmt.Errorf("unknown DbPackage edge %s", name)
|
|
}
|