README

prom

Go Report Card PkgGoDev Actions Status codecov Release

Utility library to manage shared connections in Go.

Documentation

License

MIT - see LICENSE.md.

Documentation

Overview

    Package prom provides helpers to manage shared connections in Golang.

    Documentation: see project's GitHub (https://godoc.org/github.com/btnguyen2k/prom)

    Index

    Constants

    View Source
    const (
    	// AwsDynamodbNoIndex indicates that no index will be used
    	AwsDynamodbNoIndex = ""
    
    	// AwsAttrTypeString is alias name of AWS DynamoDB attribute type "string"
    	AwsAttrTypeString = "S"
    
    	// AwsAttrTypeNumber is alias name of AWS DynamoDB attribute type "number"
    	AwsAttrTypeNumber = "N"
    
    	// AwsAttrTypeBinary is alias name of AWS DynamoDB attribute type "binary"
    	AwsAttrTypeBinary = "B"
    
    	// AwsKeyTypePartition is alias name of AWS DynamoDB key type "partition"
    	AwsKeyTypePartition = "HASH"
    
    	// AwsKeyTypeSort is alias name of AWS DynamoDB key type "sort/range"
    	AwsKeyTypeSort = "RANGE"
    )
    View Source
    const (
    	// Version of prom
    	Version = "0.2.11"
    )

    Variables

    This section is empty.

    Functions

    func AwsDynamodbEqualsBuilder

    func AwsDynamodbEqualsBuilder(condition map[string]interface{}) *expression.ConditionBuilder

      AwsDynamodbEqualsBuilder builds a expression.ConditionBuilder with condition attr1=value1 AND attr1=value1 AND...

      Parameters:

      - condition: format {attribute-name:attribute-value}
      

      func AwsDynamodbExistsAllBuilder

      func AwsDynamodbExistsAllBuilder(attrs []string) *expression.ConditionBuilder

        AwsDynamodbExistsAllBuilder builds a expression.ConditionBuilder where all attributes must exist.

        func AwsDynamodbNotExistsAllBuilder

        func AwsDynamodbNotExistsAllBuilder(attrs []string) *expression.ConditionBuilder

          AwsDynamodbNotExistsAllBuilder builds a expression.ConditionBuilder where all attributes must not exist.

          func AwsDynamodbToAttributeSet

          func AwsDynamodbToAttributeSet(v interface{}) *dynamodb.AttributeValue

            AwsDynamodbToAttributeSet converts a Go value to DynamoDB's set.

            func AwsDynamodbToAttributeValue

            func AwsDynamodbToAttributeValue(v interface{}) *dynamodb.AttributeValue

              AwsDynamodbToAttributeValue converts a Go value to DynamoDB's attribute value.

              func AwsIgnoreErrorIfMatched

              func AwsIgnoreErrorIfMatched(err error, excludeCode string) error

                AwsIgnoreErrorIfMatched returns nil if err is an awserr.Error and its code equals to excludeCode.

                func IsAwsError

                func IsAwsError(err error, awsErrCode string) bool

                  IsAwsError returns true if err is an awserr.Error and its code equals to awsErrCode.

                  Available: since v0.2.5

                  Types

                  type AwsDynamodbConnect

                  type AwsDynamodbConnect struct {
                  	// contains filtered or unexported fields
                  }

                    AwsDynamodbConnect holds a AWS DynamoDB client (https://github.com/aws/aws-sdk-go/tree/master/service/dynamodb) that can be shared within the application.

                    func NewAwsDynamodbConnect

                    func NewAwsDynamodbConnect(cfg *aws.Config, sess *session.Session, db *dynamodb.DynamoDB, defaultTimeoutMs int) (*AwsDynamodbConnect, error)

                      NewAwsDynamodbConnect constructs a new AwsDynamodbConnect instance.

                      Parameters:

                      - cfg             : aws.Config instance
                      - sess            : session.Session instance
                      - db              :  dynamodb.DynamoDB instance
                      - defaultTimeoutMs: default timeout for db operations, in milliseconds
                      

                      Return: the AwsDynamodbConnect instance and error (if any). Note:

                      - if db is nil, it will be built from session
                      - if session is nil, it sill be built from config
                      - at least one of {config, session, db} must not be nil
                      

                      func (*AwsDynamodbConnect) AddValuesToAttributes

                      func (adc *AwsDynamodbConnect) AddValuesToAttributes(ctx aws.Context, table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder, attrsAndValues map[string]interface{}) (*dynamodb.UpdateItemOutput, error)

                        AddValuesToAttributes adds values to one or more attributes of an item.

                        Parameters:

                        - ctx           : (optional) used for request cancellation
                        - table         : name of the table
                        - keyFilter     : map of {primary-key-attribute-name:attribute-value}, must include all primary key's attributes
                        - condition     : (optional) a condition that must be satisfied before updating item
                        - attrsAndValues: list of attributes and values to add
                        

                        See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

                        Note:

                        - "add" is math operation in this context, hence the target attribute and the value to add must be numbers
                        - value can be added to top-level as well as nested attributes
                        - currently can not add value to a set using this function. To add value to a set, use AddValuesToSet. See: https://github.com/aws/aws-sdk-go/issues/1990
                        

                        func (*AwsDynamodbConnect) AddValuesToSet

                        func (adc *AwsDynamodbConnect) AddValuesToSet(ctx aws.Context, table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder, attrsAndValues map[string]interface{}) (*dynamodb.UpdateItemOutput, error)

                          AddValuesToSet adds values to set attributes of an item.

                          Parameters:

                          - ctx           : (optional) used for request cancellation
                          - table         : name of the table
                          - keyFilter     : map of {primary-key-attribute-name:attribute-value}, must include all primary key's attributes
                          - condition     : (optional) a condition that must be satisfied before updating item
                          - attrsAndValues: list of attributes and values to add
                          

                          See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

                          func (*AwsDynamodbConnect) BuildDeleteItemInput

                          func (adc *AwsDynamodbConnect) BuildDeleteItemInput(table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder) (*dynamodb.DeleteItemInput, error)

                            BuildDeleteItemInput is a helper function to build dynamodb.DeleteItemInput.

                            Available: since v0.2.6

                            func (*AwsDynamodbConnect) BuildGetItemInput

                            func (adc *AwsDynamodbConnect) BuildGetItemInput(table string, keyFilter map[string]interface{}) (*dynamodb.GetItemInput, error)

                              BuildGetItemInput is a helper function to build dynamodb.GetItemInput.

                              Notes:

                              - All projected attributes will be fetched.
                              - ConsistentRead is not set.
                              

                              Available: since v0.2.6

                              func (*AwsDynamodbConnect) BuildPutItemInput

                              func (adc *AwsDynamodbConnect) BuildPutItemInput(table string, item map[string]*dynamodb.AttributeValue, condition *expression.ConditionBuilder) (*dynamodb.PutItemInput, error)

                                BuildPutItemInput is a helper function to build dynamodb.PutItemInput.

                                Available: since v0.2.6

                                func (*AwsDynamodbConnect) BuildQueryInput

                                func (adc *AwsDynamodbConnect) BuildQueryInput(table string, keyFilter, nonKeyFilter *expression.ConditionBuilder, indexName string, exclusiveStartKey map[string]*dynamodb.AttributeValue) (*dynamodb.QueryInput, error)

                                  BuildQueryInput is a helper function to build dynamodb.QueryInput.

                                  Notes:

                                  - All projected attributes will be fetched.
                                  - ConsistentRead is not set.
                                  

                                  Available: since v0.2.6

                                  func (*AwsDynamodbConnect) BuildScanInput

                                  func (adc *AwsDynamodbConnect) BuildScanInput(table string, filter *expression.ConditionBuilder, indexName string, exclusiveStartKey map[string]*dynamodb.AttributeValue) (*dynamodb.ScanInput, error)

                                    BuildScanInput is a helper function to build dynamodb.ScanInput.

                                    Notes:

                                    - All projected attributes will be fetched.
                                    - ConsistentRead is not set.
                                    

                                    Available: since v0.2.6

                                    func (*AwsDynamodbConnect) BuildTxAddValuesToAttributes

                                    func (adc *AwsDynamodbConnect) BuildTxAddValuesToAttributes(table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder, attrsAndValues map[string]interface{}) (*dynamodb.TransactWriteItem, error)

                                      BuildTxAddValuesToAttributes builds a 'dynamodb.TransactWriteItem' with "add values to attributes" operation.

                                      Parameters: see AddValuesToAttributes

                                      Note: currently can not add value to a set using this function. To add value to a set, use BuildTxAddValuesToSet. See: https://github.com/aws/aws-sdk-go/issues/1990

                                      Available: since v0.2.4

                                      func (*AwsDynamodbConnect) BuildTxAddValuesToSet

                                      func (adc *AwsDynamodbConnect) BuildTxAddValuesToSet(table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder, attrsAndValues map[string]interface{}) (*dynamodb.TransactWriteItem, error)

                                        BuildTxAddValuesToSet builds a 'dynamodb.TransactWriteItem' with "add values to set attributes" operation.

                                        Parameters: see AddValuesToSet

                                        Available: since v0.2.4

                                        func (*AwsDynamodbConnect) BuildTxDelete

                                        func (adc *AwsDynamodbConnect) BuildTxDelete(table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder) (*dynamodb.TransactWriteItem, error)

                                          BuildTxDelete builds a 'dynamodb.TransactWriteItem' with "delete" operation.

                                          Parameters: see DeleteItem

                                          Available: since v0.2.4

                                          func (*AwsDynamodbConnect) BuildTxDeleteValuesFromSet

                                          func (adc *AwsDynamodbConnect) BuildTxDeleteValuesFromSet(table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder, attrsAndValues map[string]interface{}) (*dynamodb.TransactWriteItem, error)

                                            BuildTxDeleteValuesFromSet builds a 'dynamodb.TransactWriteItem' with "add values to set attributes" operation.

                                            Parameters: see DeleteValuesFromSet

                                            Available: since v0.2.4

                                            func (*AwsDynamodbConnect) BuildTxGet

                                            func (adc *AwsDynamodbConnect) BuildTxGet(table string, keyFilter map[string]interface{}) (*dynamodb.TransactGetItem, error)

                                              BuildTxGet builds a 'dynamodb.TransactGetItem' with "get item" operation.

                                              Parameters: see GetItem

                                              Available: since v0.2.4

                                              func (*AwsDynamodbConnect) BuildTxPut

                                              func (adc *AwsDynamodbConnect) BuildTxPut(table string, item interface{}, condition *expression.ConditionBuilder) (*dynamodb.TransactWriteItem, error)

                                                BuildTxPut builds a 'dynamodb.TransactWriteItem' with "insert or replace" operation.

                                                Parameters: see PutItem

                                                Available: since v0.2.4

                                                func (*AwsDynamodbConnect) BuildTxPutIfNotExist

                                                func (adc *AwsDynamodbConnect) BuildTxPutIfNotExist(table string, item interface{}, pkAttrs []string) (*dynamodb.TransactWriteItem, error)

                                                  BuildTxPutIfNotExist builds a 'dynamodb.TransactWriteItem' with "insert if not exist" operation.

                                                  Parameters: see PutItemIfNotExist

                                                  Available: since v0.2.4

                                                  func (*AwsDynamodbConnect) BuildTxPutRaw

                                                    BuildTxPutRaw builds a 'dynamodb.TransactWriteItem' with "insert or replace" operation.

                                                    Parameters: see PutItemRaw

                                                    Available: since v0.2.4

                                                    func (*AwsDynamodbConnect) BuildTxPutRawIfNotExist

                                                    func (adc *AwsDynamodbConnect) BuildTxPutRawIfNotExist(table string, item map[string]*dynamodb.AttributeValue, pkAttrs []string) (*dynamodb.TransactWriteItem, error)

                                                      BuildTxPutRawIfNotExist builds a 'dynamodb.TransactWriteItem' with "insert if not exist" operation.

                                                      Parameters: see PutItemRawIfNotExist

                                                      Available: since v0.2.4

                                                      func (*AwsDynamodbConnect) BuildTxRemoveAttributes

                                                      func (adc *AwsDynamodbConnect) BuildTxRemoveAttributes(table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder, attrs []string) (*dynamodb.TransactWriteItem, error)

                                                        BuildTxRemoveAttributes builds a 'dynamodb.TransactWriteItem' with "remote attributes" operation.

                                                        Parameters: see RemoveAttributes

                                                        Available: since v0.2.4

                                                        func (*AwsDynamodbConnect) BuildTxSetAttributes

                                                        func (adc *AwsDynamodbConnect) BuildTxSetAttributes(table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder, attrsAndValues map[string]interface{}) (*dynamodb.TransactWriteItem, error)

                                                          BuildTxSetAttributes builds a 'dynamodb.TransactWriteItem' with "set attributes" operation.

                                                          Parameters: see SetAttributes

                                                          Available: since v0.2.4

                                                          func (*AwsDynamodbConnect) BuildTxUpdate

                                                          func (adc *AwsDynamodbConnect) BuildTxUpdate(table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder,
                                                          	attrsToRemove []string, attrsAndValuesToSet, attrsAndValuesToAdd, attrsAndValuesToDelete map[string]interface{}) (*dynamodb.TransactWriteItem, error)

                                                            BuildTxUpdate builds a 'dynamodb.TransactWriteItem' with "update" operation.

                                                            Parameters: see UpdateItem

                                                            Available: since v0.2.4

                                                            func (*AwsDynamodbConnect) BuildTxUpdateRaw

                                                            func (adc *AwsDynamodbConnect) BuildTxUpdateRaw(table string, key map[string]*dynamodb.AttributeValue, updateExpression expression.Expression) (*dynamodb.TransactWriteItem, error)

                                                              BuildTxUpdateRaw builds a 'dynamodb.TransactWriteItem' with "update" operation.

                                                              Available: since v0.2.4

                                                              func (*AwsDynamodbConnect) BuildUpdateItemInput

                                                              func (adc *AwsDynamodbConnect) BuildUpdateItemInput(table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder,
                                                              	attrsToRemove []string, attrsAndValuesToSet, attrsAndValuesToAdd, attrsAndValuesToDelete map[string]interface{}) (*dynamodb.UpdateItemInput, error)

                                                                BuildUpdateItemInput is a helper function to build dynamodb.UpdateItemInput.

                                                                Parameters:

                                                                - table                 : name of the table
                                                                - keyFilter             : map of {primary-key-attribute-name:attribute-value}, must include all primary key's attributes
                                                                - condition             : (optional) a condition that must be satisfied before updating item
                                                                - attrsToRemove         : list of attributes to remove
                                                                - attrsAndValuesToSet   : list of attributes and values to set
                                                                - attrsAndValuesToAdd   : list of attributes and values to add
                                                                - attrsAndValuesToDelete: list of attributes and values to delete
                                                                

                                                                Note: at least one of attrsToRemove, attrsAndValuesToSet, attrsAndValuesToAdd, attrsAndValuesToDelete must be provided

                                                                See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

                                                                Available: since v0.2.6

                                                                func (*AwsDynamodbConnect) Close

                                                                func (adc *AwsDynamodbConnect) Close() error

                                                                  Close frees all resources and closes all connection associated with this AwsDynamodbConnect.

                                                                  func (*AwsDynamodbConnect) CreateGlobalSecondaryIndex

                                                                  func (adc *AwsDynamodbConnect) CreateGlobalSecondaryIndex(ctx aws.Context, table, indexName string, rcu, wcu int64, attrDefs, keyAttrs []AwsDynamodbNameAndType) error

                                                                    CreateGlobalSecondaryIndex creates a Global Secondary Index on a specified table.

                                                                    Parameters:

                                                                    - ctx      : (optional) used for request cancellation
                                                                    - table    : name of the table
                                                                    - indexName: name of the index to be created
                                                                    - rcu      : ReadCapacityUnits (0 means PAY_PER_REQUEST)
                                                                    - wcu      : WriteCapacityUnits (0 means PAY_PER_REQUEST)
                                                                    - attrDefs : GSI attributes, where attribute-type is either "S", "N" or "B"
                                                                    - keyAttrs : GSI key schema, where key-type is either "HASH" or "RANGE"
                                                                    

                                                                    Note: DynamoDB GSI is created asynchronously. Use GetGlobalSecondaryIndexStatus to check GSI's existence.

                                                                    func (*AwsDynamodbConnect) CreateTable

                                                                    func (adc *AwsDynamodbConnect) CreateTable(ctx aws.Context, table string, rcu, wcu int64, attrDefs, pkDefs []AwsDynamodbNameAndType) error

                                                                      CreateTable create a new table without index.

                                                                      Parameters:

                                                                      - ctx     : (optional) used for request cancellation
                                                                      - table   : name of the table to be created
                                                                      - rcu     : ReadCapacityUnits (0 means PAY_PER_REQUEST)
                                                                      - wcu     : WriteCapacityUnits (0 means PAY_PER_REQUEST)
                                                                      - attrDefs: table attributes, where attribute-type is either "S", "N" or "B"
                                                                      - pkDefs  : primary key definitions, where key-type is either "HASH" or "RANGE"
                                                                      

                                                                      Note: DynamoDB table is created asynchronously. Use GetTableStatus to check table's existence.

                                                                      func (*AwsDynamodbConnect) DeleteGlobalSecondaryIndex

                                                                      func (adc *AwsDynamodbConnect) DeleteGlobalSecondaryIndex(ctx aws.Context, table, indexName string) error

                                                                        DeleteGlobalSecondaryIndex deletes a Global Secondary Index on a specified table.

                                                                        Parameters:

                                                                        - ctx: (optional) used for request cancellation
                                                                        

                                                                        Notes:

                                                                        - DynamoDB GSI is deleted asynchronously. Use GetGlobalSecondaryIndexStatus to check index's existence.
                                                                        - This function ignores error if index does not exist.
                                                                        

                                                                        func (*AwsDynamodbConnect) DeleteItem

                                                                        func (adc *AwsDynamodbConnect) DeleteItem(ctx aws.Context, table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder) (*dynamodb.DeleteItemOutput, error)

                                                                          DeleteItem removes a single item from specified table.

                                                                          Parameters:

                                                                          - ctx      : (optional) used for request cancellation
                                                                          - table    : name of the table
                                                                          - keyFilter: map of {primary-key-attribute-name:attribute-value}, must include all primary key's attributes
                                                                          - condition: (optional) a condition that must be satisfied before removing item
                                                                          

                                                                          func (*AwsDynamodbConnect) DeleteItemWithInput

                                                                          func (adc *AwsDynamodbConnect) DeleteItemWithInput(ctx aws.Context, input *dynamodb.DeleteItemInput) (*dynamodb.DeleteItemOutput, error)

                                                                            DeleteItemWithInput executes DynamoDB "delete-item" operation.

                                                                            Available: since v0.2.6

                                                                            func (*AwsDynamodbConnect) DeleteTable

                                                                            func (adc *AwsDynamodbConnect) DeleteTable(ctx aws.Context, table string) error

                                                                              DeleteTable deletes an existing table.

                                                                              Parameters:

                                                                              - ctx: (optional) used for request cancellation
                                                                              

                                                                              Notes:

                                                                              - DynamoDB table is deleted asynchronously. Use GetTableStatus to check table's existence.
                                                                              - This function ignores error if table does not exist.
                                                                              

                                                                              func (*AwsDynamodbConnect) DeleteValuesFromSet

                                                                              func (adc *AwsDynamodbConnect) DeleteValuesFromSet(ctx aws.Context, table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder, attrsAndValues map[string]interface{}) (*dynamodb.UpdateItemOutput, error)

                                                                                DeleteValuesFromSet deletes values from one or more set attributes of an item.

                                                                                Parameters:

                                                                                - ctx           : (optional) used for request cancellation
                                                                                - table         : name of the table
                                                                                - keyFilter     : map of {primary-key-attribute-name:attribute-value}, must include all primary key's attributes
                                                                                - condition     : (optional) a condition that must be satisfied before updating item
                                                                                - attrsAndValues: list of attributes and values to delete
                                                                                

                                                                                See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

                                                                                func (*AwsDynamodbConnect) ExecTxGetItems

                                                                                  ExecTxGetItems executes a "get-items" transaction.

                                                                                  Available: since v0.2.4

                                                                                  func (*AwsDynamodbConnect) ExecTxWriteItems

                                                                                    ExecTxWriteItems executes a "write-items" transaction.

                                                                                    Available: since v0.2.4

                                                                                    func (*AwsDynamodbConnect) GetDb

                                                                                    func (adc *AwsDynamodbConnect) GetDb() *dynamodb.DynamoDB

                                                                                      GetDb returns the underlying dynamodb.DynamoDB instance.

                                                                                      func (*AwsDynamodbConnect) GetGlobalSecondaryIndexStatus

                                                                                      func (adc *AwsDynamodbConnect) GetGlobalSecondaryIndexStatus(ctx aws.Context, table, indexName string) (string, error)

                                                                                        GetGlobalSecondaryIndexStatus fetches and returns a table's GSI status.

                                                                                        Parameters:

                                                                                        - ctx: (optional) used for request cancellation
                                                                                        

                                                                                        Note: If index does not exist, this function returns "", nil

                                                                                        func (*AwsDynamodbConnect) GetItem

                                                                                        func (adc *AwsDynamodbConnect) GetItem(ctx aws.Context, table string, keyFilter map[string]interface{}) (AwsDynamodbItem, error)

                                                                                          GetItem fetches a single item from specified table.

                                                                                          Parameters:

                                                                                          - ctx      : (optional) used for request cancellation
                                                                                          - table    : name of the table
                                                                                          - keyFilter: map of {primary-key-attribute-name:attribute-value}, must include all primary key's attributes
                                                                                          

                                                                                          Notes:

                                                                                          - If item does not exist, this function returns (nil, nil).
                                                                                          - All projected attributes will be fetched.
                                                                                          - ConsistentRead is not set.
                                                                                          

                                                                                          func (*AwsDynamodbConnect) GetItemWithInput

                                                                                          func (adc *AwsDynamodbConnect) GetItemWithInput(ctx aws.Context, input *dynamodb.GetItemInput) (*dynamodb.GetItemOutput, error)

                                                                                            GetItemWithInput executes DynamoDB "get-item" operation.

                                                                                            Available: since v0.2.6

                                                                                            func (*AwsDynamodbConnect) GetTableStatus

                                                                                            func (adc *AwsDynamodbConnect) GetTableStatus(ctx aws.Context, table string) (string, error)

                                                                                              GetTableStatus fetches and returns table status.

                                                                                              Parameters:

                                                                                              - ctx: (optional) used for request cancellation
                                                                                              

                                                                                              Note: If table does not exist, this function returns "", nil

                                                                                              func (*AwsDynamodbConnect) HasTable

                                                                                              func (adc *AwsDynamodbConnect) HasTable(ctx aws.Context, table string) (bool, error)

                                                                                                HasTable checks if a table exists.

                                                                                                Parameters:

                                                                                                - ctx: (optional) used for request cancellation
                                                                                                

                                                                                                func (*AwsDynamodbConnect) ListTables

                                                                                                func (adc *AwsDynamodbConnect) ListTables(ctx aws.Context) ([]string, error)

                                                                                                  ListTables returns all visible tables.

                                                                                                  Parameters:

                                                                                                  - ctx: (optional) used for request cancellation
                                                                                                  

                                                                                                  func (*AwsDynamodbConnect) NewContext

                                                                                                  func (adc *AwsDynamodbConnect) NewContext(timeoutMs ...int) (aws.Context, context.CancelFunc)

                                                                                                    NewContext creates a new context with specified timeout in milliseconds. If there is no specified timeout, or timeout value is less than or equal to 0, the default timeout is used.

                                                                                                    func (*AwsDynamodbConnect) PutItem

                                                                                                    func (adc *AwsDynamodbConnect) PutItem(ctx aws.Context, table string, item interface{}, condition *expression.ConditionBuilder) (*dynamodb.PutItemOutput, error)

                                                                                                      PutItem inserts a new item to table or replace an existing one.

                                                                                                      Parameters:

                                                                                                      - ctx      : (optional) used for request cancellation
                                                                                                      - table    : name of the table
                                                                                                      - item     : item to be inserted (a map or struct), will be converted to map[string]*dynamodb.AttributeValue via dynamodbattribute.MarshalMap(item)
                                                                                                      - condition: (optional) a condition that must be satisfied before writing item
                                                                                                      

                                                                                                      func (*AwsDynamodbConnect) PutItemIfNotExist

                                                                                                      func (adc *AwsDynamodbConnect) PutItemIfNotExist(ctx aws.Context, table string, item interface{}, pkAttrs []string) (*dynamodb.PutItemOutput, error)

                                                                                                        PutItemIfNotExist inserts a new item to table only if it does not exist.

                                                                                                        Parameters:

                                                                                                        - ctx    : (optional) used for request cancellation
                                                                                                        - table  : name of the table
                                                                                                        - item   : item to be inserted (a map or struct), will be converted to map[string]*dynamodb.AttributeValue via dynamodbattribute.MarshalMap(item)
                                                                                                        - pkAttrs: primary key attribute names
                                                                                                        

                                                                                                        Note:

                                                                                                        - (since v0.2.7) if item already existed, this function return (nil, nil)
                                                                                                        

                                                                                                        func (*AwsDynamodbConnect) PutItemRaw

                                                                                                          PutItemRaw inserts a new item to table or replace an existing one.

                                                                                                          Parameters:

                                                                                                          - ctx      : (optional) used for request cancellation
                                                                                                          - table    : name of the table
                                                                                                          - item     : item to be inserted
                                                                                                          - condition: (optional) a condition that must be satisfied before writing item
                                                                                                          

                                                                                                          func (*AwsDynamodbConnect) PutItemRawIfNotExist

                                                                                                          func (adc *AwsDynamodbConnect) PutItemRawIfNotExist(ctx aws.Context, table string, item map[string]*dynamodb.AttributeValue, pkAttrs []string) (*dynamodb.PutItemOutput, error)

                                                                                                            PutItemRawIfNotExist inserts a new item to table only if it does not exist.

                                                                                                            Parameters:

                                                                                                            - ctx    : (optional) used for request cancellation
                                                                                                            - table  : name of the table
                                                                                                            - item   : item to be inserted
                                                                                                            - pkAttrs: primary key attribute names
                                                                                                            

                                                                                                            func (*AwsDynamodbConnect) PutItemWithInput

                                                                                                            func (adc *AwsDynamodbConnect) PutItemWithInput(ctx aws.Context, input *dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error)

                                                                                                              PutItemWithInput executes DynamoDB "put-item" operation.

                                                                                                              Available: since v0.2.6

                                                                                                              func (*AwsDynamodbConnect) QueryItems

                                                                                                              func (adc *AwsDynamodbConnect) QueryItems(ctx aws.Context, table string, keyFilter, nonKeyFilter *expression.ConditionBuilder, indexName string) ([]AwsDynamodbItem, error)

                                                                                                                QueryItems fetches multiple items from specified table using "query" operation.

                                                                                                                Parameters:

                                                                                                                - ctx              : (optional) used for request cancellation
                                                                                                                - table            : name of the table to be scanned
                                                                                                                - keyFilter        : used to filter items on primary key attributes
                                                                                                                - nonKeyFilter     : used to filter items on non-primary key attributes before returning result
                                                                                                                - indexName        : if non-empty, use this secondary index to scan (local or global)
                                                                                                                

                                                                                                                Notes:

                                                                                                                - This function may not fetch all item's attributes when using secondary index and not all attributes are projected to the index.
                                                                                                                - All projected attributes will be fetched.
                                                                                                                - ConsistentRead is not set.
                                                                                                                

                                                                                                                func (*AwsDynamodbConnect) QueryItemsWithCallback

                                                                                                                func (adc *AwsDynamodbConnect) QueryItemsWithCallback(ctx aws.Context, table string, keyFilter, nonKeyFilter *expression.ConditionBuilder, indexName string, exclusiveStartKey map[string]*dynamodb.AttributeValue, callback AwsDynamodbItemCallback) error

                                                                                                                  QueryItemsWithCallback fetches multiple items from specified table using "query" operation.

                                                                                                                  Parameters:

                                                                                                                  - ctx              : (optional) used for request cancellation
                                                                                                                  - table            : name of the table to be queried
                                                                                                                  - keyFilter        : used to filter items on primary key attributes
                                                                                                                  - nonKeyFilter     : used to filter items on non-primary key attributes before returning result
                                                                                                                  - indexName        : if non-empty, use this secondary index to query (local or global)
                                                                                                                  - exclusiveStartKey: (optional) skip items till this key (used for paging)
                                                                                                                  - callback         : callback function
                                                                                                                  

                                                                                                                  Notes:

                                                                                                                  - This function may not fetch all item's attributes when using secondary index and not all attributes are projected to the index.
                                                                                                                  - All projected attributes will be fetched.
                                                                                                                  - ConsistentRead is not set.
                                                                                                                  

                                                                                                                  func (*AwsDynamodbConnect) QueryWithInput

                                                                                                                  func (adc *AwsDynamodbConnect) QueryWithInput(ctx aws.Context, input *dynamodb.QueryInput) ([]AwsDynamodbItem, error)

                                                                                                                    QueryWithInput executes DynamoDB "query" operation.

                                                                                                                    Note: This function may not fetch all item's attributes when using secondary index and not all attributes are projected to the index.

                                                                                                                    Available: since v0.2.6

                                                                                                                    func (*AwsDynamodbConnect) QueryWithInputCallback

                                                                                                                    func (adc *AwsDynamodbConnect) QueryWithInputCallback(ctx aws.Context, input *dynamodb.QueryInput, callback AwsDynamodbItemCallback) error

                                                                                                                      QueryWithInputCallback executes DynamoDB "query" operation.

                                                                                                                      Note: This function may not fetch all item's attributes when using secondary index and not all attributes are projected to the index.

                                                                                                                      Available: since v0.2.6

                                                                                                                      func (*AwsDynamodbConnect) RemoveAttributes

                                                                                                                      func (adc *AwsDynamodbConnect) RemoveAttributes(ctx aws.Context, table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder, attrs []string) (*dynamodb.UpdateItemOutput, error)

                                                                                                                        RemoveAttributes removes one or more attributes from an item.

                                                                                                                        Parameters:

                                                                                                                        - ctx      : (optional) used for request cancellation
                                                                                                                        - table    : name of the table
                                                                                                                        - keyFilter: map of {primary-key-attribute-name:attribute-value}, must include all primary key's attributes
                                                                                                                        - condition: (optional) a condition that must be satisfied before updating item
                                                                                                                        - attrs    : list of attributes to remove
                                                                                                                        

                                                                                                                        See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

                                                                                                                        func (*AwsDynamodbConnect) ScanItems

                                                                                                                        func (adc *AwsDynamodbConnect) ScanItems(ctx aws.Context, table string, filter *expression.ConditionBuilder, indexName string) ([]AwsDynamodbItem, error)

                                                                                                                          ScanItems fetches multiple items from specified table using "scan" operation.

                                                                                                                          Parameters:

                                                                                                                          - ctx              : (optional) used for request cancellation
                                                                                                                          - table            : name of the table to be scanned
                                                                                                                          - filter           : (optional) used to filter scanned items
                                                                                                                          - indexName        : if non-empty, use this secondary index to scan (local or global)
                                                                                                                          

                                                                                                                          Notes:

                                                                                                                          - This function may not fetch all item's attributes when using secondary index and not all attributes are projected to the index.
                                                                                                                          - All projected attributes will be fetched.
                                                                                                                          - ConsistentRead is not set.
                                                                                                                          

                                                                                                                          func (*AwsDynamodbConnect) ScanItemsWithCallback

                                                                                                                          func (adc *AwsDynamodbConnect) ScanItemsWithCallback(ctx aws.Context, table string, filter *expression.ConditionBuilder, indexName string, exclusiveStartKey map[string]*dynamodb.AttributeValue, callback AwsDynamodbItemCallback) error

                                                                                                                            ScanItemsWithCallback fetches multiple items from specified table using "scan" operation.

                                                                                                                            Parameters:

                                                                                                                            - ctx              : (optional) used for request cancellation
                                                                                                                            - table            : name of the table to be scanned
                                                                                                                            - filter           : (optional) used to filter scanned items
                                                                                                                            - indexName        : if non-empty, use this secondary index to scan (local or global)
                                                                                                                            - exclusiveStartKey: (optional) skip items till this key (used for paging)
                                                                                                                            - callback         : callback function
                                                                                                                            

                                                                                                                            Notes:

                                                                                                                            - This function may not fetch all item's attributes when using secondary index and not all attributes are projected to the index.
                                                                                                                            - All projected attributes will be fetched.
                                                                                                                            - ConsistentRead is not set.
                                                                                                                            

                                                                                                                            func (*AwsDynamodbConnect) ScanWithInput

                                                                                                                            func (adc *AwsDynamodbConnect) ScanWithInput(ctx aws.Context, input *dynamodb.ScanInput) ([]AwsDynamodbItem, error)

                                                                                                                              ScanWithInput executes DynamoDB "scan" operation.

                                                                                                                              Note: This function may not fetch all item's attributes when using secondary index and not all attributes are projected to the index.

                                                                                                                              Available: since v0.2.6

                                                                                                                              func (*AwsDynamodbConnect) ScanWithInputCallback

                                                                                                                              func (adc *AwsDynamodbConnect) ScanWithInputCallback(ctx aws.Context, input *dynamodb.ScanInput, callback AwsDynamodbItemCallback) error

                                                                                                                                ScanWithInputCallback executes DynamoDB "scan" operation.

                                                                                                                                Note: This function may not fetch all item's attributes when using secondary index and not all attributes are projected to the index.

                                                                                                                                Available: since v0.2.6

                                                                                                                                func (*AwsDynamodbConnect) SetAttributes

                                                                                                                                func (adc *AwsDynamodbConnect) SetAttributes(ctx aws.Context, table string, keyFilter map[string]interface{}, condition *expression.ConditionBuilder, attrsAndValues map[string]interface{}) (*dynamodb.UpdateItemOutput, error)

                                                                                                                                  SetAttributes sets one or more attributes of an item.

                                                                                                                                  Parameters:

                                                                                                                                  - ctx           : (optional) used for request cancellation
                                                                                                                                  - table         : name of the table
                                                                                                                                  - keyFilter     : map of {primary-key-attribute-name:attribute-value}, must include all primary key's attributes
                                                                                                                                  - condition     : (optional) a condition that must be satisfied before updating item
                                                                                                                                  - attrsAndValues: list of attributes and values to set
                                                                                                                                  

                                                                                                                                  See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

                                                                                                                                  func (*AwsDynamodbConnect) UpdateItem

                                                                                                                                  func (adc *AwsDynamodbConnect) UpdateItem(ctx aws.Context, table string,
                                                                                                                                  	keyFilter map[string]interface{}, condition *expression.ConditionBuilder,
                                                                                                                                  	attrsToRemove []string, attrsAndValuesToSet, attrsAndValuesToAdd, attrsAndValuesToDelete map[string]interface{}) (*dynamodb.UpdateItemOutput, error)

                                                                                                                                    UpdateItem performs operation remove/set/add value/delete values from item's attributes.

                                                                                                                                    Parameters:

                                                                                                                                    - ctx                   : (optional) used for request cancellation
                                                                                                                                    - table                 : name of the table
                                                                                                                                    - keyFilter             : map of {primary-key-attribute-name:attribute-value}, must include all primary key's attributes
                                                                                                                                    - condition             : (optional) a condition that must be satisfied before updating item
                                                                                                                                    - attrsToRemove         : list of attributes to remove
                                                                                                                                    - attrsAndValuesToSet   : list of attributes and values to set
                                                                                                                                    - attrsAndValuesToAdd   : list of attributes and values to add
                                                                                                                                    - attrsAndValuesToDelete: list of attributes and values to delete
                                                                                                                                    

                                                                                                                                    Note: at least one of attrsToRemove, attrsAndValuesToSet, attrsAndValuesToAdd, attrsAndValuesToDelete must be provided

                                                                                                                                    See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

                                                                                                                                    func (*AwsDynamodbConnect) UpdateItemWithInput

                                                                                                                                    func (adc *AwsDynamodbConnect) UpdateItemWithInput(ctx aws.Context, input *dynamodb.UpdateItemInput) (*dynamodb.UpdateItemOutput, error)

                                                                                                                                      UpdateItemWithInput executes DynamoDB "update-item" operation.

                                                                                                                                      Available: since v0.2.6

                                                                                                                                      type AwsDynamodbConsistentReadLevel

                                                                                                                                      type AwsDynamodbConsistentReadLevel int

                                                                                                                                        AwsDynamodbConsistentReadLevel specifies the level of read consistency.

                                                                                                                                        Available: since v0.2.6

                                                                                                                                        const (
                                                                                                                                        	AwsDynamodbConsistentReadLevelNone AwsDynamodbConsistentReadLevel = iota
                                                                                                                                        )

                                                                                                                                          Predefined levels of read consistency.

                                                                                                                                          Available: since v0.2.6

                                                                                                                                          type AwsDynamodbItem

                                                                                                                                          type AwsDynamodbItem map[string]interface{}

                                                                                                                                            AwsDynamodbItem defines a generic structure for DynamoDB item.

                                                                                                                                            type AwsDynamodbItemCallback

                                                                                                                                            type AwsDynamodbItemCallback func(item AwsDynamodbItem, lastEvaluatedKey map[string]*dynamodb.AttributeValue) (bool, error)

                                                                                                                                              AwsDynamodbItemCallback defines callback interface for "scan"/"query" operation.

                                                                                                                                              If callback function returns false or error, the scan/query process will stop (even if there are still more items).

                                                                                                                                              type AwsDynamodbNameAndType

                                                                                                                                              type AwsDynamodbNameAndType struct{ Name, Type string }

                                                                                                                                                AwsDynamodbNameAndType defines a generic name & type pair.

                                                                                                                                                type DbFlavor

                                                                                                                                                type DbFlavor int

                                                                                                                                                  DbFlavor specifies the flavor or database server/vendor.

                                                                                                                                                  Available: since v0.1.0

                                                                                                                                                  const (
                                                                                                                                                  	FlavorDefault DbFlavor = iota
                                                                                                                                                  	FlavorMySql
                                                                                                                                                  	FlavorPgSql
                                                                                                                                                  	FlavorMsSql
                                                                                                                                                  	FlavorOracle
                                                                                                                                                  	FlavorSqlite
                                                                                                                                                  	FlavorCosmosDb
                                                                                                                                                  )

                                                                                                                                                    Predefined db flavors.

                                                                                                                                                    Available: since v0.1.0

                                                                                                                                                    type GoRedisConnect

                                                                                                                                                    type GoRedisConnect struct {
                                                                                                                                                    	// contains filtered or unexported fields
                                                                                                                                                    }

                                                                                                                                                      GoRedisConnect holds a go-redis client (https://github.com/go-redis/redis) that can be shared within the application.

                                                                                                                                                      func NewGoRedisConnect

                                                                                                                                                      func NewGoRedisConnect(hostsAndPorts, password string, maxRetries int) *GoRedisConnect

                                                                                                                                                        NewGoRedisConnect constructs a new GoRedisConnect instance with supplied options and default Redis pool options.

                                                                                                                                                        Parameters: see NewGoRedisConnectWithPoolOptions

                                                                                                                                                        func NewGoRedisConnectWithPoolOptions

                                                                                                                                                        func NewGoRedisConnectWithPoolOptions(hostsAndPorts, password string, maxRetries int, poolOpts *RedisPoolOpts) *GoRedisConnect

                                                                                                                                                          NewGoRedisConnectWithPoolOptions constructs a new GoRedisConnect instance with supplied options and default Redis pool options.

                                                                                                                                                          Parameters:

                                                                                                                                                          - hostsAndPorts: list of Redis servers (example: "host1:6379,host2;host3:6380")
                                                                                                                                                          - password     : password to authenticate against Redis server
                                                                                                                                                          - maxRetries   : max number of retries for failed operations
                                                                                                                                                          - poolOpts     : Redis connection pool settings
                                                                                                                                                          

                                                                                                                                                          Available since v0.2.8

                                                                                                                                                          func (*GoRedisConnect) Close

                                                                                                                                                          func (r *GoRedisConnect) Close() error

                                                                                                                                                            Close closes all underlying Redis connections associated with this GoRedisConnect.

                                                                                                                                                            Available: since v0.2.0

                                                                                                                                                            func (*GoRedisConnect) GetClient

                                                                                                                                                            func (r *GoRedisConnect) GetClient(db int) *redis.Client

                                                                                                                                                              GetClient returns the redis.Client associated with the specified db number.

                                                                                                                                                              Note: do NOT close the returned client (e.g. call redis.Client.Close()).

                                                                                                                                                              This function uses the first entry of 'hostsAndPorts' as Redis server address. This function returns the existing client, if any (i.e. no new redis.Client instance will be created).

                                                                                                                                                              func (*GoRedisConnect) GetClusterClient

                                                                                                                                                              func (r *GoRedisConnect) GetClusterClient() *redis.ClusterClient

                                                                                                                                                                GetClusterClient returns the redis.ClusterClient associated with the GoRedisConnect.

                                                                                                                                                                Note: do NOT close the returned client (e.g. call redis.ClusterClient.Close()).

                                                                                                                                                                This function uses 'hostsAndPorts' config as list of Redis server addresses. This function returns the existing client, if any (i.e. no new redis.ClusterClient instance will be created).

                                                                                                                                                                func (*GoRedisConnect) GetFailoverClient

                                                                                                                                                                func (r *GoRedisConnect) GetFailoverClient(db int) *redis.Client

                                                                                                                                                                  GetFailoverClient returns the failover redis.Client associated with the specified db number.

                                                                                                                                                                  Note: do NOT close the returned client (e.g. call redis.Client.Close()).

                                                                                                                                                                  This function uses 'hostsAndPorts' config as list of Redis Sentinel server addresses. This function returns the existing client, if any (i.e. no new redis.Client instance will be created).

                                                                                                                                                                  func (*GoRedisConnect) GetRedisPoolOpts

                                                                                                                                                                  func (r *GoRedisConnect) GetRedisPoolOpts() *RedisPoolOpts

                                                                                                                                                                    GetRedisPoolOpts returns Redis connection pool configurations.

                                                                                                                                                                    Available: since v0.2.8

                                                                                                                                                                    func (*GoRedisConnect) GetSentinelMasterName

                                                                                                                                                                    func (r *GoRedisConnect) GetSentinelMasterName() string

                                                                                                                                                                      GetSentinelMasterName returns the current sentinel master name.

                                                                                                                                                                      Available: since v0.2.8

                                                                                                                                                                      func (*GoRedisConnect) GetSlaveReadOnly

                                                                                                                                                                      func (r *GoRedisConnect) GetSlaveReadOnly() bool

                                                                                                                                                                        GetSlaveReadOnly returns the current value of 'slaveReadOnly' setting.

                                                                                                                                                                        Available: since v0.2.8

                                                                                                                                                                        func (*GoRedisConnect) SetRedisPoolOpts

                                                                                                                                                                        func (r *GoRedisConnect) SetRedisPoolOpts(opts *RedisPoolOpts) *GoRedisConnect

                                                                                                                                                                          SetRedisPoolOpts sets Redis connection pool configurations.

                                                                                                                                                                          The change will apply to newly created clients, existing one will NOT be effected! This function returns the current GoRedisConnect instance so that function calls can be chained.

                                                                                                                                                                          Available: since v0.2.8

                                                                                                                                                                          func (*GoRedisConnect) SetSentinelMasterName

                                                                                                                                                                          func (r *GoRedisConnect) SetSentinelMasterName(masterName string) *GoRedisConnect

                                                                                                                                                                            SetSentinelMasterName sets the sentinel master name, used by failover clients.

                                                                                                                                                                            The change will apply to newly created clients, existing one will NOT be effected! This function returns the current GoRedisConnect instance so that function calls can be chained.

                                                                                                                                                                            func (*GoRedisConnect) SetSlaveReadOnly

                                                                                                                                                                            func (r *GoRedisConnect) SetSlaveReadOnly(readOnly bool) *GoRedisConnect

                                                                                                                                                                              SetSlaveReadOnly enables/disables read-only commands on slave nodes.

                                                                                                                                                                              The change will apply to newly created clients, existing one will NOT be effected! This function returns the current GoRedisConnect instance so that function calls can be chained.

                                                                                                                                                                              type MongoConnect

                                                                                                                                                                              type MongoConnect struct {
                                                                                                                                                                              	// contains filtered or unexported fields
                                                                                                                                                                              }

                                                                                                                                                                                MongoConnect holds a MongoDB client (https://github.com/mongodb/mongo-go-driver) that can be shared within the application.

                                                                                                                                                                                func NewMongoConnect

                                                                                                                                                                                func NewMongoConnect(url, db string, defaultTimeoutMs int) (*MongoConnect, error)

                                                                                                                                                                                  NewMongoConnect constructs a new MongoConnect instance.

                                                                                                                                                                                  Parameters: see NewMongoConnectWithPoolOptions

                                                                                                                                                                                  Return: see NewMongoConnectWithPoolOptions

                                                                                                                                                                                  func NewMongoConnectWithPoolOptions

                                                                                                                                                                                  func NewMongoConnectWithPoolOptions(url, db string, defaultTimeoutMs int, poolOpts *MongoPoolOpts) (*MongoConnect, error)

                                                                                                                                                                                    NewMongoConnectWithPoolOptions constructs a new MongoConnect instance.

                                                                                                                                                                                    Parameters:

                                                                                                                                                                                    - url             : connection url, including authentication credentials
                                                                                                                                                                                    - db              : name of database to connect to
                                                                                                                                                                                    - defaultTimeoutMs: default timeout for db operations, in milliseconds
                                                                                                                                                                                    - poolOpts        : MongoDB connection pool settings
                                                                                                                                                                                    

                                                                                                                                                                                    Return: the MongoConnect instance and error (if any). Note:

                                                                                                                                                                                    - In case of connection error: this function returns the MongoConnect instance and the error.
                                                                                                                                                                                    - Other error: this function returns (nil, error)
                                                                                                                                                                                    

                                                                                                                                                                                    Available since v0.2.8

                                                                                                                                                                                    func (*MongoConnect) Close

                                                                                                                                                                                    func (m *MongoConnect) Close(ctx context.Context) error

                                                                                                                                                                                      Close closes all connections associated with the underlying MongoDB client.

                                                                                                                                                                                      Available: since v0.2.0

                                                                                                                                                                                      func (*MongoConnect) CreateCollection

                                                                                                                                                                                      func (m *MongoConnect) CreateCollection(collectionName string) (*mongo.SingleResult, error)

                                                                                                                                                                                        CreateCollection creates a collection specified by 'collectionName'

                                                                                                                                                                                        func (*MongoConnect) CreateCollectionIndexes

                                                                                                                                                                                        func (m *MongoConnect) CreateCollectionIndexes(collectionName string, indexes []interface{}) ([]string, error)

                                                                                                                                                                                          CreateCollectionIndexes creates indexes on the specified collection. The names of the created indexes are returned.

                                                                                                                                                                                          Example (index definition can be a map, or a mongo.IndexModel):

                                                                                                                                                                                          collectionName := "my_table"
                                                                                                                                                                                          indexes := []interface{}{
                                                                                                                                                                                          	map[string]interface{}{
                                                                                                                                                                                          		"key": map[string]interface{}{
                                                                                                                                                                                          			"field_1": 1, // ascending index
                                                                                                                                                                                          		},
                                                                                                                                                                                          		"name"  : "uidx_1",
                                                                                                                                                                                          		"unique": true,
                                                                                                                                                                                          	},
                                                                                                                                                                                          	mongo.IndexModel{
                                                                                                                                                                                          		Keys: map[string]interface{}{
                                                                                                                                                                                          			"field_2": -1, // descending index
                                                                                                                                                                                          		},
                                                                                                                                                                                          		Options: &options.IndexOptions{
                                                                                                                                                                                          			Name  : &name,
                                                                                                                                                                                          			Unique: &isUnique,
                                                                                                                                                                                          		},
                                                                                                                                                                                          	},
                                                                                                                                                                                          }
                                                                                                                                                                                          indexesNames, err := m.CreateCollectionIndexes(collectionName, indexes)
                                                                                                                                                                                          

                                                                                                                                                                                          Available: since v0.2.1

                                                                                                                                                                                          func (*MongoConnect) DecodeResultCallback

                                                                                                                                                                                          func (m *MongoConnect) DecodeResultCallback(ctx context.Context, cursor *mongo.Cursor, callback func(docNum int, doc bson.M, err error) bool)

                                                                                                                                                                                            DecodeResultCallback loops through the cursor and, for each fetched document, passes it to the callback function.

                                                                                                                                                                                            Note:

                                                                                                                                                                                            - docNum is 1-based, and scoped to the cursor context. This function does not close the cursor!
                                                                                                                                                                                            - If callback function returns 'false', the loop will break and DecodeResultCallback returns.
                                                                                                                                                                                            

                                                                                                                                                                                            func (*MongoConnect) DecodeResultCallbackRaw

                                                                                                                                                                                            func (m *MongoConnect) DecodeResultCallbackRaw(ctx context.Context, cursor *mongo.Cursor, callback func(docNum int, doc []byte, err error) bool)

                                                                                                                                                                                              DecodeResultCallbackRaw loops through the cursor and, for each fetched document, passes it to the callback function.

                                                                                                                                                                                              Note:

                                                                                                                                                                                              - docNum is 1-based, and scoped to the cursor context. This function does not close the cursor!
                                                                                                                                                                                              - If callback function returns 'false', the loop will break and DecodeResultCallbackRaw returns.
                                                                                                                                                                                              

                                                                                                                                                                                              Available: since v0.0.3.1

                                                                                                                                                                                              func (*MongoConnect) DecodeSingleResult

                                                                                                                                                                                              func (m *MongoConnect) DecodeSingleResult(dbResult *mongo.SingleResult) (bson.M, error)

                                                                                                                                                                                                DecodeSingleResult transforms 'mongo.SingleResult' to 'bson.M'.

                                                                                                                                                                                                func (*MongoConnect) DecodeSingleResultRaw

                                                                                                                                                                                                func (m *MongoConnect) DecodeSingleResultRaw(dbResult *mongo.SingleResult) ([]byte, error)

                                                                                                                                                                                                  DecodeSingleResultRaw transforms 'mongo.SingleResult' to raw JSON data.

                                                                                                                                                                                                  Available: since v0.0.3.1

                                                                                                                                                                                                  func (*MongoConnect) GetCollection

                                                                                                                                                                                                  func (m *MongoConnect) GetCollection(collectionName string, opts ...*options.CollectionOptions) *mongo.Collection

                                                                                                                                                                                                    GetCollection returns the collection object specified by 'collectionName'.

                                                                                                                                                                                                    func (*MongoConnect) GetDatabase

                                                                                                                                                                                                    func (m *MongoConnect) GetDatabase(opts ...*options.DatabaseOptions) *mongo.Database

                                                                                                                                                                                                      GetDatabase returns the database object attached to this MongoConnect.

                                                                                                                                                                                                      func (*MongoConnect) GetDb

                                                                                                                                                                                                      func (m *MongoConnect) GetDb() string

                                                                                                                                                                                                        GetDb returns name of MongoDB database to connect.

                                                                                                                                                                                                        Available since v0.2.8

                                                                                                                                                                                                        func (*MongoConnect) GetMongoClient

                                                                                                                                                                                                        func (m *MongoConnect) GetMongoClient() *mongo.Client

                                                                                                                                                                                                          GetMongoClient returns the underlying MongoDB client instance.

                                                                                                                                                                                                          func (*MongoConnect) GetMongoPoolOpts

                                                                                                                                                                                                          func (m *MongoConnect) GetMongoPoolOpts() *MongoPoolOpts

                                                                                                                                                                                                            GetMongoPoolOpts returns MongoDB connection pool configurations.

                                                                                                                                                                                                            Available since v0.2.8

                                                                                                                                                                                                            func (*MongoConnect) GetTimeoutMs

                                                                                                                                                                                                            func (m *MongoConnect) GetTimeoutMs() int

                                                                                                                                                                                                              GetTimeoutMs returns default timeout value (in milliseconds).

                                                                                                                                                                                                              Available since v0.2.8

                                                                                                                                                                                                              func (*MongoConnect) GetUrl

                                                                                                                                                                                                              func (m *MongoConnect) GetUrl() string

                                                                                                                                                                                                                GetUrl returns MongoDB connection url setting.

                                                                                                                                                                                                                Available since v0.2.8

                                                                                                                                                                                                                func (*MongoConnect) HasCollection

                                                                                                                                                                                                                func (m *MongoConnect) HasCollection(collectionName string, opts ...*options.ListCollectionsOptions) (bool, error)

                                                                                                                                                                                                                  HasCollection checks if a collection exists in the database.

                                                                                                                                                                                                                  func (*MongoConnect) HasDatabase

                                                                                                                                                                                                                  func (m *MongoConnect) HasDatabase(dbName string, opts ...*options.ListDatabasesOptions) (bool, error)

                                                                                                                                                                                                                    HasDatabase checks if a database exists on MongoDB server.

                                                                                                                                                                                                                    func (*MongoConnect) Init

                                                                                                                                                                                                                    func (m *MongoConnect) Init() error

                                                                                                                                                                                                                      Init should be called to initialize the MongoConnect instance before use.

                                                                                                                                                                                                                      Available since v0.2.8

                                                                                                                                                                                                                      func (*MongoConnect) IsConnected

                                                                                                                                                                                                                      func (m *MongoConnect) IsConnected() bool

                                                                                                                                                                                                                        IsConnected returns true if the connection to MongoDB has established.

                                                                                                                                                                                                                        func (*MongoConnect) NewContext

                                                                                                                                                                                                                        func (m *MongoConnect) NewContext(timeoutMs ...int) context.Context

                                                                                                                                                                                                                          NewContext creates a new context with specified timeout in milliseconds. If there is no specified timeout, or timeout value is less than or equal to 0, the default timeout is used.

                                                                                                                                                                                                                          Available: since v0.2.0 (since v0.2.8) this function return only context.Context. Use NewContextWithCancel if context.CancelFunc is needed.

                                                                                                                                                                                                                          func (*MongoConnect) NewContextIfNil

                                                                                                                                                                                                                          func (m *MongoConnect) NewContextIfNil(ctx context.Context, timeoutMs ...int) context.Context

                                                                                                                                                                                                                            NewContextIfNil creates a new context with specified timeout in milliseconds if the supplied ctx is nil. Otherwise, ctx is returned as-is.

                                                                                                                                                                                                                            If there is no specified timeout, or timeout value is less than or equal to 0, the default timeout is used.

                                                                                                                                                                                                                            Available: since v0.2.8

                                                                                                                                                                                                                            func (*MongoConnect) NewContextWithCancel

                                                                                                                                                                                                                            func (m *MongoConnect) NewContextWithCancel(timeoutMs ...int) (context.Context, context.CancelFunc)

                                                                                                                                                                                                                              NewContextWithCancel is similar to NewContext, but it returns a pair (context.Context, context.CancelFunc).

                                                                                                                                                                                                                              Available: since v0.2.8

                                                                                                                                                                                                                              func (*MongoConnect) Ping

                                                                                                                                                                                                                              func (m *MongoConnect) Ping(ctx context.Context) error

                                                                                                                                                                                                                                Ping tries to send a "ping" request to MongoDB server.

                                                                                                                                                                                                                                func (*MongoConnect) SetDb

                                                                                                                                                                                                                                func (m *MongoConnect) SetDb(db string) *MongoConnect

                                                                                                                                                                                                                                  SetDb sets MongoDB database to connect. Note: the change does not take effect if called after Init has been called.

                                                                                                                                                                                                                                  Available since v0.2.8

                                                                                                                                                                                                                                  func (*MongoConnect) SetMongoPoolOpts

                                                                                                                                                                                                                                  func (m *MongoConnect) SetMongoPoolOpts(opts *MongoPoolOpts) *MongoConnect

                                                                                                                                                                                                                                    SetMongoPoolOpts sets MongoDB connection pool configurations. Note: the change does not take effect if called after Init has been called.

                                                                                                                                                                                                                                    Available since v0.2.8

                                                                                                                                                                                                                                    func (*MongoConnect) SetTimeoutMs

                                                                                                                                                                                                                                    func (m *MongoConnect) SetTimeoutMs(timeoutMs int) *MongoConnect

                                                                                                                                                                                                                                      SetTimeoutMs sets default timeout value (in milliseconds).

                                                                                                                                                                                                                                      Available since v0.2.8

                                                                                                                                                                                                                                      func (*MongoConnect) SetUrl

                                                                                                                                                                                                                                      func (m *MongoConnect) SetUrl(url string) *MongoConnect

                                                                                                                                                                                                                                        SetUrl sets MongoDB connection url setting. Note: the change does not take effect if called after Init has been called.

                                                                                                                                                                                                                                        Available since v0.2.8

                                                                                                                                                                                                                                        type MongoPoolOpts

                                                                                                                                                                                                                                        type MongoPoolOpts struct {
                                                                                                                                                                                                                                        	// Timeout for establishing connection to server.
                                                                                                                                                                                                                                        	// Set zero or negative value to use default value.
                                                                                                                                                                                                                                        	ConnectTimeout time.Duration
                                                                                                                                                                                                                                        	// Timeout for socket reads/writes
                                                                                                                                                                                                                                        	// Set zero or negative value to use default value.
                                                                                                                                                                                                                                        	SocketTimeout time.Duration
                                                                                                                                                                                                                                        	// Timeout for waiting for available server to execute an operation.
                                                                                                                                                                                                                                        	// Set zero or negative value to use default value.
                                                                                                                                                                                                                                        	ServerSelectionTimeout time.Duration
                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                        	// Maximum number of connections.
                                                                                                                                                                                                                                        	// Set zero or negative value to use default value.
                                                                                                                                                                                                                                        	MaxPoolSize int
                                                                                                                                                                                                                                        	// Minimum number of idle connections. Default value is 1.
                                                                                                                                                                                                                                        	MinPoolSize int
                                                                                                                                                                                                                                        }

                                                                                                                                                                                                                                          MongoPoolOpts holds options to configure MongoDB connection pool.

                                                                                                                                                                                                                                          Available: since v0.2.8

                                                                                                                                                                                                                                          type RedisPoolOpts

                                                                                                                                                                                                                                          type RedisPoolOpts struct {
                                                                                                                                                                                                                                          	// Dial timeout for establishing new connections.
                                                                                                                                                                                                                                          	// Set zero or negative value to use go-redis' default value.
                                                                                                                                                                                                                                          	DialTimeout time.Duration
                                                                                                                                                                                                                                          	// Timeout for socket reads.
                                                                                                                                                                                                                                          	// Set zero or negative value to use go-redis' default value.
                                                                                                                                                                                                                                          	ReadTimeout time.Duration
                                                                                                                                                                                                                                          	// Timeout for socket writes.
                                                                                                                                                                                                                                          	// Set zero or negative value to use go-redis' default value.
                                                                                                                                                                                                                                          	WriteTimeout time.Duration
                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                          	// Maximum number of connections.
                                                                                                                                                                                                                                          	// Set zero or negative value to use go-redis' default value.
                                                                                                                                                                                                                                          	PoolSize int
                                                                                                                                                                                                                                          	// Minimum number of idle connections. Default value is 1.
                                                                                                                                                                                                                                          	MinIdleConns int
                                                                                                                                                                                                                                          }

                                                                                                                                                                                                                                            RedisPoolOpts holds options to configure Redis connection pool.

                                                                                                                                                                                                                                            Available: since v0.2.8

                                                                                                                                                                                                                                            type SqlConnect

                                                                                                                                                                                                                                            type SqlConnect struct {
                                                                                                                                                                                                                                            	// contains filtered or unexported fields
                                                                                                                                                                                                                                            }

                                                                                                                                                                                                                                              SqlConnect holds a database/sql DB instance (https://golang.org/pkg/database/sql/#DB) that can be shared within the application.

                                                                                                                                                                                                                                              func NewSqlConnect

                                                                                                                                                                                                                                              func NewSqlConnect(driver, dsn string, defaultTimeoutMs int, poolOptions *SqlPoolOptions) (*SqlConnect, error)

                                                                                                                                                                                                                                                NewSqlConnect constructs a new SqlConnect instance.

                                                                                                                                                                                                                                                Parameters: see #NewSqlConnectWithFlavor.

                                                                                                                                                                                                                                                func NewSqlConnectWithFlavor

                                                                                                                                                                                                                                                func NewSqlConnectWithFlavor(driver, dsn string, defaultTimeoutMs int, poolOptions *SqlPoolOptions, flavor DbFlavor) (*SqlConnect, error)

                                                                                                                                                                                                                                                  NewSqlConnectWithFlavor constructs a new SqlConnect instance.

                                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                                  - driver          : database driver name
                                                                                                                                                                                                                                                  - dsn             : data source name (sample format [username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN])
                                                                                                                                                                                                                                                  - defaultTimeoutMs: default timeout for db operations, in milliseconds
                                                                                                                                                                                                                                                  - poolOptions     : connection pool options. If nil, default value is used
                                                                                                                                                                                                                                                  - flavor          : database flavor associated with the SqlConnect instance.
                                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                                  Return: the SqlConnect instance and error (if any). Note:

                                                                                                                                                                                                                                                  - In case of connection error: this function returns the SqlConnect instance and the error.
                                                                                                                                                                                                                                                  - Other error: this function returns (nil, error)
                                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                                  Available: since v0.1.0

                                                                                                                                                                                                                                                  func (*SqlConnect) Close

                                                                                                                                                                                                                                                  func (sc *SqlConnect) Close() error

                                                                                                                                                                                                                                                    Close closes the underlying 'sql.DB' instance.

                                                                                                                                                                                                                                                    func (*SqlConnect) Conn

                                                                                                                                                                                                                                                    func (sc *SqlConnect) Conn(ctx context.Context) (*sql.Conn, error)

                                                                                                                                                                                                                                                      Conn returns a single connection by either opening a new connection or returning an existing connection from the connection pool. Conn will block until either a connection is returned or ctx is canceled/timed-out.

                                                                                                                                                                                                                                                      Every leased connection must be returned to the pool after use by calling sql.Conn.Close

                                                                                                                                                                                                                                                      func (*SqlConnect) FetchRow

                                                                                                                                                                                                                                                      func (sc *SqlConnect) FetchRow(row *sql.Row, numCols int) ([]interface{}, error)

                                                                                                                                                                                                                                                        FetchRow copies the columns from the matched row into a slice and return it.

                                                                                                                                                                                                                                                        If more than one row matches the query, FetchRow uses only the first row and discards the rest. If no row matches the query, FetchRow returns (nil,nil).

                                                                                                                                                                                                                                                        func (*SqlConnect) FetchRows

                                                                                                                                                                                                                                                        func (sc *SqlConnect) FetchRows(rows *sql.Rows) ([]map[string]interface{}, error)

                                                                                                                                                                                                                                                          FetchRows loads rows from database and transform to a slice of 'map[string]interface{}' where each column's name & value is a map entry. If no row matches the query, FetchRow returns (<empty slice>, nil).

                                                                                                                                                                                                                                                          Note: FetchRows does NOT call 'rows.close()' when done!

                                                                                                                                                                                                                                                          func (*SqlConnect) FetchRowsCallback

                                                                                                                                                                                                                                                          func (sc *SqlConnect) FetchRowsCallback(rows *sql.Rows, callback func(row map[string]interface{}, err error) bool) error

                                                                                                                                                                                                                                                            FetchRowsCallback loads rows from database. For each row, FetchRowsCallback transforms it to 'map[string]interface{}', where each column's name & value is a map entry, and passes the map to the callback function. FetchRowsCallback stops the loop when there is no more row to load or 'callback' function returns 'false'.

                                                                                                                                                                                                                                                            Note: FetchRowsCallback does NOT call 'rows.close()' when done!

                                                                                                                                                                                                                                                            func (*SqlConnect) GetDB

                                                                                                                                                                                                                                                            func (sc *SqlConnect) GetDB() *sql.DB

                                                                                                                                                                                                                                                              GetDB returns the underlying 'sql.DB' instance.

                                                                                                                                                                                                                                                              func (*SqlConnect) GetDbFlavor

                                                                                                                                                                                                                                                              func (sc *SqlConnect) GetDbFlavor() DbFlavor

                                                                                                                                                                                                                                                                GetDbFlavor returns the current database flavor associated with this SqlConnect.

                                                                                                                                                                                                                                                                Available: since v0.1.0

                                                                                                                                                                                                                                                                func (*SqlConnect) GetDriver

                                                                                                                                                                                                                                                                func (sc *SqlConnect) GetDriver() string

                                                                                                                                                                                                                                                                  GetDriver returns the database driver setting.

                                                                                                                                                                                                                                                                  Available: since v0.2.8

                                                                                                                                                                                                                                                                  func (*SqlConnect) GetDsn

                                                                                                                                                                                                                                                                  func (sc *SqlConnect) GetDsn() string

                                                                                                                                                                                                                                                                    GetDsn returns the database dsn setting.

                                                                                                                                                                                                                                                                    Available: since v0.2.8

                                                                                                                                                                                                                                                                    func (*SqlConnect) GetLocation

                                                                                                                                                                                                                                                                    func (sc *SqlConnect) GetLocation() *time.Location

                                                                                                                                                                                                                                                                      GetLocation returns the timezone location associated with this SqlConnect.

                                                                                                                                                                                                                                                                      Timezone/Location rules:

                                                                                                                                                                                                                                                                      - If the database's underlying data type does not support timezone: read date/time is treated as "in-location".
                                                                                                                                                                                                                                                                      - If the database's underlying data type support timezone: read date/time is converted to the target timezone/location.
                                                                                                                                                                                                                                                                      - In any case, the returned date/time is attached with the specified timezone/location.
                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                      Available: since v0.1.2

                                                                                                                                                                                                                                                                      func (*SqlConnect) GetSqlPoolOptions

                                                                                                                                                                                                                                                                      func (sc *SqlConnect) GetSqlPoolOptions() *SqlPoolOptions

                                                                                                                                                                                                                                                                        GetSqlPoolOptions returns the database connection pool configurations.

                                                                                                                                                                                                                                                                        Available: since v0.2.8

                                                                                                                                                                                                                                                                        func (*SqlConnect) GetTimeoutMs

                                                                                                                                                                                                                                                                        func (sc *SqlConnect) GetTimeoutMs() int

                                                                                                                                                                                                                                                                          GetTimeoutMs returns default timeout value (in milliseconds).

                                                                                                                                                                                                                                                                          Available since v0.2.8

                                                                                                                                                                                                                                                                          func (*SqlConnect) Init

                                                                                                                                                                                                                                                                          func (sc *SqlConnect) Init() error

                                                                                                                                                                                                                                                                            Init should be called to initialize the SqlConnect instance before use.

                                                                                                                                                                                                                                                                            Available since v0.2.8

                                                                                                                                                                                                                                                                            func (*SqlConnect) IsConnected

                                                                                                                                                                                                                                                                            func (sc *SqlConnect) IsConnected() bool

                                                                                                                                                                                                                                                                              IsConnected returns true if the connection to the database is alive.

                                                                                                                                                                                                                                                                              func (*SqlConnect) NewContext

                                                                                                                                                                                                                                                                              func (sc *SqlConnect) NewContext(timeoutMs ...int) context.Context

                                                                                                                                                                                                                                                                                NewContext creates a new context with specified timeout in milliseconds. If there is no specified timeout, or timeout value is less than or equal to 0, the default timeout is used.

                                                                                                                                                                                                                                                                                Available: since v0.2.0 (since v0.2.8) this function return only context.Context. Use NewContextWithCancel if context.CancelFunc is needed.

                                                                                                                                                                                                                                                                                func (*SqlConnect) NewContextIfNil

                                                                                                                                                                                                                                                                                func (sc *SqlConnect) NewContextIfNil(ctx context.Context, timeoutMs ...int) context.Context

                                                                                                                                                                                                                                                                                  NewContextIfNil creates a new context with specified timeout in milliseconds if the supplied ctx is nil. Otherwise, ctx is returned as-is.

                                                                                                                                                                                                                                                                                  If there is no specified timeout, or timeout value is less than or equal to 0, the default timeout is used.

                                                                                                                                                                                                                                                                                  Available: since v0.2.8

                                                                                                                                                                                                                                                                                  func (*SqlConnect) NewContextWithCancel

                                                                                                                                                                                                                                                                                  func (sc *SqlConnect) NewContextWithCancel(timeoutMs ...int) (context.Context, context.CancelFunc)

                                                                                                                                                                                                                                                                                    NewContextWithCancel is similar to NewContext, but it returns a pair (context.Context, context.CancelFunc).

                                                                                                                                                                                                                                                                                    Available: since v0.2.8

                                                                                                                                                                                                                                                                                    func (*SqlConnect) Ping

                                                                                                                                                                                                                                                                                    func (sc *SqlConnect) Ping(ctx context.Context) error

                                                                                                                                                                                                                                                                                      Ping verifies a connection to the database is still alive, establishing a connection if necessary.

                                                                                                                                                                                                                                                                                      func (*SqlConnect) SetDbFlavor

                                                                                                                                                                                                                                                                                      func (sc *SqlConnect) SetDbFlavor(flavor DbFlavor) *SqlConnect

                                                                                                                                                                                                                                                                                        SetDbFlavor associates a database flavor with this SqlConnect.

                                                                                                                                                                                                                                                                                        Available: since v0.1.0

                                                                                                                                                                                                                                                                                        func (*SqlConnect) SetDriver

                                                                                                                                                                                                                                                                                        func (sc *SqlConnect) SetDriver(driver string) *SqlConnect

                                                                                                                                                                                                                                                                                          SetDriver sets the database driver setting. Note: the change does not take effect if called after Init has been called.

                                                                                                                                                                                                                                                                                          Available: since v0.2.8

                                                                                                                                                                                                                                                                                          func (*SqlConnect) SetDsn

                                                                                                                                                                                                                                                                                          func (sc *SqlConnect) SetDsn(dsn string) *SqlConnect

                                                                                                                                                                                                                                                                                            SetDsn sets the database dsn setting. Note: the change does not take effect if called after Init has been called.

                                                                                                                                                                                                                                                                                            Available: since v0.2.8

                                                                                                                                                                                                                                                                                            func (*SqlConnect) SetLocation

                                                                                                                                                                                                                                                                                            func (sc *SqlConnect) SetLocation(loc *time.Location) *SqlConnect

                                                                                                                                                                                                                                                                                              SetLocation associates a timezone location with this SqlConnect, used when parsing date/time data. Default value is time.UTC.

                                                                                                                                                                                                                                                                                              Timezone/Location rules:

                                                                                                                                                                                                                                                                                              - If the database's underlying data type does not support timezone: read date/time is treated as "in-location".
                                                                                                                                                                                                                                                                                              - If the database's underlying data type support timezone: read date/time is converted to the target timezone/location.
                                                                                                                                                                                                                                                                                              - In any case, the returned date/time is attached with the specified timezone/location.
                                                                                                                                                                                                                                                                                              

                                                                                                                                                                                                                                                                                              Available: since v0.1.2

                                                                                                                                                                                                                                                                                              func (*SqlConnect) SetSqlPoolOptions

                                                                                                                                                                                                                                                                                              func (sc *SqlConnect) SetSqlPoolOptions(poolOptions *SqlPoolOptions) *SqlConnect

                                                                                                                                                                                                                                                                                                SetSqlPoolOptions sets the database connection pool configurations. Note: the change does not take effect if called after Init has been called.

                                                                                                                                                                                                                                                                                                Available: since v0.2.8

                                                                                                                                                                                                                                                                                                func (*SqlConnect) SetTimeoutMs

                                                                                                                                                                                                                                                                                                func (sc *SqlConnect) SetTimeoutMs(timeoutMs int) *SqlConnect

                                                                                                                                                                                                                                                                                                  SetTimeoutMs sets default timeout value (in milliseconds).

                                                                                                                                                                                                                                                                                                  Available since v0.2.8

                                                                                                                                                                                                                                                                                                  type SqlPoolOptions

                                                                                                                                                                                                                                                                                                  type SqlPoolOptions struct {
                                                                                                                                                                                                                                                                                                  	// Maximum amount of time a connection may be reused, default is 1 hour,
                                                                                                                                                                                                                                                                                                  	// see https://golang.org/pkg/database/sql/#DB.SetConnMaxLifetime
                                                                                                                                                                                                                                                                                                  	ConnMaxLifetime time.Duration
                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                  	// Maximum number of idle connections in the pool, default is 1,
                                                                                                                                                                                                                                                                                                  	// see https://golang.org/pkg/database/sql/#DB.SetMaxIdleConns
                                                                                                                                                                                                                                                                                                  	MaxIdleConns int
                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                  	// Maximum number of open connections to the database, default is 2,
                                                                                                                                                                                                                                                                                                  	// see https://golang.org/pkg/database/sql/#DB.SetMaxOpenConns
                                                                                                                                                                                                                                                                                                  	MaxOpenConns int
                                                                                                                                                                                                                                                                                                  }

                                                                                                                                                                                                                                                                                                    SqlPoolOptions configures database connection pooling options.

                                                                                                                                                                                                                                                                                                    Directories

                                                                                                                                                                                                                                                                                                    Path Synopsis