api

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package api defines the API V1 implementation for tenant-api.

Index

Constants

View Source
const (
	// TenantIDService is the GID service portion of the prefix.
	TenantIDService = "tnnt"

	// TenantIDResource is the GID resource portion of the prefix.
	TenantIDResource = "ten"

	// TenantIDPrefix is the full prefix for a Tenant GID.
	TenantIDPrefix = TenantIDService + TenantIDResource
)

Variables

View Source
var (
	// ErrInvalidID is returned when a ID is invalid
	ErrInvalidID = errors.New("invalid ID")

	// ErrIDNotFound is returned when a ID is not found in the path
	ErrIDNotFound = errors.New("ID not found in path")

	// ErrTenantNameMissing is returned when the Tenant Name is not defined.
	ErrTenantNameMissing = errors.New("tenant name is missing")
)

Functions

This section is empty.

Types

type PaginationParams

type PaginationParams struct {
	Limit   int    `json:"limit,omitempty"`
	Page    int    `json:"page,omitempty"`
	Cursor  string `json:"cursor,omitempty"`
	Preload bool   `json:"preload,omitempty"`
	OrderBy string `json:"orderby,omitempty"`
}

PaginationParams allow you to paginate the results

type Router

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

Router provides a router for the API

func NewRouter

func NewRouter(db *sql.DB, ps *pubsub.Client, options ...RouterOption) *Router

NewRouter creates a new APIv1 router.

func (*Router) DatabaseCheck added in v0.0.5

func (r *Router) DatabaseCheck(ctx context.Context) error

DatabaseCheck ensure the database connection is established.

func (*Router) Routes

func (r *Router) Routes(e *echo.Group)

Routes will add the routes for this API version to a router group

type RouterOption added in v0.0.5

type RouterOption func(r *Router)

RouterOption defines the router option type.

func WithLogger added in v0.0.5

func WithLogger(logger *zap.Logger) RouterOption

WithLogger sets the logger for the service.

func WithMiddleware added in v0.0.5

func WithMiddleware(mdw ...echo.MiddlewareFunc) RouterOption

WithMiddleware includes the provided middleware with the api.

Jump to

Keyboard shortcuts

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