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.

81 lines
2.3 KiB

// ------------------------------------------------------------------------
// ℹ️ Project active3
// Active Thing (activething.com) git.activething.com/go
//
// File name partial_field.go
// ✍️ Created by DEV
// 📅 Modified 01/05/2024
//
// 🔒 COPYRIGHT 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 acache
import (
"reflect"
"time"
)
type (
// partialField representa un Field parcialmente definido con solo el nombre.
// Implementa el interface NativeResolver de forma nula para proporcionar valores
// predeterminados para los tipos de datos comunes. Cuando un objeto Field
// sobrescribe alguno de estos métodos, se produce shadowing, lo que significa
// que la implementación en Field prevalecerá sobre la implementación nula de
// partialField.
partialField struct {
name string
}
)
func makePartialField (name string) partialField {
return partialField{ name : name } }
func (f partialField) Name() string {
return f.name }
func (f partialField) Bool () (bool, bool) { return false, false }
func (f partialField) String() (string, bool) { return "", false }
func (f partialField) Binary() ([]byte, bool) { return nil, false }
func (f partialField) Int () (int, bool) { return 0, false }
func (f partialField) Uint () (uint, bool) { return 0, false }
func (f partialField) Float () (float64, bool) { return 0, false }
func (f partialField) Time () (time.Time, bool) { return g.timeZero, false }
func (f partialField) Duration () (time.Duration, bool) { return 0, false }
func (f partialField) Error () (error, bool) { return nil, false }
func (f partialField) Reflect () (reflect.Value, bool) { return g.reflectZero, false }

Powered by TurnKey Linux.