Documentation ¶
Index ¶
- Variables
- func AppEnv() string
- func IsCIorTest() bool
- func IsDev() bool
- func IsDevOrCIorTest() bool
- func IsProduction() bool
- func IsStaging() bool
- func IsTest() bool
- func NewExpandEnv(name string) (io.Reader, error)
- func NewExpandEnvWithReader(f io.Reader) (io.Reader, error)
- func Validate(v any) error
- func ValidateStruct(v any, fields ...*validation.FieldRules) error
- func WriteConfig[T TConfig](w io.Writer) error
- type AWS
- type App
- type BinlogSaver
- type Config
- type Database
- type FileSaver
- type IEndpoint
- type Logging
- type Outbox
- type OutboxPolling
- type OutboxPollingConfig
- type Publisher
- type Queue
- type SNS
- type SQS
- type SSH
- type Saver
- type TConfig
- type TLS
- type TemplateType
- type Topic
- type Trace
- type Transform
- type TransformColumn
- type TransformOutbox
- type TransformTable
- type TransformType
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFoundAggregateTypeQueue = errors.New("Not found aggregate type queue.")
)
View Source
var (
ErrNotFoundAggregateTypeTopic = errors.New("Not found aggregate type topic.")
)
View Source
var (
ErrNotFoundProducer = errors.New("Not found producer")
)
View Source
var (
ErrNotSelected = errors.New("Not selected.")
)
Functions ¶
func IsCIorTest ¶
func IsCIorTest() bool
func IsDevOrCIorTest ¶
func IsDevOrCIorTest() bool
func IsProduction ¶
func IsProduction() bool
func ValidateStruct ¶
func ValidateStruct(v any, fields ...*validation.FieldRules) error
Types ¶
type AWS ¶
type AWS struct { AccessKey string `yaml:"accessKey"` SecretKet string `yaml:"secretKey"` SNS *SNS `yaml:"sns"` SQS *SQS `yaml:"sqs"` }
func (*AWS) WithStatic ¶
func (conf *AWS) WithStatic() awsv2.CredentialsProvider
type App ¶
type App struct { AppEnv string `yaml:"appEnv" default:"dev"` TrackingEnv string `yaml:"trackingEnv" default:"dev"` ServiceName string `yaml:"serviceName"` ServiceRoot string `yaml:"serviceRoot"` }
func (*App) SetDefaults ¶
func (app *App) SetDefaults()
type BinlogSaver ¶
type BinlogSaver struct {
File *FileSaver `yaml:"file"`
}
func (BinlogSaver) Validate ¶
func (s BinlogSaver) Validate() error
type Config ¶
type Config struct { App App `yaml:"app"` Database Database `yaml:"database"` SSH *SSH `yaml:"ssh"` Saver *BinlogSaver `yaml:"saver"` Publisher *Publisher `yaml:"publisher"` Logging Logging `yaml:"logging"` }
func DefaultConfig ¶
func DefaultConfig() *Config
func LoadConfig ¶
func (*Config) NewBinlogSyncer ¶
func (c *Config) NewBinlogSyncer(serverId int) (*replication.BinlogSyncer, error)
type Database ¶
type Database struct { Host string `yaml:"host"` Port int `yaml:"port" default:"3306"` Username string `yaml:"username"` Password string `yaml:"password"` DBName string `yaml:"name" default:"mysql"` SSHTunnel bool `yaml:"sshTunnel"` TLS *TLS `yaml:"tls"` MaxOpenConn int `yaml:"maxOpenConn" default:"10"` MaxLifeTimeSecond int `yaml:"maxLifeTimeSecond" default:"300"` MaxIdleConn int `yaml:"maxIdleConn" default:"1"` MaxIdleSecond int `yaml:"maxIdleSecond" default:"0"` }
type Logging ¶
type Logging struct { Level slog.Level `yaml:"level"` Handler logging.LoggingHandle `yaml:"handler" default:"text"` Sentry *logging.SentryConfig `yaml:"sentry"` Rollbar *logging.RollbarConfig `yaml:"rollbar"` // contains filtered or unexported fields }
type Outbox ¶
type Outbox struct { Config `yaml:",inline"` *TransformTable `yaml:"outbox"` }
func LoadOutboxConfig ¶
type OutboxPolling ¶
type OutboxPolling struct { Config `yaml:",inline"` OutboxConfig *OutboxPollingConfig `yaml:"outbox"` }
func LoadOutboxPollingConfig ¶
func LoadOutboxPollingConfig(filePath string) (*OutboxPolling, error)
func (OutboxPolling) Validate ¶
func (conf OutboxPolling) Validate() error
type OutboxPollingConfig ¶
type OutboxPollingConfig struct { TransformTable `yaml:",inline"` ProducerName string `yaml:"producerName"` MaxRetryCount int `yaml:"retryCount" default:"10"` PollingInterval time.Duration `yaml:"pollingInterval" default:"5s"` RetryBackOff time.Duration `yaml:"retryBackoff" default:"20s"` }
func (OutboxPollingConfig) Validate ¶
func (o OutboxPollingConfig) Validate() error
type Queue ¶
type Queue struct { QueueName string `yaml:"queueName"` QueueUrl string `yaml:"queueUrl"` MessageGroupIdTemplate string `yaml:"messageGroupIdTemplate"` TemplateType TemplateType `yaml:"templateType" default:"Fast"` Transform Transform `yaml:"transform"` }
func (*Queue) GetMessageGroupId ¶
type SNS ¶
type SNS struct { IEndpoint `yaml:",inline"` Topics []Topic `yaml:"topics"` // contains filtered or unexported fields }
func (*SNS) FindOutboxTopicArn ¶
type SQS ¶
type SQS struct { IEndpoint `yaml:",inline"` Queues []Queue `yaml:"queues"` // contains filtered or unexported fields }
func (*SQS) FindOutboxQueueUrl ¶
type SSH ¶
type SSH struct { PrivateKey string `yaml:"privateKey"` Host string `yaml:"host"` Port int `yaml:"port" default:"22"` Username string `yaml:"username"` HostKeyAlgorithms []string `yaml:"hostKeyAlgorithms" default:"[\"ssh-ed25519\"]"` KnownHosts string `yaml:"knownHosts"` }
func (*SSH) SetDefaults ¶
func (s *SSH) SetDefaults()
type TConfig ¶
type TConfig interface { Config | Outbox | OutboxPolling }
type TLS ¶
type TemplateType ¶
type TemplateType string
const ( GoTemplate TemplateType = TemplateType("Go") FastTemplate TemplateType = TemplateType("Fast") )
func (TemplateType) String ¶
func (typ TemplateType) String() string
type Topic ¶
type Topic struct { TopicArn string `yaml:"topicArn"` MessageGroupIdTemplate string `yaml:"messageGroupIdTemplate"` TemplateType TemplateType `yaml:"templateType" default:"Fast"` Transform Transform `yaml:"transform"` }
func (*Topic) GetMessageGroupId ¶
type Transform ¶
type Transform struct { Type TransformType `yaml:"type" default:"table"` Table *TransformTable `yaml:"table"` Column *TransformColumn `yaml:"column"` Outbox *TransformOutbox `yaml:"outbox"` }
type TransformColumn ¶
type TransformColumn struct { Table TransformTable `yaml:",inline"` ColumnName string `yaml:"columnName"` Value string `yaml:"value"` }
func (TransformColumn) Validate ¶
func (t TransformColumn) Validate() error
type TransformOutbox ¶
type TransformOutbox struct {
AggregateType string `yaml:"aggregateType"`
}
func (TransformOutbox) Validate ¶
func (t TransformOutbox) Validate() error
type TransformTable ¶
func (*TransformTable) IsEnabled ¶
func (t *TransformTable) IsEnabled(schema, tableName string) bool
func (TransformTable) Validate ¶
func (t TransformTable) Validate() error
type TransformType ¶
type TransformType string
const ( TableType TransformType = TransformType("table") ColumnType TransformType = TransformType("column") OutboxPatternType TransformType = TransformType("outbox") )
Click to show internal directories.
Click to hide internal directories.