40 lines
1010 B
Go
40 lines
1010 B
Go
package util
|
|
|
|
type HyperlinkParamsMapBuilder struct {
|
|
mp map[string]map[string]any
|
|
}
|
|
|
|
func NewHyperLinkParamsMapBuilder() *HyperlinkParamsMapBuilder {
|
|
return &HyperlinkParamsMapBuilder{
|
|
mp: make(map[string]map[string]any),
|
|
}
|
|
}
|
|
|
|
func (builder *HyperlinkParamsMapBuilder) NewEnd(end string) *HyperlinkParamsMapBuilder {
|
|
builder.mp[end] = make(map[string]any)
|
|
return builder
|
|
}
|
|
|
|
func (builder *HyperlinkParamsMapBuilder) NewEnds(ends ...string) *HyperlinkParamsMapBuilder {
|
|
for _, end := range ends {
|
|
builder.mp[end] = make(map[string]any)
|
|
}
|
|
return builder
|
|
}
|
|
|
|
func (builder *HyperlinkParamsMapBuilder) WriteParam(end, key string, value any) *HyperlinkParamsMapBuilder {
|
|
builder.mp[end][key] = value
|
|
return builder
|
|
}
|
|
|
|
func (builder *HyperlinkParamsMapBuilder) WriteParamToAllEnd(key string, value any) *HyperlinkParamsMapBuilder {
|
|
for _, mp := range builder.mp {
|
|
mp[key] = value
|
|
}
|
|
return builder
|
|
}
|
|
|
|
func (builder *HyperlinkParamsMapBuilder) Map() map[string]map[string]any {
|
|
return builder.mp
|
|
}
|