fill struct data easily with fill tags
Go
Switch branches/tags
Nothing to show
Clone or download
Latest commit 2d383ee Apr 10, 2017
Permalink
Failed to load latest commit information.
example some breaking changes Apr 10, 2017
.travis.yml travisCI Apr 5, 2017
LICENSE Initial commit Apr 5, 2017
README.md some breaking changes Apr 10, 2017
filler.go goFmt 100% Apr 10, 2017
filler_test.go goFmt 100% Apr 10, 2017

README.md

filler Go Report Card Build Status GoDoc

small util to fill gaps in your structs

Installation

$ go get github.com/yaronsumel/filler

Usage

package main

import (
	"fmt"
	"github.com/yaronsumel/filler"
)

type model struct {
	UserID   string
	UserName string `fill:"UserNameFiller:UserID"`
}

func init() {
	filler.RegFiller("UserNameFiller", func(value interface{}) (interface{}, error) {
		return "UserId" + value.(string), nil
	})
}

func main() {
	m := &model{
		UserID: "123",
	}
	fmt.Printf("%+v\n", m)
	// should print `&{UserId:123 UserName:}`
	filler.Fill(m)
	// should print `&{UserId:123 UserName:UserId123}`
	fmt.Printf("%+v\n", m)
}

Written and Maintained by @YaronSumel