Upload folder using huggingface_hub (part 4)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- ent/db/billinginvoicelinediscount.goAdded+279
- ent/db/billinginvoicelinediscount_create.goAdded+1244
- ent/db/billinginvoicelinediscount_delete.goAdded+88
- ent/db/billinginvoicelinediscount_query.goAdded+643
- ent/db/billinginvoicelinediscount_update.goAdded+749
- ent/db/billinginvoicelineusagediscount.goAdded+279
- ent/db/billinginvoicelineusagediscount/billinginvoicelineusagediscount.goAdded+191
- ent/db/billinginvoicelineusagediscount/where.goAdded+771
- ent/db/billinginvoicelineusagediscount_create.goAdded+1244
- ent/db/billinginvoicelineusagediscount_delete.goAdded+88
- ent/db/billinginvoicelineusagediscount_query.goAdded+643
- ent/db/billinginvoicelineusagediscount_update.goAdded+749
- ent/db/billinginvoicesplitlinegroup.goAdded+459
- ent/db/billinginvoicesplitlinegroup/billinginvoicesplitlinegroup.goAdded+342
- ent/db/billinginvoicesplitlinegroup/where.goAdded+1352
- ent/db/billinginvoicesplitlinegroup_create.goAdded+1562
- ent/db/billinginvoicesplitlinegroup_delete.goAdded+88
- ent/db/billinginvoicesplitlinegroup_query.goAdded+961
- ent/db/billinginvoicesplitlinegroup_update.goAdded+899
- ent/db/billinginvoiceusagebasedlineconfig.goAdded+200
- ent/db/billinginvoiceusagebasedlineconfig/billinginvoiceusagebasedlineconfig.goAdded+129
- ent/db/billinginvoiceusagebasedlineconfig/where.goAdded+435
- ent/db/billinginvoiceusagebasedlineconfig_create.goAdded+943
- ent/db/billinginvoiceusagebasedlineconfig_delete.goAdded+88
- ent/db/billinginvoiceusagebasedlineconfig_query.goAdded+564
- ent/db/billinginvoiceusagebasedlineconfig_update.goAdded+489
- ent/db/billinginvoicevalidationissue.goAdded+255
- ent/db/billinginvoicevalidationissue/billinginvoicevalidationissue.goAdded+179
- ent/db/billinginvoicevalidationissue/where.goAdded+765
- ent/db/billinginvoicevalidationissue_create.goAdded+1123
- ent/db/billinginvoicevalidationissue_delete.goAdded+88
- ent/db/billinginvoicevalidationissue_query.goAdded+643
- ent/db/billinginvoicevalidationissue_update.goAdded+672
- ent/db/billinginvoicewriteschemalevel.goAdded+103
- ent/db/billinginvoicewriteschemalevel/billinginvoicewriteschemalevel.goAdded+52
- ent/db/billinginvoicewriteschemalevel/where.goAdded+123
- ent/db/billinginvoicewriteschemalevel_create.goAdded+514
- ent/db/billinginvoicewriteschemalevel_delete.goAdded+88
- ent/db/billinginvoicewriteschemalevel_query.goAdded+564
- ent/db/billinginvoicewriteschemalevel_update.goAdded+229
- ent/db/billingprofile.goAdded+478
- ent/db/billingprofile/billingprofile.goAdded+378
- ent/db/billingprofile/where.goAdded+1620
- ent/db/billingprofile_create.goAdded
- ent/db/billingprofile_delete.goAdded
- ent/db/billingprofile_query.goAdded
- ent/db/billingprofile_update.goAdded
- ent/db/billingsequencenumbers.goAdded
- ent/db/billingsequencenumbers/billingsequencenumbers.goAdded
- ent/db/billingsequencenumbers/where.goAdded
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279// Code generated by ent, DO NOT EDIT.
package db
import ( "fmt" "strings" "time"
"entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicelinediscount")
// BillingInvoiceLineDiscount is the model entity for the BillingInvoiceLineDiscount schema.type BillingInvoiceLineDiscount struct { config `json:"-"` // ID of the ent. ID string `json:"id,omitempty"` // Namespace holds the value of the "namespace" field. Namespace string `json:"namespace,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt *time.Time `json:"deleted_at,omitempty"` // InvoicingAppExternalID holds the value of the "invoicing_app_external_id" field. InvoicingAppExternalID *string `json:"invoicing_app_external_id,omitempty"` // LineID holds the value of the "line_id" field. LineID string `json:"line_id,omitempty"` // ChildUniqueReferenceID holds the value of the "child_unique_reference_id" field. ChildUniqueReferenceID *string `json:"child_unique_reference_id,omitempty"` // Description holds the value of the "description" field. Description *string `json:"description,omitempty"` // Reason holds the value of the "reason" field. Reason billing.DiscountReasonType `json:"reason,omitempty"` // Amount holds the value of the "amount" field. Amount alpacadecimal.Decimal `json:"amount,omitempty"` // RoundingAmount holds the value of the "rounding_amount" field. RoundingAmount *alpacadecimal.Decimal `json:"rounding_amount,omitempty"` // SourceDiscount holds the value of the "source_discount" field. SourceDiscount *billing.DiscountReason `json:"source_discount,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the BillingInvoiceLineDiscountQuery when eager-loading is set. Edges BillingInvoiceLineDiscountEdges `json:"edges"` selectValues sql.SelectValues}
// BillingInvoiceLineDiscountEdges holds the relations/edges for other nodes in the graph.type BillingInvoiceLineDiscountEdges struct { // BillingInvoiceLine holds the value of the billing_invoice_line edge. BillingInvoiceLine *BillingInvoiceLine `json:"billing_invoice_line,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [1]bool}
// BillingInvoiceLineOrErr returns the BillingInvoiceLine value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingInvoiceLineDiscountEdges) BillingInvoiceLineOrErr() (*BillingInvoiceLine, error) { if e.BillingInvoiceLine != nil { return e.BillingInvoiceLine, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: billinginvoiceline.Label} } return nil, &NotLoadedError{edge: "billing_invoice_line"}}
// scanValues returns the types for scanning values from sql.Rows.func (*BillingInvoiceLineDiscount) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case billinginvoicelinediscount.FieldRoundingAmount: values[i] = &sql.NullScanner{S: new(alpacadecimal.Decimal)} case billinginvoicelinediscount.FieldAmount: values[i] = new(alpacadecimal.Decimal) case billinginvoicelinediscount.FieldID, billinginvoicelinediscount.FieldNamespace, billinginvoicelinediscount.FieldInvoicingAppExternalID, billinginvoicelinediscount.FieldLineID, billinginvoicelinediscount.FieldChildUniqueReferenceID, billinginvoicelinediscount.FieldDescription, billinginvoicelinediscount.FieldReason: values[i] = new(sql.NullString) case billinginvoicelinediscount.FieldCreatedAt, billinginvoicelinediscount.FieldUpdatedAt, billinginvoicelinediscount.FieldDeletedAt: values[i] = new(sql.NullTime) case billinginvoicelinediscount.FieldSourceDiscount: values[i] = billinginvoicelinediscount.ValueScanner.SourceDiscount.ScanValue() default: values[i] = new(sql.UnknownType) } } return values, nil}
// assignValues assigns the values that were returned from sql.Rows (after scanning)// to the BillingInvoiceLineDiscount fields.func (_m *BillingInvoiceLineDiscount) 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) } for i := range columns { switch columns[i] { case billinginvoicelinediscount.FieldID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value.Valid { _m.ID = value.String } case billinginvoicelinediscount.FieldNamespace: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field namespace", values[i]) } else if value.Valid { _m.Namespace = value.String } case billinginvoicelinediscount.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { _m.CreatedAt = value.Time } case billinginvoicelinediscount.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { _m.UpdatedAt = value.Time } case billinginvoicelinediscount.FieldDeletedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field deleted_at", values[i]) } else if value.Valid { _m.DeletedAt = new(time.Time) *_m.DeletedAt = value.Time } case billinginvoicelinediscount.FieldInvoicingAppExternalID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field invoicing_app_external_id", values[i]) } else if value.Valid { _m.InvoicingAppExternalID = new(string) *_m.InvoicingAppExternalID = value.String } case billinginvoicelinediscount.FieldLineID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field line_id", values[i]) } else if value.Valid { _m.LineID = value.String } case billinginvoicelinediscount.FieldChildUniqueReferenceID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field child_unique_reference_id", values[i]) } else if value.Valid { _m.ChildUniqueReferenceID = new(string) *_m.ChildUniqueReferenceID = value.String } case billinginvoicelinediscount.FieldDescription: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field description", values[i]) } else if value.Valid { _m.Description = new(string) *_m.Description = value.String } case billinginvoicelinediscount.FieldReason: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field reason", values[i]) } else if value.Valid { _m.Reason = billing.DiscountReasonType(value.String) } case billinginvoicelinediscount.FieldAmount: if value, ok := values[i].(*alpacadecimal.Decimal); !ok { return fmt.Errorf("unexpected type %T for field amount", values[i]) } else if value != nil { _m.Amount = *value } case billinginvoicelinediscount.FieldRoundingAmount: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field rounding_amount", values[i]) } else if value.Valid { _m.RoundingAmount = new(alpacadecimal.Decimal) *_m.RoundingAmount = *value.S.(*alpacadecimal.Decimal) } case billinginvoicelinediscount.FieldSourceDiscount: if value, err := billinginvoicelinediscount.ValueScanner.SourceDiscount.FromValue(values[i]); err != nil { return err } else { _m.SourceDiscount = value } default: _m.selectValues.Set(columns[i], values[i]) } } return nil}
// Value returns the ent.Value that was dynamically selected and assigned to the BillingInvoiceLineDiscount.// This includes values selected through modifiers, order, etc.func (_m *BillingInvoiceLineDiscount) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name)}
// QueryBillingInvoiceLine queries the "billing_invoice_line" edge of the BillingInvoiceLineDiscount entity.func (_m *BillingInvoiceLineDiscount) QueryBillingInvoiceLine() *BillingInvoiceLineQuery { return NewBillingInvoiceLineDiscountClient(_m.config).QueryBillingInvoiceLine(_m)}
// Update returns a builder for updating this BillingInvoiceLineDiscount.// Note that you need to call BillingInvoiceLineDiscount.Unwrap() before calling this method if this BillingInvoiceLineDiscount// was returned from a transaction, and the transaction was committed or rolled back.func (_m *BillingInvoiceLineDiscount) Update() *BillingInvoiceLineDiscountUpdateOne { return NewBillingInvoiceLineDiscountClient(_m.config).UpdateOne(_m)}
// Unwrap unwraps the BillingInvoiceLineDiscount 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 (_m *BillingInvoiceLineDiscount) Unwrap() *BillingInvoiceLineDiscount { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("db: BillingInvoiceLineDiscount is not a transactional entity") } _m.config.driver = _tx.drv return _m}
// String implements the fmt.Stringer.func (_m *BillingInvoiceLineDiscount) String() string { var builder strings.Builder builder.WriteString("BillingInvoiceLineDiscount(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("namespace=") builder.WriteString(_m.Namespace) builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") if v := _m.DeletedAt; v != nil { builder.WriteString("deleted_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") if v := _m.InvoicingAppExternalID; v != nil { builder.WriteString("invoicing_app_external_id=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("line_id=") builder.WriteString(_m.LineID) builder.WriteString(", ") if v := _m.ChildUniqueReferenceID; v != nil { builder.WriteString("child_unique_reference_id=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.Description; v != nil { builder.WriteString("description=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("reason=") builder.WriteString(fmt.Sprintf("%v", _m.Reason)) builder.WriteString(", ") builder.WriteString("amount=") builder.WriteString(fmt.Sprintf("%v", _m.Amount)) builder.WriteString(", ") if v := _m.RoundingAmount; v != nil { builder.WriteString("rounding_amount=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") if v := _m.SourceDiscount; v != nil { builder.WriteString("source_discount=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteByte(')') return builder.String()}
// BillingInvoiceLineDiscounts is a parsable slice of BillingInvoiceLineDiscount.type BillingInvoiceLineDiscounts []*BillingInvoiceLineDiscount12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt" "time"
"entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicelinediscount")
// BillingInvoiceLineDiscountCreate is the builder for creating a BillingInvoiceLineDiscount entity.type BillingInvoiceLineDiscountCreate struct { config mutation *BillingInvoiceLineDiscountMutation hooks []Hook conflict []sql.ConflictOption}
// SetNamespace sets the "namespace" field.func (_c *BillingInvoiceLineDiscountCreate) SetNamespace(v string) *BillingInvoiceLineDiscountCreate { _c.mutation.SetNamespace(v) return _c}
// SetCreatedAt sets the "created_at" field.func (_c *BillingInvoiceLineDiscountCreate) SetCreatedAt(v time.Time) *BillingInvoiceLineDiscountCreate { _c.mutation.SetCreatedAt(v) return _c}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.func (_c *BillingInvoiceLineDiscountCreate) SetNillableCreatedAt(v *time.Time) *BillingInvoiceLineDiscountCreate { if v != nil { _c.SetCreatedAt(*v) } return _c}
// SetUpdatedAt sets the "updated_at" field.func (_c *BillingInvoiceLineDiscountCreate) SetUpdatedAt(v time.Time) *BillingInvoiceLineDiscountCreate { _c.mutation.SetUpdatedAt(v) return _c}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.func (_c *BillingInvoiceLineDiscountCreate) SetNillableUpdatedAt(v *time.Time) *BillingInvoiceLineDiscountCreate { if v != nil { _c.SetUpdatedAt(*v) } return _c}
// SetDeletedAt sets the "deleted_at" field.func (_c *BillingInvoiceLineDiscountCreate) SetDeletedAt(v time.Time) *BillingInvoiceLineDiscountCreate { _c.mutation.SetDeletedAt(v) return _c}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_c *BillingInvoiceLineDiscountCreate) SetNillableDeletedAt(v *time.Time) *BillingInvoiceLineDiscountCreate { if v != nil { _c.SetDeletedAt(*v) } return _c}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (_c *BillingInvoiceLineDiscountCreate) SetInvoicingAppExternalID(v string) *BillingInvoiceLineDiscountCreate { _c.mutation.SetInvoicingAppExternalID(v) return _c}
// SetNillableInvoicingAppExternalID sets the "invoicing_app_external_id" field if the given value is not nil.func (_c *BillingInvoiceLineDiscountCreate) SetNillableInvoicingAppExternalID(v *string) *BillingInvoiceLineDiscountCreate { if v != nil { _c.SetInvoicingAppExternalID(*v) } return _c}
// SetLineID sets the "line_id" field.func (_c *BillingInvoiceLineDiscountCreate) SetLineID(v string) *BillingInvoiceLineDiscountCreate { _c.mutation.SetLineID(v) return _c}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (_c *BillingInvoiceLineDiscountCreate) SetChildUniqueReferenceID(v string) *BillingInvoiceLineDiscountCreate { _c.mutation.SetChildUniqueReferenceID(v) return _c}
// SetNillableChildUniqueReferenceID sets the "child_unique_reference_id" field if the given value is not nil.func (_c *BillingInvoiceLineDiscountCreate) SetNillableChildUniqueReferenceID(v *string) *BillingInvoiceLineDiscountCreate { if v != nil { _c.SetChildUniqueReferenceID(*v) } return _c}
// SetDescription sets the "description" field.func (_c *BillingInvoiceLineDiscountCreate) SetDescription(v string) *BillingInvoiceLineDiscountCreate { _c.mutation.SetDescription(v) return _c}
// SetNillableDescription sets the "description" field if the given value is not nil.func (_c *BillingInvoiceLineDiscountCreate) SetNillableDescription(v *string) *BillingInvoiceLineDiscountCreate { if v != nil { _c.SetDescription(*v) } return _c}
// SetReason sets the "reason" field.func (_c *BillingInvoiceLineDiscountCreate) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineDiscountCreate { _c.mutation.SetReason(v) return _c}
// SetAmount sets the "amount" field.func (_c *BillingInvoiceLineDiscountCreate) SetAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountCreate { _c.mutation.SetAmount(v) return _c}
// SetRoundingAmount sets the "rounding_amount" field.func (_c *BillingInvoiceLineDiscountCreate) SetRoundingAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountCreate { _c.mutation.SetRoundingAmount(v) return _c}
// SetNillableRoundingAmount sets the "rounding_amount" field if the given value is not nil.func (_c *BillingInvoiceLineDiscountCreate) SetNillableRoundingAmount(v *alpacadecimal.Decimal) *BillingInvoiceLineDiscountCreate { if v != nil { _c.SetRoundingAmount(*v) } return _c}
// SetSourceDiscount sets the "source_discount" field.func (_c *BillingInvoiceLineDiscountCreate) SetSourceDiscount(v *billing.DiscountReason) *BillingInvoiceLineDiscountCreate { _c.mutation.SetSourceDiscount(v) return _c}
// SetID sets the "id" field.func (_c *BillingInvoiceLineDiscountCreate) SetID(v string) *BillingInvoiceLineDiscountCreate { _c.mutation.SetID(v) return _c}
// SetNillableID sets the "id" field if the given value is not nil.func (_c *BillingInvoiceLineDiscountCreate) SetNillableID(v *string) *BillingInvoiceLineDiscountCreate { if v != nil { _c.SetID(*v) } return _c}
// SetBillingInvoiceLineID sets the "billing_invoice_line" edge to the BillingInvoiceLine entity by ID.func (_c *BillingInvoiceLineDiscountCreate) SetBillingInvoiceLineID(id string) *BillingInvoiceLineDiscountCreate { _c.mutation.SetBillingInvoiceLineID(id) return _c}
// SetBillingInvoiceLine sets the "billing_invoice_line" edge to the BillingInvoiceLine entity.func (_c *BillingInvoiceLineDiscountCreate) SetBillingInvoiceLine(v *BillingInvoiceLine) *BillingInvoiceLineDiscountCreate { return _c.SetBillingInvoiceLineID(v.ID)}
// Mutation returns the BillingInvoiceLineDiscountMutation object of the builder.func (_c *BillingInvoiceLineDiscountCreate) Mutation() *BillingInvoiceLineDiscountMutation { return _c.mutation}
// Save creates the BillingInvoiceLineDiscount in the database.func (_c *BillingInvoiceLineDiscountCreate) Save(ctx context.Context) (*BillingInvoiceLineDiscount, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)}
// SaveX calls Save and panics if Save returns an error.func (_c *BillingInvoiceLineDiscountCreate) SaveX(ctx context.Context) *BillingInvoiceLineDiscount { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceLineDiscountCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceLineDiscountCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_c *BillingInvoiceLineDiscountCreate) defaults() { if _, ok := _c.mutation.CreatedAt(); !ok { v := billinginvoicelinediscount.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } if _, ok := _c.mutation.UpdatedAt(); !ok { v := billinginvoicelinediscount.DefaultUpdatedAt() _c.mutation.SetUpdatedAt(v) } if _, ok := _c.mutation.ID(); !ok { v := billinginvoicelinediscount.DefaultID() _c.mutation.SetID(v) }}
// check runs all checks and user-defined validators on the builder.func (_c *BillingInvoiceLineDiscountCreate) check() error { if _, ok := _c.mutation.Namespace(); !ok { return &ValidationError{Name: "namespace", err: errors.New(`db: missing required field "BillingInvoiceLineDiscount.namespace"`)} } if v, ok := _c.mutation.Namespace(); ok { if err := billinginvoicelinediscount.NamespaceValidator(v); err != nil { return &ValidationError{Name: "namespace", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineDiscount.namespace": %w`, err)} } } if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "BillingInvoiceLineDiscount.created_at"`)} } if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`db: missing required field "BillingInvoiceLineDiscount.updated_at"`)} } if _, ok := _c.mutation.LineID(); !ok { return &ValidationError{Name: "line_id", err: errors.New(`db: missing required field "BillingInvoiceLineDiscount.line_id"`)} } if _, ok := _c.mutation.Reason(); !ok { return &ValidationError{Name: "reason", err: errors.New(`db: missing required field "BillingInvoiceLineDiscount.reason"`)} } if v, ok := _c.mutation.Reason(); ok { if err := billinginvoicelinediscount.ReasonValidator(v); err != nil { return &ValidationError{Name: "reason", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineDiscount.reason": %w`, err)} } } if _, ok := _c.mutation.Amount(); !ok { return &ValidationError{Name: "amount", err: errors.New(`db: missing required field "BillingInvoiceLineDiscount.amount"`)} } if v, ok := _c.mutation.SourceDiscount(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "source_discount", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineDiscount.source_discount": %w`, err)} } } if len(_c.mutation.BillingInvoiceLineIDs()) == 0 { return &ValidationError{Name: "billing_invoice_line", err: errors.New(`db: missing required edge "BillingInvoiceLineDiscount.billing_invoice_line"`)} } return nil}
func (_c *BillingInvoiceLineDiscountCreate) sqlSave(ctx context.Context) (*BillingInvoiceLineDiscount, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec, err := _c.createSpec() if err != nil { return nil, err } if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(string); ok { _node.ID = id } else { return nil, fmt.Errorf("unexpected BillingInvoiceLineDiscount.ID type: %T", _spec.ID.Value) } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil}
func (_c *BillingInvoiceLineDiscountCreate) createSpec() (*BillingInvoiceLineDiscount, *sqlgraph.CreateSpec, error) { var ( _node = &BillingInvoiceLineDiscount{config: _c.config} _spec = sqlgraph.NewCreateSpec(billinginvoicelinediscount.Table, sqlgraph.NewFieldSpec(billinginvoicelinediscount.FieldID, field.TypeString)) ) _spec.OnConflict = _c.conflict if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = id } if value, ok := _c.mutation.Namespace(); ok { _spec.SetField(billinginvoicelinediscount.FieldNamespace, field.TypeString, value) _node.Namespace = value } if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(billinginvoicelinediscount.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicelinediscount.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } if value, ok := _c.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicelinediscount.FieldDeletedAt, field.TypeTime, value) _node.DeletedAt = &value } if value, ok := _c.mutation.InvoicingAppExternalID(); ok { _spec.SetField(billinginvoicelinediscount.FieldInvoicingAppExternalID, field.TypeString, value) _node.InvoicingAppExternalID = &value } if value, ok := _c.mutation.ChildUniqueReferenceID(); ok { _spec.SetField(billinginvoicelinediscount.FieldChildUniqueReferenceID, field.TypeString, value) _node.ChildUniqueReferenceID = &value } if value, ok := _c.mutation.Description(); ok { _spec.SetField(billinginvoicelinediscount.FieldDescription, field.TypeString, value) _node.Description = &value } if value, ok := _c.mutation.Reason(); ok { _spec.SetField(billinginvoicelinediscount.FieldReason, field.TypeEnum, value) _node.Reason = value } if value, ok := _c.mutation.Amount(); ok { _spec.SetField(billinginvoicelinediscount.FieldAmount, field.TypeOther, value) _node.Amount = value } if value, ok := _c.mutation.RoundingAmount(); ok { _spec.SetField(billinginvoicelinediscount.FieldRoundingAmount, field.TypeOther, value) _node.RoundingAmount = &value } if value, ok := _c.mutation.SourceDiscount(); ok { vv, err := billinginvoicelinediscount.ValueScanner.SourceDiscount.Value(value) if err != nil { return nil, nil, err } _spec.SetField(billinginvoicelinediscount.FieldSourceDiscount, field.TypeString, vv) _node.SourceDiscount = value } if nodes := _c.mutation.BillingInvoiceLineIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicelinediscount.BillingInvoiceLineTable, Columns: []string{billinginvoicelinediscount.BillingInvoiceLineColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.LineID = nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec, nil}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceLineDiscount.Create().// SetNamespace(v).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceLineDiscountUpsert) {// SetNamespace(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceLineDiscountCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceLineDiscountUpsertOne { _c.conflict = opts return &BillingInvoiceLineDiscountUpsertOne{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceLineDiscount.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceLineDiscountCreate) OnConflictColumns(columns ...string) *BillingInvoiceLineDiscountUpsertOne { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceLineDiscountUpsertOne{ create: _c, }}
type ( // BillingInvoiceLineDiscountUpsertOne is the builder for "upsert"-ing // one BillingInvoiceLineDiscount node. BillingInvoiceLineDiscountUpsertOne struct { create *BillingInvoiceLineDiscountCreate }
// BillingInvoiceLineDiscountUpsert is the "OnConflict" setter. BillingInvoiceLineDiscountUpsert struct { *sql.UpdateSet })
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceLineDiscountUpsert) SetUpdatedAt(v time.Time) *BillingInvoiceLineDiscountUpsert { u.Set(billinginvoicelinediscount.FieldUpdatedAt, v) return u}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsert) UpdateUpdatedAt() *BillingInvoiceLineDiscountUpsert { u.SetExcluded(billinginvoicelinediscount.FieldUpdatedAt) return u}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceLineDiscountUpsert) SetDeletedAt(v time.Time) *BillingInvoiceLineDiscountUpsert { u.Set(billinginvoicelinediscount.FieldDeletedAt, v) return u}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsert) UpdateDeletedAt() *BillingInvoiceLineDiscountUpsert { u.SetExcluded(billinginvoicelinediscount.FieldDeletedAt) return u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceLineDiscountUpsert) ClearDeletedAt() *BillingInvoiceLineDiscountUpsert { u.SetNull(billinginvoicelinediscount.FieldDeletedAt) return u}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (u *BillingInvoiceLineDiscountUpsert) SetInvoicingAppExternalID(v string) *BillingInvoiceLineDiscountUpsert { u.Set(billinginvoicelinediscount.FieldInvoicingAppExternalID, v) return u}
// UpdateInvoicingAppExternalID sets the "invoicing_app_external_id" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsert) UpdateInvoicingAppExternalID() *BillingInvoiceLineDiscountUpsert { u.SetExcluded(billinginvoicelinediscount.FieldInvoicingAppExternalID) return u}
// ClearInvoicingAppExternalID clears the value of the "invoicing_app_external_id" field.func (u *BillingInvoiceLineDiscountUpsert) ClearInvoicingAppExternalID() *BillingInvoiceLineDiscountUpsert { u.SetNull(billinginvoicelinediscount.FieldInvoicingAppExternalID) return u}
// SetLineID sets the "line_id" field.func (u *BillingInvoiceLineDiscountUpsert) SetLineID(v string) *BillingInvoiceLineDiscountUpsert { u.Set(billinginvoicelinediscount.FieldLineID, v) return u}
// UpdateLineID sets the "line_id" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsert) UpdateLineID() *BillingInvoiceLineDiscountUpsert { u.SetExcluded(billinginvoicelinediscount.FieldLineID) return u}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (u *BillingInvoiceLineDiscountUpsert) SetChildUniqueReferenceID(v string) *BillingInvoiceLineDiscountUpsert { u.Set(billinginvoicelinediscount.FieldChildUniqueReferenceID, v) return u}
// UpdateChildUniqueReferenceID sets the "child_unique_reference_id" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsert) UpdateChildUniqueReferenceID() *BillingInvoiceLineDiscountUpsert { u.SetExcluded(billinginvoicelinediscount.FieldChildUniqueReferenceID) return u}
// ClearChildUniqueReferenceID clears the value of the "child_unique_reference_id" field.func (u *BillingInvoiceLineDiscountUpsert) ClearChildUniqueReferenceID() *BillingInvoiceLineDiscountUpsert { u.SetNull(billinginvoicelinediscount.FieldChildUniqueReferenceID) return u}
// SetDescription sets the "description" field.func (u *BillingInvoiceLineDiscountUpsert) SetDescription(v string) *BillingInvoiceLineDiscountUpsert { u.Set(billinginvoicelinediscount.FieldDescription, v) return u}
// UpdateDescription sets the "description" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsert) UpdateDescription() *BillingInvoiceLineDiscountUpsert { u.SetExcluded(billinginvoicelinediscount.FieldDescription) return u}
// ClearDescription clears the value of the "description" field.func (u *BillingInvoiceLineDiscountUpsert) ClearDescription() *BillingInvoiceLineDiscountUpsert { u.SetNull(billinginvoicelinediscount.FieldDescription) return u}
// SetReason sets the "reason" field.func (u *BillingInvoiceLineDiscountUpsert) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineDiscountUpsert { u.Set(billinginvoicelinediscount.FieldReason, v) return u}
// UpdateReason sets the "reason" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsert) UpdateReason() *BillingInvoiceLineDiscountUpsert { u.SetExcluded(billinginvoicelinediscount.FieldReason) return u}
// SetAmount sets the "amount" field.func (u *BillingInvoiceLineDiscountUpsert) SetAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpsert { u.Set(billinginvoicelinediscount.FieldAmount, v) return u}
// UpdateAmount sets the "amount" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsert) UpdateAmount() *BillingInvoiceLineDiscountUpsert { u.SetExcluded(billinginvoicelinediscount.FieldAmount) return u}
// SetRoundingAmount sets the "rounding_amount" field.func (u *BillingInvoiceLineDiscountUpsert) SetRoundingAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpsert { u.Set(billinginvoicelinediscount.FieldRoundingAmount, v) return u}
// UpdateRoundingAmount sets the "rounding_amount" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsert) UpdateRoundingAmount() *BillingInvoiceLineDiscountUpsert { u.SetExcluded(billinginvoicelinediscount.FieldRoundingAmount) return u}
// ClearRoundingAmount clears the value of the "rounding_amount" field.func (u *BillingInvoiceLineDiscountUpsert) ClearRoundingAmount() *BillingInvoiceLineDiscountUpsert { u.SetNull(billinginvoicelinediscount.FieldRoundingAmount) return u}
// SetSourceDiscount sets the "source_discount" field.func (u *BillingInvoiceLineDiscountUpsert) SetSourceDiscount(v *billing.DiscountReason) *BillingInvoiceLineDiscountUpsert { u.Set(billinginvoicelinediscount.FieldSourceDiscount, v) return u}
// UpdateSourceDiscount sets the "source_discount" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsert) UpdateSourceDiscount() *BillingInvoiceLineDiscountUpsert { u.SetExcluded(billinginvoicelinediscount.FieldSourceDiscount) return u}
// ClearSourceDiscount clears the value of the "source_discount" field.func (u *BillingInvoiceLineDiscountUpsert) ClearSourceDiscount() *BillingInvoiceLineDiscountUpsert { u.SetNull(billinginvoicelinediscount.FieldSourceDiscount) return u}
// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.// Using this option is equivalent to using://// client.BillingInvoiceLineDiscount.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoicelinediscount.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceLineDiscountUpsertOne) UpdateNewValues() *BillingInvoiceLineDiscountUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { if _, exists := u.create.mutation.ID(); exists { s.SetIgnore(billinginvoicelinediscount.FieldID) } if _, exists := u.create.mutation.Namespace(); exists { s.SetIgnore(billinginvoicelinediscount.FieldNamespace) } if _, exists := u.create.mutation.CreatedAt(); exists { s.SetIgnore(billinginvoicelinediscount.FieldCreatedAt) } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceLineDiscount.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceLineDiscountUpsertOne) Ignore() *BillingInvoiceLineDiscountUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceLineDiscountUpsertOne) DoNothing() *BillingInvoiceLineDiscountUpsertOne { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceLineDiscountCreate.OnConflict// documentation for more info.func (u *BillingInvoiceLineDiscountUpsertOne) Update(set func(*BillingInvoiceLineDiscountUpsert)) *BillingInvoiceLineDiscountUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceLineDiscountUpsert{UpdateSet: update}) })) return u}
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceLineDiscountUpsertOne) SetUpdatedAt(v time.Time) *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetUpdatedAt(v) })}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertOne) UpdateUpdatedAt() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateUpdatedAt() })}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceLineDiscountUpsertOne) SetDeletedAt(v time.Time) *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetDeletedAt(v) })}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertOne) UpdateDeletedAt() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateDeletedAt() })}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceLineDiscountUpsertOne) ClearDeletedAt() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearDeletedAt() })}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (u *BillingInvoiceLineDiscountUpsertOne) SetInvoicingAppExternalID(v string) *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetInvoicingAppExternalID(v) })}
// UpdateInvoicingAppExternalID sets the "invoicing_app_external_id" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertOne) UpdateInvoicingAppExternalID() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateInvoicingAppExternalID() })}
// ClearInvoicingAppExternalID clears the value of the "invoicing_app_external_id" field.func (u *BillingInvoiceLineDiscountUpsertOne) ClearInvoicingAppExternalID() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearInvoicingAppExternalID() })}
// SetLineID sets the "line_id" field.func (u *BillingInvoiceLineDiscountUpsertOne) SetLineID(v string) *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetLineID(v) })}
// UpdateLineID sets the "line_id" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertOne) UpdateLineID() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateLineID() })}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (u *BillingInvoiceLineDiscountUpsertOne) SetChildUniqueReferenceID(v string) *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetChildUniqueReferenceID(v) })}
// UpdateChildUniqueReferenceID sets the "child_unique_reference_id" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertOne) UpdateChildUniqueReferenceID() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateChildUniqueReferenceID() })}
// ClearChildUniqueReferenceID clears the value of the "child_unique_reference_id" field.func (u *BillingInvoiceLineDiscountUpsertOne) ClearChildUniqueReferenceID() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearChildUniqueReferenceID() })}
// SetDescription sets the "description" field.func (u *BillingInvoiceLineDiscountUpsertOne) SetDescription(v string) *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetDescription(v) })}
// UpdateDescription sets the "description" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertOne) UpdateDescription() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateDescription() })}
// ClearDescription clears the value of the "description" field.func (u *BillingInvoiceLineDiscountUpsertOne) ClearDescription() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearDescription() })}
// SetReason sets the "reason" field.func (u *BillingInvoiceLineDiscountUpsertOne) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetReason(v) })}
// UpdateReason sets the "reason" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertOne) UpdateReason() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateReason() })}
// SetAmount sets the "amount" field.func (u *BillingInvoiceLineDiscountUpsertOne) SetAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetAmount(v) })}
// UpdateAmount sets the "amount" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertOne) UpdateAmount() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateAmount() })}
// SetRoundingAmount sets the "rounding_amount" field.func (u *BillingInvoiceLineDiscountUpsertOne) SetRoundingAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetRoundingAmount(v) })}
// UpdateRoundingAmount sets the "rounding_amount" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertOne) UpdateRoundingAmount() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateRoundingAmount() })}
// ClearRoundingAmount clears the value of the "rounding_amount" field.func (u *BillingInvoiceLineDiscountUpsertOne) ClearRoundingAmount() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearRoundingAmount() })}
// SetSourceDiscount sets the "source_discount" field.func (u *BillingInvoiceLineDiscountUpsertOne) SetSourceDiscount(v *billing.DiscountReason) *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetSourceDiscount(v) })}
// UpdateSourceDiscount sets the "source_discount" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertOne) UpdateSourceDiscount() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateSourceDiscount() })}
// ClearSourceDiscount clears the value of the "source_discount" field.func (u *BillingInvoiceLineDiscountUpsertOne) ClearSourceDiscount() *BillingInvoiceLineDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearSourceDiscount() })}
// Exec executes the query.func (u *BillingInvoiceLineDiscountUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceLineDiscountCreate.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceLineDiscountUpsertOne) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}
// Exec executes the UPSERT query and returns the inserted/updated ID.func (u *BillingInvoiceLineDiscountUpsertOne) ID(ctx context.Context) (id string, err error) { if u.create.driver.Dialect() == dialect.MySQL { // In case of "ON CONFLICT", there is no way to get back non-numeric ID // fields from the database since MySQL does not support the RETURNING clause. return id, errors.New("db: BillingInvoiceLineDiscountUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceLineDiscountUpsertOne.Exec instead") } node, err := u.create.Save(ctx) if err != nil { return id, err } return node.ID, nil}
// IDX is like ID, but panics if an error occurs.func (u *BillingInvoiceLineDiscountUpsertOne) IDX(ctx context.Context) string { id, err := u.ID(ctx) if err != nil { panic(err) } return id}
// BillingInvoiceLineDiscountCreateBulk is the builder for creating many BillingInvoiceLineDiscount entities in bulk.type BillingInvoiceLineDiscountCreateBulk struct { config err error builders []*BillingInvoiceLineDiscountCreate conflict []sql.ConflictOption}
// Save creates the BillingInvoiceLineDiscount entities in the database.func (_c *BillingInvoiceLineDiscountCreateBulk) Save(ctx context.Context) ([]*BillingInvoiceLineDiscount, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*BillingInvoiceLineDiscount, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*BillingInvoiceLineDiscountMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i], err = builder.createSpec() if err != nil { return nil, err } if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } } } if err != nil { return nil, err } mutation.id = &nodes[i].ID mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { mut = builder.hooks[i](mut) } mutators[i] = mut }(i, ctx) } if len(mutators) > 0 { if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil}
// SaveX is like Save, but panics if an error occurs.func (_c *BillingInvoiceLineDiscountCreateBulk) SaveX(ctx context.Context) []*BillingInvoiceLineDiscount { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceLineDiscountCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceLineDiscountCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceLineDiscount.CreateBulk(builders...).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceLineDiscountUpsert) {// SetNamespace(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceLineDiscountCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceLineDiscountUpsertBulk { _c.conflict = opts return &BillingInvoiceLineDiscountUpsertBulk{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceLineDiscount.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceLineDiscountCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceLineDiscountUpsertBulk { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceLineDiscountUpsertBulk{ create: _c, }}
// BillingInvoiceLineDiscountUpsertBulk is the builder for "upsert"-ing// a bulk of BillingInvoiceLineDiscount nodes.type BillingInvoiceLineDiscountUpsertBulk struct { create *BillingInvoiceLineDiscountCreateBulk}
// UpdateNewValues updates the mutable fields using the new values that// were set on create. Using this option is equivalent to using://// client.BillingInvoiceLineDiscount.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoicelinediscount.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateNewValues() *BillingInvoiceLineDiscountUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { for _, b := range u.create.builders { if _, exists := b.mutation.ID(); exists { s.SetIgnore(billinginvoicelinediscount.FieldID) } if _, exists := b.mutation.Namespace(); exists { s.SetIgnore(billinginvoicelinediscount.FieldNamespace) } if _, exists := b.mutation.CreatedAt(); exists { s.SetIgnore(billinginvoicelinediscount.FieldCreatedAt) } } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceLineDiscount.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceLineDiscountUpsertBulk) Ignore() *BillingInvoiceLineDiscountUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceLineDiscountUpsertBulk) DoNothing() *BillingInvoiceLineDiscountUpsertBulk { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceLineDiscountCreateBulk.OnConflict// documentation for more info.func (u *BillingInvoiceLineDiscountUpsertBulk) Update(set func(*BillingInvoiceLineDiscountUpsert)) *BillingInvoiceLineDiscountUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceLineDiscountUpsert{UpdateSet: update}) })) return u}
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceLineDiscountUpsertBulk) SetUpdatedAt(v time.Time) *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetUpdatedAt(v) })}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateUpdatedAt() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateUpdatedAt() })}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceLineDiscountUpsertBulk) SetDeletedAt(v time.Time) *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetDeletedAt(v) })}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateDeletedAt() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateDeletedAt() })}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceLineDiscountUpsertBulk) ClearDeletedAt() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearDeletedAt() })}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (u *BillingInvoiceLineDiscountUpsertBulk) SetInvoicingAppExternalID(v string) *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetInvoicingAppExternalID(v) })}
// UpdateInvoicingAppExternalID sets the "invoicing_app_external_id" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateInvoicingAppExternalID() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateInvoicingAppExternalID() })}
// ClearInvoicingAppExternalID clears the value of the "invoicing_app_external_id" field.func (u *BillingInvoiceLineDiscountUpsertBulk) ClearInvoicingAppExternalID() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearInvoicingAppExternalID() })}
// SetLineID sets the "line_id" field.func (u *BillingInvoiceLineDiscountUpsertBulk) SetLineID(v string) *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetLineID(v) })}
// UpdateLineID sets the "line_id" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateLineID() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateLineID() })}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (u *BillingInvoiceLineDiscountUpsertBulk) SetChildUniqueReferenceID(v string) *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetChildUniqueReferenceID(v) })}
// UpdateChildUniqueReferenceID sets the "child_unique_reference_id" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateChildUniqueReferenceID() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateChildUniqueReferenceID() })}
// ClearChildUniqueReferenceID clears the value of the "child_unique_reference_id" field.func (u *BillingInvoiceLineDiscountUpsertBulk) ClearChildUniqueReferenceID() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearChildUniqueReferenceID() })}
// SetDescription sets the "description" field.func (u *BillingInvoiceLineDiscountUpsertBulk) SetDescription(v string) *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetDescription(v) })}
// UpdateDescription sets the "description" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateDescription() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateDescription() })}
// ClearDescription clears the value of the "description" field.func (u *BillingInvoiceLineDiscountUpsertBulk) ClearDescription() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearDescription() })}
// SetReason sets the "reason" field.func (u *BillingInvoiceLineDiscountUpsertBulk) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetReason(v) })}
// UpdateReason sets the "reason" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateReason() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateReason() })}
// SetAmount sets the "amount" field.func (u *BillingInvoiceLineDiscountUpsertBulk) SetAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetAmount(v) })}
// UpdateAmount sets the "amount" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateAmount() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateAmount() })}
// SetRoundingAmount sets the "rounding_amount" field.func (u *BillingInvoiceLineDiscountUpsertBulk) SetRoundingAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetRoundingAmount(v) })}
// UpdateRoundingAmount sets the "rounding_amount" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateRoundingAmount() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateRoundingAmount() })}
// ClearRoundingAmount clears the value of the "rounding_amount" field.func (u *BillingInvoiceLineDiscountUpsertBulk) ClearRoundingAmount() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearRoundingAmount() })}
// SetSourceDiscount sets the "source_discount" field.func (u *BillingInvoiceLineDiscountUpsertBulk) SetSourceDiscount(v *billing.DiscountReason) *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.SetSourceDiscount(v) })}
// UpdateSourceDiscount sets the "source_discount" field to the value that was provided on create.func (u *BillingInvoiceLineDiscountUpsertBulk) UpdateSourceDiscount() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.UpdateSourceDiscount() })}
// ClearSourceDiscount clears the value of the "source_discount" field.func (u *BillingInvoiceLineDiscountUpsertBulk) ClearSourceDiscount() *BillingInvoiceLineDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineDiscountUpsert) { s.ClearSourceDiscount() })}
// Exec executes the query.func (u *BillingInvoiceLineDiscountUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { return u.create.err } for i, b := range u.create.builders { if len(b.conflict) != 0 { return fmt.Errorf("db: OnConflict was set for builder %d. Set it on the BillingInvoiceLineDiscountCreateBulk instead", i) } } if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceLineDiscountCreateBulk.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceLineDiscountUpsertBulk) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788// Code generated by ent, DO NOT EDIT.
package db
import ( "context"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicelinediscount" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceLineDiscountDelete is the builder for deleting a BillingInvoiceLineDiscount entity.type BillingInvoiceLineDiscountDelete struct { config hooks []Hook mutation *BillingInvoiceLineDiscountMutation}
// Where appends a list predicates to the BillingInvoiceLineDiscountDelete builder.func (_d *BillingInvoiceLineDiscountDelete) Where(ps ...predicate.BillingInvoiceLineDiscount) *BillingInvoiceLineDiscountDelete { _d.mutation.Where(ps...) return _d}
// Exec executes the deletion query and returns how many vertices were deleted.func (_d *BillingInvoiceLineDiscountDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceLineDiscountDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n}
func (_d *BillingInvoiceLineDiscountDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(billinginvoicelinediscount.Table, sqlgraph.NewFieldSpec(billinginvoicelinediscount.FieldID, field.TypeString)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err}
// BillingInvoiceLineDiscountDeleteOne is the builder for deleting a single BillingInvoiceLineDiscount entity.type BillingInvoiceLineDiscountDeleteOne struct { _d *BillingInvoiceLineDiscountDelete}
// Where appends a list predicates to the BillingInvoiceLineDiscountDelete builder.func (_d *BillingInvoiceLineDiscountDeleteOne) Where(ps ...predicate.BillingInvoiceLineDiscount) *BillingInvoiceLineDiscountDeleteOne { _d._d.mutation.Where(ps...) return _d}
// Exec executes the deletion query.func (_d *BillingInvoiceLineDiscountDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{billinginvoicelinediscount.Label} default: return nil }}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceLineDiscountDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "fmt" "math"
"entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicelinediscount" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceLineDiscountQuery is the builder for querying BillingInvoiceLineDiscount entities.type BillingInvoiceLineDiscountQuery struct { config ctx *QueryContext order []billinginvoicelinediscount.OrderOption inters []Interceptor predicates []predicate.BillingInvoiceLineDiscount withBillingInvoiceLine *BillingInvoiceLineQuery 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 BillingInvoiceLineDiscountQuery builder.func (_q *BillingInvoiceLineDiscountQuery) Where(ps ...predicate.BillingInvoiceLineDiscount) *BillingInvoiceLineDiscountQuery { _q.predicates = append(_q.predicates, ps...) return _q}
// Limit the number of records to be returned by this query.func (_q *BillingInvoiceLineDiscountQuery) Limit(limit int) *BillingInvoiceLineDiscountQuery { _q.ctx.Limit = &limit return _q}
// Offset to start from.func (_q *BillingInvoiceLineDiscountQuery) Offset(offset int) *BillingInvoiceLineDiscountQuery { _q.ctx.Offset = &offset return _q}
// 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 (_q *BillingInvoiceLineDiscountQuery) Unique(unique bool) *BillingInvoiceLineDiscountQuery { _q.ctx.Unique = &unique return _q}
// Order specifies how the records should be ordered.func (_q *BillingInvoiceLineDiscountQuery) Order(o ...billinginvoicelinediscount.OrderOption) *BillingInvoiceLineDiscountQuery { _q.order = append(_q.order, o...) return _q}
// QueryBillingInvoiceLine chains the current query on the "billing_invoice_line" edge.func (_q *BillingInvoiceLineDiscountQuery) QueryBillingInvoiceLine() *BillingInvoiceLineQuery { query := (&BillingInvoiceLineClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(billinginvoicelinediscount.Table, billinginvoicelinediscount.FieldID, selector), sqlgraph.To(billinginvoiceline.Table, billinginvoiceline.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, billinginvoicelinediscount.BillingInvoiceLineTable, billinginvoicelinediscount.BillingInvoiceLineColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query}
// First returns the first BillingInvoiceLineDiscount entity from the query.// Returns a *NotFoundError when no BillingInvoiceLineDiscount was found.func (_q *BillingInvoiceLineDiscountQuery) First(ctx context.Context) (*BillingInvoiceLineDiscount, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{billinginvoicelinediscount.Label} } return nodes[0], nil}
// FirstX is like First, but panics if an error occurs.func (_q *BillingInvoiceLineDiscountQuery) FirstX(ctx context.Context) *BillingInvoiceLineDiscount { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node}
// FirstID returns the first BillingInvoiceLineDiscount ID from the query.// Returns a *NotFoundError when no BillingInvoiceLineDiscount ID was found.func (_q *BillingInvoiceLineDiscountQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{billinginvoicelinediscount.Label} return } return ids[0], nil}
// FirstIDX is like FirstID, but panics if an error occurs.func (_q *BillingInvoiceLineDiscountQuery) FirstIDX(ctx context.Context) string { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id}
// Only returns a single BillingInvoiceLineDiscount entity found by the query, ensuring it only returns one.// Returns a *NotSingularError when more than one BillingInvoiceLineDiscount entity is found.// Returns a *NotFoundError when no BillingInvoiceLineDiscount entities are found.func (_q *BillingInvoiceLineDiscountQuery) Only(ctx context.Context) (*BillingInvoiceLineDiscount, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{billinginvoicelinediscount.Label} default: return nil, &NotSingularError{billinginvoicelinediscount.Label} }}
// OnlyX is like Only, but panics if an error occurs.func (_q *BillingInvoiceLineDiscountQuery) OnlyX(ctx context.Context) *BillingInvoiceLineDiscount { node, err := _q.Only(ctx) if err != nil { panic(err) } return node}
// OnlyID is like Only, but returns the only BillingInvoiceLineDiscount ID in the query.// Returns a *NotSingularError when more than one BillingInvoiceLineDiscount ID is found.// Returns a *NotFoundError when no entities are found.func (_q *BillingInvoiceLineDiscountQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{billinginvoicelinediscount.Label} default: err = &NotSingularError{billinginvoicelinediscount.Label} } return}
// OnlyIDX is like OnlyID, but panics if an error occurs.func (_q *BillingInvoiceLineDiscountQuery) OnlyIDX(ctx context.Context) string { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id}
// All executes the query and returns a list of BillingInvoiceLineDiscounts.func (_q *BillingInvoiceLineDiscountQuery) All(ctx context.Context) ([]*BillingInvoiceLineDiscount, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*BillingInvoiceLineDiscount, *BillingInvoiceLineDiscountQuery]() return withInterceptors[[]*BillingInvoiceLineDiscount](ctx, _q, qr, _q.inters)}
// AllX is like All, but panics if an error occurs.func (_q *BillingInvoiceLineDiscountQuery) AllX(ctx context.Context) []*BillingInvoiceLineDiscount { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes}
// IDs executes the query and returns a list of BillingInvoiceLineDiscount IDs.func (_q *BillingInvoiceLineDiscountQuery) IDs(ctx context.Context) (ids []string, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(billinginvoicelinediscount.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil}
// IDsX is like IDs, but panics if an error occurs.func (_q *BillingInvoiceLineDiscountQuery) IDsX(ctx context.Context) []string { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids}
// Count returns the count of the given query.func (_q *BillingInvoiceLineDiscountQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*BillingInvoiceLineDiscountQuery](), _q.inters)}
// CountX is like Count, but panics if an error occurs.func (_q *BillingInvoiceLineDiscountQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count}
// Exist returns true if the query has elements in the graph.func (_q *BillingInvoiceLineDiscountQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("db: check existence: %w", err) default: return true, nil }}
// ExistX is like Exist, but panics if an error occurs.func (_q *BillingInvoiceLineDiscountQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist}
// Clone returns a duplicate of the BillingInvoiceLineDiscountQuery builder, including all associated steps. It can be// used to prepare common query builders and use them differently after the clone is made.func (_q *BillingInvoiceLineDiscountQuery) Clone() *BillingInvoiceLineDiscountQuery { if _q == nil { return nil } return &BillingInvoiceLineDiscountQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]billinginvoicelinediscount.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.BillingInvoiceLineDiscount{}, _q.predicates...), withBillingInvoiceLine: _q.withBillingInvoiceLine.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, }}
// WithBillingInvoiceLine tells the query-builder to eager-load the nodes that are connected to// the "billing_invoice_line" edge. The optional arguments are used to configure the query builder of the edge.func (_q *BillingInvoiceLineDiscountQuery) WithBillingInvoiceLine(opts ...func(*BillingInvoiceLineQuery)) *BillingInvoiceLineDiscountQuery { query := (&BillingInvoiceLineClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withBillingInvoiceLine = query return _q}
// GroupBy is used to group vertices by one or more fields/columns.// It is often used with aggregate functions, like: count, max, mean, min, sum.//// Example://// var v []struct {// Namespace string `json:"namespace,omitempty"`// Count int `json:"count,omitempty"`// }//// client.BillingInvoiceLineDiscount.Query().// GroupBy(billinginvoicelinediscount.FieldNamespace).// Aggregate(db.Count()).// Scan(ctx, &v)func (_q *BillingInvoiceLineDiscountQuery) GroupBy(field string, fields ...string) *BillingInvoiceLineDiscountGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &BillingInvoiceLineDiscountGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = billinginvoicelinediscount.Label grbuild.scan = grbuild.Scan return grbuild}
// Select allows the selection one or more fields/columns for the given query,// instead of selecting all fields in the entity.//// Example://// var v []struct {// Namespace string `json:"namespace,omitempty"`// }//// client.BillingInvoiceLineDiscount.Query().// Select(billinginvoicelinediscount.FieldNamespace).// Scan(ctx, &v)func (_q *BillingInvoiceLineDiscountQuery) Select(fields ...string) *BillingInvoiceLineDiscountSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &BillingInvoiceLineDiscountSelect{BillingInvoiceLineDiscountQuery: _q} sbuild.label = billinginvoicelinediscount.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild}
// Aggregate returns a BillingInvoiceLineDiscountSelect configured with the given aggregations.func (_q *BillingInvoiceLineDiscountQuery) Aggregate(fns ...AggregateFunc) *BillingInvoiceLineDiscountSelect { return _q.Select().Aggregate(fns...)}
func (_q *BillingInvoiceLineDiscountQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("db: uninitialized interceptor (forgotten import db/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !billinginvoicelinediscount.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil}
func (_q *BillingInvoiceLineDiscountQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BillingInvoiceLineDiscount, error) { var ( nodes = []*BillingInvoiceLineDiscount{} _spec = _q.querySpec() loadedTypes = [1]bool{ _q.withBillingInvoiceLine != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*BillingInvoiceLineDiscount).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &BillingInvoiceLineDiscount{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withBillingInvoiceLine; query != nil { if err := _q.loadBillingInvoiceLine(ctx, query, nodes, nil, func(n *BillingInvoiceLineDiscount, e *BillingInvoiceLine) { n.Edges.BillingInvoiceLine = e }); err != nil { return nil, err } } return nodes, nil}
func (_q *BillingInvoiceLineDiscountQuery) loadBillingInvoiceLine(ctx context.Context, query *BillingInvoiceLineQuery, nodes []*BillingInvoiceLineDiscount, init func(*BillingInvoiceLineDiscount), assign func(*BillingInvoiceLineDiscount, *BillingInvoiceLine)) error { ids := make([]string, 0, len(nodes)) nodeids := make(map[string][]*BillingInvoiceLineDiscount) for i := range nodes { fk := nodes[i].LineID if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(billinginvoiceline.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "line_id" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil}
func (_q *BillingInvoiceLineDiscountQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec)}
func (_q *BillingInvoiceLineDiscountQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(billinginvoicelinediscount.Table, billinginvoicelinediscount.Columns, sqlgraph.NewFieldSpec(billinginvoicelinediscount.FieldID, field.TypeString)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicelinediscount.FieldID) for i := range fields { if fields[i] != billinginvoicelinediscount.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } if _q.withBillingInvoiceLine != nil { _spec.Node.AddColumnOnce(billinginvoicelinediscount.FieldLineID) } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec}
func (_q *BillingInvoiceLineDiscountQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(billinginvoicelinediscount.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = billinginvoicelinediscount.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, m := range _q.modifiers { m(selector) } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector}
// ForUpdate locks the selected rows against concurrent updates, and prevent them from being// updated, deleted or "selected ... for update" by other sessions, until the transaction is// either committed or rolled-back.func (_q *BillingInvoiceLineDiscountQuery) ForUpdate(opts ...sql.LockOption) *BillingInvoiceLineDiscountQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForUpdate(opts...) }) return _q}
// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock// on any rows that are read. Other sessions can read the rows, but cannot modify them// until your transaction commits.func (_q *BillingInvoiceLineDiscountQuery) ForShare(opts ...sql.LockOption) *BillingInvoiceLineDiscountQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForShare(opts...) }) return _q}
// BillingInvoiceLineDiscountGroupBy is the group-by builder for BillingInvoiceLineDiscount entities.type BillingInvoiceLineDiscountGroupBy struct { selector build *BillingInvoiceLineDiscountQuery}
// Aggregate adds the given aggregation functions to the group-by query.func (_g *BillingInvoiceLineDiscountGroupBy) Aggregate(fns ...AggregateFunc) *BillingInvoiceLineDiscountGroupBy { _g.fns = append(_g.fns, fns...) return _g}
// Scan applies the selector query and scans the result into the given value.func (_g *BillingInvoiceLineDiscountGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceLineDiscountQuery, *BillingInvoiceLineDiscountGroupBy](ctx, _g.build, _g, _g.build.inters, v)}
func (_g *BillingInvoiceLineDiscountGroupBy) sqlScan(ctx context.Context, root *BillingInvoiceLineDiscountQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}
// BillingInvoiceLineDiscountSelect is the builder for selecting fields of BillingInvoiceLineDiscount entities.type BillingInvoiceLineDiscountSelect struct { *BillingInvoiceLineDiscountQuery selector}
// Aggregate adds the given aggregation functions to the selector query.func (_s *BillingInvoiceLineDiscountSelect) Aggregate(fns ...AggregateFunc) *BillingInvoiceLineDiscountSelect { _s.fns = append(_s.fns, fns...) return _s}
// Scan applies the selector query and scans the result into the given value.func (_s *BillingInvoiceLineDiscountSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceLineDiscountQuery, *BillingInvoiceLineDiscountSelect](ctx, _s.BillingInvoiceLineDiscountQuery, _s, _s.inters, v)}
func (_s *BillingInvoiceLineDiscountSelect) sqlScan(ctx context.Context, root *BillingInvoiceLineDiscountQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt" "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicelinediscount" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceLineDiscountUpdate is the builder for updating BillingInvoiceLineDiscount entities.type BillingInvoiceLineDiscountUpdate struct { config hooks []Hook mutation *BillingInvoiceLineDiscountMutation}
// Where appends a list predicates to the BillingInvoiceLineDiscountUpdate builder.func (_u *BillingInvoiceLineDiscountUpdate) Where(ps ...predicate.BillingInvoiceLineDiscount) *BillingInvoiceLineDiscountUpdate { _u.mutation.Where(ps...) return _u}
// SetUpdatedAt sets the "updated_at" field.func (_u *BillingInvoiceLineDiscountUpdate) SetUpdatedAt(v time.Time) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetUpdatedAt(v) return _u}
// SetDeletedAt sets the "deleted_at" field.func (_u *BillingInvoiceLineDiscountUpdate) SetDeletedAt(v time.Time) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetDeletedAt(v) return _u}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdate) SetNillableDeletedAt(v *time.Time) *BillingInvoiceLineDiscountUpdate { if v != nil { _u.SetDeletedAt(*v) } return _u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (_u *BillingInvoiceLineDiscountUpdate) ClearDeletedAt() *BillingInvoiceLineDiscountUpdate { _u.mutation.ClearDeletedAt() return _u}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (_u *BillingInvoiceLineDiscountUpdate) SetInvoicingAppExternalID(v string) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetInvoicingAppExternalID(v) return _u}
// SetNillableInvoicingAppExternalID sets the "invoicing_app_external_id" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdate) SetNillableInvoicingAppExternalID(v *string) *BillingInvoiceLineDiscountUpdate { if v != nil { _u.SetInvoicingAppExternalID(*v) } return _u}
// ClearInvoicingAppExternalID clears the value of the "invoicing_app_external_id" field.func (_u *BillingInvoiceLineDiscountUpdate) ClearInvoicingAppExternalID() *BillingInvoiceLineDiscountUpdate { _u.mutation.ClearInvoicingAppExternalID() return _u}
// SetLineID sets the "line_id" field.func (_u *BillingInvoiceLineDiscountUpdate) SetLineID(v string) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetLineID(v) return _u}
// SetNillableLineID sets the "line_id" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdate) SetNillableLineID(v *string) *BillingInvoiceLineDiscountUpdate { if v != nil { _u.SetLineID(*v) } return _u}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (_u *BillingInvoiceLineDiscountUpdate) SetChildUniqueReferenceID(v string) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetChildUniqueReferenceID(v) return _u}
// SetNillableChildUniqueReferenceID sets the "child_unique_reference_id" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdate) SetNillableChildUniqueReferenceID(v *string) *BillingInvoiceLineDiscountUpdate { if v != nil { _u.SetChildUniqueReferenceID(*v) } return _u}
// ClearChildUniqueReferenceID clears the value of the "child_unique_reference_id" field.func (_u *BillingInvoiceLineDiscountUpdate) ClearChildUniqueReferenceID() *BillingInvoiceLineDiscountUpdate { _u.mutation.ClearChildUniqueReferenceID() return _u}
// SetDescription sets the "description" field.func (_u *BillingInvoiceLineDiscountUpdate) SetDescription(v string) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetDescription(v) return _u}
// SetNillableDescription sets the "description" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdate) SetNillableDescription(v *string) *BillingInvoiceLineDiscountUpdate { if v != nil { _u.SetDescription(*v) } return _u}
// ClearDescription clears the value of the "description" field.func (_u *BillingInvoiceLineDiscountUpdate) ClearDescription() *BillingInvoiceLineDiscountUpdate { _u.mutation.ClearDescription() return _u}
// SetReason sets the "reason" field.func (_u *BillingInvoiceLineDiscountUpdate) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetReason(v) return _u}
// SetNillableReason sets the "reason" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdate) SetNillableReason(v *billing.DiscountReasonType) *BillingInvoiceLineDiscountUpdate { if v != nil { _u.SetReason(*v) } return _u}
// SetAmount sets the "amount" field.func (_u *BillingInvoiceLineDiscountUpdate) SetAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetAmount(v) return _u}
// SetNillableAmount sets the "amount" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdate) SetNillableAmount(v *alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpdate { if v != nil { _u.SetAmount(*v) } return _u}
// SetRoundingAmount sets the "rounding_amount" field.func (_u *BillingInvoiceLineDiscountUpdate) SetRoundingAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetRoundingAmount(v) return _u}
// SetNillableRoundingAmount sets the "rounding_amount" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdate) SetNillableRoundingAmount(v *alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpdate { if v != nil { _u.SetRoundingAmount(*v) } return _u}
// ClearRoundingAmount clears the value of the "rounding_amount" field.func (_u *BillingInvoiceLineDiscountUpdate) ClearRoundingAmount() *BillingInvoiceLineDiscountUpdate { _u.mutation.ClearRoundingAmount() return _u}
// SetSourceDiscount sets the "source_discount" field.func (_u *BillingInvoiceLineDiscountUpdate) SetSourceDiscount(v *billing.DiscountReason) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetSourceDiscount(v) return _u}
// ClearSourceDiscount clears the value of the "source_discount" field.func (_u *BillingInvoiceLineDiscountUpdate) ClearSourceDiscount() *BillingInvoiceLineDiscountUpdate { _u.mutation.ClearSourceDiscount() return _u}
// SetBillingInvoiceLineID sets the "billing_invoice_line" edge to the BillingInvoiceLine entity by ID.func (_u *BillingInvoiceLineDiscountUpdate) SetBillingInvoiceLineID(id string) *BillingInvoiceLineDiscountUpdate { _u.mutation.SetBillingInvoiceLineID(id) return _u}
// SetBillingInvoiceLine sets the "billing_invoice_line" edge to the BillingInvoiceLine entity.func (_u *BillingInvoiceLineDiscountUpdate) SetBillingInvoiceLine(v *BillingInvoiceLine) *BillingInvoiceLineDiscountUpdate { return _u.SetBillingInvoiceLineID(v.ID)}
// Mutation returns the BillingInvoiceLineDiscountMutation object of the builder.func (_u *BillingInvoiceLineDiscountUpdate) Mutation() *BillingInvoiceLineDiscountMutation { return _u.mutation}
// ClearBillingInvoiceLine clears the "billing_invoice_line" edge to the BillingInvoiceLine entity.func (_u *BillingInvoiceLineDiscountUpdate) ClearBillingInvoiceLine() *BillingInvoiceLineDiscountUpdate { _u.mutation.ClearBillingInvoiceLine() return _u}
// Save executes the query and returns the number of nodes affected by the update operation.func (_u *BillingInvoiceLineDiscountUpdate) Save(ctx context.Context) (int, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceLineDiscountUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected}
// Exec executes the query.func (_u *BillingInvoiceLineDiscountUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceLineDiscountUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_u *BillingInvoiceLineDiscountUpdate) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := billinginvoicelinediscount.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) }}
// check runs all checks and user-defined validators on the builder.func (_u *BillingInvoiceLineDiscountUpdate) check() error { if v, ok := _u.mutation.Reason(); ok { if err := billinginvoicelinediscount.ReasonValidator(v); err != nil { return &ValidationError{Name: "reason", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineDiscount.reason": %w`, err)} } } if v, ok := _u.mutation.SourceDiscount(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "source_discount", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineDiscount.source_discount": %w`, err)} } } if _u.mutation.BillingInvoiceLineCleared() && len(_u.mutation.BillingInvoiceLineIDs()) > 0 { return errors.New(`db: clearing a required unique edge "BillingInvoiceLineDiscount.billing_invoice_line"`) } return nil}
func (_u *BillingInvoiceLineDiscountUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(billinginvoicelinediscount.Table, billinginvoicelinediscount.Columns, sqlgraph.NewFieldSpec(billinginvoicelinediscount.FieldID, field.TypeString)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicelinediscount.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicelinediscount.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(billinginvoicelinediscount.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.InvoicingAppExternalID(); ok { _spec.SetField(billinginvoicelinediscount.FieldInvoicingAppExternalID, field.TypeString, value) } if _u.mutation.InvoicingAppExternalIDCleared() { _spec.ClearField(billinginvoicelinediscount.FieldInvoicingAppExternalID, field.TypeString) } if value, ok := _u.mutation.ChildUniqueReferenceID(); ok { _spec.SetField(billinginvoicelinediscount.FieldChildUniqueReferenceID, field.TypeString, value) } if _u.mutation.ChildUniqueReferenceIDCleared() { _spec.ClearField(billinginvoicelinediscount.FieldChildUniqueReferenceID, field.TypeString) } if value, ok := _u.mutation.Description(); ok { _spec.SetField(billinginvoicelinediscount.FieldDescription, field.TypeString, value) } if _u.mutation.DescriptionCleared() { _spec.ClearField(billinginvoicelinediscount.FieldDescription, field.TypeString) } if value, ok := _u.mutation.Reason(); ok { _spec.SetField(billinginvoicelinediscount.FieldReason, field.TypeEnum, value) } if value, ok := _u.mutation.Amount(); ok { _spec.SetField(billinginvoicelinediscount.FieldAmount, field.TypeOther, value) } if value, ok := _u.mutation.RoundingAmount(); ok { _spec.SetField(billinginvoicelinediscount.FieldRoundingAmount, field.TypeOther, value) } if _u.mutation.RoundingAmountCleared() { _spec.ClearField(billinginvoicelinediscount.FieldRoundingAmount, field.TypeOther) } if value, ok := _u.mutation.SourceDiscount(); ok { vv, err := billinginvoicelinediscount.ValueScanner.SourceDiscount.Value(value) if err != nil { return 0, err } _spec.SetField(billinginvoicelinediscount.FieldSourceDiscount, field.TypeString, vv) } if _u.mutation.SourceDiscountCleared() { _spec.ClearField(billinginvoicelinediscount.FieldSourceDiscount, field.TypeString) } if _u.mutation.BillingInvoiceLineCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicelinediscount.BillingInvoiceLineTable, Columns: []string{billinginvoicelinediscount.BillingInvoiceLineColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.BillingInvoiceLineIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicelinediscount.BillingInvoiceLineTable, Columns: []string{billinginvoicelinediscount.BillingInvoiceLineColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoicelinediscount.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil}
// BillingInvoiceLineDiscountUpdateOne is the builder for updating a single BillingInvoiceLineDiscount entity.type BillingInvoiceLineDiscountUpdateOne struct { config fields []string hooks []Hook mutation *BillingInvoiceLineDiscountMutation}
// SetUpdatedAt sets the "updated_at" field.func (_u *BillingInvoiceLineDiscountUpdateOne) SetUpdatedAt(v time.Time) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetUpdatedAt(v) return _u}
// SetDeletedAt sets the "deleted_at" field.func (_u *BillingInvoiceLineDiscountUpdateOne) SetDeletedAt(v time.Time) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetDeletedAt(v) return _u}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdateOne) SetNillableDeletedAt(v *time.Time) *BillingInvoiceLineDiscountUpdateOne { if v != nil { _u.SetDeletedAt(*v) } return _u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (_u *BillingInvoiceLineDiscountUpdateOne) ClearDeletedAt() *BillingInvoiceLineDiscountUpdateOne { _u.mutation.ClearDeletedAt() return _u}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (_u *BillingInvoiceLineDiscountUpdateOne) SetInvoicingAppExternalID(v string) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetInvoicingAppExternalID(v) return _u}
// SetNillableInvoicingAppExternalID sets the "invoicing_app_external_id" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdateOne) SetNillableInvoicingAppExternalID(v *string) *BillingInvoiceLineDiscountUpdateOne { if v != nil { _u.SetInvoicingAppExternalID(*v) } return _u}
// ClearInvoicingAppExternalID clears the value of the "invoicing_app_external_id" field.func (_u *BillingInvoiceLineDiscountUpdateOne) ClearInvoicingAppExternalID() *BillingInvoiceLineDiscountUpdateOne { _u.mutation.ClearInvoicingAppExternalID() return _u}
// SetLineID sets the "line_id" field.func (_u *BillingInvoiceLineDiscountUpdateOne) SetLineID(v string) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetLineID(v) return _u}
// SetNillableLineID sets the "line_id" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdateOne) SetNillableLineID(v *string) *BillingInvoiceLineDiscountUpdateOne { if v != nil { _u.SetLineID(*v) } return _u}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (_u *BillingInvoiceLineDiscountUpdateOne) SetChildUniqueReferenceID(v string) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetChildUniqueReferenceID(v) return _u}
// SetNillableChildUniqueReferenceID sets the "child_unique_reference_id" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdateOne) SetNillableChildUniqueReferenceID(v *string) *BillingInvoiceLineDiscountUpdateOne { if v != nil { _u.SetChildUniqueReferenceID(*v) } return _u}
// ClearChildUniqueReferenceID clears the value of the "child_unique_reference_id" field.func (_u *BillingInvoiceLineDiscountUpdateOne) ClearChildUniqueReferenceID() *BillingInvoiceLineDiscountUpdateOne { _u.mutation.ClearChildUniqueReferenceID() return _u}
// SetDescription sets the "description" field.func (_u *BillingInvoiceLineDiscountUpdateOne) SetDescription(v string) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetDescription(v) return _u}
// SetNillableDescription sets the "description" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdateOne) SetNillableDescription(v *string) *BillingInvoiceLineDiscountUpdateOne { if v != nil { _u.SetDescription(*v) } return _u}
// ClearDescription clears the value of the "description" field.func (_u *BillingInvoiceLineDiscountUpdateOne) ClearDescription() *BillingInvoiceLineDiscountUpdateOne { _u.mutation.ClearDescription() return _u}
// SetReason sets the "reason" field.func (_u *BillingInvoiceLineDiscountUpdateOne) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetReason(v) return _u}
// SetNillableReason sets the "reason" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdateOne) SetNillableReason(v *billing.DiscountReasonType) *BillingInvoiceLineDiscountUpdateOne { if v != nil { _u.SetReason(*v) } return _u}
// SetAmount sets the "amount" field.func (_u *BillingInvoiceLineDiscountUpdateOne) SetAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetAmount(v) return _u}
// SetNillableAmount sets the "amount" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdateOne) SetNillableAmount(v *alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpdateOne { if v != nil { _u.SetAmount(*v) } return _u}
// SetRoundingAmount sets the "rounding_amount" field.func (_u *BillingInvoiceLineDiscountUpdateOne) SetRoundingAmount(v alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetRoundingAmount(v) return _u}
// SetNillableRoundingAmount sets the "rounding_amount" field if the given value is not nil.func (_u *BillingInvoiceLineDiscountUpdateOne) SetNillableRoundingAmount(v *alpacadecimal.Decimal) *BillingInvoiceLineDiscountUpdateOne { if v != nil { _u.SetRoundingAmount(*v) } return _u}
// ClearRoundingAmount clears the value of the "rounding_amount" field.func (_u *BillingInvoiceLineDiscountUpdateOne) ClearRoundingAmount() *BillingInvoiceLineDiscountUpdateOne { _u.mutation.ClearRoundingAmount() return _u}
// SetSourceDiscount sets the "source_discount" field.func (_u *BillingInvoiceLineDiscountUpdateOne) SetSourceDiscount(v *billing.DiscountReason) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetSourceDiscount(v) return _u}
// ClearSourceDiscount clears the value of the "source_discount" field.func (_u *BillingInvoiceLineDiscountUpdateOne) ClearSourceDiscount() *BillingInvoiceLineDiscountUpdateOne { _u.mutation.ClearSourceDiscount() return _u}
// SetBillingInvoiceLineID sets the "billing_invoice_line" edge to the BillingInvoiceLine entity by ID.func (_u *BillingInvoiceLineDiscountUpdateOne) SetBillingInvoiceLineID(id string) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.SetBillingInvoiceLineID(id) return _u}
// SetBillingInvoiceLine sets the "billing_invoice_line" edge to the BillingInvoiceLine entity.func (_u *BillingInvoiceLineDiscountUpdateOne) SetBillingInvoiceLine(v *BillingInvoiceLine) *BillingInvoiceLineDiscountUpdateOne { return _u.SetBillingInvoiceLineID(v.ID)}
// Mutation returns the BillingInvoiceLineDiscountMutation object of the builder.func (_u *BillingInvoiceLineDiscountUpdateOne) Mutation() *BillingInvoiceLineDiscountMutation { return _u.mutation}
// ClearBillingInvoiceLine clears the "billing_invoice_line" edge to the BillingInvoiceLine entity.func (_u *BillingInvoiceLineDiscountUpdateOne) ClearBillingInvoiceLine() *BillingInvoiceLineDiscountUpdateOne { _u.mutation.ClearBillingInvoiceLine() return _u}
// Where appends a list predicates to the BillingInvoiceLineDiscountUpdate builder.func (_u *BillingInvoiceLineDiscountUpdateOne) Where(ps ...predicate.BillingInvoiceLineDiscount) *BillingInvoiceLineDiscountUpdateOne { _u.mutation.Where(ps...) return _u}
// Select allows selecting one or more fields (columns) of the returned entity.// The default is selecting all fields defined in the entity schema.func (_u *BillingInvoiceLineDiscountUpdateOne) Select(field string, fields ...string) *BillingInvoiceLineDiscountUpdateOne { _u.fields = append([]string{field}, fields...) return _u}
// Save executes the query and returns the updated BillingInvoiceLineDiscount entity.func (_u *BillingInvoiceLineDiscountUpdateOne) Save(ctx context.Context) (*BillingInvoiceLineDiscount, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceLineDiscountUpdateOne) SaveX(ctx context.Context) *BillingInvoiceLineDiscount { node, err := _u.Save(ctx) if err != nil { panic(err) } return node}
// Exec executes the query on the entity.func (_u *BillingInvoiceLineDiscountUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceLineDiscountUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_u *BillingInvoiceLineDiscountUpdateOne) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := billinginvoicelinediscount.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) }}
// check runs all checks and user-defined validators on the builder.func (_u *BillingInvoiceLineDiscountUpdateOne) check() error { if v, ok := _u.mutation.Reason(); ok { if err := billinginvoicelinediscount.ReasonValidator(v); err != nil { return &ValidationError{Name: "reason", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineDiscount.reason": %w`, err)} } } if v, ok := _u.mutation.SourceDiscount(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "source_discount", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineDiscount.source_discount": %w`, err)} } } if _u.mutation.BillingInvoiceLineCleared() && len(_u.mutation.BillingInvoiceLineIDs()) > 0 { return errors.New(`db: clearing a required unique edge "BillingInvoiceLineDiscount.billing_invoice_line"`) } return nil}
func (_u *BillingInvoiceLineDiscountUpdateOne) sqlSave(ctx context.Context) (_node *BillingInvoiceLineDiscount, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(billinginvoicelinediscount.Table, billinginvoicelinediscount.Columns, sqlgraph.NewFieldSpec(billinginvoicelinediscount.FieldID, field.TypeString)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "BillingInvoiceLineDiscount.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicelinediscount.FieldID) for _, f := range fields { if !billinginvoicelinediscount.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } if f != billinginvoicelinediscount.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicelinediscount.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicelinediscount.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(billinginvoicelinediscount.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.InvoicingAppExternalID(); ok { _spec.SetField(billinginvoicelinediscount.FieldInvoicingAppExternalID, field.TypeString, value) } if _u.mutation.InvoicingAppExternalIDCleared() { _spec.ClearField(billinginvoicelinediscount.FieldInvoicingAppExternalID, field.TypeString) } if value, ok := _u.mutation.ChildUniqueReferenceID(); ok { _spec.SetField(billinginvoicelinediscount.FieldChildUniqueReferenceID, field.TypeString, value) } if _u.mutation.ChildUniqueReferenceIDCleared() { _spec.ClearField(billinginvoicelinediscount.FieldChildUniqueReferenceID, field.TypeString) } if value, ok := _u.mutation.Description(); ok { _spec.SetField(billinginvoicelinediscount.FieldDescription, field.TypeString, value) } if _u.mutation.DescriptionCleared() { _spec.ClearField(billinginvoicelinediscount.FieldDescription, field.TypeString) } if value, ok := _u.mutation.Reason(); ok { _spec.SetField(billinginvoicelinediscount.FieldReason, field.TypeEnum, value) } if value, ok := _u.mutation.Amount(); ok { _spec.SetField(billinginvoicelinediscount.FieldAmount, field.TypeOther, value) } if value, ok := _u.mutation.RoundingAmount(); ok { _spec.SetField(billinginvoicelinediscount.FieldRoundingAmount, field.TypeOther, value) } if _u.mutation.RoundingAmountCleared() { _spec.ClearField(billinginvoicelinediscount.FieldRoundingAmount, field.TypeOther) } if value, ok := _u.mutation.SourceDiscount(); ok { vv, err := billinginvoicelinediscount.ValueScanner.SourceDiscount.Value(value) if err != nil { return nil, err } _spec.SetField(billinginvoicelinediscount.FieldSourceDiscount, field.TypeString, vv) } if _u.mutation.SourceDiscountCleared() { _spec.ClearField(billinginvoicelinediscount.FieldSourceDiscount, field.TypeString) } if _u.mutation.BillingInvoiceLineCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicelinediscount.BillingInvoiceLineTable, Columns: []string{billinginvoicelinediscount.BillingInvoiceLineColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.BillingInvoiceLineIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicelinediscount.BillingInvoiceLineTable, Columns: []string{billinginvoicelinediscount.BillingInvoiceLineColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &BillingInvoiceLineDiscount{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoicelinediscount.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279// Code generated by ent, DO NOT EDIT.
package db
import ( "fmt" "strings" "time"
"entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicelineusagediscount")
// BillingInvoiceLineUsageDiscount is the model entity for the BillingInvoiceLineUsageDiscount schema.type BillingInvoiceLineUsageDiscount struct { config `json:"-"` // ID of the ent. ID string `json:"id,omitempty"` // Namespace holds the value of the "namespace" field. Namespace string `json:"namespace,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt *time.Time `json:"deleted_at,omitempty"` // InvoicingAppExternalID holds the value of the "invoicing_app_external_id" field. InvoicingAppExternalID *string `json:"invoicing_app_external_id,omitempty"` // LineID holds the value of the "line_id" field. LineID string `json:"line_id,omitempty"` // ChildUniqueReferenceID holds the value of the "child_unique_reference_id" field. ChildUniqueReferenceID *string `json:"child_unique_reference_id,omitempty"` // Description holds the value of the "description" field. Description *string `json:"description,omitempty"` // Reason holds the value of the "reason" field. Reason billing.DiscountReasonType `json:"reason,omitempty"` // Quantity holds the value of the "quantity" field. Quantity alpacadecimal.Decimal `json:"quantity,omitempty"` // PreLinePeriodQuantity holds the value of the "pre_line_period_quantity" field. PreLinePeriodQuantity *alpacadecimal.Decimal `json:"pre_line_period_quantity,omitempty"` // ReasonDetails holds the value of the "reason_details" field. ReasonDetails *billing.DiscountReason `json:"reason_details,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the BillingInvoiceLineUsageDiscountQuery when eager-loading is set. Edges BillingInvoiceLineUsageDiscountEdges `json:"edges"` selectValues sql.SelectValues}
// BillingInvoiceLineUsageDiscountEdges holds the relations/edges for other nodes in the graph.type BillingInvoiceLineUsageDiscountEdges struct { // BillingInvoiceLine holds the value of the billing_invoice_line edge. BillingInvoiceLine *BillingInvoiceLine `json:"billing_invoice_line,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [1]bool}
// BillingInvoiceLineOrErr returns the BillingInvoiceLine value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingInvoiceLineUsageDiscountEdges) BillingInvoiceLineOrErr() (*BillingInvoiceLine, error) { if e.BillingInvoiceLine != nil { return e.BillingInvoiceLine, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: billinginvoiceline.Label} } return nil, &NotLoadedError{edge: "billing_invoice_line"}}
// scanValues returns the types for scanning values from sql.Rows.func (*BillingInvoiceLineUsageDiscount) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case billinginvoicelineusagediscount.FieldPreLinePeriodQuantity: values[i] = &sql.NullScanner{S: new(alpacadecimal.Decimal)} case billinginvoicelineusagediscount.FieldQuantity: values[i] = new(alpacadecimal.Decimal) case billinginvoicelineusagediscount.FieldID, billinginvoicelineusagediscount.FieldNamespace, billinginvoicelineusagediscount.FieldInvoicingAppExternalID, billinginvoicelineusagediscount.FieldLineID, billinginvoicelineusagediscount.FieldChildUniqueReferenceID, billinginvoicelineusagediscount.FieldDescription, billinginvoicelineusagediscount.FieldReason: values[i] = new(sql.NullString) case billinginvoicelineusagediscount.FieldCreatedAt, billinginvoicelineusagediscount.FieldUpdatedAt, billinginvoicelineusagediscount.FieldDeletedAt: values[i] = new(sql.NullTime) case billinginvoicelineusagediscount.FieldReasonDetails: values[i] = billinginvoicelineusagediscount.ValueScanner.ReasonDetails.ScanValue() default: values[i] = new(sql.UnknownType) } } return values, nil}
// assignValues assigns the values that were returned from sql.Rows (after scanning)// to the BillingInvoiceLineUsageDiscount fields.func (_m *BillingInvoiceLineUsageDiscount) 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) } for i := range columns { switch columns[i] { case billinginvoicelineusagediscount.FieldID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value.Valid { _m.ID = value.String } case billinginvoicelineusagediscount.FieldNamespace: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field namespace", values[i]) } else if value.Valid { _m.Namespace = value.String } case billinginvoicelineusagediscount.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { _m.CreatedAt = value.Time } case billinginvoicelineusagediscount.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { _m.UpdatedAt = value.Time } case billinginvoicelineusagediscount.FieldDeletedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field deleted_at", values[i]) } else if value.Valid { _m.DeletedAt = new(time.Time) *_m.DeletedAt = value.Time } case billinginvoicelineusagediscount.FieldInvoicingAppExternalID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field invoicing_app_external_id", values[i]) } else if value.Valid { _m.InvoicingAppExternalID = new(string) *_m.InvoicingAppExternalID = value.String } case billinginvoicelineusagediscount.FieldLineID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field line_id", values[i]) } else if value.Valid { _m.LineID = value.String } case billinginvoicelineusagediscount.FieldChildUniqueReferenceID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field child_unique_reference_id", values[i]) } else if value.Valid { _m.ChildUniqueReferenceID = new(string) *_m.ChildUniqueReferenceID = value.String } case billinginvoicelineusagediscount.FieldDescription: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field description", values[i]) } else if value.Valid { _m.Description = new(string) *_m.Description = value.String } case billinginvoicelineusagediscount.FieldReason: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field reason", values[i]) } else if value.Valid { _m.Reason = billing.DiscountReasonType(value.String) } case billinginvoicelineusagediscount.FieldQuantity: if value, ok := values[i].(*alpacadecimal.Decimal); !ok { return fmt.Errorf("unexpected type %T for field quantity", values[i]) } else if value != nil { _m.Quantity = *value } case billinginvoicelineusagediscount.FieldPreLinePeriodQuantity: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field pre_line_period_quantity", values[i]) } else if value.Valid { _m.PreLinePeriodQuantity = new(alpacadecimal.Decimal) *_m.PreLinePeriodQuantity = *value.S.(*alpacadecimal.Decimal) } case billinginvoicelineusagediscount.FieldReasonDetails: if value, err := billinginvoicelineusagediscount.ValueScanner.ReasonDetails.FromValue(values[i]); err != nil { return err } else { _m.ReasonDetails = value } default: _m.selectValues.Set(columns[i], values[i]) } } return nil}
// Value returns the ent.Value that was dynamically selected and assigned to the BillingInvoiceLineUsageDiscount.// This includes values selected through modifiers, order, etc.func (_m *BillingInvoiceLineUsageDiscount) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name)}
// QueryBillingInvoiceLine queries the "billing_invoice_line" edge of the BillingInvoiceLineUsageDiscount entity.func (_m *BillingInvoiceLineUsageDiscount) QueryBillingInvoiceLine() *BillingInvoiceLineQuery { return NewBillingInvoiceLineUsageDiscountClient(_m.config).QueryBillingInvoiceLine(_m)}
// Update returns a builder for updating this BillingInvoiceLineUsageDiscount.// Note that you need to call BillingInvoiceLineUsageDiscount.Unwrap() before calling this method if this BillingInvoiceLineUsageDiscount// was returned from a transaction, and the transaction was committed or rolled back.func (_m *BillingInvoiceLineUsageDiscount) Update() *BillingInvoiceLineUsageDiscountUpdateOne { return NewBillingInvoiceLineUsageDiscountClient(_m.config).UpdateOne(_m)}
// Unwrap unwraps the BillingInvoiceLineUsageDiscount 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 (_m *BillingInvoiceLineUsageDiscount) Unwrap() *BillingInvoiceLineUsageDiscount { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("db: BillingInvoiceLineUsageDiscount is not a transactional entity") } _m.config.driver = _tx.drv return _m}
// String implements the fmt.Stringer.func (_m *BillingInvoiceLineUsageDiscount) String() string { var builder strings.Builder builder.WriteString("BillingInvoiceLineUsageDiscount(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("namespace=") builder.WriteString(_m.Namespace) builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") if v := _m.DeletedAt; v != nil { builder.WriteString("deleted_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") if v := _m.InvoicingAppExternalID; v != nil { builder.WriteString("invoicing_app_external_id=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("line_id=") builder.WriteString(_m.LineID) builder.WriteString(", ") if v := _m.ChildUniqueReferenceID; v != nil { builder.WriteString("child_unique_reference_id=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.Description; v != nil { builder.WriteString("description=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("reason=") builder.WriteString(fmt.Sprintf("%v", _m.Reason)) builder.WriteString(", ") builder.WriteString("quantity=") builder.WriteString(fmt.Sprintf("%v", _m.Quantity)) builder.WriteString(", ") if v := _m.PreLinePeriodQuantity; v != nil { builder.WriteString("pre_line_period_quantity=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") if v := _m.ReasonDetails; v != nil { builder.WriteString("reason_details=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteByte(')') return builder.String()}
// BillingInvoiceLineUsageDiscounts is a parsable slice of BillingInvoiceLineUsageDiscount.type BillingInvoiceLineUsageDiscounts []*BillingInvoiceLineUsageDiscount123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191// Code generated by ent, DO NOT EDIT.
package billinginvoicelineusagediscount
import ( "fmt" "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/billing")
const ( // Label holds the string label denoting the billinginvoicelineusagediscount type in the database. Label = "billing_invoice_line_usage_discount" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldNamespace holds the string denoting the namespace field in the database. FieldNamespace = "namespace" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" // FieldDeletedAt holds the string denoting the deleted_at field in the database. FieldDeletedAt = "deleted_at" // FieldInvoicingAppExternalID holds the string denoting the invoicing_app_external_id field in the database. FieldInvoicingAppExternalID = "invoicing_app_external_id" // FieldLineID holds the string denoting the line_id field in the database. FieldLineID = "line_id" // FieldChildUniqueReferenceID holds the string denoting the child_unique_reference_id field in the database. FieldChildUniqueReferenceID = "child_unique_reference_id" // FieldDescription holds the string denoting the description field in the database. FieldDescription = "description" // FieldReason holds the string denoting the reason field in the database. FieldReason = "reason" // FieldQuantity holds the string denoting the quantity field in the database. FieldQuantity = "quantity" // FieldPreLinePeriodQuantity holds the string denoting the pre_line_period_quantity field in the database. FieldPreLinePeriodQuantity = "pre_line_period_quantity" // FieldReasonDetails holds the string denoting the reason_details field in the database. FieldReasonDetails = "reason_details" // EdgeBillingInvoiceLine holds the string denoting the billing_invoice_line edge name in mutations. EdgeBillingInvoiceLine = "billing_invoice_line" // Table holds the table name of the billinginvoicelineusagediscount in the database. Table = "billing_invoice_line_usage_discounts" // BillingInvoiceLineTable is the table that holds the billing_invoice_line relation/edge. BillingInvoiceLineTable = "billing_invoice_line_usage_discounts" // BillingInvoiceLineInverseTable is the table name for the BillingInvoiceLine entity. // It exists in this package in order to avoid circular dependency with the "billinginvoiceline" package. BillingInvoiceLineInverseTable = "billing_invoice_lines" // BillingInvoiceLineColumn is the table column denoting the billing_invoice_line relation/edge. BillingInvoiceLineColumn = "line_id")
// Columns holds all SQL columns for billinginvoicelineusagediscount fields.var Columns = []string{ FieldID, FieldNamespace, FieldCreatedAt, FieldUpdatedAt, FieldDeletedAt, FieldInvoicingAppExternalID, FieldLineID, FieldChildUniqueReferenceID, FieldDescription, FieldReason, FieldQuantity, FieldPreLinePeriodQuantity, FieldReasonDetails,}
// ValidColumn reports if the column name is valid (part of the table columns).func ValidColumn(column string) bool { for i := range Columns { if column == Columns[i] { return true } } return false}
var ( // NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. NamespaceValidator func(string) error // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. DefaultUpdatedAt func() time.Time // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. UpdateDefaultUpdatedAt func() time.Time // DefaultID holds the default value on creation for the "id" field. DefaultID func() string // ValueScanner of all BillingInvoiceLineUsageDiscount fields. ValueScanner struct { ReasonDetails field.TypeValueScanner[*billing.DiscountReason] })
// ReasonValidator is a validator for the "reason" field enum values. It is called by the builders before save.func ReasonValidator(r billing.DiscountReasonType) error { switch r { case "maximum_spend", "ratecard_percentage", "ratecard_usage": return nil default: return fmt.Errorf("billinginvoicelineusagediscount: invalid enum value for reason field: %q", r) }}
// OrderOption defines the ordering options for the BillingInvoiceLineUsageDiscount queries.type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc()}
// ByNamespace orders the results by the namespace field.func ByNamespace(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldNamespace, opts...).ToFunc()}
// ByCreatedAt orders the results by the created_at field.func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()}
// ByUpdatedAt orders the results by the updated_at field.func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()}
// ByDeletedAt orders the results by the deleted_at field.func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()}
// ByInvoicingAppExternalID orders the results by the invoicing_app_external_id field.func ByInvoicingAppExternalID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldInvoicingAppExternalID, opts...).ToFunc()}
// ByLineID orders the results by the line_id field.func ByLineID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLineID, opts...).ToFunc()}
// ByChildUniqueReferenceID orders the results by the child_unique_reference_id field.func ByChildUniqueReferenceID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldChildUniqueReferenceID, opts...).ToFunc()}
// ByDescription orders the results by the description field.func ByDescription(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDescription, opts...).ToFunc()}
// ByReason orders the results by the reason field.func ByReason(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldReason, opts...).ToFunc()}
// ByQuantity orders the results by the quantity field.func ByQuantity(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldQuantity, opts...).ToFunc()}
// ByPreLinePeriodQuantity orders the results by the pre_line_period_quantity field.func ByPreLinePeriodQuantity(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPreLinePeriodQuantity, opts...).ToFunc()}
// ByReasonDetails orders the results by the reason_details field.func ByReasonDetails(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldReasonDetails, opts...).ToFunc()}
// ByBillingInvoiceLineField orders the results by billing_invoice_line field.func ByBillingInvoiceLineField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceLineStep(), sql.OrderByField(field, opts...)) }}func newBillingInvoiceLineStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(BillingInvoiceLineInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, BillingInvoiceLineTable, BillingInvoiceLineColumn), )}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771// Code generated by ent, DO NOT EDIT.
package billinginvoicelineusagediscount
import ( "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// ID filters vertices based on their ID field.func ID(id string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldID, id))}
// IDEQ applies the EQ predicate on the ID field.func IDEQ(id string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldID, id))}
// IDNEQ applies the NEQ predicate on the ID field.func IDNEQ(id string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldID, id))}
// IDIn applies the In predicate on the ID field.func IDIn(ids ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldID, ids...))}
// IDNotIn applies the NotIn predicate on the ID field.func IDNotIn(ids ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldID, ids...))}
// IDGT applies the GT predicate on the ID field.func IDGT(id string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldID, id))}
// IDGTE applies the GTE predicate on the ID field.func IDGTE(id string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldID, id))}
// IDLT applies the LT predicate on the ID field.func IDLT(id string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldID, id))}
// IDLTE applies the LTE predicate on the ID field.func IDLTE(id string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldID, id))}
// IDEqualFold applies the EqualFold predicate on the ID field.func IDEqualFold(id string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEqualFold(FieldID, id))}
// IDContainsFold applies the ContainsFold predicate on the ID field.func IDContainsFold(id string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContainsFold(FieldID, id))}
// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ.func Namespace(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldNamespace, v))}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.func CreatedAt(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldCreatedAt, v))}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.func UpdatedAt(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldUpdatedAt, v))}
// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.func DeletedAt(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldDeletedAt, v))}
// InvoicingAppExternalID applies equality check predicate on the "invoicing_app_external_id" field. It's identical to InvoicingAppExternalIDEQ.func InvoicingAppExternalID(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldInvoicingAppExternalID, v))}
// LineID applies equality check predicate on the "line_id" field. It's identical to LineIDEQ.func LineID(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldLineID, v))}
// ChildUniqueReferenceID applies equality check predicate on the "child_unique_reference_id" field. It's identical to ChildUniqueReferenceIDEQ.func ChildUniqueReferenceID(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldChildUniqueReferenceID, v))}
// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ.func Description(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldDescription, v))}
// Quantity applies equality check predicate on the "quantity" field. It's identical to QuantityEQ.func Quantity(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldQuantity, v))}
// PreLinePeriodQuantity applies equality check predicate on the "pre_line_period_quantity" field. It's identical to PreLinePeriodQuantityEQ.func PreLinePeriodQuantity(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldPreLinePeriodQuantity, v))}
// NamespaceEQ applies the EQ predicate on the "namespace" field.func NamespaceEQ(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldNamespace, v))}
// NamespaceNEQ applies the NEQ predicate on the "namespace" field.func NamespaceNEQ(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldNamespace, v))}
// NamespaceIn applies the In predicate on the "namespace" field.func NamespaceIn(vs ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldNamespace, vs...))}
// NamespaceNotIn applies the NotIn predicate on the "namespace" field.func NamespaceNotIn(vs ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldNamespace, vs...))}
// NamespaceGT applies the GT predicate on the "namespace" field.func NamespaceGT(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldNamespace, v))}
// NamespaceGTE applies the GTE predicate on the "namespace" field.func NamespaceGTE(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldNamespace, v))}
// NamespaceLT applies the LT predicate on the "namespace" field.func NamespaceLT(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldNamespace, v))}
// NamespaceLTE applies the LTE predicate on the "namespace" field.func NamespaceLTE(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldNamespace, v))}
// NamespaceContains applies the Contains predicate on the "namespace" field.func NamespaceContains(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContains(FieldNamespace, v))}
// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field.func NamespaceHasPrefix(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldHasPrefix(FieldNamespace, v))}
// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field.func NamespaceHasSuffix(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldHasSuffix(FieldNamespace, v))}
// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field.func NamespaceEqualFold(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEqualFold(FieldNamespace, v))}
// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field.func NamespaceContainsFold(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContainsFold(FieldNamespace, v))}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.func CreatedAtEQ(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldCreatedAt, v))}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.func CreatedAtNEQ(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldCreatedAt, v))}
// CreatedAtIn applies the In predicate on the "created_at" field.func CreatedAtIn(vs ...time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldCreatedAt, vs...))}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.func CreatedAtNotIn(vs ...time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldCreatedAt, vs...))}
// CreatedAtGT applies the GT predicate on the "created_at" field.func CreatedAtGT(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldCreatedAt, v))}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.func CreatedAtGTE(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldCreatedAt, v))}
// CreatedAtLT applies the LT predicate on the "created_at" field.func CreatedAtLT(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldCreatedAt, v))}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.func CreatedAtLTE(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldCreatedAt, v))}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.func UpdatedAtEQ(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldUpdatedAt, v))}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.func UpdatedAtNEQ(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldUpdatedAt, v))}
// UpdatedAtIn applies the In predicate on the "updated_at" field.func UpdatedAtIn(vs ...time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldUpdatedAt, vs...))}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.func UpdatedAtNotIn(vs ...time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldUpdatedAt, vs...))}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.func UpdatedAtGT(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldUpdatedAt, v))}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.func UpdatedAtGTE(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldUpdatedAt, v))}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.func UpdatedAtLT(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldUpdatedAt, v))}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.func UpdatedAtLTE(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldUpdatedAt, v))}
// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.func DeletedAtEQ(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldDeletedAt, v))}
// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.func DeletedAtNEQ(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldDeletedAt, v))}
// DeletedAtIn applies the In predicate on the "deleted_at" field.func DeletedAtIn(vs ...time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldDeletedAt, vs...))}
// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.func DeletedAtNotIn(vs ...time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldDeletedAt, vs...))}
// DeletedAtGT applies the GT predicate on the "deleted_at" field.func DeletedAtGT(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldDeletedAt, v))}
// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.func DeletedAtGTE(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldDeletedAt, v))}
// DeletedAtLT applies the LT predicate on the "deleted_at" field.func DeletedAtLT(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldDeletedAt, v))}
// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.func DeletedAtLTE(v time.Time) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldDeletedAt, v))}
// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.func DeletedAtIsNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIsNull(FieldDeletedAt))}
// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.func DeletedAtNotNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotNull(FieldDeletedAt))}
// InvoicingAppExternalIDEQ applies the EQ predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDEQ(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldInvoicingAppExternalID, v))}
// InvoicingAppExternalIDNEQ applies the NEQ predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDNEQ(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldInvoicingAppExternalID, v))}
// InvoicingAppExternalIDIn applies the In predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDIn(vs ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldInvoicingAppExternalID, vs...))}
// InvoicingAppExternalIDNotIn applies the NotIn predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDNotIn(vs ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldInvoicingAppExternalID, vs...))}
// InvoicingAppExternalIDGT applies the GT predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDGT(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldInvoicingAppExternalID, v))}
// InvoicingAppExternalIDGTE applies the GTE predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDGTE(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldInvoicingAppExternalID, v))}
// InvoicingAppExternalIDLT applies the LT predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDLT(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldInvoicingAppExternalID, v))}
// InvoicingAppExternalIDLTE applies the LTE predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDLTE(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldInvoicingAppExternalID, v))}
// InvoicingAppExternalIDContains applies the Contains predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDContains(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContains(FieldInvoicingAppExternalID, v))}
// InvoicingAppExternalIDHasPrefix applies the HasPrefix predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDHasPrefix(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldHasPrefix(FieldInvoicingAppExternalID, v))}
// InvoicingAppExternalIDHasSuffix applies the HasSuffix predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDHasSuffix(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldHasSuffix(FieldInvoicingAppExternalID, v))}
// InvoicingAppExternalIDIsNil applies the IsNil predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDIsNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIsNull(FieldInvoicingAppExternalID))}
// InvoicingAppExternalIDNotNil applies the NotNil predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDNotNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotNull(FieldInvoicingAppExternalID))}
// InvoicingAppExternalIDEqualFold applies the EqualFold predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDEqualFold(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEqualFold(FieldInvoicingAppExternalID, v))}
// InvoicingAppExternalIDContainsFold applies the ContainsFold predicate on the "invoicing_app_external_id" field.func InvoicingAppExternalIDContainsFold(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContainsFold(FieldInvoicingAppExternalID, v))}
// LineIDEQ applies the EQ predicate on the "line_id" field.func LineIDEQ(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldLineID, v))}
// LineIDNEQ applies the NEQ predicate on the "line_id" field.func LineIDNEQ(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldLineID, v))}
// LineIDIn applies the In predicate on the "line_id" field.func LineIDIn(vs ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldLineID, vs...))}
// LineIDNotIn applies the NotIn predicate on the "line_id" field.func LineIDNotIn(vs ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldLineID, vs...))}
// LineIDGT applies the GT predicate on the "line_id" field.func LineIDGT(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldLineID, v))}
// LineIDGTE applies the GTE predicate on the "line_id" field.func LineIDGTE(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldLineID, v))}
// LineIDLT applies the LT predicate on the "line_id" field.func LineIDLT(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldLineID, v))}
// LineIDLTE applies the LTE predicate on the "line_id" field.func LineIDLTE(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldLineID, v))}
// LineIDContains applies the Contains predicate on the "line_id" field.func LineIDContains(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContains(FieldLineID, v))}
// LineIDHasPrefix applies the HasPrefix predicate on the "line_id" field.func LineIDHasPrefix(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldHasPrefix(FieldLineID, v))}
// LineIDHasSuffix applies the HasSuffix predicate on the "line_id" field.func LineIDHasSuffix(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldHasSuffix(FieldLineID, v))}
// LineIDEqualFold applies the EqualFold predicate on the "line_id" field.func LineIDEqualFold(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEqualFold(FieldLineID, v))}
// LineIDContainsFold applies the ContainsFold predicate on the "line_id" field.func LineIDContainsFold(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContainsFold(FieldLineID, v))}
// ChildUniqueReferenceIDEQ applies the EQ predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDEQ(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldChildUniqueReferenceID, v))}
// ChildUniqueReferenceIDNEQ applies the NEQ predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDNEQ(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldChildUniqueReferenceID, v))}
// ChildUniqueReferenceIDIn applies the In predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDIn(vs ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldChildUniqueReferenceID, vs...))}
// ChildUniqueReferenceIDNotIn applies the NotIn predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDNotIn(vs ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldChildUniqueReferenceID, vs...))}
// ChildUniqueReferenceIDGT applies the GT predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDGT(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldChildUniqueReferenceID, v))}
// ChildUniqueReferenceIDGTE applies the GTE predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDGTE(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldChildUniqueReferenceID, v))}
// ChildUniqueReferenceIDLT applies the LT predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDLT(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldChildUniqueReferenceID, v))}
// ChildUniqueReferenceIDLTE applies the LTE predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDLTE(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldChildUniqueReferenceID, v))}
// ChildUniqueReferenceIDContains applies the Contains predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDContains(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContains(FieldChildUniqueReferenceID, v))}
// ChildUniqueReferenceIDHasPrefix applies the HasPrefix predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDHasPrefix(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldHasPrefix(FieldChildUniqueReferenceID, v))}
// ChildUniqueReferenceIDHasSuffix applies the HasSuffix predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDHasSuffix(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldHasSuffix(FieldChildUniqueReferenceID, v))}
// ChildUniqueReferenceIDIsNil applies the IsNil predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDIsNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIsNull(FieldChildUniqueReferenceID))}
// ChildUniqueReferenceIDNotNil applies the NotNil predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDNotNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotNull(FieldChildUniqueReferenceID))}
// ChildUniqueReferenceIDEqualFold applies the EqualFold predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDEqualFold(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEqualFold(FieldChildUniqueReferenceID, v))}
// ChildUniqueReferenceIDContainsFold applies the ContainsFold predicate on the "child_unique_reference_id" field.func ChildUniqueReferenceIDContainsFold(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContainsFold(FieldChildUniqueReferenceID, v))}
// DescriptionEQ applies the EQ predicate on the "description" field.func DescriptionEQ(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldDescription, v))}
// DescriptionNEQ applies the NEQ predicate on the "description" field.func DescriptionNEQ(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldDescription, v))}
// DescriptionIn applies the In predicate on the "description" field.func DescriptionIn(vs ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldDescription, vs...))}
// DescriptionNotIn applies the NotIn predicate on the "description" field.func DescriptionNotIn(vs ...string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldDescription, vs...))}
// DescriptionGT applies the GT predicate on the "description" field.func DescriptionGT(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldDescription, v))}
// DescriptionGTE applies the GTE predicate on the "description" field.func DescriptionGTE(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldDescription, v))}
// DescriptionLT applies the LT predicate on the "description" field.func DescriptionLT(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldDescription, v))}
// DescriptionLTE applies the LTE predicate on the "description" field.func DescriptionLTE(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldDescription, v))}
// DescriptionContains applies the Contains predicate on the "description" field.func DescriptionContains(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContains(FieldDescription, v))}
// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field.func DescriptionHasPrefix(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldHasPrefix(FieldDescription, v))}
// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field.func DescriptionHasSuffix(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldHasSuffix(FieldDescription, v))}
// DescriptionIsNil applies the IsNil predicate on the "description" field.func DescriptionIsNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIsNull(FieldDescription))}
// DescriptionNotNil applies the NotNil predicate on the "description" field.func DescriptionNotNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotNull(FieldDescription))}
// DescriptionEqualFold applies the EqualFold predicate on the "description" field.func DescriptionEqualFold(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEqualFold(FieldDescription, v))}
// DescriptionContainsFold applies the ContainsFold predicate on the "description" field.func DescriptionContainsFold(v string) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldContainsFold(FieldDescription, v))}
// ReasonEQ applies the EQ predicate on the "reason" field.func ReasonEQ(v billing.DiscountReasonType) predicate.BillingInvoiceLineUsageDiscount { vc := v return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldReason, vc))}
// ReasonNEQ applies the NEQ predicate on the "reason" field.func ReasonNEQ(v billing.DiscountReasonType) predicate.BillingInvoiceLineUsageDiscount { vc := v return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldReason, vc))}
// ReasonIn applies the In predicate on the "reason" field.func ReasonIn(vs ...billing.DiscountReasonType) predicate.BillingInvoiceLineUsageDiscount { v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldReason, v...))}
// ReasonNotIn applies the NotIn predicate on the "reason" field.func ReasonNotIn(vs ...billing.DiscountReasonType) predicate.BillingInvoiceLineUsageDiscount { v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldReason, v...))}
// QuantityEQ applies the EQ predicate on the "quantity" field.func QuantityEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldQuantity, v))}
// QuantityNEQ applies the NEQ predicate on the "quantity" field.func QuantityNEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldQuantity, v))}
// QuantityIn applies the In predicate on the "quantity" field.func QuantityIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldQuantity, vs...))}
// QuantityNotIn applies the NotIn predicate on the "quantity" field.func QuantityNotIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldQuantity, vs...))}
// QuantityGT applies the GT predicate on the "quantity" field.func QuantityGT(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldQuantity, v))}
// QuantityGTE applies the GTE predicate on the "quantity" field.func QuantityGTE(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldQuantity, v))}
// QuantityLT applies the LT predicate on the "quantity" field.func QuantityLT(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldQuantity, v))}
// QuantityLTE applies the LTE predicate on the "quantity" field.func QuantityLTE(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldQuantity, v))}
// PreLinePeriodQuantityEQ applies the EQ predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldEQ(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityNEQ applies the NEQ predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityNEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNEQ(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityIn applies the In predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIn(FieldPreLinePeriodQuantity, vs...))}
// PreLinePeriodQuantityNotIn applies the NotIn predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityNotIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotIn(FieldPreLinePeriodQuantity, vs...))}
// PreLinePeriodQuantityGT applies the GT predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityGT(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGT(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityGTE applies the GTE predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityGTE(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldGTE(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityLT applies the LT predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityLT(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLT(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityLTE applies the LTE predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityLTE(v alpacadecimal.Decimal) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldLTE(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityIsNil applies the IsNil predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityIsNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIsNull(FieldPreLinePeriodQuantity))}
// PreLinePeriodQuantityNotNil applies the NotNil predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityNotNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotNull(FieldPreLinePeriodQuantity))}
// ReasonDetailsIsNil applies the IsNil predicate on the "reason_details" field.func ReasonDetailsIsNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldIsNull(FieldReasonDetails))}
// ReasonDetailsNotNil applies the NotNil predicate on the "reason_details" field.func ReasonDetailsNotNil() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.FieldNotNull(FieldReasonDetails))}
// HasBillingInvoiceLine applies the HasEdge predicate on the "billing_invoice_line" edge.func HasBillingInvoiceLine() predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, BillingInvoiceLineTable, BillingInvoiceLineColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasBillingInvoiceLineWith applies the HasEdge predicate on the "billing_invoice_line" edge with a given conditions (other predicates).func HasBillingInvoiceLineWith(preds ...predicate.BillingInvoiceLine) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(func(s *sql.Selector) { step := newBillingInvoiceLineStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// And groups predicates with the AND operator between them.func And(predicates ...predicate.BillingInvoiceLineUsageDiscount) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.AndPredicates(predicates...))}
// Or groups predicates with the OR operator between them.func Or(predicates ...predicate.BillingInvoiceLineUsageDiscount) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.OrPredicates(predicates...))}
// Not applies the not operator on the given predicate.func Not(p predicate.BillingInvoiceLineUsageDiscount) predicate.BillingInvoiceLineUsageDiscount { return predicate.BillingInvoiceLineUsageDiscount(sql.NotPredicates(p))}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt" "time"
"entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicelineusagediscount")
// BillingInvoiceLineUsageDiscountCreate is the builder for creating a BillingInvoiceLineUsageDiscount entity.type BillingInvoiceLineUsageDiscountCreate struct { config mutation *BillingInvoiceLineUsageDiscountMutation hooks []Hook conflict []sql.ConflictOption}
// SetNamespace sets the "namespace" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetNamespace(v string) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetNamespace(v) return _c}
// SetCreatedAt sets the "created_at" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetCreatedAt(v time.Time) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetCreatedAt(v) return _c}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.func (_c *BillingInvoiceLineUsageDiscountCreate) SetNillableCreatedAt(v *time.Time) *BillingInvoiceLineUsageDiscountCreate { if v != nil { _c.SetCreatedAt(*v) } return _c}
// SetUpdatedAt sets the "updated_at" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetUpdatedAt(v time.Time) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetUpdatedAt(v) return _c}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.func (_c *BillingInvoiceLineUsageDiscountCreate) SetNillableUpdatedAt(v *time.Time) *BillingInvoiceLineUsageDiscountCreate { if v != nil { _c.SetUpdatedAt(*v) } return _c}
// SetDeletedAt sets the "deleted_at" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetDeletedAt(v time.Time) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetDeletedAt(v) return _c}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_c *BillingInvoiceLineUsageDiscountCreate) SetNillableDeletedAt(v *time.Time) *BillingInvoiceLineUsageDiscountCreate { if v != nil { _c.SetDeletedAt(*v) } return _c}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetInvoicingAppExternalID(v string) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetInvoicingAppExternalID(v) return _c}
// SetNillableInvoicingAppExternalID sets the "invoicing_app_external_id" field if the given value is not nil.func (_c *BillingInvoiceLineUsageDiscountCreate) SetNillableInvoicingAppExternalID(v *string) *BillingInvoiceLineUsageDiscountCreate { if v != nil { _c.SetInvoicingAppExternalID(*v) } return _c}
// SetLineID sets the "line_id" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetLineID(v string) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetLineID(v) return _c}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetChildUniqueReferenceID(v string) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetChildUniqueReferenceID(v) return _c}
// SetNillableChildUniqueReferenceID sets the "child_unique_reference_id" field if the given value is not nil.func (_c *BillingInvoiceLineUsageDiscountCreate) SetNillableChildUniqueReferenceID(v *string) *BillingInvoiceLineUsageDiscountCreate { if v != nil { _c.SetChildUniqueReferenceID(*v) } return _c}
// SetDescription sets the "description" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetDescription(v string) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetDescription(v) return _c}
// SetNillableDescription sets the "description" field if the given value is not nil.func (_c *BillingInvoiceLineUsageDiscountCreate) SetNillableDescription(v *string) *BillingInvoiceLineUsageDiscountCreate { if v != nil { _c.SetDescription(*v) } return _c}
// SetReason sets the "reason" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetReason(v) return _c}
// SetQuantity sets the "quantity" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetQuantity(v) return _c}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetPreLinePeriodQuantity(v) return _c}
// SetNillablePreLinePeriodQuantity sets the "pre_line_period_quantity" field if the given value is not nil.func (_c *BillingInvoiceLineUsageDiscountCreate) SetNillablePreLinePeriodQuantity(v *alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountCreate { if v != nil { _c.SetPreLinePeriodQuantity(*v) } return _c}
// SetReasonDetails sets the "reason_details" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetReasonDetails(v *billing.DiscountReason) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetReasonDetails(v) return _c}
// SetID sets the "id" field.func (_c *BillingInvoiceLineUsageDiscountCreate) SetID(v string) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetID(v) return _c}
// SetNillableID sets the "id" field if the given value is not nil.func (_c *BillingInvoiceLineUsageDiscountCreate) SetNillableID(v *string) *BillingInvoiceLineUsageDiscountCreate { if v != nil { _c.SetID(*v) } return _c}
// SetBillingInvoiceLineID sets the "billing_invoice_line" edge to the BillingInvoiceLine entity by ID.func (_c *BillingInvoiceLineUsageDiscountCreate) SetBillingInvoiceLineID(id string) *BillingInvoiceLineUsageDiscountCreate { _c.mutation.SetBillingInvoiceLineID(id) return _c}
// SetBillingInvoiceLine sets the "billing_invoice_line" edge to the BillingInvoiceLine entity.func (_c *BillingInvoiceLineUsageDiscountCreate) SetBillingInvoiceLine(v *BillingInvoiceLine) *BillingInvoiceLineUsageDiscountCreate { return _c.SetBillingInvoiceLineID(v.ID)}
// Mutation returns the BillingInvoiceLineUsageDiscountMutation object of the builder.func (_c *BillingInvoiceLineUsageDiscountCreate) Mutation() *BillingInvoiceLineUsageDiscountMutation { return _c.mutation}
// Save creates the BillingInvoiceLineUsageDiscount in the database.func (_c *BillingInvoiceLineUsageDiscountCreate) Save(ctx context.Context) (*BillingInvoiceLineUsageDiscount, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)}
// SaveX calls Save and panics if Save returns an error.func (_c *BillingInvoiceLineUsageDiscountCreate) SaveX(ctx context.Context) *BillingInvoiceLineUsageDiscount { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceLineUsageDiscountCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceLineUsageDiscountCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_c *BillingInvoiceLineUsageDiscountCreate) defaults() { if _, ok := _c.mutation.CreatedAt(); !ok { v := billinginvoicelineusagediscount.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } if _, ok := _c.mutation.UpdatedAt(); !ok { v := billinginvoicelineusagediscount.DefaultUpdatedAt() _c.mutation.SetUpdatedAt(v) } if _, ok := _c.mutation.ID(); !ok { v := billinginvoicelineusagediscount.DefaultID() _c.mutation.SetID(v) }}
// check runs all checks and user-defined validators on the builder.func (_c *BillingInvoiceLineUsageDiscountCreate) check() error { if _, ok := _c.mutation.Namespace(); !ok { return &ValidationError{Name: "namespace", err: errors.New(`db: missing required field "BillingInvoiceLineUsageDiscount.namespace"`)} } if v, ok := _c.mutation.Namespace(); ok { if err := billinginvoicelineusagediscount.NamespaceValidator(v); err != nil { return &ValidationError{Name: "namespace", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineUsageDiscount.namespace": %w`, err)} } } if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "BillingInvoiceLineUsageDiscount.created_at"`)} } if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`db: missing required field "BillingInvoiceLineUsageDiscount.updated_at"`)} } if _, ok := _c.mutation.LineID(); !ok { return &ValidationError{Name: "line_id", err: errors.New(`db: missing required field "BillingInvoiceLineUsageDiscount.line_id"`)} } if _, ok := _c.mutation.Reason(); !ok { return &ValidationError{Name: "reason", err: errors.New(`db: missing required field "BillingInvoiceLineUsageDiscount.reason"`)} } if v, ok := _c.mutation.Reason(); ok { if err := billinginvoicelineusagediscount.ReasonValidator(v); err != nil { return &ValidationError{Name: "reason", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineUsageDiscount.reason": %w`, err)} } } if _, ok := _c.mutation.Quantity(); !ok { return &ValidationError{Name: "quantity", err: errors.New(`db: missing required field "BillingInvoiceLineUsageDiscount.quantity"`)} } if v, ok := _c.mutation.ReasonDetails(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "reason_details", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineUsageDiscount.reason_details": %w`, err)} } } if len(_c.mutation.BillingInvoiceLineIDs()) == 0 { return &ValidationError{Name: "billing_invoice_line", err: errors.New(`db: missing required edge "BillingInvoiceLineUsageDiscount.billing_invoice_line"`)} } return nil}
func (_c *BillingInvoiceLineUsageDiscountCreate) sqlSave(ctx context.Context) (*BillingInvoiceLineUsageDiscount, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec, err := _c.createSpec() if err != nil { return nil, err } if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(string); ok { _node.ID = id } else { return nil, fmt.Errorf("unexpected BillingInvoiceLineUsageDiscount.ID type: %T", _spec.ID.Value) } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil}
func (_c *BillingInvoiceLineUsageDiscountCreate) createSpec() (*BillingInvoiceLineUsageDiscount, *sqlgraph.CreateSpec, error) { var ( _node = &BillingInvoiceLineUsageDiscount{config: _c.config} _spec = sqlgraph.NewCreateSpec(billinginvoicelineusagediscount.Table, sqlgraph.NewFieldSpec(billinginvoicelineusagediscount.FieldID, field.TypeString)) ) _spec.OnConflict = _c.conflict if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = id } if value, ok := _c.mutation.Namespace(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldNamespace, field.TypeString, value) _node.Namespace = value } if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } if value, ok := _c.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldDeletedAt, field.TypeTime, value) _node.DeletedAt = &value } if value, ok := _c.mutation.InvoicingAppExternalID(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldInvoicingAppExternalID, field.TypeString, value) _node.InvoicingAppExternalID = &value } if value, ok := _c.mutation.ChildUniqueReferenceID(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldChildUniqueReferenceID, field.TypeString, value) _node.ChildUniqueReferenceID = &value } if value, ok := _c.mutation.Description(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldDescription, field.TypeString, value) _node.Description = &value } if value, ok := _c.mutation.Reason(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldReason, field.TypeEnum, value) _node.Reason = value } if value, ok := _c.mutation.Quantity(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldQuantity, field.TypeOther, value) _node.Quantity = value } if value, ok := _c.mutation.PreLinePeriodQuantity(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldPreLinePeriodQuantity, field.TypeOther, value) _node.PreLinePeriodQuantity = &value } if value, ok := _c.mutation.ReasonDetails(); ok { vv, err := billinginvoicelineusagediscount.ValueScanner.ReasonDetails.Value(value) if err != nil { return nil, nil, err } _spec.SetField(billinginvoicelineusagediscount.FieldReasonDetails, field.TypeString, vv) _node.ReasonDetails = value } if nodes := _c.mutation.BillingInvoiceLineIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicelineusagediscount.BillingInvoiceLineTable, Columns: []string{billinginvoicelineusagediscount.BillingInvoiceLineColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.LineID = nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec, nil}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceLineUsageDiscount.Create().// SetNamespace(v).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceLineUsageDiscountUpsert) {// SetNamespace(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceLineUsageDiscountCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceLineUsageDiscountUpsertOne { _c.conflict = opts return &BillingInvoiceLineUsageDiscountUpsertOne{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceLineUsageDiscount.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceLineUsageDiscountCreate) OnConflictColumns(columns ...string) *BillingInvoiceLineUsageDiscountUpsertOne { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceLineUsageDiscountUpsertOne{ create: _c, }}
type ( // BillingInvoiceLineUsageDiscountUpsertOne is the builder for "upsert"-ing // one BillingInvoiceLineUsageDiscount node. BillingInvoiceLineUsageDiscountUpsertOne struct { create *BillingInvoiceLineUsageDiscountCreate }
// BillingInvoiceLineUsageDiscountUpsert is the "OnConflict" setter. BillingInvoiceLineUsageDiscountUpsert struct { *sql.UpdateSet })
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceLineUsageDiscountUpsert) SetUpdatedAt(v time.Time) *BillingInvoiceLineUsageDiscountUpsert { u.Set(billinginvoicelineusagediscount.FieldUpdatedAt, v) return u}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsert) UpdateUpdatedAt() *BillingInvoiceLineUsageDiscountUpsert { u.SetExcluded(billinginvoicelineusagediscount.FieldUpdatedAt) return u}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceLineUsageDiscountUpsert) SetDeletedAt(v time.Time) *BillingInvoiceLineUsageDiscountUpsert { u.Set(billinginvoicelineusagediscount.FieldDeletedAt, v) return u}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsert) UpdateDeletedAt() *BillingInvoiceLineUsageDiscountUpsert { u.SetExcluded(billinginvoicelineusagediscount.FieldDeletedAt) return u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceLineUsageDiscountUpsert) ClearDeletedAt() *BillingInvoiceLineUsageDiscountUpsert { u.SetNull(billinginvoicelineusagediscount.FieldDeletedAt) return u}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (u *BillingInvoiceLineUsageDiscountUpsert) SetInvoicingAppExternalID(v string) *BillingInvoiceLineUsageDiscountUpsert { u.Set(billinginvoicelineusagediscount.FieldInvoicingAppExternalID, v) return u}
// UpdateInvoicingAppExternalID sets the "invoicing_app_external_id" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsert) UpdateInvoicingAppExternalID() *BillingInvoiceLineUsageDiscountUpsert { u.SetExcluded(billinginvoicelineusagediscount.FieldInvoicingAppExternalID) return u}
// ClearInvoicingAppExternalID clears the value of the "invoicing_app_external_id" field.func (u *BillingInvoiceLineUsageDiscountUpsert) ClearInvoicingAppExternalID() *BillingInvoiceLineUsageDiscountUpsert { u.SetNull(billinginvoicelineusagediscount.FieldInvoicingAppExternalID) return u}
// SetLineID sets the "line_id" field.func (u *BillingInvoiceLineUsageDiscountUpsert) SetLineID(v string) *BillingInvoiceLineUsageDiscountUpsert { u.Set(billinginvoicelineusagediscount.FieldLineID, v) return u}
// UpdateLineID sets the "line_id" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsert) UpdateLineID() *BillingInvoiceLineUsageDiscountUpsert { u.SetExcluded(billinginvoicelineusagediscount.FieldLineID) return u}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (u *BillingInvoiceLineUsageDiscountUpsert) SetChildUniqueReferenceID(v string) *BillingInvoiceLineUsageDiscountUpsert { u.Set(billinginvoicelineusagediscount.FieldChildUniqueReferenceID, v) return u}
// UpdateChildUniqueReferenceID sets the "child_unique_reference_id" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsert) UpdateChildUniqueReferenceID() *BillingInvoiceLineUsageDiscountUpsert { u.SetExcluded(billinginvoicelineusagediscount.FieldChildUniqueReferenceID) return u}
// ClearChildUniqueReferenceID clears the value of the "child_unique_reference_id" field.func (u *BillingInvoiceLineUsageDiscountUpsert) ClearChildUniqueReferenceID() *BillingInvoiceLineUsageDiscountUpsert { u.SetNull(billinginvoicelineusagediscount.FieldChildUniqueReferenceID) return u}
// SetDescription sets the "description" field.func (u *BillingInvoiceLineUsageDiscountUpsert) SetDescription(v string) *BillingInvoiceLineUsageDiscountUpsert { u.Set(billinginvoicelineusagediscount.FieldDescription, v) return u}
// UpdateDescription sets the "description" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsert) UpdateDescription() *BillingInvoiceLineUsageDiscountUpsert { u.SetExcluded(billinginvoicelineusagediscount.FieldDescription) return u}
// ClearDescription clears the value of the "description" field.func (u *BillingInvoiceLineUsageDiscountUpsert) ClearDescription() *BillingInvoiceLineUsageDiscountUpsert { u.SetNull(billinginvoicelineusagediscount.FieldDescription) return u}
// SetReason sets the "reason" field.func (u *BillingInvoiceLineUsageDiscountUpsert) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineUsageDiscountUpsert { u.Set(billinginvoicelineusagediscount.FieldReason, v) return u}
// UpdateReason sets the "reason" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsert) UpdateReason() *BillingInvoiceLineUsageDiscountUpsert { u.SetExcluded(billinginvoicelineusagediscount.FieldReason) return u}
// SetQuantity sets the "quantity" field.func (u *BillingInvoiceLineUsageDiscountUpsert) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpsert { u.Set(billinginvoicelineusagediscount.FieldQuantity, v) return u}
// UpdateQuantity sets the "quantity" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsert) UpdateQuantity() *BillingInvoiceLineUsageDiscountUpsert { u.SetExcluded(billinginvoicelineusagediscount.FieldQuantity) return u}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (u *BillingInvoiceLineUsageDiscountUpsert) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpsert { u.Set(billinginvoicelineusagediscount.FieldPreLinePeriodQuantity, v) return u}
// UpdatePreLinePeriodQuantity sets the "pre_line_period_quantity" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsert) UpdatePreLinePeriodQuantity() *BillingInvoiceLineUsageDiscountUpsert { u.SetExcluded(billinginvoicelineusagediscount.FieldPreLinePeriodQuantity) return u}
// ClearPreLinePeriodQuantity clears the value of the "pre_line_period_quantity" field.func (u *BillingInvoiceLineUsageDiscountUpsert) ClearPreLinePeriodQuantity() *BillingInvoiceLineUsageDiscountUpsert { u.SetNull(billinginvoicelineusagediscount.FieldPreLinePeriodQuantity) return u}
// SetReasonDetails sets the "reason_details" field.func (u *BillingInvoiceLineUsageDiscountUpsert) SetReasonDetails(v *billing.DiscountReason) *BillingInvoiceLineUsageDiscountUpsert { u.Set(billinginvoicelineusagediscount.FieldReasonDetails, v) return u}
// UpdateReasonDetails sets the "reason_details" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsert) UpdateReasonDetails() *BillingInvoiceLineUsageDiscountUpsert { u.SetExcluded(billinginvoicelineusagediscount.FieldReasonDetails) return u}
// ClearReasonDetails clears the value of the "reason_details" field.func (u *BillingInvoiceLineUsageDiscountUpsert) ClearReasonDetails() *BillingInvoiceLineUsageDiscountUpsert { u.SetNull(billinginvoicelineusagediscount.FieldReasonDetails) return u}
// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.// Using this option is equivalent to using://// client.BillingInvoiceLineUsageDiscount.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoicelineusagediscount.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdateNewValues() *BillingInvoiceLineUsageDiscountUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { if _, exists := u.create.mutation.ID(); exists { s.SetIgnore(billinginvoicelineusagediscount.FieldID) } if _, exists := u.create.mutation.Namespace(); exists { s.SetIgnore(billinginvoicelineusagediscount.FieldNamespace) } if _, exists := u.create.mutation.CreatedAt(); exists { s.SetIgnore(billinginvoicelineusagediscount.FieldCreatedAt) } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceLineUsageDiscount.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceLineUsageDiscountUpsertOne) Ignore() *BillingInvoiceLineUsageDiscountUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceLineUsageDiscountUpsertOne) DoNothing() *BillingInvoiceLineUsageDiscountUpsertOne { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceLineUsageDiscountCreate.OnConflict// documentation for more info.func (u *BillingInvoiceLineUsageDiscountUpsertOne) Update(set func(*BillingInvoiceLineUsageDiscountUpsert)) *BillingInvoiceLineUsageDiscountUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceLineUsageDiscountUpsert{UpdateSet: update}) })) return u}
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) SetUpdatedAt(v time.Time) *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetUpdatedAt(v) })}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdateUpdatedAt() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateUpdatedAt() })}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) SetDeletedAt(v time.Time) *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetDeletedAt(v) })}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdateDeletedAt() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateDeletedAt() })}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) ClearDeletedAt() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearDeletedAt() })}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) SetInvoicingAppExternalID(v string) *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetInvoicingAppExternalID(v) })}
// UpdateInvoicingAppExternalID sets the "invoicing_app_external_id" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdateInvoicingAppExternalID() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateInvoicingAppExternalID() })}
// ClearInvoicingAppExternalID clears the value of the "invoicing_app_external_id" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) ClearInvoicingAppExternalID() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearInvoicingAppExternalID() })}
// SetLineID sets the "line_id" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) SetLineID(v string) *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetLineID(v) })}
// UpdateLineID sets the "line_id" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdateLineID() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateLineID() })}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) SetChildUniqueReferenceID(v string) *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetChildUniqueReferenceID(v) })}
// UpdateChildUniqueReferenceID sets the "child_unique_reference_id" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdateChildUniqueReferenceID() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateChildUniqueReferenceID() })}
// ClearChildUniqueReferenceID clears the value of the "child_unique_reference_id" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) ClearChildUniqueReferenceID() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearChildUniqueReferenceID() })}
// SetDescription sets the "description" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) SetDescription(v string) *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetDescription(v) })}
// UpdateDescription sets the "description" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdateDescription() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateDescription() })}
// ClearDescription clears the value of the "description" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) ClearDescription() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearDescription() })}
// SetReason sets the "reason" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetReason(v) })}
// UpdateReason sets the "reason" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdateReason() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateReason() })}
// SetQuantity sets the "quantity" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetQuantity(v) })}
// UpdateQuantity sets the "quantity" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdateQuantity() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateQuantity() })}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetPreLinePeriodQuantity(v) })}
// UpdatePreLinePeriodQuantity sets the "pre_line_period_quantity" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdatePreLinePeriodQuantity() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdatePreLinePeriodQuantity() })}
// ClearPreLinePeriodQuantity clears the value of the "pre_line_period_quantity" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) ClearPreLinePeriodQuantity() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearPreLinePeriodQuantity() })}
// SetReasonDetails sets the "reason_details" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) SetReasonDetails(v *billing.DiscountReason) *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetReasonDetails(v) })}
// UpdateReasonDetails sets the "reason_details" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertOne) UpdateReasonDetails() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateReasonDetails() })}
// ClearReasonDetails clears the value of the "reason_details" field.func (u *BillingInvoiceLineUsageDiscountUpsertOne) ClearReasonDetails() *BillingInvoiceLineUsageDiscountUpsertOne { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearReasonDetails() })}
// Exec executes the query.func (u *BillingInvoiceLineUsageDiscountUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceLineUsageDiscountCreate.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceLineUsageDiscountUpsertOne) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}
// Exec executes the UPSERT query and returns the inserted/updated ID.func (u *BillingInvoiceLineUsageDiscountUpsertOne) ID(ctx context.Context) (id string, err error) { if u.create.driver.Dialect() == dialect.MySQL { // In case of "ON CONFLICT", there is no way to get back non-numeric ID // fields from the database since MySQL does not support the RETURNING clause. return id, errors.New("db: BillingInvoiceLineUsageDiscountUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceLineUsageDiscountUpsertOne.Exec instead") } node, err := u.create.Save(ctx) if err != nil { return id, err } return node.ID, nil}
// IDX is like ID, but panics if an error occurs.func (u *BillingInvoiceLineUsageDiscountUpsertOne) IDX(ctx context.Context) string { id, err := u.ID(ctx) if err != nil { panic(err) } return id}
// BillingInvoiceLineUsageDiscountCreateBulk is the builder for creating many BillingInvoiceLineUsageDiscount entities in bulk.type BillingInvoiceLineUsageDiscountCreateBulk struct { config err error builders []*BillingInvoiceLineUsageDiscountCreate conflict []sql.ConflictOption}
// Save creates the BillingInvoiceLineUsageDiscount entities in the database.func (_c *BillingInvoiceLineUsageDiscountCreateBulk) Save(ctx context.Context) ([]*BillingInvoiceLineUsageDiscount, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*BillingInvoiceLineUsageDiscount, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*BillingInvoiceLineUsageDiscountMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i], err = builder.createSpec() if err != nil { return nil, err } if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } } } if err != nil { return nil, err } mutation.id = &nodes[i].ID mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { mut = builder.hooks[i](mut) } mutators[i] = mut }(i, ctx) } if len(mutators) > 0 { if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil}
// SaveX is like Save, but panics if an error occurs.func (_c *BillingInvoiceLineUsageDiscountCreateBulk) SaveX(ctx context.Context) []*BillingInvoiceLineUsageDiscount { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceLineUsageDiscountCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceLineUsageDiscountCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceLineUsageDiscount.CreateBulk(builders...).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceLineUsageDiscountUpsert) {// SetNamespace(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceLineUsageDiscountCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceLineUsageDiscountUpsertBulk { _c.conflict = opts return &BillingInvoiceLineUsageDiscountUpsertBulk{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceLineUsageDiscount.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceLineUsageDiscountCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceLineUsageDiscountUpsertBulk { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceLineUsageDiscountUpsertBulk{ create: _c, }}
// BillingInvoiceLineUsageDiscountUpsertBulk is the builder for "upsert"-ing// a bulk of BillingInvoiceLineUsageDiscount nodes.type BillingInvoiceLineUsageDiscountUpsertBulk struct { create *BillingInvoiceLineUsageDiscountCreateBulk}
// UpdateNewValues updates the mutable fields using the new values that// were set on create. Using this option is equivalent to using://// client.BillingInvoiceLineUsageDiscount.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoicelineusagediscount.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdateNewValues() *BillingInvoiceLineUsageDiscountUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { for _, b := range u.create.builders { if _, exists := b.mutation.ID(); exists { s.SetIgnore(billinginvoicelineusagediscount.FieldID) } if _, exists := b.mutation.Namespace(); exists { s.SetIgnore(billinginvoicelineusagediscount.FieldNamespace) } if _, exists := b.mutation.CreatedAt(); exists { s.SetIgnore(billinginvoicelineusagediscount.FieldCreatedAt) } } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceLineUsageDiscount.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceLineUsageDiscountUpsertBulk) Ignore() *BillingInvoiceLineUsageDiscountUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) DoNothing() *BillingInvoiceLineUsageDiscountUpsertBulk { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceLineUsageDiscountCreateBulk.OnConflict// documentation for more info.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) Update(set func(*BillingInvoiceLineUsageDiscountUpsert)) *BillingInvoiceLineUsageDiscountUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceLineUsageDiscountUpsert{UpdateSet: update}) })) return u}
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) SetUpdatedAt(v time.Time) *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetUpdatedAt(v) })}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdateUpdatedAt() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateUpdatedAt() })}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) SetDeletedAt(v time.Time) *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetDeletedAt(v) })}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdateDeletedAt() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateDeletedAt() })}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) ClearDeletedAt() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearDeletedAt() })}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) SetInvoicingAppExternalID(v string) *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetInvoicingAppExternalID(v) })}
// UpdateInvoicingAppExternalID sets the "invoicing_app_external_id" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdateInvoicingAppExternalID() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateInvoicingAppExternalID() })}
// ClearInvoicingAppExternalID clears the value of the "invoicing_app_external_id" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) ClearInvoicingAppExternalID() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearInvoicingAppExternalID() })}
// SetLineID sets the "line_id" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) SetLineID(v string) *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetLineID(v) })}
// UpdateLineID sets the "line_id" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdateLineID() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateLineID() })}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) SetChildUniqueReferenceID(v string) *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetChildUniqueReferenceID(v) })}
// UpdateChildUniqueReferenceID sets the "child_unique_reference_id" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdateChildUniqueReferenceID() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateChildUniqueReferenceID() })}
// ClearChildUniqueReferenceID clears the value of the "child_unique_reference_id" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) ClearChildUniqueReferenceID() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearChildUniqueReferenceID() })}
// SetDescription sets the "description" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) SetDescription(v string) *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetDescription(v) })}
// UpdateDescription sets the "description" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdateDescription() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateDescription() })}
// ClearDescription clears the value of the "description" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) ClearDescription() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearDescription() })}
// SetReason sets the "reason" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetReason(v) })}
// UpdateReason sets the "reason" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdateReason() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateReason() })}
// SetQuantity sets the "quantity" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetQuantity(v) })}
// UpdateQuantity sets the "quantity" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdateQuantity() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateQuantity() })}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetPreLinePeriodQuantity(v) })}
// UpdatePreLinePeriodQuantity sets the "pre_line_period_quantity" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdatePreLinePeriodQuantity() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdatePreLinePeriodQuantity() })}
// ClearPreLinePeriodQuantity clears the value of the "pre_line_period_quantity" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) ClearPreLinePeriodQuantity() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearPreLinePeriodQuantity() })}
// SetReasonDetails sets the "reason_details" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) SetReasonDetails(v *billing.DiscountReason) *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.SetReasonDetails(v) })}
// UpdateReasonDetails sets the "reason_details" field to the value that was provided on create.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) UpdateReasonDetails() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.UpdateReasonDetails() })}
// ClearReasonDetails clears the value of the "reason_details" field.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) ClearReasonDetails() *BillingInvoiceLineUsageDiscountUpsertBulk { return u.Update(func(s *BillingInvoiceLineUsageDiscountUpsert) { s.ClearReasonDetails() })}
// Exec executes the query.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { return u.create.err } for i, b := range u.create.builders { if len(b.conflict) != 0 { return fmt.Errorf("db: OnConflict was set for builder %d. Set it on the BillingInvoiceLineUsageDiscountCreateBulk instead", i) } } if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceLineUsageDiscountCreateBulk.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceLineUsageDiscountUpsertBulk) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788// Code generated by ent, DO NOT EDIT.
package db
import ( "context"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicelineusagediscount" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceLineUsageDiscountDelete is the builder for deleting a BillingInvoiceLineUsageDiscount entity.type BillingInvoiceLineUsageDiscountDelete struct { config hooks []Hook mutation *BillingInvoiceLineUsageDiscountMutation}
// Where appends a list predicates to the BillingInvoiceLineUsageDiscountDelete builder.func (_d *BillingInvoiceLineUsageDiscountDelete) Where(ps ...predicate.BillingInvoiceLineUsageDiscount) *BillingInvoiceLineUsageDiscountDelete { _d.mutation.Where(ps...) return _d}
// Exec executes the deletion query and returns how many vertices were deleted.func (_d *BillingInvoiceLineUsageDiscountDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceLineUsageDiscountDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n}
func (_d *BillingInvoiceLineUsageDiscountDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(billinginvoicelineusagediscount.Table, sqlgraph.NewFieldSpec(billinginvoicelineusagediscount.FieldID, field.TypeString)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err}
// BillingInvoiceLineUsageDiscountDeleteOne is the builder for deleting a single BillingInvoiceLineUsageDiscount entity.type BillingInvoiceLineUsageDiscountDeleteOne struct { _d *BillingInvoiceLineUsageDiscountDelete}
// Where appends a list predicates to the BillingInvoiceLineUsageDiscountDelete builder.func (_d *BillingInvoiceLineUsageDiscountDeleteOne) Where(ps ...predicate.BillingInvoiceLineUsageDiscount) *BillingInvoiceLineUsageDiscountDeleteOne { _d._d.mutation.Where(ps...) return _d}
// Exec executes the deletion query.func (_d *BillingInvoiceLineUsageDiscountDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{billinginvoicelineusagediscount.Label} default: return nil }}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceLineUsageDiscountDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "fmt" "math"
"entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicelineusagediscount" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceLineUsageDiscountQuery is the builder for querying BillingInvoiceLineUsageDiscount entities.type BillingInvoiceLineUsageDiscountQuery struct { config ctx *QueryContext order []billinginvoicelineusagediscount.OrderOption inters []Interceptor predicates []predicate.BillingInvoiceLineUsageDiscount withBillingInvoiceLine *BillingInvoiceLineQuery 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 BillingInvoiceLineUsageDiscountQuery builder.func (_q *BillingInvoiceLineUsageDiscountQuery) Where(ps ...predicate.BillingInvoiceLineUsageDiscount) *BillingInvoiceLineUsageDiscountQuery { _q.predicates = append(_q.predicates, ps...) return _q}
// Limit the number of records to be returned by this query.func (_q *BillingInvoiceLineUsageDiscountQuery) Limit(limit int) *BillingInvoiceLineUsageDiscountQuery { _q.ctx.Limit = &limit return _q}
// Offset to start from.func (_q *BillingInvoiceLineUsageDiscountQuery) Offset(offset int) *BillingInvoiceLineUsageDiscountQuery { _q.ctx.Offset = &offset return _q}
// 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 (_q *BillingInvoiceLineUsageDiscountQuery) Unique(unique bool) *BillingInvoiceLineUsageDiscountQuery { _q.ctx.Unique = &unique return _q}
// Order specifies how the records should be ordered.func (_q *BillingInvoiceLineUsageDiscountQuery) Order(o ...billinginvoicelineusagediscount.OrderOption) *BillingInvoiceLineUsageDiscountQuery { _q.order = append(_q.order, o...) return _q}
// QueryBillingInvoiceLine chains the current query on the "billing_invoice_line" edge.func (_q *BillingInvoiceLineUsageDiscountQuery) QueryBillingInvoiceLine() *BillingInvoiceLineQuery { query := (&BillingInvoiceLineClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(billinginvoicelineusagediscount.Table, billinginvoicelineusagediscount.FieldID, selector), sqlgraph.To(billinginvoiceline.Table, billinginvoiceline.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, billinginvoicelineusagediscount.BillingInvoiceLineTable, billinginvoicelineusagediscount.BillingInvoiceLineColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query}
// First returns the first BillingInvoiceLineUsageDiscount entity from the query.// Returns a *NotFoundError when no BillingInvoiceLineUsageDiscount was found.func (_q *BillingInvoiceLineUsageDiscountQuery) First(ctx context.Context) (*BillingInvoiceLineUsageDiscount, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{billinginvoicelineusagediscount.Label} } return nodes[0], nil}
// FirstX is like First, but panics if an error occurs.func (_q *BillingInvoiceLineUsageDiscountQuery) FirstX(ctx context.Context) *BillingInvoiceLineUsageDiscount { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node}
// FirstID returns the first BillingInvoiceLineUsageDiscount ID from the query.// Returns a *NotFoundError when no BillingInvoiceLineUsageDiscount ID was found.func (_q *BillingInvoiceLineUsageDiscountQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{billinginvoicelineusagediscount.Label} return } return ids[0], nil}
// FirstIDX is like FirstID, but panics if an error occurs.func (_q *BillingInvoiceLineUsageDiscountQuery) FirstIDX(ctx context.Context) string { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id}
// Only returns a single BillingInvoiceLineUsageDiscount entity found by the query, ensuring it only returns one.// Returns a *NotSingularError when more than one BillingInvoiceLineUsageDiscount entity is found.// Returns a *NotFoundError when no BillingInvoiceLineUsageDiscount entities are found.func (_q *BillingInvoiceLineUsageDiscountQuery) Only(ctx context.Context) (*BillingInvoiceLineUsageDiscount, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{billinginvoicelineusagediscount.Label} default: return nil, &NotSingularError{billinginvoicelineusagediscount.Label} }}
// OnlyX is like Only, but panics if an error occurs.func (_q *BillingInvoiceLineUsageDiscountQuery) OnlyX(ctx context.Context) *BillingInvoiceLineUsageDiscount { node, err := _q.Only(ctx) if err != nil { panic(err) } return node}
// OnlyID is like Only, but returns the only BillingInvoiceLineUsageDiscount ID in the query.// Returns a *NotSingularError when more than one BillingInvoiceLineUsageDiscount ID is found.// Returns a *NotFoundError when no entities are found.func (_q *BillingInvoiceLineUsageDiscountQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{billinginvoicelineusagediscount.Label} default: err = &NotSingularError{billinginvoicelineusagediscount.Label} } return}
// OnlyIDX is like OnlyID, but panics if an error occurs.func (_q *BillingInvoiceLineUsageDiscountQuery) OnlyIDX(ctx context.Context) string { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id}
// All executes the query and returns a list of BillingInvoiceLineUsageDiscounts.func (_q *BillingInvoiceLineUsageDiscountQuery) All(ctx context.Context) ([]*BillingInvoiceLineUsageDiscount, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*BillingInvoiceLineUsageDiscount, *BillingInvoiceLineUsageDiscountQuery]() return withInterceptors[[]*BillingInvoiceLineUsageDiscount](ctx, _q, qr, _q.inters)}
// AllX is like All, but panics if an error occurs.func (_q *BillingInvoiceLineUsageDiscountQuery) AllX(ctx context.Context) []*BillingInvoiceLineUsageDiscount { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes}
// IDs executes the query and returns a list of BillingInvoiceLineUsageDiscount IDs.func (_q *BillingInvoiceLineUsageDiscountQuery) IDs(ctx context.Context) (ids []string, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(billinginvoicelineusagediscount.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil}
// IDsX is like IDs, but panics if an error occurs.func (_q *BillingInvoiceLineUsageDiscountQuery) IDsX(ctx context.Context) []string { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids}
// Count returns the count of the given query.func (_q *BillingInvoiceLineUsageDiscountQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*BillingInvoiceLineUsageDiscountQuery](), _q.inters)}
// CountX is like Count, but panics if an error occurs.func (_q *BillingInvoiceLineUsageDiscountQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count}
// Exist returns true if the query has elements in the graph.func (_q *BillingInvoiceLineUsageDiscountQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("db: check existence: %w", err) default: return true, nil }}
// ExistX is like Exist, but panics if an error occurs.func (_q *BillingInvoiceLineUsageDiscountQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist}
// Clone returns a duplicate of the BillingInvoiceLineUsageDiscountQuery builder, including all associated steps. It can be// used to prepare common query builders and use them differently after the clone is made.func (_q *BillingInvoiceLineUsageDiscountQuery) Clone() *BillingInvoiceLineUsageDiscountQuery { if _q == nil { return nil } return &BillingInvoiceLineUsageDiscountQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]billinginvoicelineusagediscount.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.BillingInvoiceLineUsageDiscount{}, _q.predicates...), withBillingInvoiceLine: _q.withBillingInvoiceLine.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, }}
// WithBillingInvoiceLine tells the query-builder to eager-load the nodes that are connected to// the "billing_invoice_line" edge. The optional arguments are used to configure the query builder of the edge.func (_q *BillingInvoiceLineUsageDiscountQuery) WithBillingInvoiceLine(opts ...func(*BillingInvoiceLineQuery)) *BillingInvoiceLineUsageDiscountQuery { query := (&BillingInvoiceLineClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withBillingInvoiceLine = query return _q}
// GroupBy is used to group vertices by one or more fields/columns.// It is often used with aggregate functions, like: count, max, mean, min, sum.//// Example://// var v []struct {// Namespace string `json:"namespace,omitempty"`// Count int `json:"count,omitempty"`// }//// client.BillingInvoiceLineUsageDiscount.Query().// GroupBy(billinginvoicelineusagediscount.FieldNamespace).// Aggregate(db.Count()).// Scan(ctx, &v)func (_q *BillingInvoiceLineUsageDiscountQuery) GroupBy(field string, fields ...string) *BillingInvoiceLineUsageDiscountGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &BillingInvoiceLineUsageDiscountGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = billinginvoicelineusagediscount.Label grbuild.scan = grbuild.Scan return grbuild}
// Select allows the selection one or more fields/columns for the given query,// instead of selecting all fields in the entity.//// Example://// var v []struct {// Namespace string `json:"namespace,omitempty"`// }//// client.BillingInvoiceLineUsageDiscount.Query().// Select(billinginvoicelineusagediscount.FieldNamespace).// Scan(ctx, &v)func (_q *BillingInvoiceLineUsageDiscountQuery) Select(fields ...string) *BillingInvoiceLineUsageDiscountSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &BillingInvoiceLineUsageDiscountSelect{BillingInvoiceLineUsageDiscountQuery: _q} sbuild.label = billinginvoicelineusagediscount.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild}
// Aggregate returns a BillingInvoiceLineUsageDiscountSelect configured with the given aggregations.func (_q *BillingInvoiceLineUsageDiscountQuery) Aggregate(fns ...AggregateFunc) *BillingInvoiceLineUsageDiscountSelect { return _q.Select().Aggregate(fns...)}
func (_q *BillingInvoiceLineUsageDiscountQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("db: uninitialized interceptor (forgotten import db/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !billinginvoicelineusagediscount.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil}
func (_q *BillingInvoiceLineUsageDiscountQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BillingInvoiceLineUsageDiscount, error) { var ( nodes = []*BillingInvoiceLineUsageDiscount{} _spec = _q.querySpec() loadedTypes = [1]bool{ _q.withBillingInvoiceLine != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*BillingInvoiceLineUsageDiscount).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &BillingInvoiceLineUsageDiscount{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withBillingInvoiceLine; query != nil { if err := _q.loadBillingInvoiceLine(ctx, query, nodes, nil, func(n *BillingInvoiceLineUsageDiscount, e *BillingInvoiceLine) { n.Edges.BillingInvoiceLine = e }); err != nil { return nil, err } } return nodes, nil}
func (_q *BillingInvoiceLineUsageDiscountQuery) loadBillingInvoiceLine(ctx context.Context, query *BillingInvoiceLineQuery, nodes []*BillingInvoiceLineUsageDiscount, init func(*BillingInvoiceLineUsageDiscount), assign func(*BillingInvoiceLineUsageDiscount, *BillingInvoiceLine)) error { ids := make([]string, 0, len(nodes)) nodeids := make(map[string][]*BillingInvoiceLineUsageDiscount) for i := range nodes { fk := nodes[i].LineID if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(billinginvoiceline.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "line_id" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil}
func (_q *BillingInvoiceLineUsageDiscountQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec)}
func (_q *BillingInvoiceLineUsageDiscountQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(billinginvoicelineusagediscount.Table, billinginvoicelineusagediscount.Columns, sqlgraph.NewFieldSpec(billinginvoicelineusagediscount.FieldID, field.TypeString)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicelineusagediscount.FieldID) for i := range fields { if fields[i] != billinginvoicelineusagediscount.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } if _q.withBillingInvoiceLine != nil { _spec.Node.AddColumnOnce(billinginvoicelineusagediscount.FieldLineID) } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec}
func (_q *BillingInvoiceLineUsageDiscountQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(billinginvoicelineusagediscount.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = billinginvoicelineusagediscount.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, m := range _q.modifiers { m(selector) } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector}
// ForUpdate locks the selected rows against concurrent updates, and prevent them from being// updated, deleted or "selected ... for update" by other sessions, until the transaction is// either committed or rolled-back.func (_q *BillingInvoiceLineUsageDiscountQuery) ForUpdate(opts ...sql.LockOption) *BillingInvoiceLineUsageDiscountQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForUpdate(opts...) }) return _q}
// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock// on any rows that are read. Other sessions can read the rows, but cannot modify them// until your transaction commits.func (_q *BillingInvoiceLineUsageDiscountQuery) ForShare(opts ...sql.LockOption) *BillingInvoiceLineUsageDiscountQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForShare(opts...) }) return _q}
// BillingInvoiceLineUsageDiscountGroupBy is the group-by builder for BillingInvoiceLineUsageDiscount entities.type BillingInvoiceLineUsageDiscountGroupBy struct { selector build *BillingInvoiceLineUsageDiscountQuery}
// Aggregate adds the given aggregation functions to the group-by query.func (_g *BillingInvoiceLineUsageDiscountGroupBy) Aggregate(fns ...AggregateFunc) *BillingInvoiceLineUsageDiscountGroupBy { _g.fns = append(_g.fns, fns...) return _g}
// Scan applies the selector query and scans the result into the given value.func (_g *BillingInvoiceLineUsageDiscountGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceLineUsageDiscountQuery, *BillingInvoiceLineUsageDiscountGroupBy](ctx, _g.build, _g, _g.build.inters, v)}
func (_g *BillingInvoiceLineUsageDiscountGroupBy) sqlScan(ctx context.Context, root *BillingInvoiceLineUsageDiscountQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}
// BillingInvoiceLineUsageDiscountSelect is the builder for selecting fields of BillingInvoiceLineUsageDiscount entities.type BillingInvoiceLineUsageDiscountSelect struct { *BillingInvoiceLineUsageDiscountQuery selector}
// Aggregate adds the given aggregation functions to the selector query.func (_s *BillingInvoiceLineUsageDiscountSelect) Aggregate(fns ...AggregateFunc) *BillingInvoiceLineUsageDiscountSelect { _s.fns = append(_s.fns, fns...) return _s}
// Scan applies the selector query and scans the result into the given value.func (_s *BillingInvoiceLineUsageDiscountSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceLineUsageDiscountQuery, *BillingInvoiceLineUsageDiscountSelect](ctx, _s.BillingInvoiceLineUsageDiscountQuery, _s, _s.inters, v)}
func (_s *BillingInvoiceLineUsageDiscountSelect) sqlScan(ctx context.Context, root *BillingInvoiceLineUsageDiscountQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt" "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicelineusagediscount" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceLineUsageDiscountUpdate is the builder for updating BillingInvoiceLineUsageDiscount entities.type BillingInvoiceLineUsageDiscountUpdate struct { config hooks []Hook mutation *BillingInvoiceLineUsageDiscountMutation}
// Where appends a list predicates to the BillingInvoiceLineUsageDiscountUpdate builder.func (_u *BillingInvoiceLineUsageDiscountUpdate) Where(ps ...predicate.BillingInvoiceLineUsageDiscount) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.Where(ps...) return _u}
// SetUpdatedAt sets the "updated_at" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetUpdatedAt(v time.Time) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetUpdatedAt(v) return _u}
// SetDeletedAt sets the "deleted_at" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetDeletedAt(v time.Time) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetDeletedAt(v) return _u}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetNillableDeletedAt(v *time.Time) *BillingInvoiceLineUsageDiscountUpdate { if v != nil { _u.SetDeletedAt(*v) } return _u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) ClearDeletedAt() *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.ClearDeletedAt() return _u}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetInvoicingAppExternalID(v string) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetInvoicingAppExternalID(v) return _u}
// SetNillableInvoicingAppExternalID sets the "invoicing_app_external_id" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetNillableInvoicingAppExternalID(v *string) *BillingInvoiceLineUsageDiscountUpdate { if v != nil { _u.SetInvoicingAppExternalID(*v) } return _u}
// ClearInvoicingAppExternalID clears the value of the "invoicing_app_external_id" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) ClearInvoicingAppExternalID() *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.ClearInvoicingAppExternalID() return _u}
// SetLineID sets the "line_id" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetLineID(v string) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetLineID(v) return _u}
// SetNillableLineID sets the "line_id" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetNillableLineID(v *string) *BillingInvoiceLineUsageDiscountUpdate { if v != nil { _u.SetLineID(*v) } return _u}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetChildUniqueReferenceID(v string) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetChildUniqueReferenceID(v) return _u}
// SetNillableChildUniqueReferenceID sets the "child_unique_reference_id" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetNillableChildUniqueReferenceID(v *string) *BillingInvoiceLineUsageDiscountUpdate { if v != nil { _u.SetChildUniqueReferenceID(*v) } return _u}
// ClearChildUniqueReferenceID clears the value of the "child_unique_reference_id" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) ClearChildUniqueReferenceID() *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.ClearChildUniqueReferenceID() return _u}
// SetDescription sets the "description" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetDescription(v string) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetDescription(v) return _u}
// SetNillableDescription sets the "description" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetNillableDescription(v *string) *BillingInvoiceLineUsageDiscountUpdate { if v != nil { _u.SetDescription(*v) } return _u}
// ClearDescription clears the value of the "description" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) ClearDescription() *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.ClearDescription() return _u}
// SetReason sets the "reason" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetReason(v) return _u}
// SetNillableReason sets the "reason" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetNillableReason(v *billing.DiscountReasonType) *BillingInvoiceLineUsageDiscountUpdate { if v != nil { _u.SetReason(*v) } return _u}
// SetQuantity sets the "quantity" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetQuantity(v) return _u}
// SetNillableQuantity sets the "quantity" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetNillableQuantity(v *alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpdate { if v != nil { _u.SetQuantity(*v) } return _u}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetPreLinePeriodQuantity(v) return _u}
// SetNillablePreLinePeriodQuantity sets the "pre_line_period_quantity" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetNillablePreLinePeriodQuantity(v *alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpdate { if v != nil { _u.SetPreLinePeriodQuantity(*v) } return _u}
// ClearPreLinePeriodQuantity clears the value of the "pre_line_period_quantity" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) ClearPreLinePeriodQuantity() *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.ClearPreLinePeriodQuantity() return _u}
// SetReasonDetails sets the "reason_details" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetReasonDetails(v *billing.DiscountReason) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetReasonDetails(v) return _u}
// ClearReasonDetails clears the value of the "reason_details" field.func (_u *BillingInvoiceLineUsageDiscountUpdate) ClearReasonDetails() *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.ClearReasonDetails() return _u}
// SetBillingInvoiceLineID sets the "billing_invoice_line" edge to the BillingInvoiceLine entity by ID.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetBillingInvoiceLineID(id string) *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.SetBillingInvoiceLineID(id) return _u}
// SetBillingInvoiceLine sets the "billing_invoice_line" edge to the BillingInvoiceLine entity.func (_u *BillingInvoiceLineUsageDiscountUpdate) SetBillingInvoiceLine(v *BillingInvoiceLine) *BillingInvoiceLineUsageDiscountUpdate { return _u.SetBillingInvoiceLineID(v.ID)}
// Mutation returns the BillingInvoiceLineUsageDiscountMutation object of the builder.func (_u *BillingInvoiceLineUsageDiscountUpdate) Mutation() *BillingInvoiceLineUsageDiscountMutation { return _u.mutation}
// ClearBillingInvoiceLine clears the "billing_invoice_line" edge to the BillingInvoiceLine entity.func (_u *BillingInvoiceLineUsageDiscountUpdate) ClearBillingInvoiceLine() *BillingInvoiceLineUsageDiscountUpdate { _u.mutation.ClearBillingInvoiceLine() return _u}
// Save executes the query and returns the number of nodes affected by the update operation.func (_u *BillingInvoiceLineUsageDiscountUpdate) Save(ctx context.Context) (int, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceLineUsageDiscountUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected}
// Exec executes the query.func (_u *BillingInvoiceLineUsageDiscountUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceLineUsageDiscountUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_u *BillingInvoiceLineUsageDiscountUpdate) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := billinginvoicelineusagediscount.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) }}
// check runs all checks and user-defined validators on the builder.func (_u *BillingInvoiceLineUsageDiscountUpdate) check() error { if v, ok := _u.mutation.Reason(); ok { if err := billinginvoicelineusagediscount.ReasonValidator(v); err != nil { return &ValidationError{Name: "reason", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineUsageDiscount.reason": %w`, err)} } } if v, ok := _u.mutation.ReasonDetails(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "reason_details", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineUsageDiscount.reason_details": %w`, err)} } } if _u.mutation.BillingInvoiceLineCleared() && len(_u.mutation.BillingInvoiceLineIDs()) > 0 { return errors.New(`db: clearing a required unique edge "BillingInvoiceLineUsageDiscount.billing_invoice_line"`) } return nil}
func (_u *BillingInvoiceLineUsageDiscountUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(billinginvoicelineusagediscount.Table, billinginvoicelineusagediscount.Columns, sqlgraph.NewFieldSpec(billinginvoicelineusagediscount.FieldID, field.TypeString)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.InvoicingAppExternalID(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldInvoicingAppExternalID, field.TypeString, value) } if _u.mutation.InvoicingAppExternalIDCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldInvoicingAppExternalID, field.TypeString) } if value, ok := _u.mutation.ChildUniqueReferenceID(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldChildUniqueReferenceID, field.TypeString, value) } if _u.mutation.ChildUniqueReferenceIDCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldChildUniqueReferenceID, field.TypeString) } if value, ok := _u.mutation.Description(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldDescription, field.TypeString, value) } if _u.mutation.DescriptionCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldDescription, field.TypeString) } if value, ok := _u.mutation.Reason(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldReason, field.TypeEnum, value) } if value, ok := _u.mutation.Quantity(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldQuantity, field.TypeOther, value) } if value, ok := _u.mutation.PreLinePeriodQuantity(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldPreLinePeriodQuantity, field.TypeOther, value) } if _u.mutation.PreLinePeriodQuantityCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldPreLinePeriodQuantity, field.TypeOther) } if value, ok := _u.mutation.ReasonDetails(); ok { vv, err := billinginvoicelineusagediscount.ValueScanner.ReasonDetails.Value(value) if err != nil { return 0, err } _spec.SetField(billinginvoicelineusagediscount.FieldReasonDetails, field.TypeString, vv) } if _u.mutation.ReasonDetailsCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldReasonDetails, field.TypeString) } if _u.mutation.BillingInvoiceLineCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicelineusagediscount.BillingInvoiceLineTable, Columns: []string{billinginvoicelineusagediscount.BillingInvoiceLineColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.BillingInvoiceLineIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicelineusagediscount.BillingInvoiceLineTable, Columns: []string{billinginvoicelineusagediscount.BillingInvoiceLineColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoicelineusagediscount.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil}
// BillingInvoiceLineUsageDiscountUpdateOne is the builder for updating a single BillingInvoiceLineUsageDiscount entity.type BillingInvoiceLineUsageDiscountUpdateOne struct { config fields []string hooks []Hook mutation *BillingInvoiceLineUsageDiscountMutation}
// SetUpdatedAt sets the "updated_at" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetUpdatedAt(v time.Time) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetUpdatedAt(v) return _u}
// SetDeletedAt sets the "deleted_at" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetDeletedAt(v time.Time) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetDeletedAt(v) return _u}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetNillableDeletedAt(v *time.Time) *BillingInvoiceLineUsageDiscountUpdateOne { if v != nil { _u.SetDeletedAt(*v) } return _u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) ClearDeletedAt() *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.ClearDeletedAt() return _u}
// SetInvoicingAppExternalID sets the "invoicing_app_external_id" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetInvoicingAppExternalID(v string) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetInvoicingAppExternalID(v) return _u}
// SetNillableInvoicingAppExternalID sets the "invoicing_app_external_id" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetNillableInvoicingAppExternalID(v *string) *BillingInvoiceLineUsageDiscountUpdateOne { if v != nil { _u.SetInvoicingAppExternalID(*v) } return _u}
// ClearInvoicingAppExternalID clears the value of the "invoicing_app_external_id" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) ClearInvoicingAppExternalID() *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.ClearInvoicingAppExternalID() return _u}
// SetLineID sets the "line_id" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetLineID(v string) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetLineID(v) return _u}
// SetNillableLineID sets the "line_id" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetNillableLineID(v *string) *BillingInvoiceLineUsageDiscountUpdateOne { if v != nil { _u.SetLineID(*v) } return _u}
// SetChildUniqueReferenceID sets the "child_unique_reference_id" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetChildUniqueReferenceID(v string) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetChildUniqueReferenceID(v) return _u}
// SetNillableChildUniqueReferenceID sets the "child_unique_reference_id" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetNillableChildUniqueReferenceID(v *string) *BillingInvoiceLineUsageDiscountUpdateOne { if v != nil { _u.SetChildUniqueReferenceID(*v) } return _u}
// ClearChildUniqueReferenceID clears the value of the "child_unique_reference_id" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) ClearChildUniqueReferenceID() *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.ClearChildUniqueReferenceID() return _u}
// SetDescription sets the "description" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetDescription(v string) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetDescription(v) return _u}
// SetNillableDescription sets the "description" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetNillableDescription(v *string) *BillingInvoiceLineUsageDiscountUpdateOne { if v != nil { _u.SetDescription(*v) } return _u}
// ClearDescription clears the value of the "description" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) ClearDescription() *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.ClearDescription() return _u}
// SetReason sets the "reason" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetReason(v billing.DiscountReasonType) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetReason(v) return _u}
// SetNillableReason sets the "reason" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetNillableReason(v *billing.DiscountReasonType) *BillingInvoiceLineUsageDiscountUpdateOne { if v != nil { _u.SetReason(*v) } return _u}
// SetQuantity sets the "quantity" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetQuantity(v) return _u}
// SetNillableQuantity sets the "quantity" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetNillableQuantity(v *alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpdateOne { if v != nil { _u.SetQuantity(*v) } return _u}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetPreLinePeriodQuantity(v) return _u}
// SetNillablePreLinePeriodQuantity sets the "pre_line_period_quantity" field if the given value is not nil.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetNillablePreLinePeriodQuantity(v *alpacadecimal.Decimal) *BillingInvoiceLineUsageDiscountUpdateOne { if v != nil { _u.SetPreLinePeriodQuantity(*v) } return _u}
// ClearPreLinePeriodQuantity clears the value of the "pre_line_period_quantity" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) ClearPreLinePeriodQuantity() *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.ClearPreLinePeriodQuantity() return _u}
// SetReasonDetails sets the "reason_details" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetReasonDetails(v *billing.DiscountReason) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetReasonDetails(v) return _u}
// ClearReasonDetails clears the value of the "reason_details" field.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) ClearReasonDetails() *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.ClearReasonDetails() return _u}
// SetBillingInvoiceLineID sets the "billing_invoice_line" edge to the BillingInvoiceLine entity by ID.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetBillingInvoiceLineID(id string) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.SetBillingInvoiceLineID(id) return _u}
// SetBillingInvoiceLine sets the "billing_invoice_line" edge to the BillingInvoiceLine entity.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SetBillingInvoiceLine(v *BillingInvoiceLine) *BillingInvoiceLineUsageDiscountUpdateOne { return _u.SetBillingInvoiceLineID(v.ID)}
// Mutation returns the BillingInvoiceLineUsageDiscountMutation object of the builder.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) Mutation() *BillingInvoiceLineUsageDiscountMutation { return _u.mutation}
// ClearBillingInvoiceLine clears the "billing_invoice_line" edge to the BillingInvoiceLine entity.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) ClearBillingInvoiceLine() *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.ClearBillingInvoiceLine() return _u}
// Where appends a list predicates to the BillingInvoiceLineUsageDiscountUpdate builder.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) Where(ps ...predicate.BillingInvoiceLineUsageDiscount) *BillingInvoiceLineUsageDiscountUpdateOne { _u.mutation.Where(ps...) return _u}
// Select allows selecting one or more fields (columns) of the returned entity.// The default is selecting all fields defined in the entity schema.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) Select(field string, fields ...string) *BillingInvoiceLineUsageDiscountUpdateOne { _u.fields = append([]string{field}, fields...) return _u}
// Save executes the query and returns the updated BillingInvoiceLineUsageDiscount entity.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) Save(ctx context.Context) (*BillingInvoiceLineUsageDiscount, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) SaveX(ctx context.Context) *BillingInvoiceLineUsageDiscount { node, err := _u.Save(ctx) if err != nil { panic(err) } return node}
// Exec executes the query on the entity.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := billinginvoicelineusagediscount.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) }}
// check runs all checks and user-defined validators on the builder.func (_u *BillingInvoiceLineUsageDiscountUpdateOne) check() error { if v, ok := _u.mutation.Reason(); ok { if err := billinginvoicelineusagediscount.ReasonValidator(v); err != nil { return &ValidationError{Name: "reason", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineUsageDiscount.reason": %w`, err)} } } if v, ok := _u.mutation.ReasonDetails(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "reason_details", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLineUsageDiscount.reason_details": %w`, err)} } } if _u.mutation.BillingInvoiceLineCleared() && len(_u.mutation.BillingInvoiceLineIDs()) > 0 { return errors.New(`db: clearing a required unique edge "BillingInvoiceLineUsageDiscount.billing_invoice_line"`) } return nil}
func (_u *BillingInvoiceLineUsageDiscountUpdateOne) sqlSave(ctx context.Context) (_node *BillingInvoiceLineUsageDiscount, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(billinginvoicelineusagediscount.Table, billinginvoicelineusagediscount.Columns, sqlgraph.NewFieldSpec(billinginvoicelineusagediscount.FieldID, field.TypeString)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "BillingInvoiceLineUsageDiscount.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicelineusagediscount.FieldID) for _, f := range fields { if !billinginvoicelineusagediscount.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } if f != billinginvoicelineusagediscount.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.InvoicingAppExternalID(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldInvoicingAppExternalID, field.TypeString, value) } if _u.mutation.InvoicingAppExternalIDCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldInvoicingAppExternalID, field.TypeString) } if value, ok := _u.mutation.ChildUniqueReferenceID(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldChildUniqueReferenceID, field.TypeString, value) } if _u.mutation.ChildUniqueReferenceIDCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldChildUniqueReferenceID, field.TypeString) } if value, ok := _u.mutation.Description(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldDescription, field.TypeString, value) } if _u.mutation.DescriptionCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldDescription, field.TypeString) } if value, ok := _u.mutation.Reason(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldReason, field.TypeEnum, value) } if value, ok := _u.mutation.Quantity(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldQuantity, field.TypeOther, value) } if value, ok := _u.mutation.PreLinePeriodQuantity(); ok { _spec.SetField(billinginvoicelineusagediscount.FieldPreLinePeriodQuantity, field.TypeOther, value) } if _u.mutation.PreLinePeriodQuantityCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldPreLinePeriodQuantity, field.TypeOther) } if value, ok := _u.mutation.ReasonDetails(); ok { vv, err := billinginvoicelineusagediscount.ValueScanner.ReasonDetails.Value(value) if err != nil { return nil, err } _spec.SetField(billinginvoicelineusagediscount.FieldReasonDetails, field.TypeString, vv) } if _u.mutation.ReasonDetailsCleared() { _spec.ClearField(billinginvoicelineusagediscount.FieldReasonDetails, field.TypeString) } if _u.mutation.BillingInvoiceLineCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicelineusagediscount.BillingInvoiceLineTable, Columns: []string{billinginvoicelineusagediscount.BillingInvoiceLineColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.BillingInvoiceLineIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicelineusagediscount.BillingInvoiceLineTable, Columns: []string{billinginvoicelineusagediscount.BillingInvoiceLineColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &BillingInvoiceLineUsageDiscount{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoicelineusagediscount.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459// Code generated by ent, DO NOT EDIT.
package db
import ( "encoding/json" "fmt" "strings" "time"
"entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicesplitlinegroup" "github.com/openmeterio/openmeter/openmeter/ent/db/charge" "github.com/openmeterio/openmeter/openmeter/ent/db/subscription" "github.com/openmeterio/openmeter/openmeter/ent/db/subscriptionitem" "github.com/openmeterio/openmeter/openmeter/ent/db/subscriptionphase" "github.com/openmeterio/openmeter/openmeter/productcatalog" "github.com/openmeterio/openmeter/pkg/currencyx")
// BillingInvoiceSplitLineGroup is the model entity for the BillingInvoiceSplitLineGroup schema.type BillingInvoiceSplitLineGroup struct { config `json:"-"` // ID of the ent. ID string `json:"id,omitempty"` // Namespace holds the value of the "namespace" field. Namespace string `json:"namespace,omitempty"` // Metadata holds the value of the "metadata" field. Metadata map[string]string `json:"metadata,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt *time.Time `json:"deleted_at,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Description holds the value of the "description" field. Description *string `json:"description,omitempty"` // Currency holds the value of the "currency" field. Currency currencyx.Code `json:"currency,omitempty"` // ServicePeriodStart holds the value of the "service_period_start" field. ServicePeriodStart time.Time `json:"service_period_start,omitempty"` // ServicePeriodEnd holds the value of the "service_period_end" field. ServicePeriodEnd time.Time `json:"service_period_end,omitempty"` // UniqueReferenceID holds the value of the "unique_reference_id" field. UniqueReferenceID *string `json:"unique_reference_id,omitempty"` // RatecardDiscounts holds the value of the "ratecard_discounts" field. RatecardDiscounts *billing.Discounts `json:"ratecard_discounts,omitempty"` // FeatureKey holds the value of the "feature_key" field. FeatureKey *string `json:"feature_key,omitempty"` // Price holds the value of the "price" field. Price *productcatalog.Price `json:"price,omitempty"` // SubscriptionID holds the value of the "subscription_id" field. SubscriptionID *string `json:"subscription_id,omitempty"` // SubscriptionPhaseID holds the value of the "subscription_phase_id" field. SubscriptionPhaseID *string `json:"subscription_phase_id,omitempty"` // SubscriptionItemID holds the value of the "subscription_item_id" field. SubscriptionItemID *string `json:"subscription_item_id,omitempty"` // SubscriptionBillingPeriodFrom holds the value of the "subscription_billing_period_from" field. SubscriptionBillingPeriodFrom *time.Time `json:"subscription_billing_period_from,omitempty"` // SubscriptionBillingPeriodTo holds the value of the "subscription_billing_period_to" field. SubscriptionBillingPeriodTo *time.Time `json:"subscription_billing_period_to,omitempty"` // ChargeID holds the value of the "charge_id" field. ChargeID *string `json:"charge_id,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the BillingInvoiceSplitLineGroupQuery when eager-loading is set. Edges BillingInvoiceSplitLineGroupEdges `json:"edges"` selectValues sql.SelectValues}
// BillingInvoiceSplitLineGroupEdges holds the relations/edges for other nodes in the graph.type BillingInvoiceSplitLineGroupEdges struct { // BillingInvoiceLines holds the value of the billing_invoice_lines edge. BillingInvoiceLines []*BillingInvoiceLine `json:"billing_invoice_lines,omitempty"` // Subscription holds the value of the subscription edge. Subscription *Subscription `json:"subscription,omitempty"` // SubscriptionPhase holds the value of the subscription_phase edge. SubscriptionPhase *SubscriptionPhase `json:"subscription_phase,omitempty"` // SubscriptionItem holds the value of the subscription_item edge. SubscriptionItem *SubscriptionItem `json:"subscription_item,omitempty"` // Charge holds the value of the charge edge. Charge *Charge `json:"charge,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [5]bool}
// BillingInvoiceLinesOrErr returns the BillingInvoiceLines value or an error if the edge// was not loaded in eager-loading.func (e BillingInvoiceSplitLineGroupEdges) BillingInvoiceLinesOrErr() ([]*BillingInvoiceLine, error) { if e.loadedTypes[0] { return e.BillingInvoiceLines, nil } return nil, &NotLoadedError{edge: "billing_invoice_lines"}}
// SubscriptionOrErr returns the Subscription value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingInvoiceSplitLineGroupEdges) SubscriptionOrErr() (*Subscription, error) { if e.Subscription != nil { return e.Subscription, nil } else if e.loadedTypes[1] { return nil, &NotFoundError{label: subscription.Label} } return nil, &NotLoadedError{edge: "subscription"}}
// SubscriptionPhaseOrErr returns the SubscriptionPhase value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingInvoiceSplitLineGroupEdges) SubscriptionPhaseOrErr() (*SubscriptionPhase, error) { if e.SubscriptionPhase != nil { return e.SubscriptionPhase, nil } else if e.loadedTypes[2] { return nil, &NotFoundError{label: subscriptionphase.Label} } return nil, &NotLoadedError{edge: "subscription_phase"}}
// SubscriptionItemOrErr returns the SubscriptionItem value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingInvoiceSplitLineGroupEdges) SubscriptionItemOrErr() (*SubscriptionItem, error) { if e.SubscriptionItem != nil { return e.SubscriptionItem, nil } else if e.loadedTypes[3] { return nil, &NotFoundError{label: subscriptionitem.Label} } return nil, &NotLoadedError{edge: "subscription_item"}}
// ChargeOrErr returns the Charge value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingInvoiceSplitLineGroupEdges) ChargeOrErr() (*Charge, error) { if e.Charge != nil { return e.Charge, nil } else if e.loadedTypes[4] { return nil, &NotFoundError{label: charge.Label} } return nil, &NotLoadedError{edge: "charge"}}
// scanValues returns the types for scanning values from sql.Rows.func (*BillingInvoiceSplitLineGroup) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case billinginvoicesplitlinegroup.FieldMetadata: values[i] = new([]byte) case billinginvoicesplitlinegroup.FieldID, billinginvoicesplitlinegroup.FieldNamespace, billinginvoicesplitlinegroup.FieldName, billinginvoicesplitlinegroup.FieldDescription, billinginvoicesplitlinegroup.FieldCurrency, billinginvoicesplitlinegroup.FieldUniqueReferenceID, billinginvoicesplitlinegroup.FieldFeatureKey, billinginvoicesplitlinegroup.FieldSubscriptionID, billinginvoicesplitlinegroup.FieldSubscriptionPhaseID, billinginvoicesplitlinegroup.FieldSubscriptionItemID, billinginvoicesplitlinegroup.FieldChargeID: values[i] = new(sql.NullString) case billinginvoicesplitlinegroup.FieldCreatedAt, billinginvoicesplitlinegroup.FieldUpdatedAt, billinginvoicesplitlinegroup.FieldDeletedAt, billinginvoicesplitlinegroup.FieldServicePeriodStart, billinginvoicesplitlinegroup.FieldServicePeriodEnd, billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodFrom, billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodTo: values[i] = new(sql.NullTime) case billinginvoicesplitlinegroup.FieldRatecardDiscounts: values[i] = billinginvoicesplitlinegroup.ValueScanner.RatecardDiscounts.ScanValue() case billinginvoicesplitlinegroup.FieldPrice: values[i] = billinginvoicesplitlinegroup.ValueScanner.Price.ScanValue() default: values[i] = new(sql.UnknownType) } } return values, nil}
// assignValues assigns the values that were returned from sql.Rows (after scanning)// to the BillingInvoiceSplitLineGroup fields.func (_m *BillingInvoiceSplitLineGroup) 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) } for i := range columns { switch columns[i] { case billinginvoicesplitlinegroup.FieldID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value.Valid { _m.ID = value.String } case billinginvoicesplitlinegroup.FieldNamespace: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field namespace", values[i]) } else if value.Valid { _m.Namespace = value.String } case billinginvoicesplitlinegroup.FieldMetadata: if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field metadata", values[i]) } else if value != nil && len(*value) > 0 { if err := json.Unmarshal(*value, &_m.Metadata); err != nil { return fmt.Errorf("unmarshal field metadata: %w", err) } } case billinginvoicesplitlinegroup.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { _m.CreatedAt = value.Time } case billinginvoicesplitlinegroup.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { _m.UpdatedAt = value.Time } case billinginvoicesplitlinegroup.FieldDeletedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field deleted_at", values[i]) } else if value.Valid { _m.DeletedAt = new(time.Time) *_m.DeletedAt = value.Time } case billinginvoicesplitlinegroup.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { _m.Name = value.String } case billinginvoicesplitlinegroup.FieldDescription: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field description", values[i]) } else if value.Valid { _m.Description = new(string) *_m.Description = value.String } case billinginvoicesplitlinegroup.FieldCurrency: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field currency", values[i]) } else if value.Valid { _m.Currency = currencyx.Code(value.String) } case billinginvoicesplitlinegroup.FieldServicePeriodStart: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field service_period_start", values[i]) } else if value.Valid { _m.ServicePeriodStart = value.Time } case billinginvoicesplitlinegroup.FieldServicePeriodEnd: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field service_period_end", values[i]) } else if value.Valid { _m.ServicePeriodEnd = value.Time } case billinginvoicesplitlinegroup.FieldUniqueReferenceID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field unique_reference_id", values[i]) } else if value.Valid { _m.UniqueReferenceID = new(string) *_m.UniqueReferenceID = value.String } case billinginvoicesplitlinegroup.FieldRatecardDiscounts: if value, err := billinginvoicesplitlinegroup.ValueScanner.RatecardDiscounts.FromValue(values[i]); err != nil { return err } else { _m.RatecardDiscounts = value } case billinginvoicesplitlinegroup.FieldFeatureKey: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field feature_key", values[i]) } else if value.Valid { _m.FeatureKey = new(string) *_m.FeatureKey = value.String } case billinginvoicesplitlinegroup.FieldPrice: if value, err := billinginvoicesplitlinegroup.ValueScanner.Price.FromValue(values[i]); err != nil { return err } else { _m.Price = value } case billinginvoicesplitlinegroup.FieldSubscriptionID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field subscription_id", values[i]) } else if value.Valid { _m.SubscriptionID = new(string) *_m.SubscriptionID = value.String } case billinginvoicesplitlinegroup.FieldSubscriptionPhaseID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field subscription_phase_id", values[i]) } else if value.Valid { _m.SubscriptionPhaseID = new(string) *_m.SubscriptionPhaseID = value.String } case billinginvoicesplitlinegroup.FieldSubscriptionItemID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field subscription_item_id", values[i]) } else if value.Valid { _m.SubscriptionItemID = new(string) *_m.SubscriptionItemID = value.String } case billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodFrom: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field subscription_billing_period_from", values[i]) } else if value.Valid { _m.SubscriptionBillingPeriodFrom = new(time.Time) *_m.SubscriptionBillingPeriodFrom = value.Time } case billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodTo: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field subscription_billing_period_to", values[i]) } else if value.Valid { _m.SubscriptionBillingPeriodTo = new(time.Time) *_m.SubscriptionBillingPeriodTo = value.Time } case billinginvoicesplitlinegroup.FieldChargeID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field charge_id", values[i]) } else if value.Valid { _m.ChargeID = new(string) *_m.ChargeID = value.String } default: _m.selectValues.Set(columns[i], values[i]) } } return nil}
// Value returns the ent.Value that was dynamically selected and assigned to the BillingInvoiceSplitLineGroup.// This includes values selected through modifiers, order, etc.func (_m *BillingInvoiceSplitLineGroup) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name)}
// QueryBillingInvoiceLines queries the "billing_invoice_lines" edge of the BillingInvoiceSplitLineGroup entity.func (_m *BillingInvoiceSplitLineGroup) QueryBillingInvoiceLines() *BillingInvoiceLineQuery { return NewBillingInvoiceSplitLineGroupClient(_m.config).QueryBillingInvoiceLines(_m)}
// QuerySubscription queries the "subscription" edge of the BillingInvoiceSplitLineGroup entity.func (_m *BillingInvoiceSplitLineGroup) QuerySubscription() *SubscriptionQuery { return NewBillingInvoiceSplitLineGroupClient(_m.config).QuerySubscription(_m)}
// QuerySubscriptionPhase queries the "subscription_phase" edge of the BillingInvoiceSplitLineGroup entity.func (_m *BillingInvoiceSplitLineGroup) QuerySubscriptionPhase() *SubscriptionPhaseQuery { return NewBillingInvoiceSplitLineGroupClient(_m.config).QuerySubscriptionPhase(_m)}
// QuerySubscriptionItem queries the "subscription_item" edge of the BillingInvoiceSplitLineGroup entity.func (_m *BillingInvoiceSplitLineGroup) QuerySubscriptionItem() *SubscriptionItemQuery { return NewBillingInvoiceSplitLineGroupClient(_m.config).QuerySubscriptionItem(_m)}
// QueryCharge queries the "charge" edge of the BillingInvoiceSplitLineGroup entity.func (_m *BillingInvoiceSplitLineGroup) QueryCharge() *ChargeQuery { return NewBillingInvoiceSplitLineGroupClient(_m.config).QueryCharge(_m)}
// Update returns a builder for updating this BillingInvoiceSplitLineGroup.// Note that you need to call BillingInvoiceSplitLineGroup.Unwrap() before calling this method if this BillingInvoiceSplitLineGroup// was returned from a transaction, and the transaction was committed or rolled back.func (_m *BillingInvoiceSplitLineGroup) Update() *BillingInvoiceSplitLineGroupUpdateOne { return NewBillingInvoiceSplitLineGroupClient(_m.config).UpdateOne(_m)}
// Unwrap unwraps the BillingInvoiceSplitLineGroup 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 (_m *BillingInvoiceSplitLineGroup) Unwrap() *BillingInvoiceSplitLineGroup { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("db: BillingInvoiceSplitLineGroup is not a transactional entity") } _m.config.driver = _tx.drv return _m}
// String implements the fmt.Stringer.func (_m *BillingInvoiceSplitLineGroup) String() string { var builder strings.Builder builder.WriteString("BillingInvoiceSplitLineGroup(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("namespace=") builder.WriteString(_m.Namespace) builder.WriteString(", ") builder.WriteString("metadata=") builder.WriteString(fmt.Sprintf("%v", _m.Metadata)) builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") if v := _m.DeletedAt; v != nil { builder.WriteString("deleted_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(_m.Name) builder.WriteString(", ") if v := _m.Description; v != nil { builder.WriteString("description=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("currency=") builder.WriteString(fmt.Sprintf("%v", _m.Currency)) builder.WriteString(", ") builder.WriteString("service_period_start=") builder.WriteString(_m.ServicePeriodStart.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("service_period_end=") builder.WriteString(_m.ServicePeriodEnd.Format(time.ANSIC)) builder.WriteString(", ") if v := _m.UniqueReferenceID; v != nil { builder.WriteString("unique_reference_id=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.RatecardDiscounts; v != nil { builder.WriteString("ratecard_discounts=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") if v := _m.FeatureKey; v != nil { builder.WriteString("feature_key=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("price=") builder.WriteString(fmt.Sprintf("%v", _m.Price)) builder.WriteString(", ") if v := _m.SubscriptionID; v != nil { builder.WriteString("subscription_id=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.SubscriptionPhaseID; v != nil { builder.WriteString("subscription_phase_id=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.SubscriptionItemID; v != nil { builder.WriteString("subscription_item_id=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.SubscriptionBillingPeriodFrom; v != nil { builder.WriteString("subscription_billing_period_from=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") if v := _m.SubscriptionBillingPeriodTo; v != nil { builder.WriteString("subscription_billing_period_to=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") if v := _m.ChargeID; v != nil { builder.WriteString("charge_id=") builder.WriteString(*v) } builder.WriteByte(')') return builder.String()}
// BillingInvoiceSplitLineGroups is a parsable slice of BillingInvoiceSplitLineGroup.type BillingInvoiceSplitLineGroups []*BillingInvoiceSplitLineGroup123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342// Code generated by ent, DO NOT EDIT.
package billinginvoicesplitlinegroup
import ( "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/productcatalog")
const ( // Label holds the string label denoting the billinginvoicesplitlinegroup type in the database. Label = "billing_invoice_split_line_group" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldNamespace holds the string denoting the namespace field in the database. FieldNamespace = "namespace" // FieldMetadata holds the string denoting the metadata field in the database. FieldMetadata = "metadata" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" // FieldDeletedAt holds the string denoting the deleted_at field in the database. FieldDeletedAt = "deleted_at" // FieldName holds the string denoting the name field in the database. FieldName = "name" // FieldDescription holds the string denoting the description field in the database. FieldDescription = "description" // FieldCurrency holds the string denoting the currency field in the database. FieldCurrency = "currency" // FieldServicePeriodStart holds the string denoting the service_period_start field in the database. FieldServicePeriodStart = "service_period_start" // FieldServicePeriodEnd holds the string denoting the service_period_end field in the database. FieldServicePeriodEnd = "service_period_end" // FieldUniqueReferenceID holds the string denoting the unique_reference_id field in the database. FieldUniqueReferenceID = "unique_reference_id" // FieldRatecardDiscounts holds the string denoting the ratecard_discounts field in the database. FieldRatecardDiscounts = "ratecard_discounts" // FieldFeatureKey holds the string denoting the feature_key field in the database. FieldFeatureKey = "feature_key" // FieldPrice holds the string denoting the price field in the database. FieldPrice = "price" // FieldSubscriptionID holds the string denoting the subscription_id field in the database. FieldSubscriptionID = "subscription_id" // FieldSubscriptionPhaseID holds the string denoting the subscription_phase_id field in the database. FieldSubscriptionPhaseID = "subscription_phase_id" // FieldSubscriptionItemID holds the string denoting the subscription_item_id field in the database. FieldSubscriptionItemID = "subscription_item_id" // FieldSubscriptionBillingPeriodFrom holds the string denoting the subscription_billing_period_from field in the database. FieldSubscriptionBillingPeriodFrom = "subscription_billing_period_from" // FieldSubscriptionBillingPeriodTo holds the string denoting the subscription_billing_period_to field in the database. FieldSubscriptionBillingPeriodTo = "subscription_billing_period_to" // FieldChargeID holds the string denoting the charge_id field in the database. FieldChargeID = "charge_id" // EdgeBillingInvoiceLines holds the string denoting the billing_invoice_lines edge name in mutations. EdgeBillingInvoiceLines = "billing_invoice_lines" // EdgeSubscription holds the string denoting the subscription edge name in mutations. EdgeSubscription = "subscription" // EdgeSubscriptionPhase holds the string denoting the subscription_phase edge name in mutations. EdgeSubscriptionPhase = "subscription_phase" // EdgeSubscriptionItem holds the string denoting the subscription_item edge name in mutations. EdgeSubscriptionItem = "subscription_item" // EdgeCharge holds the string denoting the charge edge name in mutations. EdgeCharge = "charge" // Table holds the table name of the billinginvoicesplitlinegroup in the database. Table = "billing_invoice_split_line_groups" // BillingInvoiceLinesTable is the table that holds the billing_invoice_lines relation/edge. BillingInvoiceLinesTable = "billing_invoice_lines" // BillingInvoiceLinesInverseTable is the table name for the BillingInvoiceLine entity. // It exists in this package in order to avoid circular dependency with the "billinginvoiceline" package. BillingInvoiceLinesInverseTable = "billing_invoice_lines" // BillingInvoiceLinesColumn is the table column denoting the billing_invoice_lines relation/edge. BillingInvoiceLinesColumn = "split_line_group_id" // SubscriptionTable is the table that holds the subscription relation/edge. SubscriptionTable = "billing_invoice_split_line_groups" // SubscriptionInverseTable is the table name for the Subscription entity. // It exists in this package in order to avoid circular dependency with the "subscription" package. SubscriptionInverseTable = "subscriptions" // SubscriptionColumn is the table column denoting the subscription relation/edge. SubscriptionColumn = "subscription_id" // SubscriptionPhaseTable is the table that holds the subscription_phase relation/edge. SubscriptionPhaseTable = "billing_invoice_split_line_groups" // SubscriptionPhaseInverseTable is the table name for the SubscriptionPhase entity. // It exists in this package in order to avoid circular dependency with the "subscriptionphase" package. SubscriptionPhaseInverseTable = "subscription_phases" // SubscriptionPhaseColumn is the table column denoting the subscription_phase relation/edge. SubscriptionPhaseColumn = "subscription_phase_id" // SubscriptionItemTable is the table that holds the subscription_item relation/edge. SubscriptionItemTable = "billing_invoice_split_line_groups" // SubscriptionItemInverseTable is the table name for the SubscriptionItem entity. // It exists in this package in order to avoid circular dependency with the "subscriptionitem" package. SubscriptionItemInverseTable = "subscription_items" // SubscriptionItemColumn is the table column denoting the subscription_item relation/edge. SubscriptionItemColumn = "subscription_item_id" // ChargeTable is the table that holds the charge relation/edge. ChargeTable = "billing_invoice_split_line_groups" // ChargeInverseTable is the table name for the Charge entity. // It exists in this package in order to avoid circular dependency with the "charge" package. ChargeInverseTable = "charges" // ChargeColumn is the table column denoting the charge relation/edge. ChargeColumn = "charge_id")
// Columns holds all SQL columns for billinginvoicesplitlinegroup fields.var Columns = []string{ FieldID, FieldNamespace, FieldMetadata, FieldCreatedAt, FieldUpdatedAt, FieldDeletedAt, FieldName, FieldDescription, FieldCurrency, FieldServicePeriodStart, FieldServicePeriodEnd, FieldUniqueReferenceID, FieldRatecardDiscounts, FieldFeatureKey, FieldPrice, FieldSubscriptionID, FieldSubscriptionPhaseID, FieldSubscriptionItemID, FieldSubscriptionBillingPeriodFrom, FieldSubscriptionBillingPeriodTo, FieldChargeID,}
// ValidColumn reports if the column name is valid (part of the table columns).func ValidColumn(column string) bool { for i := range Columns { if column == Columns[i] { return true } } return false}
var ( // NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. NamespaceValidator func(string) error // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. DefaultUpdatedAt func() time.Time // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. UpdateDefaultUpdatedAt func() time.Time // CurrencyValidator is a validator for the "currency" field. It is called by the builders before save. CurrencyValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() string // ValueScanner of all BillingInvoiceSplitLineGroup fields. ValueScanner struct { RatecardDiscounts field.TypeValueScanner[*billing.Discounts] Price field.TypeValueScanner[*productcatalog.Price] })
// OrderOption defines the ordering options for the BillingInvoiceSplitLineGroup queries.type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc()}
// ByNamespace orders the results by the namespace field.func ByNamespace(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldNamespace, opts...).ToFunc()}
// ByCreatedAt orders the results by the created_at field.func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()}
// ByUpdatedAt orders the results by the updated_at field.func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()}
// ByDeletedAt orders the results by the deleted_at field.func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()}
// ByName orders the results by the name field.func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc()}
// ByDescription orders the results by the description field.func ByDescription(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDescription, opts...).ToFunc()}
// ByCurrency orders the results by the currency field.func ByCurrency(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCurrency, opts...).ToFunc()}
// ByServicePeriodStart orders the results by the service_period_start field.func ByServicePeriodStart(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldServicePeriodStart, opts...).ToFunc()}
// ByServicePeriodEnd orders the results by the service_period_end field.func ByServicePeriodEnd(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldServicePeriodEnd, opts...).ToFunc()}
// ByUniqueReferenceID orders the results by the unique_reference_id field.func ByUniqueReferenceID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUniqueReferenceID, opts...).ToFunc()}
// ByRatecardDiscounts orders the results by the ratecard_discounts field.func ByRatecardDiscounts(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldRatecardDiscounts, opts...).ToFunc()}
// ByFeatureKey orders the results by the feature_key field.func ByFeatureKey(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldFeatureKey, opts...).ToFunc()}
// ByPrice orders the results by the price field.func ByPrice(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPrice, opts...).ToFunc()}
// BySubscriptionID orders the results by the subscription_id field.func BySubscriptionID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSubscriptionID, opts...).ToFunc()}
// BySubscriptionPhaseID orders the results by the subscription_phase_id field.func BySubscriptionPhaseID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSubscriptionPhaseID, opts...).ToFunc()}
// BySubscriptionItemID orders the results by the subscription_item_id field.func BySubscriptionItemID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSubscriptionItemID, opts...).ToFunc()}
// BySubscriptionBillingPeriodFrom orders the results by the subscription_billing_period_from field.func BySubscriptionBillingPeriodFrom(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSubscriptionBillingPeriodFrom, opts...).ToFunc()}
// BySubscriptionBillingPeriodTo orders the results by the subscription_billing_period_to field.func BySubscriptionBillingPeriodTo(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSubscriptionBillingPeriodTo, opts...).ToFunc()}
// ByChargeID orders the results by the charge_id field.func ByChargeID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldChargeID, opts...).ToFunc()}
// ByBillingInvoiceLinesCount orders the results by billing_invoice_lines count.func ByBillingInvoiceLinesCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newBillingInvoiceLinesStep(), opts...) }}
// ByBillingInvoiceLines orders the results by billing_invoice_lines terms.func ByBillingInvoiceLines(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceLinesStep(), append([]sql.OrderTerm{term}, terms...)...) }}
// BySubscriptionField orders the results by subscription field.func BySubscriptionField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSubscriptionStep(), sql.OrderByField(field, opts...)) }}
// BySubscriptionPhaseField orders the results by subscription_phase field.func BySubscriptionPhaseField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSubscriptionPhaseStep(), sql.OrderByField(field, opts...)) }}
// BySubscriptionItemField orders the results by subscription_item field.func BySubscriptionItemField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSubscriptionItemStep(), sql.OrderByField(field, opts...)) }}
// ByChargeField orders the results by charge field.func ByChargeField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newChargeStep(), sql.OrderByField(field, opts...)) }}func newBillingInvoiceLinesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(BillingInvoiceLinesInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceLinesTable, BillingInvoiceLinesColumn), )}func newSubscriptionStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SubscriptionInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionTable, SubscriptionColumn), )}func newSubscriptionPhaseStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SubscriptionPhaseInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionPhaseTable, SubscriptionPhaseColumn), )}func newSubscriptionItemStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SubscriptionItemInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionItemTable, SubscriptionItemColumn), )}func newChargeStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(ChargeInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, ChargeTable, ChargeColumn), )}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352// Code generated by ent, DO NOT EDIT.
package billinginvoicesplitlinegroup
import ( "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" "github.com/openmeterio/openmeter/pkg/currencyx")
// ID filters vertices based on their ID field.func ID(id string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldID, id))}
// IDEQ applies the EQ predicate on the ID field.func IDEQ(id string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldID, id))}
// IDNEQ applies the NEQ predicate on the ID field.func IDNEQ(id string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldID, id))}
// IDIn applies the In predicate on the ID field.func IDIn(ids ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldID, ids...))}
// IDNotIn applies the NotIn predicate on the ID field.func IDNotIn(ids ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldID, ids...))}
// IDGT applies the GT predicate on the ID field.func IDGT(id string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldID, id))}
// IDGTE applies the GTE predicate on the ID field.func IDGTE(id string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldID, id))}
// IDLT applies the LT predicate on the ID field.func IDLT(id string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldID, id))}
// IDLTE applies the LTE predicate on the ID field.func IDLTE(id string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldID, id))}
// IDEqualFold applies the EqualFold predicate on the ID field.func IDEqualFold(id string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldID, id))}
// IDContainsFold applies the ContainsFold predicate on the ID field.func IDContainsFold(id string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldID, id))}
// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ.func Namespace(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldNamespace, v))}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.func CreatedAt(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldCreatedAt, v))}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.func UpdatedAt(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldUpdatedAt, v))}
// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.func DeletedAt(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldDeletedAt, v))}
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.func Name(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldName, v))}
// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ.func Description(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldDescription, v))}
// Currency applies equality check predicate on the "currency" field. It's identical to CurrencyEQ.func Currency(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldCurrency, vc))}
// ServicePeriodStart applies equality check predicate on the "service_period_start" field. It's identical to ServicePeriodStartEQ.func ServicePeriodStart(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldServicePeriodStart, v))}
// ServicePeriodEnd applies equality check predicate on the "service_period_end" field. It's identical to ServicePeriodEndEQ.func ServicePeriodEnd(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldServicePeriodEnd, v))}
// UniqueReferenceID applies equality check predicate on the "unique_reference_id" field. It's identical to UniqueReferenceIDEQ.func UniqueReferenceID(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldUniqueReferenceID, v))}
// FeatureKey applies equality check predicate on the "feature_key" field. It's identical to FeatureKeyEQ.func FeatureKey(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldFeatureKey, v))}
// SubscriptionID applies equality check predicate on the "subscription_id" field. It's identical to SubscriptionIDEQ.func SubscriptionID(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldSubscriptionID, v))}
// SubscriptionPhaseID applies equality check predicate on the "subscription_phase_id" field. It's identical to SubscriptionPhaseIDEQ.func SubscriptionPhaseID(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldSubscriptionPhaseID, v))}
// SubscriptionItemID applies equality check predicate on the "subscription_item_id" field. It's identical to SubscriptionItemIDEQ.func SubscriptionItemID(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldSubscriptionItemID, v))}
// SubscriptionBillingPeriodFrom applies equality check predicate on the "subscription_billing_period_from" field. It's identical to SubscriptionBillingPeriodFromEQ.func SubscriptionBillingPeriodFrom(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldSubscriptionBillingPeriodFrom, v))}
// SubscriptionBillingPeriodTo applies equality check predicate on the "subscription_billing_period_to" field. It's identical to SubscriptionBillingPeriodToEQ.func SubscriptionBillingPeriodTo(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldSubscriptionBillingPeriodTo, v))}
// ChargeID applies equality check predicate on the "charge_id" field. It's identical to ChargeIDEQ.func ChargeID(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldChargeID, v))}
// NamespaceEQ applies the EQ predicate on the "namespace" field.func NamespaceEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldNamespace, v))}
// NamespaceNEQ applies the NEQ predicate on the "namespace" field.func NamespaceNEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldNamespace, v))}
// NamespaceIn applies the In predicate on the "namespace" field.func NamespaceIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldNamespace, vs...))}
// NamespaceNotIn applies the NotIn predicate on the "namespace" field.func NamespaceNotIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldNamespace, vs...))}
// NamespaceGT applies the GT predicate on the "namespace" field.func NamespaceGT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldNamespace, v))}
// NamespaceGTE applies the GTE predicate on the "namespace" field.func NamespaceGTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldNamespace, v))}
// NamespaceLT applies the LT predicate on the "namespace" field.func NamespaceLT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldNamespace, v))}
// NamespaceLTE applies the LTE predicate on the "namespace" field.func NamespaceLTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldNamespace, v))}
// NamespaceContains applies the Contains predicate on the "namespace" field.func NamespaceContains(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContains(FieldNamespace, v))}
// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field.func NamespaceHasPrefix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasPrefix(FieldNamespace, v))}
// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field.func NamespaceHasSuffix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasSuffix(FieldNamespace, v))}
// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field.func NamespaceEqualFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldNamespace, v))}
// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field.func NamespaceContainsFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldNamespace, v))}
// MetadataIsNil applies the IsNil predicate on the "metadata" field.func MetadataIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldMetadata))}
// MetadataNotNil applies the NotNil predicate on the "metadata" field.func MetadataNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldMetadata))}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.func CreatedAtEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldCreatedAt, v))}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.func CreatedAtNEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldCreatedAt, v))}
// CreatedAtIn applies the In predicate on the "created_at" field.func CreatedAtIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldCreatedAt, vs...))}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.func CreatedAtNotIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldCreatedAt, vs...))}
// CreatedAtGT applies the GT predicate on the "created_at" field.func CreatedAtGT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldCreatedAt, v))}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.func CreatedAtGTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldCreatedAt, v))}
// CreatedAtLT applies the LT predicate on the "created_at" field.func CreatedAtLT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldCreatedAt, v))}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.func CreatedAtLTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldCreatedAt, v))}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.func UpdatedAtEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldUpdatedAt, v))}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.func UpdatedAtNEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldUpdatedAt, v))}
// UpdatedAtIn applies the In predicate on the "updated_at" field.func UpdatedAtIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldUpdatedAt, vs...))}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.func UpdatedAtNotIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldUpdatedAt, vs...))}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.func UpdatedAtGT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldUpdatedAt, v))}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.func UpdatedAtGTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldUpdatedAt, v))}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.func UpdatedAtLT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldUpdatedAt, v))}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.func UpdatedAtLTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldUpdatedAt, v))}
// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.func DeletedAtEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldDeletedAt, v))}
// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.func DeletedAtNEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldDeletedAt, v))}
// DeletedAtIn applies the In predicate on the "deleted_at" field.func DeletedAtIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldDeletedAt, vs...))}
// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.func DeletedAtNotIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldDeletedAt, vs...))}
// DeletedAtGT applies the GT predicate on the "deleted_at" field.func DeletedAtGT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldDeletedAt, v))}
// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.func DeletedAtGTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldDeletedAt, v))}
// DeletedAtLT applies the LT predicate on the "deleted_at" field.func DeletedAtLT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldDeletedAt, v))}
// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.func DeletedAtLTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldDeletedAt, v))}
// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.func DeletedAtIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldDeletedAt))}
// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.func DeletedAtNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldDeletedAt))}
// NameEQ applies the EQ predicate on the "name" field.func NameEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldName, v))}
// NameNEQ applies the NEQ predicate on the "name" field.func NameNEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldName, v))}
// NameIn applies the In predicate on the "name" field.func NameIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldName, vs...))}
// NameNotIn applies the NotIn predicate on the "name" field.func NameNotIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldName, vs...))}
// NameGT applies the GT predicate on the "name" field.func NameGT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldName, v))}
// NameGTE applies the GTE predicate on the "name" field.func NameGTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldName, v))}
// NameLT applies the LT predicate on the "name" field.func NameLT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldName, v))}
// NameLTE applies the LTE predicate on the "name" field.func NameLTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldName, v))}
// NameContains applies the Contains predicate on the "name" field.func NameContains(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContains(FieldName, v))}
// NameHasPrefix applies the HasPrefix predicate on the "name" field.func NameHasPrefix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasPrefix(FieldName, v))}
// NameHasSuffix applies the HasSuffix predicate on the "name" field.func NameHasSuffix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasSuffix(FieldName, v))}
// NameEqualFold applies the EqualFold predicate on the "name" field.func NameEqualFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldName, v))}
// NameContainsFold applies the ContainsFold predicate on the "name" field.func NameContainsFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldName, v))}
// DescriptionEQ applies the EQ predicate on the "description" field.func DescriptionEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldDescription, v))}
// DescriptionNEQ applies the NEQ predicate on the "description" field.func DescriptionNEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldDescription, v))}
// DescriptionIn applies the In predicate on the "description" field.func DescriptionIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldDescription, vs...))}
// DescriptionNotIn applies the NotIn predicate on the "description" field.func DescriptionNotIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldDescription, vs...))}
// DescriptionGT applies the GT predicate on the "description" field.func DescriptionGT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldDescription, v))}
// DescriptionGTE applies the GTE predicate on the "description" field.func DescriptionGTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldDescription, v))}
// DescriptionLT applies the LT predicate on the "description" field.func DescriptionLT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldDescription, v))}
// DescriptionLTE applies the LTE predicate on the "description" field.func DescriptionLTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldDescription, v))}
// DescriptionContains applies the Contains predicate on the "description" field.func DescriptionContains(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContains(FieldDescription, v))}
// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field.func DescriptionHasPrefix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasPrefix(FieldDescription, v))}
// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field.func DescriptionHasSuffix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasSuffix(FieldDescription, v))}
// DescriptionIsNil applies the IsNil predicate on the "description" field.func DescriptionIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldDescription))}
// DescriptionNotNil applies the NotNil predicate on the "description" field.func DescriptionNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldDescription))}
// DescriptionEqualFold applies the EqualFold predicate on the "description" field.func DescriptionEqualFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldDescription, v))}
// DescriptionContainsFold applies the ContainsFold predicate on the "description" field.func DescriptionContainsFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldDescription, v))}
// CurrencyEQ applies the EQ predicate on the "currency" field.func CurrencyEQ(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldCurrency, vc))}
// CurrencyNEQ applies the NEQ predicate on the "currency" field.func CurrencyNEQ(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldCurrency, vc))}
// CurrencyIn applies the In predicate on the "currency" field.func CurrencyIn(vs ...currencyx.Code) predicate.BillingInvoiceSplitLineGroup { v := make([]any, len(vs)) for i := range v { v[i] = string(vs[i]) } return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldCurrency, v...))}
// CurrencyNotIn applies the NotIn predicate on the "currency" field.func CurrencyNotIn(vs ...currencyx.Code) predicate.BillingInvoiceSplitLineGroup { v := make([]any, len(vs)) for i := range v { v[i] = string(vs[i]) } return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldCurrency, v...))}
// CurrencyGT applies the GT predicate on the "currency" field.func CurrencyGT(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldCurrency, vc))}
// CurrencyGTE applies the GTE predicate on the "currency" field.func CurrencyGTE(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldCurrency, vc))}
// CurrencyLT applies the LT predicate on the "currency" field.func CurrencyLT(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldCurrency, vc))}
// CurrencyLTE applies the LTE predicate on the "currency" field.func CurrencyLTE(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldCurrency, vc))}
// CurrencyContains applies the Contains predicate on the "currency" field.func CurrencyContains(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldContains(FieldCurrency, vc))}
// CurrencyHasPrefix applies the HasPrefix predicate on the "currency" field.func CurrencyHasPrefix(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasPrefix(FieldCurrency, vc))}
// CurrencyHasSuffix applies the HasSuffix predicate on the "currency" field.func CurrencyHasSuffix(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasSuffix(FieldCurrency, vc))}
// CurrencyEqualFold applies the EqualFold predicate on the "currency" field.func CurrencyEqualFold(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldCurrency, vc))}
// CurrencyContainsFold applies the ContainsFold predicate on the "currency" field.func CurrencyContainsFold(v currencyx.Code) predicate.BillingInvoiceSplitLineGroup { vc := string(v) return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldCurrency, vc))}
// ServicePeriodStartEQ applies the EQ predicate on the "service_period_start" field.func ServicePeriodStartEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldServicePeriodStart, v))}
// ServicePeriodStartNEQ applies the NEQ predicate on the "service_period_start" field.func ServicePeriodStartNEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldServicePeriodStart, v))}
// ServicePeriodStartIn applies the In predicate on the "service_period_start" field.func ServicePeriodStartIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldServicePeriodStart, vs...))}
// ServicePeriodStartNotIn applies the NotIn predicate on the "service_period_start" field.func ServicePeriodStartNotIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldServicePeriodStart, vs...))}
// ServicePeriodStartGT applies the GT predicate on the "service_period_start" field.func ServicePeriodStartGT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldServicePeriodStart, v))}
// ServicePeriodStartGTE applies the GTE predicate on the "service_period_start" field.func ServicePeriodStartGTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldServicePeriodStart, v))}
// ServicePeriodStartLT applies the LT predicate on the "service_period_start" field.func ServicePeriodStartLT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldServicePeriodStart, v))}
// ServicePeriodStartLTE applies the LTE predicate on the "service_period_start" field.func ServicePeriodStartLTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldServicePeriodStart, v))}
// ServicePeriodEndEQ applies the EQ predicate on the "service_period_end" field.func ServicePeriodEndEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldServicePeriodEnd, v))}
// ServicePeriodEndNEQ applies the NEQ predicate on the "service_period_end" field.func ServicePeriodEndNEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldServicePeriodEnd, v))}
// ServicePeriodEndIn applies the In predicate on the "service_period_end" field.func ServicePeriodEndIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldServicePeriodEnd, vs...))}
// ServicePeriodEndNotIn applies the NotIn predicate on the "service_period_end" field.func ServicePeriodEndNotIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldServicePeriodEnd, vs...))}
// ServicePeriodEndGT applies the GT predicate on the "service_period_end" field.func ServicePeriodEndGT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldServicePeriodEnd, v))}
// ServicePeriodEndGTE applies the GTE predicate on the "service_period_end" field.func ServicePeriodEndGTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldServicePeriodEnd, v))}
// ServicePeriodEndLT applies the LT predicate on the "service_period_end" field.func ServicePeriodEndLT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldServicePeriodEnd, v))}
// ServicePeriodEndLTE applies the LTE predicate on the "service_period_end" field.func ServicePeriodEndLTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldServicePeriodEnd, v))}
// UniqueReferenceIDEQ applies the EQ predicate on the "unique_reference_id" field.func UniqueReferenceIDEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldUniqueReferenceID, v))}
// UniqueReferenceIDNEQ applies the NEQ predicate on the "unique_reference_id" field.func UniqueReferenceIDNEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldUniqueReferenceID, v))}
// UniqueReferenceIDIn applies the In predicate on the "unique_reference_id" field.func UniqueReferenceIDIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldUniqueReferenceID, vs...))}
// UniqueReferenceIDNotIn applies the NotIn predicate on the "unique_reference_id" field.func UniqueReferenceIDNotIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldUniqueReferenceID, vs...))}
// UniqueReferenceIDGT applies the GT predicate on the "unique_reference_id" field.func UniqueReferenceIDGT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldUniqueReferenceID, v))}
// UniqueReferenceIDGTE applies the GTE predicate on the "unique_reference_id" field.func UniqueReferenceIDGTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldUniqueReferenceID, v))}
// UniqueReferenceIDLT applies the LT predicate on the "unique_reference_id" field.func UniqueReferenceIDLT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldUniqueReferenceID, v))}
// UniqueReferenceIDLTE applies the LTE predicate on the "unique_reference_id" field.func UniqueReferenceIDLTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldUniqueReferenceID, v))}
// UniqueReferenceIDContains applies the Contains predicate on the "unique_reference_id" field.func UniqueReferenceIDContains(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContains(FieldUniqueReferenceID, v))}
// UniqueReferenceIDHasPrefix applies the HasPrefix predicate on the "unique_reference_id" field.func UniqueReferenceIDHasPrefix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasPrefix(FieldUniqueReferenceID, v))}
// UniqueReferenceIDHasSuffix applies the HasSuffix predicate on the "unique_reference_id" field.func UniqueReferenceIDHasSuffix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasSuffix(FieldUniqueReferenceID, v))}
// UniqueReferenceIDIsNil applies the IsNil predicate on the "unique_reference_id" field.func UniqueReferenceIDIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldUniqueReferenceID))}
// UniqueReferenceIDNotNil applies the NotNil predicate on the "unique_reference_id" field.func UniqueReferenceIDNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldUniqueReferenceID))}
// UniqueReferenceIDEqualFold applies the EqualFold predicate on the "unique_reference_id" field.func UniqueReferenceIDEqualFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldUniqueReferenceID, v))}
// UniqueReferenceIDContainsFold applies the ContainsFold predicate on the "unique_reference_id" field.func UniqueReferenceIDContainsFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldUniqueReferenceID, v))}
// RatecardDiscountsIsNil applies the IsNil predicate on the "ratecard_discounts" field.func RatecardDiscountsIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldRatecardDiscounts))}
// RatecardDiscountsNotNil applies the NotNil predicate on the "ratecard_discounts" field.func RatecardDiscountsNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldRatecardDiscounts))}
// FeatureKeyEQ applies the EQ predicate on the "feature_key" field.func FeatureKeyEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldFeatureKey, v))}
// FeatureKeyNEQ applies the NEQ predicate on the "feature_key" field.func FeatureKeyNEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldFeatureKey, v))}
// FeatureKeyIn applies the In predicate on the "feature_key" field.func FeatureKeyIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldFeatureKey, vs...))}
// FeatureKeyNotIn applies the NotIn predicate on the "feature_key" field.func FeatureKeyNotIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldFeatureKey, vs...))}
// FeatureKeyGT applies the GT predicate on the "feature_key" field.func FeatureKeyGT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldFeatureKey, v))}
// FeatureKeyGTE applies the GTE predicate on the "feature_key" field.func FeatureKeyGTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldFeatureKey, v))}
// FeatureKeyLT applies the LT predicate on the "feature_key" field.func FeatureKeyLT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldFeatureKey, v))}
// FeatureKeyLTE applies the LTE predicate on the "feature_key" field.func FeatureKeyLTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldFeatureKey, v))}
// FeatureKeyContains applies the Contains predicate on the "feature_key" field.func FeatureKeyContains(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContains(FieldFeatureKey, v))}
// FeatureKeyHasPrefix applies the HasPrefix predicate on the "feature_key" field.func FeatureKeyHasPrefix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasPrefix(FieldFeatureKey, v))}
// FeatureKeyHasSuffix applies the HasSuffix predicate on the "feature_key" field.func FeatureKeyHasSuffix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasSuffix(FieldFeatureKey, v))}
// FeatureKeyIsNil applies the IsNil predicate on the "feature_key" field.func FeatureKeyIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldFeatureKey))}
// FeatureKeyNotNil applies the NotNil predicate on the "feature_key" field.func FeatureKeyNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldFeatureKey))}
// FeatureKeyEqualFold applies the EqualFold predicate on the "feature_key" field.func FeatureKeyEqualFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldFeatureKey, v))}
// FeatureKeyContainsFold applies the ContainsFold predicate on the "feature_key" field.func FeatureKeyContainsFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldFeatureKey, v))}
// SubscriptionIDEQ applies the EQ predicate on the "subscription_id" field.func SubscriptionIDEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldSubscriptionID, v))}
// SubscriptionIDNEQ applies the NEQ predicate on the "subscription_id" field.func SubscriptionIDNEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldSubscriptionID, v))}
// SubscriptionIDIn applies the In predicate on the "subscription_id" field.func SubscriptionIDIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldSubscriptionID, vs...))}
// SubscriptionIDNotIn applies the NotIn predicate on the "subscription_id" field.func SubscriptionIDNotIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldSubscriptionID, vs...))}
// SubscriptionIDGT applies the GT predicate on the "subscription_id" field.func SubscriptionIDGT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldSubscriptionID, v))}
// SubscriptionIDGTE applies the GTE predicate on the "subscription_id" field.func SubscriptionIDGTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldSubscriptionID, v))}
// SubscriptionIDLT applies the LT predicate on the "subscription_id" field.func SubscriptionIDLT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldSubscriptionID, v))}
// SubscriptionIDLTE applies the LTE predicate on the "subscription_id" field.func SubscriptionIDLTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldSubscriptionID, v))}
// SubscriptionIDContains applies the Contains predicate on the "subscription_id" field.func SubscriptionIDContains(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContains(FieldSubscriptionID, v))}
// SubscriptionIDHasPrefix applies the HasPrefix predicate on the "subscription_id" field.func SubscriptionIDHasPrefix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasPrefix(FieldSubscriptionID, v))}
// SubscriptionIDHasSuffix applies the HasSuffix predicate on the "subscription_id" field.func SubscriptionIDHasSuffix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasSuffix(FieldSubscriptionID, v))}
// SubscriptionIDIsNil applies the IsNil predicate on the "subscription_id" field.func SubscriptionIDIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldSubscriptionID))}
// SubscriptionIDNotNil applies the NotNil predicate on the "subscription_id" field.func SubscriptionIDNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldSubscriptionID))}
// SubscriptionIDEqualFold applies the EqualFold predicate on the "subscription_id" field.func SubscriptionIDEqualFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldSubscriptionID, v))}
// SubscriptionIDContainsFold applies the ContainsFold predicate on the "subscription_id" field.func SubscriptionIDContainsFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldSubscriptionID, v))}
// SubscriptionPhaseIDEQ applies the EQ predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldSubscriptionPhaseID, v))}
// SubscriptionPhaseIDNEQ applies the NEQ predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDNEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldSubscriptionPhaseID, v))}
// SubscriptionPhaseIDIn applies the In predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldSubscriptionPhaseID, vs...))}
// SubscriptionPhaseIDNotIn applies the NotIn predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDNotIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldSubscriptionPhaseID, vs...))}
// SubscriptionPhaseIDGT applies the GT predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDGT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldSubscriptionPhaseID, v))}
// SubscriptionPhaseIDGTE applies the GTE predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDGTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldSubscriptionPhaseID, v))}
// SubscriptionPhaseIDLT applies the LT predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDLT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldSubscriptionPhaseID, v))}
// SubscriptionPhaseIDLTE applies the LTE predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDLTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldSubscriptionPhaseID, v))}
// SubscriptionPhaseIDContains applies the Contains predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDContains(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContains(FieldSubscriptionPhaseID, v))}
// SubscriptionPhaseIDHasPrefix applies the HasPrefix predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDHasPrefix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasPrefix(FieldSubscriptionPhaseID, v))}
// SubscriptionPhaseIDHasSuffix applies the HasSuffix predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDHasSuffix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasSuffix(FieldSubscriptionPhaseID, v))}
// SubscriptionPhaseIDIsNil applies the IsNil predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldSubscriptionPhaseID))}
// SubscriptionPhaseIDNotNil applies the NotNil predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldSubscriptionPhaseID))}
// SubscriptionPhaseIDEqualFold applies the EqualFold predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDEqualFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldSubscriptionPhaseID, v))}
// SubscriptionPhaseIDContainsFold applies the ContainsFold predicate on the "subscription_phase_id" field.func SubscriptionPhaseIDContainsFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldSubscriptionPhaseID, v))}
// SubscriptionItemIDEQ applies the EQ predicate on the "subscription_item_id" field.func SubscriptionItemIDEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldSubscriptionItemID, v))}
// SubscriptionItemIDNEQ applies the NEQ predicate on the "subscription_item_id" field.func SubscriptionItemIDNEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldSubscriptionItemID, v))}
// SubscriptionItemIDIn applies the In predicate on the "subscription_item_id" field.func SubscriptionItemIDIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldSubscriptionItemID, vs...))}
// SubscriptionItemIDNotIn applies the NotIn predicate on the "subscription_item_id" field.func SubscriptionItemIDNotIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldSubscriptionItemID, vs...))}
// SubscriptionItemIDGT applies the GT predicate on the "subscription_item_id" field.func SubscriptionItemIDGT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldSubscriptionItemID, v))}
// SubscriptionItemIDGTE applies the GTE predicate on the "subscription_item_id" field.func SubscriptionItemIDGTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldSubscriptionItemID, v))}
// SubscriptionItemIDLT applies the LT predicate on the "subscription_item_id" field.func SubscriptionItemIDLT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldSubscriptionItemID, v))}
// SubscriptionItemIDLTE applies the LTE predicate on the "subscription_item_id" field.func SubscriptionItemIDLTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldSubscriptionItemID, v))}
// SubscriptionItemIDContains applies the Contains predicate on the "subscription_item_id" field.func SubscriptionItemIDContains(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContains(FieldSubscriptionItemID, v))}
// SubscriptionItemIDHasPrefix applies the HasPrefix predicate on the "subscription_item_id" field.func SubscriptionItemIDHasPrefix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasPrefix(FieldSubscriptionItemID, v))}
// SubscriptionItemIDHasSuffix applies the HasSuffix predicate on the "subscription_item_id" field.func SubscriptionItemIDHasSuffix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasSuffix(FieldSubscriptionItemID, v))}
// SubscriptionItemIDIsNil applies the IsNil predicate on the "subscription_item_id" field.func SubscriptionItemIDIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldSubscriptionItemID))}
// SubscriptionItemIDNotNil applies the NotNil predicate on the "subscription_item_id" field.func SubscriptionItemIDNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldSubscriptionItemID))}
// SubscriptionItemIDEqualFold applies the EqualFold predicate on the "subscription_item_id" field.func SubscriptionItemIDEqualFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldSubscriptionItemID, v))}
// SubscriptionItemIDContainsFold applies the ContainsFold predicate on the "subscription_item_id" field.func SubscriptionItemIDContainsFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldSubscriptionItemID, v))}
// SubscriptionBillingPeriodFromEQ applies the EQ predicate on the "subscription_billing_period_from" field.func SubscriptionBillingPeriodFromEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldSubscriptionBillingPeriodFrom, v))}
// SubscriptionBillingPeriodFromNEQ applies the NEQ predicate on the "subscription_billing_period_from" field.func SubscriptionBillingPeriodFromNEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldSubscriptionBillingPeriodFrom, v))}
// SubscriptionBillingPeriodFromIn applies the In predicate on the "subscription_billing_period_from" field.func SubscriptionBillingPeriodFromIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldSubscriptionBillingPeriodFrom, vs...))}
// SubscriptionBillingPeriodFromNotIn applies the NotIn predicate on the "subscription_billing_period_from" field.func SubscriptionBillingPeriodFromNotIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldSubscriptionBillingPeriodFrom, vs...))}
// SubscriptionBillingPeriodFromGT applies the GT predicate on the "subscription_billing_period_from" field.func SubscriptionBillingPeriodFromGT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldSubscriptionBillingPeriodFrom, v))}
// SubscriptionBillingPeriodFromGTE applies the GTE predicate on the "subscription_billing_period_from" field.func SubscriptionBillingPeriodFromGTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldSubscriptionBillingPeriodFrom, v))}
// SubscriptionBillingPeriodFromLT applies the LT predicate on the "subscription_billing_period_from" field.func SubscriptionBillingPeriodFromLT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldSubscriptionBillingPeriodFrom, v))}
// SubscriptionBillingPeriodFromLTE applies the LTE predicate on the "subscription_billing_period_from" field.func SubscriptionBillingPeriodFromLTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldSubscriptionBillingPeriodFrom, v))}
// SubscriptionBillingPeriodFromIsNil applies the IsNil predicate on the "subscription_billing_period_from" field.func SubscriptionBillingPeriodFromIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldSubscriptionBillingPeriodFrom))}
// SubscriptionBillingPeriodFromNotNil applies the NotNil predicate on the "subscription_billing_period_from" field.func SubscriptionBillingPeriodFromNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldSubscriptionBillingPeriodFrom))}
// SubscriptionBillingPeriodToEQ applies the EQ predicate on the "subscription_billing_period_to" field.func SubscriptionBillingPeriodToEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldSubscriptionBillingPeriodTo, v))}
// SubscriptionBillingPeriodToNEQ applies the NEQ predicate on the "subscription_billing_period_to" field.func SubscriptionBillingPeriodToNEQ(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldSubscriptionBillingPeriodTo, v))}
// SubscriptionBillingPeriodToIn applies the In predicate on the "subscription_billing_period_to" field.func SubscriptionBillingPeriodToIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldSubscriptionBillingPeriodTo, vs...))}
// SubscriptionBillingPeriodToNotIn applies the NotIn predicate on the "subscription_billing_period_to" field.func SubscriptionBillingPeriodToNotIn(vs ...time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldSubscriptionBillingPeriodTo, vs...))}
// SubscriptionBillingPeriodToGT applies the GT predicate on the "subscription_billing_period_to" field.func SubscriptionBillingPeriodToGT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldSubscriptionBillingPeriodTo, v))}
// SubscriptionBillingPeriodToGTE applies the GTE predicate on the "subscription_billing_period_to" field.func SubscriptionBillingPeriodToGTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldSubscriptionBillingPeriodTo, v))}
// SubscriptionBillingPeriodToLT applies the LT predicate on the "subscription_billing_period_to" field.func SubscriptionBillingPeriodToLT(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldSubscriptionBillingPeriodTo, v))}
// SubscriptionBillingPeriodToLTE applies the LTE predicate on the "subscription_billing_period_to" field.func SubscriptionBillingPeriodToLTE(v time.Time) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldSubscriptionBillingPeriodTo, v))}
// SubscriptionBillingPeriodToIsNil applies the IsNil predicate on the "subscription_billing_period_to" field.func SubscriptionBillingPeriodToIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldSubscriptionBillingPeriodTo))}
// SubscriptionBillingPeriodToNotNil applies the NotNil predicate on the "subscription_billing_period_to" field.func SubscriptionBillingPeriodToNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldSubscriptionBillingPeriodTo))}
// ChargeIDEQ applies the EQ predicate on the "charge_id" field.func ChargeIDEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEQ(FieldChargeID, v))}
// ChargeIDNEQ applies the NEQ predicate on the "charge_id" field.func ChargeIDNEQ(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNEQ(FieldChargeID, v))}
// ChargeIDIn applies the In predicate on the "charge_id" field.func ChargeIDIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIn(FieldChargeID, vs...))}
// ChargeIDNotIn applies the NotIn predicate on the "charge_id" field.func ChargeIDNotIn(vs ...string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotIn(FieldChargeID, vs...))}
// ChargeIDGT applies the GT predicate on the "charge_id" field.func ChargeIDGT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGT(FieldChargeID, v))}
// ChargeIDGTE applies the GTE predicate on the "charge_id" field.func ChargeIDGTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldGTE(FieldChargeID, v))}
// ChargeIDLT applies the LT predicate on the "charge_id" field.func ChargeIDLT(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLT(FieldChargeID, v))}
// ChargeIDLTE applies the LTE predicate on the "charge_id" field.func ChargeIDLTE(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldLTE(FieldChargeID, v))}
// ChargeIDContains applies the Contains predicate on the "charge_id" field.func ChargeIDContains(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContains(FieldChargeID, v))}
// ChargeIDHasPrefix applies the HasPrefix predicate on the "charge_id" field.func ChargeIDHasPrefix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasPrefix(FieldChargeID, v))}
// ChargeIDHasSuffix applies the HasSuffix predicate on the "charge_id" field.func ChargeIDHasSuffix(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldHasSuffix(FieldChargeID, v))}
// ChargeIDIsNil applies the IsNil predicate on the "charge_id" field.func ChargeIDIsNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldIsNull(FieldChargeID))}
// ChargeIDNotNil applies the NotNil predicate on the "charge_id" field.func ChargeIDNotNil() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldNotNull(FieldChargeID))}
// ChargeIDEqualFold applies the EqualFold predicate on the "charge_id" field.func ChargeIDEqualFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldEqualFold(FieldChargeID, v))}
// ChargeIDContainsFold applies the ContainsFold predicate on the "charge_id" field.func ChargeIDContainsFold(v string) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.FieldContainsFold(FieldChargeID, v))}
// HasBillingInvoiceLines applies the HasEdge predicate on the "billing_invoice_lines" edge.func HasBillingInvoiceLines() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceLinesTable, BillingInvoiceLinesColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasBillingInvoiceLinesWith applies the HasEdge predicate on the "billing_invoice_lines" edge with a given conditions (other predicates).func HasBillingInvoiceLinesWith(preds ...predicate.BillingInvoiceLine) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(func(s *sql.Selector) { step := newBillingInvoiceLinesStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// HasSubscription applies the HasEdge predicate on the "subscription" edge.func HasSubscription() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionTable, SubscriptionColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasSubscriptionWith applies the HasEdge predicate on the "subscription" edge with a given conditions (other predicates).func HasSubscriptionWith(preds ...predicate.Subscription) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(func(s *sql.Selector) { step := newSubscriptionStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// HasSubscriptionPhase applies the HasEdge predicate on the "subscription_phase" edge.func HasSubscriptionPhase() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionPhaseTable, SubscriptionPhaseColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasSubscriptionPhaseWith applies the HasEdge predicate on the "subscription_phase" edge with a given conditions (other predicates).func HasSubscriptionPhaseWith(preds ...predicate.SubscriptionPhase) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(func(s *sql.Selector) { step := newSubscriptionPhaseStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// HasSubscriptionItem applies the HasEdge predicate on the "subscription_item" edge.func HasSubscriptionItem() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionItemTable, SubscriptionItemColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasSubscriptionItemWith applies the HasEdge predicate on the "subscription_item" edge with a given conditions (other predicates).func HasSubscriptionItemWith(preds ...predicate.SubscriptionItem) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(func(s *sql.Selector) { step := newSubscriptionItemStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// HasCharge applies the HasEdge predicate on the "charge" edge.func HasCharge() predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, ChargeTable, ChargeColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasChargeWith applies the HasEdge predicate on the "charge" edge with a given conditions (other predicates).func HasChargeWith(preds ...predicate.Charge) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(func(s *sql.Selector) { step := newChargeStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// And groups predicates with the AND operator between them.func And(predicates ...predicate.BillingInvoiceSplitLineGroup) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.AndPredicates(predicates...))}
// Or groups predicates with the OR operator between them.func Or(predicates ...predicate.BillingInvoiceSplitLineGroup) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.OrPredicates(predicates...))}
// Not applies the not operator on the given predicate.func Not(p predicate.BillingInvoiceSplitLineGroup) predicate.BillingInvoiceSplitLineGroup { return predicate.BillingInvoiceSplitLineGroup(sql.NotPredicates(p))}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt" "time"
"entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicesplitlinegroup" "github.com/openmeterio/openmeter/openmeter/ent/db/charge" "github.com/openmeterio/openmeter/openmeter/ent/db/subscription" "github.com/openmeterio/openmeter/openmeter/ent/db/subscriptionitem" "github.com/openmeterio/openmeter/openmeter/ent/db/subscriptionphase" "github.com/openmeterio/openmeter/openmeter/productcatalog" "github.com/openmeterio/openmeter/pkg/currencyx")
// BillingInvoiceSplitLineGroupCreate is the builder for creating a BillingInvoiceSplitLineGroup entity.type BillingInvoiceSplitLineGroupCreate struct { config mutation *BillingInvoiceSplitLineGroupMutation hooks []Hook conflict []sql.ConflictOption}
// SetNamespace sets the "namespace" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetNamespace(v string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetNamespace(v) return _c}
// SetMetadata sets the "metadata" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetMetadata(v map[string]string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetMetadata(v) return _c}
// SetCreatedAt sets the "created_at" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetCreatedAt(v time.Time) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetCreatedAt(v) return _c}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableCreatedAt(v *time.Time) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetCreatedAt(*v) } return _c}
// SetUpdatedAt sets the "updated_at" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetUpdatedAt(v time.Time) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetUpdatedAt(v) return _c}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableUpdatedAt(v *time.Time) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetUpdatedAt(*v) } return _c}
// SetDeletedAt sets the "deleted_at" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetDeletedAt(v time.Time) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetDeletedAt(v) return _c}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableDeletedAt(v *time.Time) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetDeletedAt(*v) } return _c}
// SetName sets the "name" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetName(v string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetName(v) return _c}
// SetDescription sets the "description" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetDescription(v string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetDescription(v) return _c}
// SetNillableDescription sets the "description" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableDescription(v *string) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetDescription(*v) } return _c}
// SetCurrency sets the "currency" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetCurrency(v currencyx.Code) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetCurrency(v) return _c}
// SetServicePeriodStart sets the "service_period_start" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetServicePeriodStart(v time.Time) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetServicePeriodStart(v) return _c}
// SetServicePeriodEnd sets the "service_period_end" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetServicePeriodEnd(v time.Time) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetServicePeriodEnd(v) return _c}
// SetUniqueReferenceID sets the "unique_reference_id" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetUniqueReferenceID(v string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetUniqueReferenceID(v) return _c}
// SetNillableUniqueReferenceID sets the "unique_reference_id" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableUniqueReferenceID(v *string) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetUniqueReferenceID(*v) } return _c}
// SetRatecardDiscounts sets the "ratecard_discounts" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetRatecardDiscounts(v *billing.Discounts) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetRatecardDiscounts(v) return _c}
// SetFeatureKey sets the "feature_key" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetFeatureKey(v string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetFeatureKey(v) return _c}
// SetNillableFeatureKey sets the "feature_key" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableFeatureKey(v *string) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetFeatureKey(*v) } return _c}
// SetPrice sets the "price" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetPrice(v *productcatalog.Price) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetPrice(v) return _c}
// SetSubscriptionID sets the "subscription_id" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetSubscriptionID(v string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetSubscriptionID(v) return _c}
// SetNillableSubscriptionID sets the "subscription_id" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableSubscriptionID(v *string) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetSubscriptionID(*v) } return _c}
// SetSubscriptionPhaseID sets the "subscription_phase_id" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetSubscriptionPhaseID(v string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetSubscriptionPhaseID(v) return _c}
// SetNillableSubscriptionPhaseID sets the "subscription_phase_id" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableSubscriptionPhaseID(v *string) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetSubscriptionPhaseID(*v) } return _c}
// SetSubscriptionItemID sets the "subscription_item_id" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetSubscriptionItemID(v string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetSubscriptionItemID(v) return _c}
// SetNillableSubscriptionItemID sets the "subscription_item_id" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableSubscriptionItemID(v *string) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetSubscriptionItemID(*v) } return _c}
// SetSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetSubscriptionBillingPeriodFrom(v time.Time) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetSubscriptionBillingPeriodFrom(v) return _c}
// SetNillableSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableSubscriptionBillingPeriodFrom(v *time.Time) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetSubscriptionBillingPeriodFrom(*v) } return _c}
// SetSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetSubscriptionBillingPeriodTo(v time.Time) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetSubscriptionBillingPeriodTo(v) return _c}
// SetNillableSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableSubscriptionBillingPeriodTo(v *time.Time) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetSubscriptionBillingPeriodTo(*v) } return _c}
// SetChargeID sets the "charge_id" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetChargeID(v string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetChargeID(v) return _c}
// SetNillableChargeID sets the "charge_id" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableChargeID(v *string) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetChargeID(*v) } return _c}
// SetID sets the "id" field.func (_c *BillingInvoiceSplitLineGroupCreate) SetID(v string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.SetID(v) return _c}
// SetNillableID sets the "id" field if the given value is not nil.func (_c *BillingInvoiceSplitLineGroupCreate) SetNillableID(v *string) *BillingInvoiceSplitLineGroupCreate { if v != nil { _c.SetID(*v) } return _c}
// AddBillingInvoiceLineIDs adds the "billing_invoice_lines" edge to the BillingInvoiceLine entity by IDs.func (_c *BillingInvoiceSplitLineGroupCreate) AddBillingInvoiceLineIDs(ids ...string) *BillingInvoiceSplitLineGroupCreate { _c.mutation.AddBillingInvoiceLineIDs(ids...) return _c}
// AddBillingInvoiceLines adds the "billing_invoice_lines" edges to the BillingInvoiceLine entity.func (_c *BillingInvoiceSplitLineGroupCreate) AddBillingInvoiceLines(v ...*BillingInvoiceLine) *BillingInvoiceSplitLineGroupCreate { ids := make([]string, len(v)) for i := range v { ids[i] = v[i].ID } return _c.AddBillingInvoiceLineIDs(ids...)}
// SetSubscription sets the "subscription" edge to the Subscription entity.func (_c *BillingInvoiceSplitLineGroupCreate) SetSubscription(v *Subscription) *BillingInvoiceSplitLineGroupCreate { return _c.SetSubscriptionID(v.ID)}
// SetSubscriptionPhase sets the "subscription_phase" edge to the SubscriptionPhase entity.func (_c *BillingInvoiceSplitLineGroupCreate) SetSubscriptionPhase(v *SubscriptionPhase) *BillingInvoiceSplitLineGroupCreate { return _c.SetSubscriptionPhaseID(v.ID)}
// SetSubscriptionItem sets the "subscription_item" edge to the SubscriptionItem entity.func (_c *BillingInvoiceSplitLineGroupCreate) SetSubscriptionItem(v *SubscriptionItem) *BillingInvoiceSplitLineGroupCreate { return _c.SetSubscriptionItemID(v.ID)}
// SetCharge sets the "charge" edge to the Charge entity.func (_c *BillingInvoiceSplitLineGroupCreate) SetCharge(v *Charge) *BillingInvoiceSplitLineGroupCreate { return _c.SetChargeID(v.ID)}
// Mutation returns the BillingInvoiceSplitLineGroupMutation object of the builder.func (_c *BillingInvoiceSplitLineGroupCreate) Mutation() *BillingInvoiceSplitLineGroupMutation { return _c.mutation}
// Save creates the BillingInvoiceSplitLineGroup in the database.func (_c *BillingInvoiceSplitLineGroupCreate) Save(ctx context.Context) (*BillingInvoiceSplitLineGroup, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)}
// SaveX calls Save and panics if Save returns an error.func (_c *BillingInvoiceSplitLineGroupCreate) SaveX(ctx context.Context) *BillingInvoiceSplitLineGroup { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceSplitLineGroupCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceSplitLineGroupCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_c *BillingInvoiceSplitLineGroupCreate) defaults() { if _, ok := _c.mutation.CreatedAt(); !ok { v := billinginvoicesplitlinegroup.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } if _, ok := _c.mutation.UpdatedAt(); !ok { v := billinginvoicesplitlinegroup.DefaultUpdatedAt() _c.mutation.SetUpdatedAt(v) } if _, ok := _c.mutation.ID(); !ok { v := billinginvoicesplitlinegroup.DefaultID() _c.mutation.SetID(v) }}
// check runs all checks and user-defined validators on the builder.func (_c *BillingInvoiceSplitLineGroupCreate) check() error { if _, ok := _c.mutation.Namespace(); !ok { return &ValidationError{Name: "namespace", err: errors.New(`db: missing required field "BillingInvoiceSplitLineGroup.namespace"`)} } if v, ok := _c.mutation.Namespace(); ok { if err := billinginvoicesplitlinegroup.NamespaceValidator(v); err != nil { return &ValidationError{Name: "namespace", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceSplitLineGroup.namespace": %w`, err)} } } if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "BillingInvoiceSplitLineGroup.created_at"`)} } if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`db: missing required field "BillingInvoiceSplitLineGroup.updated_at"`)} } if _, ok := _c.mutation.Name(); !ok { return &ValidationError{Name: "name", err: errors.New(`db: missing required field "BillingInvoiceSplitLineGroup.name"`)} } if _, ok := _c.mutation.Currency(); !ok { return &ValidationError{Name: "currency", err: errors.New(`db: missing required field "BillingInvoiceSplitLineGroup.currency"`)} } if v, ok := _c.mutation.Currency(); ok { if err := billinginvoicesplitlinegroup.CurrencyValidator(string(v)); err != nil { return &ValidationError{Name: "currency", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceSplitLineGroup.currency": %w`, err)} } } if _, ok := _c.mutation.ServicePeriodStart(); !ok { return &ValidationError{Name: "service_period_start", err: errors.New(`db: missing required field "BillingInvoiceSplitLineGroup.service_period_start"`)} } if _, ok := _c.mutation.ServicePeriodEnd(); !ok { return &ValidationError{Name: "service_period_end", err: errors.New(`db: missing required field "BillingInvoiceSplitLineGroup.service_period_end"`)} } if v, ok := _c.mutation.RatecardDiscounts(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "ratecard_discounts", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceSplitLineGroup.ratecard_discounts": %w`, err)} } } if _, ok := _c.mutation.Price(); !ok { return &ValidationError{Name: "price", err: errors.New(`db: missing required field "BillingInvoiceSplitLineGroup.price"`)} } if v, ok := _c.mutation.Price(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "price", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceSplitLineGroup.price": %w`, err)} } } return nil}
func (_c *BillingInvoiceSplitLineGroupCreate) sqlSave(ctx context.Context) (*BillingInvoiceSplitLineGroup, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec, err := _c.createSpec() if err != nil { return nil, err } if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(string); ok { _node.ID = id } else { return nil, fmt.Errorf("unexpected BillingInvoiceSplitLineGroup.ID type: %T", _spec.ID.Value) } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil}
func (_c *BillingInvoiceSplitLineGroupCreate) createSpec() (*BillingInvoiceSplitLineGroup, *sqlgraph.CreateSpec, error) { var ( _node = &BillingInvoiceSplitLineGroup{config: _c.config} _spec = sqlgraph.NewCreateSpec(billinginvoicesplitlinegroup.Table, sqlgraph.NewFieldSpec(billinginvoicesplitlinegroup.FieldID, field.TypeString)) ) _spec.OnConflict = _c.conflict if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = id } if value, ok := _c.mutation.Namespace(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldNamespace, field.TypeString, value) _node.Namespace = value } if value, ok := _c.mutation.Metadata(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldMetadata, field.TypeJSON, value) _node.Metadata = value } if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } if value, ok := _c.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldDeletedAt, field.TypeTime, value) _node.DeletedAt = &value } if value, ok := _c.mutation.Name(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldName, field.TypeString, value) _node.Name = value } if value, ok := _c.mutation.Description(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldDescription, field.TypeString, value) _node.Description = &value } if value, ok := _c.mutation.Currency(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldCurrency, field.TypeString, value) _node.Currency = value } if value, ok := _c.mutation.ServicePeriodStart(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldServicePeriodStart, field.TypeTime, value) _node.ServicePeriodStart = value } if value, ok := _c.mutation.ServicePeriodEnd(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldServicePeriodEnd, field.TypeTime, value) _node.ServicePeriodEnd = value } if value, ok := _c.mutation.UniqueReferenceID(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldUniqueReferenceID, field.TypeString, value) _node.UniqueReferenceID = &value } if value, ok := _c.mutation.RatecardDiscounts(); ok { vv, err := billinginvoicesplitlinegroup.ValueScanner.RatecardDiscounts.Value(value) if err != nil { return nil, nil, err } _spec.SetField(billinginvoicesplitlinegroup.FieldRatecardDiscounts, field.TypeString, vv) _node.RatecardDiscounts = value } if value, ok := _c.mutation.FeatureKey(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldFeatureKey, field.TypeString, value) _node.FeatureKey = &value } if value, ok := _c.mutation.Price(); ok { vv, err := billinginvoicesplitlinegroup.ValueScanner.Price.Value(value) if err != nil { return nil, nil, err } _spec.SetField(billinginvoicesplitlinegroup.FieldPrice, field.TypeString, vv) _node.Price = value } if value, ok := _c.mutation.SubscriptionBillingPeriodFrom(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodFrom, field.TypeTime, value) _node.SubscriptionBillingPeriodFrom = &value } if value, ok := _c.mutation.SubscriptionBillingPeriodTo(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodTo, field.TypeTime, value) _node.SubscriptionBillingPeriodTo = &value } if nodes := _c.mutation.BillingInvoiceLinesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: billinginvoicesplitlinegroup.BillingInvoiceLinesTable, Columns: []string{billinginvoicesplitlinegroup.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.SubscriptionIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicesplitlinegroup.SubscriptionTable, Columns: []string{billinginvoicesplitlinegroup.SubscriptionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subscription.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.SubscriptionID = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.SubscriptionPhaseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicesplitlinegroup.SubscriptionPhaseTable, Columns: []string{billinginvoicesplitlinegroup.SubscriptionPhaseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subscriptionphase.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.SubscriptionPhaseID = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.SubscriptionItemIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicesplitlinegroup.SubscriptionItemTable, Columns: []string{billinginvoicesplitlinegroup.SubscriptionItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subscriptionitem.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.SubscriptionItemID = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.ChargeIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicesplitlinegroup.ChargeTable, Columns: []string{billinginvoicesplitlinegroup.ChargeColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(charge.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.ChargeID = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec, nil}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceSplitLineGroup.Create().// SetNamespace(v).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceSplitLineGroupUpsert) {// SetNamespace(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceSplitLineGroupCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceSplitLineGroupUpsertOne { _c.conflict = opts return &BillingInvoiceSplitLineGroupUpsertOne{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceSplitLineGroup.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceSplitLineGroupCreate) OnConflictColumns(columns ...string) *BillingInvoiceSplitLineGroupUpsertOne { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceSplitLineGroupUpsertOne{ create: _c, }}
type ( // BillingInvoiceSplitLineGroupUpsertOne is the builder for "upsert"-ing // one BillingInvoiceSplitLineGroup node. BillingInvoiceSplitLineGroupUpsertOne struct { create *BillingInvoiceSplitLineGroupCreate }
// BillingInvoiceSplitLineGroupUpsert is the "OnConflict" setter. BillingInvoiceSplitLineGroupUpsert struct { *sql.UpdateSet })
// SetMetadata sets the "metadata" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetMetadata(v map[string]string) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldMetadata, v) return u}
// UpdateMetadata sets the "metadata" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateMetadata() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldMetadata) return u}
// ClearMetadata clears the value of the "metadata" field.func (u *BillingInvoiceSplitLineGroupUpsert) ClearMetadata() *BillingInvoiceSplitLineGroupUpsert { u.SetNull(billinginvoicesplitlinegroup.FieldMetadata) return u}
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetUpdatedAt(v time.Time) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldUpdatedAt, v) return u}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateUpdatedAt() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldUpdatedAt) return u}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetDeletedAt(v time.Time) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldDeletedAt, v) return u}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateDeletedAt() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldDeletedAt) return u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceSplitLineGroupUpsert) ClearDeletedAt() *BillingInvoiceSplitLineGroupUpsert { u.SetNull(billinginvoicesplitlinegroup.FieldDeletedAt) return u}
// SetName sets the "name" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetName(v string) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldName, v) return u}
// UpdateName sets the "name" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateName() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldName) return u}
// SetDescription sets the "description" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetDescription(v string) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldDescription, v) return u}
// UpdateDescription sets the "description" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateDescription() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldDescription) return u}
// ClearDescription clears the value of the "description" field.func (u *BillingInvoiceSplitLineGroupUpsert) ClearDescription() *BillingInvoiceSplitLineGroupUpsert { u.SetNull(billinginvoicesplitlinegroup.FieldDescription) return u}
// SetServicePeriodStart sets the "service_period_start" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetServicePeriodStart(v time.Time) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldServicePeriodStart, v) return u}
// UpdateServicePeriodStart sets the "service_period_start" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateServicePeriodStart() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldServicePeriodStart) return u}
// SetServicePeriodEnd sets the "service_period_end" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetServicePeriodEnd(v time.Time) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldServicePeriodEnd, v) return u}
// UpdateServicePeriodEnd sets the "service_period_end" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateServicePeriodEnd() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldServicePeriodEnd) return u}
// SetRatecardDiscounts sets the "ratecard_discounts" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetRatecardDiscounts(v *billing.Discounts) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldRatecardDiscounts, v) return u}
// UpdateRatecardDiscounts sets the "ratecard_discounts" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateRatecardDiscounts() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldRatecardDiscounts) return u}
// ClearRatecardDiscounts clears the value of the "ratecard_discounts" field.func (u *BillingInvoiceSplitLineGroupUpsert) ClearRatecardDiscounts() *BillingInvoiceSplitLineGroupUpsert { u.SetNull(billinginvoicesplitlinegroup.FieldRatecardDiscounts) return u}
// SetSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetSubscriptionBillingPeriodFrom(v time.Time) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodFrom, v) return u}
// UpdateSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateSubscriptionBillingPeriodFrom() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodFrom) return u}
// ClearSubscriptionBillingPeriodFrom clears the value of the "subscription_billing_period_from" field.func (u *BillingInvoiceSplitLineGroupUpsert) ClearSubscriptionBillingPeriodFrom() *BillingInvoiceSplitLineGroupUpsert { u.SetNull(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodFrom) return u}
// SetSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetSubscriptionBillingPeriodTo(v time.Time) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodTo, v) return u}
// UpdateSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateSubscriptionBillingPeriodTo() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodTo) return u}
// ClearSubscriptionBillingPeriodTo clears the value of the "subscription_billing_period_to" field.func (u *BillingInvoiceSplitLineGroupUpsert) ClearSubscriptionBillingPeriodTo() *BillingInvoiceSplitLineGroupUpsert { u.SetNull(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodTo) return u}
// SetChargeID sets the "charge_id" field.func (u *BillingInvoiceSplitLineGroupUpsert) SetChargeID(v string) *BillingInvoiceSplitLineGroupUpsert { u.Set(billinginvoicesplitlinegroup.FieldChargeID, v) return u}
// UpdateChargeID sets the "charge_id" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsert) UpdateChargeID() *BillingInvoiceSplitLineGroupUpsert { u.SetExcluded(billinginvoicesplitlinegroup.FieldChargeID) return u}
// ClearChargeID clears the value of the "charge_id" field.func (u *BillingInvoiceSplitLineGroupUpsert) ClearChargeID() *BillingInvoiceSplitLineGroupUpsert { u.SetNull(billinginvoicesplitlinegroup.FieldChargeID) return u}
// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.// Using this option is equivalent to using://// client.BillingInvoiceSplitLineGroup.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoicesplitlinegroup.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateNewValues() *BillingInvoiceSplitLineGroupUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { if _, exists := u.create.mutation.ID(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldID) } if _, exists := u.create.mutation.Namespace(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldNamespace) } if _, exists := u.create.mutation.CreatedAt(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldCreatedAt) } if _, exists := u.create.mutation.Currency(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldCurrency) } if _, exists := u.create.mutation.UniqueReferenceID(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldUniqueReferenceID) } if _, exists := u.create.mutation.FeatureKey(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldFeatureKey) } if _, exists := u.create.mutation.Price(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldPrice) } if _, exists := u.create.mutation.SubscriptionID(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldSubscriptionID) } if _, exists := u.create.mutation.SubscriptionPhaseID(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldSubscriptionPhaseID) } if _, exists := u.create.mutation.SubscriptionItemID(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldSubscriptionItemID) } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceSplitLineGroup.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceSplitLineGroupUpsertOne) Ignore() *BillingInvoiceSplitLineGroupUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceSplitLineGroupUpsertOne) DoNothing() *BillingInvoiceSplitLineGroupUpsertOne { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceSplitLineGroupCreate.OnConflict// documentation for more info.func (u *BillingInvoiceSplitLineGroupUpsertOne) Update(set func(*BillingInvoiceSplitLineGroupUpsert)) *BillingInvoiceSplitLineGroupUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceSplitLineGroupUpsert{UpdateSet: update}) })) return u}
// SetMetadata sets the "metadata" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetMetadata(v map[string]string) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetMetadata(v) })}
// UpdateMetadata sets the "metadata" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateMetadata() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateMetadata() })}
// ClearMetadata clears the value of the "metadata" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) ClearMetadata() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearMetadata() })}
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetUpdatedAt(v time.Time) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetUpdatedAt(v) })}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateUpdatedAt() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateUpdatedAt() })}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetDeletedAt(v time.Time) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetDeletedAt(v) })}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateDeletedAt() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateDeletedAt() })}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) ClearDeletedAt() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearDeletedAt() })}
// SetName sets the "name" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetName(v string) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetName(v) })}
// UpdateName sets the "name" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateName() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateName() })}
// SetDescription sets the "description" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetDescription(v string) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetDescription(v) })}
// UpdateDescription sets the "description" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateDescription() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateDescription() })}
// ClearDescription clears the value of the "description" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) ClearDescription() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearDescription() })}
// SetServicePeriodStart sets the "service_period_start" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetServicePeriodStart(v time.Time) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetServicePeriodStart(v) })}
// UpdateServicePeriodStart sets the "service_period_start" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateServicePeriodStart() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateServicePeriodStart() })}
// SetServicePeriodEnd sets the "service_period_end" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetServicePeriodEnd(v time.Time) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetServicePeriodEnd(v) })}
// UpdateServicePeriodEnd sets the "service_period_end" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateServicePeriodEnd() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateServicePeriodEnd() })}
// SetRatecardDiscounts sets the "ratecard_discounts" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetRatecardDiscounts(v *billing.Discounts) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetRatecardDiscounts(v) })}
// UpdateRatecardDiscounts sets the "ratecard_discounts" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateRatecardDiscounts() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateRatecardDiscounts() })}
// ClearRatecardDiscounts clears the value of the "ratecard_discounts" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) ClearRatecardDiscounts() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearRatecardDiscounts() })}
// SetSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetSubscriptionBillingPeriodFrom(v time.Time) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetSubscriptionBillingPeriodFrom(v) })}
// UpdateSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateSubscriptionBillingPeriodFrom() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateSubscriptionBillingPeriodFrom() })}
// ClearSubscriptionBillingPeriodFrom clears the value of the "subscription_billing_period_from" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) ClearSubscriptionBillingPeriodFrom() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearSubscriptionBillingPeriodFrom() })}
// SetSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetSubscriptionBillingPeriodTo(v time.Time) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetSubscriptionBillingPeriodTo(v) })}
// UpdateSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateSubscriptionBillingPeriodTo() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateSubscriptionBillingPeriodTo() })}
// ClearSubscriptionBillingPeriodTo clears the value of the "subscription_billing_period_to" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) ClearSubscriptionBillingPeriodTo() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearSubscriptionBillingPeriodTo() })}
// SetChargeID sets the "charge_id" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) SetChargeID(v string) *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetChargeID(v) })}
// UpdateChargeID sets the "charge_id" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertOne) UpdateChargeID() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateChargeID() })}
// ClearChargeID clears the value of the "charge_id" field.func (u *BillingInvoiceSplitLineGroupUpsertOne) ClearChargeID() *BillingInvoiceSplitLineGroupUpsertOne { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearChargeID() })}
// Exec executes the query.func (u *BillingInvoiceSplitLineGroupUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceSplitLineGroupCreate.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceSplitLineGroupUpsertOne) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}
// Exec executes the UPSERT query and returns the inserted/updated ID.func (u *BillingInvoiceSplitLineGroupUpsertOne) ID(ctx context.Context) (id string, err error) { if u.create.driver.Dialect() == dialect.MySQL { // In case of "ON CONFLICT", there is no way to get back non-numeric ID // fields from the database since MySQL does not support the RETURNING clause. return id, errors.New("db: BillingInvoiceSplitLineGroupUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceSplitLineGroupUpsertOne.Exec instead") } node, err := u.create.Save(ctx) if err != nil { return id, err } return node.ID, nil}
// IDX is like ID, but panics if an error occurs.func (u *BillingInvoiceSplitLineGroupUpsertOne) IDX(ctx context.Context) string { id, err := u.ID(ctx) if err != nil { panic(err) } return id}
// BillingInvoiceSplitLineGroupCreateBulk is the builder for creating many BillingInvoiceSplitLineGroup entities in bulk.type BillingInvoiceSplitLineGroupCreateBulk struct { config err error builders []*BillingInvoiceSplitLineGroupCreate conflict []sql.ConflictOption}
// Save creates the BillingInvoiceSplitLineGroup entities in the database.func (_c *BillingInvoiceSplitLineGroupCreateBulk) Save(ctx context.Context) ([]*BillingInvoiceSplitLineGroup, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*BillingInvoiceSplitLineGroup, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*BillingInvoiceSplitLineGroupMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i], err = builder.createSpec() if err != nil { return nil, err } if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } } } if err != nil { return nil, err } mutation.id = &nodes[i].ID mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { mut = builder.hooks[i](mut) } mutators[i] = mut }(i, ctx) } if len(mutators) > 0 { if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil}
// SaveX is like Save, but panics if an error occurs.func (_c *BillingInvoiceSplitLineGroupCreateBulk) SaveX(ctx context.Context) []*BillingInvoiceSplitLineGroup { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceSplitLineGroupCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceSplitLineGroupCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceSplitLineGroup.CreateBulk(builders...).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceSplitLineGroupUpsert) {// SetNamespace(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceSplitLineGroupCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceSplitLineGroupUpsertBulk { _c.conflict = opts return &BillingInvoiceSplitLineGroupUpsertBulk{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceSplitLineGroup.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceSplitLineGroupCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceSplitLineGroupUpsertBulk { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceSplitLineGroupUpsertBulk{ create: _c, }}
// BillingInvoiceSplitLineGroupUpsertBulk is the builder for "upsert"-ing// a bulk of BillingInvoiceSplitLineGroup nodes.type BillingInvoiceSplitLineGroupUpsertBulk struct { create *BillingInvoiceSplitLineGroupCreateBulk}
// UpdateNewValues updates the mutable fields using the new values that// were set on create. Using this option is equivalent to using://// client.BillingInvoiceSplitLineGroup.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoicesplitlinegroup.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateNewValues() *BillingInvoiceSplitLineGroupUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { for _, b := range u.create.builders { if _, exists := b.mutation.ID(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldID) } if _, exists := b.mutation.Namespace(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldNamespace) } if _, exists := b.mutation.CreatedAt(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldCreatedAt) } if _, exists := b.mutation.Currency(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldCurrency) } if _, exists := b.mutation.UniqueReferenceID(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldUniqueReferenceID) } if _, exists := b.mutation.FeatureKey(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldFeatureKey) } if _, exists := b.mutation.Price(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldPrice) } if _, exists := b.mutation.SubscriptionID(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldSubscriptionID) } if _, exists := b.mutation.SubscriptionPhaseID(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldSubscriptionPhaseID) } if _, exists := b.mutation.SubscriptionItemID(); exists { s.SetIgnore(billinginvoicesplitlinegroup.FieldSubscriptionItemID) } } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceSplitLineGroup.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceSplitLineGroupUpsertBulk) Ignore() *BillingInvoiceSplitLineGroupUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceSplitLineGroupUpsertBulk) DoNothing() *BillingInvoiceSplitLineGroupUpsertBulk { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceSplitLineGroupCreateBulk.OnConflict// documentation for more info.func (u *BillingInvoiceSplitLineGroupUpsertBulk) Update(set func(*BillingInvoiceSplitLineGroupUpsert)) *BillingInvoiceSplitLineGroupUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceSplitLineGroupUpsert{UpdateSet: update}) })) return u}
// SetMetadata sets the "metadata" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetMetadata(v map[string]string) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetMetadata(v) })}
// UpdateMetadata sets the "metadata" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateMetadata() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateMetadata() })}
// ClearMetadata clears the value of the "metadata" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) ClearMetadata() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearMetadata() })}
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetUpdatedAt(v time.Time) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetUpdatedAt(v) })}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateUpdatedAt() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateUpdatedAt() })}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetDeletedAt(v time.Time) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetDeletedAt(v) })}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateDeletedAt() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateDeletedAt() })}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) ClearDeletedAt() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearDeletedAt() })}
// SetName sets the "name" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetName(v string) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetName(v) })}
// UpdateName sets the "name" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateName() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateName() })}
// SetDescription sets the "description" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetDescription(v string) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetDescription(v) })}
// UpdateDescription sets the "description" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateDescription() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateDescription() })}
// ClearDescription clears the value of the "description" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) ClearDescription() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearDescription() })}
// SetServicePeriodStart sets the "service_period_start" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetServicePeriodStart(v time.Time) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetServicePeriodStart(v) })}
// UpdateServicePeriodStart sets the "service_period_start" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateServicePeriodStart() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateServicePeriodStart() })}
// SetServicePeriodEnd sets the "service_period_end" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetServicePeriodEnd(v time.Time) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetServicePeriodEnd(v) })}
// UpdateServicePeriodEnd sets the "service_period_end" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateServicePeriodEnd() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateServicePeriodEnd() })}
// SetRatecardDiscounts sets the "ratecard_discounts" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetRatecardDiscounts(v *billing.Discounts) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetRatecardDiscounts(v) })}
// UpdateRatecardDiscounts sets the "ratecard_discounts" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateRatecardDiscounts() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateRatecardDiscounts() })}
// ClearRatecardDiscounts clears the value of the "ratecard_discounts" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) ClearRatecardDiscounts() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearRatecardDiscounts() })}
// SetSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetSubscriptionBillingPeriodFrom(v time.Time) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetSubscriptionBillingPeriodFrom(v) })}
// UpdateSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateSubscriptionBillingPeriodFrom() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateSubscriptionBillingPeriodFrom() })}
// ClearSubscriptionBillingPeriodFrom clears the value of the "subscription_billing_period_from" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) ClearSubscriptionBillingPeriodFrom() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearSubscriptionBillingPeriodFrom() })}
// SetSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetSubscriptionBillingPeriodTo(v time.Time) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetSubscriptionBillingPeriodTo(v) })}
// UpdateSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateSubscriptionBillingPeriodTo() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateSubscriptionBillingPeriodTo() })}
// ClearSubscriptionBillingPeriodTo clears the value of the "subscription_billing_period_to" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) ClearSubscriptionBillingPeriodTo() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearSubscriptionBillingPeriodTo() })}
// SetChargeID sets the "charge_id" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) SetChargeID(v string) *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.SetChargeID(v) })}
// UpdateChargeID sets the "charge_id" field to the value that was provided on create.func (u *BillingInvoiceSplitLineGroupUpsertBulk) UpdateChargeID() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.UpdateChargeID() })}
// ClearChargeID clears the value of the "charge_id" field.func (u *BillingInvoiceSplitLineGroupUpsertBulk) ClearChargeID() *BillingInvoiceSplitLineGroupUpsertBulk { return u.Update(func(s *BillingInvoiceSplitLineGroupUpsert) { s.ClearChargeID() })}
// Exec executes the query.func (u *BillingInvoiceSplitLineGroupUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { return u.create.err } for i, b := range u.create.builders { if len(b.conflict) != 0 { return fmt.Errorf("db: OnConflict was set for builder %d. Set it on the BillingInvoiceSplitLineGroupCreateBulk instead", i) } } if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceSplitLineGroupCreateBulk.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceSplitLineGroupUpsertBulk) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788// Code generated by ent, DO NOT EDIT.
package db
import ( "context"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicesplitlinegroup" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceSplitLineGroupDelete is the builder for deleting a BillingInvoiceSplitLineGroup entity.type BillingInvoiceSplitLineGroupDelete struct { config hooks []Hook mutation *BillingInvoiceSplitLineGroupMutation}
// Where appends a list predicates to the BillingInvoiceSplitLineGroupDelete builder.func (_d *BillingInvoiceSplitLineGroupDelete) Where(ps ...predicate.BillingInvoiceSplitLineGroup) *BillingInvoiceSplitLineGroupDelete { _d.mutation.Where(ps...) return _d}
// Exec executes the deletion query and returns how many vertices were deleted.func (_d *BillingInvoiceSplitLineGroupDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceSplitLineGroupDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n}
func (_d *BillingInvoiceSplitLineGroupDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(billinginvoicesplitlinegroup.Table, sqlgraph.NewFieldSpec(billinginvoicesplitlinegroup.FieldID, field.TypeString)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err}
// BillingInvoiceSplitLineGroupDeleteOne is the builder for deleting a single BillingInvoiceSplitLineGroup entity.type BillingInvoiceSplitLineGroupDeleteOne struct { _d *BillingInvoiceSplitLineGroupDelete}
// Where appends a list predicates to the BillingInvoiceSplitLineGroupDelete builder.func (_d *BillingInvoiceSplitLineGroupDeleteOne) Where(ps ...predicate.BillingInvoiceSplitLineGroup) *BillingInvoiceSplitLineGroupDeleteOne { _d._d.mutation.Where(ps...) return _d}
// Exec executes the deletion query.func (_d *BillingInvoiceSplitLineGroupDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{billinginvoicesplitlinegroup.Label} default: return nil }}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceSplitLineGroupDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "database/sql/driver" "fmt" "math"
"entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicesplitlinegroup" "github.com/openmeterio/openmeter/openmeter/ent/db/charge" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" "github.com/openmeterio/openmeter/openmeter/ent/db/subscription" "github.com/openmeterio/openmeter/openmeter/ent/db/subscriptionitem" "github.com/openmeterio/openmeter/openmeter/ent/db/subscriptionphase")
// BillingInvoiceSplitLineGroupQuery is the builder for querying BillingInvoiceSplitLineGroup entities.type BillingInvoiceSplitLineGroupQuery struct { config ctx *QueryContext order []billinginvoicesplitlinegroup.OrderOption inters []Interceptor predicates []predicate.BillingInvoiceSplitLineGroup withBillingInvoiceLines *BillingInvoiceLineQuery withSubscription *SubscriptionQuery withSubscriptionPhase *SubscriptionPhaseQuery withSubscriptionItem *SubscriptionItemQuery withCharge *ChargeQuery 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 BillingInvoiceSplitLineGroupQuery builder.func (_q *BillingInvoiceSplitLineGroupQuery) Where(ps ...predicate.BillingInvoiceSplitLineGroup) *BillingInvoiceSplitLineGroupQuery { _q.predicates = append(_q.predicates, ps...) return _q}
// Limit the number of records to be returned by this query.func (_q *BillingInvoiceSplitLineGroupQuery) Limit(limit int) *BillingInvoiceSplitLineGroupQuery { _q.ctx.Limit = &limit return _q}
// Offset to start from.func (_q *BillingInvoiceSplitLineGroupQuery) Offset(offset int) *BillingInvoiceSplitLineGroupQuery { _q.ctx.Offset = &offset return _q}
// 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 (_q *BillingInvoiceSplitLineGroupQuery) Unique(unique bool) *BillingInvoiceSplitLineGroupQuery { _q.ctx.Unique = &unique return _q}
// Order specifies how the records should be ordered.func (_q *BillingInvoiceSplitLineGroupQuery) Order(o ...billinginvoicesplitlinegroup.OrderOption) *BillingInvoiceSplitLineGroupQuery { _q.order = append(_q.order, o...) return _q}
// QueryBillingInvoiceLines chains the current query on the "billing_invoice_lines" edge.func (_q *BillingInvoiceSplitLineGroupQuery) QueryBillingInvoiceLines() *BillingInvoiceLineQuery { query := (&BillingInvoiceLineClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(billinginvoicesplitlinegroup.Table, billinginvoicesplitlinegroup.FieldID, selector), sqlgraph.To(billinginvoiceline.Table, billinginvoiceline.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, billinginvoicesplitlinegroup.BillingInvoiceLinesTable, billinginvoicesplitlinegroup.BillingInvoiceLinesColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query}
// QuerySubscription chains the current query on the "subscription" edge.func (_q *BillingInvoiceSplitLineGroupQuery) QuerySubscription() *SubscriptionQuery { query := (&SubscriptionClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(billinginvoicesplitlinegroup.Table, billinginvoicesplitlinegroup.FieldID, selector), sqlgraph.To(subscription.Table, subscription.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, billinginvoicesplitlinegroup.SubscriptionTable, billinginvoicesplitlinegroup.SubscriptionColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query}
// QuerySubscriptionPhase chains the current query on the "subscription_phase" edge.func (_q *BillingInvoiceSplitLineGroupQuery) QuerySubscriptionPhase() *SubscriptionPhaseQuery { query := (&SubscriptionPhaseClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(billinginvoicesplitlinegroup.Table, billinginvoicesplitlinegroup.FieldID, selector), sqlgraph.To(subscriptionphase.Table, subscriptionphase.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, billinginvoicesplitlinegroup.SubscriptionPhaseTable, billinginvoicesplitlinegroup.SubscriptionPhaseColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query}
// QuerySubscriptionItem chains the current query on the "subscription_item" edge.func (_q *BillingInvoiceSplitLineGroupQuery) QuerySubscriptionItem() *SubscriptionItemQuery { query := (&SubscriptionItemClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(billinginvoicesplitlinegroup.Table, billinginvoicesplitlinegroup.FieldID, selector), sqlgraph.To(subscriptionitem.Table, subscriptionitem.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, billinginvoicesplitlinegroup.SubscriptionItemTable, billinginvoicesplitlinegroup.SubscriptionItemColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query}
// QueryCharge chains the current query on the "charge" edge.func (_q *BillingInvoiceSplitLineGroupQuery) QueryCharge() *ChargeQuery { query := (&ChargeClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(billinginvoicesplitlinegroup.Table, billinginvoicesplitlinegroup.FieldID, selector), sqlgraph.To(charge.Table, charge.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, billinginvoicesplitlinegroup.ChargeTable, billinginvoicesplitlinegroup.ChargeColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query}
// First returns the first BillingInvoiceSplitLineGroup entity from the query.// Returns a *NotFoundError when no BillingInvoiceSplitLineGroup was found.func (_q *BillingInvoiceSplitLineGroupQuery) First(ctx context.Context) (*BillingInvoiceSplitLineGroup, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{billinginvoicesplitlinegroup.Label} } return nodes[0], nil}
// FirstX is like First, but panics if an error occurs.func (_q *BillingInvoiceSplitLineGroupQuery) FirstX(ctx context.Context) *BillingInvoiceSplitLineGroup { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node}
// FirstID returns the first BillingInvoiceSplitLineGroup ID from the query.// Returns a *NotFoundError when no BillingInvoiceSplitLineGroup ID was found.func (_q *BillingInvoiceSplitLineGroupQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{billinginvoicesplitlinegroup.Label} return } return ids[0], nil}
// FirstIDX is like FirstID, but panics if an error occurs.func (_q *BillingInvoiceSplitLineGroupQuery) FirstIDX(ctx context.Context) string { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id}
// Only returns a single BillingInvoiceSplitLineGroup entity found by the query, ensuring it only returns one.// Returns a *NotSingularError when more than one BillingInvoiceSplitLineGroup entity is found.// Returns a *NotFoundError when no BillingInvoiceSplitLineGroup entities are found.func (_q *BillingInvoiceSplitLineGroupQuery) Only(ctx context.Context) (*BillingInvoiceSplitLineGroup, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{billinginvoicesplitlinegroup.Label} default: return nil, &NotSingularError{billinginvoicesplitlinegroup.Label} }}
// OnlyX is like Only, but panics if an error occurs.func (_q *BillingInvoiceSplitLineGroupQuery) OnlyX(ctx context.Context) *BillingInvoiceSplitLineGroup { node, err := _q.Only(ctx) if err != nil { panic(err) } return node}
// OnlyID is like Only, but returns the only BillingInvoiceSplitLineGroup ID in the query.// Returns a *NotSingularError when more than one BillingInvoiceSplitLineGroup ID is found.// Returns a *NotFoundError when no entities are found.func (_q *BillingInvoiceSplitLineGroupQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{billinginvoicesplitlinegroup.Label} default: err = &NotSingularError{billinginvoicesplitlinegroup.Label} } return}
// OnlyIDX is like OnlyID, but panics if an error occurs.func (_q *BillingInvoiceSplitLineGroupQuery) OnlyIDX(ctx context.Context) string { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id}
// All executes the query and returns a list of BillingInvoiceSplitLineGroups.func (_q *BillingInvoiceSplitLineGroupQuery) All(ctx context.Context) ([]*BillingInvoiceSplitLineGroup, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*BillingInvoiceSplitLineGroup, *BillingInvoiceSplitLineGroupQuery]() return withInterceptors[[]*BillingInvoiceSplitLineGroup](ctx, _q, qr, _q.inters)}
// AllX is like All, but panics if an error occurs.func (_q *BillingInvoiceSplitLineGroupQuery) AllX(ctx context.Context) []*BillingInvoiceSplitLineGroup { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes}
// IDs executes the query and returns a list of BillingInvoiceSplitLineGroup IDs.func (_q *BillingInvoiceSplitLineGroupQuery) IDs(ctx context.Context) (ids []string, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(billinginvoicesplitlinegroup.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil}
// IDsX is like IDs, but panics if an error occurs.func (_q *BillingInvoiceSplitLineGroupQuery) IDsX(ctx context.Context) []string { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids}
// Count returns the count of the given query.func (_q *BillingInvoiceSplitLineGroupQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*BillingInvoiceSplitLineGroupQuery](), _q.inters)}
// CountX is like Count, but panics if an error occurs.func (_q *BillingInvoiceSplitLineGroupQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count}
// Exist returns true if the query has elements in the graph.func (_q *BillingInvoiceSplitLineGroupQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("db: check existence: %w", err) default: return true, nil }}
// ExistX is like Exist, but panics if an error occurs.func (_q *BillingInvoiceSplitLineGroupQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist}
// Clone returns a duplicate of the BillingInvoiceSplitLineGroupQuery builder, including all associated steps. It can be// used to prepare common query builders and use them differently after the clone is made.func (_q *BillingInvoiceSplitLineGroupQuery) Clone() *BillingInvoiceSplitLineGroupQuery { if _q == nil { return nil } return &BillingInvoiceSplitLineGroupQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]billinginvoicesplitlinegroup.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.BillingInvoiceSplitLineGroup{}, _q.predicates...), withBillingInvoiceLines: _q.withBillingInvoiceLines.Clone(), withSubscription: _q.withSubscription.Clone(), withSubscriptionPhase: _q.withSubscriptionPhase.Clone(), withSubscriptionItem: _q.withSubscriptionItem.Clone(), withCharge: _q.withCharge.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, }}
// WithBillingInvoiceLines tells the query-builder to eager-load the nodes that are connected to// the "billing_invoice_lines" edge. The optional arguments are used to configure the query builder of the edge.func (_q *BillingInvoiceSplitLineGroupQuery) WithBillingInvoiceLines(opts ...func(*BillingInvoiceLineQuery)) *BillingInvoiceSplitLineGroupQuery { query := (&BillingInvoiceLineClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withBillingInvoiceLines = query return _q}
// WithSubscription tells the query-builder to eager-load the nodes that are connected to// the "subscription" edge. The optional arguments are used to configure the query builder of the edge.func (_q *BillingInvoiceSplitLineGroupQuery) WithSubscription(opts ...func(*SubscriptionQuery)) *BillingInvoiceSplitLineGroupQuery { query := (&SubscriptionClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withSubscription = query return _q}
// WithSubscriptionPhase tells the query-builder to eager-load the nodes that are connected to// the "subscription_phase" edge. The optional arguments are used to configure the query builder of the edge.func (_q *BillingInvoiceSplitLineGroupQuery) WithSubscriptionPhase(opts ...func(*SubscriptionPhaseQuery)) *BillingInvoiceSplitLineGroupQuery { query := (&SubscriptionPhaseClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withSubscriptionPhase = query return _q}
// WithSubscriptionItem tells the query-builder to eager-load the nodes that are connected to// the "subscription_item" edge. The optional arguments are used to configure the query builder of the edge.func (_q *BillingInvoiceSplitLineGroupQuery) WithSubscriptionItem(opts ...func(*SubscriptionItemQuery)) *BillingInvoiceSplitLineGroupQuery { query := (&SubscriptionItemClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withSubscriptionItem = query return _q}
// WithCharge tells the query-builder to eager-load the nodes that are connected to// the "charge" edge. The optional arguments are used to configure the query builder of the edge.func (_q *BillingInvoiceSplitLineGroupQuery) WithCharge(opts ...func(*ChargeQuery)) *BillingInvoiceSplitLineGroupQuery { query := (&ChargeClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withCharge = query return _q}
// GroupBy is used to group vertices by one or more fields/columns.// It is often used with aggregate functions, like: count, max, mean, min, sum.//// Example://// var v []struct {// Namespace string `json:"namespace,omitempty"`// Count int `json:"count,omitempty"`// }//// client.BillingInvoiceSplitLineGroup.Query().// GroupBy(billinginvoicesplitlinegroup.FieldNamespace).// Aggregate(db.Count()).// Scan(ctx, &v)func (_q *BillingInvoiceSplitLineGroupQuery) GroupBy(field string, fields ...string) *BillingInvoiceSplitLineGroupGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &BillingInvoiceSplitLineGroupGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = billinginvoicesplitlinegroup.Label grbuild.scan = grbuild.Scan return grbuild}
// Select allows the selection one or more fields/columns for the given query,// instead of selecting all fields in the entity.//// Example://// var v []struct {// Namespace string `json:"namespace,omitempty"`// }//// client.BillingInvoiceSplitLineGroup.Query().// Select(billinginvoicesplitlinegroup.FieldNamespace).// Scan(ctx, &v)func (_q *BillingInvoiceSplitLineGroupQuery) Select(fields ...string) *BillingInvoiceSplitLineGroupSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &BillingInvoiceSplitLineGroupSelect{BillingInvoiceSplitLineGroupQuery: _q} sbuild.label = billinginvoicesplitlinegroup.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild}
// Aggregate returns a BillingInvoiceSplitLineGroupSelect configured with the given aggregations.func (_q *BillingInvoiceSplitLineGroupQuery) Aggregate(fns ...AggregateFunc) *BillingInvoiceSplitLineGroupSelect { return _q.Select().Aggregate(fns...)}
func (_q *BillingInvoiceSplitLineGroupQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("db: uninitialized interceptor (forgotten import db/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !billinginvoicesplitlinegroup.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil}
func (_q *BillingInvoiceSplitLineGroupQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BillingInvoiceSplitLineGroup, error) { var ( nodes = []*BillingInvoiceSplitLineGroup{} _spec = _q.querySpec() loadedTypes = [5]bool{ _q.withBillingInvoiceLines != nil, _q.withSubscription != nil, _q.withSubscriptionPhase != nil, _q.withSubscriptionItem != nil, _q.withCharge != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*BillingInvoiceSplitLineGroup).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &BillingInvoiceSplitLineGroup{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withBillingInvoiceLines; query != nil { if err := _q.loadBillingInvoiceLines(ctx, query, nodes, func(n *BillingInvoiceSplitLineGroup) { n.Edges.BillingInvoiceLines = []*BillingInvoiceLine{} }, func(n *BillingInvoiceSplitLineGroup, e *BillingInvoiceLine) { n.Edges.BillingInvoiceLines = append(n.Edges.BillingInvoiceLines, e) }); err != nil { return nil, err } } if query := _q.withSubscription; query != nil { if err := _q.loadSubscription(ctx, query, nodes, nil, func(n *BillingInvoiceSplitLineGroup, e *Subscription) { n.Edges.Subscription = e }); err != nil { return nil, err } } if query := _q.withSubscriptionPhase; query != nil { if err := _q.loadSubscriptionPhase(ctx, query, nodes, nil, func(n *BillingInvoiceSplitLineGroup, e *SubscriptionPhase) { n.Edges.SubscriptionPhase = e }); err != nil { return nil, err } } if query := _q.withSubscriptionItem; query != nil { if err := _q.loadSubscriptionItem(ctx, query, nodes, nil, func(n *BillingInvoiceSplitLineGroup, e *SubscriptionItem) { n.Edges.SubscriptionItem = e }); err != nil { return nil, err } } if query := _q.withCharge; query != nil { if err := _q.loadCharge(ctx, query, nodes, nil, func(n *BillingInvoiceSplitLineGroup, e *Charge) { n.Edges.Charge = e }); err != nil { return nil, err } } return nodes, nil}
func (_q *BillingInvoiceSplitLineGroupQuery) loadBillingInvoiceLines(ctx context.Context, query *BillingInvoiceLineQuery, nodes []*BillingInvoiceSplitLineGroup, init func(*BillingInvoiceSplitLineGroup), assign func(*BillingInvoiceSplitLineGroup, *BillingInvoiceLine)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[string]*BillingInvoiceSplitLineGroup) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] if init != nil { init(nodes[i]) } } query.withFKs = true if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(billinginvoiceline.FieldSplitLineGroupID) } query.Where(predicate.BillingInvoiceLine(func(s *sql.Selector) { s.Where(sql.InValues(s.C(billinginvoicesplitlinegroup.BillingInvoiceLinesColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { fk := n.SplitLineGroupID if fk == nil { return fmt.Errorf(`foreign-key "split_line_group_id" is nil for node %v`, n.ID) } node, ok := nodeids[*fk] if !ok { return fmt.Errorf(`unexpected referenced foreign-key "split_line_group_id" returned %v for node %v`, *fk, n.ID) } assign(node, n) } return nil}func (_q *BillingInvoiceSplitLineGroupQuery) loadSubscription(ctx context.Context, query *SubscriptionQuery, nodes []*BillingInvoiceSplitLineGroup, init func(*BillingInvoiceSplitLineGroup), assign func(*BillingInvoiceSplitLineGroup, *Subscription)) error { ids := make([]string, 0, len(nodes)) nodeids := make(map[string][]*BillingInvoiceSplitLineGroup) for i := range nodes { if nodes[i].SubscriptionID == nil { continue } fk := *nodes[i].SubscriptionID if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(subscription.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "subscription_id" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil}func (_q *BillingInvoiceSplitLineGroupQuery) loadSubscriptionPhase(ctx context.Context, query *SubscriptionPhaseQuery, nodes []*BillingInvoiceSplitLineGroup, init func(*BillingInvoiceSplitLineGroup), assign func(*BillingInvoiceSplitLineGroup, *SubscriptionPhase)) error { ids := make([]string, 0, len(nodes)) nodeids := make(map[string][]*BillingInvoiceSplitLineGroup) for i := range nodes { if nodes[i].SubscriptionPhaseID == nil { continue } fk := *nodes[i].SubscriptionPhaseID if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(subscriptionphase.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "subscription_phase_id" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil}func (_q *BillingInvoiceSplitLineGroupQuery) loadSubscriptionItem(ctx context.Context, query *SubscriptionItemQuery, nodes []*BillingInvoiceSplitLineGroup, init func(*BillingInvoiceSplitLineGroup), assign func(*BillingInvoiceSplitLineGroup, *SubscriptionItem)) error { ids := make([]string, 0, len(nodes)) nodeids := make(map[string][]*BillingInvoiceSplitLineGroup) for i := range nodes { if nodes[i].SubscriptionItemID == nil { continue } fk := *nodes[i].SubscriptionItemID if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(subscriptionitem.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "subscription_item_id" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil}func (_q *BillingInvoiceSplitLineGroupQuery) loadCharge(ctx context.Context, query *ChargeQuery, nodes []*BillingInvoiceSplitLineGroup, init func(*BillingInvoiceSplitLineGroup), assign func(*BillingInvoiceSplitLineGroup, *Charge)) error { ids := make([]string, 0, len(nodes)) nodeids := make(map[string][]*BillingInvoiceSplitLineGroup) for i := range nodes { if nodes[i].ChargeID == nil { continue } fk := *nodes[i].ChargeID if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(charge.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "charge_id" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil}
func (_q *BillingInvoiceSplitLineGroupQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec)}
func (_q *BillingInvoiceSplitLineGroupQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(billinginvoicesplitlinegroup.Table, billinginvoicesplitlinegroup.Columns, sqlgraph.NewFieldSpec(billinginvoicesplitlinegroup.FieldID, field.TypeString)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicesplitlinegroup.FieldID) for i := range fields { if fields[i] != billinginvoicesplitlinegroup.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } if _q.withSubscription != nil { _spec.Node.AddColumnOnce(billinginvoicesplitlinegroup.FieldSubscriptionID) } if _q.withSubscriptionPhase != nil { _spec.Node.AddColumnOnce(billinginvoicesplitlinegroup.FieldSubscriptionPhaseID) } if _q.withSubscriptionItem != nil { _spec.Node.AddColumnOnce(billinginvoicesplitlinegroup.FieldSubscriptionItemID) } if _q.withCharge != nil { _spec.Node.AddColumnOnce(billinginvoicesplitlinegroup.FieldChargeID) } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec}
func (_q *BillingInvoiceSplitLineGroupQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(billinginvoicesplitlinegroup.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = billinginvoicesplitlinegroup.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, m := range _q.modifiers { m(selector) } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector}
// ForUpdate locks the selected rows against concurrent updates, and prevent them from being// updated, deleted or "selected ... for update" by other sessions, until the transaction is// either committed or rolled-back.func (_q *BillingInvoiceSplitLineGroupQuery) ForUpdate(opts ...sql.LockOption) *BillingInvoiceSplitLineGroupQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForUpdate(opts...) }) return _q}
// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock// on any rows that are read. Other sessions can read the rows, but cannot modify them// until your transaction commits.func (_q *BillingInvoiceSplitLineGroupQuery) ForShare(opts ...sql.LockOption) *BillingInvoiceSplitLineGroupQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForShare(opts...) }) return _q}
// BillingInvoiceSplitLineGroupGroupBy is the group-by builder for BillingInvoiceSplitLineGroup entities.type BillingInvoiceSplitLineGroupGroupBy struct { selector build *BillingInvoiceSplitLineGroupQuery}
// Aggregate adds the given aggregation functions to the group-by query.func (_g *BillingInvoiceSplitLineGroupGroupBy) Aggregate(fns ...AggregateFunc) *BillingInvoiceSplitLineGroupGroupBy { _g.fns = append(_g.fns, fns...) return _g}
// Scan applies the selector query and scans the result into the given value.func (_g *BillingInvoiceSplitLineGroupGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceSplitLineGroupQuery, *BillingInvoiceSplitLineGroupGroupBy](ctx, _g.build, _g, _g.build.inters, v)}
func (_g *BillingInvoiceSplitLineGroupGroupBy) sqlScan(ctx context.Context, root *BillingInvoiceSplitLineGroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}
// BillingInvoiceSplitLineGroupSelect is the builder for selecting fields of BillingInvoiceSplitLineGroup entities.type BillingInvoiceSplitLineGroupSelect struct { *BillingInvoiceSplitLineGroupQuery selector}
// Aggregate adds the given aggregation functions to the selector query.func (_s *BillingInvoiceSplitLineGroupSelect) Aggregate(fns ...AggregateFunc) *BillingInvoiceSplitLineGroupSelect { _s.fns = append(_s.fns, fns...) return _s}
// Scan applies the selector query and scans the result into the given value.func (_s *BillingInvoiceSplitLineGroupSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceSplitLineGroupQuery, *BillingInvoiceSplitLineGroupSelect](ctx, _s.BillingInvoiceSplitLineGroupQuery, _s, _s.inters, v)}
func (_s *BillingInvoiceSplitLineGroupSelect) sqlScan(ctx context.Context, root *BillingInvoiceSplitLineGroupQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt" "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicesplitlinegroup" "github.com/openmeterio/openmeter/openmeter/ent/db/charge" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceSplitLineGroupUpdate is the builder for updating BillingInvoiceSplitLineGroup entities.type BillingInvoiceSplitLineGroupUpdate struct { config hooks []Hook mutation *BillingInvoiceSplitLineGroupMutation}
// Where appends a list predicates to the BillingInvoiceSplitLineGroupUpdate builder.func (_u *BillingInvoiceSplitLineGroupUpdate) Where(ps ...predicate.BillingInvoiceSplitLineGroup) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.Where(ps...) return _u}
// SetMetadata sets the "metadata" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetMetadata(v map[string]string) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetMetadata(v) return _u}
// ClearMetadata clears the value of the "metadata" field.func (_u *BillingInvoiceSplitLineGroupUpdate) ClearMetadata() *BillingInvoiceSplitLineGroupUpdate { _u.mutation.ClearMetadata() return _u}
// SetUpdatedAt sets the "updated_at" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetUpdatedAt(v time.Time) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetUpdatedAt(v) return _u}
// SetDeletedAt sets the "deleted_at" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetDeletedAt(v time.Time) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetDeletedAt(v) return _u}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdate) SetNillableDeletedAt(v *time.Time) *BillingInvoiceSplitLineGroupUpdate { if v != nil { _u.SetDeletedAt(*v) } return _u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (_u *BillingInvoiceSplitLineGroupUpdate) ClearDeletedAt() *BillingInvoiceSplitLineGroupUpdate { _u.mutation.ClearDeletedAt() return _u}
// SetName sets the "name" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetName(v string) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetName(v) return _u}
// SetNillableName sets the "name" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdate) SetNillableName(v *string) *BillingInvoiceSplitLineGroupUpdate { if v != nil { _u.SetName(*v) } return _u}
// SetDescription sets the "description" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetDescription(v string) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetDescription(v) return _u}
// SetNillableDescription sets the "description" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdate) SetNillableDescription(v *string) *BillingInvoiceSplitLineGroupUpdate { if v != nil { _u.SetDescription(*v) } return _u}
// ClearDescription clears the value of the "description" field.func (_u *BillingInvoiceSplitLineGroupUpdate) ClearDescription() *BillingInvoiceSplitLineGroupUpdate { _u.mutation.ClearDescription() return _u}
// SetServicePeriodStart sets the "service_period_start" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetServicePeriodStart(v time.Time) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetServicePeriodStart(v) return _u}
// SetNillableServicePeriodStart sets the "service_period_start" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdate) SetNillableServicePeriodStart(v *time.Time) *BillingInvoiceSplitLineGroupUpdate { if v != nil { _u.SetServicePeriodStart(*v) } return _u}
// SetServicePeriodEnd sets the "service_period_end" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetServicePeriodEnd(v time.Time) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetServicePeriodEnd(v) return _u}
// SetNillableServicePeriodEnd sets the "service_period_end" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdate) SetNillableServicePeriodEnd(v *time.Time) *BillingInvoiceSplitLineGroupUpdate { if v != nil { _u.SetServicePeriodEnd(*v) } return _u}
// SetRatecardDiscounts sets the "ratecard_discounts" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetRatecardDiscounts(v *billing.Discounts) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetRatecardDiscounts(v) return _u}
// ClearRatecardDiscounts clears the value of the "ratecard_discounts" field.func (_u *BillingInvoiceSplitLineGroupUpdate) ClearRatecardDiscounts() *BillingInvoiceSplitLineGroupUpdate { _u.mutation.ClearRatecardDiscounts() return _u}
// SetSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetSubscriptionBillingPeriodFrom(v time.Time) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetSubscriptionBillingPeriodFrom(v) return _u}
// SetNillableSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdate) SetNillableSubscriptionBillingPeriodFrom(v *time.Time) *BillingInvoiceSplitLineGroupUpdate { if v != nil { _u.SetSubscriptionBillingPeriodFrom(*v) } return _u}
// ClearSubscriptionBillingPeriodFrom clears the value of the "subscription_billing_period_from" field.func (_u *BillingInvoiceSplitLineGroupUpdate) ClearSubscriptionBillingPeriodFrom() *BillingInvoiceSplitLineGroupUpdate { _u.mutation.ClearSubscriptionBillingPeriodFrom() return _u}
// SetSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetSubscriptionBillingPeriodTo(v time.Time) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetSubscriptionBillingPeriodTo(v) return _u}
// SetNillableSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdate) SetNillableSubscriptionBillingPeriodTo(v *time.Time) *BillingInvoiceSplitLineGroupUpdate { if v != nil { _u.SetSubscriptionBillingPeriodTo(*v) } return _u}
// ClearSubscriptionBillingPeriodTo clears the value of the "subscription_billing_period_to" field.func (_u *BillingInvoiceSplitLineGroupUpdate) ClearSubscriptionBillingPeriodTo() *BillingInvoiceSplitLineGroupUpdate { _u.mutation.ClearSubscriptionBillingPeriodTo() return _u}
// SetChargeID sets the "charge_id" field.func (_u *BillingInvoiceSplitLineGroupUpdate) SetChargeID(v string) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.SetChargeID(v) return _u}
// SetNillableChargeID sets the "charge_id" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdate) SetNillableChargeID(v *string) *BillingInvoiceSplitLineGroupUpdate { if v != nil { _u.SetChargeID(*v) } return _u}
// ClearChargeID clears the value of the "charge_id" field.func (_u *BillingInvoiceSplitLineGroupUpdate) ClearChargeID() *BillingInvoiceSplitLineGroupUpdate { _u.mutation.ClearChargeID() return _u}
// AddBillingInvoiceLineIDs adds the "billing_invoice_lines" edge to the BillingInvoiceLine entity by IDs.func (_u *BillingInvoiceSplitLineGroupUpdate) AddBillingInvoiceLineIDs(ids ...string) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.AddBillingInvoiceLineIDs(ids...) return _u}
// AddBillingInvoiceLines adds the "billing_invoice_lines" edges to the BillingInvoiceLine entity.func (_u *BillingInvoiceSplitLineGroupUpdate) AddBillingInvoiceLines(v ...*BillingInvoiceLine) *BillingInvoiceSplitLineGroupUpdate { ids := make([]string, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddBillingInvoiceLineIDs(ids...)}
// SetCharge sets the "charge" edge to the Charge entity.func (_u *BillingInvoiceSplitLineGroupUpdate) SetCharge(v *Charge) *BillingInvoiceSplitLineGroupUpdate { return _u.SetChargeID(v.ID)}
// Mutation returns the BillingInvoiceSplitLineGroupMutation object of the builder.func (_u *BillingInvoiceSplitLineGroupUpdate) Mutation() *BillingInvoiceSplitLineGroupMutation { return _u.mutation}
// ClearBillingInvoiceLines clears all "billing_invoice_lines" edges to the BillingInvoiceLine entity.func (_u *BillingInvoiceSplitLineGroupUpdate) ClearBillingInvoiceLines() *BillingInvoiceSplitLineGroupUpdate { _u.mutation.ClearBillingInvoiceLines() return _u}
// RemoveBillingInvoiceLineIDs removes the "billing_invoice_lines" edge to BillingInvoiceLine entities by IDs.func (_u *BillingInvoiceSplitLineGroupUpdate) RemoveBillingInvoiceLineIDs(ids ...string) *BillingInvoiceSplitLineGroupUpdate { _u.mutation.RemoveBillingInvoiceLineIDs(ids...) return _u}
// RemoveBillingInvoiceLines removes "billing_invoice_lines" edges to BillingInvoiceLine entities.func (_u *BillingInvoiceSplitLineGroupUpdate) RemoveBillingInvoiceLines(v ...*BillingInvoiceLine) *BillingInvoiceSplitLineGroupUpdate { ids := make([]string, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveBillingInvoiceLineIDs(ids...)}
// ClearCharge clears the "charge" edge to the Charge entity.func (_u *BillingInvoiceSplitLineGroupUpdate) ClearCharge() *BillingInvoiceSplitLineGroupUpdate { _u.mutation.ClearCharge() return _u}
// Save executes the query and returns the number of nodes affected by the update operation.func (_u *BillingInvoiceSplitLineGroupUpdate) Save(ctx context.Context) (int, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceSplitLineGroupUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected}
// Exec executes the query.func (_u *BillingInvoiceSplitLineGroupUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceSplitLineGroupUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_u *BillingInvoiceSplitLineGroupUpdate) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := billinginvoicesplitlinegroup.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) }}
func (_u *BillingInvoiceSplitLineGroupUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(billinginvoicesplitlinegroup.Table, billinginvoicesplitlinegroup.Columns, sqlgraph.NewFieldSpec(billinginvoicesplitlinegroup.FieldID, field.TypeString)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Metadata(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldMetadata, field.TypeJSON, value) } if _u.mutation.MetadataCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldMetadata, field.TypeJSON) } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.Name(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldName, field.TypeString, value) } if value, ok := _u.mutation.Description(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldDescription, field.TypeString, value) } if _u.mutation.DescriptionCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldDescription, field.TypeString) } if value, ok := _u.mutation.ServicePeriodStart(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldServicePeriodStart, field.TypeTime, value) } if value, ok := _u.mutation.ServicePeriodEnd(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldServicePeriodEnd, field.TypeTime, value) } if _u.mutation.UniqueReferenceIDCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldUniqueReferenceID, field.TypeString) } if value, ok := _u.mutation.RatecardDiscounts(); ok { vv, err := billinginvoicesplitlinegroup.ValueScanner.RatecardDiscounts.Value(value) if err != nil { return 0, err } _spec.SetField(billinginvoicesplitlinegroup.FieldRatecardDiscounts, field.TypeString, vv) } if _u.mutation.RatecardDiscountsCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldRatecardDiscounts, field.TypeString) } if _u.mutation.FeatureKeyCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldFeatureKey, field.TypeString) } if value, ok := _u.mutation.SubscriptionBillingPeriodFrom(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodFrom, field.TypeTime, value) } if _u.mutation.SubscriptionBillingPeriodFromCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodFrom, field.TypeTime) } if value, ok := _u.mutation.SubscriptionBillingPeriodTo(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodTo, field.TypeTime, value) } if _u.mutation.SubscriptionBillingPeriodToCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodTo, field.TypeTime) } if _u.mutation.BillingInvoiceLinesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: billinginvoicesplitlinegroup.BillingInvoiceLinesTable, Columns: []string{billinginvoicesplitlinegroup.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedBillingInvoiceLinesIDs(); len(nodes) > 0 && !_u.mutation.BillingInvoiceLinesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: billinginvoicesplitlinegroup.BillingInvoiceLinesTable, Columns: []string{billinginvoicesplitlinegroup.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.BillingInvoiceLinesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: billinginvoicesplitlinegroup.BillingInvoiceLinesTable, Columns: []string{billinginvoicesplitlinegroup.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.ChargeCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicesplitlinegroup.ChargeTable, Columns: []string{billinginvoicesplitlinegroup.ChargeColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(charge.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ChargeIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicesplitlinegroup.ChargeTable, Columns: []string{billinginvoicesplitlinegroup.ChargeColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(charge.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoicesplitlinegroup.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil}
// BillingInvoiceSplitLineGroupUpdateOne is the builder for updating a single BillingInvoiceSplitLineGroup entity.type BillingInvoiceSplitLineGroupUpdateOne struct { config fields []string hooks []Hook mutation *BillingInvoiceSplitLineGroupMutation}
// SetMetadata sets the "metadata" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetMetadata(v map[string]string) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetMetadata(v) return _u}
// ClearMetadata clears the value of the "metadata" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) ClearMetadata() *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.ClearMetadata() return _u}
// SetUpdatedAt sets the "updated_at" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetUpdatedAt(v time.Time) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetUpdatedAt(v) return _u}
// SetDeletedAt sets the "deleted_at" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetDeletedAt(v time.Time) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetDeletedAt(v) return _u}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetNillableDeletedAt(v *time.Time) *BillingInvoiceSplitLineGroupUpdateOne { if v != nil { _u.SetDeletedAt(*v) } return _u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) ClearDeletedAt() *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.ClearDeletedAt() return _u}
// SetName sets the "name" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetName(v string) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetName(v) return _u}
// SetNillableName sets the "name" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetNillableName(v *string) *BillingInvoiceSplitLineGroupUpdateOne { if v != nil { _u.SetName(*v) } return _u}
// SetDescription sets the "description" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetDescription(v string) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetDescription(v) return _u}
// SetNillableDescription sets the "description" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetNillableDescription(v *string) *BillingInvoiceSplitLineGroupUpdateOne { if v != nil { _u.SetDescription(*v) } return _u}
// ClearDescription clears the value of the "description" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) ClearDescription() *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.ClearDescription() return _u}
// SetServicePeriodStart sets the "service_period_start" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetServicePeriodStart(v time.Time) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetServicePeriodStart(v) return _u}
// SetNillableServicePeriodStart sets the "service_period_start" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetNillableServicePeriodStart(v *time.Time) *BillingInvoiceSplitLineGroupUpdateOne { if v != nil { _u.SetServicePeriodStart(*v) } return _u}
// SetServicePeriodEnd sets the "service_period_end" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetServicePeriodEnd(v time.Time) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetServicePeriodEnd(v) return _u}
// SetNillableServicePeriodEnd sets the "service_period_end" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetNillableServicePeriodEnd(v *time.Time) *BillingInvoiceSplitLineGroupUpdateOne { if v != nil { _u.SetServicePeriodEnd(*v) } return _u}
// SetRatecardDiscounts sets the "ratecard_discounts" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetRatecardDiscounts(v *billing.Discounts) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetRatecardDiscounts(v) return _u}
// ClearRatecardDiscounts clears the value of the "ratecard_discounts" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) ClearRatecardDiscounts() *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.ClearRatecardDiscounts() return _u}
// SetSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetSubscriptionBillingPeriodFrom(v time.Time) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetSubscriptionBillingPeriodFrom(v) return _u}
// SetNillableSubscriptionBillingPeriodFrom sets the "subscription_billing_period_from" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetNillableSubscriptionBillingPeriodFrom(v *time.Time) *BillingInvoiceSplitLineGroupUpdateOne { if v != nil { _u.SetSubscriptionBillingPeriodFrom(*v) } return _u}
// ClearSubscriptionBillingPeriodFrom clears the value of the "subscription_billing_period_from" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) ClearSubscriptionBillingPeriodFrom() *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.ClearSubscriptionBillingPeriodFrom() return _u}
// SetSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetSubscriptionBillingPeriodTo(v time.Time) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetSubscriptionBillingPeriodTo(v) return _u}
// SetNillableSubscriptionBillingPeriodTo sets the "subscription_billing_period_to" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetNillableSubscriptionBillingPeriodTo(v *time.Time) *BillingInvoiceSplitLineGroupUpdateOne { if v != nil { _u.SetSubscriptionBillingPeriodTo(*v) } return _u}
// ClearSubscriptionBillingPeriodTo clears the value of the "subscription_billing_period_to" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) ClearSubscriptionBillingPeriodTo() *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.ClearSubscriptionBillingPeriodTo() return _u}
// SetChargeID sets the "charge_id" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetChargeID(v string) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.SetChargeID(v) return _u}
// SetNillableChargeID sets the "charge_id" field if the given value is not nil.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetNillableChargeID(v *string) *BillingInvoiceSplitLineGroupUpdateOne { if v != nil { _u.SetChargeID(*v) } return _u}
// ClearChargeID clears the value of the "charge_id" field.func (_u *BillingInvoiceSplitLineGroupUpdateOne) ClearChargeID() *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.ClearChargeID() return _u}
// AddBillingInvoiceLineIDs adds the "billing_invoice_lines" edge to the BillingInvoiceLine entity by IDs.func (_u *BillingInvoiceSplitLineGroupUpdateOne) AddBillingInvoiceLineIDs(ids ...string) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.AddBillingInvoiceLineIDs(ids...) return _u}
// AddBillingInvoiceLines adds the "billing_invoice_lines" edges to the BillingInvoiceLine entity.func (_u *BillingInvoiceSplitLineGroupUpdateOne) AddBillingInvoiceLines(v ...*BillingInvoiceLine) *BillingInvoiceSplitLineGroupUpdateOne { ids := make([]string, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddBillingInvoiceLineIDs(ids...)}
// SetCharge sets the "charge" edge to the Charge entity.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SetCharge(v *Charge) *BillingInvoiceSplitLineGroupUpdateOne { return _u.SetChargeID(v.ID)}
// Mutation returns the BillingInvoiceSplitLineGroupMutation object of the builder.func (_u *BillingInvoiceSplitLineGroupUpdateOne) Mutation() *BillingInvoiceSplitLineGroupMutation { return _u.mutation}
// ClearBillingInvoiceLines clears all "billing_invoice_lines" edges to the BillingInvoiceLine entity.func (_u *BillingInvoiceSplitLineGroupUpdateOne) ClearBillingInvoiceLines() *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.ClearBillingInvoiceLines() return _u}
// RemoveBillingInvoiceLineIDs removes the "billing_invoice_lines" edge to BillingInvoiceLine entities by IDs.func (_u *BillingInvoiceSplitLineGroupUpdateOne) RemoveBillingInvoiceLineIDs(ids ...string) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.RemoveBillingInvoiceLineIDs(ids...) return _u}
// RemoveBillingInvoiceLines removes "billing_invoice_lines" edges to BillingInvoiceLine entities.func (_u *BillingInvoiceSplitLineGroupUpdateOne) RemoveBillingInvoiceLines(v ...*BillingInvoiceLine) *BillingInvoiceSplitLineGroupUpdateOne { ids := make([]string, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveBillingInvoiceLineIDs(ids...)}
// ClearCharge clears the "charge" edge to the Charge entity.func (_u *BillingInvoiceSplitLineGroupUpdateOne) ClearCharge() *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.ClearCharge() return _u}
// Where appends a list predicates to the BillingInvoiceSplitLineGroupUpdate builder.func (_u *BillingInvoiceSplitLineGroupUpdateOne) Where(ps ...predicate.BillingInvoiceSplitLineGroup) *BillingInvoiceSplitLineGroupUpdateOne { _u.mutation.Where(ps...) return _u}
// Select allows selecting one or more fields (columns) of the returned entity.// The default is selecting all fields defined in the entity schema.func (_u *BillingInvoiceSplitLineGroupUpdateOne) Select(field string, fields ...string) *BillingInvoiceSplitLineGroupUpdateOne { _u.fields = append([]string{field}, fields...) return _u}
// Save executes the query and returns the updated BillingInvoiceSplitLineGroup entity.func (_u *BillingInvoiceSplitLineGroupUpdateOne) Save(ctx context.Context) (*BillingInvoiceSplitLineGroup, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceSplitLineGroupUpdateOne) SaveX(ctx context.Context) *BillingInvoiceSplitLineGroup { node, err := _u.Save(ctx) if err != nil { panic(err) } return node}
// Exec executes the query on the entity.func (_u *BillingInvoiceSplitLineGroupUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceSplitLineGroupUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_u *BillingInvoiceSplitLineGroupUpdateOne) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := billinginvoicesplitlinegroup.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) }}
func (_u *BillingInvoiceSplitLineGroupUpdateOne) sqlSave(ctx context.Context) (_node *BillingInvoiceSplitLineGroup, err error) { _spec := sqlgraph.NewUpdateSpec(billinginvoicesplitlinegroup.Table, billinginvoicesplitlinegroup.Columns, sqlgraph.NewFieldSpec(billinginvoicesplitlinegroup.FieldID, field.TypeString)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "BillingInvoiceSplitLineGroup.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicesplitlinegroup.FieldID) for _, f := range fields { if !billinginvoicesplitlinegroup.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } if f != billinginvoicesplitlinegroup.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Metadata(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldMetadata, field.TypeJSON, value) } if _u.mutation.MetadataCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldMetadata, field.TypeJSON) } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.Name(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldName, field.TypeString, value) } if value, ok := _u.mutation.Description(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldDescription, field.TypeString, value) } if _u.mutation.DescriptionCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldDescription, field.TypeString) } if value, ok := _u.mutation.ServicePeriodStart(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldServicePeriodStart, field.TypeTime, value) } if value, ok := _u.mutation.ServicePeriodEnd(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldServicePeriodEnd, field.TypeTime, value) } if _u.mutation.UniqueReferenceIDCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldUniqueReferenceID, field.TypeString) } if value, ok := _u.mutation.RatecardDiscounts(); ok { vv, err := billinginvoicesplitlinegroup.ValueScanner.RatecardDiscounts.Value(value) if err != nil { return nil, err } _spec.SetField(billinginvoicesplitlinegroup.FieldRatecardDiscounts, field.TypeString, vv) } if _u.mutation.RatecardDiscountsCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldRatecardDiscounts, field.TypeString) } if _u.mutation.FeatureKeyCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldFeatureKey, field.TypeString) } if value, ok := _u.mutation.SubscriptionBillingPeriodFrom(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodFrom, field.TypeTime, value) } if _u.mutation.SubscriptionBillingPeriodFromCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodFrom, field.TypeTime) } if value, ok := _u.mutation.SubscriptionBillingPeriodTo(); ok { _spec.SetField(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodTo, field.TypeTime, value) } if _u.mutation.SubscriptionBillingPeriodToCleared() { _spec.ClearField(billinginvoicesplitlinegroup.FieldSubscriptionBillingPeriodTo, field.TypeTime) } if _u.mutation.BillingInvoiceLinesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: billinginvoicesplitlinegroup.BillingInvoiceLinesTable, Columns: []string{billinginvoicesplitlinegroup.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedBillingInvoiceLinesIDs(); len(nodes) > 0 && !_u.mutation.BillingInvoiceLinesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: billinginvoicesplitlinegroup.BillingInvoiceLinesTable, Columns: []string{billinginvoicesplitlinegroup.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.BillingInvoiceLinesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: billinginvoicesplitlinegroup.BillingInvoiceLinesTable, Columns: []string{billinginvoicesplitlinegroup.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.ChargeCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicesplitlinegroup.ChargeTable, Columns: []string{billinginvoicesplitlinegroup.ChargeColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(charge.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ChargeIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicesplitlinegroup.ChargeTable, Columns: []string{billinginvoicesplitlinegroup.ChargeColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(charge.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &BillingInvoiceSplitLineGroup{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoicesplitlinegroup.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200// Code generated by ent, DO NOT EDIT.
package db
import ( "fmt" "strings"
"entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceusagebasedlineconfig" "github.com/openmeterio/openmeter/openmeter/productcatalog")
// BillingInvoiceUsageBasedLineConfig is the model entity for the BillingInvoiceUsageBasedLineConfig schema.type BillingInvoiceUsageBasedLineConfig struct { config `json:"-"` // ID of the ent. ID string `json:"id,omitempty"` // Namespace holds the value of the "namespace" field. Namespace string `json:"namespace,omitempty"` // PriceType holds the value of the "price_type" field. PriceType productcatalog.PriceType `json:"price_type,omitempty"` // FeatureKey holds the value of the "feature_key" field. FeatureKey *string `json:"feature_key,omitempty"` // Price holds the value of the "price" field. Price *productcatalog.Price `json:"price,omitempty"` // PreLinePeriodQuantity holds the value of the "pre_line_period_quantity" field. PreLinePeriodQuantity *alpacadecimal.Decimal `json:"pre_line_period_quantity,omitempty"` // MeteredPreLinePeriodQuantity holds the value of the "metered_pre_line_period_quantity" field. MeteredPreLinePeriodQuantity *alpacadecimal.Decimal `json:"metered_pre_line_period_quantity,omitempty"` // MeteredQuantity holds the value of the "metered_quantity" field. MeteredQuantity *alpacadecimal.Decimal `json:"metered_quantity,omitempty"` // UnitConfig holds the value of the "unit_config" field. UnitConfig *productcatalog.UnitConfig `json:"unit_config,omitempty"` selectValues sql.SelectValues}
// scanValues returns the types for scanning values from sql.Rows.func (*BillingInvoiceUsageBasedLineConfig) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case billinginvoiceusagebasedlineconfig.FieldPreLinePeriodQuantity, billinginvoiceusagebasedlineconfig.FieldMeteredPreLinePeriodQuantity, billinginvoiceusagebasedlineconfig.FieldMeteredQuantity: values[i] = &sql.NullScanner{S: new(alpacadecimal.Decimal)} case billinginvoiceusagebasedlineconfig.FieldID, billinginvoiceusagebasedlineconfig.FieldNamespace, billinginvoiceusagebasedlineconfig.FieldPriceType, billinginvoiceusagebasedlineconfig.FieldFeatureKey: values[i] = new(sql.NullString) case billinginvoiceusagebasedlineconfig.FieldPrice: values[i] = billinginvoiceusagebasedlineconfig.ValueScanner.Price.ScanValue() case billinginvoiceusagebasedlineconfig.FieldUnitConfig: values[i] = billinginvoiceusagebasedlineconfig.ValueScanner.UnitConfig.ScanValue() default: values[i] = new(sql.UnknownType) } } return values, nil}
// assignValues assigns the values that were returned from sql.Rows (after scanning)// to the BillingInvoiceUsageBasedLineConfig fields.func (_m *BillingInvoiceUsageBasedLineConfig) 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) } for i := range columns { switch columns[i] { case billinginvoiceusagebasedlineconfig.FieldID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value.Valid { _m.ID = value.String } case billinginvoiceusagebasedlineconfig.FieldNamespace: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field namespace", values[i]) } else if value.Valid { _m.Namespace = value.String } case billinginvoiceusagebasedlineconfig.FieldPriceType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field price_type", values[i]) } else if value.Valid { _m.PriceType = productcatalog.PriceType(value.String) } case billinginvoiceusagebasedlineconfig.FieldFeatureKey: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field feature_key", values[i]) } else if value.Valid { _m.FeatureKey = new(string) *_m.FeatureKey = value.String } case billinginvoiceusagebasedlineconfig.FieldPrice: if value, err := billinginvoiceusagebasedlineconfig.ValueScanner.Price.FromValue(values[i]); err != nil { return err } else { _m.Price = value } case billinginvoiceusagebasedlineconfig.FieldPreLinePeriodQuantity: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field pre_line_period_quantity", values[i]) } else if value.Valid { _m.PreLinePeriodQuantity = new(alpacadecimal.Decimal) *_m.PreLinePeriodQuantity = *value.S.(*alpacadecimal.Decimal) } case billinginvoiceusagebasedlineconfig.FieldMeteredPreLinePeriodQuantity: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field metered_pre_line_period_quantity", values[i]) } else if value.Valid { _m.MeteredPreLinePeriodQuantity = new(alpacadecimal.Decimal) *_m.MeteredPreLinePeriodQuantity = *value.S.(*alpacadecimal.Decimal) } case billinginvoiceusagebasedlineconfig.FieldMeteredQuantity: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field metered_quantity", values[i]) } else if value.Valid { _m.MeteredQuantity = new(alpacadecimal.Decimal) *_m.MeteredQuantity = *value.S.(*alpacadecimal.Decimal) } case billinginvoiceusagebasedlineconfig.FieldUnitConfig: if value, err := billinginvoiceusagebasedlineconfig.ValueScanner.UnitConfig.FromValue(values[i]); err != nil { return err } else { _m.UnitConfig = value } default: _m.selectValues.Set(columns[i], values[i]) } } return nil}
// Value returns the ent.Value that was dynamically selected and assigned to the BillingInvoiceUsageBasedLineConfig.// This includes values selected through modifiers, order, etc.func (_m *BillingInvoiceUsageBasedLineConfig) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name)}
// Update returns a builder for updating this BillingInvoiceUsageBasedLineConfig.// Note that you need to call BillingInvoiceUsageBasedLineConfig.Unwrap() before calling this method if this BillingInvoiceUsageBasedLineConfig// was returned from a transaction, and the transaction was committed or rolled back.func (_m *BillingInvoiceUsageBasedLineConfig) Update() *BillingInvoiceUsageBasedLineConfigUpdateOne { return NewBillingInvoiceUsageBasedLineConfigClient(_m.config).UpdateOne(_m)}
// Unwrap unwraps the BillingInvoiceUsageBasedLineConfig 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 (_m *BillingInvoiceUsageBasedLineConfig) Unwrap() *BillingInvoiceUsageBasedLineConfig { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("db: BillingInvoiceUsageBasedLineConfig is not a transactional entity") } _m.config.driver = _tx.drv return _m}
// String implements the fmt.Stringer.func (_m *BillingInvoiceUsageBasedLineConfig) String() string { var builder strings.Builder builder.WriteString("BillingInvoiceUsageBasedLineConfig(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("namespace=") builder.WriteString(_m.Namespace) builder.WriteString(", ") builder.WriteString("price_type=") builder.WriteString(fmt.Sprintf("%v", _m.PriceType)) builder.WriteString(", ") if v := _m.FeatureKey; v != nil { builder.WriteString("feature_key=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("price=") builder.WriteString(fmt.Sprintf("%v", _m.Price)) builder.WriteString(", ") if v := _m.PreLinePeriodQuantity; v != nil { builder.WriteString("pre_line_period_quantity=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") if v := _m.MeteredPreLinePeriodQuantity; v != nil { builder.WriteString("metered_pre_line_period_quantity=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") if v := _m.MeteredQuantity; v != nil { builder.WriteString("metered_quantity=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") if v := _m.UnitConfig; v != nil { builder.WriteString("unit_config=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteByte(')') return builder.String()}
// BillingInvoiceUsageBasedLineConfigs is a parsable slice of BillingInvoiceUsageBasedLineConfig.type BillingInvoiceUsageBasedLineConfigs []*BillingInvoiceUsageBasedLineConfig123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129// Code generated by ent, DO NOT EDIT.
package billinginvoiceusagebasedlineconfig
import ( "fmt"
"entgo.io/ent/dialect/sql" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/productcatalog")
const ( // Label holds the string label denoting the billinginvoiceusagebasedlineconfig type in the database. Label = "billing_invoice_usage_based_line_config" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldNamespace holds the string denoting the namespace field in the database. FieldNamespace = "namespace" // FieldPriceType holds the string denoting the price_type field in the database. FieldPriceType = "price_type" // FieldFeatureKey holds the string denoting the feature_key field in the database. FieldFeatureKey = "feature_key" // FieldPrice holds the string denoting the price field in the database. FieldPrice = "price" // FieldPreLinePeriodQuantity holds the string denoting the pre_line_period_quantity field in the database. FieldPreLinePeriodQuantity = "pre_line_period_quantity" // FieldMeteredPreLinePeriodQuantity holds the string denoting the metered_pre_line_period_quantity field in the database. FieldMeteredPreLinePeriodQuantity = "metered_pre_line_period_quantity" // FieldMeteredQuantity holds the string denoting the metered_quantity field in the database. FieldMeteredQuantity = "metered_quantity" // FieldUnitConfig holds the string denoting the unit_config field in the database. FieldUnitConfig = "unit_config" // Table holds the table name of the billinginvoiceusagebasedlineconfig in the database. Table = "billing_invoice_usage_based_line_configs")
// Columns holds all SQL columns for billinginvoiceusagebasedlineconfig fields.var Columns = []string{ FieldID, FieldNamespace, FieldPriceType, FieldFeatureKey, FieldPrice, FieldPreLinePeriodQuantity, FieldMeteredPreLinePeriodQuantity, FieldMeteredQuantity, FieldUnitConfig,}
// ValidColumn reports if the column name is valid (part of the table columns).func ValidColumn(column string) bool { for i := range Columns { if column == Columns[i] { return true } } return false}
var ( // NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. NamespaceValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() string // ValueScanner of all BillingInvoiceUsageBasedLineConfig fields. ValueScanner struct { Price field.TypeValueScanner[*productcatalog.Price] UnitConfig field.TypeValueScanner[*productcatalog.UnitConfig] })
// PriceTypeValidator is a validator for the "price_type" field enum values. It is called by the builders before save.func PriceTypeValidator(pt productcatalog.PriceType) error { switch pt { case "flat", "unit", "tiered", "dynamic", "package": return nil default: return fmt.Errorf("billinginvoiceusagebasedlineconfig: invalid enum value for price_type field: %q", pt) }}
// OrderOption defines the ordering options for the BillingInvoiceUsageBasedLineConfig queries.type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc()}
// ByNamespace orders the results by the namespace field.func ByNamespace(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldNamespace, opts...).ToFunc()}
// ByPriceType orders the results by the price_type field.func ByPriceType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPriceType, opts...).ToFunc()}
// ByFeatureKey orders the results by the feature_key field.func ByFeatureKey(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldFeatureKey, opts...).ToFunc()}
// ByPrice orders the results by the price field.func ByPrice(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPrice, opts...).ToFunc()}
// ByPreLinePeriodQuantity orders the results by the pre_line_period_quantity field.func ByPreLinePeriodQuantity(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPreLinePeriodQuantity, opts...).ToFunc()}
// ByMeteredPreLinePeriodQuantity orders the results by the metered_pre_line_period_quantity field.func ByMeteredPreLinePeriodQuantity(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMeteredPreLinePeriodQuantity, opts...).ToFunc()}
// ByMeteredQuantity orders the results by the metered_quantity field.func ByMeteredQuantity(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMeteredQuantity, opts...).ToFunc()}
// ByUnitConfig orders the results by the unit_config field.func ByUnitConfig(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUnitConfig, opts...).ToFunc()}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435// Code generated by ent, DO NOT EDIT.
package billinginvoiceusagebasedlineconfig
import ( "entgo.io/ent/dialect/sql" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" "github.com/openmeterio/openmeter/openmeter/productcatalog")
// ID filters vertices based on their ID field.func ID(id string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldID, id))}
// IDEQ applies the EQ predicate on the ID field.func IDEQ(id string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldID, id))}
// IDNEQ applies the NEQ predicate on the ID field.func IDNEQ(id string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNEQ(FieldID, id))}
// IDIn applies the In predicate on the ID field.func IDIn(ids ...string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIn(FieldID, ids...))}
// IDNotIn applies the NotIn predicate on the ID field.func IDNotIn(ids ...string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotIn(FieldID, ids...))}
// IDGT applies the GT predicate on the ID field.func IDGT(id string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGT(FieldID, id))}
// IDGTE applies the GTE predicate on the ID field.func IDGTE(id string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGTE(FieldID, id))}
// IDLT applies the LT predicate on the ID field.func IDLT(id string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLT(FieldID, id))}
// IDLTE applies the LTE predicate on the ID field.func IDLTE(id string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLTE(FieldID, id))}
// IDEqualFold applies the EqualFold predicate on the ID field.func IDEqualFold(id string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEqualFold(FieldID, id))}
// IDContainsFold applies the ContainsFold predicate on the ID field.func IDContainsFold(id string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldContainsFold(FieldID, id))}
// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ.func Namespace(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldNamespace, v))}
// FeatureKey applies equality check predicate on the "feature_key" field. It's identical to FeatureKeyEQ.func FeatureKey(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldFeatureKey, v))}
// PreLinePeriodQuantity applies equality check predicate on the "pre_line_period_quantity" field. It's identical to PreLinePeriodQuantityEQ.func PreLinePeriodQuantity(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldPreLinePeriodQuantity, v))}
// MeteredPreLinePeriodQuantity applies equality check predicate on the "metered_pre_line_period_quantity" field. It's identical to MeteredPreLinePeriodQuantityEQ.func MeteredPreLinePeriodQuantity(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldMeteredPreLinePeriodQuantity, v))}
// MeteredQuantity applies equality check predicate on the "metered_quantity" field. It's identical to MeteredQuantityEQ.func MeteredQuantity(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldMeteredQuantity, v))}
// NamespaceEQ applies the EQ predicate on the "namespace" field.func NamespaceEQ(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldNamespace, v))}
// NamespaceNEQ applies the NEQ predicate on the "namespace" field.func NamespaceNEQ(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNEQ(FieldNamespace, v))}
// NamespaceIn applies the In predicate on the "namespace" field.func NamespaceIn(vs ...string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIn(FieldNamespace, vs...))}
// NamespaceNotIn applies the NotIn predicate on the "namespace" field.func NamespaceNotIn(vs ...string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotIn(FieldNamespace, vs...))}
// NamespaceGT applies the GT predicate on the "namespace" field.func NamespaceGT(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGT(FieldNamespace, v))}
// NamespaceGTE applies the GTE predicate on the "namespace" field.func NamespaceGTE(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGTE(FieldNamespace, v))}
// NamespaceLT applies the LT predicate on the "namespace" field.func NamespaceLT(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLT(FieldNamespace, v))}
// NamespaceLTE applies the LTE predicate on the "namespace" field.func NamespaceLTE(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLTE(FieldNamespace, v))}
// NamespaceContains applies the Contains predicate on the "namespace" field.func NamespaceContains(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldContains(FieldNamespace, v))}
// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field.func NamespaceHasPrefix(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldHasPrefix(FieldNamespace, v))}
// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field.func NamespaceHasSuffix(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldHasSuffix(FieldNamespace, v))}
// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field.func NamespaceEqualFold(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEqualFold(FieldNamespace, v))}
// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field.func NamespaceContainsFold(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldContainsFold(FieldNamespace, v))}
// PriceTypeEQ applies the EQ predicate on the "price_type" field.func PriceTypeEQ(v productcatalog.PriceType) predicate.BillingInvoiceUsageBasedLineConfig { vc := v return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldPriceType, vc))}
// PriceTypeNEQ applies the NEQ predicate on the "price_type" field.func PriceTypeNEQ(v productcatalog.PriceType) predicate.BillingInvoiceUsageBasedLineConfig { vc := v return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNEQ(FieldPriceType, vc))}
// PriceTypeIn applies the In predicate on the "price_type" field.func PriceTypeIn(vs ...productcatalog.PriceType) predicate.BillingInvoiceUsageBasedLineConfig { v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIn(FieldPriceType, v...))}
// PriceTypeNotIn applies the NotIn predicate on the "price_type" field.func PriceTypeNotIn(vs ...productcatalog.PriceType) predicate.BillingInvoiceUsageBasedLineConfig { v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotIn(FieldPriceType, v...))}
// FeatureKeyEQ applies the EQ predicate on the "feature_key" field.func FeatureKeyEQ(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldFeatureKey, v))}
// FeatureKeyNEQ applies the NEQ predicate on the "feature_key" field.func FeatureKeyNEQ(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNEQ(FieldFeatureKey, v))}
// FeatureKeyIn applies the In predicate on the "feature_key" field.func FeatureKeyIn(vs ...string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIn(FieldFeatureKey, vs...))}
// FeatureKeyNotIn applies the NotIn predicate on the "feature_key" field.func FeatureKeyNotIn(vs ...string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotIn(FieldFeatureKey, vs...))}
// FeatureKeyGT applies the GT predicate on the "feature_key" field.func FeatureKeyGT(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGT(FieldFeatureKey, v))}
// FeatureKeyGTE applies the GTE predicate on the "feature_key" field.func FeatureKeyGTE(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGTE(FieldFeatureKey, v))}
// FeatureKeyLT applies the LT predicate on the "feature_key" field.func FeatureKeyLT(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLT(FieldFeatureKey, v))}
// FeatureKeyLTE applies the LTE predicate on the "feature_key" field.func FeatureKeyLTE(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLTE(FieldFeatureKey, v))}
// FeatureKeyContains applies the Contains predicate on the "feature_key" field.func FeatureKeyContains(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldContains(FieldFeatureKey, v))}
// FeatureKeyHasPrefix applies the HasPrefix predicate on the "feature_key" field.func FeatureKeyHasPrefix(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldHasPrefix(FieldFeatureKey, v))}
// FeatureKeyHasSuffix applies the HasSuffix predicate on the "feature_key" field.func FeatureKeyHasSuffix(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldHasSuffix(FieldFeatureKey, v))}
// FeatureKeyIsNil applies the IsNil predicate on the "feature_key" field.func FeatureKeyIsNil() predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIsNull(FieldFeatureKey))}
// FeatureKeyNotNil applies the NotNil predicate on the "feature_key" field.func FeatureKeyNotNil() predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotNull(FieldFeatureKey))}
// FeatureKeyEqualFold applies the EqualFold predicate on the "feature_key" field.func FeatureKeyEqualFold(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEqualFold(FieldFeatureKey, v))}
// FeatureKeyContainsFold applies the ContainsFold predicate on the "feature_key" field.func FeatureKeyContainsFold(v string) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldContainsFold(FieldFeatureKey, v))}
// PreLinePeriodQuantityEQ applies the EQ predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityNEQ applies the NEQ predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityNEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNEQ(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityIn applies the In predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIn(FieldPreLinePeriodQuantity, vs...))}
// PreLinePeriodQuantityNotIn applies the NotIn predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityNotIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotIn(FieldPreLinePeriodQuantity, vs...))}
// PreLinePeriodQuantityGT applies the GT predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityGT(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGT(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityGTE applies the GTE predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityGTE(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGTE(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityLT applies the LT predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityLT(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLT(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityLTE applies the LTE predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityLTE(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLTE(FieldPreLinePeriodQuantity, v))}
// PreLinePeriodQuantityIsNil applies the IsNil predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityIsNil() predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIsNull(FieldPreLinePeriodQuantity))}
// PreLinePeriodQuantityNotNil applies the NotNil predicate on the "pre_line_period_quantity" field.func PreLinePeriodQuantityNotNil() predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotNull(FieldPreLinePeriodQuantity))}
// MeteredPreLinePeriodQuantityEQ applies the EQ predicate on the "metered_pre_line_period_quantity" field.func MeteredPreLinePeriodQuantityEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldMeteredPreLinePeriodQuantity, v))}
// MeteredPreLinePeriodQuantityNEQ applies the NEQ predicate on the "metered_pre_line_period_quantity" field.func MeteredPreLinePeriodQuantityNEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNEQ(FieldMeteredPreLinePeriodQuantity, v))}
// MeteredPreLinePeriodQuantityIn applies the In predicate on the "metered_pre_line_period_quantity" field.func MeteredPreLinePeriodQuantityIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIn(FieldMeteredPreLinePeriodQuantity, vs...))}
// MeteredPreLinePeriodQuantityNotIn applies the NotIn predicate on the "metered_pre_line_period_quantity" field.func MeteredPreLinePeriodQuantityNotIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotIn(FieldMeteredPreLinePeriodQuantity, vs...))}
// MeteredPreLinePeriodQuantityGT applies the GT predicate on the "metered_pre_line_period_quantity" field.func MeteredPreLinePeriodQuantityGT(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGT(FieldMeteredPreLinePeriodQuantity, v))}
// MeteredPreLinePeriodQuantityGTE applies the GTE predicate on the "metered_pre_line_period_quantity" field.func MeteredPreLinePeriodQuantityGTE(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGTE(FieldMeteredPreLinePeriodQuantity, v))}
// MeteredPreLinePeriodQuantityLT applies the LT predicate on the "metered_pre_line_period_quantity" field.func MeteredPreLinePeriodQuantityLT(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLT(FieldMeteredPreLinePeriodQuantity, v))}
// MeteredPreLinePeriodQuantityLTE applies the LTE predicate on the "metered_pre_line_period_quantity" field.func MeteredPreLinePeriodQuantityLTE(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLTE(FieldMeteredPreLinePeriodQuantity, v))}
// MeteredPreLinePeriodQuantityIsNil applies the IsNil predicate on the "metered_pre_line_period_quantity" field.func MeteredPreLinePeriodQuantityIsNil() predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIsNull(FieldMeteredPreLinePeriodQuantity))}
// MeteredPreLinePeriodQuantityNotNil applies the NotNil predicate on the "metered_pre_line_period_quantity" field.func MeteredPreLinePeriodQuantityNotNil() predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotNull(FieldMeteredPreLinePeriodQuantity))}
// MeteredQuantityEQ applies the EQ predicate on the "metered_quantity" field.func MeteredQuantityEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldEQ(FieldMeteredQuantity, v))}
// MeteredQuantityNEQ applies the NEQ predicate on the "metered_quantity" field.func MeteredQuantityNEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNEQ(FieldMeteredQuantity, v))}
// MeteredQuantityIn applies the In predicate on the "metered_quantity" field.func MeteredQuantityIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIn(FieldMeteredQuantity, vs...))}
// MeteredQuantityNotIn applies the NotIn predicate on the "metered_quantity" field.func MeteredQuantityNotIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotIn(FieldMeteredQuantity, vs...))}
// MeteredQuantityGT applies the GT predicate on the "metered_quantity" field.func MeteredQuantityGT(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGT(FieldMeteredQuantity, v))}
// MeteredQuantityGTE applies the GTE predicate on the "metered_quantity" field.func MeteredQuantityGTE(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldGTE(FieldMeteredQuantity, v))}
// MeteredQuantityLT applies the LT predicate on the "metered_quantity" field.func MeteredQuantityLT(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLT(FieldMeteredQuantity, v))}
// MeteredQuantityLTE applies the LTE predicate on the "metered_quantity" field.func MeteredQuantityLTE(v alpacadecimal.Decimal) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldLTE(FieldMeteredQuantity, v))}
// MeteredQuantityIsNil applies the IsNil predicate on the "metered_quantity" field.func MeteredQuantityIsNil() predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIsNull(FieldMeteredQuantity))}
// MeteredQuantityNotNil applies the NotNil predicate on the "metered_quantity" field.func MeteredQuantityNotNil() predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotNull(FieldMeteredQuantity))}
// UnitConfigIsNil applies the IsNil predicate on the "unit_config" field.func UnitConfigIsNil() predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldIsNull(FieldUnitConfig))}
// UnitConfigNotNil applies the NotNil predicate on the "unit_config" field.func UnitConfigNotNil() predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.FieldNotNull(FieldUnitConfig))}
// And groups predicates with the AND operator between them.func And(predicates ...predicate.BillingInvoiceUsageBasedLineConfig) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.AndPredicates(predicates...))}
// Or groups predicates with the OR operator between them.func Or(predicates ...predicate.BillingInvoiceUsageBasedLineConfig) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.OrPredicates(predicates...))}
// Not applies the not operator on the given predicate.func Not(p predicate.BillingInvoiceUsageBasedLineConfig) predicate.BillingInvoiceUsageBasedLineConfig { return predicate.BillingInvoiceUsageBasedLineConfig(sql.NotPredicates(p))}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt"
"entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceusagebasedlineconfig" "github.com/openmeterio/openmeter/openmeter/productcatalog")
// BillingInvoiceUsageBasedLineConfigCreate is the builder for creating a BillingInvoiceUsageBasedLineConfig entity.type BillingInvoiceUsageBasedLineConfigCreate struct { config mutation *BillingInvoiceUsageBasedLineConfigMutation hooks []Hook conflict []sql.ConflictOption}
// SetNamespace sets the "namespace" field.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetNamespace(v string) *BillingInvoiceUsageBasedLineConfigCreate { _c.mutation.SetNamespace(v) return _c}
// SetPriceType sets the "price_type" field.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetPriceType(v productcatalog.PriceType) *BillingInvoiceUsageBasedLineConfigCreate { _c.mutation.SetPriceType(v) return _c}
// SetFeatureKey sets the "feature_key" field.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetFeatureKey(v string) *BillingInvoiceUsageBasedLineConfigCreate { _c.mutation.SetFeatureKey(v) return _c}
// SetNillableFeatureKey sets the "feature_key" field if the given value is not nil.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetNillableFeatureKey(v *string) *BillingInvoiceUsageBasedLineConfigCreate { if v != nil { _c.SetFeatureKey(*v) } return _c}
// SetPrice sets the "price" field.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetPrice(v *productcatalog.Price) *BillingInvoiceUsageBasedLineConfigCreate { _c.mutation.SetPrice(v) return _c}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigCreate { _c.mutation.SetPreLinePeriodQuantity(v) return _c}
// SetNillablePreLinePeriodQuantity sets the "pre_line_period_quantity" field if the given value is not nil.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetNillablePreLinePeriodQuantity(v *alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigCreate { if v != nil { _c.SetPreLinePeriodQuantity(*v) } return _c}
// SetMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetMeteredPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigCreate { _c.mutation.SetMeteredPreLinePeriodQuantity(v) return _c}
// SetNillableMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field if the given value is not nil.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetNillableMeteredPreLinePeriodQuantity(v *alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigCreate { if v != nil { _c.SetMeteredPreLinePeriodQuantity(*v) } return _c}
// SetMeteredQuantity sets the "metered_quantity" field.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetMeteredQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigCreate { _c.mutation.SetMeteredQuantity(v) return _c}
// SetNillableMeteredQuantity sets the "metered_quantity" field if the given value is not nil.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetNillableMeteredQuantity(v *alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigCreate { if v != nil { _c.SetMeteredQuantity(*v) } return _c}
// SetUnitConfig sets the "unit_config" field.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetUnitConfig(v *productcatalog.UnitConfig) *BillingInvoiceUsageBasedLineConfigCreate { _c.mutation.SetUnitConfig(v) return _c}
// SetID sets the "id" field.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetID(v string) *BillingInvoiceUsageBasedLineConfigCreate { _c.mutation.SetID(v) return _c}
// SetNillableID sets the "id" field if the given value is not nil.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SetNillableID(v *string) *BillingInvoiceUsageBasedLineConfigCreate { if v != nil { _c.SetID(*v) } return _c}
// Mutation returns the BillingInvoiceUsageBasedLineConfigMutation object of the builder.func (_c *BillingInvoiceUsageBasedLineConfigCreate) Mutation() *BillingInvoiceUsageBasedLineConfigMutation { return _c.mutation}
// Save creates the BillingInvoiceUsageBasedLineConfig in the database.func (_c *BillingInvoiceUsageBasedLineConfigCreate) Save(ctx context.Context) (*BillingInvoiceUsageBasedLineConfig, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)}
// SaveX calls Save and panics if Save returns an error.func (_c *BillingInvoiceUsageBasedLineConfigCreate) SaveX(ctx context.Context) *BillingInvoiceUsageBasedLineConfig { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceUsageBasedLineConfigCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceUsageBasedLineConfigCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_c *BillingInvoiceUsageBasedLineConfigCreate) defaults() { if _, ok := _c.mutation.ID(); !ok { v := billinginvoiceusagebasedlineconfig.DefaultID() _c.mutation.SetID(v) }}
// check runs all checks and user-defined validators on the builder.func (_c *BillingInvoiceUsageBasedLineConfigCreate) check() error { if _, ok := _c.mutation.Namespace(); !ok { return &ValidationError{Name: "namespace", err: errors.New(`db: missing required field "BillingInvoiceUsageBasedLineConfig.namespace"`)} } if v, ok := _c.mutation.Namespace(); ok { if err := billinginvoiceusagebasedlineconfig.NamespaceValidator(v); err != nil { return &ValidationError{Name: "namespace", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceUsageBasedLineConfig.namespace": %w`, err)} } } if _, ok := _c.mutation.PriceType(); !ok { return &ValidationError{Name: "price_type", err: errors.New(`db: missing required field "BillingInvoiceUsageBasedLineConfig.price_type"`)} } if v, ok := _c.mutation.PriceType(); ok { if err := billinginvoiceusagebasedlineconfig.PriceTypeValidator(v); err != nil { return &ValidationError{Name: "price_type", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceUsageBasedLineConfig.price_type": %w`, err)} } } if _, ok := _c.mutation.Price(); !ok { return &ValidationError{Name: "price", err: errors.New(`db: missing required field "BillingInvoiceUsageBasedLineConfig.price"`)} } if v, ok := _c.mutation.Price(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "price", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceUsageBasedLineConfig.price": %w`, err)} } } if v, ok := _c.mutation.UnitConfig(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "unit_config", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceUsageBasedLineConfig.unit_config": %w`, err)} } } return nil}
func (_c *BillingInvoiceUsageBasedLineConfigCreate) sqlSave(ctx context.Context) (*BillingInvoiceUsageBasedLineConfig, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec, err := _c.createSpec() if err != nil { return nil, err } if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(string); ok { _node.ID = id } else { return nil, fmt.Errorf("unexpected BillingInvoiceUsageBasedLineConfig.ID type: %T", _spec.ID.Value) } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil}
func (_c *BillingInvoiceUsageBasedLineConfigCreate) createSpec() (*BillingInvoiceUsageBasedLineConfig, *sqlgraph.CreateSpec, error) { var ( _node = &BillingInvoiceUsageBasedLineConfig{config: _c.config} _spec = sqlgraph.NewCreateSpec(billinginvoiceusagebasedlineconfig.Table, sqlgraph.NewFieldSpec(billinginvoiceusagebasedlineconfig.FieldID, field.TypeString)) ) _spec.OnConflict = _c.conflict if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = id } if value, ok := _c.mutation.Namespace(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldNamespace, field.TypeString, value) _node.Namespace = value } if value, ok := _c.mutation.PriceType(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldPriceType, field.TypeEnum, value) _node.PriceType = value } if value, ok := _c.mutation.FeatureKey(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldFeatureKey, field.TypeString, value) _node.FeatureKey = &value } if value, ok := _c.mutation.Price(); ok { vv, err := billinginvoiceusagebasedlineconfig.ValueScanner.Price.Value(value) if err != nil { return nil, nil, err } _spec.SetField(billinginvoiceusagebasedlineconfig.FieldPrice, field.TypeString, vv) _node.Price = value } if value, ok := _c.mutation.PreLinePeriodQuantity(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldPreLinePeriodQuantity, field.TypeOther, value) _node.PreLinePeriodQuantity = &value } if value, ok := _c.mutation.MeteredPreLinePeriodQuantity(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldMeteredPreLinePeriodQuantity, field.TypeOther, value) _node.MeteredPreLinePeriodQuantity = &value } if value, ok := _c.mutation.MeteredQuantity(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldMeteredQuantity, field.TypeOther, value) _node.MeteredQuantity = &value } if value, ok := _c.mutation.UnitConfig(); ok { vv, err := billinginvoiceusagebasedlineconfig.ValueScanner.UnitConfig.Value(value) if err != nil { return nil, nil, err } _spec.SetField(billinginvoiceusagebasedlineconfig.FieldUnitConfig, field.TypeString, vv) _node.UnitConfig = value } return _node, _spec, nil}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceUsageBasedLineConfig.Create().// SetNamespace(v).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceUsageBasedLineConfigUpsert) {// SetNamespace(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceUsageBasedLineConfigCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceUsageBasedLineConfigUpsertOne { _c.conflict = opts return &BillingInvoiceUsageBasedLineConfigUpsertOne{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceUsageBasedLineConfig.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceUsageBasedLineConfigCreate) OnConflictColumns(columns ...string) *BillingInvoiceUsageBasedLineConfigUpsertOne { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceUsageBasedLineConfigUpsertOne{ create: _c, }}
type ( // BillingInvoiceUsageBasedLineConfigUpsertOne is the builder for "upsert"-ing // one BillingInvoiceUsageBasedLineConfig node. BillingInvoiceUsageBasedLineConfigUpsertOne struct { create *BillingInvoiceUsageBasedLineConfigCreate }
// BillingInvoiceUsageBasedLineConfigUpsert is the "OnConflict" setter. BillingInvoiceUsageBasedLineConfigUpsert struct { *sql.UpdateSet })
// SetPriceType sets the "price_type" field.func (u *BillingInvoiceUsageBasedLineConfigUpsert) SetPriceType(v productcatalog.PriceType) *BillingInvoiceUsageBasedLineConfigUpsert { u.Set(billinginvoiceusagebasedlineconfig.FieldPriceType, v) return u}
// UpdatePriceType sets the "price_type" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsert) UpdatePriceType() *BillingInvoiceUsageBasedLineConfigUpsert { u.SetExcluded(billinginvoiceusagebasedlineconfig.FieldPriceType) return u}
// SetPrice sets the "price" field.func (u *BillingInvoiceUsageBasedLineConfigUpsert) SetPrice(v *productcatalog.Price) *BillingInvoiceUsageBasedLineConfigUpsert { u.Set(billinginvoiceusagebasedlineconfig.FieldPrice, v) return u}
// UpdatePrice sets the "price" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsert) UpdatePrice() *BillingInvoiceUsageBasedLineConfigUpsert { u.SetExcluded(billinginvoiceusagebasedlineconfig.FieldPrice) return u}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsert) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpsert { u.Set(billinginvoiceusagebasedlineconfig.FieldPreLinePeriodQuantity, v) return u}
// UpdatePreLinePeriodQuantity sets the "pre_line_period_quantity" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsert) UpdatePreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsert { u.SetExcluded(billinginvoiceusagebasedlineconfig.FieldPreLinePeriodQuantity) return u}
// ClearPreLinePeriodQuantity clears the value of the "pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsert) ClearPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsert { u.SetNull(billinginvoiceusagebasedlineconfig.FieldPreLinePeriodQuantity) return u}
// SetMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsert) SetMeteredPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpsert { u.Set(billinginvoiceusagebasedlineconfig.FieldMeteredPreLinePeriodQuantity, v) return u}
// UpdateMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsert) UpdateMeteredPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsert { u.SetExcluded(billinginvoiceusagebasedlineconfig.FieldMeteredPreLinePeriodQuantity) return u}
// ClearMeteredPreLinePeriodQuantity clears the value of the "metered_pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsert) ClearMeteredPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsert { u.SetNull(billinginvoiceusagebasedlineconfig.FieldMeteredPreLinePeriodQuantity) return u}
// SetMeteredQuantity sets the "metered_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsert) SetMeteredQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpsert { u.Set(billinginvoiceusagebasedlineconfig.FieldMeteredQuantity, v) return u}
// UpdateMeteredQuantity sets the "metered_quantity" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsert) UpdateMeteredQuantity() *BillingInvoiceUsageBasedLineConfigUpsert { u.SetExcluded(billinginvoiceusagebasedlineconfig.FieldMeteredQuantity) return u}
// ClearMeteredQuantity clears the value of the "metered_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsert) ClearMeteredQuantity() *BillingInvoiceUsageBasedLineConfigUpsert { u.SetNull(billinginvoiceusagebasedlineconfig.FieldMeteredQuantity) return u}
// SetUnitConfig sets the "unit_config" field.func (u *BillingInvoiceUsageBasedLineConfigUpsert) SetUnitConfig(v *productcatalog.UnitConfig) *BillingInvoiceUsageBasedLineConfigUpsert { u.Set(billinginvoiceusagebasedlineconfig.FieldUnitConfig, v) return u}
// UpdateUnitConfig sets the "unit_config" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsert) UpdateUnitConfig() *BillingInvoiceUsageBasedLineConfigUpsert { u.SetExcluded(billinginvoiceusagebasedlineconfig.FieldUnitConfig) return u}
// ClearUnitConfig clears the value of the "unit_config" field.func (u *BillingInvoiceUsageBasedLineConfigUpsert) ClearUnitConfig() *BillingInvoiceUsageBasedLineConfigUpsert { u.SetNull(billinginvoiceusagebasedlineconfig.FieldUnitConfig) return u}
// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.// Using this option is equivalent to using://// client.BillingInvoiceUsageBasedLineConfig.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoiceusagebasedlineconfig.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) UpdateNewValues() *BillingInvoiceUsageBasedLineConfigUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { if _, exists := u.create.mutation.ID(); exists { s.SetIgnore(billinginvoiceusagebasedlineconfig.FieldID) } if _, exists := u.create.mutation.Namespace(); exists { s.SetIgnore(billinginvoiceusagebasedlineconfig.FieldNamespace) } if _, exists := u.create.mutation.FeatureKey(); exists { s.SetIgnore(billinginvoiceusagebasedlineconfig.FieldFeatureKey) } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceUsageBasedLineConfig.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) Ignore() *BillingInvoiceUsageBasedLineConfigUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) DoNothing() *BillingInvoiceUsageBasedLineConfigUpsertOne { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceUsageBasedLineConfigCreate.OnConflict// documentation for more info.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) Update(set func(*BillingInvoiceUsageBasedLineConfigUpsert)) *BillingInvoiceUsageBasedLineConfigUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceUsageBasedLineConfigUpsert{UpdateSet: update}) })) return u}
// SetPriceType sets the "price_type" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) SetPriceType(v productcatalog.PriceType) *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetPriceType(v) })}
// UpdatePriceType sets the "price_type" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) UpdatePriceType() *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdatePriceType() })}
// SetPrice sets the "price" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) SetPrice(v *productcatalog.Price) *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetPrice(v) })}
// UpdatePrice sets the "price" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) UpdatePrice() *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdatePrice() })}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetPreLinePeriodQuantity(v) })}
// UpdatePreLinePeriodQuantity sets the "pre_line_period_quantity" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) UpdatePreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdatePreLinePeriodQuantity() })}
// ClearPreLinePeriodQuantity clears the value of the "pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) ClearPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.ClearPreLinePeriodQuantity() })}
// SetMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) SetMeteredPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetMeteredPreLinePeriodQuantity(v) })}
// UpdateMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) UpdateMeteredPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdateMeteredPreLinePeriodQuantity() })}
// ClearMeteredPreLinePeriodQuantity clears the value of the "metered_pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) ClearMeteredPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.ClearMeteredPreLinePeriodQuantity() })}
// SetMeteredQuantity sets the "metered_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) SetMeteredQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetMeteredQuantity(v) })}
// UpdateMeteredQuantity sets the "metered_quantity" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) UpdateMeteredQuantity() *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdateMeteredQuantity() })}
// ClearMeteredQuantity clears the value of the "metered_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) ClearMeteredQuantity() *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.ClearMeteredQuantity() })}
// SetUnitConfig sets the "unit_config" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) SetUnitConfig(v *productcatalog.UnitConfig) *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetUnitConfig(v) })}
// UpdateUnitConfig sets the "unit_config" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) UpdateUnitConfig() *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdateUnitConfig() })}
// ClearUnitConfig clears the value of the "unit_config" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) ClearUnitConfig() *BillingInvoiceUsageBasedLineConfigUpsertOne { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.ClearUnitConfig() })}
// Exec executes the query.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceUsageBasedLineConfigCreate.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}
// Exec executes the UPSERT query and returns the inserted/updated ID.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) ID(ctx context.Context) (id string, err error) { if u.create.driver.Dialect() == dialect.MySQL { // In case of "ON CONFLICT", there is no way to get back non-numeric ID // fields from the database since MySQL does not support the RETURNING clause. return id, errors.New("db: BillingInvoiceUsageBasedLineConfigUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceUsageBasedLineConfigUpsertOne.Exec instead") } node, err := u.create.Save(ctx) if err != nil { return id, err } return node.ID, nil}
// IDX is like ID, but panics if an error occurs.func (u *BillingInvoiceUsageBasedLineConfigUpsertOne) IDX(ctx context.Context) string { id, err := u.ID(ctx) if err != nil { panic(err) } return id}
// BillingInvoiceUsageBasedLineConfigCreateBulk is the builder for creating many BillingInvoiceUsageBasedLineConfig entities in bulk.type BillingInvoiceUsageBasedLineConfigCreateBulk struct { config err error builders []*BillingInvoiceUsageBasedLineConfigCreate conflict []sql.ConflictOption}
// Save creates the BillingInvoiceUsageBasedLineConfig entities in the database.func (_c *BillingInvoiceUsageBasedLineConfigCreateBulk) Save(ctx context.Context) ([]*BillingInvoiceUsageBasedLineConfig, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*BillingInvoiceUsageBasedLineConfig, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*BillingInvoiceUsageBasedLineConfigMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i], err = builder.createSpec() if err != nil { return nil, err } if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } } } if err != nil { return nil, err } mutation.id = &nodes[i].ID mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { mut = builder.hooks[i](mut) } mutators[i] = mut }(i, ctx) } if len(mutators) > 0 { if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil}
// SaveX is like Save, but panics if an error occurs.func (_c *BillingInvoiceUsageBasedLineConfigCreateBulk) SaveX(ctx context.Context) []*BillingInvoiceUsageBasedLineConfig { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceUsageBasedLineConfigCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceUsageBasedLineConfigCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceUsageBasedLineConfig.CreateBulk(builders...).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceUsageBasedLineConfigUpsert) {// SetNamespace(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceUsageBasedLineConfigCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceUsageBasedLineConfigUpsertBulk { _c.conflict = opts return &BillingInvoiceUsageBasedLineConfigUpsertBulk{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceUsageBasedLineConfig.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceUsageBasedLineConfigCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceUsageBasedLineConfigUpsertBulk { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceUsageBasedLineConfigUpsertBulk{ create: _c, }}
// BillingInvoiceUsageBasedLineConfigUpsertBulk is the builder for "upsert"-ing// a bulk of BillingInvoiceUsageBasedLineConfig nodes.type BillingInvoiceUsageBasedLineConfigUpsertBulk struct { create *BillingInvoiceUsageBasedLineConfigCreateBulk}
// UpdateNewValues updates the mutable fields using the new values that// were set on create. Using this option is equivalent to using://// client.BillingInvoiceUsageBasedLineConfig.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoiceusagebasedlineconfig.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) UpdateNewValues() *BillingInvoiceUsageBasedLineConfigUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { for _, b := range u.create.builders { if _, exists := b.mutation.ID(); exists { s.SetIgnore(billinginvoiceusagebasedlineconfig.FieldID) } if _, exists := b.mutation.Namespace(); exists { s.SetIgnore(billinginvoiceusagebasedlineconfig.FieldNamespace) } if _, exists := b.mutation.FeatureKey(); exists { s.SetIgnore(billinginvoiceusagebasedlineconfig.FieldFeatureKey) } } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceUsageBasedLineConfig.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) Ignore() *BillingInvoiceUsageBasedLineConfigUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) DoNothing() *BillingInvoiceUsageBasedLineConfigUpsertBulk { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceUsageBasedLineConfigCreateBulk.OnConflict// documentation for more info.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) Update(set func(*BillingInvoiceUsageBasedLineConfigUpsert)) *BillingInvoiceUsageBasedLineConfigUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceUsageBasedLineConfigUpsert{UpdateSet: update}) })) return u}
// SetPriceType sets the "price_type" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) SetPriceType(v productcatalog.PriceType) *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetPriceType(v) })}
// UpdatePriceType sets the "price_type" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) UpdatePriceType() *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdatePriceType() })}
// SetPrice sets the "price" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) SetPrice(v *productcatalog.Price) *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetPrice(v) })}
// UpdatePrice sets the "price" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) UpdatePrice() *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdatePrice() })}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetPreLinePeriodQuantity(v) })}
// UpdatePreLinePeriodQuantity sets the "pre_line_period_quantity" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) UpdatePreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdatePreLinePeriodQuantity() })}
// ClearPreLinePeriodQuantity clears the value of the "pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) ClearPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.ClearPreLinePeriodQuantity() })}
// SetMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) SetMeteredPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetMeteredPreLinePeriodQuantity(v) })}
// UpdateMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) UpdateMeteredPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdateMeteredPreLinePeriodQuantity() })}
// ClearMeteredPreLinePeriodQuantity clears the value of the "metered_pre_line_period_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) ClearMeteredPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.ClearMeteredPreLinePeriodQuantity() })}
// SetMeteredQuantity sets the "metered_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) SetMeteredQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetMeteredQuantity(v) })}
// UpdateMeteredQuantity sets the "metered_quantity" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) UpdateMeteredQuantity() *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdateMeteredQuantity() })}
// ClearMeteredQuantity clears the value of the "metered_quantity" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) ClearMeteredQuantity() *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.ClearMeteredQuantity() })}
// SetUnitConfig sets the "unit_config" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) SetUnitConfig(v *productcatalog.UnitConfig) *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.SetUnitConfig(v) })}
// UpdateUnitConfig sets the "unit_config" field to the value that was provided on create.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) UpdateUnitConfig() *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.UpdateUnitConfig() })}
// ClearUnitConfig clears the value of the "unit_config" field.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) ClearUnitConfig() *BillingInvoiceUsageBasedLineConfigUpsertBulk { return u.Update(func(s *BillingInvoiceUsageBasedLineConfigUpsert) { s.ClearUnitConfig() })}
// Exec executes the query.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { return u.create.err } for i, b := range u.create.builders { if len(b.conflict) != 0 { return fmt.Errorf("db: OnConflict was set for builder %d. Set it on the BillingInvoiceUsageBasedLineConfigCreateBulk instead", i) } } if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceUsageBasedLineConfigCreateBulk.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceUsageBasedLineConfigUpsertBulk) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788// Code generated by ent, DO NOT EDIT.
package db
import ( "context"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceusagebasedlineconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceUsageBasedLineConfigDelete is the builder for deleting a BillingInvoiceUsageBasedLineConfig entity.type BillingInvoiceUsageBasedLineConfigDelete struct { config hooks []Hook mutation *BillingInvoiceUsageBasedLineConfigMutation}
// Where appends a list predicates to the BillingInvoiceUsageBasedLineConfigDelete builder.func (_d *BillingInvoiceUsageBasedLineConfigDelete) Where(ps ...predicate.BillingInvoiceUsageBasedLineConfig) *BillingInvoiceUsageBasedLineConfigDelete { _d.mutation.Where(ps...) return _d}
// Exec executes the deletion query and returns how many vertices were deleted.func (_d *BillingInvoiceUsageBasedLineConfigDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceUsageBasedLineConfigDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n}
func (_d *BillingInvoiceUsageBasedLineConfigDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(billinginvoiceusagebasedlineconfig.Table, sqlgraph.NewFieldSpec(billinginvoiceusagebasedlineconfig.FieldID, field.TypeString)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err}
// BillingInvoiceUsageBasedLineConfigDeleteOne is the builder for deleting a single BillingInvoiceUsageBasedLineConfig entity.type BillingInvoiceUsageBasedLineConfigDeleteOne struct { _d *BillingInvoiceUsageBasedLineConfigDelete}
// Where appends a list predicates to the BillingInvoiceUsageBasedLineConfigDelete builder.func (_d *BillingInvoiceUsageBasedLineConfigDeleteOne) Where(ps ...predicate.BillingInvoiceUsageBasedLineConfig) *BillingInvoiceUsageBasedLineConfigDeleteOne { _d._d.mutation.Where(ps...) return _d}
// Exec executes the deletion query.func (_d *BillingInvoiceUsageBasedLineConfigDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{billinginvoiceusagebasedlineconfig.Label} default: return nil }}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceUsageBasedLineConfigDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "fmt" "math"
"entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceusagebasedlineconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceUsageBasedLineConfigQuery is the builder for querying BillingInvoiceUsageBasedLineConfig entities.type BillingInvoiceUsageBasedLineConfigQuery struct { config ctx *QueryContext order []billinginvoiceusagebasedlineconfig.OrderOption inters []Interceptor predicates []predicate.BillingInvoiceUsageBasedLineConfig 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 BillingInvoiceUsageBasedLineConfigQuery builder.func (_q *BillingInvoiceUsageBasedLineConfigQuery) Where(ps ...predicate.BillingInvoiceUsageBasedLineConfig) *BillingInvoiceUsageBasedLineConfigQuery { _q.predicates = append(_q.predicates, ps...) return _q}
// Limit the number of records to be returned by this query.func (_q *BillingInvoiceUsageBasedLineConfigQuery) Limit(limit int) *BillingInvoiceUsageBasedLineConfigQuery { _q.ctx.Limit = &limit return _q}
// Offset to start from.func (_q *BillingInvoiceUsageBasedLineConfigQuery) Offset(offset int) *BillingInvoiceUsageBasedLineConfigQuery { _q.ctx.Offset = &offset return _q}
// 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 (_q *BillingInvoiceUsageBasedLineConfigQuery) Unique(unique bool) *BillingInvoiceUsageBasedLineConfigQuery { _q.ctx.Unique = &unique return _q}
// Order specifies how the records should be ordered.func (_q *BillingInvoiceUsageBasedLineConfigQuery) Order(o ...billinginvoiceusagebasedlineconfig.OrderOption) *BillingInvoiceUsageBasedLineConfigQuery { _q.order = append(_q.order, o...) return _q}
// First returns the first BillingInvoiceUsageBasedLineConfig entity from the query.// Returns a *NotFoundError when no BillingInvoiceUsageBasedLineConfig was found.func (_q *BillingInvoiceUsageBasedLineConfigQuery) First(ctx context.Context) (*BillingInvoiceUsageBasedLineConfig, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{billinginvoiceusagebasedlineconfig.Label} } return nodes[0], nil}
// FirstX is like First, but panics if an error occurs.func (_q *BillingInvoiceUsageBasedLineConfigQuery) FirstX(ctx context.Context) *BillingInvoiceUsageBasedLineConfig { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node}
// FirstID returns the first BillingInvoiceUsageBasedLineConfig ID from the query.// Returns a *NotFoundError when no BillingInvoiceUsageBasedLineConfig ID was found.func (_q *BillingInvoiceUsageBasedLineConfigQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{billinginvoiceusagebasedlineconfig.Label} return } return ids[0], nil}
// FirstIDX is like FirstID, but panics if an error occurs.func (_q *BillingInvoiceUsageBasedLineConfigQuery) FirstIDX(ctx context.Context) string { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id}
// Only returns a single BillingInvoiceUsageBasedLineConfig entity found by the query, ensuring it only returns one.// Returns a *NotSingularError when more than one BillingInvoiceUsageBasedLineConfig entity is found.// Returns a *NotFoundError when no BillingInvoiceUsageBasedLineConfig entities are found.func (_q *BillingInvoiceUsageBasedLineConfigQuery) Only(ctx context.Context) (*BillingInvoiceUsageBasedLineConfig, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{billinginvoiceusagebasedlineconfig.Label} default: return nil, &NotSingularError{billinginvoiceusagebasedlineconfig.Label} }}
// OnlyX is like Only, but panics if an error occurs.func (_q *BillingInvoiceUsageBasedLineConfigQuery) OnlyX(ctx context.Context) *BillingInvoiceUsageBasedLineConfig { node, err := _q.Only(ctx) if err != nil { panic(err) } return node}
// OnlyID is like Only, but returns the only BillingInvoiceUsageBasedLineConfig ID in the query.// Returns a *NotSingularError when more than one BillingInvoiceUsageBasedLineConfig ID is found.// Returns a *NotFoundError when no entities are found.func (_q *BillingInvoiceUsageBasedLineConfigQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{billinginvoiceusagebasedlineconfig.Label} default: err = &NotSingularError{billinginvoiceusagebasedlineconfig.Label} } return}
// OnlyIDX is like OnlyID, but panics if an error occurs.func (_q *BillingInvoiceUsageBasedLineConfigQuery) OnlyIDX(ctx context.Context) string { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id}
// All executes the query and returns a list of BillingInvoiceUsageBasedLineConfigs.func (_q *BillingInvoiceUsageBasedLineConfigQuery) All(ctx context.Context) ([]*BillingInvoiceUsageBasedLineConfig, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*BillingInvoiceUsageBasedLineConfig, *BillingInvoiceUsageBasedLineConfigQuery]() return withInterceptors[[]*BillingInvoiceUsageBasedLineConfig](ctx, _q, qr, _q.inters)}
// AllX is like All, but panics if an error occurs.func (_q *BillingInvoiceUsageBasedLineConfigQuery) AllX(ctx context.Context) []*BillingInvoiceUsageBasedLineConfig { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes}
// IDs executes the query and returns a list of BillingInvoiceUsageBasedLineConfig IDs.func (_q *BillingInvoiceUsageBasedLineConfigQuery) IDs(ctx context.Context) (ids []string, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(billinginvoiceusagebasedlineconfig.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil}
// IDsX is like IDs, but panics if an error occurs.func (_q *BillingInvoiceUsageBasedLineConfigQuery) IDsX(ctx context.Context) []string { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids}
// Count returns the count of the given query.func (_q *BillingInvoiceUsageBasedLineConfigQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*BillingInvoiceUsageBasedLineConfigQuery](), _q.inters)}
// CountX is like Count, but panics if an error occurs.func (_q *BillingInvoiceUsageBasedLineConfigQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count}
// Exist returns true if the query has elements in the graph.func (_q *BillingInvoiceUsageBasedLineConfigQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("db: check existence: %w", err) default: return true, nil }}
// ExistX is like Exist, but panics if an error occurs.func (_q *BillingInvoiceUsageBasedLineConfigQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist}
// Clone returns a duplicate of the BillingInvoiceUsageBasedLineConfigQuery builder, including all associated steps. It can be// used to prepare common query builders and use them differently after the clone is made.func (_q *BillingInvoiceUsageBasedLineConfigQuery) Clone() *BillingInvoiceUsageBasedLineConfigQuery { if _q == nil { return nil } return &BillingInvoiceUsageBasedLineConfigQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]billinginvoiceusagebasedlineconfig.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.BillingInvoiceUsageBasedLineConfig{}, _q.predicates...), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, }}
// GroupBy is used to group vertices by one or more fields/columns.// It is often used with aggregate functions, like: count, max, mean, min, sum.//// Example://// var v []struct {// Namespace string `json:"namespace,omitempty"`// Count int `json:"count,omitempty"`// }//// client.BillingInvoiceUsageBasedLineConfig.Query().// GroupBy(billinginvoiceusagebasedlineconfig.FieldNamespace).// Aggregate(db.Count()).// Scan(ctx, &v)func (_q *BillingInvoiceUsageBasedLineConfigQuery) GroupBy(field string, fields ...string) *BillingInvoiceUsageBasedLineConfigGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &BillingInvoiceUsageBasedLineConfigGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = billinginvoiceusagebasedlineconfig.Label grbuild.scan = grbuild.Scan return grbuild}
// Select allows the selection one or more fields/columns for the given query,// instead of selecting all fields in the entity.//// Example://// var v []struct {// Namespace string `json:"namespace,omitempty"`// }//// client.BillingInvoiceUsageBasedLineConfig.Query().// Select(billinginvoiceusagebasedlineconfig.FieldNamespace).// Scan(ctx, &v)func (_q *BillingInvoiceUsageBasedLineConfigQuery) Select(fields ...string) *BillingInvoiceUsageBasedLineConfigSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &BillingInvoiceUsageBasedLineConfigSelect{BillingInvoiceUsageBasedLineConfigQuery: _q} sbuild.label = billinginvoiceusagebasedlineconfig.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild}
// Aggregate returns a BillingInvoiceUsageBasedLineConfigSelect configured with the given aggregations.func (_q *BillingInvoiceUsageBasedLineConfigQuery) Aggregate(fns ...AggregateFunc) *BillingInvoiceUsageBasedLineConfigSelect { return _q.Select().Aggregate(fns...)}
func (_q *BillingInvoiceUsageBasedLineConfigQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("db: uninitialized interceptor (forgotten import db/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !billinginvoiceusagebasedlineconfig.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil}
func (_q *BillingInvoiceUsageBasedLineConfigQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BillingInvoiceUsageBasedLineConfig, error) { var ( nodes = []*BillingInvoiceUsageBasedLineConfig{} _spec = _q.querySpec() ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*BillingInvoiceUsageBasedLineConfig).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &BillingInvoiceUsageBasedLineConfig{config: _q.config} nodes = append(nodes, node) return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } return nodes, nil}
func (_q *BillingInvoiceUsageBasedLineConfigQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec)}
func (_q *BillingInvoiceUsageBasedLineConfigQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(billinginvoiceusagebasedlineconfig.Table, billinginvoiceusagebasedlineconfig.Columns, sqlgraph.NewFieldSpec(billinginvoiceusagebasedlineconfig.FieldID, field.TypeString)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoiceusagebasedlineconfig.FieldID) for i := range fields { if fields[i] != billinginvoiceusagebasedlineconfig.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec}
func (_q *BillingInvoiceUsageBasedLineConfigQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(billinginvoiceusagebasedlineconfig.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = billinginvoiceusagebasedlineconfig.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, m := range _q.modifiers { m(selector) } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector}
// ForUpdate locks the selected rows against concurrent updates, and prevent them from being// updated, deleted or "selected ... for update" by other sessions, until the transaction is// either committed or rolled-back.func (_q *BillingInvoiceUsageBasedLineConfigQuery) ForUpdate(opts ...sql.LockOption) *BillingInvoiceUsageBasedLineConfigQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForUpdate(opts...) }) return _q}
// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock// on any rows that are read. Other sessions can read the rows, but cannot modify them// until your transaction commits.func (_q *BillingInvoiceUsageBasedLineConfigQuery) ForShare(opts ...sql.LockOption) *BillingInvoiceUsageBasedLineConfigQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForShare(opts...) }) return _q}
// BillingInvoiceUsageBasedLineConfigGroupBy is the group-by builder for BillingInvoiceUsageBasedLineConfig entities.type BillingInvoiceUsageBasedLineConfigGroupBy struct { selector build *BillingInvoiceUsageBasedLineConfigQuery}
// Aggregate adds the given aggregation functions to the group-by query.func (_g *BillingInvoiceUsageBasedLineConfigGroupBy) Aggregate(fns ...AggregateFunc) *BillingInvoiceUsageBasedLineConfigGroupBy { _g.fns = append(_g.fns, fns...) return _g}
// Scan applies the selector query and scans the result into the given value.func (_g *BillingInvoiceUsageBasedLineConfigGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceUsageBasedLineConfigQuery, *BillingInvoiceUsageBasedLineConfigGroupBy](ctx, _g.build, _g, _g.build.inters, v)}
func (_g *BillingInvoiceUsageBasedLineConfigGroupBy) sqlScan(ctx context.Context, root *BillingInvoiceUsageBasedLineConfigQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}
// BillingInvoiceUsageBasedLineConfigSelect is the builder for selecting fields of BillingInvoiceUsageBasedLineConfig entities.type BillingInvoiceUsageBasedLineConfigSelect struct { *BillingInvoiceUsageBasedLineConfigQuery selector}
// Aggregate adds the given aggregation functions to the selector query.func (_s *BillingInvoiceUsageBasedLineConfigSelect) Aggregate(fns ...AggregateFunc) *BillingInvoiceUsageBasedLineConfigSelect { _s.fns = append(_s.fns, fns...) return _s}
// Scan applies the selector query and scans the result into the given value.func (_s *BillingInvoiceUsageBasedLineConfigSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceUsageBasedLineConfigQuery, *BillingInvoiceUsageBasedLineConfigSelect](ctx, _s.BillingInvoiceUsageBasedLineConfigQuery, _s, _s.inters, v)}
func (_s *BillingInvoiceUsageBasedLineConfigSelect) sqlScan(ctx context.Context, root *BillingInvoiceUsageBasedLineConfigQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/alpacahq/alpacadecimal" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceusagebasedlineconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" "github.com/openmeterio/openmeter/openmeter/productcatalog")
// BillingInvoiceUsageBasedLineConfigUpdate is the builder for updating BillingInvoiceUsageBasedLineConfig entities.type BillingInvoiceUsageBasedLineConfigUpdate struct { config hooks []Hook mutation *BillingInvoiceUsageBasedLineConfigMutation}
// Where appends a list predicates to the BillingInvoiceUsageBasedLineConfigUpdate builder.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) Where(ps ...predicate.BillingInvoiceUsageBasedLineConfig) *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.Where(ps...) return _u}
// SetPriceType sets the "price_type" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SetPriceType(v productcatalog.PriceType) *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.SetPriceType(v) return _u}
// SetNillablePriceType sets the "price_type" field if the given value is not nil.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SetNillablePriceType(v *productcatalog.PriceType) *BillingInvoiceUsageBasedLineConfigUpdate { if v != nil { _u.SetPriceType(*v) } return _u}
// SetPrice sets the "price" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SetPrice(v *productcatalog.Price) *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.SetPrice(v) return _u}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.SetPreLinePeriodQuantity(v) return _u}
// SetNillablePreLinePeriodQuantity sets the "pre_line_period_quantity" field if the given value is not nil.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SetNillablePreLinePeriodQuantity(v *alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdate { if v != nil { _u.SetPreLinePeriodQuantity(*v) } return _u}
// ClearPreLinePeriodQuantity clears the value of the "pre_line_period_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) ClearPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.ClearPreLinePeriodQuantity() return _u}
// SetMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SetMeteredPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.SetMeteredPreLinePeriodQuantity(v) return _u}
// SetNillableMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field if the given value is not nil.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SetNillableMeteredPreLinePeriodQuantity(v *alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdate { if v != nil { _u.SetMeteredPreLinePeriodQuantity(*v) } return _u}
// ClearMeteredPreLinePeriodQuantity clears the value of the "metered_pre_line_period_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) ClearMeteredPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.ClearMeteredPreLinePeriodQuantity() return _u}
// SetMeteredQuantity sets the "metered_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SetMeteredQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.SetMeteredQuantity(v) return _u}
// SetNillableMeteredQuantity sets the "metered_quantity" field if the given value is not nil.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SetNillableMeteredQuantity(v *alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdate { if v != nil { _u.SetMeteredQuantity(*v) } return _u}
// ClearMeteredQuantity clears the value of the "metered_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) ClearMeteredQuantity() *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.ClearMeteredQuantity() return _u}
// SetUnitConfig sets the "unit_config" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SetUnitConfig(v *productcatalog.UnitConfig) *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.SetUnitConfig(v) return _u}
// ClearUnitConfig clears the value of the "unit_config" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) ClearUnitConfig() *BillingInvoiceUsageBasedLineConfigUpdate { _u.mutation.ClearUnitConfig() return _u}
// Mutation returns the BillingInvoiceUsageBasedLineConfigMutation object of the builder.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) Mutation() *BillingInvoiceUsageBasedLineConfigMutation { return _u.mutation}
// Save executes the query and returns the number of nodes affected by the update operation.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected}
// Exec executes the query.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
// check runs all checks and user-defined validators on the builder.func (_u *BillingInvoiceUsageBasedLineConfigUpdate) check() error { if v, ok := _u.mutation.PriceType(); ok { if err := billinginvoiceusagebasedlineconfig.PriceTypeValidator(v); err != nil { return &ValidationError{Name: "price_type", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceUsageBasedLineConfig.price_type": %w`, err)} } } if v, ok := _u.mutation.Price(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "price", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceUsageBasedLineConfig.price": %w`, err)} } } if v, ok := _u.mutation.UnitConfig(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "unit_config", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceUsageBasedLineConfig.unit_config": %w`, err)} } } return nil}
func (_u *BillingInvoiceUsageBasedLineConfigUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(billinginvoiceusagebasedlineconfig.Table, billinginvoiceusagebasedlineconfig.Columns, sqlgraph.NewFieldSpec(billinginvoiceusagebasedlineconfig.FieldID, field.TypeString)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.PriceType(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldPriceType, field.TypeEnum, value) } if _u.mutation.FeatureKeyCleared() { _spec.ClearField(billinginvoiceusagebasedlineconfig.FieldFeatureKey, field.TypeString) } if value, ok := _u.mutation.Price(); ok { vv, err := billinginvoiceusagebasedlineconfig.ValueScanner.Price.Value(value) if err != nil { return 0, err } _spec.SetField(billinginvoiceusagebasedlineconfig.FieldPrice, field.TypeString, vv) } if value, ok := _u.mutation.PreLinePeriodQuantity(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldPreLinePeriodQuantity, field.TypeOther, value) } if _u.mutation.PreLinePeriodQuantityCleared() { _spec.ClearField(billinginvoiceusagebasedlineconfig.FieldPreLinePeriodQuantity, field.TypeOther) } if value, ok := _u.mutation.MeteredPreLinePeriodQuantity(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldMeteredPreLinePeriodQuantity, field.TypeOther, value) } if _u.mutation.MeteredPreLinePeriodQuantityCleared() { _spec.ClearField(billinginvoiceusagebasedlineconfig.FieldMeteredPreLinePeriodQuantity, field.TypeOther) } if value, ok := _u.mutation.MeteredQuantity(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldMeteredQuantity, field.TypeOther, value) } if _u.mutation.MeteredQuantityCleared() { _spec.ClearField(billinginvoiceusagebasedlineconfig.FieldMeteredQuantity, field.TypeOther) } if value, ok := _u.mutation.UnitConfig(); ok { vv, err := billinginvoiceusagebasedlineconfig.ValueScanner.UnitConfig.Value(value) if err != nil { return 0, err } _spec.SetField(billinginvoiceusagebasedlineconfig.FieldUnitConfig, field.TypeString, vv) } if _u.mutation.UnitConfigCleared() { _spec.ClearField(billinginvoiceusagebasedlineconfig.FieldUnitConfig, field.TypeString) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoiceusagebasedlineconfig.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil}
// BillingInvoiceUsageBasedLineConfigUpdateOne is the builder for updating a single BillingInvoiceUsageBasedLineConfig entity.type BillingInvoiceUsageBasedLineConfigUpdateOne struct { config fields []string hooks []Hook mutation *BillingInvoiceUsageBasedLineConfigMutation}
// SetPriceType sets the "price_type" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SetPriceType(v productcatalog.PriceType) *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.SetPriceType(v) return _u}
// SetNillablePriceType sets the "price_type" field if the given value is not nil.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SetNillablePriceType(v *productcatalog.PriceType) *BillingInvoiceUsageBasedLineConfigUpdateOne { if v != nil { _u.SetPriceType(*v) } return _u}
// SetPrice sets the "price" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SetPrice(v *productcatalog.Price) *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.SetPrice(v) return _u}
// SetPreLinePeriodQuantity sets the "pre_line_period_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SetPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.SetPreLinePeriodQuantity(v) return _u}
// SetNillablePreLinePeriodQuantity sets the "pre_line_period_quantity" field if the given value is not nil.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SetNillablePreLinePeriodQuantity(v *alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdateOne { if v != nil { _u.SetPreLinePeriodQuantity(*v) } return _u}
// ClearPreLinePeriodQuantity clears the value of the "pre_line_period_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) ClearPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.ClearPreLinePeriodQuantity() return _u}
// SetMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SetMeteredPreLinePeriodQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.SetMeteredPreLinePeriodQuantity(v) return _u}
// SetNillableMeteredPreLinePeriodQuantity sets the "metered_pre_line_period_quantity" field if the given value is not nil.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SetNillableMeteredPreLinePeriodQuantity(v *alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdateOne { if v != nil { _u.SetMeteredPreLinePeriodQuantity(*v) } return _u}
// ClearMeteredPreLinePeriodQuantity clears the value of the "metered_pre_line_period_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) ClearMeteredPreLinePeriodQuantity() *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.ClearMeteredPreLinePeriodQuantity() return _u}
// SetMeteredQuantity sets the "metered_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SetMeteredQuantity(v alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.SetMeteredQuantity(v) return _u}
// SetNillableMeteredQuantity sets the "metered_quantity" field if the given value is not nil.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SetNillableMeteredQuantity(v *alpacadecimal.Decimal) *BillingInvoiceUsageBasedLineConfigUpdateOne { if v != nil { _u.SetMeteredQuantity(*v) } return _u}
// ClearMeteredQuantity clears the value of the "metered_quantity" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) ClearMeteredQuantity() *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.ClearMeteredQuantity() return _u}
// SetUnitConfig sets the "unit_config" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SetUnitConfig(v *productcatalog.UnitConfig) *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.SetUnitConfig(v) return _u}
// ClearUnitConfig clears the value of the "unit_config" field.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) ClearUnitConfig() *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.ClearUnitConfig() return _u}
// Mutation returns the BillingInvoiceUsageBasedLineConfigMutation object of the builder.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) Mutation() *BillingInvoiceUsageBasedLineConfigMutation { return _u.mutation}
// Where appends a list predicates to the BillingInvoiceUsageBasedLineConfigUpdate builder.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) Where(ps ...predicate.BillingInvoiceUsageBasedLineConfig) *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.mutation.Where(ps...) return _u}
// Select allows selecting one or more fields (columns) of the returned entity.// The default is selecting all fields defined in the entity schema.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) Select(field string, fields ...string) *BillingInvoiceUsageBasedLineConfigUpdateOne { _u.fields = append([]string{field}, fields...) return _u}
// Save executes the query and returns the updated BillingInvoiceUsageBasedLineConfig entity.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) Save(ctx context.Context) (*BillingInvoiceUsageBasedLineConfig, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) SaveX(ctx context.Context) *BillingInvoiceUsageBasedLineConfig { node, err := _u.Save(ctx) if err != nil { panic(err) } return node}
// Exec executes the query on the entity.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
// check runs all checks and user-defined validators on the builder.func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) check() error { if v, ok := _u.mutation.PriceType(); ok { if err := billinginvoiceusagebasedlineconfig.PriceTypeValidator(v); err != nil { return &ValidationError{Name: "price_type", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceUsageBasedLineConfig.price_type": %w`, err)} } } if v, ok := _u.mutation.Price(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "price", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceUsageBasedLineConfig.price": %w`, err)} } } if v, ok := _u.mutation.UnitConfig(); ok { if err := v.Validate(); err != nil { return &ValidationError{Name: "unit_config", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceUsageBasedLineConfig.unit_config": %w`, err)} } } return nil}
func (_u *BillingInvoiceUsageBasedLineConfigUpdateOne) sqlSave(ctx context.Context) (_node *BillingInvoiceUsageBasedLineConfig, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(billinginvoiceusagebasedlineconfig.Table, billinginvoiceusagebasedlineconfig.Columns, sqlgraph.NewFieldSpec(billinginvoiceusagebasedlineconfig.FieldID, field.TypeString)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "BillingInvoiceUsageBasedLineConfig.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoiceusagebasedlineconfig.FieldID) for _, f := range fields { if !billinginvoiceusagebasedlineconfig.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } if f != billinginvoiceusagebasedlineconfig.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.PriceType(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldPriceType, field.TypeEnum, value) } if _u.mutation.FeatureKeyCleared() { _spec.ClearField(billinginvoiceusagebasedlineconfig.FieldFeatureKey, field.TypeString) } if value, ok := _u.mutation.Price(); ok { vv, err := billinginvoiceusagebasedlineconfig.ValueScanner.Price.Value(value) if err != nil { return nil, err } _spec.SetField(billinginvoiceusagebasedlineconfig.FieldPrice, field.TypeString, vv) } if value, ok := _u.mutation.PreLinePeriodQuantity(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldPreLinePeriodQuantity, field.TypeOther, value) } if _u.mutation.PreLinePeriodQuantityCleared() { _spec.ClearField(billinginvoiceusagebasedlineconfig.FieldPreLinePeriodQuantity, field.TypeOther) } if value, ok := _u.mutation.MeteredPreLinePeriodQuantity(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldMeteredPreLinePeriodQuantity, field.TypeOther, value) } if _u.mutation.MeteredPreLinePeriodQuantityCleared() { _spec.ClearField(billinginvoiceusagebasedlineconfig.FieldMeteredPreLinePeriodQuantity, field.TypeOther) } if value, ok := _u.mutation.MeteredQuantity(); ok { _spec.SetField(billinginvoiceusagebasedlineconfig.FieldMeteredQuantity, field.TypeOther, value) } if _u.mutation.MeteredQuantityCleared() { _spec.ClearField(billinginvoiceusagebasedlineconfig.FieldMeteredQuantity, field.TypeOther) } if value, ok := _u.mutation.UnitConfig(); ok { vv, err := billinginvoiceusagebasedlineconfig.ValueScanner.UnitConfig.Value(value) if err != nil { return nil, err } _spec.SetField(billinginvoiceusagebasedlineconfig.FieldUnitConfig, field.TypeString, vv) } if _u.mutation.UnitConfigCleared() { _spec.ClearField(billinginvoiceusagebasedlineconfig.FieldUnitConfig, field.TypeString) } _node = &BillingInvoiceUsageBasedLineConfig{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoiceusagebasedlineconfig.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255// Code generated by ent, DO NOT EDIT.
package db
import ( "fmt" "strings" "time"
"entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicevalidationissue")
// BillingInvoiceValidationIssue is the model entity for the BillingInvoiceValidationIssue schema.type BillingInvoiceValidationIssue struct { config `json:"-"` // ID of the ent. ID string `json:"id,omitempty"` // Namespace holds the value of the "namespace" field. Namespace string `json:"namespace,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt *time.Time `json:"deleted_at,omitempty"` // InvoiceID holds the value of the "invoice_id" field. InvoiceID string `json:"invoice_id,omitempty"` // Severity holds the value of the "severity" field. Severity billing.ValidationIssueSeverity `json:"severity,omitempty"` // Code holds the value of the "code" field. Code *string `json:"code,omitempty"` // Message holds the value of the "message" field. Message string `json:"message,omitempty"` // Path holds the value of the "path" field. Path *string `json:"path,omitempty"` // Component holds the value of the "component" field. Component string `json:"component,omitempty"` // DedupeHash holds the value of the "dedupe_hash" field. DedupeHash []byte `json:"dedupe_hash,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the BillingInvoiceValidationIssueQuery when eager-loading is set. Edges BillingInvoiceValidationIssueEdges `json:"edges"` selectValues sql.SelectValues}
// BillingInvoiceValidationIssueEdges holds the relations/edges for other nodes in the graph.type BillingInvoiceValidationIssueEdges struct { // BillingInvoice holds the value of the billing_invoice edge. BillingInvoice *BillingInvoice `json:"billing_invoice,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [1]bool}
// BillingInvoiceOrErr returns the BillingInvoice value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingInvoiceValidationIssueEdges) BillingInvoiceOrErr() (*BillingInvoice, error) { if e.BillingInvoice != nil { return e.BillingInvoice, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: billinginvoice.Label} } return nil, &NotLoadedError{edge: "billing_invoice"}}
// scanValues returns the types for scanning values from sql.Rows.func (*BillingInvoiceValidationIssue) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case billinginvoicevalidationissue.FieldDedupeHash: values[i] = new([]byte) case billinginvoicevalidationissue.FieldID, billinginvoicevalidationissue.FieldNamespace, billinginvoicevalidationissue.FieldInvoiceID, billinginvoicevalidationissue.FieldSeverity, billinginvoicevalidationissue.FieldCode, billinginvoicevalidationissue.FieldMessage, billinginvoicevalidationissue.FieldPath, billinginvoicevalidationissue.FieldComponent: values[i] = new(sql.NullString) case billinginvoicevalidationissue.FieldCreatedAt, billinginvoicevalidationissue.FieldUpdatedAt, billinginvoicevalidationissue.FieldDeletedAt: values[i] = new(sql.NullTime) default: values[i] = new(sql.UnknownType) } } return values, nil}
// assignValues assigns the values that were returned from sql.Rows (after scanning)// to the BillingInvoiceValidationIssue fields.func (_m *BillingInvoiceValidationIssue) 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) } for i := range columns { switch columns[i] { case billinginvoicevalidationissue.FieldID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value.Valid { _m.ID = value.String } case billinginvoicevalidationissue.FieldNamespace: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field namespace", values[i]) } else if value.Valid { _m.Namespace = value.String } case billinginvoicevalidationissue.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { _m.CreatedAt = value.Time } case billinginvoicevalidationissue.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { _m.UpdatedAt = value.Time } case billinginvoicevalidationissue.FieldDeletedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field deleted_at", values[i]) } else if value.Valid { _m.DeletedAt = new(time.Time) *_m.DeletedAt = value.Time } case billinginvoicevalidationissue.FieldInvoiceID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field invoice_id", values[i]) } else if value.Valid { _m.InvoiceID = value.String } case billinginvoicevalidationissue.FieldSeverity: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field severity", values[i]) } else if value.Valid { _m.Severity = billing.ValidationIssueSeverity(value.String) } case billinginvoicevalidationissue.FieldCode: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field code", values[i]) } else if value.Valid { _m.Code = new(string) *_m.Code = value.String } case billinginvoicevalidationissue.FieldMessage: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field message", values[i]) } else if value.Valid { _m.Message = value.String } case billinginvoicevalidationissue.FieldPath: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field path", values[i]) } else if value.Valid { _m.Path = new(string) *_m.Path = value.String } case billinginvoicevalidationissue.FieldComponent: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field component", values[i]) } else if value.Valid { _m.Component = value.String } case billinginvoicevalidationissue.FieldDedupeHash: if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field dedupe_hash", values[i]) } else if value != nil { _m.DedupeHash = *value } default: _m.selectValues.Set(columns[i], values[i]) } } return nil}
// Value returns the ent.Value that was dynamically selected and assigned to the BillingInvoiceValidationIssue.// This includes values selected through modifiers, order, etc.func (_m *BillingInvoiceValidationIssue) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name)}
// QueryBillingInvoice queries the "billing_invoice" edge of the BillingInvoiceValidationIssue entity.func (_m *BillingInvoiceValidationIssue) QueryBillingInvoice() *BillingInvoiceQuery { return NewBillingInvoiceValidationIssueClient(_m.config).QueryBillingInvoice(_m)}
// Update returns a builder for updating this BillingInvoiceValidationIssue.// Note that you need to call BillingInvoiceValidationIssue.Unwrap() before calling this method if this BillingInvoiceValidationIssue// was returned from a transaction, and the transaction was committed or rolled back.func (_m *BillingInvoiceValidationIssue) Update() *BillingInvoiceValidationIssueUpdateOne { return NewBillingInvoiceValidationIssueClient(_m.config).UpdateOne(_m)}
// Unwrap unwraps the BillingInvoiceValidationIssue 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 (_m *BillingInvoiceValidationIssue) Unwrap() *BillingInvoiceValidationIssue { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("db: BillingInvoiceValidationIssue is not a transactional entity") } _m.config.driver = _tx.drv return _m}
// String implements the fmt.Stringer.func (_m *BillingInvoiceValidationIssue) String() string { var builder strings.Builder builder.WriteString("BillingInvoiceValidationIssue(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("namespace=") builder.WriteString(_m.Namespace) builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") if v := _m.DeletedAt; v != nil { builder.WriteString("deleted_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("invoice_id=") builder.WriteString(_m.InvoiceID) builder.WriteString(", ") builder.WriteString("severity=") builder.WriteString(fmt.Sprintf("%v", _m.Severity)) builder.WriteString(", ") if v := _m.Code; v != nil { builder.WriteString("code=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("message=") builder.WriteString(_m.Message) builder.WriteString(", ") if v := _m.Path; v != nil { builder.WriteString("path=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("component=") builder.WriteString(_m.Component) builder.WriteString(", ") builder.WriteString("dedupe_hash=") builder.WriteString(fmt.Sprintf("%v", _m.DedupeHash)) builder.WriteByte(')') return builder.String()}
// BillingInvoiceValidationIssues is a parsable slice of BillingInvoiceValidationIssue.type BillingInvoiceValidationIssues []*BillingInvoiceValidationIssue123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179// Code generated by ent, DO NOT EDIT.
package billinginvoicevalidationissue
import ( "fmt" "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/openmeterio/openmeter/openmeter/billing")
const ( // Label holds the string label denoting the billinginvoicevalidationissue type in the database. Label = "billing_invoice_validation_issue" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldNamespace holds the string denoting the namespace field in the database. FieldNamespace = "namespace" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" // FieldDeletedAt holds the string denoting the deleted_at field in the database. FieldDeletedAt = "deleted_at" // FieldInvoiceID holds the string denoting the invoice_id field in the database. FieldInvoiceID = "invoice_id" // FieldSeverity holds the string denoting the severity field in the database. FieldSeverity = "severity" // FieldCode holds the string denoting the code field in the database. FieldCode = "code" // FieldMessage holds the string denoting the message field in the database. FieldMessage = "message" // FieldPath holds the string denoting the path field in the database. FieldPath = "path" // FieldComponent holds the string denoting the component field in the database. FieldComponent = "component" // FieldDedupeHash holds the string denoting the dedupe_hash field in the database. FieldDedupeHash = "dedupe_hash" // EdgeBillingInvoice holds the string denoting the billing_invoice edge name in mutations. EdgeBillingInvoice = "billing_invoice" // Table holds the table name of the billinginvoicevalidationissue in the database. Table = "billing_invoice_validation_issues" // BillingInvoiceTable is the table that holds the billing_invoice relation/edge. BillingInvoiceTable = "billing_invoice_validation_issues" // BillingInvoiceInverseTable is the table name for the BillingInvoice entity. // It exists in this package in order to avoid circular dependency with the "billinginvoice" package. BillingInvoiceInverseTable = "billing_invoices" // BillingInvoiceColumn is the table column denoting the billing_invoice relation/edge. BillingInvoiceColumn = "invoice_id")
// Columns holds all SQL columns for billinginvoicevalidationissue fields.var Columns = []string{ FieldID, FieldNamespace, FieldCreatedAt, FieldUpdatedAt, FieldDeletedAt, FieldInvoiceID, FieldSeverity, FieldCode, FieldMessage, FieldPath, FieldComponent, FieldDedupeHash,}
// ValidColumn reports if the column name is valid (part of the table columns).func ValidColumn(column string) bool { for i := range Columns { if column == Columns[i] { return true } } return false}
var ( // NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. NamespaceValidator func(string) error // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. DefaultUpdatedAt func() time.Time // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. UpdateDefaultUpdatedAt func() time.Time // InvoiceIDValidator is a validator for the "invoice_id" field. It is called by the builders before save. InvoiceIDValidator func(string) error // MessageValidator is a validator for the "message" field. It is called by the builders before save. MessageValidator func(string) error // DedupeHashValidator is a validator for the "dedupe_hash" field. It is called by the builders before save. DedupeHashValidator func([]byte) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() string)
// SeverityValidator is a validator for the "severity" field enum values. It is called by the builders before save.func SeverityValidator(s billing.ValidationIssueSeverity) error { switch s { case "critical", "warning": return nil default: return fmt.Errorf("billinginvoicevalidationissue: invalid enum value for severity field: %q", s) }}
// OrderOption defines the ordering options for the BillingInvoiceValidationIssue queries.type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc()}
// ByNamespace orders the results by the namespace field.func ByNamespace(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldNamespace, opts...).ToFunc()}
// ByCreatedAt orders the results by the created_at field.func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()}
// ByUpdatedAt orders the results by the updated_at field.func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()}
// ByDeletedAt orders the results by the deleted_at field.func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()}
// ByInvoiceID orders the results by the invoice_id field.func ByInvoiceID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldInvoiceID, opts...).ToFunc()}
// BySeverity orders the results by the severity field.func BySeverity(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSeverity, opts...).ToFunc()}
// ByCode orders the results by the code field.func ByCode(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCode, opts...).ToFunc()}
// ByMessage orders the results by the message field.func ByMessage(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMessage, opts...).ToFunc()}
// ByPath orders the results by the path field.func ByPath(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPath, opts...).ToFunc()}
// ByComponent orders the results by the component field.func ByComponent(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldComponent, opts...).ToFunc()}
// ByBillingInvoiceField orders the results by billing_invoice field.func ByBillingInvoiceField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceStep(), sql.OrderByField(field, opts...)) }}func newBillingInvoiceStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(BillingInvoiceInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, BillingInvoiceTable, BillingInvoiceColumn), )}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765// Code generated by ent, DO NOT EDIT.
package billinginvoicevalidationissue
import ( "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// ID filters vertices based on their ID field.func ID(id string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldID, id))}
// IDEQ applies the EQ predicate on the ID field.func IDEQ(id string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldID, id))}
// IDNEQ applies the NEQ predicate on the ID field.func IDNEQ(id string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldID, id))}
// IDIn applies the In predicate on the ID field.func IDIn(ids ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldID, ids...))}
// IDNotIn applies the NotIn predicate on the ID field.func IDNotIn(ids ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldID, ids...))}
// IDGT applies the GT predicate on the ID field.func IDGT(id string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldID, id))}
// IDGTE applies the GTE predicate on the ID field.func IDGTE(id string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldID, id))}
// IDLT applies the LT predicate on the ID field.func IDLT(id string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldID, id))}
// IDLTE applies the LTE predicate on the ID field.func IDLTE(id string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldID, id))}
// IDEqualFold applies the EqualFold predicate on the ID field.func IDEqualFold(id string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEqualFold(FieldID, id))}
// IDContainsFold applies the ContainsFold predicate on the ID field.func IDContainsFold(id string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContainsFold(FieldID, id))}
// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ.func Namespace(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldNamespace, v))}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.func CreatedAt(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldCreatedAt, v))}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.func UpdatedAt(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldUpdatedAt, v))}
// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.func DeletedAt(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldDeletedAt, v))}
// InvoiceID applies equality check predicate on the "invoice_id" field. It's identical to InvoiceIDEQ.func InvoiceID(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldInvoiceID, v))}
// Code applies equality check predicate on the "code" field. It's identical to CodeEQ.func Code(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldCode, v))}
// Message applies equality check predicate on the "message" field. It's identical to MessageEQ.func Message(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldMessage, v))}
// Path applies equality check predicate on the "path" field. It's identical to PathEQ.func Path(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldPath, v))}
// Component applies equality check predicate on the "component" field. It's identical to ComponentEQ.func Component(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldComponent, v))}
// DedupeHash applies equality check predicate on the "dedupe_hash" field. It's identical to DedupeHashEQ.func DedupeHash(v []byte) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldDedupeHash, v))}
// NamespaceEQ applies the EQ predicate on the "namespace" field.func NamespaceEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldNamespace, v))}
// NamespaceNEQ applies the NEQ predicate on the "namespace" field.func NamespaceNEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldNamespace, v))}
// NamespaceIn applies the In predicate on the "namespace" field.func NamespaceIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldNamespace, vs...))}
// NamespaceNotIn applies the NotIn predicate on the "namespace" field.func NamespaceNotIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldNamespace, vs...))}
// NamespaceGT applies the GT predicate on the "namespace" field.func NamespaceGT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldNamespace, v))}
// NamespaceGTE applies the GTE predicate on the "namespace" field.func NamespaceGTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldNamespace, v))}
// NamespaceLT applies the LT predicate on the "namespace" field.func NamespaceLT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldNamespace, v))}
// NamespaceLTE applies the LTE predicate on the "namespace" field.func NamespaceLTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldNamespace, v))}
// NamespaceContains applies the Contains predicate on the "namespace" field.func NamespaceContains(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContains(FieldNamespace, v))}
// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field.func NamespaceHasPrefix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasPrefix(FieldNamespace, v))}
// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field.func NamespaceHasSuffix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasSuffix(FieldNamespace, v))}
// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field.func NamespaceEqualFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEqualFold(FieldNamespace, v))}
// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field.func NamespaceContainsFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContainsFold(FieldNamespace, v))}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.func CreatedAtEQ(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldCreatedAt, v))}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.func CreatedAtNEQ(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldCreatedAt, v))}
// CreatedAtIn applies the In predicate on the "created_at" field.func CreatedAtIn(vs ...time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldCreatedAt, vs...))}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.func CreatedAtNotIn(vs ...time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldCreatedAt, vs...))}
// CreatedAtGT applies the GT predicate on the "created_at" field.func CreatedAtGT(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldCreatedAt, v))}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.func CreatedAtGTE(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldCreatedAt, v))}
// CreatedAtLT applies the LT predicate on the "created_at" field.func CreatedAtLT(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldCreatedAt, v))}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.func CreatedAtLTE(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldCreatedAt, v))}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.func UpdatedAtEQ(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldUpdatedAt, v))}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.func UpdatedAtNEQ(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldUpdatedAt, v))}
// UpdatedAtIn applies the In predicate on the "updated_at" field.func UpdatedAtIn(vs ...time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldUpdatedAt, vs...))}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.func UpdatedAtNotIn(vs ...time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldUpdatedAt, vs...))}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.func UpdatedAtGT(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldUpdatedAt, v))}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.func UpdatedAtGTE(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldUpdatedAt, v))}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.func UpdatedAtLT(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldUpdatedAt, v))}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.func UpdatedAtLTE(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldUpdatedAt, v))}
// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.func DeletedAtEQ(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldDeletedAt, v))}
// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.func DeletedAtNEQ(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldDeletedAt, v))}
// DeletedAtIn applies the In predicate on the "deleted_at" field.func DeletedAtIn(vs ...time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldDeletedAt, vs...))}
// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.func DeletedAtNotIn(vs ...time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldDeletedAt, vs...))}
// DeletedAtGT applies the GT predicate on the "deleted_at" field.func DeletedAtGT(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldDeletedAt, v))}
// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.func DeletedAtGTE(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldDeletedAt, v))}
// DeletedAtLT applies the LT predicate on the "deleted_at" field.func DeletedAtLT(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldDeletedAt, v))}
// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.func DeletedAtLTE(v time.Time) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldDeletedAt, v))}
// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.func DeletedAtIsNil() predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIsNull(FieldDeletedAt))}
// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.func DeletedAtNotNil() predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotNull(FieldDeletedAt))}
// InvoiceIDEQ applies the EQ predicate on the "invoice_id" field.func InvoiceIDEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldInvoiceID, v))}
// InvoiceIDNEQ applies the NEQ predicate on the "invoice_id" field.func InvoiceIDNEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldInvoiceID, v))}
// InvoiceIDIn applies the In predicate on the "invoice_id" field.func InvoiceIDIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldInvoiceID, vs...))}
// InvoiceIDNotIn applies the NotIn predicate on the "invoice_id" field.func InvoiceIDNotIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldInvoiceID, vs...))}
// InvoiceIDGT applies the GT predicate on the "invoice_id" field.func InvoiceIDGT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldInvoiceID, v))}
// InvoiceIDGTE applies the GTE predicate on the "invoice_id" field.func InvoiceIDGTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldInvoiceID, v))}
// InvoiceIDLT applies the LT predicate on the "invoice_id" field.func InvoiceIDLT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldInvoiceID, v))}
// InvoiceIDLTE applies the LTE predicate on the "invoice_id" field.func InvoiceIDLTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldInvoiceID, v))}
// InvoiceIDContains applies the Contains predicate on the "invoice_id" field.func InvoiceIDContains(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContains(FieldInvoiceID, v))}
// InvoiceIDHasPrefix applies the HasPrefix predicate on the "invoice_id" field.func InvoiceIDHasPrefix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasPrefix(FieldInvoiceID, v))}
// InvoiceIDHasSuffix applies the HasSuffix predicate on the "invoice_id" field.func InvoiceIDHasSuffix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasSuffix(FieldInvoiceID, v))}
// InvoiceIDEqualFold applies the EqualFold predicate on the "invoice_id" field.func InvoiceIDEqualFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEqualFold(FieldInvoiceID, v))}
// InvoiceIDContainsFold applies the ContainsFold predicate on the "invoice_id" field.func InvoiceIDContainsFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContainsFold(FieldInvoiceID, v))}
// SeverityEQ applies the EQ predicate on the "severity" field.func SeverityEQ(v billing.ValidationIssueSeverity) predicate.BillingInvoiceValidationIssue { vc := v return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldSeverity, vc))}
// SeverityNEQ applies the NEQ predicate on the "severity" field.func SeverityNEQ(v billing.ValidationIssueSeverity) predicate.BillingInvoiceValidationIssue { vc := v return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldSeverity, vc))}
// SeverityIn applies the In predicate on the "severity" field.func SeverityIn(vs ...billing.ValidationIssueSeverity) predicate.BillingInvoiceValidationIssue { v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldSeverity, v...))}
// SeverityNotIn applies the NotIn predicate on the "severity" field.func SeverityNotIn(vs ...billing.ValidationIssueSeverity) predicate.BillingInvoiceValidationIssue { v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldSeverity, v...))}
// CodeEQ applies the EQ predicate on the "code" field.func CodeEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldCode, v))}
// CodeNEQ applies the NEQ predicate on the "code" field.func CodeNEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldCode, v))}
// CodeIn applies the In predicate on the "code" field.func CodeIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldCode, vs...))}
// CodeNotIn applies the NotIn predicate on the "code" field.func CodeNotIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldCode, vs...))}
// CodeGT applies the GT predicate on the "code" field.func CodeGT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldCode, v))}
// CodeGTE applies the GTE predicate on the "code" field.func CodeGTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldCode, v))}
// CodeLT applies the LT predicate on the "code" field.func CodeLT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldCode, v))}
// CodeLTE applies the LTE predicate on the "code" field.func CodeLTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldCode, v))}
// CodeContains applies the Contains predicate on the "code" field.func CodeContains(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContains(FieldCode, v))}
// CodeHasPrefix applies the HasPrefix predicate on the "code" field.func CodeHasPrefix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasPrefix(FieldCode, v))}
// CodeHasSuffix applies the HasSuffix predicate on the "code" field.func CodeHasSuffix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasSuffix(FieldCode, v))}
// CodeIsNil applies the IsNil predicate on the "code" field.func CodeIsNil() predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIsNull(FieldCode))}
// CodeNotNil applies the NotNil predicate on the "code" field.func CodeNotNil() predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotNull(FieldCode))}
// CodeEqualFold applies the EqualFold predicate on the "code" field.func CodeEqualFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEqualFold(FieldCode, v))}
// CodeContainsFold applies the ContainsFold predicate on the "code" field.func CodeContainsFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContainsFold(FieldCode, v))}
// MessageEQ applies the EQ predicate on the "message" field.func MessageEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldMessage, v))}
// MessageNEQ applies the NEQ predicate on the "message" field.func MessageNEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldMessage, v))}
// MessageIn applies the In predicate on the "message" field.func MessageIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldMessage, vs...))}
// MessageNotIn applies the NotIn predicate on the "message" field.func MessageNotIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldMessage, vs...))}
// MessageGT applies the GT predicate on the "message" field.func MessageGT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldMessage, v))}
// MessageGTE applies the GTE predicate on the "message" field.func MessageGTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldMessage, v))}
// MessageLT applies the LT predicate on the "message" field.func MessageLT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldMessage, v))}
// MessageLTE applies the LTE predicate on the "message" field.func MessageLTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldMessage, v))}
// MessageContains applies the Contains predicate on the "message" field.func MessageContains(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContains(FieldMessage, v))}
// MessageHasPrefix applies the HasPrefix predicate on the "message" field.func MessageHasPrefix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasPrefix(FieldMessage, v))}
// MessageHasSuffix applies the HasSuffix predicate on the "message" field.func MessageHasSuffix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasSuffix(FieldMessage, v))}
// MessageEqualFold applies the EqualFold predicate on the "message" field.func MessageEqualFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEqualFold(FieldMessage, v))}
// MessageContainsFold applies the ContainsFold predicate on the "message" field.func MessageContainsFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContainsFold(FieldMessage, v))}
// PathEQ applies the EQ predicate on the "path" field.func PathEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldPath, v))}
// PathNEQ applies the NEQ predicate on the "path" field.func PathNEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldPath, v))}
// PathIn applies the In predicate on the "path" field.func PathIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldPath, vs...))}
// PathNotIn applies the NotIn predicate on the "path" field.func PathNotIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldPath, vs...))}
// PathGT applies the GT predicate on the "path" field.func PathGT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldPath, v))}
// PathGTE applies the GTE predicate on the "path" field.func PathGTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldPath, v))}
// PathLT applies the LT predicate on the "path" field.func PathLT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldPath, v))}
// PathLTE applies the LTE predicate on the "path" field.func PathLTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldPath, v))}
// PathContains applies the Contains predicate on the "path" field.func PathContains(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContains(FieldPath, v))}
// PathHasPrefix applies the HasPrefix predicate on the "path" field.func PathHasPrefix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasPrefix(FieldPath, v))}
// PathHasSuffix applies the HasSuffix predicate on the "path" field.func PathHasSuffix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasSuffix(FieldPath, v))}
// PathIsNil applies the IsNil predicate on the "path" field.func PathIsNil() predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIsNull(FieldPath))}
// PathNotNil applies the NotNil predicate on the "path" field.func PathNotNil() predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotNull(FieldPath))}
// PathEqualFold applies the EqualFold predicate on the "path" field.func PathEqualFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEqualFold(FieldPath, v))}
// PathContainsFold applies the ContainsFold predicate on the "path" field.func PathContainsFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContainsFold(FieldPath, v))}
// ComponentEQ applies the EQ predicate on the "component" field.func ComponentEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldComponent, v))}
// ComponentNEQ applies the NEQ predicate on the "component" field.func ComponentNEQ(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldComponent, v))}
// ComponentIn applies the In predicate on the "component" field.func ComponentIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldComponent, vs...))}
// ComponentNotIn applies the NotIn predicate on the "component" field.func ComponentNotIn(vs ...string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldComponent, vs...))}
// ComponentGT applies the GT predicate on the "component" field.func ComponentGT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldComponent, v))}
// ComponentGTE applies the GTE predicate on the "component" field.func ComponentGTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldComponent, v))}
// ComponentLT applies the LT predicate on the "component" field.func ComponentLT(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldComponent, v))}
// ComponentLTE applies the LTE predicate on the "component" field.func ComponentLTE(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldComponent, v))}
// ComponentContains applies the Contains predicate on the "component" field.func ComponentContains(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContains(FieldComponent, v))}
// ComponentHasPrefix applies the HasPrefix predicate on the "component" field.func ComponentHasPrefix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasPrefix(FieldComponent, v))}
// ComponentHasSuffix applies the HasSuffix predicate on the "component" field.func ComponentHasSuffix(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldHasSuffix(FieldComponent, v))}
// ComponentEqualFold applies the EqualFold predicate on the "component" field.func ComponentEqualFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEqualFold(FieldComponent, v))}
// ComponentContainsFold applies the ContainsFold predicate on the "component" field.func ComponentContainsFold(v string) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldContainsFold(FieldComponent, v))}
// DedupeHashEQ applies the EQ predicate on the "dedupe_hash" field.func DedupeHashEQ(v []byte) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldEQ(FieldDedupeHash, v))}
// DedupeHashNEQ applies the NEQ predicate on the "dedupe_hash" field.func DedupeHashNEQ(v []byte) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNEQ(FieldDedupeHash, v))}
// DedupeHashIn applies the In predicate on the "dedupe_hash" field.func DedupeHashIn(vs ...[]byte) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldIn(FieldDedupeHash, vs...))}
// DedupeHashNotIn applies the NotIn predicate on the "dedupe_hash" field.func DedupeHashNotIn(vs ...[]byte) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldNotIn(FieldDedupeHash, vs...))}
// DedupeHashGT applies the GT predicate on the "dedupe_hash" field.func DedupeHashGT(v []byte) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGT(FieldDedupeHash, v))}
// DedupeHashGTE applies the GTE predicate on the "dedupe_hash" field.func DedupeHashGTE(v []byte) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldGTE(FieldDedupeHash, v))}
// DedupeHashLT applies the LT predicate on the "dedupe_hash" field.func DedupeHashLT(v []byte) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLT(FieldDedupeHash, v))}
// DedupeHashLTE applies the LTE predicate on the "dedupe_hash" field.func DedupeHashLTE(v []byte) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.FieldLTE(FieldDedupeHash, v))}
// HasBillingInvoice applies the HasEdge predicate on the "billing_invoice" edge.func HasBillingInvoice() predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, BillingInvoiceTable, BillingInvoiceColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasBillingInvoiceWith applies the HasEdge predicate on the "billing_invoice" edge with a given conditions (other predicates).func HasBillingInvoiceWith(preds ...predicate.BillingInvoice) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(func(s *sql.Selector) { step := newBillingInvoiceStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// And groups predicates with the AND operator between them.func And(predicates ...predicate.BillingInvoiceValidationIssue) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.AndPredicates(predicates...))}
// Or groups predicates with the OR operator between them.func Or(predicates ...predicate.BillingInvoiceValidationIssue) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.OrPredicates(predicates...))}
// Not applies the not operator on the given predicate.func Not(p predicate.BillingInvoiceValidationIssue) predicate.BillingInvoiceValidationIssue { return predicate.BillingInvoiceValidationIssue(sql.NotPredicates(p))}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt" "time"
"entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicevalidationissue")
// BillingInvoiceValidationIssueCreate is the builder for creating a BillingInvoiceValidationIssue entity.type BillingInvoiceValidationIssueCreate struct { config mutation *BillingInvoiceValidationIssueMutation hooks []Hook conflict []sql.ConflictOption}
// SetNamespace sets the "namespace" field.func (_c *BillingInvoiceValidationIssueCreate) SetNamespace(v string) *BillingInvoiceValidationIssueCreate { _c.mutation.SetNamespace(v) return _c}
// SetCreatedAt sets the "created_at" field.func (_c *BillingInvoiceValidationIssueCreate) SetCreatedAt(v time.Time) *BillingInvoiceValidationIssueCreate { _c.mutation.SetCreatedAt(v) return _c}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.func (_c *BillingInvoiceValidationIssueCreate) SetNillableCreatedAt(v *time.Time) *BillingInvoiceValidationIssueCreate { if v != nil { _c.SetCreatedAt(*v) } return _c}
// SetUpdatedAt sets the "updated_at" field.func (_c *BillingInvoiceValidationIssueCreate) SetUpdatedAt(v time.Time) *BillingInvoiceValidationIssueCreate { _c.mutation.SetUpdatedAt(v) return _c}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.func (_c *BillingInvoiceValidationIssueCreate) SetNillableUpdatedAt(v *time.Time) *BillingInvoiceValidationIssueCreate { if v != nil { _c.SetUpdatedAt(*v) } return _c}
// SetDeletedAt sets the "deleted_at" field.func (_c *BillingInvoiceValidationIssueCreate) SetDeletedAt(v time.Time) *BillingInvoiceValidationIssueCreate { _c.mutation.SetDeletedAt(v) return _c}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_c *BillingInvoiceValidationIssueCreate) SetNillableDeletedAt(v *time.Time) *BillingInvoiceValidationIssueCreate { if v != nil { _c.SetDeletedAt(*v) } return _c}
// SetInvoiceID sets the "invoice_id" field.func (_c *BillingInvoiceValidationIssueCreate) SetInvoiceID(v string) *BillingInvoiceValidationIssueCreate { _c.mutation.SetInvoiceID(v) return _c}
// SetSeverity sets the "severity" field.func (_c *BillingInvoiceValidationIssueCreate) SetSeverity(v billing.ValidationIssueSeverity) *BillingInvoiceValidationIssueCreate { _c.mutation.SetSeverity(v) return _c}
// SetCode sets the "code" field.func (_c *BillingInvoiceValidationIssueCreate) SetCode(v string) *BillingInvoiceValidationIssueCreate { _c.mutation.SetCode(v) return _c}
// SetNillableCode sets the "code" field if the given value is not nil.func (_c *BillingInvoiceValidationIssueCreate) SetNillableCode(v *string) *BillingInvoiceValidationIssueCreate { if v != nil { _c.SetCode(*v) } return _c}
// SetMessage sets the "message" field.func (_c *BillingInvoiceValidationIssueCreate) SetMessage(v string) *BillingInvoiceValidationIssueCreate { _c.mutation.SetMessage(v) return _c}
// SetPath sets the "path" field.func (_c *BillingInvoiceValidationIssueCreate) SetPath(v string) *BillingInvoiceValidationIssueCreate { _c.mutation.SetPath(v) return _c}
// SetNillablePath sets the "path" field if the given value is not nil.func (_c *BillingInvoiceValidationIssueCreate) SetNillablePath(v *string) *BillingInvoiceValidationIssueCreate { if v != nil { _c.SetPath(*v) } return _c}
// SetComponent sets the "component" field.func (_c *BillingInvoiceValidationIssueCreate) SetComponent(v string) *BillingInvoiceValidationIssueCreate { _c.mutation.SetComponent(v) return _c}
// SetDedupeHash sets the "dedupe_hash" field.func (_c *BillingInvoiceValidationIssueCreate) SetDedupeHash(v []byte) *BillingInvoiceValidationIssueCreate { _c.mutation.SetDedupeHash(v) return _c}
// SetID sets the "id" field.func (_c *BillingInvoiceValidationIssueCreate) SetID(v string) *BillingInvoiceValidationIssueCreate { _c.mutation.SetID(v) return _c}
// SetNillableID sets the "id" field if the given value is not nil.func (_c *BillingInvoiceValidationIssueCreate) SetNillableID(v *string) *BillingInvoiceValidationIssueCreate { if v != nil { _c.SetID(*v) } return _c}
// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID.func (_c *BillingInvoiceValidationIssueCreate) SetBillingInvoiceID(id string) *BillingInvoiceValidationIssueCreate { _c.mutation.SetBillingInvoiceID(id) return _c}
// SetBillingInvoice sets the "billing_invoice" edge to the BillingInvoice entity.func (_c *BillingInvoiceValidationIssueCreate) SetBillingInvoice(v *BillingInvoice) *BillingInvoiceValidationIssueCreate { return _c.SetBillingInvoiceID(v.ID)}
// Mutation returns the BillingInvoiceValidationIssueMutation object of the builder.func (_c *BillingInvoiceValidationIssueCreate) Mutation() *BillingInvoiceValidationIssueMutation { return _c.mutation}
// Save creates the BillingInvoiceValidationIssue in the database.func (_c *BillingInvoiceValidationIssueCreate) Save(ctx context.Context) (*BillingInvoiceValidationIssue, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)}
// SaveX calls Save and panics if Save returns an error.func (_c *BillingInvoiceValidationIssueCreate) SaveX(ctx context.Context) *BillingInvoiceValidationIssue { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceValidationIssueCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceValidationIssueCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_c *BillingInvoiceValidationIssueCreate) defaults() { if _, ok := _c.mutation.CreatedAt(); !ok { v := billinginvoicevalidationissue.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } if _, ok := _c.mutation.UpdatedAt(); !ok { v := billinginvoicevalidationissue.DefaultUpdatedAt() _c.mutation.SetUpdatedAt(v) } if _, ok := _c.mutation.ID(); !ok { v := billinginvoicevalidationissue.DefaultID() _c.mutation.SetID(v) }}
// check runs all checks and user-defined validators on the builder.func (_c *BillingInvoiceValidationIssueCreate) check() error { if _, ok := _c.mutation.Namespace(); !ok { return &ValidationError{Name: "namespace", err: errors.New(`db: missing required field "BillingInvoiceValidationIssue.namespace"`)} } if v, ok := _c.mutation.Namespace(); ok { if err := billinginvoicevalidationissue.NamespaceValidator(v); err != nil { return &ValidationError{Name: "namespace", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.namespace": %w`, err)} } } if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "BillingInvoiceValidationIssue.created_at"`)} } if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`db: missing required field "BillingInvoiceValidationIssue.updated_at"`)} } if _, ok := _c.mutation.InvoiceID(); !ok { return &ValidationError{Name: "invoice_id", err: errors.New(`db: missing required field "BillingInvoiceValidationIssue.invoice_id"`)} } if v, ok := _c.mutation.InvoiceID(); ok { if err := billinginvoicevalidationissue.InvoiceIDValidator(v); err != nil { return &ValidationError{Name: "invoice_id", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.invoice_id": %w`, err)} } } if _, ok := _c.mutation.Severity(); !ok { return &ValidationError{Name: "severity", err: errors.New(`db: missing required field "BillingInvoiceValidationIssue.severity"`)} } if v, ok := _c.mutation.Severity(); ok { if err := billinginvoicevalidationissue.SeverityValidator(v); err != nil { return &ValidationError{Name: "severity", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.severity": %w`, err)} } } if _, ok := _c.mutation.Message(); !ok { return &ValidationError{Name: "message", err: errors.New(`db: missing required field "BillingInvoiceValidationIssue.message"`)} } if v, ok := _c.mutation.Message(); ok { if err := billinginvoicevalidationissue.MessageValidator(v); err != nil { return &ValidationError{Name: "message", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.message": %w`, err)} } } if _, ok := _c.mutation.Component(); !ok { return &ValidationError{Name: "component", err: errors.New(`db: missing required field "BillingInvoiceValidationIssue.component"`)} } if _, ok := _c.mutation.DedupeHash(); !ok { return &ValidationError{Name: "dedupe_hash", err: errors.New(`db: missing required field "BillingInvoiceValidationIssue.dedupe_hash"`)} } if v, ok := _c.mutation.DedupeHash(); ok { if err := billinginvoicevalidationissue.DedupeHashValidator(v); err != nil { return &ValidationError{Name: "dedupe_hash", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.dedupe_hash": %w`, err)} } } if len(_c.mutation.BillingInvoiceIDs()) == 0 { return &ValidationError{Name: "billing_invoice", err: errors.New(`db: missing required edge "BillingInvoiceValidationIssue.billing_invoice"`)} } return nil}
func (_c *BillingInvoiceValidationIssueCreate) sqlSave(ctx context.Context) (*BillingInvoiceValidationIssue, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(string); ok { _node.ID = id } else { return nil, fmt.Errorf("unexpected BillingInvoiceValidationIssue.ID type: %T", _spec.ID.Value) } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil}
func (_c *BillingInvoiceValidationIssueCreate) createSpec() (*BillingInvoiceValidationIssue, *sqlgraph.CreateSpec) { var ( _node = &BillingInvoiceValidationIssue{config: _c.config} _spec = sqlgraph.NewCreateSpec(billinginvoicevalidationissue.Table, sqlgraph.NewFieldSpec(billinginvoicevalidationissue.FieldID, field.TypeString)) ) _spec.OnConflict = _c.conflict if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = id } if value, ok := _c.mutation.Namespace(); ok { _spec.SetField(billinginvoicevalidationissue.FieldNamespace, field.TypeString, value) _node.Namespace = value } if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(billinginvoicevalidationissue.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicevalidationissue.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } if value, ok := _c.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicevalidationissue.FieldDeletedAt, field.TypeTime, value) _node.DeletedAt = &value } if value, ok := _c.mutation.Severity(); ok { _spec.SetField(billinginvoicevalidationissue.FieldSeverity, field.TypeEnum, value) _node.Severity = value } if value, ok := _c.mutation.Code(); ok { _spec.SetField(billinginvoicevalidationissue.FieldCode, field.TypeString, value) _node.Code = &value } if value, ok := _c.mutation.Message(); ok { _spec.SetField(billinginvoicevalidationissue.FieldMessage, field.TypeString, value) _node.Message = value } if value, ok := _c.mutation.Path(); ok { _spec.SetField(billinginvoicevalidationissue.FieldPath, field.TypeString, value) _node.Path = &value } if value, ok := _c.mutation.Component(); ok { _spec.SetField(billinginvoicevalidationissue.FieldComponent, field.TypeString, value) _node.Component = value } if value, ok := _c.mutation.DedupeHash(); ok { _spec.SetField(billinginvoicevalidationissue.FieldDedupeHash, field.TypeBytes, value) _node.DedupeHash = value } if nodes := _c.mutation.BillingInvoiceIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicevalidationissue.BillingInvoiceTable, Columns: []string{billinginvoicevalidationissue.BillingInvoiceColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.InvoiceID = nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceValidationIssue.Create().// SetNamespace(v).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceValidationIssueUpsert) {// SetNamespace(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceValidationIssueCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceValidationIssueUpsertOne { _c.conflict = opts return &BillingInvoiceValidationIssueUpsertOne{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceValidationIssue.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceValidationIssueCreate) OnConflictColumns(columns ...string) *BillingInvoiceValidationIssueUpsertOne { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceValidationIssueUpsertOne{ create: _c, }}
type ( // BillingInvoiceValidationIssueUpsertOne is the builder for "upsert"-ing // one BillingInvoiceValidationIssue node. BillingInvoiceValidationIssueUpsertOne struct { create *BillingInvoiceValidationIssueCreate }
// BillingInvoiceValidationIssueUpsert is the "OnConflict" setter. BillingInvoiceValidationIssueUpsert struct { *sql.UpdateSet })
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceValidationIssueUpsert) SetUpdatedAt(v time.Time) *BillingInvoiceValidationIssueUpsert { u.Set(billinginvoicevalidationissue.FieldUpdatedAt, v) return u}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsert) UpdateUpdatedAt() *BillingInvoiceValidationIssueUpsert { u.SetExcluded(billinginvoicevalidationissue.FieldUpdatedAt) return u}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceValidationIssueUpsert) SetDeletedAt(v time.Time) *BillingInvoiceValidationIssueUpsert { u.Set(billinginvoicevalidationissue.FieldDeletedAt, v) return u}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsert) UpdateDeletedAt() *BillingInvoiceValidationIssueUpsert { u.SetExcluded(billinginvoicevalidationissue.FieldDeletedAt) return u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceValidationIssueUpsert) ClearDeletedAt() *BillingInvoiceValidationIssueUpsert { u.SetNull(billinginvoicevalidationissue.FieldDeletedAt) return u}
// SetInvoiceID sets the "invoice_id" field.func (u *BillingInvoiceValidationIssueUpsert) SetInvoiceID(v string) *BillingInvoiceValidationIssueUpsert { u.Set(billinginvoicevalidationissue.FieldInvoiceID, v) return u}
// UpdateInvoiceID sets the "invoice_id" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsert) UpdateInvoiceID() *BillingInvoiceValidationIssueUpsert { u.SetExcluded(billinginvoicevalidationissue.FieldInvoiceID) return u}
// SetSeverity sets the "severity" field.func (u *BillingInvoiceValidationIssueUpsert) SetSeverity(v billing.ValidationIssueSeverity) *BillingInvoiceValidationIssueUpsert { u.Set(billinginvoicevalidationissue.FieldSeverity, v) return u}
// UpdateSeverity sets the "severity" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsert) UpdateSeverity() *BillingInvoiceValidationIssueUpsert { u.SetExcluded(billinginvoicevalidationissue.FieldSeverity) return u}
// SetCode sets the "code" field.func (u *BillingInvoiceValidationIssueUpsert) SetCode(v string) *BillingInvoiceValidationIssueUpsert { u.Set(billinginvoicevalidationissue.FieldCode, v) return u}
// UpdateCode sets the "code" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsert) UpdateCode() *BillingInvoiceValidationIssueUpsert { u.SetExcluded(billinginvoicevalidationissue.FieldCode) return u}
// ClearCode clears the value of the "code" field.func (u *BillingInvoiceValidationIssueUpsert) ClearCode() *BillingInvoiceValidationIssueUpsert { u.SetNull(billinginvoicevalidationissue.FieldCode) return u}
// SetMessage sets the "message" field.func (u *BillingInvoiceValidationIssueUpsert) SetMessage(v string) *BillingInvoiceValidationIssueUpsert { u.Set(billinginvoicevalidationissue.FieldMessage, v) return u}
// UpdateMessage sets the "message" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsert) UpdateMessage() *BillingInvoiceValidationIssueUpsert { u.SetExcluded(billinginvoicevalidationissue.FieldMessage) return u}
// SetPath sets the "path" field.func (u *BillingInvoiceValidationIssueUpsert) SetPath(v string) *BillingInvoiceValidationIssueUpsert { u.Set(billinginvoicevalidationissue.FieldPath, v) return u}
// UpdatePath sets the "path" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsert) UpdatePath() *BillingInvoiceValidationIssueUpsert { u.SetExcluded(billinginvoicevalidationissue.FieldPath) return u}
// ClearPath clears the value of the "path" field.func (u *BillingInvoiceValidationIssueUpsert) ClearPath() *BillingInvoiceValidationIssueUpsert { u.SetNull(billinginvoicevalidationissue.FieldPath) return u}
// SetComponent sets the "component" field.func (u *BillingInvoiceValidationIssueUpsert) SetComponent(v string) *BillingInvoiceValidationIssueUpsert { u.Set(billinginvoicevalidationissue.FieldComponent, v) return u}
// UpdateComponent sets the "component" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsert) UpdateComponent() *BillingInvoiceValidationIssueUpsert { u.SetExcluded(billinginvoicevalidationissue.FieldComponent) return u}
// SetDedupeHash sets the "dedupe_hash" field.func (u *BillingInvoiceValidationIssueUpsert) SetDedupeHash(v []byte) *BillingInvoiceValidationIssueUpsert { u.Set(billinginvoicevalidationissue.FieldDedupeHash, v) return u}
// UpdateDedupeHash sets the "dedupe_hash" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsert) UpdateDedupeHash() *BillingInvoiceValidationIssueUpsert { u.SetExcluded(billinginvoicevalidationissue.FieldDedupeHash) return u}
// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.// Using this option is equivalent to using://// client.BillingInvoiceValidationIssue.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoicevalidationissue.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceValidationIssueUpsertOne) UpdateNewValues() *BillingInvoiceValidationIssueUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { if _, exists := u.create.mutation.ID(); exists { s.SetIgnore(billinginvoicevalidationissue.FieldID) } if _, exists := u.create.mutation.Namespace(); exists { s.SetIgnore(billinginvoicevalidationissue.FieldNamespace) } if _, exists := u.create.mutation.CreatedAt(); exists { s.SetIgnore(billinginvoicevalidationissue.FieldCreatedAt) } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceValidationIssue.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceValidationIssueUpsertOne) Ignore() *BillingInvoiceValidationIssueUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceValidationIssueUpsertOne) DoNothing() *BillingInvoiceValidationIssueUpsertOne { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceValidationIssueCreate.OnConflict// documentation for more info.func (u *BillingInvoiceValidationIssueUpsertOne) Update(set func(*BillingInvoiceValidationIssueUpsert)) *BillingInvoiceValidationIssueUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceValidationIssueUpsert{UpdateSet: update}) })) return u}
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceValidationIssueUpsertOne) SetUpdatedAt(v time.Time) *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetUpdatedAt(v) })}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertOne) UpdateUpdatedAt() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateUpdatedAt() })}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceValidationIssueUpsertOne) SetDeletedAt(v time.Time) *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetDeletedAt(v) })}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertOne) UpdateDeletedAt() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateDeletedAt() })}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceValidationIssueUpsertOne) ClearDeletedAt() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.ClearDeletedAt() })}
// SetInvoiceID sets the "invoice_id" field.func (u *BillingInvoiceValidationIssueUpsertOne) SetInvoiceID(v string) *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetInvoiceID(v) })}
// UpdateInvoiceID sets the "invoice_id" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertOne) UpdateInvoiceID() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateInvoiceID() })}
// SetSeverity sets the "severity" field.func (u *BillingInvoiceValidationIssueUpsertOne) SetSeverity(v billing.ValidationIssueSeverity) *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetSeverity(v) })}
// UpdateSeverity sets the "severity" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertOne) UpdateSeverity() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateSeverity() })}
// SetCode sets the "code" field.func (u *BillingInvoiceValidationIssueUpsertOne) SetCode(v string) *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetCode(v) })}
// UpdateCode sets the "code" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertOne) UpdateCode() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateCode() })}
// ClearCode clears the value of the "code" field.func (u *BillingInvoiceValidationIssueUpsertOne) ClearCode() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.ClearCode() })}
// SetMessage sets the "message" field.func (u *BillingInvoiceValidationIssueUpsertOne) SetMessage(v string) *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetMessage(v) })}
// UpdateMessage sets the "message" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertOne) UpdateMessage() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateMessage() })}
// SetPath sets the "path" field.func (u *BillingInvoiceValidationIssueUpsertOne) SetPath(v string) *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetPath(v) })}
// UpdatePath sets the "path" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertOne) UpdatePath() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdatePath() })}
// ClearPath clears the value of the "path" field.func (u *BillingInvoiceValidationIssueUpsertOne) ClearPath() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.ClearPath() })}
// SetComponent sets the "component" field.func (u *BillingInvoiceValidationIssueUpsertOne) SetComponent(v string) *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetComponent(v) })}
// UpdateComponent sets the "component" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertOne) UpdateComponent() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateComponent() })}
// SetDedupeHash sets the "dedupe_hash" field.func (u *BillingInvoiceValidationIssueUpsertOne) SetDedupeHash(v []byte) *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetDedupeHash(v) })}
// UpdateDedupeHash sets the "dedupe_hash" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertOne) UpdateDedupeHash() *BillingInvoiceValidationIssueUpsertOne { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateDedupeHash() })}
// Exec executes the query.func (u *BillingInvoiceValidationIssueUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceValidationIssueCreate.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceValidationIssueUpsertOne) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}
// Exec executes the UPSERT query and returns the inserted/updated ID.func (u *BillingInvoiceValidationIssueUpsertOne) ID(ctx context.Context) (id string, err error) { if u.create.driver.Dialect() == dialect.MySQL { // In case of "ON CONFLICT", there is no way to get back non-numeric ID // fields from the database since MySQL does not support the RETURNING clause. return id, errors.New("db: BillingInvoiceValidationIssueUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceValidationIssueUpsertOne.Exec instead") } node, err := u.create.Save(ctx) if err != nil { return id, err } return node.ID, nil}
// IDX is like ID, but panics if an error occurs.func (u *BillingInvoiceValidationIssueUpsertOne) IDX(ctx context.Context) string { id, err := u.ID(ctx) if err != nil { panic(err) } return id}
// BillingInvoiceValidationIssueCreateBulk is the builder for creating many BillingInvoiceValidationIssue entities in bulk.type BillingInvoiceValidationIssueCreateBulk struct { config err error builders []*BillingInvoiceValidationIssueCreate conflict []sql.ConflictOption}
// Save creates the BillingInvoiceValidationIssue entities in the database.func (_c *BillingInvoiceValidationIssueCreateBulk) Save(ctx context.Context) ([]*BillingInvoiceValidationIssue, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*BillingInvoiceValidationIssue, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*BillingInvoiceValidationIssueMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } } } if err != nil { return nil, err } mutation.id = &nodes[i].ID mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { mut = builder.hooks[i](mut) } mutators[i] = mut }(i, ctx) } if len(mutators) > 0 { if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil}
// SaveX is like Save, but panics if an error occurs.func (_c *BillingInvoiceValidationIssueCreateBulk) SaveX(ctx context.Context) []*BillingInvoiceValidationIssue { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceValidationIssueCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceValidationIssueCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceValidationIssue.CreateBulk(builders...).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceValidationIssueUpsert) {// SetNamespace(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceValidationIssueCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceValidationIssueUpsertBulk { _c.conflict = opts return &BillingInvoiceValidationIssueUpsertBulk{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceValidationIssue.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceValidationIssueCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceValidationIssueUpsertBulk { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceValidationIssueUpsertBulk{ create: _c, }}
// BillingInvoiceValidationIssueUpsertBulk is the builder for "upsert"-ing// a bulk of BillingInvoiceValidationIssue nodes.type BillingInvoiceValidationIssueUpsertBulk struct { create *BillingInvoiceValidationIssueCreateBulk}
// UpdateNewValues updates the mutable fields using the new values that// were set on create. Using this option is equivalent to using://// client.BillingInvoiceValidationIssue.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoicevalidationissue.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceValidationIssueUpsertBulk) UpdateNewValues() *BillingInvoiceValidationIssueUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { for _, b := range u.create.builders { if _, exists := b.mutation.ID(); exists { s.SetIgnore(billinginvoicevalidationissue.FieldID) } if _, exists := b.mutation.Namespace(); exists { s.SetIgnore(billinginvoicevalidationissue.FieldNamespace) } if _, exists := b.mutation.CreatedAt(); exists { s.SetIgnore(billinginvoicevalidationissue.FieldCreatedAt) } } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceValidationIssue.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceValidationIssueUpsertBulk) Ignore() *BillingInvoiceValidationIssueUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceValidationIssueUpsertBulk) DoNothing() *BillingInvoiceValidationIssueUpsertBulk { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceValidationIssueCreateBulk.OnConflict// documentation for more info.func (u *BillingInvoiceValidationIssueUpsertBulk) Update(set func(*BillingInvoiceValidationIssueUpsert)) *BillingInvoiceValidationIssueUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceValidationIssueUpsert{UpdateSet: update}) })) return u}
// SetUpdatedAt sets the "updated_at" field.func (u *BillingInvoiceValidationIssueUpsertBulk) SetUpdatedAt(v time.Time) *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetUpdatedAt(v) })}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertBulk) UpdateUpdatedAt() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateUpdatedAt() })}
// SetDeletedAt sets the "deleted_at" field.func (u *BillingInvoiceValidationIssueUpsertBulk) SetDeletedAt(v time.Time) *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetDeletedAt(v) })}
// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertBulk) UpdateDeletedAt() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateDeletedAt() })}
// ClearDeletedAt clears the value of the "deleted_at" field.func (u *BillingInvoiceValidationIssueUpsertBulk) ClearDeletedAt() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.ClearDeletedAt() })}
// SetInvoiceID sets the "invoice_id" field.func (u *BillingInvoiceValidationIssueUpsertBulk) SetInvoiceID(v string) *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetInvoiceID(v) })}
// UpdateInvoiceID sets the "invoice_id" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertBulk) UpdateInvoiceID() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateInvoiceID() })}
// SetSeverity sets the "severity" field.func (u *BillingInvoiceValidationIssueUpsertBulk) SetSeverity(v billing.ValidationIssueSeverity) *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetSeverity(v) })}
// UpdateSeverity sets the "severity" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertBulk) UpdateSeverity() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateSeverity() })}
// SetCode sets the "code" field.func (u *BillingInvoiceValidationIssueUpsertBulk) SetCode(v string) *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetCode(v) })}
// UpdateCode sets the "code" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertBulk) UpdateCode() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateCode() })}
// ClearCode clears the value of the "code" field.func (u *BillingInvoiceValidationIssueUpsertBulk) ClearCode() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.ClearCode() })}
// SetMessage sets the "message" field.func (u *BillingInvoiceValidationIssueUpsertBulk) SetMessage(v string) *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetMessage(v) })}
// UpdateMessage sets the "message" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertBulk) UpdateMessage() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateMessage() })}
// SetPath sets the "path" field.func (u *BillingInvoiceValidationIssueUpsertBulk) SetPath(v string) *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetPath(v) })}
// UpdatePath sets the "path" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertBulk) UpdatePath() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdatePath() })}
// ClearPath clears the value of the "path" field.func (u *BillingInvoiceValidationIssueUpsertBulk) ClearPath() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.ClearPath() })}
// SetComponent sets the "component" field.func (u *BillingInvoiceValidationIssueUpsertBulk) SetComponent(v string) *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetComponent(v) })}
// UpdateComponent sets the "component" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertBulk) UpdateComponent() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateComponent() })}
// SetDedupeHash sets the "dedupe_hash" field.func (u *BillingInvoiceValidationIssueUpsertBulk) SetDedupeHash(v []byte) *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.SetDedupeHash(v) })}
// UpdateDedupeHash sets the "dedupe_hash" field to the value that was provided on create.func (u *BillingInvoiceValidationIssueUpsertBulk) UpdateDedupeHash() *BillingInvoiceValidationIssueUpsertBulk { return u.Update(func(s *BillingInvoiceValidationIssueUpsert) { s.UpdateDedupeHash() })}
// Exec executes the query.func (u *BillingInvoiceValidationIssueUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { return u.create.err } for i, b := range u.create.builders { if len(b.conflict) != 0 { return fmt.Errorf("db: OnConflict was set for builder %d. Set it on the BillingInvoiceValidationIssueCreateBulk instead", i) } } if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceValidationIssueCreateBulk.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceValidationIssueUpsertBulk) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788// Code generated by ent, DO NOT EDIT.
package db
import ( "context"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicevalidationissue" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceValidationIssueDelete is the builder for deleting a BillingInvoiceValidationIssue entity.type BillingInvoiceValidationIssueDelete struct { config hooks []Hook mutation *BillingInvoiceValidationIssueMutation}
// Where appends a list predicates to the BillingInvoiceValidationIssueDelete builder.func (_d *BillingInvoiceValidationIssueDelete) Where(ps ...predicate.BillingInvoiceValidationIssue) *BillingInvoiceValidationIssueDelete { _d.mutation.Where(ps...) return _d}
// Exec executes the deletion query and returns how many vertices were deleted.func (_d *BillingInvoiceValidationIssueDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceValidationIssueDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n}
func (_d *BillingInvoiceValidationIssueDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(billinginvoicevalidationissue.Table, sqlgraph.NewFieldSpec(billinginvoicevalidationissue.FieldID, field.TypeString)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err}
// BillingInvoiceValidationIssueDeleteOne is the builder for deleting a single BillingInvoiceValidationIssue entity.type BillingInvoiceValidationIssueDeleteOne struct { _d *BillingInvoiceValidationIssueDelete}
// Where appends a list predicates to the BillingInvoiceValidationIssueDelete builder.func (_d *BillingInvoiceValidationIssueDeleteOne) Where(ps ...predicate.BillingInvoiceValidationIssue) *BillingInvoiceValidationIssueDeleteOne { _d._d.mutation.Where(ps...) return _d}
// Exec executes the deletion query.func (_d *BillingInvoiceValidationIssueDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{billinginvoicevalidationissue.Label} default: return nil }}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceValidationIssueDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "fmt" "math"
"entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicevalidationissue" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceValidationIssueQuery is the builder for querying BillingInvoiceValidationIssue entities.type BillingInvoiceValidationIssueQuery struct { config ctx *QueryContext order []billinginvoicevalidationissue.OrderOption inters []Interceptor predicates []predicate.BillingInvoiceValidationIssue withBillingInvoice *BillingInvoiceQuery 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 BillingInvoiceValidationIssueQuery builder.func (_q *BillingInvoiceValidationIssueQuery) Where(ps ...predicate.BillingInvoiceValidationIssue) *BillingInvoiceValidationIssueQuery { _q.predicates = append(_q.predicates, ps...) return _q}
// Limit the number of records to be returned by this query.func (_q *BillingInvoiceValidationIssueQuery) Limit(limit int) *BillingInvoiceValidationIssueQuery { _q.ctx.Limit = &limit return _q}
// Offset to start from.func (_q *BillingInvoiceValidationIssueQuery) Offset(offset int) *BillingInvoiceValidationIssueQuery { _q.ctx.Offset = &offset return _q}
// 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 (_q *BillingInvoiceValidationIssueQuery) Unique(unique bool) *BillingInvoiceValidationIssueQuery { _q.ctx.Unique = &unique return _q}
// Order specifies how the records should be ordered.func (_q *BillingInvoiceValidationIssueQuery) Order(o ...billinginvoicevalidationissue.OrderOption) *BillingInvoiceValidationIssueQuery { _q.order = append(_q.order, o...) return _q}
// QueryBillingInvoice chains the current query on the "billing_invoice" edge.func (_q *BillingInvoiceValidationIssueQuery) QueryBillingInvoice() *BillingInvoiceQuery { query := (&BillingInvoiceClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(billinginvoicevalidationissue.Table, billinginvoicevalidationissue.FieldID, selector), sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, billinginvoicevalidationissue.BillingInvoiceTable, billinginvoicevalidationissue.BillingInvoiceColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query}
// First returns the first BillingInvoiceValidationIssue entity from the query.// Returns a *NotFoundError when no BillingInvoiceValidationIssue was found.func (_q *BillingInvoiceValidationIssueQuery) First(ctx context.Context) (*BillingInvoiceValidationIssue, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{billinginvoicevalidationissue.Label} } return nodes[0], nil}
// FirstX is like First, but panics if an error occurs.func (_q *BillingInvoiceValidationIssueQuery) FirstX(ctx context.Context) *BillingInvoiceValidationIssue { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node}
// FirstID returns the first BillingInvoiceValidationIssue ID from the query.// Returns a *NotFoundError when no BillingInvoiceValidationIssue ID was found.func (_q *BillingInvoiceValidationIssueQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{billinginvoicevalidationissue.Label} return } return ids[0], nil}
// FirstIDX is like FirstID, but panics if an error occurs.func (_q *BillingInvoiceValidationIssueQuery) FirstIDX(ctx context.Context) string { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id}
// Only returns a single BillingInvoiceValidationIssue entity found by the query, ensuring it only returns one.// Returns a *NotSingularError when more than one BillingInvoiceValidationIssue entity is found.// Returns a *NotFoundError when no BillingInvoiceValidationIssue entities are found.func (_q *BillingInvoiceValidationIssueQuery) Only(ctx context.Context) (*BillingInvoiceValidationIssue, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{billinginvoicevalidationissue.Label} default: return nil, &NotSingularError{billinginvoicevalidationissue.Label} }}
// OnlyX is like Only, but panics if an error occurs.func (_q *BillingInvoiceValidationIssueQuery) OnlyX(ctx context.Context) *BillingInvoiceValidationIssue { node, err := _q.Only(ctx) if err != nil { panic(err) } return node}
// OnlyID is like Only, but returns the only BillingInvoiceValidationIssue ID in the query.// Returns a *NotSingularError when more than one BillingInvoiceValidationIssue ID is found.// Returns a *NotFoundError when no entities are found.func (_q *BillingInvoiceValidationIssueQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{billinginvoicevalidationissue.Label} default: err = &NotSingularError{billinginvoicevalidationissue.Label} } return}
// OnlyIDX is like OnlyID, but panics if an error occurs.func (_q *BillingInvoiceValidationIssueQuery) OnlyIDX(ctx context.Context) string { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id}
// All executes the query and returns a list of BillingInvoiceValidationIssues.func (_q *BillingInvoiceValidationIssueQuery) All(ctx context.Context) ([]*BillingInvoiceValidationIssue, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*BillingInvoiceValidationIssue, *BillingInvoiceValidationIssueQuery]() return withInterceptors[[]*BillingInvoiceValidationIssue](ctx, _q, qr, _q.inters)}
// AllX is like All, but panics if an error occurs.func (_q *BillingInvoiceValidationIssueQuery) AllX(ctx context.Context) []*BillingInvoiceValidationIssue { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes}
// IDs executes the query and returns a list of BillingInvoiceValidationIssue IDs.func (_q *BillingInvoiceValidationIssueQuery) IDs(ctx context.Context) (ids []string, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(billinginvoicevalidationissue.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil}
// IDsX is like IDs, but panics if an error occurs.func (_q *BillingInvoiceValidationIssueQuery) IDsX(ctx context.Context) []string { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids}
// Count returns the count of the given query.func (_q *BillingInvoiceValidationIssueQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*BillingInvoiceValidationIssueQuery](), _q.inters)}
// CountX is like Count, but panics if an error occurs.func (_q *BillingInvoiceValidationIssueQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count}
// Exist returns true if the query has elements in the graph.func (_q *BillingInvoiceValidationIssueQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("db: check existence: %w", err) default: return true, nil }}
// ExistX is like Exist, but panics if an error occurs.func (_q *BillingInvoiceValidationIssueQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist}
// Clone returns a duplicate of the BillingInvoiceValidationIssueQuery builder, including all associated steps. It can be// used to prepare common query builders and use them differently after the clone is made.func (_q *BillingInvoiceValidationIssueQuery) Clone() *BillingInvoiceValidationIssueQuery { if _q == nil { return nil } return &BillingInvoiceValidationIssueQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]billinginvoicevalidationissue.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.BillingInvoiceValidationIssue{}, _q.predicates...), withBillingInvoice: _q.withBillingInvoice.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, }}
// WithBillingInvoice tells the query-builder to eager-load the nodes that are connected to// the "billing_invoice" edge. The optional arguments are used to configure the query builder of the edge.func (_q *BillingInvoiceValidationIssueQuery) WithBillingInvoice(opts ...func(*BillingInvoiceQuery)) *BillingInvoiceValidationIssueQuery { query := (&BillingInvoiceClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withBillingInvoice = query return _q}
// GroupBy is used to group vertices by one or more fields/columns.// It is often used with aggregate functions, like: count, max, mean, min, sum.//// Example://// var v []struct {// Namespace string `json:"namespace,omitempty"`// Count int `json:"count,omitempty"`// }//// client.BillingInvoiceValidationIssue.Query().// GroupBy(billinginvoicevalidationissue.FieldNamespace).// Aggregate(db.Count()).// Scan(ctx, &v)func (_q *BillingInvoiceValidationIssueQuery) GroupBy(field string, fields ...string) *BillingInvoiceValidationIssueGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &BillingInvoiceValidationIssueGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = billinginvoicevalidationissue.Label grbuild.scan = grbuild.Scan return grbuild}
// Select allows the selection one or more fields/columns for the given query,// instead of selecting all fields in the entity.//// Example://// var v []struct {// Namespace string `json:"namespace,omitempty"`// }//// client.BillingInvoiceValidationIssue.Query().// Select(billinginvoicevalidationissue.FieldNamespace).// Scan(ctx, &v)func (_q *BillingInvoiceValidationIssueQuery) Select(fields ...string) *BillingInvoiceValidationIssueSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &BillingInvoiceValidationIssueSelect{BillingInvoiceValidationIssueQuery: _q} sbuild.label = billinginvoicevalidationissue.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild}
// Aggregate returns a BillingInvoiceValidationIssueSelect configured with the given aggregations.func (_q *BillingInvoiceValidationIssueQuery) Aggregate(fns ...AggregateFunc) *BillingInvoiceValidationIssueSelect { return _q.Select().Aggregate(fns...)}
func (_q *BillingInvoiceValidationIssueQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("db: uninitialized interceptor (forgotten import db/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !billinginvoicevalidationissue.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil}
func (_q *BillingInvoiceValidationIssueQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BillingInvoiceValidationIssue, error) { var ( nodes = []*BillingInvoiceValidationIssue{} _spec = _q.querySpec() loadedTypes = [1]bool{ _q.withBillingInvoice != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*BillingInvoiceValidationIssue).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &BillingInvoiceValidationIssue{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withBillingInvoice; query != nil { if err := _q.loadBillingInvoice(ctx, query, nodes, nil, func(n *BillingInvoiceValidationIssue, e *BillingInvoice) { n.Edges.BillingInvoice = e }); err != nil { return nil, err } } return nodes, nil}
func (_q *BillingInvoiceValidationIssueQuery) loadBillingInvoice(ctx context.Context, query *BillingInvoiceQuery, nodes []*BillingInvoiceValidationIssue, init func(*BillingInvoiceValidationIssue), assign func(*BillingInvoiceValidationIssue, *BillingInvoice)) error { ids := make([]string, 0, len(nodes)) nodeids := make(map[string][]*BillingInvoiceValidationIssue) for i := range nodes { fk := nodes[i].InvoiceID if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(billinginvoice.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "invoice_id" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil}
func (_q *BillingInvoiceValidationIssueQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec)}
func (_q *BillingInvoiceValidationIssueQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(billinginvoicevalidationissue.Table, billinginvoicevalidationissue.Columns, sqlgraph.NewFieldSpec(billinginvoicevalidationissue.FieldID, field.TypeString)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicevalidationissue.FieldID) for i := range fields { if fields[i] != billinginvoicevalidationissue.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } if _q.withBillingInvoice != nil { _spec.Node.AddColumnOnce(billinginvoicevalidationissue.FieldInvoiceID) } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec}
func (_q *BillingInvoiceValidationIssueQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(billinginvoicevalidationissue.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = billinginvoicevalidationissue.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, m := range _q.modifiers { m(selector) } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector}
// ForUpdate locks the selected rows against concurrent updates, and prevent them from being// updated, deleted or "selected ... for update" by other sessions, until the transaction is// either committed or rolled-back.func (_q *BillingInvoiceValidationIssueQuery) ForUpdate(opts ...sql.LockOption) *BillingInvoiceValidationIssueQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForUpdate(opts...) }) return _q}
// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock// on any rows that are read. Other sessions can read the rows, but cannot modify them// until your transaction commits.func (_q *BillingInvoiceValidationIssueQuery) ForShare(opts ...sql.LockOption) *BillingInvoiceValidationIssueQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForShare(opts...) }) return _q}
// BillingInvoiceValidationIssueGroupBy is the group-by builder for BillingInvoiceValidationIssue entities.type BillingInvoiceValidationIssueGroupBy struct { selector build *BillingInvoiceValidationIssueQuery}
// Aggregate adds the given aggregation functions to the group-by query.func (_g *BillingInvoiceValidationIssueGroupBy) Aggregate(fns ...AggregateFunc) *BillingInvoiceValidationIssueGroupBy { _g.fns = append(_g.fns, fns...) return _g}
// Scan applies the selector query and scans the result into the given value.func (_g *BillingInvoiceValidationIssueGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceValidationIssueQuery, *BillingInvoiceValidationIssueGroupBy](ctx, _g.build, _g, _g.build.inters, v)}
func (_g *BillingInvoiceValidationIssueGroupBy) sqlScan(ctx context.Context, root *BillingInvoiceValidationIssueQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}
// BillingInvoiceValidationIssueSelect is the builder for selecting fields of BillingInvoiceValidationIssue entities.type BillingInvoiceValidationIssueSelect struct { *BillingInvoiceValidationIssueQuery selector}
// Aggregate adds the given aggregation functions to the selector query.func (_s *BillingInvoiceValidationIssueSelect) Aggregate(fns ...AggregateFunc) *BillingInvoiceValidationIssueSelect { _s.fns = append(_s.fns, fns...) return _s}
// Scan applies the selector query and scans the result into the given value.func (_s *BillingInvoiceValidationIssueSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceValidationIssueQuery, *BillingInvoiceValidationIssueSelect](ctx, _s.BillingInvoiceValidationIssueQuery, _s, _s.inters, v)}
func (_s *BillingInvoiceValidationIssueSelect) sqlScan(ctx context.Context, root *BillingInvoiceValidationIssueQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt" "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicevalidationissue" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceValidationIssueUpdate is the builder for updating BillingInvoiceValidationIssue entities.type BillingInvoiceValidationIssueUpdate struct { config hooks []Hook mutation *BillingInvoiceValidationIssueMutation}
// Where appends a list predicates to the BillingInvoiceValidationIssueUpdate builder.func (_u *BillingInvoiceValidationIssueUpdate) Where(ps ...predicate.BillingInvoiceValidationIssue) *BillingInvoiceValidationIssueUpdate { _u.mutation.Where(ps...) return _u}
// SetUpdatedAt sets the "updated_at" field.func (_u *BillingInvoiceValidationIssueUpdate) SetUpdatedAt(v time.Time) *BillingInvoiceValidationIssueUpdate { _u.mutation.SetUpdatedAt(v) return _u}
// SetDeletedAt sets the "deleted_at" field.func (_u *BillingInvoiceValidationIssueUpdate) SetDeletedAt(v time.Time) *BillingInvoiceValidationIssueUpdate { _u.mutation.SetDeletedAt(v) return _u}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdate) SetNillableDeletedAt(v *time.Time) *BillingInvoiceValidationIssueUpdate { if v != nil { _u.SetDeletedAt(*v) } return _u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (_u *BillingInvoiceValidationIssueUpdate) ClearDeletedAt() *BillingInvoiceValidationIssueUpdate { _u.mutation.ClearDeletedAt() return _u}
// SetInvoiceID sets the "invoice_id" field.func (_u *BillingInvoiceValidationIssueUpdate) SetInvoiceID(v string) *BillingInvoiceValidationIssueUpdate { _u.mutation.SetInvoiceID(v) return _u}
// SetNillableInvoiceID sets the "invoice_id" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdate) SetNillableInvoiceID(v *string) *BillingInvoiceValidationIssueUpdate { if v != nil { _u.SetInvoiceID(*v) } return _u}
// SetSeverity sets the "severity" field.func (_u *BillingInvoiceValidationIssueUpdate) SetSeverity(v billing.ValidationIssueSeverity) *BillingInvoiceValidationIssueUpdate { _u.mutation.SetSeverity(v) return _u}
// SetNillableSeverity sets the "severity" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdate) SetNillableSeverity(v *billing.ValidationIssueSeverity) *BillingInvoiceValidationIssueUpdate { if v != nil { _u.SetSeverity(*v) } return _u}
// SetCode sets the "code" field.func (_u *BillingInvoiceValidationIssueUpdate) SetCode(v string) *BillingInvoiceValidationIssueUpdate { _u.mutation.SetCode(v) return _u}
// SetNillableCode sets the "code" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdate) SetNillableCode(v *string) *BillingInvoiceValidationIssueUpdate { if v != nil { _u.SetCode(*v) } return _u}
// ClearCode clears the value of the "code" field.func (_u *BillingInvoiceValidationIssueUpdate) ClearCode() *BillingInvoiceValidationIssueUpdate { _u.mutation.ClearCode() return _u}
// SetMessage sets the "message" field.func (_u *BillingInvoiceValidationIssueUpdate) SetMessage(v string) *BillingInvoiceValidationIssueUpdate { _u.mutation.SetMessage(v) return _u}
// SetNillableMessage sets the "message" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdate) SetNillableMessage(v *string) *BillingInvoiceValidationIssueUpdate { if v != nil { _u.SetMessage(*v) } return _u}
// SetPath sets the "path" field.func (_u *BillingInvoiceValidationIssueUpdate) SetPath(v string) *BillingInvoiceValidationIssueUpdate { _u.mutation.SetPath(v) return _u}
// SetNillablePath sets the "path" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdate) SetNillablePath(v *string) *BillingInvoiceValidationIssueUpdate { if v != nil { _u.SetPath(*v) } return _u}
// ClearPath clears the value of the "path" field.func (_u *BillingInvoiceValidationIssueUpdate) ClearPath() *BillingInvoiceValidationIssueUpdate { _u.mutation.ClearPath() return _u}
// SetComponent sets the "component" field.func (_u *BillingInvoiceValidationIssueUpdate) SetComponent(v string) *BillingInvoiceValidationIssueUpdate { _u.mutation.SetComponent(v) return _u}
// SetNillableComponent sets the "component" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdate) SetNillableComponent(v *string) *BillingInvoiceValidationIssueUpdate { if v != nil { _u.SetComponent(*v) } return _u}
// SetDedupeHash sets the "dedupe_hash" field.func (_u *BillingInvoiceValidationIssueUpdate) SetDedupeHash(v []byte) *BillingInvoiceValidationIssueUpdate { _u.mutation.SetDedupeHash(v) return _u}
// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID.func (_u *BillingInvoiceValidationIssueUpdate) SetBillingInvoiceID(id string) *BillingInvoiceValidationIssueUpdate { _u.mutation.SetBillingInvoiceID(id) return _u}
// SetBillingInvoice sets the "billing_invoice" edge to the BillingInvoice entity.func (_u *BillingInvoiceValidationIssueUpdate) SetBillingInvoice(v *BillingInvoice) *BillingInvoiceValidationIssueUpdate { return _u.SetBillingInvoiceID(v.ID)}
// Mutation returns the BillingInvoiceValidationIssueMutation object of the builder.func (_u *BillingInvoiceValidationIssueUpdate) Mutation() *BillingInvoiceValidationIssueMutation { return _u.mutation}
// ClearBillingInvoice clears the "billing_invoice" edge to the BillingInvoice entity.func (_u *BillingInvoiceValidationIssueUpdate) ClearBillingInvoice() *BillingInvoiceValidationIssueUpdate { _u.mutation.ClearBillingInvoice() return _u}
// Save executes the query and returns the number of nodes affected by the update operation.func (_u *BillingInvoiceValidationIssueUpdate) Save(ctx context.Context) (int, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceValidationIssueUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected}
// Exec executes the query.func (_u *BillingInvoiceValidationIssueUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceValidationIssueUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_u *BillingInvoiceValidationIssueUpdate) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := billinginvoicevalidationissue.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) }}
// check runs all checks and user-defined validators on the builder.func (_u *BillingInvoiceValidationIssueUpdate) check() error { if v, ok := _u.mutation.InvoiceID(); ok { if err := billinginvoicevalidationissue.InvoiceIDValidator(v); err != nil { return &ValidationError{Name: "invoice_id", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.invoice_id": %w`, err)} } } if v, ok := _u.mutation.Severity(); ok { if err := billinginvoicevalidationissue.SeverityValidator(v); err != nil { return &ValidationError{Name: "severity", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.severity": %w`, err)} } } if v, ok := _u.mutation.Message(); ok { if err := billinginvoicevalidationissue.MessageValidator(v); err != nil { return &ValidationError{Name: "message", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.message": %w`, err)} } } if v, ok := _u.mutation.DedupeHash(); ok { if err := billinginvoicevalidationissue.DedupeHashValidator(v); err != nil { return &ValidationError{Name: "dedupe_hash", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.dedupe_hash": %w`, err)} } } if _u.mutation.BillingInvoiceCleared() && len(_u.mutation.BillingInvoiceIDs()) > 0 { return errors.New(`db: clearing a required unique edge "BillingInvoiceValidationIssue.billing_invoice"`) } return nil}
func (_u *BillingInvoiceValidationIssueUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(billinginvoicevalidationissue.Table, billinginvoicevalidationissue.Columns, sqlgraph.NewFieldSpec(billinginvoicevalidationissue.FieldID, field.TypeString)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicevalidationissue.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicevalidationissue.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(billinginvoicevalidationissue.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.Severity(); ok { _spec.SetField(billinginvoicevalidationissue.FieldSeverity, field.TypeEnum, value) } if value, ok := _u.mutation.Code(); ok { _spec.SetField(billinginvoicevalidationissue.FieldCode, field.TypeString, value) } if _u.mutation.CodeCleared() { _spec.ClearField(billinginvoicevalidationissue.FieldCode, field.TypeString) } if value, ok := _u.mutation.Message(); ok { _spec.SetField(billinginvoicevalidationissue.FieldMessage, field.TypeString, value) } if value, ok := _u.mutation.Path(); ok { _spec.SetField(billinginvoicevalidationissue.FieldPath, field.TypeString, value) } if _u.mutation.PathCleared() { _spec.ClearField(billinginvoicevalidationissue.FieldPath, field.TypeString) } if value, ok := _u.mutation.Component(); ok { _spec.SetField(billinginvoicevalidationissue.FieldComponent, field.TypeString, value) } if value, ok := _u.mutation.DedupeHash(); ok { _spec.SetField(billinginvoicevalidationissue.FieldDedupeHash, field.TypeBytes, value) } if _u.mutation.BillingInvoiceCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicevalidationissue.BillingInvoiceTable, Columns: []string{billinginvoicevalidationissue.BillingInvoiceColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.BillingInvoiceIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicevalidationissue.BillingInvoiceTable, Columns: []string{billinginvoicevalidationissue.BillingInvoiceColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoicevalidationissue.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil}
// BillingInvoiceValidationIssueUpdateOne is the builder for updating a single BillingInvoiceValidationIssue entity.type BillingInvoiceValidationIssueUpdateOne struct { config fields []string hooks []Hook mutation *BillingInvoiceValidationIssueMutation}
// SetUpdatedAt sets the "updated_at" field.func (_u *BillingInvoiceValidationIssueUpdateOne) SetUpdatedAt(v time.Time) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.SetUpdatedAt(v) return _u}
// SetDeletedAt sets the "deleted_at" field.func (_u *BillingInvoiceValidationIssueUpdateOne) SetDeletedAt(v time.Time) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.SetDeletedAt(v) return _u}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdateOne) SetNillableDeletedAt(v *time.Time) *BillingInvoiceValidationIssueUpdateOne { if v != nil { _u.SetDeletedAt(*v) } return _u}
// ClearDeletedAt clears the value of the "deleted_at" field.func (_u *BillingInvoiceValidationIssueUpdateOne) ClearDeletedAt() *BillingInvoiceValidationIssueUpdateOne { _u.mutation.ClearDeletedAt() return _u}
// SetInvoiceID sets the "invoice_id" field.func (_u *BillingInvoiceValidationIssueUpdateOne) SetInvoiceID(v string) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.SetInvoiceID(v) return _u}
// SetNillableInvoiceID sets the "invoice_id" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdateOne) SetNillableInvoiceID(v *string) *BillingInvoiceValidationIssueUpdateOne { if v != nil { _u.SetInvoiceID(*v) } return _u}
// SetSeverity sets the "severity" field.func (_u *BillingInvoiceValidationIssueUpdateOne) SetSeverity(v billing.ValidationIssueSeverity) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.SetSeverity(v) return _u}
// SetNillableSeverity sets the "severity" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdateOne) SetNillableSeverity(v *billing.ValidationIssueSeverity) *BillingInvoiceValidationIssueUpdateOne { if v != nil { _u.SetSeverity(*v) } return _u}
// SetCode sets the "code" field.func (_u *BillingInvoiceValidationIssueUpdateOne) SetCode(v string) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.SetCode(v) return _u}
// SetNillableCode sets the "code" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdateOne) SetNillableCode(v *string) *BillingInvoiceValidationIssueUpdateOne { if v != nil { _u.SetCode(*v) } return _u}
// ClearCode clears the value of the "code" field.func (_u *BillingInvoiceValidationIssueUpdateOne) ClearCode() *BillingInvoiceValidationIssueUpdateOne { _u.mutation.ClearCode() return _u}
// SetMessage sets the "message" field.func (_u *BillingInvoiceValidationIssueUpdateOne) SetMessage(v string) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.SetMessage(v) return _u}
// SetNillableMessage sets the "message" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdateOne) SetNillableMessage(v *string) *BillingInvoiceValidationIssueUpdateOne { if v != nil { _u.SetMessage(*v) } return _u}
// SetPath sets the "path" field.func (_u *BillingInvoiceValidationIssueUpdateOne) SetPath(v string) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.SetPath(v) return _u}
// SetNillablePath sets the "path" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdateOne) SetNillablePath(v *string) *BillingInvoiceValidationIssueUpdateOne { if v != nil { _u.SetPath(*v) } return _u}
// ClearPath clears the value of the "path" field.func (_u *BillingInvoiceValidationIssueUpdateOne) ClearPath() *BillingInvoiceValidationIssueUpdateOne { _u.mutation.ClearPath() return _u}
// SetComponent sets the "component" field.func (_u *BillingInvoiceValidationIssueUpdateOne) SetComponent(v string) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.SetComponent(v) return _u}
// SetNillableComponent sets the "component" field if the given value is not nil.func (_u *BillingInvoiceValidationIssueUpdateOne) SetNillableComponent(v *string) *BillingInvoiceValidationIssueUpdateOne { if v != nil { _u.SetComponent(*v) } return _u}
// SetDedupeHash sets the "dedupe_hash" field.func (_u *BillingInvoiceValidationIssueUpdateOne) SetDedupeHash(v []byte) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.SetDedupeHash(v) return _u}
// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID.func (_u *BillingInvoiceValidationIssueUpdateOne) SetBillingInvoiceID(id string) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.SetBillingInvoiceID(id) return _u}
// SetBillingInvoice sets the "billing_invoice" edge to the BillingInvoice entity.func (_u *BillingInvoiceValidationIssueUpdateOne) SetBillingInvoice(v *BillingInvoice) *BillingInvoiceValidationIssueUpdateOne { return _u.SetBillingInvoiceID(v.ID)}
// Mutation returns the BillingInvoiceValidationIssueMutation object of the builder.func (_u *BillingInvoiceValidationIssueUpdateOne) Mutation() *BillingInvoiceValidationIssueMutation { return _u.mutation}
// ClearBillingInvoice clears the "billing_invoice" edge to the BillingInvoice entity.func (_u *BillingInvoiceValidationIssueUpdateOne) ClearBillingInvoice() *BillingInvoiceValidationIssueUpdateOne { _u.mutation.ClearBillingInvoice() return _u}
// Where appends a list predicates to the BillingInvoiceValidationIssueUpdate builder.func (_u *BillingInvoiceValidationIssueUpdateOne) Where(ps ...predicate.BillingInvoiceValidationIssue) *BillingInvoiceValidationIssueUpdateOne { _u.mutation.Where(ps...) return _u}
// Select allows selecting one or more fields (columns) of the returned entity.// The default is selecting all fields defined in the entity schema.func (_u *BillingInvoiceValidationIssueUpdateOne) Select(field string, fields ...string) *BillingInvoiceValidationIssueUpdateOne { _u.fields = append([]string{field}, fields...) return _u}
// Save executes the query and returns the updated BillingInvoiceValidationIssue entity.func (_u *BillingInvoiceValidationIssueUpdateOne) Save(ctx context.Context) (*BillingInvoiceValidationIssue, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceValidationIssueUpdateOne) SaveX(ctx context.Context) *BillingInvoiceValidationIssue { node, err := _u.Save(ctx) if err != nil { panic(err) } return node}
// Exec executes the query on the entity.func (_u *BillingInvoiceValidationIssueUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceValidationIssueUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
// defaults sets the default values of the builder before save.func (_u *BillingInvoiceValidationIssueUpdateOne) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := billinginvoicevalidationissue.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) }}
// check runs all checks and user-defined validators on the builder.func (_u *BillingInvoiceValidationIssueUpdateOne) check() error { if v, ok := _u.mutation.InvoiceID(); ok { if err := billinginvoicevalidationissue.InvoiceIDValidator(v); err != nil { return &ValidationError{Name: "invoice_id", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.invoice_id": %w`, err)} } } if v, ok := _u.mutation.Severity(); ok { if err := billinginvoicevalidationissue.SeverityValidator(v); err != nil { return &ValidationError{Name: "severity", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.severity": %w`, err)} } } if v, ok := _u.mutation.Message(); ok { if err := billinginvoicevalidationissue.MessageValidator(v); err != nil { return &ValidationError{Name: "message", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.message": %w`, err)} } } if v, ok := _u.mutation.DedupeHash(); ok { if err := billinginvoicevalidationissue.DedupeHashValidator(v); err != nil { return &ValidationError{Name: "dedupe_hash", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceValidationIssue.dedupe_hash": %w`, err)} } } if _u.mutation.BillingInvoiceCleared() && len(_u.mutation.BillingInvoiceIDs()) > 0 { return errors.New(`db: clearing a required unique edge "BillingInvoiceValidationIssue.billing_invoice"`) } return nil}
func (_u *BillingInvoiceValidationIssueUpdateOne) sqlSave(ctx context.Context) (_node *BillingInvoiceValidationIssue, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(billinginvoicevalidationissue.Table, billinginvoicevalidationissue.Columns, sqlgraph.NewFieldSpec(billinginvoicevalidationissue.FieldID, field.TypeString)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "BillingInvoiceValidationIssue.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicevalidationissue.FieldID) for _, f := range fields { if !billinginvoicevalidationissue.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } if f != billinginvoicevalidationissue.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoicevalidationissue.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(billinginvoicevalidationissue.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(billinginvoicevalidationissue.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.Severity(); ok { _spec.SetField(billinginvoicevalidationissue.FieldSeverity, field.TypeEnum, value) } if value, ok := _u.mutation.Code(); ok { _spec.SetField(billinginvoicevalidationissue.FieldCode, field.TypeString, value) } if _u.mutation.CodeCleared() { _spec.ClearField(billinginvoicevalidationissue.FieldCode, field.TypeString) } if value, ok := _u.mutation.Message(); ok { _spec.SetField(billinginvoicevalidationissue.FieldMessage, field.TypeString, value) } if value, ok := _u.mutation.Path(); ok { _spec.SetField(billinginvoicevalidationissue.FieldPath, field.TypeString, value) } if _u.mutation.PathCleared() { _spec.ClearField(billinginvoicevalidationissue.FieldPath, field.TypeString) } if value, ok := _u.mutation.Component(); ok { _spec.SetField(billinginvoicevalidationissue.FieldComponent, field.TypeString, value) } if value, ok := _u.mutation.DedupeHash(); ok { _spec.SetField(billinginvoicevalidationissue.FieldDedupeHash, field.TypeBytes, value) } if _u.mutation.BillingInvoiceCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicevalidationissue.BillingInvoiceTable, Columns: []string{billinginvoicevalidationissue.BillingInvoiceColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.BillingInvoiceIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: billinginvoicevalidationissue.BillingInvoiceTable, Columns: []string{billinginvoicevalidationissue.BillingInvoiceColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &BillingInvoiceValidationIssue{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoicevalidationissue.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103// Code generated by ent, DO NOT EDIT.
package db
import ( "fmt" "strings"
"entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicewriteschemalevel")
// BillingInvoiceWriteSchemaLevel is the model entity for the BillingInvoiceWriteSchemaLevel schema.type BillingInvoiceWriteSchemaLevel struct { config `json:"-"` // ID of the ent. ID string `json:"id,omitempty"` // SchemaLevel holds the value of the "schema_level" field. SchemaLevel int `json:"schema_level,omitempty"` selectValues sql.SelectValues}
// scanValues returns the types for scanning values from sql.Rows.func (*BillingInvoiceWriteSchemaLevel) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case billinginvoicewriteschemalevel.FieldSchemaLevel: values[i] = new(sql.NullInt64) case billinginvoicewriteschemalevel.FieldID: values[i] = new(sql.NullString) default: values[i] = new(sql.UnknownType) } } return values, nil}
// assignValues assigns the values that were returned from sql.Rows (after scanning)// to the BillingInvoiceWriteSchemaLevel fields.func (_m *BillingInvoiceWriteSchemaLevel) 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) } for i := range columns { switch columns[i] { case billinginvoicewriteschemalevel.FieldID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value.Valid { _m.ID = value.String } case billinginvoicewriteschemalevel.FieldSchemaLevel: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field schema_level", values[i]) } else if value.Valid { _m.SchemaLevel = int(value.Int64) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil}
// Value returns the ent.Value that was dynamically selected and assigned to the BillingInvoiceWriteSchemaLevel.// This includes values selected through modifiers, order, etc.func (_m *BillingInvoiceWriteSchemaLevel) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name)}
// Update returns a builder for updating this BillingInvoiceWriteSchemaLevel.// Note that you need to call BillingInvoiceWriteSchemaLevel.Unwrap() before calling this method if this BillingInvoiceWriteSchemaLevel// was returned from a transaction, and the transaction was committed or rolled back.func (_m *BillingInvoiceWriteSchemaLevel) Update() *BillingInvoiceWriteSchemaLevelUpdateOne { return NewBillingInvoiceWriteSchemaLevelClient(_m.config).UpdateOne(_m)}
// Unwrap unwraps the BillingInvoiceWriteSchemaLevel 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 (_m *BillingInvoiceWriteSchemaLevel) Unwrap() *BillingInvoiceWriteSchemaLevel { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("db: BillingInvoiceWriteSchemaLevel is not a transactional entity") } _m.config.driver = _tx.drv return _m}
// String implements the fmt.Stringer.func (_m *BillingInvoiceWriteSchemaLevel) String() string { var builder strings.Builder builder.WriteString("BillingInvoiceWriteSchemaLevel(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("schema_level=") builder.WriteString(fmt.Sprintf("%v", _m.SchemaLevel)) builder.WriteByte(')') return builder.String()}
// BillingInvoiceWriteSchemaLevels is a parsable slice of BillingInvoiceWriteSchemaLevel.type BillingInvoiceWriteSchemaLevels []*BillingInvoiceWriteSchemaLevel12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152// Code generated by ent, DO NOT EDIT.
package billinginvoicewriteschemalevel
import ( "entgo.io/ent/dialect/sql")
const ( // Label holds the string label denoting the billinginvoicewriteschemalevel type in the database. Label = "billing_invoice_write_schema_level" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldSchemaLevel holds the string denoting the schema_level field in the database. FieldSchemaLevel = "schema_level" // Table holds the table name of the billinginvoicewriteschemalevel in the database. Table = "billing_invoice_write_schema_levels")
// Columns holds all SQL columns for billinginvoicewriteschemalevel fields.var Columns = []string{ FieldID, FieldSchemaLevel,}
// ValidColumn reports if the column name is valid (part of the table columns).func ValidColumn(column string) bool { for i := range Columns { if column == Columns[i] { return true } } return false}
var ( // IDValidator is a validator for the "id" field. It is called by the builders before save. IDValidator func(string) error)
// OrderOption defines the ordering options for the BillingInvoiceWriteSchemaLevel queries.type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc()}
// BySchemaLevel orders the results by the schema_level field.func BySchemaLevel(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSchemaLevel, opts...).ToFunc()}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123// Code generated by ent, DO NOT EDIT.
package billinginvoicewriteschemalevel
import ( "entgo.io/ent/dialect/sql" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// ID filters vertices based on their ID field.func ID(id string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldEQ(FieldID, id))}
// IDEQ applies the EQ predicate on the ID field.func IDEQ(id string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldEQ(FieldID, id))}
// IDNEQ applies the NEQ predicate on the ID field.func IDNEQ(id string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldNEQ(FieldID, id))}
// IDIn applies the In predicate on the ID field.func IDIn(ids ...string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldIn(FieldID, ids...))}
// IDNotIn applies the NotIn predicate on the ID field.func IDNotIn(ids ...string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldNotIn(FieldID, ids...))}
// IDGT applies the GT predicate on the ID field.func IDGT(id string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldGT(FieldID, id))}
// IDGTE applies the GTE predicate on the ID field.func IDGTE(id string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldGTE(FieldID, id))}
// IDLT applies the LT predicate on the ID field.func IDLT(id string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldLT(FieldID, id))}
// IDLTE applies the LTE predicate on the ID field.func IDLTE(id string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldLTE(FieldID, id))}
// IDEqualFold applies the EqualFold predicate on the ID field.func IDEqualFold(id string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldEqualFold(FieldID, id))}
// IDContainsFold applies the ContainsFold predicate on the ID field.func IDContainsFold(id string) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldContainsFold(FieldID, id))}
// SchemaLevel applies equality check predicate on the "schema_level" field. It's identical to SchemaLevelEQ.func SchemaLevel(v int) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldEQ(FieldSchemaLevel, v))}
// SchemaLevelEQ applies the EQ predicate on the "schema_level" field.func SchemaLevelEQ(v int) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldEQ(FieldSchemaLevel, v))}
// SchemaLevelNEQ applies the NEQ predicate on the "schema_level" field.func SchemaLevelNEQ(v int) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldNEQ(FieldSchemaLevel, v))}
// SchemaLevelIn applies the In predicate on the "schema_level" field.func SchemaLevelIn(vs ...int) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldIn(FieldSchemaLevel, vs...))}
// SchemaLevelNotIn applies the NotIn predicate on the "schema_level" field.func SchemaLevelNotIn(vs ...int) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldNotIn(FieldSchemaLevel, vs...))}
// SchemaLevelGT applies the GT predicate on the "schema_level" field.func SchemaLevelGT(v int) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldGT(FieldSchemaLevel, v))}
// SchemaLevelGTE applies the GTE predicate on the "schema_level" field.func SchemaLevelGTE(v int) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldGTE(FieldSchemaLevel, v))}
// SchemaLevelLT applies the LT predicate on the "schema_level" field.func SchemaLevelLT(v int) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldLT(FieldSchemaLevel, v))}
// SchemaLevelLTE applies the LTE predicate on the "schema_level" field.func SchemaLevelLTE(v int) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.FieldLTE(FieldSchemaLevel, v))}
// And groups predicates with the AND operator between them.func And(predicates ...predicate.BillingInvoiceWriteSchemaLevel) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.AndPredicates(predicates...))}
// Or groups predicates with the OR operator between them.func Or(predicates ...predicate.BillingInvoiceWriteSchemaLevel) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.OrPredicates(predicates...))}
// Not applies the not operator on the given predicate.func Not(p predicate.BillingInvoiceWriteSchemaLevel) predicate.BillingInvoiceWriteSchemaLevel { return predicate.BillingInvoiceWriteSchemaLevel(sql.NotPredicates(p))}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt"
"entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicewriteschemalevel")
// BillingInvoiceWriteSchemaLevelCreate is the builder for creating a BillingInvoiceWriteSchemaLevel entity.type BillingInvoiceWriteSchemaLevelCreate struct { config mutation *BillingInvoiceWriteSchemaLevelMutation hooks []Hook conflict []sql.ConflictOption}
// SetSchemaLevel sets the "schema_level" field.func (_c *BillingInvoiceWriteSchemaLevelCreate) SetSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelCreate { _c.mutation.SetSchemaLevel(v) return _c}
// SetID sets the "id" field.func (_c *BillingInvoiceWriteSchemaLevelCreate) SetID(v string) *BillingInvoiceWriteSchemaLevelCreate { _c.mutation.SetID(v) return _c}
// Mutation returns the BillingInvoiceWriteSchemaLevelMutation object of the builder.func (_c *BillingInvoiceWriteSchemaLevelCreate) Mutation() *BillingInvoiceWriteSchemaLevelMutation { return _c.mutation}
// Save creates the BillingInvoiceWriteSchemaLevel in the database.func (_c *BillingInvoiceWriteSchemaLevelCreate) Save(ctx context.Context) (*BillingInvoiceWriteSchemaLevel, error) { return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)}
// SaveX calls Save and panics if Save returns an error.func (_c *BillingInvoiceWriteSchemaLevelCreate) SaveX(ctx context.Context) *BillingInvoiceWriteSchemaLevel { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceWriteSchemaLevelCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceWriteSchemaLevelCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// check runs all checks and user-defined validators on the builder.func (_c *BillingInvoiceWriteSchemaLevelCreate) check() error { if _, ok := _c.mutation.SchemaLevel(); !ok { return &ValidationError{Name: "schema_level", err: errors.New(`db: missing required field "BillingInvoiceWriteSchemaLevel.schema_level"`)} } if v, ok := _c.mutation.ID(); ok { if err := billinginvoicewriteschemalevel.IDValidator(v); err != nil { return &ValidationError{Name: "id", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceWriteSchemaLevel.id": %w`, err)} } } return nil}
func (_c *BillingInvoiceWriteSchemaLevelCreate) sqlSave(ctx context.Context) (*BillingInvoiceWriteSchemaLevel, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(string); ok { _node.ID = id } else { return nil, fmt.Errorf("unexpected BillingInvoiceWriteSchemaLevel.ID type: %T", _spec.ID.Value) } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil}
func (_c *BillingInvoiceWriteSchemaLevelCreate) createSpec() (*BillingInvoiceWriteSchemaLevel, *sqlgraph.CreateSpec) { var ( _node = &BillingInvoiceWriteSchemaLevel{config: _c.config} _spec = sqlgraph.NewCreateSpec(billinginvoicewriteschemalevel.Table, sqlgraph.NewFieldSpec(billinginvoicewriteschemalevel.FieldID, field.TypeString)) ) _spec.OnConflict = _c.conflict if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = id } if value, ok := _c.mutation.SchemaLevel(); ok { _spec.SetField(billinginvoicewriteschemalevel.FieldSchemaLevel, field.TypeInt, value) _node.SchemaLevel = value } return _node, _spec}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceWriteSchemaLevel.Create().// SetSchemaLevel(v).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceWriteSchemaLevelUpsert) {// SetSchemaLevel(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceWriteSchemaLevelCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceWriteSchemaLevelUpsertOne { _c.conflict = opts return &BillingInvoiceWriteSchemaLevelUpsertOne{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceWriteSchemaLevel.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceWriteSchemaLevelCreate) OnConflictColumns(columns ...string) *BillingInvoiceWriteSchemaLevelUpsertOne { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceWriteSchemaLevelUpsertOne{ create: _c, }}
type ( // BillingInvoiceWriteSchemaLevelUpsertOne is the builder for "upsert"-ing // one BillingInvoiceWriteSchemaLevel node. BillingInvoiceWriteSchemaLevelUpsertOne struct { create *BillingInvoiceWriteSchemaLevelCreate }
// BillingInvoiceWriteSchemaLevelUpsert is the "OnConflict" setter. BillingInvoiceWriteSchemaLevelUpsert struct { *sql.UpdateSet })
// SetSchemaLevel sets the "schema_level" field.func (u *BillingInvoiceWriteSchemaLevelUpsert) SetSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelUpsert { u.Set(billinginvoicewriteschemalevel.FieldSchemaLevel, v) return u}
// UpdateSchemaLevel sets the "schema_level" field to the value that was provided on create.func (u *BillingInvoiceWriteSchemaLevelUpsert) UpdateSchemaLevel() *BillingInvoiceWriteSchemaLevelUpsert { u.SetExcluded(billinginvoicewriteschemalevel.FieldSchemaLevel) return u}
// AddSchemaLevel adds v to the "schema_level" field.func (u *BillingInvoiceWriteSchemaLevelUpsert) AddSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelUpsert { u.Add(billinginvoicewriteschemalevel.FieldSchemaLevel, v) return u}
// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.// Using this option is equivalent to using://// client.BillingInvoiceWriteSchemaLevel.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoicewriteschemalevel.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceWriteSchemaLevelUpsertOne) UpdateNewValues() *BillingInvoiceWriteSchemaLevelUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { if _, exists := u.create.mutation.ID(); exists { s.SetIgnore(billinginvoicewriteschemalevel.FieldID) } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceWriteSchemaLevel.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceWriteSchemaLevelUpsertOne) Ignore() *BillingInvoiceWriteSchemaLevelUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceWriteSchemaLevelUpsertOne) DoNothing() *BillingInvoiceWriteSchemaLevelUpsertOne { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceWriteSchemaLevelCreate.OnConflict// documentation for more info.func (u *BillingInvoiceWriteSchemaLevelUpsertOne) Update(set func(*BillingInvoiceWriteSchemaLevelUpsert)) *BillingInvoiceWriteSchemaLevelUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceWriteSchemaLevelUpsert{UpdateSet: update}) })) return u}
// SetSchemaLevel sets the "schema_level" field.func (u *BillingInvoiceWriteSchemaLevelUpsertOne) SetSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelUpsertOne { return u.Update(func(s *BillingInvoiceWriteSchemaLevelUpsert) { s.SetSchemaLevel(v) })}
// AddSchemaLevel adds v to the "schema_level" field.func (u *BillingInvoiceWriteSchemaLevelUpsertOne) AddSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelUpsertOne { return u.Update(func(s *BillingInvoiceWriteSchemaLevelUpsert) { s.AddSchemaLevel(v) })}
// UpdateSchemaLevel sets the "schema_level" field to the value that was provided on create.func (u *BillingInvoiceWriteSchemaLevelUpsertOne) UpdateSchemaLevel() *BillingInvoiceWriteSchemaLevelUpsertOne { return u.Update(func(s *BillingInvoiceWriteSchemaLevelUpsert) { s.UpdateSchemaLevel() })}
// Exec executes the query.func (u *BillingInvoiceWriteSchemaLevelUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceWriteSchemaLevelCreate.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceWriteSchemaLevelUpsertOne) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}
// Exec executes the UPSERT query and returns the inserted/updated ID.func (u *BillingInvoiceWriteSchemaLevelUpsertOne) ID(ctx context.Context) (id string, err error) { if u.create.driver.Dialect() == dialect.MySQL { // In case of "ON CONFLICT", there is no way to get back non-numeric ID // fields from the database since MySQL does not support the RETURNING clause. return id, errors.New("db: BillingInvoiceWriteSchemaLevelUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceWriteSchemaLevelUpsertOne.Exec instead") } node, err := u.create.Save(ctx) if err != nil { return id, err } return node.ID, nil}
// IDX is like ID, but panics if an error occurs.func (u *BillingInvoiceWriteSchemaLevelUpsertOne) IDX(ctx context.Context) string { id, err := u.ID(ctx) if err != nil { panic(err) } return id}
// BillingInvoiceWriteSchemaLevelCreateBulk is the builder for creating many BillingInvoiceWriteSchemaLevel entities in bulk.type BillingInvoiceWriteSchemaLevelCreateBulk struct { config err error builders []*BillingInvoiceWriteSchemaLevelCreate conflict []sql.ConflictOption}
// Save creates the BillingInvoiceWriteSchemaLevel entities in the database.func (_c *BillingInvoiceWriteSchemaLevelCreateBulk) Save(ctx context.Context) ([]*BillingInvoiceWriteSchemaLevel, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*BillingInvoiceWriteSchemaLevel, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*BillingInvoiceWriteSchemaLevelMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } } } if err != nil { return nil, err } mutation.id = &nodes[i].ID mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { mut = builder.hooks[i](mut) } mutators[i] = mut }(i, ctx) } if len(mutators) > 0 { if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil}
// SaveX is like Save, but panics if an error occurs.func (_c *BillingInvoiceWriteSchemaLevelCreateBulk) SaveX(ctx context.Context) []*BillingInvoiceWriteSchemaLevel { v, err := _c.Save(ctx) if err != nil { panic(err) } return v}
// Exec executes the query.func (_c *BillingInvoiceWriteSchemaLevelCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_c *BillingInvoiceWriteSchemaLevelCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) }}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause// of the `INSERT` statement. For example://// client.BillingInvoiceWriteSchemaLevel.CreateBulk(builders...).// OnConflict(// // Update the row with the new values// // the was proposed for insertion.// sql.ResolveWithNewValues(),// ).// // Override some of the fields with custom// // update values.// Update(func(u *ent.BillingInvoiceWriteSchemaLevelUpsert) {// SetSchemaLevel(v+v).// }).// Exec(ctx)func (_c *BillingInvoiceWriteSchemaLevelCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceWriteSchemaLevelUpsertBulk { _c.conflict = opts return &BillingInvoiceWriteSchemaLevelUpsertBulk{ create: _c, }}
// OnConflictColumns calls `OnConflict` and configures the columns// as conflict target. Using this option is equivalent to using://// client.BillingInvoiceWriteSchemaLevel.Create().// OnConflict(sql.ConflictColumns(columns...)).// Exec(ctx)func (_c *BillingInvoiceWriteSchemaLevelCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceWriteSchemaLevelUpsertBulk { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BillingInvoiceWriteSchemaLevelUpsertBulk{ create: _c, }}
// BillingInvoiceWriteSchemaLevelUpsertBulk is the builder for "upsert"-ing// a bulk of BillingInvoiceWriteSchemaLevel nodes.type BillingInvoiceWriteSchemaLevelUpsertBulk struct { create *BillingInvoiceWriteSchemaLevelCreateBulk}
// UpdateNewValues updates the mutable fields using the new values that// were set on create. Using this option is equivalent to using://// client.BillingInvoiceWriteSchemaLevel.Create().// OnConflict(// sql.ResolveWithNewValues(),// sql.ResolveWith(func(u *sql.UpdateSet) {// u.SetIgnore(billinginvoicewriteschemalevel.FieldID)// }),// ).// Exec(ctx)func (u *BillingInvoiceWriteSchemaLevelUpsertBulk) UpdateNewValues() *BillingInvoiceWriteSchemaLevelUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { for _, b := range u.create.builders { if _, exists := b.mutation.ID(); exists { s.SetIgnore(billinginvoicewriteschemalevel.FieldID) } } })) return u}
// Ignore sets each column to itself in case of conflict.// Using this option is equivalent to using://// client.BillingInvoiceWriteSchemaLevel.Create().// OnConflict(sql.ResolveWithIgnore()).// Exec(ctx)func (u *BillingInvoiceWriteSchemaLevelUpsertBulk) Ignore() *BillingInvoiceWriteSchemaLevelUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u}
// DoNothing configures the conflict_action to `DO NOTHING`.// Supported only by SQLite and PostgreSQL.func (u *BillingInvoiceWriteSchemaLevelUpsertBulk) DoNothing() *BillingInvoiceWriteSchemaLevelUpsertBulk { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u}
// Update allows overriding fields `UPDATE` values. See the BillingInvoiceWriteSchemaLevelCreateBulk.OnConflict// documentation for more info.func (u *BillingInvoiceWriteSchemaLevelUpsertBulk) Update(set func(*BillingInvoiceWriteSchemaLevelUpsert)) *BillingInvoiceWriteSchemaLevelUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceWriteSchemaLevelUpsert{UpdateSet: update}) })) return u}
// SetSchemaLevel sets the "schema_level" field.func (u *BillingInvoiceWriteSchemaLevelUpsertBulk) SetSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelUpsertBulk { return u.Update(func(s *BillingInvoiceWriteSchemaLevelUpsert) { s.SetSchemaLevel(v) })}
// AddSchemaLevel adds v to the "schema_level" field.func (u *BillingInvoiceWriteSchemaLevelUpsertBulk) AddSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelUpsertBulk { return u.Update(func(s *BillingInvoiceWriteSchemaLevelUpsert) { s.AddSchemaLevel(v) })}
// UpdateSchemaLevel sets the "schema_level" field to the value that was provided on create.func (u *BillingInvoiceWriteSchemaLevelUpsertBulk) UpdateSchemaLevel() *BillingInvoiceWriteSchemaLevelUpsertBulk { return u.Update(func(s *BillingInvoiceWriteSchemaLevelUpsert) { s.UpdateSchemaLevel() })}
// Exec executes the query.func (u *BillingInvoiceWriteSchemaLevelUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { return u.create.err } for i, b := range u.create.builders { if len(b.conflict) != 0 { return fmt.Errorf("db: OnConflict was set for builder %d. Set it on the BillingInvoiceWriteSchemaLevelCreateBulk instead", i) } } if len(u.create.conflict) == 0 { return errors.New("db: missing options for BillingInvoiceWriteSchemaLevelCreateBulk.OnConflict") } return u.create.Exec(ctx)}
// ExecX is like Exec, but panics if an error occurs.func (u *BillingInvoiceWriteSchemaLevelUpsertBulk) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788// Code generated by ent, DO NOT EDIT.
package db
import ( "context"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicewriteschemalevel" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceWriteSchemaLevelDelete is the builder for deleting a BillingInvoiceWriteSchemaLevel entity.type BillingInvoiceWriteSchemaLevelDelete struct { config hooks []Hook mutation *BillingInvoiceWriteSchemaLevelMutation}
// Where appends a list predicates to the BillingInvoiceWriteSchemaLevelDelete builder.func (_d *BillingInvoiceWriteSchemaLevelDelete) Where(ps ...predicate.BillingInvoiceWriteSchemaLevel) *BillingInvoiceWriteSchemaLevelDelete { _d.mutation.Where(ps...) return _d}
// Exec executes the deletion query and returns how many vertices were deleted.func (_d *BillingInvoiceWriteSchemaLevelDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceWriteSchemaLevelDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n}
func (_d *BillingInvoiceWriteSchemaLevelDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(billinginvoicewriteschemalevel.Table, sqlgraph.NewFieldSpec(billinginvoicewriteschemalevel.FieldID, field.TypeString)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err}
// BillingInvoiceWriteSchemaLevelDeleteOne is the builder for deleting a single BillingInvoiceWriteSchemaLevel entity.type BillingInvoiceWriteSchemaLevelDeleteOne struct { _d *BillingInvoiceWriteSchemaLevelDelete}
// Where appends a list predicates to the BillingInvoiceWriteSchemaLevelDelete builder.func (_d *BillingInvoiceWriteSchemaLevelDeleteOne) Where(ps ...predicate.BillingInvoiceWriteSchemaLevel) *BillingInvoiceWriteSchemaLevelDeleteOne { _d._d.mutation.Where(ps...) return _d}
// Exec executes the deletion query.func (_d *BillingInvoiceWriteSchemaLevelDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{billinginvoicewriteschemalevel.Label} default: return nil }}
// ExecX is like Exec, but panics if an error occurs.func (_d *BillingInvoiceWriteSchemaLevelDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "fmt" "math"
"entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicewriteschemalevel" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceWriteSchemaLevelQuery is the builder for querying BillingInvoiceWriteSchemaLevel entities.type BillingInvoiceWriteSchemaLevelQuery struct { config ctx *QueryContext order []billinginvoicewriteschemalevel.OrderOption inters []Interceptor predicates []predicate.BillingInvoiceWriteSchemaLevel 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 BillingInvoiceWriteSchemaLevelQuery builder.func (_q *BillingInvoiceWriteSchemaLevelQuery) Where(ps ...predicate.BillingInvoiceWriteSchemaLevel) *BillingInvoiceWriteSchemaLevelQuery { _q.predicates = append(_q.predicates, ps...) return _q}
// Limit the number of records to be returned by this query.func (_q *BillingInvoiceWriteSchemaLevelQuery) Limit(limit int) *BillingInvoiceWriteSchemaLevelQuery { _q.ctx.Limit = &limit return _q}
// Offset to start from.func (_q *BillingInvoiceWriteSchemaLevelQuery) Offset(offset int) *BillingInvoiceWriteSchemaLevelQuery { _q.ctx.Offset = &offset return _q}
// 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 (_q *BillingInvoiceWriteSchemaLevelQuery) Unique(unique bool) *BillingInvoiceWriteSchemaLevelQuery { _q.ctx.Unique = &unique return _q}
// Order specifies how the records should be ordered.func (_q *BillingInvoiceWriteSchemaLevelQuery) Order(o ...billinginvoicewriteschemalevel.OrderOption) *BillingInvoiceWriteSchemaLevelQuery { _q.order = append(_q.order, o...) return _q}
// First returns the first BillingInvoiceWriteSchemaLevel entity from the query.// Returns a *NotFoundError when no BillingInvoiceWriteSchemaLevel was found.func (_q *BillingInvoiceWriteSchemaLevelQuery) First(ctx context.Context) (*BillingInvoiceWriteSchemaLevel, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{billinginvoicewriteschemalevel.Label} } return nodes[0], nil}
// FirstX is like First, but panics if an error occurs.func (_q *BillingInvoiceWriteSchemaLevelQuery) FirstX(ctx context.Context) *BillingInvoiceWriteSchemaLevel { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node}
// FirstID returns the first BillingInvoiceWriteSchemaLevel ID from the query.// Returns a *NotFoundError when no BillingInvoiceWriteSchemaLevel ID was found.func (_q *BillingInvoiceWriteSchemaLevelQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{billinginvoicewriteschemalevel.Label} return } return ids[0], nil}
// FirstIDX is like FirstID, but panics if an error occurs.func (_q *BillingInvoiceWriteSchemaLevelQuery) FirstIDX(ctx context.Context) string { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id}
// Only returns a single BillingInvoiceWriteSchemaLevel entity found by the query, ensuring it only returns one.// Returns a *NotSingularError when more than one BillingInvoiceWriteSchemaLevel entity is found.// Returns a *NotFoundError when no BillingInvoiceWriteSchemaLevel entities are found.func (_q *BillingInvoiceWriteSchemaLevelQuery) Only(ctx context.Context) (*BillingInvoiceWriteSchemaLevel, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{billinginvoicewriteschemalevel.Label} default: return nil, &NotSingularError{billinginvoicewriteschemalevel.Label} }}
// OnlyX is like Only, but panics if an error occurs.func (_q *BillingInvoiceWriteSchemaLevelQuery) OnlyX(ctx context.Context) *BillingInvoiceWriteSchemaLevel { node, err := _q.Only(ctx) if err != nil { panic(err) } return node}
// OnlyID is like Only, but returns the only BillingInvoiceWriteSchemaLevel ID in the query.// Returns a *NotSingularError when more than one BillingInvoiceWriteSchemaLevel ID is found.// Returns a *NotFoundError when no entities are found.func (_q *BillingInvoiceWriteSchemaLevelQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{billinginvoicewriteschemalevel.Label} default: err = &NotSingularError{billinginvoicewriteschemalevel.Label} } return}
// OnlyIDX is like OnlyID, but panics if an error occurs.func (_q *BillingInvoiceWriteSchemaLevelQuery) OnlyIDX(ctx context.Context) string { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id}
// All executes the query and returns a list of BillingInvoiceWriteSchemaLevels.func (_q *BillingInvoiceWriteSchemaLevelQuery) All(ctx context.Context) ([]*BillingInvoiceWriteSchemaLevel, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*BillingInvoiceWriteSchemaLevel, *BillingInvoiceWriteSchemaLevelQuery]() return withInterceptors[[]*BillingInvoiceWriteSchemaLevel](ctx, _q, qr, _q.inters)}
// AllX is like All, but panics if an error occurs.func (_q *BillingInvoiceWriteSchemaLevelQuery) AllX(ctx context.Context) []*BillingInvoiceWriteSchemaLevel { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes}
// IDs executes the query and returns a list of BillingInvoiceWriteSchemaLevel IDs.func (_q *BillingInvoiceWriteSchemaLevelQuery) IDs(ctx context.Context) (ids []string, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(billinginvoicewriteschemalevel.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil}
// IDsX is like IDs, but panics if an error occurs.func (_q *BillingInvoiceWriteSchemaLevelQuery) IDsX(ctx context.Context) []string { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids}
// Count returns the count of the given query.func (_q *BillingInvoiceWriteSchemaLevelQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*BillingInvoiceWriteSchemaLevelQuery](), _q.inters)}
// CountX is like Count, but panics if an error occurs.func (_q *BillingInvoiceWriteSchemaLevelQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count}
// Exist returns true if the query has elements in the graph.func (_q *BillingInvoiceWriteSchemaLevelQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("db: check existence: %w", err) default: return true, nil }}
// ExistX is like Exist, but panics if an error occurs.func (_q *BillingInvoiceWriteSchemaLevelQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist}
// Clone returns a duplicate of the BillingInvoiceWriteSchemaLevelQuery builder, including all associated steps. It can be// used to prepare common query builders and use them differently after the clone is made.func (_q *BillingInvoiceWriteSchemaLevelQuery) Clone() *BillingInvoiceWriteSchemaLevelQuery { if _q == nil { return nil } return &BillingInvoiceWriteSchemaLevelQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]billinginvoicewriteschemalevel.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.BillingInvoiceWriteSchemaLevel{}, _q.predicates...), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, }}
// GroupBy is used to group vertices by one or more fields/columns.// It is often used with aggregate functions, like: count, max, mean, min, sum.//// Example://// var v []struct {// SchemaLevel int `json:"schema_level,omitempty"`// Count int `json:"count,omitempty"`// }//// client.BillingInvoiceWriteSchemaLevel.Query().// GroupBy(billinginvoicewriteschemalevel.FieldSchemaLevel).// Aggregate(db.Count()).// Scan(ctx, &v)func (_q *BillingInvoiceWriteSchemaLevelQuery) GroupBy(field string, fields ...string) *BillingInvoiceWriteSchemaLevelGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &BillingInvoiceWriteSchemaLevelGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = billinginvoicewriteschemalevel.Label grbuild.scan = grbuild.Scan return grbuild}
// Select allows the selection one or more fields/columns for the given query,// instead of selecting all fields in the entity.//// Example://// var v []struct {// SchemaLevel int `json:"schema_level,omitempty"`// }//// client.BillingInvoiceWriteSchemaLevel.Query().// Select(billinginvoicewriteschemalevel.FieldSchemaLevel).// Scan(ctx, &v)func (_q *BillingInvoiceWriteSchemaLevelQuery) Select(fields ...string) *BillingInvoiceWriteSchemaLevelSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &BillingInvoiceWriteSchemaLevelSelect{BillingInvoiceWriteSchemaLevelQuery: _q} sbuild.label = billinginvoicewriteschemalevel.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild}
// Aggregate returns a BillingInvoiceWriteSchemaLevelSelect configured with the given aggregations.func (_q *BillingInvoiceWriteSchemaLevelQuery) Aggregate(fns ...AggregateFunc) *BillingInvoiceWriteSchemaLevelSelect { return _q.Select().Aggregate(fns...)}
func (_q *BillingInvoiceWriteSchemaLevelQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("db: uninitialized interceptor (forgotten import db/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !billinginvoicewriteschemalevel.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil}
func (_q *BillingInvoiceWriteSchemaLevelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BillingInvoiceWriteSchemaLevel, error) { var ( nodes = []*BillingInvoiceWriteSchemaLevel{} _spec = _q.querySpec() ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*BillingInvoiceWriteSchemaLevel).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &BillingInvoiceWriteSchemaLevel{config: _q.config} nodes = append(nodes, node) return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } return nodes, nil}
func (_q *BillingInvoiceWriteSchemaLevelQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec)}
func (_q *BillingInvoiceWriteSchemaLevelQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(billinginvoicewriteschemalevel.Table, billinginvoicewriteschemalevel.Columns, sqlgraph.NewFieldSpec(billinginvoicewriteschemalevel.FieldID, field.TypeString)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicewriteschemalevel.FieldID) for i := range fields { if fields[i] != billinginvoicewriteschemalevel.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec}
func (_q *BillingInvoiceWriteSchemaLevelQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(billinginvoicewriteschemalevel.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = billinginvoicewriteschemalevel.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, m := range _q.modifiers { m(selector) } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector}
// ForUpdate locks the selected rows against concurrent updates, and prevent them from being// updated, deleted or "selected ... for update" by other sessions, until the transaction is// either committed or rolled-back.func (_q *BillingInvoiceWriteSchemaLevelQuery) ForUpdate(opts ...sql.LockOption) *BillingInvoiceWriteSchemaLevelQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForUpdate(opts...) }) return _q}
// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock// on any rows that are read. Other sessions can read the rows, but cannot modify them// until your transaction commits.func (_q *BillingInvoiceWriteSchemaLevelQuery) ForShare(opts ...sql.LockOption) *BillingInvoiceWriteSchemaLevelQuery { if _q.driver.Dialect() == dialect.Postgres { _q.Unique(false) } _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { s.ForShare(opts...) }) return _q}
// BillingInvoiceWriteSchemaLevelGroupBy is the group-by builder for BillingInvoiceWriteSchemaLevel entities.type BillingInvoiceWriteSchemaLevelGroupBy struct { selector build *BillingInvoiceWriteSchemaLevelQuery}
// Aggregate adds the given aggregation functions to the group-by query.func (_g *BillingInvoiceWriteSchemaLevelGroupBy) Aggregate(fns ...AggregateFunc) *BillingInvoiceWriteSchemaLevelGroupBy { _g.fns = append(_g.fns, fns...) return _g}
// Scan applies the selector query and scans the result into the given value.func (_g *BillingInvoiceWriteSchemaLevelGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceWriteSchemaLevelQuery, *BillingInvoiceWriteSchemaLevelGroupBy](ctx, _g.build, _g, _g.build.inters, v)}
func (_g *BillingInvoiceWriteSchemaLevelGroupBy) sqlScan(ctx context.Context, root *BillingInvoiceWriteSchemaLevelQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}
// BillingInvoiceWriteSchemaLevelSelect is the builder for selecting fields of BillingInvoiceWriteSchemaLevel entities.type BillingInvoiceWriteSchemaLevelSelect struct { *BillingInvoiceWriteSchemaLevelQuery selector}
// Aggregate adds the given aggregation functions to the selector query.func (_s *BillingInvoiceWriteSchemaLevelSelect) Aggregate(fns ...AggregateFunc) *BillingInvoiceWriteSchemaLevelSelect { _s.fns = append(_s.fns, fns...) return _s}
// Scan applies the selector query and scans the result into the given value.func (_s *BillingInvoiceWriteSchemaLevelSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*BillingInvoiceWriteSchemaLevelQuery, *BillingInvoiceWriteSchemaLevelSelect](ctx, _s.BillingInvoiceWriteSchemaLevelQuery, _s, _s.inters, v)}
func (_s *BillingInvoiceWriteSchemaLevelSelect) sqlScan(ctx context.Context, root *BillingInvoiceWriteSchemaLevelQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v)}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229// Code generated by ent, DO NOT EDIT.
package db
import ( "context" "errors" "fmt"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicewriteschemalevel" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate")
// BillingInvoiceWriteSchemaLevelUpdate is the builder for updating BillingInvoiceWriteSchemaLevel entities.type BillingInvoiceWriteSchemaLevelUpdate struct { config hooks []Hook mutation *BillingInvoiceWriteSchemaLevelMutation}
// Where appends a list predicates to the BillingInvoiceWriteSchemaLevelUpdate builder.func (_u *BillingInvoiceWriteSchemaLevelUpdate) Where(ps ...predicate.BillingInvoiceWriteSchemaLevel) *BillingInvoiceWriteSchemaLevelUpdate { _u.mutation.Where(ps...) return _u}
// SetSchemaLevel sets the "schema_level" field.func (_u *BillingInvoiceWriteSchemaLevelUpdate) SetSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelUpdate { _u.mutation.ResetSchemaLevel() _u.mutation.SetSchemaLevel(v) return _u}
// SetNillableSchemaLevel sets the "schema_level" field if the given value is not nil.func (_u *BillingInvoiceWriteSchemaLevelUpdate) SetNillableSchemaLevel(v *int) *BillingInvoiceWriteSchemaLevelUpdate { if v != nil { _u.SetSchemaLevel(*v) } return _u}
// AddSchemaLevel adds value to the "schema_level" field.func (_u *BillingInvoiceWriteSchemaLevelUpdate) AddSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelUpdate { _u.mutation.AddSchemaLevel(v) return _u}
// Mutation returns the BillingInvoiceWriteSchemaLevelMutation object of the builder.func (_u *BillingInvoiceWriteSchemaLevelUpdate) Mutation() *BillingInvoiceWriteSchemaLevelMutation { return _u.mutation}
// Save executes the query and returns the number of nodes affected by the update operation.func (_u *BillingInvoiceWriteSchemaLevelUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceWriteSchemaLevelUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected}
// Exec executes the query.func (_u *BillingInvoiceWriteSchemaLevelUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceWriteSchemaLevelUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
func (_u *BillingInvoiceWriteSchemaLevelUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(billinginvoicewriteschemalevel.Table, billinginvoicewriteschemalevel.Columns, sqlgraph.NewFieldSpec(billinginvoicewriteschemalevel.FieldID, field.TypeString)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.SchemaLevel(); ok { _spec.SetField(billinginvoicewriteschemalevel.FieldSchemaLevel, field.TypeInt, value) } if value, ok := _u.mutation.AddedSchemaLevel(); ok { _spec.AddField(billinginvoicewriteschemalevel.FieldSchemaLevel, field.TypeInt, value) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoicewriteschemalevel.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil}
// BillingInvoiceWriteSchemaLevelUpdateOne is the builder for updating a single BillingInvoiceWriteSchemaLevel entity.type BillingInvoiceWriteSchemaLevelUpdateOne struct { config fields []string hooks []Hook mutation *BillingInvoiceWriteSchemaLevelMutation}
// SetSchemaLevel sets the "schema_level" field.func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) SetSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelUpdateOne { _u.mutation.ResetSchemaLevel() _u.mutation.SetSchemaLevel(v) return _u}
// SetNillableSchemaLevel sets the "schema_level" field if the given value is not nil.func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) SetNillableSchemaLevel(v *int) *BillingInvoiceWriteSchemaLevelUpdateOne { if v != nil { _u.SetSchemaLevel(*v) } return _u}
// AddSchemaLevel adds value to the "schema_level" field.func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) AddSchemaLevel(v int) *BillingInvoiceWriteSchemaLevelUpdateOne { _u.mutation.AddSchemaLevel(v) return _u}
// Mutation returns the BillingInvoiceWriteSchemaLevelMutation object of the builder.func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) Mutation() *BillingInvoiceWriteSchemaLevelMutation { return _u.mutation}
// Where appends a list predicates to the BillingInvoiceWriteSchemaLevelUpdate builder.func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) Where(ps ...predicate.BillingInvoiceWriteSchemaLevel) *BillingInvoiceWriteSchemaLevelUpdateOne { _u.mutation.Where(ps...) return _u}
// Select allows selecting one or more fields (columns) of the returned entity.// The default is selecting all fields defined in the entity schema.func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) Select(field string, fields ...string) *BillingInvoiceWriteSchemaLevelUpdateOne { _u.fields = append([]string{field}, fields...) return _u}
// Save executes the query and returns the updated BillingInvoiceWriteSchemaLevel entity.func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) Save(ctx context.Context) (*BillingInvoiceWriteSchemaLevel, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)}
// SaveX is like Save, but panics if an error occurs.func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) SaveX(ctx context.Context) *BillingInvoiceWriteSchemaLevel { node, err := _u.Save(ctx) if err != nil { panic(err) } return node}
// Exec executes the query on the entity.func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err}
// ExecX is like Exec, but panics if an error occurs.func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) }}
func (_u *BillingInvoiceWriteSchemaLevelUpdateOne) sqlSave(ctx context.Context) (_node *BillingInvoiceWriteSchemaLevel, err error) { _spec := sqlgraph.NewUpdateSpec(billinginvoicewriteschemalevel.Table, billinginvoicewriteschemalevel.Columns, sqlgraph.NewFieldSpec(billinginvoicewriteschemalevel.FieldID, field.TypeString)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "BillingInvoiceWriteSchemaLevel.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicewriteschemalevel.FieldID) for _, f := range fields { if !billinginvoicewriteschemalevel.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} } if f != billinginvoicewriteschemalevel.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.SchemaLevel(); ok { _spec.SetField(billinginvoicewriteschemalevel.FieldSchemaLevel, field.TypeInt, value) } if value, ok := _u.mutation.AddedSchemaLevel(); ok { _spec.AddField(billinginvoicewriteschemalevel.FieldSchemaLevel, field.TypeInt, value) } _node = &BillingInvoiceWriteSchemaLevel{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{billinginvoicewriteschemalevel.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478// Code generated by ent, DO NOT EDIT.
package db
import ( "encoding/json" "fmt" "strings" "time"
"entgo.io/ent" "entgo.io/ent/dialect/sql" dbapp "github.com/openmeterio/openmeter/openmeter/ent/db/app" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" "github.com/openmeterio/openmeter/openmeter/ent/db/billingworkflowconfig" "github.com/openmeterio/openmeter/pkg/models")
// BillingProfile is the model entity for the BillingProfile schema.type BillingProfile struct { config `json:"-"` // ID of the ent. ID string `json:"id,omitempty"` // Namespace holds the value of the "namespace" field. Namespace string `json:"namespace,omitempty"` // Metadata holds the value of the "metadata" field. Metadata map[string]string `json:"metadata,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt *time.Time `json:"deleted_at,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Description holds the value of the "description" field. Description *string `json:"description,omitempty"` // SupplierAddressCountry holds the value of the "supplier_address_country" field. SupplierAddressCountry *models.CountryCode `json:"supplier_address_country,omitempty"` // SupplierAddressPostalCode holds the value of the "supplier_address_postal_code" field. SupplierAddressPostalCode *string `json:"supplier_address_postal_code,omitempty"` // SupplierAddressState holds the value of the "supplier_address_state" field. SupplierAddressState *string `json:"supplier_address_state,omitempty"` // SupplierAddressCity holds the value of the "supplier_address_city" field. SupplierAddressCity *string `json:"supplier_address_city,omitempty"` // SupplierAddressLine1 holds the value of the "supplier_address_line1" field. SupplierAddressLine1 *string `json:"supplier_address_line1,omitempty"` // SupplierAddressLine2 holds the value of the "supplier_address_line2" field. SupplierAddressLine2 *string `json:"supplier_address_line2,omitempty"` // SupplierAddressPhoneNumber holds the value of the "supplier_address_phone_number" field. SupplierAddressPhoneNumber *string `json:"supplier_address_phone_number,omitempty"` // TaxAppID holds the value of the "tax_app_id" field. TaxAppID string `json:"tax_app_id,omitempty"` // InvoicingAppID holds the value of the "invoicing_app_id" field. InvoicingAppID string `json:"invoicing_app_id,omitempty"` // PaymentAppID holds the value of the "payment_app_id" field. PaymentAppID string `json:"payment_app_id,omitempty"` // WorkflowConfigID holds the value of the "workflow_config_id" field. WorkflowConfigID string `json:"workflow_config_id,omitempty"` // Default holds the value of the "default" field. Default bool `json:"default,omitempty"` // SupplierName holds the value of the "supplier_name" field. SupplierName string `json:"supplier_name,omitempty"` // SupplierTaxCode holds the value of the "supplier_tax_code" field. SupplierTaxCode *string `json:"supplier_tax_code,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the BillingProfileQuery when eager-loading is set. Edges BillingProfileEdges `json:"edges"` selectValues sql.SelectValues}
// BillingProfileEdges holds the relations/edges for other nodes in the graph.type BillingProfileEdges struct { // BillingInvoices holds the value of the billing_invoices edge. BillingInvoices []*BillingInvoice `json:"billing_invoices,omitempty"` // BillingCustomerOverride holds the value of the billing_customer_override edge. BillingCustomerOverride []*BillingCustomerOverride `json:"billing_customer_override,omitempty"` // WorkflowConfig holds the value of the workflow_config edge. WorkflowConfig *BillingWorkflowConfig `json:"workflow_config,omitempty"` // TaxApp holds the value of the tax_app edge. TaxApp *App `json:"tax_app,omitempty"` // InvoicingApp holds the value of the invoicing_app edge. InvoicingApp *App `json:"invoicing_app,omitempty"` // PaymentApp holds the value of the payment_app edge. PaymentApp *App `json:"payment_app,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [6]bool}
// BillingInvoicesOrErr returns the BillingInvoices value or an error if the edge// was not loaded in eager-loading.func (e BillingProfileEdges) BillingInvoicesOrErr() ([]*BillingInvoice, error) { if e.loadedTypes[0] { return e.BillingInvoices, nil } return nil, &NotLoadedError{edge: "billing_invoices"}}
// BillingCustomerOverrideOrErr returns the BillingCustomerOverride value or an error if the edge// was not loaded in eager-loading.func (e BillingProfileEdges) BillingCustomerOverrideOrErr() ([]*BillingCustomerOverride, error) { if e.loadedTypes[1] { return e.BillingCustomerOverride, nil } return nil, &NotLoadedError{edge: "billing_customer_override"}}
// WorkflowConfigOrErr returns the WorkflowConfig value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingProfileEdges) WorkflowConfigOrErr() (*BillingWorkflowConfig, error) { if e.WorkflowConfig != nil { return e.WorkflowConfig, nil } else if e.loadedTypes[2] { return nil, &NotFoundError{label: billingworkflowconfig.Label} } return nil, &NotLoadedError{edge: "workflow_config"}}
// TaxAppOrErr returns the TaxApp value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingProfileEdges) TaxAppOrErr() (*App, error) { if e.TaxApp != nil { return e.TaxApp, nil } else if e.loadedTypes[3] { return nil, &NotFoundError{label: dbapp.Label} } return nil, &NotLoadedError{edge: "tax_app"}}
// InvoicingAppOrErr returns the InvoicingApp value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingProfileEdges) InvoicingAppOrErr() (*App, error) { if e.InvoicingApp != nil { return e.InvoicingApp, nil } else if e.loadedTypes[4] { return nil, &NotFoundError{label: dbapp.Label} } return nil, &NotLoadedError{edge: "invoicing_app"}}
// PaymentAppOrErr returns the PaymentApp value or an error if the edge// was not loaded in eager-loading, or loaded but was not found.func (e BillingProfileEdges) PaymentAppOrErr() (*App, error) { if e.PaymentApp != nil { return e.PaymentApp, nil } else if e.loadedTypes[5] { return nil, &NotFoundError{label: dbapp.Label} } return nil, &NotLoadedError{edge: "payment_app"}}
// scanValues returns the types for scanning values from sql.Rows.func (*BillingProfile) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case billingprofile.FieldMetadata: values[i] = new([]byte) case billingprofile.FieldDefault: values[i] = new(sql.NullBool) case billingprofile.FieldID, billingprofile.FieldNamespace, billingprofile.FieldName, billingprofile.FieldDescription, billingprofile.FieldSupplierAddressCountry, billingprofile.FieldSupplierAddressPostalCode, billingprofile.FieldSupplierAddressState, billingprofile.FieldSupplierAddressCity, billingprofile.FieldSupplierAddressLine1, billingprofile.FieldSupplierAddressLine2, billingprofile.FieldSupplierAddressPhoneNumber, billingprofile.FieldTaxAppID, billingprofile.FieldInvoicingAppID, billingprofile.FieldPaymentAppID, billingprofile.FieldWorkflowConfigID, billingprofile.FieldSupplierName, billingprofile.FieldSupplierTaxCode: values[i] = new(sql.NullString) case billingprofile.FieldCreatedAt, billingprofile.FieldUpdatedAt, billingprofile.FieldDeletedAt: values[i] = new(sql.NullTime) default: values[i] = new(sql.UnknownType) } } return values, nil}
// assignValues assigns the values that were returned from sql.Rows (after scanning)// to the BillingProfile fields.func (_m *BillingProfile) 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) } for i := range columns { switch columns[i] { case billingprofile.FieldID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value.Valid { _m.ID = value.String } case billingprofile.FieldNamespace: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field namespace", values[i]) } else if value.Valid { _m.Namespace = value.String } case billingprofile.FieldMetadata: if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field metadata", values[i]) } else if value != nil && len(*value) > 0 { if err := json.Unmarshal(*value, &_m.Metadata); err != nil { return fmt.Errorf("unmarshal field metadata: %w", err) } } case billingprofile.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { _m.CreatedAt = value.Time } case billingprofile.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { _m.UpdatedAt = value.Time } case billingprofile.FieldDeletedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field deleted_at", values[i]) } else if value.Valid { _m.DeletedAt = new(time.Time) *_m.DeletedAt = value.Time } case billingprofile.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { _m.Name = value.String } case billingprofile.FieldDescription: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field description", values[i]) } else if value.Valid { _m.Description = new(string) *_m.Description = value.String } case billingprofile.FieldSupplierAddressCountry: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field supplier_address_country", values[i]) } else if value.Valid { _m.SupplierAddressCountry = new(models.CountryCode) *_m.SupplierAddressCountry = models.CountryCode(value.String) } case billingprofile.FieldSupplierAddressPostalCode: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field supplier_address_postal_code", values[i]) } else if value.Valid { _m.SupplierAddressPostalCode = new(string) *_m.SupplierAddressPostalCode = value.String } case billingprofile.FieldSupplierAddressState: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field supplier_address_state", values[i]) } else if value.Valid { _m.SupplierAddressState = new(string) *_m.SupplierAddressState = value.String } case billingprofile.FieldSupplierAddressCity: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field supplier_address_city", values[i]) } else if value.Valid { _m.SupplierAddressCity = new(string) *_m.SupplierAddressCity = value.String } case billingprofile.FieldSupplierAddressLine1: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field supplier_address_line1", values[i]) } else if value.Valid { _m.SupplierAddressLine1 = new(string) *_m.SupplierAddressLine1 = value.String } case billingprofile.FieldSupplierAddressLine2: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field supplier_address_line2", values[i]) } else if value.Valid { _m.SupplierAddressLine2 = new(string) *_m.SupplierAddressLine2 = value.String } case billingprofile.FieldSupplierAddressPhoneNumber: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field supplier_address_phone_number", values[i]) } else if value.Valid { _m.SupplierAddressPhoneNumber = new(string) *_m.SupplierAddressPhoneNumber = value.String } case billingprofile.FieldTaxAppID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field tax_app_id", values[i]) } else if value.Valid { _m.TaxAppID = value.String } case billingprofile.FieldInvoicingAppID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field invoicing_app_id", values[i]) } else if value.Valid { _m.InvoicingAppID = value.String } case billingprofile.FieldPaymentAppID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field payment_app_id", values[i]) } else if value.Valid { _m.PaymentAppID = value.String } case billingprofile.FieldWorkflowConfigID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field workflow_config_id", values[i]) } else if value.Valid { _m.WorkflowConfigID = value.String } case billingprofile.FieldDefault: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field default", values[i]) } else if value.Valid { _m.Default = value.Bool } case billingprofile.FieldSupplierName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field supplier_name", values[i]) } else if value.Valid { _m.SupplierName = value.String } case billingprofile.FieldSupplierTaxCode: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field supplier_tax_code", values[i]) } else if value.Valid { _m.SupplierTaxCode = new(string) *_m.SupplierTaxCode = value.String } default: _m.selectValues.Set(columns[i], values[i]) } } return nil}
// Value returns the ent.Value that was dynamically selected and assigned to the BillingProfile.// This includes values selected through modifiers, order, etc.func (_m *BillingProfile) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name)}
// QueryBillingInvoices queries the "billing_invoices" edge of the BillingProfile entity.func (_m *BillingProfile) QueryBillingInvoices() *BillingInvoiceQuery { return NewBillingProfileClient(_m.config).QueryBillingInvoices(_m)}
// QueryBillingCustomerOverride queries the "billing_customer_override" edge of the BillingProfile entity.func (_m *BillingProfile) QueryBillingCustomerOverride() *BillingCustomerOverrideQuery { return NewBillingProfileClient(_m.config).QueryBillingCustomerOverride(_m)}
// QueryWorkflowConfig queries the "workflow_config" edge of the BillingProfile entity.func (_m *BillingProfile) QueryWorkflowConfig() *BillingWorkflowConfigQuery { return NewBillingProfileClient(_m.config).QueryWorkflowConfig(_m)}
// QueryTaxApp queries the "tax_app" edge of the BillingProfile entity.func (_m *BillingProfile) QueryTaxApp() *AppQuery { return NewBillingProfileClient(_m.config).QueryTaxApp(_m)}
// QueryInvoicingApp queries the "invoicing_app" edge of the BillingProfile entity.func (_m *BillingProfile) QueryInvoicingApp() *AppQuery { return NewBillingProfileClient(_m.config).QueryInvoicingApp(_m)}
// QueryPaymentApp queries the "payment_app" edge of the BillingProfile entity.func (_m *BillingProfile) QueryPaymentApp() *AppQuery { return NewBillingProfileClient(_m.config).QueryPaymentApp(_m)}
// Update returns a builder for updating this BillingProfile.// Note that you need to call BillingProfile.Unwrap() before calling this method if this BillingProfile// was returned from a transaction, and the transaction was committed or rolled back.func (_m *BillingProfile) Update() *BillingProfileUpdateOne { return NewBillingProfileClient(_m.config).UpdateOne(_m)}
// Unwrap unwraps the BillingProfile 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 (_m *BillingProfile) Unwrap() *BillingProfile { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("db: BillingProfile is not a transactional entity") } _m.config.driver = _tx.drv return _m}
// String implements the fmt.Stringer.func (_m *BillingProfile) String() string { var builder strings.Builder builder.WriteString("BillingProfile(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("namespace=") builder.WriteString(_m.Namespace) builder.WriteString(", ") builder.WriteString("metadata=") builder.WriteString(fmt.Sprintf("%v", _m.Metadata)) builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") if v := _m.DeletedAt; v != nil { builder.WriteString("deleted_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(_m.Name) builder.WriteString(", ") if v := _m.Description; v != nil { builder.WriteString("description=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.SupplierAddressCountry; v != nil { builder.WriteString("supplier_address_country=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") if v := _m.SupplierAddressPostalCode; v != nil { builder.WriteString("supplier_address_postal_code=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.SupplierAddressState; v != nil { builder.WriteString("supplier_address_state=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.SupplierAddressCity; v != nil { builder.WriteString("supplier_address_city=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.SupplierAddressLine1; v != nil { builder.WriteString("supplier_address_line1=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.SupplierAddressLine2; v != nil { builder.WriteString("supplier_address_line2=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.SupplierAddressPhoneNumber; v != nil { builder.WriteString("supplier_address_phone_number=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("tax_app_id=") builder.WriteString(_m.TaxAppID) builder.WriteString(", ") builder.WriteString("invoicing_app_id=") builder.WriteString(_m.InvoicingAppID) builder.WriteString(", ") builder.WriteString("payment_app_id=") builder.WriteString(_m.PaymentAppID) builder.WriteString(", ") builder.WriteString("workflow_config_id=") builder.WriteString(_m.WorkflowConfigID) builder.WriteString(", ") builder.WriteString("default=") builder.WriteString(fmt.Sprintf("%v", _m.Default)) builder.WriteString(", ") builder.WriteString("supplier_name=") builder.WriteString(_m.SupplierName) builder.WriteString(", ") if v := _m.SupplierTaxCode; v != nil { builder.WriteString("supplier_tax_code=") builder.WriteString(*v) } builder.WriteByte(')') return builder.String()}
// BillingProfiles is a parsable slice of BillingProfile.type BillingProfiles []*BillingProfile123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378// Code generated by ent, DO NOT EDIT.
package billingprofile
import ( "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph")
const ( // Label holds the string label denoting the billingprofile type in the database. Label = "billing_profile" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldNamespace holds the string denoting the namespace field in the database. FieldNamespace = "namespace" // FieldMetadata holds the string denoting the metadata field in the database. FieldMetadata = "metadata" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" // FieldDeletedAt holds the string denoting the deleted_at field in the database. FieldDeletedAt = "deleted_at" // FieldName holds the string denoting the name field in the database. FieldName = "name" // FieldDescription holds the string denoting the description field in the database. FieldDescription = "description" // FieldSupplierAddressCountry holds the string denoting the supplier_address_country field in the database. FieldSupplierAddressCountry = "supplier_address_country" // FieldSupplierAddressPostalCode holds the string denoting the supplier_address_postal_code field in the database. FieldSupplierAddressPostalCode = "supplier_address_postal_code" // FieldSupplierAddressState holds the string denoting the supplier_address_state field in the database. FieldSupplierAddressState = "supplier_address_state" // FieldSupplierAddressCity holds the string denoting the supplier_address_city field in the database. FieldSupplierAddressCity = "supplier_address_city" // FieldSupplierAddressLine1 holds the string denoting the supplier_address_line1 field in the database. FieldSupplierAddressLine1 = "supplier_address_line1" // FieldSupplierAddressLine2 holds the string denoting the supplier_address_line2 field in the database. FieldSupplierAddressLine2 = "supplier_address_line2" // FieldSupplierAddressPhoneNumber holds the string denoting the supplier_address_phone_number field in the database. FieldSupplierAddressPhoneNumber = "supplier_address_phone_number" // FieldTaxAppID holds the string denoting the tax_app_id field in the database. FieldTaxAppID = "tax_app_id" // FieldInvoicingAppID holds the string denoting the invoicing_app_id field in the database. FieldInvoicingAppID = "invoicing_app_id" // FieldPaymentAppID holds the string denoting the payment_app_id field in the database. FieldPaymentAppID = "payment_app_id" // FieldWorkflowConfigID holds the string denoting the workflow_config_id field in the database. FieldWorkflowConfigID = "workflow_config_id" // FieldDefault holds the string denoting the default field in the database. FieldDefault = "default" // FieldSupplierName holds the string denoting the supplier_name field in the database. FieldSupplierName = "supplier_name" // FieldSupplierTaxCode holds the string denoting the supplier_tax_code field in the database. FieldSupplierTaxCode = "supplier_tax_code" // EdgeBillingInvoices holds the string denoting the billing_invoices edge name in mutations. EdgeBillingInvoices = "billing_invoices" // EdgeBillingCustomerOverride holds the string denoting the billing_customer_override edge name in mutations. EdgeBillingCustomerOverride = "billing_customer_override" // EdgeWorkflowConfig holds the string denoting the workflow_config edge name in mutations. EdgeWorkflowConfig = "workflow_config" // EdgeTaxApp holds the string denoting the tax_app edge name in mutations. EdgeTaxApp = "tax_app" // EdgeInvoicingApp holds the string denoting the invoicing_app edge name in mutations. EdgeInvoicingApp = "invoicing_app" // EdgePaymentApp holds the string denoting the payment_app edge name in mutations. EdgePaymentApp = "payment_app" // Table holds the table name of the billingprofile in the database. Table = "billing_profiles" // BillingInvoicesTable is the table that holds the billing_invoices relation/edge. BillingInvoicesTable = "billing_invoices" // BillingInvoicesInverseTable is the table name for the BillingInvoice entity. // It exists in this package in order to avoid circular dependency with the "billinginvoice" package. BillingInvoicesInverseTable = "billing_invoices" // BillingInvoicesColumn is the table column denoting the billing_invoices relation/edge. BillingInvoicesColumn = "source_billing_profile_id" // BillingCustomerOverrideTable is the table that holds the billing_customer_override relation/edge. BillingCustomerOverrideTable = "billing_customer_overrides" // BillingCustomerOverrideInverseTable is the table name for the BillingCustomerOverride entity. // It exists in this package in order to avoid circular dependency with the "billingcustomeroverride" package. BillingCustomerOverrideInverseTable = "billing_customer_overrides" // BillingCustomerOverrideColumn is the table column denoting the billing_customer_override relation/edge. BillingCustomerOverrideColumn = "billing_profile_id" // WorkflowConfigTable is the table that holds the workflow_config relation/edge. WorkflowConfigTable = "billing_profiles" // WorkflowConfigInverseTable is the table name for the BillingWorkflowConfig entity. // It exists in this package in order to avoid circular dependency with the "billingworkflowconfig" package. WorkflowConfigInverseTable = "billing_workflow_configs" // WorkflowConfigColumn is the table column denoting the workflow_config relation/edge. WorkflowConfigColumn = "workflow_config_id" // TaxAppTable is the table that holds the tax_app relation/edge. TaxAppTable = "billing_profiles" // TaxAppInverseTable is the table name for the App entity. // It exists in this package in order to avoid circular dependency with the "dbapp" package. TaxAppInverseTable = "apps" // TaxAppColumn is the table column denoting the tax_app relation/edge. TaxAppColumn = "tax_app_id" // InvoicingAppTable is the table that holds the invoicing_app relation/edge. InvoicingAppTable = "billing_profiles" // InvoicingAppInverseTable is the table name for the App entity. // It exists in this package in order to avoid circular dependency with the "dbapp" package. InvoicingAppInverseTable = "apps" // InvoicingAppColumn is the table column denoting the invoicing_app relation/edge. InvoicingAppColumn = "invoicing_app_id" // PaymentAppTable is the table that holds the payment_app relation/edge. PaymentAppTable = "billing_profiles" // PaymentAppInverseTable is the table name for the App entity. // It exists in this package in order to avoid circular dependency with the "dbapp" package. PaymentAppInverseTable = "apps" // PaymentAppColumn is the table column denoting the payment_app relation/edge. PaymentAppColumn = "payment_app_id")
// Columns holds all SQL columns for billingprofile fields.var Columns = []string{ FieldID, FieldNamespace, FieldMetadata, FieldCreatedAt, FieldUpdatedAt, FieldDeletedAt, FieldName, FieldDescription, FieldSupplierAddressCountry, FieldSupplierAddressPostalCode, FieldSupplierAddressState, FieldSupplierAddressCity, FieldSupplierAddressLine1, FieldSupplierAddressLine2, FieldSupplierAddressPhoneNumber, FieldTaxAppID, FieldInvoicingAppID, FieldPaymentAppID, FieldWorkflowConfigID, FieldDefault, FieldSupplierName, FieldSupplierTaxCode,}
// ValidColumn reports if the column name is valid (part of the table columns).func ValidColumn(column string) bool { for i := range Columns { if column == Columns[i] { return true } } return false}
var ( // NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. NamespaceValidator func(string) error // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. DefaultUpdatedAt func() time.Time // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. UpdateDefaultUpdatedAt func() time.Time // SupplierAddressCountryValidator is a validator for the "supplier_address_country" field. It is called by the builders before save. SupplierAddressCountryValidator func(string) error // WorkflowConfigIDValidator is a validator for the "workflow_config_id" field. It is called by the builders before save. WorkflowConfigIDValidator func(string) error // DefaultDefault holds the default value on creation for the "default" field. DefaultDefault bool // SupplierNameValidator is a validator for the "supplier_name" field. It is called by the builders before save. SupplierNameValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() string)
// OrderOption defines the ordering options for the BillingProfile queries.type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc()}
// ByNamespace orders the results by the namespace field.func ByNamespace(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldNamespace, opts...).ToFunc()}
// ByCreatedAt orders the results by the created_at field.func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()}
// ByUpdatedAt orders the results by the updated_at field.func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()}
// ByDeletedAt orders the results by the deleted_at field.func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()}
// ByName orders the results by the name field.func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc()}
// ByDescription orders the results by the description field.func ByDescription(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDescription, opts...).ToFunc()}
// BySupplierAddressCountry orders the results by the supplier_address_country field.func BySupplierAddressCountry(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSupplierAddressCountry, opts...).ToFunc()}
// BySupplierAddressPostalCode orders the results by the supplier_address_postal_code field.func BySupplierAddressPostalCode(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSupplierAddressPostalCode, opts...).ToFunc()}
// BySupplierAddressState orders the results by the supplier_address_state field.func BySupplierAddressState(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSupplierAddressState, opts...).ToFunc()}
// BySupplierAddressCity orders the results by the supplier_address_city field.func BySupplierAddressCity(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSupplierAddressCity, opts...).ToFunc()}
// BySupplierAddressLine1 orders the results by the supplier_address_line1 field.func BySupplierAddressLine1(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSupplierAddressLine1, opts...).ToFunc()}
// BySupplierAddressLine2 orders the results by the supplier_address_line2 field.func BySupplierAddressLine2(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSupplierAddressLine2, opts...).ToFunc()}
// BySupplierAddressPhoneNumber orders the results by the supplier_address_phone_number field.func BySupplierAddressPhoneNumber(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSupplierAddressPhoneNumber, opts...).ToFunc()}
// ByTaxAppID orders the results by the tax_app_id field.func ByTaxAppID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldTaxAppID, opts...).ToFunc()}
// ByInvoicingAppID orders the results by the invoicing_app_id field.func ByInvoicingAppID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldInvoicingAppID, opts...).ToFunc()}
// ByPaymentAppID orders the results by the payment_app_id field.func ByPaymentAppID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPaymentAppID, opts...).ToFunc()}
// ByWorkflowConfigID orders the results by the workflow_config_id field.func ByWorkflowConfigID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldWorkflowConfigID, opts...).ToFunc()}
// ByDefault orders the results by the default field.func ByDefault(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDefault, opts...).ToFunc()}
// BySupplierName orders the results by the supplier_name field.func BySupplierName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSupplierName, opts...).ToFunc()}
// BySupplierTaxCode orders the results by the supplier_tax_code field.func BySupplierTaxCode(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSupplierTaxCode, opts...).ToFunc()}
// ByBillingInvoicesCount orders the results by billing_invoices count.func ByBillingInvoicesCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newBillingInvoicesStep(), opts...) }}
// ByBillingInvoices orders the results by billing_invoices terms.func ByBillingInvoices(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newBillingInvoicesStep(), append([]sql.OrderTerm{term}, terms...)...) }}
// ByBillingCustomerOverrideCount orders the results by billing_customer_override count.func ByBillingCustomerOverrideCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newBillingCustomerOverrideStep(), opts...) }}
// ByBillingCustomerOverride orders the results by billing_customer_override terms.func ByBillingCustomerOverride(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newBillingCustomerOverrideStep(), append([]sql.OrderTerm{term}, terms...)...) }}
// ByWorkflowConfigField orders the results by workflow_config field.func ByWorkflowConfigField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newWorkflowConfigStep(), sql.OrderByField(field, opts...)) }}
// ByTaxAppField orders the results by tax_app field.func ByTaxAppField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newTaxAppStep(), sql.OrderByField(field, opts...)) }}
// ByInvoicingAppField orders the results by invoicing_app field.func ByInvoicingAppField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newInvoicingAppStep(), sql.OrderByField(field, opts...)) }}
// ByPaymentAppField orders the results by payment_app field.func ByPaymentAppField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newPaymentAppStep(), sql.OrderByField(field, opts...)) }}func newBillingInvoicesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(BillingInvoicesInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoicesTable, BillingInvoicesColumn), )}func newBillingCustomerOverrideStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(BillingCustomerOverrideInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, BillingCustomerOverrideTable, BillingCustomerOverrideColumn), )}func newWorkflowConfigStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(WorkflowConfigInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2O, true, WorkflowConfigTable, WorkflowConfigColumn), )}func newTaxAppStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(TaxAppInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, TaxAppTable, TaxAppColumn), )}func newInvoicingAppStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(InvoicingAppInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, InvoicingAppTable, InvoicingAppColumn), )}func newPaymentAppStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(PaymentAppInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, PaymentAppTable, PaymentAppColumn), )}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620// Code generated by ent, DO NOT EDIT.
package billingprofile
import ( "time"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" "github.com/openmeterio/openmeter/pkg/models")
// ID filters vertices based on their ID field.func ID(id string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldID, id))}
// IDEQ applies the EQ predicate on the ID field.func IDEQ(id string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldID, id))}
// IDNEQ applies the NEQ predicate on the ID field.func IDNEQ(id string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldID, id))}
// IDIn applies the In predicate on the ID field.func IDIn(ids ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldID, ids...))}
// IDNotIn applies the NotIn predicate on the ID field.func IDNotIn(ids ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldID, ids...))}
// IDGT applies the GT predicate on the ID field.func IDGT(id string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldID, id))}
// IDGTE applies the GTE predicate on the ID field.func IDGTE(id string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldID, id))}
// IDLT applies the LT predicate on the ID field.func IDLT(id string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldID, id))}
// IDLTE applies the LTE predicate on the ID field.func IDLTE(id string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldID, id))}
// IDEqualFold applies the EqualFold predicate on the ID field.func IDEqualFold(id string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldID, id))}
// IDContainsFold applies the ContainsFold predicate on the ID field.func IDContainsFold(id string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldID, id))}
// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ.func Namespace(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldNamespace, v))}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.func CreatedAt(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldCreatedAt, v))}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.func UpdatedAt(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldUpdatedAt, v))}
// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.func DeletedAt(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldDeletedAt, v))}
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.func Name(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldName, v))}
// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ.func Description(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldDescription, v))}
// SupplierAddressCountry applies equality check predicate on the "supplier_address_country" field. It's identical to SupplierAddressCountryEQ.func SupplierAddressCountry(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressCountry, vc))}
// SupplierAddressPostalCode applies equality check predicate on the "supplier_address_postal_code" field. It's identical to SupplierAddressPostalCodeEQ.func SupplierAddressPostalCode(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressPostalCode, v))}
// SupplierAddressState applies equality check predicate on the "supplier_address_state" field. It's identical to SupplierAddressStateEQ.func SupplierAddressState(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressState, v))}
// SupplierAddressCity applies equality check predicate on the "supplier_address_city" field. It's identical to SupplierAddressCityEQ.func SupplierAddressCity(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressCity, v))}
// SupplierAddressLine1 applies equality check predicate on the "supplier_address_line1" field. It's identical to SupplierAddressLine1EQ.func SupplierAddressLine1(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressLine1, v))}
// SupplierAddressLine2 applies equality check predicate on the "supplier_address_line2" field. It's identical to SupplierAddressLine2EQ.func SupplierAddressLine2(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressLine2, v))}
// SupplierAddressPhoneNumber applies equality check predicate on the "supplier_address_phone_number" field. It's identical to SupplierAddressPhoneNumberEQ.func SupplierAddressPhoneNumber(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressPhoneNumber, v))}
// TaxAppID applies equality check predicate on the "tax_app_id" field. It's identical to TaxAppIDEQ.func TaxAppID(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldTaxAppID, v))}
// InvoicingAppID applies equality check predicate on the "invoicing_app_id" field. It's identical to InvoicingAppIDEQ.func InvoicingAppID(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldInvoicingAppID, v))}
// PaymentAppID applies equality check predicate on the "payment_app_id" field. It's identical to PaymentAppIDEQ.func PaymentAppID(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldPaymentAppID, v))}
// WorkflowConfigID applies equality check predicate on the "workflow_config_id" field. It's identical to WorkflowConfigIDEQ.func WorkflowConfigID(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldWorkflowConfigID, v))}
// Default applies equality check predicate on the "default" field. It's identical to DefaultEQ.func Default(v bool) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldDefault, v))}
// SupplierName applies equality check predicate on the "supplier_name" field. It's identical to SupplierNameEQ.func SupplierName(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierName, v))}
// SupplierTaxCode applies equality check predicate on the "supplier_tax_code" field. It's identical to SupplierTaxCodeEQ.func SupplierTaxCode(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierTaxCode, v))}
// NamespaceEQ applies the EQ predicate on the "namespace" field.func NamespaceEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldNamespace, v))}
// NamespaceNEQ applies the NEQ predicate on the "namespace" field.func NamespaceNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldNamespace, v))}
// NamespaceIn applies the In predicate on the "namespace" field.func NamespaceIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldNamespace, vs...))}
// NamespaceNotIn applies the NotIn predicate on the "namespace" field.func NamespaceNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldNamespace, vs...))}
// NamespaceGT applies the GT predicate on the "namespace" field.func NamespaceGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldNamespace, v))}
// NamespaceGTE applies the GTE predicate on the "namespace" field.func NamespaceGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldNamespace, v))}
// NamespaceLT applies the LT predicate on the "namespace" field.func NamespaceLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldNamespace, v))}
// NamespaceLTE applies the LTE predicate on the "namespace" field.func NamespaceLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldNamespace, v))}
// NamespaceContains applies the Contains predicate on the "namespace" field.func NamespaceContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldNamespace, v))}
// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field.func NamespaceHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldNamespace, v))}
// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field.func NamespaceHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldNamespace, v))}
// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field.func NamespaceEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldNamespace, v))}
// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field.func NamespaceContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldNamespace, v))}
// MetadataIsNil applies the IsNil predicate on the "metadata" field.func MetadataIsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldMetadata))}
// MetadataNotNil applies the NotNil predicate on the "metadata" field.func MetadataNotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldMetadata))}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.func CreatedAtEQ(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldCreatedAt, v))}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.func CreatedAtNEQ(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldCreatedAt, v))}
// CreatedAtIn applies the In predicate on the "created_at" field.func CreatedAtIn(vs ...time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldCreatedAt, vs...))}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.func CreatedAtNotIn(vs ...time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldCreatedAt, vs...))}
// CreatedAtGT applies the GT predicate on the "created_at" field.func CreatedAtGT(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldCreatedAt, v))}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.func CreatedAtGTE(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldCreatedAt, v))}
// CreatedAtLT applies the LT predicate on the "created_at" field.func CreatedAtLT(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldCreatedAt, v))}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.func CreatedAtLTE(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldCreatedAt, v))}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.func UpdatedAtEQ(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldUpdatedAt, v))}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.func UpdatedAtNEQ(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldUpdatedAt, v))}
// UpdatedAtIn applies the In predicate on the "updated_at" field.func UpdatedAtIn(vs ...time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldUpdatedAt, vs...))}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.func UpdatedAtNotIn(vs ...time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldUpdatedAt, vs...))}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.func UpdatedAtGT(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldUpdatedAt, v))}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.func UpdatedAtGTE(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldUpdatedAt, v))}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.func UpdatedAtLT(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldUpdatedAt, v))}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.func UpdatedAtLTE(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldUpdatedAt, v))}
// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.func DeletedAtEQ(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldDeletedAt, v))}
// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.func DeletedAtNEQ(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldDeletedAt, v))}
// DeletedAtIn applies the In predicate on the "deleted_at" field.func DeletedAtIn(vs ...time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldDeletedAt, vs...))}
// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.func DeletedAtNotIn(vs ...time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldDeletedAt, vs...))}
// DeletedAtGT applies the GT predicate on the "deleted_at" field.func DeletedAtGT(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldDeletedAt, v))}
// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.func DeletedAtGTE(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldDeletedAt, v))}
// DeletedAtLT applies the LT predicate on the "deleted_at" field.func DeletedAtLT(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldDeletedAt, v))}
// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.func DeletedAtLTE(v time.Time) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldDeletedAt, v))}
// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.func DeletedAtIsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldDeletedAt))}
// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.func DeletedAtNotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldDeletedAt))}
// NameEQ applies the EQ predicate on the "name" field.func NameEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldName, v))}
// NameNEQ applies the NEQ predicate on the "name" field.func NameNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldName, v))}
// NameIn applies the In predicate on the "name" field.func NameIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldName, vs...))}
// NameNotIn applies the NotIn predicate on the "name" field.func NameNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldName, vs...))}
// NameGT applies the GT predicate on the "name" field.func NameGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldName, v))}
// NameGTE applies the GTE predicate on the "name" field.func NameGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldName, v))}
// NameLT applies the LT predicate on the "name" field.func NameLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldName, v))}
// NameLTE applies the LTE predicate on the "name" field.func NameLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldName, v))}
// NameContains applies the Contains predicate on the "name" field.func NameContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldName, v))}
// NameHasPrefix applies the HasPrefix predicate on the "name" field.func NameHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldName, v))}
// NameHasSuffix applies the HasSuffix predicate on the "name" field.func NameHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldName, v))}
// NameEqualFold applies the EqualFold predicate on the "name" field.func NameEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldName, v))}
// NameContainsFold applies the ContainsFold predicate on the "name" field.func NameContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldName, v))}
// DescriptionEQ applies the EQ predicate on the "description" field.func DescriptionEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldDescription, v))}
// DescriptionNEQ applies the NEQ predicate on the "description" field.func DescriptionNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldDescription, v))}
// DescriptionIn applies the In predicate on the "description" field.func DescriptionIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldDescription, vs...))}
// DescriptionNotIn applies the NotIn predicate on the "description" field.func DescriptionNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldDescription, vs...))}
// DescriptionGT applies the GT predicate on the "description" field.func DescriptionGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldDescription, v))}
// DescriptionGTE applies the GTE predicate on the "description" field.func DescriptionGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldDescription, v))}
// DescriptionLT applies the LT predicate on the "description" field.func DescriptionLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldDescription, v))}
// DescriptionLTE applies the LTE predicate on the "description" field.func DescriptionLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldDescription, v))}
// DescriptionContains applies the Contains predicate on the "description" field.func DescriptionContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldDescription, v))}
// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field.func DescriptionHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldDescription, v))}
// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field.func DescriptionHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldDescription, v))}
// DescriptionIsNil applies the IsNil predicate on the "description" field.func DescriptionIsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldDescription))}
// DescriptionNotNil applies the NotNil predicate on the "description" field.func DescriptionNotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldDescription))}
// DescriptionEqualFold applies the EqualFold predicate on the "description" field.func DescriptionEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldDescription, v))}
// DescriptionContainsFold applies the ContainsFold predicate on the "description" field.func DescriptionContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldDescription, v))}
// SupplierAddressCountryEQ applies the EQ predicate on the "supplier_address_country" field.func SupplierAddressCountryEQ(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressCountry, vc))}
// SupplierAddressCountryNEQ applies the NEQ predicate on the "supplier_address_country" field.func SupplierAddressCountryNEQ(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldNEQ(FieldSupplierAddressCountry, vc))}
// SupplierAddressCountryIn applies the In predicate on the "supplier_address_country" field.func SupplierAddressCountryIn(vs ...models.CountryCode) predicate.BillingProfile { v := make([]any, len(vs)) for i := range v { v[i] = string(vs[i]) } return predicate.BillingProfile(sql.FieldIn(FieldSupplierAddressCountry, v...))}
// SupplierAddressCountryNotIn applies the NotIn predicate on the "supplier_address_country" field.func SupplierAddressCountryNotIn(vs ...models.CountryCode) predicate.BillingProfile { v := make([]any, len(vs)) for i := range v { v[i] = string(vs[i]) } return predicate.BillingProfile(sql.FieldNotIn(FieldSupplierAddressCountry, v...))}
// SupplierAddressCountryGT applies the GT predicate on the "supplier_address_country" field.func SupplierAddressCountryGT(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldGT(FieldSupplierAddressCountry, vc))}
// SupplierAddressCountryGTE applies the GTE predicate on the "supplier_address_country" field.func SupplierAddressCountryGTE(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldGTE(FieldSupplierAddressCountry, vc))}
// SupplierAddressCountryLT applies the LT predicate on the "supplier_address_country" field.func SupplierAddressCountryLT(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldLT(FieldSupplierAddressCountry, vc))}
// SupplierAddressCountryLTE applies the LTE predicate on the "supplier_address_country" field.func SupplierAddressCountryLTE(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldLTE(FieldSupplierAddressCountry, vc))}
// SupplierAddressCountryContains applies the Contains predicate on the "supplier_address_country" field.func SupplierAddressCountryContains(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldContains(FieldSupplierAddressCountry, vc))}
// SupplierAddressCountryHasPrefix applies the HasPrefix predicate on the "supplier_address_country" field.func SupplierAddressCountryHasPrefix(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldHasPrefix(FieldSupplierAddressCountry, vc))}
// SupplierAddressCountryHasSuffix applies the HasSuffix predicate on the "supplier_address_country" field.func SupplierAddressCountryHasSuffix(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldHasSuffix(FieldSupplierAddressCountry, vc))}
// SupplierAddressCountryIsNil applies the IsNil predicate on the "supplier_address_country" field.func SupplierAddressCountryIsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldSupplierAddressCountry))}
// SupplierAddressCountryNotNil applies the NotNil predicate on the "supplier_address_country" field.func SupplierAddressCountryNotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldSupplierAddressCountry))}
// SupplierAddressCountryEqualFold applies the EqualFold predicate on the "supplier_address_country" field.func SupplierAddressCountryEqualFold(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldEqualFold(FieldSupplierAddressCountry, vc))}
// SupplierAddressCountryContainsFold applies the ContainsFold predicate on the "supplier_address_country" field.func SupplierAddressCountryContainsFold(v models.CountryCode) predicate.BillingProfile { vc := string(v) return predicate.BillingProfile(sql.FieldContainsFold(FieldSupplierAddressCountry, vc))}
// SupplierAddressPostalCodeEQ applies the EQ predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressPostalCode, v))}
// SupplierAddressPostalCodeNEQ applies the NEQ predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldSupplierAddressPostalCode, v))}
// SupplierAddressPostalCodeIn applies the In predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldSupplierAddressPostalCode, vs...))}
// SupplierAddressPostalCodeNotIn applies the NotIn predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldSupplierAddressPostalCode, vs...))}
// SupplierAddressPostalCodeGT applies the GT predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldSupplierAddressPostalCode, v))}
// SupplierAddressPostalCodeGTE applies the GTE predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldSupplierAddressPostalCode, v))}
// SupplierAddressPostalCodeLT applies the LT predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldSupplierAddressPostalCode, v))}
// SupplierAddressPostalCodeLTE applies the LTE predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldSupplierAddressPostalCode, v))}
// SupplierAddressPostalCodeContains applies the Contains predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldSupplierAddressPostalCode, v))}
// SupplierAddressPostalCodeHasPrefix applies the HasPrefix predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldSupplierAddressPostalCode, v))}
// SupplierAddressPostalCodeHasSuffix applies the HasSuffix predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldSupplierAddressPostalCode, v))}
// SupplierAddressPostalCodeIsNil applies the IsNil predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeIsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldSupplierAddressPostalCode))}
// SupplierAddressPostalCodeNotNil applies the NotNil predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeNotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldSupplierAddressPostalCode))}
// SupplierAddressPostalCodeEqualFold applies the EqualFold predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldSupplierAddressPostalCode, v))}
// SupplierAddressPostalCodeContainsFold applies the ContainsFold predicate on the "supplier_address_postal_code" field.func SupplierAddressPostalCodeContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldSupplierAddressPostalCode, v))}
// SupplierAddressStateEQ applies the EQ predicate on the "supplier_address_state" field.func SupplierAddressStateEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressState, v))}
// SupplierAddressStateNEQ applies the NEQ predicate on the "supplier_address_state" field.func SupplierAddressStateNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldSupplierAddressState, v))}
// SupplierAddressStateIn applies the In predicate on the "supplier_address_state" field.func SupplierAddressStateIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldSupplierAddressState, vs...))}
// SupplierAddressStateNotIn applies the NotIn predicate on the "supplier_address_state" field.func SupplierAddressStateNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldSupplierAddressState, vs...))}
// SupplierAddressStateGT applies the GT predicate on the "supplier_address_state" field.func SupplierAddressStateGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldSupplierAddressState, v))}
// SupplierAddressStateGTE applies the GTE predicate on the "supplier_address_state" field.func SupplierAddressStateGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldSupplierAddressState, v))}
// SupplierAddressStateLT applies the LT predicate on the "supplier_address_state" field.func SupplierAddressStateLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldSupplierAddressState, v))}
// SupplierAddressStateLTE applies the LTE predicate on the "supplier_address_state" field.func SupplierAddressStateLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldSupplierAddressState, v))}
// SupplierAddressStateContains applies the Contains predicate on the "supplier_address_state" field.func SupplierAddressStateContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldSupplierAddressState, v))}
// SupplierAddressStateHasPrefix applies the HasPrefix predicate on the "supplier_address_state" field.func SupplierAddressStateHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldSupplierAddressState, v))}
// SupplierAddressStateHasSuffix applies the HasSuffix predicate on the "supplier_address_state" field.func SupplierAddressStateHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldSupplierAddressState, v))}
// SupplierAddressStateIsNil applies the IsNil predicate on the "supplier_address_state" field.func SupplierAddressStateIsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldSupplierAddressState))}
// SupplierAddressStateNotNil applies the NotNil predicate on the "supplier_address_state" field.func SupplierAddressStateNotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldSupplierAddressState))}
// SupplierAddressStateEqualFold applies the EqualFold predicate on the "supplier_address_state" field.func SupplierAddressStateEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldSupplierAddressState, v))}
// SupplierAddressStateContainsFold applies the ContainsFold predicate on the "supplier_address_state" field.func SupplierAddressStateContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldSupplierAddressState, v))}
// SupplierAddressCityEQ applies the EQ predicate on the "supplier_address_city" field.func SupplierAddressCityEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressCity, v))}
// SupplierAddressCityNEQ applies the NEQ predicate on the "supplier_address_city" field.func SupplierAddressCityNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldSupplierAddressCity, v))}
// SupplierAddressCityIn applies the In predicate on the "supplier_address_city" field.func SupplierAddressCityIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldSupplierAddressCity, vs...))}
// SupplierAddressCityNotIn applies the NotIn predicate on the "supplier_address_city" field.func SupplierAddressCityNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldSupplierAddressCity, vs...))}
// SupplierAddressCityGT applies the GT predicate on the "supplier_address_city" field.func SupplierAddressCityGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldSupplierAddressCity, v))}
// SupplierAddressCityGTE applies the GTE predicate on the "supplier_address_city" field.func SupplierAddressCityGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldSupplierAddressCity, v))}
// SupplierAddressCityLT applies the LT predicate on the "supplier_address_city" field.func SupplierAddressCityLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldSupplierAddressCity, v))}
// SupplierAddressCityLTE applies the LTE predicate on the "supplier_address_city" field.func SupplierAddressCityLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldSupplierAddressCity, v))}
// SupplierAddressCityContains applies the Contains predicate on the "supplier_address_city" field.func SupplierAddressCityContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldSupplierAddressCity, v))}
// SupplierAddressCityHasPrefix applies the HasPrefix predicate on the "supplier_address_city" field.func SupplierAddressCityHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldSupplierAddressCity, v))}
// SupplierAddressCityHasSuffix applies the HasSuffix predicate on the "supplier_address_city" field.func SupplierAddressCityHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldSupplierAddressCity, v))}
// SupplierAddressCityIsNil applies the IsNil predicate on the "supplier_address_city" field.func SupplierAddressCityIsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldSupplierAddressCity))}
// SupplierAddressCityNotNil applies the NotNil predicate on the "supplier_address_city" field.func SupplierAddressCityNotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldSupplierAddressCity))}
// SupplierAddressCityEqualFold applies the EqualFold predicate on the "supplier_address_city" field.func SupplierAddressCityEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldSupplierAddressCity, v))}
// SupplierAddressCityContainsFold applies the ContainsFold predicate on the "supplier_address_city" field.func SupplierAddressCityContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldSupplierAddressCity, v))}
// SupplierAddressLine1EQ applies the EQ predicate on the "supplier_address_line1" field.func SupplierAddressLine1EQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressLine1, v))}
// SupplierAddressLine1NEQ applies the NEQ predicate on the "supplier_address_line1" field.func SupplierAddressLine1NEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldSupplierAddressLine1, v))}
// SupplierAddressLine1In applies the In predicate on the "supplier_address_line1" field.func SupplierAddressLine1In(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldSupplierAddressLine1, vs...))}
// SupplierAddressLine1NotIn applies the NotIn predicate on the "supplier_address_line1" field.func SupplierAddressLine1NotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldSupplierAddressLine1, vs...))}
// SupplierAddressLine1GT applies the GT predicate on the "supplier_address_line1" field.func SupplierAddressLine1GT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldSupplierAddressLine1, v))}
// SupplierAddressLine1GTE applies the GTE predicate on the "supplier_address_line1" field.func SupplierAddressLine1GTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldSupplierAddressLine1, v))}
// SupplierAddressLine1LT applies the LT predicate on the "supplier_address_line1" field.func SupplierAddressLine1LT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldSupplierAddressLine1, v))}
// SupplierAddressLine1LTE applies the LTE predicate on the "supplier_address_line1" field.func SupplierAddressLine1LTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldSupplierAddressLine1, v))}
// SupplierAddressLine1Contains applies the Contains predicate on the "supplier_address_line1" field.func SupplierAddressLine1Contains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldSupplierAddressLine1, v))}
// SupplierAddressLine1HasPrefix applies the HasPrefix predicate on the "supplier_address_line1" field.func SupplierAddressLine1HasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldSupplierAddressLine1, v))}
// SupplierAddressLine1HasSuffix applies the HasSuffix predicate on the "supplier_address_line1" field.func SupplierAddressLine1HasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldSupplierAddressLine1, v))}
// SupplierAddressLine1IsNil applies the IsNil predicate on the "supplier_address_line1" field.func SupplierAddressLine1IsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldSupplierAddressLine1))}
// SupplierAddressLine1NotNil applies the NotNil predicate on the "supplier_address_line1" field.func SupplierAddressLine1NotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldSupplierAddressLine1))}
// SupplierAddressLine1EqualFold applies the EqualFold predicate on the "supplier_address_line1" field.func SupplierAddressLine1EqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldSupplierAddressLine1, v))}
// SupplierAddressLine1ContainsFold applies the ContainsFold predicate on the "supplier_address_line1" field.func SupplierAddressLine1ContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldSupplierAddressLine1, v))}
// SupplierAddressLine2EQ applies the EQ predicate on the "supplier_address_line2" field.func SupplierAddressLine2EQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressLine2, v))}
// SupplierAddressLine2NEQ applies the NEQ predicate on the "supplier_address_line2" field.func SupplierAddressLine2NEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldSupplierAddressLine2, v))}
// SupplierAddressLine2In applies the In predicate on the "supplier_address_line2" field.func SupplierAddressLine2In(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldSupplierAddressLine2, vs...))}
// SupplierAddressLine2NotIn applies the NotIn predicate on the "supplier_address_line2" field.func SupplierAddressLine2NotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldSupplierAddressLine2, vs...))}
// SupplierAddressLine2GT applies the GT predicate on the "supplier_address_line2" field.func SupplierAddressLine2GT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldSupplierAddressLine2, v))}
// SupplierAddressLine2GTE applies the GTE predicate on the "supplier_address_line2" field.func SupplierAddressLine2GTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldSupplierAddressLine2, v))}
// SupplierAddressLine2LT applies the LT predicate on the "supplier_address_line2" field.func SupplierAddressLine2LT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldSupplierAddressLine2, v))}
// SupplierAddressLine2LTE applies the LTE predicate on the "supplier_address_line2" field.func SupplierAddressLine2LTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldSupplierAddressLine2, v))}
// SupplierAddressLine2Contains applies the Contains predicate on the "supplier_address_line2" field.func SupplierAddressLine2Contains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldSupplierAddressLine2, v))}
// SupplierAddressLine2HasPrefix applies the HasPrefix predicate on the "supplier_address_line2" field.func SupplierAddressLine2HasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldSupplierAddressLine2, v))}
// SupplierAddressLine2HasSuffix applies the HasSuffix predicate on the "supplier_address_line2" field.func SupplierAddressLine2HasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldSupplierAddressLine2, v))}
// SupplierAddressLine2IsNil applies the IsNil predicate on the "supplier_address_line2" field.func SupplierAddressLine2IsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldSupplierAddressLine2))}
// SupplierAddressLine2NotNil applies the NotNil predicate on the "supplier_address_line2" field.func SupplierAddressLine2NotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldSupplierAddressLine2))}
// SupplierAddressLine2EqualFold applies the EqualFold predicate on the "supplier_address_line2" field.func SupplierAddressLine2EqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldSupplierAddressLine2, v))}
// SupplierAddressLine2ContainsFold applies the ContainsFold predicate on the "supplier_address_line2" field.func SupplierAddressLine2ContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldSupplierAddressLine2, v))}
// SupplierAddressPhoneNumberEQ applies the EQ predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierAddressPhoneNumber, v))}
// SupplierAddressPhoneNumberNEQ applies the NEQ predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldSupplierAddressPhoneNumber, v))}
// SupplierAddressPhoneNumberIn applies the In predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldSupplierAddressPhoneNumber, vs...))}
// SupplierAddressPhoneNumberNotIn applies the NotIn predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldSupplierAddressPhoneNumber, vs...))}
// SupplierAddressPhoneNumberGT applies the GT predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldSupplierAddressPhoneNumber, v))}
// SupplierAddressPhoneNumberGTE applies the GTE predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldSupplierAddressPhoneNumber, v))}
// SupplierAddressPhoneNumberLT applies the LT predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldSupplierAddressPhoneNumber, v))}
// SupplierAddressPhoneNumberLTE applies the LTE predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldSupplierAddressPhoneNumber, v))}
// SupplierAddressPhoneNumberContains applies the Contains predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldSupplierAddressPhoneNumber, v))}
// SupplierAddressPhoneNumberHasPrefix applies the HasPrefix predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldSupplierAddressPhoneNumber, v))}
// SupplierAddressPhoneNumberHasSuffix applies the HasSuffix predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldSupplierAddressPhoneNumber, v))}
// SupplierAddressPhoneNumberIsNil applies the IsNil predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberIsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldSupplierAddressPhoneNumber))}
// SupplierAddressPhoneNumberNotNil applies the NotNil predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberNotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldSupplierAddressPhoneNumber))}
// SupplierAddressPhoneNumberEqualFold applies the EqualFold predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldSupplierAddressPhoneNumber, v))}
// SupplierAddressPhoneNumberContainsFold applies the ContainsFold predicate on the "supplier_address_phone_number" field.func SupplierAddressPhoneNumberContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldSupplierAddressPhoneNumber, v))}
// TaxAppIDEQ applies the EQ predicate on the "tax_app_id" field.func TaxAppIDEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldTaxAppID, v))}
// TaxAppIDNEQ applies the NEQ predicate on the "tax_app_id" field.func TaxAppIDNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldTaxAppID, v))}
// TaxAppIDIn applies the In predicate on the "tax_app_id" field.func TaxAppIDIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldTaxAppID, vs...))}
// TaxAppIDNotIn applies the NotIn predicate on the "tax_app_id" field.func TaxAppIDNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldTaxAppID, vs...))}
// TaxAppIDGT applies the GT predicate on the "tax_app_id" field.func TaxAppIDGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldTaxAppID, v))}
// TaxAppIDGTE applies the GTE predicate on the "tax_app_id" field.func TaxAppIDGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldTaxAppID, v))}
// TaxAppIDLT applies the LT predicate on the "tax_app_id" field.func TaxAppIDLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldTaxAppID, v))}
// TaxAppIDLTE applies the LTE predicate on the "tax_app_id" field.func TaxAppIDLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldTaxAppID, v))}
// TaxAppIDContains applies the Contains predicate on the "tax_app_id" field.func TaxAppIDContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldTaxAppID, v))}
// TaxAppIDHasPrefix applies the HasPrefix predicate on the "tax_app_id" field.func TaxAppIDHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldTaxAppID, v))}
// TaxAppIDHasSuffix applies the HasSuffix predicate on the "tax_app_id" field.func TaxAppIDHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldTaxAppID, v))}
// TaxAppIDEqualFold applies the EqualFold predicate on the "tax_app_id" field.func TaxAppIDEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldTaxAppID, v))}
// TaxAppIDContainsFold applies the ContainsFold predicate on the "tax_app_id" field.func TaxAppIDContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldTaxAppID, v))}
// InvoicingAppIDEQ applies the EQ predicate on the "invoicing_app_id" field.func InvoicingAppIDEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldInvoicingAppID, v))}
// InvoicingAppIDNEQ applies the NEQ predicate on the "invoicing_app_id" field.func InvoicingAppIDNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldInvoicingAppID, v))}
// InvoicingAppIDIn applies the In predicate on the "invoicing_app_id" field.func InvoicingAppIDIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldInvoicingAppID, vs...))}
// InvoicingAppIDNotIn applies the NotIn predicate on the "invoicing_app_id" field.func InvoicingAppIDNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldInvoicingAppID, vs...))}
// InvoicingAppIDGT applies the GT predicate on the "invoicing_app_id" field.func InvoicingAppIDGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldInvoicingAppID, v))}
// InvoicingAppIDGTE applies the GTE predicate on the "invoicing_app_id" field.func InvoicingAppIDGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldInvoicingAppID, v))}
// InvoicingAppIDLT applies the LT predicate on the "invoicing_app_id" field.func InvoicingAppIDLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldInvoicingAppID, v))}
// InvoicingAppIDLTE applies the LTE predicate on the "invoicing_app_id" field.func InvoicingAppIDLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldInvoicingAppID, v))}
// InvoicingAppIDContains applies the Contains predicate on the "invoicing_app_id" field.func InvoicingAppIDContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldInvoicingAppID, v))}
// InvoicingAppIDHasPrefix applies the HasPrefix predicate on the "invoicing_app_id" field.func InvoicingAppIDHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldInvoicingAppID, v))}
// InvoicingAppIDHasSuffix applies the HasSuffix predicate on the "invoicing_app_id" field.func InvoicingAppIDHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldInvoicingAppID, v))}
// InvoicingAppIDEqualFold applies the EqualFold predicate on the "invoicing_app_id" field.func InvoicingAppIDEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldInvoicingAppID, v))}
// InvoicingAppIDContainsFold applies the ContainsFold predicate on the "invoicing_app_id" field.func InvoicingAppIDContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldInvoicingAppID, v))}
// PaymentAppIDEQ applies the EQ predicate on the "payment_app_id" field.func PaymentAppIDEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldPaymentAppID, v))}
// PaymentAppIDNEQ applies the NEQ predicate on the "payment_app_id" field.func PaymentAppIDNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldPaymentAppID, v))}
// PaymentAppIDIn applies the In predicate on the "payment_app_id" field.func PaymentAppIDIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldPaymentAppID, vs...))}
// PaymentAppIDNotIn applies the NotIn predicate on the "payment_app_id" field.func PaymentAppIDNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldPaymentAppID, vs...))}
// PaymentAppIDGT applies the GT predicate on the "payment_app_id" field.func PaymentAppIDGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldPaymentAppID, v))}
// PaymentAppIDGTE applies the GTE predicate on the "payment_app_id" field.func PaymentAppIDGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldPaymentAppID, v))}
// PaymentAppIDLT applies the LT predicate on the "payment_app_id" field.func PaymentAppIDLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldPaymentAppID, v))}
// PaymentAppIDLTE applies the LTE predicate on the "payment_app_id" field.func PaymentAppIDLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldPaymentAppID, v))}
// PaymentAppIDContains applies the Contains predicate on the "payment_app_id" field.func PaymentAppIDContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldPaymentAppID, v))}
// PaymentAppIDHasPrefix applies the HasPrefix predicate on the "payment_app_id" field.func PaymentAppIDHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldPaymentAppID, v))}
// PaymentAppIDHasSuffix applies the HasSuffix predicate on the "payment_app_id" field.func PaymentAppIDHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldPaymentAppID, v))}
// PaymentAppIDEqualFold applies the EqualFold predicate on the "payment_app_id" field.func PaymentAppIDEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldPaymentAppID, v))}
// PaymentAppIDContainsFold applies the ContainsFold predicate on the "payment_app_id" field.func PaymentAppIDContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldPaymentAppID, v))}
// WorkflowConfigIDEQ applies the EQ predicate on the "workflow_config_id" field.func WorkflowConfigIDEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldWorkflowConfigID, v))}
// WorkflowConfigIDNEQ applies the NEQ predicate on the "workflow_config_id" field.func WorkflowConfigIDNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldWorkflowConfigID, v))}
// WorkflowConfigIDIn applies the In predicate on the "workflow_config_id" field.func WorkflowConfigIDIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldWorkflowConfigID, vs...))}
// WorkflowConfigIDNotIn applies the NotIn predicate on the "workflow_config_id" field.func WorkflowConfigIDNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldWorkflowConfigID, vs...))}
// WorkflowConfigIDGT applies the GT predicate on the "workflow_config_id" field.func WorkflowConfigIDGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldWorkflowConfigID, v))}
// WorkflowConfigIDGTE applies the GTE predicate on the "workflow_config_id" field.func WorkflowConfigIDGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldWorkflowConfigID, v))}
// WorkflowConfigIDLT applies the LT predicate on the "workflow_config_id" field.func WorkflowConfigIDLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldWorkflowConfigID, v))}
// WorkflowConfigIDLTE applies the LTE predicate on the "workflow_config_id" field.func WorkflowConfigIDLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldWorkflowConfigID, v))}
// WorkflowConfigIDContains applies the Contains predicate on the "workflow_config_id" field.func WorkflowConfigIDContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldWorkflowConfigID, v))}
// WorkflowConfigIDHasPrefix applies the HasPrefix predicate on the "workflow_config_id" field.func WorkflowConfigIDHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldWorkflowConfigID, v))}
// WorkflowConfigIDHasSuffix applies the HasSuffix predicate on the "workflow_config_id" field.func WorkflowConfigIDHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldWorkflowConfigID, v))}
// WorkflowConfigIDEqualFold applies the EqualFold predicate on the "workflow_config_id" field.func WorkflowConfigIDEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldWorkflowConfigID, v))}
// WorkflowConfigIDContainsFold applies the ContainsFold predicate on the "workflow_config_id" field.func WorkflowConfigIDContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldWorkflowConfigID, v))}
// DefaultEQ applies the EQ predicate on the "default" field.func DefaultEQ(v bool) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldDefault, v))}
// DefaultNEQ applies the NEQ predicate on the "default" field.func DefaultNEQ(v bool) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldDefault, v))}
// SupplierNameEQ applies the EQ predicate on the "supplier_name" field.func SupplierNameEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierName, v))}
// SupplierNameNEQ applies the NEQ predicate on the "supplier_name" field.func SupplierNameNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldSupplierName, v))}
// SupplierNameIn applies the In predicate on the "supplier_name" field.func SupplierNameIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldSupplierName, vs...))}
// SupplierNameNotIn applies the NotIn predicate on the "supplier_name" field.func SupplierNameNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldSupplierName, vs...))}
// SupplierNameGT applies the GT predicate on the "supplier_name" field.func SupplierNameGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldSupplierName, v))}
// SupplierNameGTE applies the GTE predicate on the "supplier_name" field.func SupplierNameGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldSupplierName, v))}
// SupplierNameLT applies the LT predicate on the "supplier_name" field.func SupplierNameLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldSupplierName, v))}
// SupplierNameLTE applies the LTE predicate on the "supplier_name" field.func SupplierNameLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldSupplierName, v))}
// SupplierNameContains applies the Contains predicate on the "supplier_name" field.func SupplierNameContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldSupplierName, v))}
// SupplierNameHasPrefix applies the HasPrefix predicate on the "supplier_name" field.func SupplierNameHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldSupplierName, v))}
// SupplierNameHasSuffix applies the HasSuffix predicate on the "supplier_name" field.func SupplierNameHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldSupplierName, v))}
// SupplierNameEqualFold applies the EqualFold predicate on the "supplier_name" field.func SupplierNameEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldSupplierName, v))}
// SupplierNameContainsFold applies the ContainsFold predicate on the "supplier_name" field.func SupplierNameContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldSupplierName, v))}
// SupplierTaxCodeEQ applies the EQ predicate on the "supplier_tax_code" field.func SupplierTaxCodeEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEQ(FieldSupplierTaxCode, v))}
// SupplierTaxCodeNEQ applies the NEQ predicate on the "supplier_tax_code" field.func SupplierTaxCodeNEQ(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNEQ(FieldSupplierTaxCode, v))}
// SupplierTaxCodeIn applies the In predicate on the "supplier_tax_code" field.func SupplierTaxCodeIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIn(FieldSupplierTaxCode, vs...))}
// SupplierTaxCodeNotIn applies the NotIn predicate on the "supplier_tax_code" field.func SupplierTaxCodeNotIn(vs ...string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotIn(FieldSupplierTaxCode, vs...))}
// SupplierTaxCodeGT applies the GT predicate on the "supplier_tax_code" field.func SupplierTaxCodeGT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGT(FieldSupplierTaxCode, v))}
// SupplierTaxCodeGTE applies the GTE predicate on the "supplier_tax_code" field.func SupplierTaxCodeGTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldGTE(FieldSupplierTaxCode, v))}
// SupplierTaxCodeLT applies the LT predicate on the "supplier_tax_code" field.func SupplierTaxCodeLT(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLT(FieldSupplierTaxCode, v))}
// SupplierTaxCodeLTE applies the LTE predicate on the "supplier_tax_code" field.func SupplierTaxCodeLTE(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldLTE(FieldSupplierTaxCode, v))}
// SupplierTaxCodeContains applies the Contains predicate on the "supplier_tax_code" field.func SupplierTaxCodeContains(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContains(FieldSupplierTaxCode, v))}
// SupplierTaxCodeHasPrefix applies the HasPrefix predicate on the "supplier_tax_code" field.func SupplierTaxCodeHasPrefix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasPrefix(FieldSupplierTaxCode, v))}
// SupplierTaxCodeHasSuffix applies the HasSuffix predicate on the "supplier_tax_code" field.func SupplierTaxCodeHasSuffix(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldHasSuffix(FieldSupplierTaxCode, v))}
// SupplierTaxCodeIsNil applies the IsNil predicate on the "supplier_tax_code" field.func SupplierTaxCodeIsNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldIsNull(FieldSupplierTaxCode))}
// SupplierTaxCodeNotNil applies the NotNil predicate on the "supplier_tax_code" field.func SupplierTaxCodeNotNil() predicate.BillingProfile { return predicate.BillingProfile(sql.FieldNotNull(FieldSupplierTaxCode))}
// SupplierTaxCodeEqualFold applies the EqualFold predicate on the "supplier_tax_code" field.func SupplierTaxCodeEqualFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldEqualFold(FieldSupplierTaxCode, v))}
// SupplierTaxCodeContainsFold applies the ContainsFold predicate on the "supplier_tax_code" field.func SupplierTaxCodeContainsFold(v string) predicate.BillingProfile { return predicate.BillingProfile(sql.FieldContainsFold(FieldSupplierTaxCode, v))}
// HasBillingInvoices applies the HasEdge predicate on the "billing_invoices" edge.func HasBillingInvoices() predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoicesTable, BillingInvoicesColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasBillingInvoicesWith applies the HasEdge predicate on the "billing_invoices" edge with a given conditions (other predicates).func HasBillingInvoicesWith(preds ...predicate.BillingInvoice) predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := newBillingInvoicesStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// HasBillingCustomerOverride applies the HasEdge predicate on the "billing_customer_override" edge.func HasBillingCustomerOverride() predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, BillingCustomerOverrideTable, BillingCustomerOverrideColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasBillingCustomerOverrideWith applies the HasEdge predicate on the "billing_customer_override" edge with a given conditions (other predicates).func HasBillingCustomerOverrideWith(preds ...predicate.BillingCustomerOverride) predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := newBillingCustomerOverrideStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// HasWorkflowConfig applies the HasEdge predicate on the "workflow_config" edge.func HasWorkflowConfig() predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2O, true, WorkflowConfigTable, WorkflowConfigColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasWorkflowConfigWith applies the HasEdge predicate on the "workflow_config" edge with a given conditions (other predicates).func HasWorkflowConfigWith(preds ...predicate.BillingWorkflowConfig) predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := newWorkflowConfigStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// HasTaxApp applies the HasEdge predicate on the "tax_app" edge.func HasTaxApp() predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, TaxAppTable, TaxAppColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasTaxAppWith applies the HasEdge predicate on the "tax_app" edge with a given conditions (other predicates).func HasTaxAppWith(preds ...predicate.App) predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := newTaxAppStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// HasInvoicingApp applies the HasEdge predicate on the "invoicing_app" edge.func HasInvoicingApp() predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, InvoicingAppTable, InvoicingAppColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasInvoicingAppWith applies the HasEdge predicate on the "invoicing_app" edge with a given conditions (other predicates).func HasInvoicingAppWith(preds ...predicate.App) predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := newInvoicingAppStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// HasPaymentApp applies the HasEdge predicate on the "payment_app" edge.func HasPaymentApp() predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, PaymentAppTable, PaymentAppColumn), ) sqlgraph.HasNeighbors(s, step) })}
// HasPaymentAppWith applies the HasEdge predicate on the "payment_app" edge with a given conditions (other predicates).func HasPaymentAppWith(preds ...predicate.App) predicate.BillingProfile { return predicate.BillingProfile(func(s *sql.Selector) { step := newPaymentAppStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) })}
// And groups predicates with the AND operator between them.func And(predicates ...predicate.BillingProfile) predicate.BillingProfile { return predicate.BillingProfile(sql.AndPredicates(predicates...))}
// Or groups predicates with the OR operator between them.func Or(predicates ...predicate.BillingProfile) predicate.BillingProfile { return predicate.BillingProfile(sql.OrPredicates(predicates...))}
// Not applies the not operator on the given predicate.func Not(p predicate.BillingProfile) predicate.BillingProfile { return predicate.BillingProfile(sql.NotPredicates(p))}ent/db/billinginvoicelinediscount.goAdded+279
ent/db/billinginvoicelinediscount_create.goAdded+1244
ent/db/billinginvoicelinediscount_delete.goAdded+88
ent/db/billinginvoicelinediscount_query.goAdded+643
ent/db/billinginvoicelinediscount_update.goAdded+749
ent/db/billinginvoicelineusagediscount.goAdded+279
ent/db/billinginvoicelineusagediscount/billinginvoicelineusagediscount.goAdded+191
ent/db/billinginvoicelineusagediscount/where.goAdded+771
ent/db/billinginvoicelineusagediscount_create.goAdded+1244
ent/db/billinginvoicelineusagediscount_delete.goAdded+88
ent/db/billinginvoicelineusagediscount_query.goAdded+643
ent/db/billinginvoicelineusagediscount_update.goAdded+749
ent/db/billinginvoicesplitlinegroup.goAdded+459
ent/db/billinginvoicesplitlinegroup/billinginvoicesplitlinegroup.goAdded+342
ent/db/billinginvoicesplitlinegroup/where.goAdded+1352
ent/db/billinginvoicesplitlinegroup_create.goAdded+1562
ent/db/billinginvoicesplitlinegroup_delete.goAdded+88
ent/db/billinginvoicesplitlinegroup_query.goAdded+961
ent/db/billinginvoicesplitlinegroup_update.goAdded+899
ent/db/billinginvoiceusagebasedlineconfig.goAdded+200
ent/db/billinginvoiceusagebasedlineconfig/billinginvoiceusagebasedlineconfig.goAdded+129
ent/db/billinginvoiceusagebasedlineconfig/where.goAdded+435
ent/db/billinginvoiceusagebasedlineconfig_create.goAdded+943
ent/db/billinginvoiceusagebasedlineconfig_delete.goAdded+88
ent/db/billinginvoiceusagebasedlineconfig_query.goAdded+564
ent/db/billinginvoiceusagebasedlineconfig_update.goAdded+489
ent/db/billinginvoicevalidationissue.goAdded+255
ent/db/billinginvoicevalidationissue/billinginvoicevalidationissue.goAdded+179
ent/db/billinginvoicevalidationissue/where.goAdded+765
ent/db/billinginvoicevalidationissue_create.goAdded+1123
ent/db/billinginvoicevalidationissue_delete.goAdded+88
ent/db/billinginvoicevalidationissue_query.goAdded+643
ent/db/billinginvoicevalidationissue_update.goAdded+672
ent/db/billinginvoicewriteschemalevel.goAdded+103
ent/db/billinginvoicewriteschemalevel/billinginvoicewriteschemalevel.goAdded+52
ent/db/billinginvoicewriteschemalevel/where.goAdded+123
ent/db/billinginvoicewriteschemalevel_create.goAdded+514
ent/db/billinginvoicewriteschemalevel_delete.goAdded+88
ent/db/billinginvoicewriteschemalevel_query.goAdded+564
ent/db/billinginvoicewriteschemalevel_update.goAdded+229
ent/db/billingprofile.goAdded+478
ent/db/billingprofile/billingprofile.goAdded+378
ent/db/billingprofile/where.goAdded+1620
ent/db/billingprofile_create.goAdded
ent/db/billingprofile_delete.goAdded
ent/db/billingprofile_query.goAdded
ent/db/billingprofile_update.goAdded
ent/db/billingsequencenumbers.goAdded
ent/db/billingsequencenumbers/billingsequencenumbers.goAdded
ent/db/billingsequencenumbers/where.goAdded