// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "time" "wechat-api/ent/wxcard" "entgo.io/ent" "entgo.io/ent/dialect/sql" ) // WxCard is the model entity for the WxCard schema. type WxCard struct { config `json:"-"` // ID of the ent. ID uint64 `json:"id,omitempty"` // Create Time | 创建日期 CreatedAt time.Time `json:"created_at,omitempty"` // Update Time | 修改日期 UpdatedAt time.Time `json:"updated_at,omitempty"` // Delete Time | 删除日期 DeletedAt time.Time `json:"deleted_at,omitempty"` // user表ID UserID uint64 `json:"user_id,omitempty"` // wx表ID WxUserID uint64 `json:"wx_user_id,omitempty"` // 头像 Avatar string `json:"avatar,omitempty"` // logo Logo string `json:"logo,omitempty"` // 名称 Name string `json:"name,omitempty"` // 公司 Company string `json:"company,omitempty"` // 地址 Address string `json:"address,omitempty"` // 手机号 Phone string `json:"phone,omitempty"` // 公众号 OfficialAccount string `json:"official_account,omitempty"` // 微信号 WechatAccount string `json:"wechat_account,omitempty"` // 邮箱 Email string `json:"email,omitempty"` // fastgpt-base APIBase string `json:"api_base,omitempty"` // fastgpt-key APIKey string `json:"api_key,omitempty"` // AI信息 AiInfo string `json:"ai_info,omitempty"` // 个人介绍 Intro string `json:"intro,omitempty"` selectValues sql.SelectValues } // scanValues returns the types for scanning values from sql.Rows. func (*WxCard) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case wxcard.FieldID, wxcard.FieldUserID, wxcard.FieldWxUserID: values[i] = new(sql.NullInt64) case wxcard.FieldAvatar, wxcard.FieldLogo, wxcard.FieldName, wxcard.FieldCompany, wxcard.FieldAddress, wxcard.FieldPhone, wxcard.FieldOfficialAccount, wxcard.FieldWechatAccount, wxcard.FieldEmail, wxcard.FieldAPIBase, wxcard.FieldAPIKey, wxcard.FieldAiInfo, wxcard.FieldIntro: values[i] = new(sql.NullString) case wxcard.FieldCreatedAt, wxcard.FieldUpdatedAt, wxcard.FieldDeletedAt: values[i] = new(sql.NullTime) default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the WxCard fields. func (wc *WxCard) assignValues(columns []string, values []any) error { if m, n := len(values), len(columns); m < n { return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) } for i := range columns { switch columns[i] { case wxcard.FieldID: value, ok := values[i].(*sql.NullInt64) if !ok { return fmt.Errorf("unexpected type %T for field id", value) } wc.ID = uint64(value.Int64) case wxcard.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { wc.CreatedAt = value.Time } case wxcard.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { wc.UpdatedAt = value.Time } case wxcard.FieldDeletedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field deleted_at", values[i]) } else if value.Valid { wc.DeletedAt = value.Time } case wxcard.FieldUserID: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field user_id", values[i]) } else if value.Valid { wc.UserID = uint64(value.Int64) } case wxcard.FieldWxUserID: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field wx_user_id", values[i]) } else if value.Valid { wc.WxUserID = uint64(value.Int64) } case wxcard.FieldAvatar: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field avatar", values[i]) } else if value.Valid { wc.Avatar = value.String } case wxcard.FieldLogo: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field logo", values[i]) } else if value.Valid { wc.Logo = value.String } case wxcard.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { wc.Name = value.String } case wxcard.FieldCompany: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field company", values[i]) } else if value.Valid { wc.Company = value.String } case wxcard.FieldAddress: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field address", values[i]) } else if value.Valid { wc.Address = value.String } case wxcard.FieldPhone: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field phone", values[i]) } else if value.Valid { wc.Phone = value.String } case wxcard.FieldOfficialAccount: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field official_account", values[i]) } else if value.Valid { wc.OfficialAccount = value.String } case wxcard.FieldWechatAccount: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field wechat_account", values[i]) } else if value.Valid { wc.WechatAccount = value.String } case wxcard.FieldEmail: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field email", values[i]) } else if value.Valid { wc.Email = value.String } case wxcard.FieldAPIBase: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field api_base", values[i]) } else if value.Valid { wc.APIBase = value.String } case wxcard.FieldAPIKey: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field api_key", values[i]) } else if value.Valid { wc.APIKey = value.String } case wxcard.FieldAiInfo: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field ai_info", values[i]) } else if value.Valid { wc.AiInfo = value.String } case wxcard.FieldIntro: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field intro", values[i]) } else if value.Valid { wc.Intro = value.String } default: wc.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the WxCard. // This includes values selected through modifiers, order, etc. func (wc *WxCard) Value(name string) (ent.Value, error) { return wc.selectValues.Get(name) } // Update returns a builder for updating this WxCard. // Note that you need to call WxCard.Unwrap() before calling this method if this WxCard // was returned from a transaction, and the transaction was committed or rolled back. func (wc *WxCard) Update() *WxCardUpdateOne { return NewWxCardClient(wc.config).UpdateOne(wc) } // Unwrap unwraps the WxCard entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (wc *WxCard) Unwrap() *WxCard { _tx, ok := wc.config.driver.(*txDriver) if !ok { panic("ent: WxCard is not a transactional entity") } wc.config.driver = _tx.drv return wc } // String implements the fmt.Stringer. func (wc *WxCard) String() string { var builder strings.Builder builder.WriteString("WxCard(") builder.WriteString(fmt.Sprintf("id=%v, ", wc.ID)) builder.WriteString("created_at=") builder.WriteString(wc.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") builder.WriteString(wc.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("deleted_at=") builder.WriteString(wc.DeletedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("user_id=") builder.WriteString(fmt.Sprintf("%v", wc.UserID)) builder.WriteString(", ") builder.WriteString("wx_user_id=") builder.WriteString(fmt.Sprintf("%v", wc.WxUserID)) builder.WriteString(", ") builder.WriteString("avatar=") builder.WriteString(wc.Avatar) builder.WriteString(", ") builder.WriteString("logo=") builder.WriteString(wc.Logo) builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(wc.Name) builder.WriteString(", ") builder.WriteString("company=") builder.WriteString(wc.Company) builder.WriteString(", ") builder.WriteString("address=") builder.WriteString(wc.Address) builder.WriteString(", ") builder.WriteString("phone=") builder.WriteString(wc.Phone) builder.WriteString(", ") builder.WriteString("official_account=") builder.WriteString(wc.OfficialAccount) builder.WriteString(", ") builder.WriteString("wechat_account=") builder.WriteString(wc.WechatAccount) builder.WriteString(", ") builder.WriteString("email=") builder.WriteString(wc.Email) builder.WriteString(", ") builder.WriteString("api_base=") builder.WriteString(wc.APIBase) builder.WriteString(", ") builder.WriteString("api_key=") builder.WriteString(wc.APIKey) builder.WriteString(", ") builder.WriteString("ai_info=") builder.WriteString(wc.AiInfo) builder.WriteString(", ") builder.WriteString("intro=") builder.WriteString(wc.Intro) builder.WriteByte(')') return builder.String() } // WxCards is a parsable slice of WxCard. type WxCards []*WxCard