attrs: github.com/gobuffalo/attrs Index | Files

package attrs

import "github.com/gobuffalo/attrs"

Index

Package Files

attrs.go named_attrs.go parse.go version.go

Constants

const Version = "v0.0.1"

Version of attrs

Variables

var ErrMissingName = errors.New("requires a name argument")
var ErrRepeatedAttr = errors.New("duplicate attr name")

ErrRepeatedAttr is returned when parsing an array with repeated names

type Attr Uses

type Attr struct {
    Original string
    Name     name.Ident
    // contains filtered or unexported fields
}

Attr is buffalo's implementation for model attributes

func Parse Uses

func Parse(arg string) (Attr, error)

Parse takes a string like name:commonType:goType and turns it into an Attr

func (Attr) CommonType Uses

func (a Attr) CommonType() string

CommonType returns the common type of an attribute, this common type is used later for things like determining the database column type depending on the database.

func (Attr) GoType Uses

func (a Attr) GoType() string

GoType returns the Go type for an Attr based on its commonType

func (Attr) String Uses

func (a Attr) String() string

type Attrs Uses

type Attrs []Attr

Attrs is a slice of Attr

func ParseArgs Uses

func ParseArgs(args ...string) (Attrs, error)

ParseArgs parses passed string args into Attrs

func (Attrs) Slice Uses

func (ats Attrs) Slice() []string

type NamedAttrs Uses

type NamedAttrs struct {
    Name  name.Ident
    Attrs Attrs
}

func ParseNamedArgs Uses

func ParseNamedArgs(args ...string) (NamedAttrs, error)

func (NamedAttrs) String Uses

func (n NamedAttrs) String() string

func (NamedAttrs) Validate Uses

func (n NamedAttrs) Validate() error

Package attrs imports 3 packages (graph) and is imported by 6 packages. Updated 2019-02-26. Refresh now. Tools for package owners.