Documentation ¶
Index ¶
- Constants
- func NewMySQLDialector(cfg *DBConfig, connectionStr, driverName string) (gorm.Dialector, error)
- type Cassandra
- type CassandraCfg
- type Client
- func (c Client) AddField(ctx context.Context, collection string, document *bytes.Buffer) (interface{}, error)
- func (c Client) Create(ctx context.Context, collection string, document *bytes.Buffer, ...) (interface{}, error)
- func (c Client) Delete(ctx context.Context, collection string, document *bytes.Buffer, ...) (interface{}, error)
- func (c Client) DeleteField(ctx context.Context, collection string, document *bytes.Buffer) (interface{}, error)
- func (c Client) ListFields(ctx context.Context, collection string, params map[string]interface{}) (interface{}, error)
- func (c Client) Retrieve(ctx context.Context, collection string, params map[string]interface{}) (interface{}, error)
- func (c Client) Search(ctx context.Context, collection string, params map[string]interface{}) (interface{}, error)
- func (c Client) Update(ctx context.Context, collection string, document *bytes.Buffer, ...) (interface{}, error)
- func (c Client) UpdateField(ctx context.Context, collection string, document *bytes.Buffer) (interface{}, error)
- type DBConfig
- type DataStore
- func (ds *DataStore) CQLHealthCheck() types.Health
- func (ds *DataStore) DB() *SQLClient
- func (ds *DataStore) DynamoDBHealthCheck() types.Health
- func (ds *DataStore) ElasticsearchHealthCheck() types.Health
- func (ds *DataStore) GORM() *gorm.DB
- func (ds *DataStore) MongoHealthCheck() types.Health
- func (ds *DataStore) PubSubHealthCheck() types.Health
- func (ds *DataStore) RedisHealthCheck() types.Health
- func (ds *DataStore) SQLHealthCheck() types.Health
- func (ds *DataStore) SQLX() *sqlx.DB
- func (ds *DataStore) SQLXHealthCheck() types.Health
- func (ds *DataStore) SetORM(client interface{})
- func (ds *DataStore) YCQLHealthCheck() types.Health
- type Document
- type DynamoDB
- func (d *DynamoDB) DeleteItem(input *dynamodb.DeleteItemInput) (*dynamodb.DeleteItemOutput, error)
- func (d *DynamoDB) DeleteItemRequest(input *dynamodb.DeleteItemInput) (*Request, *dynamodb.DeleteItemOutput)
- func (d *DynamoDB) DeleteItemWithContext(ctx context.Context, input *dynamodb.DeleteItemInput) (*dynamodb.DeleteItemOutput, error)
- func (d *DynamoDB) GetItem(input *dynamodb.GetItemInput) (*dynamodb.GetItemOutput, error)
- func (d *DynamoDB) GetItemRequest(input *dynamodb.GetItemInput) (*Request, *dynamodb.GetItemOutput)
- func (d *DynamoDB) GetItemWithContext(ctx context.Context, input *dynamodb.GetItemInput) (*dynamodb.GetItemOutput, error)
- func (d *DynamoDB) HealthCheck() types.Health
- func (d *DynamoDB) PutItem(input *dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error)
- func (d *DynamoDB) PutItemRequest(input *dynamodb.PutItemInput) (*Request, *dynamodb.PutItemOutput)
- func (d *DynamoDB) PutItemWithContext(ctx context.Context, input *dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error)
- func (d *DynamoDB) UpdateItem(input *dynamodb.UpdateItemInput) (*dynamodb.UpdateItemOutput, error)
- func (d *DynamoDB) UpdateItemRequest(input *dynamodb.UpdateItemInput) (*Request, *dynamodb.UpdateItemOutput)
- func (d *DynamoDB) UpdateItemWithContext(ctx context.Context, input *dynamodb.UpdateItemInput) (*dynamodb.UpdateItemOutput, error)
- type DynamoDBConfig
- type ElasticSearchCfg
- type Elasticsearch
- func (e *Elasticsearch) Bind(res *esapi.Response, target interface{}) error
- func (e *Elasticsearch) BindArray(res *esapi.Response, target interface{}) error
- func (e *Elasticsearch) Body(res *esapi.Response) (map[string]interface{}, error)
- func (e *Elasticsearch) HealthCheck() types.Health
- func (e *Elasticsearch) Hits(res *esapi.Response) ([]interface{}, error)
- func (e *Elasticsearch) Ping() (*esapi.Response, error)
- type GORMClient
- type MongoConfig
- type MongoDB
- type QueryLogger
- func (l *QueryLogger) AfterProcess(_ context.Context, cmd goRedis.Cmder) error
- func (l *QueryLogger) AfterProcessPipeline(_ context.Context, cmds []goRedis.Cmder) error
- func (l *QueryLogger) BeforeProcess(ctx context.Context, _ goRedis.Cmder) (context.Context, error)
- func (l *QueryLogger) BeforeProcessPipeline(ctx context.Context, _ []goRedis.Cmder) (context.Context, error)
- func (l QueryLogger) ObserveBatch(_ context.Context, b gocql.ObservedBatch)
- func (l QueryLogger) ObserveQuery(_ context.Context, o gocql.ObservedQuery)
- func (l *QueryLogger) String() string
- type Redis
- type RedisConfig
- type Request
- type Response
- type SQLClient
- func (c *SQLClient) Begin() (*SQLTx, error)
- func (c *SQLClient) BeginTx(ctx context.Context, opts *sql.TxOptions) (*SQLTx, error)
- func (c *SQLClient) Exec(query string, args ...interface{}) (sql.Result, error)
- func (c *SQLClient) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (c *SQLClient) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (c *SQLClient) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (c *SQLClient) QueryRow(query string, args ...interface{}) *sql.Row
- func (c *SQLClient) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- type SQLTx
- func (c *SQLTx) Commit() error
- func (c *SQLTx) Exec(query string, args ...interface{}) (sql.Result, error)
- func (c *SQLTx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (c *SQLTx) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (c *SQLTx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (c *SQLTx) QueryRow(query string, args ...interface{}) *sql.Row
- func (c *SQLTx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- type SQLXClient
- type Schema
- type Seeder
- func (d *Seeder) AssertRowCount(t tester, tableName string, count int)
- func (d *Seeder) AssertVersion(t tester, version string)
- func (d *Seeder) ClearTable(t tester, tableName string)
- func (d *Seeder) RefreshCassandra(t tester, tableNames ...string)
- func (d *Seeder) RefreshDynamoDB(t tester, tableNames ...string)
- func (d *Seeder) RefreshElasticSearch(t tester, indexes ...string)
- func (d *Seeder) RefreshMongoCollections(t tester, collectionNames ...string)
- func (d *Seeder) RefreshRedis(t tester, tableNames ...string)
- func (d *Seeder) RefreshTables(t tester, tableNames ...string)
- func (d *Seeder) RefreshYCQL(t tester, tableNames ...string)
- type YCQL
Constants ¶
const ( MongoStore = "mongo" RedisStore = "redis" CassandraStore = "cassandra" SqlStore = "sql" Kafka = "kafka" EventBridge = "eventbridge" ElasticSearch = "elasticsearch" Ycql = "ycql" EventHub = "eventhub" DynamoDb = "dynamoDB" AWSSNS = "aws-sns" Avro = "avro" GooglePubSub = "google" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cassandra ¶
type Cassandra struct { Cluster *gocql.ClusterConfig Session *gocql.Session // contains filtered or unexported fields }
Cassandra stores information about the Cassandra cluster and open sessions
func GetNewCassandra ¶
func GetNewCassandra(logger log.Logger, cassandraCfg *CassandraCfg) (Cassandra, error)
GetNewCassandra creates and opens a connection to the cassandra cluster
func (*Cassandra) HealthCheck ¶
HealthCheck returns the health of Cassandra
type CassandraCfg ¶
type CassandraCfg struct { Hosts string Consistency string Username string Password string Keyspace string RetryPolicy gocql.RetryPolicy CertificateFile string KeyFile string RootCertificateFile string DataCenter string Port int Timeout int ConnectTimeout int ConnRetryDuration int TLSVersion uint16 HostVerification bool InsecureSkipVerify bool }
CassandraCfg holds the configurations for Cassandra Connectivity
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the methods to create update search and delete documents It also implements methods to retrieve, create, update and delete fields in schema
func NewSolrClient ¶
NewSolrClient returns a client to support basic solr functionality
func (Client) AddField ¶
func (c Client) AddField(ctx context.Context, collection string, document *bytes.Buffer) (interface{}, error)
AddField adds Field in the schema for the specified collection
func (Client) Create ¶
func (c Client) Create(ctx context.Context, collection string, document *bytes.Buffer, params map[string]interface{}) (interface{}, error)
Create makes documents in the specified collection. params can be used to send parameters like commit=true
func (Client) Delete ¶
func (c Client) Delete(ctx context.Context, collection string, document *bytes.Buffer, params map[string]interface{}) (interface{}, error)
Create deletes documents in the specified collection. params can be used to send parameters like commit=true
func (Client) DeleteField ¶
func (c Client) DeleteField(ctx context.Context, collection string, document *bytes.Buffer) (interface{}, error)
DeleteField deletes the field definitions in the schema for the specified collection
func (Client) ListFields ¶
func (c Client) ListFields(ctx context.Context, collection string, params map[string]interface{}) (interface{}, error)
ListFields retrieves all the fields in the schema for the specified collection. params can be used to send query parameters like wt, fl, includeDynamic etc.
func (Client) Retrieve ¶
func (c Client) Retrieve(ctx context.Context, collection string, params map[string]interface{}) (interface{}, error)
Retrieve retrieves the entire schema that includes all the fields,field types,dynamic rules and copy field rules. params can be used to specify the format of response
func (Client) Search ¶
func (c Client) Search(ctx context.Context, collection string, params map[string]interface{}) (interface{}, error)
Search searches documents in the given collections based on the parameters specified. This can be used for making any queries to SOLR
type DBConfig ¶
type DBConfig struct { HostName string Username string Password string Database string Port string Dialect string // supported dialects are - mysql, mssql, sqlite, postgres // postgres and mysql related config only, accepts disable, allow, prefer, require, // verify-ca and verify-full; default is disable SSL string ORM string CertificateFile string KeyFile string ConnRetryDuration int MaxOpenConn int MaxIdleConn int MaxConnLife int CACertificateFile string }
DBConfig stores the config variables required to connect to a supported database
type DataStore ¶
type DataStore struct { Logger log.Logger MongoDB MongoDB Redis Redis ORM interface{} Cassandra Cassandra YCQL YCQL PubSub pubsub.PublisherSubscriber Solr Client Elasticsearch Elasticsearch DynamoDB DynamoDB // contains filtered or unexported fields }
DataStore represents a database connection pool for various types of databases
func (*DataStore) CQLHealthCheck ¶
CQLHealthCheck performs a query operation on the cql instance. If the operation does not return an error, the healthCheck status will be set to UP, else the healthCheck status will be DOWN.
func (*DataStore) DynamoDBHealthCheck ¶
DynamoDBHealthCheck executes a ListTable API operation. If the returned error is not nil, the healthCheck status will be set to DOWN, else the healthCheck status will be UP
func (*DataStore) ElasticsearchHealthCheck ¶
ElasticsearchHealthCheck pings the Elasticsearch instance. If the ping does not return an error, the healthCheck status will be set to UP, else the healthCheck status will be DOWN
func (*DataStore) GORM ¶
GORM returns a GORM database instance, initializing it if necessary, based on the DataStore's internal state and ORM interface.
func (*DataStore) MongoHealthCheck ¶
MongoHealthCheck pings the MongoDB instance. If the ping does not return an error, the healthCheck status will be set to UP, else the healthCheck status will be DOWN.
func (*DataStore) PubSubHealthCheck ¶
PubSubHealthCheck pings the pubsub instance. If the ping does not return an error, the healthCheck status will be set to UP, else the healthCheck status will be DOWN
func (*DataStore) RedisHealthCheck ¶
RedisHealthCheck pings the redis instance. If the ping does not return an error, the healthCheck status will be set to UP, else the healthCheck status will be DOWN
func (*DataStore) SQLHealthCheck ¶
SQLHealthCheck pings the sql instance. If the ping does not return an error, the healthCheck status will be set to UP, else the healthCheck status will be DOWN
func (*DataStore) SQLXHealthCheck ¶
SQLXHealthCheck pings the sqlx instance. If the ping does not return an error, the healthCheck status will be set to UP, else the healthCheck status will be DOWN.
func (*DataStore) SetORM ¶
func (ds *DataStore) SetORM(client interface{})
SetORM sets the ORM based on GORM or SQLX
func (*DataStore) YCQLHealthCheck ¶
YCQLHealthCheck performs a query operation on the ycql instance. If the operation does not return an error, the healthCheck status will be set to UP, else the healthCheck status will be DOWN.
type Document ¶
type Document interface { Search(ctx context.Context, collection string, params map[string]interface{}) (interface{}, error) Create(ctx context.Context, collection string, document *bytes.Buffer, params map[string]interface{}) (interface{}, error) Update(ctx context.Context, collection string, document *bytes.Buffer, params map[string]interface{}) (interface{}, error) Delete(ctx context.Context, collection string, document *bytes.Buffer, params map[string]interface{}) (interface{}, error) }
Document is an interface for managing document-related operations in Solr.
type DynamoDB ¶
DynamoDB stores the DynamoDB Client along with logger ad configs to connect to DynamoDB Database.
func NewDynamoDB ¶
func NewDynamoDB(logger log.Logger, c DynamoDBConfig) (DynamoDB, error)
NewDynamoDB connects to DynamoDB and returns the connection
func (*DynamoDB) DeleteItem ¶
func (d *DynamoDB) DeleteItem(input *dynamodb.DeleteItemInput) (*dynamodb.DeleteItemOutput, error)
DeleteItem Deletes a single item in a table by primary key.It records start time, executes the operation, and logs query details. It returns the output of deleted item and error if any.
func (*DynamoDB) DeleteItemRequest ¶
func (d *DynamoDB) DeleteItemRequest(input *dynamodb.DeleteItemInput) (*Request, *dynamodb.DeleteItemOutput)
DeleteItemRequest generates a request representing the client's request for the DeleteItem operation. It returns the request and Delete Item output which will be populated once the request is completed successfully.
func (*DynamoDB) DeleteItemWithContext ¶
func (d *DynamoDB) DeleteItemWithContext(ctx context.Context, input *dynamodb.DeleteItemInput) (*dynamodb.DeleteItemOutput, error)
DeleteItemWithContext Deletes a single item in a table by primary key with the addition of the ability to pass a context and additional request options.It records start time, executes the operation, and logs query details.
func (*DynamoDB) GetItem ¶
func (d *DynamoDB) GetItem(input *dynamodb.GetItemInput) (*dynamodb.GetItemOutput, error)
GetItem returns a set of attributes for the item with the given primary key and monitors query duration It returns the DynamoDB item and error if any.
func (*DynamoDB) GetItemRequest ¶
func (d *DynamoDB) GetItemRequest(input *dynamodb.GetItemInput) (*Request, *dynamodb.GetItemOutput)
GetItemRequest generates a request representing the client's request for the GetItem operation in DynamoDB. It also generates a query logger to monitor the query. Returns the request and DynamoDB output which will be populated once the request is completed successfully for GetItem.
func (*DynamoDB) GetItemWithContext ¶
func (d *DynamoDB) GetItemWithContext(ctx context.Context, input *dynamodb.GetItemInput) (*dynamodb.GetItemOutput, error)
GetItemWithContext returns a set of attributes for the item with the given primary key and monitors query duration with the addition of the ability to pass a context and additional request options. It returns the DynamoDB item and error if any.
func (*DynamoDB) HealthCheck ¶
HealthCheck checks health of the Dya
func (*DynamoDB) PutItem ¶
func (d *DynamoDB) PutItem(input *dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error)
PutItem adds an item to DynamoDB and monitors the query duration. It records start time, executes the operation, and logs query details.
func (*DynamoDB) PutItemRequest ¶
func (d *DynamoDB) PutItemRequest(input *dynamodb.PutItemInput) (*Request, *dynamodb.PutItemOutput)
PutItemRequest generates a request representing the client's request for the PutItem operation in DynamoDB. It also generates a query logger to monitor the query. Returns the request and DynamoDB output which will be populated once the request is completed successfully for PutItem.
func (*DynamoDB) PutItemWithContext ¶
func (d *DynamoDB) PutItemWithContext(ctx context.Context, input *dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error)
PutItemWithContext adds an item to DynamoDB and monitors the query duration. It records start time, executes the operation, and logs query details with the addition of the ability to pass a context and additional request options.
func (*DynamoDB) UpdateItem ¶
func (d *DynamoDB) UpdateItem(input *dynamodb.UpdateItemInput) (*dynamodb.UpdateItemOutput, error)
UpdateItem Edits an existing item's attributes, or adds a new item to the table if it does not already exist. It records start time, executes the operation, and logs query details. It returns Update Item output and error if any.
func (*DynamoDB) UpdateItemRequest ¶
func (d *DynamoDB) UpdateItemRequest(input *dynamodb.UpdateItemInput) (*Request, *dynamodb.UpdateItemOutput)
UpdateItemRequest generates a request representing the client's request for the UpdateItem operation. It also generates a query logger to monitor the query. Returns update request and Update Item output value will be populated with the request's response once the request completes successfully.
func (*DynamoDB) UpdateItemWithContext ¶
func (d *DynamoDB) UpdateItemWithContext(ctx context.Context, input *dynamodb.UpdateItemInput) (*dynamodb.UpdateItemOutput, error)
UpdateItemWithContext Edits an existing item's attributes, or adds a new item to the table if it does not already exist with the addition of the ability to pass a context and additional request options. It also generates a query logger to monitor the query. Returns update request and Update Item output value will be populated with the request's response once the request completes successfully.
type DynamoDBConfig ¶
type DynamoDBConfig struct { Region string Endpoint string AccessKeyID string SecretAccessKey string ConnRetryDuration int }
DynamoDBConfig configuration for DynamoDB connection
type ElasticSearchCfg ¶
type ElasticSearchCfg struct { Host string Ports []int Username string Password string CloudID string ConnectionRetryDuration int }
ElasticSearchCfg stores the configuration parameters required to connect to Elasticsearch.
type Elasticsearch ¶
type Elasticsearch struct { *elasticsearch.Client // contains filtered or unexported fields }
Elasticsearch stores the elasticSearch client along with logger and configs to connect to ElasticSearch DB.
func NewElasticsearchClient ¶
func NewElasticsearchClient(logger log.Logger, c *ElasticSearchCfg) (Elasticsearch, error)
NewElasticsearchClient factory function for Elasticsearch
func (*Elasticsearch) Bind ¶
func (e *Elasticsearch) Bind(res *esapi.Response, target interface{}) error
Bind binds the response returned by the elasticsearch client to target(should not be array)
func (*Elasticsearch) BindArray ¶
func (e *Elasticsearch) BindArray(res *esapi.Response, target interface{}) error
BindArray binds the response returned by the elasticsearch client to target(should be array)
func (*Elasticsearch) Body ¶
func (e *Elasticsearch) Body(res *esapi.Response) (map[string]interface{}, error)
Body retrieves body from the response which returned by elasticsearch client
func (*Elasticsearch) HealthCheck ¶
func (e *Elasticsearch) HealthCheck() types.Health
HealthCheck return the Health of the elastic search client
type GORMClient ¶
GORMClient stores a GORM database client along with logger and configs to connect to GORM DB.
func NewORM ¶
func NewORM(cfg *DBConfig) (GORMClient, error)
NewORM returns a new ORM object if the config is correct, otherwise it returns the error thrown
func NewORMFromEnv ¶
func NewORMFromEnv() (GORMClient, error)
NewORMFromEnv fetches the config from environment variables and returns a new ORM object if the config was correct, otherwise returns the thrown error Deprecated: Instead use datastore.NewORM
func (GORMClient) HealthCheck ¶
func (c GORMClient) HealthCheck() types.Health
HealthCheck pings the sql instance in gorm. If the ping does not return an error, the healthCheck status will be set to UP, else the healthCheck status will be DOWN
type MongoConfig ¶
type MongoConfig struct { HostName string Port string Username string Password string Database string SSL bool RetryWrites bool ConnRetryDuration int }
MongoConfig holds the configurations for MongoDB Connectivity
type MongoDB ¶
type MongoDB interface { Collection(name string, opts ...*options.CollectionOptions) *mongo.Collection Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (*mongo.Cursor, error) RunCommand(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions) *mongo.SingleResult RunCommandCursor(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions) (*mongo.Cursor, error) HealthCheck() types.Health IsSet() bool }
MongoDB is an interface for accessing the base functionality
func GetMongoDBFromEnv ¶
GetMongoDBFromEnv returns client to connect to MongoDB using configuration from environment variables Deprecated: Instead use datastore.GetNewMongoDB
func GetNewMongoDB ¶
func GetNewMongoDB(logger log.Logger, config *MongoConfig) (MongoDB, error)
GetNewMongoDB connects to MongoDB and returns the connection with the specified database in the configuration
type QueryLogger ¶
type QueryLogger struct { Hosts string `json:"host,omitempty"` Query []string `json:"query"` Duration int64 `json:"duration"` StartTime time.Time `json:"-"` Logger log.Logger `json:"-"` DataStore string `json:"datastore"` }
QueryLogger represents a structure to log database queries.
func (*QueryLogger) AfterProcess ¶
AfterProcess sets the metrics such as endTime, duration after the completion of the process
func (*QueryLogger) AfterProcessPipeline ¶
AfterProcessPipeline sets the metrics such as endTime, duration after the completion of the process
func (*QueryLogger) BeforeProcess ¶
BeforeProcess sets the start time in the context and returns it.
func (*QueryLogger) BeforeProcessPipeline ¶
func (l *QueryLogger) BeforeProcessPipeline(ctx context.Context, _ []goRedis.Cmder) (context.Context, error)
BeforeProcessPipeline sets the start time for slice of redis.Cmder in the context and returns it.
func (QueryLogger) ObserveBatch ¶
func (l QueryLogger) ObserveBatch(_ context.Context, b gocql.ObservedBatch)
ObserveBatch monitors the connection in a particular fixed batch
func (QueryLogger) ObserveQuery ¶
func (l QueryLogger) ObserveQuery(_ context.Context, o gocql.ObservedQuery)
ObserveQuery monitors the query that is sent.
func (*QueryLogger) String ¶
func (l *QueryLogger) String() string
type Redis ¶
type Redis interface { goRedis.UniversalClient HealthCheck() types.Health IsSet() bool }
Redis is an abstraction that embeds the UniversalClient from go-redis/redis
func NewRedis ¶
func NewRedis(logger log.Logger, config RedisConfig) (Redis, error)
NewRedis connects to Redis if the given config is correct, otherwise returns the error
func NewRedisCluster ¶
func NewRedisCluster(clusterOptions *goRedis.ClusterOptions) (Redis, error)
NewRedisCluster returns a new Redis cluster client object if the given config is correct, otherwise returns the error
type RedisConfig ¶
type RedisConfig struct { HostName string Password string Port string DB int SSL bool ConnectionRetryDuration int Options *goRedis.Options }
RedisConfig stores the config variables required to connect to Redis, if Options is nil, then the Redis client will import the default configuration as defined in go-redis/redis. User defined config can be provided by populating the Options field.
type Request ¶
Request stores an HTTP service request along with a DB QueryLogger to monitor the duration and execution plan of database queries.
type Response ¶
type Response struct { Code int Data interface{} }
Response stores the response from SOLR
type SQLClient ¶
SQLClient stores a SQL database client along with logger and configs to connect to SQL DB.
func (*SQLClient) Begin ¶
Begin starts a transaction. The default isolation level is dependent on the driver.
func (*SQLClient) Exec ¶
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.
func (*SQLClient) ExecContext ¶
func (c *SQLClient) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
ExecContext executes a query without returning any rows. The args are for any placeholder parameters in the query.
func (*SQLClient) Query ¶
Query executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query.
func (*SQLClient) QueryContext ¶
func (c *SQLClient) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryContext executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query.
func (*SQLClient) QueryRow ¶
QueryRow executes a query that is expected to return at most one row. QueryRow always returns a non-nil value. Errors are deferred until Row's Scan method is called.
func (*SQLClient) QueryRowContext ¶
func (c *SQLClient) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
QueryRowContext executes a query that is expected to return at most one row. QueryRowContext always returns a non-nil value. Errors are deferred until Row's Scan method is called.
type SQLTx ¶
SQLTx represents a SQL Transaction.
func (*SQLTx) ExecContext ¶
func (c *SQLTx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
ExecContext executes a query that doesn't return rows.
func (*SQLTx) QueryContext ¶
func (c *SQLTx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryContext executes a query that returns rows, typically a SELECT.
func (*SQLTx) QueryRow ¶
QueryRow executes a query that is expected to return at most one row. QueryRow always returns a non-nil value. Errors are deferred until Row's Scan method is called.
func (*SQLTx) QueryRowContext ¶
QueryRowContext executes a query that is expected to return at most one row. QueryRowContext always returns a non-nil value. Errors are deferred until Row's Scan method is called.
type SQLXClient ¶
SQLXClient stores a SQLX database client along with logger to connect to SQL DB.
func NewSQLX ¶
func NewSQLX(cfg *DBConfig) (SQLXClient, error)
NewSQLX returns a new sqlx.DB object if the given config is correct, otherwise throws an error
func (SQLXClient) HealthCheck ¶
func (c SQLXClient) HealthCheck() types.Health
HealthCheck pings the sqlx instance in gorm. If the ping does not return an error, the healthCheck status will be set to UP, else the healthCheck status will be DOWN
type Schema ¶
type Schema interface { Retrieve(ctx context.Context, collection string, params map[string]interface{}) (interface{}, error) ListFields(ctx context.Context, collection string, params map[string]interface{}) (interface{}, error) AddField(ctx context.Context, collection string, document *bytes.Buffer) (interface{}, error) UpdateField(ctx context.Context, collection string, document *bytes.Buffer) (interface{}, error) DeleteField(ctx context.Context, collection string, document *bytes.Buffer) (interface{}, error) }
Schema is an interface for managing schema-related operations in Solr.
type Seeder ¶
Seeder represents a seeder for seeding data into database.
func NewSeeder ¶
NewSeeder creates a new Seeder instance. It accepts a database DataStore and the directory path for data seeding.
func (*Seeder) AssertRowCount ¶
AssertRowCount checks if the records expected are equal to the records retrieved
func (*Seeder) AssertVersion ¶
AssertVersion checks if the version is valid or not
func (*Seeder) ClearTable ¶
ClearTable clears a particular table
func (*Seeder) RefreshCassandra ¶
RefreshCassandra refreshes the Cassandra index and inserts data from the .csv file
func (*Seeder) RefreshDynamoDB ¶
RefreshDynamoDB refreshes the DynamoDB state.
func (*Seeder) RefreshElasticSearch ¶
RefreshElasticSearch refreshes the elastic search index and inserts data from the .csv file
func (*Seeder) RefreshMongoCollections ¶
RefreshMongoCollections refreshes the Mongo index and inserts data from the .csv file
func (*Seeder) RefreshRedis ¶
RefreshRedis refreshes the redis index and inserts data from the .csv file
func (*Seeder) RefreshTables ¶
RefreshTables The function will first clear the tables and then populate it with the test data for each table. The tables will have to be passed in the reverse order in which the dependency flows,i.e, the child first and then the parent
func (*Seeder) RefreshYCQL ¶
RefreshYCQL refreshes the YCQL index and inserts data from the .csv file
type YCQL ¶
type YCQL struct { Cluster *gocql.ClusterConfig Session *gocql.Session // contains filtered or unexported fields }
YCQL stores information about the YugabyteDB(CQL) cluster and open sessions
func GetNewYCQL ¶
func GetNewYCQL(logger log.Logger, config *CassandraCfg) (YCQL, error)
GetNewYCQL creates and opens a connection to the NewYCQL cluster func GetNewYCQL(logger log.Logger, config *CassandraCfg) (YCQL, error) {
func (*YCQL) HealthCheck ¶
HealthCheck returns the health of the YCQL
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package pubsub implements the necessary methods and types to work with publish-subscribe messaging patterns.
|
Package pubsub implements the necessary methods and types to work with publish-subscribe messaging patterns. |
avro
Package avro provides implementation methods for working with avro to serialize and deserialize messages.
|
Package avro provides implementation methods for working with avro to serialize and deserialize messages. |
eventbridge
Package eventbridge provides methods to interact with AWS Eventbridge service allowing user to publish events to Eventbridge
|
Package eventbridge provides methods to interact with AWS Eventbridge service allowing user to publish events to Eventbridge |
eventhub
Package eventhub provides methods to interact, publish and consume events from Azure Eventhub
|
Package eventhub provides methods to interact, publish and consume events from Azure Eventhub |
google
Package google provides methods to work with Google Cloud Pub/Sub enabling the publishing and consumption of messages.
|
Package google provides methods to work with Google Cloud Pub/Sub enabling the publishing and consumption of messages. |
kafka
Package kafka provides methods to interact with Apache Kafka offering functionality for both producing and consuming messages from kafka-topics.
|
Package kafka provides methods to interact with Apache Kafka offering functionality for both producing and consuming messages from kafka-topics. |