You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
3.1 KiB

// ------------------------------------------------------------------------
// Project atila
// Active Thing (activething.com) git.activething.com/go
//
// File name BuilderMap.go
// Created by DEV
// Modified 18/01/2024
//
// Copyright 2024 activething.com
// ------------------------------------------------------------------------
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ------------------------------------------------------------------------
package _pjson
import (
"activething.com/go/gogo/packs"
"time"
)
func (p *Builder) ElemAny (key any, value any) {
if p.addKey(key) {
p.Any(value)
}
}
func (p *Builder) ElemBinary (key any, value []byte){
if p.addKey(key) {
p.Binary(value)
}
}
func (p *Builder) ElemString (key any, value string){
if p.addKey(key) {
p.String(value)
}
}
func (p *Builder) ElemBool (key any, value bool ){
if p.addKey(key) {
p.Bool(value)
}
}
func (p *Builder) ElemRune (key any, value rune ){
if p.addKey(key) {
p.Rune(value)
}
}
func (p *Builder) ElemInt8 (key any, value int8 ){ p.ElemInt64(key, int64(value)) }
func (p *Builder) ElemInt16 (key any, value int16 ){ p.ElemInt64(key, int64(value)) }
func (p *Builder) ElemInt32 (key any, value int32 ){ p.ElemInt64(key, int64(value)) }
func (p *Builder) ElemInt64 (key any, value int64 ){
if p.addKey(key) {
p.Int64(value)
}
}
func (p *Builder) ElemUInt8 (key any, value uint8 ){ p.ElemUInt64(key, uint64(value)) }
func (p *Builder) ElemUInt16 (key any, value uint16){ p.ElemUInt64(key, uint64(value)) }
func (p *Builder) ElemUInt32 (key any, value uint32){ p.ElemUInt64(key, uint64(value)) }
func (p *Builder) ElemUInt64 (key any, value uint64){
if p.addKey(key) {
p.UInt64(value)
}
}
func (p *Builder) ElemFloat32(key any, value float32){ p.ElemFloat64(key, float64(value)) }
func (p *Builder) ElemFloat64(key any, value float64){
if p.addKey(key) {
p.Float64(value)
}
}
func (p *Builder) ElemComplex64 (key any, value complex64 ){ p.ElemComplex128(key, complex128(value)) }
func (p *Builder) ElemComplex128(key any, value complex128){
if p.addKey(key) {
p.Complex128(value)
}
}
func (p *Builder) ElemDate (key any, value time.Time) {
if p.addKey(key) {
p.Date(value)
}
}
func (p *Builder) ElemList (key any, builder func(packer packs.BuilderList)) {
if p.addKey(key) {
p.List(builder)
}
}
func (p *Builder) ElemMap (key any, builder func(packer packs.BuilderMap)) {
if p.addKey(key) {
p.Map(builder)
}
}
func (p *Builder) ElemObject(key any, builder func(packer packs.BuilderObject)) {
if p.addKey(key) {
p.Object(builder)
}
}

Powered by TurnKey Linux.