github.com/blend/go-sdk@v1.20220411.3/selector/constants.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package selector
     9  
    10  const (
    11  	// At is a common rune.
    12  	At = rune('@')
    13  	// Colon is a common rune.
    14  	Colon = rune(':')
    15  	// Dash is a common rune.
    16  	Dash = rune('-')
    17  	// Underscore  is a common rune.
    18  	Underscore = rune('_')
    19  	// Dot is a common rune.
    20  	Dot = rune('.')
    21  	// ForwardSlash is a common rune.
    22  	ForwardSlash = rune('/')
    23  	// BackSlash is a common rune.
    24  	BackSlash = rune('\\')
    25  	// BackTick is a common rune.
    26  	BackTick = rune('`')
    27  	// Bang is a common rune.
    28  	Bang = rune('!')
    29  	// Comma is a common rune.
    30  	Comma = rune(',')
    31  	// OpenBracket is a common rune.
    32  	OpenBracket = rune('[')
    33  	// OpenParens is a common rune.
    34  	OpenParens = rune('(')
    35  	// OpenCurly is a common rune.
    36  	OpenCurly = rune('{')
    37  	// CloseBracket is a common rune.
    38  	CloseBracket = rune(']')
    39  	// CloseParens is a common rune.
    40  	CloseParens = rune(')')
    41  	// Equal is a common rune.
    42  	Equal = rune('=')
    43  	// Space is a common rune.
    44  	Space = rune(' ')
    45  	// Tab is a common rune.
    46  	Tab = rune('\t')
    47  	// Tilde is a common rune.
    48  	Tilde = rune('~')
    49  	// CarriageReturn is a common rune.
    50  	CarriageReturn = rune('\r')
    51  	// NewLine is a common rune.
    52  	NewLine = rune('\n')
    53  )
    54  
    55  const (
    56  	// OpEquals is an operator.
    57  	OpEquals = "="
    58  	// OpDoubleEquals is an operator.
    59  	OpDoubleEquals = "=="
    60  	// OpNotEquals is an operator.
    61  	OpNotEquals = "!="
    62  	// OpIn is an operator.
    63  	OpIn = "in"
    64  	// OpNotIn is an operator.
    65  	OpNotIn = "notin"
    66  )
    67  
    68  const (
    69  	// ErrInvalidOperator is returned if the operator is invalid.
    70  	ErrInvalidOperator Error = "invalid operator"
    71  	// ErrInvalidSelector is returned if there is a structural issue with the selector.
    72  	ErrInvalidSelector Error = "invalid selector"
    73  	// ErrLabelKeyEmpty indicates a key is empty.
    74  	ErrLabelKeyEmpty Error = "label key empty"
    75  	// ErrLabelKeyTooLong indicates a key is too long.
    76  	ErrLabelKeyTooLong Error = "label key too long"
    77  	// ErrLabelKeyDNSSubdomainEmpty indicates a key's "dns" subdomain is empty, i.e. it is in the form `/foo`
    78  	ErrLabelKeyDNSSubdomainEmpty Error = "label key dns subdomain empty"
    79  	// ErrLabelKeyDNSSubdomainTooLong indicates a key's "dns" subdomain is too long.
    80  	ErrLabelKeyDNSSubdomainTooLong Error = "label key dns subdomain too long; must be less than 253 characters"
    81  	// ErrLabelValueTooLong indicates a value is too long.
    82  	ErrLabelValueTooLong Error = "label value too long; must be less than 63 characters"
    83  	// ErrLabelInvalidCharacter indicates a value contains characters
    84  	ErrLabelInvalidCharacter Error = `label contains invalid characters, regex used: ([A-Za-z0-9_-.])`
    85  	// ErrLabelKeyInvalidDNSSubdomain indicates a key contains characters
    86  	ErrLabelKeyInvalidDNSSubdomain Error = `label key dns subdomain contains invalid dns characters, regex used: ([a-z0-9-.])`
    87  
    88  	// MaxLabelKeyDNSSubdomainLen is the maximum dns prefix length.
    89  	MaxLabelKeyDNSSubdomainLen = 253
    90  	// MaxLabelKeyLen is the maximum key length.
    91  	MaxLabelKeyLen = 63
    92  	// MaxLabelValueLen is the maximum value length.
    93  	MaxLabelValueLen = 63
    94  )
    95  
    96  var (
    97  	// MaxLabelKeyTotalLen is the maximum total key length.
    98  	MaxLabelKeyTotalLen = MaxLabelKeyDNSSubdomainLen + MaxLabelKeyLen + 1
    99  )