1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/employee"
- "wechat-api/ent/tutorial"
- "wechat-api/ent/workexperience"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // EmployeeCreate is the builder for creating a Employee entity.
- type EmployeeCreate struct {
- config
- mutation *EmployeeMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetCreatedAt sets the "created_at" field.
- func (ec *EmployeeCreate) SetCreatedAt(t time.Time) *EmployeeCreate {
- ec.mutation.SetCreatedAt(t)
- return ec
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableCreatedAt(t *time.Time) *EmployeeCreate {
- if t != nil {
- ec.SetCreatedAt(*t)
- }
- return ec
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (ec *EmployeeCreate) SetUpdatedAt(t time.Time) *EmployeeCreate {
- ec.mutation.SetUpdatedAt(t)
- return ec
- }
- // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableUpdatedAt(t *time.Time) *EmployeeCreate {
- if t != nil {
- ec.SetUpdatedAt(*t)
- }
- return ec
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (ec *EmployeeCreate) SetDeletedAt(t time.Time) *EmployeeCreate {
- ec.mutation.SetDeletedAt(t)
- return ec
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableDeletedAt(t *time.Time) *EmployeeCreate {
- if t != nil {
- ec.SetDeletedAt(*t)
- }
- return ec
- }
- // SetTitle sets the "title" field.
- func (ec *EmployeeCreate) SetTitle(s string) *EmployeeCreate {
- ec.mutation.SetTitle(s)
- return ec
- }
- // SetAvatar sets the "avatar" field.
- func (ec *EmployeeCreate) SetAvatar(s string) *EmployeeCreate {
- ec.mutation.SetAvatar(s)
- return ec
- }
- // SetTags sets the "tags" field.
- func (ec *EmployeeCreate) SetTags(s string) *EmployeeCreate {
- ec.mutation.SetTags(s)
- return ec
- }
- // SetHireCount sets the "hire_count" field.
- func (ec *EmployeeCreate) SetHireCount(i int) *EmployeeCreate {
- ec.mutation.SetHireCount(i)
- return ec
- }
- // SetNillableHireCount sets the "hire_count" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableHireCount(i *int) *EmployeeCreate {
- if i != nil {
- ec.SetHireCount(*i)
- }
- return ec
- }
- // SetServiceCount sets the "service_count" field.
- func (ec *EmployeeCreate) SetServiceCount(i int) *EmployeeCreate {
- ec.mutation.SetServiceCount(i)
- return ec
- }
- // SetNillableServiceCount sets the "service_count" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableServiceCount(i *int) *EmployeeCreate {
- if i != nil {
- ec.SetServiceCount(*i)
- }
- return ec
- }
- // SetAchievementCount sets the "achievement_count" field.
- func (ec *EmployeeCreate) SetAchievementCount(i int) *EmployeeCreate {
- ec.mutation.SetAchievementCount(i)
- return ec
- }
- // SetNillableAchievementCount sets the "achievement_count" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableAchievementCount(i *int) *EmployeeCreate {
- if i != nil {
- ec.SetAchievementCount(*i)
- }
- return ec
- }
- // SetIntro sets the "intro" field.
- func (ec *EmployeeCreate) SetIntro(s string) *EmployeeCreate {
- ec.mutation.SetIntro(s)
- return ec
- }
- // SetNillableIntro sets the "intro" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableIntro(s *string) *EmployeeCreate {
- if s != nil {
- ec.SetIntro(*s)
- }
- return ec
- }
- // SetEstimate sets the "estimate" field.
- func (ec *EmployeeCreate) SetEstimate(s string) *EmployeeCreate {
- ec.mutation.SetEstimate(s)
- return ec
- }
- // SetNillableEstimate sets the "estimate" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableEstimate(s *string) *EmployeeCreate {
- if s != nil {
- ec.SetEstimate(*s)
- }
- return ec
- }
- // SetSkill sets the "skill" field.
- func (ec *EmployeeCreate) SetSkill(s string) *EmployeeCreate {
- ec.mutation.SetSkill(s)
- return ec
- }
- // SetNillableSkill sets the "skill" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableSkill(s *string) *EmployeeCreate {
- if s != nil {
- ec.SetSkill(*s)
- }
- return ec
- }
- // SetAbilityType sets the "ability_type" field.
- func (ec *EmployeeCreate) SetAbilityType(s string) *EmployeeCreate {
- ec.mutation.SetAbilityType(s)
- return ec
- }
- // SetNillableAbilityType sets the "ability_type" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableAbilityType(s *string) *EmployeeCreate {
- if s != nil {
- ec.SetAbilityType(*s)
- }
- return ec
- }
- // SetScene sets the "scene" field.
- func (ec *EmployeeCreate) SetScene(s string) *EmployeeCreate {
- ec.mutation.SetScene(s)
- return ec
- }
- // SetNillableScene sets the "scene" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableScene(s *string) *EmployeeCreate {
- if s != nil {
- ec.SetScene(*s)
- }
- return ec
- }
- // SetSwitchIn sets the "switch_in" field.
- func (ec *EmployeeCreate) SetSwitchIn(s string) *EmployeeCreate {
- ec.mutation.SetSwitchIn(s)
- return ec
- }
- // SetNillableSwitchIn sets the "switch_in" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableSwitchIn(s *string) *EmployeeCreate {
- if s != nil {
- ec.SetSwitchIn(*s)
- }
- return ec
- }
- // SetVideoURL sets the "video_url" field.
- func (ec *EmployeeCreate) SetVideoURL(s string) *EmployeeCreate {
- ec.mutation.SetVideoURL(s)
- return ec
- }
- // SetNillableVideoURL sets the "video_url" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableVideoURL(s *string) *EmployeeCreate {
- if s != nil {
- ec.SetVideoURL(*s)
- }
- return ec
- }
- // SetOrganizationID sets the "organization_id" field.
- func (ec *EmployeeCreate) SetOrganizationID(u uint64) *EmployeeCreate {
- ec.mutation.SetOrganizationID(u)
- return ec
- }
- // SetCategoryID sets the "category_id" field.
- func (ec *EmployeeCreate) SetCategoryID(u uint64) *EmployeeCreate {
- ec.mutation.SetCategoryID(u)
- return ec
- }
- // SetAPIBase sets the "api_base" field.
- func (ec *EmployeeCreate) SetAPIBase(s string) *EmployeeCreate {
- ec.mutation.SetAPIBase(s)
- return ec
- }
- // SetNillableAPIBase sets the "api_base" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableAPIBase(s *string) *EmployeeCreate {
- if s != nil {
- ec.SetAPIBase(*s)
- }
- return ec
- }
- // SetAPIKey sets the "api_key" field.
- func (ec *EmployeeCreate) SetAPIKey(s string) *EmployeeCreate {
- ec.mutation.SetAPIKey(s)
- return ec
- }
- // SetNillableAPIKey sets the "api_key" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableAPIKey(s *string) *EmployeeCreate {
- if s != nil {
- ec.SetAPIKey(*s)
- }
- return ec
- }
- // SetAiInfo sets the "ai_info" field.
- func (ec *EmployeeCreate) SetAiInfo(s string) *EmployeeCreate {
- ec.mutation.SetAiInfo(s)
- return ec
- }
- // SetNillableAiInfo sets the "ai_info" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableAiInfo(s *string) *EmployeeCreate {
- if s != nil {
- ec.SetAiInfo(*s)
- }
- return ec
- }
- // SetIsVip sets the "is_vip" field.
- func (ec *EmployeeCreate) SetIsVip(i int) *EmployeeCreate {
- ec.mutation.SetIsVip(i)
- return ec
- }
- // SetNillableIsVip sets the "is_vip" field if the given value is not nil.
- func (ec *EmployeeCreate) SetNillableIsVip(i *int) *EmployeeCreate {
- if i != nil {
- ec.SetIsVip(*i)
- }
- return ec
- }
- // SetID sets the "id" field.
- func (ec *EmployeeCreate) SetID(u uint64) *EmployeeCreate {
- ec.mutation.SetID(u)
- return ec
- }
- // AddEmWorkExperienceIDs adds the "em_work_experiences" edge to the WorkExperience entity by IDs.
- func (ec *EmployeeCreate) AddEmWorkExperienceIDs(ids ...uint64) *EmployeeCreate {
- ec.mutation.AddEmWorkExperienceIDs(ids...)
- return ec
- }
- // AddEmWorkExperiences adds the "em_work_experiences" edges to the WorkExperience entity.
- func (ec *EmployeeCreate) AddEmWorkExperiences(w ...*WorkExperience) *EmployeeCreate {
- ids := make([]uint64, len(w))
- for i := range w {
- ids[i] = w[i].ID
- }
- return ec.AddEmWorkExperienceIDs(ids...)
- }
- // AddEmTutorialIDs adds the "em_tutorial" edge to the Tutorial entity by IDs.
- func (ec *EmployeeCreate) AddEmTutorialIDs(ids ...uint64) *EmployeeCreate {
- ec.mutation.AddEmTutorialIDs(ids...)
- return ec
- }
- // AddEmTutorial adds the "em_tutorial" edges to the Tutorial entity.
- func (ec *EmployeeCreate) AddEmTutorial(t ...*Tutorial) *EmployeeCreate {
- ids := make([]uint64, len(t))
- for i := range t {
- ids[i] = t[i].ID
- }
- return ec.AddEmTutorialIDs(ids...)
- }
- // Mutation returns the EmployeeMutation object of the builder.
- func (ec *EmployeeCreate) Mutation() *EmployeeMutation {
- return ec.mutation
- }
- // Save creates the Employee in the database.
- func (ec *EmployeeCreate) Save(ctx context.Context) (*Employee, error) {
- if err := ec.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, ec.sqlSave, ec.mutation, ec.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (ec *EmployeeCreate) SaveX(ctx context.Context) *Employee {
- v, err := ec.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (ec *EmployeeCreate) Exec(ctx context.Context) error {
- _, err := ec.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (ec *EmployeeCreate) ExecX(ctx context.Context) {
- if err := ec.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (ec *EmployeeCreate) defaults() error {
- if _, ok := ec.mutation.CreatedAt(); !ok {
- if employee.DefaultCreatedAt == nil {
- return fmt.Errorf("ent: uninitialized employee.DefaultCreatedAt (forgotten import ent/runtime?)")
- }
- v := employee.DefaultCreatedAt()
- ec.mutation.SetCreatedAt(v)
- }
- if _, ok := ec.mutation.UpdatedAt(); !ok {
- if employee.DefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized employee.DefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := employee.DefaultUpdatedAt()
- ec.mutation.SetUpdatedAt(v)
- }
- if _, ok := ec.mutation.HireCount(); !ok {
- v := employee.DefaultHireCount
- ec.mutation.SetHireCount(v)
- }
- if _, ok := ec.mutation.ServiceCount(); !ok {
- v := employee.DefaultServiceCount
- ec.mutation.SetServiceCount(v)
- }
- if _, ok := ec.mutation.AchievementCount(); !ok {
- v := employee.DefaultAchievementCount
- ec.mutation.SetAchievementCount(v)
- }
- if _, ok := ec.mutation.Intro(); !ok {
- v := employee.DefaultIntro
- ec.mutation.SetIntro(v)
- }
- if _, ok := ec.mutation.Estimate(); !ok {
- v := employee.DefaultEstimate
- ec.mutation.SetEstimate(v)
- }
- if _, ok := ec.mutation.Skill(); !ok {
- v := employee.DefaultSkill
- ec.mutation.SetSkill(v)
- }
- if _, ok := ec.mutation.AbilityType(); !ok {
- v := employee.DefaultAbilityType
- ec.mutation.SetAbilityType(v)
- }
- if _, ok := ec.mutation.Scene(); !ok {
- v := employee.DefaultScene
- ec.mutation.SetScene(v)
- }
- if _, ok := ec.mutation.SwitchIn(); !ok {
- v := employee.DefaultSwitchIn
- ec.mutation.SetSwitchIn(v)
- }
- if _, ok := ec.mutation.VideoURL(); !ok {
- v := employee.DefaultVideoURL
- ec.mutation.SetVideoURL(v)
- }
- if _, ok := ec.mutation.APIBase(); !ok {
- v := employee.DefaultAPIBase
- ec.mutation.SetAPIBase(v)
- }
- if _, ok := ec.mutation.APIKey(); !ok {
- v := employee.DefaultAPIKey
- ec.mutation.SetAPIKey(v)
- }
- if _, ok := ec.mutation.IsVip(); !ok {
- v := employee.DefaultIsVip
- ec.mutation.SetIsVip(v)
- }
- return nil
- }
- // check runs all checks and user-defined validators on the builder.
- func (ec *EmployeeCreate) check() error {
- if _, ok := ec.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Employee.created_at"`)}
- }
- if _, ok := ec.mutation.UpdatedAt(); !ok {
- return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Employee.updated_at"`)}
- }
- if _, ok := ec.mutation.Title(); !ok {
- return &ValidationError{Name: "title", err: errors.New(`ent: missing required field "Employee.title"`)}
- }
- if v, ok := ec.mutation.Title(); ok {
- if err := employee.TitleValidator(v); err != nil {
- return &ValidationError{Name: "title", err: fmt.Errorf(`ent: validator failed for field "Employee.title": %w`, err)}
- }
- }
- if _, ok := ec.mutation.Avatar(); !ok {
- return &ValidationError{Name: "avatar", err: errors.New(`ent: missing required field "Employee.avatar"`)}
- }
- if v, ok := ec.mutation.Avatar(); ok {
- if err := employee.AvatarValidator(v); err != nil {
- return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "Employee.avatar": %w`, err)}
- }
- }
- if _, ok := ec.mutation.Tags(); !ok {
- return &ValidationError{Name: "tags", err: errors.New(`ent: missing required field "Employee.tags"`)}
- }
- if v, ok := ec.mutation.Tags(); ok {
- if err := employee.TagsValidator(v); err != nil {
- return &ValidationError{Name: "tags", err: fmt.Errorf(`ent: validator failed for field "Employee.tags": %w`, err)}
- }
- }
- if _, ok := ec.mutation.HireCount(); !ok {
- return &ValidationError{Name: "hire_count", err: errors.New(`ent: missing required field "Employee.hire_count"`)}
- }
- if v, ok := ec.mutation.HireCount(); ok {
- if err := employee.HireCountValidator(v); err != nil {
- return &ValidationError{Name: "hire_count", err: fmt.Errorf(`ent: validator failed for field "Employee.hire_count": %w`, err)}
- }
- }
- if _, ok := ec.mutation.ServiceCount(); !ok {
- return &ValidationError{Name: "service_count", err: errors.New(`ent: missing required field "Employee.service_count"`)}
- }
- if v, ok := ec.mutation.ServiceCount(); ok {
- if err := employee.ServiceCountValidator(v); err != nil {
- return &ValidationError{Name: "service_count", err: fmt.Errorf(`ent: validator failed for field "Employee.service_count": %w`, err)}
- }
- }
- if _, ok := ec.mutation.AchievementCount(); !ok {
- return &ValidationError{Name: "achievement_count", err: errors.New(`ent: missing required field "Employee.achievement_count"`)}
- }
- if v, ok := ec.mutation.AchievementCount(); ok {
- if err := employee.AchievementCountValidator(v); err != nil {
- return &ValidationError{Name: "achievement_count", err: fmt.Errorf(`ent: validator failed for field "Employee.achievement_count": %w`, err)}
- }
- }
- if _, ok := ec.mutation.Intro(); !ok {
- return &ValidationError{Name: "intro", err: errors.New(`ent: missing required field "Employee.intro"`)}
- }
- if v, ok := ec.mutation.Intro(); ok {
- if err := employee.IntroValidator(v); err != nil {
- return &ValidationError{Name: "intro", err: fmt.Errorf(`ent: validator failed for field "Employee.intro": %w`, err)}
- }
- }
- if _, ok := ec.mutation.Estimate(); !ok {
- return &ValidationError{Name: "estimate", err: errors.New(`ent: missing required field "Employee.estimate"`)}
- }
- if v, ok := ec.mutation.Estimate(); ok {
- if err := employee.EstimateValidator(v); err != nil {
- return &ValidationError{Name: "estimate", err: fmt.Errorf(`ent: validator failed for field "Employee.estimate": %w`, err)}
- }
- }
- if _, ok := ec.mutation.Skill(); !ok {
- return &ValidationError{Name: "skill", err: errors.New(`ent: missing required field "Employee.skill"`)}
- }
- if v, ok := ec.mutation.Skill(); ok {
- if err := employee.SkillValidator(v); err != nil {
- return &ValidationError{Name: "skill", err: fmt.Errorf(`ent: validator failed for field "Employee.skill": %w`, err)}
- }
- }
- if _, ok := ec.mutation.AbilityType(); !ok {
- return &ValidationError{Name: "ability_type", err: errors.New(`ent: missing required field "Employee.ability_type"`)}
- }
- if _, ok := ec.mutation.Scene(); !ok {
- return &ValidationError{Name: "scene", err: errors.New(`ent: missing required field "Employee.scene"`)}
- }
- if _, ok := ec.mutation.SwitchIn(); !ok {
- return &ValidationError{Name: "switch_in", err: errors.New(`ent: missing required field "Employee.switch_in"`)}
- }
- if _, ok := ec.mutation.VideoURL(); !ok {
- return &ValidationError{Name: "video_url", err: errors.New(`ent: missing required field "Employee.video_url"`)}
- }
- if v, ok := ec.mutation.VideoURL(); ok {
- if err := employee.VideoURLValidator(v); err != nil {
- return &ValidationError{Name: "video_url", err: fmt.Errorf(`ent: validator failed for field "Employee.video_url": %w`, err)}
- }
- }
- if _, ok := ec.mutation.OrganizationID(); !ok {
- return &ValidationError{Name: "organization_id", err: errors.New(`ent: missing required field "Employee.organization_id"`)}
- }
- if v, ok := ec.mutation.OrganizationID(); ok {
- if err := employee.OrganizationIDValidator(v); err != nil {
- return &ValidationError{Name: "organization_id", err: fmt.Errorf(`ent: validator failed for field "Employee.organization_id": %w`, err)}
- }
- }
- if _, ok := ec.mutation.CategoryID(); !ok {
- return &ValidationError{Name: "category_id", err: errors.New(`ent: missing required field "Employee.category_id"`)}
- }
- if v, ok := ec.mutation.CategoryID(); ok {
- if err := employee.CategoryIDValidator(v); err != nil {
- return &ValidationError{Name: "category_id", err: fmt.Errorf(`ent: validator failed for field "Employee.category_id": %w`, err)}
- }
- }
- if _, ok := ec.mutation.APIBase(); !ok {
- return &ValidationError{Name: "api_base", err: errors.New(`ent: missing required field "Employee.api_base"`)}
- }
- if _, ok := ec.mutation.APIKey(); !ok {
- return &ValidationError{Name: "api_key", err: errors.New(`ent: missing required field "Employee.api_key"`)}
- }
- if _, ok := ec.mutation.IsVip(); !ok {
- return &ValidationError{Name: "is_vip", err: errors.New(`ent: missing required field "Employee.is_vip"`)}
- }
- return nil
- }
- func (ec *EmployeeCreate) sqlSave(ctx context.Context) (*Employee, error) {
- if err := ec.check(); err != nil {
- return nil, err
- }
- _node, _spec := ec.createSpec()
- if err := sqlgraph.CreateNode(ctx, ec.driver, _spec); err != nil {
- if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return nil, err
- }
- if _spec.ID.Value != _node.ID {
- id := _spec.ID.Value.(int64)
- _node.ID = uint64(id)
- }
- ec.mutation.id = &_node.ID
- ec.mutation.done = true
- return _node, nil
- }
- func (ec *EmployeeCreate) createSpec() (*Employee, *sqlgraph.CreateSpec) {
- var (
- _node = &Employee{config: ec.config}
- _spec = sqlgraph.NewCreateSpec(employee.Table, sqlgraph.NewFieldSpec(employee.FieldID, field.TypeUint64))
- )
- _spec.OnConflict = ec.conflict
- if id, ok := ec.mutation.ID(); ok {
- _node.ID = id
- _spec.ID.Value = id
- }
- if value, ok := ec.mutation.CreatedAt(); ok {
- _spec.SetField(employee.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- if value, ok := ec.mutation.UpdatedAt(); ok {
- _spec.SetField(employee.FieldUpdatedAt, field.TypeTime, value)
- _node.UpdatedAt = value
- }
- if value, ok := ec.mutation.DeletedAt(); ok {
- _spec.SetField(employee.FieldDeletedAt, field.TypeTime, value)
- _node.DeletedAt = value
- }
- if value, ok := ec.mutation.Title(); ok {
- _spec.SetField(employee.FieldTitle, field.TypeString, value)
- _node.Title = value
- }
- if value, ok := ec.mutation.Avatar(); ok {
- _spec.SetField(employee.FieldAvatar, field.TypeString, value)
- _node.Avatar = value
- }
- if value, ok := ec.mutation.Tags(); ok {
- _spec.SetField(employee.FieldTags, field.TypeString, value)
- _node.Tags = value
- }
- if value, ok := ec.mutation.HireCount(); ok {
- _spec.SetField(employee.FieldHireCount, field.TypeInt, value)
- _node.HireCount = value
- }
- if value, ok := ec.mutation.ServiceCount(); ok {
- _spec.SetField(employee.FieldServiceCount, field.TypeInt, value)
- _node.ServiceCount = value
- }
- if value, ok := ec.mutation.AchievementCount(); ok {
- _spec.SetField(employee.FieldAchievementCount, field.TypeInt, value)
- _node.AchievementCount = value
- }
- if value, ok := ec.mutation.Intro(); ok {
- _spec.SetField(employee.FieldIntro, field.TypeString, value)
- _node.Intro = value
- }
- if value, ok := ec.mutation.Estimate(); ok {
- _spec.SetField(employee.FieldEstimate, field.TypeString, value)
- _node.Estimate = value
- }
- if value, ok := ec.mutation.Skill(); ok {
- _spec.SetField(employee.FieldSkill, field.TypeString, value)
- _node.Skill = value
- }
- if value, ok := ec.mutation.AbilityType(); ok {
- _spec.SetField(employee.FieldAbilityType, field.TypeString, value)
- _node.AbilityType = value
- }
- if value, ok := ec.mutation.Scene(); ok {
- _spec.SetField(employee.FieldScene, field.TypeString, value)
- _node.Scene = value
- }
- if value, ok := ec.mutation.SwitchIn(); ok {
- _spec.SetField(employee.FieldSwitchIn, field.TypeString, value)
- _node.SwitchIn = value
- }
- if value, ok := ec.mutation.VideoURL(); ok {
- _spec.SetField(employee.FieldVideoURL, field.TypeString, value)
- _node.VideoURL = value
- }
- if value, ok := ec.mutation.OrganizationID(); ok {
- _spec.SetField(employee.FieldOrganizationID, field.TypeUint64, value)
- _node.OrganizationID = value
- }
- if value, ok := ec.mutation.CategoryID(); ok {
- _spec.SetField(employee.FieldCategoryID, field.TypeUint64, value)
- _node.CategoryID = value
- }
- if value, ok := ec.mutation.APIBase(); ok {
- _spec.SetField(employee.FieldAPIBase, field.TypeString, value)
- _node.APIBase = value
- }
- if value, ok := ec.mutation.APIKey(); ok {
- _spec.SetField(employee.FieldAPIKey, field.TypeString, value)
- _node.APIKey = value
- }
- if value, ok := ec.mutation.AiInfo(); ok {
- _spec.SetField(employee.FieldAiInfo, field.TypeString, value)
- _node.AiInfo = value
- }
- if value, ok := ec.mutation.IsVip(); ok {
- _spec.SetField(employee.FieldIsVip, field.TypeInt, value)
- _node.IsVip = value
- }
- if nodes := ec.mutation.EmWorkExperiencesIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.O2M,
- Inverse: false,
- Table: employee.EmWorkExperiencesTable,
- Columns: []string{employee.EmWorkExperiencesColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(workexperience.FieldID, field.TypeUint64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := ec.mutation.EmTutorialIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.O2M,
- Inverse: false,
- Table: employee.EmTutorialTable,
- Columns: []string{employee.EmTutorialColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(tutorial.FieldID, field.TypeUint64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _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.Employee.Create().
- // SetCreatedAt(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.EmployeeUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (ec *EmployeeCreate) OnConflict(opts ...sql.ConflictOption) *EmployeeUpsertOne {
- ec.conflict = opts
- return &EmployeeUpsertOne{
- create: ec,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.Employee.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (ec *EmployeeCreate) OnConflictColumns(columns ...string) *EmployeeUpsertOne {
- ec.conflict = append(ec.conflict, sql.ConflictColumns(columns...))
- return &EmployeeUpsertOne{
- create: ec,
- }
- }
- type (
- // EmployeeUpsertOne is the builder for "upsert"-ing
- // one Employee node.
- EmployeeUpsertOne struct {
- create *EmployeeCreate
- }
- // EmployeeUpsert is the "OnConflict" setter.
- EmployeeUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetUpdatedAt sets the "updated_at" field.
- func (u *EmployeeUpsert) SetUpdatedAt(v time.Time) *EmployeeUpsert {
- u.Set(employee.FieldUpdatedAt, v)
- return u
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateUpdatedAt() *EmployeeUpsert {
- u.SetExcluded(employee.FieldUpdatedAt)
- return u
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *EmployeeUpsert) SetDeletedAt(v time.Time) *EmployeeUpsert {
- u.Set(employee.FieldDeletedAt, v)
- return u
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateDeletedAt() *EmployeeUpsert {
- u.SetExcluded(employee.FieldDeletedAt)
- return u
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *EmployeeUpsert) ClearDeletedAt() *EmployeeUpsert {
- u.SetNull(employee.FieldDeletedAt)
- return u
- }
- // SetTitle sets the "title" field.
- func (u *EmployeeUpsert) SetTitle(v string) *EmployeeUpsert {
- u.Set(employee.FieldTitle, v)
- return u
- }
- // UpdateTitle sets the "title" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateTitle() *EmployeeUpsert {
- u.SetExcluded(employee.FieldTitle)
- return u
- }
- // SetAvatar sets the "avatar" field.
- func (u *EmployeeUpsert) SetAvatar(v string) *EmployeeUpsert {
- u.Set(employee.FieldAvatar, v)
- return u
- }
- // UpdateAvatar sets the "avatar" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateAvatar() *EmployeeUpsert {
- u.SetExcluded(employee.FieldAvatar)
- return u
- }
- // SetTags sets the "tags" field.
- func (u *EmployeeUpsert) SetTags(v string) *EmployeeUpsert {
- u.Set(employee.FieldTags, v)
- return u
- }
- // UpdateTags sets the "tags" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateTags() *EmployeeUpsert {
- u.SetExcluded(employee.FieldTags)
- return u
- }
- // SetHireCount sets the "hire_count" field.
- func (u *EmployeeUpsert) SetHireCount(v int) *EmployeeUpsert {
- u.Set(employee.FieldHireCount, v)
- return u
- }
- // UpdateHireCount sets the "hire_count" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateHireCount() *EmployeeUpsert {
- u.SetExcluded(employee.FieldHireCount)
- return u
- }
- // AddHireCount adds v to the "hire_count" field.
- func (u *EmployeeUpsert) AddHireCount(v int) *EmployeeUpsert {
- u.Add(employee.FieldHireCount, v)
- return u
- }
- // SetServiceCount sets the "service_count" field.
- func (u *EmployeeUpsert) SetServiceCount(v int) *EmployeeUpsert {
- u.Set(employee.FieldServiceCount, v)
- return u
- }
- // UpdateServiceCount sets the "service_count" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateServiceCount() *EmployeeUpsert {
- u.SetExcluded(employee.FieldServiceCount)
- return u
- }
- // AddServiceCount adds v to the "service_count" field.
- func (u *EmployeeUpsert) AddServiceCount(v int) *EmployeeUpsert {
- u.Add(employee.FieldServiceCount, v)
- return u
- }
- // SetAchievementCount sets the "achievement_count" field.
- func (u *EmployeeUpsert) SetAchievementCount(v int) *EmployeeUpsert {
- u.Set(employee.FieldAchievementCount, v)
- return u
- }
- // UpdateAchievementCount sets the "achievement_count" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateAchievementCount() *EmployeeUpsert {
- u.SetExcluded(employee.FieldAchievementCount)
- return u
- }
- // AddAchievementCount adds v to the "achievement_count" field.
- func (u *EmployeeUpsert) AddAchievementCount(v int) *EmployeeUpsert {
- u.Add(employee.FieldAchievementCount, v)
- return u
- }
- // SetIntro sets the "intro" field.
- func (u *EmployeeUpsert) SetIntro(v string) *EmployeeUpsert {
- u.Set(employee.FieldIntro, v)
- return u
- }
- // UpdateIntro sets the "intro" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateIntro() *EmployeeUpsert {
- u.SetExcluded(employee.FieldIntro)
- return u
- }
- // SetEstimate sets the "estimate" field.
- func (u *EmployeeUpsert) SetEstimate(v string) *EmployeeUpsert {
- u.Set(employee.FieldEstimate, v)
- return u
- }
- // UpdateEstimate sets the "estimate" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateEstimate() *EmployeeUpsert {
- u.SetExcluded(employee.FieldEstimate)
- return u
- }
- // SetSkill sets the "skill" field.
- func (u *EmployeeUpsert) SetSkill(v string) *EmployeeUpsert {
- u.Set(employee.FieldSkill, v)
- return u
- }
- // UpdateSkill sets the "skill" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateSkill() *EmployeeUpsert {
- u.SetExcluded(employee.FieldSkill)
- return u
- }
- // SetAbilityType sets the "ability_type" field.
- func (u *EmployeeUpsert) SetAbilityType(v string) *EmployeeUpsert {
- u.Set(employee.FieldAbilityType, v)
- return u
- }
- // UpdateAbilityType sets the "ability_type" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateAbilityType() *EmployeeUpsert {
- u.SetExcluded(employee.FieldAbilityType)
- return u
- }
- // SetScene sets the "scene" field.
- func (u *EmployeeUpsert) SetScene(v string) *EmployeeUpsert {
- u.Set(employee.FieldScene, v)
- return u
- }
- // UpdateScene sets the "scene" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateScene() *EmployeeUpsert {
- u.SetExcluded(employee.FieldScene)
- return u
- }
- // SetSwitchIn sets the "switch_in" field.
- func (u *EmployeeUpsert) SetSwitchIn(v string) *EmployeeUpsert {
- u.Set(employee.FieldSwitchIn, v)
- return u
- }
- // UpdateSwitchIn sets the "switch_in" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateSwitchIn() *EmployeeUpsert {
- u.SetExcluded(employee.FieldSwitchIn)
- return u
- }
- // SetVideoURL sets the "video_url" field.
- func (u *EmployeeUpsert) SetVideoURL(v string) *EmployeeUpsert {
- u.Set(employee.FieldVideoURL, v)
- return u
- }
- // UpdateVideoURL sets the "video_url" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateVideoURL() *EmployeeUpsert {
- u.SetExcluded(employee.FieldVideoURL)
- return u
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *EmployeeUpsert) SetOrganizationID(v uint64) *EmployeeUpsert {
- u.Set(employee.FieldOrganizationID, v)
- return u
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateOrganizationID() *EmployeeUpsert {
- u.SetExcluded(employee.FieldOrganizationID)
- return u
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *EmployeeUpsert) AddOrganizationID(v uint64) *EmployeeUpsert {
- u.Add(employee.FieldOrganizationID, v)
- return u
- }
- // SetCategoryID sets the "category_id" field.
- func (u *EmployeeUpsert) SetCategoryID(v uint64) *EmployeeUpsert {
- u.Set(employee.FieldCategoryID, v)
- return u
- }
- // UpdateCategoryID sets the "category_id" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateCategoryID() *EmployeeUpsert {
- u.SetExcluded(employee.FieldCategoryID)
- return u
- }
- // AddCategoryID adds v to the "category_id" field.
- func (u *EmployeeUpsert) AddCategoryID(v uint64) *EmployeeUpsert {
- u.Add(employee.FieldCategoryID, v)
- return u
- }
- // SetAPIBase sets the "api_base" field.
- func (u *EmployeeUpsert) SetAPIBase(v string) *EmployeeUpsert {
- u.Set(employee.FieldAPIBase, v)
- return u
- }
- // UpdateAPIBase sets the "api_base" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateAPIBase() *EmployeeUpsert {
- u.SetExcluded(employee.FieldAPIBase)
- return u
- }
- // SetAPIKey sets the "api_key" field.
- func (u *EmployeeUpsert) SetAPIKey(v string) *EmployeeUpsert {
- u.Set(employee.FieldAPIKey, v)
- return u
- }
- // UpdateAPIKey sets the "api_key" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateAPIKey() *EmployeeUpsert {
- u.SetExcluded(employee.FieldAPIKey)
- return u
- }
- // SetAiInfo sets the "ai_info" field.
- func (u *EmployeeUpsert) SetAiInfo(v string) *EmployeeUpsert {
- u.Set(employee.FieldAiInfo, v)
- return u
- }
- // UpdateAiInfo sets the "ai_info" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateAiInfo() *EmployeeUpsert {
- u.SetExcluded(employee.FieldAiInfo)
- return u
- }
- // ClearAiInfo clears the value of the "ai_info" field.
- func (u *EmployeeUpsert) ClearAiInfo() *EmployeeUpsert {
- u.SetNull(employee.FieldAiInfo)
- return u
- }
- // SetIsVip sets the "is_vip" field.
- func (u *EmployeeUpsert) SetIsVip(v int) *EmployeeUpsert {
- u.Set(employee.FieldIsVip, v)
- return u
- }
- // UpdateIsVip sets the "is_vip" field to the value that was provided on create.
- func (u *EmployeeUpsert) UpdateIsVip() *EmployeeUpsert {
- u.SetExcluded(employee.FieldIsVip)
- return u
- }
- // AddIsVip adds v to the "is_vip" field.
- func (u *EmployeeUpsert) AddIsVip(v int) *EmployeeUpsert {
- u.Add(employee.FieldIsVip, v)
- return u
- }
- // UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
- // Using this option is equivalent to using:
- //
- // client.Employee.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(employee.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *EmployeeUpsertOne) UpdateNewValues() *EmployeeUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
- if _, exists := u.create.mutation.ID(); exists {
- s.SetIgnore(employee.FieldID)
- }
- if _, exists := u.create.mutation.CreatedAt(); exists {
- s.SetIgnore(employee.FieldCreatedAt)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.Employee.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *EmployeeUpsertOne) Ignore() *EmployeeUpsertOne {
- 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 *EmployeeUpsertOne) DoNothing() *EmployeeUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the EmployeeCreate.OnConflict
- // documentation for more info.
- func (u *EmployeeUpsertOne) Update(set func(*EmployeeUpsert)) *EmployeeUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&EmployeeUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *EmployeeUpsertOne) SetUpdatedAt(v time.Time) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateUpdatedAt() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *EmployeeUpsertOne) SetDeletedAt(v time.Time) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateDeletedAt() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *EmployeeUpsertOne) ClearDeletedAt() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetTitle sets the "title" field.
- func (u *EmployeeUpsertOne) SetTitle(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetTitle(v)
- })
- }
- // UpdateTitle sets the "title" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateTitle() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateTitle()
- })
- }
- // SetAvatar sets the "avatar" field.
- func (u *EmployeeUpsertOne) SetAvatar(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAvatar(v)
- })
- }
- // UpdateAvatar sets the "avatar" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateAvatar() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAvatar()
- })
- }
- // SetTags sets the "tags" field.
- func (u *EmployeeUpsertOne) SetTags(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetTags(v)
- })
- }
- // UpdateTags sets the "tags" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateTags() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateTags()
- })
- }
- // SetHireCount sets the "hire_count" field.
- func (u *EmployeeUpsertOne) SetHireCount(v int) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetHireCount(v)
- })
- }
- // AddHireCount adds v to the "hire_count" field.
- func (u *EmployeeUpsertOne) AddHireCount(v int) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddHireCount(v)
- })
- }
- // UpdateHireCount sets the "hire_count" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateHireCount() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateHireCount()
- })
- }
- // SetServiceCount sets the "service_count" field.
- func (u *EmployeeUpsertOne) SetServiceCount(v int) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetServiceCount(v)
- })
- }
- // AddServiceCount adds v to the "service_count" field.
- func (u *EmployeeUpsertOne) AddServiceCount(v int) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddServiceCount(v)
- })
- }
- // UpdateServiceCount sets the "service_count" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateServiceCount() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateServiceCount()
- })
- }
- // SetAchievementCount sets the "achievement_count" field.
- func (u *EmployeeUpsertOne) SetAchievementCount(v int) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAchievementCount(v)
- })
- }
- // AddAchievementCount adds v to the "achievement_count" field.
- func (u *EmployeeUpsertOne) AddAchievementCount(v int) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddAchievementCount(v)
- })
- }
- // UpdateAchievementCount sets the "achievement_count" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateAchievementCount() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAchievementCount()
- })
- }
- // SetIntro sets the "intro" field.
- func (u *EmployeeUpsertOne) SetIntro(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetIntro(v)
- })
- }
- // UpdateIntro sets the "intro" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateIntro() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateIntro()
- })
- }
- // SetEstimate sets the "estimate" field.
- func (u *EmployeeUpsertOne) SetEstimate(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetEstimate(v)
- })
- }
- // UpdateEstimate sets the "estimate" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateEstimate() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateEstimate()
- })
- }
- // SetSkill sets the "skill" field.
- func (u *EmployeeUpsertOne) SetSkill(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetSkill(v)
- })
- }
- // UpdateSkill sets the "skill" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateSkill() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateSkill()
- })
- }
- // SetAbilityType sets the "ability_type" field.
- func (u *EmployeeUpsertOne) SetAbilityType(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAbilityType(v)
- })
- }
- // UpdateAbilityType sets the "ability_type" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateAbilityType() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAbilityType()
- })
- }
- // SetScene sets the "scene" field.
- func (u *EmployeeUpsertOne) SetScene(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetScene(v)
- })
- }
- // UpdateScene sets the "scene" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateScene() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateScene()
- })
- }
- // SetSwitchIn sets the "switch_in" field.
- func (u *EmployeeUpsertOne) SetSwitchIn(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetSwitchIn(v)
- })
- }
- // UpdateSwitchIn sets the "switch_in" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateSwitchIn() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateSwitchIn()
- })
- }
- // SetVideoURL sets the "video_url" field.
- func (u *EmployeeUpsertOne) SetVideoURL(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetVideoURL(v)
- })
- }
- // UpdateVideoURL sets the "video_url" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateVideoURL() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateVideoURL()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *EmployeeUpsertOne) SetOrganizationID(v uint64) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *EmployeeUpsertOne) AddOrganizationID(v uint64) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateOrganizationID() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // SetCategoryID sets the "category_id" field.
- func (u *EmployeeUpsertOne) SetCategoryID(v uint64) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetCategoryID(v)
- })
- }
- // AddCategoryID adds v to the "category_id" field.
- func (u *EmployeeUpsertOne) AddCategoryID(v uint64) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddCategoryID(v)
- })
- }
- // UpdateCategoryID sets the "category_id" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateCategoryID() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateCategoryID()
- })
- }
- // SetAPIBase sets the "api_base" field.
- func (u *EmployeeUpsertOne) SetAPIBase(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAPIBase(v)
- })
- }
- // UpdateAPIBase sets the "api_base" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateAPIBase() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAPIBase()
- })
- }
- // SetAPIKey sets the "api_key" field.
- func (u *EmployeeUpsertOne) SetAPIKey(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAPIKey(v)
- })
- }
- // UpdateAPIKey sets the "api_key" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateAPIKey() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAPIKey()
- })
- }
- // SetAiInfo sets the "ai_info" field.
- func (u *EmployeeUpsertOne) SetAiInfo(v string) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAiInfo(v)
- })
- }
- // UpdateAiInfo sets the "ai_info" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateAiInfo() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAiInfo()
- })
- }
- // ClearAiInfo clears the value of the "ai_info" field.
- func (u *EmployeeUpsertOne) ClearAiInfo() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.ClearAiInfo()
- })
- }
- // SetIsVip sets the "is_vip" field.
- func (u *EmployeeUpsertOne) SetIsVip(v int) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetIsVip(v)
- })
- }
- // AddIsVip adds v to the "is_vip" field.
- func (u *EmployeeUpsertOne) AddIsVip(v int) *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddIsVip(v)
- })
- }
- // UpdateIsVip sets the "is_vip" field to the value that was provided on create.
- func (u *EmployeeUpsertOne) UpdateIsVip() *EmployeeUpsertOne {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateIsVip()
- })
- }
- // Exec executes the query.
- func (u *EmployeeUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for EmployeeCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *EmployeeUpsertOne) 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 *EmployeeUpsertOne) ID(ctx context.Context) (id uint64, 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 *EmployeeUpsertOne) IDX(ctx context.Context) uint64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // EmployeeCreateBulk is the builder for creating many Employee entities in bulk.
- type EmployeeCreateBulk struct {
- config
- err error
- builders []*EmployeeCreate
- conflict []sql.ConflictOption
- }
- // Save creates the Employee entities in the database.
- func (ecb *EmployeeCreateBulk) Save(ctx context.Context) ([]*Employee, error) {
- if ecb.err != nil {
- return nil, ecb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(ecb.builders))
- nodes := make([]*Employee, len(ecb.builders))
- mutators := make([]Mutator, len(ecb.builders))
- for i := range ecb.builders {
- func(i int, root context.Context) {
- builder := ecb.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*EmployeeMutation)
- 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, ecb.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = ecb.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, ecb.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 && nodes[i].ID == 0 {
- id := specs[i].ID.Value.(int64)
- nodes[i].ID = uint64(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, ecb.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- // SaveX is like Save, but panics if an error occurs.
- func (ecb *EmployeeCreateBulk) SaveX(ctx context.Context) []*Employee {
- v, err := ecb.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (ecb *EmployeeCreateBulk) Exec(ctx context.Context) error {
- _, err := ecb.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (ecb *EmployeeCreateBulk) ExecX(ctx context.Context) {
- if err := ecb.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.Employee.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.EmployeeUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (ecb *EmployeeCreateBulk) OnConflict(opts ...sql.ConflictOption) *EmployeeUpsertBulk {
- ecb.conflict = opts
- return &EmployeeUpsertBulk{
- create: ecb,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.Employee.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (ecb *EmployeeCreateBulk) OnConflictColumns(columns ...string) *EmployeeUpsertBulk {
- ecb.conflict = append(ecb.conflict, sql.ConflictColumns(columns...))
- return &EmployeeUpsertBulk{
- create: ecb,
- }
- }
- // EmployeeUpsertBulk is the builder for "upsert"-ing
- // a bulk of Employee nodes.
- type EmployeeUpsertBulk struct {
- create *EmployeeCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.Employee.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(employee.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *EmployeeUpsertBulk) UpdateNewValues() *EmployeeUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
- for _, b := range u.create.builders {
- if _, exists := b.mutation.ID(); exists {
- s.SetIgnore(employee.FieldID)
- }
- if _, exists := b.mutation.CreatedAt(); exists {
- s.SetIgnore(employee.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.Employee.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *EmployeeUpsertBulk) Ignore() *EmployeeUpsertBulk {
- 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 *EmployeeUpsertBulk) DoNothing() *EmployeeUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the EmployeeCreateBulk.OnConflict
- // documentation for more info.
- func (u *EmployeeUpsertBulk) Update(set func(*EmployeeUpsert)) *EmployeeUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&EmployeeUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *EmployeeUpsertBulk) SetUpdatedAt(v time.Time) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateUpdatedAt() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *EmployeeUpsertBulk) SetDeletedAt(v time.Time) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateDeletedAt() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *EmployeeUpsertBulk) ClearDeletedAt() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetTitle sets the "title" field.
- func (u *EmployeeUpsertBulk) SetTitle(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetTitle(v)
- })
- }
- // UpdateTitle sets the "title" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateTitle() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateTitle()
- })
- }
- // SetAvatar sets the "avatar" field.
- func (u *EmployeeUpsertBulk) SetAvatar(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAvatar(v)
- })
- }
- // UpdateAvatar sets the "avatar" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateAvatar() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAvatar()
- })
- }
- // SetTags sets the "tags" field.
- func (u *EmployeeUpsertBulk) SetTags(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetTags(v)
- })
- }
- // UpdateTags sets the "tags" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateTags() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateTags()
- })
- }
- // SetHireCount sets the "hire_count" field.
- func (u *EmployeeUpsertBulk) SetHireCount(v int) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetHireCount(v)
- })
- }
- // AddHireCount adds v to the "hire_count" field.
- func (u *EmployeeUpsertBulk) AddHireCount(v int) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddHireCount(v)
- })
- }
- // UpdateHireCount sets the "hire_count" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateHireCount() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateHireCount()
- })
- }
- // SetServiceCount sets the "service_count" field.
- func (u *EmployeeUpsertBulk) SetServiceCount(v int) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetServiceCount(v)
- })
- }
- // AddServiceCount adds v to the "service_count" field.
- func (u *EmployeeUpsertBulk) AddServiceCount(v int) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddServiceCount(v)
- })
- }
- // UpdateServiceCount sets the "service_count" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateServiceCount() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateServiceCount()
- })
- }
- // SetAchievementCount sets the "achievement_count" field.
- func (u *EmployeeUpsertBulk) SetAchievementCount(v int) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAchievementCount(v)
- })
- }
- // AddAchievementCount adds v to the "achievement_count" field.
- func (u *EmployeeUpsertBulk) AddAchievementCount(v int) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddAchievementCount(v)
- })
- }
- // UpdateAchievementCount sets the "achievement_count" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateAchievementCount() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAchievementCount()
- })
- }
- // SetIntro sets the "intro" field.
- func (u *EmployeeUpsertBulk) SetIntro(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetIntro(v)
- })
- }
- // UpdateIntro sets the "intro" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateIntro() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateIntro()
- })
- }
- // SetEstimate sets the "estimate" field.
- func (u *EmployeeUpsertBulk) SetEstimate(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetEstimate(v)
- })
- }
- // UpdateEstimate sets the "estimate" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateEstimate() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateEstimate()
- })
- }
- // SetSkill sets the "skill" field.
- func (u *EmployeeUpsertBulk) SetSkill(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetSkill(v)
- })
- }
- // UpdateSkill sets the "skill" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateSkill() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateSkill()
- })
- }
- // SetAbilityType sets the "ability_type" field.
- func (u *EmployeeUpsertBulk) SetAbilityType(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAbilityType(v)
- })
- }
- // UpdateAbilityType sets the "ability_type" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateAbilityType() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAbilityType()
- })
- }
- // SetScene sets the "scene" field.
- func (u *EmployeeUpsertBulk) SetScene(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetScene(v)
- })
- }
- // UpdateScene sets the "scene" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateScene() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateScene()
- })
- }
- // SetSwitchIn sets the "switch_in" field.
- func (u *EmployeeUpsertBulk) SetSwitchIn(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetSwitchIn(v)
- })
- }
- // UpdateSwitchIn sets the "switch_in" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateSwitchIn() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateSwitchIn()
- })
- }
- // SetVideoURL sets the "video_url" field.
- func (u *EmployeeUpsertBulk) SetVideoURL(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetVideoURL(v)
- })
- }
- // UpdateVideoURL sets the "video_url" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateVideoURL() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateVideoURL()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *EmployeeUpsertBulk) SetOrganizationID(v uint64) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *EmployeeUpsertBulk) AddOrganizationID(v uint64) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateOrganizationID() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // SetCategoryID sets the "category_id" field.
- func (u *EmployeeUpsertBulk) SetCategoryID(v uint64) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetCategoryID(v)
- })
- }
- // AddCategoryID adds v to the "category_id" field.
- func (u *EmployeeUpsertBulk) AddCategoryID(v uint64) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddCategoryID(v)
- })
- }
- // UpdateCategoryID sets the "category_id" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateCategoryID() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateCategoryID()
- })
- }
- // SetAPIBase sets the "api_base" field.
- func (u *EmployeeUpsertBulk) SetAPIBase(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAPIBase(v)
- })
- }
- // UpdateAPIBase sets the "api_base" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateAPIBase() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAPIBase()
- })
- }
- // SetAPIKey sets the "api_key" field.
- func (u *EmployeeUpsertBulk) SetAPIKey(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAPIKey(v)
- })
- }
- // UpdateAPIKey sets the "api_key" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateAPIKey() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAPIKey()
- })
- }
- // SetAiInfo sets the "ai_info" field.
- func (u *EmployeeUpsertBulk) SetAiInfo(v string) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetAiInfo(v)
- })
- }
- // UpdateAiInfo sets the "ai_info" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateAiInfo() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateAiInfo()
- })
- }
- // ClearAiInfo clears the value of the "ai_info" field.
- func (u *EmployeeUpsertBulk) ClearAiInfo() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.ClearAiInfo()
- })
- }
- // SetIsVip sets the "is_vip" field.
- func (u *EmployeeUpsertBulk) SetIsVip(v int) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.SetIsVip(v)
- })
- }
- // AddIsVip adds v to the "is_vip" field.
- func (u *EmployeeUpsertBulk) AddIsVip(v int) *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.AddIsVip(v)
- })
- }
- // UpdateIsVip sets the "is_vip" field to the value that was provided on create.
- func (u *EmployeeUpsertBulk) UpdateIsVip() *EmployeeUpsertBulk {
- return u.Update(func(s *EmployeeUpsert) {
- s.UpdateIsVip()
- })
- }
- // Exec executes the query.
- func (u *EmployeeUpsertBulk) 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 EmployeeCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for EmployeeCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *EmployeeUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|