Git-based package source layout (#193)

Co-authored-by: Giovanni Harting <539@idlegandalf.com>
Reviewed-on: #193
This commit is contained in:
anonfunc 2023-05-21 20:28:23 +02:00
parent 786b70b842
commit fa902fa68c
25 changed files with 1541 additions and 2386 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"context"
"errors"
"fmt"
"github.com/c2h5oh/datasize"
"github.com/sethvargo/go-retry"
@ -10,7 +11,6 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"somegit.dev/ALHP/ALHP.GO/ent"
"somegit.dev/ALHP/ALHP.GO/ent/dbpackage"
"strings"
@ -30,91 +30,6 @@ type BuildManager struct {
queueSignal chan struct{}
}
func (b *BuildManager) refreshSRCINFOs(ctx context.Context, path string) error {
pkgBuilds, err := Glob(path)
if err != nil {
return fmt.Errorf("error scanning for PKGBUILDs: %w", err)
}
wg := new(sync.WaitGroup)
workerChan := make(chan string, runtime.NumCPU())
for o := 0; o < runtime.NumCPU(); o++ {
wg.Add(1)
go b.SRCINFOWorker(ctx, workerChan, wg)
}
go func() {
for _, pkgbuild := range pkgBuilds {
workerChan <- pkgbuild
}
close(workerChan)
}()
wg.Wait()
return nil
}
func (b *BuildManager) SRCINFOWorker(ctx context.Context, workIn chan string, wg *sync.WaitGroup) {
defer wg.Done()
for pkgbuild := range workIn {
mPkgbuild := PKGBUILD(pkgbuild)
if mPkgbuild.FullRepo() == "trunk" || !Contains(conf.Repos, mPkgbuild.Repo()) ||
containsSubStr(mPkgbuild.FullRepo(), conf.Blacklist.Repo) {
continue
}
for _, march := range conf.March {
dbPkg, dbErr := db.DbPackage.Query().Where(
dbpackage.And(
dbpackage.Pkgbase(mPkgbuild.PkgBase()),
dbpackage.RepositoryEQ(dbpackage.Repository(mPkgbuild.Repo())),
dbpackage.March(march),
),
).Only(context.Background())
if ent.IsNotFound(dbErr) {
log.Debugf("[%s/%s] Package not found in database", mPkgbuild.Repo(), mPkgbuild.PkgBase())
} else if dbErr != nil {
log.Errorf("[%s/%s] Problem querying db for package: %v", mPkgbuild.Repo(), mPkgbuild.PkgBase(), dbErr)
}
// compare b3sum of PKGBUILD file to hash in database, only proceed if hash differs
// reduces the amount of PKGBUILDs that need to be parsed with makepkg, which is _really_ slow, significantly
b3s, err := b3sum(pkgbuild)
if err != nil {
log.Errorf("Error hashing PKGBUILD: %v", err)
}
if dbPkg != nil && b3s == dbPkg.Hash {
log.Debugf("[%s/%s] Skipped: PKGBUILD hash matches db (%s)", mPkgbuild.Repo(), mPkgbuild.PkgBase(), b3s)
continue
} else if dbPkg != nil && b3s != dbPkg.Hash && dbPkg.SrcinfoHash != b3s {
log.Debugf("[%s/%s] srcinfo cleared", mPkgbuild.Repo(), mPkgbuild.PkgBase())
dbPkg = dbPkg.Update().ClearSrcinfo().SaveX(context.Background())
}
proto := &ProtoPackage{
Pkgbuild: pkgbuild,
Pkgbase: mPkgbuild.PkgBase(),
Repo: dbpackage.Repository(mPkgbuild.Repo()),
March: march,
FullRepo: mPkgbuild.Repo() + "-" + march,
Hash: b3s,
DBPackage: dbPkg,
}
_, err = proto.isEligible(ctx)
if err != nil {
log.Infof("Unable to determine status for package %s: %v", proto.Pkgbase, err)
b.repoPurge[proto.FullRepo] <- []*ProtoPackage{proto}
} else if proto.DBPackage != nil {
proto.DBPackage.Update().SetPkgbuild(proto.Pkgbuild).ExecX(ctx)
}
}
}
}
func (b *BuildManager) buildQueue(queue []*ProtoPackage, ctx context.Context) error {
var (
doneQ []*ProtoPackage
@ -194,10 +109,10 @@ func (b *BuildManager) buildQueue(queue []*ProtoPackage, ctx context.Context) er
go func(pkg *ProtoPackage) {
dur, err := pkg.build(ctx)
if err != nil {
if err != nil && !errors.Is(err, ErrorNotEligible) {
log.Warningf("[Q] error building package %s->%s in %s: %s", pkg.FullRepo, pkg.Pkgbase, dur, err)
b.repoPurge[pkg.FullRepo] <- []*ProtoPackage{pkg}
} else {
} else if err == nil {
log.Infof("[Q] build successful: %s->%s (%s)", pkg.FullRepo, pkg.Pkgbase, dur)
}
doneQLock.Lock()
@ -289,7 +204,7 @@ func (b *BuildManager) htmlWorker(ctx context.Context) {
Name: repo,
}
pkgs := db.DbPackage.Query().Order(ent.Asc(dbpackage.FieldPkgbase)).
pkgs := db.DBPackage.Query().Order(ent.Asc(dbpackage.FieldPkgbase)).
Where(dbpackage.MarchEQ(march), dbpackage.RepositoryEQ(dbpackage.Repository(repo))).AllX(ctx)
for _, pkg := range pkgs {
@ -361,7 +276,7 @@ func (b *BuildManager) htmlWorker(ctx context.Context) {
Count int `json:"count"`
}
db.DbPackage.Query().GroupBy(dbpackage.FieldStatus).Aggregate(ent.Count()).ScanX(ctx, &v)
db.DBPackage.Query().GroupBy(dbpackage.FieldStatus).Aggregate(ent.Count()).ScanX(ctx, &v)
for _, c := range v {
switch c.Status {
@ -381,7 +296,7 @@ func (b *BuildManager) htmlWorker(ctx context.Context) {
Count int `json:"count"`
}
db.DbPackage.Query().Where(dbpackage.StatusNEQ(dbpackage.StatusSkipped)).
db.DBPackage.Query().Where(dbpackage.StatusNEQ(dbpackage.StatusSkipped)).
GroupBy(dbpackage.FieldLto).Aggregate(ent.Count()).ScanX(ctx, &v2)
for _, c := range v2 {
@ -436,36 +351,37 @@ func (b *BuildManager) repoWorker(repo string) {
}
for _, pkg := range pkgL {
pkg.toDBPackage(true)
err = pkg.toDBPackage(true)
if err != nil {
log.Warningf("error getting db entry for %s: %v", pkg.Pkgbase, err)
continue
}
pkgUpd := pkg.DBPackage.Update().
SetStatus(dbpackage.StatusLatest).
ClearSkipReason().
SetRepoVersion(pkg.Version).
SetTagRev(pkg.State.TagRev)
if _, err := os.Stat(filepath.Join(conf.Basedir.Debug, pkg.March,
pkg.DBPackage.Packages[0]+"-debug-"+pkg.Version+"-"+conf.Arch+".pkg.tar.zst")); err == nil {
pkg.DBPackage = pkg.DBPackage.Update().
SetStatus(dbpackage.StatusLatest).
ClearSkipReason().
SetDebugSymbols(dbpackage.DebugSymbolsAvailable).
SetRepoVersion(pkg.Version).
SetHash(pkg.Hash).
SaveX(context.Background())
pkgUpd = pkgUpd.SetDebugSymbols(dbpackage.DebugSymbolsAvailable)
} else {
pkg.DBPackage = pkg.DBPackage.Update().
SetStatus(dbpackage.StatusLatest).
ClearSkipReason().
SetDebugSymbols(dbpackage.DebugSymbolsNotAvailable).
SetRepoVersion(pkg.Version).
SetHash(pkg.Hash).
SaveX(context.Background())
pkgUpd = pkgUpd.SetDebugSymbols(dbpackage.DebugSymbolsNotAvailable)
}
pkg.DBPackage = pkgUpd.SaveX(context.Background())
}
cmd = exec.Command("paccache", "-rc", filepath.Join(conf.Basedir.Repo, repo, "os", conf.Arch), "-k", "1") //nolint:gosec
cmd = exec.Command("paccache", "-rc", filepath.Join(conf.Basedir.Repo, repo, "os", conf.Arch), "-k", "1")
res, err = cmd.CombinedOutput()
log.Debug(string(res))
if err != nil {
log.Warningf("Error running paccache: %v", err)
log.Warningf("error running paccache: %v", err)
}
err = updateLastUpdated()
if err != nil {
log.Warningf("Error updating lastupdate: %v", err)
log.Warningf("error updating lastupdate: %v", err)
}
b.repoWG.Done()
case pkgL := <-b.repoPurge[repo]:
@ -475,7 +391,7 @@ func (b *BuildManager) repoWorker(repo string) {
}
if len(pkg.PkgFiles) == 0 {
if err := pkg.findPkgFiles(); err != nil {
log.Warningf("[%s/%s] Unable to find files: %v", pkg.FullRepo, pkg.Pkgbase, err)
log.Warningf("[%s/%s] unable to find files: %v", pkg.FullRepo, pkg.Pkgbase, err)
continue
} else if len(pkg.PkgFiles) == 0 {
continue
@ -500,11 +416,11 @@ func (b *BuildManager) repoWorker(repo string) {
res, err := cmd.CombinedOutput()
log.Debug(string(res))
if err != nil && cmd.ProcessState.ExitCode() == 1 {
log.Warningf("Error while deleting package %s: %s", pkg.Pkgbase, string(res))
log.Warningf("error while deleting package %s: %s", pkg.Pkgbase, string(res))
}
if pkg.DBPackage != nil {
_ = pkg.DBPackage.Update().ClearRepoVersion().ClearHash().Exec(context.Background())
_ = pkg.DBPackage.Update().ClearRepoVersion().ClearTagRev().Exec(context.Background())
}
for _, file := range pkg.PkgFiles {
@ -513,7 +429,7 @@ func (b *BuildManager) repoWorker(repo string) {
}
err = updateLastUpdated()
if err != nil {
log.Warningf("Error updating lastupdate: %v", err)
log.Warningf("error updating lastupdate: %v", err)
}
b.repoWG.Done()
}
@ -522,38 +438,36 @@ func (b *BuildManager) repoWorker(repo string) {
}
func (b *BuildManager) syncWorker(ctx context.Context) error {
err := os.MkdirAll(filepath.Join(conf.Basedir.Work, upstreamDir), 0o755)
err := os.MkdirAll(filepath.Join(conf.Basedir.Work), 0o755)
if err != nil {
log.Fatalf("Error creating upstream dir: %v", err)
log.Fatalf("error creating work dir %s: %v", conf.Basedir.Work, err)
}
for {
for gitDir, gitURL := range conf.Svn2git {
gitPath := filepath.Join(conf.Basedir.Work, upstreamDir, gitDir)
gitPath := filepath.Join(conf.Basedir.Work, stateDir)
if _, err := os.Stat(gitPath); os.IsNotExist(err) {
cmd := exec.Command("git", "clone", "--depth=1", gitURL, gitPath)
res, err := cmd.CombinedOutput()
log.Debug(string(res))
if err != nil {
log.Fatalf("Error running git clone: %v", err)
}
} else if err == nil {
cmd := exec.Command("git", "reset", "--hard")
cmd.Dir = gitPath
res, err := cmd.CombinedOutput()
log.Debug(string(res))
if err != nil {
log.Fatalf("Error running git reset: %v", err)
}
if _, err := os.Stat(gitPath); os.IsNotExist(err) {
cmd := exec.Command("git", "clone", "--depth=1", conf.StateRepo, gitPath)
res, err := cmd.CombinedOutput()
log.Debug(string(res))
if err != nil {
log.Fatalf("error cloning state repo: %v", err)
}
} else if err == nil {
cmd := exec.Command("git", "reset", "--hard")
cmd.Dir = gitPath
res, err := cmd.CombinedOutput()
log.Debug(string(res))
if err != nil {
log.Fatalf("error reseting state repo: %v", err)
}
cmd = exec.Command("git", "pull")
cmd.Dir = gitPath
res, err = cmd.CombinedOutput()
log.Debug(string(res))
if err != nil {
log.Warningf("Failed to update git repo %s: %v", gitDir, err)
}
cmd = exec.Command("git", "pull")
cmd.Dir = gitPath
res, err = cmd.CombinedOutput()
log.Debug(string(res))
if err != nil {
log.Warningf("failed to update state repo: %v", err)
}
}
@ -581,12 +495,12 @@ func (b *BuildManager) syncWorker(ctx context.Context) error {
b.alpmMutex.Lock()
err = alpmHandle.Release()
if err != nil {
log.Fatalf("Error releasing ALPM handle: %v", err)
log.Fatalf("error releasing ALPM handle: %v", err)
}
if err := retry.Fibonacci(ctx, 1*time.Second, func(ctx context.Context) error {
if err := setupChroot(); err != nil {
log.Warningf("Unable to upgrade chroot, trying again later.")
log.Warningf("unable to upgrade chroot, trying again later")
return retry.RetryableError(err)
}
return nil
@ -597,30 +511,15 @@ func (b *BuildManager) syncWorker(ctx context.Context) error {
alpmHandle, err = initALPM(filepath.Join(conf.Basedir.Work, chrootDir, pristineChroot),
filepath.Join(conf.Basedir.Work, chrootDir, pristineChroot, "/var/lib/pacman"))
if err != nil {
log.Warningf("Error while ALPM-init: %v", err)
log.Warningf("error while alpm-init: %v", err)
}
b.alpmMutex.Unlock()
// do refreshSRCINFOs twice here
// since MirrorLatest depends on the DB being correct, there can be packages queued which should not be queued,
// so we check them twice to eliminate those.
log.Debugf("generating build-queue for PKGBUILDs found in %s", filepath.Join(conf.Basedir.Work, upstreamDir, "/**/PKGBUILD"))
err = b.refreshSRCINFOs(ctx, filepath.Join(conf.Basedir.Work, upstreamDir, "/**/PKGBUILD"))
queue, err := b.genQueue()
if err != nil {
log.Fatalf("error refreshing PKGBUILDs: %v", err)
}
log.Debugf("regenerating build-queue for PKGBUILDs found in %s", filepath.Join(conf.Basedir.Work, upstreamDir, "/**/PKGBUILD"))
err = b.refreshSRCINFOs(ctx, filepath.Join(conf.Basedir.Work, upstreamDir, "/**/PKGBUILD"))
if err != nil {
log.Fatalf("error refreshing PKGBUILDs: %v", err)
}
queue, err := genQueue()
if err != nil {
log.Warningf("Error building buildQueue: %v", err)
log.Errorf("error building queue: %v", err)
} else {
log.Debugf("buildQueue with %d items", len(queue))
log.Debugf("build-queue with %d items", len(queue))
err = b.buildQueue(queue, ctx)
if err != nil {
return err
@ -631,7 +530,7 @@ func (b *BuildManager) syncWorker(ctx context.Context) error {
for _, repo := range repos {
err = movePackagesLive(repo)
if err != nil {
log.Errorf("[%s] Error moving packages live: %v", repo, err)
log.Errorf("[%s] error moving packages live: %v", repo, err)
}
}
} else {
@ -642,3 +541,62 @@ func (b *BuildManager) syncWorker(ctx context.Context) error {
time.Sleep(time.Duration(*checkInterval) * time.Minute)
}
}
func (b *BuildManager) genQueue() ([]*ProtoPackage, error) {
stateFiles, err := Glob(filepath.Join(conf.Basedir.Work, stateDir, "**/*"))
if err != nil {
return nil, fmt.Errorf("error scanning for state-files: %w", err)
}
var pkgbuilds []*ProtoPackage
for _, stateFile := range stateFiles {
stat, err := os.Stat(stateFile)
if err != nil || stat.IsDir() || strings.Contains(stateFile, ".git") {
continue
}
repo, subRepo, arch, err := stateFileMeta(stateFile)
if err != nil {
log.Warningf("[QG] error generating statefile metadata %s: %v", stateFile, err)
continue
}
if !Contains(conf.Repos, repo) || (subRepo != nil && Contains(conf.Blacklist.Repo, *subRepo) || arch == "any") {
continue
}
rawState, err := os.ReadFile(stateFile)
if err != nil {
log.Warningf("[QG] cannot read statefile %s: %v", stateFile, err)
continue
}
state, err := parseState(string(rawState))
if err != nil {
log.Warningf("[QG] cannot parse statefile %s: %v", stateFile, err)
continue
}
for _, march := range conf.March {
pkg := &ProtoPackage{
Pkgbase: state.Pkgbase,
Repo: dbpackage.Repository(repo),
March: march,
FullRepo: repo + "-" + march,
State: state,
Version: state.PkgVer,
Arch: arch,
}
err = pkg.toDBPackage(true)
if err != nil {
log.Warningf("[QG] error getting/creating dbpackage %s: %v", state.Pkgbase, err)
continue
}
pkgbuilds = append(pkgbuilds, pkg)
}
}
return pkgbuilds, nil
}

View File

@ -2,11 +2,8 @@ arch: x86_64
repos:
- core
- extra
- community
svn2git:
upstream-core-extra: "https://github.com/archlinux/svntogit-packages.git"
upstream-community: "https://github.com/archlinux/svntogit-community.git"
state_repo: "https://gitlab.archlinux.org/archlinux/packaging/state.git"
db:
driver: pgx

View File

@ -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
}
)

View File

@ -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

View File

@ -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

View File

@ -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