Documentation ¶
Index ¶
- Constants
- func GetContext() context.Context
- func New(context context.Context, databaseType int) func(databaseCompany int, config *Config) interface{}
- func SetContext(context context.Context)
- type BigCacheClient
- func (bc *BigCacheClient) Append(key string, value interface{}) error
- func (bc *BigCacheClient) Close() error
- func (bc *BigCacheClient) Delete(key string) error
- func (bc *BigCacheClient) Get(key string) (interface{}, error)
- func (bc *BigCacheClient) GetCapacity() (interface{}, error)
- func (bc *BigCacheClient) GetNumberOfRecords() int
- func (bc *BigCacheClient) Middleware(hash hash.IHash) echo.MiddlewareFunc
- func (bc *BigCacheClient) Set(key string, value interface{}, expire time.Duration) error
- func (bc *BigCacheClient) Update(key string, value interface{}, expire time.Duration) error
- type Config
- type CustomFile
- type CustomFileClient
- func (cf *CustomFileClient) CreateFolder(name string, parents ...string) (interface{}, error)
- func (cf *CustomFileClient) Delete(fileIDs []string) error
- func (cf *CustomFileClient) Download(fileID string) (interface{}, error)
- func (cf *CustomFileClient) GetMetaData(fileID string) (interface{}, error)
- func (cf *CustomFileClient) List(pageSize int64, pageToken ...string) (interface{}, error)
- func (cf *CustomFileClient) Move(fileID, oldParentID, newParentID string) (interface{}, error)
- func (cf *CustomFileClient) Upload(name string, fileContent io.Reader, parents ...string) (interface{}, error)
- type CustomKeyValue
- type DriveServices
- func (dr *DriveServices) CreateFolder(name string, parents ...string) (interface{}, error)
- func (dr *DriveServices) Delete(fileIDs []string) error
- func (dr *DriveServices) Download(fileID string) (interface{}, error)
- func (dr *DriveServices) GetMetaData(fileID string) (interface{}, error)
- func (dr *DriveServices) List(pageSize int64, pageToken ...string) (interface{}, error)
- func (dr *DriveServices) Move(fileID, oldParentID, newParentID string) (interface{}, error)
- func (dr *DriveServices) Upload(name string, fileContent io.Reader, parents ...string) (interface{}, error)
- type GoogleDrive
- type GoogleFileListModel
- type GoogleFileModel
- type IFILE
- type INoSQLDocument
- type INoSQLKeyValue
- type ISQLRelational
- type KeyValueCustomClient
- func (cl *KeyValueCustomClient) Close() error
- func (cl *KeyValueCustomClient) Delete(key string) error
- func (cl *KeyValueCustomClient) Get(key string) (interface{}, error)
- func (cl *KeyValueCustomClient) GetCapacity() (interface{}, error)
- func (cl *KeyValueCustomClient) GetMany(keys []string) (map[string]interface{}, []string, error)
- func (cl *KeyValueCustomClient) GetNumberOfRecords() int
- func (cl *KeyValueCustomClient) Middleware(hash hash.IHash) echo.MiddlewareFunc
- func (cl *KeyValueCustomClient) Range(f func(key, value interface{}) bool)
- func (cl *KeyValueCustomClient) Set(key string, value interface{}, expire time.Duration) error
- func (cl *KeyValueCustomClient) Update(key string, value interface{}, expire time.Duration) error
- type LIKE
- type MongoClient
- func (m *MongoClient) Create(databaseName, collectionName string, documents []interface{}) (interface{}, error)
- func (m *MongoClient) Delete(databaseName, collectionName string, filter interface{}) (interface{}, error)
- func (m *MongoClient) Read(databaseName, collectionName string, filter interface{}, limit int64, ...) (interface{}, error)
- func (m *MongoClient) Update(databaseName, collectionName string, filter, update interface{}) (interface{}, error)
- type MongoDB
- type Redis
- type RedisClient
- func (r *RedisClient) Append(key string, value interface{}) error
- func (r *RedisClient) Close() error
- func (r *RedisClient) Delete(key string) error
- func (r *RedisClient) Get(key string) (interface{}, error)
- func (r *RedisClient) GetCapacity() (interface{}, error)
- func (r *RedisClient) GetNumberOfRecords() int
- func (r *RedisClient) Middleware(hash hash.IHash) echo.MiddlewareFunc
- func (r *RedisClient) Set(key string, value interface{}, expire time.Duration) error
- func (r *RedisClient) Update(key string, value interface{}, expire time.Duration) error
- type SQLLikeClient
Constants ¶
const ( // DRIVE cloud services DRIVE = iota // CUSTOMFILE file services CUSTOMFILE )
const ( // CUSTOM caching on local memory CUSTOM = iota // BIGCACHE database BIGCACHE // REDIS database REDIS )
const ( // SQLRELATIONAL is SQL relational type SQLRELATIONAL = iota // NOSQLDOCUMENT is NoSQL document type NOSQLDOCUMENT // NOSQLKEYVALUE is NoSQL key-value type NOSQLKEYVALUE // FILE is file management FILE )
const ( // MONGODB database MONGODB = iota )
const ( // SQLLike database (common relational database) SQLLike = iota )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BigCacheClient ¶
type BigCacheClient struct {
Client *bigcache.BigCache
}
BigCacheClient manage all BigCache actions
func (*BigCacheClient) Append ¶
func (bc *BigCacheClient) Append(key string, value interface{}) error
Append new value base on the key provide, With Append() you can concatenate multiple entries under the same key in an lock optimized way.
func (*BigCacheClient) Close ¶
func (bc *BigCacheClient) Close() error
Close function will close BigCache connection
func (*BigCacheClient) Delete ¶
func (bc *BigCacheClient) Delete(key string) error
Delete function will delete value based on the key provided
func (*BigCacheClient) Get ¶
func (bc *BigCacheClient) Get(key string) (interface{}, error)
Get return value based on the key provided
func (*BigCacheClient) GetCapacity ¶
func (bc *BigCacheClient) GetCapacity() (interface{}, error)
GetCapacity method return redis database size
func (*BigCacheClient) GetNumberOfRecords ¶
func (bc *BigCacheClient) GetNumberOfRecords() int
GetNumberOfRecords return number of records
func (*BigCacheClient) Middleware ¶
func (bc *BigCacheClient) Middleware(hash hash.IHash) echo.MiddlewareFunc
Middleware for echo framework
type Config ¶
type Config struct { LIKE LIKE `json:"like,omitempty"` MongoDB MongoDB `json:"mongodb,omitempty"` Redis Redis `json:"redis,omitempty"` CustomKeyValue CustomKeyValue `json:"customKeyValue,omitempty"` BigCache bigcache.Config `json:"bigCache,omitempty"` GoogleDrive GoogleDrive `json:"googleDrive,omitempty"` CustomFile CustomFile `json:"customFile,omitempty"` }
Config model for database config
type CustomFile ¶
type CustomFile struct { PoolSize int `json:"poolSize"` RootServiceDirectory string `json:"rootDirectory"` }
CustomFile config model
type CustomFileClient ¶
type CustomFileClient struct {
// contains filtered or unexported fields
}
CustomFileClient manage all custom file action
func (*CustomFileClient) CreateFolder ¶
func (cf *CustomFileClient) CreateFolder(name string, parents ...string) (interface{}, error)
CreateFolder on root service directory
func (*CustomFileClient) Delete ¶
func (cf *CustomFileClient) Delete(fileIDs []string) error
Delete file/folder based on IDs (that is the list of file name)
func (*CustomFileClient) Download ¶
func (cf *CustomFileClient) Download(fileID string) (interface{}, error)
Download feature doesn't implemented for this service
func (*CustomFileClient) GetMetaData ¶
func (cf *CustomFileClient) GetMetaData(fileID string) (interface{}, error)
GetMetaData from file based on fileID (that is file name)
func (*CustomFileClient) List ¶
func (cf *CustomFileClient) List(pageSize int64, pageToken ...string) (interface{}, error)
List all of file and folder
func (*CustomFileClient) Move ¶
func (cf *CustomFileClient) Move(fileID, oldParentID, newParentID string) (interface{}, error)
Move file to new location based on fileID, oldParentID, newParentID
type CustomKeyValue ¶
type CustomKeyValue struct { MemorySize int64 `json:"memorySize"` // byte CleaningEnable bool `json:"cleaningEnable"` CleaningInterval time.Duration `json:"cleaningInterval"` // nanosecond }
CustomKeyValue config model
type DriveServices ¶
type DriveServices struct {
// contains filtered or unexported fields
}
DriveServices manage all drive action
func (*DriveServices) CreateFolder ¶
func (dr *DriveServices) CreateFolder(name string, parents ...string) (interface{}, error)
CreateFolder on drive
func (*DriveServices) Delete ¶
func (dr *DriveServices) Delete(fileIDs []string) error
Delete file/folder based on IDs
func (*DriveServices) Download ¶
func (dr *DriveServices) Download(fileID string) (interface{}, error)
Download file based on fileID
func (*DriveServices) GetMetaData ¶
func (dr *DriveServices) GetMetaData(fileID string) (interface{}, error)
GetMetaData from file based on fileID
func (*DriveServices) List ¶
func (dr *DriveServices) List(pageSize int64, pageToken ...string) (interface{}, error)
List all files based on pageSize
func (*DriveServices) Move ¶
func (dr *DriveServices) Move(fileID, oldParentID, newParentID string) (interface{}, error)
Move file to new location based on fileID, oldParentID, newParentID
type GoogleDrive ¶
type GoogleDrive struct { PoolSize int `json:"poolSize"` ByHTTPClient bool `json:"byHTTPClient"` Token string `json:"token"` Credential string `json:"credential"` }
GoogleDrive config model
type GoogleFileListModel ¶
type GoogleFileListModel struct {
drive.FileList
}
GoogleFileListModel for unmarshal object has interface type
type GoogleFileModel ¶
type GoogleFileModel struct {
drive.File
}
GoogleFileModel for unmarshal object has interface type
type IFILE ¶
type IFILE interface { List(pageSize int64, pageToken ...string) (interface{}, error) GetMetaData(fileID string) (interface{}, error) CreateFolder(name string, parents ...string) (interface{}, error) Upload(name string, fileContent io.Reader, parents ...string) (interface{}, error) Download(fileID string) (interface{}, error) Move(fileID, oldParentID, newParentID string) (interface{}, error) Delete(fileIDs []string) error }
IFILE factory pattern interface
type INoSQLDocument ¶
type INoSQLDocument interface { Create(databaseName, collectionName string, documents []interface{}) (interface{}, error) Read(databaseName, collectionName string, filter interface{}, limit int64, dataModel reflect.Type) (interface{}, error) Update(databaseName, collectionName string, filter, update interface{}) (interface{}, error) Delete(databaseName, collectionName string, filter interface{}) (interface{}, error) }
INoSQLDocument factory pattern CRUD interface
type INoSQLKeyValue ¶
type INoSQLKeyValue interface { Middleware(hash hash.IHash) echo.MiddlewareFunc Get(key string) (interface{}, error) Set(key string, value interface{}, expire time.Duration) error Update(key string, value interface{}, expire time.Duration) error Delete(key string) error GetNumberOfRecords() int GetCapacity() (interface{}, error) Close() error }
INoSQLKeyValue factory pattern interface
type ISQLRelational ¶
ISQLRelational factory pattern interface
type KeyValueCustomClient ¶
type KeyValueCustomClient struct {
// contains filtered or unexported fields
}
KeyValueCustomClient manage all custom caching actions
func (*KeyValueCustomClient) Close ¶
func (cl *KeyValueCustomClient) Close() error
Close the service and frees up resources.
func (*KeyValueCustomClient) Delete ¶
func (cl *KeyValueCustomClient) Delete(key string) error
Delete deletes the key and its value from the memory
func (*KeyValueCustomClient) Get ¶
func (cl *KeyValueCustomClient) Get(key string) (interface{}, error)
Get return value based on the key provided
func (*KeyValueCustomClient) GetCapacity ¶
func (cl *KeyValueCustomClient) GetCapacity() (interface{}, error)
GetCapacity method return redis database size
func (*KeyValueCustomClient) GetMany ¶
func (cl *KeyValueCustomClient) GetMany(keys []string) (map[string]interface{}, []string, error)
GetMany return value based on the list of keys provided
func (*KeyValueCustomClient) GetNumberOfRecords ¶
func (cl *KeyValueCustomClient) GetNumberOfRecords() int
GetNumberOfRecords return number of records
func (*KeyValueCustomClient) Middleware ¶
func (cl *KeyValueCustomClient) Middleware(hash hash.IHash) echo.MiddlewareFunc
Middleware for echo framework
func (*KeyValueCustomClient) Range ¶
func (cl *KeyValueCustomClient) Range(f func(key, value interface{}) bool)
Range over linear data structure
type LIKE ¶
type LIKE struct { DriverName string `json:"driverName"` DataSourceName string `json:"dataSourceName"` MaxConnectionLifetime time.Duration `json:"maxConnectionLifetime"` MaxConnectionIdle int `json:"maxConnectionIdle"` MaxConnectionOpen int `json:"maxConnectionOpen"` }
LIKE model for SQL-LIKE connection config
type MongoClient ¶
type MongoClient struct { Client *mongo.Client Cancel context.CancelFunc Config *MongoDB }
MongoClient manage all mongodb actions
func (*MongoClient) Create ¶
func (m *MongoClient) Create(databaseName, collectionName string, documents []interface{}) (interface{}, error)
Create the list of document on collection
func (*MongoClient) Delete ¶
func (m *MongoClient) Delete(databaseName, collectionName string, filter interface{}) (interface{}, error)
Delete document based on filter condition
func (*MongoClient) Read ¶
func (m *MongoClient) Read(databaseName, collectionName string, filter interface{}, limit int64, dataModel reflect.Type) (interface{}, error)
Read documents from collection based on filter
func (*MongoClient) Update ¶
func (m *MongoClient) Update(databaseName, collectionName string, filter, update interface{}) (interface{}, error)
Update document with new value based on filter condition
type MongoDB ¶
type MongoDB struct { User string `json:"user"` Password string `json:"password"` Hosts []string `json:"hosts"` DB string `json:"db"` Options []string `json:"options"` }
MongoDB model for MongoDB connection config
type Redis ¶
type Redis struct { Password string `json:"password"` Host string `json:"host"` DB int `json:"db"` MaxRetries int `json:"maxRetries"` }
Redis model for redis config
type RedisClient ¶
RedisClient manage all redis actions
func (*RedisClient) Append ¶
func (r *RedisClient) Append(key string, value interface{}) error
Append new value over the key provided
func (*RedisClient) Close ¶
func (r *RedisClient) Close() error
Close method will close redis connection
func (*RedisClient) Delete ¶
func (r *RedisClient) Delete(key string) error
Delete method delete value based on the key provided
func (*RedisClient) Get ¶
func (r *RedisClient) Get(key string) (interface{}, error)
Get return value based on the key provided
func (*RedisClient) GetCapacity ¶
func (r *RedisClient) GetCapacity() (interface{}, error)
GetCapacity method return redis database size
func (*RedisClient) GetNumberOfRecords ¶
func (r *RedisClient) GetNumberOfRecords() int
GetNumberOfRecords return number of records
func (*RedisClient) Middleware ¶
func (r *RedisClient) Middleware(hash hash.IHash) echo.MiddlewareFunc
Middleware for echo framework
type SQLLikeClient ¶
SQLLikeClient manage all SQL-Like actions
func (*SQLLikeClient) Execute ¶
func (c *SQLLikeClient) Execute( query string, dataModel interface{}) (interface{}, error)
Execute return results based on 'query' and 'dataModel'