table

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListTable

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

Example:

var resultList = make([][]string, len(results)+1)
resultList[0] = []string{"Title", "Content", "Author", "Created", "Updated"}

for i, result := range results {
	var innerList = make([]string, 5)
	for j, v := range []string{result.Title, result.Body, result.Author.Username, result.CreatedAt().Format("2006-01-02 15:04:05"), result.UpdatedAt().Format("2006-01-02 15:04:05")} {
		innerList[j] = v
	}
	resultList[i+1] = innerList
}

return table.NewListTable("100%", resultList)

func NewListTable

func NewListTable(width string, list [][]string) *ListTable

func (*ListTable) Render

func (t *ListTable) Render() jsext.Element

type NoStructAvailable

type NoStructAvailable int

type Rows

type Rows struct {
	Width     string
	Name      string
	TextAlign string
}

func GetStructFieldNames

func GetStructFieldNames(reflModel reflect.Type) []Rows

type Table

type Table[T any] struct {
	// contains filtered or unexported fields
}

func New

func New(width string) *Table[NoStructAvailable]

func NewFromStruct

func NewFromStruct[T any](width string, s []T, additionalCols map[string]func(model T) *elements.Element) *Table[T]

func (*Table[T]) Render

func (t *Table[T]) Render() jsext.Element

func (*Table[T]) Run

func (t *Table[T]) Run() *elements.Element

Jump to

Keyboard shortcuts

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