util

package
v0.0.0-...-9c3951b Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDir

func AddDir(sh *shell.Shell, d map[string]string) (string, error)

func AddPath

func AddPath(sh *shell.Shell, path string, patch map[string]string) (string, error)

func CatchJar

func CatchJar(j string, me Me) ([]byte, error)

func GetLazy

func GetLazy[T any](x IpfsLazy[T], sh *shell.Shell) *T

func Hash

func Hash(x interface{}) []byte

func KeysD

func KeysD[V any](sh *shell.Shell, x DirMap[V]) ([]string, error)

func MapMap

func MapMap[K comparable, A any, B any, F func(A) B](m map[K]A, fn F) map[K]B

func MapMap2

func MapMap2[K comparable, A any, B any, C comparable, F func(A) (B, C)](m map[K]A, fn F) (n map[K]B, c C)

func MapMap2E

func MapMap2E[K comparable, A any, B any, F func(A) (B, error)](m map[K]A, fn F) (n map[K]B, c error)

func MkJar

func MkJar(tgt []byte, me Me) string

func Patch

func Patch(sh *shell.Shell, path string, patch map[string]string) (string, error)

func PutD

func PutD[V any](sh *shell.Shell, m *DirMap[V], k string, v IpfsLazy[V]) error

func Range

func Range[T constraints.Integer](f, e T) []T

func RenderD

func RenderD[V any](v DirMap[V], sh *shell.Shell) (map[string]V, error)

func Shuffle

func Shuffle[T any](s *[]T, r *rand.Rand)

func ShuffleSeed

func ShuffleSeed[T any](s *[]T, seed int64)

func SortedKeys

func SortedKeys[K constraints.Ordered, V any](m map[K]V) []K

Types

type DirMap

type DirMap[V any] struct {
	Src   string
	Mutex sync.Mutex
}

func MapD

func MapD[V any, W any, F func(V) (W, error)](sh *shell.Shell, d DirMap[V], fn F) (*DirMap[W], error)

func NewD

func NewD[V any](m map[string]V, sh *shell.Shell) (*DirMap[V], error)

type IpfsLazy

type IpfsLazy[T any] struct {
	Src string
	// contains filtered or unexported fields
}

func GetD

func GetD[V any](m DirMap[V], k string) IpfsLazy[V]

func NewLazy

func NewLazy[T any](x T, sh *shell.Shell) *IpfsLazy[T]

type Me

type Me struct {
	Priv *rsa.PrivateKey
	Pub  *rsa.PublicKey
}

Jump to

Keyboard shortcuts

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