Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
 - type AfterDeleteHandler
 - type AfterDeleteRelationsHandler
 - type AfterGetHandler
 - type AfterGetRelationHandler
 - type AfterInsertHandler
 - type AfterInsertRelationsHandler
 - type AfterListHandler
 - type AfterUpdateHandler
 - type AfterUpdateRelationsHandler
 - type BeforeDeleteHandler
 - type BeforeDeleteRelationsHandler
 - type BeforeGetHandler
 - type BeforeGetRelationHandler
 - type BeforeInsertHandler
 - type BeforeInsertRelationsHandler
 - type BeforeListHandler
 - type BeforeUpdateHandler
 - type BeforeUpdateRelationsHandler
 - type DeleteHandler
 - type DeleteMiddlewarer
 - type DeleteRelationsMiddlewarer
 - type DeleteTransactioner
 - type Endpoint
 - type EndpointsGetter
 - type GetHandler
 - type GetMiddlewarer
 - type GetRelatedTransactioner
 - type GetRelationHandler
 - type GetRelationMiddlewarer
 - type GetTransactioner
 - type InsertHandler
 - type InsertMiddlewarer
 - type InsertRelationsMiddlewarer
 - type InsertTransactioner
 - type ListHandler
 - type ListMiddlewarer
 - type ListTransactioner
 - type Middleware
 - type MiddlewareChain
 - type Server
 - type SetRelationsHandler
 - type UpdateHandler
 - type UpdateMiddlewarer
 - type UpdateRelationsMiddlewarer
 - type UpdateTransactioner
 - type VersionInitializer
 - type VersionedServer
 - type WithContextDeleteRelationer
 - type WithContextDeleter
 - type WithContextGetRelated
 - type WithContextGetter
 - type WithContextInsertRelationer
 - type WithContextInserter
 - type WithContextLister
 - type WithContextUpdateRelationer
 - type WithContextUpdater
 
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInternal is an internal server error. ErrInternal = errors.Wrap(errors.ErrInternal, "server") // ErrServer is an error related with server. ErrServer = errors.New("server") // ErrServerOptions is an error related with server options. ErrServerOptions = errors.Wrap(ErrServer, "options") // ErrURIParameter is an error related with uri parameters. ErrURIParameter = errors.Wrap(ErrServer, "uri parameter") // ErrHeader errors.Minor ErrHeader = errors.Wrap(ErrServer, "header") // ErrHeaderNotAcceptable is an error related to not acceptable request header. ErrHeaderNotAcceptable = errors.Wrap(ErrHeader, "not acceptable") // ErrUnsupportedHeader is an error related to unsupported request header. ErrUnsupportedHeader = errors.Wrap(ErrHeader, "unsupported") // ErrMissingRequiredHeader is an error related to missing required header. ErrMissingRequiredHeader = errors.Wrap(ErrHeader, "missing required") // ErrHeaderValue is an error related to request header value. ErrHeaderValue = errors.Wrap(ErrHeader, "value") )
Functions ¶
This section is empty.
Types ¶
type AfterDeleteHandler ¶
type AfterDeleteHandler interface {
	HandleAfterDelete(ctx context.Context, db database.DB, q *query.Scope, result *codec.Payload) error
}
    AfterDeleteHandler is a hook interface used to execute after API deleteQuery request.
type AfterDeleteRelationsHandler ¶
type AfterDeleteRelationsHandler interface {
	HandleAfterDeleteRelations(ctx context.Context, db database.DB, root mapping.Model, newRelations []mapping.Model, output *codec.Payload) error
}
    AfterDeleteRelationsHandler is a hook interface used to execute after API delete relations request.
type AfterGetHandler ¶
type AfterGetHandler interface {
	HandleAfterGet(ctx context.Context, db database.DB, payload *codec.Payload) error
}
    AfterGetHandler is the api hook after handling get query.
type AfterGetRelationHandler ¶
type AfterGetRelationHandler interface {
	HandleAfterGetRelation(ctx context.Context, db database.DB, result *codec.Payload) error
}
    AfterGetRelationHandler is an interface used as a hook after API request for getting relations.
type AfterInsertHandler ¶
type AfterInsertHandler interface {
	HandleAfterInsert(ctx context.Context, db database.DB, input *codec.Payload) error
}
    AfterInsertHandler is a hook handler interface after API insert query.
type AfterInsertRelationsHandler ¶
type AfterInsertRelationsHandler interface {
	HandleAfterInsertRelations(ctx context.Context, db database.DB, root mapping.Model, newRelations []mapping.Model, output *codec.Payload) error
}
    AfterInsertRelationsHandler is a hook interface used to execute after API insert relations request.
type AfterListHandler ¶
type AfterListHandler interface {
	HandleAfterList(ctx context.Context, db database.DB, payload *codec.Payload) error
}
    AfterListHandler is the api hook after handling list query.
type AfterUpdateHandler ¶
type AfterUpdateHandler interface {
	HandleAfterUpdate(ctx context.Context, db database.DB, input *codec.Payload) error
}
    AfterUpdateHandler is a hook handler interface after API update query.
type AfterUpdateRelationsHandler ¶
type AfterUpdateRelationsHandler interface {
	HandleAfterUpdateRelations(ctx context.Context, db database.DB, root mapping.Model, newRelations []mapping.Model, output *codec.Payload) error
}
    AfterUpdateRelationsHandler is a hook interface used to execute after API update relations request.
type BeforeDeleteHandler ¶
type BeforeDeleteHandler interface {
	HandleBeforeDelete(ctx context.Context, db database.DB, q *query.Scope) error
}
    BeforeDeleteHandler is a hook interface used to execute before API deleteQuery request.
type BeforeDeleteRelationsHandler ¶
type BeforeDeleteRelationsHandler interface {
	HandleBeforeDeleteRelations(ctx context.Context, db database.DB, root mapping.Model, input *codec.Payload) error
}
    BeforeDeleteRelationsHandler is a hook interface used to execute before API delete relations request.
type BeforeGetHandler ¶
type BeforeGetHandler interface {
	HandleBeforeGet(ctx context.Context, db database.DB, q *query.Scope) error
}
    BeforeGetHandler is the api hook handler before handling the query.
type BeforeGetRelationHandler ¶
type BeforeGetRelationHandler interface {
	HandleBeforeGetRelation(ctx context.Context, db database.DB, q, relatedQuery *query.Scope, relation *mapping.StructField) error
}
    BeforeGetRelationHandler is an interface used as a hook before API request for getting relations.
type BeforeInsertHandler ¶
type BeforeInsertHandler interface {
	HandleBeforeInsert(ctx context.Context, db database.DB, input *codec.Payload) error
}
    BeforeInsertHandler is a hook handler interface before API insert query.
type BeforeInsertRelationsHandler ¶
type BeforeInsertRelationsHandler interface {
	HandleBeforeInsertRelations(ctx context.Context, db database.DB, root mapping.Model, input *codec.Payload) error
}
    BeforeInsertRelationsHandler is a hook interface used to execute before API insert relations request.
type BeforeListHandler ¶
type BeforeListHandler interface {
	HandleBeforeList(ctx context.Context, db database.DB, q *query.Scope) error
}
    BeforeListHandler is the api hook handler before handling the list query.
type BeforeUpdateHandler ¶
type BeforeUpdateHandler interface {
	HandleBeforeUpdate(ctx context.Context, db database.DB, input *codec.Payload) error
}
    BeforeUpdateHandler is a hook handler interface before API update query.
type BeforeUpdateRelationsHandler ¶
type BeforeUpdateRelationsHandler interface {
	HandleBeforeUpdateRelations(ctx context.Context, db database.DB, root mapping.Model, input *codec.Payload) error
}
    BeforeUpdateRelationsHandler is a hook interface used to execute before API update relations request.
type DeleteHandler ¶
type DeleteHandler interface {
	HandleDelete(ctx context.Context, db database.DB, q *query.Scope) (*codec.Payload, error)
}
    DeleteHandler is an interface used for handling API 'deleteQuery' requests.
type DeleteMiddlewarer ¶
type DeleteMiddlewarer interface {
	DeleteMiddlewares() []Middleware
}
    DeleteMiddlewarer is an interface that gets middlewares for the 'deleteQuery' endpoint.
type DeleteRelationsMiddlewarer ¶
type DeleteRelationsMiddlewarer interface {
	DeleteRelationsMiddlewares() []Middleware
}
    DeleteRelationsMiddlewarer is an interface that gets middlewares for the 'DeleteRelation' endpoint.
type DeleteTransactioner ¶ added in v0.17.0
DeleteTransactioner is an interface that sets the delete query in transaction.
type Endpoint ¶
type Endpoint struct {
	Path        string
	HTTPMethod  string
	QueryMethod query.Method
	ModelStruct *mapping.ModelStruct
	Relation    *mapping.StructField
}
    Endpoint is a structure that represents api endpoint.
type EndpointsGetter ¶
type EndpointsGetter interface {
	// GetEndpoints is a method that gets server endpoints after initialization process.
	GetEndpoints() []*Endpoint
}
    EndpointsGetter is an interface that allows to get endpoint information.
type GetHandler ¶
type GetHandler interface {
	HandleGet(ctx context.Context, db database.DB, q *query.Scope) (*codec.Payload, error)
}
    GetHandler is the handler used to get the model
type GetMiddlewarer ¶
type GetMiddlewarer interface {
	GetMiddlewares() []Middleware
}
    GetMiddlewarer is an interface that gets middlewares for the 'Get' endpoint.
type GetRelatedTransactioner ¶ added in v0.17.0
GetRelatedTransactioner is an interface that sets the get related query in transaction.
type GetRelationHandler ¶
type GetRelationHandler interface {
	HandleGetRelation(ctx context.Context, db database.DB, modelQuery, relatedQuery *query.Scope, relation *mapping.StructField) (*codec.Payload, error)
}
    GetRelationHandler is an API interface used for handling 'GetRelation' queries.
type GetRelationMiddlewarer ¶
type GetRelationMiddlewarer interface {
	GetRelatedMiddlewares() []Middleware
}
    GetRelationMiddlewarer is an interface that gets middlewares for the 'GetRelated' endpoint.
type GetTransactioner ¶ added in v0.17.0
GetTransactioner is an interface that sets the transaction for the get query.
type InsertHandler ¶
type InsertHandler interface {
	HandleInsert(ctx context.Context, db database.DB, input *codec.Payload) (*codec.Payload, error)
}
    InsertHandler is a handler of an API insert query.
type InsertMiddlewarer ¶
type InsertMiddlewarer interface {
	InsertMiddlewares() []Middleware
}
    InsertMiddlewarer is an interface that gets the middlewares for the insert endpoint.
type InsertRelationsMiddlewarer ¶
type InsertRelationsMiddlewarer interface {
	InsertRelationsMiddlewares() []Middleware
}
    InsertRelationsMiddlewarer is an interface that gets middlewares for the 'InsertRelation' endpoint.
type InsertTransactioner ¶ added in v0.17.0
InsertTransactioner is an interface that forces model insertion in a transaction. Returned transaction options may be returned nil.
type ListHandler ¶
type ListHandler interface {
	HandleList(ctx context.Context, db database.DB, q *query.Scope) (*codec.Payload, error)
}
    ListHandler is an interface used for handling the API list request.
type ListMiddlewarer ¶
type ListMiddlewarer interface {
	ListMiddlewares() []Middleware
}
    ListMiddlewarer is an interface that gets middlewares for the 'List' endpoint.
type ListTransactioner ¶ added in v0.17.0
ListTransactioner is an interface that sets the list query in transaction.
type Middleware ¶
Middleware is a http middleware function.
type MiddlewareChain ¶
type MiddlewareChain []Middleware
MiddlewareChain is a middleware slice type that could be used as a http.Handler.
type Server ¶
type Server interface {
	EndpointsGetter
	// ListenAndServe starts listen and serve the requests.
	Serve() error
	// Shutdown defines gentle shutdown of the server and all it's connections.
	// The server shouldn't handle any more requests but let the remaining finish within given context.
	Shutdown(ctx context.Context) error
}
    Server is the interface used
type SetRelationsHandler ¶
type SetRelationsHandler interface {
	HandleSetRelations(ctx context.Context, db database.DB, model mapping.Model, newRelations []mapping.Model, relation *mapping.StructField) (*codec.Payload, error)
}
    SetRelationsHandler is an API interface that handles request for setting 'newRelations' for 'model' in field 'relation. This handler is used for all the requests (deleteQuery, update, Insert) relations.
type UpdateHandler ¶
type UpdateHandler interface {
	HandleUpdate(ctx context.Context, db database.DB, input *codec.Payload) (*codec.Payload, error)
}
    UpdateHandler is a handler interface for the API update query.
type UpdateMiddlewarer ¶
type UpdateMiddlewarer interface {
	UpdateMiddlewares() []Middleware
}
    UpdateMiddlewarer is an interface that gets middlewares for the update endpoint.
type UpdateRelationsMiddlewarer ¶
type UpdateRelationsMiddlewarer interface {
	UpdateRelationsMiddlewares() []Middleware
}
    UpdateRelationsMiddlewarer is an interface that gets middlewares for the 'UpdateRelation' endpoint.
type UpdateTransactioner ¶ added in v0.17.0
UpdateTransactioner is an interface for the model that sets the update query in transaction with provided options.
type VersionInitializer ¶
type VersionInitializer interface {
	InitializeVersion(version string, c *core.Controller) error
}
    VersionInitializer is a server that allows to initializer separate versions.
type VersionedServer ¶
type VersionedServer interface {
	VersionInitializer
	EndpointsGetter
	Serve() error
	Shutdown(ctx context.Context) error
}
    VersionedServer is a server that handles multiple versions at once.
type WithContextDeleteRelationer ¶ added in v0.17.0
type WithContextDeleteRelationer interface {
	DeleteRelationsWithContext(ctx context.Context) (context.Context, error)
}
    WithContextDeleteRelationer is an interface that sets the context for the delete relations query.
type WithContextDeleter ¶ added in v0.17.0
type WithContextDeleter interface {
	DeleteWithContext(ctx context.Context) (context.Context, error)
}
    WithContextDeleter is an interface that sets the context for the delete query.
type WithContextGetRelated ¶ added in v0.17.0
type WithContextGetRelated interface {
	GetRelatedWithContext(ctx context.Context) (context.Context, error)
}
    WithContextGetRelated is an interface that sets the context for the get related query.
type WithContextGetter ¶ added in v0.17.0
WithContextGetter is an interface that changes the get query context.
type WithContextInsertRelationer ¶ added in v0.17.0
type WithContextInsertRelationer interface {
	InsertRelationsWithContext(ctx context.Context) (context.Context, error)
}
    WithContextInsertRelationer is an interface that sets the context for the insert relations query.
type WithContextInserter ¶ added in v0.17.0
type WithContextInserter interface {
	InsertWithContext(ctx context.Context) (context.Context, error)
}
    WithContextInserter is an interface used for changing insert context.
type WithContextLister ¶ added in v0.17.0
WithContextLister is an interface that sets the context for the list query.