box

package
v0.1.2-beta Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Relation

func Relation(schema []string, tuples iter.Seq[map[string]any]) interface{ String() string }
Example
package main

import (
	"fmt"
	"slices"

	"github.com/martindrlik/rex/box"
)

func main() {
	fmt.Println(box.Relation(
		[]string{"title", "year"},
		slices.Values([]map[string]any{
			{"title": "Adventure Time", "year": 2010},
			{"title": "What We Do in the Shadows", "year": 2019},
			{"title": "The Last of Us"}})))

	fmt.Println(box.Relation([]string{"empty", "table"}, slices.Values([]map[string]any{})))

}
Output:

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┓
┃ title                     │ year ┃
┠───────────────────────────┼──────┨
┃ Adventure Time            │ 2010 ┃
┃ What We Do in the Shadows │ 2019 ┃
┃ The Last of Us            │ ?    ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┛

┏━━━━━━━┯━━━━━━━┓
┃ empty │ table ┃
┗━━━━━━━┷━━━━━━━┛

Types

This section is empty.

Jump to

Keyboard shortcuts

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