// ObjectOmitEmpty adds an object to be encoded or skips it if IsNil returns true.
// Must be used inside a slice or array encoding (does not encode a key)
// value must implement MarshalerJSONObject
978625
func (enc *Encoder) ObjectOmitEmpty(v MarshalerJSONObject) {
	if v.IsNil() {
		return
	}
	enc.grow(2)
	r := enc.getPreviousRune()
	if r != '[' {
		enc.writeByte(',')
	}
	enc.writeByte('{')

	var origHasKeys = enc.hasKeys
	var origKeys = enc.keys
	enc.hasKeys = false
	enc.keys = nil

	v.MarshalJSONObject(enc)

	enc.hasKeys = origHasKeys
	enc.keys = origKeys

	enc.writeByte('}')
}
772437
func (enc *Encoder) ArrayNullEmpty(v MarshalerJSONArray) {
	enc.grow(4)
	r := enc.getPreviousRune()
	if r != '[' {
		enc.writeByte(',')
	}
	if v.IsNil() {
		enc.writeBytes(nullBytes)
		return
	}
	enc.writeByte('[')
	v.MarshalJSONArray(enc)
	enc.writeByte(']')
}
611838
func IsEmpty(val reflect.Value) bool {
	valType := val.Kind()
	switch valType {
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		return val.Int() == 0
	case reflect.Float32, reflect.Float64:
		return val.Float() == 0
	case reflect.String:
		return val.String() == ""
	case reflect.Interface, reflect.Slice, reflect.Ptr, reflect.Map, reflect.Chan, reflect.Func:
		// Check for empty slices and props
		if val.IsNil() {
			return true
		} else if valType == reflect.Slice || valType == reflect.Map {
			return val.Len() == 0
		}
	case reflect.Struct:
		fieldCount := val.NumField()
		for i := 0; i < fieldCount; i++ {
			field := val.Field(i)
			if field.IsValid() && !IsEmpty(field) {
				return false
			}
		}
		return true
	default:
		return false
	}
	return false
}
583414
func isEmptyUnstructuredObject(in runtime.Object) bool {
	u, ok := in.(*unstructured.Unstructured)
	if !ok {
		return false
	}
	if len(u.Object) != 2 {
		return false
	}
	if _, ok := u.Object["kind"]; !ok {
		return false
	}
	if _, ok := u.Object["apiVersion"]; !ok {
		return false
	}
	return true
}
1255099
func IsEmpty(obj interface{}) bool {
	if obj == nil || obj == "" || obj == false {
		return true
	}

	for _, v := range numericZeros {
		if obj == v {
			return true
		}
	}

	objValue := reflect.ValueOf(obj)

	switch objValue.Kind() {
	case reflect.Map:
		fallthrough
	case reflect.Slice, reflect.Chan:
		return objValue.Len() == 0
	case reflect.Struct:
		return reflect.DeepEqual(obj, ZeroOf(obj))
	case reflect.Ptr:
		if objValue.IsNil() {
			return true
		}

		obj = redirectValue(objValue).Interface()

		return reflect.DeepEqual(obj, ZeroOf(obj))
	}

	return false
}
701846
func (engine *Engine) IsTableEmpty(bean interface{}) (bool, error) {
	session := engine.NewSession()
	defer session.Close()
	return session.IsTableEmpty(bean)
}
750920
func (v *Values) IsEmpty() bool {
	v.lock.RLock()
	defer v.lock.RUnlock()

	return v.root.isEmpty()
}
983496
func (enc *Encoder) Float32OmitEmpty(v float32) {
	if v == 0 {
		return
	}
	enc.grow(10)
	r := enc.getPreviousRune()
	if r != '[' {
		enc.writeByte(',')
	}
	enc.buf = strconv.AppendFloat(enc.buf, float64(v), 'f', -1, 32)
}
1032216
func (enc *Encoder) AddBoolKeyOmitEmpty(key string, v bool) {
	enc.BoolKeyOmitEmpty(key, v)
}
604297
func objectFromInterface(val interface{}) (map[string]interface{}, error) {
	switch val.(type) {
	case map[string]interface{}:
		return val.(map[string]interface{}), nil
	}
	return map[string]interface{}{}, fmt.Errorf("Expected json object for Object, got \"%v\"\n", val)
}
242792
func (enc *Encoder) AddSQLNullInt64OmitEmpty(v *sql.NullInt64) {
	if v != nil && v.Valid && v.Int64 != 0 {
		enc.Int64OmitEmpty(v.Int64)
	}
}
645399
func (enc *Encoder) Uint16KeyOmitEmpty(key string, v uint16) {
	enc.Uint64KeyOmitEmpty(key, uint64(v))
}
600416
func (rules *L7Rules) IsEmpty() bool {
	return rules == nil || (rules.HTTP == nil && rules.Kafka == nil && rules.DNS == nil && rules.L7 == nil)
}
352893
func isEmpty(t reflect.Type, value []string) bool {
	if len(value) == 0 {
		return true
	}
	switch t.Kind() {
	case boolType, float32Type, float64Type, intType, int8Type, int32Type, int64Type, stringType, uint8Type, uint16Type, uint32Type, uint64Type:
		return len(value[0]) == 0
	}
	return false
}
1036978
func (q *Queue) IsEmpty() bool {
	return atomic.LoadUint64(q.write.processing) == atomic.LoadUint64(q.read.processing)
}
1023666
func IsEmpty(fs Fs, path string) (bool, error) {
	if b, _ := Exists(fs, path); !b {
		return false, fmt.Errorf("%q path does not exist", path)
	}
	fi, err := fs.Stat(path)
	if err != nil {
		return false, err
	}
	if fi.IsDir() {
		f, err := fs.Open(path)
		if err != nil {
			return false, err
		}
		defer f.Close()
		list, err := f.Readdir(-1)
		return len(list) == 0, nil
	}
	return fi.Size() == 0, nil
}
411318
func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
	if h, ok := t.(tHelper); ok {
		h.Helper()
	}

	pass := isEmpty(object)
	if !pass {
		Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...)
	}

	return pass

}