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.

117 lines
3.2 KiB

// ------------------------------------------------------------------------
// 🚀 Project ACTIVE4
// 🔗 Active Thing (activething.com) git.activething.com/go
//
// File name kind_packers.go
// ✍️ Created by DEV
// 📅 Modified 16/06/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 pjson
import (
"fmt"
"packs"
"reflect"
)
type (
kindPackers [maxIndexKinds + 1]kindPacker
)
func makeKindPackers() kindPackers {
notPacker := kindPacker{
packFn: unsupportedTypePacker,
emptyFn: noEmpty,
keyable: false}
boolPacker:= kindPacker{
packFn: func(p *packer, v reflect.Value, f packs.Flags) { fmt.Println("bool") },
emptyFn: isZero,
keyable: true }
intPacker := kindPacker{
packFn: func(p *packer, v reflect.Value, f packs.Flags) {},
emptyFn: isZero,
keyable: true}
uintPacker := kindPacker{
packFn: func(p *packer, v reflect.Value, f packs.Flags) {},
emptyFn: isZero,
keyable: true}
floatPacker := kindPacker{
packFn: func(p *packer, v reflect.Value, f packs.Flags) {},
emptyFn: isZero,
keyable: true}
listPacker := kindPacker{
packFn : func(p *packer, v reflect.Value, f packs.Flags) {},
emptyFn: isEmpty,
keyable: false}
ifacePacker:=kindPacker{
packFn : func(p *packer, v reflect.Value, f packs.Flags) {},
keyable: false,
emptyFn: isZero }
mapPacker := kindPacker{
packFn: func(p *packer, v reflect.Value, f packs.Flags) {},
emptyFn: isEmpty,
keyable: false}
strPacker := kindPacker{
packFn: func(p *packer, v reflect.Value, f packs.Flags) {},
keyable: true,
emptyFn: isEmpty}
objPacker := kindPacker{
packFn: func(p *packer, v reflect.Value, f packs.Flags) {},
keyable: false,
emptyFn: noEmpty}
ptrPacker := kindPacker{
packFn: func(p *packer, v reflect.Value, f packs.Flags) {},
keyable: false,
emptyFn: noEmpty}
return kindPackers{
/* Invalid */ notPacker,
/* Bool */ boolPacker,
/* Int */ intPacker,
/* Int8 */ intPacker,
/* Int16 */ intPacker,
/* Int32 */ intPacker,
/* Int64 */ intPacker,
/* Uint */ uintPacker,
/* Uint8 */ uintPacker,
/* Uint16 */ uintPacker,
/* Uint32 */ uintPacker,
/* Uint64 */ uintPacker,
/* Uintptr */ uintPacker,
/* Float32 */ floatPacker,
/* Float64 */ floatPacker,
/* Complex64 */ notPacker,
/* Complex128 */ notPacker,
/* Array */ listPacker,
/* Chan */ notPacker,
/* Func */ notPacker,
/* Interface */ ifacePacker,
/* Map */ mapPacker,
/* Pointer */ ptrPacker,
/* Slice */ listPacker,
/* String */ strPacker,
/* Struct */ objPacker,
/* UnsafePointer*/ notPacker,
}
}

Powered by TurnKey Linux.