anchor dict | positive dict | negative dict |
|---|---|---|
{
"audio": "",
"image": "",
"text": "func (p *PUPolicy) SetIPAddresses(l ExtendedMap) {\n\tp.Lock()\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tdefer p.Unlock()\n\n\tp.ips = l\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(chan bool, 1),\n\t}\n\tp.routines = append(p.routines, newRoutine)\n\tp.waitGroup.Add(1)\n\tGo(func() {\n\t\tgoroutine(newRoutine.stop)\n\t\tp.waitGroup.Done()\n\t})\n\tp.lock.Unlock()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *PUPolicy) ExposedServices() ApplicationServicesList {\n\tp.Lock()\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tdefer p.Unlock()\n\n\treturn p.exposedServices\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(chan bool, 1),\n\t}\n\tp.routines = append(p.routines, newRoutine)\n\tp.waitGroup.Add(1)\n\tGo(func() {\n\t\tgoroutine(newRoutine.stop)\n\t\tp.waitGroup.Done()\n\t})\n\tp.lock.Unlock()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *PUPolicy) DependentServices() ApplicationServicesList {\n\tp.Lock()\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tdefer p.Unlock()\n\n\treturn p.dependentServices\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(chan bool, 1),\n\t}\n\tp.routines = append(p.routines, newRoutine)\n\tp.waitGroup.Add(1)\n\tGo(func() {\n\t\tgoroutine(newRoutine.stop)\n\t\tp.waitGroup.Done()\n\t})\n\tp.lock.Unlock()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *PUPolicy) ServicesListeningPort() string {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tp.Lock()\n\tdefer p.Unlock()\n\n\treturn strconv.Itoa(p.servicesListeningPort)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn func(p *Prompt) error {\n\t\tp.keyBindMode = m\n\t\treturn nil\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *PUPolicy) UpdateDNSNetworks(networks DNSRuleList) {\n\tp.Lock()",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tdefer p.Unlock()\n\n\tp.DNSACLs = make(DNSRuleList, len(networks))\n\n\tcopy(p.DNSACLs, networks)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(chan bool, 1),\n\t}\n\tp.routines = append(p.routines, newRoutine)\n\tp.waitGroup.Add(1)\n\tGo(func() {\n\t\tgoroutine(newRoutine.stop)\n\t\tp.waitGroup.Done()\n\t})\n\tp.lock.Unlock()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *PUPolicy) UpdateServiceCertificates(cert, key string)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tp.servicesCertificate = cert\n\tp.servicesPrivateKey = key\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string\n\t\tif items != nil {\n\t\t\tkey = items.Key\n\t\t}\n\t\tkeys[i] = key\n\t}\n\treturn keys\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *PUPolicy) ServiceCertificates() (string, string, string) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " p.servicesCertificate, p.servicesPrivateKey, p.servicesCA\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\tp.Lock()\n\tdefer p.Unlock()\n\treturn p.NetworkDriver.InspectState()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *PUPolicy) Scopes() []string {\n\tp.Lock()\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tdefer p.Unlock()\n\n\treturn p.scopes\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(chan bool, 1),\n\t}\n\tp.routines = append(p.routines, newRoutine)\n\tp.waitGroup.Add(1)\n\tGo(func() {\n\t\tgoroutine(newRoutine.stop)\n\t\tp.waitGroup.Done()\n\t})\n\tp.lock.Unlock()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *PUPolicy) ToPublicPolicy() *PUPolicyPublic {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\treturn &PUPolicyPublic{\n\t\tManagementID: p.managementID,\n\t\tTriremeAction: p.triremeAction,\n\t\tApplicationACLs: p.applicationACLs.Copy(),\n\t\tNetworkACLs: ... | {
"audio": "",
"image": "",
"text": "\tServicesListeningPort: p.servicesListeningPort,\n\t\tExposedServices: p.exposedServices,\n\t\tDependentServices: p.dependentServices,\n\t\tScopes: p.scopes,\n\t\tServicesCA: p.servicesCA,\n\t\tServicesCertificate: p.servicesCertificate,\... | {
"audio": "",
"image": "",
"text": "\tdefer p.Unlock()\n\n\treturn p.receiverRules.Copy()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *PUPolicyPublic) ToPrivatePolicy(convert bool) (*PUPolicy, error) {\n\tvar err error\n\n\texposedServices := ApplicationServicesList{}\n\tfor _, e := range p.ExposedServices {\n\t\tif convert {\n\t\t\te.UserAuthorizationHandler, err = usertokens.NewVerifier(e.UserAutho... | {
"audio": "",
"image": "",
"text": "\n\t\treceiverRules: p.ReceiverRules.Copy(),\n\t\tannotations: p.Annotations.Copy(),\n\t\tidentity: p.Identity.Copy(),\n\t\tips: p.IPs.Copy(),\n\t\tservicesListeningPort: p.ServicesListeningPort,\n\t\texposedServices: expo... | {
"audio": "",
"image": "",
"text": " _, f := range fields[3:] {\n\t\tif string(f) == \"file:\" {\n\t\t\te.FileLimited = true\n\t\t}\n\t\tfor _, p := range []string{\"class\", \"enum\"} {\n\t\t\tif strings.HasPrefix(f, p+\":\") {\n\t\t\t\te.Parent = strings.TrimPrefix(f, p+\":\")\n\t\t\t\te.ParentType = p\n\t\t\t... |
{
"audio": "",
"image": "",
"text": "func NewGenericSecretsDriver(ca []byte, token string, network *common.Service) (SecretsDriver, error) {\n\n\tcaPool := x509.NewCertPool()\n\tif !caPool.AppendCertsFromPEM(ca) {\n\t\treturn nil, fmt.Errorf(\"No valid CA provided\")\n\t}\n\n\ttargetAddress := \"\"\n\tif len(netw... | {
"audio": "",
"image": "",
"text": " url.Parse(\"https://\" + targetAddress + \":\" + strconv.Itoa(int(network.Ports.Min)))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Invalid URL for secrets service\")\n\t}\n\n\treturn &GenericSecretsDriver{\n\t\ttransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Con... | {
"audio": "",
"image": "",
"text": "\t\t\t}\n\t\t}\n\t}\n\n\tif id == -1 {\n\t\treturn -1, nil, fmt.Errorf(\"No network found for interface: %s\", devName)\n\t}\n\n\tconfig, err := c.NetworkConfigGet(id)\n\tif err != nil {\n\t\treturn -1, nil, err\n\t}\n\n\tnetwork := api.Network{\n\t\tName: name,\n\t\tManage... |
{
"audio": "",
"image": "",
"text": "func (k *GenericSecretsDriver) Transform(r *http.Request) error {\n\n\tr.Host",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = k.targetURL.Host\n\tr.URL = k.targetURL\n\tr.Header.Add(\"Authorization\", \"Bearer \"+k.token)\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tprefix = strings.Replace(prefix, \"{\"+name+\"}\", value, -1)\n\t}\n\n\tr.HTTPRequest.URL.Host = prefix + r.HTTPRequest.URL.Host\n\tif len(r.HTTPRequest.Host) > 0 {\n\t\tr.HTTPRequest.Host = prefix + r.HTTPRequest.Host\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func ValueEqual(v1 interface{}, v2 interface{}) bool {\n\tv1RV := reflect.ValueOf(v1)\n\tswitch v1RV.Kind() {\n\tcase reflect.Func:\n\t\t// This is best effort to check if functions match, but it could be wrong\n\t\tv2RV := reflect.ValueOf(v2)\n\t\tif !v1RV.IsValid() || !v2RV.... | {
"audio": "",
"image": "",
"text": "\t\t\t// From reflect: If v's Kind is Func, the returned pointer is an underlying code pointer, but not necessarily enough to identify a single function uniquely.\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\tswitch value1 := v1.(type) {\n\tcase error:\n\t\tswitch value2... | {
"audio": "",
"image": "",
"text": "\tv2 := reflect.ValueOf(a2)\n\n\t// REMOVED FOR JSONSCHEMA\n\t//\n\t// if v1.Type() != v2.Type() {\n\t// \treturn false\n\t// }\n\n\treturn deepValueEqual(v1, v2, make(map[visit]bool), 0)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Run(stmt ast.Stmt, env *Env) (interface{}, error) {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " RunContext(context.Background(), stmt, env)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " (interface{}, error)) *Init {\n\treturn ini.Branch(func() (interface{}, error) {\n\t\treturn ini.withTimeout(timeout, f)\n\t})\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func RunContext(ctx context.Context, stmt ast.Stmt, env *Env) (interface{}, error) {\n\trunInfo := runInfoStruct{ctx: ctx, env: env, stmt: stmt, rv: nilValue}\n\trunInfo.runSingleStmt()",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tif runInfo.err == ErrReturn {\n\t\trunInfo.err = nil\n\t}\n\treturn runInfo.rv.Interface(), runInfo.err\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := &ExecStmt{\n\t\tInfoSchema: is,\n\t\tPlan: execPlan,\n\t\tStmtNode: execStmt,\n\t\tCtx: ctx,\n\t}\n\tif prepared, ok := ctx.GetSessionVars().PreparedStmts[ID]; ok {\n\t\tstmt.Text = prepared.Stmt.Text()\n\t\tctx.GetSessionVars().StmtCtx.OriginalSQL = stmt.Te... |
{
"audio": "",
"image": "",
"text": "func newError(pos ast.Pos, err error) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\tif pos == nil {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\treturn &Error{Message: err.Error(), Pos: ast.Position{Line: 1, Column: 1}}\n\t}\n\treturn &Error{Message: err.Error(), Pos: pos.Position()}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " // from end\n\t\t\tnewpos = f.len + offset\n\t\t}\n\t}\n\n\tif newpos < 0 {\n\t\treturn 0, os.ErrInvalid\n\t} else {\n\t\tf.pos = newpos\n\t\treturn f.pos, nil\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func newStringError(pos ast.Pos, err string) error {\n\tif err == \"\" {\n\t\treturn nil\n\t}\n\tif pos == nil {\n\t\treturn &Error{Message: err, Pos:",
"video": ""
} | {
"audio": "",
"image": "",
"text": " ast.Position{Line: 1, Column: 1}}\n\t}\n\treturn &Error{Message: err, Pos: pos.Position()}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " pos)\n\tdefault:\n\t\tmax := len(in) - pos\n\t\tif max > 20 {\n\t\t\tmax = 20\n\t\t}\n\n\t\treturn 0, opErr{\n\t\t\tpos: pos,\n\t\t\tmsg: \"invalid object\",\n\t\t\tcontent: string(in[pos : pos+max]),\n\t\t}\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func equal(lhsV, rhsV reflect.Value) bool {\n\tlhsIsNil, rhsIsNil := isNil(lhsV), isNil(rhsV)\n\tif lhsIsNil && rhsIsNil {\n\t\treturn true\n\t}\n\tif (!lhsIsNil && rhsIsNil) || (lhsIsNil && !rhsIsNil) {\n\t\treturn false\n\t}\n\tif lhsV.Kind() == reflect.Interface || lhsV.Kin... | {
"audio": "",
"image": "",
"text": " != nil {\n\t\t\t// if LHS is a float, e.g. \"1.2\", we need to set lhsV to a float64\n\t\t\tlhsF, err := tryToFloat64(lhsV)\n\t\t\tif err != nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tlhsV = reflect.ValueOf(lhsF)\n\t\t} else {\n\t\t\tlhsV = reflect.ValueOf(lhsI)\n\t\t}\n\t}\... | {
"audio": "",
"image": "",
"text": " a pointer to the value.\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\tcase reflect.Ptr:\n\t\t// Represent slice types as the value itself.\n\t\tswitch rv.Type().Elem().Kind() {\n\t\tcase reflect.Slice:\n\t\t\tif rv.IsNil() {\n\t\t\t\tv... |
{
"audio": "",
"image": "",
"text": "func appendSlice(expr ast.Expr, lhsV reflect.Value, rhsV reflect.Value) (reflect.Value, error) {\n\tlhsT := lhsV.Type().Elem()\n\trhsT := rhsV.Type().Elem()\n\n\tif lhsT == rhsT {\n\t\treturn reflect.AppendSlice(lhsV, rhsV), nil\n\t}\n\n\tif rhsT.ConvertibleTo(lhsT) {\n\t\tfor... | {
"audio": "",
"image": "",
"text": "\t\t} else {\n\t\t\t\treturn nilValue, newStringError(expr, \"invalid type conversion\")\n\t\t\t}\n\t\t}\n\t\treturn lhsV, nil\n\t}\n\n\tif (leftHasSubArray || lhsT == interfaceType) && (rightHasSubArray || rhsT == interfaceType) {\n\t\tfor i := 0; i < rhsV.Len(); i++ {\n\t\t\... | {
"audio": "",
"image": "",
"text": " a pointer to the value.\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\tcase reflect.Ptr:\n\t\t// Represent slice types as the value itself.\n\t\tswitch rv.Type().Elem().Kind() {\n\t\tcase reflect.Slice:\n\t\t\tif rv.IsNil() {\n\t\t\t\tv... |
{
"audio": "",
"image": "",
"text": "func precedenceOfKinds(kind1 reflect.Kind, kind2 reflect.Kind) reflect.Kind {\n\tif kind1 == kind2 {\n\t\treturn kind1\n\t}\n\tswitch kind1 {\n\tcase reflect.String:\n\t\treturn kind1\n\tcase reflect.Float64, reflect.Float32:\n\t\tswitch kind2 {\n\t\tcase reflect.String:\n\t\t... | {
"audio": "",
"image": "",
"text": "\n\t\treturn kind1\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tswitch kind2 {\n\t\tcase reflect.String, reflect.Float64, reflect.Float32:\n\t\t\treturn kind2\n\t\t}\n\t}\n\treturn kind1\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " += s\n\t\t\t}\n\t\t\treturn sum\n\t\t}\n\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,\n\t\treflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n\t\treflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128:\n\t\treturn int(t.Size... |
{
"audio": "",
"image": "",
"text": "func toString(v reflect.Value) string {\n\tif v.Kind() == reflect.Interface && !v.IsNil() {\n\t\tv = v.Elem()\n\t}\n\tif v.Kind() == reflect.Ptr {\n\t\tv = v.Elem()\n\t}\n\tif v.Kind()",
"video": ""
} | {
"audio": "",
"image": "",
"text": " == reflect.String {\n\t\treturn v.String()\n\t}\n\treturn fmt.Sprint(v.Interface())\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " reflect.Ptr {\n\t\tv = v.Elem()\n\t}\n\treturn v\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func toBool(v reflect.Value) bool {\n\tb,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _ := tryToBool(v)\n\treturn b\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tMap(int64To16).\n\t\tWithShrinker(Int16Shrinker).\n\t\tSuchThat(func(v int16) bool {\n\t\t\treturn v >= min && v <= max\n\t\t})\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func toFloat64(v reflect.Value) float64 {\n\tf,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _ := tryToFloat64(v)\n\treturn f\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " a pointer to the value.\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\tcase reflect.Ptr:\n\t\t// Represent slice types as the value itself.\n\t\tswitch rv.Type().Elem().Kind() {\n\t\tcase reflect.Slice:\n\t\t\tif rv.IsNil() {\n\t\t\t\tv... |
{
"audio": "",
"image": "",
"text": "func toInt64(v reflect.Value) int64 {\n\ti,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _ := tryToInt64(v)\n\treturn i\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t}\n\t\t}\n\n\t\tif v.CanSet() {\n\t\t\tswitch idField := found[len(found)-1].(type) {\n\t\t\tcase reflect.Value:\n\t\t\t\tif idField.Kind() == reflect.Int64 {\n\t\t\t\t\tb.RecordID = idField.Addr().Interface().(*int64)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tb.Values(value...)\n\t... |
{
"audio": "",
"image": "",
"text": "func toInt(v reflect.Value) int {\n\ti,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _ := tryToInt(v)\n\treturn i\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " a pointer to the value.\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\tcase reflect.Ptr:\n\t\t// Represent slice types as the value itself.\n\t\tswitch rv.Type().Elem().Kind() {\n\t\tcase reflect.Slice:\n\t\t\tif rv.IsNil() {\n\t\t\t\tv... |
{
"audio": "",
"image": "",
"text": "func isHex(ch rune) bool {\n\treturn ('0' <= ch && ch <= '9') || ('a' <= ch && ch",
"video": ""
} | {
"audio": "",
"image": "",
"text": " <= 'f') || ('A' <= ch && ch <= 'F')\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " mod Modifier) bool {\n\treturn kb.key == key && kb.ch == ch && kb.mod == mod\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *Scanner) peek() rune {\n\tif s.reachEOF() {\n\t\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " EOF\n\t}\n\treturn s.src[s.offset]\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn func(s *services) {\n\t\ts.diffService = NewDiffServiceFromClient(diffService)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *Scanner) next() {\n\tif !s.reachEOF() {\n\t\tif s.peek()",
"video": ""
} | {
"audio": "",
"image": "",
"text": " == '\\n' {\n\t\t\ts.lineHead = s.offset + 1\n\t\t\ts.line++\n\t\t}\n\t\ts.offset++\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " !s.Has(c) {\n\t\ts.Add(c)\n\t\treturn true\n\t}\n\n\treturn false\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *Scanner) pos() ast.Position {\n\treturn ast.Position{Line: s.line + 1,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Column: s.offset - s.lineHead + 1}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " named '%s'\", variable.GroupConcatMaxLen))\n\t\t}\n\t\treturn &concatFunction{aggFunction: aggFunc, maxLen: maxLen}\n\tcase ast.AggFuncMax:\n\t\treturn &maxMinFunction{aggFunction: aggFunc, isMax: true}\n\tcase ast.AggFuncMin:\n\t\treturn &maxMinFunction{aggFunction: aggFunc,... |
{
"audio": "",
"image": "",
"text": "func (s *Scanner) scanIdentifier() (string, error) {\n\tvar ret []rune\n\tfor {\n\t\tif !isLetter(s.peek()) && !isDigit(s.peek()) {\n\t\t\tbreak\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t}\n\t\tret = append(ret, s.peek())\n\t\ts.next()\n\t}\n\treturn string(ret), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tvar ret *Group\n\n\tg.eachGroup(func(gg *Group) {\n\t\tif gg != g && strings.ToLower(gg.ShortDescription) == lshortDescription {\n\t\t\tret = gg\n\t\t}\n\t})\n\n\treturn ret\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *Scanner) scanNumber() (string, error) {\n\tresult := []rune{s.peek()}\n\ts.next()\n\n\tif result[0] == '0' && (s.peek() == 'x' || s.peek() == 'X') {\n\t\t// hex\n\t\tresult = append(result, 'x')\n\t\ts.next()\n\t\tfor isHex(s.peek()) {\n\t\t\tresult = append(result, s... | {
"audio": "",
"image": "",
"text": "\n\t\t\t\ts.next()\n\n\t\t\t\t// check if + or -\n\t\t\t\tif s.peek() == '+' || s.peek() == '-' {\n\t\t\t\t\t// add e with + or -\n\t\t\t\t\tresult = append(result, 'e')\n\t\t\t\t\tresult = append(result, s.peek())\n\t\t\t\t\ts.next()\n\t\t\t\t} else {\n\t\t\t\t\t// add e, but... | {
"audio": "",
"image": "",
"text": " range s {\n\t\tif c == ' ' {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *Scanner) scanRawString(l rune) (string, error) {\n\tvar ret []rune\n\tfor {\n\t\ts.next()\n\t\tif s.peek() == EOF {\n\t\t\treturn \"\", errors.New(\"unexpected EOF\")\n\t\t}\n\t\tif s.peek() == l",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\t\ts.next()\n\t\t\tbreak\n\t\t}\n\t\tret = append(ret, s.peek())\n\t}\n\treturn string(ret), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\tif s == \"wss\" {\n\t\t\t\treturn s\n\t\t\t}\n\t\t}\n\t\treturn \"ws\"\n\t}\n\tfor _, s := range a.EffectiveSchemes() {\n\t\tif s == \"https\" {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn \"http\"\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *Scanner) scanString(l rune) (string, error) {\n\tvar ret []rune\neos:\n\tfor {\n\t\ts.next()\n\t\tswitch s.peek() {\n\t\tcase EOL:\n\t\t\treturn \"\", errors.New(\"unexpected EOL\")\n\t\tcase EOF:\n\t\t\treturn \"\", errors.New(\"unexpected EOF\")\n\t\tcase l:\n\t\t\t... | {
"audio": "",
"image": "",
"text": " s.peek() {\n\t\t\tcase 'b':\n\t\t\t\tret = append(ret, '\\b')\n\t\t\t\tcontinue\n\t\t\tcase 'f':\n\t\t\t\tret = append(ret, '\\f')\n\t\t\t\tcontinue\n\t\t\tcase 'r':\n\t\t\t\tret = append(ret, '\\r')\n\t\t\t\tcontinue\n\t\t\tcase 'n':\n\t\t\t\tret = append(ret, '\\n')\n\t\t\t... | {
"audio": "",
"image": "",
"text": " upgrade is\n\t\t// fixed we can't fail the validation if it does.\n\t\tif hasHook {\n\t\t\tlogger.Errorf(\"unexpected hook info with Kind Continue\")\n\t\t}\n\t\tswitch {\n\t\tcase hasCharm:\n\t\t\treturn errors.New(\"unexpected charm URL\")\n\t\tcase hasActionId:\n\t\t\tretu... |
{
"audio": "",
"image": "",
"text": "func (l *Lexer) Lex(lval *yySymType) int {\n\ttok, lit, pos, err := l.s.Scan()\n\tif err != nil {\n\t\tl.e = &Error{Message: err.Error(), Pos: pos, Fatal: true}\n\t}\n\tlval.tok",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = ast.Token{Tok: tok, Lit: lit}\n\tlval.tok.SetPosition(pos)\n\tl.lit = lit\n\tl.pos = pos\n\treturn tok\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Error was generated at position %d near '%s'\", item.Value, l.pos, l.near())\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"Unexpected %s at position %d near '%s'\", item, l.pos, l.near())\n\t\t}\n\t}\n\treturn exp, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *Lexer) Error(msg string) {\n\tl.e = &Error{Message: msg,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Pos: l.pos, Fatal: false}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tmsg = fmt.Sprintln(r)\n\t}\n\tl.Log.Message(msg + \"\\n{\" + string(stack) + \"}\")\n\tl.Log.Priority = PanicPrio\n\tl.commit()\n\tif !cont {\n\t\tl.Writter.Close()\n\t\tl.Exiter(1)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Parse(s *Scanner) (ast.Stmt, error) {\n\tl := Lexer{s: s}\n\tif yyParse(&l) != 0 {\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn nil, l.e\n\t}\n\treturn l.stmt, l.e\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tif l.e.IsError() {\n\t\treturn &l.e\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func ParseSrc(src string) (ast.Stmt, error) {\n\tscanner := &Scanner{\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tsrc: []rune(src),\n\t}\n\treturn Parse(scanner)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tif node, ok := file.Scope.Objects[n.String()]; ok {\n\t\t\treturn node.Kind != ast.Var && node.Kind != ast.Fun\n\t\t}\n\t}\n\treturn false\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func DefineImport(e *vm.Env) {\n\te.Define(\"import\", func(source string) *vm.Env {\n\t\tmethods, ok := Packages[source]\n\t\tif !ok {\n\t\t\tpanic(fmt.Sprintf(\"package '%s' not found\", source))\n\t\t}\n\t\tvar err error\n\t\tpack := e.NewPackage(source)\n\t\tfor methodName... | {
"audio": "",
"image": "",
"text": "\ttypes, ok := PackageTypes[source]\n\t\tif ok {\n\t\t\tfor typeName, typeValue := range types {\n\t\t\t\terr = pack.DefineType(typeName, typeValue)\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(fmt.Sprintf(\"import DefineType error: %v\", err))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tret... | {
"audio": "",
"image": "",
"text": " := range e.env {\n\t\tfmt.Printf(\"%v = %#v\\n\", k, v)\n\t}\n\te.RUnlock()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func reflectValueSlicetoInterfaceSlice(valueSlice []reflect.Value) reflect.Value {\n\tinterfaceSlice := make([]interface{}, 0, len(valueSlice))\n\tfor _, value := range valueSlice {\n\t\tif value.Kind() == reflect.Interface && !value.IsNil() {\n\t\t\tvalue = value.Elem()\n\t\t... | {
"audio": "",
"image": "",
"text": " {\n\t\t\tinterfaceSlice = append(interfaceSlice, value.Interface())\n\t\t} else {\n\t\t\tinterfaceSlice = append(interfaceSlice, nil)\n\t\t}\n\t}\n\treturn reflect.ValueOf(interfaceSlice)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tif value.Agent == agent && !value.ControllerAgent {\n\t\t\tif value.Status > result {\n\t\t\t\tresult = value.Status\n\t\t\t}\n\t\t}\n\t}\n\treturn result, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func convertReflectValueToType(rv reflect.Value, rt reflect.Type) (reflect.Value, error) {\n\tif rt == interfaceType || rv.Type() == rt {\n\t\t// if reflect.Type is interface or the types match, return the provided reflect.Value\n\t\treturn rv, nil\n\t}\n\tif rv.Type().Convert... | {
"audio": "",
"image": "",
"text": "\treturn rv, err\n\t\t\t}\n\t\t\t// need to make a new value to be able to set it\n\t\t\tptrV, err := makeValue(rt)\n\t\t\tif err != nil {\n\t\t\t\treturn rv, err\n\t\t\t}\n\t\t\t// set value and return new pointer\n\t\t\tptrV.Elem().Set(value)\n\t\t\treturn ptrV, nil\n\t\t}\n... | {
"audio": "",
"image": "",
"text": " a pointer to the value.\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\tcase reflect.Ptr:\n\t\t// Represent slice types as the value itself.\n\t\tswitch rv.Type().Elem().Kind() {\n\t\tcase reflect.Slice:\n\t\t\tif rv.IsNil() {\n\t\t\t\tv... |
{
"audio": "",
"image": "",
"text": "func convertSliceOrArray(rv reflect.Value, rt reflect.Type) (reflect.Value, error) {\n\trtElemType := rt.Elem()\n\n\t// try to covert elements to new slice/array\n\tvar value reflect.Value\n\tif rt.Kind() == reflect.Slice {\n\t\t// make slice\n\t\tvalue = reflect.MakeSlice(rt,... | {
"audio": "",
"image": "",
"text": " {\n\t\tv, err = convertReflectValueToType(rv.Index(i), rtElemType)\n\t\tif err != nil {\n\t\t\treturn rv, err\n\t\t}\n\t\tvalue.Index(i).Set(v)\n\t}\n\n\t// return new converted slice or array\n\treturn value, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " a pointer to the value.\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\tcase reflect.Ptr:\n\t\t// Represent slice types as the value itself.\n\t\tswitch rv.Type().Elem().Kind() {\n\t\tcase reflect.Slice:\n\t\t\tif rv.IsNil() {\n\t\t\t\tv... |
{
"audio": "",
"image": "",
"text": "func convertMap(rv reflect.Value, rt reflect.Type) (reflect.Value, error) {\n\trtKey := rt.Key()\n\trtElem := rt.Elem()\n\n\t// create new map\n\t// note creating slice as work around to create map\n\t// just doing MakeMap can give incorrect type for defined types\n\tnewMap :=... | {
"audio": "",
"image": "",
"text": " https://github.com/golang/go/issues/11104\n\t// In the mean time using MapKeys, which will costly for large maps.\n\tmapKeys := rv.MapKeys()\n\tfor i := 0; i < len(mapKeys); i++ {\n\t\tnewKey, err := convertReflectValueToType(mapKeys[i], rtKey)\n\t\tif err != nil {\n\t\t\tret... | {
"audio": "",
"image": "",
"text": " a pointer to the value.\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\tcase reflect.Ptr:\n\t\t// Represent slice types as the value itself.\n\t\tswitch rv.Type().Elem().Kind() {\n\t\tcase reflect.Slice:\n\t\t\tif rv.IsNil() {\n\t\t\t\tv... |
{
"audio": "",
"image": "",
"text": "func convertVMFunctionToType(rv reflect.Value, rt reflect.Type) (reflect.Value, error) {\n\t// only translates runVMFunction type\n\tif !checkIfRunVMFunction(rv.Type()) {\n\t\treturn rv, fmt.Errorf(\"invalid type conversion\")\n\t}\n\n\t// create runVMConvertFunction to match ... | {
"audio": "",
"image": "",
"text": " wants more than one return value\n\t\t// make sure we have a slice/array with enought values\n\n\t\tif rv.Kind() != reflect.Slice && rv.Kind() != reflect.Array {\n\t\t\tpanic(fmt.Sprintf(\"function wants %v return values but received %v\", rt.NumOut(), rv.Kind().String()))\n\... | {
"audio": "",
"image": "",
"text": " a pointer to the value.\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\tcase reflect.Ptr:\n\t\t// Represent slice types as the value itself.\n\t\tswitch rv.Type().Elem().Kind() {\n\t\tcase reflect.Slice:\n\t\t\tif rv.IsNil() {\n\t\t\t\tv... |
{
"audio": "",
"image": "",
"text": "func toSlice(from []interface{}, ptr interface{}) {\n\t// Value of the pointer to the target\n\tobj := reflect.Indirect(reflect.ValueOf(ptr))\n\t// We can't just convert from interface{} to whatever the target is (diff memory layout),\n\t// so we need to create a New slice of ... | {
"audio": "",
"image": "",
"text": " len(from); i++ {\n\t\tv := reflect.ValueOf(from[i])\n\t\tif v.IsValid() && v.Type().ConvertibleTo(tt) {\n\t\t\tval.Set(v.Convert(tt))\n\t\t} else {\n\t\t\tval.Set(reflect.Zero(tt))\n\t\t}\n\t\tslice.Index(i).Set(val)\n\t}\n\t// Ok now assign our slice to the target pointer\n\... | {
"audio": "",
"image": "",
"text": " a pointer to the value.\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\tcase reflect.Ptr:\n\t\t// Represent slice types as the value itself.\n\t\tswitch rv.Type().Elem().Kind() {\n\t\tcase reflect.Slice:\n\t\t\tif rv.IsNil() {\n\t\t\t\tv... |
{
"audio": "",
"image": "",
"text": "func (runInfo *runInfoStruct) funcExpr() {\n\tfuncExpr := runInfo.expr.(*ast.FuncExpr)\n\n\t// create the inTypes needed by reflect.FuncOf\n\tinTypes := make([]reflect.Type, len(funcExpr.Params)+1)\n\t// for runVMFunction first arg is always context\n\tinTypes[0] = contextType... | {
"audio": "",
"image": "",
"text": " i < len(funcExpr.Params)-1; i++ {\n\t\t\trunInfo.rv = in[i+1].Interface().(reflect.Value)\n\t\t\trunInfo.env.defineValue(funcExpr.Params[i], runInfo.rv)\n\t\t}\n\t\t// add last Params to newEnv\n\t\tif len(funcExpr.Params) > 0 {\n\t\t\tif funcExpr.VarArg {\n\t\t\t\t// functio... | {
"audio": "",
"image": "",
"text": "\ttwraper := reflect.FuncOf(in, out, false)\n\twraper := reflect.MakeFunc(twraper, func(args []reflect.Value) []reflect.Value {\n\t\tresult := r.Call(args)\n\t\tif len(result) == 2 && !result[1].IsNil() {\n\t\t\tpanic(result[1])\n\t\t}\n\t\treturn result[:1]\n\t})\n\treturn ev... |
{
"audio": "",
"image": "",
"text": "func (runInfo *runInfoStruct) anonCallExpr() {\n\tanonCallExpr := runInfo.expr.(*ast.AnonCallExpr)\n\n\trunInfo.expr = anonCallExpr.Expr\n\trunInfo.invokeExpr()\n\tif runInfo.err != nil {\n\t\treturn\n\t}\n\n\tif runInfo.rv.Kind() == reflect.Interface && !runInfo.rv.IsNil() {\... | {
"audio": "",
"image": "",
"text": " newStringError(anonCallExpr, \"cannot call type \"+runInfo.rv.Kind().String())\n\t\trunInfo.rv = nilValue\n\t\treturn\n\t}\n\n\trunInfo.expr = &ast.CallExpr{Func: runInfo.rv, SubExprs: anonCallExpr.SubExprs, VarArg: anonCallExpr.VarArg, Go: anonCallExpr.Go}\n\trunInfo.invokeE... | {
"audio": "",
"image": "",
"text": "\n\tif runInfo.err == ErrReturn {\n\t\trunInfo.err = nil\n\t}\n\treturn runInfo.rv.Interface(), runInfo.err\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func checkIfRunVMFunction(rt reflect.Type) bool {\n\tif rt.NumIn() < 1 || rt.NumOut() != 2 || rt.In(0) != contextType || rt.Out(0) != reflectValueType || rt.Out(1) != reflectValueType {\n\t\treturn false\n\t}\n\tif rt.NumIn() > 1 {\n\t\tif rt.IsVariadic() {\n\t\t\tif rt.In(rt.... | {
"audio": "",
"image": "",
"text": " != reflectValueType {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tfor i := 1; i < rt.NumIn()-1; i++ {\n\t\t\tif rt.In(i) != reflectValueType {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " http.Handler) {\n\trt.Handle(http.MethodPut, path, handler)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewEnv() *Env {\n\treturn &Env{\n\t\tenv: make(map[string]reflect.Value),\n\t\ttyp: ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(map[string]reflect.Type),\n\t\tparent: nil,\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " function\n\tfor _, e := range s.Enumerate() {\n\t\tvalue = fn(value, e)\n\t}\n\n\treturn value\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) NewEnv() *Env {\n\treturn &Env{\n\t\tenv: make(map[string]reflect.Value),\n\t\ttyp: ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(map[string]reflect.Type),\n\t\tparent: e,\n\t\tname: e.name,\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " function\n\tfor _, e := range s.Enumerate() {\n\t\tvalue = fn(value, e)\n\t}\n\n\treturn value\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewPackage(n string) *Env {\n\treturn &Env{\n\t\tenv: make(map[string]reflect.Value),\n\t\ttyp: ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(map[string]reflect.Type),\n\t\tparent: nil,\n\t\tname: n,\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " -1 {\n\t\treturn formulaTable[fmtForms(FormsTable[idx].Value)]\n\t}\n\treturn func(n int) int {\n\t\treturn n\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) AddPackage(name string, methods map[string]interface{}, types map[string]interface{}) (*Env, error) {\n\tif strings.Contains(name, \".\") {\n\t\treturn nil, fmt.Errorf(\"unknown symbol '%s'\", name)\n\t}\n\tvar err error\n\tpack := e.NewPackage(name)\n\n\tfor met... | {
"audio": "",
"image": "",
"text": " {\n\t\terr = pack.DefineType(typeName, typeValue)\n\t\tif err != nil {\n\t\t\treturn pack, err\n\t\t}\n\t}\n\n\t// can ignore error from Define because of check at the start of the function\n\te.Define(name, pack)\n\treturn pack, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := strings.Index(name, \".\")\n\tif ix != -1 {\n\t\tname = name[:ix]\n\t}\n\treturn name\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) NewModule(n string) *Env {\n\tm := &Env{\n\t\tenv: make(map[string]reflect.Value),\n\t\ttyp: ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(map[string]reflect.Type),\n\t\tparent: e,\n\t\tname: n,\n\t}\n\te.Define(n, m)\n\treturn m\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\"nobody\",\n\t\tfalse,\n\t\tfunc(e Export) UserMapping { return e.MapRoot },\n\t\tfunc(e Export, m UserMapping) { e.MapRoot = m })\n\n\treturn api.ExportUpdate(ctx, c.API, nex)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) SetName(n string) {\n\te.Lock()\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\te.name = n\n\te.Unlock()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tcount, n := binary.Uvarint(b)\n\tif n <= 0 {\n\t\te.err = fmt.Errorf(\"booleanDecoder: invalid count\")\n\t\treturn\n\t}\n\n\te.b = b[n:]\n\te.i = -1\n\te.n = int(count)\n\n\tif min := len(e.b) * 8; min < e.n {\n\t\t// Shouldn't happen - TSM file was truncated/corrupted\n\... |
{
"audio": "",
"image": "",
"text": "func (e *Env) GetName() string {\n\te.RLock()\n\tdefer",
"video": ""
} | {
"audio": "",
"image": "",
"text": " e.RUnlock()\n\n\treturn e.name\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\"nobody\",\n\t\tfalse,\n\t\tfunc(e Export) UserMapping { return e.MapRoot },\n\t\tfunc(e Export, m UserMapping) { e.MapRoot = m })\n\n\treturn api.ExportUpdate(ctx, c.API, nex)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) Addr(k string) (reflect.Value, error) {\n\te.RLock()\n\tdefer e.RUnlock()\n\n\tif v, ok := e.env[k]; ok {\n\t\tif v.CanAddr() {\n\t\t\treturn v.Addr(), nil\n\t\t}\n\t\treturn nilValue, fmt.Errorf(\"unaddressable\")\n\t}\n\tif e.external != nil {\n\t\tv, err := e.... | {
"audio": "",
"image": "",
"text": "\t\t}\n\t\t\treturn nilValue, fmt.Errorf(\"unaddressable\")\n\t\t}\n\t}\n\tif e.parent == nil {\n\t\treturn nilValue, fmt.Errorf(\"undefined symbol '%s'\", k)\n\t}\n\treturn e.parent.Addr(k)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tv, _, _, e := Get(data, keys...)\n\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\n\treturn bytesToString(&v), nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) Type(k string) (reflect.Type, error) {\n\te.RLock()\n\tdefer e.RUnlock()\n\n\tif v, ok := e.typ[k]; ok {\n\t\treturn v, nil\n\t}\n\tif e.external != nil {\n\t\tv,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " err := e.external.Type(k)\n\t\tif err == nil {\n\t\t\treturn v, nil\n\t\t}\n\t}\n\tif e.parent == nil {\n\t\tif v, ok := basicTypes[k]; ok {\n\t\t\treturn v, nil\n\t\t}\n\t\treturn nilType, fmt.Errorf(\"undefined type '%s'\", k)\n\t}\n\treturn e.parent.Type(k)\n}",
"video":... | {
"audio": "",
"image": "",
"text": "\tdefer c.lock.RUnlock()\n\n\tif e := c.cache[key]; e != nil {\n\t\tent := e.Value.(*cacheEntry)\n\t\tif !c.isEntryExpired(now, ent) {\n\t\t\treturn ent.v, true\n\t\t}\n\t}\n\treturn nil, false\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) Get(k string) (interface{}, error) {\n\trv,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " err := e.get(k)\n\treturn rv.Interface(), err\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " (interface{}, error)) *Init {\n\treturn ini.Branch(func() (interface{}, error) {\n\t\treturn ini.withTimeout(timeout, f)\n\t})\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) Set(k string, v interface{}) error {\n\tif v == nil {\n\t\treturn e.setValue(k, nilValue)\n\t}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn e.setValue(k, reflect.ValueOf(v))\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, e error) {\n\tr, e := dh.createDockerfileArchive(dockerfile)\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\treturn dh.Build(r, opts)\n\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) DefineGlobal(k string, v interface{}) error {\n\tfor e.parent != nil {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\te = e.parent\n\t}\n\treturn e.Define(k, v)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, e error) {\n\tr, e := dh.createDockerfileArchive(dockerfile)\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\treturn dh.Build(r, opts)\n\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) defineGlobalValue(k string, v reflect.Value) error {\n\tfor e.parent != nil {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\te = e.parent\n\t}\n\treturn e.defineValue(k, v)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, e error) {\n\tr, e := dh.createDockerfileArchive(dockerfile)\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\treturn dh.Build(r, opts)\n\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) Define(k string, v interface{}) error {\n\tif v == nil {\n\t\treturn e.defineValue(k, nilValue)\n\t}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn e.defineValue(k, reflect.ValueOf(v))\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\te = e.parent\n\t}\n\treturn e.defineValue(k, v)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) defineValue(k string, v reflect.Value) error {\n\tif strings.Contains(k,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " \".\") {\n\t\treturn fmt.Errorf(\"unknown symbol '%s'\", k)\n\t}\n\n\te.Lock()\n\te.env[k] = v\n\te.Unlock()\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\te = e.parent\n\t}\n\treturn e.defineValue(k, v)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) Delete(k string) error {\n\tif strings.Contains(k, \".\") {\n\t\treturn fmt.Errorf(\"Unknown symbol '%s'\", k)\n\t}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\n\te.Lock()\n\tdelete(e.env, k)\n\te.Unlock()\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\n\tif k.Comment != \"\" {\n\t\ts += \" \" + k.Comment\n\t}\n\n\treturn s\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) DeleteGlobal(k string) error {\n\tif e.parent == nil {\n\t\treturn e.Delete(k)\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t}\n\n\te.RLock()\n\t_, ok := e.env[k]\n\te.RUnlock()\n\n\tif ok {\n\t\treturn e.Delete(k)\n\t}\n\n\treturn e.parent.DeleteGlobal(k)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\"nobody\",\n\t\tfalse,\n\t\tfunc(e Export) UserMapping { return e.MapRoot },\n\t\tfunc(e Export, m UserMapping) { e.MapRoot = m })\n\n\treturn api.ExportUpdate(ctx, c.API, nex)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) DefineGlobalType(k string, t interface{}) error {\n\tfor e.parent != nil {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\te = e.parent\n\t}\n\treturn e.DefineType(k, t)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, e error) {\n\tr, e := dh.createDockerfileArchive(dockerfile)\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\treturn dh.Build(r, opts)\n\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) DefineGlobalReflectType(k string, t reflect.Type) error {\n\tfor e.parent != nil {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\te = e.parent\n\t}\n\treturn e.DefineReflectType(k, t)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, e error) {\n\tr, e := dh.createDockerfileArchive(dockerfile)\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\treturn dh.Build(r, opts)\n\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) DefineType(k string, t interface{}) error {\n\tvar typ reflect.Type\n\tif t == nil {\n\t\ttyp = nilType\n\t} else {\n\t\tvar ok bool\n\t\ttyp, ok = t.(reflect.Type)\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tif !ok {\n\t\t\ttyp = reflect.TypeOf(t)\n\t\t}\n\t}\n\n\treturn e.DefineReflectType(k, typ)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\treturn t\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) DefineReflectType(k string, t reflect.Type) error {\n\tif strings.Contains(k,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " \".\") {\n\t\treturn fmt.Errorf(\"unknown symbol '%s'\", k)\n\t}\n\n\te.Lock()\n\te.typ[k] = t\n\te.Unlock()\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\tep.Type = reflect.TypeOf(v).Name()\n\t\t}\n\t\tif !ep.CaseMatch {\n\t\t\tk = strings.ToLower(k)\n\t\t}\n\t\tep.vals[k] = v\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) String() string {\n\te.RLock()\n\tdefer",
"video": ""
} | {
"audio": "",
"image": "",
"text": " e.RUnlock()\n\n\treturn e.name\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\"nobody\",\n\t\tfalse,\n\t\tfunc(e Export) UserMapping { return e.MapRoot },\n\t\tfunc(e Export, m UserMapping) { e.MapRoot = m })\n\n\treturn api.ExportUpdate(ctx, c.API, nex)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) Dump() {\n\te.RLock()\n\tfmt.Printf(\"Name: %v\\n\", e.name)\n\tfmt.Printf(\"Has parent: %v\\n\", e.parent != nil)\n\tfor k, v",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := range e.env {\n\t\tfmt.Printf(\"%v = %#v\\n\", k, v)\n\t}\n\te.RUnlock()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " e != nil {\n\t\te = fmt.Errorf(\"%s: %s\", v.Type().Name(), e)\n\t}\n\treturn e\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) Execute(src string) (interface{}, error) {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " e.ExecuteContext(context.Background(), src)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " (interface{}, error)) *Init {\n\treturn ini.Branch(func() (interface{}, error) {\n\t\treturn ini.withTimeout(timeout, f)\n\t})\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) ExecuteContext(ctx context.Context, src string) (interface{}, error) {\n\tstmt, err := parser.ParseSrc(src)\n\tif err",
"video": ""
} | {
"audio": "",
"image": "",
"text": " != nil {\n\t\treturn nilValue, err\n\t}\n\treturn RunContext(ctx, stmt, e)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " func(ctx context.Context) error {\n\t\treturn UpdateTenant(ctx, config)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) RunContext(ctx context.Context, stmt",
"video": ""
} | {
"audio": "",
"image": "",
"text": " ast.Stmt) (interface{}, error) {\n\treturn RunContext(ctx, stmt, e)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " a.baseToken.token,\n\t\tlifetime: lifetime,\n\t\trefreshCb: func(ctx context.Context, prev *internal.Token) (*internal.Token, error) {\n\t\t\treturn a.baseToken.renewToken(ctx, prev, nil)\n\t\t},\n\t})\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) Copy() *Env {\n\te.Lock()\n\tdefer e.Unlock()\n\tcopy := Env{\n\t\tname: e.name,\n\t\tenv: make(map[string]reflect.Value),\n\t\ttyp: make(map[string]reflect.Type),\n\t\tparent: e.parent,\n\t\texternal: e.external,\n\t}\n\tfor name, value",
"vide... | {
"audio": "",
"image": "",
"text": " := range e.env {\n\t\tcopy.env[name] = value\n\t}\n\tfor name, typ := range e.typ {\n\t\tcopy.typ[name] = typ\n\t}\n\treturn ©\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tdefer c.lock.RUnlock()\n\n\tif e := c.cache[key]; e != nil {\n\t\tent := e.Value.(*cacheEntry)\n\t\tif !c.isEntryExpired(now, ent) {\n\t\t\treturn ent.v, true\n\t\t}\n\t}\n\treturn nil, false\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *Env) DeepCopy() *Env {\n\tcopy := e.Copy()\n\tif",
"video": ""
} | {
"audio": "",
"image": "",
"text": " copy.parent != nil {\n\t\tcopy.parent = copy.parent.DeepCopy()\n\t}\n\treturn copy\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " e := range rl.Requests {\n\t\tout[i] = e.Copy()\n\t}\n\n\treturn out\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (c *Config) AddAllowMethods(methods ...string) {\n\tc.AllowMethods =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " append(c.AllowMethods, methods...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " func(c *Client) {\n\t\tc.client = client\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (c *Config) AddAllowHeaders(headers ...string) {\n\tc.AllowHeaders =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " append(c.AllowHeaders, headers...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " != nil {\n\t\t\tc.logf(\"Actual request no headers added: method '%s' not allowed\",\n\t\t\t\tr.Method)\n\t\t}\n\n\t\treturn\n\t}\n\theaders.Set(\"Access-Control-Allow-Origin\", origin)\n\tif len(c.exposedHeaders) > 0 {\n\t\theaders.Set(\"Access-Control-Expose-Headers\", stri... |
{
"audio": "",
"image": "",
"text": "func (c *Config) AddExposeHeaders(headers ...string) {\n\tc.ExposeHeaders =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " append(c.ExposeHeaders, headers...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " != nil {\n\t\t\tc.logf(\"Actual request no headers added: method '%s' not allowed\",\n\t\t\t\tr.Method)\n\t\t}\n\n\t\treturn\n\t}\n\theaders.Set(\"Access-Control-Allow-Origin\", origin)\n\tif len(c.exposedHeaders) > 0 {\n\t\theaders.Set(\"Access-Control-Expose-Headers\", stri... |
{
"audio": "",
"image": "",
"text": "func (c *Config) Validate() error {\n\tif c.AllowAllOrigins && (c.AllowOriginFunc != nil || len(c.AllowOrigins) > 0) {\n\t\treturn errors.New(\"conflict settings: all origins are allowed. AllowOriginFunc or AllowOrigins is not needed\")\n\t}\n\tif !c.AllowAllOrigins && c.Allow... | {
"audio": "",
"image": "",
"text": "\n\t\t\treturn nil\n\t\t} else if !strings.Contains(origin, \"*\") && !c.validateAllowedSchemas(origin) {\n\t\t\treturn errors.New(\"bad origin: origins must contain '*' or include \" + strings.Join(c.getAllowedSchemas(), \",\"))\n\t\t}\n\t}\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _, c := range actual {\n\t\t// remove value c from exp\n\t\tfor i := 0; i < len(exp); i++ {\n\t\t\tif exp[i] == c {\n\t\t\t\texp = removeListElement(exp, i)\n\t\t\t\tif len(exp) == 0 {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn len(exp) == 0\n}",
"vide... |
{
"audio": "",
"image": "",
"text": "func DefaultConfig() Config {\n\treturn Config{\n\t\tAllowMethods: []string{\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"HEAD\"},\n\t\tAllowHeaders: []string{\"Origin\",",
"video": ""
} | {
"audio": "",
"image": "",
"text": " \"Content-Length\", \"Content-Type\"},\n\t\tAllowCredentials: false,\n\t\tMaxAge: 12 * time.Hour,\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn s.handleAgentRequest(ctx, \"PATCH\", uuid, agent)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Default() gin.HandlerFunc {\n\tconfig := DefaultConfig()",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tconfig.AllowAllOrigins = true\n\treturn New(config)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\treturn http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {\n\t\t\thandleTimeout(timeout, rw, func() { h.ServeHTTP(rw, r) })\n\t\t})\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func New(config Config) gin.HandlerFunc {\n\tcors := newCors(config)\n\treturn func(c",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *gin.Context) {\n\t\tcors.applyCors(c)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Option {\n\treturn func(c *Config) {\n\t\tc.Daemon.DriverCfg[networkType] = config\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func MemProfileRate(rate int) func(*Profile) {\n\treturn func(p *Profile) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tp.memProfileRate = rate\n\t\tp.mode = memMode\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn func(p *Prompt) error {\n\t\tp.keyBindMode = m\n\t\treturn nil\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Profile) Stop() {\n\tif !atomic.CompareAndSwapUint32(&p.stopped, 0, 1) {\n\t\t// someone has already",
"video": ""
} | {
"audio": "",
"image": "",
"text": " called close\n\t\treturn\n\t}\n\tp.closer()\n\tatomic.StoreUint32(&started, 0)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " !atomic.CompareAndSwapInt32(&wg.counter, 0, 1) {\n\t\tspin.Yield()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func New(rate int, opts ...Option) Limiter {\n\tl := &limiter{\n\t\tperRequest: time.Second / time.Duration(rate),\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tmaxSlack: -10 * time.Second / time.Duration(rate),\n\t}\n\tfor _, opt := range opts {\n\t\topt(l)\n\t}\n\tif l.clock == nil {\n\t\tl.clock = clock.New()\n\t}\n\treturn l\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn time.Duration(1<<uint(i)) * time.Second\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func newCache() *cache {\n\tc := cache{\n\t\tm: make(map[reflect.Type]*structInfo),",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tregconv: make(map[reflect.Type]Converter),\n\t\ttag: \"schema\",\n\t}\n\treturn &c\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(map[reflect.Type]cache.SharedIndexInformer),\n\t\tstartedInformers: make(map[reflect.Type]bool),\n\t\tcustomResync: make(map[reflect.Type]time.Duration),\n\t}\n\n\t// Apply all options\n\tfor _, opt := range options {\n\t\tfactory = opt(factory)\n\t}\n\n\tretu... |
{
"audio": "",
"image": "",
"text": "func (c *cache) registerConverter(value interface{}, converterFunc Converter) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tc.regconv[reflect.TypeOf(value)] = converterFunc\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " (interface{}, error)) *Init {\n\treturn ini.Branch(func() (interface{}, error) {\n\t\treturn ini.withTimeout(timeout, f)\n\t})\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (c *cache) get(t reflect.Type) *structInfo {\n\tc.l.RLock()\n\tinfo := c.m[t]\n\tc.l.RUnlock()",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tif info == nil {\n\t\tinfo = c.create(t, \"\")\n\t\tc.l.Lock()\n\t\tc.m[t] = info\n\t\tc.l.Unlock()\n\t}\n\treturn info\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tc.l.Lock()\n\tdefer c.l.Unlock()\n\treturn c.exited\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (c *cache) create(t reflect.Type, parentAlias string) *structInfo {\n\tinfo := &structInfo{}\n\tvar anonymousInfos []*structInfo\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tif f := c.createField(t.Field(i), parentAlias); f != nil {\n\t\t\tinfo.fields = append(info.fields,... | {
"audio": "",
"image": "",
"text": " []*structInfo{info}\n\t\tothers = append(others, anonymousInfos[:i]...)\n\t\tothers = append(others, anonymousInfos[i+1:]...)\n\t\tfor _, f := range a.fields {\n\t\t\tif !containsAlias(others, f.alias) {\n\t\t\t\tinfo.fields = append(info.fields, f)\n\t\t\t}\n\t\t}\n\t}\n\tre... | {
"audio": "",
"image": "",
"text": "\tfor j, f := range fields {\n\t\tfor _, r := range result.Rows {\n\t\t\tif r[j].typ != Null {\n\t\t\t\tr[j].typ = f.Type\n\t\t\t}\n\t\t}\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (c *cache) createField(field reflect.StructField, parentAlias string) *fieldInfo {\n\talias, options := fieldAlias(field, c.tag)\n\tif alias == \"-\" {\n\t\t// Ignore this field.\n\t\treturn nil\n\t}\n\tcanonicalAlias := alias\n\tif parentAlias != \"\" {\n\t\tcanonicalAli... | {
"audio": "",
"image": "",
"text": " = ft.Kind() == reflect.Struct; !isStruct {\n\t\tif c.converter(ft) == nil && builtinConverters[ft.Kind()] == nil {\n\t\t\t// Type is not supported.\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn &fieldInfo{\n\t\ttyp: field.Type,\n\t\tname: field.Name,\n\t\... | {
"audio": "",
"image": "",
"text": " t.a)\n\t}\n\n\tif b, ok := t.b.(*FunctionType); ok {\n\t\tft := b.FlatTypes()\n\t\tretVal = append(retVal, ft...)\n\t\tReturnTypes(ft)\n\t} else {\n\t\tretVal = append(retVal, t.b)\n\t}\n\treturn retVal\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (c *cache) converter(t reflect.Type) Converter {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn c.regconv[t]\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\treturn t\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func fieldAlias(field reflect.StructField, tagName string) (alias string, options tagOptions) {\n\tif tag := field.Tag.Get(tagName); tag != \"\" {\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\talias, options = parseTag(tag)\n\t}\n\tif alias == \"\" {\n\t\talias = field.Name\n\t}\n\treturn alias, options\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " tag values (this will also validate the field key, which is a tag value for the special field key tag key).\n\t\tif !ValidToken(tag.Value) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func parseTag(tag string) (string, tagOptions) {\n\ts :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " strings.Split(tag, \",\")\n\treturn s[0], s[1:]\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, _ string) (string, error) {\n\treturn \"\", nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (o tagOptions) Contains(option string) bool {\n\tfor _, s := range o {\n\t\tif",
"video": ""
} | {
"audio": "",
"image": "",
"text": " s == option {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfor _, o := range opts {\n\t\tif v, ok := o.(*opt.NumericAttributesForFilteringOption); ok {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (d *Decoder) RegisterConverter(value interface{}, converterFunc Converter) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\td.cache.registerConverter(value, converterFunc)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " (interface{}, error)) *Init {\n\treturn ini.Branch(func() (interface{}, error) {\n\t\treturn ini.withTimeout(timeout, f)\n\t})\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (d *Decoder) checkRequired(t reflect.Type, src map[string][]string) MultiError {\n\tm, errs := d.findRequiredFields(t, \"\", \"\")\n\tfor key, fields := range m",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\tif isEmptyFields(fields, src) {\n\t\t\terrs[key] = EmptyFieldError{Key: key}\n\t\t}\n\t}\n\treturn errs\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tvar sum float64\n\tfor _, v := range values {\n\t\td := float64(v) - m\n\t\tsum += d * d\n\t}\n\treturn sum / float64(len(values))\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (d *Decoder) findRequiredFields(t reflect.Type, canonicalPrefix, searchPrefix string) (map[string][]fieldWithPrefix, MultiError) {\n\tstruc := d.cache.get(t)\n\tif struc == nil {\n\t\t// unexpect, cache.get never return nil\n\t\treturn nil, MultiError{canonicalPrefix + \"... | {
"audio": "",
"image": "",
"text": "\t\tfm, ferrs := d.findRequiredFields(f.typ, fcprefix, fspath+\".\")\n\t\t\t\tfor key, fields := range fm {\n\t\t\t\t\tm[key] = append(m[key], fields...)\n\t\t\t\t}\n\t\t\t\terrs.merge(ferrs)\n\t\t\t}\n\t\t}\n\t\tif f.isRequired {\n\t\t\tkey := canonicalPrefix + f.canonicalAli... | {
"audio": "",
"image": "",
"text": " {\n\t\t\t\t\t\t\tsuffix = \": \" + declKey(d) + \" \" + c2go.GoString(d.Type)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif f.ptrAdd {\n\t\t\t\t\t\t\tsuffix += \" (ptradd)\"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif f.usedAsBool {\n\t\t\t\t\t\t\tsuffix += \" (bool)\"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfmt.Pr... |
{
"audio": "",
"image": "",
"text": "func isEmptyFields(fields []fieldWithPrefix, src map[string][]string) bool {\n\tfor _, f := range fields",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\tfor _, path := range f.paths(f.prefix) {\n\t\t\tif !isEmpty(f.typ, src[path]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tfor j, f := range fields {\n\t\tfor _, r := range result.Rows {\n\t\t\tif r[j].typ != Null {\n\t\t\t\tr[j].typ = f.Type\n\t\t\t}\n\t\t}\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func isEmpty(t reflect.Type, value []string) bool {\n\tif len(value) == 0 {\n\t\treturn true\n\t}\n\tswitch t.Kind() {\n\tcase boolType,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " float32Type, float64Type, intType, int8Type, int32Type, int64Type, stringType, uint8Type, uint16Type, uint32Type, uint64Type:\n\t\treturn len(value[0]) == 0\n\t}\n\treturn false\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " nil\n\t}\n\tif t.Value != nil {\n\t\tt.Value.Finalize()\n\t\tt.Value = nil\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewEncoder() *Encoder {\n\treturn &Encoder{cache: newCache(), regenc:",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(map[reflect.Type]encoderFunc)}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " w.write(func() error {\n\t\te := json.NewEncoder(w.writer)\n\t\treturn e.Encode(data)\n\t})\n}",
"video": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.