add initial application structure with configuration, logging, and health check endpoints

This commit is contained in:
kever
2026-01-15 21:39:15 +08:00
parent fed727e593
commit ed8c3d55b8
103 changed files with 39974 additions and 80 deletions

View File

@@ -0,0 +1,64 @@
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"context"
"fmt"
"io"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql/schema"
)
var (
// WithGlobalUniqueID sets the universal ids options to the migration.
// If this option is enabled, ent migration will allocate a 1<<32 range
// for the ids of each entity (table).
// Note that this option cannot be applied on tables that already exist.
WithGlobalUniqueID = schema.WithGlobalUniqueID
// WithDropColumn sets the drop column option to the migration.
// If this option is enabled, ent migration will drop old columns
// that were used for both fields and edges. This defaults to false.
WithDropColumn = schema.WithDropColumn
// WithDropIndex sets the drop index option to the migration.
// If this option is enabled, ent migration will drop old indexes
// that were defined in the schema. This defaults to false.
// Note that unique constraints are defined using `UNIQUE INDEX`,
// and therefore, it's recommended to enable this option to get more
// flexibility in the schema changes.
WithDropIndex = schema.WithDropIndex
// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
WithForeignKeys = schema.WithForeignKeys
)
// Schema is the API for creating, migrating and dropping a schema.
type Schema struct {
drv dialect.Driver
}
// NewSchema creates a new schema client.
func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
// Create creates all schema resources.
func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
return Create(ctx, s, Tables, opts...)
}
// Create creates all table resources using the given schema driver.
func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error {
migrate, err := schema.NewMigrate(s.drv, opts...)
if err != nil {
return fmt.Errorf("ent/migrate: %w", err)
}
return migrate.Create(ctx, tables...)
}
// WriteTo writes the schema changes to w instead of running them against the database.
//
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
// log.Fatal(err)
// }
func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
}

View File

@@ -0,0 +1,224 @@
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// EpicArtifactInfosColumns holds the columns for the "epic_artifact_infos" table.
EpicArtifactInfosColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "artifact_name", Type: field.TypeString, Size: 255},
{Name: "artifact_code", Type: field.TypeString, Size: 255},
{Name: "creator", Type: field.TypeString, Size: 255},
{Name: "create_time", Type: field.TypeTime, Nullable: true},
{Name: "updater", Type: field.TypeString, Size: 255},
{Name: "update_time", Type: field.TypeTime, Nullable: true},
{Name: "deleted", Type: field.TypeBool},
{Name: "stats_health", Type: field.TypeInt},
{Name: "stats_attack", Type: field.TypeInt},
{Name: "stats_defense", Type: field.TypeInt},
{Name: "rarity", Type: field.TypeString, Size: 255},
{Name: "role", Type: field.TypeString, Size: 255},
{Name: "artifact_name_en", Type: field.TypeString, Size: 255},
{Name: "image_url", Type: field.TypeString, Size: 255},
}
// EpicArtifactInfosTable holds the schema information for the "epic_artifact_infos" table.
EpicArtifactInfosTable = &schema.Table{
Name: "epic_artifact_infos",
Columns: EpicArtifactInfosColumns,
PrimaryKey: []*schema.Column{EpicArtifactInfosColumns[0]},
}
// EpicGvgAttackTeamsColumns holds the columns for the "epic_gvg_attack_teams" table.
EpicGvgAttackTeamsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "attack_heroes", Type: field.TypeString, Size: 255},
{Name: "creator", Type: field.TypeString, Size: 255},
{Name: "create_time", Type: field.TypeTime, Nullable: true},
{Name: "updater", Type: field.TypeString, Size: 255},
{Name: "update_time", Type: field.TypeTime, Nullable: true},
{Name: "deleted", Type: field.TypeBool},
}
// EpicGvgAttackTeamsTable holds the schema information for the "epic_gvg_attack_teams" table.
EpicGvgAttackTeamsTable = &schema.Table{
Name: "epic_gvg_attack_teams",
Columns: EpicGvgAttackTeamsColumns,
PrimaryKey: []*schema.Column{EpicGvgAttackTeamsColumns[0]},
}
// EpicGvgDefenseAttackMappingsColumns holds the columns for the "epic_gvg_defense_attack_mappings" table.
EpicGvgDefenseAttackMappingsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "defense_id", Type: field.TypeInt64},
{Name: "attack_id", Type: field.TypeInt64},
{Name: "equipment_info", Type: field.TypeString, Size: 255},
{Name: "artifacts", Type: field.TypeString, Size: 255},
{Name: "battle_strategy", Type: field.TypeString, Size: 255},
{Name: "prerequisites", Type: field.TypeString, Size: 255},
{Name: "important_notes", Type: field.TypeString, Size: 255},
{Name: "creator", Type: field.TypeString, Size: 255},
{Name: "create_time", Type: field.TypeTime, Nullable: true},
{Name: "updater", Type: field.TypeString, Size: 255},
{Name: "update_time", Type: field.TypeTime, Nullable: true},
{Name: "deleted", Type: field.TypeBool},
}
// EpicGvgDefenseAttackMappingsTable holds the schema information for the "epic_gvg_defense_attack_mappings" table.
EpicGvgDefenseAttackMappingsTable = &schema.Table{
Name: "epic_gvg_defense_attack_mappings",
Columns: EpicGvgDefenseAttackMappingsColumns,
PrimaryKey: []*schema.Column{EpicGvgDefenseAttackMappingsColumns[0]},
}
// EpicGvgDefenseTeamsColumns holds the columns for the "epic_gvg_defense_teams" table.
EpicGvgDefenseTeamsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "defense_heroes", Type: field.TypeString, Size: 255},
{Name: "creator", Type: field.TypeString, Size: 255},
{Name: "create_time", Type: field.TypeTime, Nullable: true},
{Name: "updater", Type: field.TypeString, Size: 255},
{Name: "update_time", Type: field.TypeTime, Nullable: true},
{Name: "deleted", Type: field.TypeBool},
}
// EpicGvgDefenseTeamsTable holds the schema information for the "epic_gvg_defense_teams" table.
EpicGvgDefenseTeamsTable = &schema.Table{
Name: "epic_gvg_defense_teams",
Columns: EpicGvgDefenseTeamsColumns,
PrimaryKey: []*schema.Column{EpicGvgDefenseTeamsColumns[0]},
}
// EpicHeroInfosColumns holds the columns for the "epic_hero_infos" table.
EpicHeroInfosColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "hero_name", Type: field.TypeString, Size: 255},
{Name: "hero_code", Type: field.TypeString, Size: 255},
{Name: "hero_attr_lv60", Type: field.TypeString, Size: 255},
{Name: "creator", Type: field.TypeString, Size: 255},
{Name: "create_time", Type: field.TypeTime, Nullable: true},
{Name: "updater", Type: field.TypeString, Size: 255},
{Name: "update_time", Type: field.TypeTime, Nullable: true},
{Name: "deleted", Type: field.TypeBool},
{Name: "nick_name", Type: field.TypeString, Size: 255},
{Name: "rarity", Type: field.TypeString, Size: 255},
{Name: "role", Type: field.TypeString, Size: 255},
{Name: "zodiac", Type: field.TypeString, Size: 255},
{Name: "head_img_url", Type: field.TypeString, Size: 255},
{Name: "attribute", Type: field.TypeString, Size: 255},
{Name: "remark", Type: field.TypeString, Size: 255},
{Name: "raw_json", Type: field.TypeString, Size: 255},
{Name: "set_content_json", Type: field.TypeString, Size: 255},
{Name: "set_update_time", Type: field.TypeTime, Nullable: true},
}
// EpicHeroInfosTable holds the schema information for the "epic_hero_infos" table.
EpicHeroInfosTable = &schema.Table{
Name: "epic_hero_infos",
Columns: EpicHeroInfosColumns,
PrimaryKey: []*schema.Column{EpicHeroInfosColumns[0]},
}
// EpicHeroUserBuildsColumns holds the columns for the "epic_hero_user_builds" table.
EpicHeroUserBuildsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "artifact_code", Type: field.TypeString, Size: 255},
{Name: "hero_code", Type: field.TypeString, Size: 255},
{Name: "hero_heath_build", Type: field.TypeFloat64},
{Name: "hero_attack_build", Type: field.TypeFloat64},
{Name: "hero_def_build", Type: field.TypeFloat64},
{Name: "creator", Type: field.TypeString, Size: 255},
{Name: "create_time", Type: field.TypeTime, Nullable: true},
{Name: "updater", Type: field.TypeString, Size: 255},
{Name: "update_time", Type: field.TypeTime, Nullable: true},
{Name: "deleted", Type: field.TypeBool},
}
// EpicHeroUserBuildsTable holds the schema information for the "epic_hero_user_builds" table.
EpicHeroUserBuildsTable = &schema.Table{
Name: "epic_hero_user_builds",
Columns: EpicHeroUserBuildsColumns,
PrimaryKey: []*schema.Column{EpicHeroUserBuildsColumns[0]},
}
// EpicI18nMappingsColumns holds the columns for the "epic_i18n_mappings" table.
EpicI18nMappingsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "key_name", Type: field.TypeString, Size: 255},
{Name: "language", Type: field.TypeString, Size: 255},
{Name: "value", Type: field.TypeString, Size: 255},
{Name: "category", Type: field.TypeString, Size: 255},
{Name: "status", Type: field.TypeInt},
{Name: "creator", Type: field.TypeString, Size: 255},
{Name: "create_time", Type: field.TypeTime, Nullable: true},
{Name: "updater", Type: field.TypeString, Size: 255},
{Name: "update_time", Type: field.TypeTime, Nullable: true},
{Name: "deleted", Type: field.TypeInt},
{Name: "code", Type: field.TypeString, Size: 255},
}
// EpicI18nMappingsTable holds the schema information for the "epic_i18n_mappings" table.
EpicI18nMappingsTable = &schema.Table{
Name: "epic_i18n_mappings",
Columns: EpicI18nMappingsColumns,
PrimaryKey: []*schema.Column{EpicI18nMappingsColumns[0]},
}
// FribbleHeroSetsColumns holds the columns for the "fribble_hero_sets" table.
FribbleHeroSetsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "hero_code", Type: field.TypeString, Size: 255},
{Name: "json_content", Type: field.TypeString, Size: 255},
{Name: "hero_name", Type: field.TypeString, Size: 255},
{Name: "creator", Type: field.TypeString, Size: 255},
{Name: "create_time", Type: field.TypeTime, Nullable: true},
{Name: "updater", Type: field.TypeString, Size: 255},
{Name: "update_time", Type: field.TypeTime, Nullable: true},
{Name: "deleted", Type: field.TypeBool},
{Name: "success_get", Type: field.TypeInt},
}
// FribbleHeroSetsTable holds the schema information for the "fribble_hero_sets" table.
FribbleHeroSetsTable = &schema.Table{
Name: "fribble_hero_sets",
Columns: FribbleHeroSetsColumns,
PrimaryKey: []*schema.Column{FribbleHeroSetsColumns[0]},
}
// GearSetInfosColumns holds the columns for the "gear_set_infos" table.
GearSetInfosColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "level", Type: field.TypeInt},
{Name: "gear_id", Type: field.TypeInt64},
{Name: "enhance", Type: field.TypeInt},
{Name: "gear_type", Type: field.TypeString, Size: 255},
{Name: "gear_set_type", Type: field.TypeString, Size: 255},
{Name: "main_stat_type", Type: field.TypeString, Size: 255},
{Name: "main_stat_value", Type: field.TypeInt},
{Name: "sub_stat_one_type", Type: field.TypeString, Size: 255},
{Name: "sub_stat_one_value", Type: field.TypeInt},
{Name: "sub_stat_two_type", Type: field.TypeString, Size: 255},
{Name: "sub_stat_two_value", Type: field.TypeInt},
{Name: "sub_stat_three_type", Type: field.TypeString, Size: 255},
{Name: "sub_stat_three_value", Type: field.TypeInt},
{Name: "sub_stat_four_type", Type: field.TypeString, Size: 255},
{Name: "sub_stat_four_value", Type: field.TypeInt},
{Name: "account_code", Type: field.TypeString, Size: 255},
{Name: "creator", Type: field.TypeString, Size: 255},
{Name: "create_time", Type: field.TypeTime, Nullable: true},
{Name: "updater", Type: field.TypeString, Size: 255},
{Name: "update_time", Type: field.TypeTime, Nullable: true},
{Name: "deleted", Type: field.TypeBool},
{Name: "tenant_id", Type: field.TypeInt64},
}
// GearSetInfosTable holds the schema information for the "gear_set_infos" table.
GearSetInfosTable = &schema.Table{
Name: "gear_set_infos",
Columns: GearSetInfosColumns,
PrimaryKey: []*schema.Column{GearSetInfosColumns[0]},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
EpicArtifactInfosTable,
EpicGvgAttackTeamsTable,
EpicGvgDefenseAttackMappingsTable,
EpicGvgDefenseTeamsTable,
EpicHeroInfosTable,
EpicHeroUserBuildsTable,
EpicI18nMappingsTable,
FribbleHeroSetsTable,
GearSetInfosTable,
}
)
func init() {
}