shared

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParamName            = "name"
	ParamProject         = "project"
	APIV1Prefix          = "/api/v1"
	PathDashboard        = "dashboards"
	PathDatasource       = "datasources"
	PathFolder           = "folders"
	PathGlobalDatasource = "globaldatasources"
	PathGlobalVariable   = "globalvariables"
	PathProject          = "projects"
	PathVariable         = "variables"
)

Variables

View Source
var (
	InternalError   = &PersesError{message: "internal server error"}
	NotFoundError   = &PersesError{message: "document not found"}
	ConflictError   = &PersesError{message: "document already exists"}
	BadRequestError = &PersesError{message: "bad request"}
)
View Source
var ProjectResourcePathList = []string{
	PathDashboard, PathDatasource, PathFolder, PathVariable,
}

ProjectResourcePathList is containing the list of the resource path that are part of a project.

Functions

func GetProjectParameter added in v0.12.0

func GetProjectParameter(ctx echo.Context) string

func HandleBadRequestError added in v0.26.0

func HandleBadRequestError(msg string) error

func HandleError

func HandleError(err error) error

HandleError is translating the given error to the echoHTTPError

Types

type Parameters

type Parameters struct {
	Project string
	Name    string
}

type PersesError

type PersesError struct {
	// contains filtered or unexported fields
}

func (*PersesError) Error

func (e *PersesError) Error() string

type Toolbox

type Toolbox interface {
	Create(ctx echo.Context, entity api.Entity) error
	Update(ctx echo.Context, entity api.Entity) error
	Delete(ctx echo.Context) error
	Get(ctx echo.Context) error
	List(ctx echo.Context, q databaseModel.Query) error
}

Toolbox is an interface that defines the different methods that can be used in the different endpoint of the API. This is a way to align the code of the different endpoint.

func NewToolBox

func NewToolBox(service ToolboxService) Toolbox

type ToolboxService

type ToolboxService interface {
	Create(entity api.Entity) (interface{}, error)
	Update(entity api.Entity, parameters Parameters) (interface{}, error)
	Delete(parameters Parameters) error
	Get(parameters Parameters) (interface{}, error)
	List(q databaseModel.Query, parameters Parameters) (interface{}, error)
}

Directories

Path Synopsis
sql
Package dependency provides different manager that will be used to instantiate the different services and daos of the API.
Package dependency provides different manager that will be used to instantiate the different services and daos of the API.

Jump to

Keyboard shortcuts

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