Documentation
¶
Index ¶
- func ExampleBunRouterWithBunDB(bunDB *bun.DB)
- func ExampleWithBun(bunDB *bun.DB)
- func ExampleWithBunRouter(bunDB *bun.DB)
- func ExampleWithGORM(db *gorm.DB)
- func GetEntity(ctx context.Context) string
- func GetModel(ctx context.Context) interface{}
- func GetModelPtr(ctx context.Context) interface{}
- func GetSchema(ctx context.Context) string
- func GetTableName(ctx context.Context) string
- func NewStandardBunRouter() *router.StandardBunRouterAdapter
- func NewStandardMuxRouter() *router.StandardMuxAdapter
- func SetupBunRouterRoutes(bunRouter *router.StandardBunRouterAdapter, handler *Handler)
- func SetupMuxRoutes(muxRouter *mux.Router, handler *Handler)
- func WithEntity(ctx context.Context, entity string) context.Context
- func WithModel(ctx context.Context, model interface{}) context.Context
- func WithModelPtr(ctx context.Context, modelPtr interface{}) context.Context
- func WithRequestData(ctx context.Context, schema, entity, tableName string, ...) context.Context
- func WithSchema(ctx context.Context, schema string) context.Context
- func WithTableName(ctx context.Context, tableName string) context.Context
- type GormTableCRUDRequest
- type GormTableNameInterface
- type GormTableSchemaInterface
- type Handler
- func (h *Handler) GetRelationshipInfo(modelType reflect.Type, relationName string) *common.RelationshipInfo
- func (h *Handler) Handle(w common.ResponseWriter, r common.Request, params map[string]string)
- func (h *Handler) HandleGet(w common.ResponseWriter, r common.Request, params map[string]string)
- func (h *Handler) RegisterModel(schema, name string, model interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExampleBunRouterWithBunDB ¶
ExampleBunRouterWithBunDB shows the full uptrace stack (bunrouter + Bun ORM)
func ExampleWithBun ¶
ExampleWithBun shows how to switch to Bun ORM
func ExampleWithBunRouter ¶
ExampleWithBunRouter shows how to use bunrouter from uptrace
func ExampleWithGORM ¶
ExampleWithGORM shows how to use ResolveSpec with GORM
func GetModelPtr ¶
GetModelPtr retrieves model pointer from context
func GetTableName ¶
GetTableName retrieves table name from context
func NewStandardBunRouter ¶
func NewStandardBunRouter() *router.StandardBunRouterAdapter
NewStandardBunRouter creates a router with standard BunRouter handlers
func NewStandardMuxRouter ¶
func NewStandardMuxRouter() *router.StandardMuxAdapter
NewStandardMuxRouter creates a router with standard Mux HTTP handlers
func SetupBunRouterRoutes ¶
func SetupBunRouterRoutes(bunRouter *router.StandardBunRouterAdapter, handler *Handler)
SetupBunRouterRoutes sets up bunrouter routes for the ResolveSpec API
func SetupMuxRoutes ¶
SetupMuxRoutes sets up routes for the ResolveSpec API with Mux
func WithEntity ¶
WithEntity adds entity to context
func WithModelPtr ¶
WithModelPtr adds model pointer to context
func WithRequestData ¶
func WithRequestData(ctx context.Context, schema, entity, tableName string, model, modelPtr interface{}) context.Context
WithRequestData adds all request-scoped data to context at once
func WithSchema ¶
WithSchema adds schema to context
Types ¶
type GormTableCRUDRequest ¶
type GormTableCRUDRequest struct {
Request *string `json:"_request"`
}
func (GormTableCRUDRequest) GetRequest ¶
func (r GormTableCRUDRequest) GetRequest() string
func (*GormTableCRUDRequest) SetRequest ¶
func (r *GormTableCRUDRequest) SetRequest(request string)
type GormTableNameInterface ¶
type GormTableNameInterface interface {
TableName() string
}
Legacy interfaces for backward compatibility
type GormTableSchemaInterface ¶
type GormTableSchemaInterface interface {
TableSchema() string
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles API requests using database and model abstractions
func NewHandler ¶
func NewHandler(db common.Database, registry common.ModelRegistry) *Handler
NewHandler creates a new API handler with database and registry abstractions
func NewHandlerWithBun ¶
NewHandlerWithBun creates a new Handler with Bun adapter
func NewHandlerWithGORM ¶
NewHandlerWithGORM creates a new Handler with GORM adapter
func (*Handler) GetRelationshipInfo ¶ added in v0.0.20
func (h *Handler) GetRelationshipInfo(modelType reflect.Type, relationName string) *common.RelationshipInfo
GetRelationshipInfo implements common.RelationshipInfoProvider interface
func (*Handler) RegisterModel ¶
RegisterModel allows registering models at runtime