conf

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	AppId   string
	AppName string
	Version string
}

type BizShardingFieldConfig

type BizShardingFieldConfig struct {
	Fields []string `yaml:"fields" json:"fields"`
}

BizShardingFieldConfig is a map of bizName to sharding field e.g. {"shortVideo": ["id", "hash"]}

type Config

type Config struct {
	Base      Base
	Data      Data
	Server    Server
	Snowflake Snowflake
}

type Data

type Data struct {
	Database struct {
		Source string
	}
	Redis struct {
		Source   string
		Password string
	}
	DbShardingConfig map[string]DbShardingConfig     `yaml:"db_sharding_config" json:"db_sharding_config"`
	DbShardingTables map[string]DomainShardingConfig `yaml:"db_sharding_tables" json:"db_sharding_tables"`
	Minio            struct {
		Endpoint  string
		AccessKey string
		SecretKey string
	}
}

func (Data) GetShardingNumber

func (config Data) GetShardingNumber(fileName, domainName, bizName string) int64

type DbShardingConfig

type DbShardingConfig struct {
	Sharding       string `yaml:"sharding" json:"sharding"`
	ShardingNumber int64  `yaml:"sharding_number" json:"sharding_number"`
}

type DomainShardingConfig

type DomainShardingConfig struct {
	DomainName             string                            `yaml:"domain_name" json:"domain_name"`
	BizShardingFieldConfig map[string]BizShardingFieldConfig `yaml:"biz_sharding_field_config" json:"biz_sharding_field_config"`
}

DomainShardingConfig is a map of domainName to BizShardingFieldConfig, used for warming up with the creation of the sharding tables key: domain name

type Server

type Server struct {
	Grpc struct {
		Addr string
	}
}

type ShardingNumberConfig

type ShardingNumberConfig struct {
	TableName      string
	DomainName     string
	BizName        string
	ShardingNumber int
}

type Snowflake

type Snowflake struct {
	Node int64
}

Jump to

Keyboard shortcuts

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