cueutil

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: MIT Imports: 4 Imported by: 0

README

This module provides utilities to be used with cuelang.org/go/cue.

Currently, it defines a type Overlay that allows feeding io/fs based file systems, or files embedded using //go:embed to a CUE loader. An Overlay value may be assigned to the Overlay field of a load.Config.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Overlay

type Overlay map[string]load.Source

An Overlay value may be assigned to the Overlay field of a load.Config.

func (Overlay) AddBytes

func (o Overlay) AddBytes(filename string, contents []byte) error

AddBytes adds a file with the specified []byte content to the Overlay. It calls filepath.Abs on the filename before storing the byte slice into the Overlay, and returns an error if that call fails.

func (Overlay) AddFSPaths

func (o Overlay) AddFSPaths(fsys fs.FS, paths ...string) error

AddFSPaths adds files from parts of fsys, selected by the specified paths, to the Overlay. AddFSPaths walks the parts file system, reading each file into a byte slice, adding it to the Overlay as a load.Source using load.FromBytes. It returns any error occured during the call to fs.Walkdir.

func (Overlay) AddString

func (o Overlay) AddString(filename, contents string) error

AddString adds a file with the specified string content to the Overlay. It calls filepath.Abs on the filename before storing the string into the Overlay, and returns an error if that call fails.

Jump to

Keyboard shortcuts

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