MCPcopy Create free account
hub / github.com/foxcpp/maddy / Int

Method Int

framework/config/map.go:401–418  ·  view source on GitHub ↗

Int maps configuration directive with the specified name to variable referenced by 'store' pointer. Configuration directive must be in form 'name 123'. See Custom function for details about inheritGlobal, required and defaultVal.

(name string, inheritGlobal, required bool, defaultVal int, store *int)

Source from the content-addressed store, hash-verified

399// See Custom function for details about inheritGlobal, required and
400// defaultVal.
401func (m *Map) Int(name string, inheritGlobal, required bool, defaultVal int, store *int) {
402 m.Custom(name, inheritGlobal, required, func() (interface{}, error) {
403 return defaultVal, nil
404 }, func(_ *Map, node Node) (interface{}, error) {
405 if len(node.Args) != 1 {
406 return nil, NodeErr(node, "expected 1 argument")
407 }
408 if len(node.Children) != 0 {
409 return nil, NodeErr(node, "can't declare block here")
410 }
411
412 i, err := strconv.Atoi(node.Args[0])
413 if err != nil {
414 return nil, NodeErr(node, "invalid integer: %s", node.Args[0])
415 }
416 return i, nil
417 }, store)
418}
419
420// UInt maps configuration directive with the specified name to variable
421// referenced by 'store' pointer.

Callers 12

TestMapIntFunction · 0.95
TestMapInt_InvalidFunction · 0.95
readListCfgMethod · 0.95
parseResponseRuleFunction · 0.95
initDebugFunction · 0.80
setConfigMethod · 0.80
ConfigureMethod · 0.80
hashCommandFunction · 0.80
usersCreateFunction · 0.80
imapAcctAppendlimitFunction · 0.80
ConfigureMethod · 0.80
ConfigureMethod · 0.80

Calls 2

CustomMethod · 0.95
NodeErrFunction · 0.70

Tested by 2

TestMapIntFunction · 0.76
TestMapInt_InvalidFunction · 0.76