Documentation
¶
Index ¶
- Variables
- func NewResource(service schema.Service) api.Resource
- func NewService(db *sql.DB, dsConfig *config.DatasourceConfig) (schema.Service, error)
- type AtlasInspector
- func (i *AtlasInspector) InspectSchema(ctx context.Context) (*as.Schema, error)
- func (i *AtlasInspector) InspectTable(ctx context.Context, name string) (*as.Table, error)
- func (i *AtlasInspector) InspectTriggers(ctx context.Context) ([]*as.Trigger, error)
- func (i *AtlasInspector) InspectViews(ctx context.Context) ([]*as.View, error)
- type DefaultService
- func (s *DefaultService) GetTableSchema(ctx context.Context, name string) (*schema.TableSchema, error)
- func (s *DefaultService) ListTables(ctx context.Context) ([]schema.Table, error)
- func (s *DefaultService) ListTriggers(ctx context.Context) ([]schema.Trigger, error)
- func (s *DefaultService) ListViews(ctx context.Context) ([]schema.View, error)
- type GetTableSchemaParams
- type Inspector
- type Resource
Constants ¶
This section is empty.
Variables ¶
var ErrTableNotFound = errors.New("table not found")
ErrTableNotFound is returned when a table does not exist.
var ErrUnsupportedDbType = errors.New("unsupported database type")
var Module = fx.Module( "vef:schema", fx.Provide( NewService, fx.Annotate( NewResource, fx.ResultTags(`group:"vef:api:resources"`), ), ), )
Module is the FX module for schema inspection functionality.
Functions ¶
func NewResource ¶
NewResource creates a new schema inspection resource.
func NewService ¶
NewService creates a new schema service.
Types ¶
type AtlasInspector ¶
type AtlasInspector struct {
// contains filtered or unexported fields
}
func (*AtlasInspector) InspectSchema ¶
func (*AtlasInspector) InspectTable ¶
func (*AtlasInspector) InspectTriggers ¶
func (*AtlasInspector) InspectViews ¶
type DefaultService ¶
type DefaultService struct {
// contains filtered or unexported fields
}
DefaultService is the default implementation of schema.Service.
func (*DefaultService) GetTableSchema ¶
func (s *DefaultService) GetTableSchema(ctx context.Context, name string) (*schema.TableSchema, error)
GetTableSchema returns detailed structure information about a specific table.
func (*DefaultService) ListTables ¶
ListTables returns all tables in the current database/schema.
func (*DefaultService) ListTriggers ¶
ListTriggers returns all triggers in the current database/schema.
type GetTableSchemaParams ¶
GetTableSchemaParams contains parameters for getting table schema details.
type Inspector ¶
type Inspector interface {
// InspectSchema inspects the current database schema.
InspectSchema(ctx context.Context) (*as.Schema, error)
// InspectTable inspects a specific table.
InspectTable(ctx context.Context, name string) (*as.Table, error)
// InspectViews inspects all views in the current database schema.
InspectViews(ctx context.Context) ([]*as.View, error)
// InspectTriggers inspects all triggers in the current database schema.
InspectTriggers(ctx context.Context) ([]*as.Trigger, error)
}
Inspector wraps Atlas inspection capabilities for read-only schema inspection.
type Resource ¶
Resource handles schema inspection Api endpoints.
func (*Resource) GetTableSchema ¶
func (r *Resource) GetTableSchema(ctx fiber.Ctx, params GetTableSchemaParams) error
GetTableSchema returns detailed structure information about a specific table.
func (*Resource) ListTables ¶
ListTables returns all tables in the current database/schema.
func (*Resource) ListTriggers ¶
ListTriggers returns all triggers in the current database/schema.