util

package
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package util is forked from https://github.com/qri-io/starlib in order to prune excessive transitive dependencies from pulling in that library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmptyString

func IsEmptyString(s starlark.String) bool

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

func Marshal

func Marshal(data interface{}) (v starlark.Value, err error)

Marshal turns go values into starlark types

func Unmarshal

func Unmarshal(x starlark.Value) (val interface{}, err error)

Unmarshal decodes a starlark.Value into it's golang counterpart

Types

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL