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.

79 lines
2.8 KiB

// ------------------------------------------------------------------------
// ℹ️ Project active3
// Active Thing (activething.com) git.activething.com/go
//
// File name value_resolver.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 fields
import (
"reflect"
"time"
)
type (
// NativeResolver es una interfaz que define métodos para resolver
// y obtener valores nativos de diferentes tipos, junto con un indicador
// de éxito para indicar si la resolución fue exitosa o no.
NativeResolver interface {
// Bool intenta resolver y devolver el valor como un booleano.
// Retorna el valor booleano y un indicador de éxito.
Bool() (bool, bool)
// Binary intenta resolver y devolver el valor como un slice de bytes.
// Retorna el slice de bytes y un indicador de éxito.
Binary() ([]byte, bool)
// String intenta resolver y devolver el valor como una cadena de texto.
// Retorna la cadena de texto y un indicador de éxito.
String() (string, bool)
// Int intenta resolver y devolver el valor como un entero.
// Retorna el entero y un indicador de éxito.
Int() (int, bool)
// Uint intenta resolver y devolver el valor como un entero sin signo.
// Retorna el entero sin signo y un indicador de éxito.
Uint() (uint, bool)
// Float intenta resolver y devolver el valor como un número flotante de punto flotante de 64 bits.
// Retorna el número flotante y un indicador de éxito.
Float() (float64, bool)
// Time intenta resolver y devolver el valor como una marca de tiempo.
// Retorna la marca de tiempo y un indicador de éxito.
Time() (time.Time, bool)
// Duration intenta resolver y devolver el valor como una duración de tiempo
// Retorna la duración y un indicador de éxito.
Duration() (time.Duration, bool)
// Error intenta resolver y devolver el valor como un error.
// Retorna el error y un indicador de éxito.
Error() (error, bool)
// Reflect intenta resolver y devolver el valor como un reflect.Value.
// Retorna el reflect.Value y un indicador de éxito.
Reflect() (reflect.Value, bool)
}
)

Powered by TurnKey Linux.