trees

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package trees provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Package trees provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Index

Constants

View Source
const (
	JWTAuthScopes = "JWTAuth.Scopes"
)

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type CreateJSONBody

type CreateJSONBody = Tree

CreateJSONBody defines parameters for Create.

type CreateJSONRequestBody

type CreateJSONRequestBody = CreateJSONBody

CreateJSONRequestBody defines body for Create for application/json ContentType.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type Error

type Error struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
}

Error defines model for Error.

type ListParams

type ListParams struct {
	// maximum number of results to return
	Limit *int32 `form:"limit,omitempty" json:"limit,omitempty"`
}

ListParams defines parameters for List.

type PGX

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

func (PGX) Count

func (P PGX) Count() (int32, error)

func (PGX) Create

func (P PGX) Create(object Tree) (*Tree, error)

func (PGX) Delete

func (P PGX) Delete(id int32) error

func (PGX) Exist

func (P PGX) Exist(id int32) bool

func (PGX) Get

func (P PGX) Get(id int32) (*Tree, error)

func (PGX) GetMaxId

func (P PGX) GetMaxId() (int32, error)

func (PGX) IsTreeActive

func (P PGX) IsTreeActive(id int32) bool

func (PGX) List

func (P PGX) List(offset, limit int) ([]*TreeList, error)

func (PGX) SearchTreesByName

func (P PGX) SearchTreesByName(pattern string) ([]*TreeList, error)

func (PGX) Update

func (P PGX) Update(id int32, object Tree) (*Tree, error)

type ServerInterface

type ServerInterface interface {
	// List returns a list of trees
	// (GET /trees)
	List(ctx echo.Context, params ListParams) error
	// Create will create a new tree
	// (POST /trees)
	Create(ctx echo.Context) error
	// Delete allows to delete a specific treeId
	// (DELETE /trees/{treeId})
	Delete(ctx echo.Context, treeId int32) error
	// Get will retrieve in backend all information about a specific treeId
	// (GET /trees/{treeId})
	Get(ctx echo.Context, treeId int32) error
	// Update allows to modify information about a specific treeId
	// (PUT /trees/{treeId})
	Update(ctx echo.Context, treeId int32) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) Create

func (w *ServerInterfaceWrapper) Create(ctx echo.Context) error

Create converts echo context to params.

func (*ServerInterfaceWrapper) Delete

func (w *ServerInterfaceWrapper) Delete(ctx echo.Context) error

Delete converts echo context to params.

func (*ServerInterfaceWrapper) Get

func (w *ServerInterfaceWrapper) Get(ctx echo.Context) error

Get converts echo context to params.

func (*ServerInterfaceWrapper) List

func (w *ServerInterfaceWrapper) List(ctx echo.Context) error

List converts echo context to params.

func (*ServerInterfaceWrapper) Update

func (w *ServerInterfaceWrapper) Update(ctx echo.Context) error

Update converts echo context to params.

type Service

type Service struct {
	Log *log.Logger

	Store       Storage
	JwtSecret   []byte
	JwtDuration int
	// contains filtered or unexported fields
}

func (Service) Create

func (s Service) Create(ctx echo.Context) error

func (Service) Delete

func (s Service) Delete(ctx echo.Context, objectId int32) error

func (Service) Get

func (s Service) Get(ctx echo.Context, objectId int32) error

func (Service) List

func (s Service) List(ctx echo.Context, params ListParams) error

func (Service) Update

func (s Service) Update(ctx echo.Context, objectId int32) error

type Storage

type Storage interface {
	// List returns the list of existing objects with the given offset and limit.
	List(offset, limit int) ([]*TreeList, error)
	// Get returns the object with the specified objects ID.
	Get(id int32) (*Tree, error)
	// GetMaxId returns the maximum value of objects id existing in store.
	GetMaxId() (int32, error)
	// Exist returns true only if a objects with the specified id exists in store.
	Exist(id int32) bool
	// Count returns the total number of objects.
	Count() (int32, error)
	// Create saves a new objects in the storage.
	Create(object Tree) (*Tree, error)
	// Update updates the objects with given ID in the storage.
	Update(id int32, object Tree) (*Tree, error)
	// Delete removes the objects with given ID from the storage.
	Delete(id int32) error
	// SearchTreesByName list of existing objects where the name contains the given search pattern or err if not found
	SearchTreesByName(pattern string) ([]*TreeList, error)
	// IsTreeActive returns true if the object with the specified id has the is_active attribute set to true
	IsTreeActive(id int32) bool
}

Storage is an interface to different implementation of persistence for Trees

func GetStorageInstance

func GetStorageInstance(dbDriver string, db database.DB, l *log.Logger) (Storage, error)

type Tree

type Tree struct {
	Comment              *string    `json:"comment,omitempty"`
	CreateTime           time.Time  `json:"create_time"`
	Creator              int32      `json:"creator"`
	Description          *string    `json:"description,omitempty"`
	ExternalId           *int32     `json:"external_id,omitempty"`
	Id                   int32      `json:"id"`
	IdValidator          *int32     `json:"id_validator,omitempty"`
	InactivationReason   *string    `json:"inactivation_reason,omitempty"`
	InactivationTime     *time.Time `json:"inactivation_time,omitempty"`
	IsActive             bool       `json:"is_active"`
	IsValidated          *bool      `json:"is_validated,omitempty"`
	LastModificationTime *time.Time `json:"last_modification_time,omitempty"`
	LastModificationUser *int32     `json:"last_modification_user,omitempty"`
	Name                 string     `json:"name"`
}

Tree defines model for Tree.

type TreeList

type TreeList struct {
	CreateTime  time.Time `json:"create_time"`
	Creator     int32     `json:"creator"`
	Description *string   `json:"description,omitempty"`
	ExternalId  *int32    `json:"external_id,omitempty"`
	Id          int32     `json:"id"`
	IsActive    bool      `json:"is_active"`
	Name        string    `json:"name"`
}

TreeList defines model for TreeList.

Jump to

Keyboard shortcuts

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