Categorygithub.com/francoispqt/toolbox
modulepackage
0.10.1
Repository: https://github.com/francoispqt/toolbox.git
Documentation: pkg.go.dev

# README

Toolbox - go utility library

GoReportCard GoDoc

This library is compatible with Go 1.8+

Please refer to CHANGELOG.md if you encounter breaking changes.

Motivation

This library was developed as part of Datastore Connectivity and Testibility libraries: (Assertly, Datastore testing, End to end testing) as a way to share utilities, and other abstractions that may be useful in other projects.

Collection Utilities

Iterator

Example

	slice := []string{"a", "z", "c"}
	iterator := toolbox.NewSliceIterator(slice)
    value := ""
    for iterator.HasNext() {
        iterator.Next(&value)
        ...
    }

Slice utilities

The following methods work on any slice type.

ProcessSlice

Example

	var aSlice interface{}
	
	toolbox.ProcessSlice(aSlice, func(item interface{}) bool {
    		...
    		return true //to continue to next element return true
    })
	

ProcessSliceWithIndex

Example:

	var aSlice interface{}
	
	toolbox.ProcessSlice(aSlice, func(index int, item interface{}) bool {
    		...
    		return true //to continue to next element return true
    })
	

IndexSlice

Example:

    type Foo struct{
		id int
		name string
	}

	var aSlice = []Foo{ Foo{1, "A"}, Foo{2, "B"} }
	var indexedMap = make(map[int]Foo)
	
	toolbox.IndexSlice(aSlice, indexedMap, func(foo Foo) int {
		return foo.id
	})
	
	

CopySliceElements

Example:

   source := []interface{}{
   		"abc", "def", "cyz",
   	}
   	var target = make([]string, 0)
   	toolbox.CopySliceElements(source, &target)
	
	

FilterSliceElements

Example:

	source := []interface{}{
		"abc", "def", "cyz","adc",
	}
	var target = make([]string, 0)
	
	toolbox.FilterSliceElements(source, func(item string) bool {
		return strings.HasPrefix(item, "a") //this matches any elements starting with a
	}, &target)

HasSliceAnyElements

Example:

    source := []interface{}{
		"abc", "def", "cyz","adc",
	}
	toolbox.HasSliceAnyElements(source, "cyz")

SliceToMap

Example:

    var source = []Foo{ Foo{1, "A"}, Foo{2, "B"} }
	var target = make(map[int]string)
	toolbox.MakeMapFromSlice(source, target, func(foo Foo) int {
		return foo.id
	},
	func(foo Foo) string {
		return foo.name
	})
	

TransformSlice

Example:

type Product struct{ vendor, name string }
	products := []Product{
		Product{"Vendor1", "Product1"},
		Product{"Vendor2", "Product2"},
		Product{"Vendor1", "Product3"},
		Product{"Vendor1", "Product4"},
	}
	var vendors=make([]string, 0)
	toolbox.TransformSlice(products, &vendors, func(product Product) string {
		return product.vendor
	})

Map utilities

ProcessMap

The following methods work on any map type.

Example:

    var aMap interface{}
	toolbox.ProcessMap(aMap, func(key, value interface{}) bool {
    		...
    		return true //to continue to next element return true
    })

CopyMapEntries

Example:

    type Foo struct{id int;name string}
	
	source := map[interface{}]interface{} {
		1: Foo{1, "A"},
		2: Foo{2, "B"},
	}
	var target = make   (map[int]Foo)

	toolbox.CopyMapEntries(source, target)

MapKeysToSlice

Example:

    aMap := map[string]int {
		"abc":1,
		"efg":2,
	}
	var keys = make([]string, 0)
	toolbox.MapKeysToSlice(aMap, &keys)

GroupSliceElements

Example:

	type Product struct{vendor,name string}
    	products := []Product{
    		Product{"Vendor1", "Product1"},
    		Product{"Vendor2", "Product2"},
    		Product{"Vendor1", "Product3"},
    		Product{"Vendor1", "Product4"},
    	}
    
    	productsByVendor := make(map[string][]Product)
    	toolbox.GroupSliceElements(products, productsByVendor, func(product Product) string {
    		return product.vendor
    	})

SliceToMultimap

	type Product struct {
    		vendor, name string
    		productId    int
    	}
    
    	products := []Product{
    		Product{"Vendor1", "Product1", 1},
    		Product{"Vendor2", "Product2", 2},
    		Product{"Vendor1", "Product3", 3},
    		Product{"Vendor1", "Product4", 4},
    	}
    
    	productsByVendor := make(map[string][]int)
    	toolbox.SliceToMultimap(products, productsByVendor, func(product Product) string {
    		return product.vendor
    	},
    	func(product Product) int {
    		return product.productId
    	})

Converter && Conversion Utilities

Converter transforms, data between any compatible or incompatible data type including struct/basicType/map/slice/interface{} On top of that it supports custom tag to map field to target data type (i.e map)

    myStruct :=  //some struct ...
    myMap := make(map[string]interface{})
    converter := NewConverter(dateLayout, keyTag) 	
    err = converter.AssignConverted(&myMap, myStruct)
    err = converter.AssignConverted(myStruct, myMap) 

Struct Utilities

ScanStructMethods

Scan struct methods

    service := New()
    err = toolbox.ScanStructMethods(service, 1, func(method reflect.Method) error {
		fmt.Printf("%v\n", method.Name)
		return nil
	})

ProcessStruct

Scan struct fields

   service := New()
    err = toolbox.ProcessStruct(service,
        func(field reflect.StructField, value reflect.Value) error {
            fmt.Print(field.Type.Name)
            return nil
    })

Function Utilities

Time Utilities

DateFormatToLayout

Java date format style to go date layout conversion.

    dateLaout := toolbox.DateFormatToLayout("yyyy-MM-dd hh:mm:ss z")
    timeValue, err := time.Parse(dateLaout, "2016-02-22 12:32:01 UTC")

TimeAt

Provide dynamic semantic for creating time object

    
    tomorrow, err = TimeAt("tomorrow")//tomorrow in local timezone
    timeInUTC, err := TimeAt("2 days ago in UTC") //or 2DayAgoInUTC
    yesterdayUTC, err := TimeAt("yesterdayInUTC")//yesterday in UTC
    hoursAhead, err := TimeAt("50 hours ahead")

TimeDiff

Provide dynamic semantic for creating time object based on time dif


    lastyear, _ := time.Parse(DateFormatToLayout("yyyy-MM-dd"), "2017-01-01")
    ts1, e := TimeDiff(lastyear, "50 hours earlier")
    ts2, e := TimeDiff(lastyear, "3 days before in Poland")
	

DayElapsed


    t0, _ := time.Parse(DateFormatToLayout("yyyy-MM-dd hh:mm:ss"), "2017-01-01 12:00:00")
    dayElapsedInT0, err := ElapsedDay(t0) //0.5
	

ElapsedToday


    elapscedInLocalTz, err := ElapsedTodayInPct("")  
    elapscedInUTC, err := ElapsedToday("UTC")
	

RemainingToday


    elapscedInLocalTz, err := RemainingTodayInPct("")
    elapscedInUTC, err := RemainingToday("UTC")
	

Storage API

Storage API provides unified way of accessing local or remote storage system.

Example

    import (
    	"github.com/viant/toolbox/storage"
    	_ "github.com/viant/toolbox/storage/gs"	
    )
    
    
    destinationURL := "gs://myBucket/set1/content.gz"
    destinationCredentialFile = "gs-secret.json"
    storageService, err := storage.NewServiceForURL(destinationURL, destinationCredentialFile)

Macro

Tokenizer

ServiceRouter

This ServiceRouter provides simple WebService Endpoint abstractin and RESET Client utilities.

Take as example of a ReverseService defined as follow


type ReverseService interface {
        Reverse(values []int) []int 
}

type reverseService struct{}

func (r *reverseService) Reverse(values []int) []int {
	var result = make([]int, 0)
	for i := len(values) - 1; i >= 0; i-- {
		result = append(result, values[i])
	}

	return result
}

In order to define Endpoint for this service, define a server, a router with the service routes;



type Server struct {
    service ReverseService
    port string
}

func (s *Server) Start() {
    
    router := toolbox.NewServiceRouter(
		toolbox.ServiceRouting{
			HTTPMethod: "GET",
			URI:        "/v1/reverse/{ids}",
			Handler:    s.service.Reverse,
			Parameters: []string{"ids"}, 
		},
		toolbox.ServiceRouting{
			HTTPMethod: "POST",
			URI:        "/v1/reverse/",
			Handler:    s.service.Reverse,
			Parameters: []string{"ids"},
		})
		
        http.HandleFunc("/v1/", func(writer http.ResponseWriter, reader *http.Request) {
            err := router.Route(writer, reader)
            if err != nil {
                response.WriteHeader(http.StatusInternalServerError)
            }
        })
    
        fmt.Printf("Started test server on port %v\n", port)
        log.Fatal(http.ListenAndServe(":"+port, nil))
}

ServiceRouting parameters define handler parameters that can be extracted from URI, QueryString, or from Post Body (json payload) In addition two special parameter names are supported: @httpRequest, @httpResponseWriter to pass in request, and response object respectively.

The REST client utility invoking our reverse service may look as follow


               var result = make([]int, 0)
               err := toolbox.RouteToService("get", "http://127.0.0.1:8082/v1/reverse/1,7,3", nil, &result)
               //...
               err := toolbox.RouteToService("post", "http://127.0.0.1:8082/v1/reverse/", []int{1, 7, 3}, &result)

By default a service router uses reflection to call the matched routes handler, it is possible to avoid reflection overhead by providing the custom handler invoker.



var ReverseInvoker = func(serviceRouting *toolbox.ServiceRouting, request *http.Request, response http.ResponseWriter, uriParameters map[string]interface{}) error {
	var function = serviceRouting.Handler.(func(values []int) []int)
	idsParam := uriParameters["ids"]
	ids := idsParam.([]string)
	values := make([]int, 0)
	for _, item := range ids {
		values = append(values, toolbox.AsInt(item))
	}
	var result = function(values)
	err := toolbox.WriteServiceRoutingResponse(response, request, serviceRouting, result)
	if err != nil {
		return err
	}
	return nil
}

//...

 
        router := toolbox.NewServiceRouter(
		toolbox.ServiceRouting{
			HTTPMethod: "GET",
			URI:        "/v1/reverse/{ids}",
			Handler:    s.service.Reverse,
			Parameters: []string{"ids"},
			HandlerInvoker: ReverseInvoker,
		})
//...		
		

Decoder and Encoder

Decoder

This library defines DecoderFactory interface to delegate decoder creation, This library comes with standard JSON and UnMarshaler (protobuf) factory implementation.

Example

    factory :=toolbox.NewJsonDecoderFactory()
    ....
    
    decoder := factory.Create(reader)
    foo := &Foo{}
    err = decoder.Decode(foo)



    marshalerFactory := toolbox.NewUnMarshalerDecoderFactory()
    decoder := marshalerFactory.Create(reader)
    foo := &Foo{}
    err = decoder.Decode(foo)

Encoder

This library defines EncoderFactory interface to delegate encoder creation, This library comes with standard JSON and Marshaler (protobuf) factory implementation.

Example

        factory :=toolbox.NewJsonEncoderFactory()
        ....
        buffer := new(bytes.Buffer)
        
        
        decoder := factory.Create(buffer)
        err = decoder.Encode(foo)
    
    
    
        marshalerFactory := toolbox.NewMarshalerEncoderFactory()
        decoder := marshalerFactory.Create(buffer)
        err = decoder.Encode(foo)

Logger

This library provides a file logger implementation that optimizes writes. Log messages are queues until max queue size or flush frequency are met. On top of that Ctrl-C also forces immediate log messages flush to disk.

File template support java style time format to manage rotation on the file name level.

    logger, err := toolbox.NewFileLogger(toolbox.FileLoggerConfig{
		LogType:           "test",
		FileTemplate:      "/tmp/test[yyyyMMdd-hhmm].log",
		QueueFlashCount:   250,
		MaxQueueSize:      500,
		FlushFrequencyInMs: 2000,
		MaxIddleTimeInSec: 1,
	}, toolbox.FileLoggerConfig{
       		LogType:           "transaction",
       		FileTemplate:      "/tmp/transaction[yyyyMMdd-hhmm].log",
       		QueueFlashCount:   250,
       		MaxQueueSize:      500,
       		FlushFrequencyInMs:2000,
       		MaxIddleTimeInSec: 1,
       	},
	)

    logger.Log(&toolbox.LogMessage{
        MessageType: "test",
        Message:     message
    })
    
    logger.Log(&toolbox.LogMessage{
            MessageType: "transaction",
            Message:     message
        })

BatchLimiter

This library provides a batch limiter, that enables controling number of active go routines.


     var tasks []*Task
     var batchSize = 4
	 limiter:= toolbox.NewBatchLimiter(batchSize, len(tasks))
   	 for i, _ :=  range tasks {
            go func(task *Task) {
                    limiter.Acquire()
                    defer limiter.Done()
                    task.Run();
        	}(tasks[i])
	}
	limiter.Wait()

GoCover

GoCover

License

The source code is made available under the terms of the Apache License, Version 2, as stated in the file LICENSE.

Individual files may be made available under their own specific license, all compatible with Apache License, Version 2. Please see individual files for details.

Credits and Acknowledgements

Library Author: Adrian Witas

Contributors:

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

AsBoolean converts an input to bool.
AsCompatibleFunctionParameters takes incompatible function parameters and converts then into provided function signature compatible.
AsFloat converts an input to float.
AsIndentJSONText converts data structure int text JSON.
AsInt converts an input to int.
AsJSONText converts data structure int text JSON.
AsMap converts underlying map as map[string]interface{}.
AssertKind checks if input is of the passed in kind, if not it panic with message including name.
AssertPointerKind checks if input is a pointer of the passed in kind, if not it panic with message including name.
AssertTypeKind checks if dataType is of the passed in kind, if not it panic with message including name.
AsSlice converts underlying slice or Ranger as []interface{}.
AsString converts an input to string.
AsTime converts an input to time, it takes time input, dateLaout as parameters.
AsYamlText converts data structure int text YAML.
BuildFunctionParameters builds function parameters provided in the parameterValues.
BuildTagMapping builds map keyed by mappedKeyTag tag value, and value is another map of keys where tag name is presents in the tags parameter.
CallerDirectory returns directory of caller source code directory.
CallerInfo return filename, function or file line from the stack.
CallFunction calls passed in function with provided parameters,it returns a function result.
CanConvertToFloat checkis if float conversion is possible.
CanConvertToInt returns true if an input can be converted to int value.
CanConvertToString checks if input can be converted to string.
CopyMapEntries appends map entry from source map to target map.
CloneNonEmptyMap removes empty keys from map result.
CopySliceElements appends elements from source slice into targetThis 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.
CopyBuffer copies bytes from passed in source to destination with provided pool.
CountPointers count pointers to undelying non pointer type.
CreateDirIfNotExist creates directory if they do not exist.
DateFormatToLayout converts java date format https://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#rfc822timezone into go date layout.
No description provided by the author
DeleteEmptyKeys removes empty keys from map result.
DereferenceType dereference passed in value.
DereferenceValue dereference passed in value.
DereferenceValues replaces pointer to its value within a generic map or slice.
DiscoverCaller returns the first matched caller info.
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.
DiscoverComponentType returns type unwrapped from pointer, slice or map.
DiscoverTypeByKind returns unwrapped input type that matches expected kind, or panic if this is not possible.
DiscoverValueAndKind discovers input kind, it applies checks of the following types: int, float, bool, string.
DiscoverValueByKind returns unwrapped input that matches expected kind, or panic if this is not possible.
Dump prints passed in data as JSON.
DumpIndent prints passed in data as indented JSON.
ElapsedDay returns elapsed pct for passed in day (second elapsed that day over 24 hours).
ElapsedToday returns elapsed today time percent, it takes optionally timezone.
ExpandFileTemplate expands.
ExpandParameters expands passed in parameters as strings.
ExpandValue expands passed in value, it returns expanded string value or error.
ExpectToken returns the matched token or error.
ExpectTokenOptionallyFollowedBy returns second matched token or error if first and second group was not matched.
ExtractMimeType extracts mime type by extension.
ExtractURIParameters parses URIs to extract {<param>} defined in templateURI from requestURI, it returns extracted parameters and flag if requestURI matched templateURI.
FileExists checks if file exists.
Filename reformat file name.
FilterSliceElements copies elements from sourceSlice to targetSlice if predicate function returns true.
GetFuncSignature returns a function signature.
GetFunction returns function for provided owner and name, or error.
GetSliceValue gets value from passed in index.
GetStructMeta returns struct meta.
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 dateLayoutIf neithers keys exists it panics, please use HasTimeLayout to avoid panic.
GroupSliceElements reads source slice and transfer all values returned by keyFunction to a slice in target map.
HasSliceAnyElements checks if sourceSlice has any of passed in elements.
HasTimeLayout checks if dateLayout can be taken from the passed in setting map.
Handler ignoring unexported fields.
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.
InitStruct initialise any struct pointer to empty struct.
IsASCIIText return true if supplied string does not have binary data.
IsBool returns true if input is a boolean.
IsCompleteJSON returns true if supplied represent complete JSON.
IsEOFError returns true if io.EOF.
IsFloat returns true if input is a float.
IsFunc returns true if input is a funct.
IsInt returns true if input is an int.
IsMap returns true if input is a map.
IsNewLineDelimitedJSON returns true if supplied content is multi line delimited JSON.
IsNilPointerError returns true if error is nil pointer.
IsNotFoundError checks is supplied error is NotFoundError type.
IsNumber returns true if type is either float or int.
IsPointer returns true if input is a pointer.
IsPrintText return true if all candidate characters are printable (unicode.IsPrintText).
IsSlice returns true if input is a map.
IsString returns true if input is a string.
IsStruct returns true if input is a map.
IsTime returns true if input is a time.
IsValueOfKind returns true if passed in input is of supplied kind.
IsZero returns true if input is a zeroable.
JoinAsString joins all items of a slice, with separator, it takes any slice as argument,.
JSONToInterface converts JSON source to an interface (either map or slice).
JSONToMap converts JSON source into map.
JSONToSlice converts JSON source into slice.
MakeMap creates a mapstring]interface{} from string,.
MakeReverseStringMap creates a mapstring]string from string, the values become key, and key values.
MakeStringMap creates a mapstring]string from string,.
MapKeysToSlice appends all map keys to targetSlice.
MapKeysToStringSlice creates a string slice from sourceMap keys, keys do not need to be of a string type.
No description provided by the author
NewBetweenPredicate creates a new BETWEEN predicate, it takes from, and to.
NewBetweenPredicateValueProvider returns a new between value provider.
NewBodyMatcher creates a new body matcher.
NewBytes copies from input.
NewBytesBufferPool returns new httputil.BufferPool pool.
NewWriterAt returns a new instance of byte writer at.
NewCastedValueProvider return a provider that return casted value type.
NewCharactersMatcher creates a new character matcher.
NewColumnConverter create a new converter, that has ability to convert map to struct using column mapping.
NewComparablePredicate create a new comparable predicate for =, !=, >=, <=.
NewContext creates a new context.
NewConverter create a new converter, that has ability to convert map to struct, it uses keytag to identify source and dest of fields/keys.
NewCurrentDateProvider returns a provider that returns current date in the format yyyymmdd, i.e.
NewCurrentTimeProvider returns a provder that returns time.Now().
NewCustomIdMatcher creates new custom matcher.
NewDateOfBirthValueProvider provider for computing date for supplied expected age, month and day.
NewDelimiterDecoderFactory returns a new delimitered decoder factory.
NewDictionaryProvider creates a new Dictionary provider, it takes a key context that is a MapDictionary pointer.
NewDuration returns a durationToken for supplied value and time unit, 3, "second".
NewEnvValueProvider returns a provider that returns a value of env variables.
NewFieldInfo creates a new field info.
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.
Visit creates a new file info.
NewFileLogger create new file logger.
NewFileSetInfo creates a new fileset info.
NewFileValueProvider create new file value provider.
NewFlexYamlDecoderFactory create a new yaml decoder factory.
NewFunctionInfo create a new function.
No description provided by the author
NewIllegalTokenError create a new illegal token error.
NewInPredicate creates a new IN predicate.
NewIntMatcher returns a new integer matcher.
NewJSONDecoderFactory create a new JSONDecoderFactory.
NewJSONDecoderFactoryWithOption create a new JSONDecoderFactory, it takes useNumber decoder parameter.
NewJSONEncoderFactory creates new NewJSONEncoderFactory.
NewKeywordsMatcher returns a matcher for supplied keywords.
NewLikePredicate create a new like predicate.
NewLineDelimitedJSON returns JSON for supplied multi line JSON.
NewMacroEvaluator returns a new macro evaluator.
NewMarshalerEncoderFactory create a new encoder factory for marsheler struct.
NewNilPointerError creates a new nil pointer error.
NewNilPredicate returns a new nil predicate.
NewNilValueProvider returns a provider that returns a nil.
Creates a matcher that matches all remaining input.
NewSequenceMatcher creates a new matcher that finds all sequence until find at least one of the provided terminators.
NewServiceRouter creates a new service router, is takes list of service routing as arguments.
NewSliceIterator creates a new slice iterator.
NewTerminatorMatcher creates a new matcher that finds any sequence until find at least one of the provided terminators.
NewTimeDiffProvider returns a provider that delta, time unit and optionally formatformat as java date format or unix or timestamp.
NewTokenizer creates a new NewTokenizer, it takes input, invalidToken, endOfFileToeken, and matchers.
NewToolboxHTTPClient instantiate new client with provided options.
NewTypeInfo creates a new struct info.
NewUnMarshalerDecoderFactory returns a decoder factory.
NewValueProviderRegistry create new NewValueProviderRegistry.
No description provided by the author
NewWithinPredicate returns new NewWithinPredicate predicate, it takes base time, delta in second, and dateLayout.
NewWithinSecPredicateValueProvider returns a new within second value provider.
NewYamlDecoderFactory create a new yaml decoder factory.
NewYamlEncoderFactory create a new yaml encoder factory.
NormalizeKVPairs converts slice of KV paris into a map, and map[interface{}]interface{} to map[string]interface{}.
OpenFile open file converting path to elements and rebuling path safety with path.Join.
Pairs returns map for pairs.
ParseTime parses time, adjusting date layout to length of input.
Process2DSliceInBatches iterates over any 2 dimensional slice, it calls handler with batch.
ProcessMap iterates over any map, it calls handler with every key, value pair unless handler returns false.
ProcessSlice iterates over any slice, it calls handler with each element unless handler returns false,.
ProcessSliceWithIndex iterates over any slice, it calls handler with every index and item unless handler returns false.
ProcessStruct reads passed in struct fields and values to pass it to provided handler.
QueryBoolValue returns query value for passed in url's name or default value.
QueryIntValue returns query value for passed in url's name or default value.
QueryValue returns query value for passed in url's name or default value.
ReclassifyNotFoundIfMatched reclassify error if not found.
RemainingToday returns remaining today time percent, it takes optionally timezone.
RemoveFileIfExist remove file if exists.
ProcessSlice iterates over any slice, it calls handler with each element unless handler returns false,.
RouteToService calls web service url, with passed in json request, and encodes http json response into passed response.
ScanStructFunc scan supplied struct methods.
SetSliceValue sets value at slice index.
SetStructMetaFilter sets struct meta filter.
No description provided by the author
SliceToMap reads passed in slice to to apply the key and value function for each item.
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.
SortStrings creates a new copy of passed in slice and sorts it.
TerminatedSplitN split supplied text into n fragmentCount, each terminated with supplied terminator.
TimeAt returns time of now supplied offsetExpression, this function uses 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") ).
TimestampToString formats timestamp to passed in java style date format.
ToBoolean converts an input to bool.
ToFloat converts an input to float or error.
ToInt converts input value to int or error.
ToMap converts underlying map/struct/[]KV as map[string]interface{}.
No description provided by the author
TransformSlice appends transformed elements from source slice into target, transformer take as argument item of source slice and return value of target slice.
TryDiscoverTypeByKind returns unwrapped input type that matches expected kind, or error.
TryDiscoverValueByKind returns unwrapped input that matches expected kind, or panic if this is not possible.
UnwrapValue returns value.
URLBase returns base URL.
URLPathJoin joins URL paths.
URLSplit returns URL with parent path and resource name.
URLStripPath removes path from URL.
WaitGroup that waits with a timeout Returns true if timeout exceeded and false if there was no timeout.
WriteServiceRoutingResponse writes service router response.

# Constants

CSVMimeType csv mime type constant.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
JSONMimeType JSON mime type constant.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RFC 5789.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
TextMimeType mime type constant.
No description provided by the author
TSVMimeType tab separated mime type constant.
No description provided by the author

# Variables

CopyStringValueProvider is a function that returns passed in stringThis provider can be used to make map from slice like map[string]some type.
DateFormatKeyword constant 'dateFormat' key.
DateLayoutKeyword constant 'dateLayout' key.
DefaultConverter represents a default data structure converter.
DefaultDateLayout is set to 2006-01-02 15:04:05.000.
DefaultDecoderFactory - NewJSONDecoderFactory.
DefaultEncoderFactory - NewJSONEncoderFactory.
FileExtensionMimeType json, csv, tsc, sql mime types.
FileSchema file://.
No description provided by the author
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.
YamlDefaultDecoderFactory - NewYamlDecoderFactory.
YamlDefaultEncoderFactory - NewYamlEncoderFactory.

# Structs

No description provided by the author
LiteralMatcher represents a matcher that finds any literals in the input.
ByteWriterAt represents a bytes writer at.
CharactersMatcher represents a matcher, that matches any of Chars.
Converter represets data converter, it converts incompatibe data structure, like map and struct, string and time, *string to string, etc.
DelimitedRecord represents a delimited record.
EOFMatcher represents end of input matcher.
FieldInfo represents a filed info.
FileInfo represent hold definition about all defined types and its receivers in a file.
FileLogger represents a file logger.
FileLoggerConfig represents FileLogger.
FileSetInfo represents a fileset info storing information about go file with their struct definition.
FunctionInfo represents a function info.
No description provided by the author
LiteralMatcher represents a matcher that finds any literals in the input.
IllegalTokenError represents illegal token error.
IntMatcher represents a matcher that finds any int in the input.
KeywordMatcher represents a keyword matcher.
KeywordsMatcher represents a matcher that finds any of specified keywords in the input.
LiteralMatcher represents a matcher that finds any literals in the input.
LogMessage represent log message.
LogMessages represents log messages.
LogStream represents individual log stream.
MacroEvaluator represents a macro expression evaluator, macros has the following format macro prefix [macro parameter] macro postfix.
NilPointerError represents nil pointer error.
NotFoundError represents not found error.
SequenceMatcher represents a matcher that finds any sequence until find provided terminators.
ServiceRouter represents routing rule.
ServiceRouting represents a simple web services routing rule, which is matched with http request.
StructField represents a struct field.
StructFieldMeta represents struct field meta.
StructMeta represents struct meta details.
Token a matchable input.
Tokenizer represents a token scanner.
ToolboxHTTPClient contains preconfigured http client.
TypeInfo represents a struct info.

# Interfaces

ContentTypeAccessor server side response accessor.
ContentTypeMutator client side reponse optional interface.
Context represents type safe map.
Decoder represents a decoder.
DecoderFactory create an decoder for passed in input stream.
Dictionary represents simply lookup interface.
Encoder writes an instance to output stream.
EncoderFactory create an encoder for an output stream.
Iterator represents generic iterator.
Marshaler represents byte to object converter.
Matcher represents a matcher, that matches input from offset position, it returns number of characters matched.
Predicate represents a generic predicate.
Ranger represents an abstraction that has ability range over collection item.
StatucCodeAccessor server side response accessor.
StatucCodeMutator client side reponse optional interface.
UnMarshaler represent an struct that can be converted to bytes.
ValueProvider represents a value provider.
ValueProviderRegistry registry of value providers.
Zeroable represents object that can call IsZero.

# Type aliases

No description provided by the author
HandlerInvoker method is responsible of passing required parameters to router handler.
MapDictionary alias to map of string and interface{}.
StructMetaFilter.
UnexportedFieldHandler represents unexported field handler.