Versions in this module Expand all Collapse all v1 v1.0.0 Oct 17, 2023 Changes in this version + var DefaultClientCodec = &ClientCodec + var DefaultTRPCLogger = NewTRPCLogger(logger.Config{ ... }) + var NewClientProxy = func(name string, opts ...client.Option) (*gorm.DB, error) + var NewConnPool = func(name string, opts ...client.Option) ConnPool + type Client struct + Client client.Client + ServiceName string + func (gc *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (gorm.ConnPool, error) + func (gc *Client) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + func (gc *Client) GetDBConn() (*sql.DB, error) + func (gc *Client) Ping() error + func (gc *Client) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) + func (gc *Client) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) + func (gc *Client) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row + type ClientCodec struct + func (c *ClientCodec) Decode(msg codec.Msg, buffer []byte) (body []byte, err error) + func (c *ClientCodec) Encode(msg codec.Msg, body []byte) (buffer []byte, err error) + type ClientTransport struct + DefaultPoolConfig PoolConfig + PoolConfigs map[string]PoolConfig + SQLDB map[string]*sql.DB + SQLDBLock sync.RWMutex + func NewClientTransport(opt ...transport.ClientTransportOption) *ClientTransport + func (ct *ClientTransport) GetDB(serviceName, dsn string) (*sql.DB, error) + func (ct *ClientTransport) RoundTrip(ctx context.Context, reqBuf []byte, callOpts ...transport.RoundTripOption) (rspBuf []byte, err error) + type Config struct + Logger *loggerConfig + MaxIdle int + MaxLifetime int + MaxOpen int + Service []struct{ ... } + type ConnPool interface + BeginTx func(ctx context.Context, opts *sql.TxOptions) (gorm.ConnPool, error) + ExecContext func(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + GetDBConn func() (*sql.DB, error) + Ping func() error + PrepareContext func(ctx context.Context, query string) (*sql.Stmt, error) + QueryContext func(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) + QueryRowContext func(ctx context.Context, query string, args ...interface{}) *sql.Row + type MockLogger struct + func NewMockLogger(ctrl *gomock.Controller) *MockLogger + func (m *MockLogger) Debug(arg0 ...interface{}) + func (m *MockLogger) Debugf(arg0 string, arg1 ...interface{}) + func (m *MockLogger) EXPECT() *MockLoggerMockRecorder + func (m *MockLogger) Error(arg0 ...interface{}) + func (m *MockLogger) Errorf(arg0 string, arg1 ...interface{}) + func (m *MockLogger) Fatal(arg0 ...interface{}) + func (m *MockLogger) Fatalf(arg0 string, arg1 ...interface{}) + func (m *MockLogger) GetLevel(arg0 string) log.Level + func (m *MockLogger) Info(arg0 ...interface{}) + func (m *MockLogger) Infof(arg0 string, arg1 ...interface{}) + func (m *MockLogger) SetLevel(arg0 string, arg1 log.Level) + func (m *MockLogger) Sync() error + func (m *MockLogger) Trace(arg0 ...interface{}) + func (m *MockLogger) Tracef(arg0 string, arg1 ...interface{}) + func (m *MockLogger) Warn(arg0 ...interface{}) + func (m *MockLogger) Warnf(arg0 string, arg1 ...interface{}) + func (m *MockLogger) With(arg0 ...log.Field) log.Logger + func (m *MockLogger) WithFields(arg0 ...string) log.Logger + type MockLoggerMockRecorder struct + func (mr *MockLoggerMockRecorder) Debug(arg0 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Debugf(arg0 interface{}, arg1 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Error(arg0 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Errorf(arg0 interface{}, arg1 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Fatal(arg0 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Fatalf(arg0 interface{}, arg1 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) GetLevel(arg0 interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Info(arg0 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Infof(arg0 interface{}, arg1 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) SetLevel(arg0, arg1 interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Sync() *gomock.Call + func (mr *MockLoggerMockRecorder) Trace(arg0 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Tracef(arg0 interface{}, arg1 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Warn(arg0 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) Warnf(arg0 interface{}, arg1 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) With(arg0 ...interface{}) *gomock.Call + func (mr *MockLoggerMockRecorder) WithFields(arg0 ...interface{}) *gomock.Call + type OpEnum int + const OpBeginTx + const OpCommit + const OpExecContext + const OpGetDB + const OpPing + const OpPrepareContext + const OpQueryContext + const OpQueryRowContext + const OpRollback + func (op OpEnum) String() string + type Plugin struct + func (m *Plugin) Setup(name string, configDesc plugin.Decoder) (err error) + func (m *Plugin) Type() string + type PoolConfig struct + DriverName string + MaxIdle int + MaxLifetime time.Duration + MaxOpen int + type Request struct + Args []interface{} + Op OpEnum + Query string + Tx *sql.Tx + TxOptions *sql.TxOptions + type Response struct + DB *sql.DB + Result sql.Result + Row *sql.Row + Rows *sql.Rows + Stmt *sql.Stmt + Tx *sql.Tx + type TRPCLogger struct + func NewTRPCLogger(config logger.Config) *TRPCLogger + func (p *TRPCLogger) Error(ctx context.Context, format string, args ...interface{}) + func (p *TRPCLogger) Info(ctx context.Context, format string, args ...interface{}) + func (p *TRPCLogger) LogMode(level logger.LogLevel) logger.Interface + func (p *TRPCLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) + func (p *TRPCLogger) Warn(ctx context.Context, format string, args ...interface{}) + type TxClient struct + Client *Client + Tx *sql.Tx + func (txgc *TxClient) Commit() error + func (txgc *TxClient) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + func (txgc *TxClient) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) + func (txgc *TxClient) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) + func (txgc *TxClient) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row + func (txgc *TxClient) Rollback() error