Documentation
¶
Index ¶
- Variables
- func Contains(list []string, value string) bool
- func CreateLock(lock_path string) error
- func DotSerialize(prefix string, in any) map[string]string
- func ExpressionSqlFilter(filter string) (string, error)
- func FileCopy(src string, dst string) error
- func FileReplaceBlock(path, block_from, block_to string, lines ...string) error
- func FileReplaceToken(path string, full_line, add, anycase bool, token_values ...string) error
- func FileStartsWith(path string, prefix []byte) error
- func SerializeMetadata(format, prefix string, data map[string]any) (out []byte, err error)
- func WaitLock(lock_path string, clean func()) error
- type PassThruMonitor
- type UnparsedJson
Constants ¶
This section is empty.
Variables ¶
var ( ErrFileStartsWithDirectory = fmt.Errorf("FileStartsWith: Unable to check file prefix for directory") ErrFileStartsWithFileTooSmall = fmt.Errorf("FileStartsWith: File is too small for prefix") ErrFileStartsWithNotEqual = fmt.Errorf("FileStartsWith: File is not starts with the prefix") )
Functions ¶
func CreateLock ¶
The function creates the lock file, notice - remove it yourself
func DotSerialize ¶
Simple serializer to get map as key.subkey=value with dot separation for the keys
func ExpressionSqlFilter ¶ added in v0.6.0
Ensures the where filter doesn't contain bad things (SQL injections) and returns a good one could be used as Where() in gorm. It expects just an expression, so no other SQL keys will work here. For example: * `id=1 AND a in (1,2) ORDER BY i; DROP u;` will become just `"id" = 1 AND "a" IN (1, 2)` * `DROP users` - will fail * `id = 1 OR lol in (SELECT * FROM users)` - will fail
func FileReplaceBlock ¶
func FileReplaceToken ¶
func FileStartsWith ¶
func SerializeMetadata ¶
Serializes dictionary to usable format
Types ¶
type PassThruMonitor ¶
type PassThruMonitor struct { io.Reader Name string // Prefix for the message Length int64 // Expected length // contains filtered or unexported fields }
Wraps an existing io.Reader to monitor the stream
It simply forwards the Read() call, while displaying the results from individual calls to it.
type UnparsedJson ¶
type UnparsedJson string
func (*UnparsedJson) MarshalJSON ¶
func (r *UnparsedJson) MarshalJSON() ([]byte, error)
func (*UnparsedJson) UnmarshalJSON ¶
func (r *UnparsedJson) UnmarshalJSON(b []byte) error
func (*UnparsedJson) UnmarshalYAML ¶ added in v0.7.0
func (r *UnparsedJson) UnmarshalYAML(node *yaml.Node) error
To properly convert incoming yaml requests into json