Help us shape the future of Go! Take the 2026 Go Developer Survey

resources

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: Apache-2.0 Imports: 21 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 CreateOrUpdateResource

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

CreateOrUpdateResource updates resource if it existed and otherwise creates it and returns true.

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, resourceSchema *schema.Schema, resource *schema.Resource) error

CreateResourceInTransaction create 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) transaction.Filter

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

func ValidateAttachmentsForResource

func ValidateAttachmentsForResource(context middleware.Context, resourceSchema *schema.Schema, resourceMap map[string]interface{}) error

Types

type ExtensionError

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

ExtensionError is created when a problem has occurred 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 occurred 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
	Forbidden
	ForeignKeyFailed
)

The possible resource problems

Source Files

  • log.go
  • resource_management.go

Jump to

Keyboard shortcuts

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