format

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: MIT Imports: 1 Imported by: 5

Documentation

Index

Constants

View Source
const (
	UnknownExt string = ".unknown"
	// input formats
	ExcelExt string = ".xlsx"
	CSVExt   string = ".csv"
	XMLExt   string = ".xml"
	YAMLExt  string = ".yaml"
	// output formats
	JSONExt string = ".json"
	BinExt  string = ".bin"
	TextExt string = ".txt"
)

File format extension

Variables

View Source
var InputFormats = []Format{Excel, CSV, XML, YAML}
View Source
var OutputFormats = []Format{JSON, Bin, Text}

Functions

func Amongst added in v0.9.7

func Amongst(fmt Format, formats []Format) bool

func FilterInput added in v0.9.7

func FilterInput(inputFormat Format, allowedInputFormats []Format) bool

FilterInput checks if this input format need to be converted.

func Format2Ext

func Format2Ext(fmt Format) string

func IsInputDocumentFormat added in v0.11.0

func IsInputDocumentFormat(fmt Format) bool

IsInputDocumentFormat checks whether the fmt belongs to input document formats, such as yaml.

func IsInputFormat added in v0.9.10

func IsInputFormat(fmt Format) bool

IsInputFormat checks whether the fmt belongs to InputFormats, such as Excel.

Types

type Format

type Format string
const (
	UnknownFormat Format = "unknown"
	// input formats
	Excel Format = "xlsx"
	CSV   Format = "csv"
	XML   Format = "xml"
	YAML  Format = "yaml"
	// output formats
	JSON Format = "json"
	Bin  Format = "bin"
	Text Format = "txt"
)

File format

func Ext2Format

func Ext2Format(ext string) Format

func GetFormat added in v0.11.0

func GetFormat(filename string) Format

GetFormat returns the file's format by filename extension.

Jump to

Keyboard shortcuts

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