finalizer

package
v0.0.0-...-ed11039 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Code                   code.Code                    `json:"code"`
	Message                string                       `json:"message"`
	RawLocalized           *dto.Localized               `json:"-"`
	Localized              *Localized                   `json:"localized,omitempty"`
	RequestInfo            *dto.RequestInfo             `json:"requestInfo,omitempty"`
	ResourceInfo           *dto.ResourceInfo            `json:"resourceInfo,omitempty"`
	ErrorInfo              *dto.ErrorInfo               `json:"errorInfo,omitempty"`
	HelpLinks              []*dto.HelpLink              `json:"helpLinks,omitempty"`
	RawFieldViolations     []*dto.FieldViolation        `json:"-"`
	FieldViolations        []*FieldViolation            `json:"fieldViolations,omitempty"`
	PreconditionViolations []*dto.PreconditionViolation `json:"preconditionViolations,omitempty"`
	QuotaViolations        []*dto.QuotaViolation        `json:"quotaViolations,omitempty"`
	RetryInfo              *dto.RetryInfo               `json:"retryInfo,omitempty"`
}

func Render

func Render(error *apperr.AppError, opts ...RenderOption) (*Error, error)

type FieldViolation

type FieldViolation struct {
	Locale      *language.Tag `json:"locale,omitempty"`
	Field       string        `json:"field"`
	Description string        `json:"description"`
}

type LocalizationProvider

type LocalizationProvider interface {
	Localize(messageID string, languages []language.Tag) (msg string, tag language.Tag, notFound bool, err error)
	LocalizeAny(any interface{}, languages []language.Tag) (msg string, tag language.Tag, notFound bool, err error)
}

LocalizationProvider is an interface for localization implementors

type Localized

type Localized struct {
	Locale language.Tag `json:"locale"`
	Title  string       `json:"title"`
	Text   string       `json:"text"`
}

type RenderOption

type RenderOption func(config *renderConfig)

func WithLanguages

func WithLanguages(languages []language.Tag) RenderOption

func WithLocalizationProvider

func WithLocalizationProvider(provider LocalizationProvider) RenderOption

func WithLogger

func WithLogger(logger liblog.Logger) RenderOption

Jump to

Keyboard shortcuts

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