Documentation ¶
Overview ¶
Package user contains the list of administrative user for the system. All users have accesses, into a profile and even extended access based upon table records. It needs base xmodule.
Index ¶
- Constants
- Variables
- func ConvertMetrics(sitecontext *base.Datasource, quantity float64, density float64, state int, ...) (float64, *xdominion.XRecord)
- func CreateStructureMetricByData(sitecontext applications.Datasource, data xdominion.XRecordDef, ...) base.Structure
- func CreateStructureMetricByKey(sitecontext applications.Datasource, key int, lang language.Tag) base.Structure
- func ParseQuantity(cantidad string) float64
- func Setup(ds applications.Datasource, prefix string) ([]string, error)
- func StartContext(ds applications.Datasource, ctx *context.Context) error
- func Synchronize(ds applications.Datasource, prefix string) ([]string, error)
- type StructureMetric
- func (sm *StructureMetric) Clone() base.Structure
- func (sm *StructureMetric) ComplementData(sitecontext applications.Datasource)
- func (sm *StructureMetric) GetData() *xdominion.XRecord
- func (sm *StructureMetric) IsAuthorized(sitecontext applications.Datasource, site string, language string, ...) bool
Constants ¶
const ( MODULEID = "metric" VERSION = "0.0.1" TRANSLATIONTHEME = "metric" )
const ( SI_GRAM = 42 SI_LITER = 49 SI_METER = 205 SI_KILO = 45 SI_CENTILITER = 14 SI_MILILITER = 55 // solido SA_OUNCE = 56 SA_POUND = 48 // liquido SA_LOQUIDOUNCE = 207 SA_GALLON = 39 // solido o liquido, aplicar densidad si necesario SC_CUP = 86 SC_SPOON = 29 SC_TEASPOON = 30 UNIT_NOTVISIBLE = 102 // pieza sin escribir el nombre UNIT_VISIBLE = 62 // pieza escribiendo el nombre )
Variables ¶
var ModuleMetric = assets.ModuleEntries{}
Functions ¶
func ConvertMetrics ¶
func ConvertMetrics(sitecontext *base.Datasource, quantity float64, density float64, state int, fromMetric *xdominion.XRecord, system int) (float64, *xdominion.XRecord)
system is 1 - "si", 2 - "sa" or 3 - "sc" (campo "tipo" de la tabla) 0 - as captured 1 - si = sistema internacional 2 - sa = sistema americano 3 - sc = sistema de cocina density is needed for weight-volume conversions (approx 0.7 to 2.5 generally) state is the type of metric we prefer for this ingredient: (basically for SI and SA), since SC is all volume 1 = solid 2 = liquid
func CreateStructureMetricByData ¶
func CreateStructureMetricByData(sitecontext applications.Datasource, data xdominion.XRecordDef, lang language.Tag) base.Structure
func CreateStructureMetricByKey ¶
func CreateStructureMetricByKey(sitecontext applications.Datasource, key int, lang language.Tag) base.Structure
func ParseQuantity ¶
1. si SOLO tiene 0-9 y . : entonces es int/float: convierte directo 2. si tiene SOLO con anteriores / y ' ' puede ser una fraccion si tiene otra cosa: no podemos convertir (letras, guiones, espacios etc) Regresa 0 si la cantidad es 0 o vacia regresa -1 si la cantidad no pudo ser comprendida (por ejemplo, puras letras, o un float con un formato erroneo)
func Setup ¶
func Setup(ds applications.Datasource, prefix string) ([]string, error)
InitModule is called during the init phase to link the module with the system adds tables and caches to ctx::database
func StartContext ¶
func StartContext(ds applications.Datasource, ctx *context.Context) error
func Synchronize ¶
func Synchronize(ds applications.Datasource, prefix string) ([]string, error)
Types ¶
type StructureMetric ¶
func GetMetric ¶
func GetMetric(sitecontext *base.Datasource, clave int, lang language.Tag) *StructureMetric
func (*StructureMetric) Clone ¶
func (sm *StructureMetric) Clone() base.Structure
Clone the whole structure
func (*StructureMetric) ComplementData ¶
func (sm *StructureMetric) ComplementData(sitecontext applications.Datasource)
ComplementData adds all the needed data from other objects /duplicable in the thread since the object will be destroyed at the end
func (*StructureMetric) GetData ¶
func (sm *StructureMetric) GetData() *xdominion.XRecord
Returns the raw data
func (*StructureMetric) IsAuthorized ¶
func (sm *StructureMetric) IsAuthorized(sitecontext applications.Datasource, site string, language string, device string) bool
IsAuthorized returns true if the structure can be used on this site/language/device