application

package
v1.4.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiConfig

type ApiConfig struct {
	UrlPrefix    string   `json:"url_prefix" yaml:"url_prefix"`
	Port         string   `json:"port" yaml:"port"`
	LogSkipPaths []string `json:"log_skip_paths" yaml:"log_skip_paths"`
}

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(api *api.Api, i *infrastructure.Infrastructure) *App

New 创建Application

func (*App) Api

func (app *App) Api() *api.Api

Api 获取Api实例 参数: 无 返回值: - Api实例

func (*App) ChooseRouter

func (app *App) ChooseRouter(routerType string, version string) api.Router

ChooseRouter 选择Router 参数: - routerType: 路由类型,有两种

  • api.RouterRoot: 根路由
  • api.RouterPrefix: 带url前缀的路由

- version: 版本,用于获取基于上面两中路由够造的带有版本号的路由,传空字符串则选定上面两种路由本身 返回值: - 选择的Router

func (*App) Finish

func (app *App) Finish() error

Finish 终止应用 参数: 无 返回值: - 错误

func (*App) Infrastructure

func (app *App) Infrastructure() *infrastructure.Infrastructure

Infrastructure 获取Infrastructure实例 参数: 无 返回值: - Infrastructure实例

func (*App) Start

func (app *App) Start() error

Start 运行应用 参数: 无 返回值: - 错误

type Config

type Config struct {
	ApiConfig            `json:"api" yaml:"api"`
	InfrastructureConfig `json:"infrastructure" yaml:"infrastructure"`
}

func LoadFromJson

func LoadFromJson(jsonStr string) (Config, error)

func LoadFromJsonFile

func LoadFromJsonFile(jsonFilePath string) (Config, error)

func LoadFromYaml

func LoadFromYaml(yamlStr string) (Config, error)

func LoadFromYamlFile

func LoadFromYamlFile(yamlFilePath string) (Config, error)

type InfoIDField

type InfoIDField struct {
	ID string `json:"id" sqlresult:"column:id"`
}

InfoIDField Info的ID字段

type InfoTenantIDField

type InfoTenantIDField struct {
	TenantID string `json:"tenantId" sqlresult:"column:tenant_id"`
}

InfoTenantIDField Info的租户ID字段

type InfoTimeFields

type InfoTimeFields struct {
	CreatedTime     string `json:"createdTime" sqlresult:"column:created_time;timeLayout:'2006-01-02 15:04:05'"`
	LastUpdatedTime string `json:"lastUpdatedTime" sqlresult:"column:last_updated_time;timeLayout:'2006-01-02 15:04:05'"`
}

InfoTimeFields Info的时间相关字段

type InfoUserIDFields

type InfoUserIDFields struct {
	CreateUserID     string `json:"createUserId" sqlresult:"column:create_user_id;"`
	LastUpdateUserID string `json:"lastUpdateUserId" sqlresult:"column:last_update_user_id;"`
}

InfoUserIDFields Info的用户ID相关字段

type InfrastructureConfig

type InfrastructureConfig struct {
	Database     infrastructure.DatabaseConfig     `json:"database" yaml:"database"`
	Cache        infrastructure.CacheConfig        `json:"cache" yaml:"cache"`
	MessageQueue infrastructure.MessageQueueConfig `json:"message_queue" yaml:"message_queue"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL