usda

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 15 Imported by: 0

README

Go Report Card GoDoc GolangCI

xmodule/usda for Xamboo - GO

The usda package is used to keep the official free usda database for food components and nutrients

To Do:

  • Enhance the library with the new database of Nov 2019 (new tables, fields and data)

Version Changes Control

v0.0.1 - 2020-05-08

  • Compatible with xmodule context standard

v0.0.0 - 2020-03-05

  • Support for multithread context implemented

v0.0.0 - 2020-01-23

  • BuildCaches is now on parallel thread

v0.0.0 - 2019-12-18

  • First release of module

Manual:

I. USDA

Intro


  1. Overview

Example:

import "github.com/webability-go/xmodules/usda"


  1. Reference

To use the package:

import "github.com/webability-go/xmodules/usda"

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

View Source
const (
	MODULEID         = "usda"
	VERSION          = "0.0.1"
	TRANSLATIONTHEME = "nutrient"
)

Variables

View Source
var ModuleUsda = assets.ModuleEntries{}

Functions

func CreateStructureNutrientByData

func CreateStructureNutrientByData(sitecontext applications.Datasource, data xdominion.XRecordDef, lang language.Tag) base.Structure

func CreateStructureNutrientByKey

func CreateStructureNutrientByKey(sitecontext applications.Datasource, key string, lang language.Tag) base.Structure

func GetFoodNutrients

func GetFoodNutrients(sitecontext *base.Datasource, key string) *xdominion.XRecords

func GetNutrients

func GetNutrients(sitecontext *base.Datasource, lang language.Tag) []string

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 sitecontext::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 StructureNutrient

type StructureNutrient struct {
	Key  string
	Lang language.Tag
	Data *xdominion.XRecord
}

func GetNutrient

func GetNutrient(sitecontext *base.Datasource, key string, lang language.Tag) *StructureNutrient

func (*StructureNutrient) Clone

func (sm *StructureNutrient) Clone() base.Structure

Clone the whole structure

func (*StructureNutrient) ComplementData

func (sm *StructureNutrient) 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 (*StructureNutrient) GetData

func (sm *StructureNutrient) GetData() *xdominion.XRecord

Returns the raw data

func (*StructureNutrient) IsAuthorized

func (sm *StructureNutrient) 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL