chore: refactor plugin structure (#18335)
This commit is contained in:
parent
9127e1a913
commit
07fa1b64f8
127 changed files with 861 additions and 938 deletions
44
plugin/golang/registry.go
Normal file
44
plugin/golang/registry.go
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
package golang
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/evcc-io/evcc/plugin/golang/stdlib"
|
||||
"github.com/traefik/yaegi/interp"
|
||||
)
|
||||
|
||||
var (
|
||||
mu sync.Mutex
|
||||
registry = make(map[string]*interp.Interpreter)
|
||||
)
|
||||
|
||||
// RegisteredVM returns a JS VM. If name is not empty, it will return a shared instance.
|
||||
func RegisteredVM(name, init string) (*interp.Interpreter, error) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
name = strings.ToLower(name)
|
||||
vm, ok := registry[name]
|
||||
|
||||
// create new VM
|
||||
if !ok {
|
||||
vm = interp.New(interp.Options{})
|
||||
if err := vm.Use(stdlib.Symbols); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
vm.ImportUsed()
|
||||
|
||||
if init != "" {
|
||||
if _, err := vm.Eval(init); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if name != "" {
|
||||
registry[name] = vm
|
||||
}
|
||||
}
|
||||
|
||||
return vm, nil
|
||||
}
|
||||
151
plugin/golang/stdlib/fmt.go
Normal file
151
plugin/golang/stdlib/fmt.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by 'yaegi extract fmt'. DO NOT EDIT.
|
||||
|
||||
//go:build go1.23
|
||||
// +build go1.23
|
||||
|
||||
package stdlib
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Symbols["fmt/fmt"] = map[string]reflect.Value{
|
||||
// function, constant and variable definitions
|
||||
"Append": reflect.ValueOf(fmt.Append),
|
||||
"Appendf": reflect.ValueOf(fmt.Appendf),
|
||||
"Appendln": reflect.ValueOf(fmt.Appendln),
|
||||
"Errorf": reflect.ValueOf(fmt.Errorf),
|
||||
"FormatString": reflect.ValueOf(fmt.FormatString),
|
||||
"Fprint": reflect.ValueOf(fmt.Fprint),
|
||||
"Fprintf": reflect.ValueOf(fmt.Fprintf),
|
||||
"Fprintln": reflect.ValueOf(fmt.Fprintln),
|
||||
"Fscan": reflect.ValueOf(fmt.Fscan),
|
||||
"Fscanf": reflect.ValueOf(fmt.Fscanf),
|
||||
"Fscanln": reflect.ValueOf(fmt.Fscanln),
|
||||
"Print": reflect.ValueOf(fmt.Print),
|
||||
"Printf": reflect.ValueOf(fmt.Printf),
|
||||
"Println": reflect.ValueOf(fmt.Println),
|
||||
"Scan": reflect.ValueOf(fmt.Scan),
|
||||
"Scanf": reflect.ValueOf(fmt.Scanf),
|
||||
"Scanln": reflect.ValueOf(fmt.Scanln),
|
||||
"Sprint": reflect.ValueOf(fmt.Sprint),
|
||||
"Sprintf": reflect.ValueOf(fmt.Sprintf),
|
||||
"Sprintln": reflect.ValueOf(fmt.Sprintln),
|
||||
"Sscan": reflect.ValueOf(fmt.Sscan),
|
||||
"Sscanf": reflect.ValueOf(fmt.Sscanf),
|
||||
"Sscanln": reflect.ValueOf(fmt.Sscanln),
|
||||
|
||||
// type definitions
|
||||
"Formatter": reflect.ValueOf((*fmt.Formatter)(nil)),
|
||||
"GoStringer": reflect.ValueOf((*fmt.GoStringer)(nil)),
|
||||
"ScanState": reflect.ValueOf((*fmt.ScanState)(nil)),
|
||||
"Scanner": reflect.ValueOf((*fmt.Scanner)(nil)),
|
||||
"State": reflect.ValueOf((*fmt.State)(nil)),
|
||||
"Stringer": reflect.ValueOf((*fmt.Stringer)(nil)),
|
||||
|
||||
// interface wrapper definitions
|
||||
"_Formatter": reflect.ValueOf((*_fmt_Formatter)(nil)),
|
||||
"_GoStringer": reflect.ValueOf((*_fmt_GoStringer)(nil)),
|
||||
"_ScanState": reflect.ValueOf((*_fmt_ScanState)(nil)),
|
||||
"_Scanner": reflect.ValueOf((*_fmt_Scanner)(nil)),
|
||||
"_State": reflect.ValueOf((*_fmt_State)(nil)),
|
||||
"_Stringer": reflect.ValueOf((*_fmt_Stringer)(nil)),
|
||||
}
|
||||
}
|
||||
|
||||
// _fmt_Formatter is an interface wrapper for Formatter type
|
||||
type _fmt_Formatter struct {
|
||||
IValue interface{}
|
||||
WFormat func(f fmt.State, verb rune)
|
||||
}
|
||||
|
||||
func (W _fmt_Formatter) Format(f fmt.State, verb rune) {
|
||||
W.WFormat(f, verb)
|
||||
}
|
||||
|
||||
// _fmt_GoStringer is an interface wrapper for GoStringer type
|
||||
type _fmt_GoStringer struct {
|
||||
IValue interface{}
|
||||
WGoString func() string
|
||||
}
|
||||
|
||||
func (W _fmt_GoStringer) GoString() string {
|
||||
return W.WGoString()
|
||||
}
|
||||
|
||||
// _fmt_ScanState is an interface wrapper for ScanState type
|
||||
type _fmt_ScanState struct {
|
||||
IValue interface{}
|
||||
WRead func(buf []byte) (n int, err error)
|
||||
WReadRune func() (r rune, size int, err error)
|
||||
WSkipSpace func()
|
||||
WToken func(skipSpace bool, f func(rune) bool) (token []byte, err error)
|
||||
WUnreadRune func() error
|
||||
WWidth func() (wid int, ok bool)
|
||||
}
|
||||
|
||||
func (W _fmt_ScanState) Read(buf []byte) (n int, err error) {
|
||||
return W.WRead(buf)
|
||||
}
|
||||
func (W _fmt_ScanState) ReadRune() (r rune, size int, err error) {
|
||||
return W.WReadRune()
|
||||
}
|
||||
func (W _fmt_ScanState) SkipSpace() {
|
||||
W.WSkipSpace()
|
||||
}
|
||||
func (W _fmt_ScanState) Token(skipSpace bool, f func(rune) bool) (token []byte, err error) {
|
||||
return W.WToken(skipSpace, f)
|
||||
}
|
||||
func (W _fmt_ScanState) UnreadRune() error {
|
||||
return W.WUnreadRune()
|
||||
}
|
||||
func (W _fmt_ScanState) Width() (wid int, ok bool) {
|
||||
return W.WWidth()
|
||||
}
|
||||
|
||||
// _fmt_Scanner is an interface wrapper for Scanner type
|
||||
type _fmt_Scanner struct {
|
||||
IValue interface{}
|
||||
WScan func(state fmt.ScanState, verb rune) error
|
||||
}
|
||||
|
||||
func (W _fmt_Scanner) Scan(state fmt.ScanState, verb rune) error {
|
||||
return W.WScan(state, verb)
|
||||
}
|
||||
|
||||
// _fmt_State is an interface wrapper for State type
|
||||
type _fmt_State struct {
|
||||
IValue interface{}
|
||||
WFlag func(c int) bool
|
||||
WPrecision func() (prec int, ok bool)
|
||||
WWidth func() (wid int, ok bool)
|
||||
WWrite func(b []byte) (n int, err error)
|
||||
}
|
||||
|
||||
func (W _fmt_State) Flag(c int) bool {
|
||||
return W.WFlag(c)
|
||||
}
|
||||
func (W _fmt_State) Precision() (prec int, ok bool) {
|
||||
return W.WPrecision()
|
||||
}
|
||||
func (W _fmt_State) Width() (wid int, ok bool) {
|
||||
return W.WWidth()
|
||||
}
|
||||
func (W _fmt_State) Write(b []byte) (n int, err error) {
|
||||
return W.WWrite(b)
|
||||
}
|
||||
|
||||
// _fmt_Stringer is an interface wrapper for Stringer type
|
||||
type _fmt_Stringer struct {
|
||||
IValue interface{}
|
||||
WString func() string
|
||||
}
|
||||
|
||||
func (W _fmt_Stringer) String() string {
|
||||
if W.WString == nil {
|
||||
return ""
|
||||
}
|
||||
return W.WString()
|
||||
}
|
||||
11
plugin/golang/stdlib/generate.go
Normal file
11
plugin/golang/stdlib/generate.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package stdlib
|
||||
|
||||
import "reflect"
|
||||
|
||||
// go:generate yaegi extract fmt
|
||||
// go:generate yaegi extract math
|
||||
// go:generate yaegi extract strings
|
||||
// go:generate yaegi extract time
|
||||
|
||||
// Symbols variable stores the map of stdlib symbols per package.
|
||||
var Symbols = map[string]map[string]reflect.Value{}
|
||||
116
plugin/golang/stdlib/math.go
Normal file
116
plugin/golang/stdlib/math.go
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
// Code generated by 'yaegi extract math'. DO NOT EDIT.
|
||||
|
||||
//go:build go1.23
|
||||
// +build go1.23
|
||||
|
||||
package stdlib
|
||||
|
||||
import (
|
||||
"go/constant"
|
||||
"go/token"
|
||||
"math"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Symbols["math/math"] = map[string]reflect.Value{
|
||||
// function, constant and variable definitions
|
||||
"Abs": reflect.ValueOf(math.Abs),
|
||||
"Acos": reflect.ValueOf(math.Acos),
|
||||
"Acosh": reflect.ValueOf(math.Acosh),
|
||||
"Asin": reflect.ValueOf(math.Asin),
|
||||
"Asinh": reflect.ValueOf(math.Asinh),
|
||||
"Atan": reflect.ValueOf(math.Atan),
|
||||
"Atan2": reflect.ValueOf(math.Atan2),
|
||||
"Atanh": reflect.ValueOf(math.Atanh),
|
||||
"Cbrt": reflect.ValueOf(math.Cbrt),
|
||||
"Ceil": reflect.ValueOf(math.Ceil),
|
||||
"Copysign": reflect.ValueOf(math.Copysign),
|
||||
"Cos": reflect.ValueOf(math.Cos),
|
||||
"Cosh": reflect.ValueOf(math.Cosh),
|
||||
"Dim": reflect.ValueOf(math.Dim),
|
||||
"E": reflect.ValueOf(constant.MakeFromLiteral("2.71828182845904523536028747135266249775724709369995957496696762566337824315673231520670375558666729784504486779277967997696994772644702281675346915668215131895555530285035761295375777990557253360748291015625", token.FLOAT, 0)),
|
||||
"Erf": reflect.ValueOf(math.Erf),
|
||||
"Erfc": reflect.ValueOf(math.Erfc),
|
||||
"Erfcinv": reflect.ValueOf(math.Erfcinv),
|
||||
"Erfinv": reflect.ValueOf(math.Erfinv),
|
||||
"Exp": reflect.ValueOf(math.Exp),
|
||||
"Exp2": reflect.ValueOf(math.Exp2),
|
||||
"Expm1": reflect.ValueOf(math.Expm1),
|
||||
"FMA": reflect.ValueOf(math.FMA),
|
||||
"Float32bits": reflect.ValueOf(math.Float32bits),
|
||||
"Float32frombits": reflect.ValueOf(math.Float32frombits),
|
||||
"Float64bits": reflect.ValueOf(math.Float64bits),
|
||||
"Float64frombits": reflect.ValueOf(math.Float64frombits),
|
||||
"Floor": reflect.ValueOf(math.Floor),
|
||||
"Frexp": reflect.ValueOf(math.Frexp),
|
||||
"Gamma": reflect.ValueOf(math.Gamma),
|
||||
"Hypot": reflect.ValueOf(math.Hypot),
|
||||
"Ilogb": reflect.ValueOf(math.Ilogb),
|
||||
"Inf": reflect.ValueOf(math.Inf),
|
||||
"IsInf": reflect.ValueOf(math.IsInf),
|
||||
"IsNaN": reflect.ValueOf(math.IsNaN),
|
||||
"J0": reflect.ValueOf(math.J0),
|
||||
"J1": reflect.ValueOf(math.J1),
|
||||
"Jn": reflect.ValueOf(math.Jn),
|
||||
"Ldexp": reflect.ValueOf(math.Ldexp),
|
||||
"Lgamma": reflect.ValueOf(math.Lgamma),
|
||||
"Ln10": reflect.ValueOf(constant.MakeFromLiteral("2.30258509299404568401799145468436420760110148862877297603332784146804725494827975466552490443295866962642372461496758838959542646932914211937012833592062802600362869664962772731087170541286468505859375", token.FLOAT, 0)),
|
||||
"Ln2": reflect.ValueOf(constant.MakeFromLiteral("0.6931471805599453094172321214581765680755001343602552541206800092715999496201383079363438206637927920954189307729314303884387720696314608777673678644642390655170150035209453154294578780536539852619171142578125", token.FLOAT, 0)),
|
||||
"Log": reflect.ValueOf(math.Log),
|
||||
"Log10": reflect.ValueOf(math.Log10),
|
||||
"Log10E": reflect.ValueOf(constant.MakeFromLiteral("0.43429448190325182765112891891660508229439700580366656611445378416636798190620320263064286300825210972160277489744884502676719847561509639618196799746596688688378591625127711495224502868950366973876953125", token.FLOAT, 0)),
|
||||
"Log1p": reflect.ValueOf(math.Log1p),
|
||||
"Log2": reflect.ValueOf(math.Log2),
|
||||
"Log2E": reflect.ValueOf(constant.MakeFromLiteral("1.44269504088896340735992468100189213742664595415298593413544940772066427768997545329060870636212628972710992130324953463427359402479619301286929040235571747101382214539290471666532766903401352465152740478515625", token.FLOAT, 0)),
|
||||
"Logb": reflect.ValueOf(math.Logb),
|
||||
"Max": reflect.ValueOf(math.Max),
|
||||
"MaxFloat32": reflect.ValueOf(constant.MakeFromLiteral("340282346638528859811704183484516925440", token.FLOAT, 0)),
|
||||
"MaxFloat64": reflect.ValueOf(constant.MakeFromLiteral("179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368", token.FLOAT, 0)),
|
||||
"MaxInt": reflect.ValueOf(constant.MakeFromLiteral("9223372036854775807", token.INT, 0)),
|
||||
"MaxInt16": reflect.ValueOf(constant.MakeFromLiteral("32767", token.INT, 0)),
|
||||
"MaxInt32": reflect.ValueOf(constant.MakeFromLiteral("2147483647", token.INT, 0)),
|
||||
"MaxInt64": reflect.ValueOf(constant.MakeFromLiteral("9223372036854775807", token.INT, 0)),
|
||||
"MaxInt8": reflect.ValueOf(constant.MakeFromLiteral("127", token.INT, 0)),
|
||||
"MaxUint": reflect.ValueOf(constant.MakeFromLiteral("18446744073709551615", token.INT, 0)),
|
||||
"MaxUint16": reflect.ValueOf(constant.MakeFromLiteral("65535", token.INT, 0)),
|
||||
"MaxUint32": reflect.ValueOf(constant.MakeFromLiteral("4294967295", token.INT, 0)),
|
||||
"MaxUint64": reflect.ValueOf(constant.MakeFromLiteral("18446744073709551615", token.INT, 0)),
|
||||
"MaxUint8": reflect.ValueOf(constant.MakeFromLiteral("255", token.INT, 0)),
|
||||
"Min": reflect.ValueOf(math.Min),
|
||||
"MinInt": reflect.ValueOf(constant.MakeFromLiteral("-9223372036854775808", token.INT, 0)),
|
||||
"MinInt16": reflect.ValueOf(constant.MakeFromLiteral("-32768", token.INT, 0)),
|
||||
"MinInt32": reflect.ValueOf(constant.MakeFromLiteral("-2147483648", token.INT, 0)),
|
||||
"MinInt64": reflect.ValueOf(constant.MakeFromLiteral("-9223372036854775808", token.INT, 0)),
|
||||
"MinInt8": reflect.ValueOf(constant.MakeFromLiteral("-128", token.INT, 0)),
|
||||
"Mod": reflect.ValueOf(math.Mod),
|
||||
"Modf": reflect.ValueOf(math.Modf),
|
||||
"NaN": reflect.ValueOf(math.NaN),
|
||||
"Nextafter": reflect.ValueOf(math.Nextafter),
|
||||
"Nextafter32": reflect.ValueOf(math.Nextafter32),
|
||||
"Phi": reflect.ValueOf(constant.MakeFromLiteral("1.6180339887498948482045868343656381177203091798057628621354486119746080982153796619881086049305501566952211682590824739205931370737029882996587050475921915678674035433959321750307935872115194797515869140625", token.FLOAT, 0)),
|
||||
"Pi": reflect.ValueOf(constant.MakeFromLiteral("3.141592653589793238462643383279502884197169399375105820974944594789982923695635954704435713335896673485663389728754819466702315787113662862838515639906529162340867271374644786874341662041842937469482421875", token.FLOAT, 0)),
|
||||
"Pow": reflect.ValueOf(math.Pow),
|
||||
"Pow10": reflect.ValueOf(math.Pow10),
|
||||
"Remainder": reflect.ValueOf(math.Remainder),
|
||||
"Round": reflect.ValueOf(math.Round),
|
||||
"RoundToEven": reflect.ValueOf(math.RoundToEven),
|
||||
"Signbit": reflect.ValueOf(math.Signbit),
|
||||
"Sin": reflect.ValueOf(math.Sin),
|
||||
"Sincos": reflect.ValueOf(math.Sincos),
|
||||
"Sinh": reflect.ValueOf(math.Sinh),
|
||||
"SmallestNonzeroFloat32": reflect.ValueOf(constant.MakeFromLiteral("1.40129846432481707092372958328991613128026194187651577175706828388979108268586060148663818836212158203125e-45", token.FLOAT, 0)),
|
||||
"SmallestNonzeroFloat64": reflect.ValueOf(constant.MakeFromLiteral("4.940656458412465441765687928682213723650598026143247644255856825006755072702087518652998363616359923797965646954457177309266567103559397963987747960107818781263007131903114045278458171678489821036887186360569987307230500063874091535649843873124733972731696151400317153853980741262385655911710266585566867681870395603106249319452715914924553293054565444011274801297099995419319894090804165633245247571478690147267801593552386115501348035264934720193790268107107491703332226844753335720832431936092382893458368060106011506169809753078342277318329247904982524730776375927247874656084778203734469699533647017972677717585125660551199131504891101451037862738167250955837389733598993664809941164205702637090279242767544565229087538682506419718265533447265625e-324", token.FLOAT, 0)),
|
||||
"Sqrt": reflect.ValueOf(math.Sqrt),
|
||||
"Sqrt2": reflect.ValueOf(constant.MakeFromLiteral("1.414213562373095048801688724209698078569671875376948073176679739576083351575381440094441524123797447886801949755143139115339040409162552642832693297721230919563348109313505318596071447245776653289794921875", token.FLOAT, 0)),
|
||||
"SqrtE": reflect.ValueOf(constant.MakeFromLiteral("1.64872127070012814684865078781416357165377610071014801157507931167328763229187870850146925823776361770041160388013884200789716007979526823569827080974091691342077871211546646890155898290686309337615966796875", token.FLOAT, 0)),
|
||||
"SqrtPhi": reflect.ValueOf(constant.MakeFromLiteral("1.2720196495140689642524224617374914917156080418400962486166403754616080542166459302584536396369727769747312116100875915825863540562126478288118732191412003988041797518382391984914647764526307582855224609375", token.FLOAT, 0)),
|
||||
"SqrtPi": reflect.ValueOf(constant.MakeFromLiteral("1.772453850905516027298167483341145182797549456122387128213807789740599698370237052541269446184448945647349951047154197675245574635259260134350885938555625028620527962319730619356050738133490085601806640625", token.FLOAT, 0)),
|
||||
"Tan": reflect.ValueOf(math.Tan),
|
||||
"Tanh": reflect.ValueOf(math.Tanh),
|
||||
"Trunc": reflect.ValueOf(math.Trunc),
|
||||
"Y0": reflect.ValueOf(math.Y0),
|
||||
"Y1": reflect.ValueOf(math.Y1),
|
||||
"Yn": reflect.ValueOf(math.Yn),
|
||||
}
|
||||
}
|
||||
74
plugin/golang/stdlib/strings.go
Normal file
74
plugin/golang/stdlib/strings.go
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
// Code generated by 'yaegi extract strings'. DO NOT EDIT.
|
||||
|
||||
//go:build go1.23
|
||||
// +build go1.23
|
||||
|
||||
package stdlib
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Symbols["strings/strings"] = map[string]reflect.Value{
|
||||
// function, constant and variable definitions
|
||||
"Clone": reflect.ValueOf(strings.Clone),
|
||||
"Compare": reflect.ValueOf(strings.Compare),
|
||||
"Contains": reflect.ValueOf(strings.Contains),
|
||||
"ContainsAny": reflect.ValueOf(strings.ContainsAny),
|
||||
"ContainsFunc": reflect.ValueOf(strings.ContainsFunc),
|
||||
"ContainsRune": reflect.ValueOf(strings.ContainsRune),
|
||||
"Count": reflect.ValueOf(strings.Count),
|
||||
"Cut": reflect.ValueOf(strings.Cut),
|
||||
"CutPrefix": reflect.ValueOf(strings.CutPrefix),
|
||||
"CutSuffix": reflect.ValueOf(strings.CutSuffix),
|
||||
"EqualFold": reflect.ValueOf(strings.EqualFold),
|
||||
"Fields": reflect.ValueOf(strings.Fields),
|
||||
"FieldsFunc": reflect.ValueOf(strings.FieldsFunc),
|
||||
"HasPrefix": reflect.ValueOf(strings.HasPrefix),
|
||||
"HasSuffix": reflect.ValueOf(strings.HasSuffix),
|
||||
"Index": reflect.ValueOf(strings.Index),
|
||||
"IndexAny": reflect.ValueOf(strings.IndexAny),
|
||||
"IndexByte": reflect.ValueOf(strings.IndexByte),
|
||||
"IndexFunc": reflect.ValueOf(strings.IndexFunc),
|
||||
"IndexRune": reflect.ValueOf(strings.IndexRune),
|
||||
"Join": reflect.ValueOf(strings.Join),
|
||||
"LastIndex": reflect.ValueOf(strings.LastIndex),
|
||||
"LastIndexAny": reflect.ValueOf(strings.LastIndexAny),
|
||||
"LastIndexByte": reflect.ValueOf(strings.LastIndexByte),
|
||||
"LastIndexFunc": reflect.ValueOf(strings.LastIndexFunc),
|
||||
"Map": reflect.ValueOf(strings.Map),
|
||||
"NewReader": reflect.ValueOf(strings.NewReader),
|
||||
"NewReplacer": reflect.ValueOf(strings.NewReplacer),
|
||||
"Repeat": reflect.ValueOf(strings.Repeat),
|
||||
"Replace": reflect.ValueOf(strings.Replace),
|
||||
"ReplaceAll": reflect.ValueOf(strings.ReplaceAll),
|
||||
"Split": reflect.ValueOf(strings.Split),
|
||||
"SplitAfter": reflect.ValueOf(strings.SplitAfter),
|
||||
"SplitAfterN": reflect.ValueOf(strings.SplitAfterN),
|
||||
"SplitN": reflect.ValueOf(strings.SplitN),
|
||||
"Title": reflect.ValueOf(strings.Title),
|
||||
"ToLower": reflect.ValueOf(strings.ToLower),
|
||||
"ToLowerSpecial": reflect.ValueOf(strings.ToLowerSpecial),
|
||||
"ToTitle": reflect.ValueOf(strings.ToTitle),
|
||||
"ToTitleSpecial": reflect.ValueOf(strings.ToTitleSpecial),
|
||||
"ToUpper": reflect.ValueOf(strings.ToUpper),
|
||||
"ToUpperSpecial": reflect.ValueOf(strings.ToUpperSpecial),
|
||||
"ToValidUTF8": reflect.ValueOf(strings.ToValidUTF8),
|
||||
"Trim": reflect.ValueOf(strings.Trim),
|
||||
"TrimFunc": reflect.ValueOf(strings.TrimFunc),
|
||||
"TrimLeft": reflect.ValueOf(strings.TrimLeft),
|
||||
"TrimLeftFunc": reflect.ValueOf(strings.TrimLeftFunc),
|
||||
"TrimPrefix": reflect.ValueOf(strings.TrimPrefix),
|
||||
"TrimRight": reflect.ValueOf(strings.TrimRight),
|
||||
"TrimRightFunc": reflect.ValueOf(strings.TrimRightFunc),
|
||||
"TrimSpace": reflect.ValueOf(strings.TrimSpace),
|
||||
"TrimSuffix": reflect.ValueOf(strings.TrimSuffix),
|
||||
|
||||
// type definitions
|
||||
"Builder": reflect.ValueOf((*strings.Builder)(nil)),
|
||||
"Reader": reflect.ValueOf((*strings.Reader)(nil)),
|
||||
"Replacer": reflect.ValueOf((*strings.Replacer)(nil)),
|
||||
}
|
||||
}
|
||||
94
plugin/golang/stdlib/time.go
Normal file
94
plugin/golang/stdlib/time.go
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
// Code generated by 'yaegi extract time'. DO NOT EDIT.
|
||||
|
||||
//go:build go1.23
|
||||
// +build go1.23
|
||||
|
||||
package stdlib
|
||||
|
||||
import (
|
||||
"go/constant"
|
||||
"go/token"
|
||||
"reflect"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Symbols["time/time"] = map[string]reflect.Value{
|
||||
// function, constant and variable definitions
|
||||
"ANSIC": reflect.ValueOf(constant.MakeFromLiteral("\"Mon Jan _2 15:04:05 2006\"", token.STRING, 0)),
|
||||
"After": reflect.ValueOf(time.After),
|
||||
"AfterFunc": reflect.ValueOf(time.AfterFunc),
|
||||
"April": reflect.ValueOf(time.April),
|
||||
"August": reflect.ValueOf(time.August),
|
||||
"Date": reflect.ValueOf(time.Date),
|
||||
"DateOnly": reflect.ValueOf(constant.MakeFromLiteral("\"2006-01-02\"", token.STRING, 0)),
|
||||
"DateTime": reflect.ValueOf(constant.MakeFromLiteral("\"2006-01-02 15:04:05\"", token.STRING, 0)),
|
||||
"December": reflect.ValueOf(time.December),
|
||||
"February": reflect.ValueOf(time.February),
|
||||
"FixedZone": reflect.ValueOf(time.FixedZone),
|
||||
"Friday": reflect.ValueOf(time.Friday),
|
||||
"Hour": reflect.ValueOf(time.Hour),
|
||||
"January": reflect.ValueOf(time.January),
|
||||
"July": reflect.ValueOf(time.July),
|
||||
"June": reflect.ValueOf(time.June),
|
||||
"Kitchen": reflect.ValueOf(constant.MakeFromLiteral("\"3:04PM\"", token.STRING, 0)),
|
||||
"Layout": reflect.ValueOf(constant.MakeFromLiteral("\"01/02 03:04:05PM '06 -0700\"", token.STRING, 0)),
|
||||
"LoadLocation": reflect.ValueOf(time.LoadLocation),
|
||||
"LoadLocationFromTZData": reflect.ValueOf(time.LoadLocationFromTZData),
|
||||
"Local": reflect.ValueOf(&time.Local).Elem(),
|
||||
"March": reflect.ValueOf(time.March),
|
||||
"May": reflect.ValueOf(time.May),
|
||||
"Microsecond": reflect.ValueOf(time.Microsecond),
|
||||
"Millisecond": reflect.ValueOf(time.Millisecond),
|
||||
"Minute": reflect.ValueOf(time.Minute),
|
||||
"Monday": reflect.ValueOf(time.Monday),
|
||||
"Nanosecond": reflect.ValueOf(time.Nanosecond),
|
||||
"NewTicker": reflect.ValueOf(time.NewTicker),
|
||||
"NewTimer": reflect.ValueOf(time.NewTimer),
|
||||
"November": reflect.ValueOf(time.November),
|
||||
"Now": reflect.ValueOf(time.Now),
|
||||
"October": reflect.ValueOf(time.October),
|
||||
"Parse": reflect.ValueOf(time.Parse),
|
||||
"ParseDuration": reflect.ValueOf(time.ParseDuration),
|
||||
"ParseInLocation": reflect.ValueOf(time.ParseInLocation),
|
||||
"RFC1123": reflect.ValueOf(constant.MakeFromLiteral("\"Mon, 02 Jan 2006 15:04:05 MST\"", token.STRING, 0)),
|
||||
"RFC1123Z": reflect.ValueOf(constant.MakeFromLiteral("\"Mon, 02 Jan 2006 15:04:05 -0700\"", token.STRING, 0)),
|
||||
"RFC3339": reflect.ValueOf(constant.MakeFromLiteral("\"2006-01-02T15:04:05Z07:00\"", token.STRING, 0)),
|
||||
"RFC3339Nano": reflect.ValueOf(constant.MakeFromLiteral("\"2006-01-02T15:04:05.999999999Z07:00\"", token.STRING, 0)),
|
||||
"RFC822": reflect.ValueOf(constant.MakeFromLiteral("\"02 Jan 06 15:04 MST\"", token.STRING, 0)),
|
||||
"RFC822Z": reflect.ValueOf(constant.MakeFromLiteral("\"02 Jan 06 15:04 -0700\"", token.STRING, 0)),
|
||||
"RFC850": reflect.ValueOf(constant.MakeFromLiteral("\"Monday, 02-Jan-06 15:04:05 MST\"", token.STRING, 0)),
|
||||
"RubyDate": reflect.ValueOf(constant.MakeFromLiteral("\"Mon Jan 02 15:04:05 -0700 2006\"", token.STRING, 0)),
|
||||
"Saturday": reflect.ValueOf(time.Saturday),
|
||||
"Second": reflect.ValueOf(time.Second),
|
||||
"September": reflect.ValueOf(time.September),
|
||||
"Since": reflect.ValueOf(time.Since),
|
||||
"Sleep": reflect.ValueOf(time.Sleep),
|
||||
"Stamp": reflect.ValueOf(constant.MakeFromLiteral("\"Jan _2 15:04:05\"", token.STRING, 0)),
|
||||
"StampMicro": reflect.ValueOf(constant.MakeFromLiteral("\"Jan _2 15:04:05.000000\"", token.STRING, 0)),
|
||||
"StampMilli": reflect.ValueOf(constant.MakeFromLiteral("\"Jan _2 15:04:05.000\"", token.STRING, 0)),
|
||||
"StampNano": reflect.ValueOf(constant.MakeFromLiteral("\"Jan _2 15:04:05.000000000\"", token.STRING, 0)),
|
||||
"Sunday": reflect.ValueOf(time.Sunday),
|
||||
"Thursday": reflect.ValueOf(time.Thursday),
|
||||
"Tick": reflect.ValueOf(time.Tick),
|
||||
"TimeOnly": reflect.ValueOf(constant.MakeFromLiteral("\"15:04:05\"", token.STRING, 0)),
|
||||
"Tuesday": reflect.ValueOf(time.Tuesday),
|
||||
"UTC": reflect.ValueOf(&time.UTC).Elem(),
|
||||
"Unix": reflect.ValueOf(time.Unix),
|
||||
"UnixDate": reflect.ValueOf(constant.MakeFromLiteral("\"Mon Jan _2 15:04:05 MST 2006\"", token.STRING, 0)),
|
||||
"UnixMicro": reflect.ValueOf(time.UnixMicro),
|
||||
"UnixMilli": reflect.ValueOf(time.UnixMilli),
|
||||
"Until": reflect.ValueOf(time.Until),
|
||||
"Wednesday": reflect.ValueOf(time.Wednesday),
|
||||
|
||||
// type definitions
|
||||
"Duration": reflect.ValueOf((*time.Duration)(nil)),
|
||||
"Location": reflect.ValueOf((*time.Location)(nil)),
|
||||
"Month": reflect.ValueOf((*time.Month)(nil)),
|
||||
"ParseError": reflect.ValueOf((*time.ParseError)(nil)),
|
||||
"Ticker": reflect.ValueOf((*time.Ticker)(nil)),
|
||||
"Time": reflect.ValueOf((*time.Time)(nil)),
|
||||
"Timer": reflect.ValueOf((*time.Timer)(nil)),
|
||||
"Weekday": reflect.ValueOf((*time.Weekday)(nil)),
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue