Categorygithub.com/bcowtech/structproto
modulepackage
0.2.0
Repository: https://github.com/bcowtech/structproto.git
Documentation: pkg.go.dev

# README

structproto - StructPrototype

Synopsis

import (
  "github.com/bcowtech/structproto"
  "github.com/bcowtech/structproto/valuebinder"
)


type mockCharacter struct {
  Name       string    `demo:"*NAME"`
  Age        *int      `demo:"*AGE"`
  Alias      []string  `demo:"ALIAS"`
  DatOfBirth time.Time `demo:"DATE_OF_BIRTH;the character's birth of date"`
  Remark     string    `demo:"REMARK,flag1,flag2,,;note the character's personal favor"`
  Numbers    []int     `demo:"NUMBERS"`
}

func main() {
  c := mockCharacter{}
  prototype, err := structproto.Prototypify(&c, &structproto.StructProtoOption{
    TagName: "demo",
  })
  if err != nil {
    panic(err)
  }
  
  err = prototype.BindValues(NamedValues{
    "NAME":          "luffy",
    "ALIAS":         "lucy",
    "DATE_OF_BIRTH": "2020-05-05T00:00:00Z",
  }, valuebinder.BuildStringArgsBinder)
  if err != nil {
    panic(err)
  }
}

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author

# Constants

No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
A MissingRequiredFieldError represents an error when the required fields cannot be binded or missing.
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author