format

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Overview

SPDX-FileCopyrightText: 2026 Outscale SAS <opensource@outscale.com> SPDX-License-Identifier: BSD-3-Clause

SPDX-FileCopyrightText: 2026 Outscale SAS <opensource@outscale.com> SPDX-License-Identifier: BSD-3-Clause

SPDX-FileCopyrightText: 2026 Outscale SAS <opensource@outscale.com>

SPDX-License-Identifier: BSD-3-Clause

SPDX-FileCopyrightText: 2026 Outscale SAS <opensource@outscale.com> SPDX-License-Identifier: BSD-3-Clause

SPDX-FileCopyrightText: 2026 Outscale SAS <opensource@outscale.com> SPDX-License-Identifier: BSD-3-Clause

SPDX-FileCopyrightText: 2026 Outscale SAS <opensource@outscale.com> SPDX-License-Identifier: BSD-3-Clause

SPDX-FileCopyrightText: 2026 Outscale SAS <opensource@outscale.com> SPDX-License-Identifier: BSD-3-Clause

SPDX-FileCopyrightText: 2026 Outscale SAS <opensource@outscale.com> SPDX-License-Identifier: BSD-3-Clause

SPDX-FileCopyrightText: 2026 Outscale SAS <opensource@outscale.com> SPDX-License-Identifier: BSD-3-Clause

SPDX-FileCopyrightText: 2026 Outscale SAS <opensource@outscale.com> SPDX-License-Identifier: BSD-3-Clause

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRows

func GetRows(v any, cols config.Columns, explode bool) ([][]string, error)

GetRows return one or multiple rows based on a single entry.

func IsTerminal added in v0.0.14

func IsTerminal(w io.Writer) bool

Types

type Base64

type Base64 struct{}

func (Base64) Error

func (Base64) Error(ctx context.Context, v any) error

func (Base64) Format

func (b Base64) Format(ctx context.Context, w io.Writer, v any) error

type Body added in v0.0.14

type Body struct{}

func (Body) Error added in v0.0.14

func (Body) Error(ctx context.Context, v any) error

func (Body) Format added in v0.0.14

func (Body) Format(ctx context.Context, w io.Writer, v any) (err error)

type CSVFormatter added in v0.0.16

type CSVFormatter struct{}

func (CSVFormatter) Format added in v0.0.16

func (f CSVFormatter) Format(ctx context.Context, w io.Writer, headers []string, data [][]string) error

type Interface

type Interface interface {
	Format(ctx context.Context, w io.Writer, v any) error
	Error(ctx context.Context, v any) error
}

type JSON

type JSON struct{}

func (JSON) Error

func (j JSON) Error(ctx context.Context, v any) error

func (JSON) Format

func (JSON) Format(ctx context.Context, w io.Writer, v any) error

type None

type None struct{}

func (None) Error

func (None) Error(ctx context.Context, v any) error

func (None) Format

func (None) Format(ctx context.Context, _ io.Writer, _ any) error

type Single

type Single struct {
	ForFormat Interface
}

func (Single) Error

func (s Single) Error(ctx context.Context, v any) error

func (Single) Format

func (s Single) Format(ctx context.Context, w io.Writer, v any) error

type Success added in v0.0.12

type Success struct{}

func (Success) Error added in v0.0.12

func (Success) Error(ctx context.Context, v any) error

func (Success) Format added in v0.0.12

func (Success) Format(ctx context.Context, w io.Writer, v any) error

type TableFormatter added in v0.0.16

type TableFormatter struct{}

func (TableFormatter) Format added in v0.0.16

func (f TableFormatter) Format(ctx context.Context, w io.Writer, headers []string, data [][]string) error

type Tabular added in v0.0.16

type Tabular struct {
	Explode, Sort bool
	Columns       config.Columns

	Formatter TabularFormatter
}

func (Tabular) Error added in v0.0.16

func (Tabular) Error(ctx context.Context, v any) error

func (Tabular) Format added in v0.0.16

func (t Tabular) Format(ctx context.Context, w io.Writer, v any) error

type TabularFormatter added in v0.0.16

type TabularFormatter interface {
	Format(ctx context.Context, w io.Writer, header []string, data [][]string) error
}

type YAML

type YAML struct{}

func (YAML) Error

func (y YAML) Error(ctx context.Context, v any) error

func (YAML) Format

func (YAML) Format(ctx context.Context, w io.Writer, v any) error

Jump to

Keyboard shortcuts

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