Documentation ¶
Overview ¶
Package toolbox - useful set of utilities/abstractions developed as part of datastore connectivity and testing (viant/dsc, viant/dsunit).
Index ¶
- Constants
- Variables
- func AsBoolean(value interface{}) bool
- func AsCompatibleFunctionParameters(function interface{}, parameters []interface{}) ([]interface{}, error)
- func AsFloat(value interface{}) float64
- func AsIndentJSONText(source interface{}) (string, error)
- func AsInt(value interface{}) int
- func AsJSONText(source interface{}) (string, error)
- func AsMap(source interface{}) map[string]interface{}
- func AsSlice(sourceSlice interface{}) []interface{}
- func AsString(input interface{}) string
- func AsTime(value interface{}, dateLayout string) *time.Time
- func AsYamlText(source interface{}) (string, error)
- func AssertKind(input interface{}, kind reflect.Kind, name string)
- func AssertPointerKind(input interface{}, kind reflect.Kind, name string)
- func AssertTypeKind(dataType reflect.Type, kind reflect.Kind, name string)
- func BuildFunctionParameters(function interface{}, parameters []string, ...) ([]interface{}, error)
- func BuildTagMapping(structTemplatePointer interface{}, mappedKeyTag string, ...) map[string](map[string]string)
- func CallFunction(function interface{}, parameters ...interface{}) []interface{}
- func CallerDirectory(callerIndex int) string
- func CallerInfo(callerIndex int) (string, string, int)
- func CanConvertToFloat(value interface{}) bool
- func CanConvertToInt(value interface{}) bool
- func CanConvertToString(input interface{}) bool
- func CopyMapEntries(sourceMap, targetMap interface{})
- func CopyNonEmptyMapEntries(input, output interface{}) (err error)
- func CopySliceElements(sourceSlice, targetSlicePointer interface{})
- func CopyWithBufferPool(source io.Reader, destination io.Writer, pool httputil.BufferPool) (int64, error)
- func CountPointers(value interface{}) int
- func CreateDirIfNotExist(dirs ...string) error
- func DateFormatToLayout(dateFormat string) string
- func DeleteEmptyKeys(input interface{}) map[string]interface{}
- func DereferenceType(value interface{}) reflect.Type
- func DereferenceValue(value interface{}) interface{}
- func DereferenceValues(source interface{}) interface{}
- func DiscoverCaller(offset, maxDepth int, ignoreFiles ...string) (string, string, int)
- func DiscoverCollectionValuesAndKind(values interface{}) ([]interface{}, reflect.Kind)
- func DiscoverComponentType(input interface{}) reflect.Type
- func DiscoverTypeByKind(input interface{}, expected reflect.Kind) reflect.Type
- func DiscoverValueAndKind(input string) (interface{}, reflect.Kind)
- func DiscoverValueByKind(input interface{}, expected reflect.Kind) reflect.Value
- func Dump(data interface{})
- func DumpIndent(data interface{}, removeEmptyKeys bool) error
- func ElapsedDay(dateTime time.Time) float64
- func ElapsedToday(tz string) (float64, error)
- func ExpandFileTemplate(template string) string
- func ExpandParameters(macroEvaluator *MacroEvaluator, parameters map[string]string) error
- func ExpandValue(macroEvaluator *MacroEvaluator, value string) (string, error)
- func ExtractMimeType(file string) string
- func ExtractURIParameters(templateURI, requestURI string) (map[string]string, bool)
- func FileExists(filename string) bool
- func Filename(filename string) string
- func FilterSliceElements(sourceSlice interface{}, predicate interface{}, targetSlicePointer interface{})
- func GetFuncSignature(function interface{}) []reflect.Type
- func GetFunction(owner interface{}, name string) (interface{}, error)
- func GetSliceValue(slice interface{}, index int) interface{}
- func GetTimeLayout(input interface{}) string
- func GroupSliceElements(sourceSlice, targetMap, keyFunction interface{})
- func HasSliceAnyElements(sourceSlice interface{}, elements ...interface{}) (result bool)
- func HasTimeLayout(input interface{}) bool
- func IndexSlice(slice, resultingMap, keyFunction interface{})
- func InitStruct(source interface{})
- func IsASCIIText(candidate string) bool
- func IsBool(input interface{}) bool
- func IsCompleteJSON(candidate string) bool
- func IsEOFError(err error) bool
- func IsFloat(input interface{}) bool
- func IsFunc(input interface{}) bool
- func IsInt(input interface{}) bool
- func IsMap(input interface{}) bool
- func IsNewLineDelimitedJSON(candidate string) bool
- func IsNilPointerError(err error) bool
- func IsNotFoundError(err error) bool
- func IsPointer(input interface{}) bool
- func IsPrintText(candidate string) bool
- func IsSlice(input interface{}) bool
- func IsString(input interface{}) bool
- func IsStruct(input interface{}) bool
- func IsTime(input interface{}) bool
- func IsValueOfKind(input interface{}, kind reflect.Kind) bool
- func IsZero(input interface{}) bool
- func JSONToInterface(source interface{}) (interface{}, error)
- func JSONToMap(source interface{}) (map[string]interface{}, error)
- func JSONToSlice(source interface{}) ([]interface{}, error)
- func JoinAsString(slice interface{}, separator string) string
- func MakeMap(text string, valueSeparator string, itemSeparator string) map[string]interface{}
- func MakeReverseStringMap(text string, valueSepartor string, itemSeparator string) map[string]string
- func MakeStringMap(text string, valueSeparator string, itemSeparator string) map[string]string
- func MapKeysToSlice(sourceMap interface{}, targetSlicePointer interface{})
- func MapKeysToStringSlice(sourceMap interface{}) []string
- func NewBytes(input []byte) []byte
- func NewBytesBufferPool(poolSize, bufferSize int) httputil.BufferPool
- func NewDuration(value int, unit string) (time.Duration, error)
- func NewFieldSettingByKey(aStruct interface{}, key string) map[string](map[string]string)
- func NewHttpClient(options ...*HttpOptions) (*http.Client, error)
- func NewIllegalTokenError(message string, expected []int, position int, found *Token) error
- func NewLineDelimitedJSON(candidate string) ([]interface{}, error)
- func NewNilPointerError(message string) error
- func NormalizeKVPairs(source interface{}) (interface{}, error)
- func OpenFile(filename string) (*os.File, error)
- func Pairs(params ...interface{}) map[string]interface{}
- func ParseTime(input, layout string) (time.Time, error)
- func Process2DSliceInBatches(slice [][]interface{}, size int, handler func(batchedSlice [][]interface{}))
- func ProcessMap(source interface{}, handler func(key, value interface{}) bool) error
- func ProcessSlice(slice interface{}, handler func(item interface{}) bool)
- func ProcessSliceWithIndex(slice interface{}, handler func(index int, item interface{}) bool)
- func ProcessStruct(aStruct interface{}, ...) error
- func QueryBoolValue(u *url.URL, name string, defaultValue bool) bool
- func QueryIntValue(u *url.URL, name string, defaultValue int) int
- func QueryValue(u *url.URL, name, defaultValue string) string
- func ReclassifyNotFoundIfMatched(err error, URL string) error
- func RemainingToday(tz string) (float64, error)
- func RemoveFileIfExist(filenames ...string) error
- func ReverseSlice(source interface{})
- func RouteToService(method, url string, request, response interface{}) (err error)
- func SetSliceValue(slice interface{}, index int, value interface{})
- func SliceToMap(sourceSlice, targetMap, keyFunction, valueFunction interface{})
- func SliceToMultimap(sourceSlice, targetMap, keyFunction, valueFunction interface{})
- func SortStrings(source []string) []string
- func TerminatedSplitN(text string, fragmentCount int, terminator string) []string
- func TimeAt(offsetExpression string) (*time.Time, error)
- func TimeDiff(base time.Time, expression string) (*time.Time, error)
- func TimestampToString(dateFormat string, unixTimestamp, unixNanoTimestamp int64) string
- func ToBoolean(value interface{}) (bool, error)
- func ToFloat(value interface{}) (float64, error)
- func ToInt(value interface{}) (int, error)
- func ToMap(source interface{}) (map[string]interface{}, error)
- func ToTime(value interface{}, dateLayout string) (*time.Time, error)
- func TransformSlice(sourceSlice, targetSlicePointer, transformer interface{})
- func TryDiscoverTypeByKind(input interface{}, expected reflect.Kind) (reflect.Type, error)
- func URLBase(URL string) string
- func URLPathJoin(baseURL, path string) string
- func URLSplit(URL string) (string, string)
- func URLStripPath(URL string) string
- func UnwrapValue(value *reflect.Value) interface{}
- func WaitTimeout(wg *sync.WaitGroup, duration time.Duration) bool
- func WriteServiceRoutingResponse(response http.ResponseWriter, request *http.Request, ...) error
- type BatchLimiter
- type BodyMatcher
- type ByteWriterAt
- type CharactersMatcher
- type ContentTypeAccessor
- type ContentTypeMutator
- type Context
- type Converter
- type Decoder
- type DecoderFactory
- func NewDelimiterDecoderFactory() DecoderFactory
- func NewFlexYamlDecoderFactory() DecoderFactory
- func NewJSONDecoderFactory() DecoderFactory
- func NewJSONDecoderFactoryWithOption(useNumber bool) DecoderFactory
- func NewUnMarshalerDecoderFactory() DecoderFactory
- func NewYamlDecoderFactory() DecoderFactory
- type DelimitedRecord
- type Dictionary
- type EOFMatcher
- type Encoder
- type EncoderFactory
- type FieldInfo
- type FileInfo
- type FileLogger
- type FileLoggerConfig
- type FileSetInfo
- type FunctionInfo
- type HandlerInvoker
- type HttpOptions
- type IdMatcher
- type IllegalTokenError
- type IntMatcher
- type Iterator
- type KeywordMatcher
- type KeywordsMatcher
- type LiteralMatcher
- type LogMessage
- type LogMessages
- type LogStream
- type MacroEvaluator
- type MapDictionary
- type Marshaler
- type Matcher
- func NewBodyMatcher(begin, end string) Matcher
- func NewCharactersMatcher(chars string) Matcher
- func NewCustomIdMatcher(allowedChars ...string) Matcher
- func NewIntMatcher() Matcher
- func NewKeywordsMatcher(caseSensitive bool, keywords ...string) Matcher
- func NewRemainingSequenceMatcher() Matcher
- func NewSequenceMatcher(terminators ...string) Matcher
- func NewTerminatorMatcher(terminators ...string) Matcher
- type NilPointerError
- type NotFoundError
- type Predicate
- func NewBetweenPredicate(from, to interface{}) Predicate
- func NewComparablePredicate(operator string, leftOperand interface{}) Predicate
- func NewInPredicate(values ...interface{}) Predicate
- func NewLikePredicate(matching string) Predicate
- func NewNilPredicate() Predicate
- func NewWithinPredicate(baseTime time.Time, deltaInSeconds int, dateLayout string) Predicate
- type Ranger
- type SequenceMatcher
- type ServiceRouter
- type ServiceRouting
- type StatucCodeAccessor
- type StatucCodeMutator
- type StructFieldMeta
- type StructMeta
- type Token
- type Tokenizer
- type ToolboxHTTPClient
- type TypeInfo
- func (s *TypeInfo) AddFields(fields ...*FieldInfo)
- func (s *TypeInfo) AddReceivers(receivers ...*FunctionInfo)
- func (s *TypeInfo) Field(name string) *FieldInfo
- func (s *TypeInfo) Fields() []*FieldInfo
- func (s *TypeInfo) HasField(name string) bool
- func (s *TypeInfo) HasReceiver(name string) bool
- func (s *TypeInfo) Receiver(name string) *FunctionInfo
- func (s *TypeInfo) Receivers() []*FunctionInfo
- type UnMarshaler
- type ValueProvider
- func NewBetweenPredicateValueProvider() ValueProvider
- func NewCastedValueProvider() ValueProvider
- func NewCurrentDateProvider() ValueProvider
- func NewCurrentTimeProvider() ValueProvider
- func NewDateOfBirthrovider() ValueProvider
- func NewDictionaryProvider(contextKey interface{}) ValueProvider
- func NewEnvValueProvider() ValueProvider
- func NewFileValueProvider(trim bool) ValueProvider
- func NewNilValueProvider() ValueProvider
- func NewTimeDiffProvider() ValueProvider
- func NewWeekdayProvider() ValueProvider
- func NewWithinSecPredicateValueProvider() ValueProvider
- type ValueProviderRegistry
- type Zeroable
Constants ¶
const ( //JSONMimeType JSON mime type constant JSONMimeType = "text/json" //CSVMimeType csv mime type constant CSVMimeType = "text/csv" //TSVMimeType tab separated mime type constant TSVMimeType = "text/tsv" //TextMimeType mime type constant TextMimeType = "text/sql" )
const ( MethodGet = "GET" MethodHead = "HEAD" MethodPost = "POST" MethodPut = "PUT" MethodPatch = "PATCH" // RFC 5789 MethodDelete = "DELETE" MethodOptions = "OPTIONS" MethodTrace = "TRACE" )
const ( Now = "now" Tomorrow = "tomorrow" Yesterday = "yesterday" DurationWeek = "week" DurationDay = "day" DurationHour = "hour" DurationMinute = "minute" DurationMinuteAbbr = "min" DurationSecond = "second" DurationSecondAbbr = "sec" DurationMillisecond = "millisecond" DurationMillisecondAbbr = "ms" DurationMicrosecond = "microsecond" DurationMicrosecondAbbr = "us" DurationNanosecond = "nanosecond" DurationNanosecondAbbr = "ns" )
Variables ¶
var CopyStringValueProvider = func(source string) string {
return source
}
CopyStringValueProvider is a function that returns passed in string This provider can be used to make map from slice like map[string]some type
var DateFormatKeyword = "dateFormat"
DateFormatKeyword constant 'dateFormat' key
var DateLayoutKeyword = "dateLayout"
DateLayoutKeyword constant 'dateLayout' key
var DefaultConverter = NewConverter("", "name")
DefaultConverter represents a default data structure converter
var DefaultDateLayout = "2006-01-02 15:04:05.000"
DefaultDateLayout is set to 2006-01-02 15:04:05.000
var DefaultDecoderFactory = NewJSONDecoderFactory()
DefaultDecoderFactory - NewJSONDecoderFactory
var DefaultEncoderFactory = NewJSONEncoderFactory()
DefaultEncoderFactory - NewJSONEncoderFactory
var FileExtensionMimeType = map[string]string{ "json": JSONMimeType, "csv": CSVMimeType, "tsv": TSVMimeType, "sql": TextMimeType, "html": "text/html", "js": "text/javascript", "jpg": "image/jpeg", "png": "image/png", }
FileExtensionMimeType json, csv, tsc, sql mime types.
var FileSchema = "file://"
FileSchema file://
var TrueProvider = func(input interface{}) bool { return true }
var TrueValueProvider = func(ignore interface{}) bool { return true }
TrueValueProvider is a function that returns true, it takes one parameters which ignores, This provider can be used to make map from slice like map[some type]bool
var YamlDefaultDecoderFactory = NewFlexYamlDecoderFactory()
YamlDefaultDecoderFactory - NewYamlDecoderFactory
var YamlDefaultEncoderFactory = NewYamlEncoderFactory()
YamlDefaultEncoderFactory - NewYamlEncoderFactory
Functions ¶
func AsCompatibleFunctionParameters ¶
func AsCompatibleFunctionParameters(function interface{}, parameters []interface{}) ([]interface{}, error)
AsCompatibleFunctionParameters takes incompatible function parameters and converts then into provided function signature compatible
func AsIndentJSONText ¶
AsIndentJSONText converts data structure int text JSON
func AsJSONText ¶
AsJSONText converts data structure int text JSON
func AsMap ¶
func AsMap(source interface{}) map[string]interface{}
AsMap converts underlying map as map[string]interface{}
func AsSlice ¶
func AsSlice(sourceSlice interface{}) []interface{}
AsSlice converts underlying slice or Ranger as []interface{}
func AsYamlText ¶
AsYamlText converts data structure int text YAML
func AssertKind ¶
AssertKind checks if input is of the passed in kind, if not it panic with message including name
func AssertPointerKind ¶
AssertPointerKind checks if input is a pointer of the passed in kind, if not it panic with message including name
func AssertTypeKind ¶
AssertTypeKind checks if dataType is of the passed in kind, if not it panic with message including name
func BuildFunctionParameters ¶
func BuildFunctionParameters(function interface{}, parameters []string, parameterValues map[string]interface{}) ([]interface{}, error)
BuildFunctionParameters builds function parameters provided in the parameterValues. Parameters value will be converted if needed to expected by the function signature type. It returns function parameters , or error
func BuildTagMapping ¶
func BuildTagMapping(structTemplatePointer interface{}, mappedKeyTag string, resultExclusionTag string, inheritKeyFromField bool, convertKeyToLowerCase bool, tags []string) map[string](map[string]string)
BuildTagMapping builds map keyed by mappedKeyTag tag value, and value is another map of keys where tag name is presents in the tags parameter.
func CallFunction ¶
func CallFunction(function interface{}, parameters ...interface{}) []interface{}
CallFunction calls passed in function with provided parameters,it returns a function result.
func CallerDirectory ¶
CallerDirectory returns directory of caller source code directory
func CallerInfo ¶
CallerInfo return filename, function or file line from the stack
func CanConvertToFloat ¶
func CanConvertToFloat(value interface{}) bool
CanConvertToFloat checkis if float conversion is possible.
func CanConvertToInt ¶
func CanConvertToInt(value interface{}) bool
CanConvertToInt returns true if an input can be converted to int value.
func CanConvertToString ¶
func CanConvertToString(input interface{}) bool
CanConvertToString checks if input can be converted to string
func CopyMapEntries ¶
func CopyMapEntries(sourceMap, targetMap interface{})
CopyMapEntries appends map entry from source map to target map
func CopyNonEmptyMapEntries ¶
func CopyNonEmptyMapEntries(input, output interface{}) (err error)
CloneNonEmptyMap removes empty keys from map result
func CopySliceElements ¶
func CopySliceElements(sourceSlice, targetSlicePointer interface{})
CopySliceElements appends elements from source slice into target This function comes handy if you want to copy from generic []interface{} slice to more specific slice like []string, if source slice element are of the same time
func CopyWithBufferPool ¶
func CopyWithBufferPool(source io.Reader, destination io.Writer, pool httputil.BufferPool) (int64, error)
CopyBuffer copies bytes from passed in source to destination with provided pool
func CountPointers ¶
func CountPointers(value interface{}) int
CountPointers count pointers to undelying non pointer type
func CreateDirIfNotExist ¶
CreateDirIfNotExist creates directory if they do not exist
func DateFormatToLayout ¶
DateFormatToLayout converts java date format https://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#rfc822timezone into go date layout
func DeleteEmptyKeys ¶
func DeleteEmptyKeys(input interface{}) map[string]interface{}
DeleteEmptyKeys removes empty keys from map result
func DereferenceType ¶
DereferenceType dereference passed in value
func DereferenceValue ¶
func DereferenceValue(value interface{}) interface{}
DereferenceValue dereference passed in value
func DereferenceValues ¶
func DereferenceValues(source interface{}) interface{}
DereferenceValues replaces pointer to its value within a generic map or slice
func DiscoverCaller ¶
DiscoverCaller returns the first matched caller info
func DiscoverCollectionValuesAndKind ¶
DiscoverCollectionValuesAndKind discovers passed in slice item kind, and returns slice of values converted to discovered type. It tries the following kind int, float, bool, string
func DiscoverComponentType ¶
DiscoverComponentType returns type unwrapped from pointer, slice or map
func DiscoverTypeByKind ¶
DiscoverTypeByKind returns unwrapped input type that matches expected kind, or panic if this is not possible
func DiscoverValueAndKind ¶
DiscoverValueAndKind discovers input kind, it applies checks of the following types: int, float, bool, string
func DiscoverValueByKind ¶
DiscoverValueByKind returns unwrapped input that matches expected kind, or panic if this is not possible
func DumpIndent ¶
DumpIndent prints passed in data as indented JSON
func ElapsedDay ¶ added in v0.4.2
ElapsedDay returns elapsed pct for passed in day (second elapsed that day over 24 hours)
func ElapsedToday ¶ added in v0.4.2
ElapsedToday returns elapsed today time percent, it takes optionally timezone
func ExpandFileTemplate ¶
ExpandFileTemplate expands
func ExpandParameters ¶
func ExpandParameters(macroEvaluator *MacroEvaluator, parameters map[string]string) error
ExpandParameters expands passed in parameters as strings
func ExpandValue ¶
func ExpandValue(macroEvaluator *MacroEvaluator, value string) (string, error)
ExpandValue expands passed in value, it returns expanded string value or error
func ExtractMimeType ¶
ExtractMimeType extracts mime type by extension
func ExtractURIParameters ¶
ExtractURIParameters parses URIs to extract {<param>} defined in templateURI from requestURI, it returns extracted parameters and flag if requestURI matched templateURI
func FilterSliceElements ¶
func FilterSliceElements(sourceSlice interface{}, predicate interface{}, targetSlicePointer interface{})
FilterSliceElements copies elements from sourceSlice to targetSlice if predicate function returns true. Predicate function needs to accept source slice element type and return true.
func GetFuncSignature ¶
GetFuncSignature returns a function signature
func GetFunction ¶
GetFunction returns function for provided owner and name, or error
func GetSliceValue ¶
func GetSliceValue(slice interface{}, index int) interface{}
GetSliceValue gets value from passed in index
func GetTimeLayout ¶
func GetTimeLayout(input interface{}) string
GetTimeLayout returns time laout from passed in map, first it check if DateLayoutKeyword is defined is so it returns it, otherwise it check DateFormatKeyword and if exists converts it to dateLayout If neithers keys exists it panics, please use HasTimeLayout to avoid panic
func GroupSliceElements ¶
func GroupSliceElements(sourceSlice, targetMap, keyFunction interface{})
GroupSliceElements reads source slice and transfer all values returned by keyFunction to a slice in target map.
func HasSliceAnyElements ¶
func HasSliceAnyElements(sourceSlice interface{}, elements ...interface{}) (result bool)
HasSliceAnyElements checks if sourceSlice has any of passed in elements. This method iterates through elements till if finds the first match.
func HasTimeLayout ¶
func HasTimeLayout(input interface{}) bool
HasTimeLayout checks if dateLayout can be taken from the passed in setting map
func IndexSlice ¶
func IndexSlice(slice, resultingMap, keyFunction interface{})
IndexSlice reads passed in slice and applies function that takes a slice item as argument to return a key value. passed in resulting map needs to match key type return by a key function, and accept slice item type as argument.
func InitStruct ¶
func InitStruct(source interface{})
InitStruct initialise any struct pointer to empty struct
func IsASCIIText ¶
IsASCIIText return true if supplied string does not have binary data
func IsCompleteJSON ¶
IsCompleteJSON returns true if supplied represent complete JSON
func IsNewLineDelimitedJSON ¶
IsNewLineDelimitedJSON returns true if supplied content is multi line delimited JSON
func IsNilPointerError ¶
IsNilPointerError returns true if error is nil pointer
func IsNotFoundError ¶ added in v0.6.3
IsNotFoundError checks is supplied error is NotFoundError type
func IsPointer ¶
func IsPointer(input interface{}) bool
IsPointer returns true if input is a pointer
func IsPrintText ¶
IsPrintText return true if all candidate characters are printable (unicode.IsPrintText)
func IsValueOfKind ¶
IsValueOfKind returns true if passed in input is of supplied kind.
func JSONToInterface ¶
func JSONToInterface(source interface{}) (interface{}, error)
JSONToInterface converts JSON source to an interface (either map or slice)
func JSONToSlice ¶
func JSONToSlice(source interface{}) ([]interface{}, error)
JSONToSlice converts JSON source into slice
func JoinAsString ¶
JoinAsString joins all items of a slice, with separator, it takes any slice as argument,
func MakeReverseStringMap ¶
func MakeReverseStringMap(text string, valueSepartor string, itemSeparator string) map[string]string
MakeReverseStringMap creates a mapstring]string from string, the values become key, and key values
func MakeStringMap ¶
MakeStringMap creates a mapstring]string from string,
func MapKeysToSlice ¶
func MapKeysToSlice(sourceMap interface{}, targetSlicePointer interface{})
MapKeysToSlice appends all map keys to targetSlice
func MapKeysToStringSlice ¶
func MapKeysToStringSlice(sourceMap interface{}) []string
MapKeysToStringSlice creates a string slice from sourceMap keys, keys do not need to be of a string type.
func NewBytesBufferPool ¶
func NewBytesBufferPool(poolSize, bufferSize int) httputil.BufferPool
NewBytesBufferPool returns new httputil.BufferPool pool.
func NewDuration ¶
NewDuration returns a durationToken for supplied value and time unit, 3, "second"
func NewFieldSettingByKey ¶
NewFieldSettingByKey reads field's tags and returns them indexed by passed in key, fieldName is always part of the resulting map unless filed has "transient" tag.
func NewHttpClient ¶
func NewHttpClient(options ...*HttpOptions) (*http.Client, error)
func NewIllegalTokenError ¶
NewIllegalTokenError create a new illegal token error
func NewLineDelimitedJSON ¶
NewLineDelimitedJSON returns JSON for supplied multi line JSON
func NewNilPointerError ¶
NewNilPointerError creates a new nil pointer error
func NormalizeKVPairs ¶ added in v0.5.0
func NormalizeKVPairs(source interface{}) (interface{}, error)
NormalizeKVPairs converts slice of KV paris into a map, and map[interface{}]interface{} to map[string]interface{}
func OpenFile ¶
OpenFile open file converting path to elements and rebuling path safety with path.Join
func Process2DSliceInBatches ¶
func Process2DSliceInBatches(slice [][]interface{}, size int, handler func(batchedSlice [][]interface{}))
Process2DSliceInBatches iterates over any 2 dimensional slice, it calls handler with batch.
func ProcessMap ¶
ProcessMap iterates over any map, it calls handler with every key, value pair unless handler returns false.
func ProcessSlice ¶
func ProcessSlice(slice interface{}, handler func(item interface{}) bool)
ProcessSlice iterates over any slice, it calls handler with each element unless handler returns false,
func ProcessSliceWithIndex ¶
ProcessSliceWithIndex iterates over any slice, it calls handler with every index and item unless handler returns false
func ProcessStruct ¶
func ProcessStruct(aStruct interface{}, handler func(fieldType reflect.StructField, field reflect.Value) error) error
ProcessStruct reads passed in struct fields and values to pass it to provided handler
func QueryBoolValue ¶
QueryBoolValue returns query value for passed in url's name or default value
func QueryIntValue ¶
QueryIntValue returns query value for passed in url's name or default value
func QueryValue ¶
QueryValue returns query value for passed in url's name or default value
func ReclassifyNotFoundIfMatched ¶ added in v0.6.3
ReclassifyNotFoundIfMatched reclassify error if not found
func RemainingToday ¶ added in v0.4.2
RemainingToday returns remaining today time percent, it takes optionally timezone
func RemoveFileIfExist ¶
RemoveFileIfExist remove file if exists
func ReverseSlice ¶
func ReverseSlice(source interface{})
ProcessSlice iterates over any slice, it calls handler with each element unless handler returns false,
func RouteToService ¶
RouteToService calls web service url, with passed in json request, and encodes http json response into passed response
func SetSliceValue ¶
func SetSliceValue(slice interface{}, index int, value interface{})
SetSliceValue sets value at slice index
func SliceToMap ¶
func SliceToMap(sourceSlice, targetMap, keyFunction, valueFunction interface{})
SliceToMap reads passed in slice to to apply the key and value function for each item. Result of these calls is placed in the resulting map.
func SliceToMultimap ¶
func SliceToMultimap(sourceSlice, targetMap, keyFunction, valueFunction interface{})
SliceToMultimap reads source slice and transfer all values by valueFunction and returned by keyFunction to a slice in target map. Key and value function result type need to agree with target map type.
func SortStrings ¶
SortStrings creates a new copy of passed in slice and sorts it.
func TerminatedSplitN ¶ added in v0.6.3
TerminatedSplitN split supplied text into n fragmentCount, each terminated with supplied terminator
func TimeDiff ¶
TimeDiff returns time for supplied base time and literal, the supported literal now, yesterday, tomorrow, or the following template:
- [timeValueToken] durationToken past_or_future_modifier [IN tz]
where time modifier can be any of the following: "onward", "ahead", "after", "later", or "past", "ago", "before", "earlier", "in the future", "in the past") )
func TimestampToString ¶
TimestampToString formats timestamp to passed in java style date format
func TransformSlice ¶
func TransformSlice(sourceSlice, targetSlicePointer, transformer interface{})
TransformSlice appends transformed elements from source slice into target, transformer take as argument item of source slice and return value of target slice.
func TryDiscoverTypeByKind ¶ added in v0.4.2
TryDiscoverTypeByKind returns unwrapped input type that matches expected kind, or error
func WaitTimeout ¶
WaitGroup that waits with a timeout Returns true if timeout exceeded and false if there was no timeout
func WriteServiceRoutingResponse ¶
func WriteServiceRoutingResponse(response http.ResponseWriter, request *http.Request, serviceRouting *ServiceRouting, result interface{}) error
WriteServiceRoutingResponse writes service router response
Types ¶
type BatchLimiter ¶
func NewBatchLimiter ¶
func NewBatchLimiter(batchSize, total int) *BatchLimiter
func (*BatchLimiter) Acquire ¶
func (r *BatchLimiter) Acquire()
func (*BatchLimiter) Done ¶
func (r *BatchLimiter) Done()
func (*BatchLimiter) Wait ¶
func (r *BatchLimiter) Wait()
type BodyMatcher ¶
LiteralMatcher represents a matcher that finds any literals in the input
type ByteWriterAt ¶
type ByteWriterAt struct { Buffer []byte // contains filtered or unexported fields }
ByteWriterAt represents a bytes writer at
func NewByteWriterAt ¶
func NewByteWriterAt() *ByteWriterAt
NewWriterAt returns a new instance of byte writer at
type CharactersMatcher ¶
type CharactersMatcher struct {
Chars string //characters to be matched
}
CharactersMatcher represents a matcher, that matches any of Chars.
type ContentTypeAccessor ¶
type ContentTypeAccessor interface {
GetContentType() string
}
ContentTypeAccessor server side response accessor
type ContentTypeMutator ¶
type ContentTypeMutator interface {
SetContentType(contentType string)
}
ContentTypeMutator client side reponse optional interface
type Context ¶
type Context interface { //GetRequired returns a value for a target type of error if it does not exist GetRequired(targetType interface{}) (interface{}, error) //GetOptional returns a value for a target type GetOptional(targetType interface{}) interface{} //GetOptional into sets requested context value into target, returns true if value was found GetInto(targetType interface{}, target interface{}) bool //Put puts target type value to the context, or error if value exists, is nil or incompatible with target type Put(targetType interface{}, value interface{}) error //Replace repaces value in the context Replace(targetType interface{}, value interface{}) error //Remove removes value from the context Remove(targetType interface{}) interface{} //Contains chekcs if a value of a terget type is in contet Contains(targetType interface{}) bool //Clone create a shallow copy of a context Clone() Context }
Context represents type safe map.
type Converter ¶
Converter represets data converter, it converts incompatibe data structure, like map and struct, string and time, *string to string, etc.
func NewColumnConverter ¶
NewColumnConverter create a new converter, that has ability to convert map to struct using column mapping
func NewConverter ¶
NewConverter create a new converter, that has ability to convert map to struct, it uses keytag to identify source and dest of fields/keys
func (*Converter) AssignConverted ¶
AssignConverted assign to the target source, target needs to be pointer, input has to be convertible or compatible type
type Decoder ¶
type Decoder interface { //Decode reads and decodes objects from an input stream. Decode(v interface{}) error }
Decoder represents a decoder.
type DecoderFactory ¶
type DecoderFactory interface { //Create a decoder for passed in io reader Create(reader io.Reader) Decoder }
DecoderFactory create an decoder for passed in input stream
func NewDelimiterDecoderFactory ¶
func NewDelimiterDecoderFactory() DecoderFactory
NewDelimiterDecoderFactory returns a new delimitered decoder factory.
func NewFlexYamlDecoderFactory ¶
func NewFlexYamlDecoderFactory() DecoderFactory
NewFlexYamlDecoderFactory create a new yaml decoder factory
func NewJSONDecoderFactory ¶
func NewJSONDecoderFactory() DecoderFactory
NewJSONDecoderFactory create a new JSONDecoderFactory
func NewJSONDecoderFactoryWithOption ¶
func NewJSONDecoderFactoryWithOption(useNumber bool) DecoderFactory
NewJSONDecoderFactoryWithOption create a new JSONDecoderFactory, it takes useNumber decoder parameter
func NewUnMarshalerDecoderFactory ¶
func NewUnMarshalerDecoderFactory() DecoderFactory
NewUnMarshalerDecoderFactory returns a decoder factory
func NewYamlDecoderFactory ¶
func NewYamlDecoderFactory() DecoderFactory
NewYamlDecoderFactory create a new yaml decoder factory
type DelimitedRecord ¶
DelimitedRecord represents a delimited record
func (*DelimitedRecord) IsEmpty ¶
func (r *DelimitedRecord) IsEmpty() bool
IsEmpty returns true if all values are empty or null
type Dictionary ¶
type Dictionary interface { //Get returns value for passed in key or error Get(key string) (interface{}, error) //Exists checks if key exists Exists(key string) bool }
Dictionary represents simply lookup interface
type Encoder ¶
type Encoder interface { //Encode encodes an instance to output stream Encode(object interface{}) error }
Encoder writes an instance to output stream
type EncoderFactory ¶
type EncoderFactory interface { //Create creates an encoder for an output stream Create(writer io.Writer) Encoder }
EncoderFactory create an encoder for an output stream
func NewJSONEncoderFactory ¶
func NewJSONEncoderFactory() EncoderFactory
NewJSONEncoderFactory creates new NewJSONEncoderFactory
func NewMarshalerEncoderFactory ¶
func NewMarshalerEncoderFactory() EncoderFactory
NewMarshalerEncoderFactory create a new encoder factory for marsheler struct
func NewYamlEncoderFactory ¶
func NewYamlEncoderFactory() EncoderFactory
NewYamlEncoderFactory create a new yaml encoder factory
type FieldInfo ¶
type FieldInfo struct { Name string TypeName string ComponentType string IsPointerComponent bool KeyTypeName string ValueTypeName string TypePackage string IsAnonymous bool IsMap bool IsChannel bool IsSlice bool IsPointer bool Tag string Comment string }
FieldInfo represents a filed info
func NewFieldInfo ¶
NewFieldInfo creates a new field info.
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo represent hold definition about all defined types and its receivers in a file
func NewFileInfo ¶
Visit creates a new file info.
type FileLogger ¶
type FileLogger struct {
// contains filtered or unexported fields
}
FileLogger represents a file logger
func NewFileLogger ¶
func NewFileLogger(configs ...FileLoggerConfig) (*FileLogger, error)
NewFileLogger create new file logger
func (*FileLogger) Log ¶
func (l *FileLogger) Log(message *LogMessage) error
Log logs message into stream
func (*FileLogger) NewLogStream ¶
func (l *FileLogger) NewLogStream(path string, config *FileLoggerConfig) (*LogStream, error)
NewLogStream creat a new LogStream for passed om path and file config
func (*FileLogger) Notify ¶
func (l *FileLogger) Notify(siginal os.Signal)
type FileLoggerConfig ¶
type FileLoggerConfig struct { LogType string FileTemplate string QueueFlashCount int MaxQueueSize int FlushRequencyInMs int //type backward-forward compatibility FlushFrequencyInMs int MaxIddleTimeInSec int }
FileLoggerConfig represents FileLogger
func (*FileLoggerConfig) Validate ¶
func (c *FileLoggerConfig) Validate() error
Validate valides configuration sttings
type FileSetInfo ¶
type FileSetInfo struct {
// contains filtered or unexported fields
}
FileSetInfo represents a fileset info storing information about go file with their struct definition
func NewFileSetInfo ¶
func NewFileSetInfo(baseDir string) (*FileSetInfo, error)
NewFileSetInfo creates a new fileset info
func (*FileSetInfo) FileInfo ¶
func (f *FileSetInfo) FileInfo(name string) *FileInfo
FileInfo returns fileinfo for supplied file name
func (*FileSetInfo) FilesInfo ¶
func (f *FileSetInfo) FilesInfo() map[string]*FileInfo
FilesInfo returns all files info.
func (*FileSetInfo) Type ¶
func (f *FileSetInfo) Type(name string) *TypeInfo
TypeInfo returns type info for passed in type name.
type FunctionInfo ¶
type FunctionInfo struct { Name string ReceiverTypeName string ParameterFields []*FieldInfo ResultsFields []*FieldInfo }
FunctionInfo represents a function info
func NewFunctionInfo ¶
func NewFunctionInfo(funcDeclaration *ast.FuncDecl) *FunctionInfo
NewFunctionInfo create a new function
type HandlerInvoker ¶
type HandlerInvoker func(serviceRouting *ServiceRouting, request *http.Request, response http.ResponseWriter, parameters map[string]interface{}) error
HandlerInvoker method is responsible of passing required parameters to router handler.
type HttpOptions ¶
type HttpOptions struct { Key string Value interface{} }
type IdMatcher ¶
type IdMatcher struct{}
LiteralMatcher represents a matcher that finds any literals in the input
type IllegalTokenError ¶
IllegalTokenError represents illegal token error
func (*IllegalTokenError) Error ¶
func (e *IllegalTokenError) Error() string
type IntMatcher ¶
type IntMatcher struct{}
IntMatcher represents a matcher that finds any int in the input
type Iterator ¶
type Iterator interface { //HasNext returns true if iterator has next element. HasNext() bool //Next sets item pointer with next element. Next(itemPointer interface{}) error }
Iterator represents generic iterator.
func NewSliceIterator ¶
func NewSliceIterator(slice interface{}) Iterator
NewSliceIterator creates a new slice iterator.
type KeywordMatcher ¶
KeywordMatcher represents a keyword matcher
type KeywordsMatcher ¶
KeywordsMatcher represents a matcher that finds any of specified keywords in the input
type LiteralMatcher ¶
type LiteralMatcher struct{}
LiteralMatcher represents a matcher that finds any literals in the input
type LogMessage ¶
type LogMessage struct { MessageType string Message interface{} }
LogMessage represent log message
type LogMessages ¶
type LogMessages struct {
Messages []LogMessage
}
LogMessages represents log messages
type LogStream ¶
type LogStream struct { Name string Logger *FileLogger Config *FileLoggerConfig RecordCount int File *os.File LastAddQueueTime time.Time LastWriteTime uint64 Messages chan string Complete chan bool }
LogStream represents individual log stream
func (*LogStream) Log ¶
func (s *LogStream) Log(message *LogMessage) error
Log logs message into stream
type MacroEvaluator ¶
type MacroEvaluator struct {
Prefix, Postfix string
ValueProviderRegistry ValueProviderRegistry
}
MacroEvaluator represents a macro expression evaluator, macros has the following format macro prefix [macro parameter] macro postfix
func NewMacroEvaluator ¶
func NewMacroEvaluator(prefix, postfix string, registry ValueProviderRegistry) *MacroEvaluator
NewMacroEvaluator returns a new macro evaluator
func (*MacroEvaluator) Expand ¶
func (e *MacroEvaluator) Expand(context Context, input string) (interface{}, error)
Expand expands passed in input, it returns expanded value of any type or error
func (*MacroEvaluator) HasMacro ¶
func (e *MacroEvaluator) HasMacro(candidate string) bool
HasMacro checks if candidate has a macro fragment
type MapDictionary ¶
type MapDictionary map[string]interface{}
MapDictionary alias to map of string and interface{}
func (*MapDictionary) Exists ¶
func (d *MapDictionary) Exists(name string) bool
func (*MapDictionary) Get ¶
func (d *MapDictionary) Get(name string) (interface{}, error)
type Marshaler ¶
type Marshaler interface { //Marshal converts bytes to attributes of owner struct Marshal() (data []byte, err error) }
Marshaler represents byte to object converter
type Matcher ¶
type Matcher interface { //Match matches input starting from offset, it return number of characters matched Match(input string, offset int) (matched int) }
Matcher represents a matcher, that matches input from offset position, it returns number of characters matched.
func NewBodyMatcher ¶
NewBodyMatcher creates a new body matcher
func NewCharactersMatcher ¶
NewCharactersMatcher creates a new character matcher
func NewCustomIdMatcher ¶
NewCustomIdMatcher creates new custom matcher
func NewKeywordsMatcher ¶
NewKeywordsMatcher returns a matcher for supplied keywords
func NewRemainingSequenceMatcher ¶
func NewRemainingSequenceMatcher() Matcher
Creates a matcher that matches all remaining input
func NewSequenceMatcher ¶
NewSequenceMatcher creates a new matcher that finds all sequence until find at least one of the provided terminators
func NewTerminatorMatcher ¶
NewTerminatorMatcher creates a new matcher that finds any sequence until find at least one of the provided terminators
type NilPointerError ¶
type NilPointerError struct {
// contains filtered or unexported fields
}
NilPointerError represents nil pointer error
type NotFoundError ¶ added in v0.6.3
type NotFoundError struct {
URL string
}
NotFoundError represents not found error
func (*NotFoundError) Error ¶ added in v0.6.3
func (e *NotFoundError) Error() string
type Predicate ¶
type Predicate interface {
Apply(value interface{}) bool
}
Predicate represents a generic predicate
func NewBetweenPredicate ¶
func NewBetweenPredicate(from, to interface{}) Predicate
NewBetweenPredicate creates a new BETWEEN predicate, it takes from, and to.
func NewComparablePredicate ¶
NewComparablePredicate create a new comparable predicate for =, !=, >=, <=
func NewInPredicate ¶
func NewInPredicate(values ...interface{}) Predicate
NewInPredicate creates a new IN predicate
func NewLikePredicate ¶
NewLikePredicate create a new like predicate
type SequenceMatcher ¶
type SequenceMatcher struct { Terminators []string CaseSensitive bool // contains filtered or unexported fields }
SequenceMatcher represents a matcher that finds any sequence until find provided terminators
type ServiceRouter ¶
type ServiceRouter struct {
// contains filtered or unexported fields
}
ServiceRouter represents routing rule
func NewServiceRouter ¶
func NewServiceRouter(serviceRouting ...ServiceRouting) *ServiceRouter
NewServiceRouter creates a new service router, is takes list of service routing as arguments
func (*ServiceRouter) Route ¶
func (r *ServiceRouter) Route(response http.ResponseWriter, request *http.Request) error
Route matches service routing by http method , and number of parameters, then it call routing method, and sent back its response.
func (*ServiceRouter) WriteResponse ¶
func (r *ServiceRouter) WriteResponse(encoderFactory EncoderFactory, response interface{}, request *http.Request, responseWriter http.ResponseWriter) error
WriteResponse writes response to response writer, it used encoder factory to encode passed in response to the writer, it sets back request contenttype to response.
type ServiceRouting ¶
type ServiceRouting struct { URI string //matching uri Handler interface{} //has to be func HTTPMethod string Parameters []string ContentTypeEncoders map[string]EncoderFactory //content type encoder factory ContentTypeDecoders map[string]DecoderFactory //content type decoder factory HandlerInvoker HandlerInvoker //optional function that will be used instead of reflection to invoke a handler. }
ServiceRouting represents a simple web services routing rule, which is matched with http request
type StatucCodeAccessor ¶
type StatucCodeAccessor interface {
GetStatusCode() int
}
StatucCodeAccessor server side response accessor
type StatucCodeMutator ¶
type StatucCodeMutator interface {
SetStatusCode(code int)
}
StatucCodeMutator client side reponse optional interface
type StructFieldMeta ¶
type StructFieldMeta struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Required bool `json:"required,"` Description string `json:"description,omitempty"` }
StructFieldMeta represents struct field meta
type StructMeta ¶
type StructMeta struct { Type string Fields []*StructFieldMeta `json:"fields,omitempty"` Dependencies []*StructMeta `json:"dependencies,omitempty"` }
StructMeta represents struct meta details
func GetStructMeta ¶
func GetStructMeta(source interface{}) *StructMeta
type Token ¶
Token a matchable input
func ExpectToken ¶
ExpectToken returns the matched token or error
type Tokenizer ¶
type Tokenizer struct { Input string Index int InvalidToken int EndOfFileToken int // contains filtered or unexported fields }
Tokenizer represents a token scanner.
func NewTokenizer ¶
func NewTokenizer(input string, invalidToken int, endOfFileToken int, matcher map[int]Matcher) *Tokenizer
NewTokenizer creates a new NewTokenizer, it takes input, invalidToken, endOfFileToeken, and matchers.
type ToolboxHTTPClient ¶
type ToolboxHTTPClient struct {
// contains filtered or unexported fields
}
ToolboxHTTPClient contains preconfigured http client
func NewToolboxHTTPClient ¶
func NewToolboxHTTPClient(options ...*HttpOptions) (*ToolboxHTTPClient, error)
NewToolboxHTTPClient instantiate new client with provided options
func (*ToolboxHTTPClient) Request ¶
func (c *ToolboxHTTPClient) Request(method, url string, request, response interface{}, encoderFactory EncoderFactory, decoderFactory DecoderFactory) (err error)
Request sends http request using the existing client
type TypeInfo ¶
type TypeInfo struct { Name string Package string FileName string Comment string IsSlice bool IsStruct bool IsDerived bool ComponentType string IsPointerComponentType bool Derived string Settings map[string]string // contains filtered or unexported fields }
TypeInfo represents a struct info
func (*TypeInfo) AddReceivers ¶
func (s *TypeInfo) AddReceivers(receivers ...*FunctionInfo)
AddReceivers adds receiver for the struct
func (*TypeInfo) HasReceiver ¶
HasReceiver returns true if receiver is defined for struct
func (*TypeInfo) Receiver ¶
func (s *TypeInfo) Receiver(name string) *FunctionInfo
Receiver returns receiver for passed in name
func (*TypeInfo) Receivers ¶
func (s *TypeInfo) Receivers() []*FunctionInfo
Receivers returns struct functions
type UnMarshaler ¶
UnMarshaler represent an struct that can be converted to bytes
type ValueProvider ¶
type ValueProvider interface { //Get returns a value for passed in context and arguments. Context can be used to manage state. Get(context Context, arguments ...interface{}) (interface{}, error) }
ValueProvider represents a value provider
func NewBetweenPredicateValueProvider ¶
func NewBetweenPredicateValueProvider() ValueProvider
NewBetweenPredicateValueProvider returns a new between value provider
func NewCastedValueProvider ¶
func NewCastedValueProvider() ValueProvider
NewCastedValueProvider return a provider that return casted value type
func NewCurrentDateProvider ¶
func NewCurrentDateProvider() ValueProvider
NewCurrentDateProvider returns a provider that returns current date in the format yyyymmdd, i.e. 20170205
func NewCurrentTimeProvider ¶
func NewCurrentTimeProvider() ValueProvider
NewCurrentTimeProvider returns a provder that returns time.Now()
func NewDateOfBirthrovider ¶
func NewDateOfBirthrovider() ValueProvider
NewDateOfBirthValueProvider provider for computing date for supplied expected age, month and day
func NewDictionaryProvider ¶
func NewDictionaryProvider(contextKey interface{}) ValueProvider
NewDictionaryProvider creates a new Dictionary provider, it takes a key context that is a MapDictionary pointer
func NewEnvValueProvider ¶
func NewEnvValueProvider() ValueProvider
NewEnvValueProvider returns a provider that returns a value of env variables.
func NewFileValueProvider ¶
func NewFileValueProvider(trim bool) ValueProvider
NewFileValueProvider create new file value provider
func NewNilValueProvider ¶
func NewNilValueProvider() ValueProvider
NewNilValueProvider returns a provider that returns a nil
func NewTimeDiffProvider ¶
func NewTimeDiffProvider() ValueProvider
NewTimeDiffProvider returns a provider that delta, time unit and optionally format format as java date format or unix or timestamp
func NewWeekdayProvider ¶
func NewWeekdayProvider() ValueProvider
func NewWithinSecPredicateValueProvider ¶
func NewWithinSecPredicateValueProvider() ValueProvider
NewWithinSecPredicateValueProvider returns a new within second value provider
type ValueProviderRegistry ¶
type ValueProviderRegistry interface { Register(name string, valueProvider ValueProvider) Contains(name string) bool Names() []string Get(name string) ValueProvider }
ValueProviderRegistry registry of value providers
func NewValueProviderRegistry ¶
func NewValueProviderRegistry() ValueProviderRegistry
NewValueProviderRegistry create new NewValueProviderRegistry
Source Files ¶
- batch_limiter.go
- byte_buffer_pool.go
- collections.go
- context.go
- converter.go
- decoder.go
- doc.go
- dumper.go
- encoder.go
- error.go
- file_logger.go
- fileset_info.go
- function_util.go
- iterator.go
- json.go
- log_message.go
- macro.go
- mime_type.go
- os_helper.go
- predicate.go
- predicates.go
- ranger.go
- service_router.go
- stack_helper.go
- struct_helper.go
- text.go
- time_format.go
- time_helper.go
- tokenizer.go
- types.go
- uri.go
- uri_helper.go
- value_provider.go
- waitgroup_helper.go
- writer_at.go
- yaml.go