1
0

test count

This commit is contained in:
syui 2023-08-21 22:13:44 +09:00
parent bdab76bb35
commit 1124b851aa
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
19 changed files with 1049 additions and 59 deletions

View File

@ -2,7 +2,7 @@
d=${0:a:h}
cd $d
su=4000
su=5000
go generate ./...
sed -i '' "s/255/$su/g" $d/ent/ogent/oas_parameters_gen.go

View File

@ -31,6 +31,10 @@ type Card struct {
Cp int `json:"cp,omitempty"`
// URL holds the value of the "url" field.
URL string `json:"url,omitempty"`
// Count holds the value of the "count" field.
Count int `json:"count,omitempty"`
// Author holds the value of the "author" field.
Author string `json:"author,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
@ -66,9 +70,9 @@ func (*Card) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case card.FieldID, card.FieldCard, card.FieldCp:
case card.FieldID, card.FieldCard, card.FieldCp, card.FieldCount:
values[i] = new(sql.NullInt64)
case card.FieldPassword, card.FieldSkill, card.FieldStatus, card.FieldToken, card.FieldURL:
case card.FieldPassword, card.FieldSkill, card.FieldStatus, card.FieldToken, card.FieldURL, card.FieldAuthor:
values[i] = new(sql.NullString)
case card.FieldCreatedAt:
values[i] = new(sql.NullTime)
@ -137,6 +141,18 @@ func (c *Card) assignValues(columns []string, values []any) error {
} else if value.Valid {
c.URL = value.String
}
case card.FieldCount:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field count", values[i])
} else if value.Valid {
c.Count = int(value.Int64)
}
case card.FieldAuthor:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field author", values[i])
} else if value.Valid {
c.Author = value.String
}
case card.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
@ -202,6 +218,12 @@ func (c *Card) String() string {
builder.WriteString("url=")
builder.WriteString(c.URL)
builder.WriteString(", ")
builder.WriteString("count=")
builder.WriteString(fmt.Sprintf("%v", c.Count))
builder.WriteString(", ")
builder.WriteString("author=")
builder.WriteString(c.Author)
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(c.CreatedAt.Format(time.ANSIC))
builder.WriteByte(')')

View File

@ -25,6 +25,10 @@ const (
FieldCp = "cp"
// FieldURL holds the string denoting the url field in the database.
FieldURL = "url"
// FieldCount holds the string denoting the count field in the database.
FieldCount = "count"
// FieldAuthor holds the string denoting the author field in the database.
FieldAuthor = "author"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// EdgeOwner holds the string denoting the owner edge name in mutations.
@ -50,6 +54,8 @@ var Columns = []string{
FieldToken,
FieldCp,
FieldURL,
FieldCount,
FieldAuthor,
FieldCreatedAt,
}

View File

@ -90,6 +90,16 @@ func URL(v string) predicate.Card {
return predicate.Card(sql.FieldEQ(FieldURL, v))
}
// Count applies equality check predicate on the "count" field. It's identical to CountEQ.
func Count(v int) predicate.Card {
return predicate.Card(sql.FieldEQ(FieldCount, v))
}
// Author applies equality check predicate on the "author" field. It's identical to AuthorEQ.
func Author(v string) predicate.Card {
return predicate.Card(sql.FieldEQ(FieldAuthor, v))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.Card {
return predicate.Card(sql.FieldEQ(FieldCreatedAt, v))
@ -560,6 +570,131 @@ func URLContainsFold(v string) predicate.Card {
return predicate.Card(sql.FieldContainsFold(FieldURL, v))
}
// CountEQ applies the EQ predicate on the "count" field.
func CountEQ(v int) predicate.Card {
return predicate.Card(sql.FieldEQ(FieldCount, v))
}
// CountNEQ applies the NEQ predicate on the "count" field.
func CountNEQ(v int) predicate.Card {
return predicate.Card(sql.FieldNEQ(FieldCount, v))
}
// CountIn applies the In predicate on the "count" field.
func CountIn(vs ...int) predicate.Card {
return predicate.Card(sql.FieldIn(FieldCount, vs...))
}
// CountNotIn applies the NotIn predicate on the "count" field.
func CountNotIn(vs ...int) predicate.Card {
return predicate.Card(sql.FieldNotIn(FieldCount, vs...))
}
// CountGT applies the GT predicate on the "count" field.
func CountGT(v int) predicate.Card {
return predicate.Card(sql.FieldGT(FieldCount, v))
}
// CountGTE applies the GTE predicate on the "count" field.
func CountGTE(v int) predicate.Card {
return predicate.Card(sql.FieldGTE(FieldCount, v))
}
// CountLT applies the LT predicate on the "count" field.
func CountLT(v int) predicate.Card {
return predicate.Card(sql.FieldLT(FieldCount, v))
}
// CountLTE applies the LTE predicate on the "count" field.
func CountLTE(v int) predicate.Card {
return predicate.Card(sql.FieldLTE(FieldCount, v))
}
// CountIsNil applies the IsNil predicate on the "count" field.
func CountIsNil() predicate.Card {
return predicate.Card(sql.FieldIsNull(FieldCount))
}
// CountNotNil applies the NotNil predicate on the "count" field.
func CountNotNil() predicate.Card {
return predicate.Card(sql.FieldNotNull(FieldCount))
}
// AuthorEQ applies the EQ predicate on the "author" field.
func AuthorEQ(v string) predicate.Card {
return predicate.Card(sql.FieldEQ(FieldAuthor, v))
}
// AuthorNEQ applies the NEQ predicate on the "author" field.
func AuthorNEQ(v string) predicate.Card {
return predicate.Card(sql.FieldNEQ(FieldAuthor, v))
}
// AuthorIn applies the In predicate on the "author" field.
func AuthorIn(vs ...string) predicate.Card {
return predicate.Card(sql.FieldIn(FieldAuthor, vs...))
}
// AuthorNotIn applies the NotIn predicate on the "author" field.
func AuthorNotIn(vs ...string) predicate.Card {
return predicate.Card(sql.FieldNotIn(FieldAuthor, vs...))
}
// AuthorGT applies the GT predicate on the "author" field.
func AuthorGT(v string) predicate.Card {
return predicate.Card(sql.FieldGT(FieldAuthor, v))
}
// AuthorGTE applies the GTE predicate on the "author" field.
func AuthorGTE(v string) predicate.Card {
return predicate.Card(sql.FieldGTE(FieldAuthor, v))
}
// AuthorLT applies the LT predicate on the "author" field.
func AuthorLT(v string) predicate.Card {
return predicate.Card(sql.FieldLT(FieldAuthor, v))
}
// AuthorLTE applies the LTE predicate on the "author" field.
func AuthorLTE(v string) predicate.Card {
return predicate.Card(sql.FieldLTE(FieldAuthor, v))
}
// AuthorContains applies the Contains predicate on the "author" field.
func AuthorContains(v string) predicate.Card {
return predicate.Card(sql.FieldContains(FieldAuthor, v))
}
// AuthorHasPrefix applies the HasPrefix predicate on the "author" field.
func AuthorHasPrefix(v string) predicate.Card {
return predicate.Card(sql.FieldHasPrefix(FieldAuthor, v))
}
// AuthorHasSuffix applies the HasSuffix predicate on the "author" field.
func AuthorHasSuffix(v string) predicate.Card {
return predicate.Card(sql.FieldHasSuffix(FieldAuthor, v))
}
// AuthorIsNil applies the IsNil predicate on the "author" field.
func AuthorIsNil() predicate.Card {
return predicate.Card(sql.FieldIsNull(FieldAuthor))
}
// AuthorNotNil applies the NotNil predicate on the "author" field.
func AuthorNotNil() predicate.Card {
return predicate.Card(sql.FieldNotNull(FieldAuthor))
}
// AuthorEqualFold applies the EqualFold predicate on the "author" field.
func AuthorEqualFold(v string) predicate.Card {
return predicate.Card(sql.FieldEqualFold(FieldAuthor, v))
}
// AuthorContainsFold applies the ContainsFold predicate on the "author" field.
func AuthorContainsFold(v string) predicate.Card {
return predicate.Card(sql.FieldContainsFold(FieldAuthor, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.Card {
return predicate.Card(sql.FieldEQ(FieldCreatedAt, v))

View File

@ -111,6 +111,34 @@ func (cc *CardCreate) SetNillableURL(s *string) *CardCreate {
return cc
}
// SetCount sets the "count" field.
func (cc *CardCreate) SetCount(i int) *CardCreate {
cc.mutation.SetCount(i)
return cc
}
// SetNillableCount sets the "count" field if the given value is not nil.
func (cc *CardCreate) SetNillableCount(i *int) *CardCreate {
if i != nil {
cc.SetCount(*i)
}
return cc
}
// SetAuthor sets the "author" field.
func (cc *CardCreate) SetAuthor(s string) *CardCreate {
cc.mutation.SetAuthor(s)
return cc
}
// SetNillableAuthor sets the "author" field if the given value is not nil.
func (cc *CardCreate) SetNillableAuthor(s *string) *CardCreate {
if s != nil {
cc.SetAuthor(*s)
}
return cc
}
// SetCreatedAt sets the "created_at" field.
func (cc *CardCreate) SetCreatedAt(t time.Time) *CardCreate {
cc.mutation.SetCreatedAt(t)
@ -264,6 +292,14 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) {
_spec.SetField(card.FieldURL, field.TypeString, value)
_node.URL = value
}
if value, ok := cc.mutation.Count(); ok {
_spec.SetField(card.FieldCount, field.TypeInt, value)
_node.Count = value
}
if value, ok := cc.mutation.Author(); ok {
_spec.SetField(card.FieldAuthor, field.TypeString, value)
_node.Author = value
}
if value, ok := cc.mutation.CreatedAt(); ok {
_spec.SetField(card.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value

View File

@ -162,6 +162,53 @@ func (cu *CardUpdate) ClearURL() *CardUpdate {
return cu
}
// SetCount sets the "count" field.
func (cu *CardUpdate) SetCount(i int) *CardUpdate {
cu.mutation.ResetCount()
cu.mutation.SetCount(i)
return cu
}
// SetNillableCount sets the "count" field if the given value is not nil.
func (cu *CardUpdate) SetNillableCount(i *int) *CardUpdate {
if i != nil {
cu.SetCount(*i)
}
return cu
}
// AddCount adds i to the "count" field.
func (cu *CardUpdate) AddCount(i int) *CardUpdate {
cu.mutation.AddCount(i)
return cu
}
// ClearCount clears the value of the "count" field.
func (cu *CardUpdate) ClearCount() *CardUpdate {
cu.mutation.ClearCount()
return cu
}
// SetAuthor sets the "author" field.
func (cu *CardUpdate) SetAuthor(s string) *CardUpdate {
cu.mutation.SetAuthor(s)
return cu
}
// SetNillableAuthor sets the "author" field if the given value is not nil.
func (cu *CardUpdate) SetNillableAuthor(s *string) *CardUpdate {
if s != nil {
cu.SetAuthor(*s)
}
return cu
}
// ClearAuthor clears the value of the "author" field.
func (cu *CardUpdate) ClearAuthor() *CardUpdate {
cu.mutation.ClearAuthor()
return cu
}
// SetOwnerID sets the "owner" edge to the User entity by ID.
func (cu *CardUpdate) SetOwnerID(id int) *CardUpdate {
cu.mutation.SetOwnerID(id)
@ -273,6 +320,21 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) {
if cu.mutation.URLCleared() {
_spec.ClearField(card.FieldURL, field.TypeString)
}
if value, ok := cu.mutation.Count(); ok {
_spec.SetField(card.FieldCount, field.TypeInt, value)
}
if value, ok := cu.mutation.AddedCount(); ok {
_spec.AddField(card.FieldCount, field.TypeInt, value)
}
if cu.mutation.CountCleared() {
_spec.ClearField(card.FieldCount, field.TypeInt)
}
if value, ok := cu.mutation.Author(); ok {
_spec.SetField(card.FieldAuthor, field.TypeString, value)
}
if cu.mutation.AuthorCleared() {
_spec.ClearField(card.FieldAuthor, field.TypeString)
}
if cu.mutation.CreatedAtCleared() {
_spec.ClearField(card.FieldCreatedAt, field.TypeTime)
}
@ -459,6 +521,53 @@ func (cuo *CardUpdateOne) ClearURL() *CardUpdateOne {
return cuo
}
// SetCount sets the "count" field.
func (cuo *CardUpdateOne) SetCount(i int) *CardUpdateOne {
cuo.mutation.ResetCount()
cuo.mutation.SetCount(i)
return cuo
}
// SetNillableCount sets the "count" field if the given value is not nil.
func (cuo *CardUpdateOne) SetNillableCount(i *int) *CardUpdateOne {
if i != nil {
cuo.SetCount(*i)
}
return cuo
}
// AddCount adds i to the "count" field.
func (cuo *CardUpdateOne) AddCount(i int) *CardUpdateOne {
cuo.mutation.AddCount(i)
return cuo
}
// ClearCount clears the value of the "count" field.
func (cuo *CardUpdateOne) ClearCount() *CardUpdateOne {
cuo.mutation.ClearCount()
return cuo
}
// SetAuthor sets the "author" field.
func (cuo *CardUpdateOne) SetAuthor(s string) *CardUpdateOne {
cuo.mutation.SetAuthor(s)
return cuo
}
// SetNillableAuthor sets the "author" field if the given value is not nil.
func (cuo *CardUpdateOne) SetNillableAuthor(s *string) *CardUpdateOne {
if s != nil {
cuo.SetAuthor(*s)
}
return cuo
}
// ClearAuthor clears the value of the "author" field.
func (cuo *CardUpdateOne) ClearAuthor() *CardUpdateOne {
cuo.mutation.ClearAuthor()
return cuo
}
// SetOwnerID sets the "owner" edge to the User entity by ID.
func (cuo *CardUpdateOne) SetOwnerID(id int) *CardUpdateOne {
cuo.mutation.SetOwnerID(id)
@ -600,6 +709,21 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error)
if cuo.mutation.URLCleared() {
_spec.ClearField(card.FieldURL, field.TypeString)
}
if value, ok := cuo.mutation.Count(); ok {
_spec.SetField(card.FieldCount, field.TypeInt, value)
}
if value, ok := cuo.mutation.AddedCount(); ok {
_spec.AddField(card.FieldCount, field.TypeInt, value)
}
if cuo.mutation.CountCleared() {
_spec.ClearField(card.FieldCount, field.TypeInt)
}
if value, ok := cuo.mutation.Author(); ok {
_spec.SetField(card.FieldAuthor, field.TypeString, value)
}
if cuo.mutation.AuthorCleared() {
_spec.ClearField(card.FieldAuthor, field.TypeString)
}
if cuo.mutation.CreatedAtCleared() {
_spec.ClearField(card.FieldCreatedAt, field.TypeTime)
}

View File

@ -18,6 +18,8 @@ var (
{Name: "token", Type: field.TypeString, Nullable: true},
{Name: "cp", Type: field.TypeInt, Nullable: true},
{Name: "url", Type: field.TypeString, Nullable: true, Default: "https://card.syui.ai"},
{Name: "count", Type: field.TypeInt, Nullable: true},
{Name: "author", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeTime, Nullable: true},
{Name: "user_card", Type: field.TypeInt},
}
@ -29,7 +31,7 @@ var (
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "cards_users_card",
Columns: []*schema.Column{CardsColumns[9]},
Columns: []*schema.Column{CardsColumns[11]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
@ -88,7 +90,7 @@ var (
{Name: "ten_post", Type: field.TypeString, Nullable: true},
{Name: "ten_get", Type: field.TypeString, Nullable: true},
{Name: "ten_at", Type: field.TypeTime, Nullable: true},
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20230812"},
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20230821"},
{Name: "group_users", Type: field.TypeInt, Nullable: true},
}
// UsersTable holds the schema information for the "users" table.

View File

@ -46,6 +46,9 @@ type CardMutation struct {
cp *int
addcp *int
url *string
count *int
addcount *int
author *string
created_at *time.Time
clearedFields map[string]struct{}
owner *int
@ -525,6 +528,125 @@ func (m *CardMutation) ResetURL() {
delete(m.clearedFields, card.FieldURL)
}
// SetCount sets the "count" field.
func (m *CardMutation) SetCount(i int) {
m.count = &i
m.addcount = nil
}
// Count returns the value of the "count" field in the mutation.
func (m *CardMutation) Count() (r int, exists bool) {
v := m.count
if v == nil {
return
}
return *v, true
}
// OldCount returns the old "count" field's value of the Card entity.
// If the Card 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 *CardMutation) OldCount(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCount is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCount requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCount: %w", err)
}
return oldValue.Count, nil
}
// AddCount adds i to the "count" field.
func (m *CardMutation) AddCount(i int) {
if m.addcount != nil {
*m.addcount += i
} else {
m.addcount = &i
}
}
// AddedCount returns the value that was added to the "count" field in this mutation.
func (m *CardMutation) AddedCount() (r int, exists bool) {
v := m.addcount
if v == nil {
return
}
return *v, true
}
// ClearCount clears the value of the "count" field.
func (m *CardMutation) ClearCount() {
m.count = nil
m.addcount = nil
m.clearedFields[card.FieldCount] = struct{}{}
}
// CountCleared returns if the "count" field was cleared in this mutation.
func (m *CardMutation) CountCleared() bool {
_, ok := m.clearedFields[card.FieldCount]
return ok
}
// ResetCount resets all changes to the "count" field.
func (m *CardMutation) ResetCount() {
m.count = nil
m.addcount = nil
delete(m.clearedFields, card.FieldCount)
}
// SetAuthor sets the "author" field.
func (m *CardMutation) SetAuthor(s string) {
m.author = &s
}
// Author returns the value of the "author" field in the mutation.
func (m *CardMutation) Author() (r string, exists bool) {
v := m.author
if v == nil {
return
}
return *v, true
}
// OldAuthor returns the old "author" field's value of the Card entity.
// If the Card 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 *CardMutation) OldAuthor(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldAuthor is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldAuthor requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldAuthor: %w", err)
}
return oldValue.Author, nil
}
// ClearAuthor clears the value of the "author" field.
func (m *CardMutation) ClearAuthor() {
m.author = nil
m.clearedFields[card.FieldAuthor] = struct{}{}
}
// AuthorCleared returns if the "author" field was cleared in this mutation.
func (m *CardMutation) AuthorCleared() bool {
_, ok := m.clearedFields[card.FieldAuthor]
return ok
}
// ResetAuthor resets all changes to the "author" field.
func (m *CardMutation) ResetAuthor() {
m.author = nil
delete(m.clearedFields, card.FieldAuthor)
}
// SetCreatedAt sets the "created_at" field.
func (m *CardMutation) SetCreatedAt(t time.Time) {
m.created_at = &t
@ -647,7 +769,7 @@ func (m *CardMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *CardMutation) Fields() []string {
fields := make([]string, 0, 8)
fields := make([]string, 0, 10)
if m.password != nil {
fields = append(fields, card.FieldPassword)
}
@ -669,6 +791,12 @@ func (m *CardMutation) Fields() []string {
if m.url != nil {
fields = append(fields, card.FieldURL)
}
if m.count != nil {
fields = append(fields, card.FieldCount)
}
if m.author != nil {
fields = append(fields, card.FieldAuthor)
}
if m.created_at != nil {
fields = append(fields, card.FieldCreatedAt)
}
@ -694,6 +822,10 @@ func (m *CardMutation) Field(name string) (ent.Value, bool) {
return m.Cp()
case card.FieldURL:
return m.URL()
case card.FieldCount:
return m.Count()
case card.FieldAuthor:
return m.Author()
case card.FieldCreatedAt:
return m.CreatedAt()
}
@ -719,6 +851,10 @@ func (m *CardMutation) OldField(ctx context.Context, name string) (ent.Value, er
return m.OldCp(ctx)
case card.FieldURL:
return m.OldURL(ctx)
case card.FieldCount:
return m.OldCount(ctx)
case card.FieldAuthor:
return m.OldAuthor(ctx)
case card.FieldCreatedAt:
return m.OldCreatedAt(ctx)
}
@ -779,6 +915,20 @@ func (m *CardMutation) SetField(name string, value ent.Value) error {
}
m.SetURL(v)
return nil
case card.FieldCount:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCount(v)
return nil
case card.FieldAuthor:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetAuthor(v)
return nil
case card.FieldCreatedAt:
v, ok := value.(time.Time)
if !ok {
@ -800,6 +950,9 @@ func (m *CardMutation) AddedFields() []string {
if m.addcp != nil {
fields = append(fields, card.FieldCp)
}
if m.addcount != nil {
fields = append(fields, card.FieldCount)
}
return fields
}
@ -812,6 +965,8 @@ func (m *CardMutation) AddedField(name string) (ent.Value, bool) {
return m.AddedCard()
case card.FieldCp:
return m.AddedCp()
case card.FieldCount:
return m.AddedCount()
}
return nil, false
}
@ -835,6 +990,13 @@ func (m *CardMutation) AddField(name string, value ent.Value) error {
}
m.AddCp(v)
return nil
case card.FieldCount:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddCount(v)
return nil
}
return fmt.Errorf("unknown Card numeric field %s", name)
}
@ -861,6 +1023,12 @@ func (m *CardMutation) ClearedFields() []string {
if m.FieldCleared(card.FieldURL) {
fields = append(fields, card.FieldURL)
}
if m.FieldCleared(card.FieldCount) {
fields = append(fields, card.FieldCount)
}
if m.FieldCleared(card.FieldAuthor) {
fields = append(fields, card.FieldAuthor)
}
if m.FieldCleared(card.FieldCreatedAt) {
fields = append(fields, card.FieldCreatedAt)
}
@ -896,6 +1064,12 @@ func (m *CardMutation) ClearField(name string) error {
case card.FieldURL:
m.ClearURL()
return nil
case card.FieldCount:
m.ClearCount()
return nil
case card.FieldAuthor:
m.ClearAuthor()
return nil
case card.FieldCreatedAt:
m.ClearCreatedAt()
return nil
@ -928,6 +1102,12 @@ func (m *CardMutation) ResetField(name string) error {
case card.FieldURL:
m.ResetURL()
return nil
case card.FieldCount:
m.ResetCount()
return nil
case card.FieldAuthor:
m.ResetAuthor()
return nil
case card.FieldCreatedAt:
m.ResetCreatedAt()
return nil

View File

@ -58,6 +58,18 @@ func (s *CardCreate) encodeFields(e *jx.Encoder) {
s.URL.Encode(e)
}
}
{
if s.Count.Set {
e.FieldStart("count")
s.Count.Encode(e)
}
}
{
if s.Author.Set {
e.FieldStart("author")
s.Author.Encode(e)
}
}
{
if s.CreatedAt.Set {
e.FieldStart("created_at")
@ -66,14 +78,16 @@ func (s *CardCreate) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfCardCreate = [7]string{
var jsonFieldsNameOfCardCreate = [9]string{
0: "id",
1: "card",
2: "skill",
3: "status",
4: "cp",
5: "url",
6: "created_at",
6: "count",
7: "author",
8: "created_at",
}
// Decode decodes CardCreate from json.
@ -81,7 +95,7 @@ func (s *CardCreate) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode CardCreate to nil")
}
var requiredBitSet [1]uint8
var requiredBitSet [2]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -147,6 +161,26 @@ func (s *CardCreate) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"url\"")
}
case "count":
if err := func() error {
s.Count.Reset()
if err := s.Count.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"count\"")
}
case "author":
if err := func() error {
s.Author.Reset()
if err := s.Author.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"author\"")
}
case "created_at":
if err := func() error {
s.CreatedAt.Reset()
@ -166,8 +200,9 @@ func (s *CardCreate) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [1]uint8{
for i, mask := range [2]uint8{
0b00000001,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -257,6 +292,18 @@ func (s *CardList) encodeFields(e *jx.Encoder) {
s.URL.Encode(e)
}
}
{
if s.Count.Set {
e.FieldStart("count")
s.Count.Encode(e)
}
}
{
if s.Author.Set {
e.FieldStart("author")
s.Author.Encode(e)
}
}
{
if s.CreatedAt.Set {
e.FieldStart("created_at")
@ -265,14 +312,16 @@ func (s *CardList) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfCardList = [7]string{
var jsonFieldsNameOfCardList = [9]string{
0: "id",
1: "card",
2: "skill",
3: "status",
4: "cp",
5: "url",
6: "created_at",
6: "count",
7: "author",
8: "created_at",
}
// Decode decodes CardList from json.
@ -280,7 +329,7 @@ func (s *CardList) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode CardList to nil")
}
var requiredBitSet [1]uint8
var requiredBitSet [2]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -346,6 +395,26 @@ func (s *CardList) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"url\"")
}
case "count":
if err := func() error {
s.Count.Reset()
if err := s.Count.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"count\"")
}
case "author":
if err := func() error {
s.Author.Reset()
if err := s.Author.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"author\"")
}
case "created_at":
if err := func() error {
s.CreatedAt.Reset()
@ -365,8 +434,9 @@ func (s *CardList) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [1]uint8{
for i, mask := range [2]uint8{
0b00000001,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -1067,6 +1137,18 @@ func (s *CardRead) encodeFields(e *jx.Encoder) {
s.URL.Encode(e)
}
}
{
if s.Count.Set {
e.FieldStart("count")
s.Count.Encode(e)
}
}
{
if s.Author.Set {
e.FieldStart("author")
s.Author.Encode(e)
}
}
{
if s.CreatedAt.Set {
e.FieldStart("created_at")
@ -1075,14 +1157,16 @@ func (s *CardRead) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfCardRead = [7]string{
var jsonFieldsNameOfCardRead = [9]string{
0: "id",
1: "card",
2: "skill",
3: "status",
4: "cp",
5: "url",
6: "created_at",
6: "count",
7: "author",
8: "created_at",
}
// Decode decodes CardRead from json.
@ -1090,7 +1174,7 @@ func (s *CardRead) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode CardRead to nil")
}
var requiredBitSet [1]uint8
var requiredBitSet [2]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -1156,6 +1240,26 @@ func (s *CardRead) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"url\"")
}
case "count":
if err := func() error {
s.Count.Reset()
if err := s.Count.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"count\"")
}
case "author":
if err := func() error {
s.Author.Reset()
if err := s.Author.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"author\"")
}
case "created_at":
if err := func() error {
s.CreatedAt.Reset()
@ -1175,8 +1279,9 @@ func (s *CardRead) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [1]uint8{
for i, mask := range [2]uint8{
0b00000001,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -1266,6 +1371,18 @@ func (s *CardUpdate) encodeFields(e *jx.Encoder) {
s.URL.Encode(e)
}
}
{
if s.Count.Set {
e.FieldStart("count")
s.Count.Encode(e)
}
}
{
if s.Author.Set {
e.FieldStart("author")
s.Author.Encode(e)
}
}
{
if s.CreatedAt.Set {
e.FieldStart("created_at")
@ -1274,14 +1391,16 @@ func (s *CardUpdate) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfCardUpdate = [7]string{
var jsonFieldsNameOfCardUpdate = [9]string{
0: "id",
1: "card",
2: "skill",
3: "status",
4: "cp",
5: "url",
6: "created_at",
6: "count",
7: "author",
8: "created_at",
}
// Decode decodes CardUpdate from json.
@ -1289,7 +1408,7 @@ func (s *CardUpdate) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode CardUpdate to nil")
}
var requiredBitSet [1]uint8
var requiredBitSet [2]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -1355,6 +1474,26 @@ func (s *CardUpdate) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"url\"")
}
case "count":
if err := func() error {
s.Count.Reset()
if err := s.Count.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"count\"")
}
case "author":
if err := func() error {
s.Author.Reset()
if err := s.Author.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"author\"")
}
case "created_at":
if err := func() error {
s.CreatedAt.Reset()
@ -1374,8 +1513,9 @@ func (s *CardUpdate) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [1]uint8{
for i, mask := range [2]uint8{
0b00000001,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -1471,6 +1611,18 @@ func (s *CreateCardReq) encodeFields(e *jx.Encoder) {
s.URL.Encode(e)
}
}
{
if s.Count.Set {
e.FieldStart("count")
s.Count.Encode(e)
}
}
{
if s.Author.Set {
e.FieldStart("author")
s.Author.Encode(e)
}
}
{
if s.CreatedAt.Set {
e.FieldStart("created_at")
@ -1484,7 +1636,7 @@ func (s *CreateCardReq) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfCreateCardReq = [9]string{
var jsonFieldsNameOfCreateCardReq = [11]string{
0: "password",
1: "card",
2: "skill",
@ -1492,8 +1644,10 @@ var jsonFieldsNameOfCreateCardReq = [9]string{
4: "token",
5: "cp",
6: "url",
7: "created_at",
8: "owner",
7: "count",
8: "author",
9: "created_at",
10: "owner",
}
// Decode decodes CreateCardReq from json.
@ -1577,6 +1731,26 @@ func (s *CreateCardReq) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"url\"")
}
case "count":
if err := func() error {
s.Count.Reset()
if err := s.Count.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"count\"")
}
case "author":
if err := func() error {
s.Author.Reset()
if err := s.Author.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"author\"")
}
case "created_at":
if err := func() error {
s.CreatedAt.Reset()
@ -1588,7 +1762,7 @@ func (s *CreateCardReq) Decode(d *jx.Decoder) error {
return errors.Wrap(err, "decode field \"created_at\"")
}
case "owner":
requiredBitSet[1] |= 1 << 0
requiredBitSet[1] |= 1 << 2
if err := func() error {
v, err := d.Int()
s.Owner = int(v)
@ -1610,7 +1784,7 @@ func (s *CreateCardReq) Decode(d *jx.Decoder) error {
var failures []validate.FieldError
for i, mask := range [2]uint8{
0b00000001,
0b00000001,
0b00000100,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -4502,6 +4676,18 @@ func (s *UpdateCardReq) encodeFields(e *jx.Encoder) {
s.URL.Encode(e)
}
}
{
if s.Count.Set {
e.FieldStart("count")
s.Count.Encode(e)
}
}
{
if s.Author.Set {
e.FieldStart("author")
s.Author.Encode(e)
}
}
{
if s.Owner.Set {
e.FieldStart("owner")
@ -4510,14 +4696,16 @@ func (s *UpdateCardReq) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfUpdateCardReq = [7]string{
var jsonFieldsNameOfUpdateCardReq = [9]string{
0: "card",
1: "skill",
2: "status",
3: "token",
4: "cp",
5: "url",
6: "owner",
6: "count",
7: "author",
8: "owner",
}
// Decode decodes UpdateCardReq from json.
@ -4588,6 +4776,26 @@ func (s *UpdateCardReq) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"url\"")
}
case "count":
if err := func() error {
s.Count.Reset()
if err := s.Count.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"count\"")
}
case "author":
if err := func() error {
s.Author.Reset()
if err := s.Author.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"author\"")
}
case "owner":
if err := func() error {
s.Owner.Reset()
@ -5328,6 +5536,18 @@ func (s *UserCardList) encodeFields(e *jx.Encoder) {
s.URL.Encode(e)
}
}
{
if s.Count.Set {
e.FieldStart("count")
s.Count.Encode(e)
}
}
{
if s.Author.Set {
e.FieldStart("author")
s.Author.Encode(e)
}
}
{
if s.CreatedAt.Set {
e.FieldStart("created_at")
@ -5336,14 +5556,16 @@ func (s *UserCardList) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfUserCardList = [7]string{
var jsonFieldsNameOfUserCardList = [9]string{
0: "id",
1: "card",
2: "skill",
3: "status",
4: "cp",
5: "url",
6: "created_at",
6: "count",
7: "author",
8: "created_at",
}
// Decode decodes UserCardList from json.
@ -5351,7 +5573,7 @@ func (s *UserCardList) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode UserCardList to nil")
}
var requiredBitSet [1]uint8
var requiredBitSet [2]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -5417,6 +5639,26 @@ func (s *UserCardList) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"url\"")
}
case "count":
if err := func() error {
s.Count.Reset()
if err := s.Count.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"count\"")
}
case "author":
if err := func() error {
s.Author.Reset()
if err := s.Author.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"author\"")
}
case "created_at":
if err := func() error {
s.CreatedAt.Reset()
@ -5436,8 +5678,9 @@ func (s *UserCardList) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [1]uint8{
for i, mask := range [2]uint8{
0b00000001,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.

View File

@ -459,7 +459,7 @@ func decodeListCardParams(args [0]string, r *http.Request) (params ListCardParam
MinSet: true,
Min: 1,
MaxSet: true,
Max: 4000,
Max: 5000,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
@ -624,7 +624,7 @@ func decodeListGroupParams(args [0]string, r *http.Request) (params ListGroupPar
MinSet: true,
Min: 1,
MaxSet: true,
Max: 4000,
Max: 5000,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
@ -956,7 +956,7 @@ func decodeListUserParams(args [0]string, r *http.Request) (params ListUserParam
MinSet: true,
Min: 1,
MaxSet: true,
Max: 4000,
Max: 5000,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,

View File

@ -374,7 +374,7 @@ func encodeDrawStartResponse(response *DrawStartNoContent, w http.ResponseWriter
}
func encodeListCardResponse(response ListCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *ListCardOKApplicationJSON:
w.Header().Set("Content-Type", "application/json")
@ -576,7 +576,7 @@ func encodeListGroupUsersResponse(response ListGroupUsersRes, w http.ResponseWri
}
func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *ListUserOKApplicationJSON:
w.Header().Set("Content-Type", "application/json")
@ -644,7 +644,7 @@ func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span tr
}
func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *ListUserCardOKApplicationJSON:
w.Header().Set("Content-Type", "application/json")
@ -712,7 +712,7 @@ func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter,
}
func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *CardRead:
w.Header().Set("Content-Type", "application/json")
@ -780,7 +780,7 @@ func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span tr
}
func encodeReadCardOwnerResponse(response ReadCardOwnerRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *CardOwnerRead:
w.Header().Set("Content-Type", "application/json")
@ -915,7 +915,7 @@ func encodeReadGroupResponse(response ReadGroupRes, w http.ResponseWriter, span
}
func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *UserRead:
w.Header().Set("Content-Type", "application/json")

View File

@ -16,6 +16,8 @@ type CardCreate struct {
Status OptString `json:"status"`
Cp OptInt `json:"cp"`
URL OptString `json:"url"`
Count OptInt `json:"count"`
Author OptString `json:"author"`
CreatedAt OptDateTime `json:"created_at"`
}
@ -49,6 +51,16 @@ func (s *CardCreate) GetURL() OptString {
return s.URL
}
// GetCount returns the value of Count.
func (s *CardCreate) GetCount() OptInt {
return s.Count
}
// GetAuthor returns the value of Author.
func (s *CardCreate) GetAuthor() OptString {
return s.Author
}
// GetCreatedAt returns the value of CreatedAt.
func (s *CardCreate) GetCreatedAt() OptDateTime {
return s.CreatedAt
@ -84,6 +96,16 @@ func (s *CardCreate) SetURL(val OptString) {
s.URL = val
}
// SetCount sets the value of Count.
func (s *CardCreate) SetCount(val OptInt) {
s.Count = val
}
// SetAuthor sets the value of Author.
func (s *CardCreate) SetAuthor(val OptString) {
s.Author = val
}
// SetCreatedAt sets the value of CreatedAt.
func (s *CardCreate) SetCreatedAt(val OptDateTime) {
s.CreatedAt = val
@ -99,6 +121,8 @@ type CardList struct {
Status OptString `json:"status"`
Cp OptInt `json:"cp"`
URL OptString `json:"url"`
Count OptInt `json:"count"`
Author OptString `json:"author"`
CreatedAt OptDateTime `json:"created_at"`
}
@ -132,6 +156,16 @@ func (s *CardList) GetURL() OptString {
return s.URL
}
// GetCount returns the value of Count.
func (s *CardList) GetCount() OptInt {
return s.Count
}
// GetAuthor returns the value of Author.
func (s *CardList) GetAuthor() OptString {
return s.Author
}
// GetCreatedAt returns the value of CreatedAt.
func (s *CardList) GetCreatedAt() OptDateTime {
return s.CreatedAt
@ -167,6 +201,16 @@ func (s *CardList) SetURL(val OptString) {
s.URL = val
}
// SetCount sets the value of Count.
func (s *CardList) SetCount(val OptInt) {
s.Count = val
}
// SetAuthor sets the value of Author.
func (s *CardList) SetAuthor(val OptString) {
s.Author = val
}
// SetCreatedAt sets the value of CreatedAt.
func (s *CardList) SetCreatedAt(val OptDateTime) {
s.CreatedAt = val
@ -527,6 +571,8 @@ type CardRead struct {
Status OptString `json:"status"`
Cp OptInt `json:"cp"`
URL OptString `json:"url"`
Count OptInt `json:"count"`
Author OptString `json:"author"`
CreatedAt OptDateTime `json:"created_at"`
}
@ -560,6 +606,16 @@ func (s *CardRead) GetURL() OptString {
return s.URL
}
// GetCount returns the value of Count.
func (s *CardRead) GetCount() OptInt {
return s.Count
}
// GetAuthor returns the value of Author.
func (s *CardRead) GetAuthor() OptString {
return s.Author
}
// GetCreatedAt returns the value of CreatedAt.
func (s *CardRead) GetCreatedAt() OptDateTime {
return s.CreatedAt
@ -595,6 +651,16 @@ func (s *CardRead) SetURL(val OptString) {
s.URL = val
}
// SetCount sets the value of Count.
func (s *CardRead) SetCount(val OptInt) {
s.Count = val
}
// SetAuthor sets the value of Author.
func (s *CardRead) SetAuthor(val OptString) {
s.Author = val
}
// SetCreatedAt sets the value of CreatedAt.
func (s *CardRead) SetCreatedAt(val OptDateTime) {
s.CreatedAt = val
@ -610,6 +676,8 @@ type CardUpdate struct {
Status OptString `json:"status"`
Cp OptInt `json:"cp"`
URL OptString `json:"url"`
Count OptInt `json:"count"`
Author OptString `json:"author"`
CreatedAt OptDateTime `json:"created_at"`
}
@ -643,6 +711,16 @@ func (s *CardUpdate) GetURL() OptString {
return s.URL
}
// GetCount returns the value of Count.
func (s *CardUpdate) GetCount() OptInt {
return s.Count
}
// GetAuthor returns the value of Author.
func (s *CardUpdate) GetAuthor() OptString {
return s.Author
}
// GetCreatedAt returns the value of CreatedAt.
func (s *CardUpdate) GetCreatedAt() OptDateTime {
return s.CreatedAt
@ -678,6 +756,16 @@ func (s *CardUpdate) SetURL(val OptString) {
s.URL = val
}
// SetCount sets the value of Count.
func (s *CardUpdate) SetCount(val OptInt) {
s.Count = val
}
// SetAuthor sets the value of Author.
func (s *CardUpdate) SetAuthor(val OptString) {
s.Author = val
}
// SetCreatedAt sets the value of CreatedAt.
func (s *CardUpdate) SetCreatedAt(val OptDateTime) {
s.CreatedAt = val
@ -693,6 +781,8 @@ type CreateCardReq struct {
Token OptString `json:"token"`
Cp OptInt `json:"cp"`
URL OptString `json:"url"`
Count OptInt `json:"count"`
Author OptString `json:"author"`
CreatedAt OptDateTime `json:"created_at"`
Owner int `json:"owner"`
}
@ -732,6 +822,16 @@ func (s *CreateCardReq) GetURL() OptString {
return s.URL
}
// GetCount returns the value of Count.
func (s *CreateCardReq) GetCount() OptInt {
return s.Count
}
// GetAuthor returns the value of Author.
func (s *CreateCardReq) GetAuthor() OptString {
return s.Author
}
// GetCreatedAt returns the value of CreatedAt.
func (s *CreateCardReq) GetCreatedAt() OptDateTime {
return s.CreatedAt
@ -777,6 +877,16 @@ func (s *CreateCardReq) SetURL(val OptString) {
s.URL = val
}
// SetCount sets the value of Count.
func (s *CreateCardReq) SetCount(val OptInt) {
s.Count = val
}
// SetAuthor sets the value of Author.
func (s *CreateCardReq) SetAuthor(val OptString) {
s.Author = val
}
// SetCreatedAt sets the value of CreatedAt.
func (s *CreateCardReq) SetCreatedAt(val OptDateTime) {
s.CreatedAt = val
@ -2093,6 +2203,8 @@ type UpdateCardReq struct {
Token OptString `json:"token"`
Cp OptInt `json:"cp"`
URL OptString `json:"url"`
Count OptInt `json:"count"`
Author OptString `json:"author"`
Owner OptInt `json:"owner"`
}
@ -2126,6 +2238,16 @@ func (s *UpdateCardReq) GetURL() OptString {
return s.URL
}
// GetCount returns the value of Count.
func (s *UpdateCardReq) GetCount() OptInt {
return s.Count
}
// GetAuthor returns the value of Author.
func (s *UpdateCardReq) GetAuthor() OptString {
return s.Author
}
// GetOwner returns the value of Owner.
func (s *UpdateCardReq) GetOwner() OptInt {
return s.Owner
@ -2161,6 +2283,16 @@ func (s *UpdateCardReq) SetURL(val OptString) {
s.URL = val
}
// SetCount sets the value of Count.
func (s *UpdateCardReq) SetCount(val OptInt) {
s.Count = val
}
// SetAuthor sets the value of Author.
func (s *UpdateCardReq) SetAuthor(val OptString) {
s.Author = val
}
// SetOwner sets the value of Owner.
func (s *UpdateCardReq) SetOwner(val OptInt) {
s.Owner = val
@ -2532,6 +2664,8 @@ type UserCardList struct {
Status OptString `json:"status"`
Cp OptInt `json:"cp"`
URL OptString `json:"url"`
Count OptInt `json:"count"`
Author OptString `json:"author"`
CreatedAt OptDateTime `json:"created_at"`
}
@ -2565,6 +2699,16 @@ func (s *UserCardList) GetURL() OptString {
return s.URL
}
// GetCount returns the value of Count.
func (s *UserCardList) GetCount() OptInt {
return s.Count
}
// GetAuthor returns the value of Author.
func (s *UserCardList) GetAuthor() OptString {
return s.Author
}
// GetCreatedAt returns the value of CreatedAt.
func (s *UserCardList) GetCreatedAt() OptDateTime {
return s.CreatedAt
@ -2600,6 +2744,16 @@ func (s *UserCardList) SetURL(val OptString) {
s.URL = val
}
// SetCount sets the value of Count.
func (s *UserCardList) SetCount(val OptInt) {
s.Count = val
}
// SetAuthor sets the value of Author.
func (s *UserCardList) SetAuthor(val OptString) {
s.Author = val
}
// SetCreatedAt sets the value of CreatedAt.
func (s *UserCardList) SetCreatedAt(val OptDateTime) {
s.CreatedAt = val

View File

@ -51,6 +51,12 @@ func (h *OgentHandler) CreateCard(ctx context.Context, req *CreateCardReq) (Crea
if v, ok := req.Cp.Get(); ok {
b.SetCp(v)
}
if v, ok := req.Count.Get(); ok {
b.SetCount(v)
}
if v, ok := req.Author.Get(); ok {
b.SetAuthor(v)
}
if v, ok := req.URL.Get(); ok {
b.SetURL(v)
}
@ -137,6 +143,12 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
if v, ok := req.Status.Get(); ok {
b.SetStatus(v)
}
if v, ok := req.Count.Get(); ok {
b.SetCount(v)
}
if v, ok := req.Author.Get(); ok {
b.SetAuthor(v)
}
if v, ok := req.Token.Get(); ok {
b.SetToken(v)
}

View File

@ -15,6 +15,8 @@ func NewCardCreate(e *ent.Card) *CardCreate {
ret.Status = NewOptString(e.Status)
ret.Cp = NewOptInt(e.Cp)
ret.URL = NewOptString(e.URL)
ret.Count = NewOptInt(e.Count)
ret.Author = NewOptString(e.Author)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
return &ret
}
@ -48,6 +50,8 @@ func NewCardList(e *ent.Card) *CardList {
ret.Status = NewOptString(e.Status)
ret.Cp = NewOptInt(e.Cp)
ret.URL = NewOptString(e.URL)
ret.Count = NewOptInt(e.Count)
ret.Author = NewOptString(e.Author)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
return &ret
}
@ -81,6 +85,8 @@ func NewCardRead(e *ent.Card) *CardRead {
ret.Status = NewOptString(e.Status)
ret.Cp = NewOptInt(e.Cp)
ret.URL = NewOptString(e.URL)
ret.Count = NewOptInt(e.Count)
ret.Author = NewOptString(e.Author)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
return &ret
}
@ -114,6 +120,8 @@ func NewCardUpdate(e *ent.Card) *CardUpdate {
ret.Status = NewOptString(e.Status)
ret.Cp = NewOptInt(e.Cp)
ret.URL = NewOptString(e.URL)
ret.Count = NewOptInt(e.Count)
ret.Author = NewOptString(e.Author)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
return &ret
}
@ -601,6 +609,8 @@ func NewUserCardList(e *ent.Card) *UserCardList {
ret.Status = NewOptString(e.Status)
ret.Cp = NewOptInt(e.Cp)
ret.URL = NewOptString(e.URL)
ret.Count = NewOptInt(e.Count)
ret.Author = NewOptString(e.Author)
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
return &ret
}

View File

@ -30,7 +30,7 @@
"description": "item count to render per page",
"schema": {
"type": "integer",
"maximum": 4000,
"maximum": 5000,
"minimum": 1
}
}
@ -98,6 +98,12 @@
"url": {
"type": "string"
},
"count": {
"type": "integer"
},
"author": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
@ -261,6 +267,12 @@
"url": {
"type": "string"
},
"count": {
"type": "integer"
},
"author": {
"type": "string"
},
"owner": {
"type": "integer"
}
@ -390,7 +402,7 @@
"description": "item count to render per page",
"schema": {
"type": "integer",
"maximum": 4000,
"maximum": 5000,
"minimum": 1
}
}
@ -716,7 +728,7 @@
"description": "item count to render per page",
"schema": {
"type": "integer",
"maximum": 4000,
"maximum": 5000,
"minimum": 1
}
}
@ -1260,6 +1272,12 @@
"url": {
"type": "string"
},
"count": {
"type": "integer"
},
"author": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
@ -1295,6 +1313,12 @@
"url": {
"type": "string"
},
"count": {
"type": "integer"
},
"author": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
@ -1325,6 +1349,12 @@
"url": {
"type": "string"
},
"count": {
"type": "integer"
},
"author": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
@ -1355,6 +1385,12 @@
"url": {
"type": "string"
},
"count": {
"type": "integer"
},
"author": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
@ -1385,6 +1421,12 @@
"url": {
"type": "string"
},
"count": {
"type": "integer"
},
"author": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
@ -2276,6 +2318,12 @@
"url": {
"type": "string"
},
"count": {
"type": "integer"
},
"author": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"

View File

@ -41,7 +41,7 @@ func init() {
// card.DefaultURL holds the default value on creation for the url field.
card.DefaultURL = cardDescURL.Default.(string)
// cardDescCreatedAt is the schema descriptor for created_at field.
cardDescCreatedAt := cardFields[7].Descriptor()
cardDescCreatedAt := cardFields[9].Descriptor()
// card.DefaultCreatedAt holds the default value on creation for the created_at field.
card.DefaultCreatedAt = cardDescCreatedAt.Default.(func() time.Time)
groupFields := schema.Group{}.Fields()

View File

@ -134,6 +134,12 @@ func (Card) Fields() []ent.Field {
Default(url).
Optional(),
field.Int("count").
Optional(),
field.String("author").
Optional(),
field.Time("created_at").
Immutable().
Optional().

View File

@ -374,7 +374,7 @@ func encodeDrawStartResponse(response *DrawStartNoContent, w http.ResponseWriter
}
func encodeListCardResponse(response ListCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *ListCardOKApplicationJSON:
w.Header().Set("Content-Type", "application/json")
@ -576,7 +576,7 @@ func encodeListGroupUsersResponse(response ListGroupUsersRes, w http.ResponseWri
}
func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *ListUserOKApplicationJSON:
w.Header().Set("Content-Type", "application/json")
@ -644,7 +644,7 @@ func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span tr
}
func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *ListUserCardOKApplicationJSON:
w.Header().Set("Content-Type", "application/json")
@ -712,7 +712,7 @@ func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter,
}
func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *CardRead:
w.Header().Set("Content-Type", "application/json")
@ -780,7 +780,7 @@ func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span tr
}
func encodeReadCardOwnerResponse(response ReadCardOwnerRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *CardOwnerRead:
w.Header().Set("Content-Type", "application/json")
@ -915,7 +915,7 @@ func encodeReadGroupResponse(response ReadGroupRes, w http.ResponseWriter, span
}
func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
switch response := response.(type) {
case *UserRead:
w.Header().Set("Content-Type", "application/json")

View File

@ -51,6 +51,12 @@ func (h *OgentHandler) CreateCard(ctx context.Context, req *CreateCardReq) (Crea
if v, ok := req.Cp.Get(); ok {
b.SetCp(v)
}
if v, ok := req.Count.Get(); ok {
b.SetCount(v)
}
if v, ok := req.Author.Get(); ok {
b.SetAuthor(v)
}
if v, ok := req.URL.Get(); ok {
b.SetURL(v)
}
@ -137,6 +143,12 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
if v, ok := req.Status.Get(); ok {
b.SetStatus(v)
}
if v, ok := req.Count.Get(); ok {
b.SetCount(v)
}
if v, ok := req.Author.Get(); ok {
b.SetAuthor(v)
}
if v, ok := req.Token.Get(); ok {
b.SetToken(v)
}