{"modulePath":"github.com/ozontech/file.d","version":"v0.88.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package postgres\n\n## Variables\n\n```go\nvar (\n\tErrEventDoesntHaveField             = errors.New(\"event doesn't have field\")\n\tErrEventFieldHasWrongType           = errors.New(\"event field has wrong type\")\n\tErrTimestampFromDistantPastOrFuture = errors.New(\"event field contains timestamp \u003c 1970 or \u003e 9000 year\")\n)\n```\n\n```go\nvar ErrEmptyTableName = errors.New(\"table name can't be empty string\")\n```\n\n```go\nvar ErrNoColumns = errors.New(\"no pg columns in config\")\n```\n\n## Functions\n\n```go\nfunc Factory() (pipeline.AnyPlugin, pipeline.AnyConfig)\n```\n\n## Types\n\n```go\ntype Config struct {\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e Deprecated. Use `strict_fields` flag instead.\n\tStrict bool `json:\"strict\" default:\"false\"` // *\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e In strict mode file.d will crash on events without required fields.\n\t// Otherwise, events will be discarded.\n\tStrictFields bool `json:\"strict_fields\" default:\"false\"` // *\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e PostgreSQL connection string in URL or DSN format.\n\t// \u003e\n\t// \u003e Example DSN:\n\t// \u003e\n\t// \u003e `user=user password=secret host=pg.example.com port=5432 dbname=mydb sslmode=disable pool_max_conns=10`\n\tConnString string `json:\"conn_string\" required:\"true\"` // *\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e Pg target table.\n\tTable string `json:\"table\" required:\"true\"` // *\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e Array of DB columns. Each column have:\n\t// \u003e name, type (int, string, timestamp - which int that will be converted to timestamptz of rfc3339)\n\t// \u003e and nullable options.\n\tColumns []ConfigColumn `json:\"columns\" required:\"true\" slice:\"true\"` // *\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e Retries of insertion. If File.d cannot insert for this number of attempts,\n\t// \u003e File.d will fall with non-zero exit code or skip message (see fatal_on_failed_insert).\n\tRetry int `json:\"retry\" default:\"10\"` // *\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e After an insert error, fall with a non-zero exit code or not. A configured deadqueue disables fatal exits.\n\tFatalOnFailedInsert bool `json:\"fatal_on_failed_insert\" default:\"false\"` // *\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e Retention milliseconds for retry to DB.\n\tRetention  cfg.Duration `json:\"retention\" default:\"50ms\" parse:\"duration\"` // *\n\tRetention_ time.Duration\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e Multiplier for exponential increase of retention between retries\n\tRetentionExponentMultiplier int `json:\"retention_exponentially_multiplier\" default:\"2\"`\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e Timeout for DB requests in milliseconds.\n\tDBRequestTimeout  cfg.Duration `json:\"db_request_timeout\" default:\"3000ms\" parse:\"duration\"` // *\n\tDBRequestTimeout_ time.Duration\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e Timeout for DB health check.\n\tDBHealthCheckPeriod  cfg.Duration `json:\"db_health_check_period\" default:\"60s\" parse:\"duration\"` // *\n\tDBHealthCheckPeriod_ time.Duration\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e How much workers will be instantiated to send batches.\n\tWorkersCount  cfg.Expression `json:\"workers_count\" default:\"gomaxprocs*4\" parse:\"expression\"` // *\n\tWorkersCount_ int\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e Maximum quantity of events to pack into one batch.\n\tBatchSize cfg.Expression `json:\"batch_size\" default:\"capacity/4\"  parse:\"expression\"` // *\n\t// BatchSize  cfg.Expression `json:\"batch_size\" default:\"capacity/4\" parse:\"expression\"` // *\n\tBatchSize_ int\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e A minimum size of events in a batch to send.\n\t// \u003e If both batch_size and batch_size_bytes are set, they will work together.\n\tBatchSizeBytes  cfg.Expression `json:\"batch_size_bytes\" default:\"0\" parse:\"expression\"` // *\n\tBatchSizeBytes_ int\n\n\t// \u003e @3@4@5@6\n\t// \u003e\n\t// \u003e After this timeout batch will be sent even if batch isn't completed.\n\tBatchFlushTimeout  cfg.Duration `json:\"batch_flush_timeout\" default:\"200ms\" parse:\"duration\"` // *\n\tBatchFlushTimeout_ time.Duration\n}\n```\n! config-params ^ config-params\n\n```go\ntype ConfigColumn struct {\n\tName       string `json:\"name\" required:\"true\"`\n\tColumnType string `json:\"type\" required:\"true\" options:\"int|string|bool|timestamp\"`\n\tUnique     bool   `json:\"unique\" default:\"false\"`\n}\n```\n\n```go\ntype PgQueryBuilder interface {\n\tGetPgFields() []column\n\tGetUniqueFields() map[string]pgType\n\tGetInsertBuilder() sq.InsertBuilder\n\tGetPostfix() string\n}\n```\n\n```go\nfunc NewQueryBuilder(cfgColumns []ConfigColumn, table string) (PgQueryBuilder, error)\n```\nNewQueryBuilder returns new instance of builder.\n\n```go\ntype PgxIface interface {\n\tQuery(ctx context.Context, sql string, args ...any) (pgx.Rows, error)\n\tClose()\n}\n```\n\n```go\ntype Plugin struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (p *Plugin) Out(event *pipeline.Event)\n```\n\n```go\nfunc (p *Plugin) Start(config pipeline.AnyConfig, params *pipeline.OutputPluginParams)\n```\n\n```go\nfunc (p *Plugin) Stop()\n```\n\n","path":"github.com/ozontech/file.d/plugin/output/postgres","name":"postgres","synopsis":"","isRedistributable":true}
