Documentation
¶
Index ¶
- Constants
- Variables
- type Engine
- type Environment
- type Event
- func (m *Event) GetBody() []byte
- func (m *Event) GetCorrelationId() string
- func (m *Event) GetData() interface{}
- func (m *Event) GetDebug() bool
- func (m *Event) GetExchange() string
- func (m *Event) GetName() string
- func (m *Event) GetReplyTo() IReplyTo
- func (m *Event) GetRoutingKey() string
- func (m *Event) NilBody() bool
- type GrpcClient
- type GrpcConfig
- type GrpcServer
- type HttpServer
- type IEnvironment
- type IEvent
- type IFrameworkRabbitMQPublisher
- type IGrpcClient
- type IGrpcConfig
- type IGrpcServer
- type IGrpcServiceClient
- type IGrpcServiceClientPool
- type IGrpcServiceClientSingle
- type IHttpServer
- type IMongoDB
- type IMongoDBRepository
- type IMySQL
- type IMySQLRepository
- type IRabbitBody
- type IRabbitMQConfig
- type IRabbitMQConsumer
- type IRabbitMQDsn
- type IRabbitMQPublisher
- type IRabbitMQServer
- type IRabbitMQServiceClient
- type IRedis
- type IRedisRepository
- type IReplyTo
- type ISystemInfo
- type ITcpClient
- type ITcpConfig
- type ITcpServer
- type ITcpServiceClient
- type ITcpServiceHandler
- type IWebSocketBody
- type IWebSocketEvent
- type IWebSocketEventHandler
- type IWebSocketRoute
- type IWebSocketServer
- type IdentityNetwork
- type IdentityService
- type IdentitySource
- type MongoDB
- func (r *MongoDB) GetConnectTimeout() int
- func (r *MongoDB) GetDatabase() string
- func (r *MongoDB) GetDsn() string
- func (r *MongoDB) GetMaxConnIdleTime() int
- func (r *MongoDB) GetMaxPoolSize() uint64
- func (r *MongoDB) GetMaxRetries() int
- func (r *MongoDB) GetMinPoolSize() uint64
- func (r *MongoDB) GetRepositories() []IMongoDBRepository
- func (r *MongoDB) GetServerSelectionTimeout() int
- func (r *MongoDB) GetSocketTimeout() int
- type MySQL
- func (mysql *MySQL) DebugMode() bool
- func (mysql *MySQL) GetCharset() string
- func (mysql *MySQL) GetConnMaxLifetime() int
- func (mysql *MySQL) GetDatabase() string
- func (mysql *MySQL) GetDisableNestedTransaction() bool
- func (mysql *MySQL) GetDsn() string
- func (mysql *MySQL) GetHost() string
- func (mysql *MySQL) GetLoc() string
- func (mysql *MySQL) GetMaxIdleConns() int
- func (mysql *MySQL) GetMaxOpenConns() int
- func (mysql *MySQL) GetMaxRetries() int
- func (mysql *MySQL) GetParseTime() string
- func (mysql *MySQL) GetPassword() string
- func (mysql *MySQL) GetPort() string
- func (mysql *MySQL) GetQueryFields() bool
- func (mysql *MySQL) GetRepositories() []IMySQLRepository
- func (mysql *MySQL) GetUsername() string
- func (mysql *MySQL) Migration() bool
- type RabbitBody
- type RabbitMQConfig
- type RabbitMQConsumer
- func (r *RabbitMQConsumer) GenerateReplyTo() (replyTo ReplyTo)
- func (r *RabbitMQConsumer) GetBody() IRabbitBody
- func (r *RabbitMQConsumer) GetConcurrentCall() int
- func (r *RabbitMQConsumer) GetDebug() bool
- func (r *RabbitMQConsumer) GetExchange() string
- func (r *RabbitMQConsumer) GetExchangeType() string
- func (r *RabbitMQConsumer) GetListener() func(Engine)
- func (r *RabbitMQConsumer) GetName() string
- func (r *RabbitMQConsumer) GetPrefetchCount() int
- func (r *RabbitMQConsumer) GetPrefetchSize() int
- func (r *RabbitMQConsumer) GetQueue() string
- func (r *RabbitMQConsumer) GetRoutingKey() string
- type RabbitMQDsn
- type RabbitMQPublisher
- type RabbitMQServer
- func (r *RabbitMQServer) GetAutoAck() bool
- func (r *RabbitMQServer) GetConsumers() []IRabbitMQConsumer
- func (r *RabbitMQServer) GetHost() string
- func (r *RabbitMQServer) GetPassword() string
- func (r *RabbitMQServer) GetPort() string
- func (r *RabbitMQServer) GetPublishers() []IRabbitMQPublisher
- func (r *RabbitMQServer) GetUsername() string
- func (r *RabbitMQServer) GetVHost() string
- type Redis
- func (r *Redis) DebugMode() bool
- func (r *Redis) GetDatabase() int
- func (r *Redis) GetDialTimeout() int
- func (r *Redis) GetDsn() string
- func (r *Redis) GetHost() string
- func (r *Redis) GetMaxRetries() int
- func (r *Redis) GetMinIdleConns() int
- func (r *Redis) GetPassword() string
- func (r *Redis) GetPoolSize() int
- func (r *Redis) GetPoolTimeout() int
- func (r *Redis) GetPort() string
- func (r *Redis) GetReadTimeout() int
- func (r *Redis) GetRepositories() []IRedisRepository
- func (r *Redis) GetUsername() string
- func (r *Redis) GetWriteTimeout() int
- type Replica
- type ReplyTo
- type Repository
- type Response
- type SqLite
- type TcpClient
- type TcpConfig
- type TcpServer
- type WebSocketBody
- type WebSocketEvent
- type WebSocketEventHandler
- type WebSocketRoute
- type WebSocketServer
Constants ¶
const ( CLIENT_GRPC_NAME = "lets-service" CLIENT_GRPC_HOST = "127.0.0.1" CLIENT_GRPC_PORT = "5100" )
Default grpc configuration
const ( SERVER_HTTP_PORT = "5000" SERVER_HTTP_MODE = "debug" )
Default gRPC configuration
const ( MONGODB_DSN = "mongodb://localhost:27017" MONGODB_DATABASE = "default" // Pool configuration defaults MONGODB_MAX_POOL_SIZE = 100 // Default MongoDB recommendation MONGODB_MIN_POOL_SIZE = 10 // Keep connections warm MONGODB_MAX_CONN_IDLE_TIME = 300 // 5 minutes idle before cleanup MONGODB_CONNECT_TIMEOUT = 10 // Initial connection timeout MONGODB_SERVER_SELECTION_TIMEOUT = 5 // Replica set selection MONGODB_SOCKET_TIMEOUT = 30 // Read/write operations timeout MONGODB_MAX_RETRIES = 3 // Standard retry )
const ( MYSQL_DB_HOST = "localhost" MYSQL_DB_PORT = "3306" MYSQL_DB_USERNAME = "root" MYSQL_DB_PASSWORD = "" MYSQL_DB_DATABASE = "lets" MYSQL_DB_CHARSET = "utf8" MYSQL_DB_PARSE_TIME = "True" MYSQL_DB_LOC = "Local" MYSQL_DB_MIGRATION = false // Pool configuration defaults MYSQL_MAX_IDLE_CONNS = 10 // Conservative for MySQL // If you have 5 app instances: Max pool size should be: 151 ÷ 5 = 30 connections per instance MYSQL_MAX_OPEN_CONNS = 30 MYSQL_CONN_MAX_LIFETIME = 300 // 5 minutes (rotate connections) MYSQL_MAX_RETRIES = 3 )
const ( LISTEN_RABBIT_NAME = "Default Manager" LISTEN_RABBIT_VHOST = "/" LISTEN_RABBIT_EXCHANGE = "" LISTEN_RABBIT_EXCHANGE_TYPE = amqp091.ExchangeDirect LISTEN_RABBIT_ROUTING_KEY = "" LISTEN_RABBIT_QUEUE = "" LISTEN_RABBIT_DEBUG = true )
Default configuration
const ( RQ_USERNAME = "guest" RQ_PASSWORD = "guest" RQ_HOST = "localhost" RQ_PORT = "5672" RQ_VHOST = "/" )
Default configuration
const ( CALLER_RABBIT_NAME_EXAMPLE = "default-name" CALLER_RABBIT_EXCHANGE_EXAMPLE = "default-exchange" CALLER_RABBIT_DEBUG_EXAMPLE = false )
Default configuration
const ( RABBIT_HOST = "localhost" RABBIT_PORT = "5672" RABBIT_USERNAME = "guest" RABBIT_PASSWORD = "guest" RABBIT_VHOST = "/" )
Default configuration
const ( REDIS_HOST = "localhost" REDIS_PORT = "6379" REDIS_USERNAME = "" REDIS_PASSWORD = "" REDIS_DATABASE = 0 // Pool configuration defaults REDIS_POOL_SIZE = 50 // 50-100 for most apps REDIS_MIN_IDLE_CONNS = 10 // Keep warm connections REDIS_MAX_RETRIES = 3 // Standard retry REDIS_DIAL_TIMEOUT = 5 // Network timeout REDIS_READ_TIMEOUT = 3 // Fast read timeout REDIS_WRITE_TIMEOUT = 3 // Fast write timeout REDIS_POOL_TIMEOUT = 4 // Wait for connection )
const ( CLIENT_TCP_NAME = "lets-connect-tcp" CLIENT_TCP_HOST = "127.0.0.1" CLIENT_TCP_PORT = "5050" CLIENT_TCP_MODE = "debug" )
Default grpc configuration
const ( SERVER_TCP_PORT = "5050" SERVER_TCP_MODE = "debug" )
Default gRPC configuration
const ( SERVER_WS_PORT = "5050" SERVER_WS_MODE = "debug" )
Default gRPC configuration
const (
SERVER_GRPC_PORT = "5100"
)
Default grpc server configuration
Variables ¶
var ( ErrNotImplemented = errors.New("not implemented function") ErrCantCreate = errors.New("cant create") )
Functions ¶
This section is empty.
Types ¶
type Environment ¶
Serve information
func (*Environment) GetDebug ¶
func (e *Environment) GetDebug() string
func (*Environment) GetName ¶
func (e *Environment) GetName() string
type Event ¶
type Event struct {
Name string
Exchange string // Service exchange.
RoutingKey string // Service routing key.
Data interface{}
ReplyTo IReplyTo
CorrelationId string
Debug bool
Body IRabbitBody
}
func (*Event) GetCorrelationId ¶
func (*Event) GetExchange ¶
func (*Event) GetReplyTo ¶
func (*Event) GetRoutingKey ¶
type GrpcClient ¶
type GrpcClient struct {
Name string // Client name (e.g transaction-grpc)
Host string // Hostname or IP address of the gRPC server
Port string // Port
ClientOptions []grpc.DialOption
Clients []IGrpcServiceClient
MaxPoolConnections int // Maximum number of connections in the connection pool, it will use round robin pool
}
Client information
func (*GrpcClient) GetClientOptions ¶
func (gc *GrpcClient) GetClientOptions() []grpc.DialOption
Get Client Option
func (*GrpcClient) GetMaxPoolConnectionsPerAddress ¶ added in v1.0.8
func (gc *GrpcClient) GetMaxPoolConnectionsPerAddress() int
type GrpcConfig ¶
type GrpcConfig struct {
Server IGrpcServer
Clients []IGrpcClient
}
GRPC configuration struct
func (*GrpcConfig) GetClients ¶
func (g *GrpcConfig) GetClients() []IGrpcClient
Get gRPC client configuration
func (*GrpcConfig) GetServer ¶
func (g *GrpcConfig) GetServer() IGrpcServer
Get gRPC server configuration
type GrpcServer ¶
type GrpcServer struct {
Port string
Router func(*grpc.Server)
ServerOptions []grpc.ServerOption
}
Server information
func (*GrpcServer) GetServerOptions ¶
func (g *GrpcServer) GetServerOptions() []grpc.ServerOption
Get Router
type HttpServer ¶
type HttpServer struct {
Port string
Middleware func(*gin.Engine)
Router func(*gin.Engine)
Gzip bool
Mode string
}
Serve information
func (*HttpServer) GetMiddleware ¶
func (hs *HttpServer) GetMiddleware() func(*gin.Engine)
Get Middleware
type IEnvironment ¶
type IGrpcClient ¶
type IGrpcClient interface {
GetName() string
GetHost() string
GetPort() string
GetClientOptions() []grpc.DialOption
GetClients() []IGrpcServiceClient
GetMaxPoolConnectionsPerAddress() int
}
Interface for grpc method
type IGrpcConfig ¶
type IGrpcConfig interface {
GetServer() IGrpcServer
GetClients() []IGrpcClient
}
GRPC configuration interface
type IGrpcServer ¶
type IGrpcServer interface {
GetPort() string
GetRouter() func(*grpc.Server)
GetServerOptions() []grpc.ServerOption
}
Interface for gRPC
type IGrpcServiceClient ¶
type IGrpcServiceClient interface{}
Base marker interface for service clients; optional capabilities below
type IGrpcServiceClientPool ¶ added in v1.0.8
type IGrpcServiceClientPool interface {
SetConnectionPool([]*grpc.ClientConn)
}
Optional capability: receive full pool for per-request selection
type IGrpcServiceClientSingle ¶ added in v1.0.8
type IGrpcServiceClientSingle interface {
SetConnection(*grpc.ClientConn)
}
Optional capability: single connection setter
type IHttpServer ¶
type IHttpServer interface {
GetPort() string
GetMode() string
GetMiddleware() func(*gin.Engine)
GetRouter() func(*gin.Engine)
GetGzip() bool
}
Interface for accessable method
type IMongoDB ¶
type IMongoDB interface {
GetDsn() string
GetDatabase() string
GetRepositories() []IMongoDBRepository
// Connection pool configuration
GetMaxPoolSize() uint64
GetMinPoolSize() uint64
GetMaxConnIdleTime() int // in seconds
GetConnectTimeout() int // in seconds
GetServerSelectionTimeout() int // in seconds
GetSocketTimeout() int // in seconds
GetMaxRetries() int
}
type IMongoDBRepository ¶
type IMySQL ¶
type IMySQL interface {
GetHost() string
GetPort() string
GetUsername() string
GetPassword() string
GetDatabase() string
GetCharset() string
GetParseTime() string
GetLoc() string
DebugMode() bool
GetRepositories() []IMySQLRepository
GetDsn() string
Migration() bool
GetQueryFields() bool
GetDisableNestedTransaction() bool
// Connection pool configuration
GetMaxIdleConns() int
GetMaxOpenConns() int
GetConnMaxLifetime() int // in seconds
GetMaxRetries() int
}
type IRabbitBody ¶
type IRabbitMQConfig ¶
type IRabbitMQConfig interface {
GetServers() []IRabbitMQServer
}
type IRabbitMQConsumer ¶
type IRabbitMQConsumer interface {
GetName() string
GetExchange() string
GetExchangeType() string
GetRoutingKey() string
GetQueue() string
GetDebug() bool
GetListener() func(Engine)
GenerateReplyTo() ReplyTo
GetBody() IRabbitBody
GetPrefetchCount() int
GetPrefetchSize() int
GetConcurrentCall() int
}
Interface for dsn accessable method
type IRabbitMQDsn ¶
type IRabbitMQDsn interface {
GetHost() string
GetPort() string
GetUsername() string
GetPassword() string
GetVirtualHost() string
}
Interface for dsn accessable method
type IRabbitMQPublisher ¶
type IRabbitMQPublisher interface {
GetName() string
GetClients() []IRabbitMQServiceClient
}
Interface for dsn accessable method
type IRabbitMQServer ¶
type IRabbitMQServer interface {
GetHost() string
GetPort() string
GetUsername() string
GetPassword() string
GetVHost() string
GetConsumers() []IRabbitMQConsumer
GetPublishers() []IRabbitMQPublisher
GetAutoAck() bool
}
type IRabbitMQServiceClient ¶
type IRabbitMQServiceClient interface {
SetConnection(IFrameworkRabbitMQPublisher)
}
type IRedis ¶
type IRedis interface {
GetHost() string
GetPort() string
GetUsername() string
GetPassword() string
GetDatabase() int
GetDsn() string
// DebugMode() bool
GetRepositories() []IRedisRepository
// Connection pool configuration
GetPoolSize() int
GetMinIdleConns() int
GetMaxRetries() int
GetDialTimeout() int // in seconds
GetReadTimeout() int // in seconds
GetWriteTimeout() int // in seconds
GetPoolTimeout() int // in seconds
}
type IRedisRepository ¶
type ISystemInfo ¶ added in v1.0.5
type ISystemInfo interface {
// EnableNetworkInfo controls whether to collect and display network information
EnableNetworkInfo() bool
// EnableReplicaInfo controls whether to collect and display replica information
EnableReplicaInfo() bool
// EnableStartupBanner controls whether to display the startup banner
EnableStartupBanner() bool
// EnableVerboseNetworkInfo controls whether to display verbose network details
EnableVerboseNetworkInfo() bool
}
ISystemInfo provides configuration for system information display
type ITcpClient ¶
type ITcpClient interface {
GetName() string
GetHost() string
GetPort() string
GetMode() string
GetClients() []ITcpServiceClient
}
Interface for grpc method
type ITcpConfig ¶
type ITcpConfig interface {
GetServers() []ITcpServer
GetClients() []ITcpClient
}
GRPC configuration interface
type ITcpServer ¶
type ITcpServer interface {
GetPort() string
GetMode() string
GetHandler() ITcpServiceHandler
}
Interface for accessable method
type ITcpServiceClient ¶
type ITcpServiceClient interface {
OnConnect()
OnDisconnect()
}
type ITcpServiceHandler ¶
type ITcpServiceHandler interface {
OnConnect()
OnDisconnect()
}
type IWebSocketBody ¶
type IWebSocketEvent ¶
type IWebSocketEventHandler ¶
type IWebSocketEventHandler interface {
Event(string, func(IWebSocketEvent))
Call(string, IWebSocketEvent)
}
Engine for controller
type IWebSocketRoute ¶
type IWebSocketServer ¶
type IWebSocketServer interface {
GetPort() string
GetMode() string
GetRoutes() []IWebSocketRoute
}
Interface for accessable method
type IdentityNetwork ¶
type IdentityService ¶
type IdentityService struct {
Name string
Description string
ServiceDns string `desc:"Service DNS"`
Layer string `desc:"Microservice Layer"`
Author string
}
Serve information
type IdentitySource ¶
type MongoDB ¶
type MongoDB struct {
Dsn string
Database string
Repositories []IMongoDBRepository
}
func (*MongoDB) GetConnectTimeout ¶ added in v1.0.4
GetConnectTimeout returns the connection timeout in seconds
func (*MongoDB) GetDatabase ¶
func (*MongoDB) GetMaxConnIdleTime ¶ added in v1.0.4
GetMaxConnIdleTime returns the maximum connection idle time in seconds
func (*MongoDB) GetMaxPoolSize ¶ added in v1.0.4
GetMaxPoolSize returns the maximum number of connections in the pool
func (*MongoDB) GetMaxRetries ¶ added in v1.0.4
GetMaxRetries returns the maximum number of retry attempts
func (*MongoDB) GetMinPoolSize ¶ added in v1.0.4
GetMinPoolSize returns the minimum number of connections in the pool
func (*MongoDB) GetRepositories ¶
func (r *MongoDB) GetRepositories() []IMongoDBRepository
func (*MongoDB) GetServerSelectionTimeout ¶ added in v1.0.4
GetServerSelectionTimeout returns the server selection timeout in seconds
func (*MongoDB) GetSocketTimeout ¶ added in v1.0.4
GetSocketTimeout returns the socket timeout in seconds
type MySQL ¶
type MySQL struct {
Host string
Port string
Username string
Password string
Database string
Charset string
ParseTime string
Loc string
Debug bool
Gorm *gorm.DB
DB *sql.DB
Repositories []IMySQLRepository
EnableMigration bool
QueryFields bool
DisableNestedTransaction bool
}
func (*MySQL) GetCharset ¶
func (*MySQL) GetConnMaxLifetime ¶ added in v1.0.4
GetConnMaxLifetime returns the maximum amount of time a connection may be reused (in seconds)
func (*MySQL) GetDatabase ¶
func (*MySQL) GetDisableNestedTransaction ¶
func (*MySQL) GetMaxIdleConns ¶ added in v1.0.4
GetMaxIdleConns returns the maximum number of connections in the idle connection pool
func (*MySQL) GetMaxOpenConns ¶ added in v1.0.4
GetMaxOpenConns returns the maximum number of open connections to the database
func (*MySQL) GetMaxRetries ¶ added in v1.0.4
GetMaxRetries returns the maximum number of retry attempts for connection
func (*MySQL) GetParseTime ¶
func (*MySQL) GetPassword ¶
func (*MySQL) GetQueryFields ¶
func (*MySQL) GetRepositories ¶
func (mysql *MySQL) GetRepositories() []IMySQLRepository
func (*MySQL) GetUsername ¶
type RabbitBody ¶
type RabbitBody struct {
Payload interface{}
Event string `json:"event"`
Data interface{} `json:"data"`
}
func (*RabbitBody) Setup ¶
func (rb *RabbitBody) Setup()
type RabbitMQConfig ¶
type RabbitMQConfig struct {
Servers []IRabbitMQServer
}
func (*RabbitMQConfig) GetServers ¶
func (r *RabbitMQConfig) GetServers() []IRabbitMQServer
type RabbitMQConsumer ¶
type RabbitMQConsumer struct {
Name string `json:"name" hidden:"true"`
Exchange string `json:"exchange" hidden:"true"`
ExchangeType string `json:"type" hidden:"true"`
RoutingKey string `json:"routing_key" hidden:"true"`
Queue string `json:"queue" hidden:"true"`
Debug string `json:"debug" hidden:"true"`
Listener func(Engine)
CustomPayload IRabbitBody `json:"custom_payload" hidden:"true"`
PrefetchCount int `json:"prefetch_count" hidden:"true"`
PrefetchSize int `json:"prefetch_size" hidden:"true"`
ConcurrentCall int `json:"concurrent_call" hidden:"true"`
}
Target host information.
func (*RabbitMQConsumer) GenerateReplyTo ¶
func (r *RabbitMQConsumer) GenerateReplyTo() (replyTo ReplyTo)
Generating reply to payload.
func (*RabbitMQConsumer) GetBody ¶
func (r *RabbitMQConsumer) GetBody() IRabbitBody
Get payload structure for received message.
func (*RabbitMQConsumer) GetConcurrentCall ¶ added in v1.0.3
func (r *RabbitMQConsumer) GetConcurrentCall() int
func (*RabbitMQConsumer) GetExchange ¶
func (r *RabbitMQConsumer) GetExchange() string
Get Exchange.
func (*RabbitMQConsumer) GetExchangeType ¶
func (r *RabbitMQConsumer) GetExchangeType() string
Get Exchange Type.
func (*RabbitMQConsumer) GetListener ¶
func (r *RabbitMQConsumer) GetListener() func(Engine)
Get Listener.
func (*RabbitMQConsumer) GetPrefetchCount ¶
func (r *RabbitMQConsumer) GetPrefetchCount() int
Get Prefetch Count.
func (*RabbitMQConsumer) GetPrefetchSize ¶
func (r *RabbitMQConsumer) GetPrefetchSize() int
GetPrefetchSize prefetch size
func (*RabbitMQConsumer) GetRoutingKey ¶
func (r *RabbitMQConsumer) GetRoutingKey() string
Get Routing Key.
type RabbitMQDsn ¶
type RabbitMQDsn struct {
Host, Port, Username, Password, VirtualHost string
}
Target host information.
func (*RabbitMQDsn) GetVirtualHost ¶
func (rtm *RabbitMQDsn) GetVirtualHost() string
Get VirtualHost.
type RabbitMQPublisher ¶
type RabbitMQPublisher struct {
Name string `json:"name"`
Clients []IRabbitMQServiceClient
}
Target host information.
func (*RabbitMQPublisher) GetClients ¶
func (r *RabbitMQPublisher) GetClients() []IRabbitMQServiceClient
Get Clients.
type RabbitMQServer ¶
type RabbitMQServer struct {
Host string
Port string
Username string
Password string
VirtualHost string
Consumers []IRabbitMQConsumer
Publishers []IRabbitMQPublisher
AutoAck bool
}
Target host information.
func (*RabbitMQServer) GetConsumers ¶
func (r *RabbitMQServer) GetConsumers() []IRabbitMQConsumer
Get Consumers.
func (*RabbitMQServer) GetPublishers ¶
func (r *RabbitMQServer) GetPublishers() []IRabbitMQPublisher
Get Publisher.
type Redis ¶
type Redis struct {
Host string
Port string
Username string
Password string
Database int
Debug bool
Repositories []IRedisRepository
}
func (*Redis) GetDatabase ¶
func (*Redis) GetDialTimeout ¶ added in v1.0.4
GetDialTimeout returns dial timeout in seconds
func (*Redis) GetMaxRetries ¶ added in v1.0.4
GetMaxRetries returns the maximum number of retries before giving up
func (*Redis) GetMinIdleConns ¶ added in v1.0.4
GetMinIdleConns returns the minimum number of idle connections
func (*Redis) GetPassword ¶
func (*Redis) GetPoolSize ¶ added in v1.0.4
GetPoolSize returns the maximum number of socket connections
func (*Redis) GetPoolTimeout ¶ added in v1.0.4
GetPoolTimeout returns pool timeout in seconds
func (*Redis) GetReadTimeout ¶ added in v1.0.4
GetReadTimeout returns read timeout in seconds
func (*Redis) GetRepositories ¶
func (r *Redis) GetRepositories() []IRedisRepository
func (*Redis) GetUsername ¶
func (*Redis) GetWriteTimeout ¶ added in v1.0.4
GetWriteTimeout returns write timeout in seconds
type ReplyTo ¶
func (*ReplyTo) SetRoutingKey ¶
type Repository ¶
type Repository struct {
DB *gorm.DB
Mu *sync.RWMutex
Con *sql.DB
// sync
DbName string
Table string
}
func (*Repository) DatabaseName ¶
func (tbl *Repository) DatabaseName() string
Get database name of this repository
func (*Repository) SetDriver ¶
func (tbl *Repository) SetDriver(db *gorm.DB, mu *sync.RWMutex)
Implement types.IMySQLRepository.
func (*Repository) TableName ¶
func (tbl *Repository) TableName() string
Get table name of this repository
type Response ¶
type Response struct {
Code int `json:"code"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
}
Extender internal response
type SqLite ¶
type SqLite struct {
Debug bool
DBPath string
Repositories []IMySQLRepository
EnableMigration bool
QueryFields bool
DisableNestedTransaction bool
// contains filtered or unexported fields
}
func (*SqLite) GetConnMaxLifetime ¶ added in v1.0.4
GetConnMaxLifetime returns the maximum amount of time a connection may be reused (in seconds)
func (*SqLite) GetMaxIdleConns ¶ added in v1.0.4
GetMaxIdleConns returns the maximum number of connections in the idle connection pool SQLite benefits from low connection counts
func (*SqLite) GetMaxOpenConns ¶ added in v1.0.4
GetMaxOpenConns returns the maximum number of open connections to the database SQLite doesn't benefit from high connection counts
type TcpClient ¶
type TcpClient struct {
Name string
Host string
Port string
Mode string
Clients []ITcpServiceClient
}
Client information
type TcpConfig ¶
type TcpConfig struct {
Servers []ITcpServer
Clients []ITcpClient
}
GRPC configuration struct
func (*TcpConfig) GetClients ¶
func (tcp *TcpConfig) GetClients() []ITcpClient
Get gRPC client configuration
func (*TcpConfig) GetServers ¶
func (tcp *TcpConfig) GetServers() []ITcpServer
Get gRPC server configuration
type TcpServer ¶
type TcpServer struct {
Port string
Mode string
Handler ITcpServiceHandler
}
Serve information
type WebSocketBody ¶
type WebSocketBody struct {
Action string `json:"action"`
Data interface{} `json:"data"`
}
func (*WebSocketBody) GetAction ¶
func (wsb *WebSocketBody) GetAction() string
func (*WebSocketBody) GetData ¶
func (wsb *WebSocketBody) GetData() interface{}
func (*WebSocketBody) SetAction ¶
func (wsb *WebSocketBody) SetAction(action string)
func (*WebSocketBody) SetData ¶
func (wsb *WebSocketBody) SetData(data interface{})
func (*WebSocketBody) Setup ¶
func (wsb *WebSocketBody) Setup()
type WebSocketEvent ¶
type WebSocketEvent struct {
Connection *websocket.Conn
Name string
Data interface{}
Debug bool
Body IWebSocketBody
}
func (*WebSocketEvent) GetBody ¶
func (m *WebSocketEvent) GetBody() []byte
func (*WebSocketEvent) GetConnection ¶
func (m *WebSocketEvent) GetConnection() *websocket.Conn
func (*WebSocketEvent) GetData ¶
func (m *WebSocketEvent) GetData() interface{}
func (*WebSocketEvent) GetDebug ¶
func (m *WebSocketEvent) GetDebug() bool
func (*WebSocketEvent) GetName ¶
func (m *WebSocketEvent) GetName() string
func (*WebSocketEvent) NilBody ¶
func (m *WebSocketEvent) NilBody() bool
type WebSocketEventHandler ¶
type WebSocketEventHandler struct {
Debug bool
// contains filtered or unexported fields
}
Engine for controller
func (*WebSocketEventHandler) Call ¶
func (me *WebSocketEventHandler) Call(name string, event IWebSocketEvent)
func (*WebSocketEventHandler) Event ¶
func (me *WebSocketEventHandler) Event(name string, handler func(IWebSocketEvent))
type WebSocketRoute ¶
type WebSocketRoute struct {
Path string
Handlers func(IWebSocketEventHandler) // Service to inject
CustomPayload IWebSocketBody
// contains filtered or unexported fields
}
func (*WebSocketRoute) Initialize ¶
func (wsr *WebSocketRoute) Initialize(server *gin.Engine, debug bool)
func (*WebSocketRoute) SetupHandler ¶
func (wsr *WebSocketRoute) SetupHandler()
type WebSocketServer ¶
type WebSocketServer struct {
Port string
Mode string
Routes []IWebSocketRoute
}
Serve information
func (*WebSocketServer) GetRoutes ¶
func (wss *WebSocketServer) GetRoutes() []IWebSocketRoute
Get Router
Source Files
¶
- environment.go
- grpc.client.go
- grpc.go
- grpc.server.go
- http.server.go
- identity.go
- mongo.go
- mongo.repository.go
- mysql.go
- mysql.repository.go
- rabbit.consumer.go
- rabbit.dsn.go
- rabbit.engine.go
- rabbit.event.go
- rabbit.message.go
- rabbit.publisher.go
- rabbitmq.go
- redis.go
- redis.repository.go
- response.go
- sqlite.client.go
- tcp.client.go
- tcp.go
- tcp.server.go
- websocket.engine.go
- websocket.event.go
- websocket.go
- websocket.message.go
- websocket.router.go