config

package
v0.0.0-...-771f04f Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 3 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheConfig

type CacheConfig struct {
	Driver   string `json:"driver"`
	Addr     string `json:"addr"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type Config

type Config struct {
	BasePath       string                    `json:"base_path"`
	ServicePath    string                    `json:"service_path"`
	ServiceName    string                    `json:"service_name"`
	ServiceAddr    string                    `json:"service_addr"`
	RegistryConfig RegistryConfig            `json:"registry_config"`
	RateLimit      int64                     `json:"rate_limit"`
	DatabaseConfig map[string]DatabaseConfig `json:"database_config"`
	CacheConfig    CacheConfig               `json:"cache_config"`
	TokenConfig    TokenConfig               `json:"token_config"`
}

func Register

func Register(path string) (*Config, error)

type DatabaseConfig

type DatabaseConfig struct {
	Driver   string            `json:"driver"`
	Host     string            `json:"host"`
	Port     int               `json:"port"`
	Username string            `json:"username"`
	Password string            `json:"password"`
	Database string            `json:"database"`
	Sources  []DatabaseConnect `json:"sources"`
	Replicas []DatabaseConnect `json:"replicas"`
}

DatabaseConfig 数据库配置

type DatabaseConnect

type DatabaseConnect struct {
	Driver   string `json:"driver"`
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
	Database string `json:"database"`
}

type HttpResponse

type HttpResponse struct {
	Code    int         `json:"code"`
	Data    interface{} `json:"data,omitempty"`
	Message string      `json:"message,omitempty"`
}

type Method

type Method struct {
	Name   string                                                       `json:"name"`
	Router string                                                       `json:"router"`
	Func   func(ctx context.Context, res *Request, req *Response) error `json:"func"`
}

Method 服务结构

type RegistryConfig

type RegistryConfig struct {
	Driver string `json:"driver"`
	Addr   string `json:"addr"`
}

RegistryConfig 服务发现配置

type Request

type Request struct {
	Message string `json:"message"`
}

Request 请求解析

type Response

type Response struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Response 返回协议

type TokenConfig

type TokenConfig struct {
	AccessSecret  string `json:"access_secret"`
	RefreshSecret string `json:"refresh_secret"`
	AccessExpire  int    `json:"access_expire"`
	RefreshExpire int    `json:"refresh_expire"`
}

TokenConfig config

Jump to

Keyboard shortcuts

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