// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "time" "wechat-api/ent/labellog" "entgo.io/ent" "entgo.io/ent/dialect/sql" ) // LabelLog is the model entity for the LabelLog schema. type LabelLog 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"` // 标签名称 LabelName string `json:"label_name,omitempty"` // 三方平台标签id LabelID int `json:"label_id,omitempty"` // 微信ID WxID string `json:"wx_id,omitempty"` // 机构 ID OrganizationID uint64 `json:"organization_id,omitempty"` selectValues sql.SelectValues } // scanValues returns the types for scanning values from sql.Rows. func (*LabelLog) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case labellog.FieldID, labellog.FieldLabelID, labellog.FieldOrganizationID: values[i] = new(sql.NullInt64) case labellog.FieldLabelName, labellog.FieldWxID: values[i] = new(sql.NullString) case labellog.FieldCreatedAt, labellog.FieldUpdatedAt: 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 LabelLog fields. func (ll *LabelLog) 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 labellog.FieldID: value, ok := values[i].(*sql.NullInt64) if !ok { return fmt.Errorf("unexpected type %T for field id", value) } ll.ID = uint64(value.Int64) case labellog.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 { ll.CreatedAt = value.Time } case labellog.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 { ll.UpdatedAt = value.Time } case labellog.FieldLabelName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field label_name", values[i]) } else if value.Valid { ll.LabelName = value.String } case labellog.FieldLabelID: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field label_id", values[i]) } else if value.Valid { ll.LabelID = int(value.Int64) } case labellog.FieldWxID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field wx_id", values[i]) } else if value.Valid { ll.WxID = value.String } case labellog.FieldOrganizationID: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field organization_id", values[i]) } else if value.Valid { ll.OrganizationID = uint64(value.Int64) } default: ll.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the LabelLog. // This includes values selected through modifiers, order, etc. func (ll *LabelLog) Value(name string) (ent.Value, error) { return ll.selectValues.Get(name) } // Update returns a builder for updating this LabelLog. // Note that you need to call LabelLog.Unwrap() before calling this method if this LabelLog // was returned from a transaction, and the transaction was committed or rolled back. func (ll *LabelLog) Update() *LabelLogUpdateOne { return NewLabelLogClient(ll.config).UpdateOne(ll) } // Unwrap unwraps the LabelLog 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 (ll *LabelLog) Unwrap() *LabelLog { _tx, ok := ll.config.driver.(*txDriver) if !ok { panic("ent: LabelLog is not a transactional entity") } ll.config.driver = _tx.drv return ll } // String implements the fmt.Stringer. func (ll *LabelLog) String() string { var builder strings.Builder builder.WriteString("LabelLog(") builder.WriteString(fmt.Sprintf("id=%v, ", ll.ID)) builder.WriteString("created_at=") builder.WriteString(ll.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") builder.WriteString(ll.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("label_name=") builder.WriteString(ll.LabelName) builder.WriteString(", ") builder.WriteString("label_id=") builder.WriteString(fmt.Sprintf("%v", ll.LabelID)) builder.WriteString(", ") builder.WriteString("wx_id=") builder.WriteString(ll.WxID) builder.WriteString(", ") builder.WriteString("organization_id=") builder.WriteString(fmt.Sprintf("%v", ll.OrganizationID)) builder.WriteByte(')') return builder.String() } // LabelLogs is a parsable slice of LabelLog. type LabelLogs []*LabelLog