Documentation
¶
Index ¶
- func FromProtoSchema(data string) (*models.Schema, error)
- func QueryToTrace(query string) *models.SQLTrace
- func ToProtoSchema(s *models.Schema) (string, error)
- func TraceToQuery(t *models.SQLTrace) string
- type GRPCClient
- func (c *GRPCClient) ConvertSchema(schema *models.Schema) (*models.Schema, error)
- func (c *GRPCClient) ExecuteQuery(ctx context.Context, req *proto.ExecuteQueryRequest) (*proto.ExecuteQueryResponse, error)
- func (c *GRPCClient) GetName() string
- func (c *GRPCClient) Name() string
- func (c *GRPCClient) TranslateQuery(sql string) (string, error)
- func (c *GRPCClient) Version() string
- type GRPCPluginImpl
- type GRPCServer
- func (s *GRPCServer) ConvertSchema(ctx context.Context, req *proto.ConvertSchemaRequest) (*proto.ConvertSchemaResponse, error)
- func (s *GRPCServer) ExecuteQuery(ctx context.Context, req *proto.ExecuteQueryRequest) (*proto.ExecuteQueryResponse, error)
- func (s *GRPCServer) GetName(ctx context.Context, req *proto.Empty) (*proto.NameResponse, error)
- func (s *GRPCServer) TranslateQuery(ctx context.Context, req *proto.TranslateQueryRequest) (*proto.TranslateQueryResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromProtoSchema ¶
FromProtoSchema converts a proto string representation (JSON) back to a domain Schema.
func QueryToTrace ¶
QueryToTrace creates a minimal SQLTrace from a query string.
func ToProtoSchema ¶
ToProtoSchema converts a domain Schema to its proto string representation (JSON).
func TraceToQuery ¶
TraceToQuery extracts the query string from a domain SQLTrace. This is a helper as SQLTrace <-> proto.SQLTrace (which is query string in TranslateQuery)
Types ¶
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient is an implementation of DatabasePlugin that talks over RPC.
func (*GRPCClient) ConvertSchema ¶
func (*GRPCClient) ExecuteQuery ¶
func (c *GRPCClient) ExecuteQuery(ctx context.Context, req *proto.ExecuteQueryRequest) (*proto.ExecuteQueryResponse, error)
func (*GRPCClient) GetName ¶
func (c *GRPCClient) GetName() string
Name implements plugins.Plugin interface (and DatabasePlugin via GetName wrapper if needed, but the interface says GetName) Wait, DatabasePlugin interface has GetName. plugins.Plugin has Name. We implement GetName for DatabasePlugin.
func (*GRPCClient) Name ¶
func (c *GRPCClient) Name() string
Name implements plugins.Plugin interface for compatibility if needed.
func (*GRPCClient) TranslateQuery ¶
func (c *GRPCClient) TranslateQuery(sql string) (string, error)
func (*GRPCClient) Version ¶
func (c *GRPCClient) Version() string
Version implements plugins.Plugin interface.
type GRPCPluginImpl ¶
type GRPCPluginImpl struct {
plugin.Plugin
// Impl is the actual implementation of the business logic (server side).
Impl plugins.Plugin
}
GRPCPluginImpl implements plugin.GRPCPlugin interface. It's the bridge between Hashicorp plugin system and our gRPC implementation.
func (*GRPCPluginImpl) GRPCClient ¶
func (p *GRPCPluginImpl) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*GRPCPluginImpl) GRPCServer ¶
func (p *GRPCPluginImpl) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type GRPCServer ¶
type GRPCServer struct {
proto.UnimplementedSQLTraceBenchPluginServer
Impl plugins.Plugin
}
GRPCServer implements the proto.SQLTraceBenchPluginServer interface. It receives gRPC requests and forwards them to the actual implementation (plugins.Plugin).
func (*GRPCServer) ConvertSchema ¶
func (s *GRPCServer) ConvertSchema(ctx context.Context, req *proto.ConvertSchemaRequest) (*proto.ConvertSchemaResponse, error)
func (*GRPCServer) ExecuteQuery ¶
func (s *GRPCServer) ExecuteQuery(ctx context.Context, req *proto.ExecuteQueryRequest) (*proto.ExecuteQueryResponse, error)
func (*GRPCServer) GetName ¶
func (s *GRPCServer) GetName(ctx context.Context, req *proto.Empty) (*proto.NameResponse, error)
func (*GRPCServer) TranslateQuery ¶
func (s *GRPCServer) TranslateQuery(ctx context.Context, req *proto.TranslateQueryRequest) (*proto.TranslateQueryResponse, error)