gtag

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package gtag providing tag content storing for struct.

Note that calling functions of this package is concurrently safe.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(name string) string

Get retrieves and returns the stored tag content for specified name.

func Parse

func Parse(content string) string

Parse parses and returns the content by replacing all tag name variable to its content for given `content`. Eg: If "Demo:content" in tag mapping, Parse(`This is {Demo}`) -> `This is content`.

func Set

func Set(name, value string)

Set sets tag content for specified name.

Example
package main

import (
	"fmt"

	"easyscdp.com/gogf/gf/frame/g"
	"easyscdp.com/gogf/gf/util/gmeta"
	"easyscdp.com/gogf/gf/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"

func Sets

func Sets(m map[string]string)

Sets sets multiple tag content by map.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL