resolvespec

package
v0.0.58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExampleBunRouterWithBunDB

func ExampleBunRouterWithBunDB(bunDB *bun.DB)

ExampleBunRouterWithBunDB shows the full uptrace stack (bunrouter + Bun ORM)

func ExampleWithBun

func ExampleWithBun(bunDB *bun.DB)

ExampleWithBun shows how to switch to Bun ORM

func ExampleWithBunRouter

func ExampleWithBunRouter(bunDB *bun.DB)

ExampleWithBunRouter shows how to use bunrouter from uptrace

func ExampleWithGORM

func ExampleWithGORM(db *gorm.DB)

ExampleWithGORM shows how to use ResolveSpec with GORM

func GetEntity

func GetEntity(ctx context.Context) string

GetEntity retrieves entity from context

func GetModel

func GetModel(ctx context.Context) interface{}

GetModel retrieves model from context

func GetModelPtr

func GetModelPtr(ctx context.Context) interface{}

GetModelPtr retrieves model pointer from context

func GetSchema

func GetSchema(ctx context.Context) string

GetSchema retrieves schema from context

func GetTableName

func GetTableName(ctx context.Context) string

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

func SetupMuxRoutes(muxRouter *mux.Router, handler *Handler)

SetupMuxRoutes sets up routes for the ResolveSpec API with Mux

func WithEntity

func WithEntity(ctx context.Context, entity string) context.Context

WithEntity adds entity to context

func WithModel

func WithModel(ctx context.Context, model interface{}) context.Context

WithModel adds model to context

func WithModelPtr

func WithModelPtr(ctx context.Context, modelPtr interface{}) context.Context

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

func WithSchema(ctx context.Context, schema string) context.Context

WithSchema adds schema to context

func WithTableName

func WithTableName(ctx context.Context, tableName string) context.Context

WithTableName adds table name 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

func NewHandlerWithBun(db *bun.DB) *Handler

NewHandlerWithBun creates a new Handler with Bun adapter

func NewHandlerWithGORM

func NewHandlerWithGORM(db *gorm.DB) *Handler

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) Handle

func (h *Handler) Handle(w common.ResponseWriter, r common.Request, params map[string]string)

Handle processes API requests through router-agnostic interface

func (*Handler) HandleGet

func (h *Handler) HandleGet(w common.ResponseWriter, r common.Request, params map[string]string)

HandleGet processes GET requests for metadata

func (*Handler) RegisterModel

func (h *Handler) RegisterModel(schema, name string, model interface{}) error

RegisterModel allows registering models at runtime

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL