htmllookup

package module
v0.0.0-...-59816ef Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: MIT Imports: 16 Imported by: 0

README

htmllookup

Fast html/javascript lookup generated from a csv file

The API is still unstable!

Example

Example (without error checks):

package main

import (
	"github.com/msilvoso/htmllookup"
)

func main() {
	h, _ := htmllookup.NewFromFile("testdata/oscar_age_female.csv", ',')
	h.Title = "Oscar winning ladies"
	h.Hover()
	h.Bordered()
	h.Striped()
	h.AddOption("year", htmllookup.OCellIsGreaterOrEqual, 1980, true, "success")
	h.AddOption("age", htmllookup.OCellIsLowerOrEqual, 23, false, "danger")
	h.AddOption("age", htmllookup.OCellIsGreaterOrEqual, 30, false, "info")
	h.AddOption("index", htmllookup.OCellIsLower, 10, true, "warning")
	h.AddOption("name", htmllookup.OCellIsGreater, "lll", false, "primary")
	h.HideColumns("index")
	h.SearchableColumns("year", "name", 4)
	h.Process()
	h.Save("oscar.html")
}
const (
    OCellHasValue         = 1
    OCellIsEqual          = 2
    OCellIsGreater        = 4
    OCellIsLower          = 8
    OCellIsGreaterOrEqual = 16
    OCellIsLowerOrEqual   = 32
)

Functions

func New

func New() *htmlLookup

New is the simple factory for the htmlLookup struct you will still need to load some data

func NewFromData

func NewFromData(content [][]string) (*htmlLookup, error)

NewFromData instantiates a new struct preloading it with the content of a slice

func NewFromFile

func NewFromFile(fileName string, delimiter rune) (*htmlLookup, error)

NewFromFile instantiates a new struct preloading it with the content of a csv file

Documentation

Index

Constants

View Source
const (
	OCellHasValue         = 1 << iota
	OCellIsEqual          = 1 << iota
	OCellIsGreater        = 1 << iota
	OCellIsLower          = 1 << iota
	OCellIsGreaterOrEqual = 1 << iota
	OCellIsLowerOrEqual   = 1 << iota
	OCellIsNotEqual       = 1 << iota
)

powers of two

Variables

This section is empty.

Functions

func New

func New() *htmlLookup

New is the simple factory for the htmlLookup struct you will still need to load some data

func NewFromData

func NewFromData(content [][]string) (*htmlLookup, error)

NewFromData instantiates a new htmlLookup struct preloading it with the content of a slice

func NewFromFile

func NewFromFile(fileName string, delimiter rune) (*htmlLookup, error)

NewFromFile instantiates a new htmlLookup struct preloading it with the content of a csv file

Types

This section is empty.

Jump to

Keyboard shortcuts

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