tagparser

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: BSD-2-Clause Imports: 2 Imported by: 24

README

Opinionated Golang tag parser

Build Status GoDoc

Installation

Install:

go get -u github.com/vmihailenco/tagparser

Quickstart

func ExampleParse() {
	tag := tagparser.Parse("some_name,key:value,key2:'complex value'")
	fmt.Println(tag.Name)
	fmt.Println(tag.Options)
	// Output: some_name
	// map[key:value key2:'complex value']
}

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unquote

func Unquote(s string) (string, bool)

Types

type Tag

type Tag struct {
	Name    string
	Options map[string]string
}

func Parse

func Parse(s string) *Tag
Example
package main

import (
	"fmt"

	"github.com/vmihailenco/tagparser"
)

func main() {
	tag := tagparser.Parse("some_name,key:value,key2:'complex value'")
	fmt.Println(tag.Name)
	fmt.Println(tag.Options)
}
Output:

some_name
map[key:value key2:'complex value']

func (*Tag) HasOption

func (t *Tag) HasOption(name string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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