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.

133 lines
2.8 KiB

// ------------------------------------------------------------------------
// 🚀 Project active3
// 🔗 Active Thing (activething.com) git.activething.com/go
//
// File name state.go
// ✍️ Created by DEV
// 📅 Modified 10/05/2024
//
// 🔒 Copyright 2024 activething.com
//
// 📜 LICENSE --------------------------------------------------------------
// 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 pkjson
import (
"apack"
"apack/pstate"
"blds"
"reflect"
"time"
)
type (
Builder struct {
pstate.State
f apack.Flags
}
)
func newState () *Builder {
return &Builder{
State : *pstate.NewState(),
}
}
func (b *Builder) Any (value any) {}
func (b *Builder) Raw (value []byte){}
func (b *Builder) Binary (value []byte){}
func (b *Builder) String (value string){}
func (b *Builder) Bool (value bool){}
func (b *Builder) Int (value int ){}
func (b *Builder) Int8 (value int8 ){}
func (b *Builder) Int16 (value int16){}
func (b *Builder) Int32 (value int32){}
func (b *Builder) Int64 (value int64){}
func (b *Builder) Uint (value uint ){}
func (b *Builder) Uint8 (value uint8 ){}
func (b *Builder) Uint16 (value uint16){}
func (b *Builder) Uint32 (value uint32){}
func (b *Builder) Uint64 (value uint64){}
func (b *Builder) Float32 (value float32){}
func (b *Builder) Float64 (value float64){}
func (b *Builder) Error (value error){}
func (b *Builder) Time (value time.Time){}
func (b *Builder) Duration(value time.Duration){}
func (b *Builder) Reflect (value reflect.Value){}
func (b *Builder) List (fnc func (listBuilder blds.ListBuilder )){}
func (b *Builder) Map (fnc func (mapBuilder blds.MapBuilder )){}
func (b *Builder) Object(fnc func (objBuilder blds.ObjectBuilder)){}
func (b *Builder) Item () blds.ValueBuilder {
b.checkState()
return b
}
func (b *Builder) Key (key any) blds.ValueBuilder {
b.checkState()
b.writeSepIf(b.Items() > 0)
return b
}
func (b *Builder) Field (name string) blds.ValueBuilder {
b.checkState()
return b
}
func (b *Builder) checkState () {
if b.Err != nil {
panic(apack.G.ErrInvalidState.WithCause(b.Err))
}
}
func (b *Builder) writeSepIf(cond bool) {
if cond {
b.B.WriteByte(sep)
}
}

Powered by TurnKey Linux.