Awesome Go

filler

CategoryUtilities
SubcategoryUtilities
Stars0

small utility to fill structs using "fill" tag

About filler

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

Frequently Asked Questions

What is filler?

filler is a Utilities library for the Go programming language. small utility to fill structs using "fill" tag

How do I install filler?

Install filler with the Go module system using `go get yaronsumel/filler`. Check the repository for the current installation instructions.

What category does filler belong to?

filler is listed under Utilities, specifically Utilities.

← Back to Utilities