1
0
This commit is contained in:
syui 2024-04-11 06:54:13 +09:00
parent 9d1838f75d
commit 0e4f081101
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
15 changed files with 540 additions and 28 deletions

View File

@ -100,6 +100,7 @@ var (
{Name: "did", Type: field.TypeString, Nullable: true},
{Name: "uid", Type: field.TypeInt, Nullable: true},
{Name: "cid", Type: field.TypeInt, Nullable: true},
{Name: "card", Type: field.TypeInt, Nullable: true},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
{Name: "created_at", Type: field.TypeTime, Nullable: true},
{Name: "user_sev", Type: field.TypeInt},
@ -112,7 +113,7 @@ var (
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "sevs_users_sev",
Columns: []*schema.Column{SevsColumns[11]},
Columns: []*schema.Column{SevsColumns[12]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},

View File

@ -3067,6 +3067,8 @@ type SevMutation struct {
adduid *int
cid *int
addcid *int
card *int
addcard *int
updated_at *time.Time
created_at *time.Time
clearedFields map[string]struct{}
@ -3617,6 +3619,76 @@ func (m *SevMutation) ResetCid() {
delete(m.clearedFields, sev.FieldCid)
}
// SetCard sets the "card" field.
func (m *SevMutation) SetCard(i int) {
m.card = &i
m.addcard = nil
}
// Card returns the value of the "card" field in the mutation.
func (m *SevMutation) Card() (r int, exists bool) {
v := m.card
if v == nil {
return
}
return *v, true
}
// OldCard returns the old "card" field's value of the Sev entity.
// If the Sev object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *SevMutation) OldCard(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCard is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCard requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCard: %w", err)
}
return oldValue.Card, nil
}
// AddCard adds i to the "card" field.
func (m *SevMutation) AddCard(i int) {
if m.addcard != nil {
*m.addcard += i
} else {
m.addcard = &i
}
}
// AddedCard returns the value that was added to the "card" field in this mutation.
func (m *SevMutation) AddedCard() (r int, exists bool) {
v := m.addcard
if v == nil {
return
}
return *v, true
}
// ClearCard clears the value of the "card" field.
func (m *SevMutation) ClearCard() {
m.card = nil
m.addcard = nil
m.clearedFields[sev.FieldCard] = struct{}{}
}
// CardCleared returns if the "card" field was cleared in this mutation.
func (m *SevMutation) CardCleared() bool {
_, ok := m.clearedFields[sev.FieldCard]
return ok
}
// ResetCard resets all changes to the "card" field.
func (m *SevMutation) ResetCard() {
m.card = nil
m.addcard = nil
delete(m.clearedFields, sev.FieldCard)
}
// SetUpdatedAt sets the "updated_at" field.
func (m *SevMutation) SetUpdatedAt(t time.Time) {
m.updated_at = &t
@ -3788,7 +3860,7 @@ func (m *SevMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *SevMutation) Fields() []string {
fields := make([]string, 0, 10)
fields := make([]string, 0, 11)
if m.password != nil {
fields = append(fields, sev.FieldPassword)
}
@ -3813,6 +3885,9 @@ func (m *SevMutation) Fields() []string {
if m.cid != nil {
fields = append(fields, sev.FieldCid)
}
if m.card != nil {
fields = append(fields, sev.FieldCard)
}
if m.updated_at != nil {
fields = append(fields, sev.FieldUpdatedAt)
}
@ -3843,6 +3918,8 @@ func (m *SevMutation) Field(name string) (ent.Value, bool) {
return m.UID()
case sev.FieldCid:
return m.Cid()
case sev.FieldCard:
return m.Card()
case sev.FieldUpdatedAt:
return m.UpdatedAt()
case sev.FieldCreatedAt:
@ -3872,6 +3949,8 @@ func (m *SevMutation) OldField(ctx context.Context, name string) (ent.Value, err
return m.OldUID(ctx)
case sev.FieldCid:
return m.OldCid(ctx)
case sev.FieldCard:
return m.OldCard(ctx)
case sev.FieldUpdatedAt:
return m.OldUpdatedAt(ctx)
case sev.FieldCreatedAt:
@ -3941,6 +4020,13 @@ func (m *SevMutation) SetField(name string, value ent.Value) error {
}
m.SetCid(v)
return nil
case sev.FieldCard:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCard(v)
return nil
case sev.FieldUpdatedAt:
v, ok := value.(time.Time)
if !ok {
@ -3972,6 +4058,9 @@ func (m *SevMutation) AddedFields() []string {
if m.addcid != nil {
fields = append(fields, sev.FieldCid)
}
if m.addcard != nil {
fields = append(fields, sev.FieldCard)
}
return fields
}
@ -3986,6 +4075,8 @@ func (m *SevMutation) AddedField(name string) (ent.Value, bool) {
return m.AddedUID()
case sev.FieldCid:
return m.AddedCid()
case sev.FieldCard:
return m.AddedCard()
}
return nil, false
}
@ -4016,6 +4107,13 @@ func (m *SevMutation) AddField(name string, value ent.Value) error {
}
m.AddCid(v)
return nil
case sev.FieldCard:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddCard(v)
return nil
}
return fmt.Errorf("unknown Sev numeric field %s", name)
}
@ -4045,6 +4143,9 @@ func (m *SevMutation) ClearedFields() []string {
if m.FieldCleared(sev.FieldCid) {
fields = append(fields, sev.FieldCid)
}
if m.FieldCleared(sev.FieldCard) {
fields = append(fields, sev.FieldCard)
}
if m.FieldCleared(sev.FieldUpdatedAt) {
fields = append(fields, sev.FieldUpdatedAt)
}
@ -4086,6 +4187,9 @@ func (m *SevMutation) ClearField(name string) error {
case sev.FieldCid:
m.ClearCid()
return nil
case sev.FieldCard:
m.ClearCard()
return nil
case sev.FieldUpdatedAt:
m.ClearUpdatedAt()
return nil
@ -4124,6 +4228,9 @@ func (m *SevMutation) ResetField(name string) error {
case sev.FieldCid:
m.ResetCid()
return nil
case sev.FieldCard:
m.ResetCard()
return nil
case sev.FieldUpdatedAt:
m.ResetUpdatedAt()
return nil

View File

@ -2677,6 +2677,12 @@ func (s *CreateSevReq) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
s.Card.Encode(e)
}
}
{
if s.UpdatedAt.Set {
e.FieldStart("updated_at")
@ -2696,7 +2702,7 @@ func (s *CreateSevReq) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfCreateSevReq = [11]string{
var jsonFieldsNameOfCreateSevReq = [12]string{
0: "password",
1: "token",
2: "limit",
@ -2705,9 +2711,10 @@ var jsonFieldsNameOfCreateSevReq = [11]string{
5: "did",
6: "uid",
7: "cid",
8: "updated_at",
9: "created_at",
10: "owner",
8: "card",
9: "updated_at",
10: "created_at",
11: "owner",
}
// Decode decodes CreateSevReq from json.
@ -2801,6 +2808,16 @@ func (s *CreateSevReq) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "card":
if err := func() error {
s.Card.Reset()
if err := s.Card.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"card\"")
}
case "updated_at":
if err := func() error {
s.UpdatedAt.Reset()
@ -2822,7 +2839,7 @@ func (s *CreateSevReq) Decode(d *jx.Decoder) error {
return errors.Wrap(err, "decode field \"created_at\"")
}
case "owner":
requiredBitSet[1] |= 1 << 2
requiredBitSet[1] |= 1 << 3
if err := func() error {
v, err := d.Int()
s.Owner = int(v)
@ -2844,7 +2861,7 @@ func (s *CreateSevReq) Decode(d *jx.Decoder) error {
var failures []validate.FieldError
for i, mask := range [2]uint8{
0b00000001,
0b00000100,
0b00001000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -9154,6 +9171,12 @@ func (s *SevCreate) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
s.Card.Encode(e)
}
}
{
if s.UpdatedAt.Set {
e.FieldStart("updated_at")
@ -9168,7 +9191,7 @@ func (s *SevCreate) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfSevCreate = [9]string{
var jsonFieldsNameOfSevCreate = [10]string{
0: "id",
1: "limit",
2: "count",
@ -9176,8 +9199,9 @@ var jsonFieldsNameOfSevCreate = [9]string{
4: "did",
5: "uid",
6: "cid",
7: "updated_at",
8: "created_at",
7: "card",
8: "updated_at",
9: "created_at",
}
// Decode decodes SevCreate from json.
@ -9261,6 +9285,16 @@ func (s *SevCreate) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "card":
if err := func() error {
s.Card.Reset()
if err := s.Card.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"card\"")
}
case "updated_at":
if err := func() error {
s.UpdatedAt.Reset()
@ -9388,6 +9422,12 @@ func (s *SevList) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
s.Card.Encode(e)
}
}
{
if s.UpdatedAt.Set {
e.FieldStart("updated_at")
@ -9402,7 +9442,7 @@ func (s *SevList) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfSevList = [9]string{
var jsonFieldsNameOfSevList = [10]string{
0: "id",
1: "limit",
2: "count",
@ -9410,8 +9450,9 @@ var jsonFieldsNameOfSevList = [9]string{
4: "did",
5: "uid",
6: "cid",
7: "updated_at",
8: "created_at",
7: "card",
8: "updated_at",
9: "created_at",
}
// Decode decodes SevList from json.
@ -9495,6 +9536,16 @@ func (s *SevList) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "card":
if err := func() error {
s.Card.Reset()
if err := s.Card.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"card\"")
}
case "updated_at":
if err := func() error {
s.UpdatedAt.Reset()
@ -10542,6 +10593,12 @@ func (s *SevRead) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
s.Card.Encode(e)
}
}
{
if s.UpdatedAt.Set {
e.FieldStart("updated_at")
@ -10556,7 +10613,7 @@ func (s *SevRead) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfSevRead = [9]string{
var jsonFieldsNameOfSevRead = [10]string{
0: "id",
1: "limit",
2: "count",
@ -10564,8 +10621,9 @@ var jsonFieldsNameOfSevRead = [9]string{
4: "did",
5: "uid",
6: "cid",
7: "updated_at",
8: "created_at",
7: "card",
8: "updated_at",
9: "created_at",
}
// Decode decodes SevRead from json.
@ -10649,6 +10707,16 @@ func (s *SevRead) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "card":
if err := func() error {
s.Card.Reset()
if err := s.Card.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"card\"")
}
case "updated_at":
if err := func() error {
s.UpdatedAt.Reset()
@ -10776,6 +10844,12 @@ func (s *SevUpdate) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
s.Card.Encode(e)
}
}
{
if s.UpdatedAt.Set {
e.FieldStart("updated_at")
@ -10790,7 +10864,7 @@ func (s *SevUpdate) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfSevUpdate = [9]string{
var jsonFieldsNameOfSevUpdate = [10]string{
0: "id",
1: "limit",
2: "count",
@ -10798,8 +10872,9 @@ var jsonFieldsNameOfSevUpdate = [9]string{
4: "did",
5: "uid",
6: "cid",
7: "updated_at",
8: "created_at",
7: "card",
8: "updated_at",
9: "created_at",
}
// Decode decodes SevUpdate from json.
@ -10883,6 +10958,16 @@ func (s *SevUpdate) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "card":
if err := func() error {
s.Card.Reset()
if err := s.Card.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"card\"")
}
case "updated_at":
if err := func() error {
s.UpdatedAt.Reset()
@ -14042,6 +14127,12 @@ func (s *UpdateSevReq) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
s.Card.Encode(e)
}
}
{
if s.UpdatedAt.Set {
e.FieldStart("updated_at")
@ -14056,7 +14147,7 @@ func (s *UpdateSevReq) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfUpdateSevReq = [9]string{
var jsonFieldsNameOfUpdateSevReq = [10]string{
0: "token",
1: "limit",
2: "count",
@ -14064,8 +14155,9 @@ var jsonFieldsNameOfUpdateSevReq = [9]string{
4: "did",
5: "uid",
6: "cid",
7: "updated_at",
8: "owner",
7: "card",
8: "updated_at",
9: "owner",
}
// Decode decodes UpdateSevReq from json.
@ -14146,6 +14238,16 @@ func (s *UpdateSevReq) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "card":
if err := func() error {
s.Card.Reset()
if err := s.Card.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"card\"")
}
case "updated_at":
if err := func() error {
s.UpdatedAt.Reset()
@ -18853,6 +18955,12 @@ func (s *UserSevList) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
s.Card.Encode(e)
}
}
{
if s.UpdatedAt.Set {
e.FieldStart("updated_at")
@ -18867,7 +18975,7 @@ func (s *UserSevList) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfUserSevList = [9]string{
var jsonFieldsNameOfUserSevList = [10]string{
0: "id",
1: "limit",
2: "count",
@ -18875,8 +18983,9 @@ var jsonFieldsNameOfUserSevList = [9]string{
4: "did",
5: "uid",
6: "cid",
7: "updated_at",
8: "created_at",
7: "card",
8: "updated_at",
9: "created_at",
}
// Decode decodes UserSevList from json.
@ -18960,6 +19069,16 @@ func (s *UserSevList) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "card":
if err := func() error {
s.Card.Reset()
if err := s.Card.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"card\"")
}
case "updated_at":
if err := func() error {
s.UpdatedAt.Reset()

View File

@ -1308,6 +1308,7 @@ type CreateSevReq struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
Owner int `json:"owner"`
@ -1353,6 +1354,11 @@ func (s *CreateSevReq) GetCid() OptInt {
return s.Cid
}
// GetCard returns the value of Card.
func (s *CreateSevReq) GetCard() OptInt {
return s.Card
}
// GetUpdatedAt returns the value of UpdatedAt.
func (s *CreateSevReq) GetUpdatedAt() OptDateTime {
return s.UpdatedAt
@ -1408,6 +1414,11 @@ func (s *CreateSevReq) SetCid(val OptInt) {
s.Cid = val
}
// SetCard sets the value of Card.
func (s *CreateSevReq) SetCard(val OptInt) {
s.Card = val
}
// SetUpdatedAt sets the value of UpdatedAt.
func (s *CreateSevReq) SetUpdatedAt(val OptDateTime) {
s.UpdatedAt = val
@ -4606,6 +4617,7 @@ type SevCreate struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
}
@ -4645,6 +4657,11 @@ func (s *SevCreate) GetCid() OptInt {
return s.Cid
}
// GetCard returns the value of Card.
func (s *SevCreate) GetCard() OptInt {
return s.Card
}
// GetUpdatedAt returns the value of UpdatedAt.
func (s *SevCreate) GetUpdatedAt() OptDateTime {
return s.UpdatedAt
@ -4690,6 +4707,11 @@ func (s *SevCreate) SetCid(val OptInt) {
s.Cid = val
}
// SetCard sets the value of Card.
func (s *SevCreate) SetCard(val OptInt) {
s.Card = val
}
// SetUpdatedAt sets the value of UpdatedAt.
func (s *SevCreate) SetUpdatedAt(val OptDateTime) {
s.UpdatedAt = val
@ -4711,6 +4733,7 @@ type SevList struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
}
@ -4750,6 +4773,11 @@ func (s *SevList) GetCid() OptInt {
return s.Cid
}
// GetCard returns the value of Card.
func (s *SevList) GetCard() OptInt {
return s.Card
}
// GetUpdatedAt returns the value of UpdatedAt.
func (s *SevList) GetUpdatedAt() OptDateTime {
return s.UpdatedAt
@ -4795,6 +4823,11 @@ func (s *SevList) SetCid(val OptInt) {
s.Cid = val
}
// SetCard sets the value of Card.
func (s *SevList) SetCard(val OptInt) {
s.Card = val
}
// SetUpdatedAt sets the value of UpdatedAt.
func (s *SevList) SetUpdatedAt(val OptDateTime) {
s.UpdatedAt = val
@ -5359,6 +5392,7 @@ type SevRead struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
}
@ -5398,6 +5432,11 @@ func (s *SevRead) GetCid() OptInt {
return s.Cid
}
// GetCard returns the value of Card.
func (s *SevRead) GetCard() OptInt {
return s.Card
}
// GetUpdatedAt returns the value of UpdatedAt.
func (s *SevRead) GetUpdatedAt() OptDateTime {
return s.UpdatedAt
@ -5443,6 +5482,11 @@ func (s *SevRead) SetCid(val OptInt) {
s.Cid = val
}
// SetCard sets the value of Card.
func (s *SevRead) SetCard(val OptInt) {
s.Card = val
}
// SetUpdatedAt sets the value of UpdatedAt.
func (s *SevRead) SetUpdatedAt(val OptDateTime) {
s.UpdatedAt = val
@ -5464,6 +5508,7 @@ type SevUpdate struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
}
@ -5503,6 +5548,11 @@ func (s *SevUpdate) GetCid() OptInt {
return s.Cid
}
// GetCard returns the value of Card.
func (s *SevUpdate) GetCard() OptInt {
return s.Card
}
// GetUpdatedAt returns the value of UpdatedAt.
func (s *SevUpdate) GetUpdatedAt() OptDateTime {
return s.UpdatedAt
@ -5548,6 +5598,11 @@ func (s *SevUpdate) SetCid(val OptInt) {
s.Cid = val
}
// SetCard sets the value of Card.
func (s *SevUpdate) SetCard(val OptInt) {
s.Card = val
}
// SetUpdatedAt sets the value of UpdatedAt.
func (s *SevUpdate) SetUpdatedAt(val OptDateTime) {
s.UpdatedAt = val
@ -7200,6 +7255,7 @@ type UpdateSevReq struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
Owner OptInt `json:"owner"`
}
@ -7239,6 +7295,11 @@ func (s *UpdateSevReq) GetCid() OptInt {
return s.Cid
}
// GetCard returns the value of Card.
func (s *UpdateSevReq) GetCard() OptInt {
return s.Card
}
// GetUpdatedAt returns the value of UpdatedAt.
func (s *UpdateSevReq) GetUpdatedAt() OptDateTime {
return s.UpdatedAt
@ -7284,6 +7345,11 @@ func (s *UpdateSevReq) SetCid(val OptInt) {
s.Cid = val
}
// SetCard sets the value of Card.
func (s *UpdateSevReq) SetCard(val OptInt) {
s.Card = val
}
// SetUpdatedAt sets the value of UpdatedAt.
func (s *UpdateSevReq) SetUpdatedAt(val OptDateTime) {
s.UpdatedAt = val
@ -9951,6 +10017,7 @@ type UserSevList struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
}
@ -9990,6 +10057,11 @@ func (s *UserSevList) GetCid() OptInt {
return s.Cid
}
// GetCard returns the value of Card.
func (s *UserSevList) GetCard() OptInt {
return s.Card
}
// GetUpdatedAt returns the value of UpdatedAt.
func (s *UserSevList) GetUpdatedAt() OptDateTime {
return s.UpdatedAt
@ -10035,6 +10107,11 @@ func (s *UserSevList) SetCid(val OptInt) {
s.Cid = val
}
// SetCard sets the value of Card.
func (s *UserSevList) SetCard(val OptInt) {
s.Card = val
}
// SetUpdatedAt sets the value of UpdatedAt.
func (s *UserSevList) SetUpdatedAt(val OptDateTime) {
s.UpdatedAt = val

View File

@ -808,6 +808,9 @@ func (h *OgentHandler) CreateSev(ctx context.Context, req *CreateSevReq) (Create
if v, ok := req.Cid.Get(); ok {
b.SetCid(v)
}
if v, ok := req.Card.Get(); ok {
b.SetCard(v)
}
if v, ok := req.UpdatedAt.Get(); ok {
b.SetUpdatedAt(v)
}
@ -904,6 +907,9 @@ func (h *OgentHandler) UpdateSev(ctx context.Context, req *UpdateSevReq, params
if v, ok := req.Cid.Get(); ok {
b.SetCid(v)
}
if v, ok := req.Card.Get(); ok {
b.SetCard(v)
}
if v, ok := req.UpdatedAt.Get(); ok {
b.SetUpdatedAt(v)
}

View File

@ -649,6 +649,7 @@ func NewSevCreate(e *ent.Sev) *SevCreate {
ret.Did = NewOptString(e.Did)
ret.UID = NewOptInt(e.UID)
ret.Cid = NewOptInt(e.Cid)
ret.Card = NewOptInt(e.Card)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
return &ret
@ -684,6 +685,7 @@ func NewSevList(e *ent.Sev) *SevList {
ret.Did = NewOptString(e.Did)
ret.UID = NewOptInt(e.UID)
ret.Cid = NewOptInt(e.Cid)
ret.Card = NewOptInt(e.Card)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
return &ret
@ -719,6 +721,7 @@ func NewSevRead(e *ent.Sev) *SevRead {
ret.Did = NewOptString(e.Did)
ret.UID = NewOptInt(e.UID)
ret.Cid = NewOptInt(e.Cid)
ret.Card = NewOptInt(e.Card)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
return &ret
@ -754,6 +757,7 @@ func NewSevUpdate(e *ent.Sev) *SevUpdate {
ret.Did = NewOptString(e.Did)
ret.UID = NewOptInt(e.UID)
ret.Cid = NewOptInt(e.Cid)
ret.Card = NewOptInt(e.Card)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
return &ret
@ -1489,6 +1493,7 @@ func NewUserSevList(e *ent.Sev) *UserSevList {
ret.Did = NewOptString(e.Did)
ret.UID = NewOptInt(e.UID)
ret.Cid = NewOptInt(e.Cid)
ret.Card = NewOptInt(e.Card)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
return &ret

View File

@ -1172,6 +1172,9 @@
"cid": {
"type": "integer"
},
"card": {
"type": "integer"
},
"updated_at": {
"type": "string",
"format": "date-time"
@ -1342,6 +1345,9 @@
"cid": {
"type": "integer"
},
"card": {
"type": "integer"
},
"updated_at": {
"type": "string",
"format": "date-time"
@ -3770,6 +3776,9 @@
"cid": {
"type": "integer"
},
"card": {
"type": "integer"
},
"updated_at": {
"type": "string",
"format": "date-time"
@ -3812,6 +3821,9 @@
"cid": {
"type": "integer"
},
"card": {
"type": "integer"
},
"updated_at": {
"type": "string",
"format": "date-time"
@ -3849,6 +3861,9 @@
"cid": {
"type": "integer"
},
"card": {
"type": "integer"
},
"updated_at": {
"type": "string",
"format": "date-time"
@ -3886,6 +3901,9 @@
"cid": {
"type": "integer"
},
"card": {
"type": "integer"
},
"updated_at": {
"type": "string",
"format": "date-time"
@ -3923,6 +3941,9 @@
"cid": {
"type": "integer"
},
"card": {
"type": "integer"
},
"updated_at": {
"type": "string",
"format": "date-time"
@ -5564,6 +5585,9 @@
"cid": {
"type": "integer"
},
"card": {
"type": "integer"
},
"updated_at": {
"type": "string",
"format": "date-time"

View File

@ -78,7 +78,7 @@ func init() {
// sev.DefaultLimit holds the default value on creation for the limit field.
sev.DefaultLimit = sevDescLimit.Default.(bool)
// sevDescCreatedAt is the schema descriptor for created_at field.
sevDescCreatedAt := sevFields[9].Descriptor()
sevDescCreatedAt := sevFields[10].Descriptor()
// sev.DefaultCreatedAt holds the default value on creation for the created_at field.
sev.DefaultCreatedAt = sevDescCreatedAt.Default.(func() time.Time)
ueFields := schema.Ue{}.Fields()

View File

@ -43,6 +43,9 @@ func (Sev) Fields() []ent.Field {
field.Int("cid").
Optional(),
field.Int("card").
Optional(),
field.Time("updated_at").
Optional(),

View File

@ -34,6 +34,8 @@ type Sev struct {
UID int `json:"uid,omitempty"`
// Cid holds the value of the "cid" field.
Cid int `json:"cid,omitempty"`
// Card holds the value of the "card" field.
Card int `json:"card,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt time.Time `json:"updated_at,omitempty"`
// CreatedAt holds the value of the "created_at" field.
@ -74,7 +76,7 @@ func (*Sev) scanValues(columns []string) ([]any, error) {
switch columns[i] {
case sev.FieldLimit:
values[i] = new(sql.NullBool)
case sev.FieldID, sev.FieldCount, sev.FieldUID, sev.FieldCid:
case sev.FieldID, sev.FieldCount, sev.FieldUID, sev.FieldCid, sev.FieldCard:
values[i] = new(sql.NullInt64)
case sev.FieldPassword, sev.FieldToken, sev.FieldHandle, sev.FieldDid:
values[i] = new(sql.NullString)
@ -151,6 +153,12 @@ func (s *Sev) assignValues(columns []string, values []any) error {
} else if value.Valid {
s.Cid = int(value.Int64)
}
case sev.FieldCard:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field card", values[i])
} else if value.Valid {
s.Card = int(value.Int64)
}
case sev.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
@ -233,6 +241,9 @@ func (s *Sev) String() string {
builder.WriteString("cid=")
builder.WriteString(fmt.Sprintf("%v", s.Cid))
builder.WriteString(", ")
builder.WriteString("card=")
builder.WriteString(fmt.Sprintf("%v", s.Card))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(s.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")

View File

@ -30,6 +30,8 @@ const (
FieldUID = "uid"
// FieldCid holds the string denoting the cid field in the database.
FieldCid = "cid"
// FieldCard holds the string denoting the card field in the database.
FieldCard = "card"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldCreatedAt holds the string denoting the created_at field in the database.
@ -58,6 +60,7 @@ var Columns = []string{
FieldDid,
FieldUID,
FieldCid,
FieldCard,
FieldUpdatedAt,
FieldCreatedAt,
}
@ -140,6 +143,11 @@ func ByCid(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCid, opts...).ToFunc()
}
// ByCard orders the results by the card field.
func ByCard(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCard, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()

View File

@ -95,6 +95,11 @@ func Cid(v int) predicate.Sev {
return predicate.Sev(sql.FieldEQ(FieldCid, v))
}
// Card applies equality check predicate on the "card" field. It's identical to CardEQ.
func Card(v int) predicate.Sev {
return predicate.Sev(sql.FieldEQ(FieldCard, v))
}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
func UpdatedAt(v time.Time) predicate.Sev {
return predicate.Sev(sql.FieldEQ(FieldUpdatedAt, v))
@ -565,6 +570,56 @@ func CidNotNil() predicate.Sev {
return predicate.Sev(sql.FieldNotNull(FieldCid))
}
// CardEQ applies the EQ predicate on the "card" field.
func CardEQ(v int) predicate.Sev {
return predicate.Sev(sql.FieldEQ(FieldCard, v))
}
// CardNEQ applies the NEQ predicate on the "card" field.
func CardNEQ(v int) predicate.Sev {
return predicate.Sev(sql.FieldNEQ(FieldCard, v))
}
// CardIn applies the In predicate on the "card" field.
func CardIn(vs ...int) predicate.Sev {
return predicate.Sev(sql.FieldIn(FieldCard, vs...))
}
// CardNotIn applies the NotIn predicate on the "card" field.
func CardNotIn(vs ...int) predicate.Sev {
return predicate.Sev(sql.FieldNotIn(FieldCard, vs...))
}
// CardGT applies the GT predicate on the "card" field.
func CardGT(v int) predicate.Sev {
return predicate.Sev(sql.FieldGT(FieldCard, v))
}
// CardGTE applies the GTE predicate on the "card" field.
func CardGTE(v int) predicate.Sev {
return predicate.Sev(sql.FieldGTE(FieldCard, v))
}
// CardLT applies the LT predicate on the "card" field.
func CardLT(v int) predicate.Sev {
return predicate.Sev(sql.FieldLT(FieldCard, v))
}
// CardLTE applies the LTE predicate on the "card" field.
func CardLTE(v int) predicate.Sev {
return predicate.Sev(sql.FieldLTE(FieldCard, v))
}
// CardIsNil applies the IsNil predicate on the "card" field.
func CardIsNil() predicate.Sev {
return predicate.Sev(sql.FieldIsNull(FieldCard))
}
// CardNotNil applies the NotNil predicate on the "card" field.
func CardNotNil() predicate.Sev {
return predicate.Sev(sql.FieldNotNull(FieldCard))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.Sev {
return predicate.Sev(sql.FieldEQ(FieldUpdatedAt, v))

View File

@ -125,6 +125,20 @@ func (sc *SevCreate) SetNillableCid(i *int) *SevCreate {
return sc
}
// SetCard sets the "card" field.
func (sc *SevCreate) SetCard(i int) *SevCreate {
sc.mutation.SetCard(i)
return sc
}
// SetNillableCard sets the "card" field if the given value is not nil.
func (sc *SevCreate) SetNillableCard(i *int) *SevCreate {
if i != nil {
sc.SetCard(*i)
}
return sc
}
// SetUpdatedAt sets the "updated_at" field.
func (sc *SevCreate) SetUpdatedAt(t time.Time) *SevCreate {
sc.mutation.SetUpdatedAt(t)
@ -280,6 +294,10 @@ func (sc *SevCreate) createSpec() (*Sev, *sqlgraph.CreateSpec) {
_spec.SetField(sev.FieldCid, field.TypeInt, value)
_node.Cid = value
}
if value, ok := sc.mutation.Card(); ok {
_spec.SetField(sev.FieldCard, field.TypeInt, value)
_node.Card = value
}
if value, ok := sc.mutation.UpdatedAt(); ok {
_spec.SetField(sev.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value

View File

@ -190,6 +190,33 @@ func (su *SevUpdate) ClearCid() *SevUpdate {
return su
}
// SetCard sets the "card" field.
func (su *SevUpdate) SetCard(i int) *SevUpdate {
su.mutation.ResetCard()
su.mutation.SetCard(i)
return su
}
// SetNillableCard sets the "card" field if the given value is not nil.
func (su *SevUpdate) SetNillableCard(i *int) *SevUpdate {
if i != nil {
su.SetCard(*i)
}
return su
}
// AddCard adds i to the "card" field.
func (su *SevUpdate) AddCard(i int) *SevUpdate {
su.mutation.AddCard(i)
return su
}
// ClearCard clears the value of the "card" field.
func (su *SevUpdate) ClearCard() *SevUpdate {
su.mutation.ClearCard()
return su
}
// SetUpdatedAt sets the "updated_at" field.
func (su *SevUpdate) SetUpdatedAt(t time.Time) *SevUpdate {
su.mutation.SetUpdatedAt(t)
@ -330,6 +357,15 @@ func (su *SevUpdate) sqlSave(ctx context.Context) (n int, err error) {
if su.mutation.CidCleared() {
_spec.ClearField(sev.FieldCid, field.TypeInt)
}
if value, ok := su.mutation.Card(); ok {
_spec.SetField(sev.FieldCard, field.TypeInt, value)
}
if value, ok := su.mutation.AddedCard(); ok {
_spec.AddField(sev.FieldCard, field.TypeInt, value)
}
if su.mutation.CardCleared() {
_spec.ClearField(sev.FieldCard, field.TypeInt)
}
if value, ok := su.mutation.UpdatedAt(); ok {
_spec.SetField(sev.FieldUpdatedAt, field.TypeTime, value)
}
@ -549,6 +585,33 @@ func (suo *SevUpdateOne) ClearCid() *SevUpdateOne {
return suo
}
// SetCard sets the "card" field.
func (suo *SevUpdateOne) SetCard(i int) *SevUpdateOne {
suo.mutation.ResetCard()
suo.mutation.SetCard(i)
return suo
}
// SetNillableCard sets the "card" field if the given value is not nil.
func (suo *SevUpdateOne) SetNillableCard(i *int) *SevUpdateOne {
if i != nil {
suo.SetCard(*i)
}
return suo
}
// AddCard adds i to the "card" field.
func (suo *SevUpdateOne) AddCard(i int) *SevUpdateOne {
suo.mutation.AddCard(i)
return suo
}
// ClearCard clears the value of the "card" field.
func (suo *SevUpdateOne) ClearCard() *SevUpdateOne {
suo.mutation.ClearCard()
return suo
}
// SetUpdatedAt sets the "updated_at" field.
func (suo *SevUpdateOne) SetUpdatedAt(t time.Time) *SevUpdateOne {
suo.mutation.SetUpdatedAt(t)
@ -719,6 +782,15 @@ func (suo *SevUpdateOne) sqlSave(ctx context.Context) (_node *Sev, err error) {
if suo.mutation.CidCleared() {
_spec.ClearField(sev.FieldCid, field.TypeInt)
}
if value, ok := suo.mutation.Card(); ok {
_spec.SetField(sev.FieldCard, field.TypeInt, value)
}
if value, ok := suo.mutation.AddedCard(); ok {
_spec.AddField(sev.FieldCard, field.TypeInt, value)
}
if suo.mutation.CardCleared() {
_spec.ClearField(sev.FieldCard, field.TypeInt)
}
if value, ok := suo.mutation.UpdatedAt(); ok {
_spec.SetField(sev.FieldUpdatedAt, field.TypeTime, value)
}

View File

@ -808,6 +808,9 @@ func (h *OgentHandler) CreateSev(ctx context.Context, req *CreateSevReq) (Create
if v, ok := req.Cid.Get(); ok {
b.SetCid(v)
}
if v, ok := req.Card.Get(); ok {
b.SetCard(v)
}
if v, ok := req.UpdatedAt.Get(); ok {
b.SetUpdatedAt(v)
}
@ -904,6 +907,9 @@ func (h *OgentHandler) UpdateSev(ctx context.Context, req *UpdateSevReq, params
if v, ok := req.Cid.Get(); ok {
b.SetCid(v)
}
if v, ok := req.Card.Get(); ok {
b.SetCard(v)
}
if v, ok := req.UpdatedAt.Get(); ok {
b.SetUpdatedAt(v)
}