Documentation
¶
Overview ¶
Package tabwriter implements a write filter (tabwriter.Writer) that translates tabbed columns in input into properly aligned text.
The package is using the Elastic Tabstops algorithm described at http://nickgravgaard.com/elastictabstops/index.html.
The text/tabwriter package is frozen and is not accepting new features.
Index ¶
- Constants
- Variables
- func AddQuery(urlPath string, newQuery string) string
- func Any2String(val any) string
- func AnyToUInt(val any) (int, error)
- func ArrayContains(strs []string, needle string) bool
- func ArrayContainsAnyCase(strs []string, needle string) bool
- func ArrayToLower(arr []string) []string
- func ConvertStrToTime(str string) (time.Time, error)
- func DownloadURL(urlPath string) ([]byte, error)
- func EnvBool(name string, def bool) bool
- func EnvInt(name string, def int) int
- func EnvString(name string, def string) string
- func Err2String(err error) string
- func Fail(t *testing.T, str string, args ...any)
- func FindModelFile(name string) (string, error)
- func GetJSONPointer(data any, path string) (any, error)
- func GetStack() []string
- func GetStackAsString() string
- func HTMLify(r *http.Request, buf []byte) []byte
- func IncludeTraverse(includeArgs IncludeArgs, data map[string]any) error
- func IsNil(a any) bool
- func IsPortInUse(port int) bool
- func IsURL(str string) bool
- func JSONEscape(obj interface{}) string
- func JsonErrorToString(buf []byte, dec *json.Decoder, err error) string
- func Keys(m interface{}) []string
- func LineNum(buf []byte, pos int) int
- func MD5(str string) string
- func MakeShort(buf []byte) string
- func MaskTimestamps(input string) string
- func Match(pattern string, str string) bool
- func MaterializeProp(current any, pp *PropPath, val any, prev *PropPath) (any, error)
- func Must(err any)
- func NestedGetProp(obj any, pp *PropPath, prev *PropPath) (any, bool, error)
- func NewUUID() string
- func NormalizeStrTime(str string) (string, error)
- func NotNilBoolDef(val *any, def bool) bool
- func NotNilBoolPtr(val *bool) bool
- func NotNilInt(val *any) int
- func NotNilIntDef(val *any, def int) int
- func NotNilString(val *any) string
- func ObjectGetProp(obj any, pp *PropPath) (any, bool, error)
- func ObjectSetProp(obj map[string]any, pp *PropPath, val any) error
- func OneLine(buf []byte) []byte
- func PanicIf(b bool, msg string, args ...any)
- func Panicf(msg string, args ...any)
- func ParseCapabilitiesJSON(buf []byte) (*Capabilities, *XRError)
- func ParseJSONToObject(data []byte) (interface{}, error)
- func PrettyPrintJSON(data []byte, prefix, indent string) ([]byte, error)
- func PtrBool(b bool) *bool
- func PtrBoolDef(val *any, def bool) *bool
- func PtrInt(i int) *int
- func PtrIntDef(val *any, def int) *int
- func RemoveComments(buf []byte) []byte
- func RemoveProps(buf []byte) []byte
- func RemoveSchema(buf []byte) ([]byte, error)
- func ResetMap[M ~map[K]V, K comparable, V any](m M, key K, oldVal V)
- func ResolvePath(baseFile string, next string) string
- func Show(msg string, args ...any)
- func ShowStack()
- func SortedKeys(m interface{}) []string
- func SplitFragement(str string) (string, string)
- func String2AnySlice(strs []string) []any
- func TestPanicIf(b bool, msg string, args ...any)
- func ToJSON(obj interface{}) string
- func ToJSONOneLine(obj interface{}) string
- func Unmarshal(buf []byte, v any) error
- func ValidateJSONWithPath(data []byte, v interface{}) error
- func XCheck(t *testing.T, b bool, errStr string, args ...any)
- func XCheckErr(t *testing.T, errAny any, errStr string)
- func XCheckGreater(t *testing.T, extra string, newAny any, oldAny any)
- func XCheckNotEqual(t *testing.T, extra string, gotAny any, expAny any)
- func XEqual(t *testing.T, extra string, gotAny any, expAny any, flags ...string)
- func XGET(t *testing.T, url string) (int, string)
- func XJSONCheck(t *testing.T, gotObj any, expObj any)
- func XNoErr(t *testing.T, errAny any)
- func Xid2Abstract(str string) (string, error)
- type Capabilities
- func (c *Capabilities) APIEnabled(str string) bool
- func (c *Capabilities) FlagEnabled(str string) bool
- func (c *Capabilities) IgnoresEnabled(str string) bool
- func (c *Capabilities) MutableEnabled(str string) bool
- func (c *Capabilities) PaginationEnabled() bool
- func (c *Capabilities) ShortSelfEnabled(str string) bool
- func (c *Capabilities) SpecVersionEnabled(str string) bool
- func (c *Capabilities) StickyVersionsEnabled() bool
- func (c *Capabilities) Validate() *XRError
- type IncludeArgs
- type Object
- type Offered
- type OfferedCapability
- type OfferedItem
- type OrderedMap
- type PropPart
- type PropPath
- func MustPropPathFromDB(str string) *PropPath
- func MustPropPathFromPath(str string) *PropPath
- func MustPropPathFromUI(str string) *PropPath
- func NewPP() *PropPath
- func NewPPP(prop string) *PropPath
- func PropPathFromDB(str string) (*PropPath, error)
- func PropPathFromPath(str string) (*PropPath, error)
- func PropPathFromUI(str string) (*PropPath, error)
- func (pp *PropPath) Abstract() string
- func (pp *PropPath) Append(addPP *PropPath) *PropPath
- func (pp *PropPath) Bottom() string
- func (pp *PropPath) Clone() *PropPath
- func (pp *PropPath) DB() string
- func (pp *PropPath) Equals(other *PropPath) bool
- func (pp *PropPath) First() *PropPath
- func (pp *PropPath) HasPrefix(other *PropPath) bool
- func (pp *PropPath) I(i int) *PropPath
- func (pp *PropPath) Index(i int) *PropPath
- func (pp *PropPath) IsIndexed() int
- func (pp *PropPath) Last() *PropPart
- func (pp *PropPath) Len() int
- func (pp *PropPath) Next() *PropPath
- func (pp *PropPath) P(prop string) *PropPath
- func (pp *PropPath) Path() string
- func (pp *PropPath) Prop(prop string) *PropPath
- func (pp *PropPath) RemoveLast() *PropPath
- func (pp *PropPath) String() string
- func (pp *PropPath) Top() string
- func (pp *PropPath) UI() string
- type TabWriter
- type XRError
- func CleanArray(arr []string, full []string, text string) ([]string, *XRError)
- func IncomingObj2Map(incomingObj Object) (map[string]Object, *XRError)
- func NewXRError(daType string, subject string, args ...string) *XRError
- func ParseXRError(buf []byte) (*XRError, error)
- func ProcessIncludes(file string, buf []byte, localFiles bool) ([]byte, *XRError)
- func (xErr *XRError) AddSource(src string) *XRError
- func (xErr *XRError) AddSourceParent() *XRError
- func (xErr *XRError) GetTitle() string
- func (xErr *XRError) IsType(daType string) bool
- func (xErr *XRError) SetArgs(args ...string) *XRError
- func (xErr *XRError) SetCode(c int) *XRError
- func (xErr *XRError) SetDetail(msg string) *XRError
- func (xErr *XRError) SetDetailf(msg string, args ...any) *XRError
- func (xErr *XRError) SetHeader(name, value string) *XRError
- func (xErr *XRError) SetSubject(s string) *XRError
- func (xErr *XRError) SetTitle(t string) *XRError
- func (xErr *XRError) String() string
- func (xErr *XRError) ToJSON(baseURL string) string
- type Xid
- type XidType
Constants ¶
const ( // Ignore html tags and treat entities (starting with '&' // and ending in ';') as single characters (width = 1). FilterHTML uint = 1 << iota // Strip Escape characters bracketing escaped text segments // instead of passing them through unchanged with the text. StripEscape // Force right-alignment of cell content. // Default is left-alignment. AlignRight // Handle empty columns as if they were not present in // the input in the first place. DiscardEmptyColumns // Always use tabs for indentation columns (i.e., padding of // leading empty cells on the left) independent of padchar. TabIndent // Print a vertical bar ('|') between columns (after formatting). // Discarded columns appear as zero-width columns ("||"). DDebug )
Formatting can be controlled with these flags.
const ( ENTITY_REGISTRY = iota ENTITY_GROUP ENTITY_RESOURCE ENTITY_META ENTITY_VERSION ENTITY_MODEL ENTITY_GROUP_TYPE ENTITY_RESOURCE_TYPE ENTITY_VERSION_TYPE )
const ANY = "any"
Attribute types
const ARRAY = "array"
const BOOLEAN = "boolean"
const DB_IN = ','
If DB_IN changes then DefaultProps in init.sql needs to change too
const DB_INDEX = '#'
const DECIMAL = "decimal"
const Escape = '\xff'
To escape a text segment, bracket it with Escape characters. For instance, the tab in this string "Ignore this tab: \xff\t\xff" does not terminate a cell and constitutes a single character of width one for formatting purposes.
The value 0xff was chosen because it cannot appear in a valid UTF-8 sequence.
const HASDOCUMENT = true
const INTEGER = "integer"
const IN_CHAR = '.'
const IN_STR = string(IN_CHAR)
const MAP = "map"
const MAXVERSIONS = 0
const OBJECT = "object"
const READONLY = false
const SETDEFAULTSTICKY = true
const SETVERSIONID = true
const SINGLEVERSIONROOT = false
const SPECURL = "https://github.com/xregistry/spec/blob/main/core/spec.md"
const SPECVERSION = "1.0-rc2"
const STRICT = true
Model attribute default values
const STRING = "string"
const TIMESTAMP = "timestamp"
const UINTEGER = "uinteger"
const URI = "uri"
const URI_REFERENCE = "urireference"
const URI_TEMPLATE = "uritemplate"
const URL = "url"
const UX_IN = '.'
const XID = "xid"
const XIDTYPE = "xidtype"
Variables ¶
var AllowableAPIs = ArrayToLower([]string{
"/capabilities", "/capabilitiesoffered", "/export",
"/model", "/modelsource"})
var AllowableFlags = ArrayToLower([]string{
"binary", "collections", "doc", "epoch", "filter", "ignore", "inline",
"setdefaultversionid", "sort", "specversion"})
var AllowableIgnores = ArrayToLower([]string{
"capabilities", "defaultversionid", "defaultversionsticky", "epoch",
"modelsource", "readonly"})
var AllowableMutable = ArrayToLower([]string{
"capabilities", "entities", "model"})
var AllowableSpecVersions = ArrayToLower([]string{"1.0-rc2", SPECVERSION})
var DefaultCapabilities = &Capabilities{ APIs: AllowableAPIs, Flags: SupportedFlags, Ignores: SupportedIgnores, Mutable: AllowableMutable, Pagination: false, ShortSelf: false, SpecVersions: AllowableSpecVersions, StickyVersions: PtrBool(true), }
var GitCommit = ""
var JPtrEsc0 = regexp.MustCompile(`~0`)
var JPtrEsc1 = regexp.MustCompile(`~1`)
var MASK_SERVER = "MaskServer"
var NOMASK_INSTANCE = "NoMaskInstance"
var NOMASK_TS = "NoMaskTS"
Flags
var PanicLogSet = (os.Getenv("PANICLOG") != "")
TestPanicIf will always log the error but will only panic if the "PANICLOG" env var is set. This allows us to detect non-serious errors during testing but not in production
var REG_COMMIT = `GitCommit: [0-9a-f]*\n`
var REG_DBHOST = `DB server: .*`
var REG_INSTANCE = `"source": "[^"]*"`
var REG_RFC3339 = `\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[-+]\d{2}:\d{2})`
var REG_TSSLASH = `\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}`
var SavedREs = map[string]*regexp.Regexp{ REG_RFC3339: regexp.MustCompile(REG_RFC3339), REG_TSSLASH: regexp.MustCompile(REG_TSSLASH), REG_COMMIT: regexp.MustCompile(REG_COMMIT), REG_DBHOST: regexp.MustCompile(REG_DBHOST), REG_INSTANCE: regexp.MustCompile(REG_INSTANCE), }
var ShortChars = "" + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" + "-@" // 62-63
Valid tiny URL chars. Number of them needs to be a multiple of 2
var SupportedFlags = ArrayToLower([]string{
"binary", "collections", "doc", "epoch", "filter", "ignore", "inline",
"setdefaultversionid", "sort", "specversion"})
var SupportedIgnores = ArrayToLower([]string{
"capabilities", "defaultversionid", "defaultversionsticky", "epoch",
"modelsource", "readonly"})
var Type2Error = map[string]*XRError{ "action_not_supported": &XRError{ Code: 405, Title: `The specified action (<action>) is not supported for: <subject>.`, }, "ancestor_circular_reference": &XRError{ Code: 400, Title: `For "<subject>", the request would create a circular list of ancestors: <list>.`, }, "bad_defaultversionid": &XRError{ Code: 400, Title: `An error was found in the "defaultversionid" value specified (<value>): <error_detail>.`, }, "bad_details": &XRError{ Code: 400, Title: `Use of "$details" in this context is not allowed: <subject>.`, }, "bad_filter": &XRError{ Code: 400, Title: `An error was found in "filter" value (<value>): <error_detail>.`, }, "bad_flag": &XRError{ Code: 400, Title: `The specified flag (<flag>) is not allowed in this context: <subject>.`, }, "bad_ignore": &XRError{ Code: 400, Title: `An error was found in "ignore" value (<value>): <error_detail>.`, }, "bad_inline": &XRError{ Code: 400, Title: `An error was found in "inline" value (<value>): <error_detail>.`, }, "bad_request": &XRError{ Code: 400, Title: `<error_detail>.`, }, "bad_sort": &XRError{ Code: 400, Title: `An error was found in "sort" value (<value>): <error_detail>.`, }, "cannot_doc_xref": &XRError{ Code: 400, Title: `Retrieving the document view of a Version for "<subject>" is not allowed because it uses "xref".`, }, "capability_error": &XRError{ Code: 400, Title: `There was an error in the capabilities provided: <error_detail>.`, }, "capability_missing_specversion": &XRError{ Code: 400, Title: `The "specversions" capability needs to contain "<value>".`, }, "capability_unknown": &XRError{ Code: 400, Title: `Unknown capability specified: <field>.`, }, "capability_value": &XRError{ Code: 400, Title: `Invalid value (<value>) specified for capability "<field>". Allowable values include: <list>.`, }, "capability_wildcard": &XRError{ Code: 400, Title: `When "<field>" includes a value of "*" then no other values are allowed.`, }, "compatibility_violation": &XRError{ Code: 400, Title: `The request would cause one or more Versions of "<subject>" to violate its compatibility rule (<value>).`, }, "data_retrieval_error": &XRError{ Code: 500, Title: `The server was unable to retrieve all of the requested data.`, }, "defaultversionid_request": &XRError{ Code: 400, Title: `Processing "<subject>", the "defaultversionid" attribute is not allowed to be "request" since a Version wasn't processed.`, }, "extra_xref_attribute": &XRError{ Code: 400, Title: `Attribute "<name>" is not allowed to be present since the Resource (<subject>) uses "xref".`, }, "groups_only": &XRError{ Code: 400, Title: `Attribute "<name>" is invalid. Only Group types are allowed to be specified on this request: <subject>.`, }, "inline_noninlineable": &XRError{ Code: 400, Title: `Attempting to inline a non-inlineable attribute (<name>) on: <subject>.`, }, "invalid_attribute": &XRError{ Code: 400, Title: `The attribute "<name>" for "<subject>" is not valid: <error_detail>.`, }, "malformed_id": &XRError{ Code: 400, Title: `The specified ID value (<id>) is malformed: <error_detail>.`, }, "malformed_xid": &XRError{ Code: 400, Title: `The specified XID value (<xid>) is malformed: <error_detail>.`, }, "malformed_xref": &XRError{ Code: 400, Title: `The specified xref value (<xref>) is malformed: <error_detail>.`, }, "mismatched_epoch": &XRError{ Code: 400, Title: `The specified epoch value (<bad_epoch>) for "<subject>" does not match its current value (<epoch>).`, }, "mismatched_id": &XRError{ Code: 400, Title: `The specified "<singular>id" value (<invalid_id>) for "<subject>" needs to be "<expected_id>".`, }, "misplaced_epoch": &XRError{ Code: 400, Title: `The specified "epoch" value for "<subject>" needs to be within a "meta" entity.`, }, "missing_versions": &XRError{ Code: 400, Title: `At least one Version needs to be included in the request to process "<subject>".`, }, "model_compliance_error": &XRError{ Code: 400, Title: `The model provided would cause one or more entities in the Registry to become non-compliant.`, }, "model_error": &XRError{ Code: 400, Title: `There was an error in the model definition provided: <error_detail>.`, }, "model_required_true": &XRError{ Code: 400, Title: `Model attribute "<name>" needs to have a "required" value of "true" since a default value is provided.`, }, "model_scalar_default": &XRError{ Code: 400, Title: `Model attribute "<name>" is not allowed to have a default value since it is not a scalar.`, }, "multiple_roots": &XRError{ Code: 400, Title: `The operation would result in multiple root Versions for "<subject>", which is not allowed for "<plural>".`, }, "not_found": &XRError{ Code: 404, Title: `The targeted entity (<subject>) cannot be found.`, }, "one_resource": &XRError{ Code: 400, Title: `Only one attribute from "<list>" can be present at a time for: <subject>.`, }, "parsing_data": &XRError{ Code: 400, Title: `There was an error parsing the data: <error_detail>.`, }, "readonly": &XRError{ Code: 400, Title: `Updating a read-only entity (<subject>) is not allowed.`, }, "required_attribute_missing": &XRError{ Code: 400, Title: `One or more mandatory attributes for "<subject>" are missing: <list>.`, }, "server_error": &XRError{ Code: 500, Title: `An unexpected error occurred, please try again later.`, }, "setdefaultversionid_not_allowed": &XRError{ Code: 400, Title: `Processing "<subject>", the "setdefaultversionid" flag is not allowed to be specified for entities of type "<singular>".`, }, "setdefaultversionsticky_false": &XRError{ Code: 400, Title: `The model attribute "setdefaultversionsticky" needs to be "false" since "maxversions" is "1".`, }, "sort_noncollection": &XRError{ Code: 400, Title: `Can't sort on a non-collection result set. Query path: <subject>.`, }, "too_large": &XRError{ Code: 406, Title: `The size of the response is too large to return in a single response.`, }, "too_many_versions": &XRError{ Code: 400, Title: `When the "setdefaultversionid" flag is set to "request", only one Version is allowed to be specified in the request message.`, }, "unknown_attribute": &XRError{ Code: 400, Title: `An unknown attribute (<name>) was specified for "<subject>".`, }, "unknown_group_type": &XRError{ Code: 400, Title: `An unknown Group type (<name>) was specified in "<subject>".`, }, "unknown_id": &XRError{ Code: 400, Title: `While processing "<subject>", the "<singular>" with a "<singular>id" value of "<id>" cannot be found.`, }, "unknown_resource_type": &XRError{ Code: 400, Title: `An unknown Resource type (<name>) was specified for Group type "<group>".`, }, "unsupported_specversion": &XRError{ Code: 400, Title: `The specified "specversion" value (<specversion>) is not supported. Supported versions: <list>.`, }, "versionid_not_allowed": &XRError{ Code: 400, Title: `While creating a new Version for "<subject>", a "versionid" was specified but the "setversionid" model aspect for entities of type "<plural>" is "false".`, }, "wrong_defaultversionid": &XRError{ Code: 400, Title: `For "<subject>", the "defaultversionid" needs to be "<id>" since "defaultversionsticky" is "false".`, }, "api_not_found": &XRError{ Code: 404, Title: `The specified API is not supported: <subject>.`, }, "details_required": &XRError{ Code: 405, Title: `$details suffix is needed when using PATCH for the entity: <subject>.`, }, "extra_xregistry_header": &XRError{ Code: 400, Title: `xRegistry HTTP header "<name>" is not allowed on this request: <error_detail>.`, }, "header_error": &XRError{ Code: 400, Title: `There was an error processing HTTP header "<name>": <error_detail>.`, }, "missing_body": &XRError{ Code: 400, Title: `The request is missing an HTTP body - try '{}'.`, }, "exists": &XRError{ Code: 400, Title: `"<subject>" already exists.`, }, "client_error": &XRError{ Code: 400, Title: `<error_detail>.`, }, "parsing_response": &XRError{ Code: 400, Title: `There was an error parsing the response from the server: <error_detail>.`, }, "talking_to_server": &XRError{ Code: 400, Title: `There was an error talking to the server (<subject>): <error_detail>.`, }, }
Functions ¶
func Any2String ¶
func ArrayContains ¶
func ArrayContainsAnyCase ¶
func ArrayToLower ¶
func DownloadURL ¶
func Err2String ¶
func FindModelFile ¶
func GetStackAsString ¶
func GetStackAsString() string
func IncludeTraverse ¶
func IncludeTraverse(includeArgs IncludeArgs, data map[string]any) error
data is the current map to check for $include statements
func IsPortInUse ¶
func JSONEscape ¶
func JSONEscape(obj interface{}) string
func MD5 ¶
Convert a string into a unique MD5 string - basically just for cases where we want to create a tiny URL
func MakeShort ¶
Convert a []byte into a string that uses ShortChars as its encoding. Similar to base64 but with a larger char set.
func MaskTimestamps ¶
Mask timestamps, but if (for the same input) the same TS is used, make sure the mask result is the same for just those two
func MaterializeProp ¶
func NestedGetProp ¶
Value, Found, Error
func NormalizeStrTime ¶
func NotNilBoolDef ¶
func NotNilBoolPtr ¶
func NotNilIntDef ¶
func NotNilString ¶
func ObjectGetProp ¶
Value, Found, Error
func ObjectSetProp ¶
Given a PropPath and a value this will add the necessary golang data structures to 'obj' to materialize PropPath and set the appropriate fields to 'val'
func ParseCapabilitiesJSON ¶
func ParseCapabilitiesJSON(buf []byte) (*Capabilities, *XRError)
func ParseJSONToObject ¶
func PrettyPrintJSON ¶
PrettyPrintJSON takes a JSON []byte, prefix, and indent, and returns pretty-printed JSON []byte with the original order of attributes and arrays preserved. Note, it will NOT do error/syntax checking - maybe we should at some point
func PtrBoolDef ¶
func RemoveComments ¶
func RemoveProps ¶
func RemoveSchema ¶
func ResetMap ¶
func ResetMap[M ~map[K]V, K comparable, V any](m M, key K, oldVal V)
Either delete or change the value of a map based on "oldVal" being nil or not
func ResolvePath ¶
func SortedKeys ¶
func SortedKeys(m interface{}) []string
func SplitFragement ¶
func String2AnySlice ¶
func TestPanicIf ¶
func ToJSONOneLine ¶
func ToJSONOneLine(obj interface{}) string
func ValidateJSONWithPath ¶
ValidateJSONWithPath validates JSON data against a Go value, reporting detailed errors with paths for syntax errors, type mismatches, and unknown fields. It uses a custom parser instead of encoding/json. It handles struct fields without json tags by using the field name as the JSON key if exported, supports case-insensitive matching for JSON keys, and reports type mismatches with the Go type as expected. Error messages include "path " before the path, use a single dot for top-level paths (e.g., ".foo"),
func Xid2Abstract ¶
Types ¶
type Capabilities ¶
type Capabilities struct {
APIs []string `json:"apis"` // must not have omitempty
Flags []string `json:"flags"` // must not have omitempty
Ignores []string `json:"ignores"` // must not have omitempty
Mutable []string `json:"mutable"` // must not have omitempty
Pagination bool `json:"pagination"` // must not have omitempty
ShortSelf bool `json:"shortself"` // must not have omitempty
SpecVersions []string `json:"specversions"` // must not have omitempty
StickyVersions *bool `json:"stickyversions"` // must not have omitempty
}
func (*Capabilities) APIEnabled ¶
func (c *Capabilities) APIEnabled(str string) bool
func (*Capabilities) FlagEnabled ¶
func (c *Capabilities) FlagEnabled(str string) bool
func (*Capabilities) IgnoresEnabled ¶
func (c *Capabilities) IgnoresEnabled(str string) bool
func (*Capabilities) MutableEnabled ¶
func (c *Capabilities) MutableEnabled(str string) bool
func (*Capabilities) PaginationEnabled ¶
func (c *Capabilities) PaginationEnabled() bool
func (*Capabilities) ShortSelfEnabled ¶
func (c *Capabilities) ShortSelfEnabled(str string) bool
func (*Capabilities) SpecVersionEnabled ¶
func (c *Capabilities) SpecVersionEnabled(str string) bool
func (*Capabilities) StickyVersionsEnabled ¶
func (c *Capabilities) StickyVersionsEnabled() bool
func (*Capabilities) Validate ¶
func (c *Capabilities) Validate() *XRError
type IncludeArgs ¶
type Offered ¶
type Offered struct {
APIs OfferedCapability `json:"apis,omitempty"`
Flags OfferedCapability `json:"flags,omitempty"`
Ignores OfferedCapability `json:"ignores,omitempty"`
Mutable OfferedCapability `json:"mutable,omitempty"`
Pagination OfferedCapability `json:"pagination,omitempty"`
ShortSelf OfferedCapability `json:"shortself,omitempty"`
SpecVersions OfferedCapability `json:"specversions,omitempty"`
StickyVersions OfferedCapability `json:"stickyversions,omitempty"`
}
func GetOffered ¶
func GetOffered() *Offered
type OfferedCapability ¶
type OfferedItem ¶
type OfferedItem struct {
Type string `json:"type,omitempty"`
}
type OrderedMap ¶
OrderedMap holds key-value pairs with order preservation
func (*OrderedMap) MarshalJSON ¶
func (o *OrderedMap) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON marshaling to preserve key order
func (*OrderedMap) UnmarshalJSON ¶
func (o *OrderedMap) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom JSON unmarshaling to preserve key order
type PropPath ¶
type PropPath struct {
Parts []PropPart
}
func MustPropPathFromDB ¶
func MustPropPathFromPath ¶
func MustPropPathFromUI ¶
func PropPathFromDB ¶
func PropPathFromPath ¶
func PropPathFromUI ¶
func (*PropPath) RemoveLast ¶
type TabWriter ¶
type TabWriter struct {
// contains filtered or unexported fields
}
A TabWriter is a filter that inserts padding around tab-delimited columns in its input to align them in the output.
The TabWriter treats incoming bytes as UTF-8-encoded text consisting of cells terminated by horizontal ('\t') or vertical ('\v') tabs, and newline ('\n') or formfeed ('\f') characters; both newline and formfeed act as line breaks.
Tab-terminated cells in contiguous lines constitute a column. The TabWriter inserts padding as needed to make all cells in a column have the same width, effectively aligning the columns. It assumes that all characters have the same width, except for tabs for which a tabwidth must be specified. Column cells must be tab-terminated, not tab-separated: non-tab terminated trailing text at the end of a line forms a cell but that cell is not part of an aligned column. For instance, in this example (where | stands for a horizontal tab):
aaaa|bbb|d aa |b |dd a | aa |cccc|eee
the b and c are in distinct columns (the b column is not contiguous all the way). The d and e are not in a column at all (there's no terminating tab, nor would the column be contiguous).
The TabWriter assumes that all Unicode code points have the same width; this may not be true in some fonts or if the string contains combining characters.
If DiscardEmptyColumns is set, empty columns that are terminated entirely by vertical (or "soft") tabs are discarded. Columns terminated by horizontal (or "hard") tabs are not affected by this flag.
If a TabWriter is configured to filter HTML, HTML tags and entities are passed through. The widths of tags and entities are assumed to be zero (tags) and one (entities) for formatting purposes.
A segment of text may be escaped by bracketing it with Escape characters. The tabwriter passes escaped text segments through unchanged. In particular, it does not interpret any tabs or line breaks within the segment. If the StripEscape flag is set, the Escape characters are stripped from the output; otherwise they are passed through as well. For the purpose of formatting, the width of the escaped text is always computed excluding the Escape characters.
The formfeed character acts like a newline but it also terminates all columns in the current line (effectively calling TabWriter.Flush). Tab- terminated cells in the next line start new columns. Unless found inside an HTML tag or inside an escaped text segment, formfeed characters appear as newlines in the output.
The TabWriter must buffer input internally, because proper spacing of one line may depend on the cells in future lines. Clients must call Flush when done calling TabWriter.Write.
func NewTabWriter ¶
func NewTabWriter(output io.Writer, lineindent []byte, minwidth, tabwidth, padding int, padchar byte, flags uint) *TabWriter
NewTabWriter allocates and initializes a new TabWriter. The parameters are the same as for the Init function.
func (*TabWriter) Flush ¶
Flush should be called after the last call to TabWriter.Write to ensure that any data buffered in the TabWriter is written to output. Any incomplete escape sequence at the end is considered complete for formatting purposes.
func (*TabWriter) Init ¶
func (b *TabWriter) Init(output io.Writer, lineindent []byte, minwidth, tabwidth, padding int, padchar byte, flags uint) *TabWriter
A TabWriter must be initialized with a call to Init. The first parameter (output) specifies the filter output. The remaining parameters control the formatting:
lineindent chars to add to the front of each line (custom/new)
minwidth minimal cell width including any padding
tabwidth width of tab characters (equivalent number of spaces)
padding padding added to a cell before computing its width
padchar ASCII char used for padding
if padchar == '\t', the TabWriter will assume that the
width of a '\t' in the formatted output is tabwidth,
and cells are left-aligned independent of align_left
(for correct-looking results, tabwidth must correspond
to the tab width in the viewer displaying the result)
flags formatting control
type XRError ¶
type XRError struct {
Type string
Code int // HTTP response code
Title string
Args map[string]string
Subject string
Detail string
Instance string
Source string
Headers map[string]string // HTTP headers to include in response
}
func ParseXRError ¶
func ProcessIncludes ¶
func (*XRError) AddSourceParent ¶
Add the caller's parent func to the Source. Used by popular util func to add parent to the Source's stack trace