Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEventDoesntHaveField = errors.New("event doesn't have field") ErrEventFieldHasWrongType = errors.New("event field has wrong type") )
View Source
var ErrEmptyTableName = errors.New("table name can't be empty string")
View Source
var ErrNoColumns = errors.New("no pg columns in config")
Functions ¶
Types ¶
type Config ¶
type Config struct {
//> @3@4@5@6
//>
//> In strict mode file.d will crash on events without required columns.
// Otherwise events will be discarded.
Strict bool `json:"strict" default:"false"` //*
//> @3@4@5@6
//>
//> DB host.
Host string `json:"host" required:"true"` //*
//> @3@4@5@6
//>
//> Db port.
Port uint16 `json:"port" required:"true"` //*
//> @3@4@5@6
//>
//> Dbname in pg.
DBName string `json:"dbname" required:"true"` //*
//> @3@4@5@6
//>
//> Pg user name.
Username string `json:"user" required:"true"` //*
//> @3@4@5@6
//>
//> Pg user pass.
Pass string `json:"password" required:"true"` //*
//> @3@4@5@6
//>
//> Pg target table.
Table string `json:"table" required:"true"` //*
//> @3@4@5@6
//>
//> Array of DB columns. Each column have:
//> name, type (int, string, timestamp - which int that will be converted to timestamptz of rfc3339)
//> and nullable options.
Columns []ConfigColumn `json:"columns" required:"true" slice:"true"` //*
//> @3@4@5@6
//>
//> Retries of insertion.
Retry int `json:"retry" default:"3"` //*
//> @3@4@5@6
//>
//> Retention milliseconds for retry to DB.
Retention cfg.Duration `json:"retention" default:"50ms" parse:"duration"` //*
Retention_ time.Duration
//> @3@4@5@6
//>
//> Timeout for DB requests in milliseconds.
DBRequestTimeout cfg.Duration `json:"db_request_timeout" default:"3000ms" parse:"duration"` //*
DBRequestTimeout_ time.Duration
//> @3@4@5@6
//>
//> How much workers will be instantiated to send batches.
WorkersCount cfg.Expression `json:"workers_count" default:"gomaxprocs*4" parse:"expression"` //*
WorkersCount_ int
//> @3@4@5@6
//>
//> Maximum quantity of events to pack into one batch.
BatchSize cfg.Expression `json:"batch_size" default:"capacity/4" parse:"expression"` //*
//BatchSize cfg.Expression `json:"batch_size" default:"capacity/4" parse:"expression"` //*
BatchSize_ int
//> @3@4@5@6
//>
//> After this timeout batch will be sent even if batch isn't completed.
BatchFlushTimeout cfg.Duration `json:"batch_flush_timeout" default:"200ms" parse:"duration"` //*
BatchFlushTimeout_ time.Duration
}
! config-params ^ config-params
type ConfigColumn ¶
type PgQueryBuilder ¶
type PgQueryBuilder interface {
GetPgFields() []column
GetUniqueFields() map[string]pgType
GetInsertBuilder() sq.InsertBuilder
GetPostfix() string
}
func NewQueryBuilder ¶
func NewQueryBuilder(cfgColumns []ConfigColumn, table string) (PgQueryBuilder, error)
NewQueryBuilder returns new instance of builder.
type PgxIface ¶
type PgxIface interface {
ExecEx(ctx context.Context, sql string, options *pgx.QueryExOptions, arguments ...interface{}) (commandTag pgx.CommandTag, err error)
Close()
}
Click to show internal directories.
Click to hide internal directories.