utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilesExist

func FilesExist(fsys fs.FS, filePaths ...string) bool

func GetOpenAIKey

func GetOpenAIKey() (string, error)

GetOpenAIKey tries to retrieve OpenAI key from "OPENAI_API_KEY" environment variable or .env file in current workgin directory

func GetValue

func GetValue(m map[string]interface{}, path string) (interface{}, bool)

GetValue retrieves a value from a nested map given a dot-separated path (e.g. "a.b.c"). It returns the retrieved value and a boolean indicating the success of the operation.

func SetValue

func SetValue(m map[string]interface{}, path string, value interface{}) error

setValue sets a value in a nested map given a dot-separated path. If the path does not exist, it is created. If any part of the path exists and is not a map, an error is returned. This function creates any necessary maps if they don't exist, but does not overwrite non-map values in the path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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