resources

package
v0.0.0-...-3f89d33 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionResource

func ActionResource(context middleware.Context, dataStore db.DB, identityService middleware.IdentityService,
	resourceSchema *schema.Schema, action schema.Action, resourceID string, data interface{},
) error

ActionResource runs custom action on resource

func ApplyPolicyForResource

func ApplyPolicyForResource(context middleware.Context, resourceSchema *schema.Schema) error

ApplyPolicyForResource applies policy filtering for response

func ApplyPolicyForResources

func ApplyPolicyForResources(context middleware.Context, resourceSchema *schema.Schema) error

ApplyPolicyForResources applies policy filtering for response

func CreateResource

func CreateResource(
	context middleware.Context,
	dataStore db.DB,
	identityService middleware.IdentityService,
	resourceSchema *schema.Schema,
	dataMap map[string]interface{},
) error

CreateResource creates the resource specified by the schema and dataMap

func CreateResourceInTransaction

func CreateResourceInTransaction(context middleware.Context, resource *schema.Resource) error

CreateResourceInTransaction craete db resource model in transaction

func DeleteResource

func DeleteResource(context middleware.Context,
	dataStore db.DB,
	resourceSchema *schema.Schema,
	resourceID string,
) error

DeleteResource deletes the resource specified by the schema and ID

func DeleteResourceInTransaction

func DeleteResourceInTransaction(context middleware.Context, resourceSchema *schema.Schema, resourceID string) error

DeleteResourceInTransaction deletes resources in a transaction

func FilterFromQueryParameter

func FilterFromQueryParameter(resourceSchema *schema.Schema,
	queryParameters map[string][]string) map[string]interface{}

FilterFromQueryParameter makes list filter from query

func GetMultipleResources

func GetMultipleResources(context middleware.Context, dataStore db.DB, resourceSchema *schema.Schema, queryParameters map[string][]string) error

GetMultipleResources returns all resources specified by the schema and query parameters

func GetResources

func GetResources(context middleware.Context, dataStore db.DB, resourceSchema *schema.Schema, filter map[string]interface{}, paginator *pagination.Paginator) error

GetResources returns specified resources without calling non in_transaction events

func GetResourcesInTransaction

func GetResourcesInTransaction(context middleware.Context, resourceSchema *schema.Schema, filter map[string]interface{}, paginator *pagination.Paginator) error

GetResourcesInTransaction returns specified resources without calling non in_transaction events

func GetSingleResource

func GetSingleResource(context middleware.Context, dataStore db.DB, resourceSchema *schema.Schema, resourceID string) error

GetSingleResource returns the resource specified by the schema and ID

func GetSingleResourceInTransaction

func GetSingleResourceInTransaction(context middleware.Context, resourceSchema *schema.Schema, resourceID string, tenantIDs []string) (err error)

GetSingleResourceInTransaction get resource in single transaction

func InTransaction

func InTransaction(context middleware.Context, dataStore db.DB, f func() error) error

InTransaction executes function in the db transaction and set it to the context

func UpdateResource

func UpdateResource(
	context middleware.Context,
	dataStore db.DB, identityService middleware.IdentityService,
	resourceSchema *schema.Schema,
	resourceID string, dataMap map[string]interface{},
) error

UpdateResource updates the resource specified by the schema and ID using the dataMap

func UpdateResourceInTransaction

func UpdateResourceInTransaction(
	context middleware.Context,
	resourceSchema *schema.Schema, resourceID string,
	dataMap map[string]interface{}, tenantIDs []string) error

UpdateResourceInTransaction updates resource in db in transaction

Types

type ExtensionError

type ExtensionError struct {
	ExceptionInfo map[string]interface{}
	// contains filtered or unexported fields
}

ExtensionError is created when a problem has occured during event handling. It contains the information required to reraise the javascript exception that caused this error.

type ResourceError

type ResourceError struct {
	Message string
	Problem ResourceProblem
	// contains filtered or unexported fields
}

ResourceError is created when an anticipated problem has occured during resource manipulations. It contains the original error, a message to the user and an integer indicating the type of the problem.

func NewResourceError

func NewResourceError(err error, message string, problem ResourceProblem) ResourceError

NewResourceError returns a new resource error

type ResourceProblem

type ResourceProblem int

ResourceProblem describes the kind of problem that occurred during resource manipulation.

const (
	InternalServerError ResourceProblem = iota
	WrongQuery
	WrongData
	NotFound
	DeleteFailed
	CreateFailed
	UpdateFailed

	Unauthorized
)

The possible resource problems

Jump to

Keyboard shortcuts

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