util

package
v0.0.0-...-dc5593a Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//FILE_LOC_PREFIX = "~/tmp/terrafmtter"
	FILE_LOC_PREFIX = "/tmp/terrafmtter/"
)

Variables

View Source
var (
	Logger zerolog.Logger
)

Functions

func Bytes2String

func Bytes2String(b []byte) string

Bytes2String convert bytes to string.

func ConvertHtml2Md

func ConvertHtml2Md(filePath, html string) error

func ConvertString2slice

func ConvertString2slice(in string, sep string) []string

ConvertString2slice convert string to string slice according to sep.

func String2Bytes

func String2Bytes(s string) []byte

String2Bytes convert string to bytes.

func ValidateDataSource

func ValidateDataSource(ds []string) (string, bool)

func ValidateResource

func ValidateResource(rs []string) (string, bool)

func WriteToFile

func WriteToFile(filePath string, data interface{}) error

WriteToFile write data to filePath.

Types

type ByPair

type ByPair struct {
	Pairs    []*Pair
	LessFunc func(a *Pair, j *Pair) bool
}

func (ByPair) Len

func (a ByPair) Len() int

func (ByPair) Less

func (a ByPair) Less(i, j int) bool

func (ByPair) Swap

func (a ByPair) Swap(i, j int)

type OrderedMap

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

func NewMap

func NewMap() *OrderedMap

func (*OrderedMap) Delete

func (o *OrderedMap) Delete(key string)

func (*OrderedMap) Get

func (o *OrderedMap) Get(key string) (interface{}, bool)

func (*OrderedMap) Keys

func (o *OrderedMap) Keys() []string

func (OrderedMap) MarshalJSON

func (o OrderedMap) MarshalJSON() ([]byte, error)

func (*OrderedMap) Set

func (o *OrderedMap) Set(key string, value interface{})

func (*OrderedMap) SetEscapeHTML

func (o *OrderedMap) SetEscapeHTML(on bool)

func (*OrderedMap) Sort

func (o *OrderedMap) Sort(lessFunc func(a *Pair, b *Pair) bool)

Sort Sort the map using your sort func

func (*OrderedMap) SortKeys

func (o *OrderedMap) SortKeys(sortFunc func(keys []string))

SortKeys Sort the map keys using your sort func

func (*OrderedMap) UnmarshalJSON

func (o *OrderedMap) UnmarshalJSON(b []byte) error

type Pair

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

func (*Pair) Key

func (kv *Pair) Key() string

func (*Pair) Value

func (kv *Pair) Value() interface{}

Jump to

Keyboard shortcuts

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