README

structtags

Go Report Card Codecov Build Status Go docs

A go package for parsing struct tags based on the pattern used in the encoding packages of the go stdlib.

Usage

See the example in the Go Docs.

Documentation

Overview

    Package structtags parses struct tags based on the pattern used in the encoding packages of the go stdlib.

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type Tag

    type Tag struct {
    	Value   string
    	Options TagOptions
    }

      Tag contains a tag value and options.

      func Parse

      func Parse(tag string) Tag

        Parse parses a string tag into a Tag struct. A tag defined as `myTag:"value,abc,def"` will be parsed as: Tag {

        Value: "value",
        Options: ["abc", "def"],
        

        }

        Example
        Output:
        
        Tag: "a"
          Omit Empty: true
          Flatten: true
        Tag: ""
          Omit Empty: true
          Flatten: false
        

        type TagOptions

        type TagOptions []string

          TagOptions contains the options for a tag.

          func (TagOptions) Contains

          func (o TagOptions) Contains(option string) bool

            Contains checks if the option is contained in the TagOptions.

            Source Files