Documentation ¶
Index ¶
- Variables
- func CompareSlicesAsSets[T comparable](x, y []T) bool
- func CompressFiles(filenames []string, resultFilename string) error
- func FindPlaceholders(templateBytes []byte, leftDelimiter string, rightDelimiter string) ([]string, error)
- func StreamToBytes(stream io.Reader) ([]byte, error)
- func UniqueStringSlice(strings []string) []string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTemplatePlaceholdersNotFound = errors.New("placeholders not found in template") ErrDelimitersNotPassed = errors.New("delimiters did not passed") ErrBadTemplate = errors.New("can't open template file, it's broken") ErrPlaceholderWithWhitespaces = errors.New("some placeholders template has leading or tailing whitespace") )
Functions ¶
func CompareSlicesAsSets ¶ added in v0.3.5
func CompareSlicesAsSets[T comparable](x, y []T) bool
Compare two slice without ordering
func CompressFiles ¶
func FindPlaceholders ¶ added in v0.3.5
func FindPlaceholders(templateBytes []byte, leftDelimiter string, rightDelimiter string) ([]string, error)
FindPlaceholders finds all placeholders inside of given docx file (as byte slice). Takes delimiter regex pattern. For example if placeholder is "{{my_key}}", then pattern would be "{{.*}}" If given pattern is empty string then func would use default pattern "{.*}".
Returns found placeholders as a string slice. Returns error: - If there were no placeholders - If given byte slice is not a valid docx file - If placeholders have leading or tailing whitespace inside of placeholder (like `{ key}`, `{key }` or `{ key }`)
func UniqueStringSlice ¶ added in v0.3.5
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.