Documentation ¶
Index ¶
- Variables
- func AnnotateError(err error) string
- func AsString(x starlark.Value) (string, error)
- func ConvertToStarlark(value interface{}) (starlark.Value, error)
- func DecorateError(thread *starlark.Thread, err error) error
- func EnsureWorkdir(jobid string) string
- func IsEmptyString(s starlark.String) bool
- func Marshal(data interface{}) (v starlark.Value, err error)
- func Unmarshal(x starlark.Value) (val interface{}, err error)
- type ArgParser
- func (parser *ArgParser) GetBool(index int) (bool, error)
- func (parser *ArgParser) GetBoolByName(kwarg string) (bool, error)
- func (parser *ArgParser) GetInt(index int) (int64, error)
- func (parser *ArgParser) GetIntByName(kwarg string) (int64, error)
- func (parser *ArgParser) GetList(index int) ([]interface{}, error)
- func (parser *ArgParser) GetListByName(kwarg string) ([]interface{}, error)
- func (parser *ArgParser) GetParam(index int) (starlark.Value, error)
- func (parser *ArgParser) GetParamIndex(kwarg string) (int, error)
- func (parser *ArgParser) GetString(index int) (string, error)
- func (parser *ArgParser) GetStringByName(kwarg string) (string, error)
- func (parser *ArgParser) RestrictKwargs(kwargs ...string) error
- type ArgParserInterface
- type ErrIncorrectType
- type ErrUnhashable
- type Marshaler
- type Retval
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMalformattedKwarg occurs when a keyword argument passed to a starlark function is malformatted. ErrMalformattedKwarg = errors.New("malformatted keyword argument for method call") // ErrMissingKwarg occurs when a keyword argument is missing from a starlark function call. ErrMissingKwarg = errors.New("missing keyword argument for method call") // ErrMissingArg occurs when an argument is missing from a starlark function call. ErrMissingArg = errors.New("missing argument for method call") // ErrInvalidArgType occurs when an argument provided to a starlark function call has the wrong type. ErrInvalidArgType = errors.New("invalid argument type provided to method") // ErrMissingLibrary occurs when attempting to load a library that doesn't exist. ErrMissingLibrary = errors.New("could not find library to load") // ErrInvalidTypeConversion occurs when converting a golang type to a starlark.Value fails. ErrInvalidTypeConversion = errors.New("could not convert golang value to starlark.Value") // ErrInvalidKwarg occurs when a user incorrectly passes a kwarg to a starlark function ErrInvalidKwarg = errors.New("invalid kwarg was passed to the method") )
Functions ¶
func ConvertToStarlark ¶
ConvertToStarlark provides an exported function for converting starlark values
func DecorateError ¶
DecorateError decorate all error with starlark detail
func EnsureWorkdir ¶
func IsEmptyString ¶
IsEmptyString checks is a starlark string is empty ("" for a go string) starlark.String.String performs repr-style quotation, which is necessary for the starlark.Value contract but a frequent source of errors in API clients. This helper method makes sure it'll work properly
Types ¶
type ArgParser ¶
type ArgParser struct { ArgParserInterface // contains filtered or unexported fields }
func (*ArgParser) GetBoolByName ¶
func (*ArgParser) GetListByName ¶
func (*ArgParser) GetStringByName ¶
func (*ArgParser) RestrictKwargs ¶
type ArgParserInterface ¶
type ArgParserInterface interface { RestrictKwargs(kwargs ...string) error GetParam(index int) (starlark.Value, error) GetString(index int) (string, error) GetStringByName(name string) (string, error) GetInt(index int) (int64, error) GetIntByName(name string) (int64, error) GetBool(index int) (bool, error) GetBoolByName(kwarg string) (bool, error) }
ArgParser easy parse starlark args and kwargs
type ErrIncorrectType ¶
type ErrIncorrectType struct {
// contains filtered or unexported fields
}
func (ErrIncorrectType) Error ¶
func (eit ErrIncorrectType) Error() string
type ErrUnhashable ¶
type ErrUnhashable string
func (ErrUnhashable) Error ¶
func (err ErrUnhashable) Error() string
type Marshaler ¶
type Marshaler interface { // MarshalStarlark marshal a custom type to starlark object. MarshalStarlark() (starlark.Value, error) }
Marshaler is the interface use to marshal starlark custom types.
type Unmarshaler ¶
type Unmarshaler interface { // UnmarshalStarlark unmarshal a starlark object to custom type. UnmarshalStarlark(starlark.Value) error }
Unmarshaler is the interface use to unmarshal starlark custom types.
Click to show internal directories.
Click to hide internal directories.