Documentation ¶
Overview ¶
Package reason provides some utils for encoding data into a 'reason' string.
This package is a work in progress and makes no API stability promises.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractScore ¶
ExtractScore extracts a score from a reason string. It returns the score, an string reason without the score and error
func WithPolicy ¶
WithPolicy inserts a policy inside a reason string. If there is a policy inside, WithPolicy will replace it.
Types ¶
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
Policy stores fields and values (both are strings). Warning, it's unsafe.
func ExtractPolicy ¶
ExtractPolicy extracts a policy from a reason string. It returns the policy, an string reason without the policy and error.
func (*Policy) FromString ¶
FromString loads from a encoded string the values of a policy. String must be in the format:
[policy]field1=value1,field2=value2[/policy]