report

package
v0.0.0-...-c8acfb9 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package report provides rendering of report results, for example as Markdown.

Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under Version 3 of the GNU Affero General Public License (the "AGPL"):
<https://docs.photoprism.app/license/agpl>

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

The AGPL is supplemented by our Trademark and Brand Guidelines,
which describe how our Brand Assets may be used:
<https://www.photoprism.app/trademark>

Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.

Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>

Index

Constants

View Source
const (
	Enabled     = "Enabled"
	Disabled    = "Disabled"
	Yes         = "Yes"
	No          = "No"
	NotAssigned = "n/a"
)
View Source
const (
	Default  = ""
	Markdown = "markdown"
	TSV      = "tsv"
	CSV      = "csv"
)

Variables

View Source
var CliFlags = []cli.Flag{
	cli.BoolFlag{
		Name:  "md, m",
		Usage: "format as machine-readable Markdown",
	},
	cli.BoolFlag{
		Name:  "csv, c",
		Usage: "export as semicolon separated values",
	},
	cli.BoolFlag{
		Name:  "tsv, t",
		Usage: "export as tab separated values",
	},
}

Functions

func Bool

func Bool(value bool, yes, no string) string

Bool returns t or f, depending on the value of b.

func Credentials

func Credentials(idName, idValue, secretName, secretValue string) string

Credentials returns a text-formatted table with credentials.

func CsvExport

func CsvExport(rows [][]string, cols []string, sep rune) (string, error)

CsvExport returns the report as character separated values.

func DateTime

func DateTime(t *time.Time) string

DateTime formats a time pointer as a human-readable datetime string.

func MarkdownTable

func MarkdownTable(rows [][]string, cols []string, opt Options) string

MarkdownTable returns a text-formatted table with caption, optionally as valid Markdown, so the output can be pasted into the docs.

func Render

func Render(rows [][]string, cols []string, opt Options) (string, error)

Render returns a text-formatted table, optionally as valid Markdown, so the output can be pasted into the docs.

func RenderFormat

func RenderFormat(rows [][]string, cols []string, format Format) (string, error)

RenderFormat returns a text-formatted table, optionally as valid Markdown, so the output can be pasted into the docs.

func Sort

func Sort(rows [][]string)

Sort sorts the report rows.

func UnixTime

func UnixTime(t int64) string

UnixTime formats a unix time as a human-readable datetime string.

Types

type Format

type Format string

func CliFormat

func CliFormat(ctx *cli.Context) Format

type Options

type Options struct {
	Format  Format
	Caption string
	Valid   bool
	NoWrap  bool
}

Options represents render options.

Jump to

Keyboard shortcuts

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