| |
| package schema |
|
|
| import ( |
| "github.com/Wei-Shaw/sub2api/ent/schema/mixins" |
|
|
| "entgo.io/ent" |
| "entgo.io/ent/dialect" |
| "entgo.io/ent/dialect/entsql" |
| "entgo.io/ent/schema" |
| "entgo.io/ent/schema/field" |
| "entgo.io/ent/schema/index" |
| ) |
|
|
| |
| |
| |
| |
| |
| |
| |
| type ErrorPassthroughRule struct { |
| ent.Schema |
| } |
|
|
| |
| func (ErrorPassthroughRule) Annotations() []schema.Annotation { |
| return []schema.Annotation{ |
| entsql.Annotation{Table: "error_passthrough_rules"}, |
| } |
| } |
|
|
| |
| func (ErrorPassthroughRule) Mixin() []ent.Mixin { |
| return []ent.Mixin{ |
| mixins.TimeMixin{}, |
| } |
| } |
|
|
| |
| func (ErrorPassthroughRule) Fields() []ent.Field { |
| return []ent.Field{ |
| |
| field.String("name"). |
| MaxLen(100). |
| NotEmpty(), |
|
|
| |
| field.Bool("enabled"). |
| Default(true), |
|
|
| |
| |
| field.Int("priority"). |
| Default(0), |
|
|
| |
| |
| field.JSON("error_codes", []int{}). |
| Optional(). |
| SchemaType(map[string]string{dialect.Postgres: "jsonb"}), |
|
|
| |
| |
| |
| field.JSON("keywords", []string{}). |
| Optional(). |
| SchemaType(map[string]string{dialect.Postgres: "jsonb"}), |
|
|
| |
| |
| |
| field.String("match_mode"). |
| MaxLen(10). |
| Default("any"), |
|
|
| |
| |
| |
| field.JSON("platforms", []string{}). |
| Optional(). |
| SchemaType(map[string]string{dialect.Postgres: "jsonb"}), |
|
|
| |
| |
| |
| field.Bool("passthrough_code"). |
| Default(true), |
|
|
| |
| |
| field.Int("response_code"). |
| Optional(). |
| Nillable(), |
|
|
| |
| |
| |
| field.Bool("passthrough_body"). |
| Default(true), |
|
|
| |
| |
| field.Text("custom_message"). |
| Optional(). |
| Nillable(), |
|
|
| |
| |
| |
| field.Bool("skip_monitoring"). |
| Default(false), |
|
|
| |
| field.Text("description"). |
| Optional(). |
| Nillable(), |
| } |
| } |
|
|
| |
| func (ErrorPassthroughRule) Indexes() []ent.Index { |
| return []ent.Index{ |
| index.Fields("enabled"), |
| index.Fields("priority"), |
| } |
| } |
|
|