Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatRule ¶ added in v0.5.2
FormatRule renders a Rule back into the human-readable rule syntax shown in the CLI, e.g. "type=Video && size>1GB -> Videos/Large".
Round trip: for a rule whose Conditions are populated, ParseRule(FormatRule(r), 0) yields the same Conditions and Destination, except for two limitations inherited from ParseRule. It reads a left-hand side free of '=', '>', '<' and '&&' as a bare glob, so a rule whose only clause uses a word operator does not survive. And mapField has no 'mod_time' case, so a rule using models.FieldModTime renders to text ParseRule rejects outright. Rules built from the preset helper fields (Type, Extensions, MinSize, MaxSize) fall back to rendering those helpers as clauses, which is display-only and deliberately lossy — the rendered string parses, but not back into the helpers.