expandedwriter

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 5 Imported by: 0

README

Expandedwriter

Expandedwriter outputs data the same as PostgreSQL's expanded table formatting.

Example

package main

import (
	"os"

	"github.com/y-yagi/expandedwriter"
)

func main() {
	w := expandedwriter.NewWriter(os.Stdout)

	w.SetFields([]string{"id", "email"})

	w.Append([]string{"1", "test1@example.com"})
	w.Append([]string{"2", "test2@example.com"})

	w.Render()

	// --[ Data 1 ]-------------
	// id    | 1
	// email | test1@example.com
	// --[ Data 2 ]-------------
	// id    | 2
	// email | test2@example.com
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expandedwriter

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

func NewWriter

func NewWriter(w io.Writer) *Expandedwriter

func (*Expandedwriter) Append

func (ew *Expandedwriter) Append(value []string)

func (*Expandedwriter) Render

func (ew *Expandedwriter) Render() error

func (*Expandedwriter) SetFields

func (ew *Expandedwriter) SetFields(fields []string)

func (*Expandedwriter) SetHeaderName

func (ew *Expandedwriter) SetHeaderName(headername string)

Jump to

Keyboard shortcuts

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