basic

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

Package basic provides a basic representation of dosini-style documents

Index

Constants

View Source
const WriteNewLine = "\n"

WriteNewLine is the new line representation used by [doc.WriteTo]

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	Global []Field

	Sections []Section
}

Document represents an INI-style document

func Decode

func Decode(r io.Reader) (*Document, error)

Decode attempts to decode an INI-style from an io.Reader array into a Document

func DecodeBytes

func DecodeBytes(b []byte) (*Document, error)

DecodeBytes attempts to decode an INI-style bytes array into a Document

func DecodeString

func DecodeString(s string) (*Document, error)

DecodeString attempts to decode an INI-style string into a Document

func (*Document) AsBuffer

func (doc *Document) AsBuffer(nl string) *bytes.Buffer

AsBuffer returns a INI representation of the document on a memory buffer

func (*Document) String

func (doc *Document) String() string

GoString generates a string output for "%s"

func (*Document) WriteTo

func (doc *Document) WriteTo(w io.Writer) (int64, error)

WriteTo writes a INI representation of the document onto the provided writer.

type Field

type Field struct {
	Key   string
	Value string
}

Field represents a key = value entry in an INI-style document

type Section

type Section struct {
	Key     string
	ID      string
	EmptyID bool

	Fields []Field
}

Section represents an INI-style section with optional GIT-style IDs

Jump to

Keyboard shortcuts

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