package convert
import "github.com/purpleidea/mgmt/lang/core/convert"
Index ¶
- Constants
- func FormatBool(ctx context.Context, input []types.Value) (types.Value, error)
- func IntToStr(ctx context.Context, input []types.Value) (types.Value, error)
- func ParseBool(ctx context.Context, input []types.Value) (types.Value, error)
- func ToFloat(ctx context.Context, input []types.Value) (types.Value, error)
- func ToInt(ctx context.Context, input []types.Value) (types.Value, error)
Constants ¶
const ( // ModuleName is the prefix given to all the functions in this module. ModuleName = "convert" )
Functions ¶
func FormatBool ¶
FormatBool converts a boolean to a string representation that can be consumed by ParseBool. This value will be `"true"` or `"false"`.
func IntToStr ¶
IntToStr converts an integer to a string.
func ParseBool ¶
ParseBool parses a bool string and returns a boolean. It errors if you pass it an invalid value. Valid values match what is accepted by the golang strconv.ParseBool function. It's recommended to use the strings `true` or `false` if you are undecided about what string representation to choose.
func ToFloat ¶
ToFloat converts an integer to a float.
func ToInt ¶
ToInt converts a float to an integer.
Source Files ¶
convert.go format_bool.go parse_bool.go to_float.go to_int.go to_str.go
- Version
- v0.0.0-20250322185616-c50a578426f1 (latest)
- Published
- Mar 22, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 4 days ago –
Tools for package owners.