MCPcopy Create free account
hub / github.com/Comfy-Org/registry-backend / sqlQuery

Method sqlQuery

ent/ciworkflowresult_query.go:580–613  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

578}
579
580func (cwrq *CIWorkflowResultQuery) sqlQuery(ctx context.Context) *sql.Selector {
581 builder := sql.Dialect(cwrq.driver.Dialect())
582 t1 := builder.Table(ciworkflowresult.Table)
583 columns := cwrq.ctx.Fields
584 if len(columns) == 0 {
585 columns = ciworkflowresult.Columns
586 }
587 selector := builder.Select(t1.Columns(columns...)...).From(t1)
588 if cwrq.sql != nil {
589 selector = cwrq.sql
590 selector.Select(selector.Columns(columns...)...)
591 }
592 if cwrq.ctx.Unique != nil && *cwrq.ctx.Unique {
593 selector.Distinct()
594 }
595 for _, m := range cwrq.modifiers {
596 m(selector)
597 }
598 for _, p := range cwrq.predicates {
599 p(selector)
600 }
601 for _, p := range cwrq.order {
602 p(selector)
603 }
604 if offset := cwrq.ctx.Offset; offset != nil {
605 // limit is mandatory for offset clause. We start
606 // with default value, and override it below if needed.
607 selector.Offset(*offset).Limit(math.MaxInt32)
608 }
609 if limit := cwrq.ctx.Limit; limit != nil {
610 selector.Limit(*limit)
611 }
612 return selector
613}
614
615// ForUpdate locks the selected rows against concurrent updates, and prevent them from being
616// updated, deleted or "selected ... for update" by other sessions, until the transaction is

Callers 4

QueryGitcommitMethod · 0.95
QueryStorageFileMethod · 0.95
sqlScanMethod · 0.45
sqlScanMethod · 0.45

Calls 4

DialectMethod · 0.80
SelectMethod · 0.45
LimitMethod · 0.45
OffsetMethod · 0.45

Tested by

no test coverage detected