Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileRecognizer ¶ added in v0.12.3
type FileRecognizer interface { // Recognize recognizes file reference in provided input Recognize(input string) (FileReference, bool) }
FileRecognizer describes entity that has ability to find file reference in input
type FileReference ¶ added in v0.12.3
type FileReference struct { // FoundPrefix holds information about found prefix FoundPrefix FoundPrefix // Reference holds information about found file reference Reference Reference }
FileReference describes found reference to file
type FileValidator ¶
type FileValidator struct{}
FileValidator has ability to validate whether path points at any file on user OS
func NewFileValidator ¶
func NewFileValidator() FileValidator
func (FileValidator) Validate ¶
func (fv FileValidator) Validate(in interface{}) error
Validate checks whether in is valid path to any file on local user OS
type FoundPrefix ¶ added in v0.12.3
type FoundPrefix struct { // Index is byte index of first occurrence of prefix Index int // Value is prefix name Value string }
FoundPrefix describes found prefix in process of file reference recognize
type OSFileRecognizer ¶ added in v0.12.3
type OSFileRecognizer struct {
// contains filtered or unexported fields
}
OSFileRecognizer is entity that has ability to recognize reference to file in OS from string
func NewOSFileRecognizer ¶ added in v0.12.3
func NewOSFileRecognizer(prefix string, fileValidator v.Validator) OSFileRecognizer
NewOSFileRecognizer returns ready to work OSFileRecognizer. prefix should be fixed prefix of file
func (OSFileRecognizer) Recognize ¶ added in v0.12.3
func (fr OSFileRecognizer) Recognize(input string) (FileReference, bool)
Recognize accepts any string and look after reference to file as defined during construction phase in prefix field. second bool argument tells whether reference was found
type Reference ¶ added in v0.12.3
type Reference struct { // Value is raw value of reference Value string // Type is reference type Type ReferenceType }
Reference holds information about resource reference
type ReferenceType ¶ added in v0.12.3
type ReferenceType string
ReferenceType describes type of reference
const ( // ReferenceTypeOSPath describes operating system path ReferenceTypeOSPath ReferenceType = "OS_PATH" )