config_loader

package module
v0.0.0-...-9ad1bb6 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 4 Imported by: 3

README

config-loader

Define Message Queue Config struct and implement LoadByFile, LoadByBytes and SetDefault interfaces.

type QueueConfig struct {
	Url                    string `json:"url" yaml:"url"`
	AccessKeyId            string `json:"access_key_id" yaml:"access_key_id"`
	AccessKeySecret        string `json:"access_key_secret" yaml:"access_key_secret"`
	QueueName              string `json:"queue_name" yaml:"queue_name"`
	MaxDequeueCount        int    `json:"max_dequeue_count" yaml:"max_dequeue_count"`
	DelaySeconds           int    `json:"delay_seconds" yaml:"delay_seconds"`
	MaxMessageSize         int    `json:"max_message_size" yaml:"max_message_size"`
	MessageRetentionPeriod int    `json:"message_retention_period" yaml:"message_retention_period"`
	VisibilityTimeout      int    `json:"visibility_timeout" yaml:"visibility_timeout"`
	PollingWaitSeconds     int    `json:"polling_wait_seconds" yaml:"polling_wait_seconds"`
	Verbose                bool   `json:"verbose" yaml:"verbose"`
	ConsumeTimeout         int    `json:"consume_timeout" yaml:"consume_timeout"`
	MaxProcessingMessage   int    `json:"max_processing_message" yaml:"max_processing_message"`
	OverloadBreakSeconds   int    `json:"overload_break_seconds" yaml:"overload_break_seconds"`
}

Documentation

Index

Constants

View Source
const DataTypeMongo = "mongo"
View Source
const DataTypeMysql = "mysql"
View Source
const DefaultConsumeTime = -1
View Source
const DefaultDelaySeconds = 0
View Source
const DefaultMaxDequeueCount = 1
View Source
const DefaultMaxMessageSize = 65536
View Source
const DefaultMaxProcessingMessage = 200
View Source
const DefaultMessageRetentionPeriod = 7 * 24 * 3600 // 7days
View Source
const DefaultOverloadBreakSeconds = 120
View Source
const DefaultPollingWaitSeconds = 10
View Source
const DefaultRecvMessageBatchSize = 1
View Source
const DefaultVisibilityTimeout = 60

Variables

This section is empty.

Functions

func LoadByBytes

func LoadByBytes(content []byte, out interface{})

func LoadByFile

func LoadByFile(filename string, out interface{})

Types

type ConfigLoader

type ConfigLoader interface {
	LoadByFile(filename string)
	LoadByBytes(content []byte)
	SetDefault()
}

type DatasourceConfig

type DatasourceConfig struct {
	Server         string `json:"server" yaml:"server"`
	Port           int    `json:"port" yaml:"port"`
	Username       string `json:"username" yaml:"username"`
	Password       string `json:"password" yaml:"password"`
	Query          string `json:"query" yaml:"query"`
	Database       string `json:"database" yaml:"database"`
	Dbtype         string `json:"dbytpe" yaml:"dbtype"`
	ReplicaSet     string `json:"replica_set" yaml:"replica_set,omitempty"`
	ReplicaServers string `json:"replica_servers" yaml:"replica_servers,omitempty"`
	ReadPreference string `json:"replica_read_preference" yaml:"replica_read_preference,omitempty"`
	Prefix         string `json:"prefix" yaml:"prefix"`
	ConfigLoader
}

func (*DatasourceConfig) Host

func (dsc *DatasourceConfig) Host() string

func (*DatasourceConfig) Protocol

func (dsc *DatasourceConfig) Protocol() string

func (*DatasourceConfig) String

func (dsc *DatasourceConfig) String() string

type DatasourceConfigGroup

type DatasourceConfigGroup map[string]DatasourceConfig

func (*DatasourceConfigGroup) ConnectString

func (dsg *DatasourceConfigGroup) ConnectString(configName string) string

func (*DatasourceConfigGroup) DatabaseName

func (dsg *DatasourceConfigGroup) DatabaseName(configName string) string

func (*DatasourceConfigGroup) LoadByBytes

func (dsg *DatasourceConfigGroup) LoadByBytes(content []byte)

func (*DatasourceConfigGroup) LoadByFile

func (dsg *DatasourceConfigGroup) LoadByFile(filename string)

func (*DatasourceConfigGroup) SetDefault

func (dsg *DatasourceConfigGroup) SetDefault()

type FcServiceConfig

type FcServiceConfig struct {
	Endpoint        string `json:"endpoint" yaml:"endpoint"`
	AccessKeyId     string `json:"access_key_id" yaml:"access_key_id"`
	AccessKeySecret string `json:"access_key_secret" yaml:"access_key_secret"`
}

func (*FcServiceConfig) LoadByBytes

func (c *FcServiceConfig) LoadByBytes(content []byte)

func (*FcServiceConfig) LoadByFile

func (c *FcServiceConfig) LoadByFile(filename string)

func (*FcServiceConfig) SetDefault

func (c *FcServiceConfig) SetDefault()

type FunctionConfig

type FunctionConfig struct {
	ServiceName  string `json:"service_name" yaml:"service_name"`
	FunctionName string `json:"function_name" yaml:"function_name"`
}

func (*FunctionConfig) LoadByBytes

func (c *FunctionConfig) LoadByBytes(content []byte)

func (*FunctionConfig) LoadByFile

func (c *FunctionConfig) LoadByFile(filename string)

func (*FunctionConfig) SetDefault

func (c *FunctionConfig) SetDefault()

type GetuiConfigGroup

type GetuiConfigGroup map[string]getuigo.GetuiConfig

func (*GetuiConfigGroup) LoadByBytes

func (g *GetuiConfigGroup) LoadByBytes(content []byte)

func (*GetuiConfigGroup) LoadByFile

func (g *GetuiConfigGroup) LoadByFile(filename string)

func (*GetuiConfigGroup) SetDefault

func (g *GetuiConfigGroup) SetDefault()

type QueueConfig

type QueueConfig struct {
	Url                    string `json:"url" yaml:"url"`
	AccessKeyId            string `json:"access_key_id" yaml:"access_key_id"`
	AccessKeySecret        string `json:"access_key_secret" yaml:"access_key_secret"`
	QueueName              string `json:"queue_name" yaml:"queue_name"`
	MaxDequeueCount        int    `json:"max_dequeue_count" yaml:"max_dequeue_count"`
	DelaySeconds           int    `json:"delay_seconds" yaml:"delay_seconds"`
	MaxMessageSize         int    `json:"max_message_size" yaml:"max_message_size"`
	MessageRetentionPeriod int    `json:"message_retention_period" yaml:"message_retention_period"`
	VisibilityTimeout      int    `json:"visibility_timeout" yaml:"visibility_timeout"`
	PollingWaitSeconds     int    `json:"polling_wait_seconds" yaml:"polling_wait_seconds"`
	Verbose                bool   `json:"verbose" yaml:"verbose"`
	ConsumeTimeout         int    `json:"consume_timeout" yaml:"consume_timeout"`
	MaxProcessingMessage   int    `json:"max_processing_message" yaml:"max_processing_message"`
	OverloadBreakSeconds   int    `json:"overload_break_seconds" yaml:"overload_break_seconds"`
	RecvMessageBatchSize   int    `json:"recv_message_batch_size" yaml:"recv_message_batch_size"`
}

func (*QueueConfig) LoadByBytes

func (c *QueueConfig) LoadByBytes(content []byte)

func (*QueueConfig) LoadByFile

func (c *QueueConfig) LoadByFile(filename string)

func (*QueueConfig) SetDefault

func (c *QueueConfig) SetDefault()

Jump to

Keyboard shortcuts

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