Documentation ¶
Index ¶
- func GetType(r interface{}) (attr.Type, error)
- func GetValue(r interface{}) (attr.Value, error)
- func Int64(in int64) basetypes.Int64Value
- func Int64Set(in []attr.Value) basetypes.SetValue
- func IsoFromCloudInit(ctx context.Context, ci CloudInit) (string, error)
- func IsoFromFiles(ctx context.Context, isoName string, files map[string]string) (string, error)
- func MarshalURL(r any) (url.Values, error)
- func String(in string) basetypes.StringValue
- func StringSet(in []attr.Value) basetypes.SetValue
- type CloudInit
- type ParseOption
- type Parser
- type Schedule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Int64 ¶
func Int64(in int64) basetypes.Int64Value
func Int64Set ¶
Int64Set accepts a `[]attr.Value` and returns a `basetypes.SetValue`. The return type automatically handles `SetNull` for empty results and coercing all element values to a string if there are any elements.
nolint: contextcheck
func IsoFromFiles ¶
func String ¶
func String(in string) basetypes.StringValue
String accepts a `string` and returns a `basetypes.StringValue`. The return type automatically handles `StringNull` should the string be empty.
Removes the need for the following code when saving to state.
if response.MyField == "" { state.MyField = types.StringValue(response.MyField) } else { state.MyField = types.StringNull() }
Not recommended if you care about returning an empty string for the state.
nolint: contextcheck
Types ¶
type ParseOption ¶
type ParseOption int
Configuration options for creating a parser. Most options specify which fields should be included, while others enable features. If a field is not included the parser will assume a default value. These options do not change the order fields are parse in.
const ( Second ParseOption = 1 << iota // Seconds field, default 0 Minute // Minutes field, default 0 Hour // Hours field, default 0 Dom // Day of month field, default * Month // Month field, default * Dow // Day of week field, default * DowOptional // Optional day of week field, default * Descriptor // Allow descriptors such as @monthly, @weekly, etc. )
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
A custom Parser that can be configured.
func NewParser ¶
func NewParser(options ParseOption) Parser
Creates a custom Parser with custom options.
// Standard parser without descriptors specParser := NewParser(Minute | Hour | Dom | Month | Dow) sched, err := specParser.Parse("0 0 15 */3 *") // Same as above, just excludes time fields subsParser := NewParser(Dom | Month | Dow) sched, err := specParser.Parse("15 */3 *") // Same as above, just makes Dow optional subsParser := NewParser(Dom | Month | DowOptional) sched, err := specParser.Parse("15 */3")
type Schedule ¶
type Schedule struct {
Second, Minute, Hour, Dom, Month, Dow, RepeatHour, RepeatMin, RepeatDate int64
// Override location for this schedule.
Location *time.Location
}
SpecSchedule specifies a duty cycle (to the second granularity), based on a traditional crontab specification. It is computed initially and stored as bit sets.
func Parse ¶
Parse returns a new crontab schedule representing the given spec. It returns a descriptive error if the spec is not valid.
It accepts
- Full crontab specs, e.g. "* * * * * ?"
- Descriptors, e.g. "@midnight", "@every 1h30m"
func ParseStandard ¶
ParseStandard returns a new crontab schedule representing the given standardSpec (https://en.wikipedia.org/wiki/Cron). It differs from Parse requiring to always pass 5 entries representing: minute, hour, day of month, month and day of week, in that order. It returns a descriptive error if the spec is not valid.
It accepts
- Standard crontab specs, e.g. "* * * * ?"
- Descriptors, e.g. "@midnight", "@every 1h30m"