internal

package
v0.0.0-...-5905bd6 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProjectNameByID = map[db.ProjectID]models.Project{
		1: models.ProjectDemo,
		2: models.ProjectDemoTwo,
	}
	ProjectIDByName = map[models.Project]db.ProjectID{
		models.ProjectDemo:    1,
		models.ProjectDemoTwo: 2,
	}
)
View Source
var (
	DemoTwoKanbanStepsNameByID = map[db.KanbanStepID]models.DemoTwoKanbanSteps{
		5: models.DemoTwoKanbanStepsReceived,
	}
	DemoTwoKanbanStepsIDByName = map[models.DemoTwoKanbanSteps]db.KanbanStepID{
		models.DemoTwoKanbanStepsReceived: 5,
	}
)
View Source
var (
	DemoWorkItemTypesNameByID = map[db.WorkItemTypeID]models.DemoWorkItemTypes{
		1: models.DemoWorkItemTypesType1,
	}
	DemoWorkItemTypesIDByName = map[models.DemoWorkItemTypes]db.WorkItemTypeID{
		models.DemoWorkItemTypesType1: 1,
	}
)
View Source
var DemoKanbanStepsStepOrderByID = map[db.KanbanStepID]int{
	1: 0,
	2: 1,
	3: 2,
	4: 3,
}
View Source
var DemoTwoKanbanStepsStepOrderByID = map[db.KanbanStepID]int{
	5: 1,
}

Functions

func BuildAPIURL

func BuildAPIURL(subpaths ...string) string

BuildAPIURL returns a fully-qualified URL with the given path elements accounting for reverse proxy configuration.

func NewAppConfig

func NewAppConfig() error

NewAppConfig initializes app config from current environment variables. config can be replaced with subsequent calls.

func NewErrorWithLocf

func NewErrorWithLocf(code models.ErrorCode, loc []string, format string, a ...any) error

NewErrorWithLocf instantiates a new error with error location.

func NewErrorf

func NewErrorf(code models.ErrorCode, format string, a ...any) error

NewErrorf instantiates a new error.

func SetupSwaggerUI

func SetupSwaggerUI(url string, specPath, swaggerUIDir string) error

SetupSwaggerUI sets url in the Swagger docs to the endpoint where specPath is served.

func WrapErrorWithLocf

func WrapErrorWithLocf(orig error, code models.ErrorCode, loc []string, format string, a ...interface{}) error

WrapErrorWithLocf appends a given `path` to loc.

func WrapErrorf

func WrapErrorf(orig error, code models.ErrorCode, format string, a ...any) error

WrapErrorf returns a wrapped error.

Types

type AppConfig

type AppConfig struct {
	Postgres   PostgresConfig
	Redis      RedisConfig
	OIDC       OIDCConfig
	SuperAdmin SuperAdminConfig

	Domain       string `env:"DOMAIN"`
	APIPort      string `env:"API_PORT"`
	APIVersion   string `env:"API_VERSION"`
	APIPrefix    string `env:"API_PREFIX"`
	AppEnv       string `env:"APP_ENV"`
	SigningKey   string `env:"SIGNING_KEY"`
	BuildVersion string `env:"BUILD_VERSION"`
}

AppConfig contains app settings.

var (

	// Config returns the app global config initialized from environment variables.
	// [Read] locks not needed if there are no writes involved. Config is only populated at startup so there won't be any more writes.
	Config *AppConfig
)

type Error

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

Error represents an error that could be wrapping another error, It includes a code for determining what triggered the error.

func (*Error) Cause

func (e *Error) Cause() error

Cause returns the root error cause in the chain.

func (*Error) Code

func (e *Error) Code() models.ErrorCode

Code returns the code representing this error.

func (*Error) Error

func (e *Error) Error() string

Error returns the message, when wrapping errors the wrapped error is returned.

func (*Error) Loc

func (e *Error) Loc() []string

Loc returns the accumulated error location.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the wrapped error, if any.

type OIDCConfig

type OIDCConfig struct {
	ClientID     string `env:"OIDC_CLIENT_ID"`
	ClientSecret string `env:"OIDC_CLIENT_SECRET"`
	Issuer       string `env:"OIDC_ISSUER"`
	Scopes       string `env:"OIDC_SCOPES"`
	Domain       string `env:"OIDC_DOMAIN"`
}

type PostgresConfig

type PostgresConfig struct {
	// Port represents the db port to use in the application, depending on setup (dockerized or not).
	Port         int    `env:"DB_PORT"`
	User         string `env:"POSTGRES_USER"`
	Password     string `env:"POSTGRES_PASSWORD"`
	Server       string `env:"POSTGRES_SERVER"`
	DB           string `env:"POSTGRES_DB"`
	TraceEnabled bool   `env:"POSTGRES_TRACE,false"`
}

type RedisConfig

type RedisConfig struct {
	DB   int    `env:"REDIS_DB"`
	Host string `env:"REDIS_HOST"`
}

type SuperAdminConfig

type SuperAdminConfig struct {
	DefaultEmail string `env:"DEFAULT_SUPERADMIN_EMAIL"`
}

Directories

Path Synopsis
Package client provides primitives to interact with the openapi HTTP API.
Package client provides primitives to interact with the openapi HTTP API.
gen-schema generates OpenAPI v3 schema portions from code.
gen-schema generates OpenAPI v3 schema portions from code.
envvartesting
Code generated by counterfeiter.
Code generated by counterfeiter.
Package models provides primitives to interact with the openapi HTTP API.
Package models provides primitives to interact with the openapi HTTP API.
pb
python-ml-app-protos/tfidf/v1/v1testing
Code generated by counterfeiter.
Code generated by counterfeiter.
repostesting
Code generated by counterfeiter.
Code generated by counterfeiter.
Package rest provides primitives to interact with the openapi HTTP API.
Package rest provides primitives to interact with the openapi HTTP API.
utils

Jump to

Keyboard shortcuts

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