| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- "github.com/Wei-Shaw/sub2api/ent/account"
- "github.com/Wei-Shaw/sub2api/ent/apikey"
- "github.com/Wei-Shaw/sub2api/ent/group"
- "github.com/Wei-Shaw/sub2api/ent/usagelog"
- "github.com/Wei-Shaw/sub2api/ent/user"
- "github.com/Wei-Shaw/sub2api/ent/usersubscription"
- )
- // UsageLogCreate is the builder for creating a UsageLog entity.
- type UsageLogCreate struct {
- config
- mutation *UsageLogMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetUserID sets the "user_id" field.
- func (_c *UsageLogCreate) SetUserID(v int64) *UsageLogCreate {
- _c.mutation.SetUserID(v)
- return _c
- }
- // SetAPIKeyID sets the "api_key_id" field.
- func (_c *UsageLogCreate) SetAPIKeyID(v int64) *UsageLogCreate {
- _c.mutation.SetAPIKeyID(v)
- return _c
- }
- // SetAccountID sets the "account_id" field.
- func (_c *UsageLogCreate) SetAccountID(v int64) *UsageLogCreate {
- _c.mutation.SetAccountID(v)
- return _c
- }
- // SetRequestID sets the "request_id" field.
- func (_c *UsageLogCreate) SetRequestID(v string) *UsageLogCreate {
- _c.mutation.SetRequestID(v)
- return _c
- }
- // SetModel sets the "model" field.
- func (_c *UsageLogCreate) SetModel(v string) *UsageLogCreate {
- _c.mutation.SetModel(v)
- return _c
- }
- // SetRequestedModel sets the "requested_model" field.
- func (_c *UsageLogCreate) SetRequestedModel(v string) *UsageLogCreate {
- _c.mutation.SetRequestedModel(v)
- return _c
- }
- // SetNillableRequestedModel sets the "requested_model" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableRequestedModel(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetRequestedModel(*v)
- }
- return _c
- }
- // SetUpstreamModel sets the "upstream_model" field.
- func (_c *UsageLogCreate) SetUpstreamModel(v string) *UsageLogCreate {
- _c.mutation.SetUpstreamModel(v)
- return _c
- }
- // SetNillableUpstreamModel sets the "upstream_model" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableUpstreamModel(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetUpstreamModel(*v)
- }
- return _c
- }
- // SetUpstreamResponseModel sets the "upstream_response_model" field.
- func (_c *UsageLogCreate) SetUpstreamResponseModel(v string) *UsageLogCreate {
- _c.mutation.SetUpstreamResponseModel(v)
- return _c
- }
- // SetNillableUpstreamResponseModel sets the "upstream_response_model" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableUpstreamResponseModel(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetUpstreamResponseModel(*v)
- }
- return _c
- }
- // SetUpstreamModelMismatch sets the "upstream_model_mismatch" field.
- func (_c *UsageLogCreate) SetUpstreamModelMismatch(v bool) *UsageLogCreate {
- _c.mutation.SetUpstreamModelMismatch(v)
- return _c
- }
- // SetNillableUpstreamModelMismatch sets the "upstream_model_mismatch" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableUpstreamModelMismatch(v *bool) *UsageLogCreate {
- if v != nil {
- _c.SetUpstreamModelMismatch(*v)
- }
- return _c
- }
- // SetChannelID sets the "channel_id" field.
- func (_c *UsageLogCreate) SetChannelID(v int64) *UsageLogCreate {
- _c.mutation.SetChannelID(v)
- return _c
- }
- // SetNillableChannelID sets the "channel_id" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableChannelID(v *int64) *UsageLogCreate {
- if v != nil {
- _c.SetChannelID(*v)
- }
- return _c
- }
- // SetModelMappingChain sets the "model_mapping_chain" field.
- func (_c *UsageLogCreate) SetModelMappingChain(v string) *UsageLogCreate {
- _c.mutation.SetModelMappingChain(v)
- return _c
- }
- // SetNillableModelMappingChain sets the "model_mapping_chain" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableModelMappingChain(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetModelMappingChain(*v)
- }
- return _c
- }
- // SetBillingTier sets the "billing_tier" field.
- func (_c *UsageLogCreate) SetBillingTier(v string) *UsageLogCreate {
- _c.mutation.SetBillingTier(v)
- return _c
- }
- // SetNillableBillingTier sets the "billing_tier" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableBillingTier(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetBillingTier(*v)
- }
- return _c
- }
- // SetBillingMode sets the "billing_mode" field.
- func (_c *UsageLogCreate) SetBillingMode(v string) *UsageLogCreate {
- _c.mutation.SetBillingMode(v)
- return _c
- }
- // SetNillableBillingMode sets the "billing_mode" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableBillingMode(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetBillingMode(*v)
- }
- return _c
- }
- // SetGroupID sets the "group_id" field.
- func (_c *UsageLogCreate) SetGroupID(v int64) *UsageLogCreate {
- _c.mutation.SetGroupID(v)
- return _c
- }
- // SetNillableGroupID sets the "group_id" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableGroupID(v *int64) *UsageLogCreate {
- if v != nil {
- _c.SetGroupID(*v)
- }
- return _c
- }
- // SetSubscriptionID sets the "subscription_id" field.
- func (_c *UsageLogCreate) SetSubscriptionID(v int64) *UsageLogCreate {
- _c.mutation.SetSubscriptionID(v)
- return _c
- }
- // SetNillableSubscriptionID sets the "subscription_id" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableSubscriptionID(v *int64) *UsageLogCreate {
- if v != nil {
- _c.SetSubscriptionID(*v)
- }
- return _c
- }
- // SetInputTokens sets the "input_tokens" field.
- func (_c *UsageLogCreate) SetInputTokens(v int) *UsageLogCreate {
- _c.mutation.SetInputTokens(v)
- return _c
- }
- // SetNillableInputTokens sets the "input_tokens" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableInputTokens(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetInputTokens(*v)
- }
- return _c
- }
- // SetOutputTokens sets the "output_tokens" field.
- func (_c *UsageLogCreate) SetOutputTokens(v int) *UsageLogCreate {
- _c.mutation.SetOutputTokens(v)
- return _c
- }
- // SetNillableOutputTokens sets the "output_tokens" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableOutputTokens(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetOutputTokens(*v)
- }
- return _c
- }
- // SetCacheCreationTokens sets the "cache_creation_tokens" field.
- func (_c *UsageLogCreate) SetCacheCreationTokens(v int) *UsageLogCreate {
- _c.mutation.SetCacheCreationTokens(v)
- return _c
- }
- // SetNillableCacheCreationTokens sets the "cache_creation_tokens" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableCacheCreationTokens(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetCacheCreationTokens(*v)
- }
- return _c
- }
- // SetCacheReadTokens sets the "cache_read_tokens" field.
- func (_c *UsageLogCreate) SetCacheReadTokens(v int) *UsageLogCreate {
- _c.mutation.SetCacheReadTokens(v)
- return _c
- }
- // SetNillableCacheReadTokens sets the "cache_read_tokens" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableCacheReadTokens(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetCacheReadTokens(*v)
- }
- return _c
- }
- // SetCacheCreation5mTokens sets the "cache_creation_5m_tokens" field.
- func (_c *UsageLogCreate) SetCacheCreation5mTokens(v int) *UsageLogCreate {
- _c.mutation.SetCacheCreation5mTokens(v)
- return _c
- }
- // SetNillableCacheCreation5mTokens sets the "cache_creation_5m_tokens" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableCacheCreation5mTokens(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetCacheCreation5mTokens(*v)
- }
- return _c
- }
- // SetCacheCreation1hTokens sets the "cache_creation_1h_tokens" field.
- func (_c *UsageLogCreate) SetCacheCreation1hTokens(v int) *UsageLogCreate {
- _c.mutation.SetCacheCreation1hTokens(v)
- return _c
- }
- // SetNillableCacheCreation1hTokens sets the "cache_creation_1h_tokens" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableCacheCreation1hTokens(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetCacheCreation1hTokens(*v)
- }
- return _c
- }
- // SetInputCost sets the "input_cost" field.
- func (_c *UsageLogCreate) SetInputCost(v float64) *UsageLogCreate {
- _c.mutation.SetInputCost(v)
- return _c
- }
- // SetNillableInputCost sets the "input_cost" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableInputCost(v *float64) *UsageLogCreate {
- if v != nil {
- _c.SetInputCost(*v)
- }
- return _c
- }
- // SetOutputCost sets the "output_cost" field.
- func (_c *UsageLogCreate) SetOutputCost(v float64) *UsageLogCreate {
- _c.mutation.SetOutputCost(v)
- return _c
- }
- // SetNillableOutputCost sets the "output_cost" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableOutputCost(v *float64) *UsageLogCreate {
- if v != nil {
- _c.SetOutputCost(*v)
- }
- return _c
- }
- // SetCacheCreationCost sets the "cache_creation_cost" field.
- func (_c *UsageLogCreate) SetCacheCreationCost(v float64) *UsageLogCreate {
- _c.mutation.SetCacheCreationCost(v)
- return _c
- }
- // SetNillableCacheCreationCost sets the "cache_creation_cost" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableCacheCreationCost(v *float64) *UsageLogCreate {
- if v != nil {
- _c.SetCacheCreationCost(*v)
- }
- return _c
- }
- // SetCacheReadCost sets the "cache_read_cost" field.
- func (_c *UsageLogCreate) SetCacheReadCost(v float64) *UsageLogCreate {
- _c.mutation.SetCacheReadCost(v)
- return _c
- }
- // SetNillableCacheReadCost sets the "cache_read_cost" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableCacheReadCost(v *float64) *UsageLogCreate {
- if v != nil {
- _c.SetCacheReadCost(*v)
- }
- return _c
- }
- // SetTotalCost sets the "total_cost" field.
- func (_c *UsageLogCreate) SetTotalCost(v float64) *UsageLogCreate {
- _c.mutation.SetTotalCost(v)
- return _c
- }
- // SetNillableTotalCost sets the "total_cost" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableTotalCost(v *float64) *UsageLogCreate {
- if v != nil {
- _c.SetTotalCost(*v)
- }
- return _c
- }
- // SetActualCost sets the "actual_cost" field.
- func (_c *UsageLogCreate) SetActualCost(v float64) *UsageLogCreate {
- _c.mutation.SetActualCost(v)
- return _c
- }
- // SetNillableActualCost sets the "actual_cost" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableActualCost(v *float64) *UsageLogCreate {
- if v != nil {
- _c.SetActualCost(*v)
- }
- return _c
- }
- // SetRateMultiplier sets the "rate_multiplier" field.
- func (_c *UsageLogCreate) SetRateMultiplier(v float64) *UsageLogCreate {
- _c.mutation.SetRateMultiplier(v)
- return _c
- }
- // SetNillableRateMultiplier sets the "rate_multiplier" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableRateMultiplier(v *float64) *UsageLogCreate {
- if v != nil {
- _c.SetRateMultiplier(*v)
- }
- return _c
- }
- // SetLongContextBillingApplied sets the "long_context_billing_applied" field.
- func (_c *UsageLogCreate) SetLongContextBillingApplied(v bool) *UsageLogCreate {
- _c.mutation.SetLongContextBillingApplied(v)
- return _c
- }
- // SetNillableLongContextBillingApplied sets the "long_context_billing_applied" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableLongContextBillingApplied(v *bool) *UsageLogCreate {
- if v != nil {
- _c.SetLongContextBillingApplied(*v)
- }
- return _c
- }
- // SetAccountRateMultiplier sets the "account_rate_multiplier" field.
- func (_c *UsageLogCreate) SetAccountRateMultiplier(v float64) *UsageLogCreate {
- _c.mutation.SetAccountRateMultiplier(v)
- return _c
- }
- // SetNillableAccountRateMultiplier sets the "account_rate_multiplier" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableAccountRateMultiplier(v *float64) *UsageLogCreate {
- if v != nil {
- _c.SetAccountRateMultiplier(*v)
- }
- return _c
- }
- // SetBillingType sets the "billing_type" field.
- func (_c *UsageLogCreate) SetBillingType(v int8) *UsageLogCreate {
- _c.mutation.SetBillingType(v)
- return _c
- }
- // SetNillableBillingType sets the "billing_type" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableBillingType(v *int8) *UsageLogCreate {
- if v != nil {
- _c.SetBillingType(*v)
- }
- return _c
- }
- // SetStream sets the "stream" field.
- func (_c *UsageLogCreate) SetStream(v bool) *UsageLogCreate {
- _c.mutation.SetStream(v)
- return _c
- }
- // SetNillableStream sets the "stream" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableStream(v *bool) *UsageLogCreate {
- if v != nil {
- _c.SetStream(*v)
- }
- return _c
- }
- // SetDurationMs sets the "duration_ms" field.
- func (_c *UsageLogCreate) SetDurationMs(v int) *UsageLogCreate {
- _c.mutation.SetDurationMs(v)
- return _c
- }
- // SetNillableDurationMs sets the "duration_ms" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableDurationMs(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetDurationMs(*v)
- }
- return _c
- }
- // SetFirstTokenMs sets the "first_token_ms" field.
- func (_c *UsageLogCreate) SetFirstTokenMs(v int) *UsageLogCreate {
- _c.mutation.SetFirstTokenMs(v)
- return _c
- }
- // SetNillableFirstTokenMs sets the "first_token_ms" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableFirstTokenMs(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetFirstTokenMs(*v)
- }
- return _c
- }
- // SetUserAgent sets the "user_agent" field.
- func (_c *UsageLogCreate) SetUserAgent(v string) *UsageLogCreate {
- _c.mutation.SetUserAgent(v)
- return _c
- }
- // SetNillableUserAgent sets the "user_agent" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableUserAgent(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetUserAgent(*v)
- }
- return _c
- }
- // SetIPAddress sets the "ip_address" field.
- func (_c *UsageLogCreate) SetIPAddress(v string) *UsageLogCreate {
- _c.mutation.SetIPAddress(v)
- return _c
- }
- // SetNillableIPAddress sets the "ip_address" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableIPAddress(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetIPAddress(*v)
- }
- return _c
- }
- // SetImageCount sets the "image_count" field.
- func (_c *UsageLogCreate) SetImageCount(v int) *UsageLogCreate {
- _c.mutation.SetImageCount(v)
- return _c
- }
- // SetNillableImageCount sets the "image_count" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableImageCount(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetImageCount(*v)
- }
- return _c
- }
- // SetImageSize sets the "image_size" field.
- func (_c *UsageLogCreate) SetImageSize(v string) *UsageLogCreate {
- _c.mutation.SetImageSize(v)
- return _c
- }
- // SetNillableImageSize sets the "image_size" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableImageSize(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetImageSize(*v)
- }
- return _c
- }
- // SetImageInputSize sets the "image_input_size" field.
- func (_c *UsageLogCreate) SetImageInputSize(v string) *UsageLogCreate {
- _c.mutation.SetImageInputSize(v)
- return _c
- }
- // SetNillableImageInputSize sets the "image_input_size" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableImageInputSize(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetImageInputSize(*v)
- }
- return _c
- }
- // SetImageOutputSize sets the "image_output_size" field.
- func (_c *UsageLogCreate) SetImageOutputSize(v string) *UsageLogCreate {
- _c.mutation.SetImageOutputSize(v)
- return _c
- }
- // SetNillableImageOutputSize sets the "image_output_size" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableImageOutputSize(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetImageOutputSize(*v)
- }
- return _c
- }
- // SetImageSizeSource sets the "image_size_source" field.
- func (_c *UsageLogCreate) SetImageSizeSource(v string) *UsageLogCreate {
- _c.mutation.SetImageSizeSource(v)
- return _c
- }
- // SetNillableImageSizeSource sets the "image_size_source" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableImageSizeSource(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetImageSizeSource(*v)
- }
- return _c
- }
- // SetImageSizeBreakdown sets the "image_size_breakdown" field.
- func (_c *UsageLogCreate) SetImageSizeBreakdown(v map[string]int) *UsageLogCreate {
- _c.mutation.SetImageSizeBreakdown(v)
- return _c
- }
- // SetVideoCount sets the "video_count" field.
- func (_c *UsageLogCreate) SetVideoCount(v int) *UsageLogCreate {
- _c.mutation.SetVideoCount(v)
- return _c
- }
- // SetNillableVideoCount sets the "video_count" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableVideoCount(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetVideoCount(*v)
- }
- return _c
- }
- // SetVideoResolution sets the "video_resolution" field.
- func (_c *UsageLogCreate) SetVideoResolution(v string) *UsageLogCreate {
- _c.mutation.SetVideoResolution(v)
- return _c
- }
- // SetNillableVideoResolution sets the "video_resolution" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableVideoResolution(v *string) *UsageLogCreate {
- if v != nil {
- _c.SetVideoResolution(*v)
- }
- return _c
- }
- // SetVideoDurationSeconds sets the "video_duration_seconds" field.
- func (_c *UsageLogCreate) SetVideoDurationSeconds(v int) *UsageLogCreate {
- _c.mutation.SetVideoDurationSeconds(v)
- return _c
- }
- // SetNillableVideoDurationSeconds sets the "video_duration_seconds" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableVideoDurationSeconds(v *int) *UsageLogCreate {
- if v != nil {
- _c.SetVideoDurationSeconds(*v)
- }
- return _c
- }
- // SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
- func (_c *UsageLogCreate) SetCacheTTLOverridden(v bool) *UsageLogCreate {
- _c.mutation.SetCacheTTLOverridden(v)
- return _c
- }
- // SetNillableCacheTTLOverridden sets the "cache_ttl_overridden" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableCacheTTLOverridden(v *bool) *UsageLogCreate {
- if v != nil {
- _c.SetCacheTTLOverridden(*v)
- }
- return _c
- }
- // SetCreatedAt sets the "created_at" field.
- func (_c *UsageLogCreate) SetCreatedAt(v time.Time) *UsageLogCreate {
- _c.mutation.SetCreatedAt(v)
- return _c
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (_c *UsageLogCreate) SetNillableCreatedAt(v *time.Time) *UsageLogCreate {
- if v != nil {
- _c.SetCreatedAt(*v)
- }
- return _c
- }
- // SetUser sets the "user" edge to the User entity.
- func (_c *UsageLogCreate) SetUser(v *User) *UsageLogCreate {
- return _c.SetUserID(v.ID)
- }
- // SetAPIKey sets the "api_key" edge to the APIKey entity.
- func (_c *UsageLogCreate) SetAPIKey(v *APIKey) *UsageLogCreate {
- return _c.SetAPIKeyID(v.ID)
- }
- // SetAccount sets the "account" edge to the Account entity.
- func (_c *UsageLogCreate) SetAccount(v *Account) *UsageLogCreate {
- return _c.SetAccountID(v.ID)
- }
- // SetGroup sets the "group" edge to the Group entity.
- func (_c *UsageLogCreate) SetGroup(v *Group) *UsageLogCreate {
- return _c.SetGroupID(v.ID)
- }
- // SetSubscription sets the "subscription" edge to the UserSubscription entity.
- func (_c *UsageLogCreate) SetSubscription(v *UserSubscription) *UsageLogCreate {
- return _c.SetSubscriptionID(v.ID)
- }
- // Mutation returns the UsageLogMutation object of the builder.
- func (_c *UsageLogCreate) Mutation() *UsageLogMutation {
- return _c.mutation
- }
- // Save creates the UsageLog in the database.
- func (_c *UsageLogCreate) Save(ctx context.Context) (*UsageLog, error) {
- _c.defaults()
- return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (_c *UsageLogCreate) SaveX(ctx context.Context) *UsageLog {
- v, err := _c.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (_c *UsageLogCreate) Exec(ctx context.Context) error {
- _, err := _c.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (_c *UsageLogCreate) 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 *UsageLogCreate) defaults() {
- if _, ok := _c.mutation.InputTokens(); !ok {
- v := usagelog.DefaultInputTokens
- _c.mutation.SetInputTokens(v)
- }
- if _, ok := _c.mutation.OutputTokens(); !ok {
- v := usagelog.DefaultOutputTokens
- _c.mutation.SetOutputTokens(v)
- }
- if _, ok := _c.mutation.CacheCreationTokens(); !ok {
- v := usagelog.DefaultCacheCreationTokens
- _c.mutation.SetCacheCreationTokens(v)
- }
- if _, ok := _c.mutation.CacheReadTokens(); !ok {
- v := usagelog.DefaultCacheReadTokens
- _c.mutation.SetCacheReadTokens(v)
- }
- if _, ok := _c.mutation.CacheCreation5mTokens(); !ok {
- v := usagelog.DefaultCacheCreation5mTokens
- _c.mutation.SetCacheCreation5mTokens(v)
- }
- if _, ok := _c.mutation.CacheCreation1hTokens(); !ok {
- v := usagelog.DefaultCacheCreation1hTokens
- _c.mutation.SetCacheCreation1hTokens(v)
- }
- if _, ok := _c.mutation.InputCost(); !ok {
- v := usagelog.DefaultInputCost
- _c.mutation.SetInputCost(v)
- }
- if _, ok := _c.mutation.OutputCost(); !ok {
- v := usagelog.DefaultOutputCost
- _c.mutation.SetOutputCost(v)
- }
- if _, ok := _c.mutation.CacheCreationCost(); !ok {
- v := usagelog.DefaultCacheCreationCost
- _c.mutation.SetCacheCreationCost(v)
- }
- if _, ok := _c.mutation.CacheReadCost(); !ok {
- v := usagelog.DefaultCacheReadCost
- _c.mutation.SetCacheReadCost(v)
- }
- if _, ok := _c.mutation.TotalCost(); !ok {
- v := usagelog.DefaultTotalCost
- _c.mutation.SetTotalCost(v)
- }
- if _, ok := _c.mutation.ActualCost(); !ok {
- v := usagelog.DefaultActualCost
- _c.mutation.SetActualCost(v)
- }
- if _, ok := _c.mutation.RateMultiplier(); !ok {
- v := usagelog.DefaultRateMultiplier
- _c.mutation.SetRateMultiplier(v)
- }
- if _, ok := _c.mutation.LongContextBillingApplied(); !ok {
- v := usagelog.DefaultLongContextBillingApplied
- _c.mutation.SetLongContextBillingApplied(v)
- }
- if _, ok := _c.mutation.BillingType(); !ok {
- v := usagelog.DefaultBillingType
- _c.mutation.SetBillingType(v)
- }
- if _, ok := _c.mutation.Stream(); !ok {
- v := usagelog.DefaultStream
- _c.mutation.SetStream(v)
- }
- if _, ok := _c.mutation.ImageCount(); !ok {
- v := usagelog.DefaultImageCount
- _c.mutation.SetImageCount(v)
- }
- if _, ok := _c.mutation.VideoCount(); !ok {
- v := usagelog.DefaultVideoCount
- _c.mutation.SetVideoCount(v)
- }
- if _, ok := _c.mutation.CacheTTLOverridden(); !ok {
- v := usagelog.DefaultCacheTTLOverridden
- _c.mutation.SetCacheTTLOverridden(v)
- }
- if _, ok := _c.mutation.CreatedAt(); !ok {
- v := usagelog.DefaultCreatedAt()
- _c.mutation.SetCreatedAt(v)
- }
- }
- // check runs all checks and user-defined validators on the builder.
- func (_c *UsageLogCreate) check() error {
- if _, ok := _c.mutation.UserID(); !ok {
- return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "UsageLog.user_id"`)}
- }
- if _, ok := _c.mutation.APIKeyID(); !ok {
- return &ValidationError{Name: "api_key_id", err: errors.New(`ent: missing required field "UsageLog.api_key_id"`)}
- }
- if _, ok := _c.mutation.AccountID(); !ok {
- return &ValidationError{Name: "account_id", err: errors.New(`ent: missing required field "UsageLog.account_id"`)}
- }
- if _, ok := _c.mutation.RequestID(); !ok {
- return &ValidationError{Name: "request_id", err: errors.New(`ent: missing required field "UsageLog.request_id"`)}
- }
- if v, ok := _c.mutation.RequestID(); ok {
- if err := usagelog.RequestIDValidator(v); err != nil {
- return &ValidationError{Name: "request_id", err: fmt.Errorf(`ent: validator failed for field "UsageLog.request_id": %w`, err)}
- }
- }
- if _, ok := _c.mutation.Model(); !ok {
- return &ValidationError{Name: "model", err: errors.New(`ent: missing required field "UsageLog.model"`)}
- }
- if v, ok := _c.mutation.Model(); ok {
- if err := usagelog.ModelValidator(v); err != nil {
- return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "UsageLog.model": %w`, err)}
- }
- }
- if v, ok := _c.mutation.RequestedModel(); ok {
- if err := usagelog.RequestedModelValidator(v); err != nil {
- return &ValidationError{Name: "requested_model", err: fmt.Errorf(`ent: validator failed for field "UsageLog.requested_model": %w`, err)}
- }
- }
- if v, ok := _c.mutation.UpstreamModel(); ok {
- if err := usagelog.UpstreamModelValidator(v); err != nil {
- return &ValidationError{Name: "upstream_model", err: fmt.Errorf(`ent: validator failed for field "UsageLog.upstream_model": %w`, err)}
- }
- }
- if v, ok := _c.mutation.UpstreamResponseModel(); ok {
- if err := usagelog.UpstreamResponseModelValidator(v); err != nil {
- return &ValidationError{Name: "upstream_response_model", err: fmt.Errorf(`ent: validator failed for field "UsageLog.upstream_response_model": %w`, err)}
- }
- }
- if v, ok := _c.mutation.ModelMappingChain(); ok {
- if err := usagelog.ModelMappingChainValidator(v); err != nil {
- return &ValidationError{Name: "model_mapping_chain", err: fmt.Errorf(`ent: validator failed for field "UsageLog.model_mapping_chain": %w`, err)}
- }
- }
- if v, ok := _c.mutation.BillingTier(); ok {
- if err := usagelog.BillingTierValidator(v); err != nil {
- return &ValidationError{Name: "billing_tier", err: fmt.Errorf(`ent: validator failed for field "UsageLog.billing_tier": %w`, err)}
- }
- }
- if v, ok := _c.mutation.BillingMode(); ok {
- if err := usagelog.BillingModeValidator(v); err != nil {
- return &ValidationError{Name: "billing_mode", err: fmt.Errorf(`ent: validator failed for field "UsageLog.billing_mode": %w`, err)}
- }
- }
- if _, ok := _c.mutation.InputTokens(); !ok {
- return &ValidationError{Name: "input_tokens", err: errors.New(`ent: missing required field "UsageLog.input_tokens"`)}
- }
- if _, ok := _c.mutation.OutputTokens(); !ok {
- return &ValidationError{Name: "output_tokens", err: errors.New(`ent: missing required field "UsageLog.output_tokens"`)}
- }
- if _, ok := _c.mutation.CacheCreationTokens(); !ok {
- return &ValidationError{Name: "cache_creation_tokens", err: errors.New(`ent: missing required field "UsageLog.cache_creation_tokens"`)}
- }
- if _, ok := _c.mutation.CacheReadTokens(); !ok {
- return &ValidationError{Name: "cache_read_tokens", err: errors.New(`ent: missing required field "UsageLog.cache_read_tokens"`)}
- }
- if _, ok := _c.mutation.CacheCreation5mTokens(); !ok {
- return &ValidationError{Name: "cache_creation_5m_tokens", err: errors.New(`ent: missing required field "UsageLog.cache_creation_5m_tokens"`)}
- }
- if _, ok := _c.mutation.CacheCreation1hTokens(); !ok {
- return &ValidationError{Name: "cache_creation_1h_tokens", err: errors.New(`ent: missing required field "UsageLog.cache_creation_1h_tokens"`)}
- }
- if _, ok := _c.mutation.InputCost(); !ok {
- return &ValidationError{Name: "input_cost", err: errors.New(`ent: missing required field "UsageLog.input_cost"`)}
- }
- if _, ok := _c.mutation.OutputCost(); !ok {
- return &ValidationError{Name: "output_cost", err: errors.New(`ent: missing required field "UsageLog.output_cost"`)}
- }
- if _, ok := _c.mutation.CacheCreationCost(); !ok {
- return &ValidationError{Name: "cache_creation_cost", err: errors.New(`ent: missing required field "UsageLog.cache_creation_cost"`)}
- }
- if _, ok := _c.mutation.CacheReadCost(); !ok {
- return &ValidationError{Name: "cache_read_cost", err: errors.New(`ent: missing required field "UsageLog.cache_read_cost"`)}
- }
- if _, ok := _c.mutation.TotalCost(); !ok {
- return &ValidationError{Name: "total_cost", err: errors.New(`ent: missing required field "UsageLog.total_cost"`)}
- }
- if _, ok := _c.mutation.ActualCost(); !ok {
- return &ValidationError{Name: "actual_cost", err: errors.New(`ent: missing required field "UsageLog.actual_cost"`)}
- }
- if _, ok := _c.mutation.RateMultiplier(); !ok {
- return &ValidationError{Name: "rate_multiplier", err: errors.New(`ent: missing required field "UsageLog.rate_multiplier"`)}
- }
- if _, ok := _c.mutation.LongContextBillingApplied(); !ok {
- return &ValidationError{Name: "long_context_billing_applied", err: errors.New(`ent: missing required field "UsageLog.long_context_billing_applied"`)}
- }
- if _, ok := _c.mutation.BillingType(); !ok {
- return &ValidationError{Name: "billing_type", err: errors.New(`ent: missing required field "UsageLog.billing_type"`)}
- }
- if _, ok := _c.mutation.Stream(); !ok {
- return &ValidationError{Name: "stream", err: errors.New(`ent: missing required field "UsageLog.stream"`)}
- }
- if v, ok := _c.mutation.UserAgent(); ok {
- if err := usagelog.UserAgentValidator(v); err != nil {
- return &ValidationError{Name: "user_agent", err: fmt.Errorf(`ent: validator failed for field "UsageLog.user_agent": %w`, err)}
- }
- }
- if v, ok := _c.mutation.IPAddress(); ok {
- if err := usagelog.IPAddressValidator(v); err != nil {
- return &ValidationError{Name: "ip_address", err: fmt.Errorf(`ent: validator failed for field "UsageLog.ip_address": %w`, err)}
- }
- }
- if _, ok := _c.mutation.ImageCount(); !ok {
- return &ValidationError{Name: "image_count", err: errors.New(`ent: missing required field "UsageLog.image_count"`)}
- }
- if v, ok := _c.mutation.ImageSize(); ok {
- if err := usagelog.ImageSizeValidator(v); err != nil {
- return &ValidationError{Name: "image_size", err: fmt.Errorf(`ent: validator failed for field "UsageLog.image_size": %w`, err)}
- }
- }
- if v, ok := _c.mutation.ImageInputSize(); ok {
- if err := usagelog.ImageInputSizeValidator(v); err != nil {
- return &ValidationError{Name: "image_input_size", err: fmt.Errorf(`ent: validator failed for field "UsageLog.image_input_size": %w`, err)}
- }
- }
- if v, ok := _c.mutation.ImageOutputSize(); ok {
- if err := usagelog.ImageOutputSizeValidator(v); err != nil {
- return &ValidationError{Name: "image_output_size", err: fmt.Errorf(`ent: validator failed for field "UsageLog.image_output_size": %w`, err)}
- }
- }
- if v, ok := _c.mutation.ImageSizeSource(); ok {
- if err := usagelog.ImageSizeSourceValidator(v); err != nil {
- return &ValidationError{Name: "image_size_source", err: fmt.Errorf(`ent: validator failed for field "UsageLog.image_size_source": %w`, err)}
- }
- }
- if _, ok := _c.mutation.VideoCount(); !ok {
- return &ValidationError{Name: "video_count", err: errors.New(`ent: missing required field "UsageLog.video_count"`)}
- }
- if v, ok := _c.mutation.VideoResolution(); ok {
- if err := usagelog.VideoResolutionValidator(v); err != nil {
- return &ValidationError{Name: "video_resolution", err: fmt.Errorf(`ent: validator failed for field "UsageLog.video_resolution": %w`, err)}
- }
- }
- if _, ok := _c.mutation.CacheTTLOverridden(); !ok {
- return &ValidationError{Name: "cache_ttl_overridden", err: errors.New(`ent: missing required field "UsageLog.cache_ttl_overridden"`)}
- }
- if _, ok := _c.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "UsageLog.created_at"`)}
- }
- if len(_c.mutation.UserIDs()) == 0 {
- return &ValidationError{Name: "user", err: errors.New(`ent: missing required edge "UsageLog.user"`)}
- }
- if len(_c.mutation.APIKeyIDs()) == 0 {
- return &ValidationError{Name: "api_key", err: errors.New(`ent: missing required edge "UsageLog.api_key"`)}
- }
- if len(_c.mutation.AccountIDs()) == 0 {
- return &ValidationError{Name: "account", err: errors.New(`ent: missing required edge "UsageLog.account"`)}
- }
- return nil
- }
- func (_c *UsageLogCreate) sqlSave(ctx context.Context) (*UsageLog, 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
- }
- id := _spec.ID.Value.(int64)
- _node.ID = int64(id)
- _c.mutation.id = &_node.ID
- _c.mutation.done = true
- return _node, nil
- }
- func (_c *UsageLogCreate) createSpec() (*UsageLog, *sqlgraph.CreateSpec) {
- var (
- _node = &UsageLog{config: _c.config}
- _spec = sqlgraph.NewCreateSpec(usagelog.Table, sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64))
- )
- _spec.OnConflict = _c.conflict
- if value, ok := _c.mutation.RequestID(); ok {
- _spec.SetField(usagelog.FieldRequestID, field.TypeString, value)
- _node.RequestID = value
- }
- if value, ok := _c.mutation.Model(); ok {
- _spec.SetField(usagelog.FieldModel, field.TypeString, value)
- _node.Model = value
- }
- if value, ok := _c.mutation.RequestedModel(); ok {
- _spec.SetField(usagelog.FieldRequestedModel, field.TypeString, value)
- _node.RequestedModel = &value
- }
- if value, ok := _c.mutation.UpstreamModel(); ok {
- _spec.SetField(usagelog.FieldUpstreamModel, field.TypeString, value)
- _node.UpstreamModel = &value
- }
- if value, ok := _c.mutation.UpstreamResponseModel(); ok {
- _spec.SetField(usagelog.FieldUpstreamResponseModel, field.TypeString, value)
- _node.UpstreamResponseModel = &value
- }
- if value, ok := _c.mutation.UpstreamModelMismatch(); ok {
- _spec.SetField(usagelog.FieldUpstreamModelMismatch, field.TypeBool, value)
- _node.UpstreamModelMismatch = &value
- }
- if value, ok := _c.mutation.ChannelID(); ok {
- _spec.SetField(usagelog.FieldChannelID, field.TypeInt64, value)
- _node.ChannelID = &value
- }
- if value, ok := _c.mutation.ModelMappingChain(); ok {
- _spec.SetField(usagelog.FieldModelMappingChain, field.TypeString, value)
- _node.ModelMappingChain = &value
- }
- if value, ok := _c.mutation.BillingTier(); ok {
- _spec.SetField(usagelog.FieldBillingTier, field.TypeString, value)
- _node.BillingTier = &value
- }
- if value, ok := _c.mutation.BillingMode(); ok {
- _spec.SetField(usagelog.FieldBillingMode, field.TypeString, value)
- _node.BillingMode = &value
- }
- if value, ok := _c.mutation.InputTokens(); ok {
- _spec.SetField(usagelog.FieldInputTokens, field.TypeInt, value)
- _node.InputTokens = value
- }
- if value, ok := _c.mutation.OutputTokens(); ok {
- _spec.SetField(usagelog.FieldOutputTokens, field.TypeInt, value)
- _node.OutputTokens = value
- }
- if value, ok := _c.mutation.CacheCreationTokens(); ok {
- _spec.SetField(usagelog.FieldCacheCreationTokens, field.TypeInt, value)
- _node.CacheCreationTokens = value
- }
- if value, ok := _c.mutation.CacheReadTokens(); ok {
- _spec.SetField(usagelog.FieldCacheReadTokens, field.TypeInt, value)
- _node.CacheReadTokens = value
- }
- if value, ok := _c.mutation.CacheCreation5mTokens(); ok {
- _spec.SetField(usagelog.FieldCacheCreation5mTokens, field.TypeInt, value)
- _node.CacheCreation5mTokens = value
- }
- if value, ok := _c.mutation.CacheCreation1hTokens(); ok {
- _spec.SetField(usagelog.FieldCacheCreation1hTokens, field.TypeInt, value)
- _node.CacheCreation1hTokens = value
- }
- if value, ok := _c.mutation.InputCost(); ok {
- _spec.SetField(usagelog.FieldInputCost, field.TypeFloat64, value)
- _node.InputCost = value
- }
- if value, ok := _c.mutation.OutputCost(); ok {
- _spec.SetField(usagelog.FieldOutputCost, field.TypeFloat64, value)
- _node.OutputCost = value
- }
- if value, ok := _c.mutation.CacheCreationCost(); ok {
- _spec.SetField(usagelog.FieldCacheCreationCost, field.TypeFloat64, value)
- _node.CacheCreationCost = value
- }
- if value, ok := _c.mutation.CacheReadCost(); ok {
- _spec.SetField(usagelog.FieldCacheReadCost, field.TypeFloat64, value)
- _node.CacheReadCost = value
- }
- if value, ok := _c.mutation.TotalCost(); ok {
- _spec.SetField(usagelog.FieldTotalCost, field.TypeFloat64, value)
- _node.TotalCost = value
- }
- if value, ok := _c.mutation.ActualCost(); ok {
- _spec.SetField(usagelog.FieldActualCost, field.TypeFloat64, value)
- _node.ActualCost = value
- }
- if value, ok := _c.mutation.RateMultiplier(); ok {
- _spec.SetField(usagelog.FieldRateMultiplier, field.TypeFloat64, value)
- _node.RateMultiplier = value
- }
- if value, ok := _c.mutation.LongContextBillingApplied(); ok {
- _spec.SetField(usagelog.FieldLongContextBillingApplied, field.TypeBool, value)
- _node.LongContextBillingApplied = value
- }
- if value, ok := _c.mutation.AccountRateMultiplier(); ok {
- _spec.SetField(usagelog.FieldAccountRateMultiplier, field.TypeFloat64, value)
- _node.AccountRateMultiplier = &value
- }
- if value, ok := _c.mutation.BillingType(); ok {
- _spec.SetField(usagelog.FieldBillingType, field.TypeInt8, value)
- _node.BillingType = value
- }
- if value, ok := _c.mutation.Stream(); ok {
- _spec.SetField(usagelog.FieldStream, field.TypeBool, value)
- _node.Stream = value
- }
- if value, ok := _c.mutation.DurationMs(); ok {
- _spec.SetField(usagelog.FieldDurationMs, field.TypeInt, value)
- _node.DurationMs = &value
- }
- if value, ok := _c.mutation.FirstTokenMs(); ok {
- _spec.SetField(usagelog.FieldFirstTokenMs, field.TypeInt, value)
- _node.FirstTokenMs = &value
- }
- if value, ok := _c.mutation.UserAgent(); ok {
- _spec.SetField(usagelog.FieldUserAgent, field.TypeString, value)
- _node.UserAgent = &value
- }
- if value, ok := _c.mutation.IPAddress(); ok {
- _spec.SetField(usagelog.FieldIPAddress, field.TypeString, value)
- _node.IPAddress = &value
- }
- if value, ok := _c.mutation.ImageCount(); ok {
- _spec.SetField(usagelog.FieldImageCount, field.TypeInt, value)
- _node.ImageCount = value
- }
- if value, ok := _c.mutation.ImageSize(); ok {
- _spec.SetField(usagelog.FieldImageSize, field.TypeString, value)
- _node.ImageSize = &value
- }
- if value, ok := _c.mutation.ImageInputSize(); ok {
- _spec.SetField(usagelog.FieldImageInputSize, field.TypeString, value)
- _node.ImageInputSize = &value
- }
- if value, ok := _c.mutation.ImageOutputSize(); ok {
- _spec.SetField(usagelog.FieldImageOutputSize, field.TypeString, value)
- _node.ImageOutputSize = &value
- }
- if value, ok := _c.mutation.ImageSizeSource(); ok {
- _spec.SetField(usagelog.FieldImageSizeSource, field.TypeString, value)
- _node.ImageSizeSource = &value
- }
- if value, ok := _c.mutation.ImageSizeBreakdown(); ok {
- _spec.SetField(usagelog.FieldImageSizeBreakdown, field.TypeJSON, value)
- _node.ImageSizeBreakdown = value
- }
- if value, ok := _c.mutation.VideoCount(); ok {
- _spec.SetField(usagelog.FieldVideoCount, field.TypeInt, value)
- _node.VideoCount = value
- }
- if value, ok := _c.mutation.VideoResolution(); ok {
- _spec.SetField(usagelog.FieldVideoResolution, field.TypeString, value)
- _node.VideoResolution = &value
- }
- if value, ok := _c.mutation.VideoDurationSeconds(); ok {
- _spec.SetField(usagelog.FieldVideoDurationSeconds, field.TypeInt, value)
- _node.VideoDurationSeconds = &value
- }
- if value, ok := _c.mutation.CacheTTLOverridden(); ok {
- _spec.SetField(usagelog.FieldCacheTTLOverridden, field.TypeBool, value)
- _node.CacheTTLOverridden = value
- }
- if value, ok := _c.mutation.CreatedAt(); ok {
- _spec.SetField(usagelog.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- if nodes := _c.mutation.UserIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.M2O,
- Inverse: true,
- Table: usagelog.UserTable,
- Columns: []string{usagelog.UserColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _node.UserID = nodes[0]
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := _c.mutation.APIKeyIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.M2O,
- Inverse: true,
- Table: usagelog.APIKeyTable,
- Columns: []string{usagelog.APIKeyColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _node.APIKeyID = nodes[0]
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := _c.mutation.AccountIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.M2O,
- Inverse: true,
- Table: usagelog.AccountTable,
- Columns: []string{usagelog.AccountColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _node.AccountID = nodes[0]
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := _c.mutation.GroupIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.M2O,
- Inverse: true,
- Table: usagelog.GroupTable,
- Columns: []string{usagelog.GroupColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeInt64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _node.GroupID = &nodes[0]
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := _c.mutation.SubscriptionIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.M2O,
- Inverse: true,
- Table: usagelog.SubscriptionTable,
- Columns: []string{usagelog.SubscriptionColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _node.SubscriptionID = &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.UsageLog.Create().
- // SetUserID(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.UsageLogUpsert) {
- // SetUserID(v+v).
- // }).
- // Exec(ctx)
- func (_c *UsageLogCreate) OnConflict(opts ...sql.ConflictOption) *UsageLogUpsertOne {
- _c.conflict = opts
- return &UsageLogUpsertOne{
- create: _c,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.UsageLog.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (_c *UsageLogCreate) OnConflictColumns(columns ...string) *UsageLogUpsertOne {
- _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
- return &UsageLogUpsertOne{
- create: _c,
- }
- }
- type (
- // UsageLogUpsertOne is the builder for "upsert"-ing
- // one UsageLog node.
- UsageLogUpsertOne struct {
- create *UsageLogCreate
- }
- // UsageLogUpsert is the "OnConflict" setter.
- UsageLogUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetUserID sets the "user_id" field.
- func (u *UsageLogUpsert) SetUserID(v int64) *UsageLogUpsert {
- u.Set(usagelog.FieldUserID, v)
- return u
- }
- // UpdateUserID sets the "user_id" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateUserID() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldUserID)
- return u
- }
- // SetAPIKeyID sets the "api_key_id" field.
- func (u *UsageLogUpsert) SetAPIKeyID(v int64) *UsageLogUpsert {
- u.Set(usagelog.FieldAPIKeyID, v)
- return u
- }
- // UpdateAPIKeyID sets the "api_key_id" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateAPIKeyID() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldAPIKeyID)
- return u
- }
- // SetAccountID sets the "account_id" field.
- func (u *UsageLogUpsert) SetAccountID(v int64) *UsageLogUpsert {
- u.Set(usagelog.FieldAccountID, v)
- return u
- }
- // UpdateAccountID sets the "account_id" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateAccountID() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldAccountID)
- return u
- }
- // SetRequestID sets the "request_id" field.
- func (u *UsageLogUpsert) SetRequestID(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldRequestID, v)
- return u
- }
- // UpdateRequestID sets the "request_id" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateRequestID() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldRequestID)
- return u
- }
- // SetModel sets the "model" field.
- func (u *UsageLogUpsert) SetModel(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldModel, v)
- return u
- }
- // UpdateModel sets the "model" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateModel() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldModel)
- return u
- }
- // SetRequestedModel sets the "requested_model" field.
- func (u *UsageLogUpsert) SetRequestedModel(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldRequestedModel, v)
- return u
- }
- // UpdateRequestedModel sets the "requested_model" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateRequestedModel() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldRequestedModel)
- return u
- }
- // ClearRequestedModel clears the value of the "requested_model" field.
- func (u *UsageLogUpsert) ClearRequestedModel() *UsageLogUpsert {
- u.SetNull(usagelog.FieldRequestedModel)
- return u
- }
- // SetUpstreamModel sets the "upstream_model" field.
- func (u *UsageLogUpsert) SetUpstreamModel(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldUpstreamModel, v)
- return u
- }
- // UpdateUpstreamModel sets the "upstream_model" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateUpstreamModel() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldUpstreamModel)
- return u
- }
- // ClearUpstreamModel clears the value of the "upstream_model" field.
- func (u *UsageLogUpsert) ClearUpstreamModel() *UsageLogUpsert {
- u.SetNull(usagelog.FieldUpstreamModel)
- return u
- }
- // SetUpstreamResponseModel sets the "upstream_response_model" field.
- func (u *UsageLogUpsert) SetUpstreamResponseModel(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldUpstreamResponseModel, v)
- return u
- }
- // UpdateUpstreamResponseModel sets the "upstream_response_model" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateUpstreamResponseModel() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldUpstreamResponseModel)
- return u
- }
- // ClearUpstreamResponseModel clears the value of the "upstream_response_model" field.
- func (u *UsageLogUpsert) ClearUpstreamResponseModel() *UsageLogUpsert {
- u.SetNull(usagelog.FieldUpstreamResponseModel)
- return u
- }
- // SetUpstreamModelMismatch sets the "upstream_model_mismatch" field.
- func (u *UsageLogUpsert) SetUpstreamModelMismatch(v bool) *UsageLogUpsert {
- u.Set(usagelog.FieldUpstreamModelMismatch, v)
- return u
- }
- // UpdateUpstreamModelMismatch sets the "upstream_model_mismatch" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateUpstreamModelMismatch() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldUpstreamModelMismatch)
- return u
- }
- // ClearUpstreamModelMismatch clears the value of the "upstream_model_mismatch" field.
- func (u *UsageLogUpsert) ClearUpstreamModelMismatch() *UsageLogUpsert {
- u.SetNull(usagelog.FieldUpstreamModelMismatch)
- return u
- }
- // SetChannelID sets the "channel_id" field.
- func (u *UsageLogUpsert) SetChannelID(v int64) *UsageLogUpsert {
- u.Set(usagelog.FieldChannelID, v)
- return u
- }
- // UpdateChannelID sets the "channel_id" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateChannelID() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldChannelID)
- return u
- }
- // AddChannelID adds v to the "channel_id" field.
- func (u *UsageLogUpsert) AddChannelID(v int64) *UsageLogUpsert {
- u.Add(usagelog.FieldChannelID, v)
- return u
- }
- // ClearChannelID clears the value of the "channel_id" field.
- func (u *UsageLogUpsert) ClearChannelID() *UsageLogUpsert {
- u.SetNull(usagelog.FieldChannelID)
- return u
- }
- // SetModelMappingChain sets the "model_mapping_chain" field.
- func (u *UsageLogUpsert) SetModelMappingChain(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldModelMappingChain, v)
- return u
- }
- // UpdateModelMappingChain sets the "model_mapping_chain" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateModelMappingChain() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldModelMappingChain)
- return u
- }
- // ClearModelMappingChain clears the value of the "model_mapping_chain" field.
- func (u *UsageLogUpsert) ClearModelMappingChain() *UsageLogUpsert {
- u.SetNull(usagelog.FieldModelMappingChain)
- return u
- }
- // SetBillingTier sets the "billing_tier" field.
- func (u *UsageLogUpsert) SetBillingTier(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldBillingTier, v)
- return u
- }
- // UpdateBillingTier sets the "billing_tier" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateBillingTier() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldBillingTier)
- return u
- }
- // ClearBillingTier clears the value of the "billing_tier" field.
- func (u *UsageLogUpsert) ClearBillingTier() *UsageLogUpsert {
- u.SetNull(usagelog.FieldBillingTier)
- return u
- }
- // SetBillingMode sets the "billing_mode" field.
- func (u *UsageLogUpsert) SetBillingMode(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldBillingMode, v)
- return u
- }
- // UpdateBillingMode sets the "billing_mode" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateBillingMode() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldBillingMode)
- return u
- }
- // ClearBillingMode clears the value of the "billing_mode" field.
- func (u *UsageLogUpsert) ClearBillingMode() *UsageLogUpsert {
- u.SetNull(usagelog.FieldBillingMode)
- return u
- }
- // SetGroupID sets the "group_id" field.
- func (u *UsageLogUpsert) SetGroupID(v int64) *UsageLogUpsert {
- u.Set(usagelog.FieldGroupID, v)
- return u
- }
- // UpdateGroupID sets the "group_id" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateGroupID() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldGroupID)
- return u
- }
- // ClearGroupID clears the value of the "group_id" field.
- func (u *UsageLogUpsert) ClearGroupID() *UsageLogUpsert {
- u.SetNull(usagelog.FieldGroupID)
- return u
- }
- // SetSubscriptionID sets the "subscription_id" field.
- func (u *UsageLogUpsert) SetSubscriptionID(v int64) *UsageLogUpsert {
- u.Set(usagelog.FieldSubscriptionID, v)
- return u
- }
- // UpdateSubscriptionID sets the "subscription_id" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateSubscriptionID() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldSubscriptionID)
- return u
- }
- // ClearSubscriptionID clears the value of the "subscription_id" field.
- func (u *UsageLogUpsert) ClearSubscriptionID() *UsageLogUpsert {
- u.SetNull(usagelog.FieldSubscriptionID)
- return u
- }
- // SetInputTokens sets the "input_tokens" field.
- func (u *UsageLogUpsert) SetInputTokens(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldInputTokens, v)
- return u
- }
- // UpdateInputTokens sets the "input_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateInputTokens() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldInputTokens)
- return u
- }
- // AddInputTokens adds v to the "input_tokens" field.
- func (u *UsageLogUpsert) AddInputTokens(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldInputTokens, v)
- return u
- }
- // SetOutputTokens sets the "output_tokens" field.
- func (u *UsageLogUpsert) SetOutputTokens(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldOutputTokens, v)
- return u
- }
- // UpdateOutputTokens sets the "output_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateOutputTokens() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldOutputTokens)
- return u
- }
- // AddOutputTokens adds v to the "output_tokens" field.
- func (u *UsageLogUpsert) AddOutputTokens(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldOutputTokens, v)
- return u
- }
- // SetCacheCreationTokens sets the "cache_creation_tokens" field.
- func (u *UsageLogUpsert) SetCacheCreationTokens(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldCacheCreationTokens, v)
- return u
- }
- // UpdateCacheCreationTokens sets the "cache_creation_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateCacheCreationTokens() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldCacheCreationTokens)
- return u
- }
- // AddCacheCreationTokens adds v to the "cache_creation_tokens" field.
- func (u *UsageLogUpsert) AddCacheCreationTokens(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldCacheCreationTokens, v)
- return u
- }
- // SetCacheReadTokens sets the "cache_read_tokens" field.
- func (u *UsageLogUpsert) SetCacheReadTokens(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldCacheReadTokens, v)
- return u
- }
- // UpdateCacheReadTokens sets the "cache_read_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateCacheReadTokens() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldCacheReadTokens)
- return u
- }
- // AddCacheReadTokens adds v to the "cache_read_tokens" field.
- func (u *UsageLogUpsert) AddCacheReadTokens(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldCacheReadTokens, v)
- return u
- }
- // SetCacheCreation5mTokens sets the "cache_creation_5m_tokens" field.
- func (u *UsageLogUpsert) SetCacheCreation5mTokens(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldCacheCreation5mTokens, v)
- return u
- }
- // UpdateCacheCreation5mTokens sets the "cache_creation_5m_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateCacheCreation5mTokens() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldCacheCreation5mTokens)
- return u
- }
- // AddCacheCreation5mTokens adds v to the "cache_creation_5m_tokens" field.
- func (u *UsageLogUpsert) AddCacheCreation5mTokens(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldCacheCreation5mTokens, v)
- return u
- }
- // SetCacheCreation1hTokens sets the "cache_creation_1h_tokens" field.
- func (u *UsageLogUpsert) SetCacheCreation1hTokens(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldCacheCreation1hTokens, v)
- return u
- }
- // UpdateCacheCreation1hTokens sets the "cache_creation_1h_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateCacheCreation1hTokens() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldCacheCreation1hTokens)
- return u
- }
- // AddCacheCreation1hTokens adds v to the "cache_creation_1h_tokens" field.
- func (u *UsageLogUpsert) AddCacheCreation1hTokens(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldCacheCreation1hTokens, v)
- return u
- }
- // SetInputCost sets the "input_cost" field.
- func (u *UsageLogUpsert) SetInputCost(v float64) *UsageLogUpsert {
- u.Set(usagelog.FieldInputCost, v)
- return u
- }
- // UpdateInputCost sets the "input_cost" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateInputCost() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldInputCost)
- return u
- }
- // AddInputCost adds v to the "input_cost" field.
- func (u *UsageLogUpsert) AddInputCost(v float64) *UsageLogUpsert {
- u.Add(usagelog.FieldInputCost, v)
- return u
- }
- // SetOutputCost sets the "output_cost" field.
- func (u *UsageLogUpsert) SetOutputCost(v float64) *UsageLogUpsert {
- u.Set(usagelog.FieldOutputCost, v)
- return u
- }
- // UpdateOutputCost sets the "output_cost" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateOutputCost() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldOutputCost)
- return u
- }
- // AddOutputCost adds v to the "output_cost" field.
- func (u *UsageLogUpsert) AddOutputCost(v float64) *UsageLogUpsert {
- u.Add(usagelog.FieldOutputCost, v)
- return u
- }
- // SetCacheCreationCost sets the "cache_creation_cost" field.
- func (u *UsageLogUpsert) SetCacheCreationCost(v float64) *UsageLogUpsert {
- u.Set(usagelog.FieldCacheCreationCost, v)
- return u
- }
- // UpdateCacheCreationCost sets the "cache_creation_cost" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateCacheCreationCost() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldCacheCreationCost)
- return u
- }
- // AddCacheCreationCost adds v to the "cache_creation_cost" field.
- func (u *UsageLogUpsert) AddCacheCreationCost(v float64) *UsageLogUpsert {
- u.Add(usagelog.FieldCacheCreationCost, v)
- return u
- }
- // SetCacheReadCost sets the "cache_read_cost" field.
- func (u *UsageLogUpsert) SetCacheReadCost(v float64) *UsageLogUpsert {
- u.Set(usagelog.FieldCacheReadCost, v)
- return u
- }
- // UpdateCacheReadCost sets the "cache_read_cost" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateCacheReadCost() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldCacheReadCost)
- return u
- }
- // AddCacheReadCost adds v to the "cache_read_cost" field.
- func (u *UsageLogUpsert) AddCacheReadCost(v float64) *UsageLogUpsert {
- u.Add(usagelog.FieldCacheReadCost, v)
- return u
- }
- // SetTotalCost sets the "total_cost" field.
- func (u *UsageLogUpsert) SetTotalCost(v float64) *UsageLogUpsert {
- u.Set(usagelog.FieldTotalCost, v)
- return u
- }
- // UpdateTotalCost sets the "total_cost" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateTotalCost() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldTotalCost)
- return u
- }
- // AddTotalCost adds v to the "total_cost" field.
- func (u *UsageLogUpsert) AddTotalCost(v float64) *UsageLogUpsert {
- u.Add(usagelog.FieldTotalCost, v)
- return u
- }
- // SetActualCost sets the "actual_cost" field.
- func (u *UsageLogUpsert) SetActualCost(v float64) *UsageLogUpsert {
- u.Set(usagelog.FieldActualCost, v)
- return u
- }
- // UpdateActualCost sets the "actual_cost" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateActualCost() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldActualCost)
- return u
- }
- // AddActualCost adds v to the "actual_cost" field.
- func (u *UsageLogUpsert) AddActualCost(v float64) *UsageLogUpsert {
- u.Add(usagelog.FieldActualCost, v)
- return u
- }
- // SetRateMultiplier sets the "rate_multiplier" field.
- func (u *UsageLogUpsert) SetRateMultiplier(v float64) *UsageLogUpsert {
- u.Set(usagelog.FieldRateMultiplier, v)
- return u
- }
- // UpdateRateMultiplier sets the "rate_multiplier" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateRateMultiplier() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldRateMultiplier)
- return u
- }
- // AddRateMultiplier adds v to the "rate_multiplier" field.
- func (u *UsageLogUpsert) AddRateMultiplier(v float64) *UsageLogUpsert {
- u.Add(usagelog.FieldRateMultiplier, v)
- return u
- }
- // SetLongContextBillingApplied sets the "long_context_billing_applied" field.
- func (u *UsageLogUpsert) SetLongContextBillingApplied(v bool) *UsageLogUpsert {
- u.Set(usagelog.FieldLongContextBillingApplied, v)
- return u
- }
- // UpdateLongContextBillingApplied sets the "long_context_billing_applied" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateLongContextBillingApplied() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldLongContextBillingApplied)
- return u
- }
- // SetAccountRateMultiplier sets the "account_rate_multiplier" field.
- func (u *UsageLogUpsert) SetAccountRateMultiplier(v float64) *UsageLogUpsert {
- u.Set(usagelog.FieldAccountRateMultiplier, v)
- return u
- }
- // UpdateAccountRateMultiplier sets the "account_rate_multiplier" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateAccountRateMultiplier() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldAccountRateMultiplier)
- return u
- }
- // AddAccountRateMultiplier adds v to the "account_rate_multiplier" field.
- func (u *UsageLogUpsert) AddAccountRateMultiplier(v float64) *UsageLogUpsert {
- u.Add(usagelog.FieldAccountRateMultiplier, v)
- return u
- }
- // ClearAccountRateMultiplier clears the value of the "account_rate_multiplier" field.
- func (u *UsageLogUpsert) ClearAccountRateMultiplier() *UsageLogUpsert {
- u.SetNull(usagelog.FieldAccountRateMultiplier)
- return u
- }
- // SetBillingType sets the "billing_type" field.
- func (u *UsageLogUpsert) SetBillingType(v int8) *UsageLogUpsert {
- u.Set(usagelog.FieldBillingType, v)
- return u
- }
- // UpdateBillingType sets the "billing_type" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateBillingType() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldBillingType)
- return u
- }
- // AddBillingType adds v to the "billing_type" field.
- func (u *UsageLogUpsert) AddBillingType(v int8) *UsageLogUpsert {
- u.Add(usagelog.FieldBillingType, v)
- return u
- }
- // SetStream sets the "stream" field.
- func (u *UsageLogUpsert) SetStream(v bool) *UsageLogUpsert {
- u.Set(usagelog.FieldStream, v)
- return u
- }
- // UpdateStream sets the "stream" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateStream() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldStream)
- return u
- }
- // SetDurationMs sets the "duration_ms" field.
- func (u *UsageLogUpsert) SetDurationMs(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldDurationMs, v)
- return u
- }
- // UpdateDurationMs sets the "duration_ms" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateDurationMs() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldDurationMs)
- return u
- }
- // AddDurationMs adds v to the "duration_ms" field.
- func (u *UsageLogUpsert) AddDurationMs(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldDurationMs, v)
- return u
- }
- // ClearDurationMs clears the value of the "duration_ms" field.
- func (u *UsageLogUpsert) ClearDurationMs() *UsageLogUpsert {
- u.SetNull(usagelog.FieldDurationMs)
- return u
- }
- // SetFirstTokenMs sets the "first_token_ms" field.
- func (u *UsageLogUpsert) SetFirstTokenMs(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldFirstTokenMs, v)
- return u
- }
- // UpdateFirstTokenMs sets the "first_token_ms" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateFirstTokenMs() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldFirstTokenMs)
- return u
- }
- // AddFirstTokenMs adds v to the "first_token_ms" field.
- func (u *UsageLogUpsert) AddFirstTokenMs(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldFirstTokenMs, v)
- return u
- }
- // ClearFirstTokenMs clears the value of the "first_token_ms" field.
- func (u *UsageLogUpsert) ClearFirstTokenMs() *UsageLogUpsert {
- u.SetNull(usagelog.FieldFirstTokenMs)
- return u
- }
- // SetUserAgent sets the "user_agent" field.
- func (u *UsageLogUpsert) SetUserAgent(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldUserAgent, v)
- return u
- }
- // UpdateUserAgent sets the "user_agent" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateUserAgent() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldUserAgent)
- return u
- }
- // ClearUserAgent clears the value of the "user_agent" field.
- func (u *UsageLogUpsert) ClearUserAgent() *UsageLogUpsert {
- u.SetNull(usagelog.FieldUserAgent)
- return u
- }
- // SetIPAddress sets the "ip_address" field.
- func (u *UsageLogUpsert) SetIPAddress(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldIPAddress, v)
- return u
- }
- // UpdateIPAddress sets the "ip_address" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateIPAddress() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldIPAddress)
- return u
- }
- // ClearIPAddress clears the value of the "ip_address" field.
- func (u *UsageLogUpsert) ClearIPAddress() *UsageLogUpsert {
- u.SetNull(usagelog.FieldIPAddress)
- return u
- }
- // SetImageCount sets the "image_count" field.
- func (u *UsageLogUpsert) SetImageCount(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldImageCount, v)
- return u
- }
- // UpdateImageCount sets the "image_count" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateImageCount() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldImageCount)
- return u
- }
- // AddImageCount adds v to the "image_count" field.
- func (u *UsageLogUpsert) AddImageCount(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldImageCount, v)
- return u
- }
- // SetImageSize sets the "image_size" field.
- func (u *UsageLogUpsert) SetImageSize(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldImageSize, v)
- return u
- }
- // UpdateImageSize sets the "image_size" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateImageSize() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldImageSize)
- return u
- }
- // ClearImageSize clears the value of the "image_size" field.
- func (u *UsageLogUpsert) ClearImageSize() *UsageLogUpsert {
- u.SetNull(usagelog.FieldImageSize)
- return u
- }
- // SetImageInputSize sets the "image_input_size" field.
- func (u *UsageLogUpsert) SetImageInputSize(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldImageInputSize, v)
- return u
- }
- // UpdateImageInputSize sets the "image_input_size" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateImageInputSize() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldImageInputSize)
- return u
- }
- // ClearImageInputSize clears the value of the "image_input_size" field.
- func (u *UsageLogUpsert) ClearImageInputSize() *UsageLogUpsert {
- u.SetNull(usagelog.FieldImageInputSize)
- return u
- }
- // SetImageOutputSize sets the "image_output_size" field.
- func (u *UsageLogUpsert) SetImageOutputSize(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldImageOutputSize, v)
- return u
- }
- // UpdateImageOutputSize sets the "image_output_size" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateImageOutputSize() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldImageOutputSize)
- return u
- }
- // ClearImageOutputSize clears the value of the "image_output_size" field.
- func (u *UsageLogUpsert) ClearImageOutputSize() *UsageLogUpsert {
- u.SetNull(usagelog.FieldImageOutputSize)
- return u
- }
- // SetImageSizeSource sets the "image_size_source" field.
- func (u *UsageLogUpsert) SetImageSizeSource(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldImageSizeSource, v)
- return u
- }
- // UpdateImageSizeSource sets the "image_size_source" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateImageSizeSource() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldImageSizeSource)
- return u
- }
- // ClearImageSizeSource clears the value of the "image_size_source" field.
- func (u *UsageLogUpsert) ClearImageSizeSource() *UsageLogUpsert {
- u.SetNull(usagelog.FieldImageSizeSource)
- return u
- }
- // SetImageSizeBreakdown sets the "image_size_breakdown" field.
- func (u *UsageLogUpsert) SetImageSizeBreakdown(v map[string]int) *UsageLogUpsert {
- u.Set(usagelog.FieldImageSizeBreakdown, v)
- return u
- }
- // UpdateImageSizeBreakdown sets the "image_size_breakdown" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateImageSizeBreakdown() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldImageSizeBreakdown)
- return u
- }
- // ClearImageSizeBreakdown clears the value of the "image_size_breakdown" field.
- func (u *UsageLogUpsert) ClearImageSizeBreakdown() *UsageLogUpsert {
- u.SetNull(usagelog.FieldImageSizeBreakdown)
- return u
- }
- // SetVideoCount sets the "video_count" field.
- func (u *UsageLogUpsert) SetVideoCount(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldVideoCount, v)
- return u
- }
- // UpdateVideoCount sets the "video_count" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateVideoCount() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldVideoCount)
- return u
- }
- // AddVideoCount adds v to the "video_count" field.
- func (u *UsageLogUpsert) AddVideoCount(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldVideoCount, v)
- return u
- }
- // SetVideoResolution sets the "video_resolution" field.
- func (u *UsageLogUpsert) SetVideoResolution(v string) *UsageLogUpsert {
- u.Set(usagelog.FieldVideoResolution, v)
- return u
- }
- // UpdateVideoResolution sets the "video_resolution" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateVideoResolution() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldVideoResolution)
- return u
- }
- // ClearVideoResolution clears the value of the "video_resolution" field.
- func (u *UsageLogUpsert) ClearVideoResolution() *UsageLogUpsert {
- u.SetNull(usagelog.FieldVideoResolution)
- return u
- }
- // SetVideoDurationSeconds sets the "video_duration_seconds" field.
- func (u *UsageLogUpsert) SetVideoDurationSeconds(v int) *UsageLogUpsert {
- u.Set(usagelog.FieldVideoDurationSeconds, v)
- return u
- }
- // UpdateVideoDurationSeconds sets the "video_duration_seconds" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateVideoDurationSeconds() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldVideoDurationSeconds)
- return u
- }
- // AddVideoDurationSeconds adds v to the "video_duration_seconds" field.
- func (u *UsageLogUpsert) AddVideoDurationSeconds(v int) *UsageLogUpsert {
- u.Add(usagelog.FieldVideoDurationSeconds, v)
- return u
- }
- // ClearVideoDurationSeconds clears the value of the "video_duration_seconds" field.
- func (u *UsageLogUpsert) ClearVideoDurationSeconds() *UsageLogUpsert {
- u.SetNull(usagelog.FieldVideoDurationSeconds)
- return u
- }
- // SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
- func (u *UsageLogUpsert) SetCacheTTLOverridden(v bool) *UsageLogUpsert {
- u.Set(usagelog.FieldCacheTTLOverridden, v)
- return u
- }
- // UpdateCacheTTLOverridden sets the "cache_ttl_overridden" field to the value that was provided on create.
- func (u *UsageLogUpsert) UpdateCacheTTLOverridden() *UsageLogUpsert {
- u.SetExcluded(usagelog.FieldCacheTTLOverridden)
- return u
- }
- // UpdateNewValues updates the mutable fields using the new values that were set on create.
- // Using this option is equivalent to using:
- //
- // client.UsageLog.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // ).
- // Exec(ctx)
- func (u *UsageLogUpsertOne) UpdateNewValues() *UsageLogUpsertOne {
- 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.CreatedAt(); exists {
- s.SetIgnore(usagelog.FieldCreatedAt)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.UsageLog.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *UsageLogUpsertOne) Ignore() *UsageLogUpsertOne {
- 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 *UsageLogUpsertOne) DoNothing() *UsageLogUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the UsageLogCreate.OnConflict
- // documentation for more info.
- func (u *UsageLogUpsertOne) Update(set func(*UsageLogUpsert)) *UsageLogUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&UsageLogUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUserID sets the "user_id" field.
- func (u *UsageLogUpsertOne) SetUserID(v int64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetUserID(v)
- })
- }
- // UpdateUserID sets the "user_id" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateUserID() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateUserID()
- })
- }
- // SetAPIKeyID sets the "api_key_id" field.
- func (u *UsageLogUpsertOne) SetAPIKeyID(v int64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetAPIKeyID(v)
- })
- }
- // UpdateAPIKeyID sets the "api_key_id" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateAPIKeyID() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateAPIKeyID()
- })
- }
- // SetAccountID sets the "account_id" field.
- func (u *UsageLogUpsertOne) SetAccountID(v int64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetAccountID(v)
- })
- }
- // UpdateAccountID sets the "account_id" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateAccountID() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateAccountID()
- })
- }
- // SetRequestID sets the "request_id" field.
- func (u *UsageLogUpsertOne) SetRequestID(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetRequestID(v)
- })
- }
- // UpdateRequestID sets the "request_id" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateRequestID() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateRequestID()
- })
- }
- // SetModel sets the "model" field.
- func (u *UsageLogUpsertOne) SetModel(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetModel(v)
- })
- }
- // UpdateModel sets the "model" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateModel() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateModel()
- })
- }
- // SetRequestedModel sets the "requested_model" field.
- func (u *UsageLogUpsertOne) SetRequestedModel(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetRequestedModel(v)
- })
- }
- // UpdateRequestedModel sets the "requested_model" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateRequestedModel() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateRequestedModel()
- })
- }
- // ClearRequestedModel clears the value of the "requested_model" field.
- func (u *UsageLogUpsertOne) ClearRequestedModel() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearRequestedModel()
- })
- }
- // SetUpstreamModel sets the "upstream_model" field.
- func (u *UsageLogUpsertOne) SetUpstreamModel(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetUpstreamModel(v)
- })
- }
- // UpdateUpstreamModel sets the "upstream_model" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateUpstreamModel() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateUpstreamModel()
- })
- }
- // ClearUpstreamModel clears the value of the "upstream_model" field.
- func (u *UsageLogUpsertOne) ClearUpstreamModel() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearUpstreamModel()
- })
- }
- // SetUpstreamResponseModel sets the "upstream_response_model" field.
- func (u *UsageLogUpsertOne) SetUpstreamResponseModel(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetUpstreamResponseModel(v)
- })
- }
- // UpdateUpstreamResponseModel sets the "upstream_response_model" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateUpstreamResponseModel() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateUpstreamResponseModel()
- })
- }
- // ClearUpstreamResponseModel clears the value of the "upstream_response_model" field.
- func (u *UsageLogUpsertOne) ClearUpstreamResponseModel() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearUpstreamResponseModel()
- })
- }
- // SetUpstreamModelMismatch sets the "upstream_model_mismatch" field.
- func (u *UsageLogUpsertOne) SetUpstreamModelMismatch(v bool) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetUpstreamModelMismatch(v)
- })
- }
- // UpdateUpstreamModelMismatch sets the "upstream_model_mismatch" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateUpstreamModelMismatch() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateUpstreamModelMismatch()
- })
- }
- // ClearUpstreamModelMismatch clears the value of the "upstream_model_mismatch" field.
- func (u *UsageLogUpsertOne) ClearUpstreamModelMismatch() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearUpstreamModelMismatch()
- })
- }
- // SetChannelID sets the "channel_id" field.
- func (u *UsageLogUpsertOne) SetChannelID(v int64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetChannelID(v)
- })
- }
- // AddChannelID adds v to the "channel_id" field.
- func (u *UsageLogUpsertOne) AddChannelID(v int64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddChannelID(v)
- })
- }
- // UpdateChannelID sets the "channel_id" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateChannelID() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateChannelID()
- })
- }
- // ClearChannelID clears the value of the "channel_id" field.
- func (u *UsageLogUpsertOne) ClearChannelID() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearChannelID()
- })
- }
- // SetModelMappingChain sets the "model_mapping_chain" field.
- func (u *UsageLogUpsertOne) SetModelMappingChain(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetModelMappingChain(v)
- })
- }
- // UpdateModelMappingChain sets the "model_mapping_chain" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateModelMappingChain() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateModelMappingChain()
- })
- }
- // ClearModelMappingChain clears the value of the "model_mapping_chain" field.
- func (u *UsageLogUpsertOne) ClearModelMappingChain() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearModelMappingChain()
- })
- }
- // SetBillingTier sets the "billing_tier" field.
- func (u *UsageLogUpsertOne) SetBillingTier(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetBillingTier(v)
- })
- }
- // UpdateBillingTier sets the "billing_tier" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateBillingTier() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateBillingTier()
- })
- }
- // ClearBillingTier clears the value of the "billing_tier" field.
- func (u *UsageLogUpsertOne) ClearBillingTier() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearBillingTier()
- })
- }
- // SetBillingMode sets the "billing_mode" field.
- func (u *UsageLogUpsertOne) SetBillingMode(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetBillingMode(v)
- })
- }
- // UpdateBillingMode sets the "billing_mode" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateBillingMode() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateBillingMode()
- })
- }
- // ClearBillingMode clears the value of the "billing_mode" field.
- func (u *UsageLogUpsertOne) ClearBillingMode() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearBillingMode()
- })
- }
- // SetGroupID sets the "group_id" field.
- func (u *UsageLogUpsertOne) SetGroupID(v int64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetGroupID(v)
- })
- }
- // UpdateGroupID sets the "group_id" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateGroupID() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateGroupID()
- })
- }
- // ClearGroupID clears the value of the "group_id" field.
- func (u *UsageLogUpsertOne) ClearGroupID() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearGroupID()
- })
- }
- // SetSubscriptionID sets the "subscription_id" field.
- func (u *UsageLogUpsertOne) SetSubscriptionID(v int64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetSubscriptionID(v)
- })
- }
- // UpdateSubscriptionID sets the "subscription_id" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateSubscriptionID() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateSubscriptionID()
- })
- }
- // ClearSubscriptionID clears the value of the "subscription_id" field.
- func (u *UsageLogUpsertOne) ClearSubscriptionID() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearSubscriptionID()
- })
- }
- // SetInputTokens sets the "input_tokens" field.
- func (u *UsageLogUpsertOne) SetInputTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetInputTokens(v)
- })
- }
- // AddInputTokens adds v to the "input_tokens" field.
- func (u *UsageLogUpsertOne) AddInputTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddInputTokens(v)
- })
- }
- // UpdateInputTokens sets the "input_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateInputTokens() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateInputTokens()
- })
- }
- // SetOutputTokens sets the "output_tokens" field.
- func (u *UsageLogUpsertOne) SetOutputTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetOutputTokens(v)
- })
- }
- // AddOutputTokens adds v to the "output_tokens" field.
- func (u *UsageLogUpsertOne) AddOutputTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddOutputTokens(v)
- })
- }
- // UpdateOutputTokens sets the "output_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateOutputTokens() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateOutputTokens()
- })
- }
- // SetCacheCreationTokens sets the "cache_creation_tokens" field.
- func (u *UsageLogUpsertOne) SetCacheCreationTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheCreationTokens(v)
- })
- }
- // AddCacheCreationTokens adds v to the "cache_creation_tokens" field.
- func (u *UsageLogUpsertOne) AddCacheCreationTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheCreationTokens(v)
- })
- }
- // UpdateCacheCreationTokens sets the "cache_creation_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateCacheCreationTokens() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheCreationTokens()
- })
- }
- // SetCacheReadTokens sets the "cache_read_tokens" field.
- func (u *UsageLogUpsertOne) SetCacheReadTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheReadTokens(v)
- })
- }
- // AddCacheReadTokens adds v to the "cache_read_tokens" field.
- func (u *UsageLogUpsertOne) AddCacheReadTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheReadTokens(v)
- })
- }
- // UpdateCacheReadTokens sets the "cache_read_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateCacheReadTokens() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheReadTokens()
- })
- }
- // SetCacheCreation5mTokens sets the "cache_creation_5m_tokens" field.
- func (u *UsageLogUpsertOne) SetCacheCreation5mTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheCreation5mTokens(v)
- })
- }
- // AddCacheCreation5mTokens adds v to the "cache_creation_5m_tokens" field.
- func (u *UsageLogUpsertOne) AddCacheCreation5mTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheCreation5mTokens(v)
- })
- }
- // UpdateCacheCreation5mTokens sets the "cache_creation_5m_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateCacheCreation5mTokens() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheCreation5mTokens()
- })
- }
- // SetCacheCreation1hTokens sets the "cache_creation_1h_tokens" field.
- func (u *UsageLogUpsertOne) SetCacheCreation1hTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheCreation1hTokens(v)
- })
- }
- // AddCacheCreation1hTokens adds v to the "cache_creation_1h_tokens" field.
- func (u *UsageLogUpsertOne) AddCacheCreation1hTokens(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheCreation1hTokens(v)
- })
- }
- // UpdateCacheCreation1hTokens sets the "cache_creation_1h_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateCacheCreation1hTokens() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheCreation1hTokens()
- })
- }
- // SetInputCost sets the "input_cost" field.
- func (u *UsageLogUpsertOne) SetInputCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetInputCost(v)
- })
- }
- // AddInputCost adds v to the "input_cost" field.
- func (u *UsageLogUpsertOne) AddInputCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddInputCost(v)
- })
- }
- // UpdateInputCost sets the "input_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateInputCost() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateInputCost()
- })
- }
- // SetOutputCost sets the "output_cost" field.
- func (u *UsageLogUpsertOne) SetOutputCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetOutputCost(v)
- })
- }
- // AddOutputCost adds v to the "output_cost" field.
- func (u *UsageLogUpsertOne) AddOutputCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddOutputCost(v)
- })
- }
- // UpdateOutputCost sets the "output_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateOutputCost() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateOutputCost()
- })
- }
- // SetCacheCreationCost sets the "cache_creation_cost" field.
- func (u *UsageLogUpsertOne) SetCacheCreationCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheCreationCost(v)
- })
- }
- // AddCacheCreationCost adds v to the "cache_creation_cost" field.
- func (u *UsageLogUpsertOne) AddCacheCreationCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheCreationCost(v)
- })
- }
- // UpdateCacheCreationCost sets the "cache_creation_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateCacheCreationCost() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheCreationCost()
- })
- }
- // SetCacheReadCost sets the "cache_read_cost" field.
- func (u *UsageLogUpsertOne) SetCacheReadCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheReadCost(v)
- })
- }
- // AddCacheReadCost adds v to the "cache_read_cost" field.
- func (u *UsageLogUpsertOne) AddCacheReadCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheReadCost(v)
- })
- }
- // UpdateCacheReadCost sets the "cache_read_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateCacheReadCost() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheReadCost()
- })
- }
- // SetTotalCost sets the "total_cost" field.
- func (u *UsageLogUpsertOne) SetTotalCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetTotalCost(v)
- })
- }
- // AddTotalCost adds v to the "total_cost" field.
- func (u *UsageLogUpsertOne) AddTotalCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddTotalCost(v)
- })
- }
- // UpdateTotalCost sets the "total_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateTotalCost() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateTotalCost()
- })
- }
- // SetActualCost sets the "actual_cost" field.
- func (u *UsageLogUpsertOne) SetActualCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetActualCost(v)
- })
- }
- // AddActualCost adds v to the "actual_cost" field.
- func (u *UsageLogUpsertOne) AddActualCost(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddActualCost(v)
- })
- }
- // UpdateActualCost sets the "actual_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateActualCost() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateActualCost()
- })
- }
- // SetRateMultiplier sets the "rate_multiplier" field.
- func (u *UsageLogUpsertOne) SetRateMultiplier(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetRateMultiplier(v)
- })
- }
- // AddRateMultiplier adds v to the "rate_multiplier" field.
- func (u *UsageLogUpsertOne) AddRateMultiplier(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddRateMultiplier(v)
- })
- }
- // UpdateRateMultiplier sets the "rate_multiplier" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateRateMultiplier() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateRateMultiplier()
- })
- }
- // SetLongContextBillingApplied sets the "long_context_billing_applied" field.
- func (u *UsageLogUpsertOne) SetLongContextBillingApplied(v bool) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetLongContextBillingApplied(v)
- })
- }
- // UpdateLongContextBillingApplied sets the "long_context_billing_applied" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateLongContextBillingApplied() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateLongContextBillingApplied()
- })
- }
- // SetAccountRateMultiplier sets the "account_rate_multiplier" field.
- func (u *UsageLogUpsertOne) SetAccountRateMultiplier(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetAccountRateMultiplier(v)
- })
- }
- // AddAccountRateMultiplier adds v to the "account_rate_multiplier" field.
- func (u *UsageLogUpsertOne) AddAccountRateMultiplier(v float64) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddAccountRateMultiplier(v)
- })
- }
- // UpdateAccountRateMultiplier sets the "account_rate_multiplier" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateAccountRateMultiplier() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateAccountRateMultiplier()
- })
- }
- // ClearAccountRateMultiplier clears the value of the "account_rate_multiplier" field.
- func (u *UsageLogUpsertOne) ClearAccountRateMultiplier() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearAccountRateMultiplier()
- })
- }
- // SetBillingType sets the "billing_type" field.
- func (u *UsageLogUpsertOne) SetBillingType(v int8) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetBillingType(v)
- })
- }
- // AddBillingType adds v to the "billing_type" field.
- func (u *UsageLogUpsertOne) AddBillingType(v int8) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddBillingType(v)
- })
- }
- // UpdateBillingType sets the "billing_type" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateBillingType() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateBillingType()
- })
- }
- // SetStream sets the "stream" field.
- func (u *UsageLogUpsertOne) SetStream(v bool) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetStream(v)
- })
- }
- // UpdateStream sets the "stream" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateStream() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateStream()
- })
- }
- // SetDurationMs sets the "duration_ms" field.
- func (u *UsageLogUpsertOne) SetDurationMs(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetDurationMs(v)
- })
- }
- // AddDurationMs adds v to the "duration_ms" field.
- func (u *UsageLogUpsertOne) AddDurationMs(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddDurationMs(v)
- })
- }
- // UpdateDurationMs sets the "duration_ms" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateDurationMs() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateDurationMs()
- })
- }
- // ClearDurationMs clears the value of the "duration_ms" field.
- func (u *UsageLogUpsertOne) ClearDurationMs() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearDurationMs()
- })
- }
- // SetFirstTokenMs sets the "first_token_ms" field.
- func (u *UsageLogUpsertOne) SetFirstTokenMs(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetFirstTokenMs(v)
- })
- }
- // AddFirstTokenMs adds v to the "first_token_ms" field.
- func (u *UsageLogUpsertOne) AddFirstTokenMs(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddFirstTokenMs(v)
- })
- }
- // UpdateFirstTokenMs sets the "first_token_ms" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateFirstTokenMs() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateFirstTokenMs()
- })
- }
- // ClearFirstTokenMs clears the value of the "first_token_ms" field.
- func (u *UsageLogUpsertOne) ClearFirstTokenMs() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearFirstTokenMs()
- })
- }
- // SetUserAgent sets the "user_agent" field.
- func (u *UsageLogUpsertOne) SetUserAgent(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetUserAgent(v)
- })
- }
- // UpdateUserAgent sets the "user_agent" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateUserAgent() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateUserAgent()
- })
- }
- // ClearUserAgent clears the value of the "user_agent" field.
- func (u *UsageLogUpsertOne) ClearUserAgent() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearUserAgent()
- })
- }
- // SetIPAddress sets the "ip_address" field.
- func (u *UsageLogUpsertOne) SetIPAddress(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetIPAddress(v)
- })
- }
- // UpdateIPAddress sets the "ip_address" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateIPAddress() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateIPAddress()
- })
- }
- // ClearIPAddress clears the value of the "ip_address" field.
- func (u *UsageLogUpsertOne) ClearIPAddress() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearIPAddress()
- })
- }
- // SetImageCount sets the "image_count" field.
- func (u *UsageLogUpsertOne) SetImageCount(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageCount(v)
- })
- }
- // AddImageCount adds v to the "image_count" field.
- func (u *UsageLogUpsertOne) AddImageCount(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddImageCount(v)
- })
- }
- // UpdateImageCount sets the "image_count" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateImageCount() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageCount()
- })
- }
- // SetImageSize sets the "image_size" field.
- func (u *UsageLogUpsertOne) SetImageSize(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageSize(v)
- })
- }
- // UpdateImageSize sets the "image_size" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateImageSize() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageSize()
- })
- }
- // ClearImageSize clears the value of the "image_size" field.
- func (u *UsageLogUpsertOne) ClearImageSize() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearImageSize()
- })
- }
- // SetImageInputSize sets the "image_input_size" field.
- func (u *UsageLogUpsertOne) SetImageInputSize(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageInputSize(v)
- })
- }
- // UpdateImageInputSize sets the "image_input_size" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateImageInputSize() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageInputSize()
- })
- }
- // ClearImageInputSize clears the value of the "image_input_size" field.
- func (u *UsageLogUpsertOne) ClearImageInputSize() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearImageInputSize()
- })
- }
- // SetImageOutputSize sets the "image_output_size" field.
- func (u *UsageLogUpsertOne) SetImageOutputSize(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageOutputSize(v)
- })
- }
- // UpdateImageOutputSize sets the "image_output_size" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateImageOutputSize() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageOutputSize()
- })
- }
- // ClearImageOutputSize clears the value of the "image_output_size" field.
- func (u *UsageLogUpsertOne) ClearImageOutputSize() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearImageOutputSize()
- })
- }
- // SetImageSizeSource sets the "image_size_source" field.
- func (u *UsageLogUpsertOne) SetImageSizeSource(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageSizeSource(v)
- })
- }
- // UpdateImageSizeSource sets the "image_size_source" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateImageSizeSource() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageSizeSource()
- })
- }
- // ClearImageSizeSource clears the value of the "image_size_source" field.
- func (u *UsageLogUpsertOne) ClearImageSizeSource() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearImageSizeSource()
- })
- }
- // SetImageSizeBreakdown sets the "image_size_breakdown" field.
- func (u *UsageLogUpsertOne) SetImageSizeBreakdown(v map[string]int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageSizeBreakdown(v)
- })
- }
- // UpdateImageSizeBreakdown sets the "image_size_breakdown" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateImageSizeBreakdown() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageSizeBreakdown()
- })
- }
- // ClearImageSizeBreakdown clears the value of the "image_size_breakdown" field.
- func (u *UsageLogUpsertOne) ClearImageSizeBreakdown() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearImageSizeBreakdown()
- })
- }
- // SetVideoCount sets the "video_count" field.
- func (u *UsageLogUpsertOne) SetVideoCount(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetVideoCount(v)
- })
- }
- // AddVideoCount adds v to the "video_count" field.
- func (u *UsageLogUpsertOne) AddVideoCount(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddVideoCount(v)
- })
- }
- // UpdateVideoCount sets the "video_count" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateVideoCount() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateVideoCount()
- })
- }
- // SetVideoResolution sets the "video_resolution" field.
- func (u *UsageLogUpsertOne) SetVideoResolution(v string) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetVideoResolution(v)
- })
- }
- // UpdateVideoResolution sets the "video_resolution" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateVideoResolution() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateVideoResolution()
- })
- }
- // ClearVideoResolution clears the value of the "video_resolution" field.
- func (u *UsageLogUpsertOne) ClearVideoResolution() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearVideoResolution()
- })
- }
- // SetVideoDurationSeconds sets the "video_duration_seconds" field.
- func (u *UsageLogUpsertOne) SetVideoDurationSeconds(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetVideoDurationSeconds(v)
- })
- }
- // AddVideoDurationSeconds adds v to the "video_duration_seconds" field.
- func (u *UsageLogUpsertOne) AddVideoDurationSeconds(v int) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddVideoDurationSeconds(v)
- })
- }
- // UpdateVideoDurationSeconds sets the "video_duration_seconds" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateVideoDurationSeconds() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateVideoDurationSeconds()
- })
- }
- // ClearVideoDurationSeconds clears the value of the "video_duration_seconds" field.
- func (u *UsageLogUpsertOne) ClearVideoDurationSeconds() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearVideoDurationSeconds()
- })
- }
- // SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
- func (u *UsageLogUpsertOne) SetCacheTTLOverridden(v bool) *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheTTLOverridden(v)
- })
- }
- // UpdateCacheTTLOverridden sets the "cache_ttl_overridden" field to the value that was provided on create.
- func (u *UsageLogUpsertOne) UpdateCacheTTLOverridden() *UsageLogUpsertOne {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheTTLOverridden()
- })
- }
- // Exec executes the query.
- func (u *UsageLogUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for UsageLogCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *UsageLogUpsertOne) 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 *UsageLogUpsertOne) ID(ctx context.Context) (id int64, err error) {
- 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 *UsageLogUpsertOne) IDX(ctx context.Context) int64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // UsageLogCreateBulk is the builder for creating many UsageLog entities in bulk.
- type UsageLogCreateBulk struct {
- config
- err error
- builders []*UsageLogCreate
- conflict []sql.ConflictOption
- }
- // Save creates the UsageLog entities in the database.
- func (_c *UsageLogCreateBulk) Save(ctx context.Context) ([]*UsageLog, error) {
- if _c.err != nil {
- return nil, _c.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
- nodes := make([]*UsageLog, 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.(*UsageLogMutation)
- 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
- if specs[i].ID.Value != nil {
- id := specs[i].ID.Value.(int64)
- nodes[i].ID = int64(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 *UsageLogCreateBulk) SaveX(ctx context.Context) []*UsageLog {
- v, err := _c.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (_c *UsageLogCreateBulk) Exec(ctx context.Context) error {
- _, err := _c.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (_c *UsageLogCreateBulk) 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.UsageLog.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.UsageLogUpsert) {
- // SetUserID(v+v).
- // }).
- // Exec(ctx)
- func (_c *UsageLogCreateBulk) OnConflict(opts ...sql.ConflictOption) *UsageLogUpsertBulk {
- _c.conflict = opts
- return &UsageLogUpsertBulk{
- create: _c,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.UsageLog.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (_c *UsageLogCreateBulk) OnConflictColumns(columns ...string) *UsageLogUpsertBulk {
- _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
- return &UsageLogUpsertBulk{
- create: _c,
- }
- }
- // UsageLogUpsertBulk is the builder for "upsert"-ing
- // a bulk of UsageLog nodes.
- type UsageLogUpsertBulk struct {
- create *UsageLogCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.UsageLog.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // ).
- // Exec(ctx)
- func (u *UsageLogUpsertBulk) UpdateNewValues() *UsageLogUpsertBulk {
- 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.CreatedAt(); exists {
- s.SetIgnore(usagelog.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.UsageLog.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *UsageLogUpsertBulk) Ignore() *UsageLogUpsertBulk {
- 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 *UsageLogUpsertBulk) DoNothing() *UsageLogUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the UsageLogCreateBulk.OnConflict
- // documentation for more info.
- func (u *UsageLogUpsertBulk) Update(set func(*UsageLogUpsert)) *UsageLogUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&UsageLogUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUserID sets the "user_id" field.
- func (u *UsageLogUpsertBulk) SetUserID(v int64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetUserID(v)
- })
- }
- // UpdateUserID sets the "user_id" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateUserID() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateUserID()
- })
- }
- // SetAPIKeyID sets the "api_key_id" field.
- func (u *UsageLogUpsertBulk) SetAPIKeyID(v int64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetAPIKeyID(v)
- })
- }
- // UpdateAPIKeyID sets the "api_key_id" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateAPIKeyID() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateAPIKeyID()
- })
- }
- // SetAccountID sets the "account_id" field.
- func (u *UsageLogUpsertBulk) SetAccountID(v int64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetAccountID(v)
- })
- }
- // UpdateAccountID sets the "account_id" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateAccountID() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateAccountID()
- })
- }
- // SetRequestID sets the "request_id" field.
- func (u *UsageLogUpsertBulk) SetRequestID(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetRequestID(v)
- })
- }
- // UpdateRequestID sets the "request_id" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateRequestID() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateRequestID()
- })
- }
- // SetModel sets the "model" field.
- func (u *UsageLogUpsertBulk) SetModel(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetModel(v)
- })
- }
- // UpdateModel sets the "model" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateModel() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateModel()
- })
- }
- // SetRequestedModel sets the "requested_model" field.
- func (u *UsageLogUpsertBulk) SetRequestedModel(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetRequestedModel(v)
- })
- }
- // UpdateRequestedModel sets the "requested_model" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateRequestedModel() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateRequestedModel()
- })
- }
- // ClearRequestedModel clears the value of the "requested_model" field.
- func (u *UsageLogUpsertBulk) ClearRequestedModel() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearRequestedModel()
- })
- }
- // SetUpstreamModel sets the "upstream_model" field.
- func (u *UsageLogUpsertBulk) SetUpstreamModel(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetUpstreamModel(v)
- })
- }
- // UpdateUpstreamModel sets the "upstream_model" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateUpstreamModel() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateUpstreamModel()
- })
- }
- // ClearUpstreamModel clears the value of the "upstream_model" field.
- func (u *UsageLogUpsertBulk) ClearUpstreamModel() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearUpstreamModel()
- })
- }
- // SetUpstreamResponseModel sets the "upstream_response_model" field.
- func (u *UsageLogUpsertBulk) SetUpstreamResponseModel(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetUpstreamResponseModel(v)
- })
- }
- // UpdateUpstreamResponseModel sets the "upstream_response_model" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateUpstreamResponseModel() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateUpstreamResponseModel()
- })
- }
- // ClearUpstreamResponseModel clears the value of the "upstream_response_model" field.
- func (u *UsageLogUpsertBulk) ClearUpstreamResponseModel() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearUpstreamResponseModel()
- })
- }
- // SetUpstreamModelMismatch sets the "upstream_model_mismatch" field.
- func (u *UsageLogUpsertBulk) SetUpstreamModelMismatch(v bool) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetUpstreamModelMismatch(v)
- })
- }
- // UpdateUpstreamModelMismatch sets the "upstream_model_mismatch" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateUpstreamModelMismatch() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateUpstreamModelMismatch()
- })
- }
- // ClearUpstreamModelMismatch clears the value of the "upstream_model_mismatch" field.
- func (u *UsageLogUpsertBulk) ClearUpstreamModelMismatch() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearUpstreamModelMismatch()
- })
- }
- // SetChannelID sets the "channel_id" field.
- func (u *UsageLogUpsertBulk) SetChannelID(v int64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetChannelID(v)
- })
- }
- // AddChannelID adds v to the "channel_id" field.
- func (u *UsageLogUpsertBulk) AddChannelID(v int64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddChannelID(v)
- })
- }
- // UpdateChannelID sets the "channel_id" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateChannelID() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateChannelID()
- })
- }
- // ClearChannelID clears the value of the "channel_id" field.
- func (u *UsageLogUpsertBulk) ClearChannelID() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearChannelID()
- })
- }
- // SetModelMappingChain sets the "model_mapping_chain" field.
- func (u *UsageLogUpsertBulk) SetModelMappingChain(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetModelMappingChain(v)
- })
- }
- // UpdateModelMappingChain sets the "model_mapping_chain" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateModelMappingChain() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateModelMappingChain()
- })
- }
- // ClearModelMappingChain clears the value of the "model_mapping_chain" field.
- func (u *UsageLogUpsertBulk) ClearModelMappingChain() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearModelMappingChain()
- })
- }
- // SetBillingTier sets the "billing_tier" field.
- func (u *UsageLogUpsertBulk) SetBillingTier(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetBillingTier(v)
- })
- }
- // UpdateBillingTier sets the "billing_tier" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateBillingTier() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateBillingTier()
- })
- }
- // ClearBillingTier clears the value of the "billing_tier" field.
- func (u *UsageLogUpsertBulk) ClearBillingTier() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearBillingTier()
- })
- }
- // SetBillingMode sets the "billing_mode" field.
- func (u *UsageLogUpsertBulk) SetBillingMode(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetBillingMode(v)
- })
- }
- // UpdateBillingMode sets the "billing_mode" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateBillingMode() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateBillingMode()
- })
- }
- // ClearBillingMode clears the value of the "billing_mode" field.
- func (u *UsageLogUpsertBulk) ClearBillingMode() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearBillingMode()
- })
- }
- // SetGroupID sets the "group_id" field.
- func (u *UsageLogUpsertBulk) SetGroupID(v int64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetGroupID(v)
- })
- }
- // UpdateGroupID sets the "group_id" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateGroupID() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateGroupID()
- })
- }
- // ClearGroupID clears the value of the "group_id" field.
- func (u *UsageLogUpsertBulk) ClearGroupID() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearGroupID()
- })
- }
- // SetSubscriptionID sets the "subscription_id" field.
- func (u *UsageLogUpsertBulk) SetSubscriptionID(v int64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetSubscriptionID(v)
- })
- }
- // UpdateSubscriptionID sets the "subscription_id" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateSubscriptionID() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateSubscriptionID()
- })
- }
- // ClearSubscriptionID clears the value of the "subscription_id" field.
- func (u *UsageLogUpsertBulk) ClearSubscriptionID() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearSubscriptionID()
- })
- }
- // SetInputTokens sets the "input_tokens" field.
- func (u *UsageLogUpsertBulk) SetInputTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetInputTokens(v)
- })
- }
- // AddInputTokens adds v to the "input_tokens" field.
- func (u *UsageLogUpsertBulk) AddInputTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddInputTokens(v)
- })
- }
- // UpdateInputTokens sets the "input_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateInputTokens() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateInputTokens()
- })
- }
- // SetOutputTokens sets the "output_tokens" field.
- func (u *UsageLogUpsertBulk) SetOutputTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetOutputTokens(v)
- })
- }
- // AddOutputTokens adds v to the "output_tokens" field.
- func (u *UsageLogUpsertBulk) AddOutputTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddOutputTokens(v)
- })
- }
- // UpdateOutputTokens sets the "output_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateOutputTokens() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateOutputTokens()
- })
- }
- // SetCacheCreationTokens sets the "cache_creation_tokens" field.
- func (u *UsageLogUpsertBulk) SetCacheCreationTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheCreationTokens(v)
- })
- }
- // AddCacheCreationTokens adds v to the "cache_creation_tokens" field.
- func (u *UsageLogUpsertBulk) AddCacheCreationTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheCreationTokens(v)
- })
- }
- // UpdateCacheCreationTokens sets the "cache_creation_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateCacheCreationTokens() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheCreationTokens()
- })
- }
- // SetCacheReadTokens sets the "cache_read_tokens" field.
- func (u *UsageLogUpsertBulk) SetCacheReadTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheReadTokens(v)
- })
- }
- // AddCacheReadTokens adds v to the "cache_read_tokens" field.
- func (u *UsageLogUpsertBulk) AddCacheReadTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheReadTokens(v)
- })
- }
- // UpdateCacheReadTokens sets the "cache_read_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateCacheReadTokens() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheReadTokens()
- })
- }
- // SetCacheCreation5mTokens sets the "cache_creation_5m_tokens" field.
- func (u *UsageLogUpsertBulk) SetCacheCreation5mTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheCreation5mTokens(v)
- })
- }
- // AddCacheCreation5mTokens adds v to the "cache_creation_5m_tokens" field.
- func (u *UsageLogUpsertBulk) AddCacheCreation5mTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheCreation5mTokens(v)
- })
- }
- // UpdateCacheCreation5mTokens sets the "cache_creation_5m_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateCacheCreation5mTokens() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheCreation5mTokens()
- })
- }
- // SetCacheCreation1hTokens sets the "cache_creation_1h_tokens" field.
- func (u *UsageLogUpsertBulk) SetCacheCreation1hTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheCreation1hTokens(v)
- })
- }
- // AddCacheCreation1hTokens adds v to the "cache_creation_1h_tokens" field.
- func (u *UsageLogUpsertBulk) AddCacheCreation1hTokens(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheCreation1hTokens(v)
- })
- }
- // UpdateCacheCreation1hTokens sets the "cache_creation_1h_tokens" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateCacheCreation1hTokens() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheCreation1hTokens()
- })
- }
- // SetInputCost sets the "input_cost" field.
- func (u *UsageLogUpsertBulk) SetInputCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetInputCost(v)
- })
- }
- // AddInputCost adds v to the "input_cost" field.
- func (u *UsageLogUpsertBulk) AddInputCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddInputCost(v)
- })
- }
- // UpdateInputCost sets the "input_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateInputCost() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateInputCost()
- })
- }
- // SetOutputCost sets the "output_cost" field.
- func (u *UsageLogUpsertBulk) SetOutputCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetOutputCost(v)
- })
- }
- // AddOutputCost adds v to the "output_cost" field.
- func (u *UsageLogUpsertBulk) AddOutputCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddOutputCost(v)
- })
- }
- // UpdateOutputCost sets the "output_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateOutputCost() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateOutputCost()
- })
- }
- // SetCacheCreationCost sets the "cache_creation_cost" field.
- func (u *UsageLogUpsertBulk) SetCacheCreationCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheCreationCost(v)
- })
- }
- // AddCacheCreationCost adds v to the "cache_creation_cost" field.
- func (u *UsageLogUpsertBulk) AddCacheCreationCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheCreationCost(v)
- })
- }
- // UpdateCacheCreationCost sets the "cache_creation_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateCacheCreationCost() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheCreationCost()
- })
- }
- // SetCacheReadCost sets the "cache_read_cost" field.
- func (u *UsageLogUpsertBulk) SetCacheReadCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheReadCost(v)
- })
- }
- // AddCacheReadCost adds v to the "cache_read_cost" field.
- func (u *UsageLogUpsertBulk) AddCacheReadCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddCacheReadCost(v)
- })
- }
- // UpdateCacheReadCost sets the "cache_read_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateCacheReadCost() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheReadCost()
- })
- }
- // SetTotalCost sets the "total_cost" field.
- func (u *UsageLogUpsertBulk) SetTotalCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetTotalCost(v)
- })
- }
- // AddTotalCost adds v to the "total_cost" field.
- func (u *UsageLogUpsertBulk) AddTotalCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddTotalCost(v)
- })
- }
- // UpdateTotalCost sets the "total_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateTotalCost() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateTotalCost()
- })
- }
- // SetActualCost sets the "actual_cost" field.
- func (u *UsageLogUpsertBulk) SetActualCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetActualCost(v)
- })
- }
- // AddActualCost adds v to the "actual_cost" field.
- func (u *UsageLogUpsertBulk) AddActualCost(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddActualCost(v)
- })
- }
- // UpdateActualCost sets the "actual_cost" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateActualCost() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateActualCost()
- })
- }
- // SetRateMultiplier sets the "rate_multiplier" field.
- func (u *UsageLogUpsertBulk) SetRateMultiplier(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetRateMultiplier(v)
- })
- }
- // AddRateMultiplier adds v to the "rate_multiplier" field.
- func (u *UsageLogUpsertBulk) AddRateMultiplier(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddRateMultiplier(v)
- })
- }
- // UpdateRateMultiplier sets the "rate_multiplier" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateRateMultiplier() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateRateMultiplier()
- })
- }
- // SetLongContextBillingApplied sets the "long_context_billing_applied" field.
- func (u *UsageLogUpsertBulk) SetLongContextBillingApplied(v bool) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetLongContextBillingApplied(v)
- })
- }
- // UpdateLongContextBillingApplied sets the "long_context_billing_applied" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateLongContextBillingApplied() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateLongContextBillingApplied()
- })
- }
- // SetAccountRateMultiplier sets the "account_rate_multiplier" field.
- func (u *UsageLogUpsertBulk) SetAccountRateMultiplier(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetAccountRateMultiplier(v)
- })
- }
- // AddAccountRateMultiplier adds v to the "account_rate_multiplier" field.
- func (u *UsageLogUpsertBulk) AddAccountRateMultiplier(v float64) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddAccountRateMultiplier(v)
- })
- }
- // UpdateAccountRateMultiplier sets the "account_rate_multiplier" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateAccountRateMultiplier() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateAccountRateMultiplier()
- })
- }
- // ClearAccountRateMultiplier clears the value of the "account_rate_multiplier" field.
- func (u *UsageLogUpsertBulk) ClearAccountRateMultiplier() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearAccountRateMultiplier()
- })
- }
- // SetBillingType sets the "billing_type" field.
- func (u *UsageLogUpsertBulk) SetBillingType(v int8) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetBillingType(v)
- })
- }
- // AddBillingType adds v to the "billing_type" field.
- func (u *UsageLogUpsertBulk) AddBillingType(v int8) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddBillingType(v)
- })
- }
- // UpdateBillingType sets the "billing_type" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateBillingType() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateBillingType()
- })
- }
- // SetStream sets the "stream" field.
- func (u *UsageLogUpsertBulk) SetStream(v bool) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetStream(v)
- })
- }
- // UpdateStream sets the "stream" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateStream() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateStream()
- })
- }
- // SetDurationMs sets the "duration_ms" field.
- func (u *UsageLogUpsertBulk) SetDurationMs(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetDurationMs(v)
- })
- }
- // AddDurationMs adds v to the "duration_ms" field.
- func (u *UsageLogUpsertBulk) AddDurationMs(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddDurationMs(v)
- })
- }
- // UpdateDurationMs sets the "duration_ms" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateDurationMs() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateDurationMs()
- })
- }
- // ClearDurationMs clears the value of the "duration_ms" field.
- func (u *UsageLogUpsertBulk) ClearDurationMs() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearDurationMs()
- })
- }
- // SetFirstTokenMs sets the "first_token_ms" field.
- func (u *UsageLogUpsertBulk) SetFirstTokenMs(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetFirstTokenMs(v)
- })
- }
- // AddFirstTokenMs adds v to the "first_token_ms" field.
- func (u *UsageLogUpsertBulk) AddFirstTokenMs(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddFirstTokenMs(v)
- })
- }
- // UpdateFirstTokenMs sets the "first_token_ms" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateFirstTokenMs() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateFirstTokenMs()
- })
- }
- // ClearFirstTokenMs clears the value of the "first_token_ms" field.
- func (u *UsageLogUpsertBulk) ClearFirstTokenMs() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearFirstTokenMs()
- })
- }
- // SetUserAgent sets the "user_agent" field.
- func (u *UsageLogUpsertBulk) SetUserAgent(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetUserAgent(v)
- })
- }
- // UpdateUserAgent sets the "user_agent" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateUserAgent() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateUserAgent()
- })
- }
- // ClearUserAgent clears the value of the "user_agent" field.
- func (u *UsageLogUpsertBulk) ClearUserAgent() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearUserAgent()
- })
- }
- // SetIPAddress sets the "ip_address" field.
- func (u *UsageLogUpsertBulk) SetIPAddress(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetIPAddress(v)
- })
- }
- // UpdateIPAddress sets the "ip_address" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateIPAddress() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateIPAddress()
- })
- }
- // ClearIPAddress clears the value of the "ip_address" field.
- func (u *UsageLogUpsertBulk) ClearIPAddress() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearIPAddress()
- })
- }
- // SetImageCount sets the "image_count" field.
- func (u *UsageLogUpsertBulk) SetImageCount(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageCount(v)
- })
- }
- // AddImageCount adds v to the "image_count" field.
- func (u *UsageLogUpsertBulk) AddImageCount(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddImageCount(v)
- })
- }
- // UpdateImageCount sets the "image_count" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateImageCount() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageCount()
- })
- }
- // SetImageSize sets the "image_size" field.
- func (u *UsageLogUpsertBulk) SetImageSize(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageSize(v)
- })
- }
- // UpdateImageSize sets the "image_size" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateImageSize() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageSize()
- })
- }
- // ClearImageSize clears the value of the "image_size" field.
- func (u *UsageLogUpsertBulk) ClearImageSize() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearImageSize()
- })
- }
- // SetImageInputSize sets the "image_input_size" field.
- func (u *UsageLogUpsertBulk) SetImageInputSize(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageInputSize(v)
- })
- }
- // UpdateImageInputSize sets the "image_input_size" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateImageInputSize() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageInputSize()
- })
- }
- // ClearImageInputSize clears the value of the "image_input_size" field.
- func (u *UsageLogUpsertBulk) ClearImageInputSize() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearImageInputSize()
- })
- }
- // SetImageOutputSize sets the "image_output_size" field.
- func (u *UsageLogUpsertBulk) SetImageOutputSize(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageOutputSize(v)
- })
- }
- // UpdateImageOutputSize sets the "image_output_size" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateImageOutputSize() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageOutputSize()
- })
- }
- // ClearImageOutputSize clears the value of the "image_output_size" field.
- func (u *UsageLogUpsertBulk) ClearImageOutputSize() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearImageOutputSize()
- })
- }
- // SetImageSizeSource sets the "image_size_source" field.
- func (u *UsageLogUpsertBulk) SetImageSizeSource(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageSizeSource(v)
- })
- }
- // UpdateImageSizeSource sets the "image_size_source" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateImageSizeSource() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageSizeSource()
- })
- }
- // ClearImageSizeSource clears the value of the "image_size_source" field.
- func (u *UsageLogUpsertBulk) ClearImageSizeSource() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearImageSizeSource()
- })
- }
- // SetImageSizeBreakdown sets the "image_size_breakdown" field.
- func (u *UsageLogUpsertBulk) SetImageSizeBreakdown(v map[string]int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetImageSizeBreakdown(v)
- })
- }
- // UpdateImageSizeBreakdown sets the "image_size_breakdown" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateImageSizeBreakdown() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateImageSizeBreakdown()
- })
- }
- // ClearImageSizeBreakdown clears the value of the "image_size_breakdown" field.
- func (u *UsageLogUpsertBulk) ClearImageSizeBreakdown() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearImageSizeBreakdown()
- })
- }
- // SetVideoCount sets the "video_count" field.
- func (u *UsageLogUpsertBulk) SetVideoCount(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetVideoCount(v)
- })
- }
- // AddVideoCount adds v to the "video_count" field.
- func (u *UsageLogUpsertBulk) AddVideoCount(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddVideoCount(v)
- })
- }
- // UpdateVideoCount sets the "video_count" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateVideoCount() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateVideoCount()
- })
- }
- // SetVideoResolution sets the "video_resolution" field.
- func (u *UsageLogUpsertBulk) SetVideoResolution(v string) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetVideoResolution(v)
- })
- }
- // UpdateVideoResolution sets the "video_resolution" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateVideoResolution() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateVideoResolution()
- })
- }
- // ClearVideoResolution clears the value of the "video_resolution" field.
- func (u *UsageLogUpsertBulk) ClearVideoResolution() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearVideoResolution()
- })
- }
- // SetVideoDurationSeconds sets the "video_duration_seconds" field.
- func (u *UsageLogUpsertBulk) SetVideoDurationSeconds(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetVideoDurationSeconds(v)
- })
- }
- // AddVideoDurationSeconds adds v to the "video_duration_seconds" field.
- func (u *UsageLogUpsertBulk) AddVideoDurationSeconds(v int) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.AddVideoDurationSeconds(v)
- })
- }
- // UpdateVideoDurationSeconds sets the "video_duration_seconds" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateVideoDurationSeconds() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateVideoDurationSeconds()
- })
- }
- // ClearVideoDurationSeconds clears the value of the "video_duration_seconds" field.
- func (u *UsageLogUpsertBulk) ClearVideoDurationSeconds() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.ClearVideoDurationSeconds()
- })
- }
- // SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
- func (u *UsageLogUpsertBulk) SetCacheTTLOverridden(v bool) *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.SetCacheTTLOverridden(v)
- })
- }
- // UpdateCacheTTLOverridden sets the "cache_ttl_overridden" field to the value that was provided on create.
- func (u *UsageLogUpsertBulk) UpdateCacheTTLOverridden() *UsageLogUpsertBulk {
- return u.Update(func(s *UsageLogUpsert) {
- s.UpdateCacheTTLOverridden()
- })
- }
- // Exec executes the query.
- func (u *UsageLogUpsertBulk) 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("ent: OnConflict was set for builder %d. Set it on the UsageLogCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for UsageLogCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *UsageLogUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|