Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrConnClosed when Gob.Upsert is called after closing the connection ErrConnClosed = errors.New("gob: conn closed;") // ErrEmptyModel when Gob.Upsert is called with empty model ErrEmptyModel = errors.New("gob: empty model;") // ErrEmptykeys when Gob.Upsert is called with empty keys ErrEmptykeys = errors.New("gob: empty keys;") // ErrEmptyKeyspace when keyspace is not provided in DB URL ErrEmptyKeyspace = errors.New("gob: empty keyspace;") // ErrEmptyConnStr when connection string is empty ErrEmptyConnStr = errors.New("gob: empty connection string;") // ErrEmptyDBProvider when db provider is empty ErrEmptyDBProvider = errors.New("gob: empty db provider;") // ErrEmptyConflictAction when conflict action not specified ErrEmptyConflictAction = errors.New("gob: empty conflict action;") )
Functions ¶
This section is empty.
Types ¶
type ConflictAction ¶
type ConflictAction string
ConflictAction specifies alternatives ON CONFLICT
const ( // ConflictActionNothing ignores conflict during INSERT ConflictActionNothing ConflictAction = "nothing" // ConflictActionUpdate resolves conflict by updating the row ConflictActionUpdate ConflictAction = "update" )
type DBProvider ¶
type DBProvider string
DBProvider for storage
const ( // DBProviderPg indicates relational database prvoided by PostgreSQL DBProviderPg DBProvider = "pg" // DBProviderMySQL indicates relational database provided by MySQL DBProviderMySQL DBProvider = "mysql" // DBProviderCassandra indicates no-sql database provided by Cassandra DBProviderCassandra DBProvider = "cassandra" )
type Gob ¶
type Gob struct {
// contains filtered or unexported fields
}
Gob provides APIs to upsert data in bulk
type Option ¶
Option to customize Gob
func WithBatchSize ¶
WithBatchSize sets batchSize of Gob to size
func WithConnIdleTime ¶
WithConnIdleTime sets maximum amount of time conn may be idle
func WithConnLifeTime ¶
WithConnLifeTime sets maximum amount of time conn may be reused
func WithDBConnStr ¶
WithDBConnStr sets database conn string
func WithDBProvider ¶
func WithDBProvider(provider DBProvider) Option
WithDBProvider sets provider of database to upsert rows
func WithIdleConns ¶
WithIdleConns sets maximum number of connections idle in pool
func WithOpenConns ¶
WithOpenConns sets maximum number of connections open to database
type UpsertArgs ¶
type UpsertArgs struct { ConflictAction // ON CONFLICT action Keys []string // indicate index column names Model string // table name Rows []Row // rows to be upserted // contains filtered or unexported fields }
UpsertArgs to upsert rows
Click to show internal directories.
Click to hide internal directories.