Documentation ¶
Overview ¶
Package gtag providing tag content storing for struct.
Note that calling functions of this package is not concurrently safe, which means you cannot call them in runtime but in boot procedure.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse parses and returns the content by replacing all tag name variable to its content for given `content`. Eg: gtag.Set("demo", "content") Parse(`This is {demo}`) -> `This is content`.
func Set ¶
func Set(name, value string)
Set sets tag content for specified name. Note that it panics if `name` already exists.
Example ¶
package main import ( "fmt" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/util/gmeta" "github.com/gogf/gf/v2/util/gtag" ) func main() { type User struct { g.Meta `name:"User Struct" description:"{UserDescription}"` } gtag.Sets(g.MapStrStr{ `UserDescription`: `This is a demo struct named "User Struct"`, }) fmt.Println(gmeta.Get(User{}, `description`)) }
Output: This is a demo struct named "User Struct"
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.