1
0
This commit is contained in:
syui 2024-04-11 07:31:56 +09:00
parent 0e4f081101
commit 9494408008
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
15 changed files with 589 additions and 77 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: "cp", 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},
@ -113,7 +114,7 @@ var (
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "sevs_users_sev",
Columns: []*schema.Column{SevsColumns[12]},
Columns: []*schema.Column{SevsColumns[13]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},

View File

@ -3067,6 +3067,8 @@ type SevMutation struct {
adduid *int
cid *int
addcid *int
cp *int
addcp *int
card *int
addcard *int
updated_at *time.Time
@ -3619,6 +3621,76 @@ func (m *SevMutation) ResetCid() {
delete(m.clearedFields, sev.FieldCid)
}
// SetCp sets the "cp" field.
func (m *SevMutation) SetCp(i int) {
m.cp = &i
m.addcp = nil
}
// Cp returns the value of the "cp" field in the mutation.
func (m *SevMutation) Cp() (r int, exists bool) {
v := m.cp
if v == nil {
return
}
return *v, true
}
// OldCp returns the old "cp" 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) OldCp(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCp is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCp requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCp: %w", err)
}
return oldValue.Cp, nil
}
// AddCp adds i to the "cp" field.
func (m *SevMutation) AddCp(i int) {
if m.addcp != nil {
*m.addcp += i
} else {
m.addcp = &i
}
}
// AddedCp returns the value that was added to the "cp" field in this mutation.
func (m *SevMutation) AddedCp() (r int, exists bool) {
v := m.addcp
if v == nil {
return
}
return *v, true
}
// ClearCp clears the value of the "cp" field.
func (m *SevMutation) ClearCp() {
m.cp = nil
m.addcp = nil
m.clearedFields[sev.FieldCp] = struct{}{}
}
// CpCleared returns if the "cp" field was cleared in this mutation.
func (m *SevMutation) CpCleared() bool {
_, ok := m.clearedFields[sev.FieldCp]
return ok
}
// ResetCp resets all changes to the "cp" field.
func (m *SevMutation) ResetCp() {
m.cp = nil
m.addcp = nil
delete(m.clearedFields, sev.FieldCp)
}
// SetCard sets the "card" field.
func (m *SevMutation) SetCard(i int) {
m.card = &i
@ -3860,7 +3932,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, 11)
fields := make([]string, 0, 12)
if m.password != nil {
fields = append(fields, sev.FieldPassword)
}
@ -3885,6 +3957,9 @@ func (m *SevMutation) Fields() []string {
if m.cid != nil {
fields = append(fields, sev.FieldCid)
}
if m.cp != nil {
fields = append(fields, sev.FieldCp)
}
if m.card != nil {
fields = append(fields, sev.FieldCard)
}
@ -3918,6 +3993,8 @@ func (m *SevMutation) Field(name string) (ent.Value, bool) {
return m.UID()
case sev.FieldCid:
return m.Cid()
case sev.FieldCp:
return m.Cp()
case sev.FieldCard:
return m.Card()
case sev.FieldUpdatedAt:
@ -3949,6 +4026,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.FieldCp:
return m.OldCp(ctx)
case sev.FieldCard:
return m.OldCard(ctx)
case sev.FieldUpdatedAt:
@ -4020,6 +4099,13 @@ func (m *SevMutation) SetField(name string, value ent.Value) error {
}
m.SetCid(v)
return nil
case sev.FieldCp:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCp(v)
return nil
case sev.FieldCard:
v, ok := value.(int)
if !ok {
@ -4058,6 +4144,9 @@ func (m *SevMutation) AddedFields() []string {
if m.addcid != nil {
fields = append(fields, sev.FieldCid)
}
if m.addcp != nil {
fields = append(fields, sev.FieldCp)
}
if m.addcard != nil {
fields = append(fields, sev.FieldCard)
}
@ -4075,6 +4164,8 @@ func (m *SevMutation) AddedField(name string) (ent.Value, bool) {
return m.AddedUID()
case sev.FieldCid:
return m.AddedCid()
case sev.FieldCp:
return m.AddedCp()
case sev.FieldCard:
return m.AddedCard()
}
@ -4107,6 +4198,13 @@ func (m *SevMutation) AddField(name string, value ent.Value) error {
}
m.AddCid(v)
return nil
case sev.FieldCp:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddCp(v)
return nil
case sev.FieldCard:
v, ok := value.(int)
if !ok {
@ -4143,6 +4241,9 @@ func (m *SevMutation) ClearedFields() []string {
if m.FieldCleared(sev.FieldCid) {
fields = append(fields, sev.FieldCid)
}
if m.FieldCleared(sev.FieldCp) {
fields = append(fields, sev.FieldCp)
}
if m.FieldCleared(sev.FieldCard) {
fields = append(fields, sev.FieldCard)
}
@ -4187,6 +4288,9 @@ func (m *SevMutation) ClearField(name string) error {
case sev.FieldCid:
m.ClearCid()
return nil
case sev.FieldCp:
m.ClearCp()
return nil
case sev.FieldCard:
m.ClearCard()
return nil
@ -4228,6 +4332,9 @@ func (m *SevMutation) ResetField(name string) error {
case sev.FieldCid:
m.ResetCid()
return nil
case sev.FieldCp:
m.ResetCp()
return nil
case sev.FieldCard:
m.ResetCard()
return nil

View File

@ -2677,6 +2677,12 @@ func (s *CreateSevReq) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Cp.Set {
e.FieldStart("cp")
s.Cp.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
@ -2702,7 +2708,7 @@ func (s *CreateSevReq) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfCreateSevReq = [12]string{
var jsonFieldsNameOfCreateSevReq = [13]string{
0: "password",
1: "token",
2: "limit",
@ -2711,10 +2717,11 @@ var jsonFieldsNameOfCreateSevReq = [12]string{
5: "did",
6: "uid",
7: "cid",
8: "card",
9: "updated_at",
10: "created_at",
11: "owner",
8: "cp",
9: "card",
10: "updated_at",
11: "created_at",
12: "owner",
}
// Decode decodes CreateSevReq from json.
@ -2808,6 +2815,16 @@ func (s *CreateSevReq) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "cp":
if err := func() error {
s.Cp.Reset()
if err := s.Cp.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"cp\"")
}
case "card":
if err := func() error {
s.Card.Reset()
@ -2839,7 +2856,7 @@ func (s *CreateSevReq) Decode(d *jx.Decoder) error {
return errors.Wrap(err, "decode field \"created_at\"")
}
case "owner":
requiredBitSet[1] |= 1 << 3
requiredBitSet[1] |= 1 << 4
if err := func() error {
v, err := d.Int()
s.Owner = int(v)
@ -2861,7 +2878,7 @@ func (s *CreateSevReq) Decode(d *jx.Decoder) error {
var failures []validate.FieldError
for i, mask := range [2]uint8{
0b00000001,
0b00001000,
0b00010000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -9171,6 +9188,12 @@ func (s *SevCreate) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Cp.Set {
e.FieldStart("cp")
s.Cp.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
@ -9191,17 +9214,18 @@ func (s *SevCreate) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfSevCreate = [10]string{
0: "id",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "card",
8: "updated_at",
9: "created_at",
var jsonFieldsNameOfSevCreate = [11]string{
0: "id",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "cp",
8: "card",
9: "updated_at",
10: "created_at",
}
// Decode decodes SevCreate from json.
@ -9285,6 +9309,16 @@ func (s *SevCreate) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "cp":
if err := func() error {
s.Cp.Reset()
if err := s.Cp.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"cp\"")
}
case "card":
if err := func() error {
s.Card.Reset()
@ -9422,6 +9456,12 @@ func (s *SevList) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Cp.Set {
e.FieldStart("cp")
s.Cp.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
@ -9442,17 +9482,18 @@ func (s *SevList) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfSevList = [10]string{
0: "id",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "card",
8: "updated_at",
9: "created_at",
var jsonFieldsNameOfSevList = [11]string{
0: "id",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "cp",
8: "card",
9: "updated_at",
10: "created_at",
}
// Decode decodes SevList from json.
@ -9536,6 +9577,16 @@ func (s *SevList) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "cp":
if err := func() error {
s.Cp.Reset()
if err := s.Cp.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"cp\"")
}
case "card":
if err := func() error {
s.Card.Reset()
@ -10593,6 +10644,12 @@ func (s *SevRead) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Cp.Set {
e.FieldStart("cp")
s.Cp.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
@ -10613,17 +10670,18 @@ func (s *SevRead) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfSevRead = [10]string{
0: "id",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "card",
8: "updated_at",
9: "created_at",
var jsonFieldsNameOfSevRead = [11]string{
0: "id",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "cp",
8: "card",
9: "updated_at",
10: "created_at",
}
// Decode decodes SevRead from json.
@ -10707,6 +10765,16 @@ func (s *SevRead) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "cp":
if err := func() error {
s.Cp.Reset()
if err := s.Cp.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"cp\"")
}
case "card":
if err := func() error {
s.Card.Reset()
@ -10844,6 +10912,12 @@ func (s *SevUpdate) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Cp.Set {
e.FieldStart("cp")
s.Cp.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
@ -10864,17 +10938,18 @@ func (s *SevUpdate) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfSevUpdate = [10]string{
0: "id",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "card",
8: "updated_at",
9: "created_at",
var jsonFieldsNameOfSevUpdate = [11]string{
0: "id",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "cp",
8: "card",
9: "updated_at",
10: "created_at",
}
// Decode decodes SevUpdate from json.
@ -10958,6 +11033,16 @@ func (s *SevUpdate) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "cp":
if err := func() error {
s.Cp.Reset()
if err := s.Cp.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"cp\"")
}
case "card":
if err := func() error {
s.Card.Reset()
@ -14127,6 +14212,12 @@ func (s *UpdateSevReq) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Cp.Set {
e.FieldStart("cp")
s.Cp.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
@ -14147,17 +14238,18 @@ func (s *UpdateSevReq) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfUpdateSevReq = [10]string{
0: "token",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "card",
8: "updated_at",
9: "owner",
var jsonFieldsNameOfUpdateSevReq = [11]string{
0: "token",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "cp",
8: "card",
9: "updated_at",
10: "owner",
}
// Decode decodes UpdateSevReq from json.
@ -14238,6 +14330,16 @@ func (s *UpdateSevReq) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "cp":
if err := func() error {
s.Cp.Reset()
if err := s.Cp.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"cp\"")
}
case "card":
if err := func() error {
s.Card.Reset()
@ -18955,6 +19057,12 @@ func (s *UserSevList) encodeFields(e *jx.Encoder) {
s.Cid.Encode(e)
}
}
{
if s.Cp.Set {
e.FieldStart("cp")
s.Cp.Encode(e)
}
}
{
if s.Card.Set {
e.FieldStart("card")
@ -18975,17 +19083,18 @@ func (s *UserSevList) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfUserSevList = [10]string{
0: "id",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "card",
8: "updated_at",
9: "created_at",
var jsonFieldsNameOfUserSevList = [11]string{
0: "id",
1: "limit",
2: "count",
3: "handle",
4: "did",
5: "uid",
6: "cid",
7: "cp",
8: "card",
9: "updated_at",
10: "created_at",
}
// Decode decodes UserSevList from json.
@ -19069,6 +19178,16 @@ func (s *UserSevList) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"cid\"")
}
case "cp":
if err := func() error {
s.Cp.Reset()
if err := s.Cp.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"cp\"")
}
case "card":
if err := func() error {
s.Card.Reset()

View File

@ -1308,6 +1308,7 @@ type CreateSevReq struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Cp OptInt `json:"cp"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
@ -1354,6 +1355,11 @@ func (s *CreateSevReq) GetCid() OptInt {
return s.Cid
}
// GetCp returns the value of Cp.
func (s *CreateSevReq) GetCp() OptInt {
return s.Cp
}
// GetCard returns the value of Card.
func (s *CreateSevReq) GetCard() OptInt {
return s.Card
@ -1414,6 +1420,11 @@ func (s *CreateSevReq) SetCid(val OptInt) {
s.Cid = val
}
// SetCp sets the value of Cp.
func (s *CreateSevReq) SetCp(val OptInt) {
s.Cp = val
}
// SetCard sets the value of Card.
func (s *CreateSevReq) SetCard(val OptInt) {
s.Card = val
@ -4617,6 +4628,7 @@ type SevCreate struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Cp OptInt `json:"cp"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
@ -4657,6 +4669,11 @@ func (s *SevCreate) GetCid() OptInt {
return s.Cid
}
// GetCp returns the value of Cp.
func (s *SevCreate) GetCp() OptInt {
return s.Cp
}
// GetCard returns the value of Card.
func (s *SevCreate) GetCard() OptInt {
return s.Card
@ -4707,6 +4724,11 @@ func (s *SevCreate) SetCid(val OptInt) {
s.Cid = val
}
// SetCp sets the value of Cp.
func (s *SevCreate) SetCp(val OptInt) {
s.Cp = val
}
// SetCard sets the value of Card.
func (s *SevCreate) SetCard(val OptInt) {
s.Card = val
@ -4733,6 +4755,7 @@ type SevList struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Cp OptInt `json:"cp"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
@ -4773,6 +4796,11 @@ func (s *SevList) GetCid() OptInt {
return s.Cid
}
// GetCp returns the value of Cp.
func (s *SevList) GetCp() OptInt {
return s.Cp
}
// GetCard returns the value of Card.
func (s *SevList) GetCard() OptInt {
return s.Card
@ -4823,6 +4851,11 @@ func (s *SevList) SetCid(val OptInt) {
s.Cid = val
}
// SetCp sets the value of Cp.
func (s *SevList) SetCp(val OptInt) {
s.Cp = val
}
// SetCard sets the value of Card.
func (s *SevList) SetCard(val OptInt) {
s.Card = val
@ -5392,6 +5425,7 @@ type SevRead struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Cp OptInt `json:"cp"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
@ -5432,6 +5466,11 @@ func (s *SevRead) GetCid() OptInt {
return s.Cid
}
// GetCp returns the value of Cp.
func (s *SevRead) GetCp() OptInt {
return s.Cp
}
// GetCard returns the value of Card.
func (s *SevRead) GetCard() OptInt {
return s.Card
@ -5482,6 +5521,11 @@ func (s *SevRead) SetCid(val OptInt) {
s.Cid = val
}
// SetCp sets the value of Cp.
func (s *SevRead) SetCp(val OptInt) {
s.Cp = val
}
// SetCard sets the value of Card.
func (s *SevRead) SetCard(val OptInt) {
s.Card = val
@ -5508,6 +5552,7 @@ type SevUpdate struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Cp OptInt `json:"cp"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
@ -5548,6 +5593,11 @@ func (s *SevUpdate) GetCid() OptInt {
return s.Cid
}
// GetCp returns the value of Cp.
func (s *SevUpdate) GetCp() OptInt {
return s.Cp
}
// GetCard returns the value of Card.
func (s *SevUpdate) GetCard() OptInt {
return s.Card
@ -5598,6 +5648,11 @@ func (s *SevUpdate) SetCid(val OptInt) {
s.Cid = val
}
// SetCp sets the value of Cp.
func (s *SevUpdate) SetCp(val OptInt) {
s.Cp = val
}
// SetCard sets the value of Card.
func (s *SevUpdate) SetCard(val OptInt) {
s.Card = val
@ -7255,6 +7310,7 @@ type UpdateSevReq struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Cp OptInt `json:"cp"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
Owner OptInt `json:"owner"`
@ -7295,6 +7351,11 @@ func (s *UpdateSevReq) GetCid() OptInt {
return s.Cid
}
// GetCp returns the value of Cp.
func (s *UpdateSevReq) GetCp() OptInt {
return s.Cp
}
// GetCard returns the value of Card.
func (s *UpdateSevReq) GetCard() OptInt {
return s.Card
@ -7345,6 +7406,11 @@ func (s *UpdateSevReq) SetCid(val OptInt) {
s.Cid = val
}
// SetCp sets the value of Cp.
func (s *UpdateSevReq) SetCp(val OptInt) {
s.Cp = val
}
// SetCard sets the value of Card.
func (s *UpdateSevReq) SetCard(val OptInt) {
s.Card = val
@ -10017,6 +10083,7 @@ type UserSevList struct {
Did OptString `json:"did"`
UID OptInt `json:"uid"`
Cid OptInt `json:"cid"`
Cp OptInt `json:"cp"`
Card OptInt `json:"card"`
UpdatedAt OptDateTime `json:"updated_at"`
CreatedAt OptDateTime `json:"created_at"`
@ -10057,6 +10124,11 @@ func (s *UserSevList) GetCid() OptInt {
return s.Cid
}
// GetCp returns the value of Cp.
func (s *UserSevList) GetCp() OptInt {
return s.Cp
}
// GetCard returns the value of Card.
func (s *UserSevList) GetCard() OptInt {
return s.Card
@ -10107,6 +10179,11 @@ func (s *UserSevList) SetCid(val OptInt) {
s.Cid = val
}
// SetCp sets the value of Cp.
func (s *UserSevList) SetCp(val OptInt) {
s.Cp = val
}
// SetCard sets the value of Card.
func (s *UserSevList) SetCard(val OptInt) {
s.Card = val

View File

@ -811,6 +811,9 @@ func (h *OgentHandler) CreateSev(ctx context.Context, req *CreateSevReq) (Create
if v, ok := req.Card.Get(); ok {
b.SetCard(v)
}
if v, ok := req.Cp.Get(); ok {
b.SetCp(v)
}
if v, ok := req.UpdatedAt.Get(); ok {
b.SetUpdatedAt(v)
}
@ -910,6 +913,9 @@ func (h *OgentHandler) UpdateSev(ctx context.Context, req *UpdateSevReq, params
if v, ok := req.Card.Get(); ok {
b.SetCard(v)
}
if v, ok := req.Cp.Get(); ok {
b.SetCp(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.Cp = NewOptInt(e.Cp)
ret.Card = NewOptInt(e.Card)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
@ -685,6 +686,7 @@ func NewSevList(e *ent.Sev) *SevList {
ret.Did = NewOptString(e.Did)
ret.UID = NewOptInt(e.UID)
ret.Cid = NewOptInt(e.Cid)
ret.Cp = NewOptInt(e.Cp)
ret.Card = NewOptInt(e.Card)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
@ -721,6 +723,7 @@ func NewSevRead(e *ent.Sev) *SevRead {
ret.Did = NewOptString(e.Did)
ret.UID = NewOptInt(e.UID)
ret.Cid = NewOptInt(e.Cid)
ret.Cp = NewOptInt(e.Cp)
ret.Card = NewOptInt(e.Card)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
@ -757,6 +760,7 @@ func NewSevUpdate(e *ent.Sev) *SevUpdate {
ret.Did = NewOptString(e.Did)
ret.UID = NewOptInt(e.UID)
ret.Cid = NewOptInt(e.Cid)
ret.Cp = NewOptInt(e.Cp)
ret.Card = NewOptInt(e.Card)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
@ -1493,6 +1497,7 @@ func NewUserSevList(e *ent.Sev) *UserSevList {
ret.Did = NewOptString(e.Did)
ret.UID = NewOptInt(e.UID)
ret.Cid = NewOptInt(e.Cid)
ret.Cp = NewOptInt(e.Cp)
ret.Card = NewOptInt(e.Card)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)

View File

@ -1172,6 +1172,9 @@
"cid": {
"type": "integer"
},
"cp": {
"type": "integer"
},
"card": {
"type": "integer"
},
@ -1345,6 +1348,9 @@
"cid": {
"type": "integer"
},
"cp": {
"type": "integer"
},
"card": {
"type": "integer"
},
@ -3776,6 +3782,9 @@
"cid": {
"type": "integer"
},
"cp": {
"type": "integer"
},
"card": {
"type": "integer"
},
@ -3821,6 +3830,9 @@
"cid": {
"type": "integer"
},
"cp": {
"type": "integer"
},
"card": {
"type": "integer"
},
@ -3861,6 +3873,9 @@
"cid": {
"type": "integer"
},
"cp": {
"type": "integer"
},
"card": {
"type": "integer"
},
@ -3901,6 +3916,9 @@
"cid": {
"type": "integer"
},
"cp": {
"type": "integer"
},
"card": {
"type": "integer"
},
@ -3941,6 +3959,9 @@
"cid": {
"type": "integer"
},
"cp": {
"type": "integer"
},
"card": {
"type": "integer"
},
@ -5585,6 +5606,9 @@
"cid": {
"type": "integer"
},
"cp": {
"type": "integer"
},
"card": {
"type": "integer"
},

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[10].Descriptor()
sevDescCreatedAt := sevFields[11].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("cp").
Optional(),
field.Int("card").
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"`
// Cp holds the value of the "cp" field.
Cp int `json:"cp,omitempty"`
// Card holds the value of the "card" field.
Card int `json:"card,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
@ -76,7 +78,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, sev.FieldCard:
case sev.FieldID, sev.FieldCount, sev.FieldUID, sev.FieldCid, sev.FieldCp, sev.FieldCard:
values[i] = new(sql.NullInt64)
case sev.FieldPassword, sev.FieldToken, sev.FieldHandle, sev.FieldDid:
values[i] = new(sql.NullString)
@ -153,6 +155,12 @@ func (s *Sev) assignValues(columns []string, values []any) error {
} else if value.Valid {
s.Cid = int(value.Int64)
}
case sev.FieldCp:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field cp", values[i])
} else if value.Valid {
s.Cp = 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])
@ -241,6 +249,9 @@ func (s *Sev) String() string {
builder.WriteString("cid=")
builder.WriteString(fmt.Sprintf("%v", s.Cid))
builder.WriteString(", ")
builder.WriteString("cp=")
builder.WriteString(fmt.Sprintf("%v", s.Cp))
builder.WriteString(", ")
builder.WriteString("card=")
builder.WriteString(fmt.Sprintf("%v", s.Card))
builder.WriteString(", ")

View File

@ -30,6 +30,8 @@ const (
FieldUID = "uid"
// FieldCid holds the string denoting the cid field in the database.
FieldCid = "cid"
// FieldCp holds the string denoting the cp field in the database.
FieldCp = "cp"
// 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.
@ -60,6 +62,7 @@ var Columns = []string{
FieldDid,
FieldUID,
FieldCid,
FieldCp,
FieldCard,
FieldUpdatedAt,
FieldCreatedAt,
@ -143,6 +146,11 @@ func ByCid(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCid, opts...).ToFunc()
}
// ByCp orders the results by the cp field.
func ByCp(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCp, opts...).ToFunc()
}
// ByCard orders the results by the card field.
func ByCard(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCard, opts...).ToFunc()

View File

@ -95,6 +95,11 @@ func Cid(v int) predicate.Sev {
return predicate.Sev(sql.FieldEQ(FieldCid, v))
}
// Cp applies equality check predicate on the "cp" field. It's identical to CpEQ.
func Cp(v int) predicate.Sev {
return predicate.Sev(sql.FieldEQ(FieldCp, 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))
@ -570,6 +575,56 @@ func CidNotNil() predicate.Sev {
return predicate.Sev(sql.FieldNotNull(FieldCid))
}
// CpEQ applies the EQ predicate on the "cp" field.
func CpEQ(v int) predicate.Sev {
return predicate.Sev(sql.FieldEQ(FieldCp, v))
}
// CpNEQ applies the NEQ predicate on the "cp" field.
func CpNEQ(v int) predicate.Sev {
return predicate.Sev(sql.FieldNEQ(FieldCp, v))
}
// CpIn applies the In predicate on the "cp" field.
func CpIn(vs ...int) predicate.Sev {
return predicate.Sev(sql.FieldIn(FieldCp, vs...))
}
// CpNotIn applies the NotIn predicate on the "cp" field.
func CpNotIn(vs ...int) predicate.Sev {
return predicate.Sev(sql.FieldNotIn(FieldCp, vs...))
}
// CpGT applies the GT predicate on the "cp" field.
func CpGT(v int) predicate.Sev {
return predicate.Sev(sql.FieldGT(FieldCp, v))
}
// CpGTE applies the GTE predicate on the "cp" field.
func CpGTE(v int) predicate.Sev {
return predicate.Sev(sql.FieldGTE(FieldCp, v))
}
// CpLT applies the LT predicate on the "cp" field.
func CpLT(v int) predicate.Sev {
return predicate.Sev(sql.FieldLT(FieldCp, v))
}
// CpLTE applies the LTE predicate on the "cp" field.
func CpLTE(v int) predicate.Sev {
return predicate.Sev(sql.FieldLTE(FieldCp, v))
}
// CpIsNil applies the IsNil predicate on the "cp" field.
func CpIsNil() predicate.Sev {
return predicate.Sev(sql.FieldIsNull(FieldCp))
}
// CpNotNil applies the NotNil predicate on the "cp" field.
func CpNotNil() predicate.Sev {
return predicate.Sev(sql.FieldNotNull(FieldCp))
}
// CardEQ applies the EQ predicate on the "card" field.
func CardEQ(v int) predicate.Sev {
return predicate.Sev(sql.FieldEQ(FieldCard, v))

View File

@ -125,6 +125,20 @@ func (sc *SevCreate) SetNillableCid(i *int) *SevCreate {
return sc
}
// SetCp sets the "cp" field.
func (sc *SevCreate) SetCp(i int) *SevCreate {
sc.mutation.SetCp(i)
return sc
}
// SetNillableCp sets the "cp" field if the given value is not nil.
func (sc *SevCreate) SetNillableCp(i *int) *SevCreate {
if i != nil {
sc.SetCp(*i)
}
return sc
}
// SetCard sets the "card" field.
func (sc *SevCreate) SetCard(i int) *SevCreate {
sc.mutation.SetCard(i)
@ -294,6 +308,10 @@ func (sc *SevCreate) createSpec() (*Sev, *sqlgraph.CreateSpec) {
_spec.SetField(sev.FieldCid, field.TypeInt, value)
_node.Cid = value
}
if value, ok := sc.mutation.Cp(); ok {
_spec.SetField(sev.FieldCp, field.TypeInt, value)
_node.Cp = value
}
if value, ok := sc.mutation.Card(); ok {
_spec.SetField(sev.FieldCard, field.TypeInt, value)
_node.Card = value

View File

@ -190,6 +190,33 @@ func (su *SevUpdate) ClearCid() *SevUpdate {
return su
}
// SetCp sets the "cp" field.
func (su *SevUpdate) SetCp(i int) *SevUpdate {
su.mutation.ResetCp()
su.mutation.SetCp(i)
return su
}
// SetNillableCp sets the "cp" field if the given value is not nil.
func (su *SevUpdate) SetNillableCp(i *int) *SevUpdate {
if i != nil {
su.SetCp(*i)
}
return su
}
// AddCp adds i to the "cp" field.
func (su *SevUpdate) AddCp(i int) *SevUpdate {
su.mutation.AddCp(i)
return su
}
// ClearCp clears the value of the "cp" field.
func (su *SevUpdate) ClearCp() *SevUpdate {
su.mutation.ClearCp()
return su
}
// SetCard sets the "card" field.
func (su *SevUpdate) SetCard(i int) *SevUpdate {
su.mutation.ResetCard()
@ -357,6 +384,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.Cp(); ok {
_spec.SetField(sev.FieldCp, field.TypeInt, value)
}
if value, ok := su.mutation.AddedCp(); ok {
_spec.AddField(sev.FieldCp, field.TypeInt, value)
}
if su.mutation.CpCleared() {
_spec.ClearField(sev.FieldCp, field.TypeInt)
}
if value, ok := su.mutation.Card(); ok {
_spec.SetField(sev.FieldCard, field.TypeInt, value)
}
@ -585,6 +621,33 @@ func (suo *SevUpdateOne) ClearCid() *SevUpdateOne {
return suo
}
// SetCp sets the "cp" field.
func (suo *SevUpdateOne) SetCp(i int) *SevUpdateOne {
suo.mutation.ResetCp()
suo.mutation.SetCp(i)
return suo
}
// SetNillableCp sets the "cp" field if the given value is not nil.
func (suo *SevUpdateOne) SetNillableCp(i *int) *SevUpdateOne {
if i != nil {
suo.SetCp(*i)
}
return suo
}
// AddCp adds i to the "cp" field.
func (suo *SevUpdateOne) AddCp(i int) *SevUpdateOne {
suo.mutation.AddCp(i)
return suo
}
// ClearCp clears the value of the "cp" field.
func (suo *SevUpdateOne) ClearCp() *SevUpdateOne {
suo.mutation.ClearCp()
return suo
}
// SetCard sets the "card" field.
func (suo *SevUpdateOne) SetCard(i int) *SevUpdateOne {
suo.mutation.ResetCard()
@ -782,6 +845,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.Cp(); ok {
_spec.SetField(sev.FieldCp, field.TypeInt, value)
}
if value, ok := suo.mutation.AddedCp(); ok {
_spec.AddField(sev.FieldCp, field.TypeInt, value)
}
if suo.mutation.CpCleared() {
_spec.ClearField(sev.FieldCp, field.TypeInt)
}
if value, ok := suo.mutation.Card(); ok {
_spec.SetField(sev.FieldCard, field.TypeInt, value)
}

View File

@ -811,6 +811,9 @@ func (h *OgentHandler) CreateSev(ctx context.Context, req *CreateSevReq) (Create
if v, ok := req.Card.Get(); ok {
b.SetCard(v)
}
if v, ok := req.Cp.Get(); ok {
b.SetCp(v)
}
if v, ok := req.UpdatedAt.Get(); ok {
b.SetUpdatedAt(v)
}
@ -910,6 +913,9 @@ func (h *OgentHandler) UpdateSev(ctx context.Context, req *UpdateSevReq, params
if v, ok := req.Card.Get(); ok {
b.SetCard(v)
}
if v, ok := req.Cp.Get(); ok {
b.SetCp(v)
}
if v, ok := req.UpdatedAt.Get(); ok {
b.SetUpdatedAt(v)
}