typed

package
v1.2.23 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map struct {
	// contains filtered or unexported fields
}

Map provides a wrapper around a map holding arbitrary values which supports introspection. It just provides an easy way to work with structured data, such as from JSON files.

func FromJsonBytes

func FromJsonBytes(js []byte) (Map, error)

FromJsonBytes attempts to construct a map from an array of JSON formatted bytes.

func NewMap

func NewMap(items map[string]any) Map

NewMap constructs a new wrapper around a given map of arbitrary data.

func (*Map) IsEmpty

func (p *Map) IsEmpty() bool

IsEmpty checks whether this typed map is empty or not.

func (*Map) Keys

func (p *Map) Keys() []string

Keys returns the list of items in this map, but not their contents.

func (*Map) Map

func (p *Map) Map(key string) (Map, bool)

Map attempts to retrieve an item from the map as a string. This can fail in two ways: either no such item exists; or, an item exists but has the wrong type.

func (*Map) Nil

func (p *Map) Nil(key string) bool

Nil determines whether or not the given key is assigned the nil value.

func (*Map) String

func (p *Map) String(key string) (string, bool)

String attempts to retrieve an item from the map as a string. This can fail in two ways: either no such item exists; or, an item exists but has the wrong type.

func (*Map) ToJsonBytes

func (p *Map) ToJsonBytes() ([]byte, error)

ToJsonBytes converts this map into an array of JSON formatted bytes, or returns an error.

Jump to

Keyboard shortcuts

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