Add files via upload
This commit is contained in:
@@ -0,0 +1,847 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"home-vue-go/internal/ent/predicate"
|
||||
"home-vue-go/internal/ent/siteconfig"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// SiteConfigUpdate is the builder for updating SiteConfig entities.
|
||||
type SiteConfigUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *SiteConfigMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the SiteConfigUpdate builder.
|
||||
func (_u *SiteConfigUpdate) Where(ps ...predicate.SiteConfig) *SiteConfigUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSiteName sets the "site_name" field.
|
||||
func (_u *SiteConfigUpdate) SetSiteName(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetSiteName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSiteName sets the "site_name" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableSiteName(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetSiteName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSiteURL sets the "site_url" field.
|
||||
func (_u *SiteConfigUpdate) SetSiteURL(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetSiteURL(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSiteURL sets the "site_url" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableSiteURL(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetSiteURL(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSiteIcon sets the "site_icon" field.
|
||||
func (_u *SiteConfigUpdate) SetSiteIcon(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetSiteIcon(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSiteIcon sets the "site_icon" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableSiteIcon(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetSiteIcon(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSiteDescription sets the "site_description" field.
|
||||
func (_u *SiteConfigUpdate) SetSiteDescription(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetSiteDescription(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSiteDescription sets the "site_description" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableSiteDescription(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetSiteDescription(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSiteKeywords sets the "site_keywords" field.
|
||||
func (_u *SiteConfigUpdate) SetSiteKeywords(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetSiteKeywords(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSiteKeywords sets the "site_keywords" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableSiteKeywords(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetSiteKeywords(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUserName sets the "user_name" field.
|
||||
func (_u *SiteConfigUpdate) SetUserName(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetUserName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUserName sets the "user_name" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableUserName(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetUserName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetProfileImageURL sets the "profile_image_url" field.
|
||||
func (_u *SiteConfigUpdate) SetProfileImageURL(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetProfileImageURL(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableProfileImageURL sets the "profile_image_url" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableProfileImageURL(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetProfileImageURL(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearProfileImageURL clears the value of the "profile_image_url" field.
|
||||
func (_u *SiteConfigUpdate) ClearProfileImageURL() *SiteConfigUpdate {
|
||||
_u.mutation.ClearProfileImageURL()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetIcpNumber sets the "icp_number" field.
|
||||
func (_u *SiteConfigUpdate) SetIcpNumber(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetIcpNumber(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableIcpNumber sets the "icp_number" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableIcpNumber(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetIcpNumber(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearIcpNumber clears the value of the "icp_number" field.
|
||||
func (_u *SiteConfigUpdate) ClearIcpNumber() *SiteConfigUpdate {
|
||||
_u.mutation.ClearIcpNumber()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPoliceNumber sets the "police_number" field.
|
||||
func (_u *SiteConfigUpdate) SetPoliceNumber(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetPoliceNumber(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePoliceNumber sets the "police_number" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillablePoliceNumber(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetPoliceNumber(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearPoliceNumber clears the value of the "police_number" field.
|
||||
func (_u *SiteConfigUpdate) ClearPoliceNumber() *SiteConfigUpdate {
|
||||
_u.mutation.ClearPoliceNumber()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPageTitle sets the "page_title" field.
|
||||
func (_u *SiteConfigUpdate) SetPageTitle(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetPageTitle(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePageTitle sets the "page_title" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillablePageTitle(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetPageTitle(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearPageTitle clears the value of the "page_title" field.
|
||||
func (_u *SiteConfigUpdate) ClearPageTitle() *SiteConfigUpdate {
|
||||
_u.mutation.ClearPageTitle()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFavicon sets the "favicon" field.
|
||||
func (_u *SiteConfigUpdate) SetFavicon(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetFavicon(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableFavicon sets the "favicon" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableFavicon(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetFavicon(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearFavicon clears the value of the "favicon" field.
|
||||
func (_u *SiteConfigUpdate) ClearFavicon() *SiteConfigUpdate {
|
||||
_u.mutation.ClearFavicon()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUmamiScript sets the "umami_script" field.
|
||||
func (_u *SiteConfigUpdate) SetUmamiScript(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetUmamiScript(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUmamiScript sets the "umami_script" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableUmamiScript(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetUmamiScript(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUmamiScript clears the value of the "umami_script" field.
|
||||
func (_u *SiteConfigUpdate) ClearUmamiScript() *SiteConfigUpdate {
|
||||
_u.mutation.ClearUmamiScript()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUmamiWebsiteID sets the "umami_website_id" field.
|
||||
func (_u *SiteConfigUpdate) SetUmamiWebsiteID(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetUmamiWebsiteID(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUmamiWebsiteID sets the "umami_website_id" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableUmamiWebsiteID(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetUmamiWebsiteID(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUmamiWebsiteID clears the value of the "umami_website_id" field.
|
||||
func (_u *SiteConfigUpdate) ClearUmamiWebsiteID() *SiteConfigUpdate {
|
||||
_u.mutation.ClearUmamiWebsiteID()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetIconLibrary sets the "icon_library" field.
|
||||
func (_u *SiteConfigUpdate) SetIconLibrary(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetIconLibrary(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableIconLibrary sets the "icon_library" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableIconLibrary(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetIconLibrary(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearIconLibrary clears the value of the "icon_library" field.
|
||||
func (_u *SiteConfigUpdate) ClearIconLibrary() *SiteConfigUpdate {
|
||||
_u.mutation.ClearIconLibrary()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFontLibrary sets the "font_library" field.
|
||||
func (_u *SiteConfigUpdate) SetFontLibrary(v string) *SiteConfigUpdate {
|
||||
_u.mutation.SetFontLibrary(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableFontLibrary sets the "font_library" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdate) SetNillableFontLibrary(v *string) *SiteConfigUpdate {
|
||||
if v != nil {
|
||||
_u.SetFontLibrary(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearFontLibrary clears the value of the "font_library" field.
|
||||
func (_u *SiteConfigUpdate) ClearFontLibrary() *SiteConfigUpdate {
|
||||
_u.mutation.ClearFontLibrary()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the SiteConfigMutation object of the builder.
|
||||
func (_u *SiteConfigUpdate) Mutation() *SiteConfigMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (_u *SiteConfigUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *SiteConfigUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_u *SiteConfigUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *SiteConfigUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (_u *SiteConfigUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(siteconfig.Table, siteconfig.Columns, sqlgraph.NewFieldSpec(siteconfig.FieldID, field.TypeInt))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.SiteName(); ok {
|
||||
_spec.SetField(siteconfig.FieldSiteName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SiteURL(); ok {
|
||||
_spec.SetField(siteconfig.FieldSiteURL, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SiteIcon(); ok {
|
||||
_spec.SetField(siteconfig.FieldSiteIcon, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SiteDescription(); ok {
|
||||
_spec.SetField(siteconfig.FieldSiteDescription, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SiteKeywords(); ok {
|
||||
_spec.SetField(siteconfig.FieldSiteKeywords, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UserName(); ok {
|
||||
_spec.SetField(siteconfig.FieldUserName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ProfileImageURL(); ok {
|
||||
_spec.SetField(siteconfig.FieldProfileImageURL, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.ProfileImageURLCleared() {
|
||||
_spec.ClearField(siteconfig.FieldProfileImageURL, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.IcpNumber(); ok {
|
||||
_spec.SetField(siteconfig.FieldIcpNumber, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.IcpNumberCleared() {
|
||||
_spec.ClearField(siteconfig.FieldIcpNumber, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.PoliceNumber(); ok {
|
||||
_spec.SetField(siteconfig.FieldPoliceNumber, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.PoliceNumberCleared() {
|
||||
_spec.ClearField(siteconfig.FieldPoliceNumber, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.PageTitle(); ok {
|
||||
_spec.SetField(siteconfig.FieldPageTitle, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.PageTitleCleared() {
|
||||
_spec.ClearField(siteconfig.FieldPageTitle, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.Favicon(); ok {
|
||||
_spec.SetField(siteconfig.FieldFavicon, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.FaviconCleared() {
|
||||
_spec.ClearField(siteconfig.FieldFavicon, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.UmamiScript(); ok {
|
||||
_spec.SetField(siteconfig.FieldUmamiScript, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.UmamiScriptCleared() {
|
||||
_spec.ClearField(siteconfig.FieldUmamiScript, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.UmamiWebsiteID(); ok {
|
||||
_spec.SetField(siteconfig.FieldUmamiWebsiteID, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.UmamiWebsiteIDCleared() {
|
||||
_spec.ClearField(siteconfig.FieldUmamiWebsiteID, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.IconLibrary(); ok {
|
||||
_spec.SetField(siteconfig.FieldIconLibrary, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.IconLibraryCleared() {
|
||||
_spec.ClearField(siteconfig.FieldIconLibrary, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.FontLibrary(); ok {
|
||||
_spec.SetField(siteconfig.FieldFontLibrary, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.FontLibraryCleared() {
|
||||
_spec.ClearField(siteconfig.FieldFontLibrary, field.TypeString)
|
||||
}
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{siteconfig.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// SiteConfigUpdateOne is the builder for updating a single SiteConfig entity.
|
||||
type SiteConfigUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *SiteConfigMutation
|
||||
}
|
||||
|
||||
// SetSiteName sets the "site_name" field.
|
||||
func (_u *SiteConfigUpdateOne) SetSiteName(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetSiteName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSiteName sets the "site_name" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableSiteName(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetSiteName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSiteURL sets the "site_url" field.
|
||||
func (_u *SiteConfigUpdateOne) SetSiteURL(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetSiteURL(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSiteURL sets the "site_url" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableSiteURL(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetSiteURL(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSiteIcon sets the "site_icon" field.
|
||||
func (_u *SiteConfigUpdateOne) SetSiteIcon(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetSiteIcon(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSiteIcon sets the "site_icon" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableSiteIcon(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetSiteIcon(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSiteDescription sets the "site_description" field.
|
||||
func (_u *SiteConfigUpdateOne) SetSiteDescription(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetSiteDescription(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSiteDescription sets the "site_description" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableSiteDescription(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetSiteDescription(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSiteKeywords sets the "site_keywords" field.
|
||||
func (_u *SiteConfigUpdateOne) SetSiteKeywords(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetSiteKeywords(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSiteKeywords sets the "site_keywords" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableSiteKeywords(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetSiteKeywords(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUserName sets the "user_name" field.
|
||||
func (_u *SiteConfigUpdateOne) SetUserName(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetUserName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUserName sets the "user_name" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableUserName(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUserName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetProfileImageURL sets the "profile_image_url" field.
|
||||
func (_u *SiteConfigUpdateOne) SetProfileImageURL(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetProfileImageURL(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableProfileImageURL sets the "profile_image_url" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableProfileImageURL(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetProfileImageURL(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearProfileImageURL clears the value of the "profile_image_url" field.
|
||||
func (_u *SiteConfigUpdateOne) ClearProfileImageURL() *SiteConfigUpdateOne {
|
||||
_u.mutation.ClearProfileImageURL()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetIcpNumber sets the "icp_number" field.
|
||||
func (_u *SiteConfigUpdateOne) SetIcpNumber(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetIcpNumber(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableIcpNumber sets the "icp_number" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableIcpNumber(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetIcpNumber(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearIcpNumber clears the value of the "icp_number" field.
|
||||
func (_u *SiteConfigUpdateOne) ClearIcpNumber() *SiteConfigUpdateOne {
|
||||
_u.mutation.ClearIcpNumber()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPoliceNumber sets the "police_number" field.
|
||||
func (_u *SiteConfigUpdateOne) SetPoliceNumber(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetPoliceNumber(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePoliceNumber sets the "police_number" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillablePoliceNumber(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetPoliceNumber(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearPoliceNumber clears the value of the "police_number" field.
|
||||
func (_u *SiteConfigUpdateOne) ClearPoliceNumber() *SiteConfigUpdateOne {
|
||||
_u.mutation.ClearPoliceNumber()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPageTitle sets the "page_title" field.
|
||||
func (_u *SiteConfigUpdateOne) SetPageTitle(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetPageTitle(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePageTitle sets the "page_title" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillablePageTitle(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetPageTitle(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearPageTitle clears the value of the "page_title" field.
|
||||
func (_u *SiteConfigUpdateOne) ClearPageTitle() *SiteConfigUpdateOne {
|
||||
_u.mutation.ClearPageTitle()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFavicon sets the "favicon" field.
|
||||
func (_u *SiteConfigUpdateOne) SetFavicon(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetFavicon(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableFavicon sets the "favicon" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableFavicon(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetFavicon(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearFavicon clears the value of the "favicon" field.
|
||||
func (_u *SiteConfigUpdateOne) ClearFavicon() *SiteConfigUpdateOne {
|
||||
_u.mutation.ClearFavicon()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUmamiScript sets the "umami_script" field.
|
||||
func (_u *SiteConfigUpdateOne) SetUmamiScript(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetUmamiScript(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUmamiScript sets the "umami_script" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableUmamiScript(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUmamiScript(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUmamiScript clears the value of the "umami_script" field.
|
||||
func (_u *SiteConfigUpdateOne) ClearUmamiScript() *SiteConfigUpdateOne {
|
||||
_u.mutation.ClearUmamiScript()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUmamiWebsiteID sets the "umami_website_id" field.
|
||||
func (_u *SiteConfigUpdateOne) SetUmamiWebsiteID(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetUmamiWebsiteID(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUmamiWebsiteID sets the "umami_website_id" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableUmamiWebsiteID(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUmamiWebsiteID(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUmamiWebsiteID clears the value of the "umami_website_id" field.
|
||||
func (_u *SiteConfigUpdateOne) ClearUmamiWebsiteID() *SiteConfigUpdateOne {
|
||||
_u.mutation.ClearUmamiWebsiteID()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetIconLibrary sets the "icon_library" field.
|
||||
func (_u *SiteConfigUpdateOne) SetIconLibrary(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetIconLibrary(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableIconLibrary sets the "icon_library" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableIconLibrary(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetIconLibrary(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearIconLibrary clears the value of the "icon_library" field.
|
||||
func (_u *SiteConfigUpdateOne) ClearIconLibrary() *SiteConfigUpdateOne {
|
||||
_u.mutation.ClearIconLibrary()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFontLibrary sets the "font_library" field.
|
||||
func (_u *SiteConfigUpdateOne) SetFontLibrary(v string) *SiteConfigUpdateOne {
|
||||
_u.mutation.SetFontLibrary(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableFontLibrary sets the "font_library" field if the given value is not nil.
|
||||
func (_u *SiteConfigUpdateOne) SetNillableFontLibrary(v *string) *SiteConfigUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetFontLibrary(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearFontLibrary clears the value of the "font_library" field.
|
||||
func (_u *SiteConfigUpdateOne) ClearFontLibrary() *SiteConfigUpdateOne {
|
||||
_u.mutation.ClearFontLibrary()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the SiteConfigMutation object of the builder.
|
||||
func (_u *SiteConfigUpdateOne) Mutation() *SiteConfigMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the SiteConfigUpdate builder.
|
||||
func (_u *SiteConfigUpdateOne) Where(ps ...predicate.SiteConfig) *SiteConfigUpdateOne {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (_u *SiteConfigUpdateOne) Select(field string, fields ...string) *SiteConfigUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated SiteConfig entity.
|
||||
func (_u *SiteConfigUpdateOne) Save(ctx context.Context) (*SiteConfig, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *SiteConfigUpdateOne) SaveX(ctx context.Context) *SiteConfig {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (_u *SiteConfigUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *SiteConfigUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (_u *SiteConfigUpdateOne) sqlSave(ctx context.Context) (_node *SiteConfig, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(siteconfig.Table, siteconfig.Columns, sqlgraph.NewFieldSpec(siteconfig.FieldID, field.TypeInt))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "SiteConfig.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, siteconfig.FieldID)
|
||||
for _, f := range fields {
|
||||
if !siteconfig.ValidColumn(f) {
|
||||
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
if f != siteconfig.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.SiteName(); ok {
|
||||
_spec.SetField(siteconfig.FieldSiteName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SiteURL(); ok {
|
||||
_spec.SetField(siteconfig.FieldSiteURL, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SiteIcon(); ok {
|
||||
_spec.SetField(siteconfig.FieldSiteIcon, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SiteDescription(); ok {
|
||||
_spec.SetField(siteconfig.FieldSiteDescription, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SiteKeywords(); ok {
|
||||
_spec.SetField(siteconfig.FieldSiteKeywords, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UserName(); ok {
|
||||
_spec.SetField(siteconfig.FieldUserName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ProfileImageURL(); ok {
|
||||
_spec.SetField(siteconfig.FieldProfileImageURL, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.ProfileImageURLCleared() {
|
||||
_spec.ClearField(siteconfig.FieldProfileImageURL, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.IcpNumber(); ok {
|
||||
_spec.SetField(siteconfig.FieldIcpNumber, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.IcpNumberCleared() {
|
||||
_spec.ClearField(siteconfig.FieldIcpNumber, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.PoliceNumber(); ok {
|
||||
_spec.SetField(siteconfig.FieldPoliceNumber, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.PoliceNumberCleared() {
|
||||
_spec.ClearField(siteconfig.FieldPoliceNumber, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.PageTitle(); ok {
|
||||
_spec.SetField(siteconfig.FieldPageTitle, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.PageTitleCleared() {
|
||||
_spec.ClearField(siteconfig.FieldPageTitle, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.Favicon(); ok {
|
||||
_spec.SetField(siteconfig.FieldFavicon, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.FaviconCleared() {
|
||||
_spec.ClearField(siteconfig.FieldFavicon, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.UmamiScript(); ok {
|
||||
_spec.SetField(siteconfig.FieldUmamiScript, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.UmamiScriptCleared() {
|
||||
_spec.ClearField(siteconfig.FieldUmamiScript, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.UmamiWebsiteID(); ok {
|
||||
_spec.SetField(siteconfig.FieldUmamiWebsiteID, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.UmamiWebsiteIDCleared() {
|
||||
_spec.ClearField(siteconfig.FieldUmamiWebsiteID, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.IconLibrary(); ok {
|
||||
_spec.SetField(siteconfig.FieldIconLibrary, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.IconLibraryCleared() {
|
||||
_spec.ClearField(siteconfig.FieldIconLibrary, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.FontLibrary(); ok {
|
||||
_spec.SetField(siteconfig.FieldFontLibrary, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.FontLibraryCleared() {
|
||||
_spec.ClearField(siteconfig.FieldFontLibrary, field.TypeString)
|
||||
}
|
||||
_node = &SiteConfig{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{siteconfig.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
Reference in New Issue
Block a user