shared/generate/db/parse.go
func Parse(pkg *ast.Package, name string) (*Mapping, error) {
	str := findStruct(pkg.Scope, name)
	if str == nil {
		return nil, fmt.Errorf("No declaration found for %q", name)
	}

	fields, err := parseStruct(str)
	if err != nil {
		return nil, errors.Wrapf(err, "Failed to parse %q", name)
	}

	m := &Mapping{
		Package: pkg.Name,
		Name:    name,
		Fields:  fields,
	}

	return m, nil
}
func Parse(pkg *ast.Package, name string) (*Mapping, error) {
	str := findStruct(pkg.Scope, name)
	if str == nil {
		return nil, fmt.Errorf("No declaration found for %q", name)
	}

	fields, err := parseStruct(str)
	if err != nil {
		return nil, errors.Wrapf(err, "Failed to parse %q", name)
	}

	m := &Mapping{
		Package: pkg.Name,
		Name:    name,
		Fields:  fields,
	}

	return m, nil
}
func Parse ( pkg * ast . Package , name string ) ( * Mapping , error ) { str := findStruct ( pkg . Scope , name ) if str == nil { return nil , fmt . Errorf ( " " , name ) } fields , err := parseStruct ( str ) if err != nil { return nil , errors . Wrapf ( err , " " , name ) } m := & Mapping { Package : pkg . Name , Name : name , Fields : fields , } return m , nil }
// Parse the structure declaration with the given name found in the given Go
// package.
Parse the structure declaration with the given name found in the given Go package .