query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
73b2fc4540250eada9f2b3bc8086d884
SetUnbondDuration is a paid mutator transaction binding the contract method 0xb16d2d58. Solidity: function setUnbondDuration(_duration uint256) returns()
[ { "docid": "8b08891c6666892ba13031fb16727263", "score": "0.83725876", "text": "func (_Dosstaking *DosstakingTransactorSession) SetUnbondDuration(_duration *big.Int) (*types.Transaction, error) {\n\treturn _Dosstaking.Contract.SetUnbondDuration(&_Dosstaking.TransactOpts, _duration)\n}", "title": "" } ]
[ { "docid": "aa03753a480d38b8ed576666e06919e7", "score": "0.85138166", "text": "func (_Dosstaking *DosstakingTransactor) SetUnbondDuration(opts *bind.TransactOpts, _duration *big.Int) (*types.Transaction, error) {\n\treturn _Dosstaking.contract.Transact(opts, \"setUnbondDuration\", _duration)\n}", "title": "" }, { "docid": "a409fa0099d51efe4cc3ec59b0f6b2f7", "score": "0.8328628", "text": "func (_Dosstaking *DosstakingSession) SetUnbondDuration(_duration *big.Int) (*types.Transaction, error) {\n\treturn _Dosstaking.Contract.SetUnbondDuration(&_Dosstaking.TransactOpts, _duration)\n}", "title": "" }, { "docid": "86f0c806a4c5f2933b2f1f3280ecc956", "score": "0.7251096", "text": "func (_Dosstaking *DosstakingCaller) UnbondDuration(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Dosstaking.contract.Call(opts, out, \"unbondDuration\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "0f2be5c4d2d941f692e30a5dc4fe9447", "score": "0.7060265", "text": "func (_Dosstaking *DosstakingCallerSession) UnbondDuration() (*big.Int, error) {\n\treturn _Dosstaking.Contract.UnbondDuration(&_Dosstaking.CallOpts)\n}", "title": "" }, { "docid": "6c221efc163a98a84ee776ae75e0f33c", "score": "0.7008944", "text": "func (_Dosstaking *DosstakingSession) UnbondDuration() (*big.Int, error) {\n\treturn _Dosstaking.Contract.UnbondDuration(&_Dosstaking.CallOpts)\n}", "title": "" }, { "docid": "73172916c857213dc4d10a842d380abb", "score": "0.64506227", "text": "func (_L1BondingManager *L1BondingManagerTransactor) SetUnbondingPeriod(opts *bind.TransactOpts, _unbondingPeriod uint64) (*types.Transaction, error) {\n\treturn _L1BondingManager.contract.Transact(opts, \"setUnbondingPeriod\", _unbondingPeriod)\n}", "title": "" }, { "docid": "c11319e5cede9832c6910fca6fe0b63a", "score": "0.6209617", "text": "func (r *RateLimit) SetDuration(d time.Duration) {\n\tr.Mutex.Lock()\n\tdefer r.Mutex.Unlock()\n\tr.Duration = d\n}", "title": "" }, { "docid": "c11319e5cede9832c6910fca6fe0b63a", "score": "0.6209617", "text": "func (r *RateLimit) SetDuration(d time.Duration) {\n\tr.Mutex.Lock()\n\tdefer r.Mutex.Unlock()\n\tr.Duration = d\n}", "title": "" }, { "docid": "189fdb30eb2f2aa92a765efa33069f71", "score": "0.6081936", "text": "func (_L1BondingManager *L1BondingManagerTransactorSession) SetUnbondingPeriod(_unbondingPeriod uint64) (*types.Transaction, error) {\n\treturn _L1BondingManager.Contract.SetUnbondingPeriod(&_L1BondingManager.TransactOpts, _unbondingPeriod)\n}", "title": "" }, { "docid": "777cbe0c9c43957b1cd7b98a4222fddc", "score": "0.6050655", "text": "func (usc *UserStatusCreate) SetDuration(pg *pgtype.Tstzrange) *UserStatusCreate {\n\tusc.mutation.SetDuration(pg)\n\treturn usc\n}", "title": "" }, { "docid": "31d7056ef9a1f6f04455d9d8f7454f94", "score": "0.6010637", "text": "func (when *NTPShort) SetDuration(d time.Duration) {\n\tns := d.Nanoseconds()\n\twhen.Seconds = uint16(ns / 1e9)\n\twhen.SetNanos(int(ns % 1e9))\n}", "title": "" }, { "docid": "c48a4ce767e455265fd194ab9fc20f4c", "score": "0.59811324", "text": "func (_L1BondingManager *L1BondingManagerSession) SetUnbondingPeriod(_unbondingPeriod uint64) (*types.Transaction, error) {\n\treturn _L1BondingManager.Contract.SetUnbondingPeriod(&_L1BondingManager.TransactOpts, _unbondingPeriod)\n}", "title": "" }, { "docid": "fe9bc38afc10bc1f73a1ca2894347109", "score": "0.5864508", "text": "func (_SfcV1Contract *SfcV1ContractCaller) UnbondingUnlockPeriod(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV1Contract.contract.Call(opts, &out, \"unbondingUnlockPeriod\")\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "4d120c64b37d3768f9443debcc4b1ac8", "score": "0.5742712", "text": "func (v *ViperConf) SetDuration(key string, value time.Duration) {\n\tv.lock.Lock()\n\tdefer v.lock.Unlock()\n\tv.viper.Set(key, value)\n}", "title": "" }, { "docid": "0054dada8f648284a3ec19f7c8bd4659", "score": "0.5742041", "text": "func (event *VEvent) SetDuration(d time.Duration) error {\n\tt, err := event.GetStartAt()\n\tif err == nil {\n\t\tevent.SetEndAt(t.Add(d))\n\t\treturn nil\n\t} else {\n\t\tt, err = event.GetEndAt()\n\t\tif err == nil {\n\t\t\tevent.SetStartAt(t.Add(-d))\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.New(\"start or end not yet defined\")\n}", "title": "" }, { "docid": "a346fb1f0a662371b5ea77d50df3ba05", "score": "0.57297915", "text": "func (_Esd *EsdTransactorSession) Unbond(value *big.Int) (*types.Transaction, error) {\n\treturn _Esd.Contract.Unbond(&_Esd.TransactOpts, value)\n}", "title": "" }, { "docid": "40894f2da5bde221304bd83aa992c682", "score": "0.57176065", "text": "func (u PlanUpdater) SetDuration(duration time.Duration) PlanUpdater {\n\tu.fields[string(PlanDBSchema.Duration)] = duration\n\treturn u\n}", "title": "" }, { "docid": "2dafc710c8e91b6482036442bc0550fb", "score": "0.5705325", "text": "func (_Esd *EsdTransactor) Unbond(opts *bind.TransactOpts, value *big.Int) (*types.Transaction, error) {\n\treturn _Esd.contract.Transact(opts, \"unbond\", value)\n}", "title": "" }, { "docid": "759fe27160e865911e1c8529ee125ce8", "score": "0.56865627", "text": "func (device *DMXBricklet) SetFrameDuration(frameDuration uint16) (err error) {\n\tvar buf bytes.Buffer\n\tbinary.Write(&buf, binary.LittleEndian, frameDuration)\n\n\tresultBytes, err := device.device.Set(uint8(FunctionSetFrameDuration), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e599895d77416b540c3e3880b71647c1", "score": "0.5614385", "text": "func (_SfcV1Contract *SfcV1ContractSession) UnbondingUnlockPeriod() (*big.Int, error) {\n\treturn _SfcV1Contract.Contract.UnbondingUnlockPeriod(&_SfcV1Contract.CallOpts)\n}", "title": "" }, { "docid": "9fce605b658e7d48357d9380145728d4", "score": "0.5574815", "text": "func (_SfcV1Contract *SfcV1ContractCallerSession) UnbondingUnlockPeriod() (*big.Int, error) {\n\treturn _SfcV1Contract.Contract.UnbondingUnlockPeriod(&_SfcV1Contract.CallOpts)\n}", "title": "" }, { "docid": "186d7b6160787de296465eac2d819c0d", "score": "0.55622715", "text": "func (d *AtomicDuration) Set(duration time.Duration) {\n\tatomic.StoreInt64(&d.int64, int64(duration))\n}", "title": "" }, { "docid": "bf0500e20cd572af3120e80aad974def", "score": "0.55518067", "text": "func (_Esd *EsdSession) Unbond(value *big.Int) (*types.Transaction, error) {\n\treturn _Esd.Contract.Unbond(&_Esd.TransactOpts, value)\n}", "title": "" }, { "docid": "82488cae948b4d236c43263ace10d74c", "score": "0.55504864", "text": "func (e *EMA) SetDuration(v time.Duration) {\n\te.Set(float64(v))\n}", "title": "" }, { "docid": "a562149facc6cad6cd20e4acb787992c", "score": "0.55285704", "text": "func (o OptionsSendAnimation) SetDuration(duration int) OptionsSendAnimation {\n\to[\"duration\"] = duration\n\treturn o\n}", "title": "" }, { "docid": "85dfb77cdabddec3e1ca7583b99bdda5", "score": "0.5521055", "text": "func (task *BaseTask) SetDuration(duration int) {\n\tif task == nil {\n\t\tpanic(errors.New(\"task is nil\").Error())\n\t}\n\n\tvalue := duration\n\n\tCalcDeclarative(&task.duration, &value, task.setEndDateTime)\n}", "title": "" }, { "docid": "4a05a4d1e9b1bed28e38c13e19598cea", "score": "0.54814154", "text": "func (self *Timer) SetDurationA(member int) {\n self.Object.Set(\"duration\", member)\n}", "title": "" }, { "docid": "97bc73d0d5b62b42873b8ab1c1877758", "score": "0.5451643", "text": "func (_L1BondingManager *L1BondingManagerTransactor) Unbond(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) {\n\treturn _L1BondingManager.contract.Transact(opts, \"unbond\", _amount)\n}", "title": "" }, { "docid": "3a5ecd0cf610cf697687a2e5f8b6dd04", "score": "0.54396677", "text": "func (m *CustomExtensionCallbackConfiguration) SetTimeoutDuration(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n err := m.GetBackingStore().Set(\"timeoutDuration\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e7c288db1947253ef7df9126fa7367bd", "score": "0.5369164", "text": "func (i *item) SetDuration(duration string) {\n\ti.duration.SetText(duration)\n}", "title": "" }, { "docid": "d5351bc8cb72a186c4c63fac3677454e", "score": "0.53549963", "text": "func (_L1BondingManager *L1BondingManagerTransactorSession) Unbond(_amount *big.Int) (*types.Transaction, error) {\n\treturn _L1BondingManager.Contract.Unbond(&_L1BondingManager.TransactOpts, _amount)\n}", "title": "" }, { "docid": "f87d4dc0bcf8282c016c0ff168d3835c", "score": "0.53476673", "text": "func (qs PlanQuerySet) DurationNotIn(duration time.Duration, durationRest ...time.Duration) PlanQuerySet {\n\tiArgs := []interface{}{duration}\n\tfor _, arg := range durationRest {\n\t\tiArgs = append(iArgs, arg)\n\t}\n\treturn qs.w(qs.db.Where(\"duration NOT IN (?)\", iArgs))\n}", "title": "" }, { "docid": "02c1c2e83c361738989f614219c6002e", "score": "0.5300868", "text": "func (self *Pointer) SetDurationA(member int) {\n self.Object.Set(\"duration\", member)\n}", "title": "" }, { "docid": "3e006fb8185c2662ac63a3e8e3cb1017", "score": "0.52862346", "text": "func (_L1BondingManager *L1BondingManagerCaller) UnbondingPeriod(opts *bind.CallOpts) (uint64, error) {\n\tvar out []interface{}\n\terr := _L1BondingManager.contract.Call(opts, &out, \"unbondingPeriod\")\n\n\tif err != nil {\n\t\treturn *new(uint64), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "c970f656a5cc2ece5f1d9720cf4495fd", "score": "0.5244539", "text": "func (m *Monitor) SetDuration(duration []float64) {\n\tm.reqDuration = duration\n}", "title": "" }, { "docid": "66d74e6a5c88f1d1c0e72d5fcc60cab1", "score": "0.52361655", "text": "func (m *Training) SetDurationInMinutes(value *int32)() {\n err := m.GetBackingStore().Set(\"durationInMinutes\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4a6100f0057220ef9f17b3a9bbc93c11", "score": "0.5228775", "text": "func (a StandbyDurationSetting) Duration() time.Duration {\n\tif STANDBYDURATION_20 < a {\n\t\treturn time.Duration(0) //INVALID\n\t}\n\treturn time.Duration(standbyDurOptionMicroseconds[int(a)]) * time.Microsecond\n}", "title": "" }, { "docid": "bf67290ff090fd40efa31a0085964035", "score": "0.5228034", "text": "func (_L1BondingManager *L1BondingManagerSession) Unbond(_amount *big.Int) (*types.Transaction, error) {\n\treturn _L1BondingManager.Contract.Unbond(&_L1BondingManager.TransactOpts, _amount)\n}", "title": "" }, { "docid": "ff053a3af621477c204e80ea422c1ec8", "score": "0.52230805", "text": "func (m *UnifiedRoleManagementPolicyExpirationRule) SetMaximumDuration(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n err := m.GetBackingStore().Set(\"maximumDuration\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0b8f61402f5f26dd71d435e1a694271d", "score": "0.51676136", "text": "func (_Dosstaking *DosstakingFilterer) FilterUpdateUnbondDuration(opts *bind.FilterOpts) (*DosstakingUpdateUnbondDurationIterator, error) {\n\n\tlogs, sub, err := _Dosstaking.contract.FilterLogs(opts, \"UpdateUnbondDuration\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DosstakingUpdateUnbondDurationIterator{contract: _Dosstaking.contract, event: \"UpdateUnbondDuration\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "73f25a727022c0d245557cc21cde0488", "score": "0.5155827", "text": "func (d *Duration) UnmarshalJSON(data []byte) error {\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\tvar stringVar string\n\tif err := json.Unmarshal(data, &stringVar); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif stringVar == teleport.DurationNever {\n\t\td.Duration = 0\n\t} else {\n\t\tout, err := time.ParseDuration(stringVar)\n\t\tif err != nil {\n\t\t\treturn trace.BadParameter(err.Error())\n\t\t}\n\t\td.Duration = out\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c34a2103a7fa7b9b157cf54e67bcb90e", "score": "0.51462525", "text": "func (o OptionsSendVideoNote) SetDuration(duration int) OptionsSendVideoNote {\n\to[\"duration\"] = duration\n\treturn o\n}", "title": "" }, { "docid": "4dbd8e16f2ec2a99ce605b5be10b47a5", "score": "0.5141318", "text": "func (m *UserExperienceAnalyticsAppHealthAppPerformanceByAppVersion) SetAppUsageDuration(value *int32)() {\n err := m.GetBackingStore().Set(\"appUsageDuration\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "732e74b0f70db5e8510e9faa84c9a260", "score": "0.51379925", "text": "func setFlagEnvDuration(p *time.Duration, key, desc string, fallback time.Duration) {\n\tif val := envValue(key); val != nil {\n\t\tfallback, _ = time.ParseDuration(*val)\n\t}\n\tflag.DurationVar(p, key, fallback, envDesc(key, desc))\n}", "title": "" }, { "docid": "ee6cf713a7016c470df9d0a552e22349", "score": "0.5104994", "text": "func (o OptionsSendVideo) SetDuration(duration int) OptionsSendVideo {\n\to[\"duration\"] = duration\n\treturn o\n}", "title": "" }, { "docid": "dd666f0c9423ac12eced0579a8043bdb", "score": "0.5095763", "text": "func (transaction *TokenUnfreezeTransaction) SetTransactionValidDuration(duration time.Duration) *TokenUnfreezeTransaction {\n\ttransaction.requireNotFrozen()\n\ttransaction.Transaction.SetTransactionValidDuration(duration)\n\treturn transaction\n}", "title": "" }, { "docid": "f71553a70a902fe502cccd0edc4376b5", "score": "0.5079614", "text": "func (o OptionsSendVoice) SetDuration(duration int) OptionsSendVoice {\n\to[\"duration\"] = duration\n\treturn o\n}", "title": "" }, { "docid": "8022cbbd67ffec7547293d4727efa91b", "score": "0.5020168", "text": "func DurationNotIn(vs ...time.Duration) predicate.FieldType {\n\tv := make([]any, len(vs))\n\tfor i := range v {\n\t\tv[i] = int64(vs[i])\n\t}\n\treturn predicate.FieldType(sql.FieldNotIn(FieldDuration, v...))\n}", "title": "" }, { "docid": "7ebb3c8ebfc8c1f1e788ce4ed0c3c7c2", "score": "0.50165135", "text": "func useBackoffDuration(d time.Duration) func() {\n\told := backoffDuration\n\tbackoffDuration = func(attempt int) time.Duration { return d }\n\treturn func() { backoffDuration = old }\n}", "title": "" }, { "docid": "5bb1ac2491670a8ddcb5fa94fd603e1f", "score": "0.5006386", "text": "func (d *Duration) Set(v string) error {\n\tparsed, err := time.ParseDuration(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*d = Duration(parsed)\n\treturn nil\n}", "title": "" }, { "docid": "5bb1ac2491670a8ddcb5fa94fd603e1f", "score": "0.5006386", "text": "func (d *Duration) Set(v string) error {\n\tparsed, err := time.ParseDuration(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*d = Duration(parsed)\n\treturn nil\n}", "title": "" }, { "docid": "3002035e736a2be79f881fae2fa670fb", "score": "0.49896196", "text": "func (_L1BondingManager *L1BondingManagerCallerSession) UnbondingPeriod() (uint64, error) {\n\treturn _L1BondingManager.Contract.UnbondingPeriod(&_L1BondingManager.CallOpts)\n}", "title": "" }, { "docid": "0f81b3eba90ab1ae8454f85c06e2f762", "score": "0.4981102", "text": "func (d *Duration) Set(v float64) {\n\tif math.IsNaN(v) {\n\t\treturn\n\t}\n\n\t*d = Duration(v)\n}", "title": "" }, { "docid": "f34cb5b9d7d28f9e378e27143e87422d", "score": "0.4978956", "text": "func (c *BenchmarkCase) SetDuration(dur time.Duration) *BenchmarkCase {\n\tc.MinRuntime = dur\n\tif dur <= time.Minute {\n\t\tc.MaxRuntime = 10 * dur\n\t} else if dur <= 10*time.Minute {\n\t\tc.MaxRuntime = 2 * dur\n\t} else {\n\t\tc.MaxRuntime = time.Minute + dur\n\t}\n\treturn c\n}", "title": "" }, { "docid": "b9f794a46f6b12e65a6af97cc7faf7fd", "score": "0.4975941", "text": "func (_L1BondingManager *L1BondingManagerSession) UnbondingPeriod() (uint64, error) {\n\treturn _L1BondingManager.Contract.UnbondingPeriod(&_L1BondingManager.CallOpts)\n}", "title": "" }, { "docid": "e86d7b41df8b549dddb07a8ebc7b5325", "score": "0.49749273", "text": "func (o *ViewTimerInterval) SetDuration(v int32) {\n\to.Duration = &v\n}", "title": "" }, { "docid": "f6863cf09d91fbac5c930ac35b11ccb9", "score": "0.49602813", "text": "func (p *poolEvictor) SetEvictDuration(dur time.Duration) {\n\tp.Lock()\n\tif p.tickerCh == nil { // first initialize\n\t\tp.tickerCh = make(chan *time.Ticker)\n\t\tgo func(tickerCh <-chan *time.Ticker) {\n\t\t\tticker := <-tickerCh\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ticker.C:\n\t\t\t\t\tdur := time.Second * time.Duration(atomic.LoadUint32(&p.evictDurSec))\n\t\t\t\t\tp.Lock()\n\t\t\t\t\tevict := p.Evict\n\t\t\t\t\tp.Unlock()\n\t\t\t\t\tevict(dur)\n\t\t\t\tcase nxt := <-tickerCh:\n\t\t\t\t\tticker.Stop()\n\t\t\t\t\tticker = nxt\n\t\t\t\t}\n\t\t\t}\n\t\t}(p.tickerCh)\n\t}\n\tp.Unlock()\n\tatomic.StoreUint32(&p.evictDurSec, uint32(dur/time.Second))\n\tp.tickerCh <- time.NewTicker(dur)\n}", "title": "" }, { "docid": "167b1ea7f051923f6065a380282dcc23", "score": "0.49515173", "text": "func TimeoutDuration(d time.Duration) {\n\ttimeoutDuration = d\n}", "title": "" }, { "docid": "9816e4e0841cb832b0cfcfa6c01999a1", "score": "0.49456367", "text": "func SetDrainDuration(duration time.Duration) SenderOptionFunc {\n\treturn func(l *LogzioSender) error {\n\t\tl.drainDuration = duration\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "213bbfc672748901edbba9e996b4e355", "score": "0.4945112", "text": "func DurationSetMinutes(vm *VM, target, locals Interface, msg *Message) Interface {\n\td := target.(*Duration)\n\tn, stop := msg.NumberArgAt(vm, locals, 0)\n\tif stop != nil {\n\t\treturn stop\n\t}\n\tcm := d.Value / time.Minute % 60\n\tdelta := n.Value - float64(cm)\n\td.Value += time.Duration(delta * float64(time.Minute))\n\treturn target\n}", "title": "" }, { "docid": "81fb28b1193d4d54b65a68a436bebc9a", "score": "0.49286798", "text": "func (b *Buffer) AppendDuration(val time.Duration) {\n\tb.AppendInt(int64(val))\n}", "title": "" }, { "docid": "71d5121507fb88362f43e89dbe3c23f9", "score": "0.49242464", "text": "func (m *BookingService) SetDefaultDuration(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n m.defaultDuration = value\n}", "title": "" }, { "docid": "66390c096ac5b4277f46e3a1183aa198", "score": "0.49217448", "text": "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tif err := json.Unmarshal(b, &d.Duration); err == nil {\n\t\t// b was an integer number of nanoseconds.\n\t\treturn nil\n\t}\n\t// b was not an integer. Assume that it is a duration string.\n\n\tvar str string\n\terr := json.Unmarshal(b, &str)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpd, err := time.ParseDuration(str)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.Duration = pd\n\treturn nil\n}", "title": "" }, { "docid": "149850d0930450ce03bf42db69773025", "score": "0.49077198", "text": "func UpdateDuration(label FunctionLabel, duration time.Duration) {\n\tfunctionDuration.WithLabelValues(string(label)).Set(duration.Seconds())\n}", "title": "" }, { "docid": "6dda7fb839b265b7db9ff3686759166e", "score": "0.4905923", "text": "func (o OptionsSendAudio) SetDuration(duration int) OptionsSendAudio {\n\to[\"duration\"] = duration\n\treturn o\n}", "title": "" }, { "docid": "b3f437f8c43fda3e49fc0d769e474636", "score": "0.4877731", "text": "func (m *AndroidWorkProfileEasEmailProfileBase) SetDurationOfEmailToSync(value *EmailSyncDuration)() {\n err := m.GetBackingStore().Set(\"durationOfEmailToSync\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "60b217d3729f40800104b026761b5a8e", "score": "0.48743993", "text": "func (d *Duration) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\treturn d.Set(s)\n}", "title": "" }, { "docid": "3a56826047aa83d18b90e52c3311d6d8", "score": "0.48740697", "text": "func DurationMinusEq(vm *VM, target, locals Interface, msg *Message) Interface {\n\td := target.(*Duration)\n\tr, ok := CheckStop(msg.EvalArgAt(vm, locals, 0), LoopStops)\n\tif !ok {\n\t\treturn r\n\t}\n\tdd, ok := r.(*Duration)\n\tif !ok {\n\t\treturn vm.RaiseException(\"argument 0 to -= must be Duration, not \" + vm.TypeName(r))\n\t}\n\td.Value -= dd.Value\n\treturn target\n}", "title": "" }, { "docid": "1f5de5372dce090bccc761d358027379", "score": "0.48600194", "text": "func (device *ThermocoupleBricklet) SetDebouncePeriod(debounce uint32) (err error) {\n\tvar buf bytes.Buffer\n\tbinary.Write(&buf, binary.LittleEndian, debounce)\n\n\tresultBytes, err := device.device.Set(uint8(FunctionSetDebouncePeriod), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8d99aeab8446ed7f1d7dafd60ce4f97f", "score": "0.48525792", "text": "func (device *IndustrialDualAnalogInBricklet) SetDebouncePeriod(debounce uint32) (err error) {\n\tvar buf bytes.Buffer\n\tbinary.Write(&buf, binary.LittleEndian, debounce)\n\n\tresultBytes, err := device.device.Set(uint8(FunctionSetDebouncePeriod), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "70cb253e1479f41f88a7aba7bee83f39", "score": "0.4850227", "text": "func (self *Queue) SetMaxDuration(dur time.Duration) {\n\tself.lock.Lock()\n\tdefer self.lock.Unlock()\n\n\tself.maxdur = dur\n\tfor self.maxdur > 0 && len(self.pkts) >= 2 && self.pkts[len(self.pkts)-1].Time - self.pkts[0].Time > self.maxdur {\n\t\tself.pkts = self.pkts[1:]\n\t\tself.head++\n\t}\n\treturn\n}", "title": "" }, { "docid": "9ddc4891c6e931a73ca30514fd4d503f", "score": "0.48471162", "text": "func (e *EMA) UpdateDuration(v time.Duration) time.Duration {\n\treturn time.Duration(e.Update(float64(v)))\n}", "title": "" }, { "docid": "cdc4e4843f6e46c2d9c50ad7c8255680", "score": "0.48344937", "text": "func DurationMinusBuffer(intv time.Duration, buffer time.Duration, jitter int64) time.Duration {\n\td := intv - buffer\n\tif jitter == 0 {\n\t\td -= RandomStagger(d)\n\t} else {\n\t\td -= RandomStagger(time.Duration(int64(d) / jitter))\n\t}\n\treturn d\n}", "title": "" }, { "docid": "0587562e943df16ed6b776133cbfac3f", "score": "0.4824548", "text": "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tvar s int\n\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\td.Duration = time.Duration(s) * time.Second\n\n\treturn nil\n}", "title": "" }, { "docid": "0eb167c1d6f37f74618a9e0e746a2840", "score": "0.48063505", "text": "func DurationSetHours(vm *VM, target, locals Interface, msg *Message) Interface {\n\td := target.(*Duration)\n\tn, stop := msg.NumberArgAt(vm, locals, 0)\n\tif stop != nil {\n\t\treturn stop\n\t}\n\tch := d.Value / time.Hour % 24\n\tdelta := n.Value - float64(ch)\n\td.Value += time.Duration(delta * float64(time.Hour))\n\treturn target\n}", "title": "" }, { "docid": "6788e9d0e1181208285978e96fb3dd9f", "score": "0.47991544", "text": "func (d *durationValue) Set(s string) error {\n\tv, err := time.ParseDuration(s)\n\t*d = durationValue(v)\n\treturn err\n}", "title": "" }, { "docid": "23978f6a6eb653f837259310371e2091", "score": "0.47928947", "text": "func (d *Duration) UnmarshalJSON(b []byte) error {\n\t// Check if it's a string\n\tvar s string\n\terr := json.Unmarshal(b, &s)\n\tif err != nil {\n\t\tval, err := json.Number(string(b)).Int64()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\td.Duration = time.Duration(val)\n\t\treturn nil\n\t}\n\td.Duration, err = time.ParseDuration(s)\n\treturn err\n}", "title": "" }, { "docid": "03b65068cc8483171f5ce143949a7e8a", "score": "0.47909927", "text": "func (l DsdCaptureDurationRuntimeSetting) Set(v interface{}) error {\n\tvar err error\n\n\ts, ok := v.(string)\n\tif !ok {\n\t\treturn fmt.Errorf(\"%s.Set: Invalid data type\", l)\n\t}\n\n\t_, err = time.ParseDuration(s)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unsupported type for %s: %v\", l, err)\n\t}\n\n\t// TODO\n\t//common.DSD.Capture.SetDuration(d)\n\n\treturn nil\n}", "title": "" }, { "docid": "9f3b6dd99d4b36348c495f4a8ccbe175", "score": "0.4785468", "text": "func (o *InlineResponse2001Items) SetDuration(v int64) {\n\to.Duration = v\n}", "title": "" }, { "docid": "2254c8c0eee54fa581b477bbd1412e43", "score": "0.47853515", "text": "func (bit *Duration) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {\n\t_ = d.DecodeElement(&bit.Val, &start)\n\tr, _ := strconv.Atoi(bit.Val)\n\tif bit.Duration = time.Second * time.Duration(r); bit.Val == \"\" {\n\t\t// In the context of this application -1ns will significantly make\n\t\t// obvious the fact that this value was empty and not a number.\n\t\t// This typically happens for a camera's last motion event ticker\n\t\t// when one has yet to happen [since securityspy started].\n\t\tbit.Duration = -1\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55567bfe4f2bfdf9b2bd20a5a357bd1b", "score": "0.47847337", "text": "func (bit *Duration) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {\n\t_ = d.DecodeElement(&bit.Val, &start)\n\tr, _ := strconv.Atoi(bit.Val)\n\n\tif bit.Duration = time.Second * time.Duration(r); bit.Val == \"\" {\n\t\t// In the context of this application -1ns will significantly make\n\t\t// obvious the fact that this value was empty and not a number.\n\t\t// This typically happens for a camera's last motion event ticker\n\t\t// when one has yet to happen [since securityspy started].\n\t\tbit.Duration = -1\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "409fbf2bdcae01c73682d1299b228d96", "score": "0.47844878", "text": "func WithDurationUnit(unit DurationUnit) Option {\n\treturn func(opt *options) {\n\t\topt.durationUnit = unit\n\t}\n}", "title": "" }, { "docid": "3706f7025cd64da86d7c8a4ae4901786", "score": "0.47774318", "text": "func (d *Duration) Set(s string) error {\n\tv, err := ParseDuration(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*d = v\n\treturn nil\n}", "title": "" }, { "docid": "6bae292b0bfd8caccde8bc5b27c862be", "score": "0.4775587", "text": "func (duration *Duration) UnmarshalJSON(payload []byte) (err error) {\n\tvar inner interface{}\n\t_ = json.Unmarshal(payload, &inner)\n\tswitch value := inner.(type) {\n\tcase float64:\n\t\t(*duration) = Duration(value * float64(1000000))\n\tcase string:\n\t\tvar d time.Duration\n\t\tif strings.HasPrefix(strings.TrimSpace(value), \"P\") {\n\t\t\tif d, err = ParseDuration(value); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t(*duration) = Duration(d)\n\t\t\treturn\n\t\t}\n\t\tif d, err = time.ParseDuration(value); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t(*duration) = Duration(d)\n\tdefault:\n\t\treturn fmt.Errorf(\"Invalid Duration\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "600957421289f53489411eb8a5298a99", "score": "0.4770577", "text": "func (o *InlineResponse20030Timers) SetDuration(v string) {\n\to.Duration = &v\n}", "title": "" }, { "docid": "03bd41aaf53b9c4f1ace141c802e53a5", "score": "0.47699332", "text": "func (_Erdstall *ErdstallCaller) ResponseDuration(opts *bind.CallOpts) (uint64, error) {\n\tvar out []interface{}\n\terr := _Erdstall.contract.Call(opts, &out, \"responseDuration\")\n\n\tif err != nil {\n\t\treturn *new(uint64), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "df04e2e55034178d6f1f27d6581bdc46", "score": "0.47619516", "text": "func DurationSetting(duration time.Duration) Setting {\n\tif duration == 0 {\n\t\treturn DefaultSetting()\n\t}\n\treturn Setting{val: duration, valset: true}\n}", "title": "" }, { "docid": "2adc131fde8b49e7a771d11fd8483647", "score": "0.47544876", "text": "func (f *FlagSet) Duration(name rune, value time.Duration, usage string) *time.Duration {\n\tp := new(time.Duration)\n\tf.DurationVar(p, name, value, usage)\n\treturn p\n}", "title": "" }, { "docid": "464c4ff08f42b1362b66bb7029b91f31", "score": "0.4752135", "text": "func (d *durationValue) Set(s string) error {\n\tv, err := time.ParseDuration(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*d = durationValue(v)\n\treturn err\n}", "title": "" }, { "docid": "e3a4b0b6d3e13b97399dc690658bb584", "score": "0.47402567", "text": "func (s *MarshalState) WriteDuration(x time.Duration) {\n\tif s.Err() != nil {\n\t\treturn\n\t}\n\tv := fmt.Sprintf(\"%.09f\", x.Seconds())\n\t// According to the protobuf spec, nanoseconds in durations should be written as 3, 6 or 9 digits.\n\tv = strings.TrimSuffix(v, \"000\")\n\tv = strings.TrimSuffix(v, \"000\")\n\tv = strings.TrimSuffix(v, \".000\")\n\ts.inner.WriteString(v + \"s\")\n}", "title": "" }, { "docid": "ae4b55e5651386f06b9a239792c726e8", "score": "0.47277883", "text": "func (d *Duration) UnmarshalJSON(raw []byte) error {\n\tvar value string\n\terr := json.Unmarshal(raw, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.Value, err = time.ParseDuration(value)\n\treturn err\n}", "title": "" }, { "docid": "a9528cb95816ecf283239bc4b6ecae66", "score": "0.47253433", "text": "func DurationSup(d time.Duration) *Filter {\n\treturn newDurationFilter(\n\t\t&DurationFilter{\n\t\t\tCondition: &DurationFilter_Sup{\n\t\t\t\tSup: durationpb.New(d),\n\t\t\t},\n\t\t},\n\t)\n}", "title": "" }, { "docid": "7c1a4fd0eee29f1183c1f89678b5c7b2", "score": "0.47097754", "text": "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tvar v interface{}\n\terr := json.Unmarshal(b, &v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch value := v.(type) {\n\tcase float64:\n\t\t*d = Duration(time.Duration(value))\n\t\treturn nil\n\tcase string:\n\t\ttmp, err := time.ParseDuration(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*d = Duration(tmp)\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"Invalid Duration specification: '%v'\", value)\n\t}\n}", "title": "" }, { "docid": "7c4eeccf8468f340306af70c5877fe9c", "score": "0.47073996", "text": "func DurationSetSeconds(vm *VM, target, locals Interface, msg *Message) Interface {\n\td := target.(*Duration)\n\tn, stop := msg.NumberArgAt(vm, locals, 0)\n\tif stop != nil {\n\t\treturn stop\n\t}\n\tcs := d.Value / time.Second % 60\n\tdelta := n.Value - float64(cs)\n\td.Value += time.Duration(delta * float64(time.Second))\n\treturn target\n}", "title": "" }, { "docid": "a9899956c412ddba3afc6ae273b383ec", "score": "0.4703926", "text": "func (p *Transport) SetLifetime(lifetime time.Duration) {\n\tif lifetime < 1 {\n\t\treturn\n\t}\n\tp.maxLifetime = lifetime\n}", "title": "" }, { "docid": "432a125f460623a8d77050fd1580113b", "score": "0.46942902", "text": "func Duration(d time.Duration) *time.Duration {\n\treturn &d\n}", "title": "" }, { "docid": "432a125f460623a8d77050fd1580113b", "score": "0.46942902", "text": "func Duration(d time.Duration) *time.Duration {\n\treturn &d\n}", "title": "" }, { "docid": "432a125f460623a8d77050fd1580113b", "score": "0.46942902", "text": "func Duration(d time.Duration) *time.Duration {\n\treturn &d\n}", "title": "" }, { "docid": "8681729542b5ea318993d6965d3a63ad", "score": "0.46857002", "text": "func (d *jsonDuration) UnmarshalJSON(b []byte) error {\n\tvar v interface{}\n\tif err := json.Unmarshal(b, &v); err != nil {\n\t\treturn err\n\t}\n\tswitch value := v.(type) {\n\tcase float64:\n\t\t*d = jsonDuration{time.Duration(value)}\n\t\treturn nil\n\tcase string:\n\t\tduration, err := time.ParseDuration(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*d = jsonDuration{time.Duration(duration)}\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid duration: %s\", string(b))\n\t}\n}", "title": "" }, { "docid": "f73d8df3d3b546f9edaddac33e65b958", "score": "0.46737453", "text": "func (v Value) SetUint(x uint64)", "title": "" } ]
765789b11c0adc419214ff21715745c1
version identifier/method selection message ++++ |VER | NMETHODS | METHODS | ++++ | 1 | 1 | 1 to 255 | ++++ reply: +++ |VER | METHOD | +++ | 1 | 1 | +++ handShake dail handshake between socks5 client and socks5 server.
[ { "docid": "3706f4c9b855a42ff7483a4591dc7f97", "score": "0.65392494", "text": "func (s *TCPRelay) handShake() (err error) {\n\traw := make([]byte, 257)\n\tif _, err = io.ReadFull(s.conn, raw[:2]); err != nil {\n\t\treturn\n\t}\n\n\t// get socks version\n\tif ver := raw[0]; ver != socksv5 {\n\t\treturn fmt.Errorf(\"error socks version %d\", ver)\n\t}\n\n\t// read all method identifier octets\n\tnmethods := raw[1]\n\tif _, err = io.ReadFull(s.conn, raw[2:2+nmethods]); err != nil {\n\t\treturn\n\t}\n\n\t// reply to socks5 client\n\t_, err = s.conn.Write([]byte{socksv5, 0x00})\n\treturn\n}", "title": "" } ]
[ { "docid": "4cdba767993fafa15aa709f02ca10794", "score": "0.5938755", "text": "func (handler *TcpSock5Handler) Tunnel() error {\n\t// dial proxy server\n\trConn, err := handler.dialProxy()\n\tif err != nil {\n\t\tlogger.Warningf(\"[%s] failed to dial proxy server, err: %v\", handler.typ, err)\n\t\treturn err\n\t}\n\t// check type\n\ttcpAddr, ok := handler.rAddr.(*net.TCPAddr)\n\tif !ok {\n\t\tlogger.Warningf(\"[%s] tunnel addr type is not tcp\", handler.typ)\n\t\treturn errors.New(\"type is not tcp\")\n\t}\n\t// auth message\n\tauth := auth{\n\t\tuser: handler.proxy.UserName,\n\t\tpassword: handler.proxy.Password,\n\t}\n\t/*\n\t sock5 client hand shake request\n\t +----+----------+----------+\n\t |VER | NMETHODS | METHODS |\n\t +----+----------+----------+\n\t | 1 | 1 | 1 to 255 |\n\t +----+----------+----------+\n\t*/\n\t// sock5 proto\n\t// buffer := new(bytes.Buffer)\n\tbuf := make([]byte, 3)\n\tbuf[0] = 5\n\tbuf[1] = 1\n\tbuf[2] = 0\n\tif auth.user != \"\" && auth.password != \"\" {\n\t\tbuf[1] = 2\n\t\tbuf = append(buf, byte(2))\n\t}\n\t// sock5 hand shake\n\t_, err = rConn.Write(buf)\n\tif err != nil {\n\t\tlogger.Warningf(\"[%s] hand shake request failed, err: %v\", handler.typ, err)\n\t\treturn err\n\t}\n\t/*\n\t\tsock5 server hand shake response\n\t\t+----+--------+\n\t\t|VER | METHOD |\n\t\t+----+--------+\n\t\t| 1 | 1 |\n\t\t+----+--------+\n\t*/\n\t_, err = rConn.Read(buf)\n\tif err != nil {\n\t\tlogger.Warningf(\"[%s] hand shake response failed, err: %v\", handler.typ, err)\n\t\treturn err\n\t}\n\tlogger.Debugf(\"[%s] hand shake response success message auth method: %v\", handler.typ, buf[1])\n\tif buf[0] != 5 || (buf[1] != 0 && buf[1] != 2) {\n\t\treturn fmt.Errorf(\"sock5 proto is invalid, sock type: %v, method: %v\", buf[0], buf[1])\n\t}\n\t// check if server need auth\n\tif buf[1] == 2 {\n\t\tlogger.Debugf(\"[%s] proxy need auth, start authenticating...\", handler.typ)\n\t\t/*\n\t\t sock5 auth request\n\t\t +----+------+----------+------+----------+\n\t\t |VER | ULEN | UNAME | PLEN | PASSWD |\n\t\t +----+------+----------+------+----------+\n\t\t | 1 | 1 | 1 to 255 | 1 | 1 to 255 |\n\t\t +----+------+----------+------+----------+\n\t\t*/\n\t\tbuf = make([]byte, 1)\n\t\tbuf[0] = 1\n\t\tbuf = append(buf, byte(len(auth.user)))\n\t\tbuf = append(buf, []byte(auth.user)...)\n\t\tbuf = append(buf, byte(len(auth.password)))\n\t\tbuf = append(buf, []byte(auth.password)...)\n\t\t// write auth message to writer\n\t\t_, err = rConn.Write(buf)\n\t\tif err != nil {\n\t\t\tlogger.Warningf(\"[%s] auth request failed, err: %v\", handler.typ, err)\n\t\t\treturn err\n\t\t}\n\t\tbuf = make([]byte, 32)\n\t\t_, err = rConn.Read(buf)\n\t\tif err != nil {\n\t\t\tlogger.Warningf(\"[%s] auth response failed, err: %v\", handler.typ, err)\n\t\t\treturn err\n\t\t}\n\t\t// RFC1929 user/pass auth should return 1, but some sock5 return 5\n\t\tif buf[0] != 5 && buf[0] != 1 {\n\t\t\tlogger.Warningf(\"[%s] auth response incorrect code, code: %v\", handler.typ, buf[0])\n\t\t\treturn fmt.Errorf(\"incorrect sock5 auth response, code: %v\", buf[0])\n\t\t}\n\t\tlogger.Debugf(\"[%s] auth success, code: %v\", handler.typ, buf[0])\n\t}\n\t/*\n\t\t\tsock5 connect request\n\t\t +----+-----+-------+------+----------+----------+\n\t\t |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT |\n\t\t +----+-----+-------+------+----------+----------+\n\t\t | 1 | 1 | X'00' | 1 | Variable | 2 |\n\t\t +----+-----+-------+------+----------+----------+\n\t*/\n\t// start create tunnel\n\tbuf = make([]byte, 4)\n\tbuf[0] = 5\n\tbuf[1] = 1 // connect\n\tbuf[2] = 0 // reserved\n\t// add tcpAddr\n\tif tcpAddr.IP.To4() != nil {\n\t\tbuf[3] = 1\n\t\tbuf = append(buf, tcpAddr.IP.To4()...)\n\t} else if tcpAddr.IP.To16() != nil {\n\t\tbuf[3] = 4\n\t\tbuf = append(buf, tcpAddr.IP.To16()...)\n\t} else {\n\t\tbuf[3] = 3\n\t\tbuf = append(buf, tcpAddr.IP...)\n\t}\n\t// convert port 2 byte\n\tportU := uint16(tcpAddr.Port)\n\tif portU == 0 {\n\t\tportU = 80\n\t}\n\tport := make([]byte, 2)\n\tbinary.BigEndian.PutUint16(port, portU)\n\tbuf = append(buf, port...)\n\t// request proxy connect rConn server\n\tlogger.Debugf(\"[%s] send connect request, buf: %v\", handler.typ, buf)\n\t_, err = rConn.Write(buf)\n\tif err != nil {\n\t\tlogger.Warningf(\"[%s] send connect request failed, err: %v\", handler.typ, err)\n\t\treturn err\n\t}\n\tlogger.Debugf(\"[%s] request successfully\", handler.typ)\n\tbuf = make([]byte, 16)\n\t_, err = rConn.Read(buf)\n\tif err != nil {\n\t\tlogger.Warningf(\"[%s] connect response failed, err: %v\", handler.typ, err)\n\t\treturn err\n\t}\n\tlogger.Debugf(\"[%s] response successfully, buf: %v\", handler.typ, buf)\n\tif buf[0] != 5 || buf[1] != 0 {\n\t\tlogger.Warningf(\"[%s] connect response failed, version: %v, code: %v\", handler.typ, buf[0], buf[1])\n\t\treturn fmt.Errorf(\"incorrect sock5 connect reponse, version: %v, code: %v\", buf[0], buf[1])\n\t}\n\tlogger.Debugf(\"[%s] proxy: tunnel create success, [%s] -> [%s] -> [%s]\",\n\t\thandler.typ, handler.lAddr.String(), rConn.RemoteAddr(), handler.rAddr.String())\n\t// save rConn handler\n\thandler.rConn = rConn\n\treturn nil\n}", "title": "" }, { "docid": "25ac9756a3ac29b2698c2539db531a60", "score": "0.5852253", "text": "func Handshake(rw io.ReadWriter) (Addr, error) {\n\t// Read RFC 1928 for request and reply structure and sizes.\n\tbuf := make([]byte, MaxAddrLen)\n\t// read VER, NMETHODS, METHODS\n\tif _, err := io.ReadFull(rw, buf[:2]); err != nil {\n\t\treturn nil, err\n\t}\n\tnmethods := buf[1]\n\tif _, err := io.ReadFull(rw, buf[:nmethods]); err != nil {\n\t\treturn nil, err\n\t}\n\t// write VER METHOD\n\tif _, err := rw.Write([]byte{5, 0}); err != nil {\n\t\treturn nil, err\n\t}\n\t// read VER CMD RSV ATYP DST.ADDR DST.PORT\n\tif _, err := io.ReadFull(rw, buf[:3]); err != nil {\n\t\treturn nil, err\n\t}\n\tif buf[1] != CmdConnect {\n\t\treturn nil, ErrCommandNotSupported\n\t}\n\taddr, err := readAddr(rw, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// write VER REP RSV ATYP BND.ADDR BND.PORT\n\t_, err = rw.Write([]byte{5, 0, 0, 1, 0, 0, 0, 0, 0, 0})\n\treturn addr, err\n}", "title": "" }, { "docid": "99177fac46c4bde7f4c9efb0710cc7c5", "score": "0.5825207", "text": "func Version() string {\n\treturn \"socks5\"\n}", "title": "" }, { "docid": "4af0013f659dbe2f969c7256266b0a95", "score": "0.581645", "text": "func ReadMethod(reader io.Reader, protoVersion string) (Method, error) {\n\tclassID, err := ReadShort(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmethodID, err := ReadShort(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch classID {\n\n\tcase 10:\n\t\tswitch methodID {\n\n\t\tcase 10:\n\t\t\tvar method = &ConnectionStart{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 11:\n\t\t\tvar method = &ConnectionStartOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 20:\n\t\t\tvar method = &ConnectionSecure{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 21:\n\t\t\tvar method = &ConnectionSecureOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 30:\n\t\t\tvar method = &ConnectionTune{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 31:\n\t\t\tvar method = &ConnectionTuneOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 40:\n\t\t\tvar method = &ConnectionOpen{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 41:\n\t\t\tvar method = &ConnectionOpenOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 50:\n\t\t\tvar method = &ConnectionClose{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 51:\n\t\t\tvar method = &ConnectionCloseOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 60:\n\t\t\tvar method = &ConnectionBlocked{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 61:\n\t\t\tvar method = &ConnectionUnblocked{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\t}\n\tcase 20:\n\t\tswitch methodID {\n\n\t\tcase 10:\n\t\t\tvar method = &ChannelOpen{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 11:\n\t\t\tvar method = &ChannelOpenOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 20:\n\t\t\tvar method = &ChannelFlow{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 21:\n\t\t\tvar method = &ChannelFlowOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 40:\n\t\t\tvar method = &ChannelClose{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 41:\n\t\t\tvar method = &ChannelCloseOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\t}\n\tcase 40:\n\t\tswitch methodID {\n\n\t\tcase 10:\n\t\t\tvar method = &ExchangeDeclare{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 11:\n\t\t\tvar method = &ExchangeDeclareOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 20:\n\t\t\tvar method = &ExchangeDelete{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 21:\n\t\t\tvar method = &ExchangeDeleteOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 30:\n\t\t\tvar method = &ExchangeBind{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 31:\n\t\t\tvar method = &ExchangeBindOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 40:\n\t\t\tvar method = &ExchangeUnbind{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 51:\n\t\t\tvar method = &ExchangeUnbindOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\t}\n\tcase 50:\n\t\tswitch methodID {\n\n\t\tcase 10:\n\t\t\tvar method = &QueueDeclare{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 11:\n\t\t\tvar method = &QueueDeclareOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 20:\n\t\t\tvar method = &QueueBind{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 21:\n\t\t\tvar method = &QueueBindOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 50:\n\t\t\tvar method = &QueueUnbind{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 51:\n\t\t\tvar method = &QueueUnbindOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 30:\n\t\t\tvar method = &QueuePurge{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 31:\n\t\t\tvar method = &QueuePurgeOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 40:\n\t\t\tvar method = &QueueDelete{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 41:\n\t\t\tvar method = &QueueDeleteOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\t}\n\tcase 60:\n\t\tswitch methodID {\n\n\t\tcase 10:\n\t\t\tvar method = &BasicQos{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 11:\n\t\t\tvar method = &BasicQosOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 20:\n\t\t\tvar method = &BasicConsume{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 21:\n\t\t\tvar method = &BasicConsumeOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 30:\n\t\t\tvar method = &BasicCancel{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 31:\n\t\t\tvar method = &BasicCancelOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 40:\n\t\t\tvar method = &BasicPublish{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 50:\n\t\t\tvar method = &BasicReturn{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 60:\n\t\t\tvar method = &BasicDeliver{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 70:\n\t\t\tvar method = &BasicGet{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 71:\n\t\t\tvar method = &BasicGetOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 72:\n\t\t\tvar method = &BasicGetEmpty{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 80:\n\t\t\tvar method = &BasicAck{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 90:\n\t\t\tvar method = &BasicReject{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 100:\n\t\t\tvar method = &BasicRecoverAsync{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 110:\n\t\t\tvar method = &BasicRecover{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 111:\n\t\t\tvar method = &BasicRecoverOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 120:\n\t\t\tvar method = &BasicNack{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\t}\n\tcase 90:\n\t\tswitch methodID {\n\n\t\tcase 10:\n\t\t\tvar method = &TxSelect{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 11:\n\t\t\tvar method = &TxSelectOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 20:\n\t\t\tvar method = &TxCommit{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 21:\n\t\t\tvar method = &TxCommitOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 30:\n\t\t\tvar method = &TxRollback{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 31:\n\t\t\tvar method = &TxRollbackOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\t}\n\tcase 85:\n\t\tswitch methodID {\n\n\t\tcase 10:\n\t\t\tvar method = &ConfirmSelect{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\tcase 11:\n\t\t\tvar method = &ConfirmSelectOk{}\n\t\t\tif err := method.Read(reader, protoVersion); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn method, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"unknown classID and methodID: [%d. %d]\", classID, methodID)\n}", "title": "" }, { "docid": "90b30228da37e90edae292433d7a5e18", "score": "0.551869", "text": "func (method *ConnectionSecureOk) MethodIdentifier() uint16 {\n\treturn 21\n}", "title": "" }, { "docid": "62ef90e51d97c1b86ce6dd1af6a567c0", "score": "0.5392512", "text": "func handShakeFromWhareSharkBytes() {\n\n\t/************************************** ClientHelloSpec structure **************************************************\n\ttype ClientHelloSpec struct {\n\tCipherSuites []uint16 // nil => default\n\tCompressionMethods []uint8 // nil => no compression\n\tExtensions []TLSExtension // nil => no extensions\n\tTLSVersMin uint16 // [1.0-1.3] default: parse from .Extensions, if SupportedVersions ext is not present => 1.0\n\tTLSVersMax uint16 // [1.2-1.3] default: parse from .Extensions, if SupportedVersions ext is not present => 1.2\n\tGetSessionID func(ticket []byte) [32]byte\n\t}\t**********************************************************************************************************************/\n\n\tconfig := tls.Config{ServerName: hostname, MinVersion: tls.VersionTLS12}\n\n\tdialConn, err := net.DialTimeout(\"tcp\", addr, dialTimeout)\n\tif err != nil {\n\t\tfmt.Println(\"net.DialTimeout error: %+v\", err)\n\t}\n\n\t/* establish UClient of UTLS...*/\n\tuTlsConn := tls.UClient(dialConn, &config, tls.HelloCustom)\n\tdefer uTlsConn.Close()\n\n\t// make custom TLS generatedSpec from wireshark captured data.\n\tbyteString := []byte(\"1603010200010001fc03034243e7dc703824d08998cf9d85325252ee3e600879b05f6e23c0d8812209611d20748229aa4d73af238a22efb6d3ee045f6febd8819edbc2a1ad6b20a0bc4d373c0022130113021303c02cc02bc024c023c00ac009cca9c030c02fc028c027c014c013cca801000191ff010001000000001700150000126170692d70726f642e6c6f7765732e636f6d00170000000d0018001604030804040105030203080508050501080606010201000500050100000000001200000010000e000c02683208687474702f312e31000b00020100003300260024001d002062dcea24a887376e333d5bc6c6a1ae2eda1309e8458942a246feccde1aeed370002d00020101002b00050403040303000a000a0008001d001700180019001500e1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\")\n\thelloBytes := make([]byte, hex.DecodedLen(len(byteString)))\n\t_, err = hex.Decode(helloBytes, byteString)\n\tif err != nil {\n\t\tfmt.Println(\"Hex Decode error..........\")\n\t}\n\n\t/* establish UClient of UTLS...*/\n\n\tf := &tls.Fingerprinter{}\n\tgeneratedSpec, err := f.FingerprintClientHello(helloBytes)\n\n\t/* confirm genericSpec... */\n\terr = uTlsConn.ApplyPreset(generatedSpec)\n\n\tif err != nil {\n\t\tfmt.Println(\"uTlsConn.Handshake() ApplyPreset: %+v\", err)\n\t}\n\n\t// Handshake runs the client handshake using given clientHandshakeState\n\t// Requires hs.hello, and, optionally, hs.session to be set.\n\n\terr = uTlsConn.Handshake()\n\tif err != nil {\n\t\tfmt.Println(\"uTlsConn.Handshake() Handshake: %+v\", err)\n\t}\n\n\tfmt.Println(\"............. UTLS HandShake is completed Successfully ..........\")\n\n}", "title": "" }, { "docid": "010bbd5498f1ea808d8b898f835a39f8", "score": "0.5380622", "text": "func (conn *Conn) Version(t string) { conn.Ctcp(t, VERSION) }", "title": "" }, { "docid": "05e804f95ce27092b0b7112195d26aa3", "score": "0.5334479", "text": "func (cl *Client) handshake() (rest []byte, err error) {\n\tvar (\n\t\tlogp = `handshake`\n\t\tpath string = cl.remoteURL.EscapedPath()\n\t\tkey []byte = generateHandshakeKey()\n\t\tkeyAccept string = generateHandshakeAccept(key)\n\n\t\tbb bytes.Buffer\n\t\treq []byte\n\t)\n\tif len(path) == 0 {\n\t\tpath = \"/\"\n\t}\n\n\tif len(cl.remoteURL.RawQuery) > 0 {\n\t\tpath += \"?\" + cl.remoteURL.RawQuery\n\t}\n\n\t_, err = fmt.Fprintf(&bb, _handshakeReqFormat, path, cl.remoteURL.Host, key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(`%s: %w`, logp, err)\n\t}\n\n\tif len(cl.Headers) > 0 {\n\t\terr = cl.Headers.Write(&bb)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(`%s: %w`, logp, err)\n\t\t}\n\t}\n\n\tbb.WriteString(\"\\r\\n\")\n\treq = bb.Bytes()\n\n\trest, err = cl.doHandshake(keyAccept, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(`%s: %w`, logp, err)\n\t}\n\n\treturn rest, nil\n}", "title": "" }, { "docid": "2bda63b9889ba1f2e06e99276564e1b8", "score": "0.5313738", "text": "func (r *MySQLHandshake) version() string {\n\treturn string(r.packet[VERSION_OFFSET : VERSION_OFFSET+r.version_length])\n}", "title": "" }, { "docid": "9afe09878548513e6dc3873ff6c01a0a", "score": "0.5306102", "text": "func (c *Conn) readHandshake() (interface{}, error) {\n\terr := c.readRecord(c.in.encryptionLevel, 4)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata := c.rawInput\n\tn := int(data[1])<<16 | int(data[2])<<8 | int(data[3])\n\tif n > maxHandshake {\n\t\tc.sendAlert(alertInternalError)\n\t\treturn nil, fmt.Errorf(\"tls: handshake message of length %d bytes exceeds maximum of %d bytes\", n, maxHandshake)\n\t}\n\terr = c.readRecord(c.in.encryptionLevel, 4+n)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata = c.rawInput\n\tvar m handshakeMessage\n\tswitch data[0] {\n\tcase typeHelloRequest:\n\t\tm = new(helloRequestMsg)\n\tcase typeClientHello:\n\t\tm = new(clientHelloMsg)\n\tcase typeServerHello:\n\t\tm = new(serverHelloMsg)\n\tcase typeNewSessionTicket:\n\t\tm = new(newSessionTicketMsgTLS13)\n\tcase typeCertificate:\n\t\tm = new(certificateMsgTLS13)\n\tcase typeCertificateRequest:\n\t\tm = new(certificateRequestMsgTLS13)\n\tcase typeCertificateStatus:\n\t\tm = new(certificateStatusMsg)\n\tcase typeServerKeyExchange:\n\t\tm = new(serverKeyExchangeMsg)\n\tcase typeServerHelloDone:\n\t\tm = new(serverHelloDoneMsg)\n\tcase typeClientKeyExchange:\n\t\tm = new(clientKeyExchangeMsg)\n\tcase typeCertificateVerify:\n\t\tm = &certificateVerifyMsg{\n\t\t\thasSignatureAlgorithm: c.vers >= tls.VersionTLS12,\n\t\t}\n\tcase typeFinished:\n\t\tm = new(finishedMsg)\n\tcase typeEncryptedExtensions:\n\t\tm = new(encryptedExtensionsMsg)\n\tcase typeEndOfEarlyData:\n\t\tm = new(endOfEarlyDataMsg)\n\tcase typeKeyUpdate:\n\t\tm = new(keyUpdateMsg)\n\tdefault:\n\t\tc.sendAlert(alertUnexpectedMessage)\n\t\treturn nil, fmt.Errorf(\"tls: unsupported handshake message %d\", data[0])\n\t}\n\n\tdata = make([]byte, len(c.rawInput))\n\tcopy(data, c.rawInput)\n\tc.rawInput = c.rawInput[:0]\n\tif !m.unmarshal(data) {\n\t\tc.sendAlert(alertUnexpectedMessage)\n\t\treturn nil, fmt.Errorf(\"tls: could not parse message %d\", data[0])\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "8c4f8df3d4045c2e9e2312ff4577613b", "score": "0.52917093", "text": "func (ln *SocksListener) Version() string {\n\treturn \"socks4\"\n}", "title": "" }, { "docid": "22b9f1dde05fc004c8d79caecb66380e", "score": "0.5285957", "text": "func (c *Client) Invoke(method string, params ...interface{}) (interface{}, error) {\n\treqURL := c.Host + c.URL\n\tr := &hessianRequest{}\n\tr.packHead(method)\n\tfor _, v := range params {\n\t\tr.packParam(v)\n\t}\n\tr.packEnd()\n\n\tresp, err := httpPost(reqURL, bytes.NewReader(r.body))\n\tif err != nil {\n\t\tfmt.Println(\"got hessian service response failed:\", err)\n\t\treturn nil, err\n\t}\n\tfmt.Println(\"got hessian service response success\")\n\n\tif len(resp) == 0 {\n\t\treturn nil, errors.New(\"method or params error, resp is null\")\n\t}\n\n\th := NewHessian(bytes.NewReader(resp))\n\tv, err := h.Parse()\n\n\tif err != nil {\n\t\tfmt.Println(\"hessian parse error\", err)\n\t\treturn nil, err\n\t}\n\n\tc.replyMap = v\n\treturn v, nil\n}", "title": "" }, { "docid": "fb11345140314fd6959a8a519faa9070", "score": "0.5257606", "text": "func (c *Client) Version() { return }", "title": "" }, { "docid": "c0eb0716c641a993a32de46658854449", "score": "0.52414614", "text": "func TestHandshakeV5(t *testing.T) {\n\tt.Parallel()\n\tnet := newHandshakeTest()\n\tdefer net.close()\n\n\t// A -> B RANDOM PACKET\n\tpacket, _ := net.nodeA.encode(t, net.nodeB, &findnodeV5{})\n\tresp := net.nodeB.expectDecode(t, p_unknownV5, packet)\n\n\t// A <- B WHOAREYOU\n\tchallenge := &whoareyouV5{\n\t\tAuthTag: resp.(*unknownV5).AuthTag,\n\t\tIDNonce: testIDnonce,\n\t\tRecordSeq: 0,\n\t}\n\twhoareyou, _ := net.nodeB.encode(t, net.nodeA, challenge)\n\tnet.nodeA.expectDecode(t, p_whoareyouV5, whoareyou)\n\n\t// A -> B FINDNODE\n\tfindnode, _ := net.nodeA.encodeWithChallenge(t, net.nodeB, challenge, &findnodeV5{})\n\tnet.nodeB.expectDecode(t, p_findnodeV5, findnode)\n\tif len(net.nodeB.c.sc.handshakes) > 0 {\n\t\tt.Fatalf(\"node B didn't remove handshake from challenge map\")\n\t}\n\n\t// A <- B NODES\n\tnodes, _ := net.nodeB.encode(t, net.nodeA, &nodesV5{Total: 1})\n\tnet.nodeA.expectDecode(t, p_nodesV5, nodes)\n}", "title": "" }, { "docid": "f6459d9962882855d463930701c8d6bf", "score": "0.52400154", "text": "func Handshake(num uint) []string {\n\tvar bases = []uint{1, 2, 4, 8}\n\tvar events []string\n\tfor _, k := range bases {\n\t\tif num&k == k && num&k != reverseCommand {\n\t\t\tevents = append(events, codes[k])\n\t\t}\n\t}\n\tif num&reverseCommand == reverseCommand {\n\t\treturn reverse(events)\n\t}\n\treturn events\n}", "title": "" }, { "docid": "e82ab68cda6716315683a2ac83c04a45", "score": "0.5227992", "text": "func TestVersion(t *testing.T) {\n\tpver := ProtocolVersion\n\n\t// Create version message data.\n\tlastBlock := int32(234234)\n\ttcpAddrMe := &net.TCPAddr{IP: net.ParseIP(\"127.0.0.1\"), Port: 8333}\n\tme := NewNetAddress(tcpAddrMe, SFNodeNetwork)\n\ttcpAddrYou := &net.TCPAddr{IP: net.ParseIP(\"192.168.0.1\"), Port: 8333}\n\tyou := NewNetAddress(tcpAddrYou, SFNodeNetwork)\n\tnonce, err := RandomUint64()\n\tif err != nil {\n\t\tt.Errorf(\"RandomUint64: error generating nonce: %v\", err)\n\t}\n\n\t// Ensure we get the correct data back out.\n\tmsg := NewMsgVersion(me, you, nonce, lastBlock)\n\tif msg.ProtocolVersion != int32(pver) {\n\t\tt.Errorf(\"NewMsgVersion: wrong protocol version - got %v, want %v\",\n\t\t\tmsg.ProtocolVersion, pver)\n\t}\n\tif !reflect.DeepEqual(&msg.AddrMe, me) {\n\t\tt.Errorf(\"NewMsgVersion: wrong me address - got %v, want %v\",\n\t\t\tspew.Sdump(&msg.AddrMe), spew.Sdump(me))\n\t}\n\tif !reflect.DeepEqual(&msg.AddrYou, you) {\n\t\tt.Errorf(\"NewMsgVersion: wrong you address - got %v, want %v\",\n\t\t\tspew.Sdump(&msg.AddrYou), spew.Sdump(you))\n\t}\n\tif msg.Nonce != nonce {\n\t\tt.Errorf(\"NewMsgVersion: wrong nonce - got %v, want %v\",\n\t\t\tmsg.Nonce, nonce)\n\t}\n\tif msg.UserAgent != DefaultUserAgent {\n\t\tt.Errorf(\"NewMsgVersion: wrong user agent - got %v, want %v\",\n\t\t\tmsg.UserAgent, DefaultUserAgent)\n\t}\n\tif msg.LastBlock != lastBlock {\n\t\tt.Errorf(\"NewMsgVersion: wrong last block - got %v, want %v\",\n\t\t\tmsg.LastBlock, lastBlock)\n\t}\n\tif msg.DisableRelayTx {\n\t\tt.Errorf(\"NewMsgVersion: disable relay tx is not false by \"+\n\t\t\t\"default - got %v, want %v\", msg.DisableRelayTx, false)\n\t}\n\n\tmsg.AddUserAgent(\"myclient\", \"1.2.3\", \"optional\", \"comments\")\n\tcustomUserAgent := DefaultUserAgent + \"myclient:1.2.3(optional; comments)/\"\n\tif msg.UserAgent != customUserAgent {\n\t\tt.Errorf(\"AddUserAgent: wrong user agent - got %s, want %s\",\n\t\t\tmsg.UserAgent, customUserAgent)\n\t}\n\n\tmsg.AddUserAgent(\"mygui\", \"3.4.5\")\n\tcustomUserAgent += \"mygui:3.4.5/\"\n\tif msg.UserAgent != customUserAgent {\n\t\tt.Errorf(\"AddUserAgent: wrong user agent - got %s, want %s\",\n\t\t\tmsg.UserAgent, customUserAgent)\n\t}\n\n\t// accounting for \":\", \"/\"\n\terr = msg.AddUserAgent(strings.Repeat(\"t\",\n\t\tMaxUserAgentLen-len(customUserAgent)-2+1), \"\")\n\tif _, ok := err.(*MessageError); !ok {\n\t\tt.Errorf(\"AddUserAgent: expected error not received \"+\n\t\t\t\"- got %v, want %T\", err, MessageError{})\n\n\t}\n\n\t// Version message should not have any services set by default.\n\tif msg.Services != 0 {\n\t\tt.Errorf(\"NewMsgVersion: wrong default services - got %v, want %v\",\n\t\t\tmsg.Services, 0)\n\n\t}\n\tif msg.HasService(SFNodeNetwork) {\n\t\tt.Errorf(\"HasService: SFNodeNetwork service is set\")\n\t}\n\n\t// Ensure the command is expected value.\n\twantCmd := \"version\"\n\tif cmd := msg.Command(); cmd != wantCmd {\n\t\tt.Errorf(\"NewMsgVersion: wrong command - got %v want %v\",\n\t\t\tcmd, wantCmd)\n\t}\n\n\t// Ensure max payload is expected value.\n\t// Protocol version 4 bytes + services 8 bytes + timestamp 8 bytes +\n\t// remote and local net addresses + nonce 8 bytes + length of user agent\n\t// (varInt) + max allowed user agent length + last block 4 bytes +\n\t// relay transactions flag 1 byte.\n\twantPayload := uint32(358)\n\tmaxPayload := msg.MaxPayloadLength(pver)\n\tif maxPayload != wantPayload {\n\t\tt.Errorf(\"MaxPayloadLength: wrong max payload length for \"+\n\t\t\t\"protocol version %d - got %v, want %v\", pver,\n\t\t\tmaxPayload, wantPayload)\n\t}\n\n\t// Ensure adding the full service node flag works.\n\tmsg.AddService(SFNodeNetwork)\n\tif msg.Services != SFNodeNetwork {\n\t\tt.Errorf(\"AddService: wrong services - got %v, want %v\",\n\t\t\tmsg.Services, SFNodeNetwork)\n\t}\n\tif !msg.HasService(SFNodeNetwork) {\n\t\tt.Errorf(\"HasService: SFNodeNetwork service not set\")\n\t}\n}", "title": "" }, { "docid": "6d59cadb195b63753562354abf91d141", "score": "0.52267927", "text": "func queryVersionReply(buf []byte) *QueryVersionReply {\n\tv := new(QueryVersionReply)\n\tb := 1 // skip reply determinant\n\n\tb += 1 // padding\n\n\tv.Sequence = xgb.Get16(buf[b:])\n\tb += 2\n\n\tv.Length = xgb.Get32(buf[b:]) // 4-byte units\n\tb += 4\n\n\tv.MajorVersion = xgb.Get16(buf[b:])\n\tb += 2\n\n\tv.MinorVersion = xgb.Get16(buf[b:])\n\tb += 2\n\n\treturn v\n}", "title": "" }, { "docid": "613bd384d022f54e067f423051d23601", "score": "0.5224181", "text": "func ReceiveVersion(context HandleHandshakeContext, incomingRoute *router.Route, outgoingRoute *router.Route,\n\tpeer *peerpkg.Peer) (*appmessage.NetAddress, error) {\n\n\tflow := &receiveVersionFlow{\n\t\tHandleHandshakeContext: context,\n\t\tincomingRoute: incomingRoute,\n\t\toutgoingRoute: outgoingRoute,\n\t\tpeer: peer,\n\t}\n\n\treturn flow.start()\n}", "title": "" }, { "docid": "286475fc02fb51f4a6427acade9bffa2", "score": "0.5208271", "text": "func TestHandshakeProtocolVerbose(t *testing.T) {\n\ttestHandshakeProtocol(t, true)\n}", "title": "" }, { "docid": "b38ca01433bd2dd854b4eac3ab27f2d9", "score": "0.5195367", "text": "func (method *ConnectionSecure) MethodIdentifier() uint16 {\n\treturn 20\n}", "title": "" }, { "docid": "98492dbf2e303a4954d2c3cdb08e3c17", "score": "0.5186371", "text": "func (p *conn) handshake() error {\n\tvar err error\n\n\th := connHeader{S: 'S', P: 'P', Proto: p.proto.Number()}\n\tif err = binary.Write(p.c, binary.BigEndian, &h); err != nil {\n\t\treturn err\n\t}\n\tif err = binary.Read(p.c, binary.BigEndian, &h); err != nil {\n\t\tp.c.Close()\n\t\treturn err\n\t}\n\tif h.Zero != 0 || h.S != 'S' || h.P != 'P' || h.Rsvd != 0 {\n\t\tp.c.Close()\n\t\treturn ErrBadHeader\n\t}\n\t// The only version number we support at present is \"0\", at offset 3.\n\tif h.Version != 0 {\n\t\tp.c.Close()\n\t\treturn ErrBadVersion\n\t}\n\n\t// The protocol number lives as 16-bits (big-endian) at offset 4.\n\tif h.Proto != p.proto.PeerNumber() {\n\t\tp.c.Close()\n\t\treturn ErrBadProto\n\t}\n\tp.open = true\n\treturn nil\n}", "title": "" }, { "docid": "be59abe0b150c42271e0113b49d11857", "score": "0.5168109", "text": "func (s *Stream) Handshake(config *Config) error {\n\t// Get protocol / connection ID\n\tselectArg := config.ConnectionID\n\tif len(selectArg) == 0 {\n\t\tselectArg = config.Protocol\n\t}\n\n\t// Send requested protocol or connection ID\n\t_, err := s.Write(NewInstruction(\"select\", selectArg).Byte())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Wait for server Args\n\targs, err := s.AssertOpcode(\"args\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Build Args list off provided names and config\n\targNameS := args.Args\n\targValueS := make([]string, 0, len(argNameS))\n\tfor _, argName := range argNameS {\n\n\t\t// Retrieve argument name\n\n\t\t// Get defined value for name\n\t\tvalue := config.Parameters[argName]\n\n\t\t// If value defined, set that value\n\t\tif len(value) == 0 {\n\t\t\tvalue = \"\"\n\t\t}\n\t\targValueS = append(argValueS, value)\n\t}\n\n\t// Send size\n\t_, err = s.Write(NewInstruction(\"size\",\n\t\tfmt.Sprintf(\"%v\", config.OptimalScreenWidth),\n\t\tfmt.Sprintf(\"%v\", config.OptimalScreenHeight),\n\t\tfmt.Sprintf(\"%v\", config.OptimalResolution)).Byte(),\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Send supported audio formats\n\t_, err = s.Write(NewInstruction(\"audio\", config.AudioMimetypes...).Byte())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Send supported video formats\n\t_, err = s.Write(NewInstruction(\"video\", config.VideoMimetypes...).Byte())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Send supported image formats\n\t_, err = s.Write(NewInstruction(\"image\", config.ImageMimetypes...).Byte())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Send Args\n\t_, err = s.Write(NewInstruction(\"connect\", argValueS...).Byte())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Wait for ready, store ID\n\tready, err := s.AssertOpcode(\"ready\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treadyArgs := ready.Args\n\tif len(readyArgs) == 0 {\n\t\terr = ErrServer.NewError(\"No connection ID received\")\n\t\treturn err\n\t}\n\n\ts.Flush()\n\ts.ConnectionID = readyArgs[0]\n\n\treturn nil\n}", "title": "" }, { "docid": "b133301dad9d30b6296ac13445f6a007", "score": "0.5144001", "text": "func (method *ConnectionStartOk) MethodIdentifier() uint16 {\n\treturn 11\n}", "title": "" }, { "docid": "91664c42350f2171eef7988184f8e1d3", "score": "0.51361483", "text": "func (c *Controller) ProtocolInfo() ([]string, string, string, error) {\n\t// We'll start off by sending the \"PROTOCOLINFO\" command to the Tor\n\t// server. We should receive a reply of the following format:\n\t//\n\t//\tMETHODS=COOKIE,SAFECOOKIE\n\t//\tCOOKIEFILE=\"/home/user/.tor/control_auth_cookie\"\n\t//\tVERSION Tor=\"0.3.2.10\"\n\t//\n\t// We're interested in retrieving all of these fields, so we'll parse\n\t// our reply to do so.\n\tcmd := fmt.Sprintf(\"PROTOCOLINFO %d\", ProtocolInfoVersion)\n\t_, reply, err := c.sendCommand(cmd)\n\tif err != nil {\n\t\treturn nil, \"\", \"\", err\n\t}\n\n\tinfo := parseTorReply(reply)\n\tmethods, ok := info[\"METHODS\"]\n\tif !ok {\n\t\treturn nil, \"\", \"\", errors.New(\"auth methods not found in \" +\n\t\t\t\"reply\")\n\t}\n\n\tcookieFile, ok := info[\"COOKIEFILE\"]\n\tif !ok {\n\t\treturn nil, \"\", \"\", errors.New(\"cookie file path not found \" +\n\t\t\t\"in reply\")\n\t}\n\n\tversion, ok := info[\"Tor\"]\n\tif !ok {\n\t\treturn nil, \"\", \"\", errors.New(\"Tor version not found in reply\")\n\t}\n\n\t// Finally, we'll clean up the results before returning them.\n\tauthMethods := strings.Split(methods, \",\")\n\tcookieFilePath := strings.Trim(cookieFile, \"\\\"\")\n\ttorVersion := strings.Trim(version, \"\\\"\")\n\n\treturn authMethods, cookieFilePath, torVersion, nil\n}", "title": "" }, { "docid": "a7208c680dfda2f5b03101aa44bdde25", "score": "0.51242864", "text": "func (method *ConnectionSecureOk) Read(reader io.Reader, protoVersion string) (err error) {\n\n\tmethod.Response, err = ReadLongstr(reader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "85a0736393aad85cccd07b2b35b71d61", "score": "0.51161987", "text": "func (sc *Server) handshake() error {\n\n\terr := sc.one()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif sc.encryption {\n\t\terr = sc.startEncryption()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = sc.msgLength()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "4bf851b1191e644cfeb8c92ce092bd82", "score": "0.50711507", "text": "func (h *Channel) InvokeMethod(ctx context.Context, req *invokev1.InvokeMethodRequest, appID string) (*invokev1.InvokeMethodResponse, error) {\n\t// Check if HTTP Extension is given. Otherwise, it will return error.\n\thttpExt := req.Message().GetHttpExtension()\n\tif httpExt == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"missing HTTP extension field\")\n\t}\n\t// Go's net/http library does not support sending requests with the CONNECT method\n\tif httpExt.Verb == commonv1pb.HTTPExtension_NONE || httpExt.Verb == commonv1pb.HTTPExtension_CONNECT { //nolint:nosnakecase\n\t\treturn nil, status.Error(codes.InvalidArgument, \"invalid HTTP verb\")\n\t}\n\n\t// If the request is for an internal endpoint, do not allow it if the app health status is not successful\n\tif h.baseAddress != \"\" && appID == \"\" && h.appHealth != nil && h.appHealth.GetStatus() != apphealth.AppStatusHealthy {\n\t\treturn nil, status.Error(codes.Internal, messages.ErrAppUnhealthy)\n\t}\n\n\tswitch req.APIVersion() {\n\tcase internalv1pb.APIVersion_V1: //nolint:nosnakecase\n\t\treturn h.invokeMethodV1(ctx, req, appID)\n\t}\n\n\t// Reject unsupported version\n\treturn nil, status.Error(codes.Unimplemented, fmt.Sprintf(\"Unsupported spec version: %d\", req.APIVersion()))\n}", "title": "" }, { "docid": "5e10168802c60d2ed17b5850e3010223", "score": "0.50697523", "text": "func Handshake(sock io.ReadWriter, msg HandshakeMsg) (ret HandshakeMsg, err error) {\n\tvar read bool\n\tif msg.InfoHash.IsZero() {\n\t\tif err = getPeerHandshakeMsg(sock, &ret); err != nil {\n\t\t\treturn\n\t\t}\n\t\tread = true\n\t\tmsg.InfoHash = ret.InfoHash\n\t}\n\n\tif _, err = io.WriteString(sock, ProtocolHeader); err != nil {\n\t\treturn\n\t}\n\tif _, err = sock.Write(msg.ExtensionBits[:]); err != nil {\n\t\treturn\n\t}\n\tif _, err = sock.Write(msg.InfoHash[:]); err != nil {\n\t\treturn\n\t}\n\tif _, err = sock.Write(msg.PeerID[:]); err != nil {\n\t\treturn\n\t}\n\n\tif !read {\n\t\terr = getPeerHandshakeMsg(sock, &ret)\n\t}\n\treturn\n}", "title": "" }, { "docid": "52d07e7c85a78aeb5a2afd4dfc677fea", "score": "0.50696975", "text": "func (method *ConnectionTuneOk) MethodIdentifier() uint16 {\n\treturn 31\n}", "title": "" }, { "docid": "40d7b20208131f16ab09560932254f9d", "score": "0.50643224", "text": "func TestHandshakeV5_norecord(t *testing.T) {\n\tt.Parallel()\n\tnet := newHandshakeTest()\n\tdefer net.close()\n\n\t// A -> B RANDOM PACKET\n\tpacket, _ := net.nodeA.encode(t, net.nodeB, &findnodeV5{})\n\tresp := net.nodeB.expectDecode(t, p_unknownV5, packet)\n\n\t// A <- B WHOAREYOU\n\tnodeA := net.nodeA.n()\n\tif nodeA.Seq() == 0 {\n\t\tt.Fatal(\"need non-zero sequence number\")\n\t}\n\tchallenge := &whoareyouV5{\n\t\tAuthTag: resp.(*unknownV5).AuthTag,\n\t\tIDNonce: testIDnonce,\n\t\tRecordSeq: nodeA.Seq(),\n\t\tnode: nodeA,\n\t}\n\twhoareyou, _ := net.nodeB.encode(t, net.nodeA, challenge)\n\tnet.nodeA.expectDecode(t, p_whoareyouV5, whoareyou)\n\n\t// A -> B FINDNODE\n\tfindnode, _ := net.nodeA.encodeWithChallenge(t, net.nodeB, challenge, &findnodeV5{})\n\tnet.nodeB.expectDecode(t, p_findnodeV5, findnode)\n\n\t// A <- B NODES\n\tnodes, _ := net.nodeB.encode(t, net.nodeA, &nodesV5{Total: 1})\n\tnet.nodeA.expectDecode(t, p_nodesV5, nodes)\n}", "title": "" }, { "docid": "d086e28e98cc3821ec22c5483085061d", "score": "0.506286", "text": "func TestServerWrongVersionNumber(t *testing.T) {\n\n\tsc := &Server{\n\t\tname: \"test6\",\n\t\tstatus: NotConnected,\n\t\trecieved: make(chan *Message),\n\t}\n\n\tgo func() {\n\n\t\t//var pipeBase = `\\\\.\\pipe\\`\n\n\t\t//listen, err := winio.ListenPipe(pipeBase+sc.name, nil)\n\t\t//if err != nil {\n\n\t\t//\treturn err\n\t\t//}\n\n\t\t//sc.listen = listen\n\n\t\tbase := \"/tmp/\"\n\t\tsock := \".sock\"\n\n\t\tos.RemoveAll(base + sc.name + sock)\n\n\t\tsc.listen, _ = net.Listen(\"unix\", base+sc.name+sock)\n\n\t\tconn, _ := sc.listen.Accept()\n\t\tsc.conn = conn\n\n\t\tbuff := make([]byte, 2)\n\n\t\tbuff[0] = byte(8)\n\n\t\tbuff[1] = byte(0)\n\n\t\t_, err := sc.conn.Write(buff)\n\t\tif err != nil {\n\t\t\t//return errors.New(\"unable to send handshake \")\n\t\t}\n\n\t\t_, _, err4 := sc.Read()\n\t\tif err4 == nil {\n\t\t\tt.Error(\"Should have server sent wrong version number\")\n\t\t}\n\n\t}()\n\n\ttime.Sleep(time.Second)\n\n\tcc, err := StartClient(\"test6\", nil)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t_, _, err3 := cc.Read()\n\tif err3.Error() != \"server has sent a different version number\" {\n\t\tt.Error(\"Should have wrong version number\")\n\t}\n\n}", "title": "" }, { "docid": "ce8a398a41580ed35faeddc6256dd7ec", "score": "0.50600123", "text": "func (method *BasicQosOk) MethodIdentifier() uint16 {\n\treturn 11\n}", "title": "" }, { "docid": "8130eb21c54cd9f404b9595cdb5c335b", "score": "0.505024", "text": "func Socks5ClientAuth(c conf.OutBound, server net.Conn) bool {\n\tb := make([]byte, 0)\n\tvar r [1024]byte\n\tb = append(b, 0x01)\n\ttu, tp := getOutAuth(c)\n\tuser := []byte(tu)\n\tnu := byte(len(user))\n\tpass := []byte(tp)\n\tnp := byte(len(pass))\n\tb = append(b, nu)\n\tb = append(b, user...)\n\tb = append(b, np)\n\tb = append(b, pass...)\n\n\tserver.Write(b)\n\t_, err := server.Read(r[:])\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn false\n\t}\n\n\tif r[0] != 0x01 {\n\t\tlog.Println(\"Socks Client:Cannot read auth response\")\n\t\treturn false\n\t}\n\n\tif r[1] == 0x01 {\n\t\tlog.Println(\"Socks Client: Username or password error\")\n\t\treturn false\n\t}\n\n\tif r[1] == 0x00 {\n\t\treturn true\n\t}\n\tlog.Println(\"Socks Client: Cannot read auth response\")\n\treturn false\n}", "title": "" }, { "docid": "0741b4c0436bf9ade43d6ffd0856481f", "score": "0.5033255", "text": "func NewHand() (bytes.Buffer, error) {\n\tvar b bytes.Buffer\n\t// Protocol version (u32).\n\tif err := binary.Write(&b, binary.BigEndian, ProtocolVersion1); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// Capabilities (u32).\n\tif err := binary.Write(&b, binary.BigEndian, uint32(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// Nonce (u64).\n\tif err := binary.Write(&b, binary.BigEndian, uint64(1)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// Total difficulty (u64).\n\tif err := binary.Write(&b, binary.BigEndian, uint64(1)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// Sender address.\n\t// Leading zero because this is IP v4.\n\tif err := binary.Write(&b, binary.BigEndian, uint8(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// Sender IP v4 in the next 4 parts.\n\tif err := binary.Write(&b, binary.BigEndian, uint8(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\n\t}\n\tif err := binary.Write(&b, binary.BigEndian, uint8(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\tif err := binary.Write(&b, binary.BigEndian, uint8(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\tif err := binary.Write(&b, binary.BigEndian, uint8(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// Sender port.\n\tif err := binary.Write(&b, binary.BigEndian, uint16(13414)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// Receiver address.\n\t// Leading zero because this is IP v4.\n\tif err := binary.Write(&b, binary.BigEndian, uint8(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// IP v4 in the next 4 parts.\n\tif err := binary.Write(&b, binary.BigEndian, uint8(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\tif err := binary.Write(&b, binary.BigEndian, uint8(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\tif err := binary.Write(&b, binary.BigEndian, uint8(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\tif err := binary.Write(&b, binary.BigEndian, uint8(0)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// Receiver port.\n\tif err := binary.Write(&b, binary.BigEndian, uint16(13414)); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// User agent.\n\t// First we need to send the length.\n\tua := []byte(userAgent)\n\tif err := binary.Write(&b, binary.BigEndian, uint64(len(ua))); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// Now send the user agent.\n\tif err := binary.Write(&b, binary.BigEndian, ua); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\t// Genesis hash for test network 2.\n\tgen := [32]uint8{51, 70, 246, 60, 245, 178, 94, 20, 173, 221, 136, 85, 226, 117, 87, 132, 229, 94, 97, 44, 213, 133, 97, 200, 202, 24, 215, 207, 108, 168, 111, 75}\n\tif err := binary.Write(&b, binary.BigEndian, gen); err != nil {\n\t\treturn bytes.Buffer{}, err\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "4dda5a010861176adef6cb6d944968b1", "score": "0.50319594", "text": "func (c *Client) Version() (vers map[string]string, err error) {\n\t// Variants: Version\n\t// Request : MUST NOT key, value, extras\n\t// Response: MUST NOT key, extras; MUST value\n\n\t// value is the version as a string in form \"X.Y.Z\"\n\tm := &msg{\n\t\theader: header{\n\t\t\tOp: opVersion,\n\t\t},\n\t}\n\n\tvers = make(map[string]string)\n\tfor _, s := range c.servers {\n\t\tif s.isAlive {\n\t\t\tvar ms msg = *m\n\t\t\terr = s.perform(&ms)\n\t\t\tif err == nil {\n\t\t\t\tvers[s.address] = ms.val\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0fb36fb8a85a64e3148db716f91dce6f", "score": "0.50281304", "text": "func (deb *DeveloperDebora) handshake(w http.ResponseWriter, r *http.Request) {\n\tlogger.Println(\"Received handshake request from\", r.RemoteAddr)\n\t// read the request, unmarshal json\n\tcipherText, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tplainText, err := Decrypt(deb.priv, cipherText)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// the plainText is the nonce\n\t// we sign it with itself\n\tmac := SignMAC(plainText, plainText)\n\tw.Write(mac)\n}", "title": "" }, { "docid": "9ccc21c12348a51f8be95c4761cc69cb", "score": "0.50233936", "text": "func (method *BasicAck) MethodIdentifier() uint16 {\n\treturn 80\n}", "title": "" }, { "docid": "b62d53af49f4f88cdaaffb2e605906d6", "score": "0.5019115", "text": "func (cc *Client) handshake() error {\n\n\terr := cc.one()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif cc.encryption {\n\t\terr := cc.startEncryption()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = cc.msgLength()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "d1a057a27c42c4e0ad6376b530e66571", "score": "0.5013152", "text": "func suitableMethods(typ reflect.Type, sname string, reportErr bool) map[string]*methodType {\n\tmethods := make(map[string]*methodType)\n\tfor m := 0; m < typ.NumMethod(); m++ {\n\t\tmethod := typ.Method(m)\n\t\tmtype := method.Type\n\t\tmname := sname +\".\"+ method.Name\n\t\t// Discard OnHandshake/OnConnect/OnDisconnect events\n\t\tif method.Name == \"OnHandshake\" || method.Name == \"OnConnect\" || method.Name == \"OnDisconnect\" {\n\t\t\tcontinue\n\t\t}\n\t\t// Method must be exported.\n\t\tif method.PkgPath != \"\" {\n\t\t\tcontinue\n\t\t}\n\t\t// Method needs three ins: receiver, *Conn, *args, *reply.\n\t\tif mtype.NumIn() != 4 {\n\t\t\tif reportErr {\n\t\t\t\tlog.Println(\"[ERROR] method\", mname, \"has wrong number of ins:\", mtype.NumIn())\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// First arg need not be a pointer.\n\t\tif connType := mtype.In(1); connType.Kind() != reflect.Ptr || connType.Elem() != typeOfConn {\n\t\t\tif reportErr {\n\t\t\t\tlog.Println(\"[ERROR]\", mname, \"first argument must be *wsrpc.Conn type, not:\", connType)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// Second arg need not be a pointer.\n\t\targType := mtype.In(2)\n\t\tif !isExportedOrBuiltinType(argType) {\n\t\t\tif reportErr {\n\t\t\t\tlog.Println(\"[ERROR]\", mname, \"argument type not exported:\", argType)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// Third arg must be a pointer.\n\t\treplyType := mtype.In(3)\n\t\tif replyType.Kind() != reflect.Ptr && replyType != typeOfStream {\n\t\t\tif reportErr {\n\t\t\t\tlog.Println(\"[ERROR] method\", mname, \"reply type not a pointer:\", replyType)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// Reply type must be exported.\n\t\tif !isExportedOrBuiltinType(replyType) {\n\t\t\tif reportErr {\n\t\t\t\tlog.Println(\"[ERROR] method\", mname, \"reply type not exported:\", replyType)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// Method needs one out.\n\t\tif mtype.NumOut() != 1 {\n\t\t\tif reportErr {\n\t\t\t\tlog.Println(\"[ERROR] method\", mname, \"has wrong number of outs:\", mtype.NumOut())\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// The return type of the method must be error.\n\t\tif returnType := mtype.Out(0); returnType != typeOfError {\n\t\t\tif reportErr {\n\t\t\t\tlog.Println(\"[ERROR] method\", mname, \"returns\", returnType.String(), \"not error\")\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tmethods[mname] = &methodType{method: method, ArgType: argType, ReplyType: replyType}\n\t}\n\treturn methods\n}", "title": "" }, { "docid": "4866550fb5d19a8e1900ad20cc7c97de", "score": "0.501045", "text": "func TestServerNotSendsVerack(t *testing.T) {\n\tvar (\n\t\ts = newTestServer(t, ServerConfig{MaxPeers: 10, Net: 56753})\n\t\tp = newLocalPeer(t, s)\n\t\tp2 = newLocalPeer(t, s)\n\t)\n\ts.id = 1\n\tfinished := make(chan struct{})\n\tgo func() {\n\t\ts.run()\n\t\tclose(finished)\n\t}()\n\tt.Cleanup(func() {\n\t\t// close via quit as server was started via `run()`, not `Start()`\n\t\tclose(s.quit)\n\t\t<-finished\n\t})\n\n\tna, _ := net.ResolveTCPAddr(\"tcp\", \"0.0.0.0:3000\")\n\tp.netaddr = *na\n\tp2.netaddr = *na\n\ts.register <- p\n\n\tcapabilities := []capability.Capability{\n\t\t{\n\t\t\tType: capability.FullNode,\n\t\t\tData: &capability.Node{\n\t\t\t\tStartHeight: 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tType: capability.TCPServer,\n\t\t\tData: &capability.Server{\n\t\t\t\tPort: 3000,\n\t\t\t},\n\t\t},\n\t}\n\t// identical id's\n\tversion := payload.NewVersion(56753, 1, \"/NEO-GO/\", capabilities)\n\terr := s.handleVersionCmd(p, version)\n\tassert.NotNil(t, err)\n\tassert.Equal(t, errIdenticalID, err)\n\n\t// Different IDs, but also different magics\n\tversion.Nonce = 2\n\tversion.Magic = 56752\n\terr = s.handleVersionCmd(p, version)\n\tassert.NotNil(t, err)\n\tassert.Equal(t, errInvalidNetwork, err)\n\n\t// Different IDs and same network, make handshake pass.\n\tversion.Magic = 56753\n\trequire.NoError(t, s.handleVersionCmd(p, version))\n\trequire.NoError(t, p.HandleVersionAck())\n\trequire.Equal(t, true, p.Handshaked())\n\n\t// Second handshake from the same peer should fail.\n\ts.register <- p2\n\terr = s.handleVersionCmd(p2, version)\n\tassert.NotNil(t, err)\n\trequire.Equal(t, errAlreadyConnected, err)\n}", "title": "" }, { "docid": "ff99ddd0f220c3212d413e7ea78c7ec1", "score": "0.5008734", "text": "func (method *ConnectionOpenOk) MethodIdentifier() uint16 {\n\treturn 41\n}", "title": "" }, { "docid": "a470c6f285df2c0bcc6e85a125f6991a", "score": "0.49935585", "text": "func (method *ChannelFlowOk) MethodIdentifier() uint16 {\n\treturn 21\n}", "title": "" }, { "docid": "46bac2cb7ba1c21115e73468c27a7ef5", "score": "0.4983378", "text": "func (s *Session) negotiate() error {\n\tbuf := make([]byte, 4)\n\n\tbinary.BigEndian.PutUint32(buf, tsunami.PROTOCOL_REVISION)\n\n\tcount, e := s.connection.Write(buf)\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tif count < 4 {\n\t\treturn errors.New(\"Could not send protocol revision number\")\n\t}\n\n\tcount, e = s.connection.Read(buf)\n\tif e != nil {\n\t\treturn e\n\t}\n\tif count < 4 {\n\t\treturn errors.New(\"Could not read protocol revision number\")\n\t}\n\n\tx := binary.BigEndian.Uint32(buf)\n\tif x != tsunami.PROTOCOL_REVISION {\n\t\treturn errors.New(\"Protocol negotiation failed\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "878d018414e230cfb4c9ea7f3b53ae6f", "score": "0.49785572", "text": "func (cl *Client) Handshake(path, origin, proto, ext string, headers http.Header) (err error) {\n\tif len(path) == 0 {\n\t\tpath = cl.URL.EscapedPath() + \"?\" + cl.URL.RawQuery\n\t}\n\n\tcl.handshakePath = path\n\n\tcl.bb.Reset()\n\tkey := GenerateHandshakeKey()\n\tkeyAccept := GenerateHandshakeAccept(key)\n\n\t_, err = fmt.Fprintf(&cl.bb, _handshakeReqFormat, path, cl.URL.Host, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// (8)\n\tif len(origin) > 0 {\n\t\tcl.handshakeOrigin = origin\n\t\t_, _ = cl.bb.WriteString(_hdrKeyOrigin + \": \" + origin + \"\\r\\n\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// (10)\n\tif len(proto) > 0 {\n\t\tcl.handshakeProto = proto\n\t\t_, err = cl.bb.WriteString(_hdrKeyWSProtocol + \": \" + proto + \"\\r\\n\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// (11)\n\tif len(ext) > 0 {\n\t\tcl.handshakeExt = ext\n\t\t_, err = cl.bb.WriteString(_hdrKeyWSExtensions + \": \" + ext + \"\\r\\n\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// (12)\n\tif len(headers) > 0 {\n\t\tcl.handshakeHeader = headers\n\t\terr = headers.Write(&cl.bb)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tcl.bb.Write([]byte{'\\r', '\\n'})\n\n\tctx := context.WithValue(context.Background(), ctxKeyWSAccept, keyAccept)\n\n\treturn cl.Send(ctx, cl.bb.Bytes(), cl.handleHandshake)\n}", "title": "" }, { "docid": "f0096ab752368366eb2d3b5733af49e8", "score": "0.4965206", "text": "func Handshake(number uint) []string {\n\tvar result []string\n\n\tif number&0x01 == 0x01 {\n\t\tresult = append(result, \"wink\")\n\t}\n\n\tif number&0x02 == 0x02 {\n\t\tresult = append(result, \"double blink\")\n\t}\n\n\tif number&0x04 == 0x04 {\n\t\tresult = append(result, \"close your eyes\")\n\t}\n\n\tif number&0x08 == 0x08 {\n\t\tresult = append(result, \"jump\")\n\t}\n\n\tif number&0x10 == 0x10 {\n\t\trevert(result)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "a291ad5f387da3272515e8c7c764d4f4", "score": "0.49628797", "text": "func (c *Client) Call(method string, args interface{}, reply interface{}) error {\n\tif c == nil {\n\t\treturn fmt.Errorf(\"Failed to initialize server connection\")\n\t}\n\n\t// Notify user about version mismatches\n\tif config.Version.LT(c.ServerVersion) {\n\t\tfmt.Fprintf(os.Stderr, \"Note: client version (%s) is behind server version (%s). Upgrade client.\\n\", config.Version, c.ServerVersion)\n\t} else if config.Version.GT(c.ServerVersion) {\n\t\tfmt.Fprintf(os.Stderr, \"Note: client version (%s) is ahead of server version (%s). Update server by restarting it.\\n\", config.Version, c.ServerVersion)\n\t}\n\n\t// Outright refuse to use a server that's too far ahead/behind.\n\tif c.ServerVersion.Major != config.Version.Major || c.ServerVersion.Minor != config.Version.Minor {\n\t\treturn fmt.Errorf(\"Client & Server versions are incompatible.\")\n\t}\n\n\t// On pre-release builds, refuse any mismatch - things are changing too fast\n\tif !config.Version.Equals(c.ServerVersion) && (len(config.Version.Pre) > 0 || len(c.ServerVersion.Pre) > 0) {\n\t\treturn fmt.Errorf(\"Client & Server versions are incompatible.\")\n\t}\n\n\treturn c.CallWithoutVersionCheck(method, args, reply)\n}", "title": "" }, { "docid": "30c13df525b6c7d8b8acdc3d9c8a7759", "score": "0.49569726", "text": "func (method *ConnectionCloseOk) MethodIdentifier() uint16 {\n\treturn 51\n}", "title": "" }, { "docid": "eee26987fd16f8201444aca866b307f3", "score": "0.4953132", "text": "func (s *Server) MethodNames() []string { return chatter.MethodNames[:] }", "title": "" }, { "docid": "be873f176a5477ff107afb04a4699efe", "score": "0.49520826", "text": "func (method *ChannelOpenOk) MethodIdentifier() uint16 {\n\treturn 11\n}", "title": "" }, { "docid": "4b8101fb878aae6f1fead8a2dae36ce1", "score": "0.4920711", "text": "func (method *ConnectionStart) MethodIdentifier() uint16 {\n\treturn 10\n}", "title": "" }, { "docid": "5fe10e9dbd8cec93c29f4fa8dde3e261", "score": "0.4910767", "text": "func (cli *Client) DoHandshake() error {\n\tinit := &sshfxp.Init{\n\t\tVersion: 3,\n\t}\n\n\tif _, err := cli.send(init); err != nil {\n\t\treturn err\n\t}\n\n\tpkt := <-cli.incoming\n\n\tmsg, err := pkt.Decode()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif version, ok := msg.(*sshfxp.Version); !ok {\n\t\treturn errors.New(\"unexpected message received\")\n\t} else {\n\t\tif version.Version != init.Version {\n\t\t\treturn errors.New(\"unsupported version\")\n\t\t}\n\n\t\tcli.version = version.Version\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0fa071a4e156a06a945ad993f6ff8d34", "score": "0.49030846", "text": "func (r *Repo) handshake() error {\n\treq, _ := http.NewRequest(\"GET\", r.url+\"/info/refs?service=git-upload-pack\", nil)\n\treq.Header.Set(\"Accept\", \"*/*\")\n\treq.Header.Set(\"Git-Protocol\", \"version=2\")\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"handshake: %v\", err)\n\t}\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif resp.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"handshake: %v\\n%s\", resp.Status, data)\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"handshake: reading body: %v\", err)\n\t}\n\tif ct := resp.Header.Get(\"Content-Type\"); ct != \"application/x-git-upload-pack-advertisement\" {\n\t\treturn fmt.Errorf(\"handshake: invalid response Content-Type: %v\", ct)\n\t}\n\n\tpr := newPktLineReader(bytes.NewReader(data))\n\tlines, err := pr.Lines()\n\tif len(lines) == 1 && lines[0] == \"# service=git-upload-pack\" {\n\t\tlines, err = pr.Lines()\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"handshake: parsing response: %v\", err)\n\t}\n\tcaps := make(map[string]string)\n\tfor _, line := range lines {\n\t\tverb, args, _ := cut(line, \"=\")\n\t\tcaps[verb] = args\n\t}\n\tif _, ok := caps[\"version 2\"]; !ok {\n\t\treturn fmt.Errorf(\"handshake: not version 2: %q\", lines)\n\t}\n\tr.caps = caps\n\treturn nil\n}", "title": "" }, { "docid": "b7e35ee93b37f0ab579a1e38c0467164", "score": "0.4902904", "text": "func (rcv *Webhook) Method() []byte {\n\to := flatbuffers.UOffsetT(rcv._tab.Offset(4))\n\tif o != 0 {\n\t\treturn rcv._tab.ByteVector(o + rcv._tab.Pos)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "169bf2fc6cc11b311dff15a5677dab08", "score": "0.49017337", "text": "func (client *ElectrumClient) negotiateProtocol() (serverVersion, error) {\n\tvar resp [2]string // [software version, protocol version]\n\terr := client.rpc.MethodSync(&resp, \"server.version\", SoftwareVersion, supportedProtocolVersion)\n\tif err != nil {\n\t\treturn serverVersion{}, err\n\t}\n\tsemv, err := semver.NewSemVerFromString(resp[1])\n\tif err != nil {\n\t\tsemv, err = semver.NewSemVerFromString(resp[1] + \".0\")\n\t}\n\tif err != nil {\n\t\tsemv = &semver.SemVer{} // don't really care; nice to have\n\t}\n\treturn serverVersion{software: resp[0], protocol: semv}, nil\n}", "title": "" }, { "docid": "9483e51fcd79c80a283a7ddab450d2cb", "score": "0.4900736", "text": "func (_HelloWorld *HelloWorldSession) Version() (string, error) {\n\treturn _HelloWorld.Contract.Version(&_HelloWorld.CallOpts)\n}", "title": "" }, { "docid": "bbc2d17f1891d255cc7fd4c62ee31854", "score": "0.4898313", "text": "func (p *peer) Handshake(network uint64, td *big.Int, head common.Hash, genesis common.Hash, forkID forkid.ID, forkFilter forkid.Filter) error {\n\t// Send out own handshake in a new thread\n\terrc := make(chan error, 2)\n\n\tvar (\n\t\tstatus63 statusData63 // safe to read after two values have been received from errc\n\t\tstatus statusData // safe to read after two values have been received from errc\n\t)\n\tgo func() {\n\t\tswitch {\n\t\tcase p.version == eth63:\n\t\t\terrc <- p2p.Send(p.rw, StatusMsg, &statusData63{\n\t\t\t\tProtocolVersion: uint32(p.version),\n\t\t\t\tNetworkId: network,\n\t\t\t\tTD: td,\n\t\t\t\tCurrentBlock: head,\n\t\t\t\tGenesisBlock: genesis,\n\t\t\t})\n\t\tcase p.version >= eth64:\n\t\t\terrc <- p2p.Send(p.rw, StatusMsg, &statusData{\n\t\t\t\tProtocolVersion: uint32(p.version),\n\t\t\t\tNetworkID: network,\n\t\t\t\tTD: td,\n\t\t\t\tHead: head,\n\t\t\t\tGenesis: genesis,\n\t\t\t\tForkID: forkID,\n\t\t\t})\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unsupported eth protocol version: %d\", p.version))\n\t\t}\n\t}()\n\tgo func() {\n\t\tswitch {\n\t\tcase p.version == eth63:\n\t\t\terrc <- p.readStatusLegacy(network, &status63, genesis)\n\t\tcase p.version >= eth64:\n\t\t\terrc <- p.readStatus(network, &status, genesis, forkFilter)\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unsupported eth protocol version: %d\", p.version))\n\t\t}\n\t}()\n\ttimeout := time.NewTimer(handshakeTimeout)\n\tdefer timeout.Stop()\n\tfor i := 0; i < 2; i++ {\n\t\tselect {\n\t\tcase err := <-errc:\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase <-timeout.C:\n\t\t\treturn p2p.DiscReadTimeout\n\t\t}\n\t}\n\tswitch {\n\tcase p.version == eth63:\n\t\tp.td, p.head = status63.TD, status63.CurrentBlock\n\tcase p.version >= eth64:\n\t\tp.td, p.head = status.TD, status.Head\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported eth protocol version: %d\", p.version))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6b86de4d605fa86c28f6945a3addcd3", "score": "0.48925465", "text": "func Handshake(code uint) []string {\n\n\tvar s []string\n\tvar b uint\n\t// As long as some bit is set (>0)\n\t// check that bit, call the convert function to\n\t// convert it.\n\t// Then, shift right to get the next bit.\n\t// Also check only the least significant 5 bits (b<5).\n\n\tfor code > 0 && b < 5 {\n\t\tif code&1 != 0 {\n\t\t\ts = convert[b](s)\n\t\t}\n\t\tcode >>= 1\n\t\tb++\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "353b88508f8d3feebf8ca70bda7cef82", "score": "0.4885892", "text": "func (client *Client) handshake() error {\n\t// Marshal the RequestMessage with type 0\n\tbytes, err := json.Marshal(RequestMessage{\n\t\tType: 0,\n\t\tContent: \"\",\n\t\tToken: client.Token,\n\t\tInformation: *client.Information,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write the message to the websocket\n\tif err = client.Connection.WriteMessage(websocket.TextMessage, bytes); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5b4f0367cee39f9deeb6156ddbc15a75", "score": "0.4876152", "text": "func (msfrpc *MSFRPC) Call(method string, options []interface{}) (string, error) {\n\ttr := &http.Transport{\n\t\tDisableKeepAlives: true,\n\t\tTLSClientConfig: &tls.Config{\n\t\t\tInsecureSkipVerify: true,\n\t\t},\n\t}\n\tclient := &http.Client{Transport: tr}\n\n\trequestData := []interface{}{method}\n\tif method != \"auth.login\" {\n\t\trequestData = append(requestData, msfrpc.authToken)\n\t}\n\trequestData = append(requestData, options...)\n\t//fmt.Println(requestData)\n\trequestBody, err := encodeMsgpack(requestData)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tscheme := \"http\"\n\tif msfrpc.Ssl {\n\t\tscheme += \"s\"\n\t}\n\trequest, err := http.NewRequest(\"POST\", scheme+\"://\"+msfrpc.Host+\":\"+msfrpc.Port+msfrpc.URI, bytes.NewBuffer(requestBody))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\trequest.Header.Set(\"Content-Type\", \"binary/message-pack\")\n\trequest.Header.Set(\"Accept\", \"binary/message-pack\")\n\trequest.Header.Set(\"Accept-Charset\", \"UTF-8\")\n\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer response.Body.Close()\n\trawBody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tstringBody := fmt.Sprintf(\"%s\", rawBody)\n\n\treturn stringBody, nil\n}", "title": "" }, { "docid": "611287236a94578d3363f3d914cd5ce0", "score": "0.48686343", "text": "func (client *ConnectRestClient) Version() (r string, e error) {\n\tresponse, e := requestAndGetResponse(\"GET\", client.hostname(), nil)\n\tif e == nil {\n\t\tr = string(response)\n\t}\n\treturn\n}", "title": "" }, { "docid": "9d3d1f6eb9c935a5b4562ace7b4c744f", "score": "0.48638383", "text": "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\n\tcaller, caller_affiliation, err := t.get_caller_data(stub)\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Error retrieving caller information\")\n\t}\n\n\tif function == \"create_vehicle\" {\n\t\treturn t.create_vehicle(stub, caller, caller_affiliation, args[0])\n\t} else if function == \"ping\" {\n\t\treturn t.ping(stub)\n\t} else { // If the function is not a create then there must be a car so we need to retrieve the car.\n\t\targPos := 1\n\n\t\tif function == \"scrap_vehicle\" { // If its a scrap vehicle then only two arguments are passed (no update value) all others have three arguments and the v5cID is expected in the last argument\n\t\t\targPos = 0\n\t\t}\n\n\t\tv, err := t.retrieve_v5c(stub, args[argPos])\n\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"INVOKE: Error retrieving v5c: %s\", err)\n\t\t\treturn nil, errors.New(\"Error retrieving v5c\")\n\t\t}\n\n\t\tif strings.Contains(function, \"update\") == false && function != \"scrap_vehicle\" { // If the function is not an update or a scrappage it must be a transfer so we need to get the ecert of the recipient.\n\n\t\t\tif function == \"authority_to_manufacturer\" {\n\t\t\t\treturn t.authority_to_manufacturer(stub, v, caller, caller_affiliation, args[0], \"manufacturer\")\n\t\t\t} else if function == \"manufacturer_to_private\" {\n\t\t\t\treturn t.manufacturer_to_private(stub, v, caller, caller_affiliation, args[0], \"private\")\n\t\t\t} else if function == \"private_to_private\" {\n\t\t\t\treturn t.private_to_private(stub, v, caller, caller_affiliation, args[0], \"private\")\n\t\t\t} else if function == \"private_to_lease_company\" {\n\t\t\t\treturn t.private_to_lease_company(stub, v, caller, caller_affiliation, args[0], \"lease_company\")\n\t\t\t} else if function == \"lease_company_to_private\" {\n\t\t\t\treturn t.lease_company_to_private(stub, v, caller, caller_affiliation, args[0], \"private\")\n\t\t\t} else if function == \"private_to_scrap_merchant\" {\n\t\t\t\treturn t.private_to_scrap_merchant(stub, v, caller, caller_affiliation, args[0], \"scrap_merchant\")\n\t\t\t}\n\n\t\t} else if function == \"update_make\" {\n\t\t\treturn t.update_make(stub, v, caller, caller_affiliation, args[0])\n\t\t} else if function == \"update_model\" {\n\t\t\treturn t.update_model(stub, v, caller, caller_affiliation, args[0])\n\t\t} else if function == \"update_reg\" {\n\t\t\treturn t.update_registration(stub, v, caller, caller_affiliation, args[0])\n\t\t} else if function == \"update_vin\" {\n\t\t\treturn t.update_vin(stub, v, caller, caller_affiliation, args[0])\n\t\t} else if function == \"update_colour\" {\n\t\t\treturn t.update_colour(stub, v, caller, caller_affiliation, args[0])\n\t\t} else if function == \"scrap_vehicle\" {\n\t\t\treturn t.scrap_vehicle(stub, v, caller, caller_affiliation)\n\t\t}\n\n\t\treturn nil, errors.New(\"Function of the name \" + function + \" doesn't exist.\")\n\n\t}\n}", "title": "" }, { "docid": "857ae82049c4e8ad03cd2948403b9e2b", "score": "0.48578694", "text": "func (method *ConnectionSecureOk) Write(writer io.Writer, protoVersion string) (err error) {\n\n\tif err = WriteLongstr(writer, method.Response); err != nil {\n\t\treturn err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "eccc62f86ecf5a48a0bd65842b32ca66", "score": "0.48540014", "text": "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\r\n\t\r\n\tvar i1 int\r\n\r\n\tcaller, caller_affiliation, err := t.get_caller_data(stub)\r\n\t\r\n\tif err != nil { fmt.Printf(\"Error retrieving caller information\")}\r\n\r\n\t//if err != nil { return nil, errors.New(\"Error retrieving caller information\")}\r\n\t\r\n\tfmt.Printf(\"function: \", function)\r\n fmt.Printf(\"caller: \", caller)\r\n fmt.Printf(\"affiliation: \", caller_affiliation)\r\n\r\n\t\r\n\t\r\n\t\r\n\tif function == \"create_package\" { return t.create_package(stub, caller, args[0])\r\n\t} else if function == \"ping\" {\r\n return t.ping(stub)\r\n } else { \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// If the function is not a create then there must be a car so we need to retrieve the car.\r\n\t\t\r\n\t\targPos := 1\r\n\t\t\r\n\t\tif function == \"deliver_package\" {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// If its a scrap vehicle then only two arguments are passed (no update value) all others have three arguments and the v5cID is expected in the last argument\r\n\t\t\targPos = 0\r\n\t\t}\r\n\t\t\r\n\t\tv, err := t.retrieve_v5c(stub, args[argPos])\r\n\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif err != nil { fmt.Printf(\"INVOKE: Error retrieving v5c: %s\", err); return nil, errors.New(\"Error retrieving v5c\") }\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\tif strings.Contains(function, \"update\") == false && \r\n\t\t function \t\t\t\t\t\t\t!= \"deliver_package\" { \t\t\t\t\t\t\t\t\t// If the function is not an update or a scrappage it must be a transfer so we need to get the ecert of the recipient.\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tif \t\t function == \"authority_to_manufacturer\" { return t.authority_to_manufacturer(stub, v, caller, args[0])\r\n\t\t\t\t} else if function == \"manufacturer_to_private\" { return t.manufacturer_to_private(stub, v, caller, args[0])\r\n\t\t\t\t} else if function == \"private_to_private\" \t { return t.private_to_private(stub, v, caller, args[0])\r\n\t\t\t\t} else if function == \"private_to_lease_company\" { return t.private_to_lease_company(stub, v, caller, args[0])\r\n\t\t\t\t} else if function == \"lease_company_to_private\" { return t.lease_company_to_private(stub, v, caller, args[0])\r\n\t\t\t\t} else if function == \"private_to_scrap_merchant\" { return t.private_to_scrap_merchant(stub, v, caller, args[0])\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t} else if function == \"update_type\" \t \t{ return t.update_type(stub, v, caller, args[0])\r\n\t\t} else if function == \"update_particulars\" { return t.update_particulars(stub, v, caller, args[0])\r\n\t\t} else if function == \"update_sourcecity\" \t\t{ return t.update_sourcecity(stub, v, caller, args[0])\r\n\t\t} else if function == \"update_destcity\" \t\t{ return t.update_destcity(stub, v, caller, args[0])\r\n\t\t} else if function == \"update_weight\" \t\t\t{ \ti1, err = strconv.Atoi(args[0])\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn t.update_weight(stub, v, caller, i1) \r\n\t\t} else if function == \"update_owner\" \t\t\t{ return t.update_owner(stub, v, caller, args[0])\r\n\t\t} else if function == \"update_delivered\" \t { \ti1, err = strconv.Atoi(args[0])\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn t.update_delivered(stub, v, caller, i1)\r\n\t\t} else if function == \"update_status\" \t{ i1, err = strconv.Atoi(args[0])\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn t.update_status(stub, v, caller, i1)\r\n\t\t} else if function == \"update_lastlocation\" \t{ return t.update_lastlocation(stub, v, caller, args[0])\r\n\t\t} else if function == \"update_dispatchdate\" \t{ return t.update_dispatchdate(stub, v, caller, args[0])\r\n\t\t} else if function == \"update_delivereddate\" \t{ return t.update_delivereddate(stub, v, caller, args[0])\r\n\t\t} else if function == \"update_dimensions\" \t\t{ return t.update_dimensions(stub, v, caller, args[0])\r\n\t\t\r\n\t\t} else if function == \"deliver_package\" \t\t{ return t.deliver_package(stub, v, caller) }\r\n\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn nil, errors.New(\"Function of that name doesn't exist.\")\r\n\t\t\t\r\n\t}\r\n}", "title": "" }, { "docid": "be615b08d154020a1322665d54336af9", "score": "0.48503482", "text": "func (cli *Client) connect() error {\n\tfmt.Printf(\"Opening connection to %v:%v\\n\", cli.Peer.IP, cli.Peer.Port)\n\tconn, err := net.DialTimeout(\n\t\t\"tcp\",\n\t\tfmt.Sprintf(\"%v:%v\", cli.Peer.IP, cli.Peer.Port),\n\t\t3*time.Second,\n\t)\n\tif err != nil {\n\t\tlog.Fatal(\"Error establishing TCP connection: \", err)\n\t}\n\n\t// sending handshake and validating response from peer\n\th, err := handshake.NewConnection(\n\t\tconn,\n\t\tcli.Torrent.Hash,\n\t\tcli.Tracker.PeerID,\n\t\tcli.Peer,\n\t)\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn err\n\t}\n\tif !bytes.Equal(cli.Torrent.Hash, h.InfoHash) {\n\t\treturn fmt.Errorf(\"Handshake response includes an invalid info hash: expected %v but got %v\\n\", cli.Torrent.Hash, h.InfoHash)\n\t}\n\tfmt.Printf(\"Valid handshake response received: %v\\n\", *h)\n\n\t// parsing Bitfield message after successful handshake\n\tbitfieldBytes, err := handshake.GetBitfield(conn)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to received the bitfield message: %v\\n\", err)\n\t}\n\tfmt.Printf(\"Bitfield received is: %v\\n\", bitfieldBytes)\n\n\treturn nil\n}", "title": "" }, { "docid": "3599a99b2133800fc9638de517a73ab6", "score": "0.48435342", "text": "func (edp *Endpoint) HandleConnection(conn net.Conn) error {\n\tif edp.config.EndpointType != client {\n\t\tpanic(\"only client can handle connection\")\n\t}\n\n\tid := uint16(0)\n\tfor id == 0 {\n\t\tid = uint16(atomic.AddUint32(&edp.idCounter, 1) & 0xffff)\n\t}\n\tedp.addConnection(conn, id)\n\tdefer edp.removeConnection(id)\n\tdefer conn.Close()\n\n\t//Part 1: Start authentication\n\t//0x05, numOfAuthentications, [Auth1, Auth2, ...]\n\thandshakeBuf := make([]byte, 2048)\n\tn, _ := io.ReadFull(conn, handshakeBuf[:2])\n\tif (n != 2) || (handshakeBuf[0] != 0x5) {\n\t\tconn.Close()\n\t\treturn ErrSocksFailure\n\t}\n\tnumAuth := int(uint8(handshakeBuf[1]))\n\tn, _ = io.ReadFull(conn, handshakeBuf[2:2+numAuth])\n\tconn.Write([]byte(\"\\x05\\x00\")) //version 5, no auth\n\n\t//Part 2: Addr\n\tn, _ = conn.Read(handshakeBuf)\n\t//Here we assume info could be read in one shot\n\tif (n < 5) || handshakeBuf[0] != 0x5 || handshakeBuf[2] != 0x0 {\n\t\tconn.Write([]byte(\"\\x05\\x01\\x00\\x01\\xff\\xff\\xff\\xff\\x00\\x00\"))\n\t\tconn.Close()\n\t\treturn ErrSocksFailure\n\t}\n\t//0x05(SOCKS5), 0x01(TCP connect), 0x00(reserve), 0x0?(type)\n\n\tswitch handshakeBuf[1] { //Command\n\tcase 0x1: //TCP connection\n\t\tvar addrStr string\n\t\tvar portBuf []byte\n\n\t\tswitch handshakeBuf[3] { //Addr type\n\t\tcase 0x1: //IPv4\n\t\t\taddr := make(net.IP, 4)\n\t\t\tcopy(addr, handshakeBuf[4:8])\n\t\t\taddrStr = addr.String()\n\t\t\tportBuf = handshakeBuf[8:10]\n\t\tcase 0x4: //IPv6\n\t\t\taddr := make(net.IP, 16)\n\t\t\tcopy(addr, handshakeBuf[4:20])\n\t\t\taddrStr = addr.String()\n\t\t\tportBuf = handshakeBuf[20:22]\n\t\tcase 0x3: //String domain name\n\t\t\tstrLen := uint8(handshakeBuf[4])\n\t\t\taddrStr = string(handshakeBuf[5 : 5+strLen])\n\t\t\tportBuf = handshakeBuf[5+strLen : 7+strLen]\n\t\tdefault:\n\t\t\tconn.Write([]byte(\"\\x05\\x07\\x00\\x01\\xff\\xff\\xff\\xff\\x00\\x00\")) //not support\n\t\t\tconn.Close()\n\t\t\treturn ErrSocksNotSupported\n\t\t}\n\n\t\tmsgBuf := make([]byte, 1+2+2+len(addrStr))\n\t\tmsgBuf[0] = cmdConnectTCP\n\t\tbinary.BigEndian.PutUint16(msgBuf[1:3], id)\n\t\tcopy(msgBuf[3:5], portBuf)\n\t\tcopy(msgBuf[5:], []byte(addrStr))\n\t\tedp.yield(msgBuf)\n\n\tdefault:\n\t\tconn.Write([]byte(\"\\x05\\x07\\x00\\x01\\xff\\xff\\xff\\xff\\x00\\x00\"))\n\t\tconn.Close()\n\t\treturn ErrSocksNotSupported\n\t}\n\n\t//FIXME: reply here not indicating the right addr and port\n\tconn.Write([]byte(\"\\x05\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\xff\\xff\")) //granted\n\n\tedp.keepReading(conn, id)\n\n\treturn nil\n}", "title": "" }, { "docid": "b5966c63e4a2d7e723b00f7095e5db6b", "score": "0.4839551", "text": "func (ac *TransmissionClient) Version() string {\n\tcmd := Command{Method: \"session-get\"}\n\n\tresp, _ := ac.sendCommand(cmd)\n\treturn resp.Arguments.Version\n}", "title": "" }, { "docid": "dcc43b013ef86e466ffc30c9c3fea7de", "score": "0.48362082", "text": "func (method *BasicNack) MethodIdentifier() uint16 {\n\treturn 120\n}", "title": "" }, { "docid": "8288e104cce9f86b4f4029df2e4aea90", "score": "0.48354813", "text": "func (s *PublicHarmonyService) ProtocolVersion(\n\tctx context.Context,\n) (interface{}, error) {\n\t// Format response according to version\n\tswitch s.version {\n\tcase V1:\n\t\treturn hexutil.Uint(s.hmy.ProtocolVersion()), nil\n\tcase V2:\n\t\treturn s.hmy.ProtocolVersion(), nil\n\tdefault:\n\t\treturn nil, ErrUnknownRPCVersion\n\t}\n}", "title": "" }, { "docid": "d477c11f6ed9963ccf0dd4122f77b382", "score": "0.4824463", "text": "func (s *ManifestRPCServer) Version(args interface{}, resp *string) error {\n\treturn Version(s.Impl, resp)\n}", "title": "" }, { "docid": "1a6bcbaa0c26c6e13f8d8154879a8c69", "score": "0.4824429", "text": "func (method *ChannelCloseOk) MethodIdentifier() uint16 {\n\treturn 41\n}", "title": "" }, { "docid": "7e3d6ce22d2c527f735eea1d7f9fca37", "score": "0.4820575", "text": "func (_HelloWorld *HelloWorldCallerSession) Version() (string, error) {\n\treturn _HelloWorld.Contract.Version(&_HelloWorld.CallOpts)\n}", "title": "" }, { "docid": "e7749e6310acb3942c3baa04c8939493", "score": "0.4799146", "text": "func MakeHandshakeMessage(infohash string) []byte {\n\n\tbuf := make([]byte, 68)\n\n\tbuf[0] = uint8(19)\n\tcopy(buf[1:20], \"BitTorrent protocol\")\n\n\tinfohashBytes, _ := hex.DecodeString(infohash)\n\tcopy(buf[28:48], infohashBytes)\n\n\t//TODO: Random peer Id\n\tpeerId := make([]byte, 20)\n\trand.Read(peerId)\n\tcopy(buf[48:68], peerId)\n\n\treturn buf\n}", "title": "" }, { "docid": "3706c2c558f64cde97958d9748302d26", "score": "0.47810355", "text": "func (c *Client) ProtocolVersion() (string, error) {\n\tvar version string\n\tif err := c.Do(\"eth_protocolVersion\", nil, &version); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn version, nil\n}", "title": "" }, { "docid": "bd7f22609c18f66ad28a6f07f2ce49ae", "score": "0.47802693", "text": "func (d *DialoguePDU) Version() string {\n\tif d.Type.Code() == AARQ || d.Type.Code() == AARE {\n\t\treturn fmt.Sprintf(\"%d\", d.ProtocolVersion.Value[len(d.ProtocolVersion.Value)-1]>>7)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "b7e177a299e620c1d8640b5b9e0e7dea", "score": "0.47793", "text": "func (method *ConnectionSecure) Read(reader io.Reader, protoVersion string) (err error) {\n\n\tmethod.Challenge, err = ReadLongstr(reader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d9ff2c8818652aa4bfad42fc269a666f", "score": "0.47758663", "text": "func Server(ctx context.Context, conn net.Conn, controlKey key.MachinePrivate, optionalInit []byte) (*Conn, error) {\n\tif deadline, ok := ctx.Deadline(); ok {\n\t\tif err := conn.SetDeadline(deadline); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"setting conn deadline: %w\", err)\n\t\t}\n\t\tdefer func() {\n\t\t\tconn.SetDeadline(time.Time{})\n\t\t}()\n\t}\n\n\t// Deliberately does not support formatting, so that we don't echo\n\t// attacker-controlled input back to them.\n\tsendErr := func(msg string) error {\n\t\tif len(msg) >= 1<<16 {\n\t\t\tmsg = msg[:1<<16]\n\t\t}\n\t\tvar hdr [headerLen]byte\n\t\thdr[0] = msgTypeError\n\t\tbinary.BigEndian.PutUint16(hdr[1:3], uint16(len(msg)))\n\t\tif _, err := conn.Write(hdr[:]); err != nil {\n\t\t\treturn fmt.Errorf(\"sending %q error to client: %w\", msg, err)\n\t\t}\n\t\tif _, err := io.WriteString(conn, msg); err != nil {\n\t\t\treturn fmt.Errorf(\"sending %q error to client: %w\", msg, err)\n\t\t}\n\t\treturn fmt.Errorf(\"refused client handshake: %q\", msg)\n\t}\n\n\tvar s symmetricState\n\ts.Initialize()\n\n\tvar init initiationMessage\n\tif optionalInit != nil {\n\t\tif len(optionalInit) != len(init) {\n\t\t\treturn nil, sendErr(\"wrong handshake initiation size\")\n\t\t}\n\t\tcopy(init[:], optionalInit)\n\t} else if _, err := io.ReadFull(conn, init.Header()); err != nil {\n\t\treturn nil, err\n\t}\n\t// Just a rename to make it more obvious what the value is. In the\n\t// current implementation we don't need to block any protocol\n\t// versions at this layer, it's safe to let the handshake proceed\n\t// and then let the caller make decisions based on the agreed-upon\n\t// protocol version.\n\tclientVersion := init.Version()\n\tif init.Type() != msgTypeInitiation {\n\t\treturn nil, sendErr(\"unexpected handshake message type\")\n\t}\n\tif init.Length() != len(init.Payload()) {\n\t\treturn nil, sendErr(\"wrong handshake initiation length\")\n\t}\n\t// if optionalInit was provided, we have the payload already.\n\tif optionalInit == nil {\n\t\tif _, err := io.ReadFull(conn, init.Payload()); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// prologue. Can only do this once we at least think the client is\n\t// handshaking using a supported version.\n\ts.MixHash(protocolVersionPrologue(clientVersion))\n\n\t// <- s\n\t// ...\n\tcontrolKeyPub := controlKey.Public()\n\ts.MixHash(controlKeyPub.UntypedBytes())\n\n\t// -> e, es, s, ss\n\tmachineEphemeralPub := key.MachinePublicFromRaw32(mem.B(init.EphemeralPub()))\n\ts.MixHash(machineEphemeralPub.UntypedBytes())\n\tcipher, err := s.MixDH(controlKey, machineEphemeralPub)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"computing es: %w\", err)\n\t}\n\tvar machineKeyBytes [32]byte\n\tif err := s.DecryptAndHash(cipher, machineKeyBytes[:], init.MachinePub()); err != nil {\n\t\treturn nil, fmt.Errorf(\"decrypting machine key: %w\", err)\n\t}\n\tmachineKey := key.MachinePublicFromRaw32(mem.B(machineKeyBytes[:]))\n\tcipher, err = s.MixDH(controlKey, machineKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"computing ss: %w\", err)\n\t}\n\tif err := s.DecryptAndHash(cipher, nil, init.Tag()); err != nil {\n\t\treturn nil, fmt.Errorf(\"decrypting initiation tag: %w\", err)\n\t}\n\n\t// <- e, ee, se\n\tresp := mkResponseMessage()\n\tcontrolEphemeral := key.NewMachine()\n\tcontrolEphemeralPub := controlEphemeral.Public()\n\tcopy(resp.EphemeralPub(), controlEphemeralPub.UntypedBytes())\n\ts.MixHash(controlEphemeralPub.UntypedBytes())\n\tif _, err := s.MixDH(controlEphemeral, machineEphemeralPub); err != nil {\n\t\treturn nil, fmt.Errorf(\"computing ee: %w\", err)\n\t}\n\tcipher, err = s.MixDH(controlEphemeral, machineKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"computing se: %w\", err)\n\t}\n\ts.EncryptAndHash(cipher, resp.Tag(), nil) // empty message payload\n\n\tc1, c2, err := s.Split()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"finalizing handshake: %w\", err)\n\t}\n\n\tif _, err := conn.Write(resp[:]); err != nil {\n\t\treturn nil, err\n\t}\n\n\tc := &Conn{\n\t\tconn: conn,\n\t\tversion: clientVersion,\n\t\tpeer: machineKey,\n\t\thandshakeHash: s.h,\n\t\ttx: txState{\n\t\t\tcipher: c2,\n\t\t},\n\t\trx: rxState{\n\t\t\tcipher: c1,\n\t\t},\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "20004b77f967d24d496ed15323aaaf88", "score": "0.47758436", "text": "func (method *ConnectionSecureOk) Name() string {\n\treturn \"ConnectionSecureOk\"\n}", "title": "" }, { "docid": "0a0708e86ee3692df6f0b156296525ac", "score": "0.4774812", "text": "func (t *TCPTunClient) handshake(tun_name string) {\n\treq := types.TCPTunnelRequest{t.node.GetNodeAddress()}\n\treq_b, _ := req.MarshalBinary()\n\tep := types.Packet{t.dest, t.amt, req_b}\n\tgo func() {\n\t\terr := t.node.SendPacket(ep)\n\t\tif err != nil {\n\t\t\tt.err <- err\n\t\t}\n\t}()\n\n\tvar resp types.TCPTunnelResponse\n\tp := <-t.node.Packets()\n\terr := resp.UnmarshalBinary(p.Data)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t//tun_name = strings.Trim(tun_name, \"\\x00\")\n\terr = SetDevAddr(tun_name, resp.IP.String())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tgo t.readtun()\n\tgo t.writetun()\n}", "title": "" }, { "docid": "d2c58b0e525530fdc79914749a2d163b", "score": "0.4773502", "text": "func (p *Plugin) handshake() error {\n\tout := new(HandShakeResp)\n\n\terr := p.client.CallService(HandShakePath, nil, out, true)\n\n\tp.probed = true\n\n\tif err != nil {\n\t\tp.probeError = err\n\t\treturn err\n\t}\n\n\tp.probeError = nil\n\tp.Implements = out.Implements\n\treturn nil\n}", "title": "" }, { "docid": "3c4e576722d314b401a79f4fd40c1f46", "score": "0.47725412", "text": "func readSocks4aConnect(s io.Reader) (req SocksRequest, err error) {\n\tr := bufio.NewReader(s)\n\n\tvar h [8]byte\n\t_, err = io.ReadFull(r, h[:])\n\tif err != nil {\n\t\treturn\n\t}\n\tif h[0] != socksVersion {\n\t\terr = fmt.Errorf(\"SOCKS header had version 0x%02x, not 0x%02x\", h[0], socksVersion)\n\t\treturn\n\t}\n\tif h[1] != socksCmdConnect {\n\t\terr = fmt.Errorf(\"SOCKS header had command 0x%02x, not 0x%02x\", h[1], socksCmdConnect)\n\t\treturn\n\t}\n\n\tvar usernameBytes []byte\n\tusernameBytes, err = r.ReadBytes('\\x00')\n\tif err != nil {\n\t\treturn\n\t}\n\treq.Username = string(usernameBytes[:len(usernameBytes)-1])\n\n\treq.Args, err = parseClientParameters(req.Username)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar port int\n\tvar host string\n\n\tport = int(h[2])<<8 | int(h[3])<<0\n\tif h[4] == 0 && h[5] == 0 && h[6] == 0 && h[7] != 0 {\n\t\tvar hostBytes []byte\n\t\thostBytes, err = r.ReadBytes('\\x00')\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\treturn\n\t\t}\n\t\thost = string(hostBytes[:len(hostBytes)-1])\n\t} else {\n\t\thost = net.IPv4(h[4], h[5], h[6], h[7]).String()\n\t}\n\n\tif r.Buffered() != 0 {\n\t\terr = fmt.Errorf(\"%d bytes left after SOCKS header\", r.Buffered())\n\t\treturn\n\t}\n\n\treq.Target = fmt.Sprintf(\"%s:%d\", host, port)\n\treturn\n}", "title": "" }, { "docid": "467cb60b6171d8734f26820c26726f28", "score": "0.47724682", "text": "func FingerprintClientHello(data []byte) (*ClientHelloSpec, error) {\n\tclientHelloSpec := &ClientHelloSpec{}\n\n\tvar vers uint16\n\n\ts := cryptobyte.String(data)\n\tif !s.Skip(4) || // message type and uint24 length field\n\t\t!s.ReadUint16(&vers) || !s.Skip(32) { // 32 byte random\n\t\treturn nil, errors.New(\"unable to read message type, length, and random\")\n\t}\n\tvar ignoredSessionID cryptobyte.String\n\tif !s.ReadUint8LengthPrefixed(&ignoredSessionID) {\n\t\treturn nil, errors.New(\"unable to read session id\")\n\t}\n\n\tvar cipherSuitesBytes cryptobyte.String\n\tif !s.ReadUint16LengthPrefixed(&cipherSuitesBytes) {\n\t\treturn nil, errors.New(\"unable to read ciphersuites\")\n\t}\n\tcipherSuites := []uint16{}\n\tfor !cipherSuitesBytes.Empty() {\n\t\tvar suite uint16\n\t\tif !cipherSuitesBytes.ReadUint16(&suite) {\n\t\t\treturn nil, errors.New(\"unable to read ciphersuite\")\n\t\t}\n\t\tcipherSuites = append(cipherSuites, unGREASEUint16(suite))\n\t}\n\tclientHelloSpec.CipherSuites = cipherSuites\n\n\tif !readUint8LengthPrefixed(&s, &clientHelloSpec.CompressionMethods) {\n\t\treturn nil, errors.New(\"unable to read compression methods\")\n\t}\n\n\tif s.Empty() {\n\t\t// ClientHello is optionally followed by extension data\n\t\treturn clientHelloSpec, nil\n\t}\n\n\tvar extensions cryptobyte.String\n\tif !s.ReadUint16LengthPrefixed(&extensions) || !s.Empty() {\n\t\treturn nil, errors.New(\"unable to read extensions data\")\n\t}\n\n\tfor !extensions.Empty() {\n\t\tvar extension uint16\n\t\tvar extData cryptobyte.String\n\t\tif !extensions.ReadUint16(&extension) ||\n\t\t\t!extensions.ReadUint16LengthPrefixed(&extData) {\n\t\t\treturn nil, errors.New(\"unable to read extension data\")\n\t\t}\n\n\t\tswitch extension {\n\t\tcase extensionServerName:\n\t\t\t// RFC 6066, Section 3\n\t\t\tvar nameList cryptobyte.String\n\t\t\tif !extData.ReadUint16LengthPrefixed(&nameList) || nameList.Empty() {\n\t\t\t\treturn nil, errors.New(\"unable to read server name extension data\")\n\t\t\t}\n\t\t\tvar serverName string\n\t\t\tfor !nameList.Empty() {\n\t\t\t\tvar nameType uint8\n\t\t\t\tvar serverNameBytes cryptobyte.String\n\t\t\t\tif !nameList.ReadUint8(&nameType) ||\n\t\t\t\t\t!nameList.ReadUint16LengthPrefixed(&serverNameBytes) ||\n\t\t\t\t\tserverNameBytes.Empty() {\n\t\t\t\t\treturn nil, errors.New(\"unable to read server name extension data\")\n\t\t\t\t}\n\t\t\t\tif nameType != 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif len(serverName) != 0 {\n\t\t\t\t\treturn nil, errors.New(\"multiple names of the same name_type in server name extension are prohibited\")\n\t\t\t\t}\n\t\t\t\tserverName = string(serverNameBytes)\n\t\t\t\tif strings.HasSuffix(serverName, \".\") {\n\t\t\t\t\treturn nil, errors.New(\"SNI value may not include a trailing dot\")\n\t\t\t\t}\n\n\t\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &SNIExtension{})\n\n\t\t\t}\n\t\tcase extensionNextProtoNeg:\n\t\t\t// draft-agl-tls-nextprotoneg-04\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &NPNExtension{})\n\n\t\tcase extensionStatusRequest:\n\t\t\t// RFC 4366, Section 3.6\n\t\t\tvar statusType uint8\n\t\t\tvar ignored cryptobyte.String\n\t\t\tif !extData.ReadUint8(&statusType) ||\n\t\t\t\t!extData.ReadUint16LengthPrefixed(&ignored) ||\n\t\t\t\t!extData.ReadUint16LengthPrefixed(&ignored) {\n\t\t\t\treturn nil, errors.New(\"unable to read status request extension data\")\n\t\t\t}\n\n\t\t\tif statusType == statusTypeOCSP {\n\t\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &StatusRequestExtension{})\n\t\t\t} else {\n\t\t\t\treturn nil, errors.New(\"status request extension statusType is not statusTypeOCSP\")\n\t\t\t}\n\n\t\tcase extensionSupportedCurves:\n\t\t\t// RFC 4492, sections 5.1.1 and RFC 8446, Section 4.2.7\n\t\t\tvar curvesBytes cryptobyte.String\n\t\t\tif !extData.ReadUint16LengthPrefixed(&curvesBytes) || curvesBytes.Empty() {\n\t\t\t\treturn nil, errors.New(\"unable to read supported curves extension data\")\n\t\t\t}\n\t\t\tcurves := []CurveID{}\n\t\t\tfor !curvesBytes.Empty() {\n\t\t\t\tvar curve uint16\n\t\t\t\tif !curvesBytes.ReadUint16(&curve) {\n\t\t\t\t\treturn nil, errors.New(\"unable to read supported curves extension data\")\n\t\t\t\t}\n\t\t\t\tcurves = append(curves, CurveID(unGREASEUint16(curve)))\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &SupportedCurvesExtension{curves})\n\n\t\tcase extensionSupportedPoints:\n\t\t\t// RFC 4492, Section 5.1.2\n\t\t\tsupportedPoints := []uint8{}\n\t\t\tif !readUint8LengthPrefixed(&extData, &supportedPoints) ||\n\t\t\t\tlen(supportedPoints) == 0 {\n\t\t\t\treturn nil, errors.New(\"unable to read supported points extension data\")\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &SupportedPointsExtension{supportedPoints})\n\n\t\tcase extensionSessionTicket:\n\t\t\t// RFC 5077, Section 3.2\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &SessionTicketExtension{})\n\n\t\tcase extensionSignatureAlgorithms:\n\t\t\t// RFC 5246, Section 7.4.1.4.1\n\t\t\tvar sigAndAlgs cryptobyte.String\n\t\t\tif !extData.ReadUint16LengthPrefixed(&sigAndAlgs) || sigAndAlgs.Empty() {\n\t\t\t\treturn nil, errors.New(\"unable to read signature algorithms extension data\")\n\t\t\t}\n\t\t\tsupportedSignatureAlgorithms := []SignatureScheme{}\n\t\t\tfor !sigAndAlgs.Empty() {\n\t\t\t\tvar sigAndAlg uint16\n\t\t\t\tif !sigAndAlgs.ReadUint16(&sigAndAlg) {\n\t\t\t\t\treturn nil, errors.New(\"unable to read signature algorithms extension data\")\n\t\t\t\t}\n\t\t\t\tsupportedSignatureAlgorithms = append(\n\t\t\t\t\tsupportedSignatureAlgorithms, SignatureScheme(sigAndAlg))\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &SignatureAlgorithmsExtension{supportedSignatureAlgorithms})\n\n\t\tcase extensionSignatureAlgorithmsCert:\n\t\t\t// RFC 8446, Section 4.2.3\n\t\t\treturn nil, errors.New(\"unsupported extension SignatureAlgorithmsCert\")\n\n\t\tcase extensionRenegotiationInfo:\n\t\t\t// RFC 5746, Section 3.2\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &RenegotiationInfoExtension{RenegotiateOnceAsClient})\n\n\t\tcase extensionALPN:\n\t\t\t// RFC 7301, Section 3.1\n\t\t\tvar protoList cryptobyte.String\n\t\t\tif !extData.ReadUint16LengthPrefixed(&protoList) || protoList.Empty() {\n\t\t\t\treturn nil, errors.New(\"unable to read ALPN extension data\")\n\t\t\t}\n\t\t\talpnProtocols := []string{}\n\t\t\tfor !protoList.Empty() {\n\t\t\t\tvar proto cryptobyte.String\n\t\t\t\tif !protoList.ReadUint8LengthPrefixed(&proto) || proto.Empty() {\n\t\t\t\t\treturn nil, errors.New(\"unable to read ALPN extension data\")\n\t\t\t\t}\n\t\t\t\talpnProtocols = append(alpnProtocols, string(proto))\n\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &ALPNExtension{alpnProtocols})\n\n\t\tcase extensionSCT:\n\t\t\t// RFC 6962, Section 3.3.1\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &SCTExtension{})\n\n\t\tcase extensionSupportedVersions:\n\t\t\t// RFC 8446, Section 4.2.1\n\t\t\tvar versList cryptobyte.String\n\t\t\tif !extData.ReadUint8LengthPrefixed(&versList) || versList.Empty() {\n\t\t\t\treturn nil, errors.New(\"unable to read supported versions extension data\")\n\t\t\t}\n\t\t\tsupportedVersions := []uint16{}\n\t\t\tfor !versList.Empty() {\n\t\t\t\tvar vers uint16\n\t\t\t\tif !versList.ReadUint16(&vers) {\n\t\t\t\t\treturn nil, errors.New(\"unable to read supported versions extension data\")\n\t\t\t\t}\n\t\t\t\tsupportedVersions = append(supportedVersions, unGREASEUint16(vers))\n\n\t\t\t\tif isGREASEUint16(vers) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif clientHelloSpec.TLSVersMin == 0 || vers < clientHelloSpec.TLSVersMin {\n\t\t\t\t\tclientHelloSpec.TLSVersMin = vers\n\t\t\t\t}\n\t\t\t\tif clientHelloSpec.TLSVersMax == 0 || vers > clientHelloSpec.TLSVersMax {\n\t\t\t\t\tclientHelloSpec.TLSVersMax = vers\n\t\t\t\t}\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &SupportedVersionsExtension{supportedVersions})\n\n\t\tcase extensionKeyShare:\n\t\t\t// RFC 8446, Section 4.2.8\n\t\t\tvar clientShares cryptobyte.String\n\t\t\tif !extData.ReadUint16LengthPrefixed(&clientShares) {\n\t\t\t\treturn nil, errors.New(\"unable to read key share extension data\")\n\t\t\t}\n\t\t\tkeyShares := []KeyShare{}\n\t\t\tfor !clientShares.Empty() {\n\t\t\t\tvar ks KeyShare\n\t\t\t\tvar group uint16\n\t\t\t\tif !clientShares.ReadUint16(&group) ||\n\t\t\t\t\t!readUint16LengthPrefixed(&clientShares, &ks.Data) ||\n\t\t\t\t\tlen(ks.Data) == 0 {\n\t\t\t\t\treturn nil, errors.New(\"unable to read key share extension data\")\n\t\t\t\t}\n\t\t\t\tks.Group = CurveID(unGREASEUint16(group))\n\t\t\t\t// if not GREASE, key share data will be discarded\n\t\t\t\t// as it should be generated per connection\n\t\t\t\tif ks.Group != GREASE_PLACEHOLDER {\n\t\t\t\t\tks.Data = nil\n\t\t\t\t}\n\t\t\t\tkeyShares = append(keyShares, ks)\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &KeyShareExtension{keyShares})\n\n\t\tcase extensionPSKModes:\n\t\t\t// RFC 8446, Section 4.2.9\n\t\t\tpskModes := []uint8{}\n\t\t\tif !readUint8LengthPrefixed(&extData, &pskModes) {\n\t\t\t\treturn nil, errors.New(\"unable to read PSK extension data\")\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &PSKKeyExchangeModesExtension{pskModes})\n\n\t\tcase utlsExtensionExtendedMasterSecret:\n\t\t\t// https://tools.ietf.org/html/rfc7627\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &UtlsExtendedMasterSecretExtension{})\n\n\t\tcase utlsExtensionPadding:\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle})\n\n\t\tcase fakeExtensionChannelID:\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &FakeChannelIDExtension{})\n\n\t\tcase fakeExtensionChannelIDOld:\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &FakeChannelIDExtension{true})\n\n\t\tcase fakeExtensionTokenBinding:\n\t\t\tvar tokenBindingExt FakeTokenBindingExtension\n\t\t\tvar keyParameters cryptobyte.String\n\t\t\tif !extData.ReadUint8(&tokenBindingExt.MajorVersion) ||\n\t\t\t\t!extData.ReadUint8(&tokenBindingExt.MinorVersion) ||\n\t\t\t\t!extData.ReadUint8LengthPrefixed(&keyParameters) {\n\t\t\t\treturn nil, errors.New(\"unable to read token binding extension data\")\n\t\t\t}\n\t\t\ttokenBindingExt.KeyParameters = keyParameters\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &tokenBindingExt)\n\n\t\tcase fakeExtensionALPS:\n\t\t\t// Similar to ALPN (RFC 7301, Section 3.1):\n\t\t\t// https://datatracker.ietf.org/doc/html/draft-vvv-tls-alps#section-3\n\t\t\tvar protoList cryptobyte.String\n\t\t\tif !extData.ReadUint16LengthPrefixed(&protoList) || protoList.Empty() {\n\t\t\t\treturn nil, errors.New(\"unable to read ALPS extension data\")\n\t\t\t}\n\t\t\tsupportedProtocols := []string{}\n\t\t\tfor !protoList.Empty() {\n\t\t\t\tvar proto cryptobyte.String\n\t\t\t\tif !protoList.ReadUint8LengthPrefixed(&proto) || proto.Empty() {\n\t\t\t\t\treturn nil, errors.New(\"unable to read ALPS extension data\")\n\t\t\t\t}\n\t\t\t\tsupportedProtocols = append(supportedProtocols, string(proto))\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &FakeALPSExtension{supportedProtocols})\n\n\t\tcase fakeRecordSizeLimit:\n\t\t\trecordSizeExt := new(FakeRecordSizeLimitExtension)\n\t\t\tif !extData.ReadUint16(&recordSizeExt.Limit) {\n\t\t\t\treturn nil, errors.New(\"unable to read record size limit extension data\")\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, recordSizeExt)\n\n\t\tcase fakeExtensionDelegatedCredentials:\n\t\t\t//https://datatracker.ietf.org/doc/html/draft-ietf-tls-subcerts-15#section-4.1.1\n\t\t\tvar supportedAlgs cryptobyte.String\n\t\t\tif !extData.ReadUint16LengthPrefixed(&supportedAlgs) || supportedAlgs.Empty() {\n\t\t\t\treturn nil, errors.New(\"unable to read signature algorithms extension data\")\n\t\t\t}\n\t\t\tsupportedSignatureAlgorithms := []SignatureScheme{}\n\t\t\tfor !supportedAlgs.Empty() {\n\t\t\t\tvar sigAndAlg uint16\n\t\t\t\tif !supportedAlgs.ReadUint16(&sigAndAlg) {\n\t\t\t\t\treturn nil, errors.New(\"unable to read signature algorithms extension data\")\n\t\t\t\t}\n\t\t\t\tsupportedSignatureAlgorithms = append(\n\t\t\t\t\tsupportedSignatureAlgorithms, SignatureScheme(sigAndAlg))\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &FakeDelegatedCredentialsExtension{supportedSignatureAlgorithms})\n\n\t\tcase utlsExtensionCompressCertificate:\n\t\t\tmethods := []CertCompressionAlgo{}\n\t\t\tmethodsRaw := new(cryptobyte.String)\n\t\t\tif !extData.ReadUint8LengthPrefixed(methodsRaw) {\n\t\t\t\treturn nil, errors.New(\"unable to read cert compression algorithms extension data\")\n\t\t\t}\n\t\t\tfor !methodsRaw.Empty() {\n\t\t\t\tvar method uint16\n\t\t\t\tif !methodsRaw.ReadUint16(&method) {\n\t\t\t\t\treturn nil, errors.New(\"unable to read cert compression algorithms extension data\")\n\t\t\t\t}\n\t\t\t\tmethods = append(methods, CertCompressionAlgo(method))\n\t\t\t}\n\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &UtlsCompressCertExtension{methods})\n\n\t\tcase extensionPreSharedKey:\n\t\t\t// RFC 8446, Section 4.2.11\n\t\t\treturn nil, errors.New(\"unsupported extension PreSharedKey\")\n\n\t\tcase extensionCookie:\n\t\t\t// RFC 8446, Section 4.2.2\n\t\t\treturn nil, errors.New(\"unsupported extension Cookie\")\n\n\t\tcase extensionEarlyData:\n\t\t\t// RFC 8446, Section 4.2.10\n\t\t\treturn nil, errors.New(\"unsupported extension EarlyData\")\n\n\t\tdefault:\n\t\t\tif isGREASEUint16(extension) {\n\t\t\t\tclientHelloSpec.Extensions = append(clientHelloSpec.Extensions, &UtlsGREASEExtension{unGREASEUint16(extension), extData})\n\t\t\t} else {\n\t\t\t\treturn nil, fmt.Errorf(\"unsupported extension %d\", extension)\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\t}\n\n\treturn clientHelloSpec, nil\n}", "title": "" }, { "docid": "7d79fb751260c55c17ff36632b6cc239", "score": "0.476565", "text": "func (method *BasicConsumeOk) MethodIdentifier() uint16 {\n\treturn 21\n}", "title": "" }, { "docid": "6b463619775b2eee64889d260cbeb42c", "score": "0.47619915", "text": "func Handshake(inp uint) []string {\n\tresult := []string{}\n\tcodes := map[uint]string{\n\t\t1: \"wink\",\n\t\t2: \"double blink\",\n\t\t4: \"close your eyes\",\n\t\t8: \"jump\",\n\t}\n\tfor _, i := range []uint{1, 2, 4, 8} {\n\t\tif i&inp == i {\n\t\t\tresult = append(result, codes[i])\n\t\t}\n\t}\n\tif 16&inp == 16 {\n\t\tresult = reverse(result)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "0cc2fdc7e9103e5457092d023f7ec5bc", "score": "0.4746127", "text": "func TestVerackAfterHandleVersionCmd(t *testing.T) {\n\tvar (\n\t\ts = newTestServer(t, ServerConfig{})\n\t\tp = newLocalPeer(t, s)\n\t)\n\tna, _ := net.ResolveTCPAddr(\"tcp\", \"0.0.0.0:3000\")\n\tp.netaddr = *na\n\n\t// Should have a verack\n\tp.messageHandler = func(t *testing.T, msg *Message) {\n\t\tassert.Equal(t, CMDVerack, msg.Command)\n\t}\n\tcapabilities := []capability.Capability{\n\t\t{\n\t\t\tType: capability.FullNode,\n\t\t\tData: &capability.Node{\n\t\t\t\tStartHeight: 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tType: capability.TCPServer,\n\t\t\tData: &capability.Server{\n\t\t\t\tPort: 3000,\n\t\t\t},\n\t\t},\n\t}\n\tversion := payload.NewVersion(0, 1337, \"/NEO-GO/\", capabilities)\n\n\trequire.NoError(t, s.handleVersionCmd(p, version))\n}", "title": "" }, { "docid": "1ba98da3d3ab03d512cc0f96e7d1ac41", "score": "0.4734222", "text": "func (c *Common) Echo(ctx context.Context, req *pb.Payload) (*pb.EchoResponse, error) {\n\t// Echo calls\n\tc.SetColor(color.FgYellow)\n\tdefer c.UnsetColor()\n\tc.Debugf(`------ECHO Server------`)\n\tactualData, verified, name := c.Verify(ctx, req.Data)\n\tif !verified {\n\t\treturn nil, errors.New(\"signature invalid\")\n\t}\n\tif !c.PrevHashValid(req.PrevHash, req.MerkleProof.Root) {\n\t\treturn nil, errors.New(\"block with same prev_hash already voted\")\n\t}\n\tc.Debugf(`Get ECHO Message: \"%.4s\" from %s`, hex.EncodeToString(actualData), name)\n\tvalid := merkle.VerifyProof(req.MerkleProof, merkle.BytesContent(actualData))\n\tif !valid {\n\t\treturn nil, merkle.InvalidProof{}\n\t}\n\tc.Debugf(`Validated by merkle tree`)\n\n\treq.Data = actualData\n\te, err := c.EchosReceived.Add(name, req.MerkleProof.Root, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif e == len(c.RBCSetting.AllPeers)-c.ByzantineLimit {\n\t\t// TODO: interpolate {s'j} from any N-2f leaves received\n\t\t// TODO: recompute Merkle root h' and if h'!=h then abort\n\t\t// set := map[int]string{}\n\t\t// for k, v := range c.EchosReceived.Rec[merkle.MerkleRootToString(req.MerkleProof.Root)] {\n\t\t// \tidx := merkle.GetLeafIndex(v.(*pb.Payload).MerkleProof)\n\t\t// \tif _, ok := set[idx]; ok {\n\t\t// \t\treturn nil, errors.New(fmt.Sprint(\"same shards from distinct parties: %s, %s\", k, name))\n\t\t// \t}\n\t\t// }\n\t\tif !c.readyIsSent(req.MerkleProof.Root) {\n\t\t\tfor _, p := range c.RBCSetting.AllPeers {\n\t\t\t\tc.Debugf(\"Send READY to %#v\", p)\n\t\t\t\tc.SendReady(p, req.MerkleProof.Root)\n\t\t\t}\n\t\t}\n\t}\n\trootString := merkle.MerkleRootToString(req.MerkleProof.Root)\n\t// 2f + 1 Ready and N - 2f Echo, decode and apply\n\tif e == len(c.RBCSetting.AllPeers)-2*c.ByzantineLimit {\n\t\tif len(c.ReadiesReceived.Rec[rootString]) >= 2*c.ByzantineLimit+1 {\n\t\t\tc.Infof(\"Get enough READY and ECHO to decode\")\n\t\t\tdata, err := c.reconstructData(rootString)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t// TODO: add it back when block and app is ready\n\t\t\t//block, err := maoUtils.FromBytesToBlock(data)\n\t\t\t//if err != nil {\n\t\t\t//\treturn nil, err\n\t\t\t//}\n\t\t\tc.Debugf(\"Data reconstructed %.6s\", hex.EncodeToString(data))\n\t\t\tshouldSync, err := c.App.RBCReceive(data)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"Failed to apply the transaction\")\n\t\t\t}\n\t\t\tif shouldSync {\n\t\t\t\tc.Synchronize()\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &pb.EchoResponse{}, nil\n}", "title": "" }, { "docid": "15ebccbc1b64e07433123bb0c831816d", "score": "0.47294584", "text": "func Method(ctx context.Context) (string, bool) {\n\ts := ServerTransportStreamFromContext(ctx)\n\tif s == nil {\n\t\treturn \"\", false\n\t}\n\treturn s.Method(), true\n}", "title": "" }, { "docid": "63f00411dc74529c9fd4dc2376c27a09", "score": "0.47220868", "text": "func (method *ConnectionOpen) MethodIdentifier() uint16 {\n\treturn 40\n}", "title": "" }, { "docid": "fd561a7c23ad47b5ab88d653e25ab5ce", "score": "0.4712257", "text": "func (s *TCPRelay) getCmd() (cmd byte, err error) {\n\traw := make([]byte, 3)\n\tif _, err = io.ReadFull(s.conn, raw); err != nil {\n\t\treturn\n\t}\n\n\t// get socks version\n\tif ver := raw[0]; ver != socksv5 {\n\t\treturn 0, fmt.Errorf(\"error socks version %d\", ver)\n\t}\n\n\tcmd = raw[1]\n\treturn\n}", "title": "" }, { "docid": "9edb3d6f3084a8da4e7dbe067b90adf8", "score": "0.4711546", "text": "func (vc *VoteChaincode) Invoke(stub shim.ChaincodeStubInterface) peer.Response {\n\tfn, args := stub.GetFunctionAndParameters()\n\tfmt.Println(\"invoke is running \" + fn)\n\n\tswitch fn {\n\tcase \"initVote\":\n\t\treturn vc.initVote(stub, args)\n\tcase \"getVote\":\n\t\treturn vc.getVote(stub, args)\n\tcase \"getVotePrivateDetails\":\n\t\treturn vc.getVotePrivateDetails(stub, args)\n\tcase \"getVotePrivateDetailsHash\":\n\t\treturn vc.getVotePrivateDetailsHash(stub, args)\n\tcase \"amendVote\":\n\t\treturn vc.updateVote(stub, args)\n\tcase \"queryVotePrivateDetailsByPoll\":\n\t\treturn vc.queryVotePrivateDetailsByPoll(stub, args)\n\tcase \"queryVotesByPoll\":\t\t\t\t\t\t\t\t// parametrized rich query w/ poll ID\n\t\treturn vc.queryVotesByPoll(stub, args)\n\tcase \"queryVotesByVoter\":\t\t\t\t\t\t\t\t// parametrized rich query w/ voter ID\n\t\treturn vc.queryVotesByVoter(stub, args)\t\t\t\n\tcase \"queryVotes\":\t\t\t\t\t\t\t\t\t\t// ad hoc rich query\n\t\treturn vc.queryVotes(stub, args)\n\tcase \"initPoll\":\n\t\treturn vc.initPoll(stub, args)\n\tcase \"getPoll\":\n\t\treturn vc.getPoll(stub, args)\n\tcase \"getPollPrivateDetails\":\n\t\treturn vc.getPollPrivateDetails(stub, args)\n\tcase \"updatePollStatus\":\n\t\treturn vc.updatePollStatus(stub, args)\n\t}\n\n\tfmt.Println(\"invoke did not find fn: \" + fn)\n\treturn shim.Error(\"Received unknown function invocation\")\n}", "title": "" }, { "docid": "f2b7cfe77fdc1d14e40f323eb453dbe9", "score": "0.47079733", "text": "func Handshake(dirtyCode uint) []string {\n\tcode := int(dirtyCode)\n\tvar output []string\n\n\tif code&wink != 0 {\n\t\toutput = append(output, \"wink\")\n\t}\n\tif code&doubleBlink != 0 {\n\t\toutput = append(output, \"double blink\")\n\t}\n\tif code&closeEyes != 0 {\n\t\toutput = append(output, \"close your eyes\")\n\t}\n\tif code&jump != 0 {\n\t\toutput = append(output, \"jump\")\n\t}\n\n\tif code&reverse != 0 {\n\t\toldOutput := output\n\t\toutput = []string{}\n\t\tfor _, step := range oldOutput {\n\t\t\toutput = append([]string{step}, output...)\n\t\t}\n\t}\n\treturn output\n}", "title": "" }, { "docid": "7a3a8914154d95350a0e929dc4be6fe9", "score": "0.4707668", "text": "func NewClient(logger log.Logger, network, address string, typ RouteType, version uint8, software Software, mplsLabelRangeSize uint32) (*Client, error) {\n\tconn, err := net.Dial(network, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\toutgoing := make(chan *Message)\n\tincoming := make(chan *Message, 64)\n\tif version < MinZapiVer {\n\t\tversion = MinZapiVer\n\t} else if version > MaxZapiVer {\n\t\tversion = MaxZapiVer\n\t}\n\tc := &Client{\n\t\toutgoing: outgoing,\n\t\tincoming: incoming,\n\t\tredistDefault: typ,\n\t\tconn: conn,\n\t\tVersion: version,\n\t\tSoftware: software,\n\t\tlogger: logger,\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tm, more := <-outgoing\n\t\t\tif more {\n\t\t\t\tb, err := m.serialize(software)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Warn(fmt.Sprintf(\"failed to serialize: %v\", m),\n\t\t\t\t\t\tlog.Fields{\n\t\t\t\t\t\t\t\"Topic\": \"Zebra\"})\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t_, err = conn.Write(b)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Error(\"failed to write\",\n\t\t\t\t\t\tlog.Fields{\n\t\t\t\t\t\t\t\"Topic\": \"Zebra\",\n\t\t\t\t\t\t\t\"Error\": err})\n\t\t\t\t\tcloseChannel(outgoing)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlogger.Debug(\"finish outgoing loop\",\n\t\t\t\t\tlog.Fields{\"Topic\": \"Zebra\"})\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Send Hello/RouterIDAdd messages to negotiate the Zebra message version.\n\tc.SendHello()\n\tc.SendRouterIDAdd()\n\n\tif mplsLabelRangeSize > 0 && c.SupportMpls() {\n\t\tc.sendLabelManagerConnect(true)\n\t}\n\n\treceiveSingleMsg := func() (*Message, error) {\n\t\theaderBuf, err := readAll(conn, int(HeaderSize(version)))\n\t\tif err != nil {\n\t\t\tlogger.Error(\"failed to read header\",\n\t\t\t\tlog.Fields{\n\t\t\t\t\t\"Topic\": \"Zebra\",\n\t\t\t\t\t\"Error\": err})\n\t\t\treturn nil, err\n\t\t}\n\n\t\thd := &Header{}\n\t\terr = hd.decodeFromBytes(headerBuf)\n\t\tif c.Version != hd.Version {\n\t\t\tlogger.Warn(fmt.Sprintf(\"ZAPI version mismatch. configured version: %d, version of received message:%d\", c.Version, hd.Version),\n\t\t\t\tlog.Fields{\n\t\t\t\t\t\"Topic\": \"Zebra\"})\n\t\t\treturn nil, errors.New(\"ZAPI version mismatch\")\n\t\t}\n\t\tif err != nil {\n\t\t\tlogger.Error(\"failed to decode header\",\n\t\t\t\tlog.Fields{\n\t\t\t\t\t\"Topic\": \"Zebra\",\n\t\t\t\t\t\"Data\": headerBuf,\n\t\t\t\t\t\"Error\": err})\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbodyBuf, err := readAll(conn, int(hd.Len-HeaderSize(version)))\n\t\tif err != nil {\n\t\t\tlogger.Error(\"failed to read body\",\n\t\t\t\tlog.Fields{\n\t\t\t\t\t\"Topic\": \"Zebra\",\n\t\t\t\t\t\"Header\": hd,\n\t\t\t\t\t\"Error\": err})\n\t\t\treturn nil, err\n\t\t}\n\n\t\tm, err := parseMessage(hd, bodyBuf, software)\n\t\tif err != nil {\n\t\t\t// Just outputting warnings (not error message) and ignore this\n\t\t\t// error considering the case that body parser is not implemented yet.\n\t\t\tlogger.Warn(\"failed to decode body\",\n\t\t\t\tlog.Fields{\n\t\t\t\t\t\"Topic\": \"Zebra\",\n\t\t\t\t\t\"Header\": hd,\n\t\t\t\t\t\"Data\": bodyBuf,\n\t\t\t\t\t\"Error\": err})\n\t\t\treturn nil, nil\n\t\t}\n\t\tlogger.Debug(\"read message from zebra\",\n\t\t\tlog.Fields{\n\t\t\t\t\"Topic\": \"Zebra\",\n\t\t\t\t\"Message\": m})\n\n\t\treturn m, nil\n\t}\n\n\t// Try to receive the first message from Zebra.\n\tif m, err := receiveSingleMsg(); err != nil {\n\t\tc.close()\n\t\t// Return error explicitly in order to retry connection.\n\t\treturn nil, err\n\t} else if m != nil {\n\t\tincoming <- m\n\t}\n\n\t// Start receive loop only when the first message successfully received.\n\tgo func() {\n\t\tdefer close(incoming)\n\t\tfor {\n\t\t\tif m, err := receiveSingleMsg(); err != nil {\n\t\t\t\treturn\n\t\t\t} else if m != nil {\n\t\t\t\tincoming <- m\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn c, nil\n}", "title": "" }, { "docid": "36dfcae78329f8ef1816f15c1e22f6bf", "score": "0.47076", "text": "func (method *BasicGetOk) Write(writer io.Writer, protoVersion string) (err error) {\n\n\tif err = WriteLonglong(writer, method.DeliveryTag); err != nil {\n\t\treturn err\n\t}\n\n\tvar bits byte\n\n\tif method.Redelivered {\n\t\tbits |= 1 << 0\n\t}\n\n\tif err = WriteOctet(writer, bits); err != nil {\n\t\treturn err\n\t}\n\n\tif err = WriteShortstr(writer, method.Exchange); err != nil {\n\t\treturn err\n\t}\n\n\tif err = WriteShortstr(writer, method.RoutingKey); err != nil {\n\t\treturn err\n\t}\n\n\tif err = WriteLong(writer, method.MessageCount); err != nil {\n\t\treturn err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "de8d1ef70180a49f78c40963920ecb16", "score": "0.47033176", "text": "func main() {\n\t/* Parse options */\n\tlistenAddr := flag.String(\"addr\", \":23\", \"[Address and] port on \"+\n\t\t\"which to listen.\")\n\tlogDir := flag.String(\"logdir\", \"onewaymirror\", \"Directory to which \"+\n\t\t\"to write logs.\")\n\tdisableLogging := flag.Bool(\"nolog\", false, \"Disable session logging.\")\n\tdisable4 := flag.Bool(\"no4\", false, \"Disable IPv4.\")\n\tdisable6 := flag.Bool(\"no6\", false, \"Disable IPv6.\")\n\tbanner := flag.String(\"banner\", \"Connection proxied by onewaymirror.\",\n\t\t\"A banner to send to connecting clients. This may be set \"+\n\t\t\t\"to the empty string (-banner=\\\"\\\") for no \"+\n\t\t\t\"banner. A newline will be appended to the banner \"+\n\t\t\t\"after sending.\")\n\tbuflen := flag.Int(\"buflen\", 1024, \"Read buffer size.\")\n\tflag.Parse()\n\n\t/* Make sure logdir exists */\n\t/* TODO: unhardcode the perms */\n\tif !*disableLogging {\n\t\tif err := os.MkdirAll(*logDir, 0755); err != nil {\n\t\t\tlog.Fatalf(\"Unable to create directory %v: %v\",\n\t\t\t\t*logDir, err)\n\t\t}\n\t} else {\n\t\tlogDir = nil\n\t}\n\n\t/* Channels on which to receive connections */\n\tvar ch4, ch6 chan *net.TCPConn\n\n\t/* Channels to use for watching for dead listeners */\n\tdead := make(chan int)\n\tallDead := make(chan int)\n\tn := 0\n\n\t/* Append a newline to the banner if appropriate */\n\tif len(*banner) > 0 {\n\t\t*banner += \"\\n\"\n\t}\n\n\t/* Try to listen */\n\tif *disable4 && *disable6 {\n\t\tlog.Fatalf(\"-no4 and -no6 may not both be specified.\")\n\t}\n\tvar l4, l6 *net.TCPListener\n\tif !*disable4 {\n\t\tl4 = listener(\"tcp4\", *listenAddr)\n\t\tif l4 != nil {\n\t\t\tch4 = make(chan *net.TCPConn)\n\t\t\tn++\n\t\t\tgo waitConn(l4, ch4, dead)\n\t\t}\n\t}\n\tif !*disable6 {\n\t\tl6 = listener(\"tcp6\", *listenAddr)\n\t\tif l6 != nil {\n\t\t\tch6 = make(chan *net.TCPConn)\n\t\t\tn++\n\t\t\tgo waitConn(l6, ch6, dead)\n\t\t}\n\t}\n\tif nil == l4 && nil == l6 {\n\t\tlog.Fatalf(\"Unaable to create any listeners\")\n\t}\n\n\t/* Start listeners */\n\tgo waitDead(n, dead, allDead)\n\n\t/* Accept connections */\n\tfor {\n\t\tselect {\n\t\tcase c := <-ch4:\n\t\t\tgo handleConn(c, *buflen, *banner, logDir)\n\t\tcase c := <-ch6:\n\t\t\tgo handleConn(c, *buflen, *banner, logDir)\n\t\tcase <-allDead:\n\t\t\tlog.Fatalf(\"All listeners have terminated\")\n\t\t}\n\n\t}\n\t/* Shouldn't reach here */\n\tlog.Fatalf(\"Unexpected termination\")\n}", "title": "" }, { "docid": "f9d20d962c6d9148aea203f5096c8de6", "score": "0.46965083", "text": "func (c *Client) Invoke(method string, arg [][]byte) (string, error) {\n\tresp, err := c.chClient.Execute(channel.Request{\n\t\tChaincodeID: c.chainCodeId,\n\t\tFcn: method,\n\t\tArgs: arg,\n\t\t//TransientMap: nil,\n\t\t//InvocationChain: nil,\n\t})\n\n\treturn string(resp.TransactionID), err\n}", "title": "" }, { "docid": "b4feed94b2bbbc8a9ca63a2d70ef5c3b", "score": "0.4692167", "text": "func (method *TxSelectOk) MethodIdentifier() uint16 {\n\treturn 11\n}", "title": "" }, { "docid": "fa2ad36406f90885ef883188751c7657", "score": "0.4689945", "text": "func TestDuplicateVersionMsg(t *testing.T) {\n\t// Create a pair of peers that are connected to each other using a fake\n\t// connection.\n\tverack := make(chan struct{})\n\tpeerCfg := &peer.Config{\n\t\tListeners: peer.MessageListeners{\n\t\t\tOnVerAck: func(p *peer.Peer, msg *wire.MsgVerAck) {\n\t\t\t\tverack <- struct{}{}\n\t\t\t},\n\t\t},\n\t\tUserAgentName: \"peer\",\n\t\tUserAgentVersion: \"1.0\",\n\t\tChainParams: &chaincfg.MainNetParams,\n\t\tServices: 0,\n\t}\n\tinConn, outConn := pipe(\n\t\t&conn{laddr: \"10.0.0.1:9108\", raddr: \"10.0.0.2:9108\"},\n\t\t&conn{laddr: \"10.0.0.2:9108\", raddr: \"10.0.0.1:9108\"},\n\t)\n\toutPeer, err := peer.NewOutboundPeer(peerCfg, inConn.laddr)\n\tif err != nil {\n\t\tt.Fatalf(\"NewOutboundPeer: unexpected err: %v\\n\", err)\n\t}\n\toutPeer.AssociateConnection(outConn)\n\tinPeer := peer.NewInboundPeer(peerCfg)\n\tinPeer.AssociateConnection(inConn)\n\t// Wait for the veracks from the initial protocol version negotiation.\n\tfor i := 0; i < 2; i++ {\n\t\tselect {\n\t\tcase <-verack:\n\t\tcase <-time.After(time.Second):\n\t\t\tt.Fatal(\"verack timeout\")\n\t\t}\n\t}\n\t// Queue a duplicate version message from the outbound peer and wait until\n\t// it is sent.\n\tdone := make(chan struct{})\n\toutPeer.QueueMessage(&wire.MsgVersion{}, done)\n\tselect {\n\tcase <-done:\n\tcase <-time.After(time.Second):\n\t\tt.Fatal(\"send duplicate version timeout\")\n\t}\n\t// Ensure the peer that is the recipient of the duplicate version closes the\n\t// connection.\n\tdisconnected := make(chan struct{}, 1)\n\tgo func() {\n\t\tinPeer.WaitForDisconnect()\n\t\tdisconnected <- struct{}{}\n\t}()\n\tselect {\n\tcase <-disconnected:\n\tcase <-time.After(time.Second):\n\t\tt.Fatal(\"peer did not disconnect\")\n\t}\n}", "title": "" }, { "docid": "0733e3994bdfa760d432f8f43907798e", "score": "0.46811107", "text": "func (p ProtocolVersion) Version() byte {\n\treturn byte(p)\n}", "title": "" }, { "docid": "69d5290ee3045117832d623cbafc3e0f", "score": "0.46804816", "text": "func (_AloAgriOnion *AloAgriOnionCallerSession) Version() (*big.Int, error) {\n\treturn _AloAgriOnion.Contract.Version(&_AloAgriOnion.CallOpts)\n}", "title": "" }, { "docid": "986bbfd19c031a9211bd37dd2f7fc117", "score": "0.46775305", "text": "func (_SMTToken *SMTTokenCallerSession) Version() (string, error) {\n\treturn _SMTToken.Contract.Version(&_SMTToken.CallOpts)\n}", "title": "" }, { "docid": "b4232bc7a089f99c6e741f0e3f1478c0", "score": "0.46764258", "text": "func (cc *clientConn) handshake(ctx context.Context) error {\n\tif err := cc.writeInitialHandshake(ctx); err != nil {\n\t\tif errors.Cause(err) == io.EOF {\n\t\t\tlogutil.Logger(ctx).Debug(\"Could not send handshake due to connection has be closed by client-side\")\n\t\t} else {\n\t\t\tlogutil.Logger(ctx).Debug(\"Write init handshake to client fail\", zap.Error(errors.SuspendStack(err)))\n\t\t}\n\t\treturn err\n\t}\n\tif err := cc.readOptionalSSLRequestAndHandshakeResponse(ctx); err != nil {\n\t\terr1 := cc.writeError(ctx, err)\n\t\tif err1 != nil {\n\t\t\tlogutil.Logger(ctx).Debug(\"writeError failed\", zap.Error(err1))\n\t\t}\n\t\treturn err\n\t}\n\n\t// MySQL supports an \"init_connect\" query, which can be run on initial connection.\n\t// The query must return a non-error or the client is disconnected.\n\tif err := cc.initConnect(ctx); err != nil {\n\t\tlogutil.Logger(ctx).Warn(\"init_connect failed\", zap.Error(err))\n\t\tinitErr := servererr.ErrNewAbortingConnection.FastGenByArgs(cc.connectionID, \"unconnected\", cc.user, cc.peerHost, \"init_connect command failed\")\n\t\tif err1 := cc.writeError(ctx, initErr); err1 != nil {\n\t\t\tterror.Log(err1)\n\t\t}\n\t\treturn initErr\n\t}\n\n\tdata := cc.alloc.AllocWithLen(4, 32)\n\tdata = append(data, mysql.OKHeader)\n\tdata = append(data, 0, 0)\n\tif cc.capability&mysql.ClientProtocol41 > 0 {\n\t\tdata = dump.Uint16(data, mysql.ServerStatusAutocommit)\n\t\tdata = append(data, 0, 0)\n\t}\n\n\terr := cc.writePacket(data)\n\tcc.pkt.SetSequence(0)\n\tif err != nil {\n\t\terr = errors.SuspendStack(err)\n\t\tlogutil.Logger(ctx).Debug(\"write response to client failed\", zap.Error(err))\n\t\treturn err\n\t}\n\n\terr = cc.flush(ctx)\n\tif err != nil {\n\t\terr = errors.SuspendStack(err)\n\t\tlogutil.Logger(ctx).Debug(\"flush response to client failed\", zap.Error(err))\n\t\treturn err\n\t}\n\n\t// With mysql --compression-algorithms=zlib,zstd both flags are set, the result is Zlib\n\tif cc.capability&mysql.ClientCompress > 0 {\n\t\tcc.pkt.SetCompressionAlgorithm(mysql.CompressionZlib)\n\t} else if cc.capability&mysql.ClientZstdCompressionAlgorithm > 0 {\n\t\tcc.pkt.SetCompressionAlgorithm(mysql.CompressionZstd)\n\t}\n\n\treturn err\n}", "title": "" } ]
f06f1b3dcae3199c7072ee7c97918064
SetName sets the Name field's value.
[ { "docid": "1aad27b13585f62cf8a0130e7791f65b", "score": "0.0", "text": "func (s *Repository) SetName(v string) *Repository {\n\ts.Name = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "4873fd034c860e88a2427ce3031784b7", "score": "0.82193255", "text": "func (cli *SetWrapper) SetName(name string) error {\n\treturn cli.set.SetValue(fieldSetName, name)\n}", "title": "" }, { "docid": "d11296c2296e6ac1fe78360f452b75a9", "score": "0.79426783", "text": "func (s UserSet) SetName(value string) {\n\ts.RecordCollection.Set(models.NewFieldName(\"Name\", \"name\"), value)\n}", "title": "" }, { "docid": "831bcd0ed2362e5dc3624235b120cf8b", "score": "0.7628859", "text": "func (s *MyTestStruct) SetName(n string) *MyTestStruct {\n\tif s.mutable {\n\t\ts.field_Name = n\n\t\treturn s\n\t}\n\n\tres := *s\n\tres.field_Name = n\n\treturn &res\n}", "title": "" }, { "docid": "4c7d2191a4a6cce86b5dd39c4d563621", "score": "0.7387125", "text": "func (m *SDKScriptCollectorAttribute) SetName(val string) {\n\n}", "title": "" }, { "docid": "5af55e57213d12b9e6267666bf05a37c", "score": "0.73806214", "text": "func (suo *SettingUpdateOne) SetName(s string) *SettingUpdateOne {\n\tsuo.mutation.SetName(s)\n\treturn suo\n}", "title": "" }, { "docid": "805f7f44f0709db6a7747cda54f06fa3", "score": "0.7303468", "text": "func (muo *ModelUpdateOne) SetName(s string) *ModelUpdateOne {\n\tmuo.mutation.SetName(s)\n\treturn muo\n}", "title": "" }, { "docid": "f5afc4bafdb9db7e5330cf178beed6d3", "score": "0.72858477", "text": "func (fp MockProvider) SetName(name string) {\n\tfp.faux.SetName(name)\n}", "title": "" }, { "docid": "73f476479326cbdaa0e59fd7bdb5e9ce", "score": "0.7275981", "text": "func (b *TestDriver) SetName(n string) { b.name = n }", "title": "" }, { "docid": "f1dd167117552365b321c39dd41e6619", "score": "0.7256345", "text": "func (nc *NodeCreate) SetName(s string) *NodeCreate {\n\tnc.mutation.SetName(s)\n\treturn nc\n}", "title": "" }, { "docid": "1d0a30dd9c480187366a3d0bd4feb1b5", "score": "0.7235227", "text": "func (m *LabelActionBase) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3b6687f22b125e2a9074649d5cb9991c", "score": "0.72102624", "text": "func (f *Flow) setName(n string) {\n\tf.Name = n\n}", "title": "" }, { "docid": "5a4f40735da13d1d0d5956b2f6d119fd", "score": "0.72089285", "text": "func (_Contract *ContractTransactor) SetName(opts *bind.TransactOpts, node [32]byte, name string) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"setName\", node, name)\n}", "title": "" }, { "docid": "f96b32799d16ed86219184a8b2294d10", "score": "0.72042316", "text": "func (k *Kitten) SetName(name string) {\n k.Name = name\n}", "title": "" }, { "docid": "ab8d9141b0118c4862ea215a5f9f6bda", "score": "0.7182031", "text": "func (m *PolicyRule) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "835a971f744cbcd3eaba9405d4362854", "score": "0.71804714", "text": "func (d *Driver) SetName(n string) { d.name = n }", "title": "" }, { "docid": "c28d7885878ee96c0eee7046aa28e9b2", "score": "0.7157933", "text": "func (c *Mock) SetName(v string) interfaces.Client {\n\treturn c.FakeSetName(v)\n}", "title": "" }, { "docid": "0b54644371fe19e6228aa33bf908a7be", "score": "0.71506965", "text": "func (p *MockPeer) SetName(name string) {\r\n\tp.MockName = name\r\n}", "title": "" }, { "docid": "8135381621b8e0ebbe5f1d0f09d12c7d", "score": "0.71336704", "text": "func (mu *ModelUpdate) SetName(s string) *ModelUpdate {\n\tmu.mutation.SetName(s)\n\treturn mu\n}", "title": "" }, { "docid": "aa2c74bdd6fc127662ea2f3f28aa3903", "score": "0.7116052", "text": "func (e *Entry) SetName(name string) {\n\tif utf8.ValidString(name) {\n\t\te.Name = name\n\t} else {\n\t\te.NameRaw = []byte(name)\n\t}\n}", "title": "" }, { "docid": "ce037cefe4dbe0cb0dddd2dab7433e4a", "score": "0.711167", "text": "func (n *ACName) Set(s string) error {\n\tnn, err := NewACName(s)\n\tif err == nil {\n\t\t*n = *nn\n\t}\n\treturn err\n}", "title": "" }, { "docid": "4791a9729cfb30816262de3d169f4180", "score": "0.7109849", "text": "func (request *DomainRegisterRequest) SetName(value *string) {\n\trequest.SetStringProperty(\"Name\", value)\n}", "title": "" }, { "docid": "a28957900121e68f08216e5af06b1541", "score": "0.7109847", "text": "func (m *CalendarGroup) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "eadefe6336e08b307d54114735058256", "score": "0.71001863", "text": "func (nuo *NodeUpdateOne) SetName(s string) *NodeUpdateOne {\n\tnuo.mutation.SetName(s)\n\treturn nuo\n}", "title": "" }, { "docid": "7309adec68ee60de271c3bc35d579fab", "score": "0.70926636", "text": "func (w *Worker) SetName(n string) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\tw.wr.name = n\n}", "title": "" }, { "docid": "234c5c873cf70bbf35818c60a462ef25", "score": "0.7079771", "text": "func (su *SettingUpdate) SetName(s string) *SettingUpdate {\n\tsu.mutation.SetName(s)\n\treturn su\n}", "title": "" }, { "docid": "89425dc0b4e6d3d04b96291ee9ebfe5b", "score": "0.7075373", "text": "func (xdc *XxxDemoCreate) SetName(s string) *XxxDemoCreate {\n\txdc.mutation.SetName(s)\n\treturn xdc\n}", "title": "" }, { "docid": "743b0b4406cde5c577921a4ee421f641", "score": "0.70664495", "text": "func (v VirtualSwitch) SetName(newName string) error {\n\t// Get fresh settings info\n\tswitchSettingsResult, err := v.virtualSwitch.Get(\"associators_\", nil, VMSwitchSettings)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"associators_\")\n\t}\n\n\tresult, err := switchSettingsResult.ItemAtIndex(0)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"ItemAtIndex\")\n\t}\n\n\tif err := result.Set(\"ElementName\", newName); err != nil {\n\t\treturn errors.Wrap(err, \"ElementName\")\n\t}\n\n\ttext, err := result.GetText(1)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"GetText\")\n\t}\n\tif err := v.modifySwitchSettings(text); err != nil {\n\t\treturn errors.Wrap(err, \"modifySwitchSettings\")\n\t}\n\n\tif err := v.setInternalPortName(newName); err != nil {\n\t\treturn errors.Wrap(err, \"setInternalPortName\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd4d712f1f5abe414391837cd964579a", "score": "0.7038097", "text": "func (kcuo *K8sContainerUpdateOne) SetName(s string) *K8sContainerUpdateOne {\n\tkcuo.mutation.SetName(s)\n\treturn kcuo\n}", "title": "" }, { "docid": "fc6d7e6d22484bebec3f5867fc1297cf", "score": "0.7036303", "text": "func (_SweetToken *SweetTokenTransactor) SetName(opts *bind.TransactOpts, name_ string) (*types.Transaction, error) {\n\treturn _SweetToken.contract.Transact(opts, \"setName\", name_)\n}", "title": "" }, { "docid": "950e506b338c6bda9300af115b538ddf", "score": "0.7032954", "text": "func (bc *BeerCreate) SetName(s string) *BeerCreate {\n\tbc.mutation.SetName(s)\n\treturn bc\n}", "title": "" }, { "docid": "0b163cbf58be625c8d3ec3dc6e859edc", "score": "0.70289296", "text": "func SetName(name string) {\n\tcname := C.CString(name)\n\t/*if Name() != \"\" {\n\t\tC.free(unsafe.Pointer(C.rl_readline_name))\n\t}*/\n\tC.rl_readline_name = cname\n}", "title": "" }, { "docid": "50596ba9289253e395cdb715a83ce2f9", "score": "0.70242834", "text": "func (ktuo *KqiTargetUpdateOne) SetName(s string) *KqiTargetUpdateOne {\n\tktuo.mutation.SetName(s)\n\treturn ktuo\n}", "title": "" }, { "docid": "e49552123503c5d769e5e9ac76da1a6b", "score": "0.70209163", "text": "func (k keeper) SetName(ctx sdk.Context, name string, value, string){\n\twhois := k.GetWhois(ctx, name)\n\twhois.Value = value\n\tk.SetWhois(ctx, name, whois)\n}", "title": "" }, { "docid": "b8670632c8f1d3a7470fa444651143a8", "score": "0.7019446", "text": "func (nu *NodeUpdate) SetName(s string) *NodeUpdate {\n\tnu.mutation.SetName(s)\n\treturn nu\n}", "title": "" }, { "docid": "d9e7ae797f297a1a23d166d5c7a3704f", "score": "0.7008658", "text": "func (p *MockPeer) SetName(name string) {\n\tp.MockName = name\n}", "title": "" }, { "docid": "fd299d10b75da1966734200eae91e419", "score": "0.6999751", "text": "func (e *ObservableEditableBuffer) SetName(name string) {\n\tif e.Name() == name {\n\t\treturn\n\t}\n\n\t// SetName always forces an update of the tag.\n\t// TODO(rjk): This reset of filtertagobservers might now be unnecessary.\n\te.filtertagobservers = false\n\tbefore := e.getTagStatus()\n\tdefer e.notifyTagObservers(before)\n\n\tif e.seq > 0 {\n\t\t// TODO(rjk): Pass in the name, make the function name better reflect its purpose.\n\t\te.f.UnsetName(e.Name(), e.seq)\n\t}\n\te.setfilename(name)\n}", "title": "" }, { "docid": "2e66ff99eed428a5fbc16832088a4227", "score": "0.6992018", "text": "func (dc *DentistCreate) SetName(s string) *DentistCreate {\n\tdc.mutation.SetName(s)\n\treturn dc\n}", "title": "" }, { "docid": "45db030d9680485007c4876638927e29", "score": "0.6984207", "text": "func (m *AgedAccountsPayable) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6fab6badba44be0b3b1627bce1669ffa", "score": "0.6982086", "text": "func (puo *PharmacistUpdateOne) SetName(s string) *PharmacistUpdateOne {\n\tpuo.mutation.SetName(s)\n\treturn puo\n}", "title": "" }, { "docid": "dcd25c69a7e5a512f2ed3c4c6b0e136f", "score": "0.6979617", "text": "func (_ResolverContract *ResolverContractTransactor) SetName(opts *bind.TransactOpts, node [32]byte, name string) (*types.Transaction, error) {\n\treturn _ResolverContract.contract.Transact(opts, \"setName\", node, name)\n}", "title": "" }, { "docid": "5e51a2634bd53d7dd62e65c08c41a058", "score": "0.69790685", "text": "func (m *Resource) SetName(name string) error {\n\tif len(m.name) > 0 {\n\t\treturn errors.New(\"name already set\")\n\t}\n\tn := Name(name)\n\tok, err := n.IsValid()\n\tif err == nil && ok {\n\t\tm.name = n\n\t\treturn nil\n\t} else {\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "3b8e5cfa7aea7064234a18e57fe621d1", "score": "0.69744414", "text": "func (m *DeviceManagementConfigurationSettingDefinition) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "eb8b91fe821d97ec0e5e189a5ca64fed", "score": "0.69311064", "text": "func (atuo *ActivityTypeUpdateOne) SetName(s string) *ActivityTypeUpdateOne {\n\tatuo.mutation.SetName(s)\n\treturn atuo\n}", "title": "" }, { "docid": "57d5ab99ebb7faf4eedc4b5f4d870356", "score": "0.6930814", "text": "func (m *DeviceManagementApplicabilityRuleOsEdition) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b56d4bf765297982b790917c87559b81", "score": "0.69266975", "text": "func (n *Node) SetName(name string) bool {\n\tif n.Nm == name {\n\t\treturn false\n\t}\n\tn.Nm = name\n\tn.UniqueNm = name\n\tif n.Par != nil {\n\t\tn.Par.UniquifyNames()\n\t}\n\treturn true\n}", "title": "" }, { "docid": "77d6d31c68e8905696ac93e42f84c430", "score": "0.6925777", "text": "func (puo *PatientrecordUpdateOne) SetName(s string) *PatientrecordUpdateOne {\n\tpuo.mutation.SetName(s)\n\treturn puo\n}", "title": "" }, { "docid": "3b9c4af1397dc1772f34b3d12ef61f4c", "score": "0.69242513", "text": "func (m *DeviceManagementConfigurationPolicy) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "728d30dcd87a68364458a8a87a78a2d9", "score": "0.69229764", "text": "func (entry *Entry) SetName(name ndn.Name) error {\n\tnameV, _ := name.MarshalBinary()\n\tnameL := len(nameV)\n\tif nameL > MaxNameLength {\n\t\treturn fmt.Errorf(\"FIB entry name cannot exceed %d octets\", MaxNameLength)\n\t}\n\n\tc := (*CEntry)(entry)\n\tc.NameL = uint16(copy(c.NameV[:], nameV))\n\tc.NComps = uint8(len(name))\n\treturn nil\n}", "title": "" }, { "docid": "0e211bc34947210174462a11e74e0951", "score": "0.6919736", "text": "func (m *etcdMinion) SetName(name string) error {\n\tnameKey := filepath.Join(m.rootDir, \"name\")\n\topts := &etcdclient.SetOptions{\n\t\tPrevExist: etcdclient.PrevIgnore,\n\t}\n\n\t_, err := m.kapi.Set(context.Background(), nameKey, name, opts)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to set name of minion: %s\\n\", err)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "1e010f1887627c1daa0cb0b8e4ba16b9", "score": "0.6909485", "text": "func (ktu *KqiTargetUpdate) SetName(s string) *KqiTargetUpdate {\n\tktu.mutation.SetName(s)\n\treturn ktu\n}", "title": "" }, { "docid": "688a22dcd9c99f6f18e60a1e1346d9b4", "score": "0.69025326", "text": "func (luo *LibraryUpdateOne) SetName(s string) *LibraryUpdateOne {\n\tluo.mutation.SetName(s)\n\treturn luo\n}", "title": "" }, { "docid": "d1a844a9f951f30d217a93750164a7cf", "score": "0.6902132", "text": "func (iuo *ItemUpdateOne) SetName(s string) *ItemUpdateOne {\n\tiuo.mutation.SetName(s)\n\treturn iuo\n}", "title": "" }, { "docid": "ccff611807bc55744ddc4d1c50874acc", "score": "0.6898721", "text": "func (guo *GroupUpdateOne) SetName(s string) *GroupUpdateOne {\n\tguo.mutation.SetName(s)\n\treturn guo\n}", "title": "" }, { "docid": "752c2574c21b0046ee4efd9eade6ddb9", "score": "0.689851", "text": "func (mc *ManagerCreate) SetName(s string) *ManagerCreate {\n\tmc.mutation.SetName(s)\n\treturn mc\n}", "title": "" }, { "docid": "4074c9732bc0127135f3d998e111d12d", "score": "0.6889613", "text": "func (d UserData) SetName(value string) m.UserData {\n\td.ModelData.Set(models.NewFieldName(\"Name\", \"name\"), value)\n\treturn d\n}", "title": "" }, { "docid": "83e235f7b44acc7f564d5bb422574914", "score": "0.6886466", "text": "func (n *Node) SetName(name string) {\n\tn.name = name\n\tif n.cf != nil && n.cf.unquotedKey && (strings.IndexFunc(name, unicode.IsSpace) != -1 || strings.ContainsAny(name, \"\\\"{}\")) {\n\t\tn.cf.unquotedKey = false\n\t}\n}", "title": "" }, { "docid": "3998e5d6c2a595c15590e1115cd7fd7c", "score": "0.68850285", "text": "func (gsc *GameServerCreate) SetName(s string) *GameServerCreate {\n\tgsc.mutation.SetName(s)\n\treturn gsc\n}", "title": "" }, { "docid": "822eb5db33bdc927304451de9295e722", "score": "0.6880424", "text": "func (c *Configurator) SetName(name string) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tc.name = name\n}", "title": "" }, { "docid": "176ba4994142872cc779dcbdb37d51e7", "score": "0.6875202", "text": "func (k Keeper) SetName(ctx sdk.Context, name string, value string) {\n\twhois := k.GetWhois(ctx, name)\n\twhois.Value = value\n\tk.SetWhois(ctx, name, whois)\n}", "title": "" }, { "docid": "31a8a2962d626ccee0d875b317d3f948", "score": "0.68716985", "text": "func (m *ParentLabelDetails) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9b7ebe4e3a08c480063c7fc41878c9a7", "score": "0.6871508", "text": "func (m *WorkbookNamedItem) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b922b8ea4f97fb92a312c73a8015da71", "score": "0.6866207", "text": "func (tc *TokenCreate) SetName(s string) *TokenCreate {\n\ttc.mutation.SetName(s)\n\treturn tc\n}", "title": "" }, { "docid": "76dd48cde08dcb0798315d87496ed27d", "score": "0.68551236", "text": "func (rc *RuleCreate) SetName(s string) *RuleCreate {\n\trc.mutation.SetName(s)\n\treturn rc\n}", "title": "" }, { "docid": "e7f0ee7603d3b4806fed9d83a182a10f", "score": "0.6848835", "text": "func (b *ClientAdaptor) SetName(n string) { b.name = n }", "title": "" }, { "docid": "4edacf21172134beff43279daeac887c", "score": "0.68398744", "text": "func (puo *ProductUpdateOne) SetName(s string) *ProductUpdateOne {\n\tpuo.mutation.SetName(s)\n\treturn puo\n}", "title": "" }, { "docid": "8519742025fec7c13bc853b4216aeb33", "score": "0.6829844", "text": "func (ocuo *OAuthConnectionUpdateOne) SetName(s string) *OAuthConnectionUpdateOne {\n\tocuo.mutation.SetName(s)\n\treturn ocuo\n}", "title": "" }, { "docid": "cb9622d8e2e947237f678d90be778614", "score": "0.68262786", "text": "func SetName(name string) { note.Name = name }", "title": "" }, { "docid": "e690532745358ac56f424f620ed11714", "score": "0.68194884", "text": "func (m *ChatMessageAttachment) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "26a8a1431511276c77a739de13ad3e04", "score": "0.6816097", "text": "func (e *Element) SetName(value string) {\n\tif e.Parent != nil {\n\t\te.Parent.children.Rename(e.name, value)\n\t}\n\te.name = value\n}", "title": "" }, { "docid": "f08b240693e52f88f4b12ff8b2767103", "score": "0.6813862", "text": "func (duo *DeviceUpdateOne) SetName(s string) *DeviceUpdateOne {\n\tduo.mutation.SetName(s)\n\treturn duo\n}", "title": "" }, { "docid": "c9944f49a904555d5540569fd0568710", "score": "0.6813019", "text": "func (puo *PhoneUpdateOne) SetName(s string) *PhoneUpdateOne {\n\tpuo.mutation.SetName(s)\n\treturn puo\n}", "title": "" }, { "docid": "d1d65cead982111cec22049ba74ed607", "score": "0.6809827", "text": "func (gc *GroupCreate) SetName(s string) *GroupCreate {\n\tgc.mutation.SetName(s)\n\treturn gc\n}", "title": "" }, { "docid": "3bb11c626a51e99b6e2d28a59564a40e", "score": "0.6809445", "text": "func (m *WorkbookPivotTable) SetName(value *string)() {\n m.name = value\n}", "title": "" }, { "docid": "756e3b573d95a01e160a04ac50757b41", "score": "0.68082404", "text": "func (m *Mobile) SetName(username string) error {\n\tif !m.node.Online() {\n\t\treturn core.ErrOffline\n\t}\n\n\treturn m.node.SetName(username)\n}", "title": "" }, { "docid": "8891afe206899cb7315f0fe5fc1a1448", "score": "0.68077606", "text": "func (gsuo *GameServerUpdateOne) SetName(s string) *GameServerUpdateOne {\n\tgsuo.mutation.SetName(s)\n\treturn gsuo\n}", "title": "" }, { "docid": "e4c5ae890ba902916c680f98fc920c92", "score": "0.68068516", "text": "func ExamplePerson_SetName() {\n\tperson := NewPerson(\"alice\")\n\tperson.SetName(\"bob\")\n}", "title": "" }, { "docid": "e5fe341864c76871eab3978560e89877", "score": "0.6805989", "text": "func (h *MPU6050Driver) SetName(n string) { h.name = n }", "title": "" }, { "docid": "692596f4f42c69519a144e2d5456fadd", "score": "0.67954504", "text": "func (dc *DatasourceCreate) SetName(s string) *DatasourceCreate {\n\tdc.mutation.SetName(s)\n\treturn dc\n}", "title": "" }, { "docid": "e285be720816b3faf4cf93608d67ed1b", "score": "0.6787095", "text": "func (ctc *ClubTypeCreate) SetName(s string) *ClubTypeCreate {\n\tctc.mutation.SetName(s)\n\treturn ctc\n}", "title": "" }, { "docid": "e1a08b0780ccc6945fd76c3dbb514b90", "score": "0.6780527", "text": "func (mc *MenuCreate) SetName(s string) *MenuCreate {\n\tmc.mutation.SetName(s)\n\treturn mc\n}", "title": "" }, { "docid": "20ba5b60b19a4ee241b6cd6e360ac126", "score": "0.678004", "text": "func (p *Provider) SetName(name string) {\n\tp.name = name\n}", "title": "" }, { "docid": "7bd03a7e7882a1930efb96588644306b", "score": "0.67731935", "text": "func (xs *Sheet) SetName(name string) {\n\txs.xb.lib.NewProc(\"xlSheetSetNameW\").\n\t\tCall(xs.self, S(name))\n}", "title": "" }, { "docid": "79a2f91f17ba703147633e8a9a001aa9", "score": "0.6769569", "text": "func (tuo *TeamUpdateOne) SetName(s string) *TeamUpdateOne {\n\ttuo.mutation.SetName(s)\n\treturn tuo\n}", "title": "" }, { "docid": "89680d5fb9181f049abe4364a0be1dd5", "score": "0.6769197", "text": "func (m *WorkbookWorksheet) SetName(value *string)() {\n m.name = value\n}", "title": "" }, { "docid": "3d21ca7fbcc47cbff05811c6e9f9416c", "score": "0.67686564", "text": "func (c *Channel) SetName(name string) {\n\tpacket := MumbleProto.ChannelState{\n\t\tChannelId: &c.id,\n\t\tName: &name,\n\t}\n\tc.client.Send(protoMessage{&packet})\n}", "title": "" }, { "docid": "dc1890b0fd68b84bd4cdf0d35601d17a", "score": "0.6757842", "text": "func (iu *ItemUpdate) SetName(s string) *ItemUpdate {\n\tiu.mutation.SetName(s)\n\treturn iu\n}", "title": "" }, { "docid": "6e349b505d1dff619aa5f312ad1c05d6", "score": "0.6757552", "text": "func (kcu *K8sContainerUpdate) SetName(s string) *K8sContainerUpdate {\n\tkcu.mutation.SetName(s)\n\treturn kcu\n}", "title": "" }, { "docid": "c85739ee42198624b8d1be11fbf74cc7", "score": "0.6754719", "text": "func (m *ExternalConnection) SetName(value *string)() {\n m.name = value\n}", "title": "" }, { "docid": "2403283b8348003065ed4dd6465db37c", "score": "0.674975", "text": "func (ms MetricDescriptor) SetName(v string) {\n\t(*ms.orig).Name = v\n}", "title": "" }, { "docid": "46dd57265b07213d7a0d2cd478072c88", "score": "0.6742631", "text": "func (ouo *OrganizationUpdateOne) SetName(s string) *OrganizationUpdateOne {\n\touo.mutation.SetName(s)\n\treturn ouo\n}", "title": "" }, { "docid": "46dd57265b07213d7a0d2cd478072c88", "score": "0.6742631", "text": "func (ouo *OrganizationUpdateOne) SetName(s string) *OrganizationUpdateOne {\n\touo.mutation.SetName(s)\n\treturn ouo\n}", "title": "" }, { "docid": "db95f8a4d3f378959bf9333e9a2a5442", "score": "0.67421144", "text": "func (mnuo *MetricNameUpdateOne) SetName(s string) *MetricNameUpdateOne {\n\tmnuo.mutation.SetName(s)\n\treturn mnuo\n}", "title": "" }, { "docid": "6833ae3dce9176bcab15c7ba9275d533", "score": "0.67386776", "text": "func (suo *SkillUpdateOne) SetName(s string) *SkillUpdateOne {\n\tsuo.mutation.SetName(s)\n\treturn suo\n}", "title": "" }, { "docid": "a3c3a1f5905ff5615f6ae576538d23c0", "score": "0.6733495", "text": "func (euo *EmployeeUpdateOne) SetName(s string) *EmployeeUpdateOne {\n\teuo.mutation.SetName(s)\n\treturn euo\n}", "title": "" }, { "docid": "9bcee286e37e8f102d137579d9374dc3", "score": "0.6718994", "text": "func (gsu *GameServerUpdate) SetName(s string) *GameServerUpdate {\n\tgsu.mutation.SetName(s)\n\treturn gsu\n}", "title": "" }, { "docid": "4176b37f26f9540a9bcd0aa0b22293d7", "score": "0.6707963", "text": "func (du *DeviceUpdate) SetName(s string) *DeviceUpdate {\n\tdu.mutation.SetName(s)\n\treturn du\n}", "title": "" }, { "docid": "582e9e2ee5dd3fbc56e7f9c85c617392", "score": "0.670503", "text": "func (auo *AddressUpdateOne) SetName(s string) *AddressUpdateOne {\n\tauo.mutation.SetName(s)\n\treturn auo\n}", "title": "" }, { "docid": "d0bc766c6d7b5b2c362090ecb2d5d3ca", "score": "0.67038023", "text": "func (o *Partition) SetName(ctx context.Context, name string, options map[string]dbus.Variant) (err error) {\n\terr = o.object.CallWithContext(ctx, InterfacePartition+\".SetName\", 0, name, options).Store()\n\treturn\n}", "title": "" }, { "docid": "7d967238933789f1fee22c312732acee", "score": "0.6697482", "text": "func (gu *GroupUpdate) SetName(s string) *GroupUpdate {\n\tgu.mutation.SetName(s)\n\treturn gu\n}", "title": "" }, { "docid": "c10855c9f091aa592e2f38540b18bd07", "score": "0.6696623", "text": "func (ec *EquipmentCreate) SetName(s string) *EquipmentCreate {\n\tec.mutation.SetName(s)\n\treturn ec\n}", "title": "" }, { "docid": "b2099524091e3dc1b206be5979b06e9f", "score": "0.66945755", "text": "func (cc *Client) SetName(name string) (*User, error) {\n\tif !ValidateName(name) {\n\t\treturn nil, ErrNameInvalid\n\t}\n\tu := &User{}\n\tu.Name = name\n\terr := cc.AuthedRequest(\"POST\", cc.config.BioHost, cc.config.BioPort, \"/v1/bio\", u, u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn u, nil\n}", "title": "" } ]
de35bc4e3005c1f4374a8736dc626e89
CountPages in the site
[ { "docid": "43dd11228efc6d4bcb48d9207d90c898", "score": "0.79047227", "text": "func (s *Site) CountPages() (pages int) {\n\tresp, err := http.Get(s.url)\n\tutil.CheckErr(err)\n\tutil.CheckStatusCode(resp)\n\tdefer resp.Body.Close()\n\n\tdoc, err := goquery.NewDocumentFromReader(resp.Body)\n\tutil.CheckErr(err)\n\tdoc.Find(\".pagination\").Each(func(i int, s *goquery.Selection) {\n\t\tpages = s.Find(\"a\").Length()\n\t})\n\treturn\n}", "title": "" } ]
[ { "docid": "70268e657ed0c054e26d2f585adce7f6", "score": "0.78359145", "text": "func (scrapper *Scrapper) getPagesCount(tor *FilmTracker) (count int, err error) {\n\tscrapper.mainCollector.OnHTML(tor.PageCount, func(e *colly.HTMLElement) {\n\t\tcount, err = strconv.Atoi(e.DOM.Children().Last().Text())\n\t})\n\tscrapper.visitWithRetry(scrapper.mainCollector, tor.URL+tor.URLCategory, 30)\n\treturn\n}", "title": "" }, { "docid": "1ef29b92fc25bd6b983723744f71da8e", "score": "0.73891115", "text": "func getPages(baseURL string) int {\n\tpages := 0\n\tres, err := http.Get(baseURL)\n\tcheckErr(err)\n\tcheckCode(res)\n\n\tdefer res.Body.Close() // We need to close IO... after function is done prevent memory leak\n\t// Load the HTML document\n\tdoc, err := goquery.NewDocumentFromReader(res.Body) //Body is basically Byte IO\n\tcheckErr(err)\n\n\t//class name of the page : pagination-list\n\tdoc.Find(\".paging\").Each(func(i int, s *goquery.Selection) {\n\t\t// we have next , big next and no 1\n\t\t// keep next because we don't count for \"1\" (first page)\n\t\t//fmt.Println(s.Find(\"a\").Length()) // count the link\n\t\tpages = s.Find(\"a\").Length()\n\t})\n\t//fmt.Println(doc)\n\n\treturn pages\n}", "title": "" }, { "docid": "168bae28b961f01d4f67a1b5abe926d2", "score": "0.7300222", "text": "func PageCount(total int64, limit int64) int64 {\n\tif limit == 0 {\n\t\tlimit = DefaultLimit\n\t}\n\n\tpages := total / limit\n\n\tif total%limit > 0 {\n\t\tpages++\n\t}\n\n\treturn pages\n}", "title": "" }, { "docid": "28a84404f853443e7890f755feb9063e", "score": "0.72775126", "text": "func (cl CheckList) PageCount() int {\n\treturn len(cl)\n}", "title": "" }, { "docid": "0dedb9f83eb9c2a85100f67c4c277a20", "score": "0.72363716", "text": "func PageCount(n int32, p int32) int32 {\n\tif turnFront(p) > turnBack(n, p) {\n\t\treturn turnBack(n, p)\n\t}\n\treturn turnFront(p)\n}", "title": "" }, { "docid": "f59e823f336b76d1e7da35d25086725e", "score": "0.7220822", "text": "func (t Paises) CountPage(limit int) int {\n\n\t// variável para armazenar a qtd total de registro da tabela.\n\tvar count int\n\n\t// Conta no banco de dados a quantidade de registro\n\tdb.Table(t.TableName()).Count(&count)\n\n\t// Calcula a quantidade de páginas com base na quantidade registro e tamanho da página (limit).\n\tif count > limit {\n\t\tcount = count / limit\n\t\tvar remainder = count % limit\n\t\tif (remainder > 0) {\n\t\t\tcount += 1\n\t\t}\n\t} else {\n\t\tcount = 1\n\t}\n\n\tlog.Printf(\"Total de Page: \" + strconv.Itoa(count))\n\n\t// retorna a quantidade de ṕáginas\n\treturn count\n\n}", "title": "" }, { "docid": "fc54271d765dcff58090c1e39d8d16e9", "score": "0.6990434", "text": "func (p *Phracked) countPages() {\n\tfiles, err := ioutil.ReadDir(p.temp)\n\tif err != nil {\n\t\tcleanFatal(err)\n\t}\n\tp.pages = 0\n\tfor _, file := range files {\n\t\tif strings.HasSuffix(file.Name(), \".txt\") {\n\t\t\tp.pages++\n\t\t}\n\t}\n}", "title": "" }, { "docid": "14ce53c657d63b1ecb28d60e489c7e39", "score": "0.6969067", "text": "func (gen *PageGenerator) Count() uint {\n return gen.ElementsCount\n}", "title": "" }, { "docid": "047f9b326fccd59741b868493027cf29", "score": "0.6857158", "text": "func (pa *PageOfVulnerabilityCheck) TotalPages() int {\n\tvar pages = 0\n\tif pa.Page != nil {\n\t\tpages = int(pa.Page.TotalPages)\n\t}\n\n\treturn pages\n}", "title": "" }, { "docid": "ce489a5c9b924fd87ac9aff63b0438a5", "score": "0.6845821", "text": "func (pr *Printer) PageCount() int {\n\tpr.mtx.RLock()\n\tdefer pr.mtx.RUnlock()\n\treturn int(pr.pagecount)\n}", "title": "" }, { "docid": "7ac38922125974543b29a2ef8bb86ded", "score": "0.6844707", "text": "func (w *Plugins) Pages() int { return w.Info.Pages }", "title": "" }, { "docid": "0d9112cdaf7cd0e1ee1a0a14b7d1b59e", "score": "0.6781186", "text": "func (pa *PageOfVulnerability) TotalPages() int {\n\tvar pages = 0\n\tif pa.Page != nil {\n\t\tpages = int(pa.Page.TotalPages)\n\t}\n\n\treturn pages\n}", "title": "" }, { "docid": "c594e9571e2ecd9b31a642bad65a4935", "score": "0.6754559", "text": "func (pa *PageOfVulnerabilityReference) TotalPages() int {\n\tvar pages = 0\n\tif pa.Page != nil {\n\t\tpages = int(pa.Page.TotalPages)\n\t}\n\n\treturn pages\n}", "title": "" }, { "docid": "222c58e0343f52a18082a1d9b7176fc9", "score": "0.66323096", "text": "func (pa *PageOfFinding) TotalPages() int {\n\tvar pages = 0\n\tif pa.Page != nil {\n\t\tpages = int(pa.Page.TotalPages)\n\t}\n\n\treturn pages\n}", "title": "" }, { "docid": "c2a781e1070d2754f9db444eeab6cb10", "score": "0.6540364", "text": "func GetPageAndCount(r *http.Request, offset bool) (int, int) {\n\tp64, err := strconv.ParseInt(r.URL.Query().Get(\"p\"), 10, 0)\n\tp := int(p64)\n\tif err != nil || p < 1 {\n\t\tp = 1\n\t}\n\n\tc64, err := strconv.ParseInt(r.URL.Query().Get(\"c\"), 10, 0)\n\tc := int(c64)\n\tif err != nil || c > maxPerPage.Int() || c < minPerPage.Int() {\n\t\tc = perPage.Int()\n\t}\n\n\tif offset {\n\t\t// If i need to make it to offset model then do it here\n\t\tp = (p - 1) * c\n\t}\n\n\treturn p, c\n}", "title": "" }, { "docid": "8c36a8601d525fdb65a0c9a5a4248676", "score": "0.65131295", "text": "func (m MovieScraper) summarizePageCount() (int, error) {\n\turl := fmt.Sprintf(summarizeURL, 1)\n\tdoc, err := goquery.NewDocument(url)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Get the last button in the \"pages menu\"\n\tnumber := doc.Find(\"div.pagination-item-holder\").\n\t\tChildren().Last().Text()\n\treturn strconv.Atoi(number)\n}", "title": "" }, { "docid": "45cb4fd8199db5567bccc1c530ca920d", "score": "0.64522475", "text": "func totalPageCount(len, pageSize uint64) uint64 {\n\tif len % pageSize == 0 {\n\t\treturn len / pageSize\n\t} else {\n\t\treturn (len / pageSize) + 1\n\t}\n}", "title": "" }, { "docid": "9ce3ee15f41c43b3dc2faad175701327", "score": "0.64248806", "text": "func (pa *PageOfAsset) TotalPages() int {\n\tvar pages = 0\n\tif pa.Page != nil {\n\t\tpages = int(pa.Page.TotalPages)\n\t}\n\n\treturn pages\n}", "title": "" }, { "docid": "36e5d24cee0d5f819ae8fdbbad580779", "score": "0.6390975", "text": "func (pa *PageOfSolution) TotalPages() int {\n\tvar pages = 0\n\tif pa.Page != nil {\n\t\tpages = int(pa.Page.TotalPages)\n\t}\n\n\treturn pages\n}", "title": "" }, { "docid": "90d2eef84b3a761713d294044fed24c3", "score": "0.63024473", "text": "func (pa *PageOfScan) TotalPages() int {\n\tvar pages = 0\n\tif pa.Page != nil {\n\t\tpages = int(pa.Page.TotalPages)\n\t}\n\n\treturn pages\n}", "title": "" }, { "docid": "704aa9c863833a84b8c32a5944d45949", "score": "0.6267716", "text": "func (q pageQuery) Count(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"repo: failed to count page rows\")\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "f3c001371e66c27178748bc4fabc786e", "score": "0.61824214", "text": "func _160sqlite3PagerPagecount(tls crt.TLS, _pPager uintptr /* *TPager = SPager */, _pnPage uintptr /* *int32 */) {\n\t*(*int32)(unsafe.Pointer(_pnPage)) = int32(*(*uint32)(unsafe.Pointer(_pPager + 28)))\n}", "title": "" }, { "docid": "31f83ddb158bc19a399d9d562bb361b2", "score": "0.6120405", "text": "func GetPageNum(baseURL string) (pageNum int) {\r\n\r\n\t// dummyBigNumber is used just for getting last page from target URL\r\n\tconst dummyBigNumber int = 99999\r\n\r\n\tlastPageURL := urlBuilder(baseURL, dummyBigNumber)\r\n\r\n\tdoc := getPageDocObject(lastPageURL)\r\n\r\n\tdoc.Find(\".pagination-list\").Each(func(i int, s *goquery.Selection) {\r\n\r\n\t\tpageNum, _ = strconv.Atoi(s.Find(\"b\").Text())\r\n\r\n\t})\r\n\r\n\tif pageNum == 0 {\r\n\r\n\t\tlog.Fatal(\"Total size of page is 0... Failed to load pages.\")\r\n\t} else {\r\n\r\n\t\tlog.Printf(\"There are %d pages.\", pageNum)\r\n\t}\r\n\r\n\treturn\r\n}", "title": "" }, { "docid": "70b2d4fd51af3ffc33f012f8a29c6406", "score": "0.60634655", "text": "func (c *Client) totalPages(redisClient interfaces.RedisClient, leaderboardID string, pageSize int) (int, error) {\n\tpages := 0\n\ttotal, err := redisClient.ZCard(leaderboardID).Result()\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"Number of pages could not be retrieved: %v\", err)\n\t}\n\tpages = int(math.Ceil(float64(total) / float64(pageSize)))\n\treturn pages, nil\n}", "title": "" }, { "docid": "5ebb867b61d75bdcc3c08bd33526a615", "score": "0.6059038", "text": "func FetchPageAmount() (int, error) {\n\turl := \"https://www.ptt.cc/bbs/Beauty/index.html\"\n\n\tclient := http.DefaultClient\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\treq.Header.Set(\"Cookie\", \"over18=1\")\n\n\tres, _ := client.Do(req)\n\tdoc, _ := goquery.NewDocumentFromResponse(res)\n\n\tprevPageSelector := \"div.btn-group.btn-group-paging a:nth-child(2)\"\n\thref, _ := doc.Find(prevPageSelector).Attr(\"href\")\n\n\tvar n int\n\tfmt.Sscanf(href, \"/bbs/Beauty/index%d.html\", &n)\n\n\tif n == 0 {\n\t\treturn 0, errors.New(\"Cannot connect to PTT\")\n\t}\n\treturn n + 1, nil\n}", "title": "" }, { "docid": "be2f31749675888ec5662012dd94d774", "score": "0.5944263", "text": "func _898numberOfCachePages(tls crt.TLS, _p uintptr /* *TPCache = SPCache */) (r int32) {\n\tif (*(*int32)(unsafe.Pointer(_p + 28))) < int32(0) {\n\t\tgoto _1\n\t}\n\n\treturn *(*int32)(unsafe.Pointer(_p + 28))\n\n\tgoto _2\n\n_1:\n\treturn int32((int64(-1024) * int64(*(*int32)(unsafe.Pointer(_p + 28)))) / int64((*(*int32)(unsafe.Pointer(_p + 36)))+(*(*int32)(unsafe.Pointer(_p + 40)))))\n\n_2:\n\treturn r\n}", "title": "" }, { "docid": "9a7a4e1c752936decb020985b0dd04c5", "score": "0.5930271", "text": "func _877pagerPagecount(tls crt.TLS, _pPager uintptr /* *TPager = SPager */, _pnPage uintptr /* *TPgno = Tu32 = uint32 */) (r int32) {\n\tesc := crt.MustMalloc(8)\n\tvar (\n\t\t_nPage uint32\n\t\t_n = esc // *Ti64 = Tsqlite_int64 = int64\n\t\t_rc int32\n\t)\n\tdefer crt.Free(esc)\n\n\t_nPage = _1139sqlite3WalDbsize(tls, *(*uintptr)(unsafe.Pointer(_pPager + 288)))\n\tif _nPage != uint32(0) || (*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(_pPager + 72))))) == 0 {\n\t\tgoto _1\n\t}\n\n\t*(*int64)(unsafe.Pointer(_n)) = int64(0)\n\t_rc = _352sqlite3OsFileSize(tls, *(*uintptr)(unsafe.Pointer(_pPager + 72)), _n)\n\tif _rc == int32(0) {\n\t\tgoto _2\n\t}\n\n\treturn _rc\n\n_2:\n\t_nPage = uint32((((*(*int64)(unsafe.Pointer(_n))) + int64(*(*int32)(unsafe.Pointer(_pPager + 188)))) - int64(1)) / int64(*(*int32)(unsafe.Pointer(_pPager + 188))))\n_1:\n\tif _nPage <= (*(*uint32)(unsafe.Pointer(_pPager + 192))) {\n\t\tgoto _3\n\t}\n\n\t*(*uint32)(unsafe.Pointer(_pPager + 192)) = _nPage\n_3:\n\t*(*uint32)(unsafe.Pointer(_pnPage)) = _nPage\n\treturn int32(0)\n}", "title": "" }, { "docid": "595d541c49493d5b14dc926c2b257e80", "score": "0.59189534", "text": "func (p *Page) countRegions() int {\n\tvar regionCount int\n\n\tfor _, h := range p.Segments {\n\t\tswitch h.Type {\n\t\tcase 6, 7, 22, 23, 38, 39, 42, 43:\n\t\t\tregionCount++\n\t\t}\n\t}\n\treturn regionCount\n}", "title": "" }, { "docid": "c9bbf5d84c5628ea651c8efbe82c0f9a", "score": "0.5899573", "text": "func GetPagesNumber() int {\n\trespBytes := DoRequest(\"GET\", baseURL)\n\tvar deviceList DeviceList\n\tjson.Unmarshal(respBytes, &deviceList)\n\treturn deviceList.Pages\n}", "title": "" }, { "docid": "2b54d42d3b69fd048ba12a52bbd4bf5d", "score": "0.5866328", "text": "func _775sqlite3PcachePagecount(tls crt.TLS, _pCache uintptr /* *TPCache = SPCache */) (r int32) {\n\treturn fn12(*(*uintptr)(unsafe.Pointer((_28sqlite3Config + 184) + 48)))(tls, *(*uintptr)(unsafe.Pointer(_pCache + 64)))\n}", "title": "" }, { "docid": "b78cfa6cced2e44375cca1987e19c6d6", "score": "0.5860096", "text": "func (i *InstancesCrawler) Count() int {\n\treturn i.count\n}", "title": "" }, { "docid": "df550cf7f0e2d6af190c25cdc5147d54", "score": "0.5819644", "text": "func (um *URLMap) Count() int {\n\tif um.Closed() {\n\t\treturn 0\n\t}\n\tum.RLock()\n\tdefer um.RUnlock()\n\tsize := um.dkst.Count()\n\tif um.UseWriteCache {\n\t\tsize += len(um.mpTow)\n\t}\n\treturn size\n}", "title": "" }, { "docid": "ae1f18fdc65e6e491f1e6d904742e3e9", "score": "0.5789192", "text": "func (p Paginator) PageNums() int {\n\tn := int(math.Ceil(float64(p.Nums()) / float64(p.maxPerPage)))\n\tif n == 0 {\n\t\tn = 1\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "6cc62cf8082c99fb93eb343be4f3620a", "score": "0.5784182", "text": "func countEndpoint(request *http.Request, start time.Time) {\n\turl := request.URL.String()\n\tduration := time.Since(start)\n\tlog.Printf(\"Time to serve the page: %s\\n\", duration)\n\n\tapiRequests.With(prometheus.Labels{\"url\": url}).Inc()\n\n\tapiResponses.With(prometheus.Labels{\"url\": url}).Observe(float64(duration.Microseconds()))\n}", "title": "" }, { "docid": "04c2a08f930d2741a5898ba615021771", "score": "0.5782425", "text": "func (rp *recyclingPage) availablePages() int {\n\treturn len(rp.pagesToFree) + len(rp.pages)\n}", "title": "" }, { "docid": "d0241b0a0b67afc0d53034c37536c51b", "score": "0.5770939", "text": "func _850sqlite3PagerPageRefcount(tls crt.TLS, _pPage uintptr /* *TDbPage = SPgHdr */) (r int32) {\n\treturn _1131sqlite3PcachePageRefcount(tls, _pPage)\n}", "title": "" }, { "docid": "2d6581f3ff624f77a45ae698e2f83969", "score": "0.5769766", "text": "func countGo(url string) (siteStat, error) {\n\t// send GET request\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn siteStat{url, 0}, fmt.Errorf(\"request to %s failed, %s\", url, err)\n\t}\n\tdefer resp.Body.Close()\n\t// check the status of the response\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn siteStat{url, 0}, fmt.Errorf(\"request to %s failed, %s\", url, resp.Status)\n\t}\n\t// check content type\n\tcontentType := resp.Header.Get(\"Content-Type\")\n\tif contentType != \"text/html\" && !strings.HasPrefix(contentType, \"text/html;\") {\n\t\treturn siteStat{url, 0}, fmt.Errorf(\"the type of doc at %s is not text/html but %s\", url, contentType)\n\t}\n\t// put the body of response into buffer\n\tresp_body, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tfmt.Errorf(\"read from body of response from %s error %s\", url, err)\n\t}\n\t// count the number of \"Go\" instanses in the body of response\n\tnumGo := bytes.Count(resp_body, []byte(\"Go\"))\n\treturn siteStat{url, numGo}, nil\n}", "title": "" }, { "docid": "c712d3e8bcee88cf40fbf79943698632", "score": "0.5769572", "text": "func folderCount() {\n\tlock.Lock()\n\tfolderVisit++\n\tlock.Unlock()\n}", "title": "" }, { "docid": "dfca0cd96530c60bf4c1d1ba063abb8d", "score": "0.57642365", "text": "func (s *URLStore) Count() int {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn len(s.urls)\n}", "title": "" }, { "docid": "1ebd84216e9d62f4e2c569a997777a20", "score": "0.57471627", "text": "func CountHandler(w http.ResponseWriter, r *http.Request) {\n\t<<!!YOUR_CODE!!>> -- fetch the vars from gorilla for the book and word\n\t<<!!YOUR_CODE!!>> -- compute the number of occurrences given the count helper function.\n\t<<!!YOUR_CODE!!>> -- Return a json response and make sure the header Content-Type is set correctly!\n}", "title": "" }, { "docid": "ecd6c85155018b1f21ecd7b009b53cfc", "score": "0.5736637", "text": "func _1131sqlite3PcachePageRefcount(tls crt.TLS, _p uintptr /* *TPgHdr = SPgHdr */) (r int32) {\n\treturn int32(*(*int16)(unsafe.Pointer(_p + 54)))\n}", "title": "" }, { "docid": "f3c3004c89ddba9a5f2d4041d784cb5d", "score": "0.5725359", "text": "func counter(c *gin.Context) {\n\n\tcountByType := storage.CountProjects()\n\n\tc.JSON(200, countByType)\n}", "title": "" }, { "docid": "15d8d2e0d73a0875208b050b4c78b389", "score": "0.5687904", "text": "func (ac skArtistCalendar) count() int {\n\tcount := ac.PerPage * ac.Page\n\tif count > ac.TotalEntries {\n\t\tcount = ac.TotalEntries\n\t}\n\treturn count\n}", "title": "" }, { "docid": "be4547c4817b18c9c0c394c8ea480968", "score": "0.5682272", "text": "func (p *PdfiumImplementation) FPDFPage_GetAnnotCount(request *requests.FPDFPage_GetAnnotCount) (*responses.FPDFPage_GetAnnotCount, error) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tpageHandle, err := p.loadPage(request.Page)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcount := C.FPDFPage_GetAnnotCount(pageHandle.handle)\n\n\treturn &responses.FPDFPage_GetAnnotCount{\n\t\tCount: int(count),\n\t}, nil\n}", "title": "" }, { "docid": "3c271c6d215d792889a9414e032da702", "score": "0.5674345", "text": "func (self *TraitNotebook) GetNPages() (return__ int) {\n\tvar __cgo__return__ C.gint\n\t__cgo__return__ = C.gtk_notebook_get_n_pages(self.CPointer)\n\treturn__ = int(__cgo__return__)\n\treturn\n}", "title": "" }, { "docid": "f516ac65e0005b94c91a17f300a71764", "score": "0.5662974", "text": "func _261pcache1Pagecount(tls crt.TLS, _p uintptr /* *Tsqlite3_pcache = Ssqlite3_pcache */) (r int32) {\n\tvar (\n\t\t_n int32\n\t\t_pCache uintptr // *TPCache1 = SPCache1\n\t)\n\t_pCache = _p\n\n\t_n = int32(*(*uint32)(unsafe.Pointer(_pCache + 52)))\n\n\treturn _n\n}", "title": "" }, { "docid": "cf8ca4707055a421fe8a8b39cefd0980", "score": "0.5645662", "text": "func countHandler(w http.ResponseWriter, r *http.Request) {\n\tCounter++\n\tfmt.Fprintf(w, \"count: %d\\n\", Counter)\n\tfmt.Fprintf(w, \"URL.Path = %q\\n\", r.URL.Path)\n}", "title": "" }, { "docid": "2136652b5567d53dd7c36ab2132ebe81", "score": "0.56438535", "text": "func (recv *PrintCompositor) GetNPages() int32 {\n\tretC := C.gtk_source_print_compositor_get_n_pages((*C.GtkSourcePrintCompositor)(recv.native))\n\tretGo := (int32)(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "07caf78b4d0e635b7b11d976993e917b", "score": "0.5633765", "text": "func (d *Dao) HistoryPageTotalC(c context.Context, h *model.HisParamReq) (totalCount int, err error) {\n\tSQL, values := d.genListSQL(\"count\", h)\n\trow := d.db.QueryRow(c, SQL, values...)\n\tif err = row.Scan(&totalCount); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\trow = nil\n\t\t\terr = nil\n\t\t} else {\n\t\t\tlog.Error(\"row.Scan error(%v)\", err)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "74860291292f40267a652b6ed495a2ad", "score": "0.56187034", "text": "func (list *SiteList) Count() (*int64, error) {\n\treturn list.CountWithContext(context.Background())\n}", "title": "" }, { "docid": "1daf224b251d3d5da9f7cf1bfe1d5ca3", "score": "0.5575376", "text": "func MorePages(meta core.Meta) bool {\n\treturn meta.Page.Current < meta.Page.Total\n}", "title": "" }, { "docid": "6f64da4f0d844ec32f6ff33b77a9c468", "score": "0.55627644", "text": "func (_DocumentRegister *DocumentRegisterCaller) NumberOfDocuments(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _DocumentRegister.contract.Call(opts, out, \"numberOfDocuments\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "69e9c96fcff3969ec2f5ad29e20f8316", "score": "0.55555874", "text": "func (self *TraitPrintOperation) GetNPagesToPrint() (return__ int) {\n\tvar __cgo__return__ C.gint\n\t__cgo__return__ = C.gtk_print_operation_get_n_pages_to_print(self.CPointer)\n\treturn__ = int(__cgo__return__)\n\treturn\n}", "title": "" }, { "docid": "9a5600ffda998716fc265b57ab551711", "score": "0.55529296", "text": "func (r StatsRequest) Pages(ctx context.Context) (*StatsPaginatedResult, error) {\n\tvar res StatsPaginatedResult\n\treturn &res, res.load(ctx, r.r)\n}", "title": "" }, { "docid": "8f6bd99a46fb1c89b50ef625bddaa82f", "score": "0.5539932", "text": "func GetCommentFieldDataCountViaHomepage(iHomepage string) int64 {\n\tn, _ := Engine.Where(\"homepage = ?\", iHomepage).Count(&CommentFieldData{Homepage: iHomepage})\n\treturn n\n}", "title": "" }, { "docid": "a9c67869024981f8ac519d7ec8ac09cc", "score": "0.55365485", "text": "func (bs *UserService) Count(rs app.RequestScope) (int, error) {\n\treturn bs.dao.Count(rs)\n}", "title": "" }, { "docid": "9ed1eaf0b6ae8000e8b7c0b25fc11165", "score": "0.55234313", "text": "func (w *Plugins) Page() int { return w.Info.Page }", "title": "" }, { "docid": "db43f50ba4f2ca706ff4adb487c5103b", "score": "0.5505475", "text": "func (session *Session) Count(selector string) int {\n\telements, err := session.findElements(selector)\n\tif err != nil {\n\t\treturn 0\n\t}\n\tdefer session.release(elements...)\n\treturn len(elements)\n}", "title": "" }, { "docid": "fbf1778d2fe628f3b585071f97a707e6", "score": "0.549747", "text": "func fileCount() {\n\tlock.Lock()\n\tfileVisit++\n\tlock.Unlock()\n}", "title": "" }, { "docid": "eb6a2391d14f1a98634ce74fe087aae0", "score": "0.5489719", "text": "func makeNPage(nPageParams []string) int {\n\tvar page int\n\tif len(nPageParams) == 0 {\n\t\tpage = 0\n\t} else {\n\t\tvar err error\n\t\tpage, err = strconv.Atoi(nPageParams[0])\n\t\tif err != nil || page < 0 {\n\t\t\tpage = 0\n\t\t}\n\t}\n\n\treturn page\n}", "title": "" }, { "docid": "b384d1f27075f7b6b7233c0375d66c9b", "score": "0.54692197", "text": "func urlCallCount(links []string) int {\n\tcount := 0\n\tvar wg sync.WaitGroup\n\n\tfor _, link := range links {\n\t\twg.Add(1)\n\t\tgo func(url string) {\n\t\t\tdefer wg.Done()\n\t\t\t_, err := http.Get(url)\n\t\t\tif err != nil {\n\t\t\t\tcount++\n\t\t\t\tfmt.Println(\" Invalid link : \", url)\n\t\t\t}\n\t\t}(link)\n\t}\n\twg.Wait()\n\treturn count\n}", "title": "" }, { "docid": "e9d2bbd543b7a14e28777338b456bfdd", "score": "0.54666847", "text": "func (self *LdapSearchResult) Count() int{\n\treturn len(self.entries)\n}", "title": "" }, { "docid": "593f120078c9d24c88f6ac52f3cc9a72", "score": "0.5448737", "text": "func (s *UserService) Count(rs app.RequestScope) (int, error) {\n\treturn s.dao.Count(rs)\n}", "title": "" }, { "docid": "9858c0d17a8da69986433518b77aab83", "score": "0.54356587", "text": "func (c *collection) Count(ctx context.Context) (int64, error) {\n\treq, err := c.conn.NewRequest(\"GET\", path.Join(c.relPath(\"collection\"), \"count\"))\n\tif err != nil {\n\t\treturn 0, WithStack(err)\n\t}\n\tresp, err := c.conn.Do(ctx, req)\n\tif err != nil {\n\t\treturn 0, WithStack(err)\n\t}\n\tif err := resp.CheckStatus(200); err != nil {\n\t\treturn 0, WithStack(err)\n\t}\n\tvar data struct {\n\t\tCount int64 `json:\"count,omitempty\"`\n\t}\n\tif err := resp.ParseBody(\"\", &data); err != nil {\n\t\treturn 0, WithStack(err)\n\t}\n\treturn data.Count, nil\n}", "title": "" }, { "docid": "0e1531ef6c9f8dbb13a70bd8d9a04740", "score": "0.54243994", "text": "func (p *page) inuse() int {\n\tvar n int\n\tif (p.flags & leafPageFlag) != 0 {\n\t\tn = pageHeaderSize\n\t\tif p.count > 0 {\n\t\t\tn += leafPageElementSize * int(p.count-1)\n\t\t\te := p.leafPageElement(p.count - 1)\n\t\t\tn += int(e.pos + e.ksize + e.vsize)\n\t\t}\n\n\t} else if (p.flags & branchPageFlag) != 0 {\n\t\tn = pageHeaderSize\n\t\tif p.count > 0 {\n\t\t\tn += branchPageElementSize * int(p.count-1)\n\t\t\te := p.branchPageElement(p.count - 1)\n\t\t\tn += int(e.pos + e.ksize)\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "0677dc8f8dbed164a773667c8ac3785c", "score": "0.54227334", "text": "func (q cmfPortalPostQuery) Count(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to count cmf_portal_post rows\")\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "8749b99eed624f6ece3b898955104efa", "score": "0.5412969", "text": "func (p *Paginator) Nums() int {\n\tif p.nums == -1 {\n\t\tp.nums = p.adapter.Nums()\n\t}\n\n\treturn p.nums\n}", "title": "" }, { "docid": "de018f5619bb9057cc0016e9bf2329ec", "score": "0.54031813", "text": "func (n *Node) CountPublishers(topic_name string) {\n\n}", "title": "" }, { "docid": "164ad5d0b292fe7c31d4f2c8c34f2dd4", "score": "0.5398676", "text": "func GetAllCount() (count int, err error) {\n\tres, err := dao_node.AllNodes()\n\tif err != nil {\n\t\treturn\n\t}\n\tif res == nil {\n\t\treturn 0, nil\n\t}\n\tcount = len(res)\n\treturn\n}", "title": "" }, { "docid": "a6e27b7d710436a043d92ae3fcb64537", "score": "0.5395616", "text": "func (s byPageKind) Len() int { return len(s) }", "title": "" }, { "docid": "d96640f244e7031f14cc4d975f1fe62b", "score": "0.539556", "text": "func (p *pathObject) Count() (int64, error) {\n\tit := p.buildIteratorTree()\n\treturn p.s.countResults(it)\n}", "title": "" }, { "docid": "6b6c18a1b199fbfbfd98f5a6a5ff5c36", "score": "0.5394682", "text": "func GetCount(request *proto.ForwardEchoRequest) int {\n\tif request.Count > 1 {\n\t\treturn int(request.Count)\n\t}\n\treturn DefaultCount\n}", "title": "" }, { "docid": "c1e2e7e00b118e86912221609c3d18bb", "score": "0.5392446", "text": "func totalLinks(query string, args ...interface{}) int {\n\tvar count int\n\tvar err error\n\tdb := Db{}\n\tdb.Open()\n\tquery = \"select count(*) from links \" + query\n\n\tif args == nil {\n\t\terr = db.Query(query)\n\t} else {\n\t\terr = db.Prepare(query)\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\treturn 0\n\t\t}\n\t\terr = db.QueryStmt(args...)\n\t}\n\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn 0\n\t}\n\tdb.ResultRows.Next()\n\tdb.ResultRows.Scan(&count)\n\tdb.Close()\n\treturn count\n}", "title": "" }, { "docid": "32e9e817d6000d550ba67e7a0dd1ca1d", "score": "0.538791", "text": "func (db *RedisDB) Count(ctx context.Context, url string) (int, error) {\n\treturn db.rdb.Get(ctx, fmt.Sprintf(\"count:%s\", url)).Int()\n}", "title": "" }, { "docid": "d52d5a16be2142a5f459698a25e02261", "score": "0.537691", "text": "func (p Paginator) HasPages() bool {\n\treturn p.Nums() > p.maxPerPage\n}", "title": "" }, { "docid": "ecc5a50394d0109e69fc387c7a0fe7c1", "score": "0.53719336", "text": "func OggPagePageno(og *OggPage) int {\n\tcog, _ := og.PassRef()\n\t__ret := C.ogg_page_pageno(cog)\n\t__v := (int)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "c778bc3a915efa06dd43acd8ed121d75", "score": "0.5366873", "text": "func (c *CMSketch) TotalCount() uint64 {\n\treturn c.count\n}", "title": "" }, { "docid": "a191186b4d57acb0690c4ba60000499b", "score": "0.53593504", "text": "func (t TranslationsTest) Count(ctx context.Context, filter map[string]interface{}) (int64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "24194a43d7d849ae338822528899264e", "score": "0.5356834", "text": "func (ar *AuthenticationRedirectors) Count() int {\n\treturn len(ar.names)\n}", "title": "" }, { "docid": "a56fd7542a388c019cda45cfc0ade153", "score": "0.5355613", "text": "func count(collection *mongo.Collection) (int64, error) {\n\tcount, countError := collection.CountDocuments(context.Background(), bson.M{})\n\n\tif countError != nil {\n\t\treturn 0, countError\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "5e2c44235a9717c23e9c9ea39904fa68", "score": "0.5349253", "text": "func (p *Page) WindowCount() (int, error) {\n\twindows, err := p.session.GetWindows()\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed to find available windows: %s\", err)\n\t}\n\treturn len(windows), nil\n}", "title": "" }, { "docid": "d4b6ef67f5a97ead6b30a4c884724262", "score": "0.5348823", "text": "func (q cmfSlideQuery) Count(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to count cmf_slide rows\")\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "1da1eb5b33f90c6279593864d78a8dc5", "score": "0.5342408", "text": "func (maildir *Maildir) Count() int {\n\t// FIXME may be wrong, ../. ?\n\t// and handle error?\n\tdir, err := os.Open(maildir.Path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer dir.Close()\n\tn, _ := dir.Readdirnames(0)\n\treturn len(n)\n}", "title": "" }, { "docid": "96e0634072cd6651e853397f601fde77", "score": "0.53319156", "text": "func CountView(r *http.Request) bool {\n\tif r.Method == \"HEAD\" || bots.IsBot(r.UserAgent()) {\n\t\treturn false\n\t}\n\n\tpath := r.FormValue(\"p\")\n\tif path == \"\" {\n\t\treturn false\n\t}\n\n\t// Count the hit\n\tcounts[path]++\n\tSaveCounts()\n\treturn true\n}", "title": "" }, { "docid": "15c12bd40bbd93876ae88b76c8de8fc7", "score": "0.5326663", "text": "func (p Paginator) Page() int {\n\tpn := p.PageNums()\n\tif p.page > pn {\n\t\treturn pn\n\t}\n\n\treturn p.page\n}", "title": "" }, { "docid": "0253ce9b902cf97c8867e629bac52a43", "score": "0.53239805", "text": "func (p *pageSeriesType) Len() int {\n\treturn p.pages.Len()\n}", "title": "" }, { "docid": "11bd2cdc468896860cc48bbedcfdf4a4", "score": "0.53146034", "text": "func Count(w http.ResponseWriter, req *http.Request) {\n\tio.WriteString(w, fmt.Sprintf(\"%v\", linecount))\n}", "title": "" }, { "docid": "a2ed22604caeecaba16bff92a104cb38", "score": "0.5295778", "text": "func (ref *SupRef) ChildrenCount(timeout time.Duration) (*ChildrenCount, error) {\n\treq := NewChildrenCountRequest()\n\tresp, err := ref.request(req, timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse, ok := resp.(*ChildrenCount)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unknown response from supervisor: %v\", resp)\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "09ff28b35a18492da3269e13b2baae77", "score": "0.5288885", "text": "func (_DocumentRegister *DocumentRegisterCallerSession) NumberOfDocuments() (*big.Int, error) {\n\treturn _DocumentRegister.Contract.NumberOfDocuments(&_DocumentRegister.CallOpts)\n}", "title": "" }, { "docid": "e6abc9213a085ea65b905a98fc4c1dd5", "score": "0.52886593", "text": "func CountRequests(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tcount := inc(currCount, r)\n\t\tw.Header().Set(common.HeaderReqNo, fmt.Sprintf(\"%v\", count))\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "4b3dc033259ba7d065f76dcd2c5bf917", "score": "0.52857023", "text": "func Getpagesize() int", "title": "" }, { "docid": "2ba61eeccc4ef18f25a3a361015fe0d7", "score": "0.5284797", "text": "func (s service) Count(ctx context.Context) (int, error) {\n\treturn s.repo.Count(ctx)\n}", "title": "" }, { "docid": "2ba61eeccc4ef18f25a3a361015fe0d7", "score": "0.5284797", "text": "func (s service) Count(ctx context.Context) (int, error) {\n\treturn s.repo.Count(ctx)\n}", "title": "" }, { "docid": "c2b81aa04d3b4bb956878e8b87d96d96", "score": "0.5280958", "text": "func (o DomainOutput) RepositoryCount() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *Domain) pulumi.IntOutput { return v.RepositoryCount }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "af7b3ea1abc8b87d61392bfbfdd2035a", "score": "0.5279763", "text": "func (cache *cacheImpl) NodeCount() int {\n\tcache.mu.RLock()\n\tdefer cache.mu.RUnlock()\n\treturn len(cache.nodes)\n}", "title": "" }, { "docid": "cf4250bb11086b164e17d3017b092632", "score": "0.52744097", "text": "func (fs *FranchiseService) Count(opts ...Option) (int, error) {\n\tct, err := fs.client.getCount(fs.end, opts...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"cannot count Franchises\")\n\t}\n\n\treturn ct, nil\n}", "title": "" }, { "docid": "b963202762d7f99849c103a9b769170f", "score": "0.52734977", "text": "func (s *BeerStyleService) Count(rs app.RequestScope) (int, error) {\n\treturn s.dao.Count(rs)\n}", "title": "" }, { "docid": "552e7adf80a64a26dd00a2c03640f219", "score": "0.52708936", "text": "func (self *Domain) Count() (int64, error) {\n\tvar result int64\n\tparams := []interface{}{self.Key}\n\tif err := self.Call(\"domain.count\", params, &result); err != nil {\n\t\treturn -1, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "04ca7295ddb7b98d202432ed1799c1bf", "score": "0.52690864", "text": "func CountHeadings(currentTag string, count *models.HeadingCount) {\n\tswitch currentTag {\n\tcase \"h1\":\n\t\tcount.H1Count++\n\tcase \"h2\":\n\t\tcount.H2Count++\n\tcase \"h3\":\n\t\tcount.H3Count++\n\tcase \"h4\":\n\t\tcount.H4Count++\n\tcase \"h5\":\n\t\tcount.H5Count++\n\tcase \"h6\":\n\t\tcount.H6Count++\n\t}\n}", "title": "" }, { "docid": "32a6e81dfca606388c0d8f815e73e139", "score": "0.5268075", "text": "func cbzGetPages(fp string) (int64, error) {\n\tzr, err := zip.OpenReader(fp)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\tdefer zr.Close()\n\n\tvar i int64\n\tfor _, f := range zr.File {\n\t\tif RegexSupportedImageExt.MatchString(f.Name) {\n\t\t\ti++\n\t\t}\n\t}\n\n\t// force free memory with GC\n\tzr = nil\n\n\tif i == 0 {\n\t\treturn -1, ErrNotBook\n\t}\n\n\treturn i, nil\n}", "title": "" } ]
cbb68f08b7e51cb0d90dcb4a44f969f5
sendAnswer sends a CCA to the connection given
[ { "docid": "a6cb09b0e23d66c8d74478c487e0acf6", "score": "0.76189363", "text": "func sendAnswer(\n\tccr ccrMessage,\n\tconn diam.Conn,\n\tmessage *diam.Message,\n\tstatusCode uint32,\n\tadditionalAVPs ...*diam.AVP,\n) {\n\ta := message.Answer(statusCode)\n\ta.NewAVP(avp.OriginHost, avp.Mbit, 0, ccr.DestinationHost)\n\ta.NewAVP(avp.OriginRealm, avp.Mbit, 0, ccr.DestinationRealm)\n\ta.NewAVP(avp.DestinationRealm, avp.Mbit, 0, ccr.OriginRealm)\n\ta.NewAVP(avp.DestinationHost, avp.Mbit, 0, ccr.OriginHost)\n\ta.NewAVP(avp.CCRequestType, avp.Mbit, 0, ccr.RequestType)\n\ta.NewAVP(avp.CCRequestNumber, avp.Mbit, 0, ccr.RequestNumber)\n\ta.NewAVP(avp.SessionID, avp.Mbit, 0, ccr.SessionID)\n\tfor _, avp := range additionalAVPs {\n\t\ta.InsertAVP(avp)\n\t}\n\t// SessionID must be the first AVP\n\ta.InsertAVP(diam.NewAVP(avp.SessionID, avp.Mbit, 0, ccr.SessionID))\n\n\tglog.V(2).Infof(\"Sending Gy CCA message\\n%s\\n\", a)\n\t_, err := a.WriteTo(conn)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to write message to %s: %s\\n%s\\n\",\n\t\t\tconn.RemoteAddr(), err, a)\n\t\treturn\n\t}\n\tglog.V(2).Infof(\"Sent CCA to %s:\\n\", conn.RemoteAddr())\n}", "title": "" } ]
[ { "docid": "c7326cc975379f37b8e87227dd92fda0", "score": "0.58735585", "text": "func (c *RTCClient) handleAnswer(desc webrtc.SessionDescription) error {\n\tlogger.Infow(\"handling server answer\", \"participant\", c.localParticipant.Identity)\n\t// remote answered the offer, establish connection\n\terr := c.publisher.SetRemoteDescription(desc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !c.connected.TrySet(true) {\n\t\t// already connected\n\t\treturn nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a7c3dac401218d747c0526d285fc74ef", "score": "0.553893", "text": "func SendAnswer(ts, content, userID string) {\n\tpollID, channelID := db.GetPoll(ts)\n\tdbIDStr := strconv.FormatInt(pollID, 10)\n\n\tdb.AddAnswer(pollID, content, userID)\n\tnewTxt := db.GenerateText(pollID)\n\n\tif len(newTxt) > 2000 {\n\t\tnewTxt = newTxt[0:2000] + \"...\"\n\t}\n\n\theaderText := slack.NewTextBlockObject(\"mrkdwn\", newTxt, false, false)\n\theaderSection := slack.NewSectionBlock(headerText, nil, nil)\n\n\tnewBtnTxt := slack.NewTextBlockObject(\"plain_text\", \"Submit Response\", false, false)\n\tnewBtn := slack.NewButtonBlockElement(\"submit\", dbIDStr, newBtnTxt)\n\n\tresultBtnTxt := slack.NewTextBlockObject(\"plain_text\", \"Results\", false, false)\n\tresultBtn := slack.NewButtonBlockElement(\"result\", dbIDStr, resultBtnTxt)\n\tactionBlock := slack.NewActionBlock(\"\", newBtn, resultBtn)\n\n\t_, _, _, err := SlackClient.UpdateMessage(\n\t\tchannelID,\n\t\tts,\n\t\tslack.MsgOptionText(\"New Poll started!\", false),\n\t\tslack.MsgOptionBlocks(headerSection, actionBlock),\n\t)\n\tif err != nil {\n\t\tfmt.Printf(\"error updating message: %s\\n\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "43e8eaf6e897d2e46e2c407acd554c98", "score": "0.54539824", "text": "func send(c *cli.Context) error {\n\tclient, err := echo.NewClient(c.String(\"addr\"), c.String(\"name\"))\n\tif err != nil {\n\t\treturn exit(\"could not create client\", err)\n\t}\n\tdefer client.Shutdown()\n\n\tvar timeout time.Duration\n\tif timeout, err = time.ParseDuration(c.String(\"timeout\")); err != nil {\n\t\treturn exit(\"\", err)\n\t}\n\n\tif err = client.Connect(timeout); err != nil {\n\t\treturn exit(\"\", err)\n\t}\n\n\tfor _, msg := range c.Args() {\n\t\tif err := client.Send(msg); err != nil {\n\t\t\texit(\"\", err)\n\t\t}\n\t}\n\n\treturn client.Close()\n}", "title": "" }, { "docid": "b0b94d05efd4de790dc59aea6548f7fe", "score": "0.53621906", "text": "func printAnswer(answer chan string) {\n\tfor message := range answer {\n\t\tfor _, c := range message {\n\t\t\ttime.Sleep(time.Duration(180+rand.Intn(10)) * time.Millisecond) // Prints one character at the time.\n\t\t\tfmt.Print(string(c))\n\t\t}\n\t\tfmt.Print(\"\\n\" + prompt)\n\t}\n}", "title": "" }, { "docid": "28d6ad3f2d5d1a34f531ec34ae25fa53", "score": "0.5360333", "text": "func SendAnswer(w http.ResponseWriter, r *http.Request, data interface{}, er error) error {\n\tvar statuscode int = GetStatusCode(r, er)\n\tvar myuuid string\n\tvar msg string\n\n\tlogger.Log(r).Debug().Msg(\"Sending HTTP answer with status code \" + strconv.Itoa(statuscode))\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(statuscode)\n\tif er != nil {\n\t\tmsg = er.Error()\n\t}\n\tif r != nil {\n\t\tif myuuidVal := r.Context().Value(\"uuid\"); myuuidVal != nil {\n\t\t\tmyuuid = myuuidVal.(string)\n\t\t}\n\t}\n\tres := Response{Uuid: myuuid, Time: time.Now(), Message: msg, Data: data}\n\terr := EncodeJSON(w, r, res)\n\treturn err\n}", "title": "" }, { "docid": "005aa69802404ae7914b418938ad6746", "score": "0.5283351", "text": "func answerQuestions(question chan string, answer chan string) {\n\tfor message := range question { // for every question on the channel,\n\t\tgo prophecy(message, answer) // make a new prophecy\n\t}\n}", "title": "" }, { "docid": "014823bcc05e2192fa201baaad15382e", "score": "0.5246137", "text": "func processClientAnswer(client *QuizClient,qindex int) (bool,bool){\n\tdata:=common.ReadMessage(client.Conn)\n\t//fmt.Printf(\"%+v\\n\",data)\n\t/*Read the initial request data*/\n\tif (data==nil){\n\t\tcommon.SendError(client.Conn,\"DataError\",\"Error occured while reading request data\")\n\t\treturn false,true\n\t}\n\n\treqtyperaw,ok:=data[\"type\"]\n\tif !ok {\n\t\tcommon.SendError(client.Conn,\"InvalidRequest\",\"Request not proper\")\n\t\treturn false,false\n\t}\n\treqtype,ok:=reqtyperaw.(string)\n\tif(!ok){\n\t\tcommon.SendError(client.Conn,\"InvalidType\",\"Request not proper\")\n\t\treturn false,false\n\t}\n\tif(reqtype!=\"answer\" && reqtype!=\"repeat\"){\n\t\tcommon.SendError(client.Conn,\"\",fmt.Sprintf(\"InvalidType '%s'\",reqtype))\n\t\treturn false,false\n\t}\n\t//If it has asked to repeat question send question again and don't continue\n\n\tif reqtype==\"repeat\"{\n\t\tsendQuestion(client,qindex)\n\t\treturn false,false\n\n\t}\n\n\t\n\tansraw,ok:=data[\"answer\"]\n\tif (!ok){\n\t\tcommon.SendError(client.Conn,\"MissingArgument\",\"Answer is missing\")\n\t\treturn false,false\n\t}\n\tans,ok:=ansraw.(string)\n\tif (!ok){\n\t\tcommon.SendError(client.Conn,\"InvalidAnswer\",fmt.Sprintf(\"invalid answer %v\",ansraw))\n\t\treturn false,false\n\t}\n\n\treturn checkAnswerResult(client,qindex,ans),false\n\n\t\n\n}", "title": "" }, { "docid": "7e1ad531ed0b79bf7446923ed6c8ae9f", "score": "0.52010703", "text": "func (m *RemoteRef) Ask(sender Ref, ask interface{}, answer interface{}) error {\n\t//if t := reflect.TypeOf(answer); t == nil || t.Kind() != reflect.Ptr {\n\t//\treturn ErrRemoteRefAnswerType\n\t//}\n\tanswerValue := reflect.ValueOf(answer)\n\tif answerValue.Kind() != reflect.Ptr {\n\t\treturn ErrAnswerType\n\t}\n\taskProto, ok := ask.(proto.Message)\n\tif !ok {\n\t\treturn ErrRemoteRefAskType\n\t}\n\tanswerProto, ok := answer.(proto.Message)\n\tif !ok {\n\t\treturn ErrRemoteRefAnswerType\n\t}\n\n\taskAny, err := ptypes.MarshalAny(askProto)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tanswerAny, err := ptypes.MarshalAny(answerProto)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// send request\n\tw, err := m.node.send(&ConnControl{\n\t\tType: ControlType_CAskName,\n\t\tAskName: &AskName{\n\t\t\tReq: &AskName_Request{\n\t\t\t\tFromId: sender.Id().id,\n\t\t\t\tFromName: sender.Id().name,\n\t\t\t\tToName: m.id.name,\n\t\t\t\tAskData: askAny,\n\t\t\t\tAnswerData: answerAny,\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// wait for response\n\tselect {\n\tcase respMsg, more := <-w.respCh:\n\t\t{\n\t\t\tif !more || respMsg == nil || respMsg.getAskNameResp() == nil {\n\t\t\t\treturn ErrRemoteResponse\n\t\t\t}\n\t\t\tresp := respMsg.getAskNameResp()\n\t\t\tvar respErr error\n\t\t\tif resp.HasError {\n\t\t\t\trespErr = errors.New(resp.ErrorMessage)\n\t\t\t}\n\t\t\terr = ptypes.UnmarshalAny(resp.AnswerData, answerProto)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !answerValue.Elem().Type().AssignableTo(reflect.ValueOf(answerProto).Type()) {\n\t\t\t\treturn ErrRemoteRefAnswerType\n\t\t\t}\n\t\t\tanswerValue.Elem().Set(reflect.ValueOf(answerProto))\n\t\t\treturn respErr\n\t\t}\n\tcase <-time.After(requestTimeout):\n\t\t{\n\t\t\tw.canceled = true\n\t\t\treturn ErrRemoteTimeout\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ac1b2ab11e9767589575a3e450445ead", "score": "0.5199406", "text": "func respondToIQ(t *testing.T, sc *ServerConn) {\n\t// Decoder to parse the request\n\tiqReq, err := receiveIq(sc)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to receive IQ : %s\", err.Error())\n\t}\n\n\tif vld, _ := iqReq.IsValid(); !vld {\n\t\tmockIQError(sc.connection)\n\t\treturn\n\t}\n\n\t// Crafting response\n\tiqResp, err := stanza.NewIQ(stanza.Attrs{Type: stanza.IQTypeResult, From: iqReq.To, To: iqReq.From, Id: iqReq.Id, Lang: \"en\"})\n\tif err != nil {\n\t\tt.Fatalf(\"failed to create iqResp: %v\", err)\n\t}\n\tdisco := iqResp.DiscoInfo()\n\tdisco.AddFeatures(\"vcard-temp\",\n\t\t`http://jabber.org/protocol/address`)\n\n\tdisco.AddIdentity(\"Multicast\", \"service\", \"multicast\")\n\tiqResp.Payload = disco\n\n\t// Sending response to the Component\n\tmResp, err := xml.Marshal(iqResp)\n\t_, err = fmt.Fprintln(sc.connection, string(mResp))\n\tif err != nil {\n\t\tt.Errorf(\"Could not send response stanza : %w\", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "0d4ad1ee01b8ca359f26c181d5b4a4f8", "score": "0.50920916", "text": "func readAnswer(answer chan string) {\n\tvar input string\n\tfmt.Scanln(&input)\n\n\tanswer <- input\n}", "title": "" }, { "docid": "05fb3f5d55691db784fd48024b6ec566", "score": "0.50603735", "text": "func sendChallengeQuestions(ctx context.Context, cfg *config.Config,\n\treq *guardPb.FileChallengeQuestions) error {\n\tcb := cgrpc.GuardClient(cfg.Services.GuardDomain)\n\tcb.Timeout(guardTimeout)\n\treturn cb.WithContext(ctx, func(ctx context.Context, client guardPb.GuardServiceClient) error {\n\t\tres, err := client.SendQuestions(ctx, req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif res.Code != guardPb.ResponseCode_SUCCESS {\n\t\t\treturn fmt.Errorf(\"failed to send questions: %v\", res.Message)\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "a71aafd67d0d24fcfbe612d8b02cbbb9", "score": "0.50565034", "text": "func handle(conn *SocketConnection) {\n\tDebug(\"New incomming connection: %v\", conn.RemoteAddr())\n\tif err := conn.Connect(); err != nil {\n\t\tError(\"Got error while accepting connection: %s\", err)\n\t\treturn\n\t}\n\tanswer, err := conn.ExecuteAnswer(\"\", false)\n\tif err != nil {\n\t\tError(\"Got error while executing answer: %s\", err)\n\t\treturn\n\t}\n\tDebug(\"Answer Message: %s\", answer)\n\tDebug(\"Caller UUID: %s\", answer.GetHeader(\"Caller-Unique-Id\"))\n\n\tcUUID := answer.GetCallUUID()\n\n\tif te, err := conn.ExecuteSet(\"tts_engine\", \"flite\", false); err != nil {\n\t\tError(\"Got error while attempting to set tts_engine: %s\", err)\n\t} else {\n\t\tDebug(\"TTS Engine Msg: %s\", te)\n\t}\n\n\tif tv, err := conn.ExecuteSet(\"tts_voice\", \"slt\", false); err != nil {\n\t\tError(\"Got error while attempting to set tts_voice: %s\", err)\n\t} else {\n\t\tDebug(\"TTS Voice Msg: %s\", tv)\n\t}\n\n\tif sm, err := conn.Execute(\"speak\", goeslMessage, true); err != nil {\n\t\tError(\"Got error while executing speak: %s\", err)\n\t\treturn\n\t} else {\n\t\tDebug(\"Speak Message: %s\", sm)\n\t}\n\n\tif hm, err := conn.ExecuteHangup(cUUID, \"\", false); err != nil {\n\t\tError(\"Got error while executing hangup: %s\", err)\n\t\treturn\n\t} else {\n\t\tDebug(\"Hangup Message: %s\", hm)\n\t}\n\n\tfor {\n\t\tmsg, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\t// If it contains EOF, we really dont care...\n\t\t\tif !strings.Contains(err.Error(), \"EOF\") {\n\t\t\t\tError(\"Error while reading Freeswitch message: %s\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tDebug(\"%s\", msg)\n\t}\n}", "title": "" }, { "docid": "3baaf6398d1a64f3b829282188fa4620", "score": "0.5031181", "text": "func (conn *Conn) CtcpReply(t, ctcp string, arg ...string) {\n\tmsg := strings.Join(arg, \" \")\n\tif msg != \"\" {\n\t\tmsg = \" \" + msg\n\t}\n\tconn.Notice(t, \"\\001\"+strings.ToUpper(ctcp)+msg+\"\\001\")\n}", "title": "" }, { "docid": "f4fcb1678cfb809ebc038514db593013", "score": "0.49852678", "text": "func TriggerAnswer(channel string, answerMessage dto.BaseChatMessage, shouldRemember bool) error {\n\tif answerMessage.Text != \"\" {\n\t\tif err := SendAnswerForReceivedMessage(answerMessage); err != nil {\n\t\t\tlog.Logger().AddError(err).Msg(\"Failed to send prepared answers\")\n\t\t\tconversation.FinaliseConversation(channel)\n\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif answerMessage.DictionaryMessage.IsHelpTriggered {\n\t\treturn nil\n\t}\n\n\tconversation.SetLastQuestion(answerMessage)\n\n\tif answerMessage.DictionaryMessage.ReactionType == \"\" || container.C.DefinedEvents[answerMessage.DictionaryMessage.ReactionType] == nil {\n\t\tlog.Logger().Warn().\n\t\t\tInterface(\"answer\", answerMessage).\n\t\t\tMsg(\"Reaction type wasn't found\")\n\t\treturn nil\n\t}\n\n\tactiveConversation := conversation.GetConversation(channel)\n\tif activeConversation.ScenarioID != int64(0) && !activeConversation.EventReadyToBeExecuted {\n\t\tlog.Logger().Info().\n\t\t\tInterface(\"conversation\", activeConversation).\n\t\t\tMsg(\"This conversation isn't finished yet, so event cannot be executed.\")\n\t\treturn nil\n\t}\n\n\tgo func() {\n\t\tanswer, err := container.C.DefinedEvents[answerMessage.DictionaryMessage.ReactionType].Execute(answerMessage)\n\t\tif err != nil {\n\t\t\tlog.Logger().AddError(err).Msg(\"Failed to execute the event\")\n\t\t\tconversation.FinaliseConversation(channel)\n\t\t}\n\n\t\tif answer.Text != \"\" {\n\t\t\tanswerMessage.Text = answer.Text\n\t\t\tif err = SendAnswerForReceivedMessage(answerMessage); err != nil {\n\t\t\t\tlog.Logger().AddError(err).Msg(\"Failed to send post-answer for selected event\")\n\t\t\t}\n\t\t}\n\n\t\t//We will trigger the event history save in case when we don't have open conversation\n\t\t//or when we do have open conversation, but it is time to trigger the event execution\n\t\t//so, we can store all variables\n\t\tif shouldRemember && (conversation.GetConversation(answerMessage.Channel).ScenarioID == 0 || conversation.GetConversation(answerMessage.Channel).EventReadyToBeExecuted) {\n\t\t\thistory.RememberEventExecution(answerMessage)\n\t\t}\n\n\t\tif conversation.GetConversation(answerMessage.Channel).EventReadyToBeExecuted {\n\t\t\tconversation.FinaliseConversation(channel)\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "328b17b3c533e98c9373276f00f6f0ff", "score": "0.49609113", "text": "func (c *Conn) respond(s string) {\n\tlog.Print(\">> \", s)\n\t_, err := fmt.Fprint(c.conn, s, c.EOL())\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n}", "title": "" }, { "docid": "fead8be6463e5ead86ddeb5efc342156", "score": "0.49595392", "text": "func (c *RTCClient) handleOffer(desc webrtc.SessionDescription) error {\n\tif err := c.subscriber.SetRemoteDescription(desc); err != nil {\n\t\treturn err\n\t}\n\n\t// if we received an offer, we'd have to answer\n\tanswer, err := c.subscriber.PeerConnection().CreateAnswer(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.subscriber.PeerConnection().SetLocalDescription(answer); err != nil {\n\t\treturn err\n\t}\n\n\t// send remote an answer\n\tlogger.Infow(\"sending subscriber answer\",\n\t\t\"participant\", c.localParticipant.Identity,\n\t\t//\"sdp\", answer,\n\t)\n\treturn c.SendRequest(&livekit.SignalRequest{\n\t\tMessage: &livekit.SignalRequest_Answer{\n\t\t\tAnswer: rtc.ToProtoSessionDescription(answer),\n\t\t},\n\t})\n}", "title": "" }, { "docid": "ddb0239d5430bf69ab8c6baa47f32e72", "score": "0.49463606", "text": "func (u *User) SendAnswer() error {\n\tanswer, err := u.Answer()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = u.SendEvent(Event{Type: \"answer\", Answer: &answer})\n\treturn nil\n}", "title": "" }, { "docid": "01538c8d89bfd8a8b77ed32b6d7462ce", "score": "0.49272883", "text": "func answerHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"X-Session-ID\")\n\t// For CORS preflight.\n\tif \"OPTIONS\" == r.Method {\n\t\treturn\n\t}\n\n\tid := r.Header.Get(\"X-Session-ID\")\n\tsnowflake, ok := snowflakeMap[id]\n\tif !ok || nil == snowflake {\n\t\t// The snowflake took too long to respond with an answer,\n\t\t// and the designated client is no longer around / recognized by the Broker.\n\t\tw.WriteHeader(http.StatusGone)\n\t\treturn\n\t}\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif nil != err {\n\t\tlog.Println(\"Invalid data.\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tlog.Println(\"Received answer: \", body)\n\tsnowflake.answerChannel <- body\n}", "title": "" }, { "docid": "007fa5f3877e8ef26741a1a189c1b879", "score": "0.49155772", "text": "func sendQuestion(client *QuizClient, qindex int){\n\tdataMap:=make(map[string]interface{})\n\tdataMap[\"type\"]=\"question\"\n\tdataMap[\"question\"]=client.Questions[qindex].AsQuestion()\n\tcommon.SendJSONData(client.Conn,dataMap)\n\n}", "title": "" }, { "docid": "96e8cb1425080cb7ac328c8e362b6c2c", "score": "0.49028453", "text": "func (c *Challenger) SendChallenge(ctx context.Context, r *peer.Reader, w *peer.Writer) {\n\tchallenge, err := generateRandomBytes(challengeLength)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tbuf := bytes.NewBuffer(challenge)\n\tif err := topics.Prepend(buf, topics.Challenge); err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tif err := c.gossip.Process(buf); err != nil {\n\t\tlog.WithError(err).Warnln(\"could not send challenge\")\n\t\treturn\n\t}\n\n\tif _, err := w.Write(buf.Bytes()); err != nil {\n\t\tlog.WithError(err).Warnln(\"could not send challenge\")\n\t\treturn\n\t}\n\n\t// Enter the node into the store, for future reference.\n\tc.nodes.Add(r.Addr(), challenge)\n\n\tpeer.Create(ctx, r, w)\n\n\tc.nodes.SetInactive(r.Addr())\n}", "title": "" }, { "docid": "79257fb86572ed475c87b350fcc64507", "score": "0.4891378", "text": "func (r *ReconcileCertificateRequest) AnswerDnsChallenge(reqLogger logr.Logger, acmeChallengeToken string, domain string, cr *certmanv1alpha1.CertificateRequest) (fqdn string, err error) {\n\n\tfqdn = acmeChallengeSubDomain + \".\" + domain\n\n\treqLogger.Info(fmt.Sprintf(\"fqdn acme challenge domain is %v\", fqdn))\n\n\tr53svc, err := r.getAwsClient(cr)\n\tif err != nil {\n\t\treqLogger.Error(err, err.Error())\n\t\treturn fqdn, err\n\t}\n\n\thostedZoneOutput, err := r53svc.ListHostedZones(&route53.ListHostedZonesInput{})\n\tif err != nil {\n\t\treqLogger.Error(err, err.Error())\n\t\treturn fqdn, err\n\t}\n\n\tbaseDomain := cr.Spec.ACMEDNSDomain\n\n\tif string(baseDomain[len(baseDomain)-1]) != \".\" {\n\t\tbaseDomain = baseDomain + \".\"\n\t}\n\n\tfor _, hostedzone := range hostedZoneOutput.HostedZones {\n\t\tif strings.EqualFold(baseDomain, *hostedzone.Name) {\n\t\t\tzone, err := r53svc.GetHostedZone(&route53.GetHostedZoneInput{Id: hostedzone.Id})\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Error(err, err.Error())\n\t\t\t\treturn fqdn, err\n\t\t\t}\n\n\t\t\tif !*zone.HostedZone.Config.PrivateZone {\n\t\t\t\tinput := &route53.ChangeResourceRecordSetsInput{\n\t\t\t\t\tChangeBatch: &route53.ChangeBatch{\n\t\t\t\t\t\tChanges: []*route53.Change{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tAction: aws.String(route53.ChangeActionUpsert),\n\t\t\t\t\t\t\t\tResourceRecordSet: &route53.ResourceRecordSet{\n\t\t\t\t\t\t\t\t\tName: aws.String(fqdn),\n\t\t\t\t\t\t\t\t\tResourceRecords: []*route53.ResourceRecord{\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tValue: aws.String(\"\\\"\" + acmeChallengeToken + \"\\\"\"),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tTTL: aws.Int64(resourceRecordTTL),\n\t\t\t\t\t\t\t\t\tType: aws.String(route53.RRTypeTxt),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tComment: aws.String(\"\"),\n\t\t\t\t\t},\n\t\t\t\t\tHostedZoneId: hostedzone.Id,\n\t\t\t\t}\n\n\t\t\t\treqLogger.Info(fmt.Sprintf(\"updating hosted zone %v\", hostedzone.Name))\n\n\t\t\t\tresult, err := r53svc.ChangeResourceRecordSets(input)\n\t\t\t\tif err != nil {\n\t\t\t\t\treqLogger.Error(err, result.GoString(), \"fqdn\", fqdn)\n\t\t\t\t\treturn fqdn, err\n\t\t\t\t}\n\n\t\t\t\treturn fqdn, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn fqdn, errors.New(\"unknown error prevented from answering DNS challenge\")\n}", "title": "" }, { "docid": "717dc729b09b1ecc38fb1824f136632d", "score": "0.4879528", "text": "func sendToClient(c net.Conn, responseMsg *IpcMessage) (err error) {\n\tresponse, err := responseMsg.ToBytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = c.Write(response)\n\n\treturn err\n}", "title": "" }, { "docid": "0b5ff1435b2c6bfcdc93e4300c688082", "score": "0.48747057", "text": "func sendInteractionResponse(s *discordgo.Session, interact *discordgo.InteractionCreate, rData *discordgo.InteractionResponseData) {\n\terr := s.InteractionRespond(interact.Interaction, &discordgo.InteractionResponse{\n\t\tType: discordgo.InteractionResponseChannelMessageWithSource,\n\t\tData: rData,\n\t})\n\tif err != nil {\n\t\tlog.Error(\"Failed to send response: \", err.Error())\n\t}\n}", "title": "" }, { "docid": "381a8963c7d31bc0916d83b7edbcc2cb", "score": "0.4847627", "text": "func (s *secretKeeperServer) SayCACertificate(ctx context.Context, in *pb.CACertificateRequest) (*pb.CACertificateReply, error) {\n\t//log.Printf(\"Server Step SayCACertificate v\" + serverVersion)\n\tconst caCertPath = \"pki/cert/ca\"\n\tconst itemTitle = \"CA certificate\"\n\tconst dataItemName = \"certificate\"\n\t///////////////////////// put \"cm\" back\n\tvar vault = InitVault()\n\t///////////////////////// put \"cm\" back\n\tcaCertificate, err := ReadVaultPKIProperty (caCertPath, itemTitle, dataItemName, vault)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to read a CA certificate: %v\", err)\n\t\treturn &pb.CACertificateReply{}, err\n\t}\n\tlog.Printf(\"CA Certificate: %s\", caCertificate)\n\treturn &pb.CACertificateReply{\n\t\tMessage: caCertificate}, err\n}", "title": "" }, { "docid": "070d6d579b36024811be133cf87333a6", "score": "0.48352104", "text": "func sendOne(client *Client, timeout time.Duration, method string, args, reply interface{}, c chan interface{}) {\n\t<-client.Ready\n\tcall := client.Go(method, args, reply, nil)\n\tselect {\n\tcase <-call.Done:\n\t\tif call.Error != nil {\n\t\t\tc <- call.Error\n\t\t} else {\n\t\t\tc <- reply\n\t\t}\n\tcase <-client.Closed:\n\t\tc <- util.Errorf(\"rpc to %s failed as client connection was closed\", method)\n\tcase <-time.After(timeout):\n\t\tc <- util.Errorf(\"rpc to %s timed out after %s\", method, timeout)\n\t}\n}", "title": "" }, { "docid": "819726e626e6698bdc9799397c9418bd", "score": "0.48045942", "text": "func (c *QQClient) SubmitCaptcha(result string, sign []byte) (*LoginResponse, error) {\n\tseq, packet := c.buildCaptchaPacket(result, sign)\n\trsp, err := c.sendAndWait(seq, packet)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl := rsp.(LoginResponse)\n\tif l.Success {\n\t\tc.registerClient()\n\t\tc.startHeartbeat()\n\t}\n\treturn &l, nil\n}", "title": "" }, { "docid": "9ddb5bc454045ed5117c79a21af8d639", "score": "0.47931367", "text": "func sendClientMessage() {\n\tmsgchan <- \"What's your username?\"\n\tusername := <-sentchan\n\tmsgchan <- \"Set username to \" + username\n\tfor {\n\t\ttext := <-sentchan\n\t\t//fmt.Println(\"Sending client message:\" + text)\n\t\tconn, err := net.Dial(\"tcp\", \":8877\")\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Broadcast error: %v\\n\", err)\n\t\t\tbreak\n\t\t}\n\t\tvar buffer bytes.Buffer\n\t\tbuffer.WriteString(string(username))\n\t\tbuffer.WriteString(\": \")\n\t\tbuffer.WriteString(text)\n\t\tconn.Write(buffer.Bytes())\n\t\tconn.Close()\n\t}\n}", "title": "" }, { "docid": "ea27430b717328aa14b652d839ba7dab", "score": "0.4790492", "text": "func (u *User) Answer() (webrtc.SessionDescription, error) {\n\tanswer, err := u.pc.CreateAnswer(nil)\n\tif err != nil {\n\t\treturn webrtc.SessionDescription{}, err\n\t}\n\t// Sets the LocalDescription, and starts our UDP listeners\n\tif err = u.pc.SetLocalDescription(answer); err != nil {\n\t\treturn webrtc.SessionDescription{}, err\n\t}\n\treturn answer, nil\n}", "title": "" }, { "docid": "5725adf74fdbdeb692e9c41c2e98be60", "score": "0.47843555", "text": "func (b Bot) Answer(mess Message) interface{} {\n\tif !b.Machines.Exists(mess.Sender) {\n\t\tb.Machines.Set(\n\t\t\tmess.Sender,\n\t\t\t&fsm.FSM{\n\t\t\t\tState: 0,\n\t\t\t\tSlots: make(map[string]string),\n\t\t\t},\n\t\t)\n\t}\n\n\tinputMessage := mess.Text.(string)\n\tcmd, _ := b.Classifier.Predict(inputMessage)\n\n\tm := b.Machines.Get(mess.Sender)\n\tresp := m.ExecuteCmd(cmd, inputMessage, b.Domain, b.Extension)\n\tb.Machines.Set(mess.Sender, m)\n\n\treturn resp\n}", "title": "" }, { "docid": "b01b832e0e5b9d93c3e5d043ebba7a14", "score": "0.4773855", "text": "func (ic *IrcClient) SendCommand(c *Command) {\n\tfmt.Fprint(ic.Conn, c)\n}", "title": "" }, { "docid": "12fdc4167a6efa6e33d6012c550b9787", "score": "0.4763561", "text": "func tcpRespond(conn net.Conn, txt string) {\n\tlog.Printf(\"Responding to TCP with %q\", txt)\n\tif _, err := conn.Write([]byte(txt + \"\\n\")); err != nil {\n\t\tlog.Fatalf(\"Could not write to TCP stream: %v\", err)\n\t}\n}", "title": "" }, { "docid": "986dee1caff277e8b9776d0748f4783f", "score": "0.47506407", "text": "func (c *client) sendConnect() {\n\tvar user, pass string\n\tif userInfo := c.route.url.User; userInfo != nil {\n\t\tuser = userInfo.Username()\n\t\tpass, _ = userInfo.Password()\n\t}\n\tcinfo := connectInfo{\n\t\tVerbose: false,\n\t\tPedantic: false,\n\t\tUser: user,\n\t\tPass: pass,\n\t\tSsl: false,\n\t\tName: c.srv.info.ID,\n\t}\n\tb, err := json.Marshal(cinfo)\n\tif err != nil {\n\t\tLogf(\"Error marshalling CONNECT to route: %v\\n\", err)\n\t\tc.closeConnection()\n\t}\n\tc.bw.WriteString(fmt.Sprintf(conProto, b))\n\tc.bw.Flush()\n}", "title": "" }, { "docid": "0f9f35ebf3585a5a725a8738a8398c88", "score": "0.47493824", "text": "func (pc *PeerConnection) CreateAnswer(options *AnswerOptions) (_ SessionDescription, err error) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\terr = recoveryToError(e)\n\t\t}\n\t}()\n\tpromise := pc.underlying.Call(\"createAnswer\", answerOptionsToValue(options))\n\tdesc, err := awaitPromise(promise)\n\tif err != nil {\n\t\treturn SessionDescription{}, err\n\t}\n\treturn *valueToSessionDescription(desc), nil\n}", "title": "" }, { "docid": "db7a9f8810f3178d5ec895c81d25ec74", "score": "0.4711454", "text": "func (pc *RTCPeerConnection) CreateAnswer(options *RTCAnswerOptions) (RTCSessionDescription, error) {\n\tuseIdentity := pc.idpLoginURL != nil\n\tif options != nil {\n\t\treturn RTCSessionDescription{}, errors.Errorf(\"TODO handle options\")\n\t} else if useIdentity {\n\t\treturn RTCSessionDescription{}, errors.Errorf(\"TODO handle identity provider\")\n\t} else if pc.IsClosed {\n\t\treturn RTCSessionDescription{}, &rtcerr.InvalidStateError{Err: ErrConnectionClosed}\n\t}\n\n\tcandidates := pc.generateLocalCandidates()\n\td := sdp.NewJSEPSessionDescription(pc.networkManager.DTLSFingerprint(), useIdentity)\n\n\tbundleValue := \"BUNDLE\"\n\tfor _, remoteMedia := range pc.CurrentRemoteDescription.parsed.MediaDescriptions {\n\t\t// TODO @trivigy better SDP parser\n\t\tvar peerDirection RTCRtpTransceiverDirection\n\t\tmidValue := \"\"\n\t\tfor _, a := range remoteMedia.Attributes {\n\t\t\tif strings.HasPrefix(*a.String(), \"mid\") {\n\t\t\t\tmidValue = (*a.String())[len(\"mid:\"):]\n\t\t\t} else if strings.HasPrefix(*a.String(), \"sendrecv\") {\n\t\t\t\tpeerDirection = RTCRtpTransceiverDirectionSendrecv\n\t\t\t} else if strings.HasPrefix(*a.String(), \"sendonly\") {\n\t\t\t\tpeerDirection = RTCRtpTransceiverDirectionSendonly\n\t\t\t} else if strings.HasPrefix(*a.String(), \"recvonly\") {\n\t\t\t\tpeerDirection = RTCRtpTransceiverDirectionRecvonly\n\t\t\t}\n\t\t}\n\n\t\tappendBundle := func() {\n\t\t\tbundleValue += \" \" + midValue\n\t\t}\n\n\t\tif strings.HasPrefix(*remoteMedia.MediaName.String(), \"audio\") {\n\t\t\tif pc.addRTPMediaSection(d, RTCRtpCodecTypeAudio, midValue, peerDirection, candidates, sdp.ConnectionRoleActive) {\n\t\t\t\tappendBundle()\n\t\t\t}\n\t\t} else if strings.HasPrefix(*remoteMedia.MediaName.String(), \"video\") {\n\t\t\tif pc.addRTPMediaSection(d, RTCRtpCodecTypeVideo, midValue, peerDirection, candidates, sdp.ConnectionRoleActive) {\n\t\t\t\tappendBundle()\n\t\t\t}\n\t\t} else if strings.HasPrefix(*remoteMedia.MediaName.String(), \"application\") {\n\t\t\tpc.addDataMediaSection(d, midValue, candidates, sdp.ConnectionRoleActive)\n\t\t}\n\t}\n\n\td = d.WithValueAttribute(sdp.AttrKeyGroup, bundleValue)\n\n\tpc.CurrentLocalDescription = &RTCSessionDescription{\n\t\tType: RTCSdpTypeAnswer,\n\t\tSdp: d.Marshal(),\n\t\tparsed: d,\n\t}\n\treturn *pc.CurrentLocalDescription, nil\n}", "title": "" }, { "docid": "d7e9a6d425425a7fc8f1bada51211549", "score": "0.4707781", "text": "func (m *Messenger) sendToCribMsg(deckIndex uint) error {\n\tenc, err := Encode(&Message{Type: TO_CRIB, Val: deckIndex})\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"Sending TO_CRIB\")\n\treturn m.opponent.Send(enc)\n}", "title": "" }, { "docid": "15832eb66e335575aba68845ee276221", "score": "0.47071508", "text": "func NewAnswerClient(c config) *AnswerClient {\n\treturn &AnswerClient{config: c}\n}", "title": "" }, { "docid": "0e5c2df7be5dc8e05ff97a2583d51704", "score": "0.47054118", "text": "func AskQuestions(qa QuestionsAnswers, p InterrogationParameters) {\n\tfullLoop, i, j := 0, 0, 0\n\n\tvar wg sync.WaitGroup\n\twg.Add(3)\n\tnbOfQuestions := qa.GetCount()\n\n\tgo fanOutChannel(&wg, p.qachan, p.publisher)\n\tgo publishChanToWriter(&wg, p.publisher, p.GetOutputStream(), nbOfQuestions, p.limit)\n go fanOutChannel(&wg, p.command, p.publisher)\n\n\tvar question, answer string\n\ts := bufio.NewScanner(p.in)\n\tfor {\n\t\tif j%nbOfQuestions == 0 {\n\t\t\tfullLoop++\n\t\t\tif fullLoop > p.limit {\n\t\t\t\t// if the qa chan is closed, then we have to close the others.\n\t\t\t\tclose(p.qachan)\n\t\t\t\tclose(p.command)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif p.mode == random {\n\t\t\ti = int(rand.Int31n(int32(nbOfQuestions)))\n\t\t}\n\t\tquestion = qa.questions[i]\n\t\tanswer = qa.answers[i]\n\t\tif p.IsReversedMode() {\n\t\t\tquestion = qa.answers[i]\n\t\t\tanswer = qa.questions[i]\n\t\t}\n\t\tp.qachan <- fmt.Sprintf(\"%s\", question)\n\t\tif p.interactive {\n\t\t\tif s.Scan() {\n\t\t\t\tp.command <- s.Text()\n\t\t\t}\n\t\t} else {\n\t\t\ttime.Sleep(p.wait)\n\t\t}\n\t\tp.qachan <- fmt.Sprintf(\"%s\", answer)\n\n\t\tif p.mode == linear {\n\t\t\ti = (i + 1) % nbOfQuestions\n\t\t}\n\t\tj++\n\t}\n\n\twg.Wait()\n}", "title": "" }, { "docid": "3838f6cacba0801e9acd52136c9828d1", "score": "0.4699824", "text": "func (t *Twocaptcha) getCaptchaAnswer() (string, error) {\n\t// Get Queue ID\n\tqueueID, err := t.getID()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Get Captcha Answer\n\tresponse := &twocaptchaResponse{}\n\turlToAnswer := fmt.Sprintf(\n\t\t\"http://2captcha.com/res.php?key=%v&action=get&id=%v&json=1\",\n\t\tt.config.Api_key,\n\t\tqueueID,\n\t)\n\tfor {\n\t\tresp, err := http.Get(urlToAnswer)\n\t\tif err != nil {\n\t\t\ttime.Sleep(3 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Parse Response\n\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\tresp.Body.Close()\n\t\tjson.Unmarshal(body, response)\n\t\tif response.Status == 1 {\n\t\t\treturn response.Request, nil\n\t\t} else if response.Request == \"ERROR_CAPTCHA_UNSOLVABLE\" {\n\t\t\tt.GetToken()\n\t\t}\n\t\ttime.Sleep(3 * time.Second)\n\t}\n}", "title": "" }, { "docid": "da27f600c33b305e3026a6498d5ddfe6", "score": "0.4696917", "text": "func (c *Cluster) sendCommand(cmd string, slot uint16, addr string) {\n\tif cmd == \"asking\" {\n\t\t// do not spam about asking slot if we already knows about.\n\t\tif c.getConfig().slotIsAsking(slot) {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// send command non-blocking manner to\n\t// - not block user queries\n\t// - not spam control loop with many-many same commands.\n\t// Some of commands will be queued, and executed, and stream of same commands will stop.\n\t// Then other commands will have a chance to be executed.\n\tselect {\n\tcase c.commands <- clusterCommand{cmd, slot, addr}:\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "134fbba655c343ebc4c8b99d11784880", "score": "0.46873766", "text": "func (c *Status) Answer(s *discordgo.Session, m *discordgo.MessageCreate) error {\n\treq, err := http.NewRequest(http.MethodGet, \"https://api.projectceleste.com/status/health\", nil)\n\tif err != nil {\n\t\tsendErrorMessage(s, m)\n\t\treturn fmt.Errorf(\"Could not create health HTTP request: %w\", err)\n\t}\n\n\tstatus := \"\"\n\treq.Header.Set(\"Cache-Control\", \"no-cache\")\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil || resp.StatusCode != http.StatusOK {\n\t\tstatus = \"UNREACHABLE :orange_circle:\"\n\t} else {\n\n\t\tdefer resp.Body.Close()\n\t\thealth := health{}\n\t\tif err := json.NewDecoder(resp.Body).Decode(&health); err != nil {\n\t\t\tsendErrorMessage(s, m)\n\t\t\treturn fmt.Errorf(\"Health response decoding error: %w\", err)\n\t\t}\n\n\t\tif health.IsHealthy {\n\t\t\tstatus = \"UP :green_circle:\"\n\t\t} else {\n\t\t\tstatus = \"DOWN :red_circle:\"\n\t\t}\n\t}\n\n\tmessage := &discordgo.MessageSend{\n\t\tContent: \"**Game Server status**: \" + status,\n\t\tReference: m.Reference(),\n\t}\n\t_, err = s.ChannelMessageSendComplex(m.ChannelID, message)\n\treturn err\n}", "title": "" }, { "docid": "aae5a680a2b2aed1140d7f87ab0e7abd", "score": "0.46561944", "text": "func (c *Controller) SubmitAnswer(w http.ResponseWriter, r *http.Request) {\n\tu, err := c.P.GetUserFromCookieAndError(r.Cookie(\"sid\"))\n\tif view.UnauthIfError(err, w, \"cookie error, please logout and then login again\") {\n\t\treturn\n\t}\n\tr.ParseForm()\n\n\tqzid, err := strconv.Atoi(r.FormValue(\"qz-id\"))\n\tif view.Should500(err, w, \"could not parse quiz id\") {\n\t\treturn\n\t}\n\tqz, err := c.P.GetQuizWithoutQuestions(int64(qzid))\n\tif view.Should500(err, w, \"could not fetch quiz\") {\n\t\treturn\n\t}\n\tif !qz.GetAcceptingResponses() {\n\t\tw.WriteHeader(http.StatusConflict)\n\t\tfmt.Fprintf(w, \"the quiz is not accepting responses right now\")\n\t\treturn\n\t}\n\n\tans, err := GetAnswerFromPostBody(r.PostForm)\n\tif view.Should500(err, w, \"could not construct the answer from the post body\") {\n\t\treturn\n\t}\n\n\tans.ResponseTimeS = proto.Int64(time.Now().Unix())\n\tans.SolverId = proto.Int64(u.GetId())\n\t// TODO: validate that the answer type matches the question type\n\tif ans.GetId() != 0 {\n\t\t// Update\n\t\tif view.Should500(c.P.UpdateAnswer(ans), w, \"could not update the answer\") {\n\t\t\treturn\n\t\t}\n\t\tview.WriteJSONString(w, fmt.Sprint(ans.GetId()))\n\t} else {\n\t\t// Create\n\t\taid, err := c.P.CreateAnswer(ans)\n\t\tif view.Should500(err, w, \"could not store the answer\") {\n\t\t\treturn\n\t\t}\n\t\tview.WriteJSONString(w, fmt.Sprint(aid))\n\t}\n}", "title": "" }, { "docid": "e4b6a0792fdc5a217af3af932ca56a6c", "score": "0.46538562", "text": "func (r *ChatRoom) sendResponse(c *Chatter, rspt int, cont string, l []string) {\n\tif l == nil {\n\t\tl = []string{}\n\t}\n\tc.sendResponse(r.Name(), rspt, cont, l)\n\tr.mu.Lock()\n\tr.lastRsp = time.Now()\n\tr.rspCount++\n\tr.mu.Unlock()\n}", "title": "" }, { "docid": "045aadc1123e13befa8c8cee952685d9", "score": "0.4647189", "text": "func (c *CoSi) handleChallenge(in *Challenge) error {\n\tlog.Lvlf3(\"%s chal=%+v\", c.Name(), in.Chall)\n\tc.cosi.Challenge(in.Chall)\n\n\tif c.challengeHook != nil {\n\t\tc.challengeHook(in.Chall)\n\t}\n\n\t// if we are leaf, then go to response\n\tif c.IsLeaf() {\n\t\treturn c.handleResponse(nil)\n\t}\n\n\t// otherwise send it to children\n\n\tif true {\n\t\treturn c.SendToChildren(in)\n\t} else {\n\t\tlerr := c.SendToChildrenInParallel(in)\n\t\tif len(lerr) > 0 {\n\t\t\treturn lerr[0]\n\t\t}\n\t\t// send to children\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "764a28e40ad33df000945091edcc5382", "score": "0.46433118", "text": "func (n *CATIfication) Send() error {\n\tr := fmt.Sprint(n.Rate)\n\tcmd := exec.Command(\"say\", \"-v\", n.Voice, \"-r\", r, n.Text)\n\tcmd.Stderr = os.Stderr\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "249a4b70d86531aa704870c6df010c83", "score": "0.4623492", "text": "func buildAnswer(src *ModbusPacket, data ...byte) *ModbusPacket {\n\tanswer := &ModbusPacket{isAnswer: true}\n\tanswer.Init(src.TypeProtocol)\n\tpar1, par2 := src.GetFunctionParameters()\n\tanswer.buildPDU(src.GetDevID(), src.GetFunctionCode(), par1, par2, data...)\n\tanswer.SetTransactionId(src.GetTransactionId())\n\treturn answer\n}", "title": "" }, { "docid": "77a18492800ffe97fc693d9095a37a3e", "score": "0.46221167", "text": "func sendAsteriskAMICommande(ast *gami.Asterisk, command string) (gami.Message, error) {\n\tch := make(chan gami.Message)\n\n\tcheck := func(m gami.Message) {\n\t\t//fmt.Println(m)\n\t\tch <- m\n\t}\n\n\tm := gami.Message{\"Action\": \"COMMAND\", \"Command\": command}\n\n\terr := ast.SendAction(m, &check)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn <-ch, nil\n}", "title": "" }, { "docid": "ffd214188679007d95f629ec89a1049e", "score": "0.4603031", "text": "func (c *Client) send(\n\tctx context.Context,\n\tcmd string,\n\tmessage io.Reader,\n\theaders Header,\n) (io.ReadCloser, error) {\n\n\tconn, err := c.dial(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"could not dial to %v\", c.addr)\n\t}\n\n\tif err := c.write(conn, cmd, message, headers); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn conn, nil\n}", "title": "" }, { "docid": "11b4fcc176c2f6756b482ddcf67bdfbe", "score": "0.4592631", "text": "func (s *Provider) SendResponse(resp *dslink.Response) {\n\ts.c <- resp\n}", "title": "" }, { "docid": "fb7522828015e8fe3f56d31b3e829b8d", "score": "0.45893085", "text": "func handleReply(client *diatheke.Client, reply *diathekepb.ReplyAction) {\n\tfmt.Printf(\" Reply: %v\\n\", reply.Text)\n}", "title": "" }, { "docid": "9f05413056b963269740b3d941df98d9", "score": "0.45875666", "text": "func (h *Node) askForAgreement(hostId string,respondedHosts map[string]string) bool{\n\tconn,err := getConnection(h.privateVerificationReturnPortIp)\n\tif err != nil {\n log.Fatal(err)\n }\n\tdefer conn.Close()\n\tdecisionChan := make(chan bool)\n\tgo waitForDecisions(respondedHosts, conn, decisionChan)\n\n\tfor _, v := range respondedHosts {\n\t\tvm := VerificationMesssage{HostId: hostId, ReturnIp: conn.LocalAddr().String()}\n\t\th.proposeAcceptence(v, vm)\n\t}\n\treturn <-decisionChan\n}", "title": "" }, { "docid": "e91813dbdf4adfcda50047aa559feb4b", "score": "0.45807594", "text": "func challengeResponse(s *servicers.EapSimSrv, ctx *protos.Context, req eap.Packet) (eap.Packet, error) {\n\tvar (\n\t\tsuccess bool\n\t\tctxCreated time.Time\n\t)\n\tmetrics.ChallengeRequests.Inc()\n\tdefer func() {\n\t\tif !ctxCreated.IsZero() {\n\t\t\tmetrics.AuthLatency.Observe(time.Since(ctxCreated).Seconds())\n\t\t}\n\t\tif !success {\n\t\t\tmetrics.FailedChallengeRequests.Inc()\n\t\t}\n\t}()\n\tidentifier := req.Identifier()\n\tif ctx == nil {\n\t\treturn sim.EapErrorResPacket(identifier, sim.NOTIFICATION_FAILURE, codes.InvalidArgument, \"Nil CTX\")\n\t}\n\tif len(ctx.SessionId) == 0 {\n\t\treturn sim.EapErrorResPacket(identifier, sim.NOTIFICATION_FAILURE, codes.InvalidArgument, \"Missing Session ID\")\n\t}\n\tsessionId := ctx.SessionId\n\timsi, uc, ok := s.FindSession(sessionId)\n\tif !ok {\n\t\treturn sim.EapErrorResPacket(identifier, sim.NOTIFICATION_FAILURE, codes.FailedPrecondition,\n\t\t\t\"No Session found for ID: %s\", ctx.SessionId)\n\t}\n\tif uc == nil {\n\t\ts.UpdateSessionTimeout(sessionId, s.NotificationTimeout())\n\t\treturn sim.EapErrorResPacket(identifier, sim.NOTIFICATION_FAILURE, codes.FailedPrecondition,\n\t\t\t\"No IMSI '%s' found for SessionID: %s\", imsi, ctx.SessionId)\n\t}\n\tctxCreated = uc.CreatedTime()\n\n\tstate, _ := uc.State()\n\tif state != sim.StateChallenge {\n\t\tglog.Errorf(\n\t\t\t\"SIM Challenge Response: Unexpected user state: %d for IMSI: %s, Session: %s\", state, imsi, ctx.SessionId)\n\t}\n\tp := make([]byte, len(req))\n\tcopy(p, req)\n\tscanner, err := eap.NewAttributeScanner(p)\n\tif err != nil {\n\t\ts.UpdateSessionUnlockCtx(uc, s.NotificationTimeout())\n\t\treturn sim.EapErrorResPacket(identifier, sim.NOTIFICATION_FAILURE, codes.Aborted, err.Error())\n\t}\n\n\tvar a, atMac eap.Attribute\n\tfor a, err = scanner.Next(); err == nil; a, err = scanner.Next() {\n\t\tif a.Type() == sim.AT_MAC {\n\t\t\tatMac = a\n\t\t\tbreak\n\t\t}\n\t\tglog.Infof(\"Unexpected EAP-SIM Challenge Response Attribute type %d\", a.Type())\n\t}\n\tif err != nil {\n\t\ts.UpdateSessionUnlockCtx(uc, s.NotificationTimeout())\n\t\tif err == io.EOF {\n\t\t\treturn sim.EapErrorResPacket(\n\t\t\t\tidentifier, sim.NOTIFICATION_FAILURE, codes.InvalidArgument, \"Missing AT_MAC\")\n\t\t}\n\t\treturn sim.EapErrorResPacket(\n\t\t\tidentifier, sim.NOTIFICATION_FAILURE, codes.InvalidArgument, err.Error())\n\t}\n\t// Verify MAC\n\tmacBytes := atMac.Marshaled()\n\tif len(macBytes) < sim.ATT_HDR_LEN+sim.MAC_LEN {\n\t\ts.UpdateSessionUnlockCtx(uc, s.NotificationTimeout())\n\t\treturn sim.EapErrorResPacket(\n\t\t\tidentifier, sim.NOTIFICATION_FAILURE, codes.InvalidArgument, \"Malformed AT_MAC\")\n\t}\n\tueMac := make([]byte, len(macBytes)-sim.ATT_HDR_LEN)\n\tcopy(ueMac, macBytes[sim.ATT_HDR_LEN:])\n\t// Set MAC value to zeros before calculating it for verification\n\tfor i := sim.ATT_HDR_LEN; i < len(macBytes); i++ {\n\t\tmacBytes[i] = 0\n\t}\n\tmac := sim.GenChallengeMac(p, uc.Sres, uc.K_aut)\n\tif !reflect.DeepEqual(ueMac, mac) {\n\t\ts.UpdateSessionUnlockCtx(uc, s.NotificationTimeout())\n\t\tglog.Errorf(\n\t\t\t\"Invalid MAC for Session ID: %s; IMSI: %s; UE MAC: %x; Expected MAC: %x; EAP: %x\",\n\t\t\tctx.SessionId, imsi, ueMac, mac, req)\n\t\treturn sim.EapErrorResPacket(\n\t\t\tidentifier, sim.NOTIFICATION_FAILURE, codes.Unauthenticated,\n\t\t\t\"Invalid MAC for Session ID: %s; IMSI: %s\", ctx.SessionId, imsi)\n\t}\n\t// All good, set IMSI, MSK & Identity for farther use by Radius and return SuccessCode\n\tctx.Imsi = string(imsi)\n\tif uc.Profile != nil {\n\t\tctx.Msisdn = uc.Profile.Msisdn\n\t}\n\tctx.Msk = uc.MSK\n\tctx.Identity = uc.Identity\n\tctx.AuthSessionId = uc.AuthSessionId\n\tuc.SetState(sim.StateAuthenticated)\n\n\t// Keep session & User Ctx around for some time after authentication and then clean them up\n\tuc.Unlock()\n\ts.ResetSessionTimeout(sessionId, s.SessionAuthenticatedTimeout())\n\n\t// RFC 3748 p4.2 EAP Success packet\n\t// 0 1 2 3\n\t// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\n\t// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n\t// | Code | Identifier | Length |\n\t// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n\treturn []byte{\n\t\t\teap.SuccessCode, // Code\n\t\t\tidentifier, // Identifier\n\t\t\t0, 4}, // Length\n\t\tnil\n}", "title": "" }, { "docid": "d0b7e48bbb5ccc6934fa7c7f37304cb9", "score": "0.4580622", "text": "func (oc *OpenConnection) AckContactRequestOnResponse(channel int32, status string) {\n\tdefer utils.RecoverFromError()\n\n\tmessageBuilder := new(MessageBuilder)\n\tdata, err := messageBuilder.ReplyToContactRequestOnResponse(channel, status)\n\tutils.CheckError(err)\n\n\toc.setChannel(channel, \"im.ricochet.contact.request\")\n\toc.rni.SendRicochetPacket(oc.conn, 0, data)\n}", "title": "" }, { "docid": "d0b7e48bbb5ccc6934fa7c7f37304cb9", "score": "0.4580622", "text": "func (oc *OpenConnection) AckContactRequestOnResponse(channel int32, status string) {\n\tdefer utils.RecoverFromError()\n\n\tmessageBuilder := new(MessageBuilder)\n\tdata, err := messageBuilder.ReplyToContactRequestOnResponse(channel, status)\n\tutils.CheckError(err)\n\n\toc.setChannel(channel, \"im.ricochet.contact.request\")\n\toc.rni.SendRicochetPacket(oc.conn, 0, data)\n}", "title": "" }, { "docid": "301cfb67c4d082157e0e14ce0bc553a7", "score": "0.45620862", "text": "func (vr *vrMediator) reply(m Msg) {\n\tci, ok := vr.ClientTable[m.Client]\n\tif !ok {\n\t\treturn\n\t}\n\n\tlog.Printf(\"primary %d replying to %d(%s), reply = %d\\n\", vr.ID, m.Client, ci.conn.RemoteAddr().String(), m.Result)\n\tci.enc.Encode(&m)\n}", "title": "" }, { "docid": "d9afe1f13034e16b641021fe797e870d", "score": "0.4561643", "text": "func (cl *ButtonResponse) Send() error {\n\treturn cl.client.SendAnswerCallbackQuery(cl)\n}", "title": "" }, { "docid": "ed47d649cf56a4b7165b263fc121a968", "score": "0.45597202", "text": "func (u *Conn) accept(pay string) {\n\tu.send.Lock()\n\tdefer u.send.Unlock()\n\tu.send.ch <- pay\n}", "title": "" }, { "docid": "7b96bcd13371a3c8865953913c42705c", "score": "0.45574033", "text": "func Send(serverAddr string, env *cb.Envelope) error {\n\tvar opts []grpc.DialOption\n\topts = append(opts, grpc.WithInsecure())\n\topts = append(opts, grpc.WithTimeout(3*time.Second))\n\topts = append(opts, grpc.WithBlock())\n\n\tconn, err := grpc.Dial(serverAddr, opts...)\n\tdefer conn.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error connecting: %s\", err)\n\t}\n\tclient, err := ab.NewAtomicBroadcastClient(conn).Broadcast(context.TODO())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error connecting: %s\", err)\n\t}\n\n\ts := newBroadcastClient(client)\n\tif err = s.client.Send(env); err != nil {\n\t\treturn fmt.Errorf(\"Could not send :%s)\", err)\n\t}\n\n\terr = s.getAck()\n\n\treturn err\n}", "title": "" }, { "docid": "72aa0036833700034240863a35bfc50f", "score": "0.45496795", "text": "func (t *Transport) connect(ctx context.Context, addr net.Addr) (connectionID int64, err error) {\n\treq := new(connectRequest)\n\treq.SetAction(actionConnect)\n\treq.SetConnectionID(connectionIDMagic)\n\n\ttrx := newTransaction(req, \"\")\n\ttrx.addr = addr\n\n\tdata, err := t.retryTransaction(ctx, t.writeTrx, trx) // Does not return until transaction is completed.\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tvar response connectResponse\n\terr = binary.Read(bytes.NewReader(data), binary.BigEndian, &response)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif response.Action != actionConnect {\n\t\treturn 0, errors.New(\"invalid action in connect response\")\n\t}\n\n\tt.log.Debugf(\"connect Response: %#v\\n\", response)\n\treturn response.ConnectionID, nil\n}", "title": "" }, { "docid": "815342cc17fc0e4120230c865537be15", "score": "0.4537627", "text": "func (c *RTCClient) Run() error {\n\tc.conn.SetCloseHandler(func(code int, text string) error {\n\t\t// when closed, stop connection\n\t\tlogger.Infow(\"connection closed\", \"code\", code, \"text\", text)\n\t\tc.Stop()\n\t\treturn nil\n\t})\n\n\t// run the session\n\tfor {\n\t\tres, err := c.ReadResponse()\n\t\tif errors.Is(io.EOF, err) {\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\tlogger.Errorw(\"error while reading\", err)\n\t\t\treturn err\n\t\t}\n\t\tswitch msg := res.Message.(type) {\n\t\tcase *livekit.SignalResponse_Join:\n\t\t\tc.localParticipant = msg.Join.Participant\n\t\t\tc.id = msg.Join.Participant.Sid\n\t\t\tc.lock.Lock()\n\t\t\tfor _, p := range msg.Join.OtherParticipants {\n\t\t\t\tc.remoteParticipants[p.Sid] = p\n\t\t\t}\n\t\t\tc.lock.Unlock()\n\n\t\t\tlogger.Infow(\"join accepted, awaiting offer\", \"participant\", msg.Join.Participant.Identity)\n\t\tcase *livekit.SignalResponse_Answer:\n\t\t\t//logger.Debugw(\"received server answer\",\n\t\t\t//\t\"participant\", c.localParticipant.Identity,\n\t\t\t//\t\"answer\", msg.Answer.Sdp)\n\t\t\tc.handleAnswer(rtc.FromProtoSessionDescription(msg.Answer))\n\t\tcase *livekit.SignalResponse_Offer:\n\t\t\tlogger.Infow(\"received server offer\",\n\t\t\t\t\"participant\", c.localParticipant.Identity,\n\t\t\t)\n\t\t\tdesc := rtc.FromProtoSessionDescription(msg.Offer)\n\t\t\tif err := c.handleOffer(desc); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase *livekit.SignalResponse_Trickle:\n\t\t\tcandidateInit, err := rtc.FromProtoTrickle(msg.Trickle)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif msg.Trickle.Target == livekit.SignalTarget_PUBLISHER {\n\t\t\t\terr = c.publisher.AddICECandidate(candidateInit)\n\t\t\t} else {\n\t\t\t\terr = c.subscriber.AddICECandidate(candidateInit)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase *livekit.SignalResponse_Update:\n\t\t\tparticipants := make(map[string]*livekit.ParticipantInfo)\n\t\t\tfor _, p := range msg.Update.Participants {\n\t\t\t\tif p.State != livekit.ParticipantInfo_DISCONNECTED {\n\t\t\t\t\tparticipants[p.Sid] = p\n\t\t\t\t}\n\t\t\t}\n\t\t\tc.lock.Lock()\n\t\t\tc.remoteParticipants = participants\n\t\t\tc.lock.Unlock()\n\n\t\tcase *livekit.SignalResponse_TrackPublished:\n\t\t\tlogger.Debugw(\"track published\", \"track\", msg.TrackPublished.Track.Name, \"participant\", c.localParticipant.Sid,\n\t\t\t\t\"cid\", msg.TrackPublished.Cid, \"trackSid\", msg.TrackPublished.Track.Sid)\n\t\t\tc.lock.Lock()\n\t\t\tc.pendingPublishedTracks[msg.TrackPublished.Cid] = msg.TrackPublished.Track\n\t\t\tc.lock.Unlock()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2a4a92bbde20f639e3f997d5042752c0", "score": "0.4536778", "text": "func (q *Quiz) getAnswerFromUser(p Problem, c chan string) {\n\tq.printer.Println(\"what is the answer to: \" + p.Question + \" ?\")\n\tanswer, _ := q.reader.ReadString('\\n')\n\tc <- answer\n}", "title": "" }, { "docid": "398cefd410b611c9c96c9aaf79ddf8a2", "score": "0.4534326", "text": "func reply(replyid string, message string) {\n\tvar err error\n\tif replyid != \"\" {\n\t\tlog.Println(\"Sending reply to:\", replyid, message)\n\t\terr = tc.Reply(replyid, message)\n\t} else {\n\t\tlog.Println(\"Posting:\", message)\n\t\terr = tc.Post(message)\n\t}\n\tif err != nil {\n\t\tlog.Println(\"Error posting to Account:\", err)\n\t}\n}", "title": "" }, { "docid": "d7ccc8c6cfbb8ccd6febf59491981da1", "score": "0.45324513", "text": "func TestRespondentCloseContextSend(t *testing.T) {\n\ts := GetSocket(t, NewSocket)\n\tp := GetSocket(t, xsurveyor.NewSocket)\n\tMustSucceed(t, s.SetOption(mangos.OptionWriteQLen, 1))\n\tMustSucceed(t, p.SetOption(mangos.OptionReadQLen, 1))\n\tc, e := s.OpenContext()\n\tMustSucceed(t, e)\n\n\tConnectPair(t, s, p)\n\n\tMustSucceed(t, c.SetOption(mangos.OptionSendDeadline, time.Millisecond*10))\n\n\ttime.Sleep(time.Millisecond * 10)\n\tcnt := 0\n\tdata := []byte{0x80, 0, 0, 1}\n\tfor i := 0; i < 100; i++ {\n\t\t// We have to make a raw message when using xsurveyor. We\n\t\t// use xsurveyor because normal surveyor will simply discard\n\t\t// messages for surveys it doesn't have outstanding.\n\t\tm := mangos.NewMessage(0)\n\t\tm.Header = append(m.Header, data...)\n\t\tdata[3]++\n\t\tMustSucceed(t, p.SendMsg(m))\n\t\tm, e := c.RecvMsg()\n\t\tMustSucceed(t, e)\n\t\tMustNotBeNil(t, m)\n\t\tif e = c.SendMsg(m); e != nil {\n\t\t\tMustBeError(t, e, mangos.ErrSendTimeout)\n\t\t\tbreak\n\t\t}\n\t\tcnt++\n\n\t\t// NB: We never ask the peer to receive it -- this ensures we\n\t\t// encounter back-pressure.\n\t}\n\tMustBeTrue(t, cnt > 0) // Some in-flight sends possible.\n\tMustBeTrue(t, cnt < 10)\n\n\tm := mangos.NewMessage(0)\n\tm.Header = append(m.Header, data...)\n\tdata[3]++\n\tMustSucceed(t, p.SendMsg(m))\n\n\tMustSucceed(t, c.SetOption(mangos.OptionSendDeadline, time.Minute))\n\tm, e = c.RecvMsg()\n\tMustSucceed(t, e)\n\tMustNotBeNil(t, m)\n\ttime.AfterFunc(time.Millisecond*20, func() { MustSucceed(t, c.Close()) })\n\tMustBeError(t, c.SendMsg(m), mangos.ErrClosed)\n\n\tMustSucceed(t, p.Close())\n\tMustSucceed(t, s.Close())\n}", "title": "" }, { "docid": "92a8e107371e182dd10ebb5f7d1c59e2", "score": "0.45310357", "text": "func runQuiz(question, answer string, ansChan <-chan string, quit <-chan time.Time) (int, error) {\n\tfmt.Println(question)\n\n\tfor {\n\t\tselect {\n\t\tcase <-quit:\n\t\t\treturn -1, fmt.Errorf(\"\\nTime out\")\n\n\t\tcase input := <-ansChan:\n\t\t\tscore := 0\n\t\t\tif strings.Compare(strings.Trim(strings.ToLower(input), \"\\n\"), answer) == 0 {\n\t\t\t\tscore = 1\n\t\t\t} else {\n\t\t\t\treturn 0, fmt.Errorf(\"\\nWrong Answer\")\n\t\t\t}\n\t\t\treturn score, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9d0249a48b3365f9b2a9f32f3163281b", "score": "0.45204696", "text": "func (qc *QuestionClient) Ask(title string, content string, aid int, anickname string) (*model.Question, int) {\n\tutils.LOG(\"Asking new question\")\n\n\tbodyReq := fmt.Sprintf(\"{\\\"title\\\":\\\"%s\\\",\\\"content\\\":\\\"%s\\\",\\\"author_id\\\":%d,\\\"author_nickname\\\":\\\"%s\\\"}\", title, content, aid, anickname)\n\tcode, body := qc.connection.PUT(qc.host+\"/ask\", []byte(bodyReq))\n\tvar response ui.Response\n\tdata := &model.Question{}\n\ttemp := ui.Response{Data: data}\n\tjson.Unmarshal(body, &temp)\n\n\tif code != 201 {\n\t\tutils.LOG(fmt.Sprintf(\"Error occured while asking new question: %s\", response.Error))\n\t\treturn nil, code\n\t}\n\n\treturn data, code\n}", "title": "" }, { "docid": "ab09c2a4c81c0a46de4e8ce9ac65ddb7", "score": "0.45182487", "text": "func (e2e encryptionState) acceptContact(alice *disco.KeyPair, aliceName string, firstHandshakeMessage []byte) ([]byte, []byte, []byte, error) {\n\n\t// TODO: prologue\n\tprologue := []byte{}\n\n\t// initialize handshake state\n\ths := disco.Initialize(disco.Noise_IK, false, prologue, e2e.keyPair, nil, alice, nil)\n\tif _, _, err := hs.ReadMessage(firstHandshakeMessage, nil); err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\t// write the second handshake message\n\tvar msg []byte\n\tts2, ts1, err := hs.WriteMessage(nil, &msg) // reversed because we are the responder\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\t//\n\treturn ts1.Serialize(), ts2.Serialize(), msg, nil\n}", "title": "" }, { "docid": "ea9bcf5d49e14ea35501acf57dbb4423", "score": "0.4516021", "text": "func (s *XLSuite) nodeAsClient(c *C, node *Node, q int, doneCh chan bool) {\n\tP := node.SizePeers()\n\n\tfor i := 0; i < q; i++ {\n\t\tfor j := 0; j < P; j++ {\n\t\t\tgo func(j int) {\n\t\t\t\tvar err error\n\t\t\t\tvar count int\n\t\t\t\tvar cnx xt.ConnectionI\n\t\t\t\trng := xr.MakeSimpleRNG()\n\n\t\t\t\t// open cnx to peer j\n\t\t\t\tpeer := node.GetPeer(j)\n\t\t\t\tctor := peer.GetConnector(0)\n\t\t\t\t// XXX soFar and the sleep handle 'lost connection' errors\n\t\t\t\t// Before 2013-09-30 we did 3 soFars and a 1 ms delay, and\n\t\t\t\t// sometimes got many lost connections.\n\t\t\t\t// NOTE: if you get 'lost connection' errors, consider\n\t\t\t\t// resetting max open files (using ulimit -n VALUE or\n\t\t\t\t// editing /etc/security/limits.conf\n\t\t\t\tfor soFar := 0; soFar < 3; soFar++ {\n\t\t\t\t\tcnx, err = ctor.Connect(ANY_END_POINT)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\ttime.Sleep(2 * time.Millisecond)\n\t\t\t\t}\n\t\t\t\tc.Assert(err, Equals, nil) // XXX FAILS XXX\n\t\t\t\tc.Assert(cnx, Not(IsNil))\n\t\t\t\tdefer cnx.Close()\n\t\t\t\ttcpCnx := cnx.(*xt.TcpConnection)\n\n\t\t\t\t// make msg, random length, random content\n\t\t\t\tmsgLen := 1024 + rng.Intn(1024)\n\t\t\t\tbuf := make([]byte, msgLen)\n\t\t\t\trng.NextBytes(buf)\n\n\t\t\t\t// send msg\n\t\t\t\tcount, err = tcpCnx.Write(buf)\n\t\t\t\t// 2014-11-22 saw \"connection reset by peer\"\n\t\t\t\tc.Assert(err, IsNil)\n\t\t\t\tc.Assert(count, Equals, msgLen)\n\n\t\t\t\t// calculate hash\n\t\t\t\tdig := sha1.New()\n\t\t\t\tdig.Write(buf)\n\t\t\t\thash := dig.Sum(nil)\n\t\t\t\thashBuf := make([]byte, xu.SHA1_BIN_LEN)\n\n\t\t\t\t// wait for reply\n\t\t\t\tcount, err = tcpCnx.Read(hashBuf)\n\n\t\t\t\t// XXX 2013-09-30 *many* \"connection reset by peer\"\n\t\t\t\t// errors from this point.\n\t\t\t\tc.Assert(err, IsNil)\n\t\t\t\tc.Assert(count, Equals, xu.SHA1_BIN_LEN)\n\n\t\t\t\t// complain if hash differs from reply\n\t\t\t\thashOut := hex.EncodeToString(hash)\n\t\t\t\thashIn := hex.EncodeToString(hashBuf)\n\t\t\t\tc.Assert(hashOut, Equals, hashIn)\n\t\t\t}(j)\n\t\t}\n\t}\n\tdoneCh <- true\n\n}", "title": "" }, { "docid": "c03857cf116e758c900e074fc6609058", "score": "0.4515828", "text": "func handleCEA(sm *StateMachine, errc chan error) diam.HandlerFunc {\n\treturn func(c diam.Conn, m *diam.Message) {\n\t\tcea := new(smparser.CEA)\n\t\tif err := cea.Parse(m, smparser.Client); err != nil {\n\t\t\terrc <- err\n\t\t\treturn\n\t\t}\n\t\tmeta := smpeer.FromCEA(cea)\n\t\tc.SetContext(smpeer.NewContext(c.Context(), meta))\n\t\t// Notify about peer passing the handshake.\n\t\tselect {\n\t\tcase sm.hsNotifyc <- c:\n\t\tdefault:\n\t\t}\n\t\t// Done receiving and validating this CEA.\n\t\tclose(errc)\n\t}\n}", "title": "" }, { "docid": "125cc7df380f2a09de66d511ddb9e3bd", "score": "0.45077288", "text": "func (agent *Agent) handleConnect(request []byte) ([]byte, error) {\n\tunpacker := binpacker.NewUnpacker(endian, bytes.NewBuffer(request))\n\tvar isReturn byte\n\tvar port uint16\n\tvar name, host string\n\tunpacker.FetchByte(&isReturn).\n\t\tFetchUint16(&port).\n\t\tStringWithUint16Prefix(&name).\n\t\tStringWithUint16Prefix(&host)\n\tnode := &base.Node{\n\t\tName: name,\n\t\tHost: host,\n\t\tPort: port,\n\t}\n\tagent.registerNode(node)\n\tif isReturn != ACK_CONN_IS_RETURN {\n\t\tgo agent.connectTo(node.FullName(), true)\n\t}\n\treturn []byte{ACK_CONN_OK}, nil\n}", "title": "" }, { "docid": "8bc49c358c64c3bdbdfbd8ac211b5d6c", "score": "0.45028263", "text": "func (j *job) sendFeedback(resp *pbJob.CmdResult) {\n\tj.feedback <- PeerResult{Progress: j.progress, Response: resp}\n}", "title": "" }, { "docid": "aaca3ce03b35a0e4642cd9537d5c6e55", "score": "0.45004627", "text": "func send(replyToMsg *IncomingMessage, answer *Answer) *slack.OutgoingMessage {\n\treturn newSlackOutgoingMessage(replyToMsg.Channel, answer.Text)\n}", "title": "" }, { "docid": "93fa27e520d7c6e05a67bc1daa1bce65", "score": "0.44905156", "text": "func handlerConnackSuccess(_ *testing.T, c net.Conn) {\n\tack := mqtt.PDUConnAck{}\n\tbuf := ack.Marshall()\n\tc.Write(buf)\n}", "title": "" }, { "docid": "cdb00a986837695975061aeabfff1517", "score": "0.4483257", "text": "func (Uni *UniBot) Respond(cID, content string) {\n\tgo Uni.S.ChannelMessageSend(cID, content)\n}", "title": "" }, { "docid": "a8b544caf0d05c4f1801b57b23403409", "score": "0.44721723", "text": "func (server *VerifierImpl) SendAttestQuote(ctx *zattest.Context) error {\n\t//XXX: Fill it in when Controller code is ready\n\treturn nil\n}", "title": "" }, { "docid": "8576ecaa58a5df6e78d90c29b3d8b5b1", "score": "0.44717512", "text": "func (agent *Agent) handleConnection(conn *net.TCPConn) {\n\tfor {\n\t\tlengthBuffer := make([]byte, 8)\n\t\tif _, err := conn.Read(lengthBuffer); err != nil {\n\t\t\t// handle error\n\t\t\tconn.Close()\n\t\t\tbreak\n\t\t}\n\t\tlength := binary.LittleEndian.Uint16(lengthBuffer)\n\t\tbuffer := make([]byte, length)\n\t\tif _, err := conn.Read(buffer); err != nil {\n\t\t\t// handle error\n\t\t\tcontinue\n\t\t}\n\t\tcode, request := buffer[0], buffer[1:]\n\t\tanswer, err := agent.dispatchRequest(code, request)\n\t\tif err != nil {\n\t\t\tconn.Close()\n\t\t\tbreak\n\t\t}\n\t\tif _, err := conn.Write(answer); err != nil {\n\t\t\tconn.Close()\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "001718ba5070300d523de2cccfc34ac6", "score": "0.44658858", "text": "func (p *Peer) writeClient(conn net.Conn) {\n\tfor {\n\t\tfmt.Print(\"> \")\n\t\treader := bufio.NewReader(os.Stdin)\n\t\tm, err := reader.ReadString('\\n')\n\t\tif err != nil || m == \"quit\\n\" { \n\t\t\treturn \n\t\t}\n\t\tp.outbound<- m \n\t}\n}", "title": "" }, { "docid": "9a394c7f2498146b47a82254afc510f4", "score": "0.44636238", "text": "func checkAnswerResult(client *QuizClient, qindex int,ans string) bool{\n\tdataMap:=make(map[string]interface{})\n\tdataMap[\"type\"]=\"result\"\n\tcorrect,valid:=client.Questions[qindex].CheckAnswer(ans)\n\t\n\tdataMap[\"valid\"]=valid\n\tdataMap[\"correct\"]=correct\n\tif correct {\n\t\tclient.Score++\n\t} \n\tif valid {\n\t\tdataMap[\"ans\"]=client.Questions[qindex].Answer()\n\t} \n\n\t\n\tcommon.SendJSONData(client.Conn,dataMap)\n\treturn valid\n\n}", "title": "" }, { "docid": "dab1dbdcbfb7c3c8e7260d4c837d8f8a", "score": "0.44634387", "text": "func (ch pbkdf2ch) Answer(fetch trust.ArtifactHook, node trust.Node, answer []byte) (trust.Node, error) {\n\t// Phase 1. Check fetch hook\n\tif fetch == nil {\n\t\treturn nil, ErrChallengeFailed\n\t}\n\n\t// Phase 2. Parse answer.\n\t// If node exists - we must use answer as raw data.\n\t// Otherwise - try to parse it throw credentials separated values.\n\tif node == nil {\n\t\t// use special tool\n\t\tcredentials, err := Credentials(answer)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// case when this challenge must set the new node\n\t\tnode = credentials.Abstract()\n\t\t// also, answer to hash will be password part of the credentials\n\t\tanswer = credentials.Password\n\t}\n\n\t// Phase 3. Hash answer to artifact and send to hook.\n\t// It is the main purpose of this type of challenge\n\tartifact := ch.key(answer)\n\tif err := fetch(artifact, ch, node); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn node, nil\n}", "title": "" }, { "docid": "1f45ccb234a23e442ca9265357eaff55", "score": "0.4463026", "text": "func (dataChannel *DataChannel) sendEncryptionChallenge(log log.T) (err error) {\n\t// Build the request\n\tencChallengeRequest := mgsContracts.EncryptionChallengeRequest{}\n\trandBytes := make([]byte, 64)\n\tcryptoRand.Read(randBytes)\n\tdataChannel.handshake.encryptionChallenge = randBytes\n\trandBytes, err = dataChannel.blockCipher.EncryptWithAESGCM(randBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\tencChallengeRequest.Challenge = randBytes\n\n\t// Send it\n\tlog.Debug(\"Sending EncryptionChallengeRequest.\")\n\terr = dataChannel.sendStreamDataMessageJson(log, mgsContracts.EncChallengeRequest, encChallengeRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn\n}", "title": "" }, { "docid": "1b9cef0ffc47ea635b5dcbfe5071144a", "score": "0.4462724", "text": "func (c *AMQPClient) connect(addr string) bool {\n\tif c.isReal {\n\t\tconn, err := amqp.Dial(addr)\n\t\tif err != nil {\n\t\t\tc.logger.Printf(\"failed to dial rabbitMQ server: %v\", err)\n\t\t\treturn false\n\t\t}\n\n\t\tch, err := conn.Channel()\n\t\tif err != nil {\n\t\t\tc.logger.Printf(\"failed connecting to amqpChannel: %v\", err)\n\t\t\treturn false\n\t\t}\n\n\t\terr = ch.Confirm(false)\n\t\tif err != nil {\n\t\t\tc.logger.Printf(\"failed to confirm amqpChannel: %v\", err)\n\t\t\treturn false\n\t\t}\n\n\t\t_, err = ch.QueueDeclare(\n\t\t\tc.listenQueue,\n\t\t\ttrue, // Durable\n\t\t\tfalse, // Delete when unused\n\t\t\tfalse, // Exclusive\n\t\t\tfalse, // No-wait\n\t\t\tnil, // Arguments\n\t\t)\n\t\tif err != nil {\n\t\t\tc.logger.Printf(\"failed to declare listen queue: %v\", err)\n\t\t\treturn false\n\t\t}\n\n\t\t_, err = ch.QueueDeclare(\n\t\t\tc.pushQueue,\n\t\t\ttrue, // Durable\n\t\t\tfalse, // Delete when unused\n\t\t\tfalse, // Exclusive\n\t\t\tfalse, // No-wait\n\t\t\tnil, // Arguments\n\t\t)\n\n\t\tif err != nil {\n\t\t\tc.logger.Printf(\"failed to declare push queue: %v\", err)\n\t\t\treturn false\n\t\t}\n\n\t\tc.changeRealConnection(conn, ch)\n\t\tc.isConnected = true\n\n\t\treturn true\n\t}\n\n\tconn, err := amqptest.Dial(addr)\n\n\tch, err := conn.Channel()\n\tif err != nil {\n\t\tc.logger.Printf(\"failed connecting to amqpChannel: %v\", err)\n\t\treturn false\n\t}\n\n\terr = ch.Confirm(false)\n\tif err != nil {\n\t\tc.logger.Printf(\"failed to confirm amqpChannel: %v\", err)\n\t\treturn false\n\t}\n\n\toptions := wabbit.Option{\n\t\t\"durable\": true,\n\t\t\"autoDelete\": false,\n\t\t\"exclusive\": false,\n\t\t\"noWait\": false,\n\t}\n\n\t_, err = ch.QueueDeclare(c.listenQueue, options)\n\tif err != nil {\n\t\tc.logger.Printf(\"failed to declare listen queue: %v\", err)\n\t\treturn false\n\t}\n\n\t_, err = ch.QueueDeclare(c.pushQueue, options)\n\n\tif err != nil {\n\t\tc.logger.Printf(\"failed to declare push queue: %v\", err)\n\t\treturn false\n\t}\n\n\tc.logger.Printf(\"Connected\")\n\n\tc.changeConnection(conn, ch)\n\tc.isConnected = true\n\n\treturn true\n}", "title": "" }, { "docid": "a55838c69139c21f902561125abaa7e1", "score": "0.44589087", "text": "func (kc *KymaConnector) SendCSRResponse(ctx context.Context, responseURL, subject string) (string, error) {\n\tkc.Serving.Certificate = kc.AppConfig.GenerateKeysAndCertificate(subject)\n\n\tvar jsonStr = []byte(fmt.Sprintf(\"{\\\"csr\\\":\\\"%s\\\"}\", base64.StdEncoding.EncodeToString([]byte(kc.Serving.Certificate.Csr))))\n\treq, err := http.NewRequest(\"POST\", responseURL, bytes.NewBuffer(jsonStr))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to create request: %w\", err)\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq = req.WithContext(ctx)\n\n\tresp, err := kc.Serving.Client.Do(req)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"csr failed: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tbodyBytes, _ := ioutil.ReadAll(resp.Body)\n\tbodyString := string(bodyBytes)\n\treturn bodyString, nil\n}", "title": "" }, { "docid": "0c26a782fc112df499a086145076d68c", "score": "0.44572935", "text": "func (cawClient *CawClient) PostCaw(username string,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttext string,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparent_id int) bool {\n\tvar cawRequest caw.CawRequest\n\t// Checking if this is a reply or\n\t// a brand new caw\n\tif parent_id != -1 {\n\t\tcawRequest = caw.CawRequest{ Username: username, Text: text, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ParentId: []byte(strconv.Itoa(parent_id)) }\n\t} else {\n\t\tcawRequest = caw.CawRequest{ Username: username, Text: text }\n\t}\n\n\tanyRequest, errPacking := ptypes.MarshalAny(proto.Message(&cawRequest))\n\tif errPacking != nil {\n\t\tpanic(errPacking)\n\t}\n\tvar anyResponse = new(any.Any)\n\tcawSuccessBool := cawClient.client_.Event(anyRequest, anyResponse,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcawClient.functionToEventType_[\"caw\"])\n\tif cawSuccessBool {\n\t\tvar cawResponse = new(caw.CawReply)\n\t\terrUnpacking := ptypes.UnmarshalAny(anyResponse, cawResponse)\n\t\tif errUnpacking != nil {\n\t\t\tfmt.Println(errUnpacking.Error())\n\t\t\treturn false\n\t\t} else {\n\t\t\tcaw := cawResponse.GetCaw()\n\t\t\tfmt.Println(\"Your caw was posted successfully!\")\n\t\t\tfmt.Println(\"Here's your caw information\")\n\t\t\tfmt.Printf(\"\\t Username: %s \\n\", caw.Username)\n\t\t\tfmt.Printf(\"\\t Text: %s \\n\", caw.Text)\n\t\t\tfmt.Printf(\"\\t Id: %s \\n\", string(caw.Id))\n\t\t\tfmt.Printf(\"\\t Parent_Id: %s \\n\", string(caw.ParentId))\n\t\t\tfmt.Printf(\"\\t Time created: %d \\n\", caw.Timestamp.Seconds)\n\t\t\treturn true\n\t\t}\n\t} else {\n\t\terrPosting := fmt.Errorf(\"There was an error in posting your caw\")\n\t\tfmt.Println(errPosting.Error())\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "d4c0ffd705ddec69a0fab413ee5659c1", "score": "0.44572753", "text": "func (s *remoteCNIserver) generateCniReply(config *containeridx.Config, nsName string, podIP string) *cni.CNIReply {\n\treturn &cni.CNIReply{\n\t\tResult: resultOk,\n\t\tInterfaces: []*cni.CNIReply_Interface{\n\t\t\t{\n\t\t\t\tName: config.VppIf.Name,\n\t\t\t\tSandbox: nsName,\n\t\t\t\tIpAddresses: []*cni.CNIReply_Interface_IP{\n\t\t\t\t\t{\n\t\t\t\t\t\tVersion: cni.CNIReply_Interface_IP_IPV4,\n\t\t\t\t\t\tAddress: podIP,\n\t\t\t\t\t\tGateway: s.ipam.PodGatewayIP().String(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tRoutes: []*cni.CNIReply_Route{\n\t\t\t{\n\t\t\t\tDst: \"0.0.0.0/0\",\n\t\t\t\tGw: s.ipam.PodGatewayIP().String(),\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "648bfad5b43618acca65bf40fb8049f3", "score": "0.44537657", "text": "func connectClient(tc testcase, errChan chan error) {\n\tvar (\n\t\tconn net.Conn\n\t\terr error\n\t)\n\n\tif tc.conf.ssl {\n\t\tconn, err = tls.Dial(tc.conf.proto, tc.conf.addr,\n\t\t\t&tls.Config{InsecureSkipVerify: true})\n\t} else {\n\t\tconn, err = net.DialTimeout(tc.conf.proto, tc.conf.addr, 100*time.Millisecond)\n\t}\n\tif err != nil {\n\t\terrChan <- err\n\t\treturn\n\t}\n\tdefer conn.Close()\n\n\terr = readPacket(conn, tc)\n\tif err != nil {\n\t\terrChan <- err\n\t}\n}", "title": "" }, { "docid": "463d165074bab9ed47b204f7a6e5c2bd", "score": "0.44503674", "text": "func (c *Client) HandConnack(fn func()) {\n\tc.onConnack = fn\n}", "title": "" }, { "docid": "8d3526fde58460c7366ce801c5e0dea1", "score": "0.44444826", "text": "func (l *AuthLearner) sendDecided(rnd uint) {\n\tif l.maxlearned+l.alpha < rnd {\n\t\tl.maxlearned++\n\t} else if l.maxlearned+1 != rnd {\n\t\tglog.V(2).Infoln(\"Learned for round out of order, holding responses\")\n\t\treturn\n\t}\n\ti := l.maxlearned\n\tfor l.rounds.Get(rnd).Learned {\n\t\t//Send decide to server\n\t\tl.dcdChan <- &l.rounds.Get(rnd).Val\n\t\t//Send decide to publisher\n\t\tl.send(l.actors[0], DcdRnd{l.maxlearned})\n\t\trnd++\n\t\tl.maxlearned++\n\t}\n\tglog.V(2).Infof(\"Sent decided values for %d round(s)\\n\", l.maxlearned-i)\n\n}", "title": "" }, { "docid": "c6dbed77e0171ac6ce94b95f24199be8", "score": "0.44440895", "text": "func (s *policyDnstapSender) sendCRExtraMsg(w dns.ResponseWriter, msg *dns.Msg, attrs []*pb.DnstapAttribute) {\n\tif w == nil || msg == nil {\n\t\tlog.Errorf(\"Failed to create dnstap CR message - no DNS response message found\")\n\t\treturn\n\t}\n\n\tnow := time.Now()\n\tb := tapmsg.New().Time(now).Addr(w.RemoteAddr())\n\tb.Msg(msg)\n\tcrMsg, err := b.ToClientResponse()\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to create dnstap CR message (%v)\", err)\n\t\treturn\n\t}\n\n\ttimeNs := uint32(now.Nanosecond())\n\tcrMsg.ResponseTimeNsec = &timeNs\n\tt := tap.Dnstap_MESSAGE\n\n\tvar extra []byte\n\tif len(attrs) > 0 {\n\t\textra, err = proto.Marshal(&pb.Extra{Attrs: attrs})\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to create extra data for dnstap CR message (%v)\", err)\n\t\t}\n\t}\n\tdnstapMsg := tap.Dnstap{Type: &t, Message: crMsg, Extra: extra}\n\ts.ior.Dnstap(dnstapMsg)\n}", "title": "" }, { "docid": "78b58261e75306180e45b40c1d90c140", "score": "0.4439469", "text": "func handleConn(c net.Conn, deviceIDs []string) {\n\tp, err := packet.ReadPacket(c, 0)\n\n\tif debug {\n\t\tprintConnState(c)\n\t}\n\n\tif err != nil {\n\t\tfmt.Printf(\"Error while reading connect packet: %v\\n\", err)\n\t\treturn\n\t}\n\n\tconnectPacket, ok := p.(*packet.ConnectControlPacket)\n\tif !ok {\n\t\tfmt.Println(\"Got wrong packet as first packet..need connect!\")\n\t\treturn\n\t}\n\n\tdefer fmt.Println(\"Client disconnected \", connectPacket.ConnectPayload.ClientID)\n\n\tfmt.Printf(\"Client with ID %v connected!\\n\", connectPacket.ConnectPayload.ClientID)\n\t// TODO ignore/compare this ID with the given ID from the verify function\n\n\tvar clientIDOK bool\n\tvar deviceID string\n\tif len(deviceIDs) == 1 {\n\t\t// only one ID is possible with this cert; no need to have clientID set\n\t\tclientIDOK = true\n\t\tdeviceID = deviceIDs[0]\n\t} else {\n\t\tfmt.Printf(\"Client used duplicate fingerprint, Please use unique certificate for your device\\n\")\n\t\t_ = c.Close()\n\t\treturn\n\t\t//TODO : when multiple devices have single fingerprint authentication\n\t\t/*\n\t\t\tfor _, possibleID := range deviceIDs {\n\t\t\t\tif connectPacket.ConnectPayload.ClientID == possibleID {\n\t\t\t\t\tfmt.Printf(\"Using ClientID: %v\\n\", possibleID)\n\t\t\t\t\tclientIDOK = true\n\t\t\t\t\tdeviceID = possibleID\n\t\t\t\t}\n\t\t\t}\n\t\t*/\n\t}\n\n\tif !clientIDOK {\n\t\tfmt.Printf(\"Client used invalid clientID, disconnecting\\n\")\n\t\t_ = c.Close()\n\t\treturn\n\n\t}\n\t//TODO : MQTT CONNACK Properties need to add here\n\tresp := packet.ConnAckControlPacket{\n\t\tFixedHeader: packet.FixedHeader{\n\t\t\tControlPacketType: packet.CONNACK,\n\t\t},\n\t\tVariableHeader: packet.ConnAckVariableHeader{},\n\t}\n\n\tif len(connectPacket.ConnectPayload.ClientID) <= 0 {\n\t\tresp.VariableHeader.ConnAckProperties.AssignedClientID = deviceID\n\t}\n\t// Only open Back-channel after conn packet was received\n\n\t// Create empty subscription\n\tbackChannel := ps.Sub()\n\tgo handleBackChannel(c, deviceID, backChannel, connectPacket.VariableHeader.ProtocolLevel)\n\tdefer func() {\n\t\tfmt.Printf(\"Unsubbed channel %v\\n\", deviceID)\n\t\tps.Unsub(backChannel)\n\t}()\n\n\t_, err = resp.WriteTo(c)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to write ConnAck. Closing connection.\")\n\t\treturn\n\t}\n\tvar topicAliasPublishMap map[string]int\n\ttopicAliasPublishMap = make(map[string]int)\n\n\tfor {\n\t\tdeviceStatus, err := client.GetDeviceStatus(context.Background(), &registrypb.GetDeviceStatusRequest{Deviceid: deviceID})\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"device status doesn't exist in redis %v\\n\", err)\n\t\t} else {\n\t\t\tif !deviceStatus.Status {\n\t\t\t\t_ = c.Close()\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tp, err := packet.ReadPacket(c, connectPacket.VariableHeader.ProtocolLevel)\n\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tfmt.Printf(\"Client closed connection.\\n\")\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Error while reading packet in client loop: %v. Disconnecting client.\\n\", err)\n\t\t\t}\n\t\t\t_ = c.Close() // nolint: gosec\n\t\t\tbreak\n\t\t}\n\n\t\tswitch p := p.(type) {\n\t\tcase *packet.PingReqControlPacket:\n\t\t\tpong := packet.NewPingRespControlPacket()\n\t\t\t_, err := pong.WriteTo(c)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Failed to write PingResp\", err)\n\t\t\t}\n\t\tcase *packet.PublishControlPacket:\n\t\t\ttopicAliasPublishMap, err = handlePublish(p, c, deviceID, topicAliasPublishMap, int(connectPacket.VariableHeader.ProtocolLevel))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to handle Publish packet: %v.\", err)\n\t\t\t}\n\n\t\tcase *packet.SubscribeControlPacket:\n\t\t\tresponse := packet.NewSubAck(uint16(p.VariableHeader.PacketID), connectPacket.VariableHeader.ProtocolLevel, []byte{1})\n\t\t\t_, err := response.WriteTo(c)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Failed to write SubAck:\", err)\n\t\t\t}\n\t\t\tfor _, sub := range p.Payload.Subscriptions {\n\t\t\t\tsubTopic, validTopic := TopicChecker(sub.Topic, \"sub\")\n\t\t\t\tif validTopic {\n\t\t\t\t\tps.AddSub(backChannel, subTopic)\n\t\t\t\t\tgo handleBackChannel(c, deviceID, backChannel, connectPacket.VariableHeader.ProtocolLevel)\n\t\t\t\t\tfmt.Println(\"Added Subscription\", subTopic, deviceID)\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(\"Invalid Subscribed Topic\")\n\t\t\t\t\t_ = c.Close()\n\t\t\t\t}\n\t\t\t}\n\t\tcase *packet.UnsubscribeControlPacket:\n\t\t\tresponse := packet.NewUnSubAck(uint16(p.VariableHeader.PacketID), connectPacket.VariableHeader.ProtocolLevel, []byte{1})\n\t\t\t_, err := response.WriteTo(c)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Failed to write UnSubAck:\", err)\n\t\t\t}\n\t\t\tfor _, unsub := range p.Payload.UnSubscriptions {\n\t\t\t\tps.Unsub(backChannel, unsub.Topic)\n\t\t\t\tfmt.Println(\"Removed Subscription\", unsub.Topic, deviceID)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aa3e55c2f8b3fd3f3a75d3f22c15f7fc", "score": "0.44284576", "text": "func (sp *BallotProtocol) SubmitRequest(peerID peer.ID, subjectHash *subject.Hash, ch chan<- []string) bool {\n\tutils.LogInfof(\"Sending ballot request to: %s....\", peerID)\n\n\t// create message data\n\treq := &pb.BallotRequest{Metadata: NewMetadata(sp.context.Host, uuid.New().String(), false),\n\t\tMessage: fmt.Sprintf(\"Ballot request from %s\", sp.context.Host.ID()), SubjectHash: subjectHash.Byte()}\n\n\tok := SendProtoMessage(sp.context.Host, peerID, ballotRequest, req)\n\tif !ok {\n\t\treturn false\n\t}\n\n\t// store ref request so response handler has access to it\n\tsp.requests[req.Metadata.Id] = req\n\n\tchPeer := sp.channels[peerID]\n\tif chPeer == nil {\n\t\tsp.channels[peerID] = make(map[subject.HashHex]chan<- []string)\n\t}\n\tsp.channels[peerID][subjectHash.Hex()] = ch\n\t// utils.LogInfof(\"Ballot request to: %s was sent. Message Id: %s, Message: %s\", peerID, req.Metadata.Id, req.Message)\n\treturn true\n}", "title": "" }, { "docid": "fd4be2127590912a70c8559bc7b2d43c", "score": "0.44266257", "text": "func autoAnswer(qType dns.Type, qName string) (*dns.Msg, error) {\n\tvar ip net.IP\n\n\tswitch uint16(qType) {\n\tcase dns.TypeA:\n\t\tip = autoAnswerIPv4\n\tcase dns.TypeAAAA:\n\t\tip = autoAnswerIPv6\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"autoAnswer not implemented for qType=%s\", dns.TypeToString[uint16(qType)])\n\t}\n\n\treturn util.NewMsgWithAnswer(qName, 60, qType, ip.String())\n}", "title": "" }, { "docid": "b6ecf9be2db2814f311f5016b1c6e768", "score": "0.44158432", "text": "func SpawnClient(t *testing.T, id int, testCases []TestCase) {\n\n\t// Make the connection\n\ttcpAddr, err := net.ResolveTCPAddr(\"tcp\", \"localhost:9002\")\n\tconn, err := net.DialTCP(\"tcp\", nil, tcpAddr)\n\tif err != nil {\n\t\tlog.Print(\"Error in dialing: \", err)\n\t\treturn\n\t}\n\tdefer conn.Close()\n\t// Execute the testcases\n\tfor i:=0; i<len(testCases); i++ {\n\t\t// Now send data\n\t\tinput := testCases[i].input\n\t\texp_output := testCases[i].output\n\t\texpectReply := testCases[i].expectReply\n\n\t\tconn.Write([]byte(input))\n//\t\ttime.Sleep(750 * time.Millisecond)\n\t\tif !expectReply {\n\t\t\tcontinue\n\t\t}\n\t\treply := make([]byte, 1000)\n\t\tconn.Read(reply) \n\t\t//fmt.Println(\"Got reply \", string(reply))\t\n//\t\tlog.Print(\"[Client]:\",string(reply))\n\t\t\tif exp_output != \"\" { reply = reply[0:len(exp_output)] }\n\t\t\t// if expected output is \"\", then don't check\n\t\t\tif exp_output!=\"\" && string(reply) != exp_output {\n\t\t\t\tt.Error(fmt.Sprintf(\"Input: %q, Expected Output: %q, Actual Output: %q\", input, exp_output, string(reply)))\n\t\t\t}\n\t}\n\n\t// Notify that the process has ended\n\tend_ch <- id\n}", "title": "" }, { "docid": "e4932361500fd3b1cc79baa619d1a775", "score": "0.44105884", "text": "func (msg Msg) Answer(dat interface{}, err error) {\n\tif msg.Res != \"\" {\n\t\tPublish(&Msg{To: msg.Res, Dat: dat, Err: err})\n\t}\n}", "title": "" }, { "docid": "196be476a53eadcc2fb8d48772908567", "score": "0.4404389", "text": "func (str *stream) sendAck(hdr http.Header) {\n\tif str.isClosed() {\n\t\treturn\n\t}\n\tstr.session.of.reply(str, hdr)\n}", "title": "" }, { "docid": "374490e944912f62b6e514f435b9033e", "score": "0.44033632", "text": "func (s *Server) connsRequest(sub *subscription, c *client, _ *Account, subject, reply string, hdr, msg []byte) {\n\tif !s.eventsRunning() {\n\t\treturn\n\t}\n\ttk := strings.Split(subject, tsep)\n\tif len(tk) != accReqTokens {\n\t\ts.sys.client.Errorf(\"Bad subject account connections request message\")\n\t\treturn\n\t}\n\ta := tk[accReqAccIndex]\n\tm := accNumConnsReq{Account: a}\n\tif len(msg) > 0 {\n\t\tif err := json.Unmarshal(msg, &m); err != nil {\n\t\t\ts.sys.client.Errorf(\"Error unmarshalling account connections request message: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\tif m.Account != a {\n\t\ts.sys.client.Errorf(\"Error unmarshalled account does not match subject\")\n\t\treturn\n\t}\n\t// Here we really only want to lookup the account if its local. We do not want to fetch this\n\t// account if we have no interest in it.\n\tvar acc *Account\n\tif v, ok := s.accounts.Load(m.Account); ok {\n\t\tacc = v.(*Account)\n\t}\n\tif acc == nil {\n\t\treturn\n\t}\n\t// We know this is a local connection.\n\tif nlc := acc.NumLocalConnections(); nlc > 0 {\n\t\ts.mu.Lock()\n\t\ts.sendAccConnsUpdate(acc, reply)\n\t\ts.mu.Unlock()\n\t}\n}", "title": "" }, { "docid": "881b290248be61c40a6e9d175b25291f", "score": "0.4402496", "text": "func (oc *OpenConnection) SendContactRequest(channel int32, nick string, message string) {\n\tdefer utils.RecoverFromError()\n\n\tmessageBuilder := new(MessageBuilder)\n\tdata, err := messageBuilder.OpenContactRequestChannel(channel, nick, message)\n\tutils.CheckError(err)\n\n\toc.setChannel(channel, \"im.ricochet.contact.request\")\n\toc.rni.SendRicochetPacket(oc.conn, 0, data)\n}", "title": "" }, { "docid": "881b290248be61c40a6e9d175b25291f", "score": "0.4402496", "text": "func (oc *OpenConnection) SendContactRequest(channel int32, nick string, message string) {\n\tdefer utils.RecoverFromError()\n\n\tmessageBuilder := new(MessageBuilder)\n\tdata, err := messageBuilder.OpenContactRequestChannel(channel, nick, message)\n\tutils.CheckError(err)\n\n\toc.setChannel(channel, \"im.ricochet.contact.request\")\n\toc.rni.SendRicochetPacket(oc.conn, 0, data)\n}", "title": "" }, { "docid": "fdcf4fab1a97b482256b154fb06c0337", "score": "0.4398699", "text": "func (h *Handler) Handle(writer dns.ResponseWriter, msg *dns.Msg) {\n\n\tLog.Infoln(\"requesting\", msg.Question[0].Name, dns.TypeToString[msg.Question[0].Qtype])\n\n\tisAnsweredCh := make(chan bool)\n\tdefer close(isAnsweredCh)\n\n\tedns0SubnetIn := ObtainEDN0Subnet(msg)\n\tctx := &writerCtx{msg: msg, isCache: false, isAnsweredCh: isAnsweredCh,\n\t\tedns0SubnetIn: edns0SubnetIn, receivedTime: time.Now()}\n\tif h.options.Cache {\n\t\trmsg := h.cache.Get(msg)\n\t\tif rmsg != nil {\n\t\t\trmsg.Id = msg.Id\n\t\t\tctx.msg = rmsg\n\t\t\tctx.isCache = true\n\t\t\tgo h.TryWriteAnswer(&writer, ctx)\n\t\t\tif <-isAnsweredCh {\n\t\t\t\tLog.Infof(\"resolved from cache: %v, cost time: %v\",\n\t\t\t\t\tmsg.Question[0].Name, time.Now().Sub(ctx.receivedTime))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// lookup hosts file if retrieving ip address\n\tif msg.Question[0].Qtype == dns.TypeA || msg.Question[0].Qtype == dns.TypeAAAA {\n\t\tgo h.AnswerByHostsFile(&writer, ctx)\n\t\tif <-isAnsweredCh {\n\t\t\tLog.Infof(\"resolved from hosts: %v, cost time: %v\",\n\t\t\t\tmsg.Question[0].Name, time.Now().Sub(ctx.receivedTime))\n\t\t\treturn\n\t\t}\n\t}\n\n\tif isSerialMode && serialTaskNotify != nil {\n\t\tselect {\n\t\tcase <-serialTaskNotify:\n\t\t\tbreak\n\t\tcase <-time.After(queryExpireDuration):\n\t\t\tLog.Errorf(\"timeout for waiting serial task channel.\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tgo h.AnswerByDoH(&writer, ctx)\n\tif <-isAnsweredCh {\n\t\tLog.Infof(\"resolved from DoH: %v, cost time: %v\",\n\t\t\tmsg.Question[0].Name, time.Now().Sub(ctx.receivedTime))\n\t\treturn\n\t}\n\n\tif !isSerialMode {\n\t\th.initSerialMode()\n\t}\n}", "title": "" }, { "docid": "d51140be325c83d15465358ad7b2df23", "score": "0.43921185", "text": "func (p echoAnswerCommand) Cmd() byte { return teocli.CmdLEchoAnswer }", "title": "" }, { "docid": "aedb5ff406a9ed08d53181f9ec759b9b", "score": "0.43891776", "text": "func (c *Client) handleQuestion(q *dnsmessage.Question, src *net.UDPAddr, conn *net.UDPConn) {\n\t// Extract domain name, excluding the final \".\" character.\n\tname := q.Name.String()[:q.Name.Length-1]\n\tif !isEphemeralLocalDomain(name) {\n\t\treturn\n\t}\n\n\t// Strip \".local\" suffix to get the UUID part of the ephemeral domain.\n\tuuid := name[:len(name)-6]\n\n\t// Only respond if we have an authoritative record for this domain.\n\tc.Lock()\n\tr, found := c.cache[uuid]\n\tc.Unlock()\n\tif found && r.ours && q.Type == r.Type() && time.Now().Before(r.expires) {\n\t\tdst := src\n\t\tif (q.Class & classMask) == 0 {\n\t\t\t// High bit of QCLASS means a unicast response is requested.\n\t\t\tdst = conn.LocalAddr().(*net.UDPAddr)\n\t\t}\n\t\tlog.Debug(\"responding to %v with %v\", q, r.ip)\n\t\tif err := c.sendResponse(r, dst, conn); err != nil {\n\t\t\tlog.Warn(\"failed to send response: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b674a30d1904d592755d407bf41cae71", "score": "0.43837208", "text": "func dialTarget(ctx context.Context, cc chan net.Conn) {\n\tlog.Print(\">>> dialTarget \")\n\tdefer log.Print(\"dialTarget --->\")\n\n\taddr, _ := ctx.Value(ctxKeyAddr).(string)\n\tticker := time.NewTicker(5 * time.Second)\n\tdefer ticker.Stop()\n\n\t// Infinite loop until new connection is generated and sent\n\t// via channel. The loop can be cancelled by ctx.Done()\n\tfor func() bool {\n\t\tvar err error\n\t\tvar conn net.Conn\n\t\tif conn, err = net.Dial(\"tcp\", addr); err == nil {\n\t\t\t// send connection and stop loop\n\t\t\tlog.Printf(\"dial %s: ok\", addr)\n\t\t\tcc <- conn\n\t\t\treturn false\n\t\t}\n\t\t// continue to next iteration\n\t\t// log.Print(err)\n\t\treturn true\n\t}() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bda1712b2572f4f9d8e06f71418e4390", "score": "0.43784782", "text": "func answerIncomming(conn connection) bool {\n\tconst __DELAY_MS = 20\n\n\tzero := make([]byte, 1)\n\n\tr := registers\n\tfor i := 0; i < __MAX_RINGS; i++ {\n\t\tm.setLastRingTime()\n\t\tconn.Write([]byte(\"Ringing...\\n\\r\"))\n\t\tlogger.Print(\"Ringing\")\n\t\tif m.offHook() { // computer has issued 'ATA'\n\t\t\tgoto answered\n\t\t}\n\n\t\t// Simulate the \"2-4\" pattern for POTS ring signal (2\n\t\t// seconds of high voltage ring signal, 4 seconds\n\t\t// of silence)\n\n\t\t// Ring for 2s\n\t\td := 0\n\t\traiseRI()\n\t\tfor m.onHook() && d < 2000 {\n\t\t\tif _, err := conn.Write(zero); err != nil {\n\t\t\t\tgoto no_answer\n\t\t\t}\n\t\t\ttime.Sleep(__DELAY_MS * time.Millisecond)\n\t\t\td += __DELAY_MS\n\t\t\tif m.offHook() { // computer has issued 'ATA'\n\t\t\t\tgoto answered\n\t\t\t}\n\t\t}\n\t\tlowerRI()\n\n\t\t// By verification, the Hayes Ultra 96 displays the\n\t\t// \"RING\" text /after/ the RI signal is lowered. Do\n\t\t// this here so we behave the same.\n\t\tserial.Println(RING)\n\t\tlcd.Printf(1, \"RING %2d\", i)\n\t\tlcd.Printf(2, \"<%s\", conn.RemoteAddr())\n\n\n\t\t// If Auto Answer is enabled and we've exceeded the\n\t\t// configured number of rings to wait before\n\t\t// answering, answer the call. We do this here before\n\t\t// the 4s delay as I think it feels more correct.\n\t\tringCount := r.Inc(REG_RING_COUNT)\n\t\taaCount := r.Read(REG_AUTO_ANSWER)\n\t\tif aaCount > 0 {\n\t\t\tif ringCount >= aaCount {\n\t\t\t\tlogger.Print(\"Auto answering\")\n\t\t\t\tlcd.Printf(1, \"Auto-answering\")\n\t\t\t\tanswer()\n\t\t\t}\n\t\t}\n\n\t\t// Silence for 4s\n\t\td = 0\n\t\tfor m.onHook() && d < 4000 {\n\t\t\t// Test for closed connection\n\t\t\tif _, err := conn.Write(zero); err != nil {\n\t\t\t\tgoto no_answer\n\t\t\t}\n\n\t\t\ttime.Sleep(__DELAY_MS * time.Millisecond)\n\t\t\td += __DELAY_MS\n\t\t\tif m.offHook() { // computer has issued 'ATA'\n\t\t\t\tgoto answered\n\t\t\t}\n\t\t}\n\t}\n\nno_answer:\n\t// At this point we've not answered and have timed out, or the\n\t// caller hung up before we answered.\n\tlogger.Print(\"No answer\")\n\tconn.Write([]byte(\"No answer, closing connection\\n\\r\"))\n\tlowerRI()\n\tprstatus(NO_ANSWER)\n\treturn false\n\nanswered:\n\t// if we're here, the computer answered.\n\tlogger.Print(\"Answered\")\n\tconn.Write([]byte(\"Answered\\n\\r\"))\n\tregisters.Write(REG_RING_COUNT, 0)\n\tlowerRI()\n\treturn true\n}", "title": "" } ]
55ea8aacd0d5c2c7a51269922a46479f
listServices list all the registered services
[ { "docid": "66bf407177c1f847ddf4614b057db915", "score": "0.78202045", "text": "func (s *server) listServices(c *gin.Context) {\n\tservices := s.Store.GetAll()\n\tc.JSON(http.StatusOK, services)\n}", "title": "" } ]
[ { "docid": "28385341c6a3a27996da5ba41cae9cf6", "score": "0.8212397", "text": "func ListServices() []string {\n\treturn dm.ListServices()\n}", "title": "" }, { "docid": "81ad6c7994c7b3c4d46dbe9dbe0dabeb", "score": "0.7893083", "text": "func (c *Collector) ListServices() {\n\tserviceIndex := 1\n\tfor name, service := range c.ServiceCache {\n\t\tfmt.Printf(\"%d. %s\\n\", serviceIndex, name)\n\t\tmethods := service.GetMethods()\n\t\tfor i, method := range methods {\n\t\t\t// TODO: This is pretty ugly and will start printing weird characters.\n\t\t\tfmt.Printf(\"\\t%s. %s\\n\", string(toChar(i+1)), method.GetName())\n\t\t}\n\t\tserviceIndex++\n\t}\n}", "title": "" }, { "docid": "93d0c0ce5fc376b8eecd6c9a6fedb4c1", "score": "0.78897727", "text": "func (ss *ServicesService) List() (*ListServicesResponse, error) {\n\treq, err := ss.client.NewRequest(\"GET\", \"services\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tservicesResponse := &ListServicesResponse{}\n\n\t_, err = ss.client.Do(req, &servicesResponse)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn servicesResponse, nil\n}", "title": "" }, { "docid": "6319f18312c8accdd38b4bc04b79e9cb", "score": "0.7832582", "text": "func ListServices(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(services.services)\n}", "title": "" }, { "docid": "f2f75daec8146c1e5659bb665ae384da", "score": "0.7751989", "text": "func (r *Registry) ListServices(ctx api.Context) (*api.ServiceList, error) {\n\tlist := &api.ServiceList{}\n\terr := r.ExtractToList(makeServiceListKey(ctx), list)\n\treturn list, err\n}", "title": "" }, { "docid": "cccfb68dfc7885042e9a29c951b30770", "score": "0.77510524", "text": "func (rm* RpcMap) ListServices() []*ServiceDef {\n sl := make([]*ServiceDef, 0, 16)\n for _, s := range rm.services {\n sl = append(sl, s)\n }\n return sl\n}", "title": "" }, { "docid": "b26e0a2c8db4f1051154e8acc290d3eb", "score": "0.77353424", "text": "func (cs *Cellaserv) listServices(*cellaserv.Request) (interface{}, error) {\n\treturn cs.broker.GetServicesJSON(), nil\n}", "title": "" }, { "docid": "917afa4f744d375486754bf433f05569", "score": "0.7724035", "text": "func (ms *dbStorage) listServices() ([]atium.ServiceInfo, error) {\n\tvar services []atium.ServiceInfo\n\trows, err := ms.db.Query(\"SELECT S.name, S.description, S.price FROM service\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() { _ = rows.Close() }()\n\tfor rows.Next() {\n\t\ts := atium.ServiceInfo{}\n\t\terr = rows.Scan(&s.Name, &s.Description, &s.Price)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tservices = append(services, s)\n\t}\n\treturn services, nil\n}", "title": "" }, { "docid": "fb57e12d199e12d91947f673d989e02f", "score": "0.77093405", "text": "func (p *platform) ListServices() ([]*registry.Service, error) {\n\tp.RLock()\n\tif cache := p.cache; len(cache) > 0 {\n\t\tp.RUnlock()\n\t\tvar services []*registry.Service\n\t\tfor _, service := range cache {\n\t\t\tservices = append(services, service...)\n\t\t}\n\t\treturn services, nil\n\t}\n\tp.RUnlock()\n\n\t// disabled discovery?\n\tif !p.opts.Discovery {\n\t\treturn p.opts.Registry.ListServices()\n\t}\n\n\trsp, err := p.reg.ListServices(context.TODO(), &proto2.ListServicesRequest{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar services []*registry.Service\n\tfor _, service := range rsp.Services {\n\t\tservices = append(services, toService(service))\n\t}\n\treturn services, nil\n}", "title": "" }, { "docid": "732e1343810fca2a81294a4fb3f1f779", "score": "0.7647639", "text": "func List(c *drycc.Client, appID string) (api.Services, error) {\n\tu := fmt.Sprintf(\"/v2/apps/%s/services/\", appID)\n\tres, reqErr := c.Request(\"GET\", u, nil)\n\n\tif reqErr != nil && !drycc.IsErrAPIMismatch(reqErr) {\n\t\treturn []api.Service{}, reqErr\n\t}\n\n\tdefer res.Body.Close()\n\n\tbody, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn []api.Service{}, err\n\t}\n\n\tr := make(map[string]interface{})\n\tif err = json.Unmarshal([]byte(body), &r); err != nil {\n\t\treturn []api.Service{}, err\n\t}\n\n\tout, err := json.Marshal(r[\"services\"].([]interface{}))\n\tif err != nil {\n\t\treturn []api.Service{}, err\n\t}\n\n\tvar services []api.Service\n\tif err := json.Unmarshal([]byte(out), &services); err != nil {\n\t\treturn []api.Service{}, err\n\t}\n\n\treturn services, reqErr\n}", "title": "" }, { "docid": "78e49315d188514b1ed224726bdf52f7", "score": "0.7644936", "text": "func ListServices(client *grpcreflect.Client) ([]string, error) {\n\tservices, err := client.ListServices()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't list services: %v\", err)\n\t}\n\n\treturn services, nil\n}", "title": "" }, { "docid": "662497158a0d3eba2c58b693b952257d", "score": "0.763195", "text": "func listServices(c *gin.Context) {\n\tservices := DefaultStore.GetAll()\n\tc.JSON(http.StatusOK, services)\n}", "title": "" }, { "docid": "bf8e8f19591330d7266ecc5e9b814548", "score": "0.7620775", "text": "func (router *ServiceRouter) ListServices() []string {\n\tservices := make([]string, len(serviceMap))\n\n\ti := 0\n\tfor key := range serviceMap {\n\t\tservices[i] = key\n\t\ti++\n\t}\n\n\treturn services\n}", "title": "" }, { "docid": "598f582455fd258b343973ac9e186419", "score": "0.7576996", "text": "func ListAllServices() []string {\n\tregistry.RLock()\n\tdefer registry.RUnlock()\n\tservices := make([]string, 0, len(registry.serviceLocations))\n\tfor service := range registry.serviceLocations {\n\t\tservices = append(services, service)\n\t}\n\treturn services\n}", "title": "" }, { "docid": "fc6456736f944119bad5bbb9ba0cad8b", "score": "0.7571812", "text": "func (c *httpClient) ListServices(namespace, repoName string) ([]*api.Service, error) {\n\tout := []*api.Service{}\n\trawURL := fmt.Sprintf(pathServices, c.base, namespace, repoName)\n\terr := c.get(rawURL, &out)\n\treturn out, errio.Error(err)\n}", "title": "" }, { "docid": "7b118e98fdd415fde9aa0916c276be6d", "score": "0.75399184", "text": "func (s *Server) ListServices(ctx context.Context, q *notification.ServicesListRequest) (*notification.ServiceList, error) {\n\tapi, err := s.apiFactory.GetAPI()\n\tif err != nil {\n\t\tif apierr.IsNotFound(err) {\n\t\t\treturn &notification.ServiceList{}, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tservices := []*notification.Service{}\n\tfor svc := range api.GetConfig().Services {\n\t\tservices = append(services, &notification.Service{Name: pointer.String(svc)})\n\t}\n\treturn &notification.ServiceList{Items: services}, nil\n}", "title": "" }, { "docid": "860790f87cb0c3ea64eb5ecde556aef8", "score": "0.7517631", "text": "func (c *RESTServicesClient) List(ctx context.Context, req *ServiceQuery) (*ServicesResponse, error) {\n\tres := &ServicesResponse{}\n\t_, err := c.restClient().Get(\"services\").QueryStruct(req).Receive(res, nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not get service\")\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "568ff745ef797819ea511ece99670179", "score": "0.7504741", "text": "func (d *Dice) ListServices(options types.ServiceListOptions) ([]types.ServiceInfoOutput, error) {\n\tfilter := store.AllServicesFilter\n\n\tif !options.All {\n\t\tfilter = func(service *entity.Service) bool {\n\t\t\treturn service.IsEnabled\n\t\t}\n\t}\n\n\tservices, err := d.kvStore.FindServices(filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserviceList := make([]types.ServiceInfoOutput, len(services))\n\n\tfor i, s := range services {\n\t\tinfo := types.ServiceInfoOutput{\n\t\t\tID: s.ID,\n\t\t\tName: s.Name,\n\t\t\tURLs: s.URLs,\n\t\t\tTargetVersion: s.TargetVersion,\n\t\t\tBalancingMethod: s.BalancingMethod,\n\t\t\tIsEnabled: s.IsEnabled,\n\t\t}\n\t\tserviceList[i] = info\n\t}\n\n\treturn serviceList, nil\n}", "title": "" }, { "docid": "fded930bf00853e5b9f80ae991b953f1", "score": "0.74647254", "text": "func (c *Cache) ListServices() ([]string, error) {\n\tc.mutex.RLock()\n\tdefer c.mutex.RUnlock()\n\n\tservices := make([]string, 0, len(c.cache))\n\tfor service := range c.cache {\n\t\tservices = append(services, service)\n\t}\n\n\treturn services, nil\n}", "title": "" }, { "docid": "fe7520cf22bc246228eb059ca131d9b8", "score": "0.74191195", "text": "func (s *serverReflectionServer) listServices() []*v1reflectionpb.ServiceResponse {\n\tserviceInfo := s.s.GetServiceInfo()\n\tresp := make([]*v1reflectionpb.ServiceResponse, 0, len(serviceInfo))\n\tfor svc := range serviceInfo {\n\t\tresp = append(resp, &v1reflectionpb.ServiceResponse{Name: svc})\n\t}\n\tsort.Slice(resp, func(i, j int) bool {\n\t\treturn resp[i].Name < resp[j].Name\n\t})\n\treturn resp\n}", "title": "" }, { "docid": "a5d2317d8f6764dc3cd3b963054d38d6", "score": "0.7415697", "text": "func (r *PathFinderReconciler) ListServices(namespace string) *corev1.ServiceList {\n\n\tservices := corev1.ServiceList{}\n\tr.Client.List(context.TODO(), &services, client.InNamespace(namespace))\n\treturn &services\n}", "title": "" }, { "docid": "2cdb1d63f2de5a611a125616984d6d49", "score": "0.7347417", "text": "func (s *DtaService) ListServices(ctx context.Context, req *pb.ListServiceRequest) (*pb.ListServicesResponse, error) {\n\tlog.WithFields(log.Fields{\"Service\": s.ApplicationName(), \"Status\": \"ListServices\"}).Tracef(\"Service requested\")\n\tlog.WithFields(log.Fields{\"Service\": s.ApplicationName(), \"Status\": \"ListServices\"}).Infof(\"In know only myself: %s\", s.ApplicationName())\n\tservices := (&pb.ListServicesResponse{}).Services\n\tservices = append(services, s.ApplicationName())\n\treturn &pb.ListServicesResponse{Services: services}, nil\n\n}", "title": "" }, { "docid": "2cdb1d63f2de5a611a125616984d6d49", "score": "0.7347417", "text": "func (s *DtaService) ListServices(ctx context.Context, req *pb.ListServiceRequest) (*pb.ListServicesResponse, error) {\n\tlog.WithFields(log.Fields{\"Service\": s.ApplicationName(), \"Status\": \"ListServices\"}).Tracef(\"Service requested\")\n\tlog.WithFields(log.Fields{\"Service\": s.ApplicationName(), \"Status\": \"ListServices\"}).Infof(\"In know only myself: %s\", s.ApplicationName())\n\tservices := (&pb.ListServicesResponse{}).Services\n\tservices = append(services, s.ApplicationName())\n\treturn &pb.ListServicesResponse{Services: services}, nil\n\n}", "title": "" }, { "docid": "d2d8bf00629456060921df65475eac70", "score": "0.7347377", "text": "func (sr *ServerReflect) ListServices() ([]string, error) {\n\tsds, err := gr.LoadServiceDescriptors(sr.svr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar svcs []string\n\tfor _, sd := range sds {\n\t\tsvcs = append(svcs, sd.GetName())\n\t}\n\n\treturn svcs, nil\n}", "title": "" }, { "docid": "71f139a486ca16da77b206af67698f88", "score": "0.7318859", "text": "func (kubeutil *Kube) ListServices(namespace string) ([]*corev1.Service, error) {\n\treturn kubeutil.ListServicesWithSelector(namespace, \"\")\n}", "title": "" }, { "docid": "becd59919c255e77a8ebebd1e4fca084", "score": "0.73017097", "text": "func (g *GrpcGet) ListServices(ctx context.Context) error {\n\tif g.opts.outputServiceList == nil {\n\t\treturn errors.New(\"Must configure OutputServiceList to run this method\")\n\t}\n\n\trefClient, conn, err := g.checkRefClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer refClient.Reset()\n\tdefer conn.Close()\n\n\tservices, err := refClient.ListServices()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.opts.outputServiceList.OutputServiceList(services)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ba8fdb06e6f809b3c44e668592bb3023", "score": "0.72522897", "text": "func (client *Client) ListServices(project, service string) ([]Service, error) {\n\tvar (\n\t\tservices []Service\n\t\tpath = fmt.Sprintf(\"/projects/%s/services/%s\", project, service)\n\t)\n\tif err := client.request(http.MethodGet, path, &services, nil); err != nil {\n\t\treturn nil, err\n\t}\n\treturn services, nil\n}", "title": "" }, { "docid": "49768bc6ae9c1341f633235593ce0235", "score": "0.7175061", "text": "func (c *EpinioClient) ServiceListAll() error {\n\tlog := c.Log.WithName(\"ServiceListAll\")\n\tlog.Info(\"start\")\n\tdefer log.Info(\"return\")\n\n\tc.ui.Note().Msg(\"Listing all Services...\")\n\n\tservices, err := c.API.AllServices()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"service list failed\")\n\t}\n\n\tif len(services) == 0 {\n\t\tc.ui.Normal().Msg(\"No services found\")\n\t\treturn nil\n\t}\n\n\tsort.Sort(services)\n\n\tmsg := c.ui.Success().WithTable(\"Namespace\", \"Name\", \"Created\", \"Catalog Service\", \"Version\", \"Status\", \"Application\")\n\tfor _, service := range services {\n\t\tmsg = msg.WithTableRow(\n\t\t\tservice.Meta.Namespace,\n\t\t\tservice.Meta.Name,\n\t\t\tservice.Meta.CreatedAt.String(),\n\t\t\tservice.CatalogService,\n\t\t\tservice.CatalogServiceVersion,\n\t\t\tservice.Status.String(),\n\t\t\tstrings.Join(service.BoundApps, \", \"),\n\t\t)\n\t}\n\tmsg.Msg(\"Details:\")\n\n\treturn nil\n}", "title": "" }, { "docid": "dc26698b5967b3de4595a7670e885982", "score": "0.7166136", "text": "func (c *EpinioClient) ServiceList() error {\n\tlog := c.Log.WithName(\"ServiceList\")\n\tlog.Info(\"start\")\n\tdefer log.Info(\"return\")\n\n\tc.ui.Note().\n\t\tWithStringValue(\"Namespace\", c.Settings.Namespace).\n\t\tMsg(\"Listing Services...\")\n\n\tservices, err := c.API.ServiceList(c.Settings.Namespace)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"service list failed\")\n\t}\n\n\tif len(services) == 0 {\n\t\tc.ui.Normal().Msg(\"No services found\")\n\t\treturn nil\n\t}\n\n\tsort.Sort(services)\n\n\tmsg := c.ui.Success().WithTable(\"Name\", \"Created\", \"Catalog Service\", \"Version\", \"Status\", \"Applications\")\n\tfor _, service := range services {\n\t\tmsg = msg.WithTableRow(\n\t\t\tservice.Meta.Name,\n\t\t\tservice.Meta.CreatedAt.String(),\n\t\t\tservice.CatalogService,\n\t\t\tservice.CatalogServiceVersion,\n\t\t\tservice.Status.String(),\n\t\t\tstrings.Join(service.BoundApps, \", \"),\n\t\t)\n\t}\n\tmsg.Msg(\"Details:\")\n\n\treturn nil\n}", "title": "" }, { "docid": "0b89faa02a7247bf38412ac6268bae0f", "score": "0.7155094", "text": "func (s *ServicesService) List(ctx context.Context, clientID int) ([]*Service, *http.Response, error) {\n\turl := fmt.Sprintf(serviceListURL, clientID)\n\n\treq, err := s.client.NewRequest(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tservices := make([]*Service, 0)\n\n\tresp, err := s.client.Do(req, &services)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn services, resp, nil\n}", "title": "" }, { "docid": "bb401e52943e9d02c41849aa1d7881ea", "score": "0.7153819", "text": "func (ctx *Context) ServiceList() map[string]rpctypes.Web3Service {\n\treturn ctx.services\n}", "title": "" }, { "docid": "49712fa5d970e3a0bc9daf0992fa2ddf", "score": "0.7116021", "text": "func (rm *ResourceManager) ListServices() ([]*v1.Service, error) {\n\treturn rm.serviceLister.List(labels.Everything())\n}", "title": "" }, { "docid": "8fd82202d24ef9c55560d91ee1073b42", "score": "0.7095187", "text": "func (a *SystemApiService) ListServices(ctx context.Context) ApiListServicesRequest {\n\treturn ApiListServicesRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "36b359c827578115daef910188878713", "score": "0.70882887", "text": "func (c *ServiceServer) ListServices(ctx context.Context, req *api.ListServicesRequest) (*api.ListServicesResponse, error) {\n\tclient := getClient(ctx)\n\tallowed, err := auth.IsAuthorized(client, \"\", \"list\", \"\", \"onepanel-service\", \"\")\n\tif err != nil || !allowed {\n\t\treturn nil, err\n\t}\n\n\tservices, err := client.ListServices(req.Namespace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tapiServices := make([]*api.Service, len(services))\n\tfor i, service := range services {\n\t\tapiServices[i] = apiService(service)\n\t}\n\n\treturn &api.ListServicesResponse{\n\t\tCount: int32(len(services)),\n\t\tServices: apiServices,\n\t\tPage: 1,\n\t\tPages: 1,\n\t\tTotalCount: int32(len(services)),\n\t}, nil\n}", "title": "" }, { "docid": "3b665dc6a0c640830e64f9686c26ef06", "score": "0.70711344", "text": "func getServices( kubeContext , namespace string, kubeConfig *string) ([]Service, error){\n\n\n\tif kubeConfig == nil{\n\t\treturn nil, errors.New(\"kube config is nil\")\n\t}\n\n\n\n\t// use the current context in kubeconfig\n\tkConfig, err := buildConfigFromFlags(kubeContext, *kubeConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// create the clientset\n\tclientset, err := kubernetes.NewForConfig(kConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\n\n\tsvc, err := clientset.CoreV1().Services(namespace).List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar svcs []Service\n\tfor _, s := range svc.Items{\n\t\tnsvc := Service{Name: s.Name, Port: \"0\"}\n\n\t\tif len(s.Spec.Ports) > 0{\n\t\t\t\tnsvc.Port = fmt.Sprint(s.Spec.Ports[0].Port)\n\t\t}\n\n\n\n\t\tsvcs=append(svcs, nsvc)\n\t}\n\n\treturn svcs, nil\n\n\n}", "title": "" }, { "docid": "1bf6ebbc54e751eca395c79951b424e6", "score": "0.7051903", "text": "func (d *Daemon) ListServices(t testing.TB) []swarm.Service {\n\tt.Helper()\n\tcli := d.NewClientT(t)\n\tdefer cli.Close()\n\n\tservices, err := cli.ServiceList(context.Background(), types.ServiceListOptions{})\n\tassert.NilError(t, err)\n\treturn services\n}", "title": "" }, { "docid": "74d6c4d8c66636710d5b5b07a43fa7c2", "score": "0.7013563", "text": "func (cr *ClientReflect) ListServices() ([]string, error) {\n\trf := gr.NewClient(context.Background(), grpc_reflection_v1alpha.NewServerReflectionClient(cr.Conn))\n\tsvcs, err := rf.ListServices()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn svcs, nil\n}", "title": "" }, { "docid": "c07c4f1a5994203bbb3a717235411742", "score": "0.7013297", "text": "func GetServices(c *gin.Context) {\n\toffset := query.ParseInt(c.Query(\"offset\"), 0, math.MaxInt32, 0)\n\tlimit := query.ParseInt(c.Query(\"limit\"), 1, config.TopLimit, config.DefaultLimit)\n\n\tdata := query.AutoQuery(\n\t\tdatabase.DB.ServicesData,\n\t\tc.Request.URL.Query(),\n\t\tlimit,\n\t\toffset,\n\t)\n\n\tres, _ := json.Marshal(data)\n\tvar services []database.Service\n\tjson.Unmarshal(res, &services)\n\tif len(services) == 0 {\n\t\tresponse.SendEmptySuccess(c)\n\t} else {\n\t\tresponse.SendSuccess(c, services)\n\t}\n}", "title": "" }, { "docid": "d70aab1751684458d48ec98a0eb9954d", "score": "0.6969062", "text": "func (s *Service) List(namespace string) (map[string]*types.Service, error) {\n\n\tlog.V(logLevel).Debugf(\"%s:list:> by namespace %s\", logServicePrefix, namespace)\n\n\titems, err := s.storage.Service().ListByNamespace(s.context, namespace)\n\tif err != nil {\n\t\tlog.V(logLevel).Error(\"%s:list:> by namespace %s err: %s\", logServicePrefix, namespace, err)\n\t\treturn nil, err\n\t}\n\n\tlog.V(logLevel).Debugf(\"%s:list:> by namespace %s result: %d\", logServicePrefix, namespace, len(items))\n\n\treturn items, nil\n}", "title": "" }, { "docid": "e16fe550f5c22f14a717ecddf7493561", "score": "0.69463384", "text": "func (c *pydioregistry) ListRunningServices() ([]Service, error) {\n\n\trunningOnce.Do(func() {\n\t\tc.maintainRunningServicesList()\n\t})\n\n\tvar services []Service\n\n\tfor _, p := range GetPeers() {\n\t\tfor _, rs := range p.GetServices() {\n\t\t\tif s, ok := c.register[rs.Name]; ok {\n\t\t\t\tservices = append(services, s)\n\t\t\t} else {\n\t\t\t\tmock := &mockService{name: rs.Name, running: true}\n\t\t\t\tif strings.HasPrefix(rs.Name, common.SERVICE_GRPC_NAMESPACE_+common.SERVICE_DATA_) {\n\t\t\t\t\tmock.tags = []string{common.SERVICE_TAG_DATASOURCE}\n\t\t\t\t}\n\t\t\t\tservices = append(services, mock)\n\t\t\t}\n\t\t}\n\t}\n\n\t// De-dup\n\tresult := services[:0]\n\tencountered := map[string]bool{}\n\tfor _, s := range services {\n\t\tname := s.Name()\n\t\tif encountered[name] == true {\n\t\t\t// Do not add duplicate.\n\t\t} else {\n\t\t\tencountered[name] = true\n\t\t\tresult = append(result, s)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "f919ddbc36a292b9599abf0e8505b2b7", "score": "0.69328344", "text": "func Services(name string, timeout time.Duration) ([]*Service, error) {\n\tif err := ensureDefaultConnected(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn DefaultClient.Services(name, timeout)\n}", "title": "" }, { "docid": "5ad0248ad4f88abba7182fa425cd1432", "score": "0.6929196", "text": "func (m *Print) GetServices()([]PrintServiceable) {\n return m.services\n}", "title": "" }, { "docid": "808ab214aaf83515145e534ff0971c1c", "score": "0.6902616", "text": "func (c *client) GetServiceList() ([]*library.Service, error) {\n\tlogrus.Trace(\"Listing Services from the database\")\n\n\t// variable to store query results\n\ts := new([]database.Service)\n\n\t// send query to the database and store result in variable\n\terr := c.Database.\n\t\tTable(constants.TableService).\n\t\tRaw(c.DML.ServiceService.List[\"all\"]).\n\t\tScan(s).Error\n\n\t// variable we want to return\n\tservices := []*library.Service{}\n\t// iterate through all query results\n\tfor _, service := range *s {\n\t\t// https://golang.org/doc/faq#closures_and_goroutines\n\t\ttmp := service\n\n\t\t// convert query result to library type\n\t\tservices = append(services, tmp.ToLibrary())\n\t}\n\n\treturn services, err\n}", "title": "" }, { "docid": "147e5e44dda15fde723063db6bce9b73", "score": "0.6900425", "text": "func (s *Handler) ListServ(nsName string) (servList []*sr.Service, err error) {\n\t// -- Init\n\tif err := s.checkNames(&nsName, nil, nil); err != nil {\n\t\treturn nil, err\n\t}\n\tl := s.Log.WithName(\"ListServ\").WithValues(\"ns-name\", nsName)\n\tctx, canc := context.WithTimeout(s.Context, time.Minute)\n\tdefer canc()\n\n\treq := &sdpb.ListServicesRequest{\n\t\tParent: s.getResourcePath(servDirPath{namespace: nsName}),\n\t}\n\n\titer := s.Client.ListServices(ctx, req)\n\tif iter == nil {\n\t\tl.V(0).Info(\"returned list is nil\")\n\t\treturn\n\t}\n\tfor {\n\t\tnextServ, iterErr := iter.Next()\n\t\tif iterErr != nil {\n\n\t\t\tif iterErr == context.DeadlineExceeded {\n\t\t\t\tl.Error(err, \"timeout expired while waiting for service directory to reply\", \"timeout-seconds\", defTimeout.Seconds())\n\t\t\t\treturn nil, sr.ErrTimeOutExpired\n\t\t\t}\n\n\t\t\tif iterErr != iterator.Done {\n\t\t\t\tl.Error(iterErr, \"error while loading services\")\n\t\t\t\treturn nil, iterErr\n\t\t\t}\n\n\t\t\tbreak\n\t\t}\n\n\t\t// Create the list\n\t\tsplitName := strings.Split(nextServ.Name, \"/\")\n\t\tserv := &sr.Service{\n\t\t\tName: splitName[len(splitName)-1],\n\t\t\tNsName: nsName,\n\t\t\tMetadata: nextServ.Annotations,\n\t\t}\n\t\tif serv.Metadata == nil {\n\t\t\tserv.Metadata = map[string]string{}\n\t\t}\n\n\t\tservList = append(servList, serv)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "4145f393edf5ac9aa8bd4da0d863f91e", "score": "0.6900102", "text": "func (s *PcnServiceController) List(queryServ, queryNs *pcn_types.ObjectQuery) ([]core_v1.Service, error) {\n\t// The namespaces the services must be found on\n\t// If this stays empty it means that I don't care about the namespace they are in\n\tns := map[string]bool{}\n\n\t//------------------------------------------------\n\t// Preliminary checks\n\t//------------------------------------------------\n\t// -- The namespace\n\tnsList, err := Namespaces().List(queryNs)\n\tif err != nil {\n\t\treturn []core_v1.Service{}, err\n\t}\n\tif len(nsList) == 0 {\n\t\t// If no namespace is found, it is useless to go on searching for services\n\t\treturn []core_v1.Service{}, nil\n\t}\n\tfor _, n := range nsList {\n\t\tns[n.Name] = true\n\t}\n\n\t// BRIEF: from now on, this function has been split in mini-functions\n\t// inside it for sack of clarity.\n\t// Jump at the bottom of it to understand it better.\n\n\t//-------------------------------------\n\t// Find by name\n\t//-------------------------------------\n\n\tbyName := func(name string) ([]core_v1.Service, error) {\n\t\tlist := []core_v1.Service{}\n\n\t\t// Do I care or not about the namespace?\n\t\t// If not, I'll put the NamespaceAll inside the map as its only value\n\t\tif len(ns) == 0 {\n\t\t\tns[meta_v1.NamespaceAll] = true\n\t\t}\n\n\t\t// Loop through all interested namespaces\n\t\tfor namespace := range ns {\n\t\t\tlistOptions := meta_v1.ListOptions{}\n\n\t\t\t//\tName provided?\n\t\t\tif len(name) != 0 {\n\t\t\t\tlistOptions.FieldSelector = \"metadata.name=\" + name\n\t\t\t}\n\n\t\t\t// Get 'em\n\t\t\tlister, err := clientset.CoreV1().Services(namespace).List(listOptions)\n\t\t\tif err == nil {\n\t\t\t\tlist = append(list, lister.Items...)\n\t\t\t} else {\n\t\t\t\t//return []core_v1.Service, err\n\t\t\t\t// Just skip this namespace.\n\t\t\t}\n\t\t}\n\t\treturn list, nil\n\t}\n\n\t//-------------------------------------\n\t// Find by labels\n\t//-------------------------------------\n\n\tbyLabels := func(labels map[string]string) ([]core_v1.Service, error) {\n\t\tif labels == nil {\n\t\t\treturn []core_v1.Service{}, errors.New(\"Service labels is nil\")\n\t\t}\n\t\tif len(labels) == 0 {\n\t\t\t// If you need to get all Services, put the query as nil\n\t\t\treturn []core_v1.Service{}, errors.New(\"No service labels provided\")\n\t\t}\n\t\tlist := []core_v1.Service{}\n\n\t\t// -- If you want to get the service spec.selector...\n\t\t// We have to go through all of them :(\n\t\tfor namespace := range ns {\n\t\t\t// Get 'em\n\t\t\tlister, err := clientset.CoreV1().Services(namespace).List(meta_v1.ListOptions{})\n\t\t\tif err == nil {\n\t\t\t\tfor _, currentServ := range lister.Items {\n\t\t\t\t\tif len(currentServ.Spec.Selector) > 0 && utils.AreLabelsContained(currentServ.Spec.Selector, labels) {\n\t\t\t\t\t\tlist = append(list, currentServ)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//return []core_v1.Service, err\n\t\t\t\t// Just skip this namespace.\n\t\t\t}\n\t\t}\n\n\t\treturn list, nil\n\t}\n\n\t//-------------------------------------\n\t// Find 'em\n\t//-------------------------------------\n\n\tif queryServ == nil {\n\t\treturn byName(\"\")\n\t}\n\n\tswitch strings.ToLower(queryServ.By) {\n\tcase \"name\":\n\t\treturn byName(queryServ.Name)\n\tcase \"labels\":\n\t\treturn byLabels(queryServ.Labels)\n\tdefault:\n\t\treturn []core_v1.Service{}, errors.New(\"Unrecognized service query\")\n\t}\n}", "title": "" }, { "docid": "0861b1428584dd08dcc2b3b55a41c9f7", "score": "0.6876459", "text": "func (d *Docker) ServiceList(ctx context.Context, name, mode string, pageIndex, pageSize int) (services []swarm.Service, totalCount int, err error) {\n\terr = d.call(func(c *client.Client) (err error) {\n\t\targs := filters.NewArgs()\n\t\tif name != \"\" {\n\t\t\targs.Add(\"name\", name)\n\t\t}\n\t\tif mode != \"\" {\n\t\t\targs.Add(\"mode\", mode)\n\t\t}\n\t\tservices, err = c.ServiceList(ctx, types.ServiceListOptions{Status: true, Filters: args})\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tsort.Slice(services, func(i, j int) bool {\n\t\t\treturn services[i].Spec.Name < services[j].Spec.Name\n\t\t})\n\t\ttotalCount = len(services)\n\t\tstart, end := misc.Page(totalCount, pageIndex, pageSize)\n\t\tservices = services[start:end]\n\n\t\tif versions.LessThan(c.ClientVersion(), \"1.41\") {\n\t\t\terr = d.fillStatus(ctx, c, services)\n\t\t}\n\t\treturn\n\t})\n\treturn\n}", "title": "" }, { "docid": "bbcb091dfb09be874a044aa5466423e5", "score": "0.68670845", "text": "func GetServices() {\n\turl := \"http://127.0.0.1:8500/v1/agent/services\"\n\tresp, e := http.Get(url)\n\tif e != nil {\n\t\tpanic(e.Error())\n\t}\n\tif resp != nil && resp.Body != nil {\n\t\tdefer resp.Body.Close()\n\t\tbuf, e := ioutil.ReadAll(resp.Body)\n\t\tif e != nil {\n\t\t\tpanic(e.Error())\n\t\t}\n\t\tvar buff = bytes.NewBuffer(nil)\n\t\tjson.Indent(buff, buf, \" \", \" \")\n\t\tfmt.Println(string(buff.String()))\n\t\treturn\n\t}\n\tfmt.Println(\"nothing returned\")\n}", "title": "" }, { "docid": "71d001e153ea8cef65e41f3c320df9c3", "score": "0.6856502", "text": "func (v ServicesResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.WithStack(errors.New(\"no transaction found\"))\n\t}\n\n\tservices := &models.Services{}\n\n\t// Paginate results. Params \"page\" and \"per_page\" control pagination.\n\t// Default values are \"page=1\" and \"per_page=20\".\n\tq := tx.PaginateFromParams(c.Params())\n\n\t// Retrieve all Services from the DB\n\tif err := q.All(services); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// Add the paginator to the context so it can be used in the template.\n\tc.Set(\"pagination\", q.Paginator)\n\n\tbreadcrumbs := []models.Breadcrumb{}\n\tbreadcrumbs = append(breadcrumbs, models.Breadcrumb{\"/\", \"Home\"})\n\tbreadcrumbs = append(breadcrumbs, models.Breadcrumb{\"/services\", \"Services\"})\n\tc.Set(\"breadcrumbs\", breadcrumbs)\n\n\treturn c.Render(200, r.Auto(c, services))\n}", "title": "" }, { "docid": "a9dbf4d714b1b67cbe8cf3a82a4b85d1", "score": "0.6843574", "text": "func (c *DockerContainer) ListServices(labels ...string) ([]swarm.Service, error) {\n\targs := make([]filters.KeyValuePair, len(labels))\n\tfor i, label := range labels {\n\t\targs[i] = filters.KeyValuePair{\n\t\t\tKey: \"label\",\n\t\t\tValue: label,\n\t\t}\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), c.callTimeout)\n\tdefer cancel()\n\treturn c.client.ServiceList(ctx, types.ServiceListOptions{\n\t\tFilters: filters.NewArgs(args...),\n\t})\n}", "title": "" }, { "docid": "648358d2fe86ff07495bb92cb7abbf1d", "score": "0.68376577", "text": "func (i *Handle) GetServices() ([]*Service, error) {\n\treturn i.doGetServicesCmd(nil)\n}", "title": "" }, { "docid": "909d68f3e387aa75db9366786994bbc5", "score": "0.68227595", "text": "func (c *consoleServices) List(opts v1.ListOptions) (result *v1beta1.ConsoleServiceList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v1beta1.ConsoleServiceList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"consoleservices\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "2594d1c13af670e6898170e7446d68d8", "score": "0.6820398", "text": "func ListServices(ctx context.Context) ([]string, error) {\n\tecsClient := ecs.NewFromConfig(awsConfig)\n\n\t// This is paginated but if we ever have that many clusters that\n\t// it's an issue then we have a bigger problem\n\tlistClustersOutput, err := ecsClient.ListClusters(ctx, &ecs.ListClustersInput{\n\t\tMaxResults: aws.Int32(100),\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to list available ECS Clusters\")\n\t}\n\n\tvar serviceNames []string\n\tfor _, clusterARN := range listClustersOutput.ClusterArns {\n\t\tlistServicesOutput, err := ecsClient.ListServices(ctx, &ecs.ListServicesInput{\n\t\t\tCluster: aws.String(clusterARN),\n\t\t\tMaxResults: aws.Int32(100),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to list services in cluster %s\", clusterARN)\n\t\t}\n\n\t\tfor _, arn := range listServicesOutput.ServiceArns {\n\t\t\t// TODO(@cszatmary): Use a regex to parse the ARN\n\t\t\tparts := strings.Split(arn, \"/\")\n\t\t\tserviceNames = append(serviceNames, parts[len(parts)-1])\n\t\t}\n\t}\n\n\treturn serviceNames, nil\n}", "title": "" }, { "docid": "4e64c8ff69216c430112a3eb5da3bcbe", "score": "0.6795432", "text": "func (c *registry) GetServices(token string, url string) ([]string, error) {\n\tregisteredServ := struct {\n\t\tServices []string `json:\"services\"`\n\t}{}\n\n\theader := http.Header{}\n\theader.Set(\"Authorization\", \"Bearer \"+token)\n\theader.Set(\"X-Forwarded-Proto\", \"https\")\n\n\terr := c.doRequest(\"GET\", url, \"/api/v1/services\", http.StatusOK, nil, &registeredServ, header)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn registeredServ.Services, nil\n}", "title": "" }, { "docid": "3795be939a85288b679d8f884de6f581", "score": "0.67518044", "text": "func (c *ControllerContext) GetAllServices() ([]*apiv1.Service, error) {\n\treturn c.ListerGroup.ServiceLister.List(labels.Everything())\n}", "title": "" }, { "docid": "ca656de5746576a85015448a084e4b6b", "score": "0.6744113", "text": "func GetRegisteredServices() map[string]*Service {\n\treturn registeredServices\n}", "title": "" }, { "docid": "89a462d61e5286f754270f02bd64768f", "score": "0.67432964", "text": "func (c PGClient) GetAllServices() (*[]subset.AllService, error) {\n\tvar rows *sql.Rows\n\trows, err := db.Query(\"select id,name,host,uri,type from tServices\")\n\tres := make([]subset.AllService, 0, 200)\n\tfor rows.Next() {\n\t\tt := subset.AllService{}\n\t\tif err = rows.Scan(&t.ID, &t.Name, &t.Host, &t.Port, &t.Type); err != nil {\n\t\t\treturn &res, err\n\t\t}\n\t\trowsProjects, err := db.Query(\"select name from tProjects where id in(select project_id from tServiceProjects where service_id=$1)\", t.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor rowsProjects.Next() {\n\t\t\tvar tempProject string\n\t\t\terr := rowsProjects.Scan(&tempProject)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tt.Projects = append(t.Projects, tempProject)\n\t\t}\n\t\tres = append(res, t)\n\t}\n\treturn &res, err\n}", "title": "" }, { "docid": "6bcbb7e093913298b786e39a7b9a0369", "score": "0.67265403", "text": "func (s *Server) GetServiceList(r GetRequest) (GetResponse, error) {\n\tif s.WaitTime <= 0 {\n\t\ts.WaitTime = 3\n\t}\n\twt := r.WaitTime\n\tif wt <= 0 {\n\t\twt = s.WaitTime\n\t}\n\n\tif r.ServiceType == \"\" {\n\t\tr.ServiceType = s.Config.DefaultServiceType\n\t}\n\tif r.Domain == \"\" {\n\t\tr.Domain = \"local\"\n\t}\n\n\tresp := r.CreateResponse()\n\tresolver, err := zeroconf.NewResolver(nil)\n\tif err != nil {\n\t\ts.logError(\"Failed to initialize zeroconf resolver.\", err.Error())\n\t\treturn resp, err\n\t}\n\tentries := make(chan *zeroconf.ServiceEntry)\n\tgo func(results <-chan *zeroconf.ServiceEntry) {\n\t\tfor entry := range results {\n\t\t\tresp.Services = append(resp.Services, NewServiceItemFromZeroConf(entry))\n\t\t}\n\t}(entries)\n\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*time.Duration(wt))\n\tdefer cancel()\n\terr = resolver.Browse(ctx, r.ServiceType, r.Domain, entries)\n\tif err != nil {\n\t\ts.logError(fmt.Sprintf(\"Failed to browse for services with ServiceType '%s' on Domain '%s'.\", r.ServiceType, r.Domain), err.Error())\n\t\treturn resp, err\n\t}\n\n\t<-ctx.Done()\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "3cc3fdb2c3cd086005522a5e011c600c", "score": "0.6700115", "text": "func GetAllFrpServices(c *gin.Context) {\n\tresult := service.GetAllFrpServiceConfsTypeAndName()\n\tc.JSON(http.StatusOK, gin.H{\"result\": result})\n}", "title": "" }, { "docid": "b8eb60384cb15c4c063e973c04e00cf9", "score": "0.66369075", "text": "func (c *Client) ListService(pageNo, pageSize int, keywordType, keyword, order, orderBy, status string) (*api.ListServiceResult, error) {\n\n\tparams := make(map[string]string)\n\tif pageNo != 0 {\n\t\tparams[\"pageNo\"] = strconv.Itoa(pageNo)\n\t}\n\tif pageSize != 0 {\n\t\tparams[\"pageSize\"] = strconv.Itoa(pageSize)\n\t}\n\tif keyword != \"\" {\n\t\tparams[\"keyword\"] = keyword\n\t}\n\tif keywordType != \"\" {\n\t\tparams[\"keywordType\"] = keywordType\n\t}\n\tif status != \"\" {\n\t\tparams[\"status\"] = status\n\t}\n\tif order != \"\" {\n\t\tparams[\"order\"] = order\n\t}\n\tif orderBy != \"\" {\n\t\tparams[\"orderBy\"] = orderBy\n\t}\n\n\tresult := &api.ListServiceResult{}\n\terr := bce.NewRequestBuilder(c).\n\t\tWithMethod(http.GET).\n\t\tWithURL(api.GetServiceURI()).\n\t\tWithQueryParams(params).\n\t\tWithResult(result).\n\t\tDo()\n\n\treturn result, err\n}", "title": "" }, { "docid": "a57057676581c16f88e184bfd9df3ffe", "score": "0.66274846", "text": "func (n *networkServicesStore) List() []*netmesh.NetworkService {\n\tn.Lock()\n\tdefer n.Unlock()\n\tnetworkServices := make([]*netmesh.NetworkService, 0)\n\tfor _, ns := range n.networkService {\n\t\tnetworkServices = append(networkServices, ns)\n\t}\n\treturn networkServices\n}", "title": "" }, { "docid": "6b523f560842a38677fa0ec96acc87b4", "score": "0.6621197", "text": "func (w *Watcher) Services(stopCh <-chan struct{}) (lister v1.ServiceLister, err error) {\n\tfactory := informerFactory(w)\n\tserviceformer := factory.Core().V1().Services()\n\tinformer := serviceformer.Informer()\n\n\tdefer runtime.HandleCrash()\n\n\tfactory.Start(stopCh)\n\n\tif !cache.WaitForCacheSync(stopCh, informer.HasSynced) {\n\t\terr = errTimeout\n\t\truntime.HandleError(err)\n\t\treturn\n\t}\n\n\tlister = serviceformer.Lister()\n\treturn\n}", "title": "" }, { "docid": "4443cdd3724b647f4ce441be89d10885", "score": "0.66091955", "text": "func GetServices(ctx context.Context, res http.ResponseWriter, req *http.Request) {\n\t/*\n\t * We will get the app context\n\t * We will get the list of services that are available\n\t * We will return the response\n\t */\n\n\t//getting the app context\n\tappCtx := ctx.Value(routes.AppContextKey).(*config.AppContext)\n\tappCtx.Log.Info(\"Got a request to fetch the list of datastore services\", appCtx.Session.User.ID)\n\n\t//fetching the list of datastore services\n\tservices, err := services.GetAll(appCtx.Db)\n\tif err != nil {\n\t\t//error while getting the list\n\t\tappCtx.Log.Error(\"error while getting the list\", err.Error())\n\t\tresponse.WriteError(res, response.Error{Err: \"Couldn't fetch the list\"}, http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif appCtx.Session.User.UserType != authConfig.CuttleApp {\n\t\tfor i := 0; i < len(services); i++ {\n\t\t\tservices[i].Password = \"\"\n\t\t}\n\t}\n\n\tappCtx.Log.Info(\"Successfully fetched the list of datastore services of length\", len(services))\n\tresponse.Write(res, response.Message{Message: \"Successfully fetched the list\", Data: services})\n}", "title": "" }, { "docid": "a24d930688224b655844a5c42a115be8", "score": "0.6592706", "text": "func (d *Docker) ServicesList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) {\n\treturn d.client.ServiceList(ctx, options)\n}", "title": "" }, { "docid": "f077bb42a244b2768c050fc74879ba90", "score": "0.6586657", "text": "func (g *GrpcGet) ListService(ctx context.Context, service string) error {\n\tif g.opts.outputServiceList == nil {\n\t\treturn errors.New(\"Must configure OutputService to run this method\")\n\t}\n\n\trefClient, conn, err := g.checkRefClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer refClient.Reset()\n\tdefer conn.Close()\n\n\tsvc, err := refClient.ResolveService(service)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.opts.outputService.OutputService(svc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a330d604631d127c12fc76dabdffeb4d", "score": "0.6574551", "text": "func TestListService(t *testing.T) {\n\tres, err := CLIENT.ListService(1, 100,\n\t\t\"\", \"\", \"\", \"\", \"\")\n\tExpectEqual(t.Errorf, nil, err)\n\tt.Logf(\"%+v\", res)\n}", "title": "" }, { "docid": "8318e5b2229eaf9252514ab9e9cf90a7", "score": "0.6572776", "text": "func (p *proxyServiceDirectory) Services() ([]ServiceInfo, error) {\n\tvar err error\n\tvar ret []ServiceInfo\n\tvar buf bytes.Buffer\n\tresponse, err := p.Call(\"services\", buf.Bytes())\n\tif err != nil {\n\t\treturn ret, fmt.Errorf(\"call services failed: %s\", err)\n\t}\n\tresp := bytes.NewBuffer(response)\n\tret, err = func() (b []ServiceInfo, err error) {\n\t\tsize, err := basic.ReadUint32(resp)\n\t\tif err != nil {\n\t\t\treturn b, fmt.Errorf(\"read slice size: %s\", err)\n\t\t}\n\t\tb = make([]ServiceInfo, size)\n\t\tfor i := 0; i < int(size); i++ {\n\t\t\tb[i], err = readServiceInfo(resp)\n\t\t\tif err != nil {\n\t\t\t\treturn b, fmt.Errorf(\"read slice value: %s\", err)\n\t\t\t}\n\t\t}\n\t\treturn b, nil\n\t}()\n\tif err != nil {\n\t\treturn ret, fmt.Errorf(\"parse services response: %s\", err)\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "bfe1b5a9b5bffca282a35d771e453311", "score": "0.65720814", "text": "func (s *vaultServiceLister) List(selector labels.Selector) (ret []*v1alpha1.VaultService, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.VaultService))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "6f12b9b4001e27de702205a981ca194f", "score": "0.65630233", "text": "func (ds DiscoveryService) List() []string {\n\tkeys := make([]string, 0, len(serviceMap))\n\tfor k := range serviceMap {\n\t\tkeys = append(keys, k)\n\t}\n\treturn keys\n}", "title": "" }, { "docid": "b045c3172691c00888e219b8774134a8", "score": "0.6557302", "text": "func (a *Client) ServiceList(params *ServiceListParams) (*ServiceListOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewServiceListParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ServiceList\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/services\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"text/plain\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &ServiceListReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ServiceListOK), nil\n\n}", "title": "" }, { "docid": "7b8f35c08644fe629f6f1399c868a8f2", "score": "0.65534955", "text": "func (ilw *IstioEgressListenerWrapper) Services() []*Service {\n\treturn ilw.services\n}", "title": "" }, { "docid": "a999e8778b3512a38906da20fe3d3488", "score": "0.6546389", "text": "func (s *server) List(params *ListParams) (*[]Model, error) {\n\turl := s.client.BasicUrl + \"/v2/money-transfer/services\"\n\n\tresponse, err := s.client.Get(url, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != http.StatusOK {\n\t\terrorMsg := fmt.Sprintf(\"list services request error, code: {%d}, message: {%s}\",\n\t\t\tresponse.StatusCode, response.Status)\n\t\treturn nil, errors.New(errorMsg)\n\t}\n\n\tservices := &[]Model{}\n\terr = json.NewDecoder(response.Body).Decode(services)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn services, nil\n}", "title": "" }, { "docid": "c06047d51b5d54d78ae5ce37c4a05ec0", "score": "0.654219", "text": "func (c *Client) Services(name string, timeout time.Duration) ([]*Service, error) {\n\tset, err := c.NewServiceSet(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer set.Close()\n\twatch := set.Watch(true)\n\tdefer set.Unwatch(watch)\n\tselect {\n\tcase <-watch:\n\t\treturn set.Services(), nil\n\tcase <-time.After(timeout):\n\t\treturn nil, errors.New(\"discover: timeout exceeded\")\n\t}\n}", "title": "" }, { "docid": "3df554cc42f8056f5e964798e63e32bd", "score": "0.65125775", "text": "func (s *signalrServiceLister) List(selector labels.Selector) (ret []*v1alpha1.SignalrService, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.SignalrService))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "00ce70b5706c9ae28d2e65c9cd692ea7", "score": "0.65066373", "text": "func handleListServices(s api.FluxService) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tinst := getInstanceID(r)\n\t\tnamespace := mux.Vars(r)[\"namespace\"]\n\t\tres, err := s.ListServices(inst, namespace)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tfmt.Fprintf(w, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tif err := json.NewEncoder(w).Encode(res); err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tfmt.Fprintf(w, err.Error())\n\t\t\treturn\n\t\t}\n\t})\n}", "title": "" }, { "docid": "a6b729c9faa1cf86483600774ecc0632", "score": "0.64754087", "text": "func (gcpBroker *GCPServiceBroker) Services(ctx context.Context) ([]brokerapi.Service, error) {\n\tsvcs := []brokerapi.Service{}\n\n\tenabledServices, err := gcpBroker.registry.GetEnabledServices()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, service := range enabledServices {\n\t\tentry, err := service.CatalogEntry()\n\t\tif err != nil {\n\t\t\treturn svcs, err\n\t\t}\n\t\tsvcs = append(svcs, entry.ToPlain())\n\t}\n\n\treturn svcs, nil\n}", "title": "" }, { "docid": "d2ea834487d3276fb911258c49cda191", "score": "0.6442831", "text": "func (device *Device) GetServices() (services []Service, err error) {\n\t// Create SOAP\n\tsoap := SOAP{\n\t\tBody: `<tds:GetServices xmlns:ns0=\"http://www.onvif.org/ver10/device/wsdl\">\n\t\t\t<ns0:IncludeCapability>false</ns0:IncludeCapability>\n\t\t</tds:GetServices>`,\n\t\tXMLNs: deviceXMLNs,\n\t\tUser: device.User,\n\t\tPassword: device.Password,\n\t}\n\n\t// Send SOAP request\n\tresponse, err := soap.SendRequest(device.XAddr)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Parse response to interface\n\tservicesInfo, err := response.ValuesForPath(\"Envelope.Body.GetServicesResponse.Service\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\t_services := make(map[string]Service)\n\tfor _, svc := range servicesInfo {\n\t\tif mapService, ok := svc.(map[string]interface{}); ok {\n\t\t\tnewService := Service{\n\t\t\t\tNameSpace: mapService[\"Namespace\"].(string),\n\t\t\t\tXAddr: mapService[\"XAddr\"].(string),\n\t\t\t}\n\t\t\t_services[newService.NameSpace] = newService\n\t\t\tservices = append(services, newService)\n\t\t}\n\t}\n\tdevice.Services = _services\n\n\treturn\n}", "title": "" }, { "docid": "f2a50be017c3a2af4e4ff0ced693100b", "score": "0.64301956", "text": "func (s *ServiceMux) GetAllServices() (map[string]*Service, error) {\n\tlist := make(map[string]*Service, len(s.services))\n\tfor id, service := range s.services {\n\t\tlist[id] = service\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "06a560617246468c91cea411089d035a", "score": "0.64156276", "text": "func (f *FileReader) GetServices() (services []string) {\n\tdirInfos, err := ioutil.ReadDir(servicePath())\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfor _, info := range dirInfos {\n\t\tservices = append(services, info.Name())\n\t}\n\treturn\n}", "title": "" }, { "docid": "9ddda3e8f3f6e7795e2aa95cae28c534", "score": "0.6413023", "text": "func (l *Lvs) GetServices() ([]core.Service, error) {\n\tipvsLock.RLock()\n\tdefer ipvsLock.RUnlock()\n\tsvcs := make([]core.Service, 0, 0)\n\tfor _, svc := range lvs.DefaultIpvs.Services {\n\t\tsvcs = append(svcs, lToSvc(svc))\n\t}\n\treturn svcs, nil\n}", "title": "" }, { "docid": "9692f4073ad9dee5c8e527eeaba484ba", "score": "0.64117277", "text": "func (repo *ServiceRepository) GetAllServices() ([]*Service, error) {\n\tscript, err := assets.Asset(\"sql/services/get_all_services.sql\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trows, err := repo.db.Query(string(script))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tservices := make([]*Service, 0)\n\n\tfor rows.Next() {\n\t\tservice := new(Service)\n\t\terr = rows.Scan(&service.ID, &service.Title, &service.Description, &service.Price)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tservices = append(services, service)\n\t}\n\n\treturn services, nil\n}", "title": "" }, { "docid": "9aa96295ba2f538749aed67dbb3260fc", "score": "0.63999665", "text": "func GetServices(c context.Context) Services { return c.Value(&servicesKey).(Services) }", "title": "" }, { "docid": "75593b446c65b7b91242a5ec67e50a04", "score": "0.6387223", "text": "func (c *FakeServices) List(opts v1.ListOptions) (result *creatorv1.ServiceList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewRootListAction(servicesResource, servicesKind, opts), &creatorv1.ServiceList{})\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &creatorv1.ServiceList{ListMeta: obj.(*creatorv1.ServiceList).ListMeta}\n\tfor _, item := range obj.(*creatorv1.ServiceList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "title": "" }, { "docid": "1fc3d243315c5f968292d03a407fcfb3", "score": "0.6381927", "text": "func (k *Kubeclient) List(opts metav1.ListOptions) (\n\t*corev1.ServiceList, error) {\n\tcli, err := k.getClientOrCached()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn k.list(cli, k.namespace, opts)\n}", "title": "" }, { "docid": "fe6e5805c474caea89f8b24b61607189", "score": "0.63798046", "text": "func (app App) Services(ctx context.Context) ([]api.ProviderDescription, error) {\n\n\tservices := make([]api.ProviderDescription, 0, len(app.providers))\n\n\tfor _, provider := range app.providers {\n\t\tservices = append(services, provider.Description())\n\t}\n\n\treturn services, nil\n}", "title": "" }, { "docid": "04249c79b437d7ad416632cc8012101e", "score": "0.63795394", "text": "func (d *Discoverer) Services(namespace string) (map[string]string, error) {\n\tresp, err := d.cli.Get(context.TODO(), namespace, clientv3.WithPrefix())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsvrs := make(map[string]string)\n\tfor _, kv := range resp.Kvs {\n\t\tkey := string(kv.Key)\n\t\tname, _ := filepath.Rel(namespace, key)\n\t\tsvrs[name] = string(kv.Value)\n\t}\n\treturn svrs, nil\n}", "title": "" }, { "docid": "7b3b802fcffd713ab179ae3eb3722297", "score": "0.63710535", "text": "func (b *Broker) Services(ctx context.Context) ([]domain.Service, error) {\n\treturn b.brokerServices, nil\n}", "title": "" }, { "docid": "a294231ab0db90ede7fb2b274dd79f99", "score": "0.6344948", "text": "func (r *Repository) All() ([]sdk.Service, error) {\n\tquery := `\n\tSELECT name, type, http_url, last_heartbeat, hash \n\tFROM services`\n\tservices, err := r.findAll(query)\n\tif err != nil {\n\t\tif err == sdk.ErrNotFound {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, sdk.WrapError(err, \"All> Unable to find dead services\")\n\t}\n\treturn services, nil\n}", "title": "" }, { "docid": "0168cf5cdd9db93c5868a29fba573d56", "score": "0.63418865", "text": "func (m *Manager) Services() []*Service {\n\tm.lock()\n\trv := make([]*Service, 0, len(m.services))\n\tfor s := range m.services {\n\t\trv = append(rv, s)\n\t}\n\tm.unlock()\n\treturn rv\n}", "title": "" }, { "docid": "8d474781077502b13922a5ca2b69857e", "score": "0.63364476", "text": "func (s vaultServiceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VaultService, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.VaultService))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "b2fe0878e708c89a3937edae9a4a0c72", "score": "0.63222307", "text": "func GetRunningServices() error {\n\t// var serviceChan chan string = make(chan, string)\n\tf, err := os.Open(\"allIP.txt\")\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"not able to read allIP.txt %v\", err)\n\t}\n\tdefer f.Close()\n\n\tfw, err := os.OpenFile(\"aliveServices.txt\", os.O_TRUNC|os.O_WRONLY, os.ModeAppend)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\tdefer fw.Close()\n\tin := make(chan string, 1)\n\tout := make(chan string, 1)\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\n\t\taliveIP := scanner.Text()\n\t\t// fmt.Println(aliveIP)\n\t\tin <- aliveIP\n\t\tgo runningService(in, out)\n\t\tselect {\n\t\tcase v := <-out:\n\t\t\t{\n\t\t\t\tfmt.Println(v)\n\t\t\t\tfmt.Fprintln(fw, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tbreak\n\t\t}\n\t}\n\tif scanner.Err() != nil {\n\t\treturn fmt.Errorf(\"error from scanner%v\", err)\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b00bf1ae6eda23de67d9b3b5faa1dc6", "score": "0.6314485", "text": "func (c *authenticationServices) List(opts v1.ListOptions) (result *v1beta1.AuthenticationServiceList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v1beta1.AuthenticationServiceList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"authenticationservices\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "e11a004fe697cd31c1897e4acadde03d", "score": "0.62999994", "text": "func (f FakeServiceLister) List(labels.Selector) ([]*v1.Service, error) {\n\treturn f, nil\n}", "title": "" }, { "docid": "8e5933ab02add1e5fe241a058b447bc2", "score": "0.62994546", "text": "func (a *SystemApiService) ListServicesExecute(r ApiListServicesRequest) ([]Service, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue []Service\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"SystemApiService.ListServices\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/system/services\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ApiErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "311bee7aedeb54383de6e4d6b457093b", "score": "0.6296506", "text": "func DisplayServices(services catalog.ServiceTypeList) {\n\tw := tabwriter.NewWriter(os.Stdout, 5, 2, 3, ' ', tabwriter.TabIndent)\n\tlog.Info(\"Services available through Service Catalog\")\n\tfmt.Fprintln(w, \"NAME\", \"\\t\", \"PLANS\")\n\tfor _, service := range services.Items {\n\t\tfmt.Fprintln(w, service.ObjectMeta.Name, \"\\t\", strings.Join(service.Spec.PlanList, \",\"))\n\t}\n\tw.Flush()\n}", "title": "" }, { "docid": "3f218df99b389e07b46a27e04711e9b9", "score": "0.6280101", "text": "func (m *Manager) GetServices() map[Type]Interface {\n\treturn m.services\n}", "title": "" }, { "docid": "d62dee30c76940e998ff30ce30608c8a", "score": "0.627684", "text": "func fetchServiceList(ctx context.Context, k *Kubernetes, namespace string) (*coreV1.ServiceList, error) {\n\tserviceList, err := k.Clientset.CoreV1().Services(\"\").List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn k.Clientset.CoreV1().Services(namespace).List(ctx, metav1.ListOptions{})\n\t}\n\treturn serviceList, err\n}", "title": "" }, { "docid": "86bbfccd7c0c960f34016d3a94b84f75", "score": "0.62736076", "text": "func ListControllerServices() []string {\n\tret := make([]string, 0)\n\tcontrollerServices, ok := os.LookupEnv(\"CONTROLLER_SERVICES\")\n\tif !ok {\n\t\treturn ret\n\t}\n\treturn strings.Split(controllerServices, \",\")\n}", "title": "" }, { "docid": "1ac2db44c7c320ce45360929fd1b2bde", "score": "0.6236996", "text": "func GetServiceinfo() *v1.ServiceList {\n\tlog := models.Log{}\n\tservices, err := models.GetClientset().CoreV1().Services(\"default\").List(metav1.ListOptions{})\n\tif err != nil {\n\t\tlog.Time = models.Gettime()\n\t\tlog.Etype = \"error\"\n\t\tlog.Event = \"Failed to get service \" + err.Error()\n\t\tgo models.Insertlog(&log)\n\t}\n\treturn services\n}", "title": "" }, { "docid": "6b1da77b52d8664266d840af7b80c466", "score": "0.6224986", "text": "func (s *podServiceLister) List(selector labels.Selector) (ret []*v1alpha1.PodService, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.PodService))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "72a411c5fe4416b0871985bedb2a6ede", "score": "0.62167555", "text": "func getActiveServices(tx *sql.Tx) ([]service.Service, error) {\n\trows, err := tx.Query(selectActiveServicesQuery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tvar svc service.Service\n\tservices := make([]service.Service, 0)\n\tfor rows.Next() {\n\t\terr = rows.Scan(&svc.Name, &svc.Domain, &svc.Port)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tservices = append(services, svc)\n\t}\n\treturn services, nil\n}", "title": "" } ]
7fc542c79ec4da7423ebd09229746feb
/ handles foreach operation on database object
[ { "docid": "88cd1f5333b12466f6e86f51564ae5bb", "score": "0.5894858", "text": "func (database *Database) Foreach(action func(string, string)) {\n\tfor key, value := range database.items {\n\t\taction(key, value)\n\t}\n}", "title": "" } ]
[ { "docid": "0f56c03c95f6b5192dfdd15b2bd6e29d", "score": "0.6405739", "text": "func (backend *impl) ForEach(namespace []byte, fun func([]byte, []byte) error) error {\n\treturn backend.db.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket(namespace)\n\t\treturn b.ForEach(fun)\n\t})\n}", "title": "" }, { "docid": "a1b899c79b6a4c76942e0f32e3239754", "score": "0.6399637", "text": "func (db *Database) IterateDatabase() {\n\tvar entries []Entry\n\tfor _, sub := range db.Keepass.Content.Root.Groups {\n\t\tentries = append(entries, iterateGroup(sub)...)\n\t}\n\tdb.Entries = entries\n}", "title": "" }, { "docid": "63deb72c39bc1b99ee2fb6f6831dc0d4", "score": "0.6295959", "text": "func (rs *ObjectResultSet) ForEach(fn func(*Object) error) error {\n\tfor rs.Next() {\n\t\trecord, err := rs.Get()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := fn(record); err != nil {\n\t\t\tif err == kallax.ErrStop {\n\t\t\t\treturn rs.Close()\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5adddaad4260e6686a2bf2f8444fd494", "score": "0.6095388", "text": "func (t *task) entityLoop(session *r.Session) {\n\tlog.Println(\"Executing database query\")\n\tcursor, err := t.query.Run(session)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer cursor.Close()\n\tvar row map[string]interface{}\n\tfor cursor.Next(&row) {\n\t\tt.results <- t.extractor(row)\n\t}\n\n\tif err = cursor.Err(); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tclose(t.results)\n}", "title": "" }, { "docid": "d2678e02296a389f5e9a7291e23fc9b5", "score": "0.6050084", "text": "func dbForEach(b *bolt.Bucket, fn interface{}) error {\n\t// check function type\n\tfnVal, fnTyp := reflect.ValueOf(fn), reflect.TypeOf(fn)\n\tif fnTyp.Kind() != reflect.Func || fnTyp.NumIn() != 2 {\n\t\tpanic(\"bad fn type: needed func(key, val), got \" + fnTyp.String())\n\t}\n\n\treturn b.ForEach(func(keyBytes, valBytes []byte) error {\n\t\tkey, val := reflect.New(fnTyp.In(0)), reflect.New(fnTyp.In(1))\n\t\tif err := encoding.Unmarshal(keyBytes, key.Interface()); err != nil {\n\t\t\treturn err\n\t\t} else if err := encoding.Unmarshal(valBytes, val.Interface()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfnVal.Call([]reflect.Value{key.Elem(), val.Elem()})\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "25e06b1b7f7f8b664ae2abd1184e9714", "score": "0.5958968", "text": "func (db *Ldb) Iterate(bucket Bucket) (iter Iterator) {\n\tbkey := BuildKey(bucket, []byte{})\n\titer = db.DB.NewIterator(util.BytesPrefix(bkey), nil)\n\treturn iter\n}", "title": "" }, { "docid": "4f083b766960dd852e7b97f033986a11", "score": "0.5865146", "text": "func (db *setDB) forEachItem(bucket []byte, fn func(k, v []byte) error) {\n\terr := db.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket(bucket)\n\t\tif build.DEBUG && b == nil {\n\t\t\tpanic(errNilBucket)\n\t\t}\n\t\treturn b.ForEach(fn)\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "0154a65e350ff9e8b99fce5a11af78c5", "score": "0.58465075", "text": "func (this *Iter_Amazing_SelectById) Each(fun func(*Row_Amazing_SelectById) error) error {\n\tdefer this.rows.Close()\n\tfor {\n\t\tselect {\n\t\tcase <-this.ctx.Done():\n\t\t\treturn this.ctx.Err()\n\t\tdefault:\n\t\t\tif row, ok := this.Next(); !ok {\n\t\t\t\treturn nil\n\t\t\t} else if err := fun(row); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d997b159753e9b59c86adc1f5541a28b", "score": "0.5843686", "text": "func (c *Cursor) ForEach(handler func(*Cursor) error) error {\n\tdefer c.Close()\n\tfor c.Cursor.Next(c.Ctx) {\n\t\terr := handler(c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78eb2a015d263b821ad971d983cce04c", "score": "0.58322316", "text": "func (boltDB *BoltDB) ForEach(fn func(k, v []byte) error) error {\n\tvar err error\n\treturn boltDB.db.View(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket([]byte(FILE_BUCKET))\n\t\terr = bucket.ForEach(fn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "151c563bd8353afecf1a08db3ad58354", "score": "0.58254445", "text": "func (s *Store) ForEach(query *Query, fn interface{}) error {\n\treturn s.Bolt().View(func(tx *bolt.Tx) error {\n\t\treturn s.TxForEach(tx, query, fn)\n\t})\n}", "title": "" }, { "docid": "80cf2554d23503c7220080c3e9446c35", "score": "0.58250535", "text": "func (db *MapDb) Iterate(bucket Bucket) (iter Iterator) {\n\treturn nil\n}", "title": "" }, { "docid": "5b93f198df59d26a4d101dc88dfd7500", "score": "0.5813184", "text": "func traverseFromDB(db dbm.DB, fn func(key, value []byte)) {\n\titr, err := db.Iterator(nil, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer itr.Close()\n\n\tfor ; itr.Valid(); itr.Next() {\n\t\tfn(itr.Key(), itr.Value())\n\t}\n}", "title": "" }, { "docid": "38f4b405b43ec9c5efdc10fcf8650432", "score": "0.5812719", "text": "func (rs *QueuedElementResultSet) ForEach(fn func(*QueuedElement) error) error {\n\tfor rs.Next() {\n\t\trecord, err := rs.Get()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := fn(record); err != nil {\n\t\t\tif err == kallax.ErrStop {\n\t\t\t\treturn rs.Close()\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e53c2d83b479010d5aa444c04f851d49", "score": "0.5719463", "text": "func (this *Iter_Amazing_Insert) Each(fun func(*Row_Amazing_Insert) error) error {\n\tdefer this.rows.Close()\n\tfor {\n\t\tselect {\n\t\tcase <-this.ctx.Done():\n\t\t\treturn this.ctx.Err()\n\t\tdefault:\n\t\t\tif row, ok := this.Next(); !ok {\n\t\t\t\treturn nil\n\t\t\t} else if err := fun(row); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "29916c7a2e736f26d1ae8f07606d7e4c", "score": "0.5688099", "text": "func (s *Store) ForEach(handle func(Object) error) error {\n\tvalues, err := s.backend.List(s.current.Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to list meta data: %v\", err)\n\t}\n\tfor _, v := range values {\n\t\tobj := s.current.NewObject()\n\t\tif err := json.Unmarshal(v, obj); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to decode meta data: %v\", err)\n\t\t}\n\t\tif err := handle(obj); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eb90116a4301229b21aac44cf8c57d7a", "score": "0.56729573", "text": "func (rd *BadgerStore) Each(fn nstorage.EachItem) error {\n\treturn rd.Db.View(func(txn *badger.Txn) error {\n\t\tvar iterator = txn.NewIterator(rd.iter)\n\t\tdefer iterator.Close()\n\n\t\tfor iterator.Rewind(); iterator.Valid(); iterator.Next() {\n\t\t\tvar item = iterator.Item()\n\t\t\tif item.IsDeletedOrExpired() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar stop = false\n\t\t\tvar err = item.Value(func(value []byte) error {\n\t\t\t\tif dataErr := fn(value, string(item.Key())); dataErr != nil {\n\t\t\t\t\tstop = true\n\t\t\t\t\tif nerror.IsAny(dataErr, nstorage.ErrJustStop) {\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t\treturn dataErr\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t})\n\n\t\t\tif err != nil {\n\t\t\t\treturn nerror.WrapOnly(err)\n\t\t\t}\n\n\t\t\tif stop {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "b6e10728503d3aeca27fd5162ab9a747", "score": "0.56697685", "text": "func (r *RebuildMunger) EachLoop() error { return nil }", "title": "" }, { "docid": "2f814162ae9225ce127d975954df760c", "score": "0.56466717", "text": "func walk(db *bolt.DB, walkFn walkFunc) error {\n\treturn db.View(func(tx *bolt.Tx) error {\n\t\treturn tx.ForEach(func(name []byte, b *bolt.Bucket) error {\n\t\t\treturn walkBucket(b, nil, name, nil, b.Sequence(), walkFn)\n\t\t})\n\t})\n}", "title": "" }, { "docid": "b4685cfa8d4f302641af906559c1a2cf", "score": "0.56208736", "text": "func (rs *RepositoryResultSet) ForEach(fn func(*Repository) error) error {\n\tfor rs.Next() {\n\t\trecord, err := rs.Get()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := fn(record); err != nil {\n\t\t\tif err == kallax.ErrStop {\n\t\t\t\treturn rs.Close()\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b4685cfa8d4f302641af906559c1a2cf", "score": "0.56208736", "text": "func (rs *RepositoryResultSet) ForEach(fn func(*Repository) error) error {\n\tfor rs.Next() {\n\t\trecord, err := rs.Get()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := fn(record); err != nil {\n\t\t\tif err == kallax.ErrStop {\n\t\t\t\treturn rs.Close()\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8321bf8727aa1bf0cb64a3a39697634f", "score": "0.55988586", "text": "func (rs *NodeResultSet) ForEach(fn func(*Node) error) error {\n\tfor rs.Next() {\n\t\trecord, err := rs.Get()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := fn(record); err != nil {\n\t\t\tif err == kallax.ErrStop {\n\t\t\t\treturn rs.Close()\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "21585e2a057ad10f233303f37759b9ae", "score": "0.5571429", "text": "func (u *DbUtils) ForEachRow(pq *PreparedQuery, callback DBRowCallback) error {\n\tsc := new(SQLScan)\n\n\trows, err := u.db.Query(pq.Query, pq.Args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\terr = callback(rows, sc)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "80db7e7aaeceac12f597f9b85ee403c3", "score": "0.5547546", "text": "func (q *Query) ForEach(f func(e T)) {\n\tnext := q.Iterate()\n\tfor elem, ok := next(); ok; elem, ok = next() {\n\t\tf(elem)\n\t}\n}", "title": "" }, { "docid": "c52dc2e39e3d7f57ab95d574c1db19e1", "score": "0.55401796", "text": "func (this *Amazing_SelectByIdIter) Each(fun func(*Amazing_SelectByIdRow) error) error {\n\tfor {\n\t\tselect {\n\t\tcase <-this.ctx.Done():\n\t\t\treturn this.ctx.Err()\n\t\tdefault:\n\t\t\tif row, ok := this.Next(); !ok {\n\t\t\t\treturn nil\n\t\t\t} else if err := fun(row); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "790a5aa3170a9a6d563f3b866baf4045", "score": "0.5527411", "text": "func (rs *MentionResultSet) ForEach(fn func(*Mention) error) error {\n\tfor rs.Next() {\n\t\trecord, err := rs.Get()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := fn(record); err != nil {\n\t\t\tif err == kallax.ErrStop {\n\t\t\t\treturn rs.Close()\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "790a5aa3170a9a6d563f3b866baf4045", "score": "0.5527411", "text": "func (rs *MentionResultSet) ForEach(fn func(*Mention) error) error {\n\tfor rs.Next() {\n\t\trecord, err := rs.Get()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := fn(record); err != nil {\n\t\t\tif err == kallax.ErrStop {\n\t\t\t\treturn rs.Close()\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70a9105e82f5f9b2c35403ac46636986", "score": "0.5501821", "text": "func (CommentDeleter) EachLoop() error { return nil }", "title": "" }, { "docid": "bb29b1223119056875ba2f832a94fd7e", "score": "0.5491551", "text": "func (it *MongoIterDAL) All(result interface{}) error {\n\treturn it.iter.All(result)\n}", "title": "" }, { "docid": "87b29b629277aa043167753f9e39f0fb", "score": "0.54871494", "text": "func (c *CherrypickAutoApprove) EachLoop() error { return nil }", "title": "" }, { "docid": "be66c0e0273939ff59b62a898246f601", "score": "0.5453928", "text": "func (s *Store) ForEach(callback func(ID string, c Container)) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\tfor containerID, container := range s.containers {\n\t\tcallback(containerID, container)\n\t}\n}", "title": "" }, { "docid": "18e88a507f9e05a7078ec14d7ddd2a27", "score": "0.5444581", "text": "func (this *Amazing_InsertIter) Each(fun func(*Amazing_InsertRow) error) error {\n\tfor {\n\t\tselect {\n\t\tcase <-this.ctx.Done():\n\t\t\treturn this.ctx.Err()\n\t\tdefault:\n\t\t\tif row, ok := this.Next(); !ok {\n\t\t\t\treturn nil\n\t\t\t} else if err := fun(row); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6003d7db894993c13b71221be0f4068b", "score": "0.5437395", "text": "func (this *Iter_Amazing_SelectByName) Each(fun func(*Row_Amazing_SelectByName) error) error {\n\tdefer this.rows.Close()\n\tfor {\n\t\tselect {\n\t\tcase <-this.ctx.Done():\n\t\t\treturn this.ctx.Err()\n\t\tdefault:\n\t\t\tif row, ok := this.Next(); !ok {\n\t\t\t\treturn nil\n\t\t\t} else if err := fun(row); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "365f51083d42a1bdc330d4a25537d987", "score": "0.54326797", "text": "func (s Select) EachObject(dest interface{}, cb func()) {\n\tvar r = s.Query()\n\tdefer r.Close()\n\n\tfor r.Next() {\n\t\tr.Scan(s.ot.t.ScanStruct(dest)...)\n\t\tcb()\n\t}\n}", "title": "" }, { "docid": "5f6652082b1a2802be6cb6b8527cef31", "score": "0.5430024", "text": "func (c *ESConnection) ForEach(query interface{}, indexList []string, typeList []string, cb func(*goes.Document) error) error {\n\tres, err := c.Scan(query, indexList, typeList, c.Timeout, c.Size)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdoc := goes.Document{}\n\n\tres, err = c.Scroll(res.ScrollId, c.Timeout)\n\tfor err == nil && len(res.Hits.Hits) > 0 {\n\t\tfor _, hit := range res.Hits.Hits {\n\t\t\tdoc.Index = hit.Index\n\t\t\tdoc.Type = hit.Type\n\t\t\tdoc.Id = hit.Id\n\t\t\tdoc.Fields = hit.Source\n\t\t\tif err = cb(&doc); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tres, err = c.Scroll(res.ScrollId, c.Timeout)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "349872086fd07721988f57b47d1d0728", "score": "0.5420745", "text": "func (s *StorePostgres) IterateAll(\n\to interface{},\n\tblock func(k string, v string, t string, stop *bool)) {\n\tvar err error\n\tvar res *sql.Rows\n\tres, err = s.IterateAllStmt.Query()\n\tgotils.CheckNotFatal(err)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer res.Close()\n\n\tstop := false\n\tfor res.Next() {\n\t\tvar k string\n\t\tvar v string\n\t\tvar t string\n\t\terr = res.Scan(&k, &v, &t)\n\t\tgotils.CheckNotFatal(err)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\terr = json.Unmarshal([]byte(v), &o)\n\t\tgotils.CheckNotFatal(err)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tblock(k, v, t, &stop)\n\t\tif stop {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cb43cf2976217e61541f3c2bee993a25", "score": "0.5369539", "text": "func (AssignUnassignHandler) EachLoop() error { return nil }", "title": "" }, { "docid": "f4607ce20be52cb7b0d2446d29dd31ab", "score": "0.5366001", "text": "func (self *OrbClient) writeLoop() {\n\n\tfor {\n\n\t\tchangedOrb := <-self.write\n\t\tfmt.Println(\"Change orb: \", changedOrb)\n\t\tbsonBuf, err := bson.Marshal(changedOrb)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error marshalling (todo handle properly): \", err)\n\t\t}\n\n\t\t//buff := bytes.NewBuffer(bson)\n\t\t//buff.append(Deliminator)\n\t\tbsonBuf = append(bsonBuf, []byte(Deliminator)...)\n\n\t\tfmt.Printf(\"Writing %s\\n\", bsonBuf)\n\t\t_, err = self.conn.Write(bsonBuf)\n\n\t\tif err == io.EOF {\n\t\t\tself.broadcastDisconnect()\n\t\t\treturn\n\t\t} else if err != nil {\n\t\t\tfmt.Println(\"Error writing (todo handle properly): \", err)\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "20a323c126a0bf5c9540cbb8e08125f5", "score": "0.5360805", "text": "func (b *Backend) forEachUpload(f func(upload *common.Upload) error, unscoped bool) (err error) {\n\tstmt := b.db.Model(&common.Upload{})\n\tif unscoped {\n\t\tstmt = stmt.Unscoped()\n\t}\n\n\trows, err := stmt.Rows()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() { _ = rows.Close() }()\n\n\tfor rows.Next() {\n\t\tupload := &common.Upload{}\n\t\terr = b.db.ScanRows(rows, upload)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = f(upload)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "556533fd901c942b7d0df1b23c8e9f5b", "score": "0.53497916", "text": "func (a *Admin) list(w http.ResponseWriter, req *http.Request) {\n\tcoll, id := parseRequest(req.URL.Path)\n\n\t//ensure we have a collection, but no id\n\tif coll == \"\" || id != \"\" {\n\t\ta.Renderer.NotFound(w, req)\n\t}\n\n\t//make sure we know about the requested collection\n\tif !a.hasType(coll) {\n\t\ta.Renderer.NotFound(w, req)\n\t\treturn\n\t}\n\n\tc := a.collFor(coll)\n\n\t//TODO: make this load into a map[string]interface{} instead\n\t//to reduce the amount of reflection we need to do. We can't get\n\t//objects that way though so see if thats an issue.\n\n\ttotal, err := c.Find(nil).Count()\n\tif err != nil {\n\t\ta.Renderer.InternalError(w, req, err)\n\t}\n\n\t//grab the data\n\tvar items []interface{}\n\titer, page, numpage := listParse(c, req.URL.Query())\n\tfor {\n\t\tt := a.newType(coll)\n\t\tif !iter.Next(t) {\n\t\t\tbreak\n\t\t}\n\t\titems = append(items, t)\n\t}\n\n\t//report any errors our iterator made\n\tif err := iter.Err(); err != nil {\n\t\ta.Renderer.InternalError(w, req, err)\n\t\treturn\n\t}\n\n\tids := a.types[coll].ColumnIds\n\n\t//generate the columns\n\tcolumns := make([]string, len(ids))\n\ttyp := a.types[coll].Type\n\tfor j, idx := range ids {\n\t\tcolumns[j] = typ.Field(idx).Name\n\t}\n\n\t//make the values :(\n\tvalues := make([][]string, len(items))\n\tfor i, obj := range items {\n\t\tval, err := indirect(reflect.ValueOf(obj))\n\t\tif err != nil {\n\t\t\ta.Renderer.InternalError(w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tvalues[i] = make([]string, len(ids))\n\n\t\tfor j, idx := range ids {\n\t\t\tvar data string\n\n\t\t\t//TODO: make things that involve hexable into a function that gets\n\t\t\t//called.\n\t\t\tswitch item := val.Field(idx).Interface().(type) {\n\t\t\tcase hexable:\n\t\t\t\tdata = item.Hex()\n\t\t\tdefault:\n\t\t\t\tdata = fmt.Sprint(item)\n\t\t\t}\n\n\t\t\tvalues[i][j] = data\n\t\t}\n\t}\n\n\tpages := int(math.Ceil(float64(total) / float64(numpage)))\n\tif pages < 1 {\n\t\tpages = 1\n\t}\n\n\ta.Renderer.List(w, req, ListContext{\n\t\tBaseContext: a.baseContext(req),\n\t\tCollection: coll,\n\t\tColumns: columns,\n\t\tValues: values,\n\t\tObjects: items,\n\t\tPagination: Pagination{\n\t\t\tPages: pages,\n\t\t\tCurrentPage: page,\n\t\t\tquery: req.URL.Query(),\n\t\t},\n\t})\n}", "title": "" }, { "docid": "f064dc37c6b7bc6d63aa94bf7885c08e", "score": "0.5331166", "text": "func (iter *objectsIter) ForEach(cb func(plumbing.EncodedObject) error) error {\n\treturn nil\n}", "title": "" }, { "docid": "f9f1881f37b3164a992dbe5d450dd321", "score": "0.53247267", "text": "func (p *FileBunkerCollection) GetAllFromDB() {\n\tp = GetAllOriginalDataFromDB()\n}", "title": "" }, { "docid": "259cd8ba52775dd2663a0ff809c98232", "score": "0.53091943", "text": "func (t *Object) Collect(dbh *sql.DB) {\n\tt.current = selectRows(dbh)\n\tt.SetLastCollectTimeNow()\n\n\tt.makeResults()\n}", "title": "" }, { "docid": "ba8eff55939cfb4d3d7767760bf76456", "score": "0.5303031", "text": "func GetAll(client *mongo.Client) []NewJob {\n var jobs []NewJob\n collection := client.Database(\"odin\").Collection(\"jobs\")\n documents, _ := collection.Find(context.TODO(), bson.D{})\n client.Disconnect(context.TODO())\n for documents.Next(context.TODO()) {\n var job NewJob\n documents.Decode(&job)\n jobs = append(jobs, job)\n }\n return jobs\n}", "title": "" }, { "docid": "f1a7258dfb4835a4d71ab38f6cf16ca0", "score": "0.5286398", "text": "func forEach(tx *bolt.Tx, bucket []byte, fn func(k, v []byte) error) error {\n\tb := tx.Bucket(bucket)\n\tif build.DEBUG && b == nil {\n\t\tpanic(errNilBucket)\n\t}\n\treturn b.ForEach(fn)\n}", "title": "" }, { "docid": "f6860324cbccc64b928abbe29f115355", "score": "0.5279019", "text": "func (c *ClearPickAfterMerge) EachLoop() error { return nil }", "title": "" }, { "docid": "e8ebdfc99bb9fc93398a1c0a85ef500a", "score": "0.5254608", "text": "func (tx *Transaction) SavePersistentData() {\n for col, pc := range tx.PersistentCollections{\n pc.SetData(tx.GetCollection(col).Data)\n pc.Save()\n }\n}", "title": "" }, { "docid": "db9a3762672f1ae0b5b981b90bf7d771", "score": "0.52497655", "text": "func (s *Store) ForEachInBucket(parent *bolt.Bucket, query *Query, fn interface{}) error {\n\treturn s.forEach(parent, query, fn)\n}", "title": "" }, { "docid": "811c060ace2b79beca7927a43c53cc75", "score": "0.5244014", "text": "func (m *MongoDB) Iter(fn func(models.Machine)) error {\n\tquery := func(c *mgo.Collection) error {\n\t\tmachinesWithIds := bson.M{\n\t\t\t\"meta.instanceId\": bson.M{\"$exists\": true, \"$ne\": \"\"},\n\t\t}\n\n\t\tmachine := models.Machine{}\n\t\titer := c.Find(machinesWithIds).Batch(150).Iter()\n\t\tfor iter.Next(&machine) {\n\t\t\tfn(machine)\n\t\t}\n\n\t\treturn iter.Close()\n\t}\n\n\treturn m.DB.Run(\"jMachines\", query)\n}", "title": "" }, { "docid": "af60f1ab9be83e16c9b2e04a63a5cca4", "score": "0.52101165", "text": "func (db *Memory) Iterate(\n\tkeyLB, keyUB []byte, done chan struct{}, callback func(key, value []byte),\n) error {\n\tdataKeyLB, dataKeyUB := getDataKey(keyLB), getDataKey(keyUB)\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\tfor key, value := range db.data {\n\t\tif strings.Compare(key, dataKeyLB) >= 0 && strings.Compare(key, dataKeyUB) < 0 {\n\t\t\tkeyBytes, err := hex.DecodeString(key)\n\t\t\terrors2.MaybePanic(err)\n\t\t\tcallback(keyBytes, value)\n\t\t\tselect {\n\t\t\tcase <-done:\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\t// continue\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9a3c935afa4591e57915fe0455f2d773", "score": "0.5204123", "text": "func (collection *LocalRepoCollection) ForEach(handler func(*LocalRepo) error) error {\n\treturn collection.db.ProcessByPrefix([]byte(\"L\"), func(key, blob []byte) error {\n\t\tr := &LocalRepo{}\n\t\tif err := r.Decode(blob); err != nil {\n\t\t\tlog.Printf(\"Error decoding repo: %s\\n\", err)\n\t\t\treturn nil\n\t\t}\n\n\t\treturn handler(r)\n\t})\n}", "title": "" }, { "docid": "7538cba071b2d8abeda180e2d499dd75", "score": "0.5201364", "text": "func ForEach(data, callback interface{}) error {\n\treturn Each(data, callback)\n}", "title": "" }, { "docid": "bf91568438892b3a00626ffe4dec145c", "score": "0.5196603", "text": "func (b *GetBlockedQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error {\n\titer := b.Iter()\n\tfor iter.Next(ctx) {\n\t\tif err := cb(ctx, iter.Value()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn iter.Err()\n}", "title": "" }, { "docid": "79cd5f1d30b773c3881b5935c2509ff1", "score": "0.5194573", "text": "func (self *OrbClient) readLoop() {\n\n\tfor {\n\n\t\tbsonBuf := make([]byte, 2048)\n\t\tl, err := self.conn.Read(bsonBuf)\n\n\t\tif err == io.EOF {\n\t\t\tself.broadcastDisconnect()\n\t\t\treturn\n\t\t} else if err == nil && l > 0 {\n\n\t\t\tnewOrb := &Orb{}\n\t\t\tif err := bson.Unmarshal(bsonBuf, newOrb); err != nil {\n\t\t\t\tfmt.Println(\"Error unmarshalling (todo handle properly): \", err)\n\t\t\t} else {\n\t\t\t\tself.read <-*newOrb\n\t\t\t}\n\n\t\t} else {\n\t\t\tfmt.Println(\"Error reading (todo handle properly): \", err)\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "5b4844a55cfd002153591ff8562175f0", "score": "0.5184372", "text": "func getComponentes() []componente{\r\n dbinfo := fmt.Sprintf(\"host=%s user=%s password=%s dbname=%s sslmode=disable\",\r\n db_config.Host, db_config.User, db_config.Pass, db_config.Name)\r\n db, err := sql.Open(\"postgres\", dbinfo)\r\n checkErr(err)\r\n defer db.Close()\r\n\r\n rows, err := db.Query(\"SELECT id, mashup_id FROM componentes\")\r\n checkErr(err)\r\n\r\n var componentes []componente\r\n for rows.Next() {\r\n var idT int\r\n var mashup_idT int\r\n err = rows.Scan(&idT,&mashup_idT)\r\n checkErr(err)\r\n temporal := componente{id: idT, mashup_id: mashup_idT}\r\n componentes = append(componentes, temporal)\r\n }\r\n return componentes\r\n}", "title": "" }, { "docid": "23e329d7e39cc3357f89491c126c01ca", "score": "0.51770896", "text": "func (d DatabaseData) ForEachRow(f func(schemaID string, row RowData) error) error {\n\tfor schemaID, table := range d {\n\t\tfor _, row := range table {\n\t\t\tif err := f(schemaID, row); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ad6b2e517fc028f09614260c356a7bf5", "score": "0.51762193", "text": "func (uts *UnapprovedTransactions) ForEach(callback ForEachKeyIteratorInterface) error {\n\treturn uts.DB.forEachInBucket(unapprovedTransactionsBucket, callback)\n}", "title": "" }, { "docid": "adee9b3d9eca4955e42de6ef186072b7", "score": "0.51746804", "text": "func (db *RocksDB) Iterate(\n\tkeyLB, keyUB []byte, done chan struct{}, callback func(key, value []byte),\n) error {\n\topts := gorocksdb.NewDefaultReadOptions()\n\topts.SetIterateUpperBound(keyUB)\n\topts.SetFillCache(false)\n\titer := db.rdb.NewIterator(opts)\n\tdefer iter.Close()\n\tdefer opts.Destroy()\n\n\titer.Seek(keyLB)\n\tfor ; iter.Valid(); iter.Next() {\n\t\tcallback(iter.Key().Data(), iter.Value().Data())\n\t\tselect {\n\t\tcase <-done:\n\t\t\treturn iter.Err()\n\t\tdefault:\n\t\t\t// continue\n\t\t}\n\t}\n\treturn iter.Err()\n}", "title": "" }, { "docid": "e7e4d38bd11aefac73953ca57a6f4034", "score": "0.516543", "text": "func (c Collector) save() {\n\tfor key, item := range c.data {\n\t\terr := c.db.Update(func(tx *bolt.Tx) error {\n\t\t\tbucket := tx.Bucket(DB).Bucket(Entries)\n\t\t\tif bucket == nil {\n\t\t\t\treturn errors.New(\"entries bucket not found\")\n\t\t\t}\n\n\t\t\tenc, err := gobEncode(item)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = bucket.Put([]byte(key), enc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a70fb0157a25aa22c9988f01fca76dd3", "score": "0.51533014", "text": "func Objects(w http.ResponseWriter, r *http.Request) {\n\tdb := dbConnPostgres()\n\tselDB, err := db.Query(\"SELECT * FROM objects ORDER BY id DESC\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tobject := Object{}\n\tres := []Object{}\n\n\tfor selDB.Next() {\n\t\tvar id int\n\t\tvar name, content string\n\t\terr := selDB.Scan(&id, &name, &content)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tlog.Println(\"Listing Row: Id \" + string(id) + \" | name \" + name + \" | content \" + content)\n\n\t\tobject.Id = id\n\t\tobject.Name = name\n\t\tobject.Content = content\n\t\tres = append(res, object)\n\t}\n\ttmpl.ExecuteTemplate(w, \"Objects\", res)\n\tdefer db.Close()\n}", "title": "" }, { "docid": "9ab354bdcf74b0dff8243ee4f965bbc1", "score": "0.51455444", "text": "func readAllItems(db *sql.DB) []LogItem {\n\tsqlReadAll := `\n\tSELECT id, clientTimestamp, resultCode, machineId, info, insertedDatetime FROM logs\n\tORDER BY datetime(insertedDatetime)\n\t`\n\n\trows, err := db.Query(sqlReadAll)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer rows.Close()\n\n\tvar result []LogItem\n\tfor rows.Next() {\n\t\tlogItem := LogItem{}\n\t\terr2 := rows.Scan(&logItem.ID, &logItem.ClientTimestamp, &logItem.ResultCode, &logItem.MachineID, &logItem.Info, &logItem.InsertedDatetime)\n\t\tif err2 != nil {\n\t\t\tpanic(err2)\n\t\t}\n\t\tresult = append(result, logItem)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "c458d47239f4b454f6512ca36cb79e98", "score": "0.5137267", "text": "func (this *SqlScheduler) manipulateDataLoop() {\n\tfor {\n\t\tselect {\n\t\tcase <-this.addTaskChan: // add task does not need lock\n\t\t\tif len(this.tasks) > store_to_sql_count {\n\t\t\t\tfor i := 0; i < store_count; i++ {\n\t\t\t\t\tt := <-this.tasks\n\t\t\t\t\ttaskStr, err := t.Serialize()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\taddTask(this.db, taskStr)\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-this.getTaskChan: // get task does need lock\n\t\t\tthis.lock()\n\t\t\tif len(this.tasks) < extract_count {\n\t\t\t\ttasks := getTasks(this.db, extract_count)\n\t\t\t\tfor i := 0; i < len(tasks); i++ {\n\t\t\t\t\tt, err := model.UnSerializeTask(tasks[i].Data)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthis.tasks <- t\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.unLock()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "70d84b327d4d7be59870816ff5410279", "score": "0.51355106", "text": "func (kb dbKeybase) List() ([]Info, error) {\n\tvar res []Info\n\titer := kb.db.Iterator(nil, nil)\n\tdefer iter.Close()\n\tfor ; iter.Valid(); iter.Next() {\n\t\tinfo, err := readInfo(iter.Value())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres = append(res, info)\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "af85c442e712740dc7d9e26463fbc244", "score": "0.51179326", "text": "func (lt *table) ForEach(userID string, callback index.ForEachIndexCallback) error {\n\tlt.indexSetMtx.RLock()\n\tdefer lt.indexSetMtx.RUnlock()\n\n\t// TODO(owen-d): refactor? Uploads mgr never has user indices,\n\t// only common (multitenant) ones.\n\t// iterate through both user and common index\n\tfor _, uid := range []string{userID, \"\"} {\n\t\tidxSet, ok := lt.indexSet[uid]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := idxSet.ForEach(callback); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c82d8c33b6b976744673c3807767e9a", "score": "0.5116248", "text": "func (this *Amazing_SelectByNameIter) Each(fun func(*Amazing_SelectByNameRow) error) error {\n\tfor {\n\t\tselect {\n\t\tcase <-this.ctx.Done():\n\t\t\treturn this.ctx.Err()\n\t\tdefault:\n\t\t\tif row, ok := this.Next(); !ok {\n\t\t\t\treturn nil\n\t\t\t} else if err := fun(row); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cd79c942f6edda35e8bf0a77ba5d69df", "score": "0.51142436", "text": "func (db *MemoryStore) Iter() <-chan es.Event {\n\tc := make(chan es.Event)\n\n\tf := func() {\n\t\tdb.Lock()\n\t\tdefer db.Unlock()\n\n\t\tfor _, event := range db.Data[db.Namespace] {\n\t\t\tc <- event\n\t\t}\n\t\tclose(c)\n\t}\n\tgo f()\n\n\treturn c\n}", "title": "" }, { "docid": "a999cdfd4cfbcab30bd1ae6b78c8fc1f", "score": "0.5107948", "text": "func (p *Pk) Iterate(fn func(field.Field) error) error {\n\tvar err error\n\tvar f field.Field\n\n\tf, _ = p.Field(\"A\")\n\terr = fn(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf, _ = p.Field(\"B\")\n\terr = fn(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "03754387fb7fdd5fb3f63aca7f68ddad", "score": "0.5087567", "text": "func (c *Cursor) All(_ context.Context, out interface{}) error {\n\t// acquire mutex\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\t// check if closed\n\tif c.closed {\n\t\treturn fmt.Errorf(\"cursor closed\")\n\t}\n\n\t// decode items\n\terr := bsonkit.DecodeList(c.list, out)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// close cursor\n\tc.closed = true\n\n\treturn nil\n}", "title": "" }, { "docid": "8f3ad22485ee8e1be3f1c8b21c2d6d17", "score": "0.5082597", "text": "func (db *MongoDB) GetAll(collection string, data interface{}) {\n\tsession := db.CreateSession()\n\tdefer session.Close()\n\n\t// elements := make([]interface{}, 0, db.Count(collection))\n\terr := session.DB(db.Name).C(collection).Find(bson.M{}).All(data)\n\tif err != nil {\n\t\tfmt.Printf(\"Unable to obtain all: %s\", err.Error())\n\t}\n\treturn\n}", "title": "" }, { "docid": "8c7bd32de6ca40f2230b678f7a3e9b97", "score": "0.5073392", "text": "func dbViewAll(db *bolt.DB, bucketName string) (map[string]string, error) {\n\t//Map for returning the key values in the db.\n\tm := make(map[string]string)\n\n\terr := db.View(func(tx *bolt.Tx) error {\n\n\t\tbu := tx.Bucket([]byte(bucketName))\n\n\t\t//Check if tx.Bucket returns nil, and return if nil,\n\t\t// if it was nil and we did continue it will panic\n\t\t// on the first use of the bucket, since it does not exist.\n\t\tif bu == nil {\n\t\t\tlog.Println(\"error: bucket does not exist: \", bu)\n\t\t\treturn fmt.Errorf(\"error: bucket does not exist: value : %v\", bu)\n\t\t}\n\n\t\t//create a cursor, go to the first key in the db,\n\t\t// then iterate all key's with next.\n\t\tcursor := bu.Cursor()\n\t\tcursor.First()\n\t\tfor k, v := cursor.First(); k != nil; k, v = cursor.Next() {\n\t\t\tm[string(k)] = string(v)\n\t\t\t//fmt.Printf(\"key=%s, value=%s\\n\", k, v)\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error: viewing all items in db: %v\", err)\n\t}\n\n\treturn m, err\n}", "title": "" }, { "docid": "53aea67df21c4b722c7bbd92dd930cf0", "score": "0.507304", "text": "func (db *Database) ForEachDocID(callback ForEachDocIDFunc, resultsOpts ForEachDocIDOptions) error {\n\ttype viewRow struct {\n\t\tKey string\n\t\tValue struct {\n\t\t\tRevID string `json:\"r\"`\n\t\t\tSequence uint64 `json:\"s\"`\n\t\t\tChannels []string `json:\"c\"`\n\t\t}\n\t}\n\tvar vres struct {\n\t\tRows []viewRow\n\t}\n\topts := Body{\"stale\": false, \"reduce\": false}\n\n\tif resultsOpts.Startkey != \"\" {\n\t\topts[\"startkey\"] = resultsOpts.Startkey\n\t}\n\n\tif resultsOpts.Endkey != \"\" {\n\t\topts[\"endkey\"] = resultsOpts.Endkey\n\t}\n\n\terr := db.Bucket.ViewCustom(DesignDocSyncHousekeeping, ViewAllDocs, opts, &vres)\n\tif err != nil {\n\t\tbase.Warn(\"all_docs got error: %v\", err)\n\t\treturn err\n\t}\n\n\tcount := uint64(0)\n\tfor _, row := range vres.Rows {\n\t\tif callback(IDAndRev{row.Key, row.Value.RevID, row.Value.Sequence}, row.Value.Channels) {\n\t\t\tcount++\n\t\t}\n\t\t//We have to apply limit check after callback has been called\n\t\t//to account for rows that are not in the current users channels\n\t\tif resultsOpts.Limit > 0 && count == resultsOpts.Limit {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "23b0bb222cc246d506b439ea1cc545f6", "score": "0.50723416", "text": "func (d *DB) QueryIter(ctx context.Context, statement string, fields []string, args ...interface{}) (connection.ResultFetchIter, error) {\n\tvar rows pgx.Rows\n\tvar err error\n\tvar connQ func(context.Context, string, ...interface{}) (pgx.Rows, error)\n\tif d.tx != nil {\n\t\tconnQ = d.tx.Query\n\t} else if d.conn != nil {\n\t\tconnQ = d.conn.Query\n\t} else {\n\t\treturn nil, gaumErrors.NoDB\n\t}\n\n\tif len(args) != 0 {\n\t\trows, err = connQ(ctx, statement, args...)\n\t} else {\n\t\trows, err = connQ(ctx, statement)\n\t}\n\tif err != nil {\n\t\treturn func(interface{}) (bool, func(), error) { return false, func() {}, nil },\n\t\t\terrors.Wrap(err, \"querying database\")\n\t}\n\n\tvar fieldMap map[string]reflect.StructField\n\tvar typeName string\n\tif !rows.Next() {\n\t\treturn func(interface{}) (bool, func(), error) { return false, func() {}, nil },\n\t\t\tsql.ErrNoRows\n\t}\n\tif len(fields) == 0 || (len(fields) == 1 && fields[0] == \"*\") {\n\t\t// This seems to make a query each time so perhaps it goes outside.\n\t\tsqlQueryfields := rows.FieldDescriptions()\n\t\tfields = make([]string, len(sqlQueryfields), len(sqlQueryfields))\n\t\tfor i, v := range sqlQueryfields {\n\t\t\tfields[i] = string(v.Name)\n\t\t}\n\t}\n\treturn func(destination interface{}) (bool, func(), error) {\n\t\tvar err error\n\t\tif reflect.TypeOf(destination).Elem().Name() != typeName {\n\t\t\ttypeName, fieldMap, err = srm.MapFromPtrType(destination, []reflect.Kind{}, []reflect.Kind{\n\t\t\t\treflect.Map, reflect.Slice,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tdefer rows.Close()\n\t\t\t\treturn false, func() {}, errors.Wrapf(err, \"cant fetch data into %T\", destination)\n\t\t\t}\n\t\t}\n\t\tfieldRecipients := srm.FieldRecipientsFromType(d.logger, fields, fieldMap, destination)\n\n\t\terr = rows.Scan(fieldRecipients...)\n\t\tif err != nil {\n\t\t\tdefer rows.Close()\n\t\t\treturn false, func() {}, errors.Wrap(err,\n\t\t\t\t\"scanning values into recipient, connection was closed\")\n\t\t}\n\n\t\treturn rows.Next(), rows.Close, rows.Err()\n\t}, nil\n}", "title": "" }, { "docid": "2e5ebd04e9e86c2a78f40e669cbec273", "score": "0.5071227", "text": "func (a *Database) GetAll(bucket string) (vals [][]byte, err error) {\r\n\tvals = [][]byte{}\r\n\r\n\ta.BoltDatabase.View(func(tx *bolt.Tx) error {\r\n\t\tb := tx.Bucket([]byte(bucket))\r\n\t\tb.ForEach(func(k, v []byte) error {\r\n\t\t\tvals = append(vals, v)\r\n\t\t\treturn nil\r\n\t\t})\r\n\t\treturn nil\r\n\t})\r\n\r\n\treturn\r\n}", "title": "" }, { "docid": "172362f863c487a8f14a3bdd6bdc1a6e", "score": "0.507073", "text": "func getDetailFromDatabase()([]dat.MovieVM,error){\n\n db,err,_:=sqlservice.DbConn()\n if err !=nil {\n log.Fatal(com.GetErrorDescription(\"ERR001\"))\n }\n var movies []ent.MovieMovies\n var movievm []dat.MovieVM\n err=db.Preload(\"Language\").\n Preload(\"Director\").\n Preload(\"MoveType\").\n Preload(\"Genere\").\n Preload(\"Actors\").\n Preload(\"Actors.Actor\").\n Order(\"price asc\").Find(&movies).Error\n if err != nil{\n log.Fatal(com.GetErrorDescription(\"ERR004\"))\n }\n for i := range movies {\n results := GetMovie(movies[i],db)\n for ch :=range results{\n movievm=append(movievm,ch)\n }\n fmt.Println(movies[i].Language.Language)\n }\n return movievm,nil\n}", "title": "" }, { "docid": "e11f8fb920e88afb815cdbfb5ac11f9d", "score": "0.5070176", "text": "func (this *Testservice1_ServerStreamSelectIter) Each(fun func(*Testservice1_ServerStreamSelectRow) error) error {\n\tfor {\n\t\tselect {\n\t\tcase <-this.ctx.Done():\n\t\t\treturn this.ctx.Err()\n\t\tdefault:\n\t\t\tif row, ok := this.Next(); !ok {\n\t\t\t\treturn nil\n\t\t\t} else if err := fun(row); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "34dfd4e02f6fbb97dc24215a76a97e54", "score": "0.5064012", "text": "func (s *Store) All(callback func(key, value []byte) error) error {\n\treturn s.db.View(func(txn *bolt.Tx) error {\n\t\tbucket, err := s.fetchBucket(txn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn bucket.ForEach(callback)\n\t})\n}", "title": "" }, { "docid": "0ff58842c1f85f5475172c0af9355096", "score": "0.5057636", "text": "func (*ItemDb) List(user config.UserId, lastTimestamp int64) ([]OutputItem, error) {\n\tdb := config.GetDatabaseInstance()\n\n\tsql := fmt.Sprintf(`\nSELECT \n\tid, \n\tuserid, \n\tbase.record AS baserecord,\n\tprefix.record as prefixrecord, \n\tsuffix.record as suffixrecord, \n\tmodifier.record as modifierrecord, \n\trelic.record as reliccompletionbonusrecord,\n\ttransmute.record as transmuterecord, \n\tmateria.record as materiarecord, \n\tenchantment.record as enchantmentrecord, \n\tseed, \n\trelicseed, \n\tprefixrarity, \n\tunknown, \n\tenchantmentseed, \n\tmateriacombines, \n\tstackcount, \n\tname, \n\tnamelowercase, \n\trarity, \n\tlevelrequirement, \n\t%s, \n\tishardcore, \n\tcreated_at, \n\tts\n FROM item i\n LEFT JOIN records as base ON i.id_baserecord = base.id_record\n LEFT JOIN records as prefix ON i.id_prefixrecord = prefix.id_record\n LEFT JOIN records AS suffix ON i.id_suffixrecord = suffix.id_record\n LEFT JOIN records AS modifier ON i.id_modifierrecord = modifier.id_record\n LEFT JOIN records AS transmute ON i.id_transmuterecord = transmute.id_record\n LEFT JOIN records AS materia ON i.id_materiarecord = materia.id_record\n LEFT JOIN records AS relic ON i.id_reliccompletionbonusrecord = relic.id_record\n LEFT JOIN records AS enchantment ON i.id_enchantmentrecord = enchantment.id_record\n WHERE userid = ? AND ts > ?\n ORDER BY ts ASC\n LIMIT ?\n `, \"`mod`\")\n\tvar items = make([]OutputItem, 0)\n\trows, err := db.Raw(sql, user, lastTimestamp, MaxItemLimit).Rows()\n\tdefer rows.Close()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar item OutputItem\n\tfor rows.Next() {\n\t\tif err = db.ScanRows(rows, &item); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\titems = append(items, item)\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "4c2137f724de003a33e8197c38534a23", "score": "0.50483257", "text": "func (*server) List(req *model.ListReq, stream model.DBService_ListServer) error {\n\tcursor, err := collections.Find(context.Background(), bson.D{})\n\tdefer cursor.Close(context.Background())\n\n\tif err != nil {\n\t\tmsgErr := status.Errorf(codes.Unavailable, \"Failed connect to collections\")\n\t\treturn msgErr\n\t}\n\n\tfor cursor.Next(context.Background()) {\n\t\tdata := &dataItem{}\n\t\terr := cursor.Decode(data)\n\n\t\tif err != nil {\n\t\t\terrMsg := status.Errorf(codes.OutOfRange, \"Failed read data from mongodb\")\n\t\t\treturn errMsg\n\t\t}\n\n\t\tresp := &model.ListResp{\n\t\t\tDb: &model.Database{\n\t\t\t\tId: data.ID.Hex(),\n\t\t\t\tAuthor: data.Author,\n\t\t\t\tAppsname: data.AppsName,\n\t\t\t\tLanguage: data.Language,\n\t\t\t},\n\t\t}\n\n\t\tfmt.Println(resp)\n\t\terr = stream.Send(resp)\n\n\t\ttime.Sleep(1 * time.Second)\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a26fa009f3e64909a8c5a818582361de", "score": "0.5046866", "text": "func (b *GetDialogsQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error {\n\titer := b.Iter()\n\tfor iter.Next(ctx) {\n\t\tif err := cb(ctx, iter.Value()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn iter.Err()\n}", "title": "" }, { "docid": "0e0a30b9113c12b1ac463264396d1196", "score": "0.50424933", "text": "func IterateObjects[Object any](ctx context.Context, f func(repo *Object) error) error {\n\tvar start int\n\tbatchSize := setting.Database.IterateBufferSize\n\tsess := GetEngine(ctx)\n\tfor {\n\t\trepos := make([]*Object, 0, batchSize)\n\t\tif err := sess.Limit(batchSize, start).Find(&repos); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(repos) == 0 {\n\t\t\treturn nil\n\t\t}\n\t\tstart += len(repos)\n\n\t\tfor _, repo := range repos {\n\t\t\tif err := f(repo); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6b151902282594e70ff28eda987e405f", "score": "0.50064033", "text": "func GetAll(db *SellingRepository) []models.Selling { // modelSelling ==> nama file di folder model\n\tfmt.Println(db.DB)\n\n\tresult, err := db.DB.Query(\"Select Invoice, InvoiceDate, Item, Total, Paid, Returned, OfficeCode FROM tblSelling\")\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tdefer result.Close()\n\tfmt.Println(result)\n\tselling := []models.Selling{}\n\tfor result.Next() {\n\t\tvar p models.Selling\n\t\tif err := result.Scan(&p.Invoice, &p.InvoiceDate, &p.Item, &p.Total, &p.Paid, &p.Returned, &p.OfficeCode); err != nil {\n\t\t\tfmt.Println(\"petugasCanceError\")\n\t\t\tfmt.Println(err)\n\t\t\treturn nil\n\t\t}\n\t\tselling = append(selling, p)\n\t}\n\treturn selling\n}", "title": "" }, { "docid": "4dcab7ab06988a53ef072fe3d94de9ef", "score": "0.50036484", "text": "func (s *TxStoreBase) Iterate(query Query, fn IterateFn) error {\n\tif err := s.IsDone(); err != nil {\n\t\treturn err\n\t}\n\treturn s.BatchedStore.Iterate(query, fn)\n}", "title": "" }, { "docid": "8436a0c3df1a5dbd9af8d8254d582c0e", "score": "0.50016916", "text": "func (l *LimitedTx) ForEach(fn func(name []byte, b *bolt.Bucket) error) error {\n\treturn l.tx.ForEach(fn)\n}", "title": "" }, { "docid": "ef0424cd6039f217eaf66020cdfa2b79", "score": "0.5001193", "text": "func (db *DB) Close() {\n\tfor _, c := range db.cs {\n\t\tc.close()\n\t}\n}", "title": "" }, { "docid": "a79658607a4afe9660e0a37dd6d623de", "score": "0.49929842", "text": "func Foreach(ctx context.Context, f func(string, interface{}, int64) bool) Gache {\n\treturn instance.Foreach(ctx, f)\n}", "title": "" }, { "docid": "b8cdbf09207cfe0e889e89ea4ef2901f", "score": "0.49929303", "text": "func (r *ReleaseNoteLabel) EachLoop() error { return nil }", "title": "" }, { "docid": "8badf330244ed978eaeb08358e01d95d", "score": "0.49775496", "text": "func (dataCollection *DataCollection) getAll(vm *duktape.Context) (result int) {\n\tlogger.Debug(\"Entering DataCollection.getAll\", vm)\n\tdefer func() { logger.Debug(\"Exiting DataCollection.getAll\", result) }()\n\n\t// Validate the arguments from JavaScript.\n\tvm.RequireFunction(0)\n\n\t// Create the composite key.\n\t// The objects are stored with composite keys of collectionID + objectID.\n\titerator, err := dataCollection.Stub.GetStateByPartialCompositeKey(dataCollection.CollectionID, []string{})\n\tif err != nil {\n\t\tvm.Dup(0)\n\t\tvm.PushErrorObjectVa(duktape.ErrError, \"%s\", err.Error())\n\t\tif vm.Pcall(1) == duktape.ExecError {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn 0\n\t}\n\n\t// Must close iterator to free resources.\n\tdefer iterator.Close()\n\n\t// Iterate over all the keys returned by the partial query above.\n\tarrIdx := vm.PushArray()\n\tarrCount := uint(0)\n\tfor iterator.HasNext() {\n\n\t\t// Read the current key and value.\n\t\t_, value, err := iterator.Next()\n\t\t// kv, err := iterator.Next()\n\t\tif err != nil {\n\t\t\tvm.Dup(0)\n\t\t\tvm.PushErrorObjectVa(duktape.ErrError, \"%s\", err.Error())\n\t\t\tif vm.Pcall(1) == duktape.ExecError {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\treturn 0\n\t\t}\n\n\t\t// Parse the current value.\n\t\tvm.PushString(string(value))\n\t\t// vm.PushString(string(kv.Value))\n\t\tvm.JsonDecode(-1)\n\t\tvm.PutPropIndex(arrIdx, arrCount)\n\t\tarrCount++\n\n\t}\n\n\t// Call the callback.\n\tvm.Dup(0)\n\tvm.PushNull()\n\tvm.Dup(arrIdx)\n\tvm.Pcall(2)\n\treturn 0\n}", "title": "" }, { "docid": "df12ae041d062a0ee0d616a3e4c16643", "score": "0.4965881", "text": "func (self *syncDb) dbRead(useBatches bool, counter uint64, fun func(interface{}, chan bool) bool) {\n\tkey := make([]byte, 42)\n\tcopy(key, self.start)\n\tbinary.BigEndian.PutUint64(key[34:], counter)\n\tvar batches, n, cnt, total int\n\tvar more bool\n\tvar entry *syncDbEntry\n\tvar it iterator.Iterator\n\tvar del *leveldb.Batch\n\tbatchSizes := make(chan int)\n\n\tfor {\n\t\t// if useBatches is false, cnt is not set\n\t\tif useBatches {\n\t\t\t// this could be called before all cnt items sent out\n\t\t\t// so that loop is not blocking while delivering\n\t\t\t// only relevant if cnt is large\n\t\t\tselect {\n\t\t\tcase self.batch <- batchSizes:\n\t\t\tcase <-self.quit:\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// wait for the write to finish and get the item count in the next batch\n\t\t\tcnt = <-batchSizes\n\t\t\tbatches++\n\t\t\tif cnt == 0 {\n\t\t\t\t// empty\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tit = self.db.NewIterator()\n\t\tit.Seek(key)\n\t\tif !it.Valid() {\n\t\t\tcopy(key, self.start)\n\t\t\tuseBatches = true\n\t\t\tcontinue\n\t\t}\n\t\tdel = new(leveldb.Batch)\n\t\tlog.Trace(fmt.Sprintf(\"syncDb[%v/%v]: new iterator: %x (batch %v, count %v)\", self.key.Log(), self.priority, key, batches, cnt))\n\n\t\tfor n = 0; !useBatches || n < cnt; it.Next() {\n\t\t\tcopy(key, it.Key())\n\t\t\tif len(key) == 0 || key[0] != 0 {\n\t\t\t\tcopy(key, self.start)\n\t\t\t\tuseBatches = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tval := make([]byte, 40)\n\t\t\tcopy(val, it.Value())\n\t\t\tentry = &syncDbEntry{key, val}\n\t\t\t// log.Trace(fmt.Sprintf(\"syncDb[%v/%v] - %v, batches: %v, total: %v, session total from db: %v/%v\", self.key.Log(), self.priority, self.key.Log(), batches, total, self.dbTotal, self.total))\n\t\t\tmore = fun(entry, self.quit)\n\t\t\tif !more {\n\t\t\t\t// quit received when waiting to deliver entry, the entry will not be deleted\n\t\t\t\tlog.Trace(fmt.Sprintf(\"syncDb[%v/%v] batch %v quit after %v/%v items\", self.key.Log(), self.priority, batches, n, cnt))\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// since subsequent batches of the same db session are indexed incrementally\n\t\t\t// deleting earlier batches can be delayed and parallelised\n\t\t\t// this could be batch delete when db is idle (but added complexity esp when quitting)\n\t\t\tdel.Delete(key)\n\t\t\tn++\n\t\t\ttotal++\n\t\t}\n\t\tlog.Debug(fmt.Sprintf(\"syncDb[%v/%v] - db session closed, batches: %v, total: %v, session total from db: %v/%v\", self.key.Log(), self.priority, batches, total, self.dbTotal, self.total))\n\t\tself.db.Write(del) // this could be async called only when db is idle\n\t\tit.Release()\n\t}\n}", "title": "" }, { "docid": "ef09784211ebba2f44d5256456b609b1", "score": "0.49639416", "text": "func handleDB(pch <-chan canlib.ProcessedCanFrame, db canalyze.Database, context int) {\n for processedCan := range pch {\n err := db.AddProcessedFrame(processedCan, context)\n if err != nil {\n panic(err.Error())\n }\n }\n}", "title": "" }, { "docid": "090e33a5fa999d8437a288cf3356d605", "score": "0.49627575", "text": "func (cl *Client) Execute(qs []*Query) (err error) {\n\tfor _, q := range qs {\n\t\terr := cl.executeQuery(q)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7d8d7a902f0a45f2b4fad19099216ea", "score": "0.4961209", "text": "func (t *Transaction) ForEach(name string, fn func(k, v []byte) error) error {\n\t// Open a cursor on the bucket.\n\tc, err := t.Cursor(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Iterate over each key/value pair in the bucket.\n\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\tif err := fn(k, v); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "75fb71416d88eff7b85e97c793e62c9b", "score": "0.49594143", "text": "func (uos *UnspentOutputs) ForEach(callback ForEachKeyIteratorInterface) error {\n\treturn uos.DB.forEachInBucket(unspentTransactionsBucket, callback)\n}", "title": "" }, { "docid": "6f29e437b4b9dc31f388001044afa583", "score": "0.49525857", "text": "func (t *Tx) ForEach(fn func(k string, v *Bucket) error) error {\n return t.tx.ForEach( func(k []byte, b *bbolt.Bucket ) error {\n return fn( string(k[:]), &Bucket{tx: t, bucket: b} )\n } )\n}", "title": "" }, { "docid": "89850302a92af2eb1778a0594f6aa276", "score": "0.49483594", "text": "func (c *MongoCollection) ReadAll(result interface{}) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = errPanic\n\t\t}\n\t}()\n\treturn c.Database.FindAll(c.Collection, result)\n}", "title": "" }, { "docid": "887ec88682ed6f7130ef900dc0da2690", "score": "0.49480808", "text": "func (mongoQuery MongoQuery) GetAll() (interface{}, *fiber.Error) {\n\t//get a collection , context, cancel func\n\tcollection, ctx, cancel := createCtxAndUserCol(mongoQuery.CollectionName)\n\tdefer cancel()\n\n\t//create an empty array to store all fields from collection\n\tvar data []bson.M\n\n\t//get all user record\n\tcur, err := collection.Find(ctx, bson.D{})\n\tif err != nil {\n\t\treturn nil, fiber.NewError(500, err.Error())\n\t}\n\tdefer cur.Close(ctx)\n\t//map data to user variable\n\tif err = cur.All(ctx, &data); err != nil {\n\t\treturn nil, fiber.NewError(500, err.Error())\n\t}\n\t//response data to client\n\tif data == nil {\n\t\treturn []bson.M{}, nil\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "87c6459a566ddc0095f0a46f95d94235", "score": "0.49425945", "text": "func (e *Eval) forStmt(obj objects.BlObject,\n binding string,\n block *interm.Node) int {\n typeobj := obj.BlType()\n if seq := typeobj.Sequence; seq != nil {\n if seq.SqItem != nil && seq.SqSize != nil {\n e.loopCount++\n siz := seq.SqSize(obj)\n var i int\n outer:\n for ; i < siz; i++ {\n // Bind the name => item.\n e.set(binding, seq.SqItem(obj, i))\n // Exec the code block.\n inner:\n for _, stmt := range block.Children {\n e.exec(stmt)\n switch e.diveoutSet() {\n case DIVEOUT_BREAK:\n break outer\n case DIVEOUT_CONTINUE:\n break inner\n }\n }\n }\n e.loopCount--\n return 0\n }\n }\n errpkg.SetErrmsg(\"'%s' object is not iterable\",\n typeobj.Name)\n return -1\n}", "title": "" }, { "docid": "49f80a77117074ed6421fdeb68ca87ca", "score": "0.49425244", "text": "func (a *attachmentCollection) iter(cb func(store.HeadTrackable)) {\n\ta.mutex.RLock()\n\tdefer a.mutex.RUnlock()\n\n\tfor _, id := range a.sortedIDs {\n\t\tcb(a.trackables[id])\n\t}\n}", "title": "" }, { "docid": "67ab2eaebbe568c08cefea5ff70b0e10", "score": "0.4929756", "text": "func (ac *applyContext) writeToDB() {\n\tif err := ac.wb.WriteToDB(ac.engines.Kv); err != nil {\n\t\tpanic(err)\n\t}\n\tac.wb.Reset()\n\tfor _, cb := range ac.cbs {\n\t\tcb.invokeAll()\n\t}\n\tac.cbs = ac.cbs[:0]\n}", "title": "" }, { "docid": "52f9269d300e3727c878563c25b519df", "score": "0.4928464", "text": "func (it *Iterator) Next() {\n\tC.leveldb_iter_next(it.Iter)\n}", "title": "" }, { "docid": "f097433d94d93eb38afe0dbc76196d48", "score": "0.4926202", "text": "func ReadAll(c *gin.Context) {\n\t// Connection to the database\n\tdb := database.Conn()\n\t// Close connection database\n\tdefer db.Close()\n\n\tvar info []Infos\n\t// SELECT * FROM users\n\tdb.Find(&info)\n\n\t// Display JSON result\n\tc.JSON(200, info)\n\n}", "title": "" } ]
99d3c046540ecfe25df06a20ccc63b03
AgentemailHasPrefix applies the HasPrefix predicate on the "Agentemail" field.
[ { "docid": "04e66daa99b9262d81024228b61ce3f5", "score": "0.8820081", "text": "func AgentemailHasPrefix(v string) predicate.Agentkyc {\n\treturn predicate.Agentkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAgentemail), v))\n\t})\n}", "title": "" } ]
[ { "docid": "cf6102fe92945060d02a8766939ea450", "score": "0.7969244", "text": "func EmailHasPrefix(v string) predicate.Employee {\n\treturn predicate.Employee(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "e00e841f44493a73bc89516d281c0e03", "score": "0.78363556", "text": "func StaffEmailHasPrefix(v string) predicate.Staff {\n\treturn predicate.Staff(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldStaffEmail), v))\n\t})\n}", "title": "" }, { "docid": "ed1e54b3ebd5ff050365351961e5e00e", "score": "0.7730453", "text": "func EmailHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldEmail, v))\n}", "title": "" }, { "docid": "ed7cb3778f76be3589f009c546852a29", "score": "0.77290195", "text": "func EmailHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "c6a71f0a3948f01e70798f521756d45b", "score": "0.75363487", "text": "func AgentIDHasPrefix(v string) predicate.Agentkyc {\n\treturn predicate.Agentkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAgentID), v))\n\t})\n}", "title": "" }, { "docid": "f48f80b57a8d8cea07f5338189df4872", "score": "0.7233316", "text": "func AddressHasPrefix(v string) predicate.Receipt {\n\treturn predicate.Receipt(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "115fad022c0c06e3780e9f493de20add", "score": "0.72267765", "text": "func AgentTypeHasPrefix(v string) predicate.Agentkyc {\n\treturn predicate.Agentkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAgentType), v))\n\t})\n}", "title": "" }, { "docid": "007153e7e971217ecf911a50c33245d3", "score": "0.7031349", "text": "func HnHasPrefix(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldHn), v))\n\t})\n}", "title": "" }, { "docid": "a300bda189072ecb5ae2fb9967e91aa6", "score": "0.69308174", "text": "func AnnotationHasPrefix(v string) predicate.Courseclass {\n\treturn predicate.Courseclass(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAnnotation), v))\n\t})\n}", "title": "" }, { "docid": "94f114c35c850db10f5b0676d923833b", "score": "0.69239706", "text": "func AnnotationHasPrefix(v string) predicate.Prescription {\n\treturn predicate.Prescription(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAnnotation), v))\n\t})\n}", "title": "" }, { "docid": "2c8179cb9aa16860723930cbffb15624", "score": "0.6900056", "text": "func NetworkAddressHasPrefix(v string) predicate.IPStaticRoutingTable {\n\treturn predicate.IPStaticRoutingTable(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldNetworkAddress), v))\n\t})\n}", "title": "" }, { "docid": "535feaa57c00a84559514647cadd720c", "score": "0.6873541", "text": "func AlarmURLHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldAlarmURL, v))\n}", "title": "" }, { "docid": "050f7f0c62b2f3869a244f533df77166", "score": "0.68650395", "text": "func TestHasPrefix(t *testing.T) {\n\ta := assert.New(t)\n\n\tvar testData = []struct {\n\t\tin string\n\t\tout string\n\t}{\n\t\t{\"www.google.com\", \"http://www.google.com\"},\n\t\t{\"http://www.google.com\", \"http://www.google.com\"},\n\t\t{\"ftp://www.google.com\", \"ftp://www.google.com\"},\n\t\t{\"blah://www.google.com\", \"blah://www.google.com\"},\n\t\t{\"http://somesite.net\", \"http://somesite.net\"},\n\t\t{\"somesite.net\", \"http://somesite.net\"},\n\t}\n\n\tfor _, td := range testData {\n\t\tr, err := EnsurePrefix(td.in)\n\t\ta.NoError(err)\n\t\ta.Equal(td.out, r)\n\t}\n}", "title": "" }, { "docid": "6f197a6f885a9a833b93447b5488c463", "score": "0.68507785", "text": "func AgentNameLastnameHasPrefix(v string) predicate.Agentkyc {\n\treturn predicate.Agentkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAgentNameLastname), v))\n\t})\n}", "title": "" }, { "docid": "235b6a893991926000fa098819467537", "score": "0.6833342", "text": "func IdtenantHasPrefix(v string) predicate.Lease {\n\treturn predicate.Lease(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldIdtenant), v))\n\t})\n}", "title": "" }, { "docid": "9af5e757c8ff7336a32b59f8034d4056", "score": "0.68284935", "text": "func AvatarHasPrefix(v string) predicate.Customer {\n\treturn predicate.Customer(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAvatar), v))\n\t})\n}", "title": "" }, { "docid": "d7b1942224d280ffe2b80255b477b843", "score": "0.67780733", "text": "func AccountHasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAccount), v))\n\t})\n}", "title": "" }, { "docid": "b958a999293a67cb6f9fb9ad3ac92106", "score": "0.6765874", "text": "func IPAddressHasPrefix(v string) predicate.Operation {\n\treturn predicate.Operation(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldIPAddress), v))\n\t})\n}", "title": "" }, { "docid": "3b7fe72d01549cb4e5c9e479ebd9af33", "score": "0.67429215", "text": "func KYCRespondHasPrefix(v string) predicate.Agentkyc {\n\treturn predicate.Agentkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldKYCRespond), v))\n\t})\n}", "title": "" }, { "docid": "ee41a7fc159914e25b42f6c3c60a9d03", "score": "0.67379504", "text": "func PatientPrefixHasPrefix(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPatientPrefix), v))\n\t})\n}", "title": "" }, { "docid": "9d6ebaa70d10e645f9f4e08bba42b011", "score": "0.6728079", "text": "func AccountHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldAccount, v))\n}", "title": "" }, { "docid": "f2244a8eaa5b5fa38dbde68cd4cc2d3a", "score": "0.6720479", "text": "func OptStrHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldOptStr), v))\n\t})\n}", "title": "" }, { "docid": "9b8dbf2506669690d66ab3deddaef1c4", "score": "0.6712922", "text": "func Oa2FakeHasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldOa2Fake), v))\n\t})\n}", "title": "" }, { "docid": "8967feb451c8d83b50c1e76e07b8e6de", "score": "0.6702195", "text": "func DOPARespondHasPrefix(v string) predicate.Agentkyc {\n\treturn predicate.Agentkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldDOPARespond), v))\n\t})\n}", "title": "" }, { "docid": "54aa24d879bf0b0c83c6c7255b45161a", "score": "0.67017126", "text": "func CountryHasPrefix(v string) predicate.EntityAddress {\n\treturn predicate.EntityAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldCountry), v))\n\t})\n}", "title": "" }, { "docid": "4ae666625bf2df30821b42e785b0e61c", "score": "0.6699049", "text": "func PostalCodeHasPrefix(v string) predicate.EntityAddress {\n\treturn predicate.EntityAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPostalCode), v))\n\t})\n}", "title": "" }, { "docid": "f3ae04522d0c09f2b0fab10da4a185e7", "score": "0.6687757", "text": "func RegisterAddressHasPrefix(v string) predicate.Register {\n\treturn predicate.Register(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldRegisterAddress), v))\n\t})\n}", "title": "" }, { "docid": "38bf9a4ea8eaae780aaa412ac92125ee", "score": "0.6686799", "text": "func ReceiptcodeHasPrefix(v string) predicate.Receipt {\n\treturn predicate.Receipt(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldReceiptcode), v))\n\t})\n}", "title": "" }, { "docid": "35384fa24058b0ad217354779e2c89e3", "score": "0.6684888", "text": "func MobileKeyHasPrefix(v string) predicate.CheckIn {\n\treturn predicate.CheckIn(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldMobileKey), v))\n\t})\n}", "title": "" }, { "docid": "c4d11a355e3c5d65cdccff2f417c33bf", "score": "0.66671187", "text": "func ConsumerwalletidHasPrefix(v string) predicate.Agentkyc {\n\treturn predicate.Agentkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldConsumerwalletid), v))\n\t})\n}", "title": "" }, { "docid": "7589b589a6db2897ee34696aef6351e2", "score": "0.66469127", "text": "func PhoneHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "1febdb4d78fbf269055c832a29de878d", "score": "0.664149", "text": "func FacebookHasPrefix(v string) predicate.FixRoom {\n\treturn predicate.FixRoom(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldFacebook), v))\n\t})\n}", "title": "" }, { "docid": "256c4b9dba6f742a01cf21c5c9ebce57", "score": "0.6631424", "text": "func PasswordSaltHasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPasswordSalt), v))\n\t})\n}", "title": "" }, { "docid": "8901cd034ac6bf80168b91d3576daac3", "score": "0.6621238", "text": "func UIDHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldUID), v))\n\t})\n}", "title": "" }, { "docid": "e828dce98968abe59f708b61c449a801", "score": "0.66204447", "text": "func SymptomHasPrefix(v string) predicate.Prescription {\n\treturn predicate.Prescription(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldSymptom), v))\n\t})\n}", "title": "" }, { "docid": "1ad7af19f17d6f0d19ad80ffb33ba4a3", "score": "0.660318", "text": "func PhoneHasPrefix(v string) predicate.Customer {\n\treturn predicate.Customer(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "185371fc2de9f7fdcd1b512589322cd3", "score": "0.6595362", "text": "func strHasPrefix(L *LState) int {\n\tstr := L.CheckString(1)\n\tprefix := L.CheckString(2)\n\tL.Push(LBool(strings.HasPrefix(str, prefix)))\n\treturn 1\n}", "title": "" }, { "docid": "d2d51d863aa6d795e243ee08fa0f5b56", "score": "0.65580213", "text": "func NextHopHasPrefix(v string) predicate.IPStaticRoutingTable {\n\treturn predicate.IPStaticRoutingTable(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldNextHop), v))\n\t})\n}", "title": "" }, { "docid": "6e00ebfc4fd4a6aaa66127757224a152", "score": "0.65466547", "text": "func AccountReferenceHasPrefix(v string) predicate.Loanbinding {\n\treturn predicate.Loanbinding(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAccountReference), v))\n\t})\n}", "title": "" }, { "docid": "8496fcd2af11c1f90eb1ddda51670b20", "score": "0.6546346", "text": "func MemoHasPrefix(v string) predicate.Sample {\n\treturn predicate.Sample(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldMemo), v))\n\t})\n}", "title": "" }, { "docid": "6593e6a2d7f4645369d64071e6b85098", "score": "0.65395916", "text": "func LocationHasPrefix(v string) predicate.Sensor {\n\treturn predicate.Sensor(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldLocation), v))\n\t})\n}", "title": "" }, { "docid": "9844ed6bde70ff4019729144b4c981cb", "score": "0.6539413", "text": "func MEMBERNAMEHasPrefix(v string) predicate.Member {\n\treturn predicate.Member(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldMEMBERNAME), v))\n\t})\n}", "title": "" }, { "docid": "287d884784dc59f4c7549dafc12bba6f", "score": "0.6518039", "text": "func HostHasPrefix(v string) predicate.DNSDetectorResult {\n\treturn predicate.DNSDetectorResult(sql.FieldHasPrefix(FieldHost, v))\n}", "title": "" }, { "docid": "1545b78a6535cd1ced2837a546f2fe2d", "score": "0.6514604", "text": "func FirstNameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldFirstName), v))\n\t})\n}", "title": "" }, { "docid": "77c2127413cb43dee2d65f1ee2e48f02", "score": "0.65098643", "text": "func HashHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldHash), v))\n\t})\n}", "title": "" }, { "docid": "8e0b7bc19dfc4fff5df4e8a2eb30987e", "score": "0.65062475", "text": "func ContentHasPrefix(v string) predicate.Request {\n\treturn predicate.Request(sql.FieldHasPrefix(FieldContent, v))\n}", "title": "" }, { "docid": "5e45d537e25dec1b324c5503f9c1de9c", "score": "0.65027857", "text": "func PasswordHasPrefix(v string) predicate.Employee {\n\treturn predicate.Employee(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPassword), v))\n\t})\n}", "title": "" }, { "docid": "e3848638e0c0aa5ce0a8bb9e1f8cab92", "score": "0.6486942", "text": "func ChHasPrefix(v string) predicate.Character {\n\treturn predicate.Character(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldCh), v))\n\t})\n}", "title": "" }, { "docid": "8ab1923814807703c3732395dc154d81", "score": "0.64685595", "text": "func DeviceHostnameHasPrefix(v string) predicate.Device {\n\treturn predicate.Device(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldDeviceHostname), v))\n\t})\n}", "title": "" }, { "docid": "f72f00bcbd5e5156c5894fd70ada153a", "score": "0.64679945", "text": "func GroupHasPrefix(v string) predicate.File {\n\treturn predicate.File(sql.FieldHasPrefix(FieldGroup, v))\n}", "title": "" }, { "docid": "db0d0810facc66e1e2cf32a99e53fe87", "score": "0.6465022", "text": "func KangxiHasPrefix(v string) predicate.Character {\n\treturn predicate.Character(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldKangxi), v))\n\t})\n}", "title": "" }, { "docid": "4dc2c2d59262e88702140c72b76e080c", "score": "0.6456795", "text": "func GNameHasPrefix(v string) predicate.Groups {\n\treturn predicate.Groups(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldGName), v))\n\t})\n}", "title": "" }, { "docid": "e946d7c669570aa01c912dd4878289b7", "score": "0.6449583", "text": "func TelHasPrefix(v string) predicate.Employee {\n\treturn predicate.Employee(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldTel), v))\n\t})\n}", "title": "" }, { "docid": "eee877c7b62f0199a7f40e85d4746646", "score": "0.64490175", "text": "func SaltHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldSalt), v))\n\t})\n}", "title": "" }, { "docid": "d6cea85fcb3b1ea059bbf36ebbf812e3", "score": "0.64466906", "text": "func TenantHasPrefix(v string) predicate.Lease {\n\treturn predicate.Lease(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "4d090edcd3cbdec2d4b1dc408640be25", "score": "0.6443237", "text": "func StaffPasswordHasPrefix(v string) predicate.Staff {\n\treturn predicate.Staff(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldStaffPassword), v))\n\t})\n}", "title": "" }, { "docid": "873beaa8d32028557158dcffe8f0bda4", "score": "0.644024", "text": "func NumbtenantHasPrefix(v string) predicate.Lease {\n\treturn predicate.Lease(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldNumbtenant), v))\n\t})\n}", "title": "" }, { "docid": "3982efa3435b535ea7864c0924b98888", "score": "0.6428173", "text": "func TagHasPrefix(v string) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldTag), v))\n\t})\n}", "title": "" }, { "docid": "cef5c28a6a49093411362de37be1547d", "score": "0.64258385", "text": "func String2HasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldString2), v))\n\t})\n}", "title": "" }, { "docid": "cacabf4fe6282bc707750dee015a631c", "score": "0.6421461", "text": "func WechatOpenidHasPrefix(v string) predicate.Customer {\n\treturn predicate.Customer(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldWechatOpenid), v))\n\t})\n}", "title": "" }, { "docid": "a55d76926f9864449fbfd9f9a0f3f20b", "score": "0.64151317", "text": "func DisplayNameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldDisplayName), v))\n\t})\n}", "title": "" }, { "docid": "79ca13f000a9b1fea4ddb793b0ef28d3", "score": "0.6407698", "text": "func NameHasPrefix(v string) predicate.Group {\n\treturn predicate.Group(func(t *dsl.Traversal) {\n\t\tt.Has(Label, FieldName, p.StartingWith(v))\n\t})\n}", "title": "" }, { "docid": "b37a57c1ec7e75d8ee46d91508c53402", "score": "0.6369067", "text": "func AccountKidHasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAccountKid), v))\n\t})\n}", "title": "" }, { "docid": "cfb3fdf60a91627904ea9a6564ad2a00", "score": "0.63680476", "text": "func NameHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldName, v))\n}", "title": "" }, { "docid": "1c74c3acf0468dfa4312b487e75a0829", "score": "0.63672113", "text": "func DeviceUsernameHasPrefix(v string) predicate.Device {\n\treturn predicate.Device(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldDeviceUsername), v))\n\t})\n}", "title": "" }, { "docid": "8c97433d3b9712de9fb18706e5a2bda0", "score": "0.63671535", "text": "func NoteLBHasPrefix(v string) predicate.Pointpendinglbtransaction {\n\treturn predicate.Pointpendinglbtransaction(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldNoteLB), v))\n\t})\n}", "title": "" }, { "docid": "681d8e075b9dd2b09f73c76603c8be07", "score": "0.636706", "text": "func StaffNameHasPrefix(v string) predicate.Staff {\n\treturn predicate.Staff(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldStaffName), v))\n\t})\n}", "title": "" }, { "docid": "94e4bf24c5aa727e1b6fd8e81e147103", "score": "0.6365732", "text": "func UsernameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldUsername), v))\n\t})\n}", "title": "" }, { "docid": "deab660ae595e0b31c8dfa14379e29b0", "score": "0.63638", "text": "func PhoneNumberHasPrefix(v string) predicate.FixRoom {\n\treturn predicate.FixRoom(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPhoneNumber), v))\n\t})\n}", "title": "" }, { "docid": "49c9cf839279eb424ce043e880dc8f92", "score": "0.63471097", "text": "func EmployeeNameHasPrefix(v string) predicate.Employee {\n\treturn predicate.Employee(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldEmployeeName), v))\n\t})\n}", "title": "" }, { "docid": "b17b0dcafdd1d9090cfd1bb8839c620e", "score": "0.6338944", "text": "func InterfaceNameHasPrefix(v string) predicate.NetInterface {\n\treturn predicate.NetInterface(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldInterfaceName), v))\n\t})\n}", "title": "" }, { "docid": "a975e72d542ecdca9b121c62c1b8c371", "score": "0.6330121", "text": "func TasteHasPrefix(v string) predicate.Taste {\n\treturn predicate.Taste(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldTaste), v))\n\t})\n}", "title": "" }, { "docid": "7f0162200ae03a7ca30c74efa8c084ed", "score": "0.63255364", "text": "func MiniOpenidHasPrefix(v string) predicate.Customer {\n\treturn predicate.Customer(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldMiniOpenid), v))\n\t})\n}", "title": "" }, { "docid": "77836e5a7518e56c2847496be1baf6c6", "score": "0.63155675", "text": "func PidHasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPid), v))\n\t})\n}", "title": "" }, { "docid": "b99665488a226fbb47b913f1e2faeea6", "score": "0.62985396", "text": "func PhoneNumberHasPrefix(v string) predicate.CheckIn {\n\treturn predicate.CheckIn(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPhoneNumber), v))\n\t})\n}", "title": "" }, { "docid": "2a61e7c1539c422b5c4e34e1900d51f5", "score": "0.6286971", "text": "func withPrefix(pfx string) func(string) bool {\n\treturn func(link string) bool {\n\t\treturn strings.HasPrefix(link, pfx)\n\t}\n}", "title": "" }, { "docid": "56de66b49202152d7e6d28293e40ad66", "score": "0.62832546", "text": "func PasswordHasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPassword), v))\n\t})\n}", "title": "" }, { "docid": "9e3fdc6036c088c7a45e6767d7acb81a", "score": "0.62827283", "text": "func DoctorsurnameHasPrefix(v string) predicate.Doctorinfo {\n\treturn predicate.Doctorinfo(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldDoctorsurname), v))\n\t})\n}", "title": "" }, { "docid": "ab283cd380767d760336d93e49a7eb2b", "score": "0.6266779", "text": "func AccountTypHasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAccountTyp), v))\n\t})\n}", "title": "" }, { "docid": "693eb2e0544efdbc5ba175f919f75fff", "score": "0.6263342", "text": "func CityHasPrefix(v string) predicate.EntityAddress {\n\treturn predicate.EntityAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "db243b5d7f771428cb2a4baa1550604b", "score": "0.62612015", "text": "func LuckyHasPrefix(v string) predicate.Character {\n\treturn predicate.Character(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldLucky), v))\n\t})\n}", "title": "" }, { "docid": "8be1991796b9180c360b224c22cdb08a", "score": "0.6250548", "text": "func MEMBERIDHasPrefix(v string) predicate.Member {\n\treturn predicate.Member(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldMEMBERID), v))\n\t})\n}", "title": "" }, { "docid": "3b7eaa01fa5d54c98b003afd874b2290", "score": "0.62504256", "text": "func ProductnameHasPrefix(v string) predicate.Receipt {\n\treturn predicate.Receipt(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldProductname), v))\n\t})\n}", "title": "" }, { "docid": "d7477ae463dedc012eca814be424758b", "score": "0.6246363", "text": "func NameHasPrefix(v string) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "53ec6d74410edffc58c96579943e9344", "score": "0.6243538", "text": "func RepresentativeHasPrefix(v string) predicate.Wallet {\n\treturn predicate.Wallet(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldRepresentative), v))\n\t})\n}", "title": "" }, { "docid": "89d67beb499838566dabcbe5e0a095ec", "score": "0.6230778", "text": "func Auth0IDHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAuth0ID), v))\n\t})\n}", "title": "" }, { "docid": "fca1b9991426e2ae2f1e6308b6a122bd", "score": "0.6229039", "text": "func String1HasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldString1), v))\n\t})\n}", "title": "" }, { "docid": "7303589f8d4ad9c7151e0a8b42e24f17", "score": "0.6219609", "text": "func NameHasPrefix(v string) predicate.Entity {\n\treturn predicate.Entity(sql.FieldHasPrefix(FieldName, v))\n}", "title": "" }, { "docid": "38d21dc0bb18f74b96a62d0f1219461a", "score": "0.6218599", "text": "func SlugHasPrefix(v string) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldSlug), v))\n\t})\n}", "title": "" }, { "docid": "6e5b2de6120e3bfd8320bbad414e442a", "score": "0.62153727", "text": "func VerifyTypeHasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldVerifyType), v))\n\t})\n}", "title": "" }, { "docid": "c4e9c390564808fe458f076f687f67f9", "score": "0.6209766", "text": "func NameHasPrefix(v string) predicate.Template {\n\treturn predicate.Template(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "e677d71d654f6b22fb64625d1eb4ab37", "score": "0.6204668", "text": "func CallerDataHasPrefix(v string) predicate.InstanceRuntime {\n\treturn predicate.InstanceRuntime(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldCallerData), v))\n\t})\n}", "title": "" }, { "docid": "f10b57e4331b1324c23a14a353d1a873", "score": "0.6196329", "text": "func UserNameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldUserName), v))\n\t})\n}", "title": "" }, { "docid": "0c324c0302c524c609054734cf632530", "score": "0.6189548", "text": "func KYCDateHasPrefix(v string) predicate.Agentkyc {\n\treturn predicate.Agentkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldKYCDate), v))\n\t})\n}", "title": "" }, { "docid": "6695bed7d2523e8e5016aa4d177bfe82", "score": "0.61885786", "text": "func KYCTimeHasPrefix(v string) predicate.Agentkyc {\n\treturn predicate.Agentkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldKYCTime), v))\n\t})\n}", "title": "" }, { "docid": "d5aabb9c74f18bb9d95fa451cdbc566b", "score": "0.6185872", "text": "func PatientAgeHasPrefix(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPatientAge), v))\n\t})\n}", "title": "" }, { "docid": "bd3cebc608dc890b7f64e5c9f916541a", "score": "0.618435", "text": "func TemplateHasPrefix(v string) predicate.Template {\n\treturn predicate.Template(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldTemplate), v))\n\t})\n}", "title": "" }, { "docid": "b1caaeb8387f9c5ecb08a506124917db", "score": "0.61828625", "text": "func CarCodeHasPrefix(v string) predicate.District {\n\treturn predicate.District(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldCarCode), v))\n\t})\n}", "title": "" }, { "docid": "550e31ca01beb7a843cdd57f6dd0e486", "score": "0.61758095", "text": "func TelephonenumberHasPrefix(v string) predicate.Doctorinfo {\n\treturn predicate.Doctorinfo(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldTelephonenumber), v))\n\t})\n}", "title": "" }, { "docid": "7e70f642b29b0756517e1e3e622b5ef7", "score": "0.6170238", "text": "func RnameHasPrefix(v string) predicate.Room {\n\treturn predicate.Room(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldRname), v))\n\t})\n}", "title": "" } ]
9647b873210526979d097a3177472b54
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
[ { "docid": "7ae774737aa2862c4094728ce09ccec4", "score": "0.0", "text": "func (in *FileIntegrityConfig) DeepCopyInto(out *FileIntegrityConfig) {\n\t*out = *in\n}", "title": "" } ]
[ { "docid": "048b519d3e53b62f5b4bc1ff775f4ced", "score": "0.8202259", "text": "func (in *DeepCopyNonPtr) DeepCopyInto(out *DeepCopyNonPtr) {\n\t*out = in.DeepCopy()\n}", "title": "" }, { "docid": "fb2bc55c9644bc3872b478b5ab8d7aeb", "score": "0.81697565", "text": "func (in *Inner) DeepCopyInto(out *Inner) {\n\t*out = *in\n}", "title": "" }, { "docid": "333b67297f915fbee5d71b6723b8df18", "score": "0.81422216", "text": "func (in *Info) DeepCopyInto(out *Info) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4ea2f4990a9bb9f5d6f1b1c433545996", "score": "0.81188923", "text": "func (in *ModelArgReset) DeepCopyInto(out *ModelArgReset) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "96d1a99b123fa716566b1547c6bfe7a4", "score": "0.81035995", "text": "func (obj *LiteObject) DeepCopyInto(out *LiteObject) {\n\t*out = *obj\n\treturn\n}", "title": "" }, { "docid": "fd68cc5c404d65fa5c03c64949665da7", "score": "0.80897367", "text": "func (in *Size) DeepCopyInto(out *Size) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4e4ac2b7c08ccfa219135f2b5b252450", "score": "0.8087213", "text": "func (in *Struct) DeepCopyInto(out *Struct) {\n\t*out = *in\n}", "title": "" }, { "docid": "21a4dc0bd810e7ad7e5a1989d07e436c", "score": "0.80673146", "text": "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "title": "" }, { "docid": "04fac3bead17f8bd4b26c8360aacb580", "score": "0.8063649", "text": "func (in *BuildArg) DeepCopyInto(out *BuildArg) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "41475496763ae4276f7015dae332c81a", "score": "0.8058077", "text": "func (in *MX) DeepCopyInto(out *MX) {\n\t*out = *in\n}", "title": "" }, { "docid": "301de8be1b8a048ae01b54dbd4ec7aa8", "score": "0.8049101", "text": "func (in *BadDeepCopyNonPtrVal) DeepCopyInto(out *BadDeepCopyNonPtrVal) {\n\t*out = *in\n}", "title": "" }, { "docid": "009b9d06dd3a7a9ef7a22f9ad17d0c6f", "score": "0.80470526", "text": "func (in *InMemoryNodeBehaviour) DeepCopyInto(out *InMemoryNodeBehaviour) {\n\t*out = *in\n\tout.Provisioning = in.Provisioning\n}", "title": "" }, { "docid": "c8589014e3e027a9879b6e278ef45d69", "score": "0.8038561", "text": "func (in *InMemoryVMBehaviour) DeepCopyInto(out *InMemoryVMBehaviour) {\n\t*out = *in\n\tout.Provisioning = in.Provisioning\n}", "title": "" }, { "docid": "8348d262057586a69eb15a3f217f5d4a", "score": "0.8034583", "text": "func (in *OIDCTestOutput) DeepCopyInto(out *OIDCTestOutput) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9f8b8a23dcf73e6ba1910cae5ae70043", "score": "0.8034077", "text": "func (in *Value) DeepCopyInto(out *Value) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "684ea75f78edffb1a05bfdf42b6f1191", "score": "0.802035", "text": "func (in *CVSS) DeepCopyInto(out *CVSS) {\n\t*out = *in\n}", "title": "" }, { "docid": "092f9a09ed2586f4ce7cf6247a8fd452", "score": "0.8003537", "text": "func (in *Foo) DeepCopyInto(out *Foo) {\n\t*out = *in\n}", "title": "" }, { "docid": "24891879c3796e85357de6b6d3986a17", "score": "0.8001523", "text": "func (in *Empty) DeepCopyInto(out *Empty) {\n\t*out = *in\n}", "title": "" }, { "docid": "0e6b303fbadbc23c61dcee39495476b2", "score": "0.79985833", "text": "func (in *Interface) DeepCopyInto(out *Interface) {\n\t*out = *in\n}", "title": "" }, { "docid": "25d6f8a1ae7844ca27c7b513f87a921c", "score": "0.7996636", "text": "func (in *BadDeepCopyNoReturn) DeepCopyInto(out *BadDeepCopyNoReturn) {\n\t*out = *in\n}", "title": "" }, { "docid": "2fe17056672126433e92688bbc6c7532", "score": "0.7990644", "text": "func (in *GroupVersionForDiscovery) DeepCopyInto(out *GroupVersionForDiscovery) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "2fe17056672126433e92688bbc6c7532", "score": "0.7990644", "text": "func (in *GroupVersionForDiscovery) DeepCopyInto(out *GroupVersionForDiscovery) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "727fb0034d4fb617ed30df9887e7dc97", "score": "0.7990549", "text": "func (in *MongoDBVersionInitContainer) DeepCopyInto(out *MongoDBVersionInitContainer) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "720f714354a151aefd95f8d577d05159", "score": "0.7986762", "text": "func (in *DatabaseNode) DeepCopyInto(out *DatabaseNode) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "885731d95003e6f9b658d976bd38dfdc", "score": "0.7975989", "text": "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "885731d95003e6f9b658d976bd38dfdc", "score": "0.7975989", "text": "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "980fdef1bb7b3518843e5cde9e15cf96", "score": "0.7975752", "text": "func (in *SyscallFromSourceType) DeepCopyInto(out *SyscallFromSourceType) {\n\t*out = *in\n}", "title": "" }, { "docid": "b82493d02142c9938c5c7522f25a0f62", "score": "0.7972119", "text": "func (in *ExternalNode) DeepCopyInto(out *ExternalNode) {\n\t*out = *in\n}", "title": "" }, { "docid": "883e1692748cbc47dc1ea579a21b83cd", "score": "0.79713833", "text": "func (in *CommandAndArgs) DeepCopyInto(out *CommandAndArgs) {\n\t*out = *in\n\tif in.Command != nil {\n\t\tin, out := &in.Command, &out.Command\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79695636", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "f25f31a63ac38b2bdf2dd3d75c7198b7", "score": "0.7965354", "text": "func (in *Struct_Empty) DeepCopyInto(out *Struct_Empty) {\n\t*out = *in\n}", "title": "" }, { "docid": "a1257b8c0770e028b3129ab02b3a1911", "score": "0.79643905", "text": "func (in *TokenInfo) DeepCopyInto(out *TokenInfo) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "be82863d9978b104237d2472cfdf3614", "score": "0.79602563", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "d71a08ebbf7d7d2bc0c2ca3727a341a9", "score": "0.7954875", "text": "func (in *OCIContentID) DeepCopyInto(out *OCIContentID) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "91822354dc9c7c5522209b70c93931f1", "score": "0.7953985", "text": "func (in *InMemoryEtcdBehaviour) DeepCopyInto(out *InMemoryEtcdBehaviour) {\n\t*out = *in\n\tout.Provisioning = in.Provisioning\n}", "title": "" }, { "docid": "fa34b9e99dc2aa3d5c6d52b55d95ad90", "score": "0.795201", "text": "func (in *CephBackupSource) DeepCopyInto(out *CephBackupSource) {\n\t*out = *in\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7945754", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7945754", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7346345b0a2d608dba2995dc744da425", "score": "0.7943555", "text": "func (in *SomeStruct) DeepCopyInto(out *SomeStruct) {\n\t*out = *in\n}", "title": "" }, { "docid": "76b62ad159adac94ccfe3c31208085ec", "score": "0.7940948", "text": "func (in *BadDeepCopyIntoHasResult) DeepCopyInto(out *BadDeepCopyIntoHasResult) {\n\t*out = *in\n}", "title": "" }, { "docid": "a62d2491925276d66a89576351b7bdb4", "score": "0.7940367", "text": "func (in *Replicas) DeepCopyInto(out *Replicas) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4e89e189987c500586638a1efac2583d", "score": "0.79361534", "text": "func (in *ExportOutput) DeepCopyInto(out *ExportOutput) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "c98ffe01606a65bbc00e878445f7020d", "score": "0.7935412", "text": "func (in *TestBuiltins) DeepCopyInto(out *TestBuiltins) {\n\t*out = *in\n}", "title": "" }, { "docid": "01a4a6fa60275bc00731594653970844", "score": "0.793288", "text": "func (in *ObjectStorageTLSSpec) DeepCopyInto(out *ObjectStorageTLSSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "035c57e5b867d4ec15daf30d08d7d69e", "score": "0.7930392", "text": "func (in *GoRuntime) DeepCopyInto(out *GoRuntime) {\n\t*out = *in\n}", "title": "" }, { "docid": "9a15d89300bd7975c23b970cd7e97f3d", "score": "0.7928252", "text": "func (in *File) DeepCopyInto(out *File) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a9e1cd549f537d2c2cb2f2e1216d7225", "score": "0.79280424", "text": "func (in *PoolMirroringInfo) DeepCopyInto(out *PoolMirroringInfo) {\n\t*out = *in\n\tif in.Peers != nil {\n\t\tin, out := &in.Peers, &out.Peers\n\t\t*out = make([]PeersSpec, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "fbe65d613a92e723394102e79c892716", "score": "0.79195696", "text": "func (in *RootComponent) DeepCopyInto(out *RootComponent) {\n\t*out = *in\n}", "title": "" }, { "docid": "14b2f553637143403dbe2897add2909f", "score": "0.79188687", "text": "func (in *QueryParameter) DeepCopyInto(out *QueryParameter) {\n\t*out = *in\n}", "title": "" }, { "docid": "cdbdcac5268c93872566a1dbbf202b5d", "score": "0.7917624", "text": "func (in *CISBenchmarkResult) DeepCopyInto(out *CISBenchmarkResult) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "259a9547b7102244862bca671083e2c9", "score": "0.7916506", "text": "func (in *FabricInfo) DeepCopyInto(out *FabricInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "c9a56664a293f4158a6788eb506cc8cc", "score": "0.79161125", "text": "func (in *Selection) DeepCopyInto(out *Selection) {\n\t*out = *in\n\tif in.UseAllDevices != nil {\n\t\tin, out := &in.UseAllDevices, &out.UseAllDevices\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Devices != nil {\n\t\tin, out := &in.Devices, &out.Devices\n\t\t*out = make([]Device, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.VolumeClaimTemplates != nil {\n\t\tin, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates\n\t\t*out = make([]corev1.PersistentVolumeClaim, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6eb2a79b125d469ab0fe3abf20a19b8e", "score": "0.79125196", "text": "func (in *Delete) DeepCopyInto(out *Delete) {\n\t*out = *in\n}", "title": "" }, { "docid": "ade6ed73a501a383b2bb84cc3c832913", "score": "0.79082656", "text": "func (in *Struct_Primitives_Alias) DeepCopyInto(out *Struct_Primitives_Alias) {\n\t*out = *in\n}", "title": "" }, { "docid": "515c63092873c3f63bfdc531f088f552", "score": "0.7902317", "text": "func (in *Pull) DeepCopyInto(out *Pull) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "88b5329b28f6cf5edf471f0d6150c481", "score": "0.78990966", "text": "func (in *GithubConfigTestOutput) DeepCopyInto(out *GithubConfigTestOutput) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "765f173f5ddb0038fd7e0370a824e0f6", "score": "0.7898786", "text": "func (in *JenkinsFile) DeepCopyInto(out *JenkinsFile) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "eff0622caffaed25ba5e7aa86ed9abd3", "score": "0.7897443", "text": "func (in *ImageSourcePath) DeepCopyInto(out *ImageSourcePath) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "118ba62bc171ec4213ad230b73af2117", "score": "0.7897345", "text": "func (in *Struct_Primitives) DeepCopyInto(out *Struct_Primitives) {\n\t*out = *in\n}", "title": "" }, { "docid": "1f709093026f70cab533f03d4a5d6cf0", "score": "0.7897118", "text": "func (in *CephRestoreSource) DeepCopyInto(out *CephRestoreSource) {\n\t*out = *in\n}", "title": "" }, { "docid": "beef70b1916b67776c8e84225599dd8e", "score": "0.7895959", "text": "func (in *ImageDigest) DeepCopyInto(out *ImageDigest) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "d6832563794ae47600e6a6296fa86ecc", "score": "0.7895805", "text": "func (in *BuildOutput) DeepCopyInto(out *BuildOutput) {\n\t*out = *in\n\tif in.To != nil {\n\t\tin, out := &in.To, &out.To\n\t\t*out = new(corev1.ObjectReference)\n\t\t**out = **in\n\t}\n\tif in.PushSecret != nil {\n\t\tin, out := &in.PushSecret, &out.PushSecret\n\t\t*out = new(corev1.LocalObjectReference)\n\t\t**out = **in\n\t}\n\tif in.ImageLabels != nil {\n\t\tin, out := &in.ImageLabels, &out.ImageLabels\n\t\t*out = make([]ImageLabel, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a4bf692f8f6286e7819a448a72dcfad0", "score": "0.7895415", "text": "func (in *PhaseInfo) DeepCopyInto(out *PhaseInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "564805f323fbadde55f67e46f75ac865", "score": "0.7894315", "text": "func (in *Destination) DeepCopyInto(out *Destination) {\n\t*out = *in\n}", "title": "" }, { "docid": "06a3b3f38b6ff0617d4968300458ec9c", "score": "0.789431", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3dbac8b7d13838a94e731bbe00f460d5", "score": "0.7893283", "text": "func (in *OS) DeepCopyInto(out *OS) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a032549f561910a66098977e33380961", "score": "0.78928816", "text": "func (in *AllocatableModeling) DeepCopyInto(out *AllocatableModeling) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "09c4dcffa19a3bab59ed150ba5969941", "score": "0.78927106", "text": "func (in *Member) DeepCopyInto(out *Member) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "0bba3a2f1f7e5d69a617aaccc6d25c00", "score": "0.7891777", "text": "func (in *MongoDBVersionExporter) DeepCopyInto(out *MongoDBVersionExporter) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "23fa856144960771fdedc08d73a6334e", "score": "0.7891238", "text": "func (in *ProxySQLVersionProxysql) DeepCopyInto(out *ProxySQLVersionProxysql) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.7889831", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.7889831", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.7889831", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "54696db3f914ef5236271dad05b38ac8", "score": "0.7889451", "text": "func (in *BadDeepCopyIntoNoParams) DeepCopyInto(out *BadDeepCopyIntoNoParams) {\n\t*out = *in\n}", "title": "" }, { "docid": "153a99a016a77679a9b35b2afac0ce73", "score": "0.78857577", "text": "func (in *CloneFrom) DeepCopyInto(out *CloneFrom) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "23db226639df1ec5bfce6ed220d55ed3", "score": "0.7885264", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "title": "" }, { "docid": "31bc84415f77e0c156fdfbb6ac723966", "score": "0.788405", "text": "func (in *Gitlab) DeepCopyInto(out *Gitlab) {\n\t*out = *in\n}", "title": "" }, { "docid": "d16087e4b89eb0ac20119d490e0084d1", "score": "0.78797835", "text": "func (in *CISBenchmarkSelection) DeepCopyInto(out *CISBenchmarkSelection) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "98a5fec2843f9518f6f2fd61b9fa9c74", "score": "0.7875915", "text": "func (in *BinaryBuildSource) DeepCopyInto(out *BinaryBuildSource) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "39fc6ad3b33696c5a382172839f602c4", "score": "0.78755045", "text": "func (in *Mysql) DeepCopyInto(out *Mysql) {\n\t*out = *in\n}", "title": "" }, { "docid": "0b41c52e9da3545832627f75cd1798b0", "score": "0.78719705", "text": "func (in *InMemoryAPIServerBehaviour) DeepCopyInto(out *InMemoryAPIServerBehaviour) {\n\t*out = *in\n\tout.Provisioning = in.Provisioning\n}", "title": "" }, { "docid": "d04effc735adc59932f839adb9a5fcca", "score": "0.78713626", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "title": "" }, { "docid": "1bdb8740dd406f99e36d269dd6e9990b", "score": "0.78712523", "text": "func (in *Custom) DeepCopyInto(out *Custom) {\n\t*out = *in\n\tout.Expr = in.Expr\n\treturn\n}", "title": "" }, { "docid": "13d7c5f7535e75d698e840b9cfd16ae3", "score": "0.7867813", "text": "func (in *Expr) DeepCopyInto(out *Expr) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "6fc5d0984d8c73e612ab3ac8df3a35b3", "score": "0.7867336", "text": "func (in *Identity) DeepCopyInto(out *Identity) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "d7c370bb74cf9022ffb0b1644dac2baa", "score": "0.786481", "text": "func (in *Mongo) DeepCopyInto(out *Mongo) {\n\t*out = *in\n}", "title": "" }, { "docid": "23a65f1f8246d0a6155b7ec686aafb86", "score": "0.7864268", "text": "func (in *Revision) DeepCopyInto(out *Revision) {\n\t*out = *in\n}", "title": "" }, { "docid": "60f2c810f51132cc5295ed2b35dac8ab", "score": "0.7864215", "text": "func (in *Action) DeepCopyInto(out *Action) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7863321", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "126b737579f2263a795ede56342e2f86", "score": "0.7862278", "text": "func (in *Feed) DeepCopyInto(out *Feed) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "547474ce2a12555364e84de325180903", "score": "0.7861857", "text": "func (in *FilesFrom) DeepCopyInto(out *FilesFrom) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "d6c78efb8990c0e87750c6aa88b98475", "score": "0.786148", "text": "func (in *RedisVersionCoordinator) DeepCopyInto(out *RedisVersionCoordinator) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dbff322ba9de4ebcad7d38fc96f4c23d", "score": "0.7861228", "text": "func (in *MySQLVersionCoordinator) DeepCopyInto(out *MySQLVersionCoordinator) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "65ae9948c541da496f7ad198975ba2f5", "score": "0.7860243", "text": "func (in *MigrationSpec) DeepCopyInto(out *MigrationSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "4f4fcbb079c2abc9452aac73d8b653a1", "score": "0.7860037", "text": "func (in *Body) DeepCopyInto(out *Body) {\n\t*out = *in\n\tif in.KV != nil {\n\t\tin, out := &in.KV, &out.KV\n\t\t*out = make(map[string]Any, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Byte != nil {\n\t\tin, out := &in.Byte, &out.Byte\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.JSON != nil {\n\t\tin, out := &in.JSON, &out.JSON\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "a70b2ea5a026ffdba657063ccc91180f", "score": "0.7855658", "text": "func (in *PodInfo) DeepCopyInto(out *PodInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "848fd773e0c97792e3685f1559eefa69", "score": "0.78512", "text": "func (in *TestRunner) DeepCopyInto(out *TestRunner) {\n\t*out = *in\n\tout.Teamcity = in.Teamcity\n\tout.Gitlab = in.Gitlab\n}", "title": "" }, { "docid": "d291b0f5d54262faa3ca288a73994a94", "score": "0.7849717", "text": "func (in *JavaRuntime) DeepCopyInto(out *JavaRuntime) {\n\t*out = *in\n}", "title": "" }, { "docid": "170ddf2575c007ccb3fc0068b04801fb", "score": "0.7848102", "text": "func (in *MemoryGibPerVcpuObservation) DeepCopyInto(out *MemoryGibPerVcpuObservation) {\n\t*out = *in\n}", "title": "" }, { "docid": "ba403d912e2353789e17a5a9a9c4fa3b", "score": "0.7847872", "text": "func (in OptionalNodeSelector) DeepCopyInto(out *OptionalNodeSelector) {\n\t{\n\t\tin := &in\n\t\t*out = make(OptionalNodeSelector, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "466efa302ee30b818f18f14131212f2b", "score": "0.78478134", "text": "func (in *Global) DeepCopyInto(out *Global) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" } ]
7231ffda00ab60346f98768501123bdb
Element picks the element based on the Event's Kind, if it's removed, the element is the "old" value, if it's added or changed, the element is the "new" value.
[ { "docid": "a8ef5ff71e86d8c6e028486b2442cd83", "score": "0.7339141", "text": "func (p *Event) Element() reflect.Value {\n\tif p.Kind == KindRemoved {\n\t\treturn p.Old\n\t}\n\n\treturn p.New\n}", "title": "" } ]
[ { "docid": "db55f86ff41bde3aa210c81245187616", "score": "0.56045336", "text": "func (l *List) Remove(e *Element) interface{} {\n\tif e.list == l {\n\t\t// if e.list == l, l must have been initialized when e was inserted\n\t\t// in l or l == nil ( e is a zero Element) and l.remove will crash\n\t\tl.remove(e)\n\t}\n\treturn e.Value\n}", "title": "" }, { "docid": "3a00dfd37397bf4a3d59e360765a63b6", "score": "0.55446464", "text": "func (l *List[T]) Remove(e *Element[T]) T {\n\tv := e.Value\n\tif e.list == l {\n\t\t// if e.list == l, l must have been initialized when e was inserted\n\t\t// in l or l == nil (e is a zero Element) and l.remove will crash\n\t\tl.remove(e)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "7b963ef89052292e58353032f0e2d604", "score": "0.53993547", "text": "func (e *Event) Type() Type { return Type(e.typ) }", "title": "" }, { "docid": "2c67b447a665b51a5a1f44b76e3b334a", "score": "0.5309654", "text": "func (e *Element) Remove() interface{} {\n\tswitch {\n\tcase &e == nil || e.next == nil || e.prev == nil:\n\t\treturn nil\n\tcase e.next == nil || e.prev == nil:\n\t\treturn e.Value\n\tcase e.list != nil:\n\t\te.list.remove(e)\n\tdefault:\n\t\te.remove()\n\t}\n\n\treturn e.Value\n}", "title": "" }, { "docid": "d4fb1e14e19a540a89c015a29c05750c", "score": "0.51617014", "text": "func (r *Registry) GetEqual(eventType, floor int) *Event {\n\tr.lock.RLock()\n\tdefer r.lock.RUnlock()\n\n\tfor _, v := range r.events {\n\t\tif v.Floor == floor && v.Type == eventType {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e978998750c6b8e9358f1bfdbd16787b", "score": "0.50925267", "text": "func (r *Radio) Event() *Event {\n\tev := atomic.LoadPointer(&r.latestEvent)\n\tif ev == invalidEvent {\n\t\treturn nil\n\t}\n\treturn (*Event)(ev)\n}", "title": "" }, { "docid": "866b33ca942b8c5314ca1c758428eb0a", "score": "0.49798757", "text": "func (r *registration) maybeStripEvent(event *roachpb.RangeFeedEvent) *roachpb.RangeFeedEvent {\n\tret := event\n\tcopyOnWrite := func() interface{} {\n\t\tif ret == event {\n\t\t\tret = event.ShallowCopy()\n\t\t}\n\t\treturn ret.GetValue()\n\t}\n\n\tswitch t := ret.GetValue().(type) {\n\tcase *roachpb.RangeFeedValue:\n\t\tif t.PrevValue.IsPresent() && !r.withDiff {\n\t\t\t// If no registrations for the current Range are requesting previous\n\t\t\t// values, then we won't even retrieve them on the Raft goroutine.\n\t\t\t// However, if any are and they overlap with an update then the\n\t\t\t// previous value on the corresponding events will be populated.\n\t\t\t// If we're in this case and any other registrations don't want\n\t\t\t// previous values then we'll need to strip them.\n\t\t\tt = copyOnWrite().(*roachpb.RangeFeedValue)\n\t\t\tt.PrevValue = roachpb.Value{}\n\t\t}\n\tcase *roachpb.RangeFeedCheckpoint:\n\t\tif !t.Span.EqualValue(r.span) {\n\t\t\t// Checkpoint events are always created spanning the entire Range.\n\t\t\t// However, a registration might not be listening on updates over\n\t\t\t// the entire Range. If this is the case then we need to constrain\n\t\t\t// the checkpoint events published to that registration to just the\n\t\t\t// span that it's listening on. This is more than just a convenience\n\t\t\t// to consumers - it would be incorrect to say that a rangefeed has\n\t\t\t// observed all values up to the checkpoint timestamp over a given\n\t\t\t// key span if any updates to that span have been filtered out.\n\t\t\tif !t.Span.Contains(r.span) {\n\t\t\t\tpanic(fmt.Sprintf(\"registration span %v larger than checkpoint span %v\", r.span, t.Span))\n\t\t\t}\n\t\t\tt = copyOnWrite().(*roachpb.RangeFeedCheckpoint)\n\t\t\tt.Span = r.span\n\t\t}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unexpected RangeFeedEvent variant: %v\", t))\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "ecb890ca0e209fee279d8cc8d8b94815", "score": "0.4925521", "text": "func (rc *RenderCore) updateElement(_parent interface{}, parent *Element, new, old interface{}, index int, inReplaced bool) error {\n\t// if element has created\n\tif old == nil {\n\t\trc.Add(&RenderTask{\n\t\t\tType: RCreate,\n\t\t\tNew: new,\n\t\t\tParent: parent,\n\t\t\tNodeParent: _parent,\n\n\t\t\tInReplaced: inReplaced,\n\t\t})\n\n\t\treturn nil\n\t}\n\n\t_childes := rc.BE.ChildNodes(_parent)\n\n\tvar _el interface{}\n\tif len(_childes) > index {\n\t\t_el = _childes[index]\n\t} else {\n\t\tif IsElement(old) {\n\t\t\t_el = I2E(old).BEElement()\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// if element was deleted\n\tif new == nil {\n\t\trc.Add(&RenderTask{\n\t\t\tType: RDelete,\n\t\t\tNodeParent: _parent,\n\t\t\tParent: parent,\n\t\t\tNodeOld: _el,\n\t\t\tOld: old,\n\t\t\tInReplaced: inReplaced,\n\t\t})\n\n\t\treturn nil\n\t}\n\n\t// if element has Changed\n\tisChanged, canGoDeeper, err := Changed(new, old)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif isChanged {\n\t\trc.Add(&RenderTask{\n\t\t\tType: RReplace,\n\t\t\tNodeParent: _parent,\n\t\t\tNodeOld: _el,\n\t\t\tParent: parent,\n\t\t\tNew: new,\n\t\t\tOld: old,\n\t\t\tReplaceCanGoDeeper: canGoDeeper,\n\t\t\tInReplaced: inReplaced,\n\t\t})\n\t}\n\tif !canGoDeeper {\n\t\treturn nil\n\t}\n\n\tnewE := new.(*Element)\n\toldE := old.(*Element)\n\tnewE.UUID = oldE.UUID // little hack\n\n\t// if old and new is equals and they have html directives => they are two commons elements\n\tif oldE.HTML != nil && newE.HTML != nil {\n\t\treturn nil\n\t}\n\n\terr = rc.UpdateElementChildes(_el, newE, newE.Childes, getOldChildes(newE, oldE), isChanged)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif isChanged && !inReplaced {\n\t\trc.Add(&RenderTask{\n\t\t\tType: RReplaceHooks,\n\t\t\tNodeParent: _parent,\n\t\t\tNodeOld: _el,\n\t\t\tParent: parent,\n\t\t\tNew: new,\n\t\t\tOld: old,\n\t\t})\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8512e229a6b3d9bd341bfc7e8dcdcb71", "score": "0.49176168", "text": "func (r *Registry) GetAnyDiffer(eventType, floor int) *Event {\n\tr.lock.RLock()\n\tdefer r.lock.RUnlock()\n\n\tfor _, v := range r.events {\n\t\tif v.Floor != floor && v.Type == eventType {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a5807a7192fa280f62f1127a21723eaf", "score": "0.4860879", "text": "func (eh *ElementHolder) Pop() interface{} {\n\tif len(eh.elements) == 0 {\n\t\treturn nil\n\t}\n\told := eh.elements\n\tn := eh.Len()\n\telement := old[n-1]\n\told[n-1] = nil // avoid memory leak\n\telement.Index = -1 // for safety\n\teh.elements = old[:n-1]\n\treturn element\n}", "title": "" }, { "docid": "11bb3bb95a92be58a04cba100dc2285d", "score": "0.48280582", "text": "func (q *Queue) Pop() *Event {\n\tq.mu.Lock()\n\tdefer q.mu.Unlock()\n\n\tif q.count == 0 {\n\t\treturn nil\n\t}\n\n\tev := q.evs[q.head]\n\tq.head = (q.head + 1) % len(q.evs)\n\tq.count--\n\n\treturn ev\n}", "title": "" }, { "docid": "8428ac0db4641bc00e5c23730e43789d", "score": "0.47928718", "text": "func (t *ChanType) Elem() Type\t{ return toType(*t.elem) }", "title": "" }, { "docid": "999d789bfaaa1e309cb6426daad80140", "score": "0.47573164", "text": "func (b *EventBox) Set(event EventType, value interface{}) {\n\tb.cond.L.Lock()\n\tb.events[event] = value\n\tif _, found := b.ignore[event]; !found {\n\t\tb.cond.Broadcast()\n\t}\n\tb.cond.L.Unlock()\n}", "title": "" }, { "docid": "7d6279005c73e757edbbc9664875d1eb", "score": "0.47295448", "text": "func (l *T) Element(key interface{}) (e *Element) {\n\te, _ = l.ElementPos(key)\n\treturn e\n}", "title": "" }, { "docid": "a0a14809c30517c0744f5ca90d852e67", "score": "0.47174516", "text": "func (x *fastReflection_Event) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"tendermint.abci.Event.attributes\":\n\t\tif x.Attributes == nil {\n\t\t\tx.Attributes = []*EventAttribute{}\n\t\t}\n\t\tvalue := &_Event_2_list{list: &x.Attributes}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"tendermint.abci.Event.type\":\n\t\tpanic(fmt.Errorf(\"field type of message tendermint.abci.Event is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.abci.Event\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.abci.Event does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "585158cb03876ed1db3c23147de31729", "score": "0.47049177", "text": "func (e *Event) Equals(newEvent *Event) bool {\n\tif e.Name != newEvent.Name {\n\t\treturn false\n\t}\n\n\tif e.Labels[\"volume\"] != newEvent.Labels[\"volume\"] {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "cf43946434b43083b562ece1d9831830", "score": "0.46923473", "text": "func (e *Element) Key() interface{} { return e.key }", "title": "" }, { "docid": "1ae17ab89edf17b395f28e66ac6bd6e8", "score": "0.4674587", "text": "func (n *Node) GetElement() Element { return n.elem }", "title": "" }, { "docid": "be98fe8582adf1b4d798df018f2fcd9c", "score": "0.46741736", "text": "func newValue(in interface{}) (value, error) {\n\t// TODO(crbug.com/1201727): Support more data types, such as Golang map to XML-RPC struct.\n\tif reflect.TypeOf(in).Kind() == reflect.Slice || reflect.TypeOf(in).Kind() == reflect.Array {\n\t\tv := reflect.ValueOf(in)\n\t\tvar a xmlArray\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tval, err := newValue(v.Index(i).Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn value{}, err\n\t\t\t}\n\t\t\ta.Values = append(a.Values, val)\n\t\t}\n\t\treturn value{Array: &a}, nil\n\t}\n\tswitch v := in.(type) {\n\tcase string:\n\t\ts := v\n\t\treturn value{Str: &s}, nil\n\tcase bool:\n\t\tb := boolToXMLBoolean(v)\n\t\treturn value{Boolean: &b}, nil\n\tcase int:\n\t\ti, err := intToXMLInteger(v)\n\t\tif err != nil {\n\t\t\treturn value{}, err\n\t\t}\n\t\treturn value{Int: &i}, nil\n\tcase float64:\n\t\tf := float64ToXMLDouble(v)\n\t\treturn value{Double: &f}, nil\n\tcase map[string]string:\n\t\tvar s xmlStruct\n\t\tfor key, obj := range v {\n\t\t\tstr := obj\n\t\t\ts.Members = append(s.Members, member{Name: key, Value: value{Str: &str}})\n\t\t}\n\t\treturn value{Struct: &s}, nil\n\tcase map[string]interface{}:\n\t\tvar s xmlStruct\n\t\tfor key, obj := range v {\n\t\t\tval, err := newValue(obj)\n\t\t\tif err != nil {\n\t\t\t\treturn value{}, errors.Wrapf(err, \"failed when calling newValue on key: %v value: %v\", key, obj)\n\t\t\t}\n\t\t\ts.Members = append(s.Members, member{Name: key, Value: val})\n\t\t}\n\t\treturn value{Struct: &s}, nil\n\tdefault:\n\t\t// This is to support type definition wrapping around primitive type\n\t\t// without having the client code perform a type conversion.\n\t\t// e.g. type NewType int\n\t\t// If the underlying type is one of the primitive types supported,\n\t\t// we recursively call NewValue by peeling of one layer of indirection.\n\t\tswitch reflect.TypeOf(in).Kind() {\n\t\tcase reflect.Int:\n\t\t\treturn newValue(int(reflect.ValueOf(in).Int()))\n\t\tcase reflect.Bool:\n\t\t\treturn newValue(reflect.ValueOf(in).Bool())\n\t\tcase reflect.Float64:\n\t\t\treturn newValue(float64(reflect.ValueOf(in).Float()))\n\t\tcase reflect.String:\n\t\t\treturn newValue(reflect.ValueOf(in).String())\n\t\t}\n\t}\n\treturn value{}, errors.Errorf(\"%q is not a supported type for newValue\", reflect.TypeOf(in))\n}", "title": "" }, { "docid": "f9a76e3ebc9878d845b6aedbdbcc7970", "score": "0.46581557", "text": "func (self *Lefs) GetFirstEvent() Event {\n\t/* log.Println(\"Lista antes de eliminar primer evento :\")\n\t(*self).IlEvents.PrintEvent()\n\t*/\n\tle_evento := (*self).IlEvents.GetFirstEvent()\n\t(*self).IlEvents.DeleteFirstEvent()\n\t/*log.Println(\"Lista DESPUES de eliminar primer evento :\")\n\t(*self).IlEvents.PrintEvent()\n\t*/\n\treturn le_evento\n}", "title": "" }, { "docid": "d830bfe6de07a3b34e983a1698f5364b", "score": "0.46558103", "text": "func (elem *collectionElemImpl) Get(key interface{}) (value Element, err error) {\n\n\tvar realKey string\n\n\tswitch k := key.(type) {\n\tcase int, int32, int64:\n\t\trealKey = fmt.Sprintf(\"%d\", k)\n\tcase string:\n\t\trealKey = k\n\tcase Element:\n\t\tvar serializer Serializer\n\t\tif serializer, err = GetSerializerByType(EvaEdnMimeType); err == nil {\n\t\t\trealKey, err = k.Serialize(serializer)\n\t\t}\n\tdefault:\n\t\terr = MakeErrorWithFormat(ErrInvalidInput, \"key type: %T\", k)\n\t}\n\n\tif err == nil {\n\t\tswitch v := elem.collection.(type) {\n\t\tcase []Element:\n\t\t\tvar index int\n\t\t\tif index, err = strconv.Atoi(realKey); err == nil {\n\t\t\t\tif index >= 0 && index < len(v) {\n\t\t\t\t\tvalue = v[index]\n\t\t\t\t} else {\n\t\t\t\t\terr = MakeError(ErrNoValue, realKey)\n\t\t\t\t}\n\t\t\t}\n\t\tcase map[string][2]Element:\n\t\t\tvar has bool\n\t\t\tvar pair [2]Element\n\t\t\tif pair, has = v[realKey]; has {\n\t\t\t\tvalue = pair[1]\n\t\t\t} else {\n\t\t\t\terr = MakeError(ErrNoValue, realKey)\n\t\t\t}\n\t\tdefault:\n\t\t\terr = MakeErrorWithFormat(ErrInvalidElement, \"type: %T\", v)\n\t\t}\n\t}\n\n\treturn value, err\n}", "title": "" }, { "docid": "39d8f6680f8d60c16f653e070b7495dd", "score": "0.4642925", "text": "func (x *fastReflection_Event) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"tendermint.abci.Event.type\":\n\t\tvalue := x.Type_\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"tendermint.abci.Event.attributes\":\n\t\tif len(x.Attributes) == 0 {\n\t\t\treturn protoreflect.ValueOfList(&_Event_2_list{})\n\t\t}\n\t\tlistValue := &_Event_2_list{list: &x.Attributes}\n\t\treturn protoreflect.ValueOfList(listValue)\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.abci.Event\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.abci.Event does not contain field %s\", descriptor.FullName()))\n\t}\n}", "title": "" }, { "docid": "4b78293c2df4a51014515505c26da132", "score": "0.4638496", "text": "func apply(o *Order, e Event, isNew bool) {\n\to.ID = e.ID()\n\n\thandle(o, e)\n\n\tif isNew {\n\t\to.uncommitted = append(o.uncommitted, e)\n\t}\n}", "title": "" }, { "docid": "37e0e666e80c7e53112a15278c2dacd5", "score": "0.46316049", "text": "func (e Element) Value() interface{} {\n\treturn e.value.Value()\n}", "title": "" }, { "docid": "62eafc8f80ede5a42bb579e3ea1dc995", "score": "0.46106473", "text": "func (e EventStruct) Update() error {\n\treturn nil\n}", "title": "" }, { "docid": "aedfd0d7dcf5aee79fdbdf36b7fc4272", "score": "0.46105257", "text": "func (m *Metric) UpdateEvent(event *Event) error {\n\tif event.Name == \"\" {\n\t\tevent.Name = m.Name\n\t}\n\tif event.Name != m.Name {\n\t\treturn fmt.Errorf(\"cannot add event %s to metric %s\", event.Name, m.Name)\n\t}\n\tfor i, e := range m.Events {\n\t\tif e.Equals(event) {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"metric\": m.Name,\n\t\t\t\t\"old_event\": e.String(),\n\t\t\t\t\"new_event\": event.String(),\n\t\t\t}).Debug(\"Replacing event\")\n\t\t\tm.Events[i] = event\n\t\t\treturn nil\n\t\t}\n\t}\n\tlog.WithFields(log.Fields{\n\t\t\"metric\": m.Name,\n\t\t\"event\": event.String(),\n\t}).Debug(\"Adding event\")\n\tm.Events = append(m.Events, event)\n\n\treturn nil\n}", "title": "" }, { "docid": "597ea29fadc2707be74a11e849e2291f", "score": "0.46073204", "text": "func (src *EventSource) PopChange() Event {\n\tif len(src.Changes) > 0 {\n\t\thead, tail := src.Changes[0], src.Changes[1:]\n\t\tsrc.Changes = tail\n\t\treturn head\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "69f06010987f4d01179cbf04beb07455", "score": "0.46053395", "text": "func (e *Element) Value() interface{} {\n\treturn e.value\n}", "title": "" }, { "docid": "893763922f18a88fbd55269f15dc7f7e", "score": "0.45738542", "text": "func (p RepositoryPushHook) EventTag() string {\n\treturn p.UpdatedTags[0]\n}", "title": "" }, { "docid": "f9f8bb412653e8c0abd756e673f8be59", "score": "0.45627624", "text": "func (h *Holder) GetEvent(startLocation binlog.Location) (*replication.BinlogEvent, error) {\n\th.mu.Lock()\n\tdefer h.mu.Unlock()\n\n\tkey := startLocation.Position.String()\n\toperator, ok := h.operators[key]\n\tif !ok {\n\t\treturn nil, terror.ErrSyncerReplaceEventNotExist.Generate(startLocation)\n\t}\n\n\tif len(operator.events) <= startLocation.Suffix {\n\t\treturn nil, terror.ErrSyncerReplaceEvent.Generatef(\"replace events out of range, index: %d, total: %d\", startLocation.Suffix, len(operator.events))\n\t}\n\n\te := operator.events[startLocation.Suffix]\n\tbuf := new(bytes.Buffer)\n\te.Dump(buf)\n\th.logger.Info(\"get replace event\", zap.Stringer(\"event\", buf))\n\n\treturn e, nil\n}", "title": "" }, { "docid": "12182f99441ead5f47483a168a0e9c83", "score": "0.45611033", "text": "func (r *StubEventHandler) Updated(Event) {}", "title": "" }, { "docid": "5403ba301bab9a4a05abfe240aae5ac3", "score": "0.45548752", "text": "func (c *Chan) Elem() Type { return c.elem }", "title": "" }, { "docid": "639b3ccc96374f5a34f5ddd39b666270", "score": "0.45391294", "text": "func (q *Queue) Pop() (Event, bool) {\n\tif q.length == 0 {\n\t\treturn Event{}, false\n\t}\n\n\tevent := Event{}\n\tfor event.ID == 0 && q.length > 0 {\n\t\tevent = q.events[q.start]\n\t\tq.events[q.start] = Event{}\n\t\tq.start = q.index(q.start+1)\n\t\tq.length--\n\t}\n\n\tif event.ID == 0 {\n\t\treturn Event{}, false\n\t}\n\n\tfor i := q.start; i != q.end; i = q.index(i+1) {\n\t\tq.events[i].Time -= event.Time \n\t}\n\n\treturn event, true\n}", "title": "" }, { "docid": "147094f2b40d8ac99ba1d160033190cb", "score": "0.45348105", "text": "func (q *expirationQueue[K, V]) Pop() interface{} {\n\told := *q\n\ti := len(old) - 1\n\telem := old[i]\n\telem.Value.(*Item[K, V]).queueIndex = -1\n\told[i] = nil // avoid memory leak\n\t*q = old[:i]\n\n\treturn elem\n}", "title": "" }, { "docid": "b115fc5ba5b10047498809ae5a8153dd", "score": "0.4533534", "text": "func (eh *ElementHolder) Push(x interface{}) {\n\tn := len(eh.elements)\n\telement := x.(*Element)\n\telement.Index = n\n\teh.elements = append(eh.elements, element)\n}", "title": "" }, { "docid": "62bf539f6f24c18ac875b05822088ed2", "score": "0.45217937", "text": "func (e Element) Value() Value {\n\tval, _ := e.ValueErr()\n\treturn val\n}", "title": "" }, { "docid": "49af552126ef5d3633a9bb709c8e6c62", "score": "0.45136243", "text": "func TestReplaceEvent(t *testing.T) {\n\trun(t, func(client *Client, table *Table) {\n\t\ttimestamp, _ := ParseTimestamp(\"1970-01-01T00:00:01.5Z\")\n\t\ttable.CreateProperty(NewProperty(\"p0\", false, Factor))\n\t\ttable.CreateProperty(NewProperty(\"t0\", true, Integer))\n\t\te0 := NewEvent(timestamp, map[string]interface{}{\"p0\": \"foo\", \"t0\": 10})\n\t\te1 := NewEvent(timestamp, map[string]interface{}{\"t0\": 20})\n\n\t\t// Add the event.\n\t\terr := table.AddEvent(\"o0\", e0, Replace)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Unable to replace event: %v (%v)\", e0, err)\n\t\t}\n\n\t\t// Replace the event.\n\t\terr = table.AddEvent(\"o0\", e1, Replace)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Unable to replace event: %v (%v)\", e1, err)\n\t\t}\n\n\t\t// Get the event to verify.\n\t\tevent, err := table.GetEvent(\"o0\", timestamp)\n\t\tif err != nil || event.Data[\"t0\"] != float64(20) || event.Data[\"p0\"] != nil {\n\t\t\tt.Fatalf(\"Incorrect replaced event: %v (%v)\", event, err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "d86f8d4a80b6066b8673a9e637865134", "score": "0.4506148", "text": "func (e Event) Get(key string) (interface{}, bool) {\n\tt := reflect.TypeOf(e)\n\tfor i := 0; i < t.NumField(); i++ {\n\t\t// Find a matching field by name, ignoring case\n\t\tif strings.EqualFold(t.Field(i).Name, key) {\n\t\t\t// return the value of that field\n\t\t\treturn reflect.ValueOf(e).Field(i).Interface(), true\n\t\t}\n\t}\n\n\tv, ok := e.extension[strings.ToLower(key)]\n\treturn v, ok\n}", "title": "" }, { "docid": "0dba583b30c4f4a991cf253553240db9", "score": "0.44911537", "text": "func AsEvent(e ld.Entity) Event { return Event{AsObject(e)} }", "title": "" }, { "docid": "728eece5fe6f24aa9521b595c784a211", "score": "0.4487414", "text": "func (ew *EventWindow) Push(e Event) {\n\tdefer ew.m.Unlock()\n\tew.m.Lock()\n\tremoveBefore := e.Date.Add(-ew.maxAge)\n\tvar i int\n\tvar previous Event\n\tfor i, previous = range ew.events {\n\t\tif previous.Date.After(removeBefore) {\n\t\t\tbreak\n\t\t}\n\t}\n\tfor j := 0; j < i; j++ {\n\t\tew.exit(ew.events[j], ew.events[j:])\n\t}\n\tew.events = append(ew.events[i:], e)\n}", "title": "" }, { "docid": "679087bdece942a4ade3a295bff9c3fa", "score": "0.44796166", "text": "func (r *snapshotReactor) popChange() interface{} {\n\tr.lock.Lock()\n\tdefer r.lock.Unlock()\n\n\tif len(r.changedObjects) == 0 {\n\t\treturn nil\n\t}\n\n\t// For debugging purposes, print the queue\n\tfor _, obj := range r.changedObjects {\n\t\tswitch obj.(type) {\n\t\tcase *crdv1.VolumeSnapshotContent:\n\t\t\tvol, _ := obj.(*crdv1.VolumeSnapshotContent)\n\t\t\tklog.V(4).Infof(\"reactor queue: %s\", vol.Name)\n\t\t}\n\t}\n\n\t// Pop the first item from the queue and return it\n\tobj := r.changedObjects[0]\n\tr.changedObjects = r.changedObjects[1:]\n\treturn obj\n}", "title": "" }, { "docid": "5ef016e6db8f54da56540e3f5fe7378a", "score": "0.44791433", "text": "func (itr *elementIterator) Element() *Element { return itr.elem }", "title": "" }, { "docid": "37af9ef33a64abbad89a9914ed530e16", "score": "0.44722334", "text": "func Update(event *Event) (*Event, error) {\n\tvar updatedEvent *Event\n\tif event.ID == primitive.NilObjectID {\n\t\treturn updatedEvent, errors.New(\"Event ID not provided\")\n\t}\n\tclient, ctx, cancel, err := getConnection()\n\tif err != nil {\n\t\treturn updatedEvent, err\n\t}\n\tdefer cancel()\n\tdefer client.Disconnect(ctx)\n\n\tupdate := bson.M{\n\t\t\"$set\": event,\n\t}\n\n\tupsert := true\n\tafter := options.After\n\topt := options.FindOneAndUpdateOptions{\n\t\tUpsert: &upsert,\n\t\tReturnDocument: &after,\n\t}\n\n\terr = client.Database(\"penpal\").Collection(\"events\").FindOneAndUpdate(ctx, bson.M{\"_id\": event.ID}, update, &opt).Decode(&updatedEvent)\n\tif err != nil {\n\t\tlog.Printf(\"Could not save Event: %v\", err)\n\t\treturn nil, err\n\t}\n\treturn updatedEvent, nil\n}", "title": "" }, { "docid": "db5efc6636e119177e828d01577f7e87", "score": "0.44657868", "text": "func (m *AnomalyMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase anomaly.FieldCreateTime:\n\t\treturn m.OldCreateTime(ctx)\n\tcase anomaly.FieldUpdateTime:\n\t\treturn m.OldUpdateTime(ctx)\n\tcase anomaly.FieldType:\n\t\treturn m.OldType(ctx)\n\tcase anomaly.FieldValue:\n\t\treturn m.OldValue(ctx)\n\tcase anomaly.FieldProcessed:\n\t\treturn m.OldProcessed(ctx)\n\tcase anomaly.FieldPeriodStart:\n\t\treturn m.OldPeriodStart(ctx)\n\tcase anomaly.FieldPeriodEnd:\n\t\treturn m.OldPeriodEnd(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Anomaly field %s\", name)\n}", "title": "" }, { "docid": "4ceb4c0925dbb01739864651f8ff3400", "score": "0.446563", "text": "func (h *ElementHolder) Pop() interface{} {\n\tif len(h.elements) == 0 {\n\t\treturn nil\n\t}\n\titem := h.elements[h.Len()-1]\n\th.elements = h.elements[:h.Len()-1]\n\treturn item\n}", "title": "" }, { "docid": "9c971edb581eacd36b9189f89f3cdcc9", "score": "0.44586137", "text": "func (h *EventHeap) Pop() interface{} {\n\tnewLen := len(h.Txs) - 1\n\tval := h.Txs[newLen]\n\th.Txs = h.Txs[:newLen]\n\treturn val\n}", "title": "" }, { "docid": "b8ad5416cd8610495ee30d0d055c696a", "score": "0.44490445", "text": "func (t *PtrType) Elem() Type\t{ return toType(*t.elem) }", "title": "" }, { "docid": "3b9975b2fea6b0c462a9d74191eb2ae2", "score": "0.444612", "text": "func (m *Memory) Pop() (e *Events) {\n\te = m.events\n\tm.Reset()\n\treturn\n}", "title": "" }, { "docid": "5fc589a3f742a485f6464a6575111853", "score": "0.44461086", "text": "func (l *List) RemoveElement(e *Element) (v interface{}, ok bool) {\n\tif !l.Contains(e) {\n\t\treturn nil, false\n\t}\n\tl.unlink(e)\n\tl.len--\n\tv = e.value\n\te.clear()\n\treturn v, true\n}", "title": "" }, { "docid": "a9984da847ce8a911249332b9c47de77", "score": "0.44451162", "text": "func ConvertEvent(appl application.Application, request *http.Request, wiEvent event.Event, wiID uuid.UUID) *app.Event {\n\trelatedCreatorLink := rest.AbsoluteURL(request, fmt.Sprintf(\"%s/%s\", usersEndpoint, wiEvent.Modifier.String()))\n\trelatedURL := rest.AbsoluteURL(request, app.WorkitemHref(wiID))\n\tlabelsRelated := relatedURL + \"/labels\"\n\tmodifier := &app.RelationGeneric{\n\t\tData: &app.GenericData{\n\t\t\tType: ptr.String(APIStringTypeUser),\n\t\t\tID: ptr.String(wiEvent.Modifier.String()),\n\t\t\tLinks: &app.GenericLinks{\n\t\t\t\tRelated: &relatedCreatorLink,\n\t\t\t},\n\t\t},\n\t}\n\n\tvar e *app.Event\n\tswitch wiEvent.Name {\n\tcase workitem.SystemState, workitem.SystemTitle:\n\t\te = &app.Event{\n\t\t\tType: event.APIStringTypeEvents,\n\t\t\tID: &wiEvent.ID,\n\t\t\tAttributes: map[string]interface{}{\n\t\t\t\t\"name\": wiEvent.Name,\n\t\t\t\t\"newValue\": wiEvent.New,\n\t\t\t\t\"oldValue\": wiEvent.Old,\n\t\t\t\t\"timestamp\": wiEvent.Timestamp,\n\t\t\t},\n\n\t\t\tRelationships: &app.EventRelations{\n\t\t\t\tModifier: modifier,\n\t\t\t},\n\t\t}\n\tcase workitem.SystemDescription:\n\t\te = &app.Event{\n\t\t\tType: event.APIStringTypeEvents,\n\t\t\tID: &wiEvent.ID,\n\t\t\tAttributes: map[string]interface{}{\n\t\t\t\t\"name\": wiEvent.Name,\n\t\t\t\t\"newValue\": nil,\n\t\t\t\t\"oldValue\": nil,\n\t\t\t\t\"timestamp\": wiEvent.Timestamp,\n\t\t\t},\n\n\t\t\tRelationships: &app.EventRelations{\n\t\t\t\tModifier: modifier,\n\t\t\t},\n\t\t}\n\tcase workitem.SystemArea:\n\t\told := ConvertAreaSimple(request, wiEvent.Old)\n\t\tnew := ConvertAreaSimple(request, wiEvent.New)\n\t\te = &app.Event{\n\t\t\tType: event.APIStringTypeEvents,\n\t\t\tID: &wiEvent.ID,\n\t\t\tAttributes: map[string]interface{}{\n\t\t\t\t\"name\": wiEvent.Name,\n\t\t\t\t\"newValue\": nil,\n\t\t\t\t\"oldValue\": nil,\n\t\t\t\t\"timestamp\": wiEvent.Timestamp,\n\t\t\t},\n\n\t\t\tRelationships: &app.EventRelations{\n\t\t\t\tModifier: modifier,\n\t\t\t\tOldValue: &app.RelationGenericList{\n\t\t\t\t\tData: []*app.GenericData{old},\n\t\t\t\t},\n\t\t\t\tNewValue: &app.RelationGenericList{\n\t\t\t\t\tData: []*app.GenericData{new},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\tcase workitem.SystemIteration:\n\t\told := ConvertIterationSimple(request, wiEvent.Old)\n\t\tnew := ConvertIterationSimple(request, wiEvent.New)\n\t\te = &app.Event{\n\t\t\tType: event.APIStringTypeEvents,\n\t\t\tID: &wiEvent.ID,\n\t\t\tAttributes: map[string]interface{}{\n\t\t\t\t\"name\": wiEvent.Name,\n\t\t\t\t\"newValue\": nil,\n\t\t\t\t\"oldValue\": nil,\n\t\t\t\t\"timestamp\": wiEvent.Timestamp,\n\t\t\t},\n\n\t\t\tRelationships: &app.EventRelations{\n\t\t\t\tModifier: modifier,\n\t\t\t\tOldValue: &app.RelationGenericList{\n\t\t\t\t\tData: []*app.GenericData{old},\n\t\t\t\t},\n\t\t\t\tNewValue: &app.RelationGenericList{\n\t\t\t\t\tData: []*app.GenericData{new},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\tcase workitem.SystemAssignees:\n\t\te = &app.Event{\n\t\t\tType: event.APIStringTypeEvents,\n\t\t\tID: &wiEvent.ID,\n\t\t\tAttributes: map[string]interface{}{\n\t\t\t\t\"name\": wiEvent.Name,\n\t\t\t\t\"newValue\": nil,\n\t\t\t\t\"oldValue\": nil,\n\t\t\t\t\"timestamp\": wiEvent.Timestamp,\n\t\t\t},\n\t\t\tRelationships: &app.EventRelations{\n\t\t\t\tModifier: modifier,\n\t\t\t\tOldValue: &app.RelationGenericList{\n\t\t\t\t\tData: ConvertUsersSimple(request, wiEvent.Old.([]interface{})),\n\t\t\t\t},\n\t\t\t\tNewValue: &app.RelationGenericList{\n\t\t\t\t\tData: ConvertUsersSimple(request, wiEvent.New.([]interface{})),\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\tcase workitem.SystemLabels:\n\t\te = &app.Event{\n\t\t\tType: event.APIStringTypeEvents,\n\t\t\tID: &wiEvent.ID,\n\t\t\tAttributes: map[string]interface{}{\n\t\t\t\t\"name\": wiEvent.Name,\n\t\t\t\t\"newValue\": nil,\n\t\t\t\t\"oldValue\": nil,\n\t\t\t\t\"timestamp\": wiEvent.Timestamp,\n\t\t\t},\n\t\t\tRelationships: &app.EventRelations{\n\t\t\t\tModifier: modifier,\n\t\t\t\tOldValue: &app.RelationGenericList{\n\t\t\t\t\tData: ConvertLabelsSimple(request, wiEvent.Old.([]interface{})),\n\t\t\t\t\tLinks: &app.GenericLinks{\n\t\t\t\t\t\tRelated: &labelsRelated,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tNewValue: &app.RelationGenericList{\n\t\t\t\t\tData: ConvertLabelsSimple(request, wiEvent.New.([]interface{})),\n\t\t\t\t\tLinks: &app.GenericLinks{\n\t\t\t\t\t\tRelated: &labelsRelated,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\treturn e\n}", "title": "" }, { "docid": "28ca7d7350d9448372364cc94e49796a", "score": "0.444183", "text": "func (wr *jsonWriter) getElement(name string, elType elemType) interface{} {\n\tvar el interface{}\n\tswitch elType {\n\tcase mapT, mapNoArrT, mapArrayT:\n\t\tel = make(map[string]interface{})\n\tcase arrayT:\n\t\tel = make([]interface{}, 0)\n\tcase singleT:\n\t\tel = name\n\tcase emptyT:\n\t\tel = nil\n\n\tdefault:\n\t}\n\treturn el\n}", "title": "" }, { "docid": "cc4642fc8c792be6d0916b9ca7e43446", "score": "0.4439938", "text": "func (e Element) Item() stackitem.Item {\n\treturn e.value\n}", "title": "" }, { "docid": "2de07a1572abb3c87eb248461c0d7cea", "score": "0.44071108", "text": "func (e *Event) Index() int { return int(e.idx) }", "title": "" }, { "docid": "d311d9c5dac49f80053877a33989e742", "score": "0.44050917", "text": "func (T *RedBlackTree) Remove(E Elem) error {\n\toldsize := T.size\n\tT.delete(E)\n\tif oldsize == T.size {\n\t\treturn errors.New(\"Item not found in Tree.\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f97b0a19f1fa1186007077ceb3416452", "score": "0.43988904", "text": "func (t *OpenconfigSystem_System_Aaa_Authorization_Events) RenameEvent(oldK, newK E_OpenconfigAaaTypes_AAA_AUTHORIZATION_EVENT_TYPE) error {\n\tif _, ok := t.Event[newK]; ok {\n\t\treturn fmt.Errorf(\"key %v already exists in Event\", newK)\n\t}\n\n\te, ok := t.Event[oldK]\n\tif !ok {\n\t\treturn fmt.Errorf(\"key %v not found in Event\", oldK)\n\t}\n\te.EventType = newK\n\n\tt.Event[newK] = e\n\tdelete(t.Event, oldK)\n\treturn nil\n}", "title": "" }, { "docid": "02c511bacca4b44a647872332539601e", "score": "0.43979073", "text": "func (ev BaseEvent) GetKind() string {\n\treturn ev.Kind\n}", "title": "" }, { "docid": "07f9cf500a216cc6f6d4f78618ec8e77", "score": "0.43977764", "text": "func ElementPrev(e *list.Element,) *list.Element", "title": "" }, { "docid": "3e0af278cff0a49332adaaa2856a8d23", "score": "0.43565506", "text": "func getElement(msg types.Event, cFilter *vm.Program) (string, error) {\n\tel, err := expr.Run(cFilter, map[string]interface{}{\"evt\": &msg})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\telement, ok := el.(string)\n\tif !ok {\n\t\treturn \"\", err\n\t}\n\treturn element, nil\n}", "title": "" }, { "docid": "3bdabd26a3c3b6a869828ce68c1c3887", "score": "0.43513182", "text": "func (t *OpenconfigSystem_System_Aaa_Accounting_Events) GetOrCreateEvent(EventType E_OpenconfigAaaTypes_AAA_ACCOUNTING_EVENT_TYPE) *OpenconfigSystem_System_Aaa_Accounting_Events_Event {\n\n\tkey := EventType\n\n\tif v, ok := t.Event[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewEvent(EventType)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateEvent got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "08c03dfb28762d8f7f9c7fbda4d5bd3f", "score": "0.434811", "text": "func (r *Reader) Element() Element {\n\treturn r.e\n}", "title": "" }, { "docid": "6ac3cd7a84e66444b3107daf5cba19a6", "score": "0.43479937", "text": "func (event *BasicEventCreated) CleanEvent() (*BasicEventCreated, error) {\n\n\tif val, ok := event.Payload[\"subject_id\"]; ok {\n\t\tevent.SubjectId = val\n\t\tdelete(event.Payload, \"subject_id\")\n\t} else {\n\t\treturn nil, ErrSubjectMissing\n\t}\n\n\tif val, ok := event.Payload[\"created_at\"]; ok {\n\t\tt, err := time.Parse(time.RFC3339, val)\n\t\tif err != nil {\n\t\t\tglog.Fatalln(err)\n\t\t}\n\t\tevent.CreatedAt = t\n\t\tdelete(event.Payload, \"created_at\")\n\t} else {\n\t\treturn nil, ErrCreatedAtMissing\n\t}\n\n\tif val, ok := event.Payload[\"source\"]; ok {\n\t\tevent.Source = val\n\t\tdelete(event.Payload, \"source\")\n\t}\n\n\tif val, ok := event.Payload[\"target\"]; ok {\n\t\tevent.Target = val\n\t\tdelete(event.Payload, \"target\")\n\t}\n\n\treturn event, nil\n}", "title": "" }, { "docid": "5cbed91ced5935b48566b8f6fc359bd4", "score": "0.4342626", "text": "func (euo *EventUpdateOne) Save(ctx context.Context) (*Event, error) {\n\tvar (\n\t\terr error\n\t\tnode *Event\n\t)\n\tif len(euo.hooks) == 0 {\n\t\tnode, err = euo.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*EventMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\teuo.mutation = mutation\n\t\t\tnode, err = euo.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn node, err\n\t\t})\n\t\tfor i := len(euo.hooks) - 1; i >= 0; i-- {\n\t\t\tmut = euo.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, euo.mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn node, err\n}", "title": "" }, { "docid": "4dfe133360cf7a83c4bdee92e09be341", "score": "0.4341524", "text": "func (wr *jsonWriter) insertElement(name string, elem interface{}, elType elemType) error {\n\tvar el interface{}\n\tif elType == mapT || elem == nil {\n\t\tarr := make([]interface{}, 0)\n\t\tif elem != nil {\n\t\t\tarr = append(arr, elem)\n\t\t}\n\t\tel = arr\n\t} else {\n\t\tel = elem\n\t}\n\tcurrent := wr.st.Peek()\n\tif current == nil {\n\t\tm := make(map[string]interface{})\n\t\twr.root = m\n\t\tm[name] = el\n\t} else {\n\t\tswitch c := current.(type) {\n\t\tcase map[string]interface{}:\n\t\t\tc[name] = el\n\t\t\t// fmt.Printf(\"** %#v\\n\", c)\n\t\tcase []interface{}:\n\t\t\twr.st.Pop()\n\t\t\tc = append(c, el)\n\t\t\twr.st.Push(c)\n\t\t\t//fmt.Printf(\"** %#v\\n\", c)\n\t\tcase interface{}:\n\t\t\treturn fmt.Errorf(\"ERRO: InsertElement(interface{}): %#v\\n\", c)\n\t\tdefault:\n\t\t\t//fmt.Printf(\"**** %#v\\n\", c)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd87546ce46106286624e39153aa1bea", "score": "0.43398747", "text": "func (u *Unbound) Pop() terminalapi.Event {\n\tu.mu.Lock()\n\tdefer u.mu.Unlock()\n\n\tif u.empty() {\n\t\treturn nil\n\t}\n\n\tn := u.first\n\tu.first = u.first.next\n\n\tif u.empty() {\n\t\tu.last = nil\n\t}\n\treturn n.event\n}", "title": "" }, { "docid": "2edc91b28ad4267501118f7ae4641850", "score": "0.4335648", "text": "func (m *WatchlisttypeMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase watchlisttype.FieldTypeID:\n\t\treturn m.OldTypeID(ctx)\n\tcase watchlisttype.FieldTypeName:\n\t\treturn m.OldTypeName(ctx)\n\tcase watchlisttype.FieldTypeDescription:\n\t\treturn m.OldTypeDescription(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Watchlisttype field %s\", name)\n}", "title": "" }, { "docid": "f582fc50dc843df611cfbaf4af581e35", "score": "0.43323684", "text": "func (e *Element) Set(v interface{}) {\n\te.value = v\n}", "title": "" }, { "docid": "3e709489a540e5c3af83eb12c52adf9a", "score": "0.43299818", "text": "func (o DomainInputMappingDefaultValuesPtrOutput) EventType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DomainInputMappingDefaultValues) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.EventType\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1136a219d9594dfa399cfa5c444bc16d", "score": "0.43250394", "text": "func (t EventType) String() string {\n\tswitch t {\n\tcase Added:\n\t\treturn \"added\"\n\tcase Removed:\n\t\treturn \"removed\"\n\tdefault:\n\t\treturn \"unknown\"\n\t}\n}", "title": "" }, { "docid": "a5fdb141f2bc670b0c0db9c5cc5699d0", "score": "0.43234992", "text": "func (t *Type) Elem() *Type {\n\tswitch t.kind {\n\tcase Optional, Array, List, Map:\n\tdefault:\n\t\tt.panicErrKind(\"Elem\", Optional, Array, List, Map)\n\t}\n\treturn t.elem\n}", "title": "" }, { "docid": "7cd0ceed11f16c310882767d0c7d062f", "score": "0.43231", "text": "func (ev *event) Type() models.EventType {\n\treturn ev.evType\n}", "title": "" }, { "docid": "a4d5a05601b6d801bed9ebf8b960bb4a", "score": "0.43217346", "text": "func (t *OpenconfigSystem_System_Aaa_Accounting_Events) RenameEvent(oldK, newK E_OpenconfigAaaTypes_AAA_ACCOUNTING_EVENT_TYPE) error {\n\tif _, ok := t.Event[newK]; ok {\n\t\treturn fmt.Errorf(\"key %v already exists in Event\", newK)\n\t}\n\n\te, ok := t.Event[oldK]\n\tif !ok {\n\t\treturn fmt.Errorf(\"key %v not found in Event\", oldK)\n\t}\n\te.EventType = newK\n\n\tt.Event[newK] = e\n\tdelete(t.Event, oldK)\n\treturn nil\n}", "title": "" }, { "docid": "4d4336b863402e23c805b0553be8cc59", "score": "0.43191543", "text": "func (m *TopicMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase topic.FieldTitle:\n\t\treturn m.OldTitle(ctx)\n\tcase topic.FieldContent:\n\t\treturn m.OldContent(ctx)\n\tcase topic.FieldIsReleased:\n\t\treturn m.OldIsReleased(ctx)\n\tcase topic.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase topic.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase topic.FieldCreaterID:\n\t\treturn m.OldCreaterID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Topic field %s\", name)\n}", "title": "" }, { "docid": "73a3f8e2f467f392d184ac5581e883b0", "score": "0.431161", "text": "func (w *event) Unwrap() *corev1.Event {\n\treturn w.Event\n}", "title": "" }, { "docid": "9758be22b513b1cbca82f8fd5c8fb057", "score": "0.43108356", "text": "func EventToRaw(e Event) *RawEvent {\n\traw := new(RawEvent)\n\tswitch e.GetType() {\n\tcase Events.ApplicationReplaced:\n\t\traw.ApplicationReplaced = e.(*ApplicationReplaced)\n\tcase Events.BridgeAttendedTransfer:\n\t\traw.BridgeAttendedTransfer = e.(*BridgeAttendedTransfer)\n\tcase Events.BridgeBlindTransfer:\n\t\traw.BridgeBlindTransfer = e.(*BridgeBlindTransfer)\n\tcase Events.BridgeCreated:\n\t\traw.BridgeCreated = e.(*BridgeCreated)\n\tcase Events.BridgeDestroyed:\n\t\traw.BridgeDestroyed = e.(*BridgeDestroyed)\n\tcase Events.BridgeMerged:\n\t\traw.BridgeMerged = e.(*BridgeMerged)\n\tcase Events.BridgeVideoSourceChanged:\n\t\traw.BridgeVideoSourceChanged = e.(*BridgeVideoSourceChanged)\n\tcase Events.ChannelCallerID:\n\t\traw.ChannelCallerID = e.(*ChannelCallerID)\n\tcase Events.ChannelConnectedLine:\n\t\traw.ChannelConnectedLine = e.(*ChannelConnectedLine)\n\tcase Events.ChannelCreated:\n\t\traw.ChannelCreated = e.(*ChannelCreated)\n\tcase Events.ChannelDestroyed:\n\t\traw.ChannelDestroyed = e.(*ChannelDestroyed)\n\tcase Events.ChannelDialplan:\n\t\traw.ChannelDialplan = e.(*ChannelDialplan)\n\tcase Events.ChannelDtmfReceived:\n\t\traw.ChannelDtmfReceived = e.(*ChannelDtmfReceived)\n\tcase Events.ChannelEnteredBridge:\n\t\traw.ChannelEnteredBridge = e.(*ChannelEnteredBridge)\n\tcase Events.ChannelHangupRequest:\n\t\traw.ChannelHangupRequest = e.(*ChannelHangupRequest)\n\tcase Events.ChannelHold:\n\t\traw.ChannelHold = e.(*ChannelHold)\n\tcase Events.ChannelLeftBridge:\n\t\traw.ChannelLeftBridge = e.(*ChannelLeftBridge)\n\tcase Events.ChannelStateChange:\n\t\traw.ChannelStateChange = e.(*ChannelStateChange)\n\tcase Events.ChannelTalkingFinished:\n\t\traw.ChannelTalkingFinished = e.(*ChannelTalkingFinished)\n\tcase Events.ChannelTalkingStarted:\n\t\traw.ChannelTalkingStarted = e.(*ChannelTalkingStarted)\n\tcase Events.ChannelUnhold:\n\t\traw.ChannelUnhold = e.(*ChannelUnhold)\n\tcase Events.ChannelUserevent:\n\t\traw.ChannelUserevent = e.(*ChannelUserevent)\n\tcase Events.ChannelVarset:\n\t\traw.ChannelVarset = e.(*ChannelVarset)\n\tcase Events.ContactInfo:\n\t\traw.ContactInfo = e.(*ContactInfo)\n\tcase Events.ContactStatusChange:\n\t\traw.ContactStatusChange = e.(*ContactStatusChange)\n\tcase Events.DeviceStateChanged:\n\t\traw.DeviceStateChanged = e.(*DeviceStateChanged)\n\tcase Events.Dial:\n\t\traw.Dial = e.(*Dial)\n\tcase Events.EndpointStateChange:\n\t\traw.EndpointStateChange = e.(*EndpointStateChange)\n\tcase Events.MissingParams:\n\t\traw.MissingParams = e.(*MissingParams)\n\tcase Events.Peer:\n\t\traw.Peer = e.(*Peer)\n\tcase Events.PeerStatusChange:\n\t\traw.PeerStatusChange = e.(*PeerStatusChange)\n\tcase Events.PlaybackContinuing:\n\t\traw.PlaybackContinuing = e.(*PlaybackContinuing)\n\tcase Events.PlaybackFinished:\n\t\traw.PlaybackFinished = e.(*PlaybackFinished)\n\tcase Events.PlaybackStarted:\n\t\traw.PlaybackStarted = e.(*PlaybackStarted)\n\tcase Events.RecordingFailed:\n\t\traw.RecordingFailed = e.(*RecordingFailed)\n\tcase Events.RecordingFinished:\n\t\traw.RecordingFinished = e.(*RecordingFinished)\n\tcase Events.RecordingStarted:\n\t\traw.RecordingStarted = e.(*RecordingStarted)\n\tcase Events.StasisEnd:\n\t\traw.StasisEnd = e.(*StasisEnd)\n\tcase Events.StasisStart:\n\t\traw.StasisStart = e.(*StasisStart)\n\tcase Events.TextMessageReceived:\n\t\traw.TextMessageReceived = e.(*TextMessageReceived)\n\n\tdefault:\n\t\treturn nil\n\t}\n\treturn raw\n}", "title": "" }, { "docid": "393acc5ec1a8c870298f540699627ea8", "score": "0.43105143", "text": "func (x *fastReflection_Event) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {\n\tswitch fd.FullName() {\n\tcase \"tendermint.abci.Event.type\":\n\t\tx.Type_ = value.Interface().(string)\n\tcase \"tendermint.abci.Event.attributes\":\n\t\tlv := value.List()\n\t\tclv := lv.(*_Event_2_list)\n\t\tx.Attributes = *clv.list\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.abci.Event\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.abci.Event does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "d4deb311a92f5f17ee47a99a64cfc7f9", "score": "0.4305399", "text": "func (m *WatchlistMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase watchlist.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase watchlist.FieldTaxID:\n\t\treturn m.OldTaxID(ctx)\n\tcase watchlist.FieldRankWatchlist:\n\t\treturn m.OldRankWatchlist(ctx)\n\tcase watchlist.FieldFileimportID:\n\t\treturn m.OldFileimportID(ctx)\n\tcase watchlist.FieldIsDeleted:\n\t\treturn m.OldIsDeleted(ctx)\n\tcase watchlist.FieldImportDate:\n\t\treturn m.OldImportDate(ctx)\n\tcase watchlist.FieldUserUpload:\n\t\treturn m.OldUserUpload(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Watchlist field %s\", name)\n}", "title": "" }, { "docid": "764bb668f3603dc93bfee5134a5a8c03", "score": "0.43009064", "text": "func (m *ConfigpointMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase configpoint.FieldTransactionName:\n\t\treturn m.OldTransactionName(ctx)\n\tcase configpoint.FieldTransactionType:\n\t\treturn m.OldTransactionType(ctx)\n\tcase configpoint.FieldPaymentChannel:\n\t\treturn m.OldPaymentChannel(ctx)\n\tcase configpoint.FieldPaymentType:\n\t\treturn m.OldPaymentType(ctx)\n\tcase configpoint.FieldDummyWallet:\n\t\treturn m.OldDummyWallet(ctx)\n\tcase configpoint.FieldAmount:\n\t\treturn m.OldAmount(ctx)\n\tcase configpoint.FieldPoint:\n\t\treturn m.OldPoint(ctx)\n\tcase configpoint.FieldExpire:\n\t\treturn m.OldExpire(ctx)\n\tcase configpoint.FieldUpdateDate:\n\t\treturn m.OldUpdateDate(ctx)\n\tcase configpoint.FieldExpireDate:\n\t\treturn m.OldExpireDate(ctx)\n\tcase configpoint.FieldStatusTransaction:\n\t\treturn m.OldStatusTransaction(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Configpoint field %s\", name)\n}", "title": "" }, { "docid": "2272ce39fb55742082444db0321da4de", "score": "0.42943123", "text": "func (event Event) Clone() (*Event, error) {\n\tvar stateClone *state.AnimatedElementState\n\tif event.State != nil {\n\t\tstateClone = event.State.Clone()\n\t}\n\tvar newExtradData ExtradData\n\tif event.ExtraData != nil {\n\t\tnewExtradData = make(ExtradData)\n\t\tfor key, value := range event.ExtraData {\n\t\t\tswitch key {\n\t\t\tcase \"otherPlayers\", \"projectiles\":\n\t\t\t\tanimatedElementStates := make(map[string]*state.AnimatedElementState)\n\t\t\t\tfor animatedElementID, animatedElementState := range value.(map[string]*state.AnimatedElementState) {\n\t\t\t\t\tanimatedElementClone := animatedElementState.Clone()\n\t\t\t\t\tanimatedElementStates[animatedElementID] = animatedElementClone\n\t\t\t\t}\n\t\t\t\tnewExtradData[key] = animatedElementStates\n\t\t\tcase \"worldMap\":\n\t\t\t\tnewExtradData[key] = value.(world.WorldMap).Clone()\n\t\t\tcase \"playerID\", \"projectileID\":\n\t\t\t\tnewExtradData[key] = value\n\t\t\tdefault:\n\t\t\t\treturn nil, errors.New(\"extra-data: \" + key + \" is not managed for Cloning\")\n\t\t\t}\n\t\t}\n\t}\n\tresult := &Event{\n\t\tAction: event.Action,\n\t\tPlayerID: event.PlayerID,\n\t\tState: stateClone,\n\t\tTimeFrame: event.TimeFrame,\n\t\tExtraData: newExtradData,\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ec9c874116ecd3ff370d82934893cce6", "score": "0.42914286", "text": "func (b *AttachmentBuilder) Event(value *EventBuilder) *AttachmentBuilder {\n\tb.event = value\n\tif value != nil {\n\t\tb.bitmap_ |= 128\n\t} else {\n\t\tb.bitmap_ &^= 128\n\t}\n\treturn b\n}", "title": "" }, { "docid": "c2d75b7a389788971b6a73a4ca1b1481", "score": "0.4287352", "text": "func (task *Task) GetElement() string {\n\treturn task.Element\n}", "title": "" }, { "docid": "0ad27472e4f4bce7a5c80cb634d4da03", "score": "0.4284275", "text": "func (t *OpenconfigSystem_System_Aaa_Authorization_Events) GetOrCreateEvent(EventType E_OpenconfigAaaTypes_AAA_AUTHORIZATION_EVENT_TYPE) *OpenconfigSystem_System_Aaa_Authorization_Events_Event {\n\n\tkey := EventType\n\n\tif v, ok := t.Event[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewEvent(EventType)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateEvent got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "09a930785f228f494cf686f745125ebb", "score": "0.42751202", "text": "func (self *Lefs) get_primer_evento() Event {\n\t/* fmt.Println(\"Lista antes de eliminar primer evento :\")\n\t(*self).il_eventos.Imprime()\n\t*/\n\tle_evento := (*self).Il_eventos.recoge_primer_evento()\n\t(*self).Il_eventos.elimina_primer_evento()\n\t/*fmt.Println(\"Lista DESPUES de eliminar primer evento :\")\n\t(*self).il_eventos.Imprime()\n\t*/\n\treturn le_evento\n}", "title": "" }, { "docid": "9d9695c6bab26c81793609e0e7f2c3c3", "score": "0.4260352", "text": "func (l *eventList) Put(msg *auparse.AuditMessage) {\n\tl.Lock()\n\tdefer l.Unlock()\n\n\tseq := sequenceNum(msg.Sequence)\n\te, found := l.events[seq]\n\n\t// Mark as complete, but do not append.\n\tif msg.RecordType == auparse.AUDIT_EOE {\n\t\tif found {\n\t\t\te.complete = true\n\t\t}\n\t\treturn\n\t}\n\n\tif !found {\n\t\tl.seqs = append(l.seqs, seq)\n\t\tl.seqs.Sort()\n\n\t\te = &event{\n\t\t\texpireTime: time.Now().Add(l.timeout),\n\t\t\tmsgs: make([]*auparse.AuditMessage, 0, 4),\n\t\t}\n\t\tl.events[seq] = e\n\t}\n\n\te.Add(msg)\n}", "title": "" }, { "docid": "a2be6898fa52ecd15306109b8332ee4c", "score": "0.4256722", "text": "func (e *Event) Set() {\n\t(*event)(e).set()\n}", "title": "" }, { "docid": "e038e0698bf1a87d78af0aecae90df3d", "score": "0.42566624", "text": "func (cl *ConfigListener) Event(e *core.Event) {\n\tlager.Logger.Infof(\"the value of %s is change to %v, get the values: %v\", e.Key, e.Value, Get(e.Key))\n}", "title": "" }, { "docid": "833cb8eb6b059200046378010eddcea3", "score": "0.42547947", "text": "func (e Event) Get(index uint, dflt ...interface{}) interface{} {\n\tvar d interface{}\n\tfor _, first := range dflt {\n\t\td = first\n\t\tbreak\n\t}\n\tif len(e.Args) > int(index) {\n\t\treturn e.Args[index]\n\t}\n\treturn d\n}", "title": "" }, { "docid": "0f3875d92565981c043ef58b0a72ab05", "score": "0.42538595", "text": "func newSimpleEvent(payload interface{}, topic string) (Event, error) {\n\tbuf := new(bytes.Buffer)\n\tenc := gob.NewEncoder(buf)\n\terr := enc.Encode(payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpayloadBytes := buf.Bytes()\n\treturn &simpeEvent{payloadBytes, topic}, nil\n}", "title": "" }, { "docid": "aaf86ec9ad5d494f4dbfb458cb031fca", "score": "0.4251324", "text": "func (r *Root) DeregisterElement(elem Element) {\n\tcreatedAt := elem.CreatedAt().Key()\n\tdelete(r.elementMapByCreatedAt, createdAt)\n\tdelete(r.removedElementPairMapByCreatedAt, createdAt)\n}", "title": "" }, { "docid": "c984c7b3480d20d08292bfb464a21cc2", "score": "0.42512083", "text": "func addDetails(e *Event, raw []byte) {\n\tvar err error\n\tswitch e.Type {\n\tcase I3WorkspaceEvent:\n\t\tvar d WorkspaceEvent\n\t\terr = json.Unmarshal(raw, &d)\n\t\te.Details = d\n\tcase I3ModeEvent:\n\t\tvar d ModeEvent\n\t\terr = json.Unmarshal(raw, &d)\n\t\te.Details = d\n\tcase I3WindowEvent:\n\t\tvar d WindowEvent\n\t\terr = json.Unmarshal(raw, &d)\n\t\te.Details = d\n\tcase I3BindingEvent:\n\t\tvar d BindingEvent\n\t\terr = json.Unmarshal(raw, &d)\n\t\te.Details = d\n\tdefault:\n\t\tvar d BaseEvent\n\t\terr = json.Unmarshal(raw, &d)\n\t\te.Details = d\n\t}\n\t//TODO: proper error handling\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "3a71f47d8fe80568d4ea04052246724e", "score": "0.42507577", "text": "func (n *node) takeValue(nt *notification) *value {\n\tcommandClassId := (uint8)(nt.value.cRef.valueId.commandClassId)\n\tinstanceId := (uint8)(nt.value.cRef.valueId.instance)\n\tindex := (uint8)(nt.value.cRef.valueId.index)\n\n\tinstance := n.createOrGetInstance(commandClassId, instanceId)\n\tv, ok := instance.values[index]\n\tif !ok {\n\t\tv = nt.swapValueImpl(nil)\n\t\tinstance.values[index] = v\n\n\t} else {\n\t\tnt.swapValueImpl(v)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "af50e24e24bd42ff224db813bad5beaa", "score": "0.4247883", "text": "func (dw *deleteWrap) OldValue(out interface{}) error {\n\treturn dw.delete.OldValue(out)\n}", "title": "" }, { "docid": "807a33e33ab89bb09977149618bf2bc4", "score": "0.42361698", "text": "func (h *ElementHolder) Push(element interface{}) {\n\th.elements = append(h.elements, element)\n}", "title": "" }, { "docid": "6696d553884266cae3ad51c3b34a3aea", "score": "0.42338127", "text": "func (s *Socket) GetEvent(name string) Event {\n\tch, ok := s.events[name]\n\tif !ok {\n\t\ts.events[name] = make(chan Message)\n\t\tch = s.events[name]\n\t}\n\treturn ch\n}", "title": "" }, { "docid": "53d8a9c8c562926655b1b5d3d8e46c72", "score": "0.42282265", "text": "func (o DomainInputMappingDefaultValuesOutput) EventType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DomainInputMappingDefaultValues) *string { return v.EventType }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b1c5bbd4052cc544602ba3dca1103155", "score": "0.42282093", "text": "func (T *RedBlackTree) Add(E Elem) error {\n\toldsize := T.size\n\tT.insert(E)\n\tif oldsize == T.size {\n\t\treturn errors.New(\"Item already exists in Tree.\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "553c6016ae8b15cd4912c53d8dbc6b93", "score": "0.42205447", "text": "func (m *WatchlisttypeMutation) OldTypeDescription(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldTypeDescription is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldTypeDescription requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldTypeDescription: %w\", err)\n\t}\n\treturn oldValue.TypeDescription, nil\n}", "title": "" }, { "docid": "dd9c932ffb4b2a19332c1760cd1a1f4d", "score": "0.42186192", "text": "func (mr *modelRef) elemValue() reflect.Value {\n\tif mr.value().IsNil() {\n\t\tmsg := fmt.Sprintf(\"zoom: panic in elemValue(). Model of type %T was nil\", mr.model)\n\t\tpanic(msg)\n\t}\n\treturn mr.value().Elem()\n}", "title": "" }, { "docid": "3772b6238528be096d9610c0992df6f0", "score": "0.42136502", "text": "func (p *posts) apply(event interface{}) *posts {\n\tp.mx.Lock()\n\tdefer p.mx.Unlock()\n\n\tswitch e := event.(type) {\n\tcase postAdded:\n\t\tnp := &post{\n\t\t\tid: e.id,\n\t\t\tcontent: e.content,\n\t\t}\n\t\tp.byId[np.id.String()] = np\n\t\tp.byTimeAdded = append(p.byTimeAdded, np)\n\n\tcase postEdited:\n\t\tp.byId[e.id.String()].content = e.content\n\n\tcase postDeleted:\n\t\tdelete(p.byId, e.id.String())\n\t\tp.byTimeAdded = p.byTimeAdded.Filter(func(pp interface{}) bool {\n\t\t\tif pp.(*post).id.String() == e.id.String() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\t}\n\treturn p\n}", "title": "" }, { "docid": "383767ec5504190d44986e59b184b633", "score": "0.4206403", "text": "func (m *TagTopicMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase tagtopic.FieldTagID:\n\t\treturn m.OldTagID(ctx)\n\tcase tagtopic.FieldTopicID:\n\t\treturn m.OldTopicID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown TagTopic field %s\", name)\n}", "title": "" }, { "docid": "19086cf398927d21a20bc746d8289ded", "score": "0.42018163", "text": "func (g *Gui) pollEvent() GocuiEvent {\n\tvar tev tcell.Event\n\tif g.playRecording {\n\t\tselect {\n\t\tcase ev := <-g.ReplayedEvents.Keys:\n\t\t\ttev = (ev).toTcellEvent()\n\t\tcase ev := <-g.ReplayedEvents.Resizes:\n\t\t\ttev = (ev).toTcellEvent()\n\t\tcase ev := <-g.ReplayedEvents.MouseEvents:\n\t\t\ttev = (ev).toTcellEvent()\n\t\t}\n\t} else {\n\t\ttev = Screen.PollEvent()\n\t}\n\n\tswitch tev := tev.(type) {\n\tcase *tcell.EventInterrupt:\n\t\treturn GocuiEvent{Type: eventInterrupt}\n\tcase *tcell.EventResize:\n\t\tw, h := tev.Size()\n\t\treturn GocuiEvent{Type: eventResize, Width: w, Height: h}\n\tcase *tcell.EventKey:\n\t\tk := tev.Key()\n\t\tch := rune(0)\n\t\tif k == tcell.KeyRune {\n\t\t\tk = 0 // if rune remove key (so it can match rune instead of key)\n\t\t\tch = tev.Rune()\n\t\t\tif ch == ' ' {\n\t\t\t\t// special handling for spacebar\n\t\t\t\tk = 32 // tcell keys ends at 31 or starts at 256\n\t\t\t\tch = rune(0)\n\t\t\t}\n\t\t}\n\t\tmod := tev.Modifiers()\n\t\t// remove control modifier and setup special handling of ctrl+spacebar, etc.\n\t\tif mod == tcell.ModCtrl && k == 32 {\n\t\t\tmod = 0\n\t\t\tch = rune(0)\n\t\t\tk = tcell.KeyCtrlSpace\n\t\t} else if mod == tcell.ModCtrl || mod == tcell.ModShift {\n\t\t\t// remove Ctrl or Shift if specified\n\t\t\t// - shift - will be translated to the final code of rune\n\t\t\t// - ctrl - is translated in the key\n\t\t\tmod = 0\n\t\t} else if mod == tcell.ModAlt && k == tcell.KeyEnter {\n\t\t\t// for the sake of convenience I'm having a KeyAltEnter key. I will likely\n\t\t\t// regret this laziness in the future. We're arbitrarily mapping that to tcell's\n\t\t\t// KeyF64.\n\t\t\tmod = 0\n\t\t\tk = tcell.KeyF64\n\t\t}\n\n\t\treturn GocuiEvent{\n\t\t\tType: eventKey,\n\t\t\tKey: Key(k),\n\t\t\tCh: ch,\n\t\t\tMod: Modifier(mod),\n\t\t}\n\tcase *tcell.EventMouse:\n\t\tx, y := tev.Position()\n\t\tbutton := tev.Buttons()\n\t\tmouseKey := MouseRelease\n\t\tmouseMod := ModNone\n\t\t// process mouse wheel\n\t\tif button&tcell.WheelUp != 0 {\n\t\t\tmouseKey = MouseWheelUp\n\t\t}\n\t\tif button&tcell.WheelDown != 0 {\n\t\t\tmouseKey = MouseWheelDown\n\t\t}\n\t\tif button&tcell.WheelLeft != 0 {\n\t\t\tmouseKey = MouseWheelLeft\n\t\t}\n\t\tif button&tcell.WheelRight != 0 {\n\t\t\tmouseKey = MouseWheelRight\n\t\t}\n\n\t\twheeling := mouseKey == MouseWheelUp || mouseKey == MouseWheelDown || mouseKey == MouseWheelLeft || mouseKey == MouseWheelRight\n\n\t\t// process button events (not wheel events)\n\t\tbutton &= tcell.ButtonMask(0xff)\n\t\tif button != tcell.ButtonNone && lastMouseKey == tcell.ButtonNone {\n\t\t\tlastMouseKey = button\n\t\t\tlastMouseMod = tev.Modifiers()\n\t\t\tswitch button {\n\t\t\tcase tcell.ButtonPrimary:\n\t\t\t\tmouseKey = MouseLeft\n\t\t\t\tdragState = MAYBE_DRAGGING\n\t\t\t\tlastX = x\n\t\t\t\tlastY = y\n\t\t\tcase tcell.ButtonSecondary:\n\t\t\t\tmouseKey = MouseRight\n\t\t\tcase tcell.ButtonMiddle:\n\t\t\t\tmouseKey = MouseMiddle\n\t\t\t}\n\t\t}\n\n\t\tswitch tev.Buttons() {\n\t\tcase tcell.ButtonNone:\n\t\t\tif lastMouseKey != tcell.ButtonNone {\n\t\t\t\tswitch lastMouseKey {\n\t\t\t\tcase tcell.ButtonPrimary:\n\t\t\t\t\tdragState = NOT_DRAGGING\n\t\t\t\tcase tcell.ButtonSecondary:\n\t\t\t\tcase tcell.ButtonMiddle:\n\t\t\t\t}\n\t\t\t\tmouseMod = Modifier(lastMouseMod)\n\t\t\t\tlastMouseMod = tcell.ModNone\n\t\t\t\tlastMouseKey = tcell.ButtonNone\n\t\t\t}\n\t\t}\n\n\t\tif !wheeling {\n\t\t\tswitch dragState {\n\t\t\tcase NOT_DRAGGING:\n\t\t\t\treturn GocuiEvent{Type: eventNone}\n\t\t\t// if we haven't released the left mouse button and we've moved the cursor then we're dragging\n\t\t\tcase MAYBE_DRAGGING:\n\t\t\t\tif x != lastX || y != lastY {\n\t\t\t\t\tdragState = DRAGGING\n\t\t\t\t}\n\t\t\tcase DRAGGING:\n\t\t\t\tmouseMod = ModMotion\n\t\t\t\tmouseKey = MouseLeft\n\t\t\t}\n\t\t}\n\n\t\treturn GocuiEvent{\n\t\t\tType: eventMouse,\n\t\t\tMouseX: x,\n\t\t\tMouseY: y,\n\t\t\tKey: mouseKey,\n\t\t\tCh: 0,\n\t\t\tMod: mouseMod,\n\t\t}\n\tcase *tcell.EventFocus:\n\t\treturn GocuiEvent{\n\t\t\tType: eventFocus,\n\t\t\tFocused: tev.Focused,\n\t\t}\n\tdefault:\n\t\treturn GocuiEvent{Type: eventNone}\n\t}\n}", "title": "" } ]
93d671419ff28795d25b977089bfcc36
Validate validates s against the YANG schema corresponding to its type.
[ { "docid": "5b9ef0adfa5315c07a8dd2e3bf3690ad", "score": "0.0", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MaxReservableLinkBandwidth) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MaxReservableLinkBandwidth\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "829e43df4b46a8b2131e2b8ccaf9e213", "score": "0.6214569", "text": "func (b *Binder) Validate(s interface{}) error {\n\treturn b.validator.Struct(s)\n}", "title": "" }, { "docid": "e2b12091245e631515b22840359ee6c3", "score": "0.5937292", "text": "func (s *StreamWriter) Validate(t typewriter.Type) (bool, error) {\n\treturn true, nil\n}", "title": "" }, { "docid": "375b5129dfe442b6626821aa079ec7b5", "score": "0.5936571", "text": "func (pr *Parser) Validate(s string, opts Options) Err {\n\treturn pr.validate(s, opts)\n}", "title": "" }, { "docid": "6cb90c15007419d28891900ba345d0e8", "score": "0.5910243", "text": "func Validate(s []byte) error {\n\titer := iterator{s: s}\n\terr := validate(&iter)\n\tif err != nil {\n\t\treturn err\n\t}\n\titer.AdvancePastAllWhiteSpace()\n\tif iter.Cursor() != iter.Len() {\n\t\treturn ValidationError{msg: \"Extra characters at the end of the json string\"}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "29b56c65b9ee75a9de95e27d1c7ebea1", "score": "0.5895862", "text": "func (s *StringValue) Validate(f *flag.Flag) error { return s.v.Validate(f) }", "title": "" }, { "docid": "5229f8638befae9145c235799b39fc41", "score": "0.5863666", "text": "func (val *SchemaValidator) ValidateString(doc string) (valid bool, err error) {\n\tdocumentLoader := gojsonschema.NewStringLoader(doc)\n\treturn val.validate(documentLoader)\n}", "title": "" }, { "docid": "bae4a79c4b311fa60d593b12021e75c9", "score": "0.58356035", "text": "func (m ServiceType) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "a91ef1018e6b3cb88155e2d4b33ab4ba", "score": "0.5755088", "text": "func (s HookType) Validate() error {\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\tswitch s {\n\tcase PreHook:\n\tcase PostHook:\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported hook type: %s\", s)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ca72f048e7378e091e7595749e428a17", "score": "0.56673914", "text": "func (s *State) Validate() error {\n\treturn validate.Struct(s)\n}", "title": "" }, { "docid": "816c5e1007a3c05acf4b28fc6d9b6377", "score": "0.5640879", "text": "func (ut *ChecktypeType) Validate() (err error) {\n\n\tif ut.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"name\"))\n\t}\n\tif ut.Image == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"image\"))\n\t}\n\tif ut.Description != nil {\n\t\tif ok := goa.ValidatePattern(`^[[:print:]]+`, *ut.Description); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`type.description`, *ut.Description, `^[[:print:]]+`))\n\t\t}\n\t}\n\tif ut.Description != nil {\n\t\tif utf8.RuneCountInString(*ut.Description) > 255 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.description`, *ut.Description, utf8.RuneCountInString(*ut.Description), 255, false))\n\t\t}\n\t}\n\tif ok := goa.ValidatePattern(`^[[:word:]]+`, ut.Name); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`type.name`, ut.Name, `^[[:word:]]+`))\n\t}\n\tif utf8.RuneCountInString(ut.Name) < 1 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.name`, ut.Name, utf8.RuneCountInString(ut.Name), 1, true))\n\t}\n\treturn\n}", "title": "" }, { "docid": "15570dae5492952a26420a03501f97b4", "score": "0.5609977", "text": "func Validate(b []byte, val interface{}) error {\n\tm := make(map[string]interface{})\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn ResolveJSONError(b, err)\n\t}\n\tif err := checkFields(m, reflect.ValueOf(val)); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "281cb5883cb5db7d18f78ae60a66120a", "score": "0.55690897", "text": "func Example_fromString() {\n\tschema := `{\"type\": \"object\"}`\n\tinstance := `{\"foo\": \"bar\"}`\n\n\tsch, err := jsonschema.CompileString(\"schema.json\", schema)\n\tif err != nil {\n\t\tlog.Fatalf(\"%#v\", err)\n\t}\n\n\tvar v interface{}\n\tif err := json.Unmarshal([]byte(instance), &v); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif err = sch.Validate(v); err != nil {\n\t\tlog.Fatalf(\"%#v\", err)\n\t}\n\t// Output:\n}", "title": "" }, { "docid": "2d5264dcae7b1bf5d7477d8ed2ddbeb4", "score": "0.5559986", "text": "func (s *StringRule) Validate(cv ctypes.ConfigValue) error {\n\t// Check that type is correct\n\tif cv.Type() != StringType {\n\t\treturn wrongType(s.key, cv.Type(), StringType)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f553ea7dbf2c11cf263bb5a2aa4f47c3", "score": "0.5550975", "text": "func (ut *checktypeType) Validate() (err error) {\n\tif ut.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"id\"))\n\t}\n\tif ut.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"name\"))\n\t}\n\tif ut.Image == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"image\"))\n\t}\n\tif ut.Description != nil {\n\t\tif ok := goa.ValidatePattern(`^[[:print:]]+`, *ut.Description); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`request.description`, *ut.Description, `^[[:print:]]+`))\n\t\t}\n\t}\n\tif ut.Description != nil {\n\t\tif utf8.RuneCountInString(*ut.Description) > 255 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.description`, *ut.Description, utf8.RuneCountInString(*ut.Description), 255, false))\n\t\t}\n\t}\n\tif ut.Name != nil {\n\t\tif ok := goa.ValidatePattern(`^[[:word:]]+`, *ut.Name); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`request.name`, *ut.Name, `^[[:word:]]+`))\n\t\t}\n\t}\n\tif ut.Name != nil {\n\t\tif utf8.RuneCountInString(*ut.Name) < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.name`, *ut.Name, utf8.RuneCountInString(*ut.Name), 1, true))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "617efc2318e8fb2c162d4f4179fc90be", "score": "0.5504195", "text": "func Validate(x interface{}) error {\n\tc := defaultCodec\n\tc.mutex.RLock()\n\tdefer c.mutex.RUnlock()\n\n\tr := defaultCodec.runtime\n\tv, err := fromGoType(r, x)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw, err := fromGoValue(r, x, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tv = v.Unify(w)\n\tif err := v.Validate(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ace5bd92a797b96d9307e985f582e998", "score": "0.55012393", "text": "func isValidType(s string) bool {\n s = strings.TrimSpace(s)\n if len(s) == 0 {\n return false \n }\n\n switch s[0:1] {\n case \"`\" : return isValidTypeVar(s)\n case \"(\" : return isValidFuncType(s)\n case \"[\" : return isValidList(s)\n default : return isValidPrimitive(s)\n }\n}", "title": "" }, { "docid": "6e80e80cc63c4f07416b25f120627042", "score": "0.54792356", "text": "func (st ServiceType) Validate() error {\n\tswitch st {\n\tcase ServiceTypeREST, ServiceTypeGRPC:\n\t\treturn nil\n\t}\n\treturn ErrInvalidServiceType\n}", "title": "" }, { "docid": "effc3eeddfd6bc9bfb05e1ccb2225543", "score": "0.54364556", "text": "func Validate(t interface{}) error {\n\treturn validator.Struct(t)\n}", "title": "" }, { "docid": "1164efab6bf0591dd0079b8ac02c1ecb", "score": "0.54088056", "text": "func (s Schema) Validate() bool {\n\tif len(s) == 0 {\n\t\treturn false\n\t}\n\tfor _, v := range s {\n\t\tif !v.Validate() {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "47af65825149c0b2d7f474b2ba8cc8cd", "score": "0.5395894", "text": "func (s Schema) Validate() diag.Diagnostics {\n\treturn s.ValidateImplementation(context.Background())\n}", "title": "" }, { "docid": "f9872e3fd7ebccd31e1f632d98927178", "score": "0.53708756", "text": "func (e *Exploration) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.Validate(\n\t\t&validators.StringIsPresent{Field: e.FoundType, Name: \"FoundType\"},\n\t), nil\n}", "title": "" }, { "docid": "942a6f81c890161d479d8c50435f5d69", "score": "0.53647214", "text": "func (schema Schema) Validate() error {\n\tvalidaters := []validater{}\n\tfor _, s := range schema.AllOf {\n\t\tvalidaters = append(validaters, s)\n\t}\n\tfor _, s := range schema.OneOf {\n\t\tvalidaters = append(validaters, s)\n\t}\n\tfor _, s := range schema.AnyOf {\n\t\tvalidaters = append(validaters, s)\n\t}\n\tif schema.Not != nil {\n\t\tvalidaters = append(validaters, schema.Not)\n\t}\n\tif schema.Items != nil {\n\t\tvalidaters = append(validaters, schema.Items)\n\t}\n\tif schema.Discriminator != nil {\n\t\tvalidaters = append(validaters, schema.Discriminator)\n\t}\n\tif schema.XML != nil {\n\t\tvalidaters = append(validaters, schema.XML)\n\t}\n\tif schema.ExternalDocs != nil {\n\t\tvalidaters = append(validaters, schema.ExternalDocs)\n\t}\n\tfor _, property := range schema.Properties {\n\t\tvalidaters = append(validaters, property)\n\t}\n\tif e, ok := schema.Example.(validater); ok {\n\t\tvalidaters = append(validaters, e)\n\t}\n\tfor k := range schema.Extension {\n\t\tif !strings.HasPrefix(k, \"x-\") {\n\t\t\treturn fmt.Errorf(\"unknown field: %s\", k)\n\t\t}\n\t}\n\treturn validateAll(validaters)\n}", "title": "" }, { "docid": "9943d855943de5fb56a1ba13b0aa16f7", "score": "0.5363666", "text": "func ValidateStruct(s interface{}) (bool, []*ValidError) {\n\treturn validateStruct(\"\", s)\n}", "title": "" }, { "docid": "1e282c0e4c4ac701e036a046912907f0", "score": "0.53485453", "text": "func validateType(ttype reflect.Type) error {\n\tif ttype.Kind() != reflect.Struct {\n\t\tif ttype.Kind() == reflect.Ptr && ttype.Elem().Kind() != reflect.Struct { // if value is not a pointer to a struct\n\t\t\treturn NotAStruct\n\t\t}\n\t}\n\tif ttype.Kind() == reflect.Ptr { // \"indirect\" if value is a pointer to a struct\n\t\tttype = ttype.Elem()\n\t}\n\tid, ok := ttype.FieldByName(\"ID\")\n\tif !ok {\n\t\treturn IdNotFound\n\t}\n\tif id.Type.Kind() != reflect.Uint {\n\t\treturn IdIsNotUint\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7afaa1a56f04a8ac93cf20850eccfce", "score": "0.5343273", "text": "func (r StringRule) Validate(value interface{}) error {\n\tvalue, isNil := Indirect(value)\n\tif isNil || IsEmpty(value) {\n\t\treturn nil\n\t}\n\n\tstr, err := EnsureString(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif r.validate(str) {\n\t\treturn nil\n\t}\n\n\treturn r.err\n}", "title": "" }, { "docid": "83eee96d8ce1ae9e46a1cc036ba5927d", "score": "0.5338558", "text": "func (t *Interface_Sonet) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Interface_Sonet\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae51c638196ed03876d413a3b8720f56", "score": "0.5303816", "text": "func isValidated(typ string) bool {\n\tfor _, v := range validatedTypes {\n\t\tif v == typ {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a75499507e2a5dfe7bab3cc75b3353f6", "score": "0.52864087", "text": "func (c *SSMLProsody) Validate() error {\n\tok := Validate(\n\t\tRequired(c.Text),\n\t)\n\tif !ok {\n\t\treturn fmt.Errorf(\"%s markup failed validation\", c.Type())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "18287b005d59462bdbc4fd6f2f90a445", "score": "0.52841425", "text": "func checkType(props *v1beta1.JSONSchemaProps, s string, enums *[]v1beta1.JSON) {\n\tswitch props.Type {\n\tcase \"integer\":\n\t\tif _, err := strconv.ParseInt(s, 0, 64); err != nil {\n\t\t\tlog.Fatalf(\"Invalid integer value [%v] for a field of integer type\", s)\n\t\t}\n\t\t*enums = append(*enums, v1beta1.JSON{Raw: []byte(fmt.Sprintf(\"%v\", s))})\n\tcase \"float\", \"number\":\n\t\tif _, err := strconv.ParseFloat(s, 64); err != nil {\n\t\t\tlog.Fatalf(\"Invalid float value [%v] for a field of float type\", s)\n\t\t}\n\t\t*enums = append(*enums, v1beta1.JSON{Raw: []byte(fmt.Sprintf(\"%v\", s))})\n\tcase \"string\":\n\t\t*enums = append(*enums, v1beta1.JSON{Raw: []byte(`\"` + s + `\"`)})\n\t}\n}", "title": "" }, { "docid": "23ceb78545c90574112422de773881eb", "score": "0.52764374", "text": "func (m *SetSubscriptionTypePayload) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateSubscriptionType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3fc79c799b908a0d880004ed08211fde", "score": "0.52647847", "text": "func (o *Types) Validate(req *http.Request, errs binding.Errors) error {\n\tif o.Name == \"\" {\n\t\terrs = append(errs, binding.Error{\n\t\t\tFieldNames: []string{\"message\"},\n\t\t\tClassification: \"ComplaintError\",\n\t\t\tMessage: \"Name can't be blank\",\n\t\t})\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "d7f3d55d3ab39fb8720d574c482a8519", "score": "0.5255446", "text": "func isValidType(s string) bool {\n\ts = strings.ToLower(s)\n\tif s == \"bool\" ||\n\t\ts == \"char\" ||\n\t\ts == \"uint8_t\" ||\n\t\ts == \"uint16_t\" ||\n\t\ts == \"uint32_t\" ||\n\t\ts == \"uint64_t\" ||\n\t\ts == \"int8_t\" ||\n\t\ts == \"int16_t\" ||\n\t\ts == \"int32_t\" ||\n\t\ts == \"int64_t\" ||\n\t\ts == \"float\" ||\n\t\ts == \"double\" ||\n\t\ts == \"dtimer_t\" ||\n\t\ts == \"rtimer_t\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0fb90f83b5d79d2bc691516a790094d1", "score": "0.5247536", "text": "func (o *DNS) Validate() error {\n\treturn validate.Struct(o)\n}", "title": "" }, { "docid": "bb8b97af8239417dd2035338484c2945", "score": "0.5244987", "text": "func Validate(s interface{}) []error {\n\terrors := make([]error, 0)\n\n\tv := reflect.ValueOf(s)\n\tt := v.Type()\n\n\tif t.Kind() == reflect.Ptr {\n\t\tv = v.Elem()\n\t\tt = v.Type()\n\t}\n\n\tnonblank := make([]string, 0)\n\turls := make([]string, 0)\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tvalidate := f.Tag.Get(\"validate\")\n\t\tif validate != \"\" {\n\t\t\tparts := strings.Split(validate, \",\")\n\t\t\tfor _, p := range parts {\n\t\t\t\tif p == \"nonblank\" {\n\t\t\t\t\tnonblank = append(nonblank, f.Name)\n\t\t\t\t}\n\t\t\t\tif p == \"url\" {\n\t\t\t\t\turls = append(urls, f.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, nb := range nonblank {\n\t\tf := v.FieldByName(nb)\n\t\ts := f.String()\n\n\t\tif s == \"\" {\n\t\t\terrors = append(errors, fmt.Errorf(\"%s cannot be blank\", nb))\n\t\t}\n\t}\n\n\treturn errors\n}", "title": "" }, { "docid": "32c7941b5985cfa4b2435579ddcdf864", "score": "0.5237891", "text": "func ValidateString(s string) error {\n\tv := Validator{}\n\treturn v.Validate([]byte(s))\n}", "title": "" }, { "docid": "b6821b1f45bf7504b2dedaa3c8d15943", "score": "0.5237474", "text": "func (v *typeValue) validate() error {\n\t// Check type and set default if empty\n\tif *v == \"\" {\n\t\t*v = FtBool\n\t}\n\n\t// Check type is valid\n\timplemented, found := ValidTypes[*v]\n\n\tif !found {\n\t\treturn formatErrorItem(2, \"-\", \"type '%s' is not known\", *v)\n\t} else if !implemented {\n\t\treturn formatErrorItem(2, \"-\", \"type '%s' is not implemented\", *v)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f56f6489bb2f2d392bb2003f425202b6", "score": "0.52361363", "text": "func (m AnyDataType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateAnyDataTypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db071c7b1f487672c2623f4b9456bea8", "score": "0.51965755", "text": "func (t *Stp) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c7bdc84e67c9b24a704a74786af67463", "score": "0.519657", "text": "func Validate(schema string, data []byte) error {\n\tresults, err := gojsonschema.Validate(\n\t\tgojsonschema.NewStringLoader(schema), gojsonschema.NewBytesLoader(data),\n\t)\n\n\tif err != nil {\n\t\treturn Error{\n\t\t\tType: \"parsing\",\n\t\t\tMessage: \"Input parsing error\",\n\t\t\tDetails: err,\n\t\t}\n\t}\n\n\tif len(results.Errors()) == 0 {\n\t\treturn nil\n\t}\n\n\treturn Error{\n\t\tType: \"validation\",\n\t\tMessage: \"The input is invalid.\",\n\t\tDetails: results.Errors(),\n\t}\n}", "title": "" }, { "docid": "591fa0ed2b346a69258b958211e6ac6c", "score": "0.5194944", "text": "func Validate(v interface{}) error {\n\treturn validate.Struct(v)\n}", "title": "" }, { "docid": "ad0ebecc0d9567c48d3933aebf61f729", "score": "0.51944", "text": "func (si SchemaItem) Validate() bool {\n\tif si.name == \"\" || si.typeName == \"\" || si.dataIndex < 0 {\n\t\treturn false\n\t}\n\n\tswitch reflect.TypeOf(si.iType) {\n\tcase itemTypeRefBool, itemTypeRefInt8, itemTypeRefInt16, itemTypeRefInt32,\n\t\titemTypeRefInt64, itemTypeRefUint8, itemTypeRefUint16, itemTypeRefUint32,\n\t\titemTypeRefUint64, itemTypeRefFloat32, itemTypeRefFloat64, itemTypeRefString,\n\t\titemTypeRefArray, itemTypeRefMap, itemTypeRefObject, itemTypeRefTime:\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6aec3709f3185d8a3e5ed6e2264acd01", "score": "0.51887685", "text": "func (ut *SubscriptionPayload) Validate() (err error) {\n\tif ut.Alias != nil {\n\t\tif utf8.RuneCountInString(*ut.Alias) < 2 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.alias`, *ut.Alias, utf8.RuneCountInString(*ut.Alias), 2, true))\n\t\t}\n\t}\n\tif ut.URI != nil {\n\t\tif utf8.RuneCountInString(*ut.URI) < 5 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.uri`, *ut.URI, utf8.RuneCountInString(*ut.URI), 5, true))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9896d46abbbcc8c06685f7907cf3ebaa", "score": "0.5177877", "text": "func Validate(schema *Schema, typename string, data interface{}) Validation {\n\tv := getValidator(schema)\n\treturn validateWithValidator(v, typename, data)\n}", "title": "" }, { "docid": "d1a17bcb906a20d1e5ec6183ff46cd94", "score": "0.5163257", "text": "func (m *PowerFeedType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLabel(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateValue(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eeee01771decc1cebabf96e1cb338592", "score": "0.51554805", "text": "func (m V1VisualizationType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateV1VisualizationTypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f81dfd07ec6d173b7ac1b620105b8ef1", "score": "0.51419944", "text": "func validateLengthSchema(schema *yang.Entry) error {\n\tif len(schema.Type.Length) == 0 {\n\t\treturn nil\n\t}\n\tfor _, r := range schema.Type.Length {\n\t\t// This is a limited check. It's assumed that a full check is\n\t\t// done in the goyang parser.\n\t\tminLen, maxLen := r.Min, r.Max\n\t\tif minLen.Negative {\n\t\t\treturn fmt.Errorf(\"length Min must be positive: %v for schema %s\", minLen, schema.Name)\n\t\t}\n\t\tif maxLen.Negative {\n\t\t\treturn fmt.Errorf(\"length Max must be positive: %v for schema %s\", minLen, schema.Name)\n\t\t}\n\t\tif maxLen.Less(minLen) {\n\t\t\treturn fmt.Errorf(\"schema has bad length min[%v] > max[%v] for schema %s\", minLen, maxLen, schema.Name)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e94de9304c1f06def967d6a94a328710", "score": "0.5140846", "text": "func (u *UserTypeDefinition) Validate(ctx string, parent dslengine.Definition) *dslengine.ValidationErrors {\n\tverr := new(dslengine.ValidationErrors)\n\tif u.TypeName == \"\" {\n\t\tverr.Add(parent, \"%s - %s\", ctx, \"User type must have a name\")\n\t}\n\tverr.Merge(u.AttributeDefinition.Validate(ctx, u))\n\treturn verr.AsError()\n}", "title": "" }, { "docid": "6690717e5c98d649ba8c2d04a8957de7", "score": "0.51383525", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa_TypeOfService) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa_TypeOfService\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fc6f266e8cb1b453f5091bb1593e4a44", "score": "0.5128181", "text": "func (v *defValueValue) validate(aType typeValue) error {\n\tif *v != \"\" {\n\t\treturn nil\n\t}\n\n\t// Init the DefValue\n\tswitch aType {\n\tcase FtBool:\n\t\t*v = defValueValue(strconv.FormatBool(false))\n\tcase FtCount, FtDuration, FtFloat32, FtFloat64, FtInt, FtInt8, FtInt16, FtInt32, FtUint, FtUint8, FtUint16, FtUint32:\n\t\t*v = defValueValue(strconv.FormatInt(0, 10))\n\tcase FtString:\n\t\t*v = \"\"\n\tcase ftTest3: // used for testing only\n\t\t*v = \"\"\n\tdefault:\n\t\tif implemented := ValidTypes[aType]; implemented {\n\t\t\t// Mandatory implementation missing -> panic\n\t\t\tpanic(fmt.Sprintf(\"Error implementation of DefValue validation missing for type '%s'\", aType))\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "110f3eca9f922a3a1b852558565a2952", "score": "0.5123761", "text": "func (o *DNSRecord) Validate() error {\n\treturn validate.Struct(o)\n}", "title": "" }, { "docid": "0b40ddb68613c962b8ee8540949d0c96", "score": "0.51226425", "text": "func (m MonitorType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateMonitorTypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cedbfa479ef3184fe53cfafc315f26d6", "score": "0.5122253", "text": "func (m Fact) Validate() error {\n\treturn validation.ValidateStruct(&m,\n\t\tvalidation.Field(&m.FactString, validation.Required, validation.Length(0, 1000)),\n\t)\n}", "title": "" }, { "docid": "c05a0d54f9792f1f29a71bbac12548dc", "score": "0.51003754", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NssaExternalLsa_TypeOfService) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NssaExternalLsa_TypeOfService\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "65a88e88f831966472fea5d2a7aec72b", "score": "0.5100108", "text": "func (t Type) IsValid() bool {\n\treturn int(t) < len(MsgTypeStr)\n}", "title": "" }, { "docid": "2c7a45b0062c11a605cf81f6b1e35644", "score": "0.5095633", "text": "func (r *schemaValidatorType) validateSchema(schema, cfg string) []serror.SnapError {\n\tschemaLoader := gojsonschema.NewStringLoader(schema)\n\ttestDoc := gojsonschema.NewStringLoader(cfg)\n\tresult, err := gojsonschema.Validate(schemaLoader, testDoc)\n\tvar serrors []serror.SnapError\n\t// Check for invalid json\n\tif err != nil {\n\t\tserrors = append(serrors, serror.New(err))\n\t\treturn serrors\n\t}\n\t// check if result passes validation\n\tif result.Valid() {\n\t\treturn nil\n\t}\n\tfor _, err := range result.Errors() {\n\t\tserr := serror.New(errors.New(\"Validate schema error\"))\n\t\tserr.SetFields(map[string]interface{}{\n\t\t\t\"value\": err.Value(),\n\t\t\t\"context\": err.Context().String(\"::\"),\n\t\t\t\"description\": err.Description(),\n\t\t})\n\t\tserrors = append(serrors, serr)\n\t}\n\treturn serrors\n}", "title": "" }, { "docid": "7921d5fb5d43dbbe2472aef1a9acb147", "score": "0.50873864", "text": "func CheckTypeString(s string) (CheckType, error) {\n\tif val, ok := _CheckTypeNameToValueMap[s]; ok {\n\t\treturn val, nil\n\t}\n\n\tif val, ok := _CheckTypeNameToValueMap[strings.ToLower(s)]; ok {\n\t\treturn val, nil\n\t}\n\treturn 0, fmt.Errorf(\"%s does not belong to CheckType values\", s)\n}", "title": "" }, { "docid": "5f5f04f1033b09e8b885cb31d59b9997", "score": "0.50869435", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa_TypeOfService) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa_TypeOfService\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e958df8e1bad6084aee17daad4da72b1", "score": "0.50656533", "text": "func (f *formatStringValidation) Validate(value interface{}, obj reflect.Value) *ValidationError {\r\n\tstrValue, ok := value.(string)\r\n\tif !ok {\r\n\t\treturn &ValidationError{\r\n\t\t\tKey: f.FieldName(),\r\n\t\t\tMessage: \"is not of type string and FormatValidation only accepts strings\",\r\n\t\t}\r\n\t}\r\n\r\n\tif !f.pattern.MatchString(strValue) {\r\n\t\treturn &ValidationError{\r\n\t\t\tKey: f.FieldName(),\r\n\t\t\tMessage: \"does not match \" + f.patternName + \" format\",\r\n\t\t}\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "5b3cdd1b94386222ad9a336a9d25093e", "score": "0.50584924", "text": "func (c ConfigType) Validate() error {\n\tswitch c {\n\tcase KV:\n\t\treturn errors.New(\"not support kv config type for now\")\n\tcase File:\n\tcase Table:\n\t\treturn errors.New(\"not support table config type for now\")\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported config type: %s\", c)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "010388230dd04ccaafc333d3ed580f84", "score": "0.5050604", "text": "func (m OBExternalLegalStructureType1Code) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3e2685392e2065fc030ed20cea886b0d", "score": "0.50496525", "text": "func (p *Pattern) Validate() error {\n\tif len(p.Kind) == 0 {\n\t\treturn errors.New(\"Kind cannot be empty\")\n\t}\n\n\tif len(p.Value) == 0 {\n\t\treturn errors.New(\"Value cannot be empty\")\n\t}\n\n\tif p.Kind != \"suffix\" && p.Kind != \"prefix\" && p.Kind != \"regex\" && p.Kind != \"timestring\" {\n\t\treturn errors.New(\"Invalid kind\")\n\t}\n\n\tif p.Kind == \"timestring\" {\n\t\tif err := validateTimestring(p.Value); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fe866ea5bade678bab21cfb7772f8b51", "score": "0.50493973", "text": "func ValidateString(input interface{}) error {\n\tv, ok := input.(string)\n\tif !ok {\n\t\treturn fmt.Errorf(\"input param is not a string\")\n\t}\n\n\tif len(v) < 3 {\n\t\treturn fmt.Errorf(\"lenght less than 3\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "995adf840d20483fed458bc586fed65f", "score": "0.50419015", "text": "func (o *GSLB) Validate() error {\n\treturn validate.Struct(o)\n}", "title": "" }, { "docid": "1eed492188ef8e8883f52f5890a7fde0", "score": "0.5028368", "text": "func (o *GSLBServer) Validate() error {\n\treturn validate.Struct(o)\n}", "title": "" }, { "docid": "61e7c9d6075202df23ade026bd54d11f", "score": "0.50218993", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "141e296f0cb3be4a44cd40be5fbeb337", "score": "0.5021573", "text": "func (v *validate) Validate(i interface{}) error {\n\treturn v.Validator.Struct(i)\n}", "title": "" }, { "docid": "a5a1e599c3b76ecd15e133b6284518ff", "score": "0.50211823", "text": "func Validate(b []byte) error {\n\tv := Validator{}\n\treturn v.Validate(b)\n}", "title": "" }, { "docid": "60dfc700f9a07bf00bc5ba7f9c58699e", "score": "0.5019898", "text": "func (m *minLengthStringValidation) Validate(value interface{}, obj reflect.Value) *ValidationError {\r\n\tstrValue, ok := value.(string)\r\n\tif !ok {\r\n\t\treturn &ValidationError{\r\n\t\t\tKey: m.FieldName(),\r\n\t\t\tMessage: \"is not of type string and MinLengthValidation only accepts strings\",\r\n\t\t}\r\n\t}\r\n\r\n\tif len(strValue) < m.length {\r\n\t\treturn &ValidationError{\r\n\t\t\tKey: m.FieldName(),\r\n\t\t\tMessage: \"must be at least \" + strconv.Itoa(m.length) + \" characters\",\r\n\t\t}\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "9e05bd4034281f3f7f3b29b2aa17d4e6", "score": "0.50167537", "text": "func Validate(payload interface{}) *fiber.Error {\n\terr := validate.Struct(payload)\n\n\tif err != nil {\n\t\tvar errors []string\n\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\terrors = append(\n\t\t\t\terrors,\n\t\t\t\tfmt.Sprintf(\"`%v` with value `%v` doesn't satisfy the `%v` constraint\", strings.ToLower(err.Field()), err.Value(), err.Tag()),\n\t\t\t)\n\t\t}\n\n\t\treturn &fiber.Error{\n\t\t\tCode: fiber.StatusBadRequest,\n\t\t\tMessage: strings.Join(errors, \",\"),\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d77a0eb4d6a7c391741d55fe8613cc7d", "score": "0.5010206", "text": "func (m VcsType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateVcsTypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c92521b94ccbd1fcbcdfee160914e1e", "score": "0.49946964", "text": "func (m *SlotContent) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateBody(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d57889b4cf89769cb4a1dff5f82a63db", "score": "0.499348", "text": "func (t *Stp_Rstp) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Rstp\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3d2c93c476f8b725c780339217b81df8", "score": "0.4992619", "text": "func (m *StatusTypeState) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ae353eae40d2756600a0367563bc2239", "score": "0.49848267", "text": "func (tv TypedValue) Validate() error {\n\tv := validation{\n\t\tpath: fieldpath.Path{},\n\t\tvalue: tv.value,\n\t\tschema: tv.schema,\n\t\ttypeRef: tv.typeRef,\n\t}\n\terrs := v.validate()\n\tif len(errs) == 0 {\n\t\treturn nil\n\t}\n\treturn errs\n}", "title": "" }, { "docid": "1dce3c6e45a34b8daf5c1a4422c595e6", "score": "0.49819064", "text": "func (s *Student) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.Validate(\n\t\t&validators.StringIsPresent{Field: s.Name, Name: \"Name\"},\n\t), nil\n}", "title": "" }, { "docid": "0e2dc95ea73db9c003b16ca32dc656d7", "score": "0.4980436", "text": "func (o *GSLBHealthCheck) Validate() error {\n\treturn validate.Struct(o)\n}", "title": "" }, { "docid": "1c93f74f9eccd2cc88f93fc3b9d19ce8", "score": "0.49772525", "text": "func (v valid) Validate(u UUID) error {\n\tif v.Str != u.String() {\n\t\treturn fmt.Errorf(\"string representation '%s' does not match '%s'.\", u.String(), v.Str)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a73c063eeee563fd735c2a2eb90b1ffd", "score": "0.4970795", "text": "func (v *JSONValidator) Validate(kind string, obj interface{}) error {\n\tschema := v.schemas[kind]\n\tif schema == nil {\n\t\treturn nil\n\t}\n\n\tloader := gojsonschema.NewGoLoader(obj)\n\tresult, err := gojsonschema.Validate(schema, loader)\n\tif err != nil {\n\t\treturn err\n\t} else if !result.Valid() {\n\t\treturn &ErrInvalidSchema{Errors: result.Errors()}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "03f34c857a45a3c35c1a2c36babce4cc", "score": "0.49591568", "text": "func (s *SeverityType) Unmarshal(in string) error {\n\tswitch strings.ToLower(in) {\n\tcase \"error\", \"err\":\n\t\t*s = Error\n\tcase \"warning\", \"warn\":\n\t\t*s = Warning\n\tdefault:\n\t\treturn fmt.Errorf(\"not a valid severity type: %q\", in)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6d8e1f231ddc54a3893deb0eab282c6f", "score": "0.49583435", "text": "func (svc *service) Validate(s *entities.Sucursal) apierrors.APIError {\n\ts.Direccion = strings.TrimSpace(s.Direccion)\n\n\tvar fields []apierrors.ErrorField\n\terr := validate.Struct(s)\n\tif err != nil {\n\t\tfor _, fieldError := range err.(validator.ValidationErrors) {\n\t\t\tswitch fieldError.Tag() {\n\t\t\tcase \"required\":\n\t\t\t\tfields = append(fields, apierrors.ErrorField{Field: fieldError.Field(), Error: \"Campo requerido\"})\n\t\t\tcase \"min\":\n\t\t\tcase \"max\":\n\t\t\t\tswitch fieldError.Field() {\n\t\t\t\tcase \"lat\":\n\t\t\t\t\tfields = append(fields, apierrors.ErrorField{Field: fieldError.Field(), Error: \"La latitud debe ser un número entre -90 y 90\"})\n\t\t\t\tcase \"long\":\n\t\t\t\t\tfields = append(fields, apierrors.ErrorField{Field: fieldError.Field(), Error: \"La longitud debe ser un número entre -180 y 180\"})\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfields = append(fields, apierrors.ErrorField{Field: fieldError.Field(), Error: \"Error\"})\n\t\t\t}\n\t\t}\n\t\treturn apierrors.NewValidationError(\"Error validando la sucursal\", fields)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7a348a48fb33743738a08d745725706", "score": "0.49583083", "text": "func ValidateStruct(typeName string, entity interface{}) error {\n\tif vp != nil {\n\t\treturn vp.ValidateStruct(typeName, entity)\n\t}\n\treturn notInitErr\n}", "title": "" }, { "docid": "312b049f6749d232cbdd1235049459dd", "score": "0.49532464", "text": "func (c *SSMLText) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "9609660839ac19b2cb0809a314631c1f", "score": "0.4952135", "text": "func (payload *POSTSamplePayload) Validate() (err error) {\n\n\tif payload.StringType == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"stringType\"))\n\t}\n\tif payload.Email == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"email\"))\n\t}\n\tif payload.EnumType == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"enumType\"))\n\t}\n\tif payload.DefaultType == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"defaultType\"))\n\t}\n\tif payload.Reg == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"reg\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "66d8500a4ac13b36c975db3021102db6", "score": "0.49515763", "text": "func (o *SIMLog) Validate() error {\n\treturn validate.Struct(o)\n}", "title": "" }, { "docid": "26910794f455072c792711afb34c0e0d", "score": "0.49451748", "text": "func Valid(i interface{}) bool {\n\tswitch v := i.(type) {\n\tcase int, int32, int64, uint, uint32, uint64:\n\t\treturn ValidString(fmt.Sprint(v))\n\tcase string:\n\t\treturn ValidString(v)\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "c4f0e8b255167b45bb3abbaeb16f1087", "score": "0.49410608", "text": "func (m *StringLiteral) TypeCheck(ts *Scope, errch chan<- error) {\n}", "title": "" }, { "docid": "0c66f3bba059d5e1610ed94168a3ab69", "score": "0.49360827", "text": "func (b *Binding) Validate(value interface{}) error {\n\treturn b.vd.Validate(value)\n}", "title": "" }, { "docid": "c492bc0880aa949f827cfb6c602c2d59", "score": "0.49338987", "text": "func (t *Stp_Interface) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Interface\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "740601a591bf4c5de5468158e951a8a9", "score": "0.4929982", "text": "func (s *StreamingSchedule) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "eaee3c17dfccccc70ade33ee154ffdb2", "score": "0.49289384", "text": "func (val *SchemaValidator) Validate(doc interface{}) (valid bool, err error) {\n\tdocumentLoader := gojsonschema.NewGoLoader(doc)\n\treturn val.validate(documentLoader)\n}", "title": "" }, { "docid": "010f7ba36a7a4fc0c60829792bbb1d34", "score": "0.49288437", "text": "func (m *JournalSubjectType) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif v, ok := interface{}(m.GetId()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn JournalSubjectTypeValidationError{\n\t\t\t\tfield: \"Id\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn JournalSubjectTypeValidationError{\n\t\t\t\tfield: \"CreatedAt\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn JournalSubjectTypeValidationError{\n\t\t\t\tfield: \"UpdatedAt\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\t// no validation rules for Name\n\n\treturn nil\n}", "title": "" }, { "docid": "bf2773e5a5fe1f0b1b591015cde220b3", "score": "0.49229974", "text": "func (r LengthRule) Validate(value interface{}) error {\n\tvalue, isNil := Indirect(value)\n\tif isNil || IsEmpty(value) {\n\t\treturn nil\n\t}\n\n\tvar (\n\t\tl int\n\t\terr error\n\t)\n\tif s, ok := value.(string); ok && r.rune {\n\t\tl = utf8.RuneCountInString(s)\n\t} else if l, err = LengthOfValue(value); err != nil {\n\t\treturn err\n\t}\n\n\tif r.min > 0 && l < r.min || r.max > 0 && l > r.max || r.min == 0 && r.max == 0 && l > 0 {\n\t\treturn r.err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c1838c910b6385953df3651621eb4955", "score": "0.49209917", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_TypeOfService) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_TypeOfService\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d86e688ba7abc2485fae72fa7e98dcb", "score": "0.49188557", "text": "func (ut *streamDefinition) Validate() (err error) {\n\tif ut.Stream == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"stream\"))\n\t}\n\tif ut.IntervalSize == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"intervalSize\"))\n\t}\n\tif ut.MaxIntervalLag == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"maxIntervalLag\"))\n\t}\n\tif ut.TargetSampleSize == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"targetSampleSize\"))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c5bf2080d79747b1f42de6f164c1e835", "score": "0.4910113", "text": "func Validate(v interface{}) error {\n\treturn Root().Validate(v)\n}", "title": "" }, { "docid": "f2827975c9634517d1744e6806d8825a", "score": "0.49072912", "text": "func (m *SadomainRule) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCid(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCreatedTimestamp(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFilter(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePermissions(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePriority(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTopic(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateUpdatedTimestamp(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateUserUUID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bbdf915ebd8fa2f2666cf3fd3230a8c6", "score": "0.4906282", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47a8ce0f368e6b5112aeb14ccf409bba", "score": "0.49045825", "text": "func (c *Codec) Validate(v cue.Value, x interface{}) error {\n\tc.mutex.RLock()\n\tdefer c.mutex.RUnlock()\n\n\tr := checkAndForkContext(c.runtime, v)\n\tw, err := fromGoValue(r, x, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn w.Unify(v).Err()\n}", "title": "" }, { "docid": "c6a5bf3aa87dc6adee580fd2484b4e39", "score": "0.4901409", "text": "func TestValidateGood(t *testing.T) {\n\tschema := `{\n \"type\": \"record\",\n \"name\": \"User\",\n \"fields\": [\n {\"name\": \"username\", \"type\": \"string\"},\n {\"name\": \"phone\", \"type\": \"long\"},\n {\"name\": \"age\", \"type\": \"int\"}\n ]\n }`\n\n\tif err := Validate(schema); err != nil {\n\t\tt.Fatalf(\"expected schema to pass validation: %s\", err)\n\t}\n}", "title": "" }, { "docid": "1c54d513703fd734560076d6af222796", "score": "0.4899901", "text": "func (b Binding) ValidationString() (ret string) {\n\treturn b.signature(parameterTypeArray(b, false))\n}", "title": "" }, { "docid": "ea54cc93c91980ade17648e487ce8421", "score": "0.48913217", "text": "func (m TapiOamPerceivedSeverityType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateTapiOamPerceivedSeverityTypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" } ]
3321fe05de432a4f528158c204fd7eac
Convert to int64 value.
[ { "docid": "2c03939a5f4d97fdae8fd9d543407811", "score": "0.7338919", "text": "func (v *Value) Int64() int64 {\n\treturn v.getInt()\n}", "title": "" } ]
[ { "docid": "edd2028207f41de83196ba30a68023f7", "score": "0.78995186", "text": "func (n Number) Int64() (int64, error) {\n\treturn IntParse([]byte(n))\n}", "title": "" }, { "docid": "8443373a2b2bff88b595fa7e649a518c", "score": "0.7810311", "text": "func (num *Number) Int64() int64 {\n\tintVal, _ := strconv.ParseInt(num.Format(Base10), 10, 64)\n\treturn intVal\n}", "title": "" }, { "docid": "bd99df7a85660e57f72c7721c6c5b0ce", "score": "0.7777546", "text": "func (v ValueNumber) Int64() (int64, error) { return strconv.ParseInt(string(v), 10, 64) }", "title": "" }, { "docid": "d38eb180af6b61434007bf7aabe77d71", "score": "0.7772831", "text": "func (n Number) Int64() (int64, error) {\n\treturn strconv.ParseInt(string(n), 10, 64)\n}", "title": "" }, { "docid": "d38eb180af6b61434007bf7aabe77d71", "score": "0.7772831", "text": "func (n Number) Int64() (int64, error) {\n\treturn strconv.ParseInt(string(n), 10, 64)\n}", "title": "" }, { "docid": "3b4813c63f39a383e49b8075bb2d7437", "score": "0.77355975", "text": "func toInt64(i interface{}) int64 {\n\tv, err := toInt64E(i)\n\tpanicerr(err)\n\treturn v\n}", "title": "" }, { "docid": "9af269cf4d765e9afc88402e7e17aa30", "score": "0.77015823", "text": "func ToInt64(value interface{}) int64 {\n switch v := value.(type) {\n case int:\n return int64(v)\n case int8:\n return int64(v)\n case int16:\n return int64(v)\n case int32:\n return int64(v)\n case int64:\n return v\n case uint:\n return int64(v)\n case uint8:\n return int64(v)\n case uint16:\n return int64(v)\n case uint32:\n return int64(v)\n case uint64:\n return int64(v)\n case float32:\n return int64(v)\n case float64:\n return int64(v)\n case time.Time:\n return v.Unix()\n case *time.Time:\n if v != nil {\n return v.Unix()\n } \n case string:\n if i, err := strconv.Atoi(v); err == nil {\n return int64(i)\n }\n }\n return 0\n}", "title": "" }, { "docid": "743cd6a064e9d7e82dceb53d79f59087", "score": "0.76902145", "text": "func (n NumberValue) Int64() (int64, error) {\n\treturn strconv.ParseInt(string(n), 10, 64)\n}", "title": "" }, { "docid": "809547a29e953a970161e96410e431d9", "score": "0.76823574", "text": "func (s RuneValue) Int64() int64 {\n\treturn int64(s)\n}", "title": "" }, { "docid": "14a0a89e05bec4166bb5e19517509615", "score": "0.76542217", "text": "func (av DynamoDBAttributeValue) Int64() (int64, error) {\n\tnumber := av.Number()\n\treturn strconv.ParseInt(number, 10, 64)\n}", "title": "" }, { "docid": "9088a2a94b373d3d1489b6f6676c3297", "score": "0.7576015", "text": "func (v *BigIntVal) Int64() int64 { return v.Int64() }", "title": "" }, { "docid": "27c43e77b592262da102fc1e4b6feb01", "score": "0.75669277", "text": "func ToInt64(value interface{}) (d int64, err error) {\n\tval := reflect.ValueOf(value)\n\tswitch value.(type) {\n\tcase int, int8, int16, int32, int64:\n\t\td = val.Int()\n\tcase uint, uint8, uint16, uint32, uint64:\n\t\td = int64(val.Uint())\n\tdefault:\n\t\terr = ERR_NEED_NUMERIC\n\t}\n\treturn\n}", "title": "" }, { "docid": "330695a34bd1e729d4350b5e3123569e", "score": "0.75602865", "text": "func (f StrTo) Int64() (int64, error) {\n\tv, err := strconv.ParseInt(f.String(), 10, 64)\n\tif err != nil {\n\t\ti := new(big.Int)\n\t\tni, ok := i.SetString(f.String(), 10) // octal\n\t\tif !ok {\n\t\t\treturn v, err\n\t\t}\n\t\treturn ni.Int64(), nil\n\t}\n\treturn v, err\n}", "title": "" }, { "docid": "aee4d4aa6724337b799243640668ad5e", "score": "0.7557542", "text": "func ToInt64(v interface{}) int64 {\n\tswitch v := v.(type) {\n\tcase string:\n\t\tstr := strings.TrimSpace(v)\n\t\tresult, err := strconv.Atoi(str)\n\t\tif err != nil {\n\t\t\treturn 0\n\t\t}\n\t\treturn int64(result)\n\tcase int:\n\t\treturn int64(v)\n\tcase int32:\n\t\treturn int64(v)\n\tcase int64:\n\t\treturn v\n\tcase float32:\n\t\treturn int64(v)\n\tcase float64:\n\t\treturn int64(v)\n\tcase []byte:\n\t\tresult, err := strconv.Atoi(string(v))\n\t\tif err != nil {\n\t\t\treturn 0\n\t\t}\n\t\treturn int64(result)\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "034f7597b8f68c67ae48d69047f887de", "score": "0.75474435", "text": "func (v *Value) Int64() (int64, error) {\n\tn, err := v.Number()\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn n.Int64()\n}", "title": "" }, { "docid": "24a82b79870bfb6a4a0a6ff0a3f6f00c", "score": "0.75456244", "text": "func (c Int64Convert) Convert(item int64) (int64, error) { return c(item) }", "title": "" }, { "docid": "b70b3b1532681129e72669301a604f12", "score": "0.75455755", "text": "func ToInt64(i interface{}) int64 {\r\n\ti = indirect(i)\r\n\r\n\tswitch s := i.(type) {\r\n\tcase int:\r\n\t\treturn int64(s)\r\n\tcase int64:\r\n\t\treturn s\r\n\tcase int32:\r\n\t\treturn int64(s)\r\n\tcase int16:\r\n\t\treturn int64(s)\r\n\tcase int8:\r\n\t\treturn int64(s)\r\n\tcase uint:\r\n\t\treturn int64(s)\r\n\tcase uint64:\r\n\t\treturn int64(s)\r\n\tcase uint32:\r\n\t\treturn int64(s)\r\n\tcase uint16:\r\n\t\treturn int64(s)\r\n\tcase uint8:\r\n\t\treturn int64(s)\r\n\tcase float64:\r\n\t\treturn int64(s)\r\n\tcase float32:\r\n\t\treturn int64(s)\r\n\tcase string:\r\n\t\tv, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)\r\n\t\tif err == nil {\r\n\t\t\treturn v\r\n\t\t}\r\n\t\tfmt.Printf(\"unable to cast %#v of type %T to int64\", i, i)\r\n\t\treturn 0\r\n\tcase json.Number:\r\n\t\treturn ToInt64(string(s))\r\n\tcase bool:\r\n\t\tif s {\r\n\t\t\treturn 1\r\n\t\t}\r\n\t\treturn 0\r\n\tcase nil:\r\n\t\treturn 0\r\n\tdefault:\r\n\t\tintv, ok := toInt(i)\r\n\t\tif ok {\r\n\t\t\treturn int64(intv)\r\n\t\t}\r\n\r\n\t\tfmt.Printf(\"unable to cast %#v of type %T to int64\", i, i)\r\n\t\treturn 0\r\n\t}\r\n}", "title": "" }, { "docid": "817c348dbae898d8d95cc5c6dd7cf09f", "score": "0.75447875", "text": "func ToInt64(v interface{}) int64 {\n\tresult := int64(0)\n\tswitch v.(type) {\n\tcase string:\n\t\tresult, _ = strconv.ParseInt(v.(string), 10, 64)\n\tcase int:\n\t\tresult = int64(v.(int))\n\tcase int64:\n\t\tresult = int64(v.(int64))\n\tcase float64:\n\t\tresult = int64(v.(float64))\n\tcase uint8:\n\t\tresult, _ = strconv.ParseInt(string(v.(uint8)), 10, 64)\n\tdefault:\n\t\tresult = int64(0)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "028bfe2df4a749280314ca61c01f4d4e", "score": "0.7540538", "text": "func (i Integer) Int64() (int64, error) {\n\tn, err := strconv.ParseInt(string(i[1:len(i)-2]), 10, 64)\n\tif err != nil {\n\t\treturn 0, ErrSyntaxError\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "d65ad01f92aa13784a223a97230cc3b9", "score": "0.7535112", "text": "func ToInt64(_v interface{}) (v int64, err error) {\n\tswitch t := _v.(type) {\n\tcase nil:\n\tcase bool:\n\t\tv = bool2Int64(t)\n\tcase []byte:\n\t\tv, err = strconv.ParseInt(string(t), 10, 64)\n\tcase string:\n\t\tv, err = strconv.ParseInt(t, 10, 64)\n\tcase int:\n\t\tv = int64(t)\n\tcase int8:\n\t\tv = int64(t)\n\tcase int16:\n\t\tv = int64(t)\n\tcase int32:\n\t\tv = int64(t)\n\tcase int64:\n\t\tv = t\n\tcase uint:\n\t\tv = int64(t)\n\tcase uint8:\n\t\tv = int64(t)\n\tcase uint16:\n\t\tv = int64(t)\n\tcase uint32:\n\t\tv = int64(t)\n\tcase uint64:\n\t\tv = int64(t)\n\tcase float32:\n\t\tv = int64(t)\n\tcase float64:\n\t\tv = int64(t)\n\tcase complex64:\n\t\tv = int64(real(t))\n\tcase complex128:\n\t\tv = int64(real(t))\n\tdefault:\n\t\terr = ErrUnknownType\n\t}\n\treturn\n}", "title": "" }, { "docid": "22cb776ef3a6f133deb839b77962bb81", "score": "0.7520185", "text": "func ToInt64(input *int64) int64 {\n\tif input != nil {\n\t\treturn *input\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "7aa2dd0e432e4ab1c5eb1b151c0b9a23", "score": "0.7518509", "text": "func ToInt64(d decimal.Decimal) int64 {\n\tcheckInteger(d)\n\treturn toInt64IgnoreFraction(d)\n}", "title": "" }, { "docid": "92971b34139ab9ed4cea2a087ccc64d7", "score": "0.75016457", "text": "func (i IntValue64) Int64() int64 {\n\treturn int64(i)\n}", "title": "" }, { "docid": "94a6e0478df89e3a012c3a5076859f60", "score": "0.74760485", "text": "func (b BS) Int64() int64 {\n\treturn int64(b.Uint64())\n}", "title": "" }, { "docid": "59a62b2ad0465fd9bcd43ed8519ec6e6", "score": "0.7467737", "text": "func (v *MysqlValue) AsInt64() (int64, error) {\n\ti, err := strconv.ParseInt(v._v, 10, 64)\n\treturn i, err\n}", "title": "" }, { "docid": "78fc72336168f268cfcc613b17f77d50", "score": "0.7462833", "text": "func (s *Str) Int64() (int64, error) {\n\tif s.base == DefaultIntBase {\n\t\ti, err := strconv.Atoi(s.Value)\n\t\treturn int64(i), err\n\t}\n\n\treturn s.parseInt(s.Value, 64)\n}", "title": "" }, { "docid": "1073344cbdb3377b884eca658bcff808", "score": "0.7442759", "text": "func (c *Coercable) AsInt64() int64 {\n\tvalue, ok := maybeIntToInt64(c.rawValue, true)\n\tif !ok {\n\t\tc.storeError(\"int64\", \"int\")\n\t\tvalue, _ = c.defaultValue.(int64)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "146204810f35fa69d890123f4b78afca", "score": "0.74407804", "text": "func GetInt64(name string) int64 { return Conf.GetInt64(name) }", "title": "" }, { "docid": "c2ee9529dc408bf7bc185625dda1062f", "score": "0.74382675", "text": "func (v *Value) AsInt64() (int64, error) {\n\treturn int64(v.Number), nil\n}", "title": "" }, { "docid": "7cae6f1b461b588c424d5963eda7cbda", "score": "0.74293905", "text": "func (fn *Fn) Int64() (int64, error) {\n\ti, err := strconv.ParseInt(fn.input, 10, 64)\n\tif err != nil {\n\t\treturn i, err\n\t}\n\treturn i, nil\n}", "title": "" }, { "docid": "198e018c8a1e0e9966bb3baf056dc268", "score": "0.73953253", "text": "func ToInt64(_v interface{}) (v int64, err error) {\n\tswitch _v.(type) {\n\tcase complex64, complex128:\n\t\tv = int64(real(reflect.ValueOf(_v).Complex()))\n\tcase bool:\n\t\tv = int64(bool2Int(_v.(bool)))\n\tcase int, int8, int16, int32, int64:\n\t\tv = reflect.ValueOf(_v).Int()\n\tcase uint, uint8, uint16, uint32, uint64:\n\t\tv = int64(reflect.ValueOf(_v).Uint())\n\tcase float32, float64:\n\t\tv = int64(reflect.ValueOf(_v).Float())\n\tcase string:\n\t\treturn strconv.ParseInt(_v.(string), 10, 64)\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown type of %T\", _v)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d4df732adc55e9904b34eb7b37b5ec82", "score": "0.7393839", "text": "func ToInt64(v interface{}) (int64, error) {\n\tvv := reflect.ValueOf(v)\n\tswitch vv.Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn int64(vv.Int()), nil\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn int64(vv.Uint()), nil\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn int64(vv.Float()), nil\n\tcase reflect.String:\n\t\tr, err := strconv.ParseInt(vv.String(), 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, ErrInvalid\n\t\t}\n\t\treturn r, nil\n\tdefault:\n\t\treturn 0, ErrInvalid\n\t}\n}", "title": "" }, { "docid": "672255bcc872032c8db2a08c4a55819a", "score": "0.73923105", "text": "func (x *Int) Int64() int64 {\n\tv := int64(low64(x.abs))\n\tif x.neg {\n\t\tv = -v\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a19724f26a2b25900927bd787a96f4cd", "score": "0.73792756", "text": "func ToInt64(i string, dflt int64) int64 {\n\ti64, err := strconv.ParseInt(i, 10, 0)\n\tif err != nil {\n\t\treturn dflt\n\t}\n\treturn i64\n}", "title": "" }, { "docid": "e5a7ef2a36c8dcab7de625a9b408bec1", "score": "0.7374074", "text": "func (i IntValue) Int64() int64 {\n\treturn int64(i)\n}", "title": "" }, { "docid": "ac7ec88f0a477ea628c9795c060f1db2", "score": "0.7357347", "text": "func Int64(val int64, err error) int64 {\n\tTo(err)\n\treturn val\n}", "title": "" }, { "docid": "c026de08c40bf1b7672ed2bf3e29a7c7", "score": "0.734504", "text": "func ToInt64(p *int64) (v int64) {\n\tif p == nil {\n\t\treturn v\n\t}\n\n\treturn *p\n}", "title": "" }, { "docid": "6466144628aa4368c60f07cbd852dc75", "score": "0.73431474", "text": "func ToInt64(value interface{}) (d int64) {\n\tval := reflect.ValueOf(value)\n\tswitch value.(type) {\n\tcase int, int8, int16, int32, int64:\n\t\td = val.Int()\n\tcase uint, uint8, uint16, uint32, uint64:\n\t\td = int64(val.Uint())\n\tdefault:\n\t\tpanic(fmt.Errorf(\"ToInt64 need numeric not `%T`\", value))\n\t}\n\treturn\n}", "title": "" }, { "docid": "ef7b8e5ed09e336eea8616a7ea60465b", "score": "0.7339356", "text": "func (v Value) AsInt64() int64 {\n\treturn internal.RawToInt64(v.numeric)\n}", "title": "" }, { "docid": "7ba4f92ac97423a98ccf10c04907cea1", "score": "0.73289686", "text": "func ToInt64(value interface{}) (int64, bool) { // nolint: gocyclo\n\tswitch cast := value.(type) {\n\tcase int64:\n\t\treturn cast, true\n\tcase int:\n\t\treturn int64(cast), true\n\tcase int8:\n\t\treturn int64(cast), true\n\tcase int16:\n\t\treturn int64(cast), true\n\tcase int32:\n\t\treturn int64(cast), true\n\tcase uint8:\n\t\treturn int64(cast), true\n\tcase uint16:\n\t\treturn int64(cast), true\n\tcase uint32:\n\t\treturn int64(cast), true\n\tcase uint64:\n\t\tif cast <= math.MaxInt64 {\n\t\t\treturn int64(cast), true\n\t\t}\n\tcase string:\n\t\tn, err := strconv.ParseInt(cast, 10, 64)\n\t\tif err == nil {\n\t\t\treturn n, true\n\t\t}\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "bf5e94c1c5d368e695299a613c94aacf", "score": "0.73277855", "text": "func ToInt64(value interface{}) (d int64, err error) {\n\tval := reflect.ValueOf(value)\n\tswitch value.(type) {\n\tcase int, int8, int16, int32, int64:\n\t\td = val.Int()\n\tcase uint, uint8, uint16, uint32, uint64:\n\t\td = int64(val.Uint())\n\tdefault:\n\t\terr = fmt.Errorf(\"ToInt64 need numeric not `%T`\", value)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bf5e94c1c5d368e695299a613c94aacf", "score": "0.73277855", "text": "func ToInt64(value interface{}) (d int64, err error) {\n\tval := reflect.ValueOf(value)\n\tswitch value.(type) {\n\tcase int, int8, int16, int32, int64:\n\t\td = val.Int()\n\tcase uint, uint8, uint16, uint32, uint64:\n\t\td = int64(val.Uint())\n\tdefault:\n\t\terr = fmt.Errorf(\"ToInt64 need numeric not `%T`\", value)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2bda1f089f5153aabe106642f7fd55ca", "score": "0.7310243", "text": "func (v Int) Int64() int64 {\n\tif !v.Valid() {\n\t\treturn 0\n\t}\n\treturn v.int\n}", "title": "" }, { "docid": "3292841643085b6e2706c10f50301a69", "score": "0.7309088", "text": "func ToInt64(v interface{}) (int64, error) {\n\tswitch value := reflect.ValueOf(v); v.(type) {\n\tcase string:\n\t\treturn StringToInt64(value.String())\n\tcase int, int8, int16, int32, int64:\n\t\treturn value.Int(), nil\n\tcase uint, uint8, uint16, uint32, uint64:\n\t\treturn int64(value.Uint()), nil\n\tcase float32, float64:\n\t\treturn int64(value.Float()), nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"ToInt64 unknow type:%#v\", v)\n\t}\n}", "title": "" }, { "docid": "21f71f50605496e7f6b4eda5fa53dbea", "score": "0.7296296", "text": "func Int64(key string) (int64, error) {\n\treturn wrapper.Int64(key)\n}", "title": "" }, { "docid": "7d2a5e12d0600fd50a21f49a12dedc54", "score": "0.7287176", "text": "func (r *Result) GetInt64() (int64, error) {\n\treturn strconv.ParseInt(r.GetString(), 10, 64)\n}", "title": "" }, { "docid": "0cf095011368906b003d28c0c87312c4", "score": "0.7278239", "text": "func (p Param) Int64() (int64, error) {\n\treturn strconv.ParseInt(string(p), 10, 64)\n}", "title": "" }, { "docid": "5a2e0c32cb43142a64296e535b19b467", "score": "0.7278178", "text": "func (m Memory) Int64() int64 {\n\ti, err := strconv.ParseInt(string(m.Val), 10, 64)\n\tif err != nil && err.Error() != \"strconv.ParseInt: parsing \\\"\\\"\\\"\\\": invalid syntax converting memory to int64\" {\n\t\tm.log.Debugf(\"could not convert memory to int64 %s (%s, %s)\",\n\t\t\terr, m.Key, string(m.Val))\n\t}\n\treturn i\n}", "title": "" }, { "docid": "b0f1a9ba6d7829024dae2fb76495fb24", "score": "0.7257499", "text": "func ToInt64(s string) (int64, error) {\n\treturn strconv.ParseInt(s, 10, 64)\n}", "title": "" }, { "docid": "5bbe5a979f3752a4b3e12f0e6e6ffbf5", "score": "0.7241836", "text": "func ToNativeInt64(o Object) int64 {\n\treturn o.Cast(INTEGER).(*Integer).Value\n}", "title": "" }, { "docid": "3f9ee55cd7eb52ab5eb7eae98bb3bb7d", "score": "0.72377205", "text": "func toInt64(v interface{}) int64 {\n\tif str, ok := v.(string); ok {\n\t\tiv, err := strconv.ParseInt(str, 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0\n\t\t}\n\t\treturn iv\n\t}\n\n\tval := reflect.Indirect(reflect.ValueOf(v))\n\tswitch val.Kind() {\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\treturn val.Int()\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32:\n\t\treturn int64(val.Uint())\n\tcase reflect.Uint, reflect.Uint64:\n\t\ttv := val.Uint()\n\t\tif tv <= math.MaxInt64 {\n\t\t\treturn int64(tv)\n\t\t}\n\t\t// TODO: What is the sensible thing to do here?\n\t\treturn math.MaxInt64\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn int64(val.Float())\n\tcase reflect.Bool:\n\t\tif val.Bool() {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "f34386bf4572dd548d22bec4fd01d5a3", "score": "0.72357136", "text": "func ToInt64(val int64) *int64 {\n\treturn &val\n}", "title": "" }, { "docid": "4e3129e6dbda3116f1f94df89aff9442", "score": "0.72320396", "text": "func ToInt64(x *big.Int) (int64, bool) {\n\treturn x.Int64(), x.IsInt64()\n}", "title": "" }, { "docid": "9c30f52acd2f51369fed9ca377a28543", "score": "0.7227142", "text": "func (c Conv) Int64(from interface{}) (int64, error) {\n\tif T, ok := from.(string); ok {\n\t\treturn c.convStrToInt64(T)\n\t} else if T, ok := from.(int64); ok {\n\t\treturn T, nil\n\t}\n\tif c, ok := from.(intConverter); ok {\n\t\treturn c.Int64()\n\t}\n\n\tvalue := refutil.IndirectVal(reflect.ValueOf(from))\n\tkind := value.Kind()\n\tswitch {\n\tcase reflect.String == kind:\n\t\treturn c.convStrToInt64(value.String())\n\tcase refutil.IsKindInt(kind):\n\t\treturn value.Int(), nil\n\tcase refutil.IsKindUint(kind):\n\t\tval := value.Uint()\n\t\tif val > math.MaxInt64 {\n\t\t\tval = math.MaxInt64\n\t\t}\n\t\treturn int64(val), nil\n\tcase refutil.IsKindFloat(kind):\n\t\treturn int64(value.Float()), nil\n\tcase refutil.IsKindComplex(kind):\n\t\treturn int64(real(value.Complex())), nil\n\tcase reflect.Bool == kind:\n\t\tif value.Bool() {\n\t\t\treturn 1, nil\n\t\t}\n\t\treturn 0, nil\n\tcase refutil.IsKindLength(kind):\n\t\treturn int64(value.Len()), nil\n\t}\n\treturn 0, newConvErr(from, \"int64\")\n}", "title": "" }, { "docid": "a59f35ba4cae199cde09658e803fb2bf", "score": "0.7181172", "text": "func (s StringValue) Int64() int64 {\n\tn, _ := strconv.Atoi(string(s))\n\treturn int64(n)\n}", "title": "" }, { "docid": "65952f3be6c0a0dc3bb9ecdbc57489e2", "score": "0.71774775", "text": "func (argument *Argument) AsInt64() (int64, error) {\n\treturn strconv.ParseInt(argument.Raw, 10, 64)\n}", "title": "" }, { "docid": "8d9a7ac10264f40f9552982a253309bc", "score": "0.71593744", "text": "func (i FileNumber) Int64() int64 {\n\treturn int64(i)\n}", "title": "" }, { "docid": "aa671d076567fe69ade7b96b61a04731", "score": "0.7152886", "text": "func (i IntValue32) Int64() int64 {\n\treturn int64(i)\n}", "title": "" }, { "docid": "727f66c978fa59c3e3a0066d8f7dc7bf", "score": "0.71488076", "text": "func ConvertToInt64(s string) int64 {\r\n\tc,err := strconv.ParseInt(s,10,64)\r\n\tif (err != nil) {\r\n\t\tlog.Println(\"Error from stats.ConvertToInt64: \",err)\r\n\t\treturn 0\r\n\t}\r\n\treturn c\r\n}", "title": "" }, { "docid": "d4c5f6ded256b70256ad9272454fa46d", "score": "0.71430576", "text": "func (c Conv) Int64(from interface{}) (int64, error) {\n\tif T, ok := from.(string); ok {\n\t\treturn c.convStrToInt64(T)\n\t} else if T, ok := from.(int64); ok {\n\t\treturn T, nil\n\t}\n\tif c, ok := from.(interface {\n\t\tInt64() (int64, error)\n\t}); ok {\n\t\treturn c.Int64()\n\t}\n\n\tvalue := reflect.ValueOf(indirect(from))\n\tkind := value.Kind()\n\tswitch {\n\tcase reflect.String == kind:\n\t\treturn c.convStrToInt64(value.String())\n\tcase isKindInt(kind):\n\t\treturn value.Int(), nil\n\tcase isKindUint(kind):\n\t\tval := value.Uint()\n\t\tif val > math.MaxInt64 {\n\t\t\tval = math.MaxInt64\n\t\t}\n\t\treturn int64(val), nil\n\tcase isKindFloat(kind):\n\t\treturn int64(value.Float()), nil\n\tcase isKindComplex(kind):\n\t\treturn int64(real(value.Complex())), nil\n\tcase reflect.Bool == kind:\n\t\tif value.Bool() {\n\t\t\treturn 1, nil\n\t\t}\n\t\treturn 0, nil\n\tcase isKindLength(kind):\n\t\treturn int64(value.Len()), nil\n\t}\n\treturn 0, newConvErr(from, \"int64\")\n}", "title": "" }, { "docid": "e570cf7454e18a1f2c98273e9fc6ef1d", "score": "0.7133842", "text": "func Int64(key string) (int64, error) {\n\treturn strconv.ParseInt(String(key), 10, 64)\n}", "title": "" }, { "docid": "8a7fef130f71b8b1305bb4b91de1514f", "score": "0.71315974", "text": "func (t *CommandType) Int64() int64 {\n\treturn int64(*t)\n}", "title": "" }, { "docid": "86eae9ed94aa7b7b11d95c5467aca58d", "score": "0.71229416", "text": "func (fh *File) Int64() (int64, error) {\n\tvar out int64\n\tif err := binary.Read(fh, binary.LittleEndian, &out); err != nil {\n\t\treturn 0, err\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "511d1879b4ad910a4ade71aef6a3f286", "score": "0.71218276", "text": "func (v Value) Int64() (int64, error) {\n\tn, err := v.getNum(adt.IntKind)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif !n.X.Coeff.IsInt64() {\n\t\tif n.X.Negative {\n\t\t\treturn math.MinInt64, ErrAbove\n\t\t}\n\t\treturn math.MaxInt64, ErrBelow\n\t}\n\ti := n.X.Coeff.Int64()\n\tif n.X.Negative {\n\t\ti = -i\n\t}\n\treturn i, nil\n}", "title": "" }, { "docid": "e60162ba5a76c2d779766f82560dc6f7", "score": "0.7121303", "text": "func (bx Bytex) Int64() int64 {\n\tif len(bx) > 0 {\n\t\tif i64, err := strconv.ParseInt(string(bx), 10, 64); err == nil {\n\t\t\treturn i64\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "2925074df524a5d5793fb156e4425301", "score": "0.7118761", "text": "func Int64(key string) (int64, error) {\n\treturn cache.Int64(key)\n}", "title": "" }, { "docid": "6bb91275e096467c9ab33a4843d3eccf", "score": "0.7106809", "text": "func Int64(name string, value int64, usage string) *int64 {\n\treturn Environment.Int64(name, value, usage)\n}", "title": "" }, { "docid": "9b0ef304704e5dc83695268b4d3c1821", "score": "0.70757776", "text": "func (z *Int) Int64() int64 {\n\tif !z.init {\n\t\treturn 0\n\t}\n\treturn int64(C.mpz_get_si(z.ptr))\n}", "title": "" }, { "docid": "a5437149b0e8615088534f22de82bbb0", "score": "0.7067572", "text": "func AsInt64(v interface{}) (int64, bool) {\n\tswitch d := indirect(v).(type) {\n\tcase bool:\n\t\tif d {\n\t\t\treturn 1, true\n\t\t}\n\t\treturn 0, true\n\tcase int:\n\t\treturn int64(d), true\n\tcase int64:\n\t\treturn d, true\n\tcase int32:\n\t\treturn int64(d), true\n\tcase int16:\n\t\treturn int64(d), true\n\tcase int8:\n\t\treturn int64(d), true\n\tcase uint:\n\t\treturn int64(d), true\n\tcase uint64:\n\t\treturn int64(d), true\n\tcase uint32:\n\t\treturn int64(d), true\n\tcase uint16:\n\t\treturn int64(d), true\n\tcase uint8:\n\t\treturn int64(d), true\n\tcase float64:\n\t\treturn int64(d), true\n\tcase float32:\n\t\treturn int64(d), true\n\tcase string:\n\t\tif n, err := strconv.ParseInt(d, 10, 64); err == nil {\n\t\t\treturn n, true\n\t\t}\n\t\treturn 0, false\n\tdefault:\n\t\treturn 0, false\n\t}\n}", "title": "" }, { "docid": "e4c16992581ce7f9226938427ee2d26c", "score": "0.7060501", "text": "func (tv *TypedInt64) Int() int {\n\treturn int(binary.LittleEndian.Uint64(tv.Value))\n}", "title": "" }, { "docid": "7c3840849282ab32ac62ee2db072b63d", "score": "0.70525074", "text": "func Int64(name string, value int64, usage string) *int64 {\n\treturn CommandLine.Int64(name, value, usage)\n}", "title": "" }, { "docid": "f96f626b951459f0820e8d1d67b244c9", "score": "0.7051054", "text": "func Int64(args *cons.Cons, env environment.Environment, context interface{}) (types.Object, error) {\n\tnum, ok := args.Car.(*numbers.Number)\n\tif !ok {\n\t\treturn nil, errors.New(\"INT64 expected a number as first argument\")\n\t}\n\n\treturn num.Int64(), nil\n}", "title": "" }, { "docid": "83e7e410879523ad3aa0fee72d83572d", "score": "0.70504147", "text": "func (coin Coin) ToInt64() int64 {\n\treturn coin.Amount.BigInt().Int64()\n}", "title": "" }, { "docid": "10c785a7755431f8e25d52ec91681da9", "score": "0.7046814", "text": "func (r *Reader) Int64(bits uint) int64 {\n\tif bits <= 32 {\n\t\treturn r.read32i(bits)\n\t}\n\tval := r.read32i(32)\n\tbits -= 32\n\treturn val<<bits | int64(r.read32(bits))\n}", "title": "" }, { "docid": "277ee4b668bd1169f4203b4cb0024747", "score": "0.7033021", "text": "func (lvl *Level) ToInt64() {\n\tlvl.Labels = lvl.Labels.ToInt64()\n\tlvl.DataType = options.Int64\n\tlvl.NeedsRefresh = true\n}", "title": "" }, { "docid": "442f16c89015821d6dab07a9fcbbaf83", "score": "0.7020666", "text": "func (instance *Integer) GetInt64() int64 {\n\tvar v1 = instance.Value\n\tvar v2 = reflect.ValueOf(v1).Int()\n\treturn v2\n}", "title": "" }, { "docid": "9ed25f98d23f1ecd8c180c48031f741d", "score": "0.70118725", "text": "func Int64(name string, value int64, usage string) *int64 {}", "title": "" }, { "docid": "77251b264ef44af7aa111fec3beec674", "score": "0.7000033", "text": "func (ca *RuntimeCache) GetInt64(key string) (int64, error) {\n\tv, err := ca.GetString(key)\n\tif err != nil || v == \"\" {\n\t\treturn ZeroInt64, nil\n\t} else {\n\t\ti, e := strconv.ParseInt(v, 10, 64)\n\t\tif e != nil {\n\t\t\treturn ZeroInt64, e\n\t\t} else {\n\t\t\treturn i, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d727399f328f8a011ad8fb5977183bd7", "score": "0.6994418", "text": "func GetInt64(ctx context.Context, r Retriever, k Key) (int64, error) {\n\tval, err := r.Get(ctx, k)\n\tif IsErrNotFound(err) {\n\t\treturn 0, nil\n\t}\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tintVal, err := strconv.ParseInt(string(val), 10, 64)\n\tif err != nil {\n\t\treturn intVal, errors.Trace(err)\n\t}\n\treturn intVal, nil\n}", "title": "" }, { "docid": "e27ce9905597ccf192e1bfad857f0b45", "score": "0.6976815", "text": "func toInt64E(i interface{}) (int64, error) {\n\ti = indirect(i)\n\n\tswitch s := i.(type) {\n\tcase int:\n\t\treturn int64(s), nil\n\tcase int64:\n\t\treturn s, nil\n\tcase int32:\n\t\treturn int64(s), nil\n\tcase int16:\n\t\treturn int64(s), nil\n\tcase int8:\n\t\treturn int64(s), nil\n\tcase uint:\n\t\treturn int64(s), nil\n\tcase uint64:\n\t\treturn int64(s), nil\n\tcase uint32:\n\t\treturn int64(s), nil\n\tcase uint16:\n\t\treturn int64(s), nil\n\tcase uint8:\n\t\treturn int64(s), nil\n\tcase float64:\n\t\treturn int64(s), nil\n\tcase float32:\n\t\treturn int64(s), nil\n\tcase string:\n\t\tv, err := strconv.ParseInt(s, 0, 0)\n\t\tif err == nil {\n\t\t\treturn v, nil\n\t\t}\n\t\treturn 0, fmt.Errorf(\"unable to cast %#v of type %T to int64\", i, i)\n\tcase bool:\n\t\tif s {\n\t\t\treturn 1, nil\n\t\t}\n\t\treturn 0, nil\n\tcase nil:\n\t\treturn 0, nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"unable to cast %#v of type %T to int64\", i, i)\n\t}\n}", "title": "" }, { "docid": "5ca083a627099090a1ab4f8888e72c37", "score": "0.69763315", "text": "func (c *Context) Int64(name string) int64 {\n\tv, _ := strconv.ParseInt(c.String(name), 10, 64)\n\treturn v\n}", "title": "" }, { "docid": "113839ddca67c75bed78bd4853c87e0d", "score": "0.69738084", "text": "func (b *Buffer) GetInt64() (int64, error) {\n\tvar n int64\n\tbuf, err := b.GetBytes(SizeInt64)\n\tif err != nil {\n\t\treturn 0, nil\n\t}\n\tn |= int64(buf[0])\n\tn |= int64(buf[1]) << 8\n\tn |= int64(buf[2]) << 16\n\tn |= int64(buf[3]) << 24\n\tn |= int64(buf[4]) << 32\n\tn |= int64(buf[5]) << 40\n\tn |= int64(buf[6]) << 48\n\tn |= int64(buf[7]) << 56\n\treturn n, nil\n}", "title": "" }, { "docid": "3f1e0ff22fe241edfa4bb87781b5f058", "score": "0.6971904", "text": "func (v MeasurementValue) AsInt64() int64 {\n\treturn rawToInt64(v.AsRaw())\n}", "title": "" }, { "docid": "cf435c05f523a1f55555c5c927abb5d1", "score": "0.6968039", "text": "func (i IntValue64) Int() int {\n\treturn int(i)\n}", "title": "" }, { "docid": "29403623cf5f940ff57cc28afb113b59", "score": "0.69218415", "text": "func Int64(key string) (value int64, ok bool) {\n\treturn dc.Int64(key)\n}", "title": "" }, { "docid": "49e649c046a6e5f050788e59151fc00c", "score": "0.69073945", "text": "func (c *FunctionContext) Int64(i int) int64 {\n\treturn int64(C.sqlite3_value_int64(c.argv[i]))\n}", "title": "" }, { "docid": "fe150ae4cd25cff0c67ec43a871a0291", "score": "0.6901822", "text": "func (d *Datum) GetInt64() int64 {\n\treturn d.i\n}", "title": "" }, { "docid": "fe150ae4cd25cff0c67ec43a871a0291", "score": "0.6901822", "text": "func (d *Datum) GetInt64() int64 {\n\treturn d.i\n}", "title": "" }, { "docid": "426528cab4615380adb534d1a2290289", "score": "0.6900908", "text": "func (p *Process) ReadInt64(a Address) int64 {\n\treturn int64(p.ReadUint64(a))\n}", "title": "" }, { "docid": "426528cab4615380adb534d1a2290289", "score": "0.6900908", "text": "func (p *Process) ReadInt64(a Address) int64 {\n\treturn int64(p.ReadUint64(a))\n}", "title": "" }, { "docid": "822ce295e39b525dca236216ada37f32", "score": "0.68976766", "text": "func ReadInt64() int64 {\n\treturn readInt64()\n}", "title": "" }, { "docid": "7ca57096299e281c0b165bafbd09a6af", "score": "0.6895141", "text": "func Int64(value int64) *int64 {\n\treturn &value\n}", "title": "" }, { "docid": "c8da3a8c022d8443e3cd675b95b41ac5", "score": "0.68929595", "text": "func Int64(s int64) *int64 {\n\treturn &s\n}", "title": "" }, { "docid": "e64e0cc22bb00efd1d9547052b9f25b7", "score": "0.68851906", "text": "func (expr *NumVal) AsInt64() (int64, error) {\n\tintVal, ok := expr.AsConstantInt()\n\tif !ok {\n\t\treturn 0, errConstNotInt\n\t}\n\ti, exact := constant.Int64Val(intVal)\n\tif !exact {\n\t\treturn 0, errConstOutOfRange64\n\t}\n\texpr.resInt = DInt(i)\n\treturn i, nil\n}", "title": "" }, { "docid": "e6632612e58b56e03c191d448bf8136d", "score": "0.68718815", "text": "func getInt64(lit interface{}) (int64, error) {\n\tl, ok := lit.(*IntLit)\n\tif !ok {\n\t\treturn 0, errors.Errorf(\"invalid integer literal type; expected *astx.IntLit, got %T\", lit)\n\t}\n\tn, err := strconv.ParseInt(l.lit, 10, 64)\n\tif err != nil {\n\t\treturn 0, errors.WithStack(err)\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "1a948ec1f9b20eaf2eb465ff2e09462b", "score": "0.6866725", "text": "func (w *Wrapper) Int64(key string) (int64, error) {\n\treturn w.Client.Get(key).Int64()\n}", "title": "" }, { "docid": "7de544a7606ab2dddd43f1cf46778c07", "score": "0.6858946", "text": "func Int64(str string) (int64, error) {\n\treturn parseStringExprIntoInt64(str, true)\n}", "title": "" }, { "docid": "a236907a249fca2cd81c24a76b6383e8", "score": "0.685887", "text": "func Int64(name string, usage string) *int64 {\n\treturn CmdVar.Int64(name, usage)\n}", "title": "" }, { "docid": "de6c11f2cfccd0fea770137c1625f73a", "score": "0.68523425", "text": "func String2Int64(src string) int64 {\n\tval, err := strconv.ParseInt(src, 10, 64)\n\tif err != nil {\n\t\treturn -1\n\t}\n\treturn val\n}", "title": "" }, { "docid": "b594050662e2e541e2ae8546d172db85", "score": "0.6840565", "text": "func Int64(p *int64) int64 {\n\tif p == nil {\n\t\treturn 0\n\t}\n\treturn *p\n}", "title": "" } ]
25a29f0300366bba879cfb2144976478
AreasByActualizadoPorID retrieves a row from 'v1wq1ics1m037sn6.area' as a Area. Generated from index 'IDX_D7943D68F6167A1C'.
[ { "docid": "5cb78ab16475ab40505ddd27082b9b70", "score": "0.8583757", "text": "func AreasByActualizadoPorID(db XODB, actualizadoPorID sql.NullInt64) ([]*Area, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, creado_por_id, actualizado_por_id, nombre, fecha_creacion, fecha_actualizacion, departamento_id ` +\n\t\t`FROM v1wq1ics1m037sn6.area ` +\n\t\t`WHERE actualizado_por_id = ?`\n\n\t// run query\n\tXOLog(sqlstr, actualizadoPorID)\n\tq, err := db.Query(sqlstr, actualizadoPorID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*Area{}\n\tfor q.Next() {\n\t\ta := Area{\n\t\t\t_exists: true,\n\t\t}\n\n\t\t// scan\n\t\terr = q.Scan(&a.ID, &a.CreadoPorID, &a.ActualizadoPorID, &a.Nombre, &a.FechaCreacion, &a.FechaActualizacion, &a.DepartamentoID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &a)\n\t}\n\n\treturn res, nil\n}", "title": "" } ]
[ { "docid": "fa91bf9097869c91921b0c3774c38f52", "score": "0.76964265", "text": "func AreasByCreadoPorID(db XODB, creadoPorID sql.NullInt64) ([]*Area, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, creado_por_id, actualizado_por_id, nombre, fecha_creacion, fecha_actualizacion, departamento_id ` +\n\t\t`FROM v1wq1ics1m037sn6.area ` +\n\t\t`WHERE creado_por_id = ?`\n\n\t// run query\n\tXOLog(sqlstr, creadoPorID)\n\tq, err := db.Query(sqlstr, creadoPorID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*Area{}\n\tfor q.Next() {\n\t\ta := Area{\n\t\t\t_exists: true,\n\t\t}\n\n\t\t// scan\n\t\terr = q.Scan(&a.ID, &a.CreadoPorID, &a.ActualizadoPorID, &a.Nombre, &a.FechaCreacion, &a.FechaActualizacion, &a.DepartamentoID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &a)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "f9c95d7588ad6e6d75a15736fa7e137e", "score": "0.7575134", "text": "func AreasByDepartamentoID(db XODB, departamentoID sql.NullInt64) ([]*Area, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, creado_por_id, actualizado_por_id, nombre, fecha_creacion, fecha_actualizacion, departamento_id ` +\n\t\t`FROM v1wq1ics1m037sn6.area ` +\n\t\t`WHERE departamento_id = ?`\n\n\t// run query\n\tXOLog(sqlstr, departamentoID)\n\tq, err := db.Query(sqlstr, departamentoID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*Area{}\n\tfor q.Next() {\n\t\ta := Area{\n\t\t\t_exists: true,\n\t\t}\n\n\t\t// scan\n\t\terr = q.Scan(&a.ID, &a.CreadoPorID, &a.ActualizadoPorID, &a.Nombre, &a.FechaCreacion, &a.FechaActualizacion, &a.DepartamentoID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &a)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "22bafba525dc96d597498079633a44b4", "score": "0.6384574", "text": "func AreaByID(db XODB, id int) (*Area, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, creado_por_id, actualizado_por_id, nombre, fecha_creacion, fecha_actualizacion, departamento_id ` +\n\t\t`FROM v1wq1ics1m037sn6.area ` +\n\t\t`WHERE id = ?`\n\n\t// run query\n\tXOLog(sqlstr, id)\n\ta := Area{\n\t\t_exists: true,\n\t}\n\n\terr = db.QueryRow(sqlstr, id).Scan(&a.ID, &a.CreadoPorID, &a.ActualizadoPorID, &a.Nombre, &a.FechaCreacion, &a.FechaActualizacion, &a.DepartamentoID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &a, nil\n}", "title": "" }, { "docid": "d6809c62274cd21262993dc4a7efb982", "score": "0.6046433", "text": "func (a *Area) CodigoUsuarioByActualizadoPorID(db XODB) (*CodigoUsuario, error) {\n\treturn CodigoUsuarioByID(db, int(a.ActualizadoPorID.Int64))\n}", "title": "" }, { "docid": "626ddf66f9dad056fa867a7cf867a06c", "score": "0.58621585", "text": "func AreaMap(db DB, ids []int64) (areas map[int64]*Area, err error) {\n\tareas = make(map[int64]*Area)\n\tresults, err := Areas(db).Where(\"id IN (?)\", ids).All()\n\tfor _, area := range results {\n\t\tareas[area.ID] = area\n\t}\n\treturn\n}", "title": "" }, { "docid": "379b0311a53317ce215f580645ce1462", "score": "0.5189211", "text": "func (a AreaRepository) GetAllByLocation(locationID int) ([]interface{}, error) {\n\tvar sqlStm = `\n\t\t\t\tSELECT \ta.id, \n\t\t\t\t\t\ta.name,\n\t\t\t\t\t\ta.description,\n\t\t\t\t\t\ta.img_url,\n\t\t\t\t\t\ta.timestamp, \n\t\t\t\t\t\ta.updated,\n\t\t\t\t\t\tb.id,\n\t\t\t\t\t\tb.name,\n\t\t\t\t\t\tb.description,\n\t\t\t\t\t\tb.crcenter_id,\n\t\t\t\t\t\tb.business_id\n\t\t\t\tFROM reservations_area a\n\t\t\t\tINNER JOIN reservations_location b\n\t\t\t\t\tON b.id = a.location_id\n\t\t\t\tWHERE b.id = $1\n\t\t\t\t`\n\n\tvar objects []models.AreaModel\n\n\trows, err := a.DB.Query(sqlStm, locationID)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar id int\n\t\tvar name string\n\t\tvar description string\n\t\tvar imgurl string\n\t\tvar timestamp time.Time\n\t\tvar updated time.Time\n\t\tvar locationid int\n\t\tvar locationName string\n\t\tvar locationDescription string\n\t\tvar locationCrCenterID int\n\t\tvar businessID int\n\n\t\tif err = rows.Scan(\n\t\t\t&id,\n\t\t\t&name,\n\t\t\t&description,\n\t\t\t&imgurl,\n\t\t\t&timestamp,\n\t\t\t&updated,\n\t\t\t&locationid,\n\t\t\t&locationName,\n\t\t\t&locationDescription,\n\t\t\t&locationCrCenterID,\n\t\t\t&businessID); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t\t}\n\n\t\ttables, _ := a.GetTables(id)\n\n\t\tobjects = append(objects, models.AreaModel{\n\t\t\tID: id,\n\t\t\tName: name,\n\t\t\tTimestamp: timestamp,\n\t\t\tUpdated: updated,\n\t\t\tImgURL: imgurl,\n\t\t\tLocation: models.LocationModel{\n\t\t\t\tID: locationid,\n\t\t\t\tName: locationName,\n\t\t\t\tDescription: locationDescription,\n\t\t\t\tCrCenterID: locationCrCenterID,\n\t\t\t\tBusinessID: businessID,\n\t\t\t},\n\t\t\tTables: tables,\n\t\t})\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\tintfObjects := make([]interface{}, len(objects))\n\n\tfor i, obj := range objects {\n\t\tintfObjects[i] = obj\n\t}\n\n\treturn intfObjects, nil\n}", "title": "" }, { "docid": "05136f4e17186eaf824a8621f4ace43b", "score": "0.5166333", "text": "func (a AreaRepository) GetAll() ([]interface{}, error) {\n\tvar sqlStm = `\n\t\t\t\tSELECT \ta.id, \n\t\t\t\t\t\ta.name,\n\t\t\t\t\t\ta.description,\n\t\t\t\t\t\ta.img_url,\n\t\t\t\t\t\ta.timestamp, \n\t\t\t\t\t\ta.updated,\n\t\t\t\t\t\tb.id,\n\t\t\t\t\t\tb.name,\n\t\t\t\t\t\tb.description,\n\t\t\t\t\t\tb.crcenter_id,\n\t\t\t\t\t\tb.business_id\n\t\t\t\tFROM reservations_area a\n\t\t\t\tINNER JOIN reservations_location b\n\t\t\t\t\tON b.id = a.location_id\n\t\t\t\t`\n\n\tvar objects []models.AreaModel\n\n\trows, err := a.DB.Query(sqlStm)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar id int\n\t\tvar name string\n\t\tvar description string\n\t\tvar imgurl string\n\t\tvar timestamp time.Time\n\t\tvar updated time.Time\n\t\tvar locationid int\n\t\tvar locationName string\n\t\tvar locationDescription string\n\t\tvar locationCrCenterID int\n\t\tvar businessID int\n\n\t\tif err = rows.Scan(\n\t\t\t&id,\n\t\t\t&name,\n\t\t\t&description,\n\t\t\t&imgurl,\n\t\t\t&timestamp,\n\t\t\t&updated,\n\t\t\t&locationid,\n\t\t\t&locationName,\n\t\t\t&locationDescription,\n\t\t\t&locationCrCenterID,\n\t\t\t&businessID); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t\t}\n\n\t\ttables, _ := a.GetTables(id)\n\n\t\tobjects = append(objects, models.AreaModel{\n\t\t\tID: id,\n\t\t\tName: name,\n\t\t\tTimestamp: timestamp,\n\t\t\tUpdated: updated,\n\t\t\tImgURL: imgurl,\n\t\t\tLocation: models.LocationModel{\n\t\t\t\tID: locationid,\n\t\t\t\tName: locationName,\n\t\t\t\tDescription: locationDescription,\n\t\t\t\tCrCenterID: locationCrCenterID,\n\t\t\t\tBusinessID: businessID,\n\t\t\t},\n\t\t\tTables: tables,\n\t\t})\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\tintfObjects := make([]interface{}, len(objects))\n\n\tfor i, obj := range objects {\n\t\tintfObjects[i] = obj\n\t}\n\n\treturn intfObjects, nil\n}", "title": "" }, { "docid": "e305b19807cdf374bc49ac0521317e65", "score": "0.5120019", "text": "func (a *Area) CodigoUsuarioByCreadoPorID(db XODB) (*CodigoUsuario, error) {\n\treturn CodigoUsuarioByID(db, int(a.CreadoPorID.Int64))\n}", "title": "" }, { "docid": "327fb7911b06eebc292f4d7515957b90", "score": "0.5058891", "text": "func LoadAreas(p string) error {\n\t// Open the areas CSV\n\trows, err := loadCSV(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Walk rows reading area data (countries and provinces)\n\t// for each one we create a series\n\tfor i, row := range rows {\n\t\t// validate header row\n\t\tif i == 0 {\n\t\t\tif row[0] != \"country\" || row[1] != \"province\" || row[2] != \"area_id\" || row[7] != \"colour\" {\n\t\t\t\treturn fmt.Errorf(\"areas: invalid header row in file:%s row:%s\", p, row)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\ts, err := NewData(row)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"areas: invalid row in file:%s row:%s error:%s\", p, row, err)\n\t\t}\n\n\t\tdataset = append(dataset, s)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8d4bafc433f5706318c7011a37dcb0a1", "score": "0.5013146", "text": "func (c *AreaController)GetArea() {\n\tbeego.Info(\"------------------connect success--------------------\")\n\n\tresp := make(map[string]interface{})\n\tresp[\"errno\"] = models.RECODE_OK\n\tresp[\"errmsg\"] = models.RecodeText(models.RECODE_OK)\n\n\t// defer\n\tdefer c.RetData(resp)\n\n\t// data from session\n\n\t// data from mysql\n\tvar areas []models.Area\n\n\t// query database\n\to:= orm.NewOrm()\n\tnum, err := o.QueryTable(\"area\").All(&areas)\n\tif err != nil {\n\t\tbeego.Info(\"read data --------------------- error \")\n\t\tresp[\"errno\"] = models.RECODE_DATAERR\n\t\tresp[\"errmsg\"] = models.RecodeText(models.RECODE_DATAERR)\n\t\treturn\n\t}\n\tif num == 0 {\n\t\tresp[\"errno\"] = models.RECODE_NODATA\n\t\tresp[\"errmsg\"] = models.RecodeText(models.RECODE_NODATA)\n\t\treturn\n\t}\n\n\t// data\n\tresp[\"data\"] = areas\n\n\tbeego.Info(\"------------query data success, resp = \", resp, \"num = \", num)\n}", "title": "" }, { "docid": "8671855809e4c21f28e829527f2ee449", "score": "0.49946526", "text": "func (_this *HTMLMapElement) Areas() *dom.HTMLCollection {\n\tvar ret *dom.HTMLCollection\n\tvalue := _this.Value_JS.Get(\"areas\")\n\tret = dom.HTMLCollectionFromJS(value)\n\treturn ret\n}", "title": "" }, { "docid": "5ddb3ce897a062186796e35561aab899", "score": "0.48223525", "text": "func (e *Example) GetArea (ctx context.Context, req *example.Request, rsp *example.Response) error {\n\tfmt.Println(\"获取地域信息服务 GetArea /api/v1.0/areas\")\n\t//初始化返回值\n\trsp.Errno = utils.RECODE_OK\n\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\n\t//连接redis\n\n\tbm,err := utils.RedisOpen(utils.G_server_name,utils.G_redis_addr,utils.G_redis_port,utils.G_redis_dbnum)\n\tif err != nil {\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\n\tkey := \"area_info\"\n\n\tarea_info_value := bm.Get(key)\n\t//接受数据\n\tvar areas []models.Area\n\tif area_info_value != nil{\n\t\tfmt.Println(\"获取数据送给web\")\n\t\terr = json.Unmarshal(area_info_value.([]byte),&areas)\n\n\t\tfor key ,value := range areas{\n\t\t\tfmt.Println(key,value)\n\n\t\t\tarea := example.ResponseAddress{Aid:int32(value.Id),Aname:string(value.Name)}\n\n\t\t\trsp.Data = append(rsp.Data,&area)\n\t\t}\n\t\treturn nil\n\t}\n\t//查询数据库\n\to:= orm.NewOrm()\n\n\tqs := o.QueryTable(\"Area\")\n\n\tnum ,err := qs.All(&areas)\n\tif err != nil {\n\t\tfmt.Println(\"查询数据库错误\",err)\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\tif num == 0 {\n\t\tfmt.Println(\"五数据\",err)\n\t\trsp.Errno = utils.RECODE_NODATA\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\t//2.5 存入数据\n\t//json编码\n\tarea_info_json,_ := json.Marshal(areas)\n\t//存入数据\n\terr= bm.Put(key,area_info_json,time.Second*7200)\n\tif err != nil {\n\t\tfmt.Println(\"redis 存入数据失败\",err)\n\t\trsp.Errno= utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\t//3 将查询到的数据转化类型\n\tfor key,value := range areas{\n\t\tfmt.Println(key,value)\n\t\t//\t结构体 ---》proto\n\t\tarea := example.ResponseAddress{Aid:int32(value.Id),Aname:string(value.Name)}\n\t\t//4 数据返回\n\t\trsp.Data = append(rsp.Data,&area)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08e90adeb36081d73fad9e227eebe859", "score": "0.4812773", "text": "func (s *Server) loadAreas() error {\n\tlog.Info(\"Loading areas ...\")\n\tareaWalker := func(path string, info os.FileInfo, err error) error {\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tfileContent, fileIoErr := ioutil.ReadFile(path)\n\t\tif fileIoErr != nil {\n\t\t\tlog.Info(fmt.Sprintf(\"%s could not be loaded: %v\", path, fileIoErr))\n\t\t\treturn fileIoErr\n\t\t}\n\n\t\tarea := area.Area{}\n\t\tif _, err := toml.Decode(string(fileContent), &area); err != nil {\n\t\t\tlog.Info(fmt.Sprintf(\"%s could not be unmarshaled: %v\", path, err))\n\t\t\treturn err\n\t\t}\n\n\t\tlog.Info(fmt.Sprintf(\"Loaded area %q\", area.Name))\n\t\t// TODO: Lock\n\t\ts.Areas[area.Name] = area\n\n\t\treturn nil\n\t}\n\n\treturn filepath.Walk(s.staticDir+\"/areas/\", areaWalker)\n}", "title": "" }, { "docid": "23e08ca433ec44524ad3c02e95bfe321", "score": "0.47942483", "text": "func (a AreaRepository) GetByID(id int) (interface{}, error) {\n\tvar sqlStm = `\n\t\t\tSELECT \ta.id, \n\t\t\t\t\ta.name,\n\t\t\t\t\ta.description,\n\t\t\t\t\ta.img_url,\n\t\t\t\t\ta.timestamp, \n\t\t\t\t\ta.updated,\n\t\t\t\t\tb.id,\n\t\t\t\t\tb.name,\n\t\t\t\t\tb.description,\n\t\t\t\t\tb.crcenter_id,\n\t\t\t\t\tb.business_id\n\t\t\tFROM reservations_area a INNER JOIN reservations_location b\n\t\t\t\tON b.id = a.location_id\n\t\t\tWHERE a.id = $1`\n\n\tvar object models.AreaModel\n\tobject.Location = models.LocationModel{}\n\n\tif err := a.DB.QueryRow(\n\t\tsqlStm,\n\t\tid,\n\t).Scan(\n\t\t&object.ID,\n\t\t&object.Name,\n\t\t&object.Description,\n\t\t&object.ImgURL,\n\t\t&object.Timestamp,\n\t\t&object.Updated,\n\t\t&object.Location.ID,\n\t\t&object.Location.Name,\n\t\t&object.Location.Description,\n\t\t&object.Location.CrCenterID,\n\t\t&object.Location.BusinessID,\n\t); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\tobject.Tables, _ = a.GetTables(object.ID)\n\n\treturn object, nil\n}", "title": "" }, { "docid": "78b273ca1d92179377f04ad3fac86f64", "score": "0.47804585", "text": "func (e *Example) GetArea(ctx context.Context, req *example.Request, rsp *example.Response) error {\n\tfmt.Println(\"获取区域信息服务,GetArea...\")\n\t// 1.初始化返回值\n\trsp.Errno = utils.RECODE_OK\n\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\n\t// 2.调用工具类函数,获取存入redis中的数据\n\tbm, err := utils.RedisOpen(utils.G_server_name, utils.G_redis_addr, utils.G_redis_port, utils.G_redis_dbnum)\n\tif err != nil {\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\t// 定义区域信息存入redis的key值\n\tkey := \"area_info\"\n\t// 先从redis中获取数据\n\tarea_info_value := bm.Get(key)\n\t// 校验数据\n\tif area_info_value != nil {\n\t\tfmt.Println(\"已从redis中获取到数据,准备发送给web端..\")\n\t\t// 接收数据\n\t\tvar areas []models.Area\n\t\t// 解码\n\t\terr := json.Unmarshal(area_info_value.([]byte), &areas)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"redis数据解码错误\", err)\n\t\t\trsp.Errno = utils.RECODE_DBERR\n\t\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\t\treturn nil\n\t\t}\n\t\t// 循环转换数据发送给web\n\t\tfor _, value := range areas {\n\t\t\tarea := example.ResponseAddress{AId: int32(value.Id), AName: string(value.Name)}\n\t\t\t// 数据返回给web端\n\t\t\trsp.Data = append(rsp.Data, &area)\n\t\t}\n\t\treturn nil\n\t}\n\n\t// 3.如果redis中获取不到数据,则需要查询数据库\n\to := orm.NewOrm()\n\t// 定义接收数据的容器\n\tvar areas []models.Area\n\t//设置查询条件\n\tqs := o.QueryTable(\"Area\")\n\t//查询全部\n\tn, err := qs.All(&areas)\n\tif err != nil {\n\t\tfmt.Println(\"查询数据库错误!\", err)\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\tif n == 0 {\n\t\tfmt.Println(\"无数据!\", err)\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\n\t// 4.将查询到的数据存入redis中,方便后续使用\n\t// 对数据进行json编码\n\tarea_info_json, _ := json.Marshal(areas)\n\t//存入数据\n\tbm.Put(key, area_info_json, time.Second*7200)\n\tif err != nil {\n\t\tfmt.Println(\"存入redis数据失败!\", err)\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\n\t// 5.将查询到的数据转化类型\n\tfor _, value := range areas {\n\t\tarea := example.ResponseAddress{AId: int32(value.Id), AName: string(value.Name)}\n\t\t// 6.数据返回给web端\n\t\trsp.Data = append(rsp.Data, &area)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db7b08616dfe6e46d04cd742b8f4cb81", "score": "0.46939725", "text": "func (a *Area) Update(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !a._exists {\n\t\treturn errors.New(\"update failed: does not exist\")\n\t}\n\n\t// if deleted, bail\n\tif a._deleted {\n\t\treturn errors.New(\"update failed: marked for deletion\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `UPDATE v1wq1ics1m037sn6.area SET ` +\n\t\t`creado_por_id = ?, actualizado_por_id = ?, nombre = ?, fecha_creacion = ?, fecha_actualizacion = ?, departamento_id = ?` +\n\t\t` WHERE id = ?`\n\n\t// run query\n\tXOLog(sqlstr, a.CreadoPorID, a.ActualizadoPorID, a.Nombre, a.FechaCreacion, a.FechaActualizacion, a.DepartamentoID, a.ID)\n\t_, err = db.Exec(sqlstr, a.CreadoPorID, a.ActualizadoPorID, a.Nombre, a.FechaCreacion, a.FechaActualizacion, a.DepartamentoID, a.ID)\n\treturn err\n}", "title": "" }, { "docid": "e26d143a7e6580b2b1977097245bf6ba", "score": "0.46828163", "text": "func ConvertAreas(appl application.Application, request *http.Request, areas []area.Area, additional ...AreaConvertFunc) []*app.Area {\n\tvar is = []*app.Area{}\n\tfor _, i := range areas {\n\t\tis = append(is, ConvertArea(appl, request, i, additional...))\n\t}\n\treturn is\n}", "title": "" }, { "docid": "f25663e53ec4d390a6e8929400f09181", "score": "0.46215922", "text": "func (c *AreaController) Show(ctx *app.ShowAreaContext) error {\n\tid, err := uuid.FromString(ctx.ID)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound(err.Error()))\n\t}\n\n\treturn application.Transactional(c.db, func(appl application.Application) error {\n\t\ta, err := appl.Areas().Load(ctx, id)\n\t\tif err != nil {\n\t\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t\t}\n\t\treturn ctx.ConditionalRequest(*a, c.config.GetCacheControlArea, func() error {\n\t\t\tres := &app.AreaSingle{}\n\t\t\tres.Data = ConvertArea(appl, ctx.Request, *a, addResolvedPath)\n\t\t\treturn ctx.OK(res)\n\t\t})\n\t})\n}", "title": "" }, { "docid": "72c41b8f4d00dfbb51342033c7730d48", "score": "0.46017897", "text": "func GetExamenesComplementariosById(id int) (v *ExamenesComplementarios, err error) {\n\to := orm.NewOrm()\n\tv = &ExamenesComplementarios{IdExamenesComplementarios: id}\n\tif err = o.Read(v); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "5149fe137dbba8de32f84980d0810a96", "score": "0.45266137", "text": "func AreaOf(c aspect.ColumnElem) aspect.ColumnElem {\n\treturn c.SetInner(\n\t\taspect.FuncClause{Inner: c.Inner(), F: \"ST_Area\"},\n\t)\n}", "title": "" }, { "docid": "11adafef255176b5c284dee231dc0a78", "score": "0.45178148", "text": "func ArbolApropiaciones(unidadEjecutora int, Vigencia int) (padres []map[string]interface{}, err error) {\n\to := orm.NewOrm()\n\tvar m []orm.Params\n\t//funcion para conseguir los rubros padre.\n\t_, err = o.Raw(` SELECT rubro.id as \"Id\", rubro.codigo as \"Codigo\",rubro.nombre as \"Nombre\", rubro.descripcion as \"Descripcion\", rubro.unidad_ejecutora as \"UnidadEjecutora\"\n\t from financiera.rubro\n\t where (id in (select DISTINCT rubro_padre from financiera.rubro_rubro)\n\t\t\t AND id not in (select DISTINCT rubro_hijo from financiera.rubro_rubro))\n\t\t\t OR (id not in (select DISTINCT rubro_hijo from financiera.rubro_rubro)\n\t\t\t AND id not in (select DISTINCT rubro_padre from financiera.rubro_rubro))\n\t\t\t\tAND rubro.unidad_ejecutora=?`, unidadEjecutora).Values(&m)\n\tif err == nil {\n\t\tfmt.Println(\"Generando arbol....\")\n\t\tvar res []map[string]interface{}\n\t\terr = formatdata.FillStruct(m, &res)\n\t\tresch := genChanMapStr(res...)\n\t\tdone := make(chan map[string]interface{}) // HLdone\n\t\tdefer close(done) // HLdone\n\t\tfor padre := range RamaApropiaciones(done, unidadEjecutora, Vigencia, resch) {\n\t\t\tpadres = append(padres, padre) //tomar valores del canal y agregarlos al array de hijos.\n\t\t}\n\t}\n\tfmt.Println(\"Arbol generado...\")\n\treturn\n}", "title": "" }, { "docid": "28cba578bdaac62f95cae0248246452e", "score": "0.44973546", "text": "func (s *WorldService) GenerateAreas(w *entities.World) {\n\ti := 0\n\n\tfor y := 0; y <= 100; y++ {\n\t\tfor x := 0; x <= 100; x++ {\n\t\t\tw.AddArea(&entities.Area{\n\t\t\t\tX: int32(x),\n\t\t\t\tY: int32(y),\n\t\t\t\tZ: 0,\n\t\t\t})\n\t\t\ti++\n\t\t}\n\t}\n\n\tlog.Info().Int(\"areas total\", i).Msg(\"areas were generated\")\n}", "title": "" }, { "docid": "fe36dbcbb9f06d540df81f82b35070c2", "score": "0.44718036", "text": "func ObtenerAlarmas(ID string, page int64, fecha string, hora string, tipo string) ([]*models.Alarma, bool) {\n\tctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)\n\tdefer cancel()\n\tvar resultados []*models.Alarma\n\tfindOptions := options.Find()\n\tfindOptions.SetSkip((page - 1) * 20)\n\tfindOptions.SetLimit(20)\n\tqury := bson.M{\n\t\t//?i no se fija si son mayusculas y minusculas\n\t\t\"fecha\": bson.M{\"$regex\": `(?i)` + fecha},\n\t\t\"hora\": bson.M{\"$regex\": `(?i)` + hora},\n\t\t\"tipo\": bson.M{\"$regex\": `(?i)` + tipo},\n\t}\n\tcursor, err := colA.Find(ctx, qury, findOptions)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn resultados, false\n\t}\n\tfor cursor.Next(ctx) {\n\t\tvar s models.Alarma\n\t\terr := cursor.Decode(&s)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\treturn resultados, false\n\t\t}\n\t\tresultados = append(resultados, &s)\n\t}\n\terr = cursor.Err()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn resultados, false\n\t}\n\tcursor.Close(ctx)\n\treturn resultados, false\n}", "title": "" }, { "docid": "ad8a3652d3ba9fe35b5ad358fd4dcd1b", "score": "0.4471042", "text": "func AreaHandler(w http.ResponseWriter, r *http.Request) {\n\tdecoder := json.NewDecoder(r.Body)\n\n\tvar t area.PointRect\n\terr := decoder.Decode(&t)\n\n\tvalid := isValid(t)\n\tif valid == false {\n\t\thttp.Error(w, \"Invalid Inputs\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcalcArea := area.CalculateArea(t)\n\tjs, err := json.Marshal(calcArea)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(js)\n}", "title": "" }, { "docid": "d72a7f4e3b4cdf84bb11901b815e7648", "score": "0.44205365", "text": "func (s *invService) GetSubarea(ctx context.Context, req *pb.GetSubareaRequest) (*pb.GetSubareaResponse, error) {\n\tresp := &pb.GetSubareaResponse{}\n\n\tsqlstring := `SELECT s.inbSubareaId, s.dtmCreated, s.dtmModified, s.intVersion, s.inbMserviceId, s.inbFacilityId, \n\ts.inbParentSubareaId, s.intPosition, s.intSubareaTypeId, s.chvSubareaName, s.chvJsonData, f.chvFacilityName, t.chvSubareaTypeName \n\tFROM tb_Subarea AS s \n\tLEFT JOIN tb_Facility AS f ON s.inbFacilityId = f.inbFacilityId\n\tLEFT JOIN tb_SubareaType AS t ON s.inbMserviceId = t.inbMserviceId AND s.intSubareaTypeId = t.intSubareaTypeId\n\tWHERE s.inbMserviceId = ? AND s.inbSubareaId = ? AND s.bitIsDeleted = 0`\n\n\tstmt, err := s.db.Prepare(sqlstring)\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"Prepare\", \"error\", err)\n\t\tresp.ErrorCode = 500\n\t\tresp.ErrorMessage = \"db.Prepare failed\"\n\t\treturn resp, nil\n\t}\n\n\tdefer stmt.Close()\n\n\tvar created string\n\tvar modified string\n\tvar subarea pb.Subarea\n\tvar facility sql.NullString\n\tvar subtype sql.NullString\n\n\terr = stmt.QueryRow(req.GetMserviceId(), req.GetSubareaId()).Scan(&subarea.SubareaId, &created, &modified, &subarea.Version, &subarea.MserviceId,\n\t\t&subarea.FacilityId, &subarea.ParentSubareaId, &subarea.Position, &subarea.SubareaTypeId, &subarea.SubareaName,\n\t\t&subarea.JsonData, &facility, &subtype)\n\n\tif err == nil {\n\t\tsubarea.Created = dml.DateTimeFromString(created)\n\t\tsubarea.Modified = dml.DateTimeFromString(modified)\n\t\tif facility.Valid {\n\t\t\tsubarea.FacilityName = facility.String\n\t\t}\n\t\tif subtype.Valid {\n\t\t\tsubarea.SubareaTypeName = subtype.String\n\t\t}\n\t\tresp.Subarea = &subarea\n\t\tresp.ErrorCode = 0\n\t} else if err == sql.ErrNoRows {\n\t\tresp.ErrorCode = 404\n\t\tresp.ErrorMessage = \"not found\"\n\n\t} else {\n\t\tlevel.Error(s.logger).Log(\"what\", \"QueryRow\", \"error\", err)\n\t\tresp.ErrorCode = 500\n\t\tresp.ErrorMessage = err.Error()\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "f2626617446ed17a5d567b55f3dbfc85", "score": "0.43892494", "text": "func (e *Example) GetArea(ctx context.Context, req *example.Request, rsp *example.Response) error {\n\t//1.初始化返回值\n\trsp.Errno=utils.RECODE_OK\n\trsp.Errmsg=utils.RecodeText(rsp.Errno)\n\n\tarea_list:=[]models.Area{}\n\n\t//1.4连接redis\n\t//{\"key\":\"collectionName\",\"conn\":\":6039\",\"dbNum\":\"0\",\"password\":\"thePassWord\"}\n\t//key: Redis collection 的名称\n\t//conn: Redis 连接信息\n\t//dbNum: 连接 Redis 时的 DB 编号. 默认是0.\n\t//password: 用于连接有密码的 Redis 服务器.\n\t//redis_config:=map[string]string{\n\t//\t\"key\":utils.G_server_name,\n\t//\t\"conn\":utils.G_redis_addr+\":\"+utils.G_redis_port,\n\t//\t\"dbNum\":utils.G_redis_dbnum,\n\t//}\n\t//redis_conf,_:=json.Marshal(redis_config)\n\t//bm,err:=cache.NewCache(\"redis\",string(redis_conf))\n\t//if err!=nil{\n\t//\trsp.Errno=utils.RECODE_DBERR\n\t//\trsp.Errmsg=utils.RecodeText(rsp.Errno)\n\t//\tfmt.Println(\"redis连接失败\")\n\t//\treturn nil\n\t//}\n\tbm,err:=utils.Openredis(utils.G_server_name,utils.G_redis_addr,utils.G_redis_port,utils.G_redis_dbnum)\n\tif err!=nil{\n\t\trsp.Errno=utils.RECODE_DBERR\n\t\trsp.Errmsg=utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\n\t//1.5从redis中获取数据,发送给web\n\n\tarea_json:=bm.Get(\"area_info\")\n\n\tif area_json!=nil{\n\t\tfmt.Println(\"获取redis 数据\")\n\n\t\tjson.Unmarshal(area_json.([]byte),&area_list)\n\t\tfor _, value := range area_list {\n\t\t\ttemp:=example.Address{Aid:int32(value.Id),Aname:value.Name}\n\t\t\trsp.Data= append(rsp.Data, &temp)\n\t\t}\n\t\treturn nil\n\t}\n\n\t//2.查询数据\n\n\to:=orm.NewOrm()\n\tqs:=o.QueryTable(\"area\")\n\tnum,err:=qs.All(&area_list)\n\tif err!=nil{\n\t\trsp.Errno=utils.RECODE_DBERR\n\t\trsp.Errmsg=utils.RecodeText(rsp.Errno)\n\t\tfmt.Println(\"数据库查询失败\")\n\t\treturn nil\n\t}\n\tif 0==num{\n\t\trsp.Errno=utils.RECODE_NODATA\n\t\trsp.Errmsg=utils.RecodeText(rsp.Errno)\n\t\tfmt.Println(\"数据为空 \", err)\n\t\treturn nil\n\t}\n\n\t//2.5将查询到的数据存入缓存\n\tarea_json,_=json.Marshal(area_list)\n\terr=bm.Put(\"area_info\",area_json,time.Second*3600)\n\tif err!=nil{\n\t\trsp.Errno=utils.RECODE_DBERR\n\t\trsp.Errmsg=utils.RecodeText(rsp.Errno)\n\t\tfmt.Println(\"redis存入失败\")\n\t\treturn nil\n\t}\n\n\t//3.返回数据\n\tfor _, value := range area_list {\n\t\ttemp:=example.Address{Aid:int32(value.Id),Aname:value.Name}\n\t\trsp.Data= append(rsp.Data, &temp)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e8c4acee83a61ce178ac510cb532bc76", "score": "0.4350133", "text": "func (f *FMap) ReadArea(r io.ReaderAt, i int) ([]byte, error) {\n\tif i < 0 || int(f.NAreas) <= i {\n\t\treturn nil, fmt.Errorf(\"area index %d out of range\", i)\n\t}\n\tbuf := make([]byte, f.Areas[i].Size)\n\t_, err := r.ReadAt(buf, int64(f.Areas[i].Offset))\n\treturn buf, err\n}", "title": "" }, { "docid": "2a4fe66a25cc7b98f9881922616c1ff7", "score": "0.42994615", "text": "func (a AreaRepository) GetTables(areaID int) ([]models.TableModel, error) {\n\tvar sqlStm = `\n\t\t\t\tSELECT \ta.id, \n\t\t\t\t\t\ta.name,\n\t\t\t\t\t\ta.description,\n\t\t\t\t\t\ta.img_url,\n\t\t\t\t\t\ta.max_guests\n\t\t\t\tFROM reservations_table a WHERE a.area_id = $1\n\t\t\t\t`\n\n\tvar objects []models.TableModel\n\n\trows, err := a.DB.Query(sqlStm, areaID)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar id int\n\t\tvar name string\n\t\tvar description string\n\t\tvar imgurl string\n\t\tvar maxGuests int\n\n\t\tif err = rows.Scan(\n\t\t\t&id,\n\t\t\t&name,\n\t\t\t&description,\n\t\t\t&imgurl,\n\t\t\t&maxGuests); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t\t}\n\n\t\tobjects = append(objects, models.TableModel{\n\t\t\tID: id,\n\t\t\tName: name,\n\t\t\tDescription: description,\n\t\t\tImgURL: imgurl,\n\t\t\tMaxGuests: maxGuests,\n\t\t})\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", err)\n\t}\n\n\treturn objects, nil\n}", "title": "" }, { "docid": "0bc1d895897ac173c1cbb4df3bc8525e", "score": "0.42886817", "text": "func ApropiacionOrdenPago(apropiacion interface{}, fuente interface{}) (res []interface{}, err error) {\n\to := orm.NewOrm()\n\tvar m []orm.Params\n\t_, err = o.Raw(`SELECT id_apr,codigo,COALESCE( idfuente, 0 ) as idfuente,SUM(valor) as valor FROM\n\t\t(SELECT orden.id , SUM(orden_concepto.valor) as valor , orden.estado_orden_pago , apropiacion.id as id_apr,rubro.codigo, fuente.id as idfuente,rp.numero_registro_presupuestal AS RP,\n\t\tcdp.numero_disponibilidad AS CDP, fuente.descripcion AS fuente\n\n\t\tFROM\n\t\t\tfinanciera.orden_pago as orden\n\t\tJOIN\n\t\t\tfinanciera.concepto_orden_pago as orden_concepto\n\t\tON\n\t\t\torden_concepto.orden_de_pago = orden.id\n\t\tJOIN\n\t\t\tfinanciera.registro_presupuestal_disponibilidad_apropiacion as rpda\n\t\tON\n\t\t\trpda.id = orden_concepto.registro_presupuestal_disponibilidad_apropiacion\n\t\tJOIN\n\t\t\tfinanciera.disponibilidad_apropiacion as disponibilidad\n\t\tON\n\t\t\tdisponibilidad.id = rpda.disponibilidad_apropiacion\n\t\tJOIN\n\t\t\tfinanciera.apropiacion as apropiacion\n\t\tON\n\t\t\tapropiacion.id = disponibilidad.apropiacion\n\t\tJOIN\n\t\t\tfinanciera.rubro as rubro\n\t\tON apropiacion.rubro = rubro.id\n\t\tJOIN\n\t\t\tfinanciera.estado_orden_pago as estado_ord\n\t\tON\n\t\t\testado_ord.id = orden.estado_orden_pago\n\t\tJOIN\n\t\t\tfinanciera.registro_presupuestal as rp\n\t\tON\n\t\t\trp.id = rpda.registro_presupuestal\n\t\tJOIN\n\t\t\tfinanciera.disponibilidad_apropiacion AS disp_apr\n\t\tON\n\t\t disp_apr.id = rpda.disponibilidad_apropiacion\n\t\tJOIN\n\t\t\tfinanciera.disponibilidad as cdp\n\t\tON\n\t\t\tcdp.id = disp_apr.disponibilidad\n\t\tLEFT JOIN\n\t\t\tfinanciera.fuente_financiamiento AS fuente\n\t\tON\n\t\t\tdisponibilidad.fuente_financiamiento = fuente.id\n\t\tGROUP BY\n\t\t\tapropiacion.rubro, orden.id, rubro.codigo, orden.estado_orden_pago, apropiacion.id, fuente.id, rp.numero_registro_presupuestal, cdp.numero_disponibilidad, fuente.descripcion) as rubro\n\t\tWHERE id_apr = ?\n\t\tAND\n\t\t COALESCE( idfuente, 0 ) = ?\n\t\tGROUP BY\n\t\tid_apr,\n\t\t codigo,\n\t\t\tidfuente`, apropiacion, fuente).Values(&m)\n\terr = formatdata.FillStruct(m, &res)\n\treturn\n}", "title": "" }, { "docid": "95876cbccfd888a86048f4f5cf9fbe75", "score": "0.42658284", "text": "func (a *NiatelemetryApiService) GetNiatelemetryAaaTacacsProviderDetailsByMoidExecute(r ApiGetNiatelemetryAaaTacacsProviderDetailsByMoidRequest) (*NiatelemetryAaaTacacsProviderDetails, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *NiatelemetryAaaTacacsProviderDetails\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"NiatelemetryApiService.GetNiatelemetryAaaTacacsProviderDetailsByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/niatelemetry/AaaTacacsProviderDetails/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "8ce5033d56e6f02ff63436b09e127e4f", "score": "0.4265627", "text": "func AreaSelect() sq.SelectBuilder {\n\treturn sq.StatementBuilder.\n\t\tSelect(\"id, gid, name\").\n\t\tFrom(\"area\")\n}", "title": "" }, { "docid": "f910fa9d701e529d206a08af21d5cddf", "score": "0.4263681", "text": "func (c *AreaController) ShowChildren(ctx *app.ShowChildrenAreaContext) error {\n\tid, err := uuid.FromString(ctx.ID)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound(err.Error()))\n\t}\n\n\treturn application.Transactional(c.db, func(appl application.Application) error {\n\t\tparentArea, err := appl.Areas().Load(ctx, id)\n\t\tif err != nil {\n\t\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t\t}\n\t\tchildren, err := appl.Areas().ListChildren(ctx, parentArea)\n\t\tif err != nil {\n\t\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t\t}\n\t\treturn ctx.ConditionalEntities(children, c.config.GetCacheControlAreas, func() error {\n\t\t\tres := &app.AreaList{}\n\t\t\tres.Data = ConvertAreas(appl, ctx.Request, children, addResolvedPath)\n\t\t\treturn ctx.OK(res)\n\t\t})\n\t})\n}", "title": "" }, { "docid": "c3e4d1fef40e5635df449c7958860f45", "score": "0.42257077", "text": "func ValorMovimientosPorApropiacion(Id int, tipoMov int, cuenta string) (valor float64, err error) {\n\to := orm.NewOrm()\n\tqb, _ := orm.NewQueryBuilder(\"mysql\")\n\tqb.Select(\"COALESCE(sum(valor),0) as valor\").\n\t\tFrom(\"financiera.movimiento_apropiacion_disponibilidad_apropiacion\").\n\t\tInnerJoin(\"financiera.movimiento_apropiacion\").\n\t\tOn(\"movimiento_apropiacion.id = movimiento_apropiacion_disponibilidad_apropiacion.movimiento_apropiacion\").\n\t\tWhere(cuenta + \" = ?\").\n\t\tAnd(\"tipo_movimiento_apropiacion = ?\").\n\t\tAnd(\"estado_movimiento_apropiacion = 2\")\n\terr = o.Raw(qb.String(), Id, tipoMov).QueryRow(&valor)\n\treturn\n}", "title": "" }, { "docid": "7cd951313045512169725df784036930", "score": "0.42169523", "text": "func (suo *StatisticUpdateOne) AddArea(a ...*Area) *StatisticUpdateOne {\n\tids := make([]int, len(a))\n\tfor i := range a {\n\t\tids[i] = a[i].ID\n\t}\n\treturn suo.AddAreaIDs(ids...)\n}", "title": "" }, { "docid": "19e901ed9718c34607f54bc259562210", "score": "0.4213247", "text": "func (su *StatisticUpdate) AddArea(a ...*Area) *StatisticUpdate {\n\tids := make([]int, len(a))\n\tfor i := range a {\n\t\tids[i] = a[i].ID\n\t}\n\treturn su.AddAreaIDs(ids...)\n}", "title": "" }, { "docid": "8e3a81dbed90f897634f4ad84898f3fa", "score": "0.42115596", "text": "func Area(aspects ...dom.Aspect) dom.Aspect {\n\treturn dom.Element(\"area\", aspects...)\n}", "title": "" }, { "docid": "0ff69970d4f5c42e40d62c9bd8fb0f64", "score": "0.4207596", "text": "func ConvertArea(appl application.Application, request *http.Request, ar area.Area, additional ...AreaConvertFunc) *app.Area {\n\tareaType := area.APIStringTypeAreas\n\tspaceID := ar.SpaceID.String()\n\trelatedURL := rest.AbsoluteURL(request, app.AreaHref(ar.ID))\n\tchildURL := rest.AbsoluteURL(request, app.AreaHref(ar.ID)+\"/children\")\n\tspaceRelatedURL := rest.AbsoluteURL(request, app.SpaceHref(spaceID))\n\tpathToTopMostParent := ar.Path.String() // /uuid1/uuid2/uuid3s\n\ti := &app.Area{\n\t\tType: areaType,\n\t\tID: &ar.ID,\n\t\tAttributes: &app.AreaAttributes{\n\t\t\tName: &ar.Name,\n\t\t\tCreatedAt: &ar.CreatedAt,\n\t\t\tUpdatedAt: &ar.UpdatedAt,\n\t\t\tVersion: &ar.Version,\n\t\t\tParentPath: &pathToTopMostParent,\n\t\t},\n\t\tRelationships: &app.AreaRelations{\n\t\t\tSpace: &app.RelationGeneric{\n\t\t\t\tData: &app.GenericData{\n\t\t\t\t\tType: &space.SpaceType,\n\t\t\t\t\tID: &spaceID,\n\t\t\t\t},\n\t\t\t\tLinks: &app.GenericLinks{\n\t\t\t\t\tSelf: &spaceRelatedURL,\n\t\t\t\t\tRelated: &spaceRelatedURL,\n\t\t\t\t},\n\t\t\t},\n\t\t\tChildren: &app.RelationGeneric{\n\t\t\t\tLinks: &app.GenericLinks{\n\t\t\t\t\tSelf: &childURL,\n\t\t\t\t\tRelated: &childURL,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tLinks: &app.GenericLinks{\n\t\t\tSelf: &relatedURL,\n\t\t\tRelated: &relatedURL,\n\t\t},\n\t}\n\n\t// Now check the path, if the path is empty, then this is the topmost area\n\t// in a specific space.\n\tif ar.Path.IsEmpty() == false {\n\t\tparent := ar.Path.This().String()\n\t\t// Only the immediate parent's URL.\n\t\tparentSelfURL := rest.AbsoluteURL(request, app.AreaHref(parent))\n\n\t\ti.Relationships.Parent = &app.RelationGeneric{\n\t\t\tData: &app.GenericData{\n\t\t\t\tType: &areaType,\n\t\t\t\tID: &parent,\n\t\t\t},\n\t\t\tLinks: &app.GenericLinks{\n\t\t\t\tSelf: &parentSelfURL,\n\t\t\t},\n\t\t}\n\t}\n\tfor _, add := range additional {\n\t\tadd(appl, request, &ar, i)\n\t}\n\treturn i\n}", "title": "" }, { "docid": "69a2630fea6968fbfb45713dccdc928e", "score": "0.41964608", "text": "func NewAreaController(service *goa.Service, db application.DB, config AreaControllerConfiguration) *AreaController {\n\treturn &AreaController{\n\t\tController: service.NewController(\"AreaController\"),\n\t\tdb: db,\n\t\tconfig: config}\n}", "title": "" }, { "docid": "446ea152cbe0acd531a505a8d92877d5", "score": "0.41957614", "text": "func RoadAreaHandler(w http.ResponseWriter, r *http.Request) {\n\tdecoder := json.NewDecoder(r.Body)\n\n\tvar t area.PointRect\n\terr := decoder.Decode(&t)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvalid := isValid(t)\n\tif valid == false {\n\t\thttp.Error(w, \"Invalid Inputs\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcalcArea := area.CalculateRoadArea(t)\n\tjs, err := json.Marshal(calcArea)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(js)\n}", "title": "" }, { "docid": "1eb6c665f148904d89920b3faba0f59a", "score": "0.41883388", "text": "func (a *MemoryApiService) GetMemoryPersistentMemoryRegionByMoidExecute(r ApiGetMemoryPersistentMemoryRegionByMoidRequest) (*MemoryPersistentMemoryRegion, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *MemoryPersistentMemoryRegion\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"MemoryApiService.GetMemoryPersistentMemoryRegionByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/memory/PersistentMemoryRegions/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "a8fa950f8cedfb452447b9471a1dbe46", "score": "0.41698334", "text": "func (client *Client) DescribeDDosEventAreaWithOptions(request *DescribeDDosEventAreaRequest, runtime *util.RuntimeOptions) (_result *DescribeDDosEventAreaResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.EventType)) {\n\t\tquery[\"EventType\"] = request.EventType\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Ip)) {\n\t\tquery[\"Ip\"] = request.Ip\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.StartTime)) {\n\t\tquery[\"StartTime\"] = request.StartTime\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DescribeDDosEventArea\"),\n\t\tVersion: tea.String(\"2020-01-01\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &DescribeDDosEventAreaResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "30427e7a087bc58e440c2ace2c336778", "score": "0.41667315", "text": "func (suo *StatisticUpdateOne) SetAreaID(id int) *StatisticUpdateOne {\n\tsuo.mutation.SetAreaID(id)\n\treturn suo\n}", "title": "" }, { "docid": "9755d86c13f04a7685d93360119071e8", "score": "0.4162668", "text": "func (s *invService) GetSubareas(ctx context.Context, req *pb.GetSubareasRequest) (*pb.GetSubareasResponse, error) {\n\tresp := &pb.GetSubareasResponse{}\n\n\tgResp, subareas := s.GetSubareasHelper(req.GetMserviceId(), req.GetFacilityId())\n\n\tresp.ErrorCode = gResp.ErrorCode\n\tresp.ErrorMessage = gResp.ErrorMessage\n\tresp.Subareas = subareas\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "119af02b8cb6b694c2ce77c619982efc", "score": "0.41269314", "text": "func (m *Militar) MGOActualizarFEVIDA() (err error) {\n\tsq, err := sys.PostgreSQLSAMAN.Query(sqlFeDeVida())\n\tutil.Error(err)\n\ti := 0\n\tc := sys.MGOSession.DB(sys.CBASE).C(sys.CMILITAR)\n\tfor sq.Next() {\n\t\tvar codnip, familiar, razon sql.NullString\n\t\ti++\n\t\terr = sq.Scan(&codnip, &familiar, &razon)\n\t\tobtenerErr(err, \"\")\n\t\tced := util.ValidarNullString(codnip)\n\t\tfam := util.ValidarNullString(familiar)\n\t\traz := util.ValidarNullString(razon)\n\t\tsituacionpago := make(map[string]interface{})\n\t\tsitua := \"299\"\n\t\tif raz == \"CAR\" {\n\t\t\tsitua = \"206\"\n\t\t} else if raz == \"VIDA\" {\n\t\t\tsitua = \"207\"\n\t\t}\n\t\tsituacionpago[\"familiar.$.situacionpago\"] = situa\n\t\tsituacionpago[\"familiar.$.razonpago\"] = raz\n\n\t\terr = c.Update(bson.M{\"familiar.persona.datobasico.cedula\": fam, \"id\": ced}, bson.M{\"$set\": situacionpago})\n\t\tutil.Error(err)\n\t\tfmt.Println(\"#\", i, \"(Cedula): \"+ced)\n\n\t}\n\treturn\n}", "title": "" }, { "docid": "3c90de9cb4519fc0ca3e6ffa58fa1b1c", "score": "0.41166887", "text": "func ValorAnuladoCdpPorApropiacion(Id int) (valor float64, err error) {\n\to := orm.NewOrm()\n\tvar maps_valor_tot []orm.Params\n\t_, err = o.Raw(`SELECT anulacion_disponibilidad.estado_anulacion,\n\t\t\t\t\t\t\t\tdisponibilidad_apropiacion.apropiacion,\n\t\t\t\t\t\t\t\tCOALESCE(sum(anulacion_disponibilidad_apropiacion.valor),0) AS valor\n\t \t\t\t\t\t\tFROM financiera.anulacion_disponibilidad_apropiacion\n\t\t \t\t\t\t\tJOIN financiera.disponibilidad_apropiacion ON anulacion_disponibilidad_apropiacion.disponibilidad_apropiacion = disponibilidad_apropiacion.id\n\t\t \t\t\t\t\tJOIN financiera.disponibilidad ON disponibilidad_apropiacion.disponibilidad = disponibilidad.id\n\t\t\t\t\t \t\tJOIN financiera.anulacion_disponibilidad ON anulacion_disponibilidad.id = anulacion_disponibilidad_apropiacion.anulacion\n\t\t\t\t\t\t\t WHERE apropiacion = ? AND estado_anulacion = 3\n\t\t\t\t\t\t\t GROUP BY anulacion_disponibilidad.estado_anulacion, disponibilidad_apropiacion.apropiacion\n\t\t\t\t\t\t\t`, Id).Values(&maps_valor_tot)\n\t//fmt.Println(\"maps: \", len(maps_valor_tot))\n\tif len(maps_valor_tot) > 0 && err == nil {\n\t\tvalor, _ = strconv.ParseFloat(maps_valor_tot[0][\"valor\"].(string), 64)\n\t} else {\n\t\tvalor = 0\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "1aeb900c730c3d63013fe05a2c6925cc", "score": "0.4088071", "text": "func (a *Area) Insert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif a._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql insert query, primary key provided by autoincrement\n\tconst sqlstr = `INSERT INTO v1wq1ics1m037sn6.area (` +\n\t\t`creado_por_id, actualizado_por_id, nombre, fecha_creacion, fecha_actualizacion, departamento_id` +\n\t\t`) VALUES (` +\n\t\t`?, ?, ?, ?, ?, ?` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, a.CreadoPorID, a.ActualizadoPorID, a.Nombre, a.FechaCreacion, a.FechaActualizacion, a.DepartamentoID)\n\tres, err := db.Exec(sqlstr, a.CreadoPorID, a.ActualizadoPorID, a.Nombre, a.FechaCreacion, a.FechaActualizacion, a.DepartamentoID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// retrieve id\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set primary key and existence\n\ta.ID = int(id)\n\ta._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "5c6d80d4e95dfcadee9fcb9fb10a3802", "score": "0.40848494", "text": "func ValorApropiacion(Id int) (valor float64, err error) {\n\to := orm.NewOrm()\n\tvar maps_valor_tot []orm.Params\n\t_, err = o.Raw(`SELECT valor\n\t\t\t\tFROM financiera.apropiacion\n\t\t\t\tWHERE id= ?`, Id).Values(&maps_valor_tot)\n\t//fmt.Println(\"maps: \", len(maps_valor_tot))\n\tif len(maps_valor_tot) > 0 && err == nil {\n\t\tvalor, _ = strconv.ParseFloat(maps_valor_tot[0][\"valor\"].(string), 64)\n\t} else {\n\t\tvalor = 0\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3039328d72302e4fef0f39c705ccb2ad", "score": "0.4076924", "text": "func (c *ConfigareaClient) Get(ctx context.Context, id int) (*Configarea, error) {\n\treturn c.Query().Where(configarea.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "c0ba8a9c9a7f4b683b22ed84864f2415", "score": "0.4058197", "text": "func Get(name string) *area.Area {\n\treturn areas[strings.ToIDString(name)]\n}", "title": "" }, { "docid": "673ce6a23ceb6110a9987d19ec0340ea", "score": "0.40421164", "text": "func (a *PoliciesApiService) OrganizationsOrganizationIdAccountsAccountIdPoliciesPolicyIdExecutePost(ctx context.Context, policyId string, accountId string, organizationId string, empty Empty) (Empty, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tsuccessPayload Empty\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/organizations/{organization_id}/accounts/{account_id}/policies/{policy_id}/execute\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"policy_id\"+\"}\", fmt.Sprintf(\"%v\", policyId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"account_id\"+\"}\", fmt.Sprintf(\"%v\", accountId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"organization_id\"+\"}\", fmt.Sprintf(\"%v\", organizationId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &empty\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"x-api-key\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "b0554b27962c66648eafcadb67731bde", "score": "0.40415838", "text": "func (t *NetworkInstance_Protocol_Ospfv2) NewArea(Identifier NetworkInstance_Protocol_Ospfv2_Area_Identifier_Union) (*NetworkInstance_Protocol_Ospfv2_Area, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Area == nil {\n\t\tt.Area = make(map[NetworkInstance_Protocol_Ospfv2_Area_Identifier_Union]*NetworkInstance_Protocol_Ospfv2_Area)\n\t}\n\n\tkey := Identifier\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Area[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %%v for list Area\", key)\n\t}\n\n\tt.Area[key] = &NetworkInstance_Protocol_Ospfv2_Area{\n\t\tIdentifier: Identifier,\n\t}\n\n\treturn t.Area[key], nil\n}", "title": "" }, { "docid": "8e1db8e290f9c024625d286e48eb390a", "score": "0.4037976", "text": "func (m *Company) GetTaxAreas()([]TaxAreaable) {\n val, err := m.GetBackingStore().Get(\"taxAreas\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]TaxAreaable)\n }\n return nil\n}", "title": "" }, { "docid": "fdd2a802c6cf01dcea3b0e8d5c7ad701", "score": "0.40351653", "text": "func (t *NetworkInstance_Protocol_Ospfv2) NewArea(Identifier NetworkInstance_Protocol_Ospfv2_Area_Identifier_Union) (*NetworkInstance_Protocol_Ospfv2_Area, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Area == nil {\n\t\tt.Area = make(map[NetworkInstance_Protocol_Ospfv2_Area_Identifier_Union]*NetworkInstance_Protocol_Ospfv2_Area)\n\t}\n\n\tkey := Identifier\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Area[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Area\", key)\n\t}\n\n\tt.Area[key] = &NetworkInstance_Protocol_Ospfv2_Area{\n\t\tIdentifier: Identifier,\n\t}\n\n\treturn t.Area[key], nil\n}", "title": "" }, { "docid": "6fb217fab55c5e38dbfe4681f9d5da54", "score": "0.4022457", "text": "func (suo *StatisticUpdateOne) AddAreaIDs(ids ...int) *StatisticUpdateOne {\n\tsuo.mutation.AddAreaIDs(ids...)\n\treturn suo\n}", "title": "" }, { "docid": "23201332255a39d7d8ce567a393370e9", "score": "0.40071636", "text": "func (s *ReplaceService) Area(area string) *ReplaceService {\n\ts.area = area\n\treturn s\n}", "title": "" }, { "docid": "10bb50ab59220deaf5080a67efd32b84", "score": "0.39982283", "text": "func (c *AreahistoryClient) Get(ctx context.Context, id int) (*Areahistory, error) {\n\treturn c.Query().Where(areahistory.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "3bd4a0d779cdc126d8ad1a0869a383bd", "score": "0.39933276", "text": "func (f *FMap) WriteArea(r io.WriterAt, i int, data []byte) error {\n\tif i < 0 || int(f.NAreas) <= i {\n\t\treturn fmt.Errorf(\"Area index %d out of range\", i)\n\t}\n\tif uint32(len(data)) > f.Areas[i].Size {\n\t\treturn fmt.Errorf(\"data too large for fmap area: %#x > %#x\",\n\t\t\tlen(data), f.Areas[i].Size)\n\t}\n\t_, err := r.WriteAt(data, int64(f.Areas[i].Offset))\n\treturn err\n}", "title": "" }, { "docid": "bf5bbb35df67dd308bdb04f9864e5a3c", "score": "0.39565462", "text": "func (*SafetySetAllowedArea) Id() uint8 {\n\treturn 54\n}", "title": "" }, { "docid": "4f7ab1ad6d29323e1a0607c152c05032", "score": "0.3945484", "text": "func (a *NiatelemetryApiService) GetNiatelemetryAaaRadiusProviderDetailsByMoidExecute(r ApiGetNiatelemetryAaaRadiusProviderDetailsByMoidRequest) (*NiatelemetryAaaRadiusProviderDetails, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *NiatelemetryAaaRadiusProviderDetails\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"NiatelemetryApiService.GetNiatelemetryAaaRadiusProviderDetailsByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/niatelemetry/AaaRadiusProviderDetails/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "7351911b5ceed401331afd133f863ac9", "score": "0.3927785", "text": "func Test_AreaCode(t *testing.T) {\n\tcites := []string{\n\t\t\"西\",\n\t\t\"北京市\",\n\t\t\"上海\",\n\t\t\"神\",\n\t\t\"神农架\",\n\t}\n\n\tfor _, city := range cites {\n\t\tcode, ok := AreaCode(city)\n\t\tif !ok {\n\t\t\tt.Errorf(\"not found. city=%q\", city)\n\t\t}\n\n\t\tt.Logf(\"city=%q, code=%q\", city, code)\n\t}\n}", "title": "" }, { "docid": "34e64845cf78cf605aeefa2b7320400c", "score": "0.39258483", "text": "func (d *Dao) ValidFilterAreaCountByArea(c context.Context, area string) (count int64, err error) {\n\trow := d.mysql.QueryRow(c, _validAreaRuleCount, time.Now(), time.Now(), area)\n\tif err = row.Scan(&count); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7e4ad7a84da13708b920c499d2cabeaa", "score": "0.3915634", "text": "func (ai *AI) updateArea(fields [5][5]pkg.FieldType, current *Ant) {\n\tai.log.Printf(\"%d, %v updateArea\", current.ID, current.Pos)\n\tfor dx := range fields {\n\t\tfor dy, t := range fields[dx] {\n\t\t\tx := current.Pos.X + dx - 2\n\t\t\ty := current.Pos.Y + dy - 2\n\t\t\tif ai.area.RewriteMap(x, y, ai) {\n\t\t\t\tx = current.Pos.X + dx - 2\n\t\t\t\ty = current.Pos.Y + dy - 2\n\t\t\t}\n\n\t\t\tif ai.area.matrix[x][y] != t {\n\t\t\t\tif t == pkg.EnemyAnthillField {\n\t\t\t\t\tai.enemyAnthills = append(ai.enemyAnthills, &pkg.Pos{X: x, Y: y})\n\t\t\t\t} else if ai.area.matrix[x][y] == pkg.EnemyAnthillField {\n\t\t\t\t\tai.enemyAnthills = ai.enemyAnthills.Remove(x, y)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tai.area.matrix[x][y] = t\n\t\t}\n\t}\n\n\tai.area.CutArea(fields, current.Pos, ai)\n}", "title": "" }, { "docid": "25f7df662431b1933314345d3af70944", "score": "0.39064056", "text": "func calculateAreas(){\n\tfor i := top; i <= bottom; i++ {\n\t\tfor j := left; j <= right; j++ {\n\t\t\tareas[i][j] = calculateClosest(i,j);\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e2894e6e81fadf7655a3c4cbbde68c43", "score": "0.38940537", "text": "func (n *Newton) Area(expr string, start int, end int) (string, error) {\n\tconst endPoint = \"area\"\n\texp := fmt.Sprintf(\"%d:%d|%s\", start, end, expr)\n\tcall := fmt.Sprintf(url, endPoint, exp)\n\tres, err := http.Get(call)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvar data response\n\tjson.NewDecoder(res.Body).Decode(&data)\n\treturn data.Result, nil\n}", "title": "" }, { "docid": "87e18689c67008ab216dfe32c99e5d1f", "score": "0.3883305", "text": "func (this *DtTileCache) DecodeObstacleIdObstacle(ref DtObstacleRef) uint32 {\n\ttileMask := (DtObstacleRef(1) << 16) - 1\n\treturn uint32(ref & tileMask)\n}", "title": "" }, { "docid": "664df02d25ce1f75afeb5e3b273c9e27", "score": "0.387594", "text": "func ConvertAreaSimple(request *http.Request, id interface{}) *app.GenericData {\n\tt := area.APIStringTypeAreas\n\ti := fmt.Sprint(id)\n\treturn &app.GenericData{\n\t\tType: &t,\n\t\tID: &i,\n\t\tLinks: createAreaLinks(request, id),\n\t}\n}", "title": "" }, { "docid": "69c33c67dfcd35374a837d1f5ae66ccc", "score": "0.38697788", "text": "func GetApropiacionById(id int) (v *Apropiacion, err error) {\n\to := orm.NewOrm()\n\tv = &Apropiacion{Id: id}\n\tif err = o.Read(v); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "210999d0be949ae067cd96cdfde16a06", "score": "0.38683093", "text": "func drawModelAreaWithPoints(pathToDataFile, pathToPredictionFile, pathToModelAreaImageFile string, \nscale float64) *image.RGBA {\n\tlabels, xs := readPoints(pathToDataFile, 0)\n\timage := buildImageBigEnoughToFitPoints(xs, scale)\n\n\tlines := strings.Split(readFileAsString(pathToPredictionFile), \"\\n\")\n\tlines = lines[:len(lines)-1]\n\tgridLabels := make([]float64, len(lines))\n\tfor i := range lines {\n\t\tline := strings.Split(lines[i], \" \")\n\t\tn, _ := strconv.ParseFloat(line[0], 64)\n\t\tgridLabels[i] = n\n\t}\n\n\tk := 0\n\trunThroughImage(image, func (i, j int) {\n\t\taddColorAt(i, j,image, color.RGBA{(255/2)*uint8(1+gridLabels[k]), (255/2)*uint8(1-gridLabels[k]), 0, 255})\n\t\tk++\n\t})\n\n\tdrawPointsInImage(labels, xs, image, scale)\n\n\t// saveImage(image, pathToModelAreaImageFile)\n\treturn image\n}", "title": "" }, { "docid": "ebbf8a1357c76307fe7d7f6b2ef5b8ee", "score": "0.38670427", "text": "func (a *NiatelemetryApiService) GetNiatelemetryHttpsAclEpgContractMapByMoidExecute(r ApiGetNiatelemetryHttpsAclEpgContractMapByMoidRequest) (*NiatelemetryHttpsAclEpgContractMap, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *NiatelemetryHttpsAclEpgContractMap\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"NiatelemetryApiService.GetNiatelemetryHttpsAclEpgContractMapByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/niatelemetry/HttpsAclEpgContractMaps/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "b52eecc3d29fe0402dee3d9271edbbc5", "score": "0.38613757", "text": "func (a *VirtualizationApiService) GetVirtualizationEsxiConsoleByMoidExecute(r ApiGetVirtualizationEsxiConsoleByMoidRequest) (*VirtualizationEsxiConsole, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *VirtualizationEsxiConsole\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"VirtualizationApiService.GetVirtualizationEsxiConsoleByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/virtualization/EsxiConsoles/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "cb9ef57cd410ae7d46890e55f06fa0de", "score": "0.3856966", "text": "func (su *StatisticUpdate) SetAreaID(id int) *StatisticUpdate {\n\tsu.mutation.SetAreaID(id)\n\treturn su\n}", "title": "" }, { "docid": "b28477ea43b198fc1d14c595ca1720ec", "score": "0.3854141", "text": "func (a *VirtualizationApiService) GetVirtualizationVmwareDatacenterByMoidExecute(r ApiGetVirtualizationVmwareDatacenterByMoidRequest) (*VirtualizationVmwareDatacenter, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *VirtualizationVmwareDatacenter\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"VirtualizationApiService.GetVirtualizationVmwareDatacenterByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/virtualization/VmwareDatacenters/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "7c0f138044a954bdbccbc237358130bf", "score": "0.3848324", "text": "func (a *MacpoolApiService) GetMacpoolUniverseByMoidExecute(r ApiGetMacpoolUniverseByMoidRequest) (*MacpoolUniverse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *MacpoolUniverse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"MacpoolApiService.GetMacpoolUniverseByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/macpool/Universes/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "565f0d27a7b0b114ddbf07f7224ee909", "score": "0.3819351", "text": "func (s *invService) GetInventoryItemsBySubarea(ctx context.Context, req *pb.GetInventoryItemsBySubareaRequest) (*pb.GetInventoryItemsBySubareaResponse, error) {\n\tresp := &pb.GetInventoryItemsBySubareaResponse{}\n\n\tsqlstring := `SELECT i.inbInventoryItemId, i.dtmCreated, i.dtmModified, i.intVersion, i.inbMserviceId,\n\ti.inbSubareaId, i.intItemTypeId, i.intQuantity, i.chvSerialNumber, i.inbProductId, i.chvJsonData, \n\tt.chvItemTypeName, p.chvProductName\n\tFROM tb_InventoryItem AS i\n\tLEFT JOIN tb_ItemType as t ON i.inbMserviceId = t.inbMserviceId AND i.intItemTypeId = t.intItemTypeId\n\tLEFT JOIN tb_Product as p ON i.inbProductId = p.inbProductId\n\tWHERE i.inbSubareaId = ? AND i.inbMserviceId = ? AND i.bitIsDeleted = 0`\n\n\tstmt, err := s.db.Prepare(sqlstring)\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"Prepare\", \"error\", err)\n\t\tresp.ErrorCode = 500\n\t\tresp.ErrorMessage = \"db.Prepare failed\"\n\t\treturn resp, nil\n\t}\n\n\tdefer stmt.Close()\n\n\trows, err := stmt.Query(req.GetSubareaId(), req.GetMserviceId())\n\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"Query\", \"error\", err)\n\t\tresp.ErrorCode = 500\n\t\tresp.ErrorMessage = err.Error()\n\t\treturn resp, nil\n\t}\n\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar created string\n\t\tvar modified string\n\t\tvar item pb.InventoryItem\n\t\tvar typeName sql.NullString\n\t\tvar productName sql.NullString\n\n\t\terr := rows.Scan(&item.InventoryItemId, &created, &modified,\n\t\t\t&item.Version, &item.MserviceId, &item.SubareaId, &item.ItemTypeId, &item.Quantity, &item.SerialNumber,\n\t\t\t&item.ProductId, &item.JsonData, &typeName, &productName)\n\t\tif err != nil {\n\t\t\tlevel.Error(s.logger).Log(\"what\", \"Scan\", \"error\", err)\n\t\t\tresp.ErrorCode = 500\n\t\t\tresp.ErrorMessage = err.Error()\n\t\t\treturn resp, nil\n\t\t}\n\n\t\titem.Created = dml.DateTimeFromString(created)\n\t\titem.Modified = dml.DateTimeFromString(modified)\n\t\tif typeName.Valid {\n\t\t\titem.ItemTypeName = typeName.String\n\t\t}\n\t\tif productName.Valid {\n\t\t\titem.ProductName = productName.String\n\t\t}\n\n\t\tresp.InventoryItems = append(resp.InventoryItems, &item)\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "9c77c60a82c44dc6f57d0074a39408e9", "score": "0.38142332", "text": "func (s *DeleteService) Area(area string) *DeleteService {\n\ts.area = area\n\treturn s\n}", "title": "" }, { "docid": "13f6b65003528b4b7f0f6cf9b23f7588", "score": "0.3809836", "text": "func (a *NiatelemetryApiService) GetNiatelemetryHttpsAclContractFilterMapByMoidExecute(r ApiGetNiatelemetryHttpsAclContractFilterMapByMoidRequest) (*NiatelemetryHttpsAclContractFilterMap, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *NiatelemetryHttpsAclContractFilterMap\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"NiatelemetryApiService.GetNiatelemetryHttpsAclContractFilterMapByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/niatelemetry/HttpsAclContractFilterMaps/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "33396baf3b9e049386abb3645aefdea2", "score": "0.38067892", "text": "func StoreArea(c *gin.Context) {\n\t// Register var and bind json\n\tvar area models.Areas\n\tif err := c.ShouldBindJSON(&area); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\t// StoreInDB\n\tif err := config.DB.Create(&area).Error; err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tconfig.DB.Preload(\"Country\").Preload(\"City\").Find(&area)\n\tc.JSON(200, area)\n}", "title": "" }, { "docid": "8a573652c5d9b2bd002c815adaceff66", "score": "0.38025156", "text": "func getRectData(line string) (area, error) {\n\tfirstSplit := strings.Split(line, \" @ \")\n\tkey := firstSplit[1]\n\tid := firstSplit[0][1:]\n\n\tauxLine := strings.Split(key, \",\")\n\txString, auxLine2 := auxLine[0], auxLine[1]\n\txDistance, errx := strconv.Atoi(xString)\n\n\tauxLine = strings.Split(auxLine2, \": \")\n\tyString, auxLine4 := auxLine[0], auxLine[1]\n\tyDistance, erry := strconv.Atoi(yString)\n\n\tauxLine = strings.Split(auxLine4, \"x\")\n\twidth, errw := strconv.Atoi(auxLine[0])\n\theight, errh := strconv.Atoi(auxLine[1])\n\n\tif errx != nil || erry != nil || errw != nil || errh != nil {\n\t\treturn area{}, errors.New(\"Error parsing data to int\")\n\t}\n\treturn area {\n\t\txDistance: xDistance,\n\t\tyDistance: yDistance,\n\t\twidth: width,\n\t\theight: height,\n\t\tkey: key,\n\t\tid: id,\n\t\toverlap: false,\n\t}, nil\n}", "title": "" }, { "docid": "f22be03b5f219734fbb56a3907b93028", "score": "0.3802454", "text": "func initValorArea(xx, yy int32) {\n\t// TODO: Implement initValorArea.\n\tlog.Print(\"note: quests.initValorArea not yet implemented.\")\n}", "title": "" }, { "docid": "c843ab199b7517eaf940a706affc03e1", "score": "0.3798976", "text": "func NewRangeArea(v *nvim.Nvim, buf nvim.Buffer, sMark [2]int, eMark [2]int) (*RangeArea, error) {\n\tlines, err := v.BufferLines(buf, sMark[0]-1, eMark[0], true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tra := &RangeArea{}\n\n\tra.UnselectedStartLine = getUnselectedStartLine(lines, sMark[1])\n\tra.UnselectedEndLine = getUnselectedEndLine(lines, eMark[1])\n\tra.SelectedLines = getSelectedLines(lines, sMark, eMark)\n\n\treturn ra, nil\n}", "title": "" }, { "docid": "5298fea44ffd2fdaead4a0d79de8bef7", "score": "0.37960166", "text": "func ValorCdpPorApropiacion(Id int) (valor float64, err error) {\n\to := orm.NewOrm()\n\tvar maps_valor_tot []orm.Params\n\t_, err = o.Raw(`SELECT disponibilidad_apropiacion.apropiacion,\n\t\tCOALESCE(sum(disponibilidad_apropiacion.valor),0) AS valor\n\t FROM financiera.disponibilidad\n\t\t JOIN financiera.disponibilidad_apropiacion ON disponibilidad_apropiacion.disponibilidad = disponibilidad.id\n\t\t WHERE apropiacion= ?\n\t\t GROUP BY disponibilidad_apropiacion.apropiacion\n\t\t\t\t`, Id).Values(&maps_valor_tot)\n\t//fmt.Println(\"maps: \", len(maps_valor_tot))\n\tif len(maps_valor_tot) > 0 && err == nil {\n\t\tvalor, _ = strconv.ParseFloat(maps_valor_tot[0][\"valor\"].(string), 64)\n\t} else {\n\t\tvalor = 0\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "69fcc80d1645cc44b5f6589a4ce54e2e", "score": "0.37885538", "text": "func NewAreaRPCClient(client *liverpc.Client) AreaRPCClient {\n\treturn &areaRPCClient{\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "231ceb0137a7a3ff34a0aab24533e9d5", "score": "0.37846118", "text": "func Area(r Int) Int {\n\treturn r * r\n}", "title": "" }, { "docid": "acc6a85e163b569283eb8057044a7e38", "score": "0.37799156", "text": "func (a *MacpoolApiService) GetMacpoolIdBlockByMoidExecute(r ApiGetMacpoolIdBlockByMoidRequest) (*MacpoolIdBlock, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *MacpoolIdBlock\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"MacpoolApiService.GetMacpoolIdBlockByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/macpool/IdBlocks/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "0cfc568875b4fc7d16acae8c128995a2", "score": "0.37784544", "text": "func (s *ScrollService) Area(area string) *ScrollService {\n\ts.area = area\n\treturn s\n}", "title": "" }, { "docid": "40ea03989b641fbf666c2fb3c5413f61", "score": "0.37778232", "text": "func TestAreaTableDriven(t *testing.T) {\n\tareaTests := []struct {\n\t\tshapeName string\n\t\tshape Shape\n\t\twant float64\n\t}{\n\t\t{shapeName: \"Rectangle\", shape: Rectangle{width: 12.0, height: 10.0}, want: 120.0},\n\t\t{shapeName: \"Circle\", shape: Circle{radius: 10.0}, want: 314.1592653589793},\n\t\t{shapeName: \"Triangle\", shape: Triangle{base: 10.0, height: 8.0}, want: 40.0},\n\t}\n\n\tfor _, testData := range areaTests {\n\t\t// Using t.Run to give more feedback for the specific test being run\n\t\tt.Run(\"Currently testing \"+testData.shapeName, func(t *testing.T) {\n\t\t\tcalculatedArea := testData.shape.Area()\n\t\t\tif calculatedArea != testData.want {\n\t\t\t\tt.Errorf(\"(%#v) Expected %g but got %g\", testData.shape, testData.want, calculatedArea)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "8297b2b8c1ac6f2bb5733c2516863eaf", "score": "0.37719983", "text": "func (parser *Fichero) Ordenar() (hits []Hits) {\n\tvar longitudes Longitudes\n\n\t// Habrá que cambiar el map a un slice de struct. Aprovechamos para encontrar las longitudes\n\tfor acceso, intentos := range parser.intentos {\n\t\titem := Hits{acceso.usuario, acceso.hostname, acceso.ipaddress, intentos}\n\t\tif len(item.usuario) > longitudes.usuario {\n\t\t\tlongitudes.usuario = len(item.usuario)\n\t\t}\n\t\tif len(item.hostname) > longitudes.hostname {\n\t\t\tlongitudes.hostname = len(item.hostname)\n\t\t}\n\t\thits = append(hits, item)\n\t}\n\n\t// Ahora si, podemos ordenar\n\tsort.Slice(hits, func(i, j int) bool {\n\t\treturn hits[i].intento > hits[j].intento\n\t})\n\n\tparser.Longitudes = longitudes\n\treturn\n}", "title": "" }, { "docid": "f2e11ee4bffdbba15d9bda1af71256f8", "score": "0.37656826", "text": "func (g Group) EBaccArea(area string) EBaccSummary {\n\n\treturn g.ebaccSummary(area)\n}", "title": "" }, { "docid": "f7d5f810fbe0e08af2616660546a9bce", "score": "0.37560347", "text": "func AreaCodesForGeoPt(areaSize int64, lat, lng float64) []int64 {\n\tdEq, dGr, cEq, cGr := areaDistancesAndIndices(areaSize, lat, lng)\n\n\tareaCodes := make([]int64, 1, 4)\n\t// Main area code:\n\tareaCodes[0] = packAreaIndices(cEq, cGr)\n\n\t// Location inside an area:\n\tinEq := dEq - cEq*areaSize\n\tinGr := dGr - cGr*areaSize\n\n\t// Half of the size of the Areas, in meters\n\thalfAreaSize := areaSize / 2\n\n\t// Square of the half of the size of the Areas, in meters2\n\thalfAreaSize2 := halfAreaSize * halfAreaSize\n\n\t// Side neighbours:\n\tif inEq <= halfAreaSize { // South\n\t\tareaCodes = append(areaCodes, packAreaIndices(cEq-1, cGr))\n\t} else { // North\n\t\tareaCodes = append(areaCodes, packAreaIndices(cEq+1, cGr))\n\t}\n\tif inGr <= halfAreaSize { // West\n\t\tareaCodes = append(areaCodes, packAreaIndices(cEq, cGr-1))\n\t} else { // East\n\t\tareaCodes = append(areaCodes, packAreaIndices(cEq, cGr+1))\n\t}\n\n\t// Corner neighbours:\n\tif inEq <= halfAreaSize { // South\n\t\ty := inEq\n\t\tif inGr <= halfAreaSize { // Sount-West\n\t\t\tif x := inGr; (x*x + y*y) < halfAreaSize2 {\n\t\t\t\tareaCodes = append(areaCodes, packAreaIndices(cEq-1, cGr-1))\n\t\t\t}\n\t\t} else { // Sount-East\n\t\t\tif x := halfAreaSize - inGr; (x*x + y*y) < halfAreaSize2 {\n\t\t\t\tareaCodes = append(areaCodes, packAreaIndices(cEq-1, cGr+1))\n\t\t\t}\n\t\t}\n\t} else { // North\n\t\ty := halfAreaSize - inEq\n\t\tif inGr <= halfAreaSize { // North-West\n\t\t\tif x := inGr; (x*x + y*y) < halfAreaSize2 {\n\t\t\t\tareaCodes = append(areaCodes, packAreaIndices(cEq+1, cGr-1))\n\t\t\t}\n\t\t} else { // Sount-East\n\t\t\tif x := halfAreaSize - inGr; (x*x + y*y) < halfAreaSize2 {\n\t\t\t\tareaCodes = append(areaCodes, packAreaIndices(cEq+1, cGr+1))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn areaCodes\n}", "title": "" }, { "docid": "678a29a3e458deb5798b3148d2d843e3", "score": "0.3748722", "text": "func (su *StatisticUpdate) AddAreaIDs(ids ...int) *StatisticUpdate {\n\tsu.mutation.AddAreaIDs(ids...)\n\treturn su\n}", "title": "" }, { "docid": "3f31d5053d405b650b86bfc43a4551dd", "score": "0.37376115", "text": "func (m *SafetySetAllowedArea) Decode(buf []byte) {\n\tdata := bytes.NewBuffer(buf)\n\tbinary.Read(data, binary.LittleEndian, &m.P1X)\n\tbinary.Read(data, binary.LittleEndian, &m.P1Y)\n\tbinary.Read(data, binary.LittleEndian, &m.P1Z)\n\tbinary.Read(data, binary.LittleEndian, &m.P2X)\n\tbinary.Read(data, binary.LittleEndian, &m.P2Y)\n\tbinary.Read(data, binary.LittleEndian, &m.P2Z)\n\tbinary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM)\n\tbinary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT)\n\tbinary.Read(data, binary.LittleEndian, &m.FRAME)\n}", "title": "" }, { "docid": "43922caa089bef6940ef79455da85c31", "score": "0.37362623", "text": "func (suo *StatisticUpdateOne) SetArea(a *Area) *StatisticUpdateOne {\n\treturn suo.SetAreaID(a.ID)\n}", "title": "" }, { "docid": "1a3b22641f0fdce8bcbf08b4858eb734", "score": "0.37343508", "text": "func ActualizarCelular(c *gin.Context) {\n\n\tvar celulares Celular\n\tid := c.Params.ByName(\"id\")\n\n\tif err := DB.Where(\"id = ?\", id).First(&celulares).Error; err != nil {\n\t\tc.AbortWithStatus(404)\n\t\tfmt.Println(err)\n\t}\n\tc.BindJSON(&celulares)\n\n\tDB.Save(&celulares)\n\tc.JSON(200, celulares)\n\n}", "title": "" }, { "docid": "a4d74f379eaad90a57f6af529ac4a8fc", "score": "0.37272233", "text": "func (sc *StatisticCreate) SetAreaID(id int) *StatisticCreate {\n\tsc.mutation.SetAreaID(id)\n\treturn sc\n}", "title": "" }, { "docid": "4d4ea1f73c3241e969d3be71c4bbe9db", "score": "0.37165773", "text": "func (a *MacpoolApiService) GetMacpoolReservationByMoidExecute(r ApiGetMacpoolReservationByMoidRequest) (*MacpoolReservation, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *MacpoolReservation\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"MacpoolApiService.GetMacpoolReservationByMoid\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/macpool/Reservations/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "7e0416a38b554fae1b0c0e7e42b5e965", "score": "0.37154627", "text": "func CreateAreaByGivenCordinate(dataPoints []DataPoint) []HeatMapRect {\n\tconst level = 18\n\tvar rect s2.Rect\n\tfor k := 0; k < len(dataPoints); k++ {\n\t\tif k == 0 {\n\t\t\trect = s2.RectFromLatLng(s2.LatLngFromDegrees(dataPoints[k].lantitutte, dataPoints[k].longtitute))\n\t\t} else {\n\t\t\trect = rect.AddPoint(s2.LatLngFromDegrees(dataPoints[k].lantitutte, dataPoints[k].longtitute))\n\t\t}\n\t}\n\t//creating region cover\n\trc := &s2.RegionCoverer{MinLevel: level, MaxLevel: level, MaxCells: 50}\n\t//creating region accordinting to created rect\n\tr := s2.Region(rect.RectBound())\n\t//create cells covering area given coordinates\n\tcovering := rc.Covering(r)\n\n\tfor _, c := range covering {\n\t\tval := 8\n\t\tcellMap[c] += val\n\t}\n\tvar heatMapRects = make([]HeatMapRect, 0, len(cellMap))\n\tfor cellId, _ := range cellMap {\n\t\t//fmt.Println(val)\n\t\tvar rect Rect\n\t\tcell := s2.CellFromCellID(cellId)\n\t\tfor k := 0; k < 4; k++ {\n\t\t\tvertex := s2.LatLngFromPoint(cell.Vertex(k))\n\t\t\trect[k][0], rect[k][1] = vertex.Lat.Degrees(), vertex.Lng.Degrees()\n\t\t}\n\t\theatMapRects = append(heatMapRects, HeatMapRect{Rect: rect})\n\t}\n\theatMapData = heatMapRects\n\treturn heatMapData\n}", "title": "" }, { "docid": "5f6709b3d6c8312226a10c695a5b8f00", "score": "0.37116405", "text": "func (d *Dao) FilterByContent(c context.Context, content string) (rule *model.FilterInfo, err error) {\n\trule = &model.FilterInfo{}\n\trow := d.mysql.QueryRow(c, _ruleByContent, content)\n\tif err = row.Scan(&rule.ID, &rule.Mode, &rule.Filter, &rule.Level, &rule.Comment, &rule.Stime, &rule.Etime, &rule.Source, &rule.Type, &rule.State, &rule.CTime); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil\n\t\t\trule = nil\n\t\t}\n\t\treturn\n\t}\n\tvar rows *xsql.Rows\n\tif rows, err = d.mysql.Query(c, _ruleAreas, rule.ID); err != nil {\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tvar (\n\t\tareaM = make(map[string]*model.FilterArea)\n\t\ttpM = make(map[int64]struct{})\n\t)\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tarea string\n\t\t\ttpid int64\n\t\t\tareaLevel int8\n\t\t)\n\t\tif err = rows.Scan(&area, &tpid, &areaLevel); err != nil {\n\t\t\treturn\n\t\t}\n\t\tareaM[area] = &model.FilterArea{Area: area, Level: areaLevel}\n\t\ttpM[tpid] = struct{}{}\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn\n\t}\n\tfor _, a := range areaM {\n\t\trule.Areas = append(rule.Areas, a)\n\t}\n\tfor t := range tpM {\n\t\trule.TpIDs = append(rule.TpIDs, t)\n\t}\n\treturn\n}", "title": "" }, { "docid": "03b83c640c38b3055dae1ea1994fb77b", "score": "0.3700707", "text": "func (aabb *AABB) Area() vect.Float {\n\treturn (aabb.Upper.X - aabb.Lower.X) * (aabb.Upper.Y - aabb.Lower.Y)\n}", "title": "" }, { "docid": "eeb324cb4d62442c7a1e3d84761f2068", "score": "0.36915168", "text": "func Area() (r *HTMLTagBuilder) {\n\treturn Tag(\"area\").OmitEndTag()\n}", "title": "" }, { "docid": "d8b215f8d46f0a83c9c35974a91f1cbd", "score": "0.36780643", "text": "func (rs *RemitosService) PasarACreado(token string) (map[string]interface{}, error) {\n\tusuarioEjecuta := structs.Usuarios{\n\t\tToken: token,\n\t}\n\n\tparams := map[string]interface{}{\n\t\t\"Remitos\": rs.Remitos,\n\t\t\"UsuariosEjecuta\": usuarioEjecuta,\n\t}\n\n\tout, err := rs.DbHandler.CallSP(\"zsp_remito_pasar_a_creado\", params)\n\n\tif err != nil || out == nil {\n\t\treturn nil, err\n\t}\n\n\tvar response map[string]interface{}\n\n\terr = json.Unmarshal(*out, &response)\n\n\treturn response, err\n}", "title": "" } ]
66363efae74cc9aece98498afc812d56
GetNodeList gets the nodelist which satisfies the topology info
[ { "docid": "dd437a0b5ed84ba2d4ee465a349da08f", "score": "0.77350706", "text": "func GetNodeList(topo *csi.TopologyRequirement) ([]string, error) {\n\n\tvar nodelist []string\n\n\tlist, err := k8sapi.ListNodes(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, node := range list.Items {\n\t\tfor _, prf := range topo.Preferred {\n\t\t\tnodeFiltered := false\n\t\t\tfor key, value := range prf.Segments {\n\t\t\t\tif node.Labels[key] != value {\n\t\t\t\t\tnodeFiltered = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif nodeFiltered == false {\n\t\t\t\tnodelist = append(nodelist, node.Name)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nodelist, nil\n}", "title": "" } ]
[ { "docid": "c993bd18e8145785ed21427c88312f5a", "score": "0.7283274", "text": "func (nodeInstance *Node) GetNodeList() {\n client := http.Client{\n Timeout: 10 * time.Second,\n }\n\n // loop through all known nodes and get their node lists\n for _, node := range nodeInstance.NodeList {\n httpAddress := \"http://\" + node.IpAddr + \":\" + strconv.Itoa(node.Port) + \"/get-nodes\"\n resp, err := client.Get(httpAddress)\n if err != nil {\n continue\n }\n\n // convert response body to a slice of NodeAddresses\n var nodeAddresses []NodeAddress\n err = json.NewDecoder(resp.Body).Decode(&nodeAddresses)\n if err != nil { //we got an error, so the node list was not formatted well\n continue\n }\n\n for _, nodeAddress := range nodeAddresses {\n nodeInstance.NodeList = append(nodeInstance.NodeList, nodeAddress)\n }\n // remove duplicates from the node list\n nodeInstance.NodeList = removeDuplicateNodes(nodeInstance.NodeList)\n }\n return\n}", "title": "" }, { "docid": "401f758b33c54d9b9c627ee641f7341b", "score": "0.682259", "text": "func GetNodeList(client *client.Client) (*NodeList, error) {\n\tnodes, err := client.Nodes().List(\n\t\tapi.ListOptions{\n\t\t\tLabelSelector: labels.Everything(),\n\t\t\tFieldSelector: fields.Everything(),\n\t\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn getNodeList(nodes.Items), nil\n}", "title": "" }, { "docid": "8f93f40c0bf26ae40c54e0b0bb3d85e3", "score": "0.6202582", "text": "func (tm TasksManager)GetNodes()[]string{\n\tif len(tm.nodes) <=1 {\n\t\treturn []string{}\n\t}\n\tnodes := make([]string,0,len(tm.nodes)-1)\n\tfor url,_ := range tm.nodes {\n\t\tif url != tm.url {\n\t\t\tnodes = append(nodes,url)\n\t\t}\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "b338bc3e5e8f735344195d3f6c77a1b7", "score": "0.6127137", "text": "func (d *Displayer) GetListNodes(ctx context.Context, w io.Writer, resources []*output.Node, _ bool) error {\n\treturn d.encode(w, resources)\n}", "title": "" }, { "docid": "c482154cd283a1fa07fe80d881ead022", "score": "0.6072224", "text": "func (s *Suite) GetNodes(x int) ([]cfgBackend.Node, error) {\n\tfilterMap := make(map[string][]string, 0)\n\treturn s.cfgmgmt.GetNodes(1, x, \"node_name\", true, filterMap, \"\", \"\")\n}", "title": "" }, { "docid": "561eed3d55c4a2b010d9a5d906d8892a", "score": "0.60643816", "text": "func (n NodeList) GetNodes(num int) string {\n\treturn n.currentView.GetNodes(n.topNodeIndex, num)\n}", "title": "" }, { "docid": "6228da18638733cf7d7ff5d20a6f3db5", "score": "0.604574", "text": "func (sp *ScyllaOrganizationProvider) ListNodes(organizationID string) ([]string, derrors.Error) {\n\n\tsp.Lock()\n\tdefer sp.Unlock()\n\n\tif err := sp.CheckAndConnect(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 1.-Check if the organization exists\n\texists, err := sp.UnsafeGenericExist(organizationTable, organizationTablePK, organizationID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, derrors.NewNotFoundError(\"organization\").WithParams(organizationID)\n\t}\n\n\tstmt, names := qb.Select(organizationNodeTable).Columns(\"node_id\").Where(qb.Eq(\"organization_id\")).ToCql()\n\tq := gocqlx.Query(sp.Session.Query(stmt), names).BindMap(qb.M{\n\t\t\"organization_id\": organizationID,\n\t})\n\n\tnodes := make([]string, 0)\n\tcqlErr := q.SelectRelease(&nodes)\n\n\tif cqlErr != nil {\n\t\treturn nil, derrors.AsError(cqlErr, \"cannot list nodes\")\n\t}\n\n\treturn nodes, nil\n}", "title": "" }, { "docid": "455409b17c182316afb82f4293562cd4", "score": "0.60429674", "text": "func (c *ACIClient) NodeList() (map[string]map[string]interface{}, error) {\n\tnodeMap := make(map[string]map[string]interface{})\n\tnodes, err := c.client.NodeList()\n\tif err != nil {\n\t\treturn nodeMap, err\n\t}\n\tfor _, node := range nodes {\n\t\tc.Log.Tracef(\"Recieved node from ACI: %+v\\n\", node)\n\t\tdn := strings.Replace(node[\"dn\"].(string), \"/sys\", \"\", -1)\n\t\tnodeMap[dn] = node\n\t}\n\treturn nodeMap, nil\n}", "title": "" }, { "docid": "cedd3153a637aba70804f3ef040fe54d", "score": "0.60142577", "text": "func getList() (nodes []Node, err error) {\n\tres, err := httpGet(WEB_URL)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tr := regexp.MustCompile(`\n<tr>\n<td>(?P<ip>.+?)</td>\n<td>(?P<port>.+?)</td>\n<td>(?P<location>.+?)</td>\n<td>\n.+width: (?P<speed>.+?)%.+\n</td>\n<td>(?P<lastcheck>.+?)</td>\n</tr>`)\n\tm := r.FindAllSubmatch(res, -1)\n\n\ta := make([]map[string]string, len(m))\n\n\tfor k, v := range m {\n\t\ta[k] = make(map[string]string)\n\t\tfor i, name := range r.SubexpNames() {\n\t\t\tif i != 0 && len(name) > 0 {\n\t\t\t\ta[k][name] = string(v[i])\n\t\t\t}\n\t\t}\n\t}\n\n\tnodes = make([]Node, len(a))\n\n\tfor k, v := range a {\n\t\tnodes[k].Ip = v[\"ip\"]\n\t\tnodes[k].Port = v[\"port\"]\n\t\tnodes[k].Location = v[\"location\"]\n\t\tnodes[k].Speed, _ = strconv.Atoi(v[\"speed\"])\n\t\tnodes[k].LastCheck, _ = time.Parse(\"2006-01-02 15:04:05\", v[\"lastcheck\"])\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5987f4e147fd28d115b92deef0d09de0", "score": "0.59941345", "text": "func getNodeListByLabel(kubeClient cnoclient.Client, label string) ([]string, error) {\n\tvar nodeNames []string\n\tnodeList, err := kubeClient.Default().Kubernetes().CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{LabelSelector: label})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, node := range nodeList.Items {\n\t\tnodeNames = append(nodeNames, node.Name)\n\t}\n\tklog.Infof(\"For Label %s, the list of nodes are %+q\", label, nodeNames)\n\treturn nodeNames, nil\n}", "title": "" }, { "docid": "342b5a6da839b847af1d8faf09134305", "score": "0.5991678", "text": "func (o *EssentialBcs) GetNodesList() (allNodes []int) {\n\tvar list []int\n\tfor _, bc := range o.All {\n\t\tlist = append(list, bc.GetNodesSorted()...)\n\t}\n\treturn utl.IntUnique(list)\n}", "title": "" }, { "docid": "fd1979dc7ff99fcec9045d98659b60dd", "score": "0.5950488", "text": "func (ov *DataHandler) GetClusterNodeInfos() (model.ClusterNodeInfoList, error) {\n\tnodes := &corev1.NodeList{}\n\terr := ov.client.List(context.TODO(), nodes)\n\tif err != nil {\n\t\tklog.Errorf(\"GetClusterTotalResource Failed to list nodes\")\n\t\treturn model.ClusterNodeInfoList{}, err\n\t}\n\tvar clusterNodeInfos []model.ClusterNodeInfo\n\tfor _, node := range nodes.Items {\n\t\t// query pod list in node\n\t\tpodList := &corev1.PodList{}\n\t\terr = ov.client.List(context.TODO(), podList, &client.ListOptions{\n\t\t\tFieldSelector: fields.OneTermEqualSelector(IndexNodeName, node.Name),\n\t\t})\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"GetClusterNodeInfos Failed to get pod list on node: %v error: %v\", node.Name, err)\n\t\t\treturn model.ClusterNodeInfoList{}, err\n\t\t}\n\t\tpodsRequest := getPodRequest(podList, corev1.PodRunning)\n\t\tallocatable := node.Status.Allocatable.DeepCopy()\n\n\t\tclusterNodeInfo := model.ClusterNodeInfo{\n\t\t\tNodeName: node.Name,\n\t\t\tInstanceType: getInstanceType(&node),\n\t\t\tGPUType: node.Labels[GPUType],\n\t\t\tTotalCPU: allocatable.Cpu().MilliValue(),\n\t\t\tTotalMemory: allocatable.Memory().Value(),\n\t\t\tTotalGPU: getGpu(allocatable).MilliValue(),\n\t\t\tRequestCPU: podsRequest.Cpu().MilliValue(),\n\t\t\tRequestMemory: podsRequest.Memory().Value(),\n\t\t\tRequestGPU: getGpu(podsRequest).MilliValue(),\n\t\t}\n\t\tclusterNodeInfos = append(clusterNodeInfos, clusterNodeInfo)\n\t}\n\n\t// sort by node name\n\tsort.SliceStable(clusterNodeInfos, func(i, j int) bool {\n\t\treturn clusterNodeInfos[i].NodeName > clusterNodeInfos[j].NodeName\n\t})\n\n\treturn model.ClusterNodeInfoList{Items: clusterNodeInfos}, nil\n}", "title": "" }, { "docid": "ee9b26a60ab3ad83270f1c2b3b4b48b7", "score": "0.59356743", "text": "func GetNodes(contextName string) ([]corev1.Node, error) {\n\n\tclientset, err := context.GetClientset(contextName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif results := event.GetNodes(contextName); results != nil {\n\t\treturn results, nil\n\t}\n\n\treturn connector.GetNodes(clientset)\n}", "title": "" }, { "docid": "ba6f2b5ba4b2bd3452746b1379c62176", "score": "0.59290975", "text": "func (conn *EventConn) RequestNodeList() error {\n\tif err := conn.Put(NodeListRequestEvent, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "846dd9215874338543c324869ef9a720", "score": "0.5923721", "text": "func (nl *NodeLister) List() ([]*v1.Node, error) {\n\tvar nodes []*v1.Node\n\tfor _, node := range nl.Session.Nodes {\n\t\tnodes = append(nodes, node.Node)\n\t}\n\treturn nodes, nil\n}", "title": "" }, { "docid": "b7d20545b013e23611b6f9cddbd74174", "score": "0.58563644", "text": "func (n *NodeLister) List(selector labels.Selector) (ret []*corev1.Node, err error) {\n\tklog.V(4).Infof(\"Query node metrics with selector: %s\", selector.String())\n\n\tclusters, err := n.clusterLister.List(labels.Everything())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, cluster := range clusters {\n\t\tsci := n.informerManager.GetSingleClusterManager(cluster.Name)\n\t\tif sci == nil {\n\t\t\tklog.Errorf(\"Failed to get SingleClusterInformerManager for cluster(%s)\", cluster.Name)\n\t\t\tcontinue\n\t\t}\n\t\tnodes, err := sci.Lister(NodesGVR).List(selector)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"Failed to list nodes from cluster(%s): %v\", cluster.Name, err)\n\t\t\treturn nil, err\n\t\t}\n\t\tfor index := range nodes {\n\t\t\tnodeTyped := &corev1.Node{}\n\t\t\terr = helper.ConvertToTypedObject(nodes[index], nodeTyped)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"Failed to convert to typed object: %v\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif nodeTyped.Annotations == nil {\n\t\t\t\tnodeTyped.Annotations = map[string]string{}\n\t\t\t}\n\n\t\t\t//If user sets this annotation, we need to reset it.\n\t\t\tnodeTyped.Annotations[labelSelectorAnnotationInternal] = selector.String()\n\t\t\tret = append(ret, nodeTyped)\n\t\t}\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "715d05b6acbec9986c1232a8cc074bf1", "score": "0.5852827", "text": "func (h *nodes) List(metadata api.NodeMetadata) (*api.NodeList, error) {\n\tl := api.NewNodeList()\n\terr := h.c.list(metadata, h, l)\n\treturn l, err\n}", "title": "" }, { "docid": "624cddf7fd99b92d0ea892f08286bcbd", "score": "0.58525246", "text": "func (cl *Client) ListNodes(f *NodeFilter, page *Pager) ([]Node, error) {\n\tnodes := []Node{}\n\tquery := url.Values{}\n\tf.Apply(query)\n\tpage.apply(query)\n\t_, err := cl.get(cl.geturl(\"nodes\"), query, &nodes, http.StatusOK)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nodes, nil\n}", "title": "" }, { "docid": "d24d812e970a33082295e55aae699372", "score": "0.5852155", "text": "func (s *NodeAPI) List(ctx context.Context, db *mongo.Database, q nodeQuery, opts ...*options.FindOptions) ([]directory.Node, int64, error) {\n\tvar filter directory.NodeFilter\n\tif q.FarmID > 0 {\n\t\tfilter = filter.WithFarmID(schema.ID(q.FarmID))\n\t}\n\tfilter = filter.WithTotalCap(q.CRU, q.MRU, q.HRU, q.SRU)\n\tfilter = filter.WithLocation(q.Country, q.City)\n\n\tif !q.Proofs {\n\t\tprojection := bson.D{\n\t\t\t{Key: \"proofs\", Value: 0},\n\t\t}\n\t\topts = append(opts, options.Find().SetProjection(projection))\n\t}\n\n\tcur, err := filter.Find(ctx, db, opts...)\n\tif err != nil {\n\t\treturn nil, 0, errors.Wrap(err, \"failed to list nodes\")\n\t}\n\n\tdefer cur.Close(ctx)\n\tout := []directory.Node{}\n\tif err := cur.All(ctx, &out); err != nil {\n\t\treturn nil, 0, errors.Wrap(err, \"failed to load node list\")\n\t}\n\n\tcount, err := filter.Count(ctx, db)\n\tif err != nil {\n\t\treturn nil, 0, errors.Wrap(err, \"failed to count entries in nodes collection\")\n\t}\n\n\treturn out, count, nil\n}", "title": "" }, { "docid": "6dc3236e536980b1c9cf539f625ff680", "score": "0.584181", "text": "func NewNodeList(jsonData []byte, blocking bool) (NodeList, error) {\n\tmaster, err := NewMasterNodeList(jsonData, blocking)\n\tif err != nil {\n\t\treturn NodeList{}, err\n\t}\n\n\tif blocking {\n\t\tview, err := master.GetNodeView()\n\t\tif err != nil {\n\t\t\treturn NodeList{}, err\n\t\t}\n\t\treturn NodeList{master, map[string]View{\"main\": view}, view, \"main\", 0, 0, 0}, nil\n\t}\n\tnodeList := NodeList{master, map[string]View{}, View{}, \"\", 0, 0, 0}\n\t//subscribe to master callback\n\treturn nodeList, nil\n}", "title": "" }, { "docid": "3783b9286681938dab0657eae28f84f1", "score": "0.58091897", "text": "func getMinionNodes(c *kubernetes.Clientset) *api.NodeList {\n\tnodes, err := c.Core().Nodes().List(\n\t\tmetav1.ListOptions{\n\t\t\tFieldSelector: \"spec.unschedulable=false\",\n\t\t})\n\tif err != nil {\n\t\tfmt.Println(\"Failed to fetch nodes\", err)\n\t\treturn nil\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "79b9c5a71c4f1454450f068753024614", "score": "0.58083797", "text": "func (w *Watcher) buildNodeConfig() ([]*v1.Node, error) {\n\n\t// if the clusterConfig is nil for the watcher, we can't do anything\n\tif w.ClusterConfig == nil {\n\t\t// w.logger.Infof(\"w.ClusterConfig %p, len AllEndpoints %d\", w.ClusterConfig, len(w.AllEndpoints))\n\t\treturn []*v1.Node{}, fmt.Errorf(\"watcher: error in buildNodeConfig(). Tried to build NodeList, but w.ClusterConfig was nil\")\n\t}\n\n\t// if all endpoints are empty then throw an error. we can't publish this\n\tif len(w.AllEndpoints) == 0 {\n\t\treturn []*v1.Node{}, fmt.Errorf(\"watcher: error in buildNodeConfig(). Tried to build NodeList, but w.AllEndpoints was empty\")\n\t}\n\n\tif len(w.Nodes) == 0 {\n\t\treturn []*v1.Node{}, fmt.Errorf(\"watcher: error in buildNodeConfig(). Tried to build NodeList, but w.Nodes was empty\")\n\t}\n\n\tw.RLock()\n\tdefer w.RUnlock()\n\n\t// make a map for all nodes known to the watcher to prevent dupes\n\tnodeMap := make(map[string]*v1.Node)\n\tfor _, n := range w.Nodes {\n\t\tnodeMap[n.Name] = n\n\t}\n\n\t// loop over subsets across all endpoints and sort them into our nodes\n\t// for _, endpoint := range w.AllEndpoints { // Kubernetes *v1.Endpoint\n\n\t// \t// look over the subsets and address to find what node owns this endpoint\n\t// \tfor _, subset := range endpoint.Subsets {\n\n\t// \t\t// find the owning node of this set of subsets\n\t// \t\tfor _, addr := range subset.Addresses {\n\t// \t\t\tif addr.NodeName == nil {\n\t// \t\t\t\tlog.Warningln(\"watcher: skipped a subset address because the NodeName within was nil\")\n\t// \t\t\t\tcontinue\n\t// \t\t\t}\n\n\t// \t\t\t// check if this address's node name is in our nodeList map. If not,\n\t// \t\t\t// skip it until we learn about this node existing\n\t// \t\t\towningNode, ok := nodeMap[*addr.NodeName]\n\t// \t\t\tif !ok {\n\t// \t\t\t\tlog.Warningln(\"watcher: buildNodeConfig() skipped endpoint\", addr.IP, \"for node\", *addr.NodeName, \"because no node of this name is known yet\")\n\t// \t\t\t\tcontinue\n\t// \t\t\t}\n\n\t// \t\t\t// if the node does not have this endpoint yet, then we add it to the list and set this node in the node map\n\t// \t\t\tif !w.nodeHasAddressAlready(owningNode, addr) {\n\t// \t\t\t\t// fetch the owning node from our node map, append this new endpoint, and set it back\n\t// \t\t\t\towningNode.EndpointAddresses = append(owningNode.EndpointAddresses, addr)\n\t// \t\t\t\tlog.Warningln(\"watcher: node\", owningNode.Name, \"has had the following endpoint added:\", endpoint, \"these endpoints are now set:\", owningNode.EndpointAddresses)\n\t// \t\t\t\tw.Lock()\n\t// \t\t\t\tnodeMap[owningNode.Name] = owningNode\n\t// \t\t\t\tw.Unlock()\n\t// \t\t\t}\n\t// \t\t}\n\t// \t}\n\t// }\n\n\t// convert the nodeList map into a types.NodeList. Sort all the subsets\n\t// and then sort the node list at the end as well\n\tvar nodeList []*v1.Node\n\tfor _, n := range nodeMap {\n\t\tnodeList = append(nodeList, n)\n\t}\n\n\t// log.Debugln(\"watcher: buildNodeConfig is returning\", len(nodeList), \"nodes\")\n\treturn nodeList, nil\n}", "title": "" }, { "docid": "d481901ab12bf9b72a5ac6f07776060c", "score": "0.58078915", "text": "func (e *TestCli) GetNodes() (*corev1.NodeList, error) {\n\tnodes := &corev1.NodeList{}\n\terr := e.Cli.List(context.TODO(), nodes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nodes, nil\n}", "title": "" }, { "docid": "c64272f0630d05ea19849f6009330538", "score": "0.5800028", "text": "func GetNodes(p1 GeoPoint, p2 GeoPoint) []GeoPoint {\n\tbody := makeRequest(p1, p2)\n\t_, nodes, err := parseOsm(body)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn extractPoints(nodes)\n}", "title": "" }, { "docid": "cd28b34b99063db86f142627c1e8c358", "score": "0.5799717", "text": "func (d *Request) NodeList() []string {\n\tvar node []string\n\tfor _, host := range d.Hosts {\n\t\tif host.Country == d.Country {\n\t\t\tnode = append(node, host.City)\n\t\t}\n\t}\n\tsort.Strings(node)\n\treturn node\n}", "title": "" }, { "docid": "6822d7931d15691d44305741893dc5c2", "score": "0.57948446", "text": "func GetNodes() ([]Node, error) {\n\tvar nodes []Node\n\tdb, err := sql.Open(dbDriver, dbsource)\n\tif err != nil {\n\t\treturn nodes, err\n\t}\n\tdefer db.Close()\n\tstmt, err := db.Prepare(\"SELECT * FROM node\")\n\tif err != nil {\n\t\treturn nodes, err\n\t}\n\tdefer stmt.Close()\n\trows, err := stmt.Query()\n\tif err != nil {\n\t\treturn nodes, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar id, platformid, inftype int\n\t\tvar devid string\n\t\tvar isprovider bool\n\t\trows.Scan(&id, &devid, &platformid, &isprovider, &inftype)\n\t\tnode := Node{\n\t\t\tID: id,\n\t\t\tDevID: devid,\n\t\t\tPlatformID: platformid,\n\t\t\tIsProvider: isprovider,\n\t\t\tInfType: inftype,\n\t\t}\n\t\tnodes = append(nodes, node)\n\t}\n\treturn nodes, err\n}", "title": "" }, { "docid": "6235ee7a085992dd9c78f19bff6ef93e", "score": "0.57842684", "text": "func getNodeIDs() ([]string, error) {\n\ttlsConfig, err := creds.GetClientCredentials()\n\tvar nodeIDs []string\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\topts := []grpc.DialOption{\n\t\tgrpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)),\n\t}\n\n\tconn, err := grpc.DialContext(context.Background(), onosE2TAddress, opts...)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tadminClient := admin.NewE2TAdminServiceClient(conn)\n\tconnections, err := adminClient.ListE2NodeConnections(context.Background(), &admin.ListE2NodeConnectionsRequest{})\n\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tfor {\n\t\tconnection, err := connections.Recv()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn []string{}, err\n\t\t}\n\t\tif connection != nil {\n\t\t\tnodeID := connection.Id\n\t\t\tnodeIDs = append(nodeIDs, nodeID)\n\t\t}\n\n\t}\n\n\treturn nodeIDs, nil\n}", "title": "" }, { "docid": "386a017b90a3e1d4bc64d5dd8504b307", "score": "0.5781401", "text": "func GetNodes(s *discordgo.Session, m *discordgo.MessageCreate) {\n\tnodes, err := clientset.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\tlog.Printf(\"Error in getting ingress: %v\", err)\n\t}\n\tvar nodesList string\n\tfor _, node := range nodes.Items {\n\t\tnodesList += fmt.Sprintf(\"%v\\n\", node.Name)\n\t}\n\ts.ChannelMessageSend(m.ChannelID, nodesList)\n\n}", "title": "" }, { "docid": "f90b8843fa9af784923f8a3b0deaa145", "score": "0.5757379", "text": "func (t *tree) GetAllNodes(leafOnly bool) *list.List {\n\tt.RLock()\n\tdefer t.RUnlock()\n\tnodesList := new(list.List)\n\tfor _, n := range t.resPools {\n\t\tif !leafOnly || n.IsLeaf() {\n\t\t\tnodesList.PushBack(n)\n\t\t}\n\t}\n\treturn nodesList\n}", "title": "" }, { "docid": "fa6104cd586d99c8df06b7616554a23d", "score": "0.57456356", "text": "func (l *importHeartbeatListener) GetNodes() ([]string, error) {\n\n\tl.lock.RLock()\n\tnodeIDsCopy := make([]string, len(l.nodeIDs))\n\tcopy(nodeIDsCopy, l.nodeIDs)\n\tl.lock.RUnlock()\n\treturn nodeIDsCopy, nil\n}", "title": "" }, { "docid": "32fa90025af8c8ba3ed5e78554ce78d7", "score": "0.5744663", "text": "func (k Kademlia) GetNodes(ctx context.Context, start string, limit int) ([]*proto.Node, error) {\n\tif start == \"\" {\n\t\tstart = k.dht.GetSelfID()\n\t}\n\n\tnn, err := k.dht.FindNodes(ctx, start, limit)\n\tif err != nil {\n\t\treturn []*proto.Node{}, err\n\t}\n\treturn convertNetworkNodes(nn), nil\n}", "title": "" }, { "docid": "d08f9d062c970257970cf4368d52ee70", "score": "0.574203", "text": "func (s *srvNodeInfo) listNodes() {\n\tnmmu.RLock()\n\tnk := make([]int32, len(s.nodeMap))\n\ti := 0\n\tfor k := range s.nodeMap {\n\t\tnk[i] = k\n\t\ti++\n\t}\n\tsort.Slice(nk, func(i, j int) bool { return nk[i] < nk[j] })\n\tfor i := range nk {\n\t\teni := s.nodeMap[nk[i]]\n\t\tsub := time.Now().Sub(eni.lastAlive) / time.Second\n\t\tlog.Printf(\"ID: %4d %25s %14s %3d %2d:%3d %s\\n\", nk[i], eni.nodeName, eni.address, int(sub), eni.count, eni.status, eni.arg)\n\t}\n\tnmmu.RUnlock()\n}", "title": "" }, { "docid": "74026b451372a1a16405e2f085aa93fb", "score": "0.57324886", "text": "func (network *Network) GetNodes() []*node.Node {\n\tnetwork.mutex.RLock()\n\tdefer network.mutex.RUnlock()\n\n\tnodeList := make([]*node.Node, len(network.nodes))\n\n\ti := 0\n\tfor _, v := range network.nodes {\n\t\tnodeList[i] = v\n\t\ti++\n\t}\n\n\treturn nodeList\n}", "title": "" }, { "docid": "55e7902db5eb5d3d1a804f3f1167ca34", "score": "0.57011676", "text": "func (s *SPVCon) GetListOfNodes() ([]string, error) {\n\tvar listOfNodes []string // slice of IP addrs returned from the DNS seed\n\tlogging.Infof(\"Attempting to retrieve peers to connect to based on DNS Seed\\n\")\n\n\tfor _, seed := range s.Param.DNSSeeds {\n\t\ttemp, err := net.LookupHost(seed)\n\t\t// need this temp in order to capture the error from net.LookupHost\n\t\t// also need this to report the number of IPs we get from a seed\n\t\tif err != nil {\n\t\t\tlogging.Infof(\"Have difficulty trying to connect to %s. Going to the next seed\", seed)\n\t\t\tcontinue\n\t\t}\n\t\tlistOfNodes = append(listOfNodes, temp...)\n\t\tlogging.Infof(\"Got %d IPs from DNS seed %s\\n\", len(temp), seed)\n\t}\n\tif len(listOfNodes) == 0 {\n\t\treturn nil, fmt.Errorf(\"No peers found connected to DNS Seeds. Please provide a host to connect to.\")\n\t}\n\tlogging.Info(listOfNodes)\n\treturn listOfNodes, nil\n}", "title": "" }, { "docid": "c1663e1e800a801ad87ba2b213ce9327", "score": "0.56997037", "text": "func GetNodes(ctx context.Context, deploymentID string) ([]string, error) {\n\tnames := make([]string, 0)\n\tnodesPath := path.Join(consulutil.DeploymentKVPrefix, deploymentID, \"topology/nodes\")\n\tnodes, err := storage.GetStore(types.StoreTypeDeployment).Keys(nodesPath)\n\tif err != nil {\n\t\treturn names, err\n\t}\n\tfor _, node := range nodes {\n\t\tnames = append(names, path.Base(node))\n\t}\n\treturn names, nil\n}", "title": "" }, { "docid": "547f63ec8a5fe787a1d9cee63aac6863", "score": "0.5683179", "text": "func ResourceNodeList() []*ResourceNode {\n\trnsMux.RLock()\n\tdefer rnsMux.RUnlock()\n\n\tlist := make([]*ResourceNode, 0, len(resNodeMap))\n\tfor _, v := range resNodeMap {\n\t\tlist = append(list, v)\n\t}\n\treturn list\n}", "title": "" }, { "docid": "ebbe5f5a57d0e24b9f3a5a5378a70851", "score": "0.56731606", "text": "func GetTopology(sysFs sysfs.SysFs) ([]info.Node, int, error) {\n\t// s390/s390x changes\n\tif isSystemZ() {\n\t\treturn nil, getNumCores(), nil\n\t}\n\treturn sysinfo.GetNodesInfo(sysFs)\n}", "title": "" }, { "docid": "026fc051e8f24500fda5e108a19e98a8", "score": "0.566081", "text": "func (self *Network) GetNodes() []*Node {\n\tself.lock.Lock()\n\tdefer self.lock.Unlock()\n\treturn self.Nodes\n}", "title": "" }, { "docid": "b42abc5de8747bcf2a5c18ec321e3e4c", "score": "0.5636429", "text": "func (b *backend) GetNodes(namespace string, opts ...teleservices.MarshalOption) ([]teleservices.Server, error) {\n\treturn b.getNodes(namespace)\n}", "title": "" }, { "docid": "b2da9090a7eacfa876c20728fc8184ce", "score": "0.5632912", "text": "func GetNodes(n Noder, addr string) (Nodes, error) {\n\tnodes, err := n.GetNodes(addr, catalogNodesPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error querying Consul API: %s\", err)\n\t}\n\treturn nodes, nil\n}", "title": "" }, { "docid": "934fbac0a81e2528708c227951a045a7", "score": "0.560954", "text": "func GetNodeLocs() ([]NodeLocation, error) {\n\tnodeList := corev1.NodeList{}\n\n\tif gTestEnv.K8sClient.List(context.TODO(), &nodeList, &client.ListOptions{}) != nil {\n\t\treturn nil, errors.New(\"failed to list nodes\")\n\t}\n\tNodeLocs := make([]NodeLocation, 0, len(nodeList.Items))\n\tfor _, k8snode := range nodeList.Items {\n\t\taddrstr := \"\"\n\t\tnamestr := \"\"\n\t\tmayastorNode := false\n\t\tmasterNode := false\n\t\tfor label, value := range k8snode.Labels {\n\t\t\tif label == \"openebs.io/engine\" && value == \"mayastor\" {\n\t\t\t\tmayastorNode = true\n\t\t\t}\n\t\t\tif label == \"node-role.kubernetes.io/master\" {\n\t\t\t\tmasterNode = true\n\t\t\t}\n\t\t}\n\t\tfor _, addr := range k8snode.Status.Addresses {\n\t\t\tif addr.Type == corev1.NodeInternalIP {\n\t\t\t\taddrstr = addr.Address\n\t\t\t}\n\t\t\tif addr.Type == corev1.NodeHostName {\n\t\t\t\tnamestr = addr.Address\n\t\t\t}\n\t\t}\n\t\tif namestr != \"\" && addrstr != \"\" {\n\t\t\tNodeLocs = append(NodeLocs, NodeLocation{\n\t\t\t\tNodeName: namestr,\n\t\t\t\tIPAddress: addrstr,\n\t\t\t\tMayastorNode: mayastorNode,\n\t\t\t\tMasterNode: masterNode,\n\t\t\t})\n\t\t} else {\n\t\t\treturn nil, errors.New(\"node lacks expected fields\")\n\t\t}\n\t}\n\treturn NodeLocs, nil\n}", "title": "" }, { "docid": "76787bc4557815b16eaeecafa74791c0", "score": "0.5592382", "text": "func (a *Client) ListNodes(ctx context.Context, params *ListNodesParams) (*ListNodesOK, error) {\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ListNodes\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/nodes\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &ListNodesReader{formats: a.formats},\n\t\tContext: ctx,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ListNodesOK), nil\n\n}", "title": "" }, { "docid": "c84dabd12ff4c0615a6c8118cf742e12", "score": "0.55553997", "text": "func (n Node) GetNeighborsNodes() NodesList {\n\treturn n.neighbors.Get()\n}", "title": "" }, { "docid": "12c7c9391896627cd76f1d42811cbe93", "score": "0.5545534", "text": "func (c *Client) GetNodeIDList(ctx context.Context) ([]byte, error) {\n\treturn c.apiHandler.GetNodeIDList(ctx, c.groupID)\n}", "title": "" }, { "docid": "c6be8433104aed8f4b58c5bbabe48969", "score": "0.5544276", "text": "func listNodes(node *GraphNode) {\n\tif !node.Visited {\n\t\tnode.Visited = true\n\t\tNodeList = append(NodeList, node)\n\t\tif len(node.c) != 0 {\n\t\t\tfor _, v := range node.c {\n\t\t\t\tlistNodes(v)\n\t\t\t}\n\t\t} else {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2cedf183564dbbc0ade1f5ba76b86076", "score": "0.55300015", "text": "func getNodeEvents(c clientset.Interface, nodeName string) []v1.Event {\n\tselector := fields.Set{\n\t\t\"involvedObject.kind\": \"Node\",\n\t\t\"involvedObject.name\": nodeName,\n\t\t\"involvedObject.namespace\": v1.NamespaceAll,\n\t\t\"source\": \"kubelet\",\n\t}.AsSelector()\n\toptions := v1.ListOptions{FieldSelector: selector.String()}\n\tevents, err := c.Core().Events(api.NamespaceSystem).List(options)\n\tif err != nil {\n\t\tLogf(\"Unexpected error retrieving node events %v\", err)\n\t\treturn []v1.Event{}\n\t}\n\treturn events.Items\n}", "title": "" }, { "docid": "22846d41a0b781944e0b26498618846e", "score": "0.54873186", "text": "func GetNodePortsByProjectName(pname string) ([]int32, error) {\n\tvar nodeports []int32\n\n\t//obtain serviceList data of\n\tk8sclient := k8sassist.NewK8sAssistClient(&k8sassist.K8sAssistConfig{\n\t\tKubeConfigPath: kubeConfigPath(),\n\t})\n\n\tserviceList, err := k8sclient.AppV1().Service(pname).List()\n\tif err != nil {\n\t\tlogs.Error(\"Failed to get service list with project name: %s\", pname)\n\t\treturn nil, err\n\t}\n\n\t//handle the serviceList data\n\tfor _, service := range serviceList.Items {\n\n\t\tfor _, port := range service.Ports {\n\t\t\tif port.NodePort != 0 {\n\t\t\t\tnodeports = append(nodeports, port.NodePort)\n\t\t\t}\n\t\t}\n\t}\n\treturn nodeports, err\n}", "title": "" }, { "docid": "7e135d281d28285d4c27b926044aa94f", "score": "0.54725254", "text": "func (c *Conn) GetAvailableNodes(path ...NodeName) ([]string, error) {\n\tvar ret []string\n\targs := pathToArgs(path)\n\terr := c.Request(\"get_nodes\", &ret, args...)\n\treturn ret, err\n}", "title": "" }, { "docid": "532e44097af983ef62b74d418d3a1c09", "score": "0.5468541", "text": "func GetNodesAddr(ctx context.Context) ([]string, error) {\n\targs := utils.PlanetCommand(Command(\"get\", \"nodes\",\n\t\t\"--output\",\n\t\t`jsonpath={.items[*].status.addresses[?(@.type==\"InternalIP\")].address}`))\n\tcmd := exec.CommandContext(ctx, args[0], args[1:]...)\n\n\tcmd.Stderr = utils.NewStderrLogger(log.WithField(\"cmd\", \"kubectl get nodes\"))\n\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err, \"%v : %v\", cmd, err)\n\t}\n\n\tnodes := strings.Fields(strings.TrimSpace(string(out)))\n\treturn nodes, nil\n}", "title": "" }, { "docid": "5d7d514948df0f53ef558aba07d71459", "score": "0.54621166", "text": "func (l *Softmax) GetNodesPtr() *[]float64 {\n\treturn &l.nodes\n}", "title": "" }, { "docid": "e747964c6bf3a2d94137765604b2101e", "score": "0.5449111", "text": "func GetNodes(c *gin.Context) {\n\tconnection := c.MustGet(\"clientset\").(kubernetes.Clientset)\n\tnodes, _ := connection.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"result\": nodes,\n\t})\n}", "title": "" }, { "docid": "366df5f33d2f3c1b4b7d736084a4b815", "score": "0.54486424", "text": "func (psc *partitionSchedulingContext) getSchedulingNodes(excludeReserved bool) []*SchedulingNode {\n\tpsc.RLock()\n\tdefer psc.RUnlock()\n\n\tschedulingNodes := make([]*SchedulingNode, 0)\n\tfor _, node := range psc.nodes {\n\t\t// filter out the nodes that are not scheduling\n\t\tif !node.nodeInfo.IsSchedulable() || (excludeReserved && node.isReserved()) {\n\t\t\tcontinue\n\t\t}\n\t\tschedulingNodes = append(schedulingNodes, node)\n\t}\n\treturn schedulingNodes\n}", "title": "" }, { "docid": "350c23997c6c518f3039a55e4a5416ba", "score": "0.54272854", "text": "func (c *Client) ListNodes(opts *k8s.ListOptions) (*k8s.NodeList, error) {\n\tvar out k8s.NodeList\n\t_, err := c.do(\"GET\", \"/api/v1/nodes?\"+listOptionsQuery(opts, nil), nil, &out)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to list nodes\")\n\t}\n\treturn &out, nil\n}", "title": "" }, { "docid": "82c5880658e954f1d594fd133e8855f8", "score": "0.5422311", "text": "func (lb *LoadBalancerService) GetLBNodeList(loadBalancerID string) (lBNode *[]types.LBNode, err error) {\n\tlog.Debug(\"ListLBNodes\")\n\n\tdata, status, err := lb.concertoService.Get(fmt.Sprintf(\"/v1/network/load_balancers/%s/nodes\", loadBalancerID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = utils.CheckStandardStatus(status, data); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = json.Unmarshal(data, &lBNode); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn lBNode, nil\n}", "title": "" }, { "docid": "d5ab84e798987c83a68cfc77deae657c", "score": "0.54180425", "text": "func (l *Linear) GetNodesPtr() *[]float64 {\n\treturn &l.nodes\n}", "title": "" }, { "docid": "5bf99caaf58966864327e6d642bb49b4", "score": "0.54154384", "text": "func (g *Graph) GetNodes() (result []*Node) {\n\tfor _, node := range g.nodes {\n\t\tresult = append(result, node)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b101ed73aaa482f31ef192200479d638", "score": "0.53998435", "text": "func (kube *Kube) GetNodes() (*kv1.NodeList, error) {\n\tkube.logger.Debugf(nil, \"{kubernetes} retrieving list of nodes\")\n\tnodes, err := kube.core.Nodes().List(kmeta.ListOptions{})\n\tif err != nil {\n\t\treturn nil, karma.Format(\n\t\t\terr,\n\t\t\t\"unable to retrieve nodes from all namespaces\",\n\t\t)\n\t}\n\n\treturn nodes, nil\n}", "title": "" }, { "docid": "1b75235ee248f7d71c631ea45f728e4e", "score": "0.5391841", "text": "func GetNodes() []*Node {\n\tif len(Nodes) > 0 {\n\t\treturn Nodes\n\t}\n\tfor _, v := range GetKinds(GetNodeByFile, \"node\") {\n\t\tNodes = append(Nodes, v.(*Node))\n\t}\n\treturn Nodes\n}", "title": "" }, { "docid": "cab7da2f11712dcea7d32ec822d51047", "score": "0.53900635", "text": "func Get() []Node {\n\treturn list\n}", "title": "" }, { "docid": "229950cd7b0a8023ca6eceb5ba06463c", "score": "0.5386717", "text": "func (m *kubeManager) List(ctx context.Context) (ret []*corev1.Node, err error) {\n\tlist, err := m.listAllNodes(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get list of nodes\")\n\t}\n\n\treturn m.filterProxies(list), nil\n}", "title": "" }, { "docid": "376ddde895de386e05a8a9c899b1cf3e", "score": "0.5384684", "text": "func (c *collection) GetNodes() []*rpc.Node {\n\tnodes := make([]*rpc.Node, 0)\n\tfor _, n := range c.members {\n\t\tnodes = append(nodes, n)\n\t}\n\n\treturn nodes\n}", "title": "" }, { "docid": "7aa7873c86976c42679a912a14a65f16", "score": "0.53818536", "text": "func getOverlappingNodes(accessibleNodes []string, topologyRequirement *csi.TopologyRequirement) ([]string, error) {\n\tvar overlappingNodes []string\n\tnoOverLappingNodes := true\n\taccessibleNodeMap := make(map[string]bool)\n\tfor _, node := range accessibleNodes {\n\t\taccessibleNodeMap[node] = true\n\t}\n\tfor _, topology := range topologyRequirement.GetPreferred() {\n\t\thostname := topology.Segments[v1.LabelHostname]\n\t\tif accessibleNodeMap[hostname] {\n\t\t\t// Found an overlapping node.\n\t\t\tnoOverLappingNodes = false\n\t\t\toverlappingNodes = append(overlappingNodes, hostname)\n\t\t}\n\t}\n\tif noOverLappingNodes {\n\t\treturn nil, fmt.Errorf(\"couldn't find any overlapping node as accessible nodes present in storage pool \" +\n\t\t\t\"and hostnames provided in accessibility requirements are disjoint\")\n\t}\n\treturn overlappingNodes, nil\n}", "title": "" }, { "docid": "e3a1ffc1a87bbfd2b7001bdbbf70a38b", "score": "0.5364769", "text": "func (k *kubernetesTargetRetriever) listNodes() error {\n\tnodes, err := k.client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, n := range nodes.Items {\n\t\tif !isObjectScrapable(&n, k.scrapeEnabledLabel) {\n\t\t\tklog.Debugf(\"node %s was skipped because label or annotation %s is not true\", n.Name, k.scrapeEnabledLabel)\n\t\t\tcontinue\n\t\t}\n\n\t\ttargets, err := nodeTargets(&n)\n\t\tif err != nil {\n\t\t\tklog.WithError(err).WithField(\"node\", n.Name).Warnf(\"can't get targets for node. Ignoring\")\n\t\t\tcontinue\n\t\t}\n\t\tk.targets.Store(string(n.UID), targets)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "37eaf6140c526cdc6aaba41d828da593", "score": "0.53602296", "text": "func (n NodeList) GetNodesMatching(regex *regexp.Regexp, matchType MatchType, equal bool) []int {\n\treturn n.currentView.GetNodesMatching(regex, matchType, equal)\n}", "title": "" }, { "docid": "ecaa729bdf89adeda1102ec7ae15f2fa", "score": "0.53360075", "text": "func (m *NodeNetworkMock) GetWorkingNodes() (r []insolar.NetworkNode) {\n\tcounter := atomic.AddUint64(&m.GetWorkingNodesPreCounter, 1)\n\tdefer atomic.AddUint64(&m.GetWorkingNodesCounter, 1)\n\n\tif len(m.GetWorkingNodesMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.GetWorkingNodesMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to NodeNetworkMock.GetWorkingNodes.\")\n\t\t\treturn\n\t\t}\n\n\t\tresult := m.GetWorkingNodesMock.expectationSeries[counter-1].result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the NodeNetworkMock.GetWorkingNodes\")\n\t\t\treturn\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetWorkingNodesMock.mainExpectation != nil {\n\n\t\tresult := m.GetWorkingNodesMock.mainExpectation.result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the NodeNetworkMock.GetWorkingNodes\")\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetWorkingNodesFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to NodeNetworkMock.GetWorkingNodes.\")\n\t\treturn\n\t}\n\n\treturn m.GetWorkingNodesFunc()\n}", "title": "" }, { "docid": "91b4d6cf14dca795a4f0853688cc8592", "score": "0.5335637", "text": "func ListNodes(w http.ResponseWriter, r *http.Request) {\n\tLogHttp(r)\n\tuuid := GetQueryValue(\"uuid\", w, r)\n\tif validateNode(uuid) == false {\n\t\tlog.Error(\"Invalid or empty node UUID\")\n\t\tLogHttpErr(w, r, fmt.Errorf(\"Invalid or empty node UUID\"), http.StatusUnauthorized)\n\t\treturn\n\t}\n\tlock.RLock()\n\tdefer lock.RUnlock()\n\tserial, _ := json.MarshalIndent(&CurrentNodes, \" \", \" \")\n\tio.WriteString(w, string(serial))\n}", "title": "" }, { "docid": "eebb516698942e611c4a6dd7a1f1dd99", "score": "0.5329089", "text": "func (c *ciliumNodes) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumNodeList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v2.CiliumNodeList{}\n\terr = c.client.Get().\n\t\tResource(\"ciliumnodes\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "c5b766f00df8730376b99cf47e726918", "score": "0.532614", "text": "func ListNodes(ch chan<- *k8sapicore.NodeList) {\n\tnodes, err := K8sClient.CoreV1().Nodes().List(listOptions)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\tch <- nodes\n}", "title": "" }, { "docid": "92f0811381d982759a471e57bf36b06d", "score": "0.53237003", "text": "func (c *Client) ListNodes(opts ListNodesOptions) ([]swarm.Node, error) {\n\tpath := \"/nodes?\" + queryString(opts)\n\tresp, err := c.do(http.MethodGet, path, doOptions{context: opts.Context})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tvar nodes []swarm.Node\n\tif err := json.NewDecoder(resp.Body).Decode(&nodes); err != nil {\n\t\treturn nil, err\n\t}\n\treturn nodes, nil\n}", "title": "" }, { "docid": "d4cfdc934bad33d3cbbb399eddace85b", "score": "0.53106403", "text": "func (s *ServiceOp) ListVirtualNodeGroups(ctx context.Context, input *ListVngsInput) (*ListVngsOutput, error) {\n\tif input == nil {\n\t\treturn nil, fmt.Errorf(\"input is nil\")\n\t}\n\n\tpath, err := uritemplates.Expand(\"/ocean/spark/cluster/{clusterId}/virtualNodeGroup\", uritemplates.Values{\n\t\t\"clusterId\": spotinst.StringValue(input.ClusterID),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := client.NewRequest(http.MethodGet, path)\n\tresp, err := client.RequireOK(s.Client.Do(ctx, r))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvngs, err := vngsFromHttpResponse(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toutput := new(ListVngsOutput)\n\tif len(vngs) > 0 {\n\t\toutput.VirtualNodeGroups = vngs\n\t}\n\n\treturn output, nil\n}", "title": "" }, { "docid": "bb8d4fd4b29b4fa076179cc06ed3b556", "score": "0.5301529", "text": "func (t *transport) ListVnodes(hn string) ([]*chord.Vnode, error) {\n\tvar (\n\t\taddr *e3x.Addr\n\t\tch *e3x.Channel\n\t\tres []*completeVnode\n\t\terr error\n\t)\n\n\taddr = t.lookupAddr(hashname.H(hn))\n\tif addr == nil {\n\t\treturn nil, e3x.ErrNoAddress\n\t}\n\n\tch, err = t.e.Open(addr, \"chord.list\", true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer ch.Close()\n\n\t// ch.SetReadDeadline(time.Now().Add(30*time.Second))\n\t// ch.SetWriteDeadline(time.Now().Add(30*time.Second))\n\n\terr = ch.WritePacket(&lob.Packet{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = json.NewDecoder(newStream(ch)).Decode(&res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn t.internalVnodes(res), nil\n}", "title": "" }, { "docid": "26c4e658813cd1f98ff33ae6d0c3057d", "score": "0.5283748", "text": "func (c *Configuration) Nodes() []*Node {\n\treturn c.nodes\n}", "title": "" }, { "docid": "291b5e7d8f7d7c6b3c42e313d2833d86", "score": "0.5275742", "text": "func getNodes(clusterDir string) (nodeip []string, err error) {\n\n\tfileName := clusterDir + \"addSlaves\"\n\texist, _ := common.PathExist(fileName)\n\tif !exist {\n\t\t//logrus.Infof(\"getNodeIp, file %s not exists\", fileName)\n\t\treturn nil, nil\n\n\t}\n\n\tnodeByte, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\tlogrus.Errorf(\"getNodeIp, read file %s failed, err is %v\", fileName, err)\n\t\treturn nil, err\n\t}\n\tnodeip = strings.Split(strings.TrimSuffix(string(nodeByte), \",\"), \",\")\n\treturn\n}", "title": "" }, { "docid": "58ad0e110fd13a6065cb816c9d6b9231", "score": "0.52543205", "text": "func (db *MongoDbBridge) NetworkNodeAddressList(cur *mongo.Cursor, size uint) ([]*enode.Node, error) {\n\tlist := make([]*enode.Node, 0, size)\n\n\tfor cur.Next(context.Background()) {\n\t\tvar n struct {\n\t\t\tNode enode.Node `bson:\"node\"`\n\t\t}\n\t\tif err := cur.Decode(&n); err != nil {\n\t\t\tdb.log.Errorf(\"could not decode network node; %s\", err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tlist = append(list, &n.Node)\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "1fa30ca7c4b6e20a27c832e5dad9d924", "score": "0.5243699", "text": "func (k *KytheBeam) Nodes() beam.PCollection { return k.nodes }", "title": "" }, { "docid": "547265558c188abfeb7cabeafab3a078", "score": "0.5239814", "text": "func (m *MockRestClientInterface) NodeList(arg0 context.Context, arg1 string) (*cluster.NodesGetOK, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NodeList\", arg0, arg1)\n\tret0, _ := ret[0].(*cluster.NodesGetOK)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5beea0b3a5a0a34b157a29c93e2eef48", "score": "0.52318645", "text": "func (ns *NodeSync) GetAllNodes() Nodes {\n\tnodes := make(Nodes)\n\tfor _, node := range ns.nodes {\n\t\tif node.ID == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tnodes[node.Name] = node\n\t}\n\treturn ns.nodes\n}", "title": "" }, { "docid": "87f893763f09e0c615171d525adc0306", "score": "0.52189195", "text": "func GetNodes(c echo.Context) error {\n\tc.Logger().Printf(\"executing GetNodes handler\")\n\trouter := c.Get(\"coin_router\").(transport.Resolver)\n\n\tnoinfo := strings.ToLower(c.QueryParam(\"noinfo\")) == \"true\"\n\tcoins := router.GetNodes(!noinfo)\n\n\treturn c.JSON(http.StatusOK, GetNodesResponse{\n\t\tData: struct {\n\t\t\tNodes []transport.CoinNode `json:\"nodes\"`\n\t\t}{\n\t\t\tNodes: coins,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "83191afb07672f0a90433165bfb30d35", "score": "0.5218334", "text": "func (nodeInstance *Node) GetNodeStatus () {\n client := http.Client{\n Timeout: 10 * time.Second,\n }\n\n for i, node := range nodeInstance.NodeList {\n httpAddress := \"http://\" + node.IpAddr + \":\" + strconv.Itoa(node.Port) + \"/node-status\"\n resp, err := client.Get(httpAddress)\n if err != nil {\n continue\n }\n if resp.StatusCode == 200 {\n nodeInstance.NodeList[i].LastSeen = time.Now().Unix()\n }\n }\n}", "title": "" }, { "docid": "6cd6e781c0c369b28c2761ecaf93731e", "score": "0.52129006", "text": "func (s *Uint8Sync) GetList() []uint8 {\n\ts.RLock()\n\tdefer s.RUnlock()\n\tnums := []uint8{}\n\tfor i := range s.nodeMap {\n\t\tnums = append(nums, i)\n\t}\n\treturn nums\n}", "title": "" }, { "docid": "fbe7311e896eb4b85d5ff8bd18c501b3", "score": "0.5212754", "text": "func (o *SubscriptionMetrics) GetNodes() (value *ClusterMetricsNodes, ok bool) {\n\tok = o != nil && o.bitmap_&512 != 0\n\tif ok {\n\t\tvalue = o.nodes\n\t}\n\treturn\n}", "title": "" }, { "docid": "7f7294e64a1ff9913e69dec7cb7559b9", "score": "0.5210977", "text": "func (s *StrSync) GetList() []string {\n\ts.RLock()\n\tdefer s.RUnlock()\n\tstrList := []string{}\n\tfor i := range s.nodeMap {\n\t\tstrList = append(strList, i)\n\t}\n\treturn strList\n}", "title": "" }, { "docid": "36015c4adcd27743c1ff2ef381b0c337", "score": "0.51976025", "text": "func (n *NodeList) All() []*Node {\n\tif n.nodes == nil {\n\t\treturn []*Node{}\n\t}\n\treturn n.nodes\n}", "title": "" }, { "docid": "b1c4a3dee1c1a3cc47a976b184c054e1", "score": "0.51971525", "text": "func (k TestKubernetes) Nodes() []string {\n\tnodes := &corev1.NodeList{}\n\tlistOps := &client.ListOptions{}\n\terr := k.Kubernetes.Client.List(context.TODO(), nodes, listOps)\n\tExpectNoError(err)\n\n\tvar s []string\n\tif nodes.Size() == 0 {\n\t\treturn s\n\t}\n\tfor _, element := range nodes.Items {\n\t\ts = append(s, element.Name)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "5c14887b9b3fa5eaa649b577881de68d", "score": "0.51931685", "text": "func (c *Catalog) ListNodes(args *structs.DCSpecificRequest, reply *structs.IndexedNodes) error {\n\tif done, err := c.srv.forward(\"Catalog.ListNodes\", args, args, reply); done {\n\t\treturn err\n\t}\n\n\treturn c.srv.blockingQuery(\n\t\t&args.QueryOptions,\n\t\t&reply.QueryMeta,\n\t\tfunc(ws memdb.WatchSet, state *state.Store) error {\n\t\t\tvar index uint64\n\t\t\tvar nodes structs.Nodes\n\t\t\tvar err error\n\t\t\tif len(args.NodeMetaFilters) > 0 {\n\t\t\t\tindex, nodes, err = state.NodesByMeta(ws, args.NodeMetaFilters)\n\t\t\t} else {\n\t\t\t\tindex, nodes, err = state.Nodes(ws)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treply.Index, reply.Nodes = index, nodes\n\t\t\tif err := c.srv.filterACL(args.Token, reply); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn c.srv.sortNodesByDistanceFrom(args.Source, reply.Nodes)\n\t\t})\n}", "title": "" }, { "docid": "283040fc47cd7acd1781317c0e8be38f", "score": "0.5185206", "text": "func GetAllNodes(client clientset.Interface) (*corev1.NodeList, error) {\n\treturn client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})\n}", "title": "" }, { "docid": "758841af8b8cff9f4fe9be56860be92c", "score": "0.51839495", "text": "func (gce *GCE) listnode(request interface{}) (resp interface{}, err error) {\n\n\toptions := request.(map[string]string)\n\n\turl := \"https://www.googleapis.com/compute/v1/projects/\" + options[\"projectid\"] + \"/zones/\" + options[\"Zone\"] + \"/instances/\"\n\n\tclient := googleauth.SignJWT()\n\n\tlistnoderequest, err := http.NewRequest(\"POST\", url, nil)\n\tlistnoderequest.Header.Set(\"Content-Type\", \"application/json\")\n\n\tlistnoderesp, err := client.Do(listnoderequest)\n\n\tdefer listnoderesp.Body.Close()\n\tbody, err := ioutil.ReadAll(listnoderesp.Body)\n\n\tlistnoderesponse := make(map[string]interface{})\n\tlistnoderesponse[\"status\"] = listnoderesp.StatusCode\n\tlistnoderesponse[\"body\"] = string(body)\n\tresp = listnoderesponse\n\treturn resp, err\n}", "title": "" }, { "docid": "90fc5e18cd242b30a58c8fa4f933002d", "score": "0.5182347", "text": "func nodesOverview(cfg api.Config, context string) (string, error) {\n\tcs, err := csForContext(cfg, context)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"Can't create a clientset based on config provided\")\n\t}\n\tnodes, err := cs.CoreV1().Nodes().List(metav1.ListOptions{})\n\tnodeCount := len(nodes.Items)\n\treadyCount := 0\n\tfor _, node := range nodes.Items {\n\t\tfor _, nodeCondition := range node.Status.Conditions {\n\t\t\tif nodeCondition.Type == \"Ready\" {\n\t\t\t\tif nodeCondition.Status == \"True\" {\n\t\t\t\t\treadyCount++\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"Can't get nodes in cluster\")\n\t}\n\tnoverview := fmt.Sprintf(\"%v/%v\", readyCount, nodeCount)\n\treturn noverview, nil\n}", "title": "" }, { "docid": "ea77b33ac0d85ae7088c5825599adf90", "score": "0.5181953", "text": "func (c *FakeK8SOrchestrator) GetCSINodeTopologyInstancesList() []interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "74795e3237439c1ca43089081424e6d2", "score": "0.5179232", "text": "func (_Staking *StakingCaller) GetNodeAddrs(opts *bind.CallOpts) ([]common.Address, error) {\n\tvar out []interface{}\n\terr := _Staking.contract.Call(opts, &out, \"getNodeAddrs\")\n\n\tif err != nil {\n\t\treturn *new([]common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "a5b3c82f7d3851fffe628128571f67cd", "score": "0.51756227", "text": "func ListNodes(ctx context.Context, db *gorm.DB) ([]Node, error) {\n\tvar nodes []Node\n\terr := gorm.WithContext(ctx, db).Table(NodeTableName).\n\t\tWhere(\"deleteTime=?\", 0).\n\t\tFind(&nodes).Error\n\treturn nodes, err\n}", "title": "" }, { "docid": "2fd611be3f542e57aa64a9c0ea24fe3c", "score": "0.51708823", "text": "func GetNodes(ctx context.Context, clientset kubernetes.Interface, names ...string) ([]corev1.Node, error) {\n\tif len(names) > 0 {\n\t\tvar nodes []corev1.Node\n\t\tfor _, name := range names {\n\t\t\tnode, err := clientset.CoreV1().Nodes().Get(ctx, name, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnodes = append(nodes, *node)\n\t\t}\n\t\treturn nodes, nil\n\t}\n\n\tnodeList, err := clientset.CoreV1().Nodes().List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nodeList.Items, nil\n}", "title": "" }, { "docid": "9d347e6cf4c7a6e85d6f8d5da6a82c36", "score": "0.5169819", "text": "func GetNodeInfo(w http.ResponseWriter, r *http.Request) {\n\tif (*r).Method == \"OPTIONS\" {\n\t\treturn\n\t}\n\tneighbourMap := db.GetDataBase()\n\tresp := model.Response{}\n\t// set Default value\n\tresp.Default()\n\n\tNodeNameMap, GraphData, err := neighbourMap.GenarateNetworkTopology()\n\n\tif err != nil {\n\t\tlog.Println(\"ERROR: Payload Error\", err)\n\t\tresp.InternalServerError()\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t} else {\n\t\tdata := make(map[string]interface{})\n\t\tdata[\"graphData\"] = GraphData\n\t\tdata[\"nodeNames\"] = NodeNameMap\n\n\t\tresp.Code = http.StatusOK\n\t\tresp.Message = \"Updated time: \"\n\t\tresp.Data = data\n\t\tw.WriteHeader(http.StatusOK)\n\n\t}\n\tjson.NewEncoder(w).Encode(resp)\n\n}", "title": "" }, { "docid": "4f568ad22d85d01258ae50381dcac93a", "score": "0.5165722", "text": "func (w *ListWidget) GetNodes() []*expanders.TreeNode {\n\tif w.currentPage == nil {\n\t\treturn []*expanders.TreeNode{}\n\t}\n\treturn w.currentPage.Items\n}", "title": "" }, { "docid": "a4a6ab67964f3d8e0ff7a7c09a5ef898", "score": "0.516462", "text": "func (c *Calcium) filterNodes(ctx context.Context, nf types.NodeFilter) (ns []*types.Node, err error) {\n\tdefer func() {\n\t\tif len(ns) == 0 {\n\t\t\treturn\n\t\t}\n\t\tsort.Slice(ns, func(i, j int) bool { return ns[i].Name <= ns[j].Name })\n\t\t// unique\n\t\tns = ns[:utils.Unique(ns, func(i int) string { return ns[i].Name })]\n\t}()\n\n\tif len(nf.Includes) != 0 {\n\t\tfor _, nodename := range nf.Includes {\n\t\t\tnode, err := c.GetNode(ctx, nodename)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tns = append(ns, node)\n\t\t}\n\t\treturn ns, nil\n\t}\n\n\tch, err := c.ListPodNodes(ctx, &types.ListNodesOptions{\n\t\tPodname: nf.Podname,\n\t\tLabels: nf.Labels,\n\t\tAll: nf.All,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlistedNodes := []*types.Node{}\n\tfor n := range ch {\n\t\tlistedNodes = append(listedNodes, n)\n\t}\n\tif len(nf.Excludes) == 0 {\n\t\treturn listedNodes, nil\n\t}\n\n\texcludes := map[string]struct{}{}\n\tfor _, n := range nf.Excludes {\n\t\texcludes[n] = struct{}{}\n\t}\n\n\tfor _, n := range listedNodes {\n\t\tif _, ok := excludes[n.Name]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tns = append(ns, n)\n\t}\n\treturn ns, nil\n}", "title": "" }, { "docid": "95d21f3e248c2f8e02f672094df70ca2", "score": "0.51635265", "text": "func (s *NodePlanner) GetAllowedNodes() ([]*unstructured.Unstructured, error) {\n\tvar allowed []*unstructured.Unstructured\n\tallnodes := s.GetAllNodes()\n\tif len(s.NodeSelector.SelectorTerms) == 0 {\n\t\t// all nodes are allowed since there is no preference\n\t\t// i.e. no selector terms were specified\n\t\ts.allowedNodes = allnodes\n\t\treturn s.allowedNodes, nil\n\t}\n\tfor _, node := range allnodes {\n\t\teval := selector.Evaluation{\n\t\t\tTarget: node,\n\t\t\tTerms: s.NodeSelector.SelectorTerms,\n\t\t}\n\t\tmatch, err := eval.RunMatch()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif match {\n\t\t\tallowed = append(allowed, node)\n\t\t}\n\t}\n\ts.allowedNodes = allowed\n\treturn s.allowedNodes, nil\n}", "title": "" }, { "docid": "9da43b0362e1f09735b9d8d61ac53d64", "score": "0.5159866", "text": "func (client *Client) ListFreeNodes(request *ListFreeNodesRequest) (response *ListFreeNodesResponse, err error) {\n\tresponse = CreateListFreeNodesResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "128e919d208cc7663974e96473fb2d05", "score": "0.5154919", "text": "func DatabaseGetAllNodes()([]node, error){\n\tvar err error\n\tvar nodes []node\n\t\n\t// Open a connection with the database\n\tdb_nodes, err = sql.Open(\"sqlite3\", filePath)\n\tif err != nil {\n\t\treturn nodes, err\n\t}\n\t// close the database\n\tdefer db_nodes.Close()\n\t\n\t// Get information about all node into the list\n\trows, err := db_nodes.Query(\"SELECT * FROM nodes;\")\n\tif err != nil {\n\t\treturn nodes, err\n\t}\n\t\n\t// Add all measurements to the slide measurements\n\tfor rows.Next(){\n\t\tvar ip string\n\t\tvar n node\n\t\terr = rows.Scan(&n.ID, &ip, &n.Config.Name, &n.Config.Description, &n.Config.Interval);\n\t\tif err != nil{\n\t\t\treturn nodes, err\n\t\t}\n\t\tnodes = append(nodes, n)\n\t}\n\t\n\treturn nodes, err\n}", "title": "" }, { "docid": "1b1a979813df4bcc60ee3a8d7c1cc431", "score": "0.5151343", "text": "func getNonControlPlaneNodes(cli clientset.Interface) ([]corev1.Node, error) {\n\tnodeList, err := cli.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(nodeList.Items) == 0 {\n\t\treturn nil, fmt.Errorf(\"no nodes found in the cluster\")\n\t}\n\n\tcontrolPlaneTaint := corev1.Taint{\n\t\tEffect: corev1.TaintEffectNoSchedule,\n\t\tKey: \"node-role.kubernetes.io/control-plane\",\n\t}\n\tout := []corev1.Node{}\n\tfor _, node := range nodeList.Items {\n\t\tif !taintutils.TaintExists(node.Spec.Taints, &controlPlaneTaint) {\n\t\t\tout = append(out, node)\n\t\t}\n\t}\n\n\tif len(out) == 0 {\n\t\treturn nil, fmt.Errorf(\"no non-control-plane nodes found in the cluster\")\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "d30e7f57368d6f2102bb96ffa788e140", "score": "0.5149691", "text": "func (cntrlTopology *mockControllerVolumeTopology) GetTopologyInfoFromNodes(ctx context.Context,\n\treqParams interface{}) ([]map[string]string, error) {\n\tlog := logger.GetLogger(ctx)\n\treturn nil, logger.LogNewError(log, \"GetTopologyInfoFromNodes is not yet implemented.\")\n}", "title": "" } ]
11e2a4e3f0994eda3fa6a75e1e7d42e5
Unexported Connection methods Log data if possible.
[ { "docid": "0f7ff4d2232eb19a93e84b6e9aa9a3b2", "score": "0.5659166", "text": "func (c *Connection) log(v ...interface{}) {\n\tif c.logger == nil {\n\t\treturn\n\t}\n\tc.logger.Print(c.session, v)\n\treturn\n}", "title": "" } ]
[ { "docid": "ef77cd8efcb8c78d6e0f498a169c1a7c", "score": "0.535495", "text": "func _logBadConnection(tls *crt.TLS, _zType *int8) {\n\tXsqlite3_log(tls, int32(21), str(8521), unsafe.Pointer(_zType))\n}", "title": "" }, { "docid": "7b8fbca45980c05107654b913ed5d7cf", "score": "0.5311679", "text": "func (n nonlLogger) Log(_ ...interface{}) {}", "title": "" }, { "docid": "78fdcdc34835dcbc29cdaba063aa1b0a", "score": "0.5303217", "text": "func logConn(conn net.Conn) string {\n\treturn memberlist.LogConn(conn)\n}", "title": "" }, { "docid": "77528b6eab62b40d1a07132336cc333b", "score": "0.5247708", "text": "func (me *DummyMetricsEngine) RecordConnectionClose(success bool) {\n\treturn\n}", "title": "" }, { "docid": "eb64153025bdfb8dc405ad33ba87182d", "score": "0.524203", "text": "func PrintConnection(connection *enigma.Connection) {\n\tlog.PrintAsJSON(connection)\n}", "title": "" }, { "docid": "bbd6a1d5a8ab0e80792cdd9853dbb2be", "score": "0.5176153", "text": "func logFilter(ctx context.Context, c net.Conn, chain connFilters) context.Context {\n\tlog.Log(ctx, AcceptedConnection{Remote: c.RemoteAddr()})\n\tctx = chain.next(ctx, c)\n\tlog.Log(ctx, ClosedConnection{Remote: c.RemoteAddr()})\n\treturn ctx\n}", "title": "" }, { "docid": "b90d83a6e59b258f7ac0c6e209178487", "score": "0.5065437", "text": "func (n *noop) Debug(msg ...interface{}) {}", "title": "" }, { "docid": "e41ae554270eb154602ce5f2a726901b", "score": "0.50488776", "text": "func (me *NilMetricsEngine) RecordConnectionClose(success bool) {\n}", "title": "" }, { "docid": "8328a6c1ca50e561a0619e3b5906512a", "score": "0.5044719", "text": "func init() {\n\tDisableLog()\n}", "title": "" }, { "docid": "89bd378005aaa8fd10f4afd73395708b", "score": "0.50122327", "text": "func (me *DummyMetricsEngine) RecordConnectionAccept(success bool) {\n\treturn\n}", "title": "" }, { "docid": "a717d6292a9602d67dd0c38b23f34984", "score": "0.4994621", "text": "func (n *NoopMetrics) DropConnection() {}", "title": "" }, { "docid": "5727bf194f647843214170304ad8fbfb", "score": "0.49908915", "text": "func (p *DataPasser) log() {\n\tfor item := range p.logs {\n\t\tfmt.Println(\"2. Item\", item)\n\t}\n}", "title": "" }, { "docid": "e9ec70df96bfb59ea25a1bdd2b5892ea", "score": "0.498366", "text": "func (p *Proxy) stats() {\n\tlog.Printf(\"Proxy connection closed (%s -> %s) sent: %s received: %s\\n\",\n\t\tp.lconn.RemoteAddr(), p.raddr, prettyBytes(p.sentBytes),\n\t\tprettyBytes(p.receivedBytes))\n\n}", "title": "" }, { "docid": "55e53f09293050aee14c669ffac50136", "score": "0.49334407", "text": "func CloseConnection() {\n\tlog.Println(\"Connection Closed\")\n}", "title": "" }, { "docid": "67afaf9825497a1d5bb941c899980c81", "score": "0.49330497", "text": "func logClientJoined(conn *net.TCPConn) {\n\tfmt.Println(\"server.go: Client joined from %s\", conn.RemoteAddr())\n}", "title": "" }, { "docid": "2eb7ad864858dae4fd4117d2ae6da4fe", "score": "0.49309844", "text": "func (mgr *ArangoDBMgr) LogAllKeys() {\n\tglog.Infof(\"Printing all keys\")\n}", "title": "" }, { "docid": "4008101fdf2f358311eb6463854b65e0", "score": "0.48998043", "text": "func (ds *DrvStmt) log(enabled bool, v ...interface{}) {\n\tcfg := _drv.Cfg()\n\tif !cfg.Log.IsEnabled(enabled) {\n\t\treturn\n\t}\n\tif len(v) == 0 {\n\t\tcfg.Log.Logger.Infof(\"%v %v\", ds.sysName(), callInfo(1))\n\t} else {\n\t\tcfg.Log.Logger.Infof(\"%v %v %v\", ds.sysName(), callInfo(1), fmt.Sprint(v...))\n\t}\n}", "title": "" }, { "docid": "89f2207839fe7b424ac7135aa68307de", "score": "0.48414886", "text": "func copyConnectionData(writer, reader net.Conn) {\n\t_, err := io.Copy(writer, reader)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n}", "title": "" }, { "docid": "22aa141b0272d37713e02bf87520264a", "score": "0.4827424", "text": "func (ch *LogCh) AllClose(){\n ch.InfoClose()\n ch.DebugClose()\n ch.WarningClose()\n ch.ErrorClose()\n return\n}", "title": "" }, { "docid": "9b0fbfced4c66552e4ea412128782474", "score": "0.4815078", "text": "func (con *Con) log(enabled bool, v ...interface{}) {\n\tif enabled {\n\t\tif len(v) == 0 {\n\t\t\t_drv.Cfg().Log.Logger.Infof(\"%v %v\", con.sysName(), callInfo(1))\n\t\t} else {\n\t\t\t_drv.Cfg().Log.Logger.Infof(\"%v %v %v\", con.sysName(), callInfo(1), fmt.Sprint(v...))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "15807fde4fbfb08930157e7508e3f4c4", "score": "0.48126462", "text": "func (n *noop) Info(msg ...interface{}) {}", "title": "" }, { "docid": "a9c8a326543dacbcff28994bfe692a11", "score": "0.48086712", "text": "func LogConn(c *Conn, state ConnState) {\n\tswitch state {\n\tcase Connected:\n\t\tlogf(c.srv.LogFunc, \"%v: connected from %v with subprotocol %q\", c.UUID, c.RemoteAddr(), c.Subprotocol())\n\tcase Closing:\n\t\tlogf(c.srv.LogFunc, \"%v: closing from %v with error %v\", c.UUID, c.RemoteAddr(), c.CloseErr)\n\t}\n}", "title": "" }, { "docid": "5721b86769dfe9901f0b0dc0825094ed", "score": "0.4799631", "text": "func (session *dummySession) LogMethodEnter() {\n\tassert.Fail(session.t, \"Unexpected call to LogMethodEnter\")\n}", "title": "" }, { "docid": "5721b86769dfe9901f0b0dc0825094ed", "score": "0.4799631", "text": "func (session *dummySession) LogMethodEnter() {\n\tassert.Fail(session.t, \"Unexpected call to LogMethodEnter\")\n}", "title": "" }, { "docid": "1ee9dd51bfe46f7bc975b9f92b40716a", "score": "0.47808796", "text": "func (me *NilMetricsEngine) RecordConnectionAccept(success bool) {\n}", "title": "" }, { "docid": "0c3786798008911b867d96a72bc51a89", "score": "0.47686952", "text": "func (cl ConnLogger) Disconnected(n net.Network, c net.Conn) {\n\tWithCaller(connLogger(c, netLogger(n, cl.l))).Debug(\"disconnected\")\n}", "title": "" }, { "docid": "e10eace87bdba624363733b38c07c1c8", "score": "0.47548133", "text": "func omitDropLogging(p *packet.ParsedPacket, dir direction) bool {\n\tb := p.Buffer()\n\tswitch dir {\n\tcase out:\n\t\tswitch p.IPVersion {\n\t\tcase 4:\n\t\t\t// ParsedPacket.Decode zeros out ParsedPacket.IPProtocol for protocols\n\t\t\t// it doesn't know about, so parse it out ourselves if needed.\n\t\t\tipProto := p.IPProto\n\t\t\tif ipProto == 0 && len(b) > 8 {\n\t\t\t\tipProto = packet.IPProto(b[9])\n\t\t\t}\n\t\t\t// Omit logging about outgoing IGMP.\n\t\t\tif ipProto == packet.IGMP {\n\t\t\t\treturn true\n\t\t\t}\n\t\tcase 6:\n\t\t\tif len(b) < 40 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tsrc, dst := b[8:8+16], b[24:24+16]\n\t\t\t// Omit logging for outgoing IPv6 ICMP-v6 queries to ff02::2,\n\t\t\t// as sent by the OS, looking for routers.\n\t\t\tif p.IPProto == packet.ICMPv6 {\n\t\t\t\tif isLinkLocalV6(src) && string(dst) == ipv6AllRoutersLinkLocal {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif string(dst) == ipv6AllMLDv2CapableRouters {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\t// Actually, just catch all multicast.\n\t\t\tif dst[0] == 0xff {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f9482a2a45d89b71743e49137510fce7", "score": "0.4753902", "text": "func printDisconnected() {\n\tfmt.Println(\"Disconnected\")\n}", "title": "" }, { "docid": "f9482a2a45d89b71743e49137510fce7", "score": "0.4753902", "text": "func printDisconnected() {\n\tfmt.Println(\"Disconnected\")\n}", "title": "" }, { "docid": "f9482a2a45d89b71743e49137510fce7", "score": "0.4753902", "text": "func printDisconnected() {\n\tfmt.Println(\"Disconnected\")\n}", "title": "" }, { "docid": "17f163a827617c534773b8ce931c976e", "score": "0.47491565", "text": "func (p *Pebble) LogData(data []byte) error {\n\treturn p.db.LogData(data, pebble.Sync)\n}", "title": "" }, { "docid": "d8c116e0dbfae26e4163e51eed05f9f5", "score": "0.4731566", "text": "func (a *adapter) Info(msg string, data ...interface{}) {\n\tfields := data2fields(data)\n\ta.Logger.Info(msg, *fields...)\n}", "title": "" }, { "docid": "618b35cdfbe01dd1207f067e6a2d75dc", "score": "0.4719853", "text": "func (m *metricZookeeperConnectionActive) emit(metrics pmetric.MetricSlice) {\n\tif m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {\n\t\tm.updateCapacity()\n\t\tm.data.MoveTo(metrics.AppendEmpty())\n\t\tm.init()\n\t}\n}", "title": "" }, { "docid": "844e458b9a142660164eaae7e6fc1d3a", "score": "0.47189504", "text": "func (m *metricMongodbatlasProcessConnections) emit(metrics pmetric.MetricSlice) {\n\tif m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {\n\t\tm.updateCapacity()\n\t\tm.data.MoveTo(metrics.AppendEmpty())\n\t\tm.init()\n\t}\n}", "title": "" }, { "docid": "0ec302a233b7f27a1d17c05b42aca376", "score": "0.47175938", "text": "func (a *DBAdapter) Print() {\n\n}", "title": "" }, { "docid": "9b07d4cc2be87013bb8f3926908a79f5", "score": "0.47119755", "text": "func ModLog(data ...interface{}) {\n\tmodlogger.Println(data...)\n}", "title": "" }, { "docid": "becc9dd590d85a4044944efe9c54abec", "score": "0.47014517", "text": "func PrintConn(a_conn Conn) {\n fmt.Printf(\"%s:%d -> %s:%d\\n\", a_conn.src, a_conn.src_port, a_conn.dst,\n a_conn.dst_port)\n}", "title": "" }, { "docid": "779226a2e1f084c8520a1127ca7de325", "score": "0.46958536", "text": "func init() {\n \tlog.SetReportCaller(true)\n }", "title": "" }, { "docid": "9fa39844aaf8af6fa521a89a48a85911", "score": "0.46917453", "text": "func X__ccgo_sqlite3_log(t *TLS, iErrCode int32, zFormat uintptr, args uintptr) {\n\t// if dmesgs {\n\t// \tdmesg(\"%v: iErrCode: %v, msg: %s\\n%s\", origin(1), iErrCode, printf(zFormat, args), debug.Stack())\n\t// }\n}", "title": "" }, { "docid": "bf4cdfb97956467f2bf083452e3f8faf", "score": "0.4689802", "text": "func (c *Conn) logActiveDerpLocked() {\n\tnow := time.Now()\n\tc.logf(\"magicsock: %v active derp conns%s\", len(c.activeDerp), logger.ArgWriter(func(buf *bufio.Writer) {\n\t\tif len(c.activeDerp) == 0 {\n\t\t\treturn\n\t\t}\n\t\tbuf.WriteString(\":\")\n\t\tc.foreachActiveDerpSortedLocked(func(node int, ad activeDerp) {\n\t\t\tfmt.Fprintf(buf, \" derp-%d=cr%v,wr%v\", node, simpleDur(now.Sub(ad.createTime)), simpleDur(now.Sub(*ad.lastWrite)))\n\t\t})\n\t}))\n}", "title": "" }, { "docid": "0c03347f2857c3a682d116d231ddb8eb", "score": "0.4684487", "text": "func drainLogs() {\n for {\n select {\n case msg := <- crash:\n sendCrash(msg)\n case msg := <- debug:\n sendDebug(msg)\n case msg := <- error:\n sendError(msg)\n case msg := <- info:\n sendInfo(msg)\n default:\n return\n }\n }\n}", "title": "" }, { "docid": "bd10a9bef3e07dd3ae68033272f6c1f3", "score": "0.46820495", "text": "func (m *Connection) logQuery(query string, bindings []interface{}, elapsed time.Duration) {\n\tif m.loggingQueries {\n\t\tm.queryLog = append(m.queryLog, map[string]interface{}{\n\t\t\t\"query\": query,\n\t\t\t\"bindings\": bindings,\n\t\t\t\"time\": elapsed.String(),\n\t\t})\n\t}\n}", "title": "" }, { "docid": "610eb469d7e43f42b3f385019fb40de3", "score": "0.46806756", "text": "func sulog(format string, a ...interface{}) {\n\tif Phonebook.Debug {\n\t\tulog(format, a...)\n\t}\n}", "title": "" }, { "docid": "8278e029afc4101364b99329fbbbb753", "score": "0.4662633", "text": "func (c *Conn) cleanIgnore() {\n\tnow := time.Now().UnixNano()\n\tif c.subStateSubscriber.cleanIgnore < now {\n\t\tc.subStateSubscriber.cleanIgnore = now + cleanIgnoreInterval\n\n\t\tfor p, t := range c.subStateSubscriber.ignore {\n\t\t\tif t < now {\n\t\t\t\tdelete(c.subStateSubscriber.ignore, p)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5b7992db8540f7e276c88a4d7967f91b", "score": "0.46601722", "text": "func (pgs *PrefetchGlobalState) log(a string, args ...interface{}) {\n\tLogMsg(\"prefetch\", a, args...)\n}", "title": "" }, { "docid": "56765aa40b92c15f490ca1c1e8ae0ee0", "score": "0.46544668", "text": "func InternalConnectionHandler(user *models.User) {\n\tfor {\n\t\tbuffer := make([]byte, 1400)\n\t\tpacketSize, err := (*user.Conn).Read(buffer)\n\t\tif err != nil {\n\t\t\thelpers.LogError(err)\n\t\t\tbreak\n\t\t}\n\t\t_ = packetSize\n\t\tcmd := models.NewInternalCommand()\n\t\tcmd.Decode(buffer)\n\t\taction := newAction(cmd, user)\n\t\taction.rerouteCommands()\n\t}\n}", "title": "" }, { "docid": "355538822c6369617c23ef75c99bd256", "score": "0.46534446", "text": "func BackupLog(data ...interface{}) {\n\tbackuplogger.Println(data...)\n}", "title": "" }, { "docid": "ba169807b1b710450eddd1dcb0e7d47a", "score": "0.4629748", "text": "func qmpLogger(id int, q qmp.Conn) {\n\tfor v := q.Message(); v != nil; v = q.Message() {\n\t\tlog.Info(\"VM %v received asynchronous message: %v\", id, v)\n\t}\n}", "title": "" }, { "docid": "ba169807b1b710450eddd1dcb0e7d47a", "score": "0.4629748", "text": "func qmpLogger(id int, q qmp.Conn) {\n\tfor v := q.Message(); v != nil; v = q.Message() {\n\t\tlog.Info(\"VM %v received asynchronous message: %v\", id, v)\n\t}\n}", "title": "" }, { "docid": "d64a8068cd591afe77d5f17ff5e2bf38", "score": "0.4628112", "text": "func (table *CacheTable) log(v ...interface{}) {\n\tif table.logger == nil {\n\t\treturn\n\t}\n\n\ttable.logger.Println(v...)\n}", "title": "" }, { "docid": "35da85ff6b4623a53f1ab351e44a884a", "score": "0.46279576", "text": "func (_m *Store) DebugAllPovInfos() {\n\t_m.Called()\n}", "title": "" }, { "docid": "c120ee53792a948c3bcd380cf52e2aaf", "score": "0.46153188", "text": "func main() {\n\t// Create connection\n\tconn, err := net.Dial(\"tcp\", \"localhost:1025\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer conn.Close()\n\n\tlogger := log.New(conn, \"No: \", log.LstdFlags|log.Lshortfile)\n\tlogger.Println(\"No alarm\")\n\t// Not call log.Fatal because it exit immediatly\n\t// Utilize Log.Panic, it call defer func and correctly close connections\n\tlogger.Panicln(\"Exception programm\")\n}", "title": "" }, { "docid": "f27615a070e5bfa5d267dd31a2982d8b", "score": "0.46066657", "text": "func (c *loggedRoundTripper) logRequest(req *http.Request) {\n}", "title": "" }, { "docid": "77ef1d6114b3ffb63e4e613203beb422", "score": "0.4600613", "text": "func (NopLogger) Debug(msg string, keyvals ...interface{}) {}", "title": "" }, { "docid": "e948b44869a86f0107c9b1603486069c", "score": "0.45956224", "text": "func (m *Manager) LogConnectionEventStd(e *Event) {\n\tlog.Printf(\"[Shard Manager] %s\", e.String())\n}", "title": "" }, { "docid": "75509783cdd59aa8b7d9d88f7aa73bba", "score": "0.45942113", "text": "func (r *Receiver) Logging() bool { return r.logging }", "title": "" }, { "docid": "f32a81f97087df47cd11386377fe5506", "score": "0.45908022", "text": "func (t *OpenTSDBTransport) closeConnection() {\n\n\terr := t.connection.Close()\n\tif err != nil {\n\t\tif logh.ErrorEnabled {\n\t\t\tt.core.loggers.Error().Msg(err.Error())\n\t\t}\n\t}\n\n\tif logh.InfoEnabled {\n\t\tt.core.loggers.Info().Msg(\"connection closed\")\n\t}\n\n\tt.connection = nil\n}", "title": "" }, { "docid": "8ffc5d172a0230fba052fdceb271242b", "score": "0.45826685", "text": "func TestLoggerBasic(t *testing.T) {\n\tfor _, sp = range Protocols() {\n\t\tn, _ = openConn(t)\n\t\tch := login_headers\n\t\tch = headersProtocol(ch, sp)\n\t\tlog.Printf(\"Connect Headers: %v\\n\", ch)\n\t\tconn, e = Connect(n, ch)\n\t\tif e != nil {\n\t\t\tt.Errorf(\"TestLoggerBasic CONNECT expected nil, got %v\\n\", e)\n\t\t\tif conn != nil {\n\t\t\t\tt.Errorf(\"TestLoggerBasic CONNECT ERROR, got %v\\n\",\n\t\t\t\t\tconn.ConnectResponse)\n\t\t\t}\n\t\t}\n\t\t//\n\t\tl := log.New(os.Stdout, \"TLB \", log.Ldate|log.Lmicroseconds)\n\t\t// Show broker's CONNECT response (CONNECTED frame).\n\t\tl.Printf(\"TestLoggerBasic ConnectResponse:\\n%v\\n\", conn.ConnectResponse)\n\n\t\t// We force a logger for this test.\n\t\tconn.SetLogger(l)\n\n\t\t//\n\n\t\tcheckReceived(t, conn, false)\n\t\te = conn.Disconnect(empty_headers)\n\t\tcheckDisconnectError(t, e)\n\t\ttime.Sleep(testlgslt * time.Millisecond)\n\t\t_ = closeConn(t, n)\n\t}\n\n}", "title": "" }, { "docid": "fb6a031c0005306bf366c7e7d225f564", "score": "0.45807046", "text": "func (f *CustomDownlinkFunctions) Log() []*pb_handler.LogEntry {\n\treturn f.Logger.Entries()\n}", "title": "" }, { "docid": "84eec631f43aa51ebf7eae2f6ee8aae8", "score": "0.45797125", "text": "func readResultsFromConnectionLog(connectionLog *mysql.ConnectionLog) *ScanResults {\n\tret := ScanResults{}\n\tif connectionLog == nil {\n\t\treturn nil\n\t}\n\t// If we received neither a Handshake nor an Error message, then no\n\t// MySQL service is detected.\n\tif connectionLog.Handshake == nil && connectionLog.Error == nil {\n\t\treturn nil\n\t}\n\tif connectionLog.Handshake != nil {\n\t\tret.RawPackets = append(ret.RawPackets, connectionLog.Handshake.Raw)\n\t\tswitch handshake := connectionLog.Handshake.Parsed.(type) {\n\t\tcase *mysql.HandshakePacket:\n\t\t\tret.ProtocolVersion = handshake.ProtocolVersion\n\t\t\tret.ServerVersion = handshake.ServerVersion\n\t\t\tret.ConnectionID = handshake.ConnectionID\n\t\t\tlen1 := len(handshake.AuthPluginData1)\n\t\t\tret.AuthPluginData = make([]byte, len1+len(handshake.AuthPluginData2))\n\t\t\tcopy(ret.AuthPluginData[0:len1], handshake.AuthPluginData1)\n\t\t\tcopy(ret.AuthPluginData[len1:], handshake.AuthPluginData2)\n\t\t\tret.CharacterSet = handshake.CharacterSet\n\t\t\tret.StatusFlags = mysql.GetServerStatusFlags(handshake.StatusFlags)\n\t\t\tret.CapabilityFlags = mysql.GetClientCapabilityFlags(handshake.CapabilityFlags)\n\t\t\tret.AuthPluginName = handshake.AuthPluginName\n\t\tdefault:\n\t\t\tlog.Fatalf(\"Unreachable code -- ConnectionLog.Handshake was set to a non-handshake packet: %v / %v\", connectionLog.Handshake.Parsed, reflect.TypeOf(connectionLog.Handshake.Parsed))\n\t\t}\n\t}\n\tif connectionLog.Error != nil {\n\t\tret.RawPackets = append(ret.RawPackets, connectionLog.Error.Raw)\n\t\tswitch err := connectionLog.Error.Parsed.(type) {\n\t\tcase *mysql.ERRPacket:\n\t\t\tret.setError(err)\n\t\tdefault:\n\t\t\ttemp := -1\n\t\t\tret.ErrorCode = &temp\n\t\t\tret.ErrorMessage = \"Unexpected packet type\"\n\t\t}\n\t}\n\tif connectionLog.SSLRequest != nil {\n\t\tret.RawPackets = append(ret.RawPackets, connectionLog.SSLRequest.Raw)\n\t}\n\treturn &ret\n}", "title": "" }, { "docid": "eeeab1998f934e55d2bbb747fe3586f7", "score": "0.45722753", "text": "func (m *SlowQueryInternal) LoggingChannel() logpb.Channel { return logpb.Channel_SQL_INTERNAL_PERF }", "title": "" }, { "docid": "6110b7b01c93209bc4bf141779723575", "score": "0.4569712", "text": "func (session *dummySession) LogMethodExit() {\n\tassert.Fail(session.t, \"Unexpected call to LogMethodExit\")\n}", "title": "" }, { "docid": "6110b7b01c93209bc4bf141779723575", "score": "0.4569712", "text": "func (session *dummySession) LogMethodExit() {\n\tassert.Fail(session.t, \"Unexpected call to LogMethodExit\")\n}", "title": "" }, { "docid": "dd8819e74745dd0a81ac5108fffc0d05", "score": "0.45695147", "text": "func (vrsConnection VRSConnection) Stolen([]interface{}) {\n}", "title": "" }, { "docid": "fa1b62f0744db9d9921c090d16dff157", "score": "0.45675346", "text": "func (k *KVStore) setupLogging() {\n\t// cname := C.CString(k.name)\n\t// defer C.free(unsafe.Pointer(cname))\n\t// C.init_fdb_logging(k.db, cname)\n}", "title": "" }, { "docid": "f177fbec35fbc726e19ce847eb5491fd", "score": "0.45607036", "text": "func (f *CustomUplinkFunctions) Log() []*pb_handler.LogEntry {\n\treturn f.Logger.Entries()\n}", "title": "" }, { "docid": "3438f8cbbcdb466dc4ac5bf8b3aa751e", "score": "0.455957", "text": "func (m *metricSqlserverTransactionLogUsage) emit(metrics pmetric.MetricSlice) {\n\tif m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {\n\t\tm.updateCapacity()\n\t\tm.data.MoveTo(metrics.AppendEmpty())\n\t\tm.init()\n\t}\n}", "title": "" }, { "docid": "0cd6e565aa1f43bd51ff9401f89a89b7", "score": "0.45582792", "text": "func emitAccessRelatedWarnings(config *DbConfig, context *db.DatabaseContext) {\n\tfor _, warning := range collectAccessRelatedWarnings(config, context) {\n\t\tbase.Warn(\"%v\", warning)\n\t}\n\n}", "title": "" }, { "docid": "e430a55c7a92b26dc532bb590c3b6401", "score": "0.4558254", "text": "func LogMessages(logger jsonrpc2.Logger) jsonrpc2.ConnOpt {\n\treturn func(c *jsonrpc2.Conn) {\n\t\t// Remember reqs we have received so we can helpfully show the\n\t\t// request method in OnSend for responses.\n\t\tvar (\n\t\t\tmu sync.Mutex\n\t\t\treqMethods = map[jsonrpc2.ID]string{}\n\t\t)\n\n\t\tjsonrpc2.OnRecv(func(req *jsonrpc2.Request, resp *jsonrpc2.Response) {\n\t\t\tswitch {\n\t\t\tcase resp != nil:\n\t\t\t\tvar method string\n\t\t\t\tif req != nil {\n\t\t\t\t\tmethod = req.Method\n\t\t\t\t} else {\n\t\t\t\t\tmethod = \"(no matching request)\"\n\t\t\t\t}\n\t\t\t\tswitch {\n\t\t\t\tcase resp.Result != nil:\n\t\t\t\t\tresult, _ := json.Marshal(resp.Result)\n\t\t\t\t\tlogger.Printf(\"jsonrpc2: --> result #%s: %s: %s\\n\", resp.ID, method, result)\n\t\t\t\tcase resp.Error != nil:\n\t\t\t\t\terr, _ := json.Marshal(resp.Error)\n\t\t\t\t\tlogger.Printf(\"jsonrpc2: --> error #%s: %s: %s\\n\", resp.ID, method, err)\n\t\t\t\t}\n\n\t\t\tcase req != nil:\n\t\t\t\tmu.Lock()\n\t\t\t\treqMethods[req.ID] = req.Method\n\t\t\t\tmu.Unlock()\n\n\t\t\t\tparams, _ := json.Marshal(req.Params)\n\t\t\t\tif req.Notif {\n\t\t\t\t\tlogger.Printf(\"jsonrpc2: --> notif: %s: %s\\n\", req.Method, params)\n\t\t\t\t} else {\n\t\t\t\t\tlogger.Printf(\"jsonrpc2: --> request #%s: %s: %s\\n\", req.ID, req.Method, params)\n\t\t\t\t}\n\t\t\t}\n\t\t})(c)\n\t\tjsonrpc2.OnSend(func(req *jsonrpc2.Request, resp *jsonrpc2.Response) {\n\t\t\tswitch {\n\t\t\tcase resp != nil:\n\t\t\t\tmu.Lock()\n\t\t\t\tmethod := reqMethods[resp.ID]\n\t\t\t\tdelete(reqMethods, resp.ID)\n\t\t\t\tmu.Unlock()\n\t\t\t\tif method == \"\" {\n\t\t\t\t\tmethod = \"(no previous request)\"\n\t\t\t\t}\n\n\t\t\t\tif resp.Result != nil {\n\t\t\t\t\tresult, _ := json.Marshal(resp.Result)\n\t\t\t\t\tlogger.Printf(\"jsonrpc2: <-- result #%s: %s: %s\\n\", resp.ID, method, result)\n\t\t\t\t} else {\n\t\t\t\t\terr, _ := json.Marshal(resp.Error)\n\t\t\t\t\tlogger.Printf(\"jsonrpc2: <-- error #%s: %s: %s\\n\", resp.ID, method, err)\n\t\t\t\t}\n\n\t\t\tcase req != nil:\n\t\t\t\tparams, _ := json.Marshal(req.Params)\n\t\t\t\tif req.Notif {\n\t\t\t\t\tlogger.Printf(\"jsonrpc2: <-- notif: %s: %s\\n\", req.Method, params)\n\t\t\t\t} else {\n\t\t\t\t\tlogger.Printf(\"jsonrpc2: <-- request #%s: %s: %s\\n\", req.ID, req.Method, params)\n\t\t\t\t}\n\t\t\t}\n\t\t})(c)\n\t}\n}", "title": "" }, { "docid": "882df8722d063897bd01384ae99fe5b3", "score": "0.45558524", "text": "func (c *Client) Debug() {\n\tlog.Printf(\"%v\", c)\n}", "title": "" }, { "docid": "25bc8d330054df5d33873556278badd5", "score": "0.4555704", "text": "func (m *UserManager) CleanupConnectionsLog() error {\n\texpireDate := time.Now().AddDate(0, 0, -m.config.ConnectionsRetention)\n\tresult := m.db.Delete(&models.VPNConnection{}, \"created_at < ?\", expireDate)\n\treturn result.Error\n}", "title": "" }, { "docid": "c6217be4e2a68872a2644f3834550a61", "score": "0.4554998", "text": "func (l *nopLogger) Debug(format string, params ...interface{}) {\n}", "title": "" }, { "docid": "4c6df4a11b46f585a4098dc2a2d9c58f", "score": "0.4553213", "text": "func (*Log) Debug(v ...interface{}) {}", "title": "" }, { "docid": "43b28cc136bd14bc0ec83c836a908b0e", "score": "0.4553038", "text": "func (a *Aggregator) GetAllConnectionMethods(ctx context.Context, req *aggregatorproto.AggregatorRequest) (\n\t*aggregatorproto.AggregatorResponse, error) {\n\n\tvar oemprivileges []string\n\tprivileges := []string{common.PrivilegeLogin}\n\tauthResp := a.connector.Auth(req.SessionToken, privileges, oemprivileges)\n\tresp := &aggregatorproto.AggregatorResponse{}\n\tif authResp.StatusCode != http.StatusOK {\n\t\tlog.Error(\"Unable to authenticate session with token: \" + req.SessionToken)\n\t\tgenerateResponse(authResp, resp)\n\t\treturn resp, nil\n\t}\n\trpcResponce := a.connector.GetAllConnectionMethods(req)\n\tgenerateResponse(rpcResponce, resp)\n\treturn resp, nil\n}", "title": "" }, { "docid": "a8530f7067b0af4fe4b8213396aeb22d", "score": "0.4549515", "text": "func onLog(mosq unsafe.Pointer, data unsafe.Pointer, level int, message *C.char) {\n\tlogMessage := C.GoString(message)\n\tlog.Printf(\"mosquitto log: %d, %s\", level, logMessage)\n}", "title": "" }, { "docid": "1d4139362d1bd27f89eb4ad0bc880f48", "score": "0.45461982", "text": "func (l NoOpLogger) Debug(msg string, fields ...Field) {}", "title": "" }, { "docid": "af2827f940494fdfde9694082480230a", "score": "0.45460936", "text": "func (e *Encoder) Log() []*pb_handler.LogEntry {\n\treturn nil\n}", "title": "" }, { "docid": "6b0b27dcb549509b7ea8f0dfbb9d13f4", "score": "0.45459986", "text": "func (loggerSqlInternalPerf) Info(ctx context.Context, msg string) {\n\tlogfDepth(ctx, 1, severity.INFO, channel.SQL_INTERNAL_PERF, msg)\n}", "title": "" }, { "docid": "3193c046858c531508bf6c765a3baa51", "score": "0.45454136", "text": "func DoGetAllConnectionMethods(req aggregatorproto.AggregatorRequest) (*aggregatorproto.AggregatorResponse, error) {\n\n\tconn, err := services.ODIMService.Client(services.Aggregator)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create client connection: %v\", err)\n\t}\n\tdefer conn.Close()\n\taggregator := aggregatorproto.NewAggregatorClient(conn)\n\n\tresp, err := aggregator.GetAllConnectionMethods(context.TODO(), &req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"RPC error: %v\", err)\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "77811bcb1ae2532a4c60d9560c7e1df1", "score": "0.45447466", "text": "func (l *devNullLogger) Info(v ...interface{}) {\n}", "title": "" }, { "docid": "a5a0d85ddfc00803c732a35fc197caf7", "score": "0.45432553", "text": "func (a *adapter) Info(msg string, data ...interface{}) {\n\ta.Logger.Info(msg, data...)\n}", "title": "" }, { "docid": "63416adddb6dc6108aaf80158ad9ed14", "score": "0.45409873", "text": "func PrintConnection(a category.Connectable, b category.Connectable) error {\n\tif a == nil || b == nil {\n\t\treturn fmt.Errorf(\"connecting nil\")\n\t}\n\tfmt.Printf(\"%s -> %s\\n\", a.GetId(), b.GetId())\n\treturn nil\n}", "title": "" }, { "docid": "ee374a23fc04b35e31c3708e68f9bba1", "score": "0.45409858", "text": "func forwardRunhcsLogs(ctx context.Context, c net.Conn, fields logrus.Fields) {\n\tdefer c.Close()\n\tj := json.NewDecoder(c)\n\n\tfor {\n\t\te := logrus.Entry{}\n\t\terr := j.Decode(&e.Data)\n\t\tif err == io.EOF || err == errorConnectionAborted {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\t// Likely the last message wasn't complete at closure. Just read all\n\t\t\t// data and forward as error.\n\t\t\tdata, _ := ioutil.ReadAll(io.MultiReader(j.Buffered(), c))\n\t\t\tif len(data) != 0 {\n\t\t\t\tlog.G(ctx).WithFields(fields).Error(string(data))\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tmsg := e.Data[logrus.FieldKeyMsg]\n\t\tdelete(e.Data, logrus.FieldKeyMsg)\n\n\t\tlevel, err := logrus.ParseLevel(e.Data[logrus.FieldKeyLevel].(string))\n\t\tif err != nil {\n\t\t\tlog.G(ctx).WithFields(fields).WithError(err).Debug(\"invalid log level\")\n\t\t\tlevel = logrus.DebugLevel\n\t\t}\n\t\tdelete(e.Data, logrus.FieldKeyLevel)\n\n\t\t// TODO: JTERRY75 maybe we need to make this configurable so we know\n\t\t// that runhcs is using the same one we are deserializing.\n\t\tti, err := time.Parse(logrus.DefaultTimestampFormat, e.Data[logrus.FieldKeyTime].(string))\n\t\tif err != nil {\n\t\t\tlog.G(ctx).WithFields(fields).WithError(err).Debug(\"invalid time stamp format\")\n\t\t\tti = time.Time{}\n\t\t}\n\t\tdelete(e.Data, logrus.FieldKeyTime)\n\n\t\tetr := log.G(ctx).WithFields(fields).WithFields(e.Data)\n\t\tetr.Time = ti\n\t\tswitch level {\n\t\tcase logrus.PanicLevel:\n\t\t\tetr.Panic(msg)\n\t\tcase logrus.FatalLevel:\n\t\t\tetr.Fatal(msg)\n\t\tcase logrus.ErrorLevel:\n\t\t\tetr.Error(msg)\n\t\tcase logrus.WarnLevel:\n\t\t\tetr.Warn(msg)\n\t\tcase logrus.InfoLevel:\n\t\t\tetr.Info(msg)\n\t\tcase logrus.DebugLevel:\n\t\t\tetr.Debug(msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fee2b8a33a3ad36b8a57ba6a8521873e", "score": "0.45266244", "text": "func (b *BroadcastClient) log() {\n\tname, orderCount, totalTax, rule, speed := b.calcInfo()\n\tlogger.Info(\"Logging system\", \"orderer-name\", name, \"txs-fetched\", orderCount, \"fee-reward\", totalTax, \"allocation-rule\", rule, \"tps\", speed)\n}", "title": "" }, { "docid": "dcb80df2108d95de6c9fa9ec8c80bcf9", "score": "0.45201764", "text": "func dumpLogs(ringEntry interface{}) {\n\tvar ok bool\n\tvar line string\n\tif line, ok = ringEntry.(string); !ok {\n\t\treturn\n\t}\n\tif strings.Contains(line, \"vddk: config key=password\") {\n\t\t// Do not log passwords\n\t\treturn\n\t}\n\tklog.Infof(\"Log line from nbdkit: %s\", line)\n}", "title": "" }, { "docid": "cde141ba68cc8e4fa76b7083b6c69da0", "score": "0.45194095", "text": "func (l NoOpLogger) Info(msg string, fields ...Field) {}", "title": "" }, { "docid": "bfee06587de4bc9d517b217d21533b99", "score": "0.45156896", "text": "func DiscardLog(f string, args ...interface{}) {}", "title": "" }, { "docid": "e6ab45d3d47248c82f7ad1bc42625e11", "score": "0.45147032", "text": "func (n *noop) Debugln(msg ...interface{}) {}", "title": "" }, { "docid": "7469d6d0749a3300ef123180e1edb48e", "score": "0.45112774", "text": "func (cmd *DebugLevelCmd) Method() string {\n\treturn \"debuglevel\"\n}", "title": "" }, { "docid": "5bd38e13fb90dbae524dbc265defc59b", "score": "0.4510296", "text": "func (s *Sqlite3Impl) log(msg string) {\n\tchatlog.Append(chatlog.LOGSQL, msg)\n}", "title": "" }, { "docid": "5a2cdd9b6aeb6e99a2c6d778c7aa6383", "score": "0.45083568", "text": "func (n *NoopMetrics) DropConnect() {}", "title": "" }, { "docid": "1c90ab768757f92deb8a610986a0f3e6", "score": "0.4507765", "text": "func LogOut() {\n\tif DebugLog {\n\t\tfor i := 0; i < MemLogP; i++ {\n\t\t\tfmt.Println(MemLog[i])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "71c0624069b66819f79aa8ae7c6c9534", "score": "0.45059475", "text": "func (c *LogClient) LogSomething() {\n\tc.log.Write([]byte(\"Something\\n\"))\n}", "title": "" }, { "docid": "1b8f716173a185db40053aa8ea316f0b", "score": "0.45055515", "text": "func Quiet(format string, args ...interface{}) {\n\t/* discard logs */\n}", "title": "" }, { "docid": "f60114c6edd0db6c73da0850ed3feae5", "score": "0.44995254", "text": "func Ignore(args ...interface{}) {\n\tif Debug() {\n\t\tlog.Println(args...)\n\t}\n}", "title": "" }, { "docid": "94b5d73f37924d6d148ff86609c8516c", "score": "0.44972435", "text": "func (NopLogger) Info(msg string, keyvals ...interface{}) {}", "title": "" }, { "docid": "a3a5215c88e50a2326bd2b8509346a51", "score": "0.44940653", "text": "func (n node) Loggable() map[string]interface{} { return nil }", "title": "" }, { "docid": "ea48f897928448b1a9015d48525f4dd3", "score": "0.4489442", "text": "func (n *NullLogger) Info(format string, v ...interface{}) {}", "title": "" }, { "docid": "f5860daa7a194df20cfb0d749c5844b9", "score": "0.44846085", "text": "func (m *RpcState) LogWarning(args ...interface{}) {\n\tm.logger.Warning(args...)\n}", "title": "" }, { "docid": "cb927e2c16b7b65b176472da38887f78", "score": "0.44807595", "text": "func (m *mainScreen) logRoutine() {\n\tfor {\n\t\tselect {\n\t\tcase <-m.shutdown:\n\t\t\treturn\n\t\tcase rec := <-m.toBeLogged:\n\n\t\t\t// perform lookup on external submitted QSOs (e.g. from WSJT-X)\n\t\t\tif rec.external {\n\t\t\t\trsp, err := m.lookup.Lookup(rec.record.Get(adif.Call))\n\t\t\t\tif err == nil {\n\t\t\t\t\tif rsp.Name != nil && rec.record.Get(adif.Name) == \"\" {\n\t\t\t\t\t\trec.record = append(rec.record, adif.Field{Name: adif.Name, Value: *rsp.Name})\n\t\t\t\t\t}\n\t\t\t\t\tif rsp.Grid != nil && rec.record.Get(adif.GridSquare) == \"\" {\n\t\t\t\t\t\trec.record = append(rec.record, adif.Field{Name: adif.GridSquare, Value: *rsp.Grid})\n\t\t\t\t\t}\n\t\t\t\t\tif rsp.Country != nil {\n\t\t\t\t\t\trec.record = append(rec.record, adif.Field{Name: adif.Country, Value: *rsp.Country})\n\n\t\t\t\t\t\tent, err := dxcc.LookupEntity(*rsp.Country)\n\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\trec.record = append(rec.record,\n\t\t\t\t\t\t\t\tadif.Field{\n\t\t\t\t\t\t\t\t\tName: adif.DXCC,\n\t\t\t\t\t\t\t\t\tValue: strconv.FormatInt(int64(ent.DXCC), 10),\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif m.cfg.Operator.Sig != \"\" {\n\t\t\t\trec.record = append(rec.record, adif.Field{Name: adif.MySIG, Value: m.cfg.Operator.Sig})\n\t\t\t}\n\t\t\tif m.cfg.Operator.SigInfo != \"\" {\n\t\t\t\trec.record = append(rec.record, adif.Field{Name: adif.MySIGInfo, Value: m.cfg.Operator.SigInfo})\n\t\t\t}\n\n\t\t\t// upload to LoTW?\n\t\t\tif !m.cfg.noNet && m.cfg.Operator.LOTWAutoUpload {\n\t\t\t\t// possibly adds new fields if successful\n\t\t\t\trec.record = m.logToLOTW(rec.record)\n\t\t\t}\n\n\t\t\tm.alog.AddRecord(rec.record)\n\t\t\tm.alog.Save()\n\n\t\t\t// index the QSO so we can quickly identify if we've seen it before\n\t\t\tr, err := db.AdifToRecord(rec.record)\n\t\t\tif err == nil {\n\t\t\t\tm.d.AddRecord(r)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" } ]
8ed34c8e17dce214066714553ca6ebfa
NewDB opens a new BoltDB database.
[ { "docid": "77eab74bf45e6b152e28f940cafd2a7f", "score": "0.7773773", "text": "func NewDB(filename string, fileMode os.FileMode, boltOptions *bolt.Options) (db *bolt.DB, err error) {\n\tif boltOptions == nil {\n\t\tboltOptions = &bolt.Options{\n\t\t\tTimeout: 2 * time.Second,\n\t\t\tMmapFlags: mmapFlags,\n\t\t}\n\t}\n\tif fileMode == 0 {\n\t\tfileMode = 0640\n\t}\n\tdb, err = bolt.Open(filename, fileMode, boltOptions)\n\treturn\n}", "title": "" } ]
[ { "docid": "0d0c860a7658ca7f7d0e77968661fbbe", "score": "0.7783004", "text": "func NewDB(tb testing.TB) *DB {\n\tdb, err := bolt.Open(tempfile(), 0666, nil)\n\tif err != nil {\n\t\ttb.Fatal(err)\n\t}\n\treturn &DB{DB: db}\n}", "title": "" }, { "docid": "2910100aaf7a7c9ac615fd144d3c7d4c", "score": "0.77212566", "text": "func NewDB() *DB { return &DB{} }", "title": "" }, { "docid": "001447c13013a2f97634a81fb0c68fd2", "score": "0.74557376", "text": "func NewDB(conf configuration.Ledger, opts *badger.Options) (*DB, error) {\n\topts = setOptions(opts)\n\tdir, err := filepath.Abs(conf.Storage.DataDirectory)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\topts.Dir = dir\n\topts.ValueDir = dir\n\n\tbdb, err := badger.Open(*opts)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"local database open failed\")\n\t}\n\n\tdb := &DB{\n\t\tdb: bdb,\n\t\ttxretiries: conf.Storage.TxRetriesOnConflict,\n\t\tjetSizesHistoryDepth: conf.JetSizesHistoryDepth,\n\t\tidlocker: NewIDLocker(),\n\t\tjetHeavyClientLocker: NewIDLocker(),\n\t\tnodeHistory: map[core.PulseNumber][]Node{},\n\t}\n\treturn db, nil\n}", "title": "" }, { "docid": "d5eb94e6eac933f51aa9ae694499b89e", "score": "0.7428417", "text": "func New(filepath string) (*bolt.DB, error) {\n\t// New BoltDB session\n\tdb, err := bolt.Open(filepath, 0600, nil)\n\t// Return the new Session and error if any\n\treturn db, err\n}", "title": "" }, { "docid": "aa1dd3603f2ca8cb53b65ab66386b89e", "score": "0.7370967", "text": "func NewDB() *DB {\n\treturn &DB{}\n}", "title": "" }, { "docid": "7f2c4785faffb76cc8345917988b68eb", "score": "0.7307777", "text": "func NewDatabase(path string) (*Database, error) {\n\tdb, err := bbolt.Open(path, 0666, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot open database: %v\", err)\n\t}\n\n\treturn &Database{db}, nil\n}", "title": "" }, { "docid": "3fe39aa177c8d033f6c0c87638147923", "score": "0.7275576", "text": "func NewDB(c *Config) *BlockchainDB {\n\tonce.Do(func() {\n\t\tconfig = c\n\n\t\tdbInstance = &BlockchainDB{}\n\t\tdbInstance.open()\n\t})\n\treturn dbInstance\n}", "title": "" }, { "docid": "d568be7e3bb41362e3b3bc986972ae93", "score": "0.7255343", "text": "func NewDB() *DB {\n\tdb, err := gorm.Open(\"sqlite3\", \"test.db\")\n\tif err != nil {\n\t\tpanic(\"failed to connect database\")\n\t}\n\n\t// Migrate the schema\n\tdb.AutoMigrate(&domain.Product{}, &domain.Stock{}, &domain.Trans{})\n\n\treturn &DB{db}\n}", "title": "" }, { "docid": "5e03896dbabb539ee8024062fc9bc45d", "score": "0.723671", "text": "func NewDB(cfg config.Configuration) (DB, error) {\n\tdb, err := gorm.Open(cfg.DB, cfg.FormattedDBURL())\n\tif err != nil {\n\t\treturn DB{}, err\n\t}\n\tdb.LogMode(cfg.DBLogMode)\n\t// create logger\n\tlogger := log.Logger.With(\"module\", \"DB\")\n\n\tbz, err := bazooka.NewPreLoadedBazooka(cfg)\n\tif err != nil {\n\t\treturn DB{}, err\n\t}\n\treturn DB{Instance: db, Logger: logger, Bazooka: bz, Cfg: cfg}, nil\n}", "title": "" }, { "docid": "a0d8fdbad8020973100892b596f8f8da", "score": "0.72334445", "text": "func NewDB() interfaces.DB {\n\treturn &DB{}\n}", "title": "" }, { "docid": "2ec29dd84ea48fadaa9ce36f86be4942", "score": "0.72276676", "text": "func NewDB() *DB {\n\treturn &DB{\n\t\tdata: make(map[string]string),\n\t}\n}", "title": "" }, { "docid": "05fd81ccc300567991615b4d9bcb1df7", "score": "0.7190797", "text": "func NewDB(config *Config) *DB {\n\tsslMode := \"enable\"\n\tif config.SSLMode != \"\" {\n\t\tsslMode = config.SSLMode\n\t}\n\n\tconn := fmt.Sprintf(`\n\t\thost=%s\n\t\tport=%d \n\t\tuser=%s \n\t\tpassword=%s \n\t\tdbname=%s \n\t\tsslmode=%s`,\n\t\tconfig.Host,\n\t\tconfig.Port,\n\t\tconfig.User,\n\t\tconfig.Pass,\n\t\tconfig.Dbname,\n\t\tsslMode,\n\t)\n\n\tlog.Printf(\"[db] connecting to database: %s:%v/%s\",\n\t\tconfig.Host,\n\t\tconfig.Port,\n\t\tconfig.Dbname,\n\t)\n\n\tclient, err := sql.Open(\"postgres\", conn)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn &DB{\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "51a05bc89627e6f09ea621f5af025d35", "score": "0.7186667", "text": "func NewDB(path string, timeout time.Duration) (*DB, error) {\n\t// open connection to the DB\n\tlog.WithField(\"path\", path).WithField(\"timeout\", timeout).Debug(\"Creating DB connection\")\n\topts := bbolt.DefaultOptions\n\tif timeout > 0 {\n\t\topts.Timeout = timeout\n\t}\n\tb, err := bbolt.Open(path, 0755, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open DB: %w\", err)\n\t}\n\n\t// create global bucket if it doesn't exist yet\n\tlog.WithField(\"bucket\", string(bucketName)).Debug(\"Setting the default bucket\")\n\terr = b.Update(func(tx *bbolt.Tx) error {\n\t\t_, bErr := tx.CreateBucketIfNotExists(bucketName)\n\t\treturn bErr\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create global bucket: %w\", err)\n\t}\n\n\t// return the DB\n\tdb := &DB{b: b, timeout: timeout}\n\tlog.Debug(\"DB initiated\")\n\treturn db, nil\n}", "title": "" }, { "docid": "1f13a5da4d19c8177e94f9c1e3171c89", "score": "0.7181407", "text": "func NewDB(filename string) (*DB, error) {\n\tdb := DB{\n\t\tfilename: filename,\n\t\tTodos: make(map[string]Todo),\n\t\tTriggers: make(map[string]Trigger),\n\t}\n\terr := db.Read()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &db, nil\n}", "title": "" }, { "docid": "85ba397b6f17f2af07f4a3a8af0edc97", "score": "0.71647537", "text": "func NewDB() *DB {\n\treturn &DB{\n\t\tmtx: sync.Mutex{},\n\t\tlast: 0,\n\t\tblocks: make(map[string][]byte),\n\t}\n}", "title": "" }, { "docid": "c3dbeffff995ea7ba91dd21b45f2956e", "score": "0.7154786", "text": "func NewDB() (db *gorm.DB, err error) {\n\t//For connecting to MySQL DB\n\t//db, err = gorm.Open(\"mysql\", \"user:password@(localhost)/dbname?charset=utf8&parseTime=True&loc=Local\")\n\tdb, err = gorm.Open(\"sqlite3\", \"file:test.db?_busy_timeout=300000\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdb.AutoMigrate(&User{})\n\tdb.AutoMigrate(&Home{})\n\n\treturn\n}", "title": "" }, { "docid": "e4e2b51776fe9f3b4d3682b99a8acdcf", "score": "0.7153559", "text": "func New(db_path string) (*DB, error) {\n\tcreateOpen := kv.Open\n\tif _, err := os.Stat(db_path); os.IsNotExist(err) {\n\t\tcreateOpen = kv.Create\n\t}\n\t//opts := opts()\n\t//action := kv.Open\n\t//if _, err := os.Stat(db_path); os.IsNotExist(err) {\n\t//\taction = kv.Create\n\t//}\n\tkvdb, err := createOpen(db_path, &kv.Options{})\n\tdb := &DB{}\n\tdb.db = kvdb\n\tdb.db_path = db_path\n\tdb.mutex = NewSlottedMutex()\n\treturn db, err\n}", "title": "" }, { "docid": "cc95629751f33827918eeacdbc1da1d2", "score": "0.7149474", "text": "func newDB(t *testing.T) database.DB {\n\tdb, err := sql.Open(\"sqlite3\", \":memory:\")\n\tif err != nil {\n\t\tt.Errorf(\"expected err to be nil: %v\", err)\n\t}\n\n\tcreateTableSchema := `\nCREATE TABLE schema (\n id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n version INTEGER NOT NULL,\n updated_at DATETIME NOT NULL,\n UNIQUE (version)\n);\n`\n\t_, err = db.Exec(createTableSchema + cluster.FreshSchema())\n\tif err != nil {\n\t\tt.Errorf(\"expected err to be nil: %v\", err)\n\t}\n\n\treturn database.NewShimDB(db)\n}", "title": "" }, { "docid": "2e7ef491dd9881b9e2bc186c652b416b", "score": "0.71371126", "text": "func NewDB(tb testing.TB, cfg ...*rbfcfg.Config) *rbf.DB {\n\tpath, err := testhook.TempDir(tb, \"rbfdb\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn NewDBAt(tb, path, cfg...)\n}", "title": "" }, { "docid": "5df2afa991655e46f6afa2604e90617d", "score": "0.71351045", "text": "func newDB(cfg config) (Datab, error) {\n\tswitch cfg.dbType {\n\tcase \"sqlite\":\n\t\treturn newSQLite(cfg)\n\tcase \"postgres\":\n\t\treturn newPostgres(cfg)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown backend: %q\", cfg.dbType)\n\t}\n}", "title": "" }, { "docid": "a77c98bc41288619ff3588deccca9d2b", "score": "0.71220684", "text": "func NewDB(dbPath string, logger dex.Logger) (dexdb.DB, error) {\n\t_, err := os.Stat(dbPath)\n\tisNew := os.IsNotExist(err)\n\n\tdb, err := bbolt.Open(dbPath, 0600, &bbolt.Options{Timeout: 1 * time.Second})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Release the file lock on exit.\n\tbdb := &BoltDB{\n\t\tDB: db,\n\t\tlog: logger,\n\t}\n\n\terr = bdb.makeTopLevelBuckets([][]byte{appBucket, accountsBucket, disabledAccountsBucket,\n\t\tordersBucket, matchesBucket, walletsBucket, notesBucket})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If the db is a new one, initialize it with the current DB version.\n\tif isNew {\n\t\terr := bdb.DB.Update(func(dbTx *bbolt.Tx) error {\n\t\t\tbkt := dbTx.Bucket(appBucket)\n\t\t\tif bkt == nil {\n\t\t\t\treturn fmt.Errorf(\"app bucket not found\")\n\t\t\t}\n\n\t\t\tversionB := encode.Uint32Bytes(DBVersion)\n\t\t\terr := bkt.Put(versionKey, versionB)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tbdb.log.Infof(\"creating new version %d database\", DBVersion)\n\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn bdb, nil\n\t}\n\n\treturn bdb, bdb.upgradeDB()\n}", "title": "" }, { "docid": "39f6292c96d9116d2a670aed764a3b4d", "score": "0.7121815", "text": "func newDB(dbUrl string) (UserDatabase, error) {\n\treturn &templateDB{}, nil\n}", "title": "" }, { "docid": "a821066198e64a17d6b74045a5949c9d", "score": "0.71108514", "text": "func newDB(l *logrus.Logger) *pgDB {\n\n\t// create a normal database connection through database/sql\n\tdb, err := sql.Open(\"postgres\", os.Getenv(\"API_DSN\"))\n\tif err != nil {\n\t\tl.WithError(err).Fatal(\"could not connect to DB\")\n\t}\n\n\t// ensures the database can be pinged with an exponential backoff (15 min)\n\trunner.MustPing(db)\n\n\t// set to reasonable values for production\n\tdb.SetMaxIdleConns(4)\n\tdb.SetMaxOpenConns(16)\n\n\t// set this to enable interpolation\n\tdat.EnableInterpolation = true\n\n\t// set to check things like sessions closing.\n\t// Should be disabled in production/release builds.\n\tdat.Strict = false\n\n\t// Log any query over 10ms as warnings. (optional)\n\trunner.LogQueriesThreshold = 10 * time.Millisecond\n\tl.Info(\"Connected to DB\")\n\treturn &pgDB{\n\t\tlog: l,\n\t\tdb: runner.NewDB(db, \"postgres\"),\n\t}\n}", "title": "" }, { "docid": "e3fff181dfe9c20a09234a6f32194594", "score": "0.7105562", "text": "func NewDB(name string) *DB {\n\tdsn, _ := getDSN(name)\n\treturn &DB{\n\t\tDSN: dsn,\n\t}\n}", "title": "" }, { "docid": "dedec4b9c56e27c92456e43022d37bb9", "score": "0.70898026", "text": "func (mgr *ShardingManager) newDB(service *DBService, dbname string) (*gorm.DB, error) {\n\tdsn := fmt.Sprintf(\"%s:%s@tcp(%s:%d)/%s?parseTime=true&loc=Local&timeout=%s&readTimeout=%s&writeTimeout=%s&charset=%s\",\n\t\tservice.User,\n\t\tservice.Password,\n\t\tservice.Host,\n\t\tservice.Port,\n\t\tdbname,\n\t\tmgr.configTemplate.ConnTimeout,\n\t\tmgr.configTemplate.ReadTimeout,\n\t\tmgr.configTemplate.WriteTimeout,\n\t\tdatabase.BSCPCHARSET,\n\t)\n\n\tdb, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsqlDB, err := db.DB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsqlDB.SetMaxOpenConns(mgr.configTemplate.MaxOpenConns)\n\tsqlDB.SetMaxIdleConns(mgr.configTemplate.MaxIdleConns)\n\tsqlDB.SetConnMaxLifetime(mgr.configTemplate.KeepAlive)\n\n\treturn db, nil\n}", "title": "" }, { "docid": "5937894d3f48cda3789b376c57a2a32c", "score": "0.7088046", "text": "func NewDB() *Database {\n\treturn &Database{\n\t\troot: &Node{\n\t\t\tChildren: map[string]*Node{},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ab3920e9e65ef341cc7eafe4cf15733b", "score": "0.707415", "text": "func newDB(c *C.grngo_db) *DB {\n\tdb := new(DB)\n\tdb.c = c\n\tdb.tables = make(map[string]*Table)\n\treturn db\n}", "title": "" }, { "docid": "c1232b4a9791b62ea990d6bba3760660", "score": "0.7064165", "text": "func NewDB(u, p, a, d string) (err error) {\n\tpar := fmt.Sprintf(\"%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True&loc=Local\", u, p, a, d)\n\tlog.Println(par)\n\tdb, err = gorm.Open(\"mysql\", par)\n\tif err == nil {\n\t\t// automigrate dbModels\n\t\tdb.AutoMigrate(&articleDB{})\n\t\tdb.AutoMigrate(&userDB{})\n\t\tdb.AutoMigrate(&commentDB{})\n\t\tdb.AutoMigrate(&likeDB{})\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2000e4998bb061cef8dc4a7933fb6ac0", "score": "0.7058049", "text": "func New(dbfile string) (dnsserverDB.DB, error) {\n\tdb, err := gorm.Open(\"sqlite3\", dbfile)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not connect to db\")\n\t}\n\n\tif err := db.AutoMigrate(&Record{}).Error; err != nil {\n\t\treturn nil, errors.Wrap(err, \"while migrating database\")\n\t}\n\n\treturn &DB{db: db}, nil\n}", "title": "" }, { "docid": "01a45ffa6261dfd68393c79fcc893fe3", "score": "0.70324576", "text": "func newDB(path string) (*DB, error) {\n\t// connect to the example db, create if it doesn't exist\n\tdb, err := gorm.Open(\"postgres\", path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// drop tables and all data, and recreate them fresh for this run\n\tdb.DropTableIfExists(&resolver.User{})\n\tdb.AutoMigrate(&resolver.User{})\n\n\t// put all the users into the db\n\tfor _, u := range users {\n\t\tif err := db.Create(&u).Error; err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &DB{db}, nil\n}", "title": "" }, { "docid": "3986505fb461fe80565918c644c3bf9c", "score": "0.70307183", "text": "func New() db.Database {\n\treturn &DB{}\n}", "title": "" }, { "docid": "ffdfd37c326da6227d4da9fdacfd3c36", "score": "0.70285475", "text": "func NewDatabase(path string, readonly bool) (database.DB, error) {\n\tstorage, err := openStorage(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn DB{storage, readonly}, nil\n}", "title": "" }, { "docid": "096d0c9b2e8f6cd8e2742a916dbe2631", "score": "0.70116216", "text": "func NewDB(db *sqlx.DB) *DB {\n\treturn &DB{DB: db}\n}", "title": "" }, { "docid": "158d0d6e6a89d45c039ae0d5117b2db8", "score": "0.7006372", "text": "func NewDB(memory bool) *DB {\n\treturn &DB{\n\t\tdatabase: make(map[string]interface{}),\n\t\tmemory: memory,\n\t}\n}", "title": "" }, { "docid": "0972bb63435e5d3b31b227613e7e84b8", "score": "0.6994327", "text": "func NewDB(c config.Config) (*DB, error) {\n db, err := sqlx.Connect(\"postgres\", createDNS(c))\n if err != nil {\n return nil, err\n }\n return &DB{db}, nil\n}", "title": "" }, { "docid": "8b89985d2c08830d16abd3fc70087d2c", "score": "0.69858855", "text": "func NewDB(dataSourceName string) (*DB, error) {\n\tdb, err := sql.Open(\"sqlite3\", dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdb.SetMaxOpenConns(1)\n\td := &DB{\n\t\tdb: db,\n\t}\n\tif err := d.init(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "fdfd2234676a7403576e70623bd7a892", "score": "0.69733626", "text": "func NewDB() (*sql.DB, error) {\n\treturn newDB(sqlDsn)\n}", "title": "" }, { "docid": "6d062ae296fd6b210b4d41ea084ee1fe", "score": "0.6963202", "text": "func NewDB() *DB {\n\treturn &DB{\n\t\tmtx: sync.Mutex{},\n\t\tlast: 0,\n\t\tblocks: make(map[uint64][]byte),\n\t}\n}", "title": "" }, { "docid": "060f74c14a6a929bde61326a239e1704", "score": "0.69385064", "text": "func NewDatabase(ctx context.Context, name string, dbData env.DbData, editOpts editor.Options) (Database, error) {\n\tglobalState, err := dsess.NewGlobalStateStoreForDb(ctx, name, dbData.Ddb)\n\tif err != nil {\n\t\treturn Database{}, err\n\t}\n\n\treturn Database{\n\t\tbaseName: name,\n\t\trequestedName: name,\n\t\tddb: dbData.Ddb,\n\t\trsr: dbData.Rsr,\n\t\trsw: dbData.Rsw,\n\t\tgs: globalState,\n\t\teditOpts: editOpts,\n\t}, nil\n}", "title": "" }, { "docid": "53d5816b17d9003e507741a577c64aba", "score": "0.691778", "text": "func NewBoltDB(directory string, filename string) *bbolt.DB {\n\topts := &bbolt.Options{\n\t\tNoSync: true,\n\t}\n\n\tdb, err := bolt.CreateDB(directory, filename, opts)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "fe6f5a725cccb22c18155f02f9ba3064", "score": "0.69131124", "text": "func NewDB(dbPath, dbCfgPath string) *DB {\n\tdb := &DB{\n\t\tdbPath: dbPath,\n\t\tdbCfgPath: dbCfgPath,\n\t}\n\treturn db\n}", "title": "" }, { "docid": "22a1a281fa90148ffa55d4fb7cbcbd3b", "score": "0.69126374", "text": "func newDB(s sqlSpec) (db.DB, error) {\n\tdrv := s.driver()\n\tif !knownDrivers[drv] {\n\t\treturn nil, fmt.Errorf(\"unknown sql driver %q\", drv)\n\t}\n\n\tsqlDb, err := sql.Open(string(drv), s.ConnectionString())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn wrapDB(sqlDb, s)\n}", "title": "" }, { "docid": "2bc0dc648bf052431f53caea07ed0915", "score": "0.69068253", "text": "func NewDB() *DB {\n\n\tdb := &DB{\n\t\tkeys: make([]interface{}, 0),\n\t\tvalues: make(map[interface{}]interface{}, 0),\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "c88861bd14d162785aede55569e6b4ec", "score": "0.69002885", "text": "func NewDatabase() DB {\n\tsession = getSession()\n\treturn &Database{}\n}", "title": "" }, { "docid": "a862d0fc3baa84fb147f2cdc3456cb56", "score": "0.688538", "text": "func NewDatabase(db *sql.DB) (*Database, error) {\n\treturn &Database{\n\t\tdb: db,\n\t}, db.Ping()\n}", "title": "" }, { "docid": "22b21f82b2cffd3e9fd2a3313a9f8f05", "score": "0.68711996", "text": "func NewDB(dbFilePath string) (db *BadgerDB, err error) {\n\tdb = &BadgerDB{}\n\n\tdb.path = dbFilePath\n\n\tdb.db, err = badger.Open(badger.DefaultOptions(db.path))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7ef8dfc5d5a87ddfab4385391b25f76b", "score": "0.68521404", "text": "func New(uri, migrationsDir string) (DB, error) {\n\tif migrationsDir != \"\" {\n\t\tlevel.Info(util.Logger).Log(\"msg\", \"running database migrations...\")\n\t\tif errs, ok := migrate.UpSync(uri, migrationsDir); !ok {\n\t\t\tfor _, err := range errs {\n\t\t\t\tlevel.Error(util.Logger).Log(\"err\", err)\n\t\t\t}\n\t\t\treturn DB{}, errors.New(\"database migrations failed\")\n\t\t}\n\t}\n\tdb, err := sql.Open(\"postgres\", uri)\n\treturn DB{\n\t\tdbProxy: db,\n\t\tStatementBuilderType: statementBuilder(db),\n\t}, err\n}", "title": "" }, { "docid": "92bf74d57a61d8e0b868921c69f473d1", "score": "0.6851051", "text": "func NewDB(dataSource string, pool int, readTimeout time.Duration) *DB {\n\tusr, pass, proto, addr, dbname := parseDataSource(dataSource)\n\tconns := make(chan *Conn, pool)\n\treturn &DB{\n\t\tconns: conns,\n\t\tusername: usr,\n\t\tpassword: pass,\n\t\tprotocol: proto,\n\t\taddress: addr,\n\t\tdatabase: dbname,\n\t\treadTimeout: readTimeout,\n\t}\n}", "title": "" }, { "docid": "e12a661da6e76179b8a110b25bee2bb6", "score": "0.68504906", "text": "func NewDB(path string, opt ...Option) (*DB, error) {\n\topts := newOptions(opt...)\n\n\tdb, err := sqlx.Open(\"sqlite3\", path)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to open db\")\n\t}\n\tif err := initTables(db); err != nil {\n\t\treturn nil, err\n\t}\n\tck, err := initClientKey(db, opts.ClientKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DB{db: db, ck: ck}, nil\n}", "title": "" }, { "docid": "c6e0472b981da27a80721b549b89c918", "score": "0.68489504", "text": "func NewDatabase(dbPath string) *Database {\n\tdb, err := badger.Open(badger.DefaultOptions(dbPath))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn &Database{db: db}\n}", "title": "" }, { "docid": "c01162edc9acac0f304b494770b5239c", "score": "0.68326294", "text": "func New(dbName string, user string, password string) *DB {\n\tcreds := fmt.Sprintf(\"host=%s port=%d user=%s dbname=%s password=%s sslmode=disable\", \"localhost\", 5432, user, dbName, password)\n\tgormDB, err := gorm.Open(\"postgres\", creds)\n\tif err != nil {\n\t\tlog.Fatal(tui.Red(\"Could not connect to PostgreSQL with provided parameters and credentials\" + err.Error()))\n\t}\n\tdb := &DB{gormDB}\n\n\treturn db\n}", "title": "" }, { "docid": "fd3542503aea874b4581ed0d1c879895", "score": "0.68272275", "text": "func New(db *sql.DB) *DB {\n\treturn &DB{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "387735e7745c89494ee4302294785352", "score": "0.680457", "text": "func NewDB(address string, name string, measurement string) *DB {\n\treturn &DB{\n\t\tAddress: address,\n\t\tName: name,\n\t\tMeasurement: measurement,\n\t}\n\n}", "title": "" }, { "docid": "da374f807bfc3f01710a7f69e18949e4", "score": "0.6799511", "text": "func NewDB(conn connectors.Connector) *DB {\n\treturn &DB{\n\t\tconn: conn,\n\t}\n}", "title": "" }, { "docid": "30e90bda0979a2d1783de733d2a2753a", "score": "0.67955875", "text": "func NewDB(dbPath string, dbCfgPath string) *DB {\n\treturn &DB{dbPath: dbPath, dbCfgPath: dbCfgPath}\n}", "title": "" }, { "docid": "20df50afbc76fc4559284ca22e47a449", "score": "0.67861056", "text": "func New(db *sql.DB) *Database {\n\treturn &Database{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "6b0619b753a0c0e06b287189da740996", "score": "0.67738324", "text": "func NewDB() (*sql.DB, func()) {\n\tcs := postgres.NewConnString()\n\tdb, err := postgres.New(cs.String(), MigrationsSource)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn db, func() {\n\t\t_ = db.Close()\n\t}\n}", "title": "" }, { "docid": "637f9ad3220edb311750d92bc6425686", "score": "0.67736924", "text": "func NewDB(config *config.Config) *DB {\n\tconnStr := \"postgresql://\" + config.DBUser + \":\" + config.DBPassword + \"@\" + config.DBURL + \"/\" + config.DBName\n\tconn, err := pgxpool.Connect(context.Background(), connStr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Info(\"database connection established\")\n\treturn &DB{conn}\n}", "title": "" }, { "docid": "a478ebdb12381ec77c2f21cd09e92918", "score": "0.67709005", "text": "func (c Config) NewDB() (*db.DB, error) {\n\treturn db.NewDB(c.DBFile)\n}", "title": "" }, { "docid": "3bee22653b49b7aa508a7309333f47c0", "score": "0.6762545", "text": "func NewDB(dsn string) *DB {\n\tdb := &DB{\n\t\tDSN: dsn,\n\t\tNow: time.Now,\n\n\t\tEventService: wtf.NopEventService(),\n\t}\n\tdb.ctx, db.cancel = context.WithCancel(context.Background())\n\treturn db\n}", "title": "" }, { "docid": "bb7cabb3d560808b2cb21cc123044a76", "score": "0.6761928", "text": "func NewDatabase(db *leveldb.DB) Database {\n\treturn &levelDB{db: db}\n}", "title": "" }, { "docid": "c94c86dc5c8fe587bde2aa3cd2064c56", "score": "0.6755468", "text": "func NewDB(dataSource string) (*DB, error) {\n\tdb, err := sql.Open(\"postgres\", dataSource)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := &DB{DB: db, stmts: map[int]*sql.Stmt{}}\n\tif err := res.prepareStmts(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "a62136fb2143603eeaa8ab3b8a04cd27", "score": "0.67554146", "text": "func New(file string, opts *bolt.Options) (*bolt.DB, error) {\n\tdb, err := bolt.Open(file, _fileMode, opts)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"bolt.Open\")\n\t}\n\n\ttx, err := db.Begin(true)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"_db.Begin\")\n\t}\n\tdefer tx.Rollback()\n\n\tif _, err = tx.CreateBucketIfNotExists(SnapshotBucket); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error creating bucket %s\", string(SnapshotBucket))\n\t}\n\n\tif _, err = tx.CreateBucketIfNotExists(MainBucket); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error creating bucket %s\", string(MainBucket))\n\t}\n\n\tif err = tx.Commit(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"tx.Commit\")\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "3ba9077ff2bb10d692c904252f42f33c", "score": "0.67538404", "text": "func NewDB(db *sql.DB) DB {\n\tconvertedDB := sqlx.NewDb(db, \"postgres\")\n\treturn convertedDB\n}", "title": "" }, { "docid": "0a968d374c72881e507f6f19d5c4b65c", "score": "0.6746355", "text": "func NewDB() (*sqlx.DB, error) {\n\tconn := os.Getenv(\"POSTGRES_CONN\")\n\tif conn == \"\" {\n\t\tconn = \"dbname=ovh sslmode=disable\"\n\t}\n\n\tdb, err := sqlx.Open(\"postgres\", conn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "7d278b6da2ef8145706d4ac57002c166", "score": "0.6740649", "text": "func NewDB(ctx context.Context, project, namespace, instance string, ts oauth2.TokenSource) (DB, error) {\n\trv, err := NewFirestoreDBWithParams(ctx, project, namespace, instance, ts)\n\tif err != nil {\n\t\treturn nil, skerr.Wrap(err)\n\t}\n\texportDB, err := NewFirestoreDBWithParams(ctx, project, ds.AUTOROLL_NS, instance, ts)\n\tif err != nil {\n\t\treturn nil, skerr.Wrap(err)\n\t}\n\trv.exportDB = exportDB\n\treturn rv, nil\n}", "title": "" }, { "docid": "2e5445d970c014866ff4fd2822ea567e", "score": "0.6734572", "text": "func NewDB(path string, o *Options) (db *DB, err error) {\n\tif o == nil {\n\t\to = &Options{\n\t\t\tOpenFilesLimit: defaultOpenFilesLimit,\n\t\t\tBlockCacheCapacity: defaultBlockCacheCapacity,\n\t\t\tWriteBufferSize: defaultWriteBufferSize,\n\t\t\tDisableSeeksCompaction: defaultDisableSeeksCompaction,\n\t\t}\n\t}\n\tvar ldb *leveldb.DB\n\tif path == \"\" {\n\t\tldb, err = leveldb.Open(storage.NewMemStorage(), nil)\n\t} else {\n\t\tldb, err = leveldb.OpenFile(path, &opt.Options{\n\t\t\tOpenFilesCacheCapacity: int(o.OpenFilesLimit),\n\t\t\tBlockCacheCapacity: int(o.BlockCacheCapacity),\n\t\t\tWriteBuffer: int(o.WriteBufferSize),\n\t\t\tDisableSeeksCompaction: o.DisableSeeksCompaction,\n\t\t})\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewDBWrap(ldb)\n}", "title": "" }, { "docid": "0d73d8252cf03fc27b0ef892944f7074", "score": "0.672474", "text": "func NewDB(config config.DBCfg, logger *log.Logger) (Database, error) {\n\tvar db *gorm.DB\n\tvar err error\n\n\tcnxStr, err := config.ConnectionString()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdb, err = gorm.Open(config.Type.String(), cnxStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdb.LogMode(config.Logging)\n\tdb.SetLogger(logger)\n\n\treturn &gormDB{\n\t\tdb: db,\n\t\tconfig: config,\n\t\tlogger: logger,\n\t}, nil\n}", "title": "" }, { "docid": "b3ceb26df4846de90ad075fa8f43b3e6", "score": "0.67197907", "text": "func NewDB(path string) *JSONDB {\n\tdb := &JSONDB{\n\t\tPath: path,\n\t\tindex: map[string]*FileInfo{},\n\t}\n\tdb.index = db.load()\n\treturn db\n}", "title": "" }, { "docid": "c52f0802ee5ef2585b3eba5d275d18ac", "score": "0.67138314", "text": "func New(path string) (*DB, error) {\n\tldb, err := leveldb.OpenFile(path, nil)\n\tdb := DB{\n\t\tdatabase: ldb,\n\t}\n\tif err != nil {\n\t\tlog.Fatal(\"Yikes!\")\n\t}\n\treturn &db, nil\n}", "title": "" }, { "docid": "37e309e766104bf799a3f38036375d1f", "score": "0.6707328", "text": "func NewDB(clusterID uint64, nodeID uint64) sm.IStateMachine {\n\tplog.Infof(\"drummer DB is being created, cluster id: %d, node id: %d\",\n\t\tclusterID, nodeID)\n\td := &DB{\n\t\tVersion: currentVersion,\n\t\tClusterID: clusterID,\n\t\tNodeID: nodeID,\n\t\tClusters: make(map[uint64]*pb.Cluster),\n\t\tKVMap: make(map[string][]byte),\n\t\tClusterImage: newMultiCluster(),\n\t\tNodeHostImage: newMultiNodeHost(),\n\t\tNodeHostInfo: make(map[string]pb.NodeHostInfo),\n\t\tRequests: make(map[string][]pb.NodeHostRequest),\n\t\tOutgoing: make(map[string][]pb.NodeHostRequest),\n\t}\n\treturn d\n}", "title": "" }, { "docid": "067536120c1e0ebc1434802f35f89e52", "score": "0.6707057", "text": "func NewDb(fileName string) (repository.Db, error) {\n\n\tcontent, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar books []api.Book\n\terr = json.Unmarshal(content, &books)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Db{\n\t\tBooks: books,\n\t}, nil\n}", "title": "" }, { "docid": "db08e51c224c2e9b391ffbb758110ea7", "score": "0.6701107", "text": "func Open(name string) (DB, error) {\n\tdbStruct := bdb{\n\t\tname: name,\n\t\tbucketName: []byte(\"myBucket\"),\n\t}\n\tboltdb, err := bolt.Open(\"my.db\", 0666, nil)\n\tif err != nil {\n\t\tlog.Printf(\"db creation error: %s\", err)\n\t\treturn nil, err\n\t}\n\terr = boltdb.Update(func(tx *bolt.Tx) error {\n\t\t_, err := tx.CreateBucketIfNotExists(dbStruct.bucketName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"bucket creation error: %s\", err)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn nil, err\n\t}\n\tdbStruct.db = boltdb\n\treturn dbStruct, nil\n\n}", "title": "" }, { "docid": "d9e3745099dff941fd5db9bb4dd4cbd3", "score": "0.6699708", "text": "func New(config *Config) (*Database, error) {\n\tdb, err := gorm.Open(\"postgres\", config.DatabaseURI)\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to connect to database\")\n\t}\n\n\tif err = db.DB().Ping(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"database ping error\")\n\t}\n\tlog.Println(\"Connected to database\")\n\n\treturn &Database{db}, nil\n}", "title": "" }, { "docid": "54c5e4884c888920416fccb6e1a51e97", "score": "0.6698875", "text": "func NewDB(ctx context.Context, t testing.TB) (*DB, error) {\n\t// if we find an environment variable use this inplace of the passed in DSN.\n\t// this will mostly be used in CI/CD settings to point to pipeline databases\n\tvar dsn string\n\tdsnFromEnv := os.Getenv(EnvPGConnString)\n\tif dsnFromEnv != \"\" {\n\t\tdsn = dsnFromEnv\n\t} else {\n\t\tdsn = DefaultDSN\n\t}\n\n\tcfg, err := pgxpool.ParseConfig(dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcfg.ConnConfig.Logger = testingadapter.NewLogger(t)\n\tcfg.MaxConns = 10\n\tdbid, roleid := mkIDs()\n\tdatabase := fmt.Sprintf(\"db%x\", dbid)\n\trole := fmt.Sprintf(\"role%x\", roleid)\n\n\tconn, err := pgx.ConnectConfig(ctx, cfg.ConnConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := conn.Exec(ctx, fmt.Sprintf(createRole, role)); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := conn.Exec(ctx, fmt.Sprintf(createDatabase, role, database)); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := conn.Close(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg.ConnConfig.Database = database\n\tconn, err = pgx.ConnectConfig(ctx, cfg.ConnConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := conn.Exec(ctx, loadUUID); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := conn.Close(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg.ConnConfig.User = role\n\tt.Logf(\"config: %+v\", struct {\n\t\tHost string\n\t\tPort uint16\n\t\tDatabase string\n\t\tUser string\n\t\tPassword string\n\t}{\n\t\tHost: cfg.ConnConfig.Host,\n\t\tPort: cfg.ConnConfig.Port,\n\t\tDatabase: cfg.ConnConfig.Database,\n\t\tUser: cfg.ConnConfig.User,\n\t\tPassword: cfg.ConnConfig.Password,\n\t})\n\tcfg.ConnConfig.Logger = nil\n\n\treturn &DB{\n\t\tdsn: dsn,\n\t\tcfg: cfg,\n\t}, nil\n}", "title": "" }, { "docid": "86095a5be049cc3dfc9854ffa8a3d970", "score": "0.66945094", "text": "func NewDatabase(db ethdb.KeyValueStore) ethdb.Database {\n\treturn db\n}", "title": "" }, { "docid": "78354cc5d15d720357f874b859a0aee0", "score": "0.66761166", "text": "func NewDatabase(config interface{}) *Database {\n\tcfg := config.(string)\n\n\tdc := DatabaseConfig{\n\t\tMaster: cfg,\n\t}\n\n\treturn &Database{\n\t\tName: dc,\n\t}\n}", "title": "" }, { "docid": "7eca512b3eb651884b25f61153639d9a", "score": "0.6671092", "text": "func NewDb(componentId ...string) *Db {\n\tid := DefaultDbId\n\tif len(componentId) > 0 {\n\t\tid = componentId[0]\n\t}\n\td := &Db{}\n\td.client = pgo2.App().Component(id, db.New).(*db.Client)\n\n\treturn d\n}", "title": "" }, { "docid": "165c44bf4a9613ae43cf7a9504220ab7", "score": "0.6666508", "text": "func NewDB(user, password, dbname, host string) (*DB, error) {\n\tconnectString := fmt.Sprintf(\n\t\t\"postgresql://%s:%s@%s/%s?sslmode=disable\",\n\t\tuser, password, host, dbname)\n\t// open a db connection\n\tdb, err := sql.Open(\"postgres\", connectString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DB{db}, nil\n}", "title": "" }, { "docid": "54a5ca863010124e2e726cf974d436d9", "score": "0.6656736", "text": "func (scope *Scope) NewDB() *DB {\n\treturn scope.db.new()\n}", "title": "" }, { "docid": "a1119b329e4a9fa59ed45bf7f433e0bc", "score": "0.66502583", "text": "func New() *Database {\n\tdb := dbConn(dbUser, dbPass, dbIP, dbPort, dbName)\n\n\treturn &Database{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "2b827e0aa0f1063979792c56b31cd4fb", "score": "0.6625854", "text": "func New(sess *sql.DB) (sqlbuilder.Database, error) {\r\n\td := newDatabase(nil)\r\n\r\n\t// Binding with sqladapter's logic.\r\n\td.BaseDatabase = sqladapter.NewBaseDatabase(d)\r\n\r\n\t// Binding with sqlbuilder.\r\n\td.SQLBuilder = sqlbuilder.WithSession(d.BaseDatabase, template)\r\n\r\n\tif err := d.BaseDatabase.BindSession(sess); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn d, nil\r\n}", "title": "" }, { "docid": "fa22efb04f396a4d462b4700dad2ef98", "score": "0.6620017", "text": "func NewDB() (*DB, error) {\n\tenv := os.Getenv(\"GOENV\")\n\tif env == \"\" {\n\t\tenv = \"dev\"\n\t}\n\n\tworkingDir, err := os.Getwd()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to get working directory with error %v\", err)\n\t}\n\n\tfilename, err := findConfigFile(workingDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tyamlFile, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to read db.yml with error %s\", err.Error())\n\t}\n\n\tvar configs map[string]DB\n\tif err := yaml.Unmarshal(yamlFile, &configs); err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to parse db.yml with error %s\", err.Error())\n\t}\n\n\tdb, ok := configs[env]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"DB configuration for env %s not found\", env)\n\t}\n\n\tif db.Host == \"\" {\n\t\tdb.Host = \"localhost\"\n\t}\n\n\tif db.SSLMode == \"\" {\n\t\tdb.SSLMode = \"disable\"\n\t}\n\n\treturn &db, nil\n}", "title": "" }, { "docid": "66ba4cca0f1d8566a0821fc1d69b1e5f", "score": "0.6615471", "text": "func NewDB(dsn string, tableName string) (*sql.DB, error) {\n\tif dsn == \"\" {\n\t\treturn nil, errors.New(\"dsn is not provided\")\n\t}\n\tif tableName == \"\" {\n\t\treturn nil, errors.New(\"tableName is not provided\")\n\t}\n\n\tdb, err := sql.Open(\"sqlite3\", dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = db.Exec(MigrateSchema(tableName))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, err\n}", "title": "" }, { "docid": "29f5a12e79487950cdb221786975e56a", "score": "0.6607576", "text": "func NewDB() (*DBIf, error) {\n\n\tpsqlInfo := fmt.Sprintf(\"host=%s port=%d user=%s \"+\"password=%s dbname=%s sslmode=disable\",\n\t\tpgConnHost, pgConnPort, pgConnUser, pgConnPassword, pgConnDBName)\n\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = db.Ping()\n\n\tif err != nil {\n\t\tdb.Close()\n\t\treturn nil, err\n\t}\n\tfmt.Println(\"PGSql:Connection Created\")\n\tdbif := &DBIf{db: db}\n\treturn dbif, nil\n}", "title": "" }, { "docid": "267555a7f314f7510f3305e872fe53db", "score": "0.66074294", "text": "func NewDB(directory string) (*DB, error) {\n\terr := os.MkdirAll(directory, dirPerm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlsm, err := newLSM(directory)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmemtable1, maxCommitTs1, err := newMemTable(directory, \"1\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmemtable2, maxCommitTs2, err := newMemTable(directory, \"2\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmaxCommitTs := maxCommitTs1\n\tif maxCommitTs2 > maxCommitTs {\n\t\tmaxCommitTs = maxCommitTs2\n\t}\n\t// if last committed ts is 0, then there is possibility that immutable flushed\n\t// and mutable did not receive any entries. So need to check all L0 files for last ts\n\tif maxCommitTs == 0 {\n\t\tts, err := lsm.RecoverTS()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmaxCommitTs = ts\n\t}\n\n\tdb := &DB{\n\t\tmutable: memtable1,\n\t\timmutable: memtable2,\n\t\tlsm: lsm,\n\t\tsnaphots: newDoublyLinkedList(),\n\n\t\twriteChan: make(chan *writeRequest),\n\t\tflushChan: make(chan *memTable),\n\t\tclose: make(chan struct{}, 1),\n\t}\n\n\toracle := newOracle(maxCommitTs+1, db)\n\tdb.oracle = oracle\n\n\tgo db.run()\n\tgo db.runFlush()\n\n\treturn db, nil\n}", "title": "" }, { "docid": "0e28530f59a66ad1e0499278ef297ebe", "score": "0.6604787", "text": "func NewDB(username string, password string, database string, hostname string, port string) (*DB, error) {\n\tvar err error\n\n\tdb, err := sql.Open(\"postgres\",\n\t\tfmt.Sprintf(\"postgres://%v:%v@%v:%v/%v?sslmode=disable\", username, password, hostname, port, database))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &DB{db}, nil\n}", "title": "" }, { "docid": "f761f0c16ea8367bda99c396f7fbc6e9", "score": "0.659786", "text": "func NewDatabase() *Database {\n\treturn &Database{\n\t\tTables: make(map[string]*DBTable),\n\t}\n}", "title": "" }, { "docid": "fdbdd4201775febeb349c76349642fa2", "score": "0.65939677", "text": "func NewDb() Db {\n\tconnStr := \"user=postgres password=avitopass dbname=avito sslmode=disable port=5432 host=composepostgres\"\n\tdbCon, err := sql.Open(\"postgres\", connStr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = dbCon.Ping()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn &db{dbCon: dbCon}\n}", "title": "" }, { "docid": "9a15f1d1931e4ed5a9376bc8d209d1b5", "score": "0.65882456", "text": "func NewDatabase(ctx *pulumi.Context,\n\tname string, args *DatabaseArgs, opts ...pulumi.ResourceOption) (*Database, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.CreateStatement == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'CreateStatement'\")\n\t}\n\tif args.InstanceId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'InstanceId'\")\n\t}\n\tvar resource Database\n\terr := ctx.RegisterResource(\"google-native:spanner/v1:Database\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "c49a01e669f184fada138f0dccadbce0", "score": "0.6582147", "text": "func OpenDB(directory string, config DBConfig) (*DB, error) {\n\t// check directory\n\tif directory == \"\" {\n\t\tpanic(\"quasar: missing directory\")\n\t}\n\n\t// ensure directory\n\terr := os.MkdirAll(directory, 0777)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// prepare logger\n\tlogger := &logger{fn: config.Logger}\n\n\t// prepare cache\n\tcache := pebble.NewCache(64 << 20)\n\n\t// open db\n\tpdb, err := pebble.Open(directory, &pebble.Options{\n\t\tCache: cache,\n\t\tMemTableSize: 16 << 20,\n\t\tMemTableStopWritesThreshold: 4,\n\t\tMinFlushRate: 4 << 20,\n\t\tL0CompactionThreshold: 2,\n\t\tL0StopWritesThreshold: 16,\n\t\tLBaseMaxBytes: 16 << 20,\n\t\tLevels: []pebble.LevelOptions{{\n\t\t\tBlockSize: 32 << 10, // 32KB\n\t\t}},\n\t\tLogger: logger,\n\t\tEventListener: pebble.MakeLoggingEventListener(logger),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// create db\n\tdb := &DB{\n\t\tDB: pdb,\n\t\tch: cache,\n\t\two: &pebble.WriteOptions{Sync: config.SyncWrites},\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "f0bc51507aeab29566c3275e341d03a7", "score": "0.65753037", "text": "func NewDB() (*gorm.DB, error) {\n\treturn gorm.Open(mysql.Open(osenv.Get(\"MYSQL_DNS\")), &gorm.Config{})\n}", "title": "" }, { "docid": "be31e8edc0c1d4c7eb2d97d2aa54332f", "score": "0.6568489", "text": "func newMemoryDB() (*DB, error) {\n\tdb, err := leveldb.Open(storage.NewMemStorage(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DB{lvl: db, quit: make(chan struct{})}, nil\n}", "title": "" }, { "docid": "6703179e3710362d45ab9c8867bc1835", "score": "0.6564902", "text": "func OpenDB() (*bolt.DB, error) {\n\tlocalDir, err := state.LocalDirectory()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"bolt: failed to get local directory: %v\", err)\n\t}\n\n\t// Make the local directory if it does not exist.\n\terr = os.MkdirAll(localDir, os.ModePerm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Open / create as 0700 so that we (and only we) have read/write access.\n\treturn bolt.Open(filepath.Join(localDir, \"i3adc.db\"), 0600, &bolt.Options{\n\t\tTimeout: 5 * time.Second,\n\t})\n}", "title": "" }, { "docid": "11e3b5b7ec0d313cd57c372f26c31714", "score": "0.65643966", "text": "func NewDB() (*Db, error) {\n\n\tconnStr := fmt.Sprintf(\n\t\t\"host=%s port=%s user=%s password=%s dbname=%s sslmode=%s\",\n\t\tos.Getenv(\"MUI_THEME_ENV_API_DB_HOST\"),\n\t\tos.Getenv(\"MUI_THEME_ENV_API_DB_PORT\"),\n\t\tos.Getenv(\"MUI_THEME_ENV_API_DB_USER\"),\n\t\tos.Getenv(\"MUI_THEME_ENV_API_DB_PASSWORD\"),\n\t\tos.Getenv(\"MUI_THEME_ENV_API_DB_NAME\"),\n\t\tos.Getenv(\"MUI_THEME_ENV_API_SSL_MODE\"),\n\t)\n\tdb, err := sql.Open(\"postgres\", connStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Db{db}, nil\n}", "title": "" }, { "docid": "5cd732f9fdfa2aa8d70dd6a1651bf1ad", "score": "0.6559501", "text": "func New(config *Config) *Database {\n\n\treturn &Database{config: config}\n\n}", "title": "" }, { "docid": "14f7637b559c01438ba67f3ef5686542", "score": "0.65494394", "text": "func New() (db *sql.DB, err error) {\n\tconfig, err := loadConfig()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error loading config: %v\", err)\n\t}\n\n\tdb, err = initDatabase(config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error initializing DB: %v\", err)\n\t}\n\n\tif err = prepareDatabase(db); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error creating schema and tables, error: %v\", err)\n\t}\n\n\tif err = db.Ping(); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error pinging DB: %v\", err)\n\t}\n\n\treturn db, err\n}", "title": "" }, { "docid": "d5acddd610111b81cd557e2e8eaa6356", "score": "0.6543732", "text": "func NewDatabase() (*Database, error) {\n\tconnStr := fmt.Sprintf(\n\t\t\"host=%s port=%s user=%s password=%s dbname=%s sslmode=%s\",\n\t\tos.Getenv(\"CLOUDKIT_DB_HOST\"),\n\t\tos.Getenv(\"CLOUDKIT_DB_PORT\"),\n\t\tos.Getenv(\"CLOUDKIT_DB_USER\"),\n\t\tos.Getenv(\"CLOUDKIT_DB_PASSWORD\"),\n\t\tos.Getenv(\"CLOUDKIT_DB_NAME\"),\n\t\tos.Getenv(\"CLOUDKIT_SSL_MODE\"),\n\t)\n\tdb, err := sql.Open(\"postgres\", connStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Database{db}, nil\n}", "title": "" }, { "docid": "bcce4a41f9c46761f54df07b9240f8ed", "score": "0.65374357", "text": "func NewDB(config Config) SqlDB {\n\treturn sqlDB{\n\t\tconfig: config,\n\t}\n}", "title": "" } ]
9175654536a7c05b73a322b1aede51bc
UpdateOne returns an update builder for the given entity.
[ { "docid": "a4bca430d9356cbc1e4c71031988719b", "score": "0.6465108", "text": "func (c *JDModelClient) UpdateOne(jm *JDModel) *JDModelUpdateOne {\n\tmutation := newJDModelMutation(c.config, OpUpdateOne, withJDModel(jm))\n\treturn &JDModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" } ]
[ { "docid": "811553d4436f5cb381aa306b7b5c9835", "score": "0.6781803", "text": "func (c *EndWorkClient) UpdateOne(ew *EndWork) *EndWorkUpdateOne {\n\tmutation := newEndWorkMutation(c.config, OpUpdateOne, withEndWork(ew))\n\treturn &EndWorkUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "d2e7846b5ff332d9f8fe04533edef866", "score": "0.6604633", "text": "func (c *DeveloperClient) UpdateOne(d *Developer) *DeveloperUpdateOne {\n\tmutation := newDeveloperMutation(c.config, OpUpdateOne, withDeveloper(d))\n\treturn &DeveloperUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "d814ca4570ca5a2d4918d14d376ec0fe", "score": "0.6544255", "text": "func (b *baseDialect) UpdateOne(ctx context.Context, db Executor, bindType BindVarType, table string, filter interface{}, data interface{}, opts *UpdateOptions) (Result, error) {\n\treturn doUpdate(ctx, db, bindType, table, filter, data, true, opts)\n}", "title": "" }, { "docid": "03ecb5d0cf9fae62682a9e10932cce29", "score": "0.6521206", "text": "func (c *DevelopperClient) UpdateOne(d *Developper) *DevelopperUpdateOne {\n\tmutation := newDevelopperMutation(c.config, OpUpdateOne, withDevelopper(d))\n\treturn &DevelopperUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "a59a0efc28322f7ecbc3bbeaa07bf9ec", "score": "0.65063155", "text": "func (c *SFModelClient) UpdateOne(sm *SFModel) *SFModelUpdateOne {\n\tmutation := newSFModelMutation(c.config, OpUpdateOne, withSFModel(sm))\n\treturn &SFModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "a645c079db9e49a67126dab8e30ca9f2", "score": "0.6488436", "text": "func (c *CompanyClient) UpdateOne(co *Company) *CompanyUpdateOne {\n\tmutation := newCompanyMutation(c.config, OpUpdateOne, withCompany(co))\n\treturn &CompanyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "a645c079db9e49a67126dab8e30ca9f2", "score": "0.6488436", "text": "func (c *CompanyClient) UpdateOne(co *Company) *CompanyUpdateOne {\n\tmutation := newCompanyMutation(c.config, OpUpdateOne, withCompany(co))\n\treturn &CompanyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "a873be680ca29e5dec634d8a28f05950", "score": "0.64580745", "text": "func (c *PostClient) UpdateOne(po *Post) *PostUpdateOne {\n\tmutation := newPostMutation(c.config, OpUpdateOne, withPost(po))\n\treturn &PostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "3f97fa4310c7393043dcadbf9dd0ecf5", "score": "0.64320177", "text": "func (c *WidgetClient) UpdateOne(w *Widget) *WidgetUpdateOne {\n\tmutation := newWidgetMutation(c.config, OpUpdateOne, withWidget(w))\n\treturn &WidgetUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "fd7b72ca36d770e1e34bbada01a73437", "score": "0.64137715", "text": "func (c *GiveawayClient) UpdateOne(gi *Giveaway) *GiveawayUpdateOne {\n\tmutation := newGiveawayMutation(c.config, OpUpdateOne, withGiveaway(gi))\n\treturn &GiveawayUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "5dc61865a42746d4adc0499467e48a41", "score": "0.64088744", "text": "func (c *QQModelClient) UpdateOne(qm *QQModel) *QQModelUpdateOne {\n\tmutation := newQQModelMutation(c.config, OpUpdateOne, withQQModel(qm))\n\treturn &QQModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "49ae9eafdd66afe6aeba74fd71748f89", "score": "0.6407116", "text": "func (c *DrugAllergyClient) UpdateOne(da *DrugAllergy) *DrugAllergyUpdateOne {\n\tmutation := newDrugAllergyMutation(c.config, OpUpdateOne, withDrugAllergy(da))\n\treturn &DrugAllergyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "1c8bb350d259273d1ce6f3db84fb372b", "score": "0.6382365", "text": "func (c *WorkflowClient) UpdateOne(w *Workflow) *WorkflowUpdateOne {\n\tmutation := newWorkflowMutation(c.config, OpUpdateOne, withWorkflow(w))\n\treturn &WorkflowUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "15fd612cc3951a0f573ac27f4d0931e2", "score": "0.6348345", "text": "func (c *OrderClient) UpdateOne(o *Order) *OrderUpdateOne {\n\tmutation := newOrderMutation(c.config, OpUpdateOne, withOrder(o))\n\treturn &OrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "3684a6cfa9d11607b09918c29a59ec4c", "score": "0.634611", "text": "func (c *ContactClient) UpdateOne(co *Contact) *ContactUpdateOne {\n\tmutation := newContactMutation(c.config, OpUpdateOne, withContact(co))\n\treturn &ContactUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "e66ad2e23d573b82601146123bf43327", "score": "0.6339203", "text": "func (c *DRoomClient) UpdateOne(d *DRoom) *DRoomUpdateOne {\n\tmutation := newDRoomMutation(c.config, OpUpdateOne, withDRoom(d))\n\treturn &DRoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "54385e49edf9f3671be0739d309ecc3d", "score": "0.6337983", "text": "func (c *WorkflowEventsClient) UpdateOne(we *WorkflowEvents) *WorkflowEventsUpdateOne {\n\tmutation := newWorkflowEventsMutation(c.config, OpUpdateOne, withWorkflowEvents(we))\n\treturn &WorkflowEventsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "922c15045e8e7255dea0a0e965a0da87", "score": "0.6325927", "text": "func (c *MedicineClient) UpdateOne(m *Medicine) *MedicineUpdateOne {\n\tmutation := newMedicineMutation(c.config, OpUpdateOne, withMedicine(m))\n\treturn &MedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "bcc1bda806b62d21be8f27004a916a9d", "score": "0.631989", "text": "func (c *DoctorClient) UpdateOne(d *Doctor) *DoctorUpdateOne {\n\tmutation := newDoctorMutation(c.config, OpUpdateOne, withDoctor(d))\n\treturn &DoctorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "fc81298d47e3758106058c4dde4a98a8", "score": "0.62957007", "text": "func (c *TypeproductClient) UpdateOne(t *Typeproduct) *TypeproductUpdateOne {\n\tmutation := newTypeproductMutation(c.config, OpUpdateOne, withTypeproduct(t))\n\treturn &TypeproductUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "eb5bb101cfda1ba930c76cfe0b498fbe", "score": "0.6285851", "text": "func (c *AssessmentClient) UpdateOne(a *Assessment) *AssessmentUpdateOne {\n\tmutation := newAssessmentMutation(c.config, OpUpdateOne, withAssessment(a))\n\treturn &AssessmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "4bc17ce8944fefe65206ef726013d17f", "score": "0.62849885", "text": "func (c *WorkflowInstanceClient) UpdateOne(wi *WorkflowInstance) *WorkflowInstanceUpdateOne {\n\tmutation := newWorkflowInstanceMutation(c.config, OpUpdateOne, withWorkflowInstance(wi))\n\treturn &WorkflowInstanceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "15e021d06d16a6589f18dd9d827e4c14", "score": "0.62710464", "text": "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "15e021d06d16a6589f18dd9d827e4c14", "score": "0.62710464", "text": "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "75a83f89092029c16ab962a012e08c62", "score": "0.6268299", "text": "func (c *StartWorkClient) UpdateOne(sw *StartWork) *StartWorkUpdateOne {\n\tmutation := newStartWorkMutation(c.config, OpUpdateOne, withStartWork(sw))\n\treturn &StartWorkUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "d96f76324e41492e9c0785698700be0d", "score": "0.62669396", "text": "func (c *WidgetTypeClient) UpdateOne(wt *WidgetType) *WidgetTypeUpdateOne {\n\tmutation := newWidgetTypeMutation(c.config, OpUpdateOne, withWidgetType(wt))\n\treturn &WidgetTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "2b02285c993c79cbec98976311012436", "score": "0.6251943", "text": "func (o *Opt) Update() *OptUpdateOne {\n\treturn (&OptClient{config: o.config}).UpdateOne(o)\n}", "title": "" }, { "docid": "4cf559ba5057323ad0115ab37876c059", "score": "0.62249064", "text": "func (c *RestaurantClient) UpdateOne(r *Restaurant) *RestaurantUpdateOne {\n\tmutation := newRestaurantMutation(c.config, OpUpdateOne, withRestaurant(r))\n\treturn &RestaurantUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "e9d457af39e427933605d90d3895f2a5", "score": "0.6221794", "text": "func (c *TestClient) UpdateOne(t *Test) *TestUpdateOne {\n\tmutation := newTestMutation(c.config, OpUpdateOne, withTest(t))\n\treturn &TestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "62af8fd779f5bec3eaffc3bf307da3ec", "score": "0.6219747", "text": "func (c *DeviceClient) UpdateOne(d *Device) *DeviceUpdateOne {\n\treturn c.UpdateOneID(d.ID)\n}", "title": "" }, { "docid": "9157e4646a7f0ac019125f105e7501a4", "score": "0.6219627", "text": "func (c *PromotionClient) UpdateOne(pr *Promotion) *PromotionUpdateOne {\n\tmutation := newPromotionMutation(c.config, OpUpdateOne, withPromotion(pr))\n\treturn &PromotionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "66d58eaf72b086b65c58e8dbc9268ddd", "score": "0.62172455", "text": "func (c *OrderproductClient) UpdateOne(o *Orderproduct) *OrderproductUpdateOne {\n\tmutation := newOrderproductMutation(c.config, OpUpdateOne, withOrderproduct(o))\n\treturn &OrderproductUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "bfa95483cd0314557682a24ec85e2a61", "score": "0.6203078", "text": "func (c *CompetenceClient) UpdateOne(co *Competence) *CompetenceUpdateOne {\n\tmutation := newCompetenceMutation(c.config, OpUpdateOne, withCompetence(co))\n\treturn &CompetenceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "ad7f79ea7897ad9beca884a4fed5a5e2", "score": "0.6198164", "text": "func (c *ArticleClient) UpdateOne(a *Article) *ArticleUpdateOne {\n\tmutation := newArticleMutation(c.config, OpUpdateOne, withArticle(a))\n\treturn &ArticleUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "fa65b229eced1372127676dd4bc35f63", "score": "0.61927545", "text": "func (c *SysMenuActionClient) UpdateOne(sma *SysMenuAction) *SysMenuActionUpdateOne {\n\tmutation := newSysMenuActionMutation(c.config, OpUpdateOne, withSysMenuAction(sma))\n\treturn &SysMenuActionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "bfddc188fe1b043c25a2ba16c7cdda16", "score": "0.61863756", "text": "func (c *ManagerClient) UpdateOne(m *Manager) *ManagerUpdateOne {\n\tmutation := newManagerMutation(c.config, OpUpdateOne, withManager(m))\n\treturn &ManagerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "e9272efc84d751406d0226d84c6b5df3", "score": "0.6178261", "text": "func (c *RecruitmentClient) UpdateOne(r *Recruitment) *RecruitmentUpdateOne {\n\tmutation := newRecruitmentMutation(c.config, OpUpdateOne, withRecruitment(r))\n\treturn &RecruitmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "8ab1ce29adfd2052615e7cc12c9e8285", "score": "0.61778814", "text": "func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne {\n\tmutation := newTagMutation(c.config, OpUpdateOne, withTag(t))\n\treturn &TagUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "8ab1ce29adfd2052615e7cc12c9e8285", "score": "0.61778814", "text": "func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne {\n\tmutation := newTagMutation(c.config, OpUpdateOne, withTag(t))\n\treturn &TagUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "8ab1ce29adfd2052615e7cc12c9e8285", "score": "0.61778814", "text": "func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne {\n\tmutation := newTagMutation(c.config, OpUpdateOne, withTag(t))\n\treturn &TagUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "b1fa2490224bab827d5bd72b12f748a8", "score": "0.6173971", "text": "func (c *PostClient) UpdateOne(po *Post) *PostUpdateOne {\n\treturn c.UpdateOneID(po.ID)\n}", "title": "" }, { "docid": "b40c453bb6a48ca0a0a483f90c48fa44", "score": "0.6173589", "text": "func (c *ContagiousClient) UpdateOne(co *Contagious) *ContagiousUpdateOne {\n\tmutation := newContagiousMutation(c.config, OpUpdateOne, withContagious(co))\n\treturn &ContagiousUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "561598f91fc379ee6391a80f8442b4d3", "score": "0.6172441", "text": "func (c *DomainClient) UpdateOne(d *Domain) *DomainUpdateOne {\n\treturn c.UpdateOneID(d.ID)\n}", "title": "" }, { "docid": "42300e17e29927e8920f71d9e3098283", "score": "0.61704266", "text": "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "42300e17e29927e8920f71d9e3098283", "score": "0.61704266", "text": "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "42300e17e29927e8920f71d9e3098283", "score": "0.61704266", "text": "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "6b12a50331bc90dd979426014da05def", "score": "0.6158959", "text": "func (c *RoomClient) UpdateOne(r *Room) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoom(r))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "a4bb2387a40dbf37ab32f9c60f9f69a4", "score": "0.61498356", "text": "func (c *SysMenuActionResourceClient) UpdateOne(smar *SysMenuActionResource) *SysMenuActionResourceUpdateOne {\n\tmutation := newSysMenuActionResourceMutation(c.config, OpUpdateOne, withSysMenuActionResource(smar))\n\treturn &SysMenuActionResourceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "e76851a38070f8bf7e73117604119b61", "score": "0.614649", "text": "func (c *DiseaseClient) UpdateOne(d *Disease) *DiseaseUpdateOne {\n\tmutation := newDiseaseMutation(c.config, OpUpdateOne, withDisease(d))\n\treturn &DiseaseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "eadaf9c5939412f9458aaa79c96bcbe5", "score": "0.6144882", "text": "func (c *AchievementClient) UpdateOne(a *Achievement) *AchievementUpdateOne {\n\tmutation := newAchievementMutation(c.config, OpUpdateOne, withAchievement(a))\n\treturn &AchievementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "1fa4644d9733872a27ebeba848a8462d", "score": "0.6135769", "text": "func (b *Bill) Update() *BillUpdateOne {\n\treturn (&BillClient{config: b.config}).UpdateOne(b)\n}", "title": "" }, { "docid": "1243b8c27ba7b25a1950a2a9b3c9564a", "score": "0.61290807", "text": "func (c *CompanyUserClient) UpdateOne(cu *CompanyUser) *CompanyUserUpdateOne {\n\tmutation := newCompanyUserMutation(c.config, OpUpdateOne, withCompanyUser(cu))\n\treturn &CompanyUserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "6e163933b9e7837a4d4db044a0efac87", "score": "0.61277145", "text": "func (c *SysDictItemClient) UpdateOne(sdi *SysDictItem) *SysDictItemUpdateOne {\n\tmutation := newSysDictItemMutation(c.config, OpUpdateOne, withSysDictItem(sdi))\n\treturn &SysDictItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "b6c0a4beb726b844ddb4fc0e01dfcde2", "score": "0.6127252", "text": "func (c *DChatClient) UpdateOne(d *DChat) *DChatUpdateOne {\n\tmutation := newDChatMutation(c.config, OpUpdateOne, withDChat(d))\n\treturn &DChatUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "1b1dbb3186a7bfb4ec6ac9b32e246211", "score": "0.61236316", "text": "func (c *PredicamentClient) UpdateOne(pr *Predicament) *PredicamentUpdateOne {\n\tmutation := newPredicamentMutation(c.config, OpUpdateOne, withPredicament(pr))\n\treturn &PredicamentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "069faea2db623ef76a5e26484e22febf", "score": "0.6122949", "text": "func (c *TagsClient) UpdateOne(t *Tags) *TagsUpdateOne {\n\tmutation := newTagsMutation(c.config, OpUpdateOne, withTags(t))\n\treturn &TagsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "4c63d85855d7c00a7adc970d77c8926d", "score": "0.6121328", "text": "func (c *MannerClient) UpdateOne(m *Manner) *MannerUpdateOne {\n\tmutation := newMannerMutation(c.config, OpUpdateOne, withManner(m))\n\treturn &MannerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "258f7b370d25ccf4ef3fc9e858a45fd6", "score": "0.6120872", "text": "func (c *EmployeeWorkingHoursClient) UpdateOne(ewh *EmployeeWorkingHours) *EmployeeWorkingHoursUpdateOne {\n\tmutation := newEmployeeWorkingHoursMutation(c.config, OpUpdateOne, withEmployeeWorkingHours(ewh))\n\treturn &EmployeeWorkingHoursUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "86f81a8a315a684a3f7364794760be5e", "score": "0.61178434", "text": "func (c *AnswerClient) UpdateOne(a *Answer) *AnswerUpdateOne {\n\treturn c.UpdateOneID(a.ID)\n}", "title": "" }, { "docid": "473ae0d1ade11db817718df81378aa3f", "score": "0.6110945", "text": "func (c *StatisticClient) UpdateOne(s *Statistic) *StatisticUpdateOne {\n\tmutation := newStatisticMutation(c.config, OpUpdateOne, withStatistic(s))\n\treturn &StatisticUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "473ae0d1ade11db817718df81378aa3f", "score": "0.6110945", "text": "func (c *StatisticClient) UpdateOne(s *Statistic) *StatisticUpdateOne {\n\tmutation := newStatisticMutation(c.config, OpUpdateOne, withStatistic(s))\n\treturn &StatisticUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "76f8e9568047b3b46649fcc8ff49bca8", "score": "0.61103284", "text": "func UpdateOne(query interface{}, update interface{}) error {\n\treturn db.Update(\n\t\tCollection,\n\t\tquery,\n\t\tupdate,\n\t)\n}", "title": "" }, { "docid": "3e06f367f7f20e90f4861630a6fa6d28", "score": "0.60996544", "text": "func (c *ProductClient) UpdateOne(pr *Product) *ProductUpdateOne {\n\tmutation := newProductMutation(c.config, OpUpdateOne, withProduct(pr))\n\treturn &ProductUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "3e06f367f7f20e90f4861630a6fa6d28", "score": "0.60996544", "text": "func (c *ProductClient) UpdateOne(pr *Product) *ProductUpdateOne {\n\tmutation := newProductMutation(c.config, OpUpdateOne, withProduct(pr))\n\treturn &ProductUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "f902f2cd0c41632250f7d3f61002b90d", "score": "0.609321", "text": "func (c *LevelClient) UpdateOne(l *Level) *LevelUpdateOne {\n\tmutation := newLevelMutation(c.config, OpUpdateOne, withLevel(l))\n\treturn &LevelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "0e3d3aa9fa6d17f7dda65c3cf745a5a0", "score": "0.60883147", "text": "func (c *CommentClient) UpdateOne(co *Comment) *CommentUpdateOne {\n\tmutation := newCommentMutation(c.config, OpUpdateOne, withComment(co))\n\treturn &CommentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "0e3d3aa9fa6d17f7dda65c3cf745a5a0", "score": "0.60883147", "text": "func (c *CommentClient) UpdateOne(co *Comment) *CommentUpdateOne {\n\tmutation := newCommentMutation(c.config, OpUpdateOne, withComment(co))\n\treturn &CommentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "65588243583f25e96aca75f0d729ddc1", "score": "0.6081462", "text": "func (c *SysMenuClient) UpdateOne(sm *SysMenu) *SysMenuUpdateOne {\n\tmutation := newSysMenuMutation(c.config, OpUpdateOne, withSysMenu(sm))\n\treturn &SysMenuUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "ead7fe1363f4fbfcbb83f38ddb7bfce1", "score": "0.6077914", "text": "func (c *SurveyClient) UpdateOne(s *Survey) *SurveyUpdateOne {\n\treturn c.UpdateOneID(s.ID)\n}", "title": "" }, { "docid": "0c78d1740942301ba1378554739e2f16", "score": "0.6076481", "text": "func (po *Post) Update() *PostUpdateOne {\n\treturn (&PostClient{config: po.config}).UpdateOne(po)\n}", "title": "" }, { "docid": "0c78d1740942301ba1378554739e2f16", "score": "0.6076481", "text": "func (po *Post) Update() *PostUpdateOne {\n\treturn (&PostClient{config: po.config}).UpdateOne(po)\n}", "title": "" }, { "docid": "0c78d1740942301ba1378554739e2f16", "score": "0.6076481", "text": "func (po *Post) Update() *PostUpdateOne {\n\treturn (&PostClient{config: po.config}).UpdateOne(po)\n}", "title": "" }, { "docid": "4ec5781da829fdc1e12f97ed5be3f6f8", "score": "0.607597", "text": "func (c *JobClient) UpdateOne(j *Job) *JobUpdateOne {\n\tmutation := newJobMutation(c.config, OpUpdateOne, withJob(j))\n\treturn &JobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "7d72b6b26b3db8df0506109078a8d471", "score": "0.6070833", "text": "func (c *ImageRepoClient) UpdateOne(ir *ImageRepo) *ImageRepoUpdateOne {\n\tmutation := newImageRepoMutation(c.config, OpUpdateOne, withImageRepo(ir))\n\treturn &ImageRepoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "a51285e1b7fe837ddfc5ca877829f200", "score": "0.60665554", "text": "func (c *SysUserClient) UpdateOne(su *SysUser) *SysUserUpdateOne {\n\tmutation := newSysUserMutation(c.config, OpUpdateOne, withSysUser(su))\n\treturn &SysUserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "c32459f081b5169cb22cd9943cf218fa", "score": "0.6064432", "text": "func (c *RoomTypeClient) UpdateOne(rt *RoomType) *RoomTypeUpdateOne {\n\tmutation := newRoomTypeMutation(c.config, OpUpdateOne, withRoomType(rt))\n\treturn &RoomTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "400b9f008617956dd3f35d1ad1afd76d", "score": "0.6044985", "text": "func (c *SkillClient) UpdateOne(s *Skill) *SkillUpdateOne {\n\tmutation := newSkillMutation(c.config, OpUpdateOne, withSkill(s))\n\treturn &SkillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "75991b3f60f25b9b1934b2a978b9d35d", "score": "0.60371214", "text": "func (c *DayClient) UpdateOne(d *Day) *DayUpdateOne {\n\tmutation := newDayMutation(c.config, OpUpdateOne, withDay(d))\n\treturn &DayUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "b1b8187f4cb4717c006ae045238621c4", "score": "0.6020407", "text": "func (c *OrderonlineClient) UpdateOne(o *Orderonline) *OrderonlineUpdateOne {\n\tmutation := newOrderonlineMutation(c.config, OpUpdateOne, withOrderonline(o))\n\treturn &OrderonlineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "d713fb3353f3e8827ea396ddb2449b8f", "score": "0.6016702", "text": "func (e *Event) Update() *EventUpdateOne {\n\treturn (&EventClient{config: e.config}).UpdateOne(e)\n}", "title": "" }, { "docid": "d931c2356eaa16634520544a0fb8ae6c", "score": "0.60131365", "text": "func (c *ShortClient) UpdateOne(s *Short) *ShortUpdateOne {\n\treturn c.UpdateOneID(s.ID)\n}", "title": "" }, { "docid": "de12fc8a999e3900ed76e34459cd5f0e", "score": "0.60022384", "text": "func NewUpdateOneModel() *UpdateOneModel {\n\treturn &UpdateOneModel{}\n}", "title": "" }, { "docid": "9d078f47ee22b08bba39541b63cda40d", "score": "0.59969485", "text": "func (c *CommentsClient) UpdateOne(co *Comments) *CommentsUpdateOne {\n\tmutation := newCommentsMutation(c.config, OpUpdateOne, withComments(co))\n\treturn &CommentsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "700836fc061b172c2e759023b67c161b", "score": "0.5993479", "text": "func (c *QuestionClient) UpdateOne(q *Question) *QuestionUpdateOne {\n\treturn c.UpdateOneID(q.ID)\n}", "title": "" }, { "docid": "faea6682227c7d211be45a0562a94882", "score": "0.5989615", "text": "func (c *AreaClient) UpdateOne(a *Area) *AreaUpdateOne {\n\tmutation := newAreaMutation(c.config, OpUpdateOne, withArea(a))\n\treturn &AreaUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "faea6682227c7d211be45a0562a94882", "score": "0.5989615", "text": "func (c *AreaClient) UpdateOne(a *Area) *AreaUpdateOne {\n\tmutation := newAreaMutation(c.config, OpUpdateOne, withArea(a))\n\treturn &AreaUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "08def949be4ec4ae9030e093bddeb9cd", "score": "0.5988705", "text": "func (c *UserTypeClient) UpdateOne(ut *UserType) *UserTypeUpdateOne {\n\tmutation := newUserTypeMutation(c.config, OpUpdateOne, withUserType(ut))\n\treturn &UserTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "55e02822e1b870e719e96b52159c8d2d", "score": "0.59886724", "text": "func (c *DChessdbCacheClient) UpdateOne(dc *DChessdbCache) *DChessdbCacheUpdateOne {\n\tmutation := newDChessdbCacheMutation(c.config, OpUpdateOne, withDChessdbCache(dc))\n\treturn &DChessdbCacheUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "6ed9963b3eb4256b47cf765c3d957557", "score": "0.5987329", "text": "func (c *WorkflowEventsWaitClient) UpdateOne(wew *WorkflowEventsWait) *WorkflowEventsWaitUpdateOne {\n\tmutation := newWorkflowEventsWaitMutation(c.config, OpUpdateOne, withWorkflowEventsWait(wew))\n\treturn &WorkflowEventsWaitUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "fb64f0c4f3aab02d42073ca62fc36501", "score": "0.5985089", "text": "func (c *OtherTestClient) UpdateOne(ot *OtherTest) *OtherTestUpdateOne {\n\tmutation := newOtherTestMutation(c.config, OpUpdateOne, withOtherTest(ot))\n\treturn &OtherTestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "ec26197a504bf21344d87a20bd26fd10", "score": "0.5976448", "text": "func (f *Form) Update() *FormUpdateOne {\n\treturn (&FormClient{config: f.config}).UpdateOne(f)\n}", "title": "" }, { "docid": "934fabe6f532e4cf8ec38027cd30734a", "score": "0.5973638", "text": "func (c *SysJwtBlockClient) UpdateOne(sjb *SysJwtBlock) *SysJwtBlockUpdateOne {\n\tmutation := newSysJwtBlockMutation(c.config, OpUpdateOne, withSysJwtBlock(sjb))\n\treturn &SysJwtBlockUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "804ed11162e6df2edfee14b05897172e", "score": "0.59651124", "text": "func (c *InputClient) UpdateOne(i *Input) *InputUpdateOne {\n\treturn c.UpdateOneID(i.ID)\n}", "title": "" }, { "docid": "665f1585dff31a584f3f35e2207f5e02", "score": "0.59586173", "text": "func (c *ForumClient) UpdateOne(f *Forum) *ForumUpdateOne {\n\tmutation := newForumMutation(c.config, OpUpdateOne, withForum(f))\n\treturn &ForumUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "1dc5d508482097cdd5ee3441ff41e04e", "score": "0.59526086", "text": "func (c *ExperienceClient) UpdateOne(e *Experience) *ExperienceUpdateOne {\n\tmutation := newExperienceMutation(c.config, OpUpdateOne, withExperience(e))\n\treturn &ExperienceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "d99fd5e11ef391b1accbfb16209dfbef", "score": "0.5950678", "text": "func (c *ContactClient) UpdateOne(co *Contact) *ContactUpdateOne {\n\treturn c.UpdateOneID(co.ID)\n}", "title": "" }, { "docid": "da0fe1240e5a039f15db3e5ad84c08ca", "score": "0.5947419", "text": "func (c *PaymentchannelClient) UpdateOne(pa *Paymentchannel) *PaymentchannelUpdateOne {\n\tmutation := newPaymentchannelMutation(c.config, OpUpdateOne, withPaymentchannel(pa))\n\treturn &PaymentchannelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "19b4de041d66a85947c12d4b37d1818c", "score": "0.59466064", "text": "func (c *SalaryClient) UpdateOne(s *Salary) *SalaryUpdateOne {\n\tmutation := newSalaryMutation(c.config, OpUpdateOne, withSalary(s))\n\treturn &SalaryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "c25aa3a9c62d802ea9a0ace83a37a601", "score": "0.5940901", "text": "func (c *ImageClient) UpdateOne(i *Image) *ImageUpdateOne {\n\tmutation := newImageMutation(c.config, OpUpdateOne, withImage(i))\n\treturn &ImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "5d0a3cf7db611e3e5c4ef3799b07bb15", "score": "0.59354943", "text": "func (r *InvestmentRepo) UpdateOne(id string, toUpdate Investment) (Investment,\n error) {\n\tbsonId := bson.ObjectIdHex(id)\n\tif toUpdate.Fields == nil {\n\t\ttoUpdate.Fields = make(map[string]interface{})\n\t}\n\n err := r.Collection.UpdateId(bsonId, toUpdate);\n\tif err != nil {\n\t\treturn Investment{}, err\n\t}\n\n\treturn toUpdate, nil\n}", "title": "" } ]
446fdef0125ab505355f1bd044ac6ab1
Key function returns key value.
[ { "docid": "4232c84ef4a12d6026cd4fa69d70c39d", "score": "0.0", "text": "func (e GetRoleListResponseValidationError) Key() bool { return e.key }", "title": "" } ]
[ { "docid": "f839052724327da43ec33cb11b004a30", "score": "0.75885636", "text": "func (f stringLikeFunc) key() Key {\n\treturn f.k\n}", "title": "" }, { "docid": "7326b47ec7fad1239fc3dc6fc00b5d20", "score": "0.7114486", "text": "func (d dbVal) key() string{\n\treturn string(d.k)\n}", "title": "" }, { "docid": "a596d7776419fc1f817669ab07dfcc17", "score": "0.68720675", "text": "func (v keyValue) key() interface{} {\n\treturn v.k\n}", "title": "" }, { "docid": "b179c93dcdf5cffbd595024c01b75551", "score": "0.6852386", "text": "func (i *Iterator[K, V, Aux, A, AP]) Key() K {\n\treturn i.keys[i.pos]\n}", "title": "" }, { "docid": "738c91e532bfb6060d3c8b32093f3e22", "score": "0.67663246", "text": "func (m *KeyUint) Key() driver.Value {\n\treturn driver.Value(m.ID)\n}", "title": "" }, { "docid": "2a069427e76da26f26d1a823005eebdf", "score": "0.67357004", "text": "func (a AlphaNumeric) GetKey() string {\n\treturn a.Key\n}", "title": "" }, { "docid": "6a12546ab47b5c1ad3198af4d28295f5", "score": "0.6697428", "text": "func GetKey(mp map[int]string, givenValue string) int {\n\tfor key, value := range mp {\n\t\tif value == givenValue {\n\t\t\treturn key\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "8a395027406a586a481914221dbc9b01", "score": "0.668372", "text": "func Key(m interface{}) interface{} { return randKey(m, cRandInt) }", "title": "" }, { "docid": "86af75ff044fbf58e6f9c2cbcfd942bb", "score": "0.66588765", "text": "func getValueKey(s []string, c string) int {\n\tfor k, v := range s {\n\t\tif v == c {\n\t\t\treturn k\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "612fefb3eef1c872caeab808fda0bdb0", "score": "0.66479045", "text": "func (m Match) GetKey() string {\n\treturn m.Key\n}", "title": "" }, { "docid": "cd3bd4e8a9cbd4e1bf8d1477eeccca6d", "score": "0.66223323", "text": "func (a Alpha) GetKey() string {\n\treturn a.Key\n}", "title": "" }, { "docid": "2b213bd59c842706346d25ebddf53e6b", "score": "0.6593437", "text": "func getKey(obj metav1.Object, t *testing.T) string {\n\tkey, err := controller.KeyFunc(obj)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error getting key for resource %v: %v\", obj.GetName(), err)\n\t\treturn \"\"\n\t}\n\treturn key\n}", "title": "" }, { "docid": "d9731d9656b632e02981c3bb94415e04", "score": "0.6585843", "text": "func (m MACAddr) Key() string {\n\treturn string(m[:])\n}", "title": "" }, { "docid": "b943cb274323bf8f5774ed1985cf0ce4", "score": "0.6577177", "text": "func (o *Facts) GetKey() string {\n\tif o == nil || IsNil(o.Key) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "title": "" }, { "docid": "d9937bb12d491801de5d228495ad33b0", "score": "0.65590775", "text": "func (f numericLessThanFunc) key() Key {\n\treturn f.k\n}", "title": "" }, { "docid": "13634f2d629d7f2bcc336b8cd1d6347c", "score": "0.655557", "text": "func (n *Node) GetKey() float32 {\n\treturn n.key\n}", "title": "" }, { "docid": "037c9eb46dfd07d0e40edd7c02561591", "score": "0.6546226", "text": "func stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(objectEntry).key\n\treturn key, nil\n}", "title": "" }, { "docid": "3533d8501664650f6437b62e7d8ab8d4", "score": "0.65316856", "text": "func (it *chainIter[K, V, H]) key() K {\n\treturn it.b.key[it.ib]\n}", "title": "" }, { "docid": "f3bd0087b49d8aaa0a076a1214fb27a5", "score": "0.65268946", "text": "func (n NoMatch) GetKey() string {\n\treturn n.Key\n}", "title": "" }, { "docid": "c1fa595f31307a7ef468c254e330073a", "score": "0.65227526", "text": "func GetKey(allkeys []string, loc Where) string {\n\tif loc == Left {\n\t\treturn allkeys[0]\n\t}\n\tif loc == Right {\n\t\treturn allkeys[len(allkeys)-1]\n\t}\n\t// select a random index between 1 and allkeys-2\n\tidx := unsafe.NewRand().Int()%(len(allkeys)-2) + 1\n\treturn allkeys[idx]\n}", "title": "" }, { "docid": "3442ab6f273d53ac292fb4b557244cab", "score": "0.6499769", "text": "func (n Numeric) GetKey() string {\n\treturn n.Key\n}", "title": "" }, { "docid": "67792a395a04e1af3e63b054b1080998", "score": "0.6489056", "text": "func (d *Stats) KeyVal() string {\n\treturn d.ID\n}", "title": "" }, { "docid": "031dae71ee3017c469fbc739e879a929", "score": "0.6485388", "text": "func (m Min) GetKey() string {\n\treturn m.Key\n}", "title": "" }, { "docid": "5ea864bf2cb37901dd33b8a25522d698", "score": "0.6451214", "text": "func (mapping *DNSMapping) GetKey() []byte {\n\treturn []byte(mapping.Name + mapping.IP.String())\n}", "title": "" }, { "docid": "1be243b7b4413254822828286c2290b4", "score": "0.64501834", "text": "func (i KeyValIterator) Key() []byte {\n\treturn i.key\n}", "title": "" }, { "docid": "c6eac4fd7b3b8699d9e77934006470d6", "score": "0.64488065", "text": "func (_ KVPairStringAliases) Key(p graphql.ResolveParams) (string, error) {\n\tval, err := graphql.DefaultResolver(p.Source, p.Info.FieldName)\n\tret, ok := val.(string)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif !ok {\n\t\treturn ret, errors.New(\"unable to coerce value for field 'key'\")\n\t}\n\treturn ret, err\n}", "title": "" }, { "docid": "8f42856c5526858a3829519858c56546", "score": "0.6448241", "text": "func stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*nodeidentity.Info).InstanceID\n\treturn key, nil\n}", "title": "" }, { "docid": "605a23a9681d08128683dc65f91ec960", "score": "0.64470667", "text": "func (p4 *impl) KeyGet(key string) (string, error) {\n\tcb := keycb{}\n\terr := p4.runCmdCb(&cb, \"key\", key)\n\tif err != nil {\n\t\treturn \"0\", err\n\t}\n\tif v, ok := cb[key]; ok {\n\t\treturn v, nil\n\t}\n\treturn \"0\", ErrKeyNotFound\n}", "title": "" }, { "docid": "d864da1fd1111311e850ef167ed727f4", "score": "0.6431529", "text": "func getKey(name, namespace string) string {\n\treturn fmt.Sprintf(\"%s/%s\", name, namespace)\n}", "title": "" }, { "docid": "67bef58f6e77ca86bd9629dc74cdd3cc", "score": "0.6423325", "text": "func (m *Map) Key() Type { return m.key }", "title": "" }, { "docid": "17c812e30897152fb3e5783c7499a5f2", "score": "0.6415269", "text": "func (diane Diane) Key() string {\n\treturn diane.NumeroSiren\n}", "title": "" }, { "docid": "33b8526055d489e7d63daed8e142e46f", "score": "0.64138", "text": "func (l Length) GetKey() string {\n\treturn l.Key\n}", "title": "" }, { "docid": "e07fd8d4339d29e31aff52d1e171ec23", "score": "0.6405272", "text": "func (it *Iterator) Key() []byte {\n\tkvitem := it.it.Item()\n\treturn kvitem.Key()\n}", "title": "" }, { "docid": "5f4707f1578edf785c8274a4db7776e9", "score": "0.6403367", "text": "func (c Group) Get(key string) string { return c[key] }", "title": "" }, { "docid": "b9ff0011ce9d61aae0306a16e66a4d33", "score": "0.63734704", "text": "func (i *Input) GetKey() string {\n\treturn fmt.Sprintf(\"%d:%d:%d\", i.BlockIndex, i.TxIndex, i.OutputIndex)\n}", "title": "" }, { "docid": "dc0d07913b25f19a6edccff33cf74913", "score": "0.6367644", "text": "func (a AlphaDash) GetKey() string {\n\treturn a.Key\n}", "title": "" }, { "docid": "f9b1774c57f49e3811c87549d6026dfa", "score": "0.6366343", "text": "func (o *V1MatchExpression) GetKey() string {\n\tif o == nil || o.Key == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "title": "" }, { "docid": "206589d6d20f65f21f1867e5f0534de6", "score": "0.63598573", "text": "func (it *StoreIterator) Key() string {\n\treturn it.keys[it.pos]\n}", "title": "" }, { "docid": "8b8fa7ccb1c1237e19a131ece9d71082", "score": "0.63402766", "text": "func GetKeyForInt(integer int) string {\n\treturn DefaultConverter.GetKey(integer)\n}", "title": "" }, { "docid": "7d1ea5b23be3ec61f57ec6a80d020666", "score": "0.63352305", "text": "func (node *Node) GetKey(ctx context.Context, key *gmajpb.Key) (*gmajpb.Val, error) {\n\tval, err := node.getKey(key.Key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &gmajpb.Val{Val: val}, nil\n}", "title": "" }, { "docid": "8c7d80f7676601ea6fa0c8355335b6e7", "score": "0.63284117", "text": "func (entry *Entry) GetKey() Comparator {\n\treturn entry.key\n}", "title": "" }, { "docid": "c61697852cdd8ddb8b40c48f18c5fb9b", "score": "0.6327199", "text": "func (graph *Graph) getKey(node *Node) (key string) {\n for key ,val := range graph.Nodes{\n if(val == node){\n return key\n }\n }\n \n return \"ERROR\"\n}", "title": "" }, { "docid": "969edf5976fffb5b614ef8e8acea6b75", "score": "0.63261014", "text": "func (s *Series) Key(v string) string {\n\treturn strings.Replace(strings.ToLower(v), \" \", \"-\", -1)\n}", "title": "" }, { "docid": "b1291dd3360c3492d4712c8e667a645a", "score": "0.6322614", "text": "func (bi *BoundInt) Key() string {\n\treturn bi.key\n}", "title": "" }, { "docid": "b3c9435a9aa3c2ea4e258aff84751784", "score": "0.6311293", "text": "func (combiner *itrCombiner) keyAt(i int) string {\n\treturn combiner.kvAt(i).Key\n}", "title": "" }, { "docid": "c8e3077c467d04ade4434ada002e7934", "score": "0.6307562", "text": "func (v *PersistenceFeature) GetKey() (o string) {\n\tif v != nil && v.Key != nil {\n\t\treturn *v.Key\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "afcc92aaf53c5e94f7cc83f44a3ab1dc", "score": "0.6304664", "text": "func (i ForwardIteratorStringIntMapOfIntSliceTreeMap) Key() string { return i.node.key }", "title": "" }, { "docid": "8af0ddd79238f6336523a6b3a2ee5ae1", "score": "0.6295458", "text": "func (m *Map) GetKey(value interface{}) (key interface{}, found bool) {\n\tm.mu.RLock()\n\tdefer m.mu.RUnlock()\n\treturn m.nts.GetKey(value)\n}", "title": "" }, { "docid": "6240bc7d26b2e5fbdb7e80ddd347ca37", "score": "0.6295039", "text": "func (v *Var) Key() []byte {\n\tif v.ID == 0 {\n\t\treturn nil\n\t}\n\treturn itob(v.ID)\n}", "title": "" }, { "docid": "079d19c01b5be93017024847127b1d22", "score": "0.62910837", "text": "func (r Range) GetKey() string {\n\treturn r.Key\n}", "title": "" }, { "docid": "dfcc79ada72370dadc5381a00cc19469", "score": "0.6279411", "text": "func (i SNSEndpointAttribute) Key() string {\n\tif val, ok := _SNSEndpointAttributeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "26cca3154950844923f27970ce5332f8", "score": "0.6274667", "text": "func (n *Node) Key() string {\n\tif n == nil {\n\t\treturn \"\"\n\t}\n\n\tn.RLock()\n\tkey := n.key\n\tn.RUnlock()\n\n\treturn key\n}", "title": "" }, { "docid": "14b743d77308c36a2f53632f7529e8e4", "score": "0.6267663", "text": "func (nn NodeNet) GetKey() string {\n\treturn nn.key\n}", "title": "" }, { "docid": "94199dce98875f4e5fe5b14f15ddd576", "score": "0.6252229", "text": "func Key(typ, name string) string {\n\treturn typ + \"+\" + name\n}", "title": "" }, { "docid": "cdd8c8a36a660d7d8d555062437b5281", "score": "0.62497455", "text": "func GetKey(obj interface{}, t *testing.T) string {\n\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\tif ok {\n\t\t// if tombstone , try getting the value from tombstone.Obj\n\t\tobj = tombstone.Obj\n\t}\n\tval := reflect.ValueOf(obj).Elem()\n\tname := val.FieldByName(\"Name\").String()\n\tkind := val.FieldByName(\"Kind\").String()\n\t// Note kind is not always set in the tests, so ignoring that for now\n\tif len(name) == 0 || len(kind) == 0 {\n\t\tt.Errorf(\"Unexpected object %v\", obj)\n\t}\n\n\tkey, err := keyFunc(obj)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error getting key for %v %v: %v\", kind, name, err)\n\t\treturn \"\"\n\t}\n\treturn key\n}", "title": "" }, { "docid": "b34e0512365ff10d16ad680c4e701f25", "score": "0.6243515", "text": "func (a authConfig) KeyFunc(t *jwt.Token) (interface{}, error) {\n\t// nolint: gocritic\n\tswitch a.KeyType {\n\t//TODO: add more support for keytypes here\n\tdefault:\n\t\treturn []byte(a.Key), nil\n\t}\n}", "title": "" }, { "docid": "62454e1af10d7c626ce3a03c9aefbd51", "score": "0.62352204", "text": "func Key() storj.Key {\n\tvar key storj.Key\n\tRead(key[:])\n\treturn key\n}", "title": "" }, { "docid": "1d4efbaa818024e5c577a71e048f9600", "score": "0.6232253", "text": "func (c *Cognito) getKey(token *jwt.Token) (interface{}, error) {\n\tkeyID, ok := token.Header[\"kid\"].(string)\n\tif !ok {\n\t\treturn nil, errors.New(\"expecting JWT header to have string kid\")\n\t}\n\n\tlog.Debug(\"kid: \", keyID)\n\n\tif key := keySet.LookupKeyID(keyID); len(key) == 1 {\n\t\treturn key[0].Materialize()\n\t}\n\n\treturn nil, errors.New(\"unable to find key\")\n}", "title": "" }, { "docid": "d8fe7d2a37c97278dbdff8480d5fed5a", "score": "0.62277895", "text": "func (excuse SimpleExcuse) GetKey() string {\n\treturn excuse.Key\n}", "title": "" }, { "docid": "650cb36b8abe59ebe5527ae203c23ffc", "score": "0.6222224", "text": "func (m Max) GetKey() string {\n\treturn m.Key\n}", "title": "" }, { "docid": "482dbc93e016c63ed40e9e2738cf7c17", "score": "0.6216279", "text": "func (v Values) Get(key string) string", "title": "" }, { "docid": "482dbc93e016c63ed40e9e2738cf7c17", "score": "0.6216279", "text": "func (v Values) Get(key string) string", "title": "" }, { "docid": "6e36efae7a2b3919b46a5673168c6724", "score": "0.6194336", "text": "func (o TaintOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Taint) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f7778f8dd479141837b1dbc3041bf9e2", "score": "0.6188707", "text": "func (k *Kvs) Get(key string) string {\n\treturn k.kv[key]\n}", "title": "" }, { "docid": "696fe1831e95c819432b9f0c45ba99aa", "score": "0.6188582", "text": "func (this *Ketama) Get(key string) (string, bool) {\n\tif this.Empty() {\n\t\treturn \"\", false\n\t}\n\n\thashs := hash.GenHashInts([]byte(Salt+key), 1)\n\thash := hashs[0]\n\n\tthis.Lock()\n\tdefer this.Unlock()\n\n\titer := this.m.LowerBound(hash)\n\tif iter.IsValid() {\n\t\treturn iter.Value().(string), true\n\t}\n\treturn this.m.First().Value().(string), true\n}", "title": "" }, { "docid": "3a4c9f14e4846251a99fb373803dc3be", "score": "0.6182585", "text": "func (e *Encryptor) Key() encryption.Key {\n\tif e.keyFunc == nil {\n\t\treturn nil\n\t}\n\treturn e.keyFunc()\n}", "title": "" }, { "docid": "6bb7a74132bbf14aef1c24cf4601b780", "score": "0.61789924", "text": "func GetKey(id int, context appengine.Context) (*models.Key, error) {\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "2a89b603edcc96bc38e14d970b282c0d", "score": "0.61771667", "text": "func (ss *SortedSet) GetByKey(key string) *SortedSetNode {\n\treturn ss.Dict[key]\n}", "title": "" }, { "docid": "95eac26369205354a9d26b0025e58f3c", "score": "0.6174011", "text": "func (s *Segment) GetKey() string {\n\treturn s.Key\n}", "title": "" }, { "docid": "a181c3373dd0c27da7befb1e7c1171fc", "score": "0.6170864", "text": "func (c *Cursor) keyValue() ([]byte, []byte) {\n\tref := &c.stack[len(c.stack)-1]\n\tif ref.index >= ref.page.count {\n\t\treturn nil, nil\n\t}\n\te := ref.page.leafPageElement(ref.index)\n\treturn e.key(), e.value()\n}", "title": "" }, { "docid": "0e3cb0264fa11d3c5de0ea0b62f31cb1", "score": "0.61704916", "text": "func Key(fn func()) {\n\tdsl.Key(fn)\n}", "title": "" }, { "docid": "f3f175b2bcce6cdb627f943f383a848c", "score": "0.6169283", "text": "func Key(x byte) (byte, byte) {\n\t//fmt.Printf(\"%08b\\n\",x)\n\tval := x >> 3\n\n\t// if the x value has a value in the 8 place\n\tif int(x) >= 8 {\n\t\tx = x & 0x07\n\n\t} else {\n\t\treturn val, x\n\t}\n\t// if the x value has a value in the 16 place\n\tif int(x) >= 16 {\n\t\tx = x & 0x0f\n\n\t} else {\n\t\treturn val, x\n\t}\n\n\tif int(x) >= 32 {\n\t\tx = x & 0x1f\n\n\t} else {\n\t\treturn val, x\n\t}\n\n\tif int(x) >= 64 {\n\t\tx = x & 0x3f\n\n\t} else {\n\t\treturn val, x\n\t}\n\n\tif int(x) >= 128 {\n\t\tx = x & 0x7f\n\n\t} else {\n\t\treturn val, x\n\t}\n\n\treturn val, x\n\n}", "title": "" }, { "docid": "aab283ab3b7192039f2a505be14729db", "score": "0.61679953", "text": "func (v *KeyValue_GetValue_Args) GetKey() (o Key) {\n\tif v != nil && v.Key != nil {\n\t\treturn *v.Key\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7a004467d10378dab614c5bfc11c5f43", "score": "0.6161162", "text": "func (p CacheSlidePointer3) Key() uint64 {\n\treturn types.ExtractBits(uint64(p), 49, 2)\n}", "title": "" }, { "docid": "7a004467d10378dab614c5bfc11c5f43", "score": "0.6161162", "text": "func (p CacheSlidePointer3) Key() uint64 {\n\treturn types.ExtractBits(uint64(p), 49, 2)\n}", "title": "" }, { "docid": "c319a75a3a95c718afe1d6ec1e00bbd9", "score": "0.6160722", "text": "func (o *VirtualizationVmwareVirtualMachineGpuAllOf) GetKey() int64 {\n\tif o == nil || o.Key == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "title": "" }, { "docid": "c26be8cc2c053b5d1a939abd4721e3fa", "score": "0.61435676", "text": "func (this *AllOne) GetMinKey() string {\n \n}", "title": "" }, { "docid": "fdfc520fe2ffc31f06cd932bdad94ad5", "score": "0.6140586", "text": "func (aws *AWS) GetKey(labels map[string]string, n *v1.Node) models.Key {\n\treturn &awsKey{\n\t\tSpotLabelName: aws.SpotLabelName,\n\t\tSpotLabelValue: aws.SpotLabelValue,\n\t\tLabels: labels,\n\t\tProviderID: labels[\"providerID\"],\n\t}\n}", "title": "" }, { "docid": "081e1f966fa44c407f71292100cb4d4b", "score": "0.6137957", "text": "func (f Filter) Key() string {\n\treturn f.key.String()\n}", "title": "" }, { "docid": "bed2f472630a8622c08fb312bd1e209b", "score": "0.61320305", "text": "func (i ReverseIteratorStringIntMapOfIntSliceTreeMap) Key() string { return i.node.key }", "title": "" }, { "docid": "122f3f5a8ea9410ccd6f1fbdeb824283", "score": "0.61291736", "text": "func getKeyUsingValue(m map[string]int, val int) (key string, ok bool) {\n\tfor k, v := range m {\n\t\tif v == val {\n\t\t\tkey = k\n\t\t\tok = true\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "24c636f4400c40c24af40bc697915849", "score": "0.6128213", "text": "func (e BooleanDataEntry) GetKey() string {\n\treturn e.Key\n}", "title": "" }, { "docid": "ae7fd4515daa2daeeb4052f38ab221cb", "score": "0.6127503", "text": "func (v justValue) key() interface{} {\n\treturn v.v\n}", "title": "" }, { "docid": "8e2e2771eee65941c8cf800b2393345d", "score": "0.6119081", "text": "func Key(id string, fallback string) Reference {\n\treturn key{id, fallback}\n}", "title": "" }, { "docid": "755546b1f8cb7a5fc07c8326cce8d122", "score": "0.61180955", "text": "func (iterator *RBIterator) Key() string {\n\treturn iterator.node.Key\n}", "title": "" }, { "docid": "2cf8f0b20364da1253299ed8c6e2f9b3", "score": "0.61170906", "text": "func (v *PersistenceSetting) GetKey() (o string) {\n\tif v != nil && v.Key != nil {\n\t\treturn *v.Key\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b4e310ba8b8ac5d186ab0807199794c2", "score": "0.61164016", "text": "func (it *itemType) GetKey() interface{} {\n\treturn it.key\n}", "title": "" }, { "docid": "27ea6a30712f4b47108c3478726dbd35", "score": "0.6112465", "text": "func (compte Compte) Key() string {\n\treturn compte.Siret\n}", "title": "" }, { "docid": "cf43946434b43083b562ece1d9831830", "score": "0.6109416", "text": "func (e *Element) Key() interface{} { return e.key }", "title": "" }, { "docid": "9ad83a5ddc2d3eaa233c231f12cc24de", "score": "0.61082727", "text": "func GetKey() *fernet.Key {\n\tmintLock.RLock()\n\tdefer mintLock.RUnlock()\n\treturn key\n\n}", "title": "" }, { "docid": "78085a8c9a8444c01dbf3b7b7fe1dfd3", "score": "0.6102286", "text": "func getKey(p *MProxy) func(token *jwt.Token) (interface{}, error) {\n\treturn func(token *jwt.Token) (interface{}, error) {\n\t\tkid, ok := token.Header[\"kid\"].(string)\n\t\tif !ok {\n\t\t\treturn nil, &Error{\n\t\t\t\tCode: ErrorKeyError,\n\t\t\t\tMsg: \"No valid key id provided by discovery URL\",\n\t\t\t\tErr: nil,\n\t\t\t}\n\t\t}\n\n\t\tkey := p.jwtKeys.LookupKeyID(kid)\n\t\tif len(key) == 0 {\n\t\t\treturn nil, &Error{\n\t\t\t\tCode: ErrorKeyError,\n\t\t\t\tMsg: \"No valid keys provided by discovery URL\",\n\t\t\t\tErr: nil,\n\t\t\t}\n\t\t}\n\n\t\treturn key[0].Materialize()\n\t}\n}", "title": "" }, { "docid": "cb0bf515645d7598feae5ffc808b4be3", "score": "0.61021805", "text": "func (u User) GetKey() string {\n\treturn u.key\n}", "title": "" }, { "docid": "eb4ec52766769a6c1ac9986eac6645d9", "score": "0.6099464", "text": "func (it *Iterator) Key() interface{} {\r\n\treturn it.node.data\r\n}", "title": "" }, { "docid": "7fdbd0bd9ee4d88a80ae6fc3fd695ea4", "score": "0.6097521", "text": "func (i Joke) GetKey() string {\n\treturn fmt.Sprintf(\"%s-%s\", i.Source, i.Id)\n}", "title": "" }, { "docid": "767c9b1f9b7c9d5e53c68f8b39fd9946", "score": "0.6093933", "text": "func (c Command) Key() string {\n\treturn c.String()\n}", "title": "" }, { "docid": "4b828e51af3e6cff772d8ab033b5d243", "score": "0.6093845", "text": "func (a *Alias) Key() string {\n\treturn strings.Trim(a.string, \"$()\")\n}", "title": "" }, { "docid": "8edbb9b2fc3851ac92ddc296ccabf9b7", "score": "0.60907686", "text": "func GetValue(key string) string{\n return secretData[key]\n }", "title": "" }, { "docid": "fa7a93163efc3d1192c70147234daaff", "score": "0.6088966", "text": "func (p *Page) Key() string {\n\treturn \"page.\" + p.Slug\n}", "title": "" }, { "docid": "0fbc4efb0051ea015ecb95111713f050", "score": "0.6087842", "text": "func (e *Execution) Key() string {\n\treturn fmt.Sprintf(\"%d-%s\", e.StartedAt.UnixNano(), e.NodeName)\n}", "title": "" }, { "docid": "9f4fae29e1168e169483d1f6f7b20c96", "score": "0.6081505", "text": "func (n *Node) key() string {\n\treturn n.Metadata.key()\n}", "title": "" }, { "docid": "8e696de02badba2f978a04bc17020564", "score": "0.6080484", "text": "func (self *State) Key() string{\n return self.Object.Get(\"key\").String()\n}", "title": "" } ]
d36d6c0669bd59a010f13431330d290c
NewFuture returns an initialized and ready Future.
[ { "docid": "716f6d9b76a5e13841a18f73497ff63e", "score": "0.7885232", "text": "func NewFuture() *Future {\n\tmutex := &sync.Mutex{}\n\treturn &Future{\n\t\tmutex: mutex,\n\t\tcond: sync.NewCond(mutex),\n\t\treceived: false,\n\t\tval: nil,\n\t\terr: nil,\n\t}\n}", "title": "" } ]
[ { "docid": "668f8e39271f0e6ee2019e25a54ead13", "score": "0.7583831", "text": "func NewFuture(ctx Context) (Future, Settable) {\n\treturn internal.NewFuture(ctx)\n}", "title": "" }, { "docid": "e6dbd72e2c81a0bc77341cdc46f1fb00", "score": "0.750224", "text": "func New() Promise {\n\treturn new(future)\n}", "title": "" }, { "docid": "b21bd60ca92d8ff18392da917ebf08b1", "score": "0.7340527", "text": "func NewFuture(requestID message.RequestID, actor *node.Node, msg *message.Message, cancelCallback CancelCallback) Future {\n\treturn &future{\n\t\tresult: make(chan *message.Message),\n\t\tactor: actor,\n\t\trequest: msg,\n\t\trequestID: requestID,\n\t\tcancelCallback: cancelCallback,\n\t}\n}", "title": "" }, { "docid": "aacd0d1a9051efa5a72268db21d74f9d", "score": "0.71558946", "text": "func NewFuture(jobId, apiKey string, httpClient *http.Client) *Future {\n\tif httpClient == nil {\n\t\thttpClient = &http.Client{}\n\t}\n\tf := &Future{JobId: jobId, ApiKey: apiKey}\n\tf.HttpClient = httpClient\n\treturn f\n}", "title": "" }, { "docid": "d0bb158b8c63c1034fc0482ec46ba2b0", "score": "0.70732695", "text": "func NewFuture(requestID network.RequestID, actor *host.Host, msg *packet.Packet, cancelCallback CancelCallback) Future {\n\tmetrics.NetworkFutures.WithLabelValues(msg.Type.String()).Inc()\n\treturn &future{\n\t\tresult: make(chan *packet.Packet, 1),\n\t\tactor: actor,\n\t\trequest: msg,\n\t\trequestID: requestID,\n\t\tcancelCallback: cancelCallback,\n\t}\n}", "title": "" }, { "docid": "d06ae730a7bb2c303f4d0f83a40a26b5", "score": "0.68846667", "text": "func New[T any](poll func() (Result[T], bool)) Future[T] {\n\treturn Future[T]{\n\t\tpoll: poll,\n\t}\n}", "title": "" }, { "docid": "639fc6be0074bcecf86c2bd02c5f82db", "score": "0.6752222", "text": "func NewFuture(d time.Duration) *Future {\n\tref := &futureProcess{Future{cond: sync.NewCond(&sync.Mutex{})}}\n\tid := ProcessRegistry.NextId()\n\n\tpid, ok := ProcessRegistry.Add(ref, \"future\"+id)\n\tif !ok {\n\t\tplog.Error(\"failed to register future process\", log.Stringer(\"pid\", pid))\n\t}\n\n\tref.pid = pid\n\tif d >= 0 {\n\t\tref.t = time.AfterFunc(d, func() {\n\t\t\tref.err = ErrTimeout\n\t\t\tref.Stop(pid)\n\t\t})\n\t}\n\n\treturn &ref.Future\n}", "title": "" }, { "docid": "7ac8969115e4baa2fa2aefc833863a40", "score": "0.6505026", "text": "func New() *Promise {\n\treturn &Promise{\n\t\tdone: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "2914b89de61a4372bec34746c974e368", "score": "0.6367326", "text": "func New(fn func(func(interface{}), func(error))) *Promise {\n\tpromise := &Promise{\n\t\tresolve: make(chan interface{}, 1),\n\t\treject: make(chan error, 1),\n\t\tdone: make(chan bool, 1),\n\t}\n\tgo fn(promise.resolveFn, promise.rejectFn)\n\treturn promise\n}", "title": "" }, { "docid": "6b24e32e3f83a0b4865be0208ec335bd", "score": "0.6365394", "text": "func New(executor func(resolve func(interface{}), reject func(error))) *Promise {\n\tpromise := newPromise()\n\n\tgo func() {\n\t\tdefer promise.handlePanic()\n\t\texecutor(promise.resolve, promise.reject)\n\t}()\n\n\treturn promise\n}", "title": "" }, { "docid": "28f428b90cb6097f835aab0cb703917f", "score": "0.6244796", "text": "func NewPromise() Promise {\n\treturn &PromiseImpl{\n\t\tfuture: NewFuture(),\n\t\tstatus: ready,\n\t}\n}", "title": "" }, { "docid": "1df8e3c0fd42b78157258a9096aabdee", "score": "0.6205115", "text": "func NewPromise() *Promise {\r\n\tf := &Promise{new(sync.Once),\r\n\t\t&Future{\r\n\t\t\tnew(sync.Once), new(sync.Mutex),\r\n\t\t\tmake(chan *PromiseResult, 1),\r\n\t\t\tmake([]func(v ...interface{}), 0, 8),\r\n\t\t\tmake([]func(v ...interface{}), 0, 8),\r\n\t\t\tmake([]func(v ...interface{}), 0, 4),\r\n\t\t\tpipe{}, nil, nil,\r\n\t\t},\r\n\t}\r\n\treturn f\r\n}", "title": "" }, { "docid": "bbf051012cf147689ccdbeb20b011d69", "score": "0.6178174", "text": "func newPromise(f func() (string, error)) *promise {\n\tp := &promise{}\n\twgGlobal.Add(1)\n\tgo func() {\n\t\tp.value, p.err = f()\n\t\tp.state = pending\n\t\twgGlobal.Done()\n\t}()\n\treturn p\n}", "title": "" }, { "docid": "685f9e95184edff248e07d1903180bba", "score": "0.61136466", "text": "func newFutureResponse(opcode linux.FUSEOpcode) *futureResponse {\n\treturn &futureResponse{\n\t\topcode: opcode,\n\t\tch: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "ba9aaa9d07fbd3a81b432945f8fe33a2", "score": "0.6077182", "text": "func NewPromise(f func() (string, error)) *Promise {\n\tp := &Promise{}\n\tp.globalWG.Add(1)\n\tgo func() {\n\t\tp.value, p.err = f()\n\t\tp.state = pending\n\t\tp.globalWG.Done()\n\t}()\n\treturn p\n}", "title": "" }, { "docid": "e75bb693d178f00c6aa13a611940cf99", "score": "0.6030722", "text": "func NewMockFuture(ctrl *gomock.Controller) *MockFuture {\n\tmock := &MockFuture{ctrl: ctrl}\n\tmock.recorder = &MockFutureMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "639841d8bfdaad0900c164935265a4f9", "score": "0.599067", "text": "func NewPromise() Promise {\n\treturn &promise{waitCh: make(chan struct{})}\n}", "title": "" }, { "docid": "2890de5fcf4bb55b6aa6a2dff0a751fe", "score": "0.598661", "text": "func NewPromise(callback func() (interface{}, error)) Promise {\n\tpromise := Promise{\n\t\tchannel: make(chan promiseResult),\n\t}\n\tgo func() {\n\t\tdefer close(promise.channel)\n\t\tres, err := callback()\n\t\tif err != nil {\n\t\t\tpromise.reject(err)\n\t\t}\n\t\tpromise.resolve(res)\n\t}()\n\treturn promise\n}", "title": "" }, { "docid": "ad713564f2074a2d00abd9207e3f1b78", "score": "0.598123", "text": "func CreateFuture (cmd *Command) (future interface{}) {\n\tswitch cmd.RespType {\n\tcase BOOLEAN:\n\t\tfuture = newFutureBool();\n\tcase BULK: \t\t\t\n\t\tfuture = newFutureBytes();\n\tcase MULTI_BULK:\t\n\t\tfuture = newFutureBytesArray();\n\tcase NUMBER:\t\t\t\n\t\tfuture = newFutureInt64();\n\tcase STATUS:\t\t\n//\t\tfuture = newFutureString();\n\t\tfuture = newFutureBool();\n\tcase STRING:\t\t\n\t\tfuture = newFutureString();\n//\tcase VIRTUAL:\t\t// TODO\n//\t resp, err = getVirtualResponse ();\n\t}\n\treturn;\n}", "title": "" }, { "docid": "7a8892f75f0361f28819e00f066e4938", "score": "0.59695154", "text": "func newPromise() *Promise {\n\tp := &Promise{}\n\tp.successChannel = make(chan interface{}, 1)\n\tp.errorChannel = make(chan error, 1)\n\treturn p\n}", "title": "" }, { "docid": "a2a7cf23e04a92ff03df394290112a33", "score": "0.5969289", "text": "func newNilFutureResult(ctx context.Context) *cmdRes {\n\tresponseChan := make(chan *response, 1)\n\tresponseChan <- &response{result: nil, err: nil}\n\treturn &cmdRes{ctx: ctx, c: responseChan}\n}", "title": "" }, { "docid": "d686b38563921f6f614645cc9f4977cc", "score": "0.595402", "text": "func newNilFutureResult() chan *futureResult {\n\tresponseChan := make(chan *futureResult, 1)\n\tresponseChan <- &futureResult{reply: nil}\n\treturn responseChan\n}", "title": "" }, { "docid": "df0ae392ac92057936ed5846ca327759", "score": "0.57997", "text": "func New(fn ResolutionFunc) Promise {\n\tif fn == nil {\n\t\tpanic(\"promise.New: resolution func must be non-nil\")\n\t}\n\n\tp := &promise{\n\t\thandlers: make([]*handler, 0),\n\t\tdone: make(chan struct{}),\n\t}\n\n\tgo func() {\n\t\tdefer close(p.done)\n\t\tdefer handlePanic(p)\n\t\tfn(p.resolve, p.reject)\n\t}()\n\n\treturn p\n}", "title": "" }, { "docid": "8d29dd35cee3e141739b29e490751a45", "score": "0.5788474", "text": "func NewPromise(fn func(ResolveHandler, RejectHandler)) Interface {\n\tp := innerPromise{make(chan struct{}), make(chan struct{}), nil, nil}\n\tgo func() {\n\t\tfn(func(res interface{}) {\n\t\t\tp.resolve(res)\n\t\t}, func(err error) {\n\t\t\tp.reject(err)\n\t\t})\n\t}()\n\treturn &p\n}", "title": "" }, { "docid": "52084c436805fe96668d9dca015b12e1", "score": "0.5710357", "text": "func New(fn Fn) Caller {\n\treturn newCoroutine(fn)\n}", "title": "" }, { "docid": "e66178c3649be20269eceef935a5d9f9", "score": "0.54719", "text": "func (p *PromiseImpl) Future() Future {\n\treturn p.future\n}", "title": "" }, { "docid": "a5ccc426e0450b054e5bce37a234e41e", "score": "0.54114246", "text": "func NewPromise(mutable, recoverable, relay bool) *Promise {\n\treturn &Promise{\n\t\tmessage: make(chan Result, 1),\n\t\tmutable: mutable,\n\t\trecoverable: recoverable,\n\t\trelay: relay,\n\t}\n\n}", "title": "" }, { "docid": "7f93430530678b59eaf55e628aa28d57", "score": "0.5397863", "text": "func NewTokenFuture() *tokenFuture {\n\treturn &tokenFuture{}\n}", "title": "" }, { "docid": "92cd0829c2800dcd55b7da91cc7db803", "score": "0.5366936", "text": "func NewPromise(run func() (interface{}, error)) *Promise {\n\treturn NewScheduler().InitScheduler(run)\n}", "title": "" }, { "docid": "10fb665394690e794cabc06fd5e164d0", "score": "0.53455734", "text": "func NewRaw() (*Promise, func(interface{}), func(error)) {\n\tpromise := newPromise()\n\treturn promise, promise.resolve, promise.reject\n}", "title": "" }, { "docid": "fe0dcd9c59a3be7160355fe7bbe30700", "score": "0.5254154", "text": "func NewResponseFuture(ctx context.Context, opaque int32, callback func(*ResponseFuture)) *ResponseFuture {\n\treturn &ResponseFuture{\n\t\tOpaque: opaque,\n\t\tDone: make(chan bool),\n\t\tcallback: callback,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "d452723e866fcf5bec52b1cfe69847a4", "score": "0.52460974", "text": "func (eh readyEventHandler) New() interface{} {\r\n\treturn &Ready{}\r\n}", "title": "" }, { "docid": "8e6ba19ca990e95cd841c06807efcd63", "score": "0.52365273", "text": "func newPromise(check *protocol.Admission) *Promise {\n\treturn &Promise{\n\t\tcheck: check,\n\t\tdone: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "6fc67a53d08f49031fde608a6abee60d", "score": "0.5145415", "text": "func newCoroutine(fn Fn) *coroutine {\n\t// Use as little initial memory as possible, zero value other fields\n\treturn &coroutine{\n\t\tfn: fn,\n\t}\n}", "title": "" }, { "docid": "956894c6987c21e7864a18fbb5021296", "score": "0.5139391", "text": "func New(completedCB func()) *MultiTask {\n\treturn &MultiTask{\n\t\tcompletedCB: completedCB,\n\t}\n}", "title": "" }, { "docid": "d0ee16977809aafe333e2526cef642bd", "score": "0.50572765", "text": "func (corSelf *CorDef) New(effect func()) *CorDef {\n\topCh := make(chan *CorOp, 5)\n\tresultCh := make(chan interface{}, 5)\n\tcor := &CorDef{effect: effect, opCh: &opCh, resultCh: &resultCh, isStarted: AtomBool{flag: 0}}\n\treturn cor\n}", "title": "" }, { "docid": "7fb66abb1a382fee604994d541b59e9f", "score": "0.5053944", "text": "func NewChan() *Chan {\n\treturn &Chan{\n\t\treadyChan: make(chan bool),\n\t}\n}", "title": "" }, { "docid": "907e70979b4c3266580fc1a11239a655", "score": "0.5039131", "text": "func ExampleFuture() {\n\t// Future function\n\tdoThings := func() *future.Future {\n\t\tfut, setResult := future.New()\n\t\ttime.AfterFunc(10*time.Millisecond, func() {\n\t\t\tsetResult(\"OK\", nil)\n\t\t})\n\t\treturn fut\n\t}\n\n\t// Usage\n\tres := doThings()\n\tval, _ := res.Get(context.Background())\n\tfmt.Println(val)\n\t// Output: OK\n}", "title": "" }, { "docid": "efd57870e6e0b8835bec989d214f9619", "score": "0.5032444", "text": "func New(f func()) *Closer {\n\treturn &Closer{\n\t\tIsClosedChan: make(chan struct{}),\n\t\tf: f,\n\t}\n}", "title": "" }, { "docid": "d397dd3bf27a7dbe4755b6df223af517", "score": "0.5023678", "text": "func NewValueOfFutures(val decimal.Decimal, scale int32) ValueOfFuturesField {\n\treturn ValueOfFuturesField{quickfix.FIXDecimal{Decimal: val, Scale: scale}}\n}", "title": "" }, { "docid": "5471f5a0506d7714a4f4b01ee8765930", "score": "0.49913412", "text": "func AsyncNew(items []geometry.Vec3, maxDimension int) <-chan *KDNode {\n\tchannel := make(chan *KDNode)\n\n\tgo func() {\n\t\tchannel <- New(items, maxDimension)\n\t}()\n\n\treturn channel\n}", "title": "" }, { "docid": "1f0407aac612cc42f4bc3094853190fa", "score": "0.49850783", "text": "func (ops *Operations) NewOperation(from <-chan RESTResult, onReceive func(RESTResult)) *Operation {\n\tid := atomic.AddInt64(&ops.lastID, 1)\n\top := &Operation{\n\t\tID: strconv.FormatInt(id, 10),\n\t\tawaiting: from,\n\t\tonReceive: onReceive,\n\t\tnotify: make(chan struct{}),\n\t}\n\tgo op.wait()\n\tgo ops.insert(op)\n\treturn op\n}", "title": "" }, { "docid": "310e74bb9fdc2721babd549a8a694bb6", "score": "0.49753127", "text": "func New() venom.Executor {\n\treturn &Executor{}\n}", "title": "" }, { "docid": "310e74bb9fdc2721babd549a8a694bb6", "score": "0.49753127", "text": "func New() venom.Executor {\n\treturn &Executor{}\n}", "title": "" }, { "docid": "310e74bb9fdc2721babd549a8a694bb6", "score": "0.49753127", "text": "func New() venom.Executor {\n\treturn &Executor{}\n}", "title": "" }, { "docid": "310e74bb9fdc2721babd549a8a694bb6", "score": "0.49753127", "text": "func New() venom.Executor {\n\treturn &Executor{}\n}", "title": "" }, { "docid": "310e74bb9fdc2721babd549a8a694bb6", "score": "0.49753127", "text": "func New() venom.Executor {\n\treturn &Executor{}\n}", "title": "" }, { "docid": "76da3f6c5b161e22716e1d6428bbd226", "score": "0.4974556", "text": "func (in *Future) DeepCopy() *Future {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Future)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fc59a07db3bdacb941acbe68f3c9a819", "score": "0.4974043", "text": "func NewPromiseNoFuture(entry *commonpb.Entry) PromiseLogEntry {\n\treturn &promiseEntry{\n\t\tentry: entry,\n\t\tcreated: time.Now(),\n\t}\n}", "title": "" }, { "docid": "7287182362fa3c7437a8e8ce5b39feea", "score": "0.49519923", "text": "func (pid *PID) RequestFuture(message interface{}, timeout time.Duration) *Future {\n\tfuture := NewFuture(timeout)\n\tenv := &MessageEnvelope{\n\t\tMessage: message,\n\t\tHeader: nil,\n\t\tSender: future.PID(),\n\t}\n\tpid.ref().SendUserMessage(pid, env)\n\treturn future\n}", "title": "" }, { "docid": "d7b65c6d20a448156550d9614ad88929", "score": "0.4935298", "text": "func (rc *RootContext) RequestFuture(pid *PID, message interface{}, timeout time.Duration) *Future {\n\tfuture := NewFuture(timeout)\n\tenv := &MessageEnvelope{\n\t\tHeader: nil,\n\t\tMessage: message,\n\t\tSender: future.PID(),\n\t}\n\trc.sendUserMessage(pid, env)\n\treturn future\n}", "title": "" }, { "docid": "29ad808d847fd6e8cfc88e373de8b9e0", "score": "0.49182558", "text": "func New() *T {\n\treturn &T{\n\t\tstartC: make(chan Notification, 1),\n\t\tdoneC: make(chan Notification, 1),\n\t\tabortingC: make(chan Notification, 1),\n\t\tstarted: false,\n\t\tdone: false,\n\t\tcanceled: false,\n\t\taborting: false,\n\t}\n}", "title": "" }, { "docid": "2cb063c68c8cead809eab24f07e9d157", "score": "0.49091125", "text": "func (f *FetcherFactory) New(ctx context.Context, source storage.Address, peers *sync.Map) storage.NetFetcher {\n\tfetcher := NewFetcher(ctx, source, f.request, f.skipCheck)\n\tgo fetcher.run(peers)\n\treturn fetcher\n}", "title": "" }, { "docid": "063807be989a3ec13e167a8ab31f1954", "score": "0.49047005", "text": "func (r ContextWrapper) RequestFuture(pid *PID, message interface{}, timeout time.Duration) *Future {\n\treturn r.Context.RequestFuture(pid.PID, message, timeout)\n}", "title": "" }, { "docid": "e1e30cd48741a5a72196b4f2fe5c0b2f", "score": "0.4903874", "text": "func New() *Finisher {\n\treturn &Finisher{}\n}", "title": "" }, { "docid": "3cbe438697bc8ab85757a96e7fc6f2bf", "score": "0.49033016", "text": "func New() chan interface{} {\n\treturn make(chan interface{}, 0)\n}", "title": "" }, { "docid": "d3e7f82813c36f783a3d7bcc9b8c05e9", "score": "0.48968", "text": "func newFetcher() (*fetcherServer, error) {\n\n\tfs := &fetcherServer{\n\t\tqueue: make(chan *queueRequest, 64),\n\t\tdone: make(chan bool, Workers),\n\t}\n\tfor i := 0; i < Workers; i++ {\n\t\tgo fs.worker()\n\t}\n\treturn fs, nil\n}", "title": "" }, { "docid": "cbca50f5bb24bb596fbe1f1983745dab", "score": "0.48851225", "text": "func NewAsyncResult() *AsyncResult {\n\treturn &AsyncResult{Result: make(chan error, 1)}\n}", "title": "" }, { "docid": "25399f03bd808120ffb02f6c942114c9", "score": "0.48844013", "text": "func New() Op {\n\treturn Op{executor}\n}", "title": "" }, { "docid": "79b9aa4a8214c8d6e26605b3413cefd3", "score": "0.486686", "text": "func (this *Future) Get() (val interface{}, err error) {\n\t<-this.final\n\treturn getFutureReturnVal(this.loadResult())\n}", "title": "" }, { "docid": "cde7eded8a0ff9320e97dd390abe73b0", "score": "0.4865026", "text": "func New(f Func) *Memo {\n\tmemo := &Memo{requests: make(chan request)}\n\tgo memo.server(f)\n\treturn memo\n}", "title": "" }, { "docid": "ff911c45d569d5e9d3a0e9391d4f2a9a", "score": "0.48485744", "text": "func newTask() *Task {\n\treturn &Task{\n\t\tstop: make(chan struct{}),\n\t\tstartedAt: time.Now(),\n\t}\n}", "title": "" }, { "docid": "93d2224ca6a64cad5345a4dfb1fc1d67", "score": "0.48388603", "text": "func New(method, url string, body string) *Task {\n\tctx, cancel := context.WithCancel(context.Background())\n\treturn &Task{\n\t\tID: uuid.New(),\n\t\tStatus: StatusScheduled,\n\t\tMethod: method,\n\t\tURL: url,\n\t\tRequestBody: body,\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\tdone: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "9cdc26c91b05cb8a23a3cc564723ae38", "score": "0.48377824", "text": "func New() *Fetcher {\n\treturn &Fetcher{}\n}", "title": "" }, { "docid": "9c32191149893bd8c7f893ab3c18712d", "score": "0.4833957", "text": "func New(addr string) *AsyncServer {\n\ta := &AsyncServer{\n\t\tstopped: make(chan bool),\n\t}\n\ta.Addr = addr\n\treturn a\n}", "title": "" }, { "docid": "e393510f349a86ad7eb9345ad0611577", "score": "0.4827545", "text": "func NewRoutine() *R {\n\treturn &R{\n\t\twg: new(sync.WaitGroup),\n\t\tresult: make(chan result),\n\t\tmethods: make([]func(), 0),\n\t}\n}", "title": "" }, { "docid": "6ba0b1c3e48102f1a368dcbc6e9b217c", "score": "0.48268571", "text": "func New(f Func) *Memo {\n\tm := &Memo{requests: make(chan request)}\n\tgo m.server(f)\n\treturn m\n}", "title": "" }, { "docid": "6380630189a44223c9e6e97d7bbc54b4", "score": "0.48133186", "text": "func New(f *os.File, done <-chan struct{}) RFID {\n\tr := &rfid{\n\t\tch: make(chan (string)),\n\t\tdone: done,\n\t\tin: bufio.NewScanner(f),\n\t}\n\tr.start()\n\treturn r\n}", "title": "" }, { "docid": "d728e22b3b23efc72a0df54ed7a76cdd", "score": "0.480297", "text": "func newCompletionHandler(timeout time.Duration) *completionHandler {\n\treturn &completionHandler{\n\t\ttimeout: timeout,\n\t\tcompleted: make(chan bool),\n\t}\n}", "title": "" }, { "docid": "7676f673854af25a6e5bee5804ea180f", "score": "0.4777132", "text": "func New(nWorkers uint, fn func(gt interface{}) (interface{}, error), buffer uint) (Request, Response, <-chan error) {\n\trequest := make(chan interface{}, buffer)\n\tresponse := make(chan interface{}, buffer)\n\terrs := make(chan error, buffer)\n\n\tw := &worker{\n\t\terrs: errs,\n\t\trequest: request,\n\t\tresponse: response,\n\t\tjobs: make(chan interface{}, buffer),\n\t\tdone: make(chan bool),\n\t\tfn: fn,\n\t\tbuf: list.New(),\n\t}\n\n\tgo w.listener()\n\n\tfor i := uint(0); i < nWorkers; i++ {\n\t\tgo w.work()\n\t}\n\n\tgo func() {\n\t\tfor i := uint(0); i < nWorkers; i++ {\n\t\t\t<-w.done\n\t\t}\n\t}()\n\n\treturn request, response, errs\n}", "title": "" }, { "docid": "f06356de3794db2843113285d2df4a80", "score": "0.47721037", "text": "func New(callable *lua.LFunction, loop eventloop.Loop) Callback {\n\treturn &callback{\n\t\tcallable: callable,\n\t\tloop: loop,\n\t}\n}", "title": "" }, { "docid": "4172817db5088c468291de985e977fd2", "score": "0.47710693", "text": "func RequisitionNew() *Requisition {\n\tretC := C.gtk_requisition_new()\n\tretGo := RequisitionNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "5a1179b4aa6bfe65bc6c132e03d1586c", "score": "0.4769881", "text": "func New(ctx context.Context, id string, publisher shim.Publisher, shutdown func()) (shim.Shim, error) {\n\treturn &service{}, nil\n}", "title": "" }, { "docid": "75f7711c0c3ffccdda08c2bab65a801e", "score": "0.47592595", "text": "func (this *Future) GetChan() <-chan *PromiseResult {\n\tc := make(chan *PromiseResult, 1)\n\tthis.OnComplete(func(v interface{}) {\n\t\tc <- this.loadResult()\n\t}).OnCancel(func() {\n\t\tc <- this.loadResult()\n\t})\n\treturn c\n}", "title": "" }, { "docid": "58d5c78acd66e6b90d39488a69f79630", "score": "0.47478843", "text": "func New(generatorFunc Func) *Generator {\n\tgenerator := &Generator{\n\t\tisDone: false,\n\n\t\tisDoneChan: make(chan struct{}),\n\t\tstatusChan: make(chan *status),\n\t\tretStatusChan: make(chan retStatus),\n\t\tfirstCallChan: make(chan firstCall, 1),\n\t}\n\n\tgo generator.start(generatorFunc)\n\n\treturn generator\n}", "title": "" }, { "docid": "0e87f10c3e10c4d5eb8941d260f3b4af", "score": "0.47356966", "text": "func NewWeather() (*Weather, error) {\n\tweather := Weather{}\n\n\tif err := weather.FetchWeather(); err != nil {\n\t\treturn &weather, err\n\t}\n\n\tgo func(w *Weather) {\n\t\tfor {\n\t\t\tlog.Println(\"Fetching Weather...\")\n\t\t\ttime.Sleep(time.Minute * 1)\n\n\t\t\tif err := w.FetchWeather(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(&weather)\n\n\treturn &weather, nil\n}", "title": "" }, { "docid": "d88802bc47d7fe731269365b4c6d7f36", "score": "0.47330275", "text": "func (c *Client) NewRPC(done chan *RPC) *RPC {\n\tif done == nil {\n\t\tdone = make(chan *RPC)\n\t}\n\tc.mu.Lock();\n\tid := c.idGen;\n\tc.idGen++;\n\tc.mu.Unlock();\n\treturn &RPC{nil, done, OK, c, id};\n}", "title": "" }, { "docid": "3344ff3eca77663f341daef971bc2390", "score": "0.47308886", "text": "func New(poolName string, numWorkers int, queueSize int) ExecutorService {\n\twork := make(chan call, queueSize)\n\t// This starts up the workers, initially blocked\n\t// because there is no work yet.\n\tfor w := 1; w <= int(numWorkers); w++ {\n\t\tgo worker(fmt.Sprintf(\"%s-worker_%d\", poolName, w), work)\n\t}\n\treturn ExecutorService{work}\n}", "title": "" }, { "docid": "1bbb92189633a45f7740ded4b6622088", "score": "0.47239372", "text": "func (f *CreateSceneFuture) Wait() (*CreateSceneResponse, error) {\n\t<-f.done\n\treturn f.rsp, f.err\n}", "title": "" }, { "docid": "622a5b3311d725b8dd928d9d592411b5", "score": "0.4719974", "text": "func (q *Query) NewFilter(fn FilterFunc) *Filter {\n done := make(chan bool)\n q.done = append(q.done, done)\n f := &Filter{\n in: make(chan *blob.Blob),\n fn: fn,\n out: q.result,\n done: done,\n skip: q.skip,\n }\n q.filters = append(q.filters, f)\n return f\n}", "title": "" }, { "docid": "89da31ab6bfa6a743e2b42c5b937ce6a", "score": "0.47107908", "text": "func New() api.Facade {\n\treturn lockbased.NewFacade(lockbased.NewStore())\n}", "title": "" }, { "docid": "467ea35bb4841d32503e608b6d8a12ef", "score": "0.47050002", "text": "func New(jobs chan acd.Job) http.Handler {\n\th := handler{jobs}\n\n\tmux := http.NewServeMux()\n\n\tmux.HandleFunc(\"/\", h.delay)\n\n\tn := negroni.New()\n\tn.Use(negroni.NewLogger())\n\tn.UseHandler(mux)\n\n\treturn n\n}", "title": "" }, { "docid": "05f822594975b0cab8a9b248aba765d8", "score": "0.4699259", "text": "func NewTask(f func(chan bool)) *Task {\n\tt := &Task{\n\t\tf: f,\n\t\tcancelchan: make(chan bool),\n\t\tlisteners: make([]chan interface{}, 0),\n\t}\n\treturn t\n}", "title": "" }, { "docid": "de51f4e9acbec92e13a35b39382a8ffd", "score": "0.46868026", "text": "func New() *Success {\n\to := &Success{}\n\to.L = &sync.Mutex{}\n\treturn o\n}", "title": "" }, { "docid": "878a0e6f9b51426c43714e8951c84d24", "score": "0.46790004", "text": "func NewFetchFn(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *FetchFn {\n\tmock := &FetchFn{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "56fccb2e188c35979d6d44f82e7720eb", "score": "0.4677712", "text": "func FromFunc(function func() (interface{}, error)) Promise {\n\tpromise := new(SimplePromise)\n\tpromise.successChannel = make(chan interface{}, 1)\n\tpromise.failureChannel = make(chan error, 1)\n\tgo func() {\n\t\tobj, err := function()\n\t\tif err == nil {\n\t\t\tpromise.successChannel <- obj\n\t\t} else {\n\t\t\tpromise.failureChannel <- err\n\t\t}\n\t}()\n\treturn promise\n}", "title": "" }, { "docid": "d76d2f9c1b4bbf8fbb6e1c74f4759a58", "score": "0.46724007", "text": "func New(r resolv.Resolver) FS {\n\treturn FS{r: r}\n}", "title": "" }, { "docid": "c304e96d94d140624190627f9e3e2b47", "score": "0.46696654", "text": "func NewPoolFutures(maxGoroutines, taskQueueLen int, allowExceed bool) *poolFutures {\n\tp := &poolFutures{\n\t\tallowExceed: allowExceed,\n\t\tg: thread.NewGroupWorkers(),\n\t\tjobsChan: make(chan func(), taskQueueLen),\n\t}\n\n\tfor i := 0; i < maxGoroutines; i++ {\n\t\tp.g.AddAsWorker(func(w *thread.Worker) {\n\t\t\tstop := w.StopC()\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-stop:\n\t\t\t\t\treturn\n\t\t\t\tcase job := <-p.jobsChan:\n\t\t\t\t\tjob()\n\t\t\t\t}\n\t\t\t}\n\t\t}, nil)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "ec01511dabf6cb153cfbbbbb040e9fbd", "score": "0.46672612", "text": "func New() *NonBlockingChan {\n var (\n send = make(chan interface{})\n recv = make(chan interface{})\n n = &NonBlockingChan{\n Send: send,\n Recv: recv,\n items: list.New(),\n }\n )\n go n.run(send, recv)\n return n\n}", "title": "" }, { "docid": "5d30910f0d1d90954f630e603b4f950d", "score": "0.46629113", "text": "func createPromise(done chan interface{}) *Promise {\n\tp := &Promise{}\n\tp.successChannel = make(chan interface{}, 1)\n\tp.errorMessage = make(chan error, 1)\n\n\tgo func() {\n\tpromise:\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase message, valid := <-p.successChannel:\n\t\t\t\tif !valid {\n\t\t\t\t\tbreak promise\n\t\t\t\t}\n\t\t\t\tfmt.Println(message)\n\t\t\tcase err, valid := <-p.errorMessage:\n\t\t\t\tif !valid {\n\t\t\t\t\tbreak promise\n\t\t\t\t}\n\t\t\t\tfmt.Println(err)\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\tclose(done)\n\t}()\n\treturn p\n}", "title": "" }, { "docid": "cf9367bcbbf08b6f5be6671cf2a9fdc3", "score": "0.46609354", "text": "func (actorSelf *ActorDef) New(effect func(*ActorDef, interface{})) *ActorDef {\n\tch := make(chan interface{})\n\treturn actorSelf.NewByOptions(effect, &ch, map[string]interface{}{})\n}", "title": "" }, { "docid": "14dbf54eec89a388dc2d29ef19764b6d", "score": "0.46490183", "text": "func (f *future) Get() (Result, error) {\n\t// Block on the promise of a result until we get one.\n\tresult, ok := <-f.promise\n\tif ok {\n\t\tfunc() {\n\t\t\tf.m.Lock()\n\t\t\tdefer f.m.Unlock()\n\t\t\t// If we got the result, then store it so that\n\t\t\t// others may access it.\n\t\t\tf.result = result\n\t\t\t// Close the promise channel so that others\n\t\t\t// are signaled that the result is available.\n\t\t\tclose(f.promise)\n\t\t}()\n\t}\n\n\tf.m.RLock()\n\tdefer f.m.RUnlock()\n\n\treturn f.result.img, f.result.err\n}", "title": "" }, { "docid": "81216d84cb6e8abc900b451c7035d1b4", "score": "0.4648252", "text": "func New() *Resolver {\n\treturn &Resolver{\n\t\ttimeout: Timeout,\n\t\tcache: newCache(),\n\t\tdebug: false,\n\t}\n}", "title": "" }, { "docid": "80c68ee2a35eb4409441fce78703a8cf", "score": "0.46427864", "text": "func New(opts Opts, client api.Client, features batches.FeatureFlags) *executor {\n\treturn &executor{\n\t\tcache: NewCache(opts.CacheDir),\n\t\tclearCache: opts.ClearCache,\n\n\t\tlogger: log.NewManager(opts.TempDir, opts.KeepLogs),\n\t\tcreator: opts.Creator,\n\n\t\tfetcher: batches.NewRepoFetcher(client, opts.CacheDir, opts.CleanArchives),\n\n\t\tclient: client,\n\t\tfeatures: features,\n\n\t\ttempDir: opts.TempDir,\n\t\ttimeout: opts.Timeout,\n\n\t\tdoneEnqueuing: make(chan struct{}),\n\t\tpar: parallel.NewRun(opts.Parallelism),\n\t\ttasks: []*Task{},\n\t\tstatuses: map[*Task]*TaskStatus{},\n\t}\n}", "title": "" }, { "docid": "e175a80c37b2b0d3278f32c6afc169cd", "score": "0.46404174", "text": "func (m Meter) newAsync(\n\tname string,\n\tmkind InstrumentKind,\n\tnkind number.Kind,\n\topts []InstrumentOption,\n\trunner AsyncRunner,\n) (\n\tAsyncImpl,\n\terror,\n) {\n\tif m.impl == nil {\n\t\treturn NoopAsync{}, nil\n\t}\n\tdesc := NewDescriptor(name, mkind, nkind, opts...)\n\tdesc.config.instrumentationName = m.name\n\tdesc.config.instrumentationVersion = m.version\n\treturn m.impl.NewAsyncInstrument(desc, runner)\n}", "title": "" }, { "docid": "2e8bdb37a2a24860c1cacd36d657657a", "score": "0.46400112", "text": "func (f *Factory) New(config *trigger.Config) trigger.Trigger {\n\treturn &Trigger{metadata: f.metadata, config: config}\n}", "title": "" }, { "docid": "ee812a7e0257037c65f516a916af1378", "score": "0.46394214", "text": "func (f *Future) Get() (interface{}, error) {\n\tselect {\n\tcase <-f.done:\n\t\treturn f.result, f.err\n\tcase <-f.cancel:\n\t\treturn nil, errors.New(\"canceled\")\n\t}\n}", "title": "" }, { "docid": "f9564717452a3fce1c334e4442d87a73", "score": "0.46364284", "text": "func NewSimple(f func()) *Thread {\n\treturn makeThread(\n\t\tcontext.Background(),\n\t\tSimple,\n\t\tf,\n\t)\n}", "title": "" }, { "docid": "9a2cd104a4b10f1868b0cd39e321b26c", "score": "0.46337175", "text": "func New(v interface{}) (*Callable, error) {\n\n\treflectValue := reflect.ValueOf(v)\n\n\tif reflectValue.Kind() != reflect.Func {\n\t\treturn nil, fmt.Errorf(\"expected function\")\n\t}\n\n\treturn &Callable{\n\t\tcallable: reflectValue,\n\t\targumentTypes: funcArgumentTypes(reflectValue),\n\t\tnumberOfReturnValues: numberOfReturnValues(reflectValue),\n\t}, nil\n}", "title": "" }, { "docid": "82d924ea1663619827d2e3eeab836bb5", "score": "0.46293446", "text": "func NewTrigger(p Parameters) *Trigger {\n\tif p.sleepInterval == 0 {\n\t\tp.sleepInterval = time.Second\n\t}\n\n\tt := &Trigger{\n\t\tparams: p,\n\t\twakeupChan: make(chan bool, 1),\n\t\tcloseChan: make(chan struct{}, 1),\n\t}\n\n\tgo t.waiter()\n\n\treturn t\n}", "title": "" } ]
45268006a05d615f6a4f4a84705cc2eb
IndividualResolver resolves individual get requests
[ { "docid": "a7541529b87be26d6d73c585c7225bb0", "score": "0.6866821", "text": "func (r BookResolver) IndividualResolver(p graphql.ResolveParams) (interface{}, error) {\n\tbook, err := service.BookServ.Get(p.Args[\"id\"].(int))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn book, nil\n}", "title": "" } ]
[ { "docid": "c5a6118fe09ee26517a521cd83134aff", "score": "0.5723926", "text": "func (r BookResolver) AllResolver(p graphql.ResolveParams) (interface{}, error) {\n\tbooks, err := service.BookServ.GetAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn books, nil\n}", "title": "" }, { "docid": "81a1c3b7737b8fbf2a3153ef79d31fb6", "score": "0.5572518", "text": "func (r *DefaultResolver) Resolve(ctx context.Context, segs Segments,\n\treq RequestSet) (Segments, RequestSet, error) {\n\n\tvar err error\n\tif req.resolveUp() {\n\t\tif segs, req, err = r.resolveUpSegs(ctx, segs, req); err != nil {\n\t\t\treturn segs, req, err\n\t\t}\n\t}\n\tif req.resolveDown() {\n\t\tif segs, req, err = r.resolveDownSegs(ctx, segs, req); err != nil {\n\t\t\treturn segs, req, err\n\t\t}\n\t}\n\tif zeroUpDownSegsCached(req, segs) {\n\t\tfor i := range req.Cores {\n\t\t\treq.Cores[i].State = Loaded\n\t\t}\n\t\treturn segs, req, nil\n\t}\n\t// If there are still up or down segments to request, or if there are no\n\t// core segments no more action can be done here.\n\tif !req.upDownResolved() || req.Cores.IsEmpty() {\n\t\treturn segs, req, nil\n\t}\n\t// now resolve core segs:\n\treq.Cores, err = r.expandCores(segs, req)\n\tif err != nil {\n\t\treturn segs, req, err\n\t}\n\tif req.Cores, err = r.resolveCores(ctx, req); err != nil {\n\t\treturn segs, req, err\n\t}\n\tif len(req.Cores) == 0 {\n\t\treq.Cores = nil\n\t}\n\tfor i, coreReq := range req.Cores {\n\t\tif local, err := r.LocalInfo.IsSegLocal(ctx, coreReq.Src, coreReq.Dst); err != nil {\n\t\t\treturn segs, req, err\n\t\t} else if local {\n\t\t\tcoreReq.State = Cached\n\t\t}\n\t\tif coreReq.State != Cached && coreReq.State != Fetched {\n\t\t\tcontinue\n\t\t}\n\t\tcoreRes, err := r.DB.Get(ctx, &query.Params{\n\t\t\tStartsAt: []addr.IA{coreReq.Dst},\n\t\t\tEndsAt: []addr.IA{coreReq.Src},\n\t\t\tSegTypes: []proto.PathSegType{proto.PathSegType_core},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn segs, req, err\n\t\t}\n\t\tallRev, err := r.allRevoked(ctx, coreRes)\n\t\tif err != nil {\n\t\t\treturn segs, req, err\n\t\t}\n\t\tif allRev && coreReq.State != Fetched {\n\t\t\treq.Cores[i].State = Fetch\n\t\t} else {\n\t\t\treq.Cores[i].State = Loaded\n\t\t}\n\t\tsegs.Core = append(segs.Core, coreRes.Segs()...)\n\t}\n\treturn segs, req, nil\n}", "title": "" }, { "docid": "d373bb2ca2e1205724550d7a1d3fd30b", "score": "0.5538752", "text": "func EndPointResolve(c *gin.Context) {\n queryName := c.Query(\"name\")\n queryType := c.DefaultQuery(\"type\", \"1\")\n queryCd := c.DefaultQuery(\"cd\", \"false\")\n queryEdns := c.DefaultQuery(\"edns_client_subnet\", \"\")\n\n m := NewDnsMessageOutput()\n m.dnsRequest(queryName, queryType, queryCd, queryEdns)\n\n c.JSON(200, m)\n}", "title": "" }, { "docid": "62734be47b9ba03f0b4b6dd8a15865aa", "score": "0.54993266", "text": "func (rb *route) Resolve() *route {\n\tfor rb.Redirect != nil {\n\t\trb = rb.Redirect\n\t}\n\treturn rb\n}", "title": "" }, { "docid": "668cd22562721e429db3f4ad499f705e", "score": "0.5313228", "text": "func (c *Client) Resolve(fnName string) (string, error) {\n\tif strings.Contains(fnName, \".\") {\n\t\tfnName = strings.TrimSuffix(fnName, \".\"+faasNamespace)\n\t}\n\n\tfnName = \"s-\" + fnName\n\tsvc, err := c.endpointLister.Get(fnName)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Error listing \\\"%s.%s\\\": %s\", fnName, faasNamespace, err)\n\t}\n\n\tif len(svc.Subsets) == 0 {\n\t\treturn \"\", fmt.Errorf(\"No subsets available for \\\"%s.%s\\\"\", fnName, faasNamespace)\n\t}\n\n\tall := len(svc.Subsets[0].Addresses)\n\tif len(svc.Subsets[0].Addresses) == 0 {\n\t\treturn \"\", fmt.Errorf(\"No addresses in subset for \\\"%s.%s\\\"\", fnName, faasNamespace)\n\t}\n\n\ttarget := rand.Intn(all)\n\n\tserviceIP := svc.Subsets[0].Addresses[target].IP\n\n\treturn fmt.Sprintf(\"http://%s:%d\", serviceIP, 8080), nil\n}", "title": "" }, { "docid": "56e2d3d8014f3eaa77a77dd054ee772f", "score": "0.5239048", "text": "func (mg *Server) ResolveReferences(ctx context.Context, c client.Reader) error {\n\tr := reference.NewAPIResolver(c, mg)\n\n\tvar rsp reference.ResolutionResponse\n\tvar mrsp reference.MultiResolutionResponse\n\tvar err error\n\n\tif mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails != nil {\n\t\tmrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{\n\t\t\tCurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.AddressAllocationIDs),\n\t\t\tExtract: reference.ExternalName(),\n\t\t\tReferences: mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.AddressAllocationIDRefs,\n\t\t\tSelector: mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.AddressAllocationIDSelector,\n\t\t\tTo: reference.To{\n\t\t\t\tList: &v1beta1.AddressList{},\n\t\t\t\tManaged: &v1beta1.Address{},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.AddressAllocationIDs\")\n\t\t}\n\t\tmg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.AddressAllocationIDs = reference.ToPtrValues(mrsp.ResolvedValues)\n\t\tmg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.AddressAllocationIDRefs = mrsp.ResolvedReferences\n\n\t}\n\tif mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails != nil {\n\t\tmrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{\n\t\t\tCurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SecurityGroupIDs),\n\t\t\tExtract: reference.ExternalName(),\n\t\t\tReferences: mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SecurityGroupIDRefs,\n\t\t\tSelector: mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SecurityGroupIDSelector,\n\t\t\tTo: reference.To{\n\t\t\t\tList: &v1beta1.SecurityGroupList{},\n\t\t\t\tManaged: &v1beta1.SecurityGroup{},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SecurityGroupIDs\")\n\t\t}\n\t\tmg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SecurityGroupIDs = reference.ToPtrValues(mrsp.ResolvedValues)\n\t\tmg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SecurityGroupIDRefs = mrsp.ResolvedReferences\n\n\t}\n\tif mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails != nil {\n\t\tmrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{\n\t\t\tCurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SubnetIDs),\n\t\t\tExtract: reference.ExternalName(),\n\t\t\tReferences: mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SubnetIDRefs,\n\t\t\tSelector: mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SubnetIDSelector,\n\t\t\tTo: reference.To{\n\t\t\t\tList: &v1beta1.SubnetList{},\n\t\t\t\tManaged: &v1beta1.Subnet{},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SubnetIDs\")\n\t\t}\n\t\tmg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SubnetIDs = reference.ToPtrValues(mrsp.ResolvedValues)\n\t\tmg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.SubnetIDRefs = mrsp.ResolvedReferences\n\n\t}\n\tif mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails != nil {\n\t\trsp, err = r.Resolve(ctx, reference.ResolutionRequest{\n\t\t\tCurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCEndpointID),\n\t\t\tExtract: reference.ExternalName(),\n\t\t\tReference: mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCEndpointIDRef,\n\t\t\tSelector: mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCEndpointIDSelector,\n\t\t\tTo: reference.To{\n\t\t\t\tList: &v1alpha1.VPCEndpointList{},\n\t\t\t\tManaged: &v1alpha1.VPCEndpoint{},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCEndpointID\")\n\t\t}\n\t\tmg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCEndpointID = reference.ToPtrValue(rsp.ResolvedValue)\n\t\tmg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCEndpointIDRef = rsp.ResolvedReference\n\n\t}\n\tif mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails != nil {\n\t\trsp, err = r.Resolve(ctx, reference.ResolutionRequest{\n\t\t\tCurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCID),\n\t\t\tExtract: reference.ExternalName(),\n\t\t\tReference: mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCIDRef,\n\t\t\tSelector: mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCIDSelector,\n\t\t\tTo: reference.To{\n\t\t\t\tList: &v1beta1.VPCList{},\n\t\t\t\tManaged: &v1beta1.VPC{},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"mg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCID\")\n\t\t}\n\t\tmg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCID = reference.ToPtrValue(rsp.ResolvedValue)\n\t\tmg.Spec.ForProvider.CustomServerParameters.CustomEndpointDetails.VPCIDRef = rsp.ResolvedReference\n\n\t}\n\trsp, err = r.Resolve(ctx, reference.ResolutionRequest{\n\t\tCurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomServerParameters.Certificate),\n\t\tExtract: reference.ExternalName(),\n\t\tReference: mg.Spec.ForProvider.CustomServerParameters.CertificateRef,\n\t\tSelector: mg.Spec.ForProvider.CustomServerParameters.CertificateSelector,\n\t\tTo: reference.To{\n\t\t\tList: &v1beta11.CertificateList{},\n\t\t\tManaged: &v1beta11.Certificate{},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mg.Spec.ForProvider.CustomServerParameters.Certificate\")\n\t}\n\tmg.Spec.ForProvider.CustomServerParameters.Certificate = reference.ToPtrValue(rsp.ResolvedValue)\n\tmg.Spec.ForProvider.CustomServerParameters.CertificateRef = rsp.ResolvedReference\n\n\trsp, err = r.Resolve(ctx, reference.ResolutionRequest{\n\t\tCurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomServerParameters.LoggingRole),\n\t\tExtract: v1beta12.RoleARN(),\n\t\tReference: mg.Spec.ForProvider.CustomServerParameters.LoggingRoleRef,\n\t\tSelector: mg.Spec.ForProvider.CustomServerParameters.LoggingRoleSelector,\n\t\tTo: reference.To{\n\t\t\tList: &v1beta12.RoleList{},\n\t\t\tManaged: &v1beta12.Role{},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mg.Spec.ForProvider.CustomServerParameters.LoggingRole\")\n\t}\n\tmg.Spec.ForProvider.CustomServerParameters.LoggingRole = reference.ToPtrValue(rsp.ResolvedValue)\n\tmg.Spec.ForProvider.CustomServerParameters.LoggingRoleRef = rsp.ResolvedReference\n\n\treturn nil\n}", "title": "" }, { "docid": "33038cecbae453aacc82185440985705", "score": "0.5211904", "text": "func (mr *Resolver) Resolve(ctx context.Context) (*Conf, error) {\n\t// First check if already an active watching, close that if any.\n\tif err := mr.closeIfNeeded(ctx); err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot close previous watch: %w\", err)\n\t}\n\n\t// Retrieves individual configurations from all URIs in the given order, and merge them in retMap.\n\tretMap := New()\n\tfor _, uri := range mr.uris {\n\t\tret, err := mr.retrieveValue(ctx, uri)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot retrieve the configuration: %w\", err)\n\t\t}\n\t\tmr.closers = append(mr.closers, ret.Close)\n\t\tretCfgMap, err := ret.AsConf()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err = retMap.Merge(retCfgMap); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tcfgMap := make(map[string]any)\n\tfor _, k := range retMap.AllKeys() {\n\t\tval, err := mr.expandValueRecursively(ctx, retMap.Get(k))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcfgMap[k] = val\n\t}\n\tretMap = NewFromStringMap(cfgMap)\n\n\t// Apply the converters in the given order.\n\tfor _, confConv := range mr.converters {\n\t\tif err := confConv.Convert(ctx, retMap); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot convert the confmap.Conf: %w\", err)\n\t\t}\n\t}\n\n\treturn retMap, nil\n}", "title": "" }, { "docid": "01027101a45f94e551d18aa6beccdd94", "score": "0.51745415", "text": "func (_Registry *RegistrySession) Resolver() (common.Address, error) {\n\treturn _Registry.Contract.Resolver(&_Registry.CallOpts)\n}", "title": "" }, { "docid": "753d05231ebc8db8065551e568955cd1", "score": "0.5144414", "text": "func (_Registry *RegistryCaller) Resolver(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Registry.contract.Call(opts, out, \"resolver\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3df41597ab0eae054ceb2a9d19e4e8b3", "score": "0.51405203", "text": "func (_Registry *RegistryCallerSession) Resolver() (common.Address, error) {\n\treturn _Registry.Contract.Resolver(&_Registry.CallOpts)\n}", "title": "" }, { "docid": "1242820c7e945154d5a229b69911c23d", "score": "0.5136058", "text": "func (srv *Server) handleGet(res http.ResponseWriter, req *http.Request) {\n\tfor _, rute := range srv.routeGets {\n\t\tvals, ok := rute.parse(req.URL.Path)\n\t\tif ok {\n\t\t\trute.endpoint.call(res, req, srv.evals, vals)\n\t\t\treturn\n\t\t}\n\t}\n\n\tsrv.HandleFS(res, req)\n}", "title": "" }, { "docid": "369f18ee5294ada009759c5fd25cf67b", "score": "0.5122992", "text": "func (r *Resolver) Resolve(ctx context.Context, params []pipelinev1beta1.Param) (framework.ResolvedResource, error) {\n\tif r.isDisabled(ctx) {\n\t\treturn nil, errors.New(disabledError)\n\t}\n\topts, err := OptionsFromParams(ctx, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnamespace := common.RequestNamespace(ctx)\n\tkc, err := k8schain.New(ctx, r.kubeClientSet, k8schain.Options{\n\t\tNamespace: namespace,\n\t\tServiceAccountName: opts.ServiceAccount,\n\t})\n\tctx, cancelFn := context.WithTimeout(ctx, timeoutDuration)\n\tdefer cancelFn()\n\treturn GetEntry(ctx, kc, opts)\n}", "title": "" }, { "docid": "f41d71e119758bc9464eef4744d472ba", "score": "0.51091844", "text": "func (resolver UserResolver) AllUserResolver(param graphql.ResolveParams) (interface{}, error) {\n\tctx := param.Context\n\tusers, err := resolver.userService.GetAllUser(ctx)\n\n\tif err != nil {\n\t\tlog.Logger(ctx).Errorf(\"Error from Service : %v \", err)\n\t\treturn nil, err\n\t}\n\treturn users, nil\n}", "title": "" }, { "docid": "7f42ab0e7cbc6282c0ee5a6e92148da9", "score": "0.5098851", "text": "func (s serverImpl) ResolversByURL(ctx context.Context, request *data.QueryResolversByURLRequest) (*data.QueryResolversByURLResponse, error) {\n\tif len(request.Url) == 0 {\n\t\treturn nil, regenerrors.ErrInvalidArgument.Wrap(\"URL cannot be empty\")\n\t}\n\n\tpg, err := ormutil.GogoPageReqToPulsarPageReq(request.Pagination)\n\tif err != nil {\n\t\treturn nil, regenerrors.ErrInvalidArgument.Wrap(err.Error())\n\t}\n\n\tit, err := s.stateStore.ResolverTable().List(\n\t\tctx,\n\t\tapi.ResolverUrlIndexKey{}.WithUrl(request.Url),\n\t\tormlist.Paginate(pg),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer it.Close()\n\n\tres := &data.QueryResolversByURLResponse{}\n\tfor it.Next() {\n\t\tresolver, err := it.Value()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmanager := sdk.AccAddress(resolver.Manager).String()\n\n\t\tres.Resolvers = append(res.Resolvers, &data.ResolverInfo{\n\t\t\tId: resolver.Id,\n\t\t\tUrl: resolver.Url,\n\t\t\tManager: manager,\n\t\t})\n\t}\n\n\tres.Pagination, err = ormutil.PulsarPageResToGogoPageRes(it.PageResponse())\n\tif err != nil {\n\t\treturn nil, regenerrors.ErrInternal.Wrap(err.Error())\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "1f26818ebd2e7169301e91454a213c8a", "score": "0.5090413", "text": "func (n *network) startResolver() {\n}", "title": "" }, { "docid": "ad25661e55c8783b356558c1e5d45a1a", "score": "0.5058022", "text": "func (r *Resolver) Resolve(host, port string) []string {\n\tr.r = rsv.NewResolver(host, port, r.needRefresh, &r.refreshRate, r.C)\n\tr.r.StartResolver()\n\treturn r.r.Addresses\n}", "title": "" }, { "docid": "7dbbd3f1eabb9e90daf4c17da01a31f8", "score": "0.5000996", "text": "func AddFinderForAllQueryResolverFun(e *Entity, f *File) {\n\tfun := GraphqlFinderQueryForAll(e)\n\tres := GraphqlResolverResult(fun)\n\n\tResolverFun(fun, func(g *Group) {\n\n\t\tTimeNow(g)\n\n\t\tg.List(\n\t\t\tId(VarName(e.PluralName())),\n\t\t\tErr(),\n\t\t).Op(\":=\").Id(fmt.Sprintf(\"FindAll%s\", e.PluralName())).Call(\n\t\t\tId(\"r\").Dot(\"Db\"),\n\t\t\tId(\"args\").Dot(\"Limit\"),\n\t\t\tId(\"args\").Dot(\"Offset\"),\n\t\t)\n\n\t\tMaybeReturnWrappedErrorAndIncrementCounter(\n\t\t\tfmt.Sprintf(\"Error finding all %s \", e.PluralName()),\n\t\t\tFindAllQueryErrorCounterName(e),\n\t\t\tg,\n\t\t)\n\n\t\tg.Id(\"resolvers\").Op(\":=\").Id(res).Values(Dict{})\n\n\t\tg.For(\n\t\t\tList(\n\t\t\t\tId(\"_\"),\n\t\t\t\tId(e.VarName()),\n\t\t\t).Op(\":=\").Range().Id(VarName(e.PluralName())),\n\t\t).BlockFunc(func(g2 *Group) {\n\n\t\t\tg2.Id(\"resolvers\").Op(\"=\").Append(\n\t\t\t\tId(\"resolvers\"),\n\t\t\t\tOp(\"&\").Id(GraphqlResolverForEntity(e)).Values(Dict{\n\t\t\t\t\tId(\"Db\"): Id(\"r\").Dot(\"Db\"),\n\t\t\t\t\tId(\"Data\"): Id(e.VarName()),\n\t\t\t\t}),\n\t\t\t)\n\t\t})\n\n\t\tObserveDuration(FindAllQueryHistogramName(e), g)\n\n\t\tg.Return(\n\t\t\tOp(\"&\").Id(\"resolvers\"),\n\t\t\tNil(),\n\t\t)\n\n\t}, f)\n}", "title": "" }, { "docid": "2d361c1bda24d9c66492d0d28b74009b", "score": "0.49955043", "text": "func (r *DefaultResolver) resolveCores(ctx context.Context,\n\treq RequestSet) (Requests, error) {\n\n\tneedsFetching := make(map[Request]bool)\n\tfor i, coreReq := range req.Cores {\n\t\tif coreReq.State == Fetched {\n\t\t\treq.Cores[i].State = Cached\n\t\t\tcontinue\n\t\t}\n\t\tif coreReq.State == Fetch {\n\t\t\tcontinue\n\t\t}\n\t\tcoreFetch, ok := needsFetching[coreReq]\n\t\tif !ok {\n\t\t\tvar err error\n\t\t\tif coreFetch, err = r.needsFetching(ctx, coreReq); err != nil {\n\t\t\t\treturn req.Cores, err\n\t\t\t}\n\t\t\tneedsFetching[coreReq] = coreFetch\n\t\t}\n\t\tif coreFetch {\n\t\t\treq.Cores[i].State = Fetch\n\t\t} else {\n\t\t\treq.Cores[i].State = Cached\n\t\t}\n\t}\n\treturn req.Cores, nil\n}", "title": "" }, { "docid": "180c8bb244815d01e218f20b52847cfb", "score": "0.49879837", "text": "func (srv *Server) registerGet(ep *Endpoint) (err error) {\n\tep.RequestType = RequestTypeQuery\n\n\t// Check if the same route already registered.\n\tfor _, rute := range srv.routeGets {\n\t\t_, ok := rute.parse(ep.Path)\n\t\tif ok {\n\t\t\treturn ErrEndpointAmbiguous\n\t\t}\n\t}\n\n\trute, err := newRoute(ep)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrv.routeGets = append(srv.routeGets, rute)\n\n\treturn nil\n}", "title": "" }, { "docid": "daf9f56d200f740be9c6dfa26e3f2b91", "score": "0.49697602", "text": "func Resolver(handler dns.Handler) dns.Handler {\n\treturn dns.HandlerFunc(func(w dns.ResponseWriter, req *dns.Msg) {\n\t\t// forward query if no recursion is desired\n\t\tif !req.RecursionDesired {\n\t\t\thandler.ServeDNS(w, req)\n\t\t\treturn\n\t\t}\n\n\t\t// prepare response\n\t\tres := new(dns.Msg)\n\t\tres.SetReply(req)\n\t\tres.RecursionAvailable = true\n\n\t\t// query handler\n\t\tvar wr responseWriter\n\t\thandler.ServeDNS(&wr, req)\n\n\t\t// check response\n\t\tif wr.msg == nil {\n\t\t\t_ = w.WriteMsg(res)\n\t\t\treturn\n\t\t}\n\n\t\t// add resolved answers\n\t\tres.Answer = append(res.Answer, resolve(handler, wr.msg.Answer)...)\n\n\t\t// write response\n\t\terr := w.WriteMsg(res)\n\t\tif err != nil {\n\t\t\t_ = w.Close()\n\t\t}\n\t})\n}", "title": "" }, { "docid": "92d4172bc52c5a5173a83df483d4f055", "score": "0.49584067", "text": "func LookupAllResolverIPs(ctx context.Context, resolver HostLookupper) (ips []string, err error) {\n\tif resolver == nil {\n\t\tresolver = &net.Resolver{}\n\t}\n\tips, err = resolver.LookupHost(ctx, \"whoami.akamai.net\")\n\treturn\n}", "title": "" }, { "docid": "a6500c4d996da76d0d5305fbb42f72fd", "score": "0.4955685", "text": "func (c *Client) Resolver(_ context.Context, client *http.Client, plainHTTP bool) (remotes.Resolver, error) {\n\treturn docker.NewResolver(docker.ResolverOptions{\n\t\tCredentials: c.Credential,\n\t\tClient: client,\n\t\tPlainHTTP: plainHTTP,\n\t}), nil\n}", "title": "" }, { "docid": "c17a0089f6ea3a79586a3ede852d3509", "score": "0.4946834", "text": "func (i *Indexer) Resolve(ctx netctx.Context, req *ResolveRequest) (*ResolveResponse, error) {\n\ti.m.RLock()\n\tidx, ok := i.indexes[req.Partition]\n\ti.m.RUnlock()\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unknown partition requested\")\n\t}\n\tids, err := idx.Resolve(req.Matchers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ResolveResponse{\n\t\tIds: ids,\n\t}, nil\n}", "title": "" }, { "docid": "9f403b176538ed9c510f8fb6c2b0db11", "score": "0.49295688", "text": "func ExampleNewResolver() {\n\t// create a yaml.Node reference as a root node.\n\tvar rootNode yaml.Node\n\n\t// load in the Stripe OpenAPI spec (lots of polymorphic complexity in here)\n\tstripeBytes, _ := ioutil.ReadFile(\"../test_specs/stripe.yaml\")\n\n\t// unmarshal bytes into our rootNode.\n\t_ = yaml.Unmarshal(stripeBytes, &rootNode)\n\n\t// create a new spec index (resolver depends on it)\n\tindexConfig := index.CreateClosedAPIIndexConfig()\n\tindex := index.NewSpecIndexWithConfig(&rootNode, indexConfig)\n\n\t// create a new resolver using the index.\n\tresolver := NewResolver(index)\n\n\t// resolve the document, if there are circular reference errors, they are returned/\n\t// WARNING: this is a destructive action and the rootNode will be PERMANENTLY altered and cannot be unresolved\n\tcircularErrors := resolver.Resolve()\n\n\t// The Stripe API has a bunch of circular reference problems, mainly from polymorphism.\n\t// So let's print them out.\n\t//\n\tfmt.Printf(\"There are %d circular reference errors, %d of them are polymorphic errors, %d are not\",\n\t\tlen(circularErrors), len(resolver.GetPolymorphicCircularErrors()), len(resolver.GetNonPolymorphicCircularErrors()))\n\t// Output: There are 3 circular reference errors, 0 of them are polymorphic errors, 3 are not\n}", "title": "" }, { "docid": "78017176ae91aa585748e301977ffd59", "score": "0.49261865", "text": "func RegisterGet(toHandle ...ToHandler) {\n\tfor _, hand := range toHandle {\n\t\tRouter.HandleFunc(hand.ToHandler()).Methods(\"GET\")\n\t}\n}", "title": "" }, { "docid": "683b1a741e8f1978c62718da4107012a", "score": "0.48792034", "text": "func (t *Client) ResolveEndpoints(ctx context.Context, authorityInfo authority.Info, userPrincipalName string) (authority.Endpoints, error) {\n\treturn t.Resolver.ResolveEndpoints(ctx, authorityInfo, userPrincipalName)\n}", "title": "" }, { "docid": "d1d762f86ed432cbb46075ec00ce5024", "score": "0.48625177", "text": "func (r *CachingResolver) Resolve(request *model.Request) (response *model.Response, err error) {\n\tlogger := withPrefix(request.Log, \"caching_resolver\")\n\n\tif r.maxCacheTimeSec < 0 {\n\t\tlogger.Debug(\"skip cache\")\n\n\t\treturn r.next.Resolve(request)\n\t}\n\n\tresp := new(dns.Msg)\n\tresp.SetReply(request.Req)\n\n\tfor _, question := range request.Req.Question {\n\t\tdomain := util.ExtractDomain(question)\n\t\tcacheKey := util.GenerateCacheKey(dns.Type(question.Qtype), domain)\n\t\tlogger := logger.WithField(\"domain\", util.Obfuscate(domain))\n\n\t\tr.trackQueryDomainNameCount(domain, cacheKey, logger)\n\n\t\tval, ttl := r.resultCache.Get(cacheKey)\n\n\t\tif val != nil {\n\t\t\tlogger.Debug(\"domain is cached\")\n\n\t\t\tevt.Bus().Publish(evt.CachingResultCacheHit, domain)\n\n\t\t\tv, ok := val.(cacheValue)\n\t\t\tif ok {\n\t\t\t\tif v.prefetch {\n\t\t\t\t\t// Hit from prefetch cache\n\t\t\t\t\tevt.Bus().Publish(evt.CachingPrefetchCacheHit, domain)\n\t\t\t\t}\n\n\t\t\t\t// Answer from successful request\n\t\t\t\tresp.Answer = v.answer\n\t\t\t\tfor _, rr := range resp.Answer {\n\t\t\t\t\trr.Header().Ttl = uint32(ttl.Seconds())\n\t\t\t\t}\n\n\t\t\t\treturn &model.Response{Res: resp, RType: model.ResponseTypeCACHED, Reason: \"CACHED\"}, nil\n\t\t\t}\n\t\t\t// Answer with response code != OK\n\t\t\tresp.Rcode = val.(int)\n\n\t\t\treturn &model.Response{Res: resp, RType: model.ResponseTypeCACHED, Reason: \"CACHED NEGATIVE\"}, nil\n\t\t}\n\n\t\tevt.Bus().Publish(evt.CachingResultCacheMiss, domain)\n\n\t\tlogger.WithField(\"next_resolver\", Name(r.next)).Debug(\"not in cache: go to next resolver\")\n\t\tresponse, err = r.next.Resolve(request)\n\n\t\tif err == nil {\n\t\t\tr.putInCache(cacheKey, response, false, r.redisEnabled)\n\t\t}\n\t}\n\n\treturn response, err\n}", "title": "" }, { "docid": "e7805c0b463a74c1612ea4d95da200a3", "score": "0.48586103", "text": "func (r *Resolver) FetchAndResolve(ctx context.Context, resources []ResourceIdentifier) []ResourceResult {\n\tvar results []ResourceResult\n\n\tfor _, resource := range resources {\n\t\tu, err := r.fetchResource(ctx, resource)\n\t\tif err != nil {\n\t\t\tif k8serrors.IsNotFound(errors.Cause(err)) {\n\t\t\t\tresults = append(results, ResourceResult{\n\t\t\t\t\tResource: resource,\n\t\t\t\t\tResult: &status.Result{\n\t\t\t\t\t\tStatus: status.CurrentStatus,\n\t\t\t\t\t\tMessage: \"Resource does not exist\",\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tresults = append(results, ResourceResult{\n\t\t\t\t\tResult: &status.Result{\n\t\t\t\t\t\tStatus: status.UnknownStatus,\n\t\t\t\t\t\tMessage: fmt.Sprintf(\"Error fetching resource from cluster: %v\", err),\n\t\t\t\t\t},\n\t\t\t\t\tResource: resource,\n\t\t\t\t\tError: err,\n\t\t\t\t})\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tres, err := r.statusComputeFunc(u)\n\t\tresults = append(results, ResourceResult{\n\t\t\tResult: res,\n\t\t\tResource: resource,\n\t\t\tError: err,\n\t\t})\n\t}\n\n\treturn results\n}", "title": "" }, { "docid": "957aa1ae3662800d2801af8b08629605", "score": "0.48404026", "text": "func (router *GinRouterWrapper) GET(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes {\n\treturn router.Handle(http.MethodGet, relativePath, handlers...)\n}", "title": "" }, { "docid": "5ed0f34c065130873cee6aafc289ccbf", "score": "0.4837814", "text": "func (c *Client) Resolve(name string, rrType RRType) (*Response, error) {\n\tresp, err := c.httpClient.Get(rawurl(name, rrType))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tio.CopyN(ioutil.Discard, resp.Body, 64)\n\t\tresp.Body.Close()\n\t}()\n\n\tr := &Response{Questions: []Question{}, Answers: []Answer{}}\n\n\tif err := json.NewDecoder(resp.Body).Decode(r); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "7c8a37816662e62f3fefdc115183eff8", "score": "0.48374367", "text": "func (group *RouterGroup) GET(relativePath string, handlers ...HandlerFunc) IRoutes {\n\treturn group.handle(\"GET\", relativePath, handlers)\n}", "title": "" }, { "docid": "6914ec75b11e5368764237b80235d2c5", "score": "0.48275688", "text": "func Resolve(name string, rrType RRType) (*Response, error) {\n\treturn DefaultClient.Resolve(name, rrType)\n}", "title": "" }, { "docid": "9a077754b9802890dc6092a38f94389c", "score": "0.48192516", "text": "func (l *LocalResolver) Resolve(c *model.Connections) {\n\tl.mux.RLock()\n\tdefer l.mux.RUnlock()\n\n\ttype connKey struct {\n\t\tladdr, raddr netip.AddrPort\n\t\tproto model.ConnectionType\n\t\tnetns uint32\n\t}\n\n\tctrsByConn := make(map[connKey]string, len(c.Conns))\n\tfor _, conn := range c.Conns {\n\t\tif conn.Laddr == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// resolve laddr\n\t\t//\n\t\t// if process monitoring is enabled in the system-probe,\n\t\t// then laddr container id may be set, so check that\n\t\t// first\n\t\tcid := conn.Laddr.ContainerId\n\t\tif cid == \"\" {\n\t\t\tcid = l.ctrForPid[int(conn.Pid)]\n\t\t}\n\n\t\tif cid == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tconn.Laddr.ContainerId = cid\n\n\t\tif !conn.IntraHost {\n\t\t\tcontinue\n\t\t}\n\n\t\tladdr, raddr, err := translatedAddrs(conn)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif conn.Direction == model.ConnectionDirection_incoming {\n\t\t\traddr = netip.AddrPortFrom(raddr.Addr(), 0)\n\t\t}\n\n\t\tk := connKey{\n\t\t\tladdr: laddr,\n\t\t\traddr: raddr,\n\t\t\tproto: conn.Type,\n\t\t\tnetns: conn.NetNS,\n\t\t}\n\t\tif conn.NetNS != 0 {\n\t\t\tctrsByConn[k] = cid\n\t\t}\n\t\tif !laddr.Addr().IsLoopback() {\n\t\t\tk.netns = 0\n\t\t\tctrsByConn[k] = cid\n\t\t}\n\t}\n\n\tlog.Tracef(\"ctrsByConn = %v\", ctrsByConn)\n\n\t// go over connections again using hashtable computed earlier to resolver raddr\n\tfor _, conn := range c.Conns {\n\t\tif conn.Raddr.ContainerId != \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tladdr, raddr, err := translatedAddrs(conn)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif conn.IntraHost {\n\t\t\tif conn.Direction == model.ConnectionDirection_outgoing {\n\t\t\t\tladdr = netip.AddrPortFrom(laddr.Addr(), 0)\n\t\t\t}\n\n\t\t\tvar ok bool\n\t\t\tk := connKey{\n\t\t\t\tladdr: raddr,\n\t\t\t\traddr: laddr,\n\t\t\t\tproto: conn.Type,\n\t\t\t\tnetns: conn.NetNS,\n\t\t\t}\n\t\t\tif conn.Raddr.ContainerId, ok = ctrsByConn[k]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif !raddr.Addr().IsLoopback() {\n\t\t\t\tk.netns = 0\n\t\t\t\tif conn.Raddr.ContainerId, ok = ctrsByConn[k]; ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif conn.Raddr.ContainerId = l.addrToCtrID[model.ContainerAddr{\n\t\t\tIp: raddr.Addr().String(),\n\t\t\tPort: int32(raddr.Port()),\n\t\t\tProtocol: conn.Type,\n\t\t}]; conn.Raddr.ContainerId == \"\" {\n\t\t\tlog.Tracef(\"could not resolve raddr %v\", conn.Raddr)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "102dd1d0cc8111ffb9155e67c091227c", "score": "0.48065805", "text": "func (s *Server) HandleGetServiceRoutingRequest() http.HandlerFunc {\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\t\tdefer cancel()\n\n\t\t// Verify token\n\t\t_, err := s.auth.VerifyToken(utils.GetToken(r))\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Failed to get service routes - %s\", err.Error())\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tserviceID, exists := r.URL.Query()[\"id\"]\n\n\t\tserviceRoutes, err := s.driver.GetServiceRoutes(ctx, projectID)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Failed to get service routing rules - %s\", err.Error())\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif exists {\n\t\t\tfor k, result := range serviceRoutes {\n\t\t\t\tif k == serviceID[0] {\n\t\t\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\t\t\t_ = json.NewEncoder(w).Encode(model.Response{Result: result})\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t_ = json.NewEncoder(w).Encode(map[string]string{\"error\": fmt.Sprintf(\"serviceID(%s) not present in state\", serviceID[0])})\n\t\t\treturn\n\t\t}\n\n\t\tvar result model.Routes\n\t\tfor _, value := range serviceRoutes {\n\t\t\tresult = append(result, value...)\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_ = json.NewEncoder(w).Encode(model.Response{Result: result})\n\t}\n}", "title": "" }, { "docid": "2ddbe751d2ad8eb4cd009a5be82d8e83", "score": "0.4789699", "text": "func (a NetApi) GetDnsResolverList() (*NetDnsResolverList, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/net/dnsResolver\"\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(NetDnsResolverList)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.47861776", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.47861776", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.47861776", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "fde037cf9e672b33f4c6a1325a9251e4", "score": "0.47859967", "text": "func customResolver(nameServer, useNetwork string) net.Resolver {\n\treturn net.Resolver{\n\t\tPreferGo: true,\n\t\tDial: func(ctx context.Context, network, address string) (net.Conn, error) {\n\t\t\td := net.Dialer{\n\t\t\t\tTimeout: time.Second * defaultDnsTimeout,\n\t\t\t}\n\t\t\treturn d.DialContext(ctx, useNetwork, nameServer+\":\"+defaultDnsPort)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4fc7a8e81fe33ad97613e85659b7f602", "score": "0.47789827", "text": "func (h *JSONAPIHandler) GetRelated(root *ModelHandler, endpoint *Endpoint) http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, req *http.Request) {\n\t\tif _, ok := h.ModelHandlers[root.ModelType]; !ok {\n\t\t\th.MarshalInternalError(rw)\n\t\t\treturn\n\t\t}\n\t\tSetContentType(rw)\n\n\t\t/**\n\n\t\tGET RELATED: BUILD SCOPE\n\n\t\t*/\n\t\tscope, errs, err := h.Controller.BuildScopeRelated(req, reflect.New(root.ModelType).Interface())\n\t\tif err != nil {\n\t\t\th.log.Errorf(\"An internal error occurred while building related scope for model: '%v'. %v\", reflect.TypeOf(root), err)\n\t\t\th.MarshalInternalError(rw)\n\t\t\treturn\n\t\t}\n\t\tif len(errs) > 0 {\n\t\t\th.MarshalErrors(rw, errs...)\n\t\t\treturn\n\t\t}\n\n\t\tscope.NewValueSingle()\n\n\t\t/**\n\n\t\tGET RELATED: LANGUAGE\n\n\t\t*/\n\n\t\ttag, ok := h.GetLanguage(req, rw)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tif scope.UseI18n() {\n\t\t\tscope.SetLanguageFilter(tag.String())\n\t\t}\n\n\t\t/**\n\n\t\tGET RELATED: PRECHECK PAIR\n\n\t\t*/\n\t\tif !h.AddPrecheckPairFilters(scope, root, endpoint, req, rw, endpoint.PrecheckPairs...) {\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET RELATED: PRECHECK FILTERS\n\n\t\t*/\n\t\tif !h.AddPrecheckFilters(scope, req, rw, endpoint.PrecheckFilters...) {\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET RELATED: GET RELATIONSHIP FILTERS\n\n\t\t*/\n\n\t\terr = h.GetRelationshipFilters(scope, req, rw)\n\t\tif err != nil {\n\t\t\tif hErr := err.(*HandlerError); hErr != nil {\n\t\t\t\tif !h.handleHandlerError(hErr, rw) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\th.log.Error(err)\n\t\t\t\th.MarshalInternalError(rw)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// Get root repository\n\t\trootRepository := h.GetRepositoryByType(root.ModelType)\n\t\t// Get the root for given id\n\t\t// Select the related field inside\n\n\t\t/**\n\n\t\t GET RELATED: HOOK BEFORE READ\n\n\t\t*/\n\n\t\tif errObj := h.HookBeforeReader(scope); errObj != nil {\n\t\t\th.MarshalErrors(rw, errObj)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET RELATED: REPOSITORY GET ROOT\n\n\t\t*/\n\t\tdbErr := rootRepository.Get(scope)\n\t\tif dbErr != nil {\n\t\t\th.manageDBError(rw, dbErr)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\t GET RELATED: ROOT HOOK AFTER READ\n\n\t\t*/\n\t\tif errObj := h.HookAfterReader(scope); errObj != nil {\n\t\t\th.MarshalErrors(rw, errObj)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET RELATED: BUILD RELATED SCOPE\n\n\t\t*/\n\n\t\trelatedScope, err := scope.GetRelatedScope()\n\t\tif err != nil {\n\t\t\th.log.Errorf(\"Error while getting Related Scope: %v\", err)\n\t\t\th.MarshalInternalError(rw)\n\t\t\treturn\n\t\t}\n\n\t\t// if there is any primary filter\n\t\tif relatedScope.Value != nil && len(relatedScope.PrimaryFilters) != 0 {\n\n\t\t\trelatedRepository := h.GetRepositoryByType(relatedScope.Struct.GetType())\n\t\t\tif relatedScope.UseI18n() {\n\t\t\t\trelatedScope.SetLanguageFilter(tag.String())\n\t\t\t}\n\n\t\t\t/**\n\n\t\t\t GET RELATED: HOOK BEFORE READER\n\n\t\t\t*/\n\t\t\tif errObj := h.HookBeforeReader(relatedScope); errObj != nil {\n\t\t\t\th.MarshalErrors(rw, errObj)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// SELECT METHOD TO GET\n\t\t\tif relatedScope.IsMany {\n\t\t\t\th.log.Debug(\"The related scope isMany.\")\n\t\t\t\tdbErr = relatedRepository.List(relatedScope)\n\t\t\t} else {\n\t\t\t\th.log.Debug(\"The related scope isSingle.\")\n\t\t\t\th.log.Debugf(\"The value of related scope: %+v\", relatedScope.Value)\n\t\t\t\th.log.Debugf(\"Fieldset %+v\", relatedScope.Fieldset)\n\t\t\t\tdbErr = relatedRepository.Get(relatedScope)\n\t\t\t}\n\t\t\tif dbErr != nil {\n\t\t\t\th.manageDBError(rw, dbErr)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t/**\n\n\t\t\tHOOK AFTER READER\n\n\t\t\t*/\n\t\t\tif errObj := h.HookAfterReader(relatedScope); errObj != nil {\n\t\t\t\th.MarshalErrors(rw, errObj)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\th.HeaderContentLanguage(rw, tag)\n\t\th.MarshalScope(relatedScope, rw, req)\n\t\treturn\n\n\t}\n}", "title": "" }, { "docid": "f5fad7aa6625d9a95a55da4c0a3f07ea", "score": "0.47761738", "text": "func (Group *RouterGroup) GET(relativePath string, handlers ...HandlerFunc) IRoutes {\n\treturn Group.handle(http.MethodGet, relativePath, handlers)\n}", "title": "" }, { "docid": "d1b640ebea8582d57d59503744aef977", "score": "0.47678718", "text": "func Resolve(w http.ResponseWriter, r *http.Request) {\n\tglog.Infof(\"request: %+v\", r)\n\tglog.Infof(\"request mux vars: %+v\", mux.Vars(r))\n\n\tu := r.URL\n\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\tif u.Host == \"\" {\n\t\tu.Host = r.Host\n\t}\n\n\t// glog.Infof(\"scheme: %s\", u.Scheme)\n\t// glog.Infof(\"host: %s\", u.Host)\n\tglog.Infof(\"path: %s\", u.Path)\n\n\tglog.Infof(\"url: %s\", u.String())\n\n\tredir, err := load(u.String())\n\tif err == nil {\n\t\tglog.Infof(\"Found source URL %s, redirecting to target URL %s\", redir.Key, redir.TargetUrl)\n\t\tgo redis.HIncrBy(ctx, redir.Key, \"Clicks\", 1)\n\t\thttp.Redirect(w, r, redir.TargetUrl, http.StatusMovedPermanently)\n\t} else {\n\t\tglog.Infof(\"Error: %s. Redirecting to default target URL %s\", err, filenotfound)\n\t\thttp.Redirect(w, r, filenotfound, http.StatusMovedPermanently)\n\t}\n}", "title": "" }, { "docid": "737518259a6d8dc50e93fa37ee5499f0", "score": "0.47675458", "text": "func (c Chain) Resolve(routeHandler Handler) http.HandlerFunc {\n\treturn c.errorHandler(c.foldMiddleware()(routeHandler))\n}", "title": "" }, { "docid": "44c00c34294d0dc316300630832396c4", "score": "0.47667563", "text": "func (d *openAPIDependency) resolve(c *gin.Context, op *openAPIOperation) (map[string]string, interface{}, error) {\n\t// Identity dependencies are first. Just return if it's one of them.\n\tif d == &contextDependency {\n\t\treturn nil, c.Request.Context(), nil\n\t}\n\n\tif d == &ginContextDependency {\n\t\treturn nil, c, nil\n\t}\n\n\tif d == &operationIDDependency {\n\t\treturn nil, op.id, nil\n\t}\n\n\tv := reflect.ValueOf(d.handler)\n\tif v.Kind() != reflect.Func {\n\t\t// Not a function, just return the global value.\n\t\treturn nil, d.handler, nil\n\t}\n\n\t// Generate the input arguments\n\tin := make([]reflect.Value, 0, v.Type().NumIn())\n\theaders := map[string]string{}\n\n\t// Resolve each sub-dependency\n\tfor _, dep := range d.dependencies {\n\t\tdHeaders, dVal, err := dep.resolve(c, op)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tfor h, hv := range dHeaders {\n\t\t\theaders[h] = hv\n\t\t}\n\n\t\tin = append(in, reflect.ValueOf(dVal))\n\t}\n\n\t// Get each input parameter\n\tfor _, param := range d.params {\n\t\tv, ok := getParamValue(c, param)\n\t\tif !ok {\n\t\t\treturn nil, nil, fmt.Errorf(\"could not get param value\")\n\t\t}\n\n\t\tin = append(in, reflect.ValueOf(v))\n\t}\n\n\t// Call the function.\n\tout := v.Call(in)\n\n\tif last := out[len(out)-1]; !last.IsNil() {\n\t\t// There was an error!\n\t\treturn nil, nil, last.Interface().(error)\n\t}\n\n\t// Get the headers & response value.\n\tfor i, h := range d.responseHeaders {\n\t\theaders[h.Name] = out[i].Interface().(string)\n\t}\n\n\treturn headers, out[len(d.responseHeaders)].Interface(), nil\n}", "title": "" }, { "docid": "0f46f03362eacb739f71aee3cb8e5e4d", "score": "0.47573897", "text": "func (this *router)Get(mountpoint string, processor Tout) Router {\n return this.UseSpecified(mountpoint, \"GET\", processor, true)\n}", "title": "" }, { "docid": "3beb5afda49615fbca8591ff77c6b5f5", "score": "0.4753835", "text": "func (t *DNSResolvers) run(parentCtx context.Context) []DNSEntry {\n\t// create output channels for the lookup\n\tsystemOut := make(chan []string)\n\tudpOut := make(chan []string)\n\thttpsOut := make(chan []string)\n\twhoamiSystemV4Out := make(chan []DNSWhoamiInfoEntry)\n\twhoamiUDPv4Out := make(chan []DNSWhoamiInfoEntry)\n\n\t// TODO(bassosimone): add opportunistic support for detecting\n\t// whether DNS queries are answered regardless of dest addr by\n\t// sending a few queries to root DNS servers\n\n\tudpAddress := t.udpAddress()\n\n\t// start asynchronous lookups\n\tgo t.lookupHostSystem(parentCtx, systemOut)\n\tgo t.lookupHostUDP(parentCtx, udpAddress, udpOut)\n\tgo t.lookupHostDNSOverHTTPS(parentCtx, httpsOut)\n\tgo t.whoamiSystemV4(parentCtx, whoamiSystemV4Out)\n\tgo t.whoamiUDPv4(parentCtx, udpAddress, whoamiUDPv4Out)\n\n\t// collect resulting IP addresses (which may be nil/empty lists)\n\tsystemAddrs := <-systemOut\n\tudpAddrs := <-udpOut\n\thttpsAddrs := <-httpsOut\n\n\t// collect whoami results (which also may be nil/empty)\n\twhoamiSystemV4 := <-whoamiSystemV4Out\n\twhoamiUDPv4 := <-whoamiUDPv4Out\n\tt.TestKeys.WithDNSWhoami(func(di *DNSWhoamiInfo) {\n\t\tdi.SystemV4 = whoamiSystemV4\n\t\tdi.UDPv4[udpAddress] = whoamiUDPv4\n\t})\n\n\t// merge the resolved IP addresses\n\tmerged := map[string]*DNSEntry{}\n\tfor _, addr := range systemAddrs {\n\t\tif _, found := merged[addr]; !found {\n\t\t\tmerged[addr] = &DNSEntry{}\n\t\t}\n\t\tmerged[addr].Addr = addr\n\t\tmerged[addr].Flags |= DNSAddrFlagSystemResolver\n\t}\n\tfor _, addr := range udpAddrs {\n\t\tif _, found := merged[addr]; !found {\n\t\t\tmerged[addr] = &DNSEntry{}\n\t\t}\n\t\tmerged[addr].Addr = addr\n\t\tmerged[addr].Flags |= DNSAddrFlagUDP\n\t}\n\tfor _, addr := range httpsAddrs {\n\t\tif _, found := merged[addr]; !found {\n\t\t\tmerged[addr] = &DNSEntry{}\n\t\t}\n\t\tmerged[addr].Addr = addr\n\t\tmerged[addr].Flags |= DNSAddrFlagHTTPS\n\t}\n\tvar entries []DNSEntry\n\tfor _, entry := range merged {\n\t\tentries = append(entries, *entry)\n\t}\n\n\treturn entries\n}", "title": "" }, { "docid": "d93820ad2d31bf7a13b3f3fdc00b58a6", "score": "0.4753758", "text": "func (r *Resolver) Resolve(ctx context.Context, service string) (services []Service, err error) {\n\tdomains, err := lookupDomains()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"serviceresolver: %v\", err)\n\t}\n\tservices, err = lookupServices(service, domains)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"serviceresolver: %v\", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "992cef52c2e16614242afb2c4a976ea6", "score": "0.47475812", "text": "func (r *IndexesResolver) Resolve(ctx context.Context) error {\n\tr.once.Do(func() { r.err = r.resolve(ctx) })\n\treturn r.err\n}", "title": "" }, { "docid": "03f161c514e027b009135e5e1d6885ae", "score": "0.4735388", "text": "func (client PathItemsClient) GetAllWithValuesResponder(resp *http.Response) (result autorest.Response, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n}", "title": "" }, { "docid": "b27bd57565fdd90f8bbd39fe0244229b", "score": "0.47330666", "text": "func NewResolver(cfg config.Mapping) Resolver {\n\tpfConfig := cfg.TLD.Platform\n\tres := resolve{\n\t\tcfg: pfConfig,\n\t}\n\n\tres.athenzDomains = res.createAthenzDomains(pfConfig.ServiceAthenzDomains)\n\tres.athenzSAPrefix = res.createAthenzDomains([]string{pfConfig.AthenzServiceAccountPrefix})[0]\n\n\tswitch res.cfg.Name {\n\tcase \"k8s\":\n\t\treturn &K8SResolve{res}\n\tcase \"aks\":\n\t\treturn &AKSResolve{res}\n\tcase \"eks\":\n\t\treturn &EKSResolve{res}\n\t}\n\treturn &res\n}", "title": "" }, { "docid": "1b4a52364b5f48850988deebe999f98d", "score": "0.47176173", "text": "func (r *resolver) Query() service.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "2294e092baa2aa3ad483b3dd5f58aeec", "score": "0.470734", "text": "func Resolve(r func() (string, error)) {\n\tresolver = r\n}", "title": "" }, { "docid": "c4977a88801e88ee96b8c39b308d6d67", "score": "0.47071278", "text": "func (a NetApi) GetDnsResolver(id string) (*NetDnsResolver, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/net/dnsResolver/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(NetDnsResolver)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "3a1f7bb57c2ad1218586ed2f16889a6b", "score": "0.46949208", "text": "func (f *Fetcher) Fetch(ctx context.Context, reqs Requests, refresh bool) (Segments, error) {\n\t// Load local and cached segments from DB\n\tloadedSegs, fetchReqs, err := f.Resolver.Resolve(ctx, reqs, refresh)\n\tif err != nil {\n\t\treturn Segments{}, serrors.Wrap(errDB, err)\n\t}\n\tif len(fetchReqs) == 0 {\n\t\treturn loadedSegs, nil\n\t}\n\t// Forward and cache any requests that were not local / cached\n\tfetchedSegs, err := f.Request(ctx, fetchReqs)\n\tif err != nil {\n\t\terr = serrors.Wrap(errFetch, err)\n\t}\n\treturn append(loadedSegs, fetchedSegs...), err\n}", "title": "" }, { "docid": "ed5d6cf6ba0c93dc27363b87282fd4b8", "score": "0.46893033", "text": "func (h *JSONAPIHandler) Get(model *ModelHandler, endpoint *Endpoint) http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, req *http.Request) {\n\t\tif _, ok := h.ModelHandlers[model.ModelType]; !ok {\n\t\t\th.MarshalInternalError(rw)\n\t\t\treturn\n\t\t}\n\t\tSetContentType(rw)\n\n\t\t/**\n\n\t\tGET: BUILD SCOPE\n\n\t\t*/\n\t\tscope, errs, err := h.Controller.BuildScopeSingle(req, reflect.New(model.ModelType).Interface(), nil)\n\t\tif err != nil {\n\t\t\th.log.Error(err)\n\t\t\th.MarshalInternalError(rw)\n\t\t\treturn\n\t\t}\n\n\t\tif errs != nil {\n\t\t\th.MarshalErrors(rw, errs...)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET: LANGUAGE\n\n\t\t*/\n\t\ttag, ok := h.GetLanguage(req, rw)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tif scope.UseI18n() {\n\t\t\tscope.SetLanguageFilter(tag.String())\n\t\t}\n\n\t\t/**\n\n\t\tGET: PRECHECK PAIR\n\n\t\t*/\n\t\tif !h.AddPrecheckPairFilters(scope, model, endpoint, req, rw, endpoint.PrecheckPairs...) {\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET: PRECHECK FILTERS\n\n\t\t*/\n\n\t\tif !h.AddPrecheckFilters(scope, req, rw, endpoint.PrecheckFilters...) {\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET: RELATIONSHIP FILTERS\n\n\t\t*/\n\t\terr = h.GetRelationshipFilters(scope, req, rw)\n\t\tif err != nil {\n\t\t\tif hErr := err.(*HandlerError); hErr != nil {\n\t\t\t\tif !h.handleHandlerError(hErr, rw) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\th.log.Error(err)\n\t\t\t\th.MarshalInternalError(rw)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\trepo := h.GetRepositoryByType(model.ModelType)\n\t\t// Set NewSingleValue for the scope\n\t\tscope.NewValueSingle()\n\n\t\t/**\n\n\t\tGET: HOOK BEFORE\n\n\t\t*/\n\t\tif errObj := h.HookBeforeReader(scope); errObj != nil {\n\t\t\th.MarshalErrors(rw, errObj)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET: REPOSITORY GET\n\n\t\t*/\n\t\tdbErr := repo.Get(scope)\n\t\tif dbErr != nil {\n\t\t\th.manageDBError(rw, dbErr)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET: HOOK AFTER\n\n\t\t*/\n\t\tif errObj := h.HookAfterReader(scope); errObj != nil {\n\t\t\th.MarshalErrors(rw, errObj)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET: GET INCLUDED FIELDS\n\n\t\t*/\n\t\tif correct := h.GetIncluded(scope, rw, req, tag); !correct {\n\t\t\treturn\n\t\t}\n\n\t\t// get included\n\t\th.HeaderContentLanguage(rw, tag)\n\t\th.MarshalScope(scope, rw, req)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "158a09b75319d9a10df5bc5f8b5f8583", "score": "0.4689205", "text": "func (client PathItemsClient) GetGlobalAndLocalQueryNullResponder(resp *http.Response) (result autorest.Response, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n}", "title": "" }, { "docid": "44c8249cbbb9f8ee63c101299582984b", "score": "0.46747178", "text": "func (g *Grapher) ResolveAll(args, roleNames, profileNames []string) ([]Path, error) {\n\tlogger.InfoMsgf(\"resolving all paths based on %v / %v / %v\", args, roleNames, profileNames)\n\n\ttfs := cartogram.TagFilterSet{}\n\tif err := tfs.LoadFromArgs(args); err != nil {\n\t\treturn []Path{}, err\n\t}\n\taccounts := g.Pack.Search(tfs)\n\n\tpaths := make([]Path, len(accounts))\n\n\tfor index, item := range accounts {\n\t\tpath, err := g.filterPaths(item, roleNames, profileNames)\n\t\tif err != nil {\n\t\t\treturn []Path{}, err\n\t\t}\n\t\tpaths[index] = path\n\t}\n\n\treturn paths, nil\n}", "title": "" }, { "docid": "c9722107c12f48ce8a3cad159f4c239e", "score": "0.4659141", "text": "func NewGetResolverDefault(code int) *GetResolverDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetResolverDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "3e93778d6a20a486f1bed4388ab33652", "score": "0.46553698", "text": "func (r GetResolverRequest) Send() (*GetResolverOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*GetResolverOutput), nil\n}", "title": "" }, { "docid": "17419ad70c239f935f72b7af80dac756", "score": "0.4652916", "text": "func (d *DoHClient) ResolveGET(q *dns.Msg) (*dns.Msg, error) {\n\t// Pack the DNS query into wire format\n\tb, err := q.Pack()\n\tif err != nil {\n\t\td.metrics.err.Add(\"pack\", 1)\n\t\treturn nil, err\n\t}\n\t// Encode the query as base64url without padding\n\tb64 := base64.RawURLEncoding.EncodeToString(b)\n\n\t// The URL must be a template. Process it with the \"dns\" param containing the encoded query.\n\tu, err := d.template.Expand(map[string]interface{}{\"dns\": b64})\n\tif err != nil {\n\t\td.metrics.err.Add(\"template\", 1)\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\td.metrics.err.Add(\"http\", 1)\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"accept\", \"application/dns-message\")\n\tresp, err := d.client.Do(req)\n\tif err != nil {\n\t\td.metrics.err.Add(\"get\", 1)\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\treturn d.responseFromHTTP(resp)\n}", "title": "" }, { "docid": "8a7b1238197ff68f32e82d9058ced693", "score": "0.46481645", "text": "func Do(ctx context.Context, resolver *net.Resolver) (ips []string, err error) {\n\terr = retryx.Do(ctx, func() error {\n\t\tips, err = resolver.LookupHost(ctx, \"whoami.akamai.net\")\n\t\treturn err\n\t})\n\treturn\n}", "title": "" }, { "docid": "49c1bc01278db07710d5efa8d2cad477", "score": "0.4640463", "text": "func NewResolver() Resolver {\n\tres := &resolver{c: &dns.Client{}}\n\tres.AddHandler(\".\", res.Forward)\n\n\tlog.Printf(\"Initialzed resolver\")\n\treturn res\n}", "title": "" }, { "docid": "16dc0ee7a8c1092ffc19b016b61ebd52", "score": "0.46262032", "text": "func (r *Resolver) Request() RequestResolver {\n\treturn &requestResolver{r}\n}", "title": "" }, { "docid": "84c61b46708356238c76598558e05885", "score": "0.46218428", "text": "func (sc *SyncContext) ReadRegistries(\n\ttoRead []RegistryContext,\n\trecurse bool,\n\tmkProducer func(*SyncContext, RegistryContext) stream.Producer,\n) {\n\t// Collect all images in sc.Inv (the src and dest registry names found in\n\t// the manifest).\n\tvar populateRequests PopulateRequests = func(\n\t\tsc *SyncContext,\n\t\treqs chan<- stream.ExternalRequest,\n\t\twg *sync.WaitGroup) {\n\t\t// For each registry, start the very first root \"repo\" read call.\n\t\tfor _, rc := range toRead {\n\t\t\t// Create the request.\n\t\t\tvar req stream.ExternalRequest\n\t\t\treq.RequestParams = rc\n\t\t\treq.StreamProducer = mkProducer(sc, rc)\n\t\t\t// Load request into the channel.\n\t\t\twg.Add(1)\n\t\t\treqs <- req\n\t\t}\n\t}\n\n\tvar processRequest ProcessRequest = func(\n\t\tsc *SyncContext,\n\t\treqs chan stream.ExternalRequest,\n\t\trequestResults chan<- RequestResult,\n\t\twg *sync.WaitGroup,\n\t\tmutex *sync.Mutex,\n\t) {\n\t\tfor req := range reqs {\n\t\t\treqRes := RequestResult{Context: req}\n\n\t\t\t// Now run the request (make network HTTP call with\n\t\t\t// ExponentialBackoff()).\n\t\t\ttagsStruct, err := getRegistryTagsWrapper(req)\n\t\t\tif err != nil {\n\t\t\t\t// Skip this request if it has unrecoverable errors (even after\n\t\t\t\t// ExponentialBackoff).\n\t\t\t\treqRes.Errors = Errors{\n\t\t\t\t\tError{\n\t\t\t\t\t\tContext: \"getRegistryTagsWrapper\",\n\t\t\t\t\t\tError: err,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\trequestResults <- reqRes\n\n\t\t\t\t// Invalidate promotion conservatively for the subset of images\n\t\t\t\t// that touch this network request. If we have trouble reading\n\t\t\t\t// \"foo\" from a destination registry, do not bother trying to\n\t\t\t\t// promote it for all registries\n\t\t\t\tmutex.Lock()\n\t\t\t\tsc.IgnoreFromPromotion(req.RequestParams.(RegistryContext).Name)\n\t\t\t\tmutex.Unlock()\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Process the current repo.\n\t\t\trName := req.RequestParams.(RegistryContext).Name\n\t\t\tdigestTags := make(DigestTags)\n\n\t\t\tfor digest, mfestInfo := range tagsStruct.Manifests {\n\t\t\t\ttagSlice := TagSlice{}\n\t\t\t\tfor _, tag := range mfestInfo.Tags {\n\t\t\t\t\ttagSlice = append(tagSlice, Tag(tag))\n\t\t\t\t}\n\t\t\t\tdigestTags[Digest(digest)] = tagSlice\n\n\t\t\t\t// Store MediaType.\n\t\t\t\tmutex.Lock()\n\t\t\t\tmediaType, err := supportedMediaType(mfestInfo.MediaType)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(\"digest %s: %s\\n\", digest, err)\n\t\t\t\t}\n\t\t\t\tsc.DigestMediaType[Digest(digest)] = mediaType\n\n\t\t\t\t// Store ImageSize\n\t\t\t\tsc.DigestImageSize[Digest(digest)] = int(mfestInfo.Size)\n\t\t\t\tmutex.Unlock()\n\t\t\t}\n\n\t\t\t// Only write an entry into our inventory if the entry has some\n\t\t\t// non-nil value for digestTags. This is because we only want to\n\t\t\t// populate the inventory with image names that have digests in\n\t\t\t// them, and exclude any image paths that are actually just folder\n\t\t\t// names without any images in them.\n\t\t\tif len(digestTags) > 0 {\n\t\t\t\trootReg, imageName, err := SplitByKnownRegistries(rName, sc.RegistryContexts)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Fatal(err)\n\t\t\t\t}\n\n\t\t\t\tcurrentRepo := make(RegInvImage)\n\t\t\t\tcurrentRepo[imageName] = digestTags\n\n\t\t\t\tmutex.Lock()\n\t\t\t\texistingRegEntry := sc.Inv[rootReg]\n\t\t\t\tif len(existingRegEntry) == 0 {\n\t\t\t\t\tsc.Inv[rootReg] = currentRepo\n\t\t\t\t} else {\n\t\t\t\t\tsc.Inv[rootReg][imageName] = digestTags\n\t\t\t\t}\n\t\t\t\tmutex.Unlock()\n\t\t\t}\n\n\t\t\t// Process child repos.\n\t\t\tif recurse {\n\t\t\t\tfor _, childRepoName := range tagsStruct.Children {\n\t\t\t\t\t// TODO: Check result of type assertion\n\t\t\t\t\t//nolint:errcheck\n\t\t\t\t\tparentRC, _ := req.RequestParams.(RegistryContext)\n\n\t\t\t\t\tchildRc := RegistryContext{\n\t\t\t\t\t\tName: RegistryName(\n\t\t\t\t\t\t\tstring(parentRC.Name) + \"/\" + childRepoName),\n\t\t\t\t\t\t// Inherit the service account used at the parent\n\t\t\t\t\t\t// (cascades down from toplevel to all subrepos). In the\n\t\t\t\t\t\t// future if the token exchange fails, we can refresh\n\t\t\t\t\t\t// the token here instead of using the one we inherit\n\t\t\t\t\t\t// below.\n\t\t\t\t\t\tServiceAccount: parentRC.ServiceAccount,\n\t\t\t\t\t\t// Inherit the token as well.\n\t\t\t\t\t\tToken: parentRC.Token,\n\t\t\t\t\t\t// Don't need src, because we are just reading data\n\t\t\t\t\t\t// (don't care if it's the source reg or not).\n\t\t\t\t\t}\n\n\t\t\t\t\tvar childReq stream.ExternalRequest\n\t\t\t\t\tchildReq.RequestParams = childRc\n\t\t\t\t\tchildReq.StreamProducer = mkProducer(sc, childRc)\n\n\t\t\t\t\t// Every time we \"descend\" into child nodes, increment the\n\t\t\t\t\t// semaphore.\n\t\t\t\t\twg.Add(1)\n\t\t\t\t\treqs <- childReq\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// When we're done processing this node (req), decrement the\n\t\t\t// semaphore.\n\t\t\treqRes.Errors = Errors{}\n\t\t\trequestResults <- reqRes\n\t\t}\n\t}\n\n\t// TODO(lint): Check error return value\n\t//nolint:errcheck\n\tsc.ExecRequests(populateRequests, processRequest)\n}", "title": "" }, { "docid": "ec922d0a38536af01ca02e564bf5e621", "score": "0.46182266", "text": "func DefaultReadResolver(args ...interface{}) graphql.FieldResolveFn {\n\tlog.Println(\"Default resolver working\")\n\n\treturn func(params graphql.ResolveParams) (interface{}, error) {\n\t\treturn nil, nil\n\t}\n}", "title": "" }, { "docid": "dfd346d90492ba198aa3438f141203ab", "score": "0.4615076", "text": "func (r *StaticResolver) Next() ([]*naming.Update, error) {\n\tif r.addr != nil {\n\t\tupdates := r.addr\n\t\tr.addr = nil\n\t\treturn updates, nil\n\t}\n\tinfinite := make(chan struct{})\n\t<-infinite\n\treturn nil, nil\n}", "title": "" }, { "docid": "23d9ae71767b1638b4fd63862489d1ff", "score": "0.46146935", "text": "func ariesLookup(c *gin.Context) {\n\tpassedID := c.Param(\"id\")\n\tqs := url.QueryEscape(fmt.Sprintf(\"id:\\\"%s\\\"\", passedID))\n\tfl := \"&fl=id,identifier_ssim,file_location_ssi,has_model_ssim,isPartOf_ssim\"\n\turlStr := fmt.Sprintf(\"%s/%s/select?q=%s&wt=json&indent=true%s\", solrURL, solrCore, qs, fl)\n\trespStr, err := getAPIResponse(urlStr)\n\tif err != nil {\n\t\tlog.Printf(\"Query for %s FAILED: %s\", passedID, err.Error())\n\t\tc.String(http.StatusNotFound, err.Error())\n\t\treturn\n\t}\n\n\tvar resp solrFullResponse\n\tmarshallErr := json.Unmarshal([]byte(respStr), &resp)\n\tif marshallErr != nil {\n\t\tlog.Printf(\"Unable to parse response: %s\", marshallErr.Error())\n\t\tc.String(http.StatusNotFound, \"%s not found\", passedID)\n\t\treturn\n\t}\n\n\tif resp.Response.NumFound == 0 {\n\t\tlog.Printf(\"Query for ID=%s had no hits; check in identifier_ssim\", passedID)\n\t\tqs = url.QueryEscape(fmt.Sprintf(\"identifier_ssim:\\\"%s\\\"\", passedID))\n\t\turlStr = fmt.Sprintf(\"%s/%s/select?q=%s&wt=json&indent=true%s\", solrURL, solrCore, qs, fl)\n\t\trespStr, _ = getAPIResponse(urlStr)\n\t\tmarshallErr := json.Unmarshal([]byte(respStr), &resp)\n\t\tif marshallErr != nil {\n\t\t\tlog.Printf(\"Unable to parse response: %s\", marshallErr.Error())\n\t\t\tc.String(http.StatusNotFound, \"%s not found\", passedID)\n\t\t\treturn\n\t\t}\n\t\tif resp.Response.NumFound == 0 {\n\t\t\tlog.Printf(\"Query for identifier_ssim=%s had no hits\", passedID)\n\t\t\tc.String(http.StatusNotFound, \"%s not found\", passedID)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif resp.Response.NumFound > 1 {\n\t\tlog.Printf(\"Query for %s had too many hits\", passedID)\n\t\tc.String(http.StatusBadRequest, \"%s has too many hits. Query: %s\", passedID, urlStr)\n\t\treturn\n\t}\n\n\tvar out aries\n\tdoc := resp.Response.Docs[0]\n\tout.Identifiers = append(out.Identifiers, doc.ID)\n\tfor _, altID := range doc.IdentifierSSIM {\n\t\tout.Identifiers = append(out.Identifiers, altID)\n\t}\n\tif doc.FileLocation != \"\" {\n\t\tout.MasterFile = append(out.MasterFile, doc.FileLocation)\n\t}\n\n\tsvcURL := serviceURL{\n\t\tURL: fmt.Sprintf(\"%s/%s/select?q=%s\", solrURL, solrCore, qs),\n\t\tProtocol: \"avalon-index\"}\n\tout.ServiceURL = append(out.ServiceURL, svcURL)\n\n\tif doc.Model[0] == \"MediaObject\" {\n\t\t// MediaObjects have descMetadata\n\t\tout.MetadataURL = append(out.MetadataURL, fmt.Sprintf(\"%s/media_objects/%s/content/descMetadata\", avalonURL, doc.ID))\n\t\tout.AccessURL = append(out.AccessURL, fmt.Sprintf(\"%s/media_objects/%s\", avalonURL, doc.ID))\n\t\tout.AdminURL = append(out.AdminURL, fmt.Sprintf(\"%s/media_objects/%s/edit\", avalonURL, doc.ID))\n\t} else {\n\t\t// Master files are have no metadata, are nested under their parent URL and can have derivatives\n\t\tout.AccessURL = append(out.AccessURL, fmt.Sprintf(\"%s/media_objects/%s/section/%s\", avalonURL, doc.PartOf[0], doc.ID))\n\t\tout.AdminURL = append(out.AdminURL, fmt.Sprintf(\"%s/media_objects/%s/section/%s/edit\", avalonURL, doc.PartOf[0], doc.ID))\n\n\t\tqs = url.QueryEscape(fmt.Sprintf(\"isDerivationOf_ssim:\\\"%s\\\"\", doc.ID))\n\t\tfl = \"&fl=id,derivativeFile_ssi\"\n\t\turlStr = fmt.Sprintf(\"%s/%s/select?q=%s&wt=json&indent=true%s\", solrURL, solrCore, qs, fl)\n\t\trespStr, _ = getAPIResponse(urlStr)\n\t\tmarshallErr = json.Unmarshal([]byte(respStr), &resp)\n\t\tif marshallErr == nil {\n\t\t\tfor _, d := range resp.Response.Docs {\n\t\t\t\tif d.DerivativeFile != \"\" {\n\t\t\t\t\tout.DerivativeFile = append(out.DerivativeFile, d.DerivativeFile)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tc.JSON(http.StatusOK, out)\n}", "title": "" }, { "docid": "8a7a2df1b67e9835756db3af392eb745", "score": "0.461337", "text": "func (r *Resolver) Query() internal.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "2d0c5ee5a3228f64c2861d2912fea78e", "score": "0.46106017", "text": "func setup(c *caddy.Controller) error {\n\tc.Next() // Ignore \"resolve\" and give us the next token.\n\targs := c.RemainingArgs()\n\n\tif len(args) != 1 {\n\t\treturn plugin.Error(\"resolve\", c.ArgErr())\n\t}\n\n\taddr := args[0]\n\tresolver := NewResolver(addr)\n\n\tc.OnStartup(func() error {\n\t\t// Find the first configured handler\n\t\tconf := dnsserver.GetConfig(c)\n\t\tfor _, d := range dnsserver.Directives {\n\t\t\th := conf.Handler(d)\n\t\t\tif h != nil {\n\t\t\t\tresolver.Next = h\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tc.OnStartup(resolver.OnStartup)\n\tc.OnRestart(resolver.OnStop)\n\tc.OnFinalShutdown(resolver.OnStop)\n\n\treturn nil\n}", "title": "" }, { "docid": "35b7108c82e7367642e46ae34c4e1b2c", "score": "0.4602091", "text": "func (_SubdomainRegistrar *SubdomainRegistrarSession) PublicResolver() (common.Address, error) {\n\treturn _SubdomainRegistrar.Contract.PublicResolver(&_SubdomainRegistrar.CallOpts)\n}", "title": "" }, { "docid": "c293c50aafb79ff2521ac72ddabcf4a2", "score": "0.46004543", "text": "func (a *Air) GET(path string, h Handler, gases ...Gas) {\n\ta.router.register(http.MethodGet, path, h, gases...)\n}", "title": "" }, { "docid": "94fa06643480ff079c39f87516254691", "score": "0.4598805", "text": "func (h *JSONAPIHandler) GetRelationship(root *ModelHandler, endpoint *Endpoint) http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, req *http.Request) {\n\t\tif _, ok := h.ModelHandlers[root.ModelType]; !ok {\n\t\t\th.MarshalInternalError(rw)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET RELATIONSHIP: BUILD SCOPE\n\n\t\t*/\n\t\tscope, errs, err := h.Controller.BuildScopeRelationship(req, reflect.New(root.ModelType).Interface())\n\t\tif err != nil {\n\t\t\th.log.Error(err)\n\t\t\th.MarshalInternalError(rw)\n\t\t\treturn\n\t\t}\n\t\tif len(errs) > 0 {\n\t\t\th.MarshalErrors(rw, errs...)\n\t\t\treturn\n\t\t}\n\t\tscope.NewValueSingle()\n\n\t\t/**\n\n\t\t GET RELATIONSHIP: LANGUAGE\n\n\t\t*/\n\t\ttag, ok := h.GetLanguage(req, rw)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tif scope.UseI18n() {\n\t\t\tscope.SetLanguageFilter(tag.String())\n\t\t}\n\t\th.HeaderContentLanguage(rw, tag)\n\n\t\t/**\n\n\t\t GET RELATIONSHIP: PRECHECK PAIR\n\n\t\t*/\n\t\tif !h.AddPrecheckPairFilters(scope, root, endpoint, req, rw, endpoint.PrecheckPairs...) {\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET RELATIONSHIP: PRECHECK FILTERS\n\n\t\t*/\n\n\t\tif !h.AddPrecheckFilters(scope, req, rw, endpoint.PrecheckFilters...) {\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\tGET RELATIONSHIP: GET RELATIONSHIP FILTERS\n\n\t\t*/\n\n\t\terr = h.GetRelationshipFilters(scope, req, rw)\n\t\tif err != nil {\n\t\t\tif hErr := err.(*HandlerError); hErr != nil {\n\t\t\t\tif !h.handleHandlerError(hErr, rw) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\th.log.Error(err)\n\t\t\t\th.MarshalInternalError(rw)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t/**\n\n\t\t GET RELATIONSHIP: ROOT HOOK BEFORE READ\n\n\t\t*/\n\n\t\tif errObj := h.HookBeforeReader(scope); errObj != nil {\n\t\t\th.MarshalErrors(rw, errObj)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\t GET RELATIONSHIP: GET ROOT FROM REPOSITORY\n\n\t\t*/\n\n\t\trootRepository := h.GetRepositoryByType(scope.Struct.GetType())\n\t\tdbErr := rootRepository.Get(scope)\n\t\tif dbErr != nil {\n\t\t\th.manageDBError(rw, dbErr)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\t GET RELATIONSHIP: ROOT HOOK AFTER READ\n\n\t\t*/\n\n\t\tif errObj := h.HookAfterReader(scope); errObj != nil {\n\t\t\th.MarshalErrors(rw, errObj)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\t GET RELATIONSHIP: GET RELATIONSHIP SCOPE\n\n\t\t*/\n\t\trelationshipScope, err := scope.GetRelationshipScope()\n\t\tif err != nil {\n\t\t\th.log.Errorf(\"Error while getting RelationshipScope for model: %v. %v\", scope.Struct.GetType(), err)\n\t\t\th.MarshalInternalError(rw)\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\n\t\t GET RELATIONSHIP: MARSHAL SCOPE\n\n\t\t*/\n\t\th.MarshalScope(relationshipScope, rw, req)\n\t}\n}", "title": "" }, { "docid": "dd48ecebd3963c51bd61a366cd615d1e", "score": "0.4598597", "text": "func (r *defaultRouter) ServeHTTP(stdRes http.ResponseWriter, stdReq *http.Request) {\n\n\tr.c.Reset()\n\n\tr.Use(func(req Request, res Response, c *Context) {\n\n\t\treq.Raw(func(raw *ModifiedRequest) {\n\n\t\t\tfor _, aRoute := range r.routes[raw.Method] {\n\t\t\t\tif aRoute != nil {\n\t\t\t\t\taRoute.Query(raw.URL.Path, req, res)\n\t\t\t\t}\n\n\t\t\t}\n\t\t})\n\n\t})\n\n\tr.c.Next(DefaultRequest(&ModifiedRequest{[]string{}, stdReq}), DefaultResponse(stdRes), r.c)\n\n}", "title": "" }, { "docid": "ddf1fac55421a1f8ef0e4f8564422f27", "score": "0.45933172", "text": "func NewResolver(refreshRate int, needRefresh bool) *Resolver {\n\treturn &Resolver{\n\t\tC: make(chan bool),\n\t\trefreshRate: time.Duration(refreshRate),\n\t\tneedRefresh: needRefresh,\n\t}\n}", "title": "" }, { "docid": "8861f012e5622aeb6f3e117bfa00a13a", "score": "0.4593283", "text": "func NewHTTPResolver() Interface {\n\treturn &httpResolver{}\n}", "title": "" }, { "docid": "e9ace77a2eeba6b6d1540354fb39124b", "score": "0.45919558", "text": "func withDynamicResolver(ctx context.Context, ref string, registryConfig *RegistryConfig) containerd.RemoteOpt {\n\tdefaultResolver := func(_ *containerd.Client, _ *containerd.RemoteContext) error { return nil }\n\tif registryConfig != nil {\n\t\tdefaultResolver = func(_ *containerd.Client, c *containerd.RemoteContext) error {\n\t\t\tresolver := docker.NewResolver(docker.ResolverOptions{\n\t\t\t\tHosts: registryHosts(registryConfig, nil),\n\t\t\t})\n\t\t\tc.Resolver = resolver\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tswitch {\n\t// For private ECR registries, we need to use the Amazon ECR resolver.\n\t// Currently we're unable to support image registry configuration with the ECR resolver.\n\t// FIXME Track upstream `amazon-ecr-containerd-resolver` support for image registry configuration.\n\tcase strings.HasPrefix(ref, \"ecr.aws/\"):\n\t\treturn func(_ *containerd.Client, c *containerd.RemoteContext) error {\n\t\t\t// Create the Amazon ECR resolver\n\t\t\tresolver, err := ecr.NewResolver()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"Failed to create ECR resolver\")\n\t\t\t}\n\t\t\tlog.G(ctx).WithField(\"ref\", ref).Info(\"pulling with Amazon ECR Resolver\")\n\t\t\tc.Resolver = resolver\n\t\t\treturn nil\n\t\t}\n\t// For Amazon ECR Public registries, we should try and fetch credentials before resolving the image reference\n\tcase strings.HasPrefix(ref, \"public.ecr.aws/\"):\n\t\t// ... not if the user has specified their own registry credentials for 'public.ecr.aws'; In that case we use the default resolver.\n\t\tif _, found := registryConfig.Credentials[\"public.ecr.aws\"]; found {\n\t\t\treturn defaultResolver\n\t\t}\n\n\t\t// Try to get credentials for authenticated pulls from ECR Public\n\t\tsession := session.Must(session.NewSession())\n\t\t// The ECR Public API is only available in us-east-1 today\n\t\tpublicConfig := aws.NewConfig().WithRegion(\"us-east-1\")\n\t\tclient := ecrpublic.New(session, publicConfig)\n\t\toutput, err := client.GetAuthorizationToken(&ecrpublic.GetAuthorizationTokenInput{})\n\t\tif err != nil {\n\t\t\tlog.G(ctx).Warn(\"ecr-public: failed to get authorization token, falling back to default resolver (unauthenticated pull)\")\n\t\t\treturn defaultResolver\n\t\t}\n\t\tif output == nil || output.AuthorizationData == nil {\n\t\t\tlog.G(ctx).Warn(\"ecr-public: missing AuthorizationData in ECR Public GetAuthorizationToken response, falling back to default resolver (unauthenticated pull)\")\n\t\t\treturn defaultResolver\n\t\t}\n\t\tauthToken, err := base64.StdEncoding.DecodeString(aws.StringValue(output.AuthorizationData.AuthorizationToken))\n\t\tif err != nil {\n\t\t\tlog.G(ctx).Warn(\"ecr-public: unable to decode authorization token, falling back to default resolver (unauthenticated pull)\")\n\t\t\treturn defaultResolver\n\t\t}\n\t\ttokens := strings.SplitN(string(authToken), \":\", 2)\n\t\tif len(tokens) != 2 {\n\t\t\tlog.G(ctx).Warn(\"ecr-public: invalid credentials decoded from authorization token, falling back to default resolver (unauthenticated pull)\")\n\t\t\treturn defaultResolver\n\t\t}\n\t\t// Use the fetched authorization credentials to resolve the image\n\t\tauthOpt := docker.WithAuthCreds(func(host string) (string, string, error) {\n\t\t\t// Double-check to make sure the we're doing this for an ECR Public registry\n\t\t\tif host != \"public.ecr.aws\" {\n\t\t\t\treturn \"\", \"\", errors.New(\"ecr-public: expected image to start with public.ecr.aws\")\n\t\t\t}\n\t\t\treturn tokens[0], tokens[1], nil\n\t\t})\n\t\tauthorizer := docker.NewDockerAuthorizer(authOpt)\n\t\tresolverOpt := docker.ResolverOptions{\n\t\t\tHosts: registryHosts(registryConfig, &authorizer),\n\t\t}\n\n\t\treturn func(_ *containerd.Client, c *containerd.RemoteContext) error {\n\t\t\tresolver := docker.NewResolver(resolverOpt)\n\t\t\tlog.G(ctx).WithField(\"ref\", ref).Info(\"pulling from ECR Public\")\n\t\t\tc.Resolver = resolver\n\t\t\treturn nil\n\t\t}\n\tdefault:\n\t\t// For all other registries\n\t\treturn defaultResolver\n\t}\n}", "title": "" }, { "docid": "9a65247bfd3d018b6d8a26c446ae8afb", "score": "0.45884356", "text": "func (r *RequestProcessor) handleGET(req *http.Request, obj *object.FileObject) *response.Response {\n\tctx := obj.Ctx\n\n\tcurrObj := obj\n\tvar parentObj *object.FileObject\n\tvar transformsTab []transforms.Transforms\n\tvar res *response.Response\n\tvar parentRes *response.Response\n\n\t// search for root parent\n\tfor currObj.HasParent() {\n\t\tif currObj.HasTransform() {\n\t\t\ttransformsTab = append(transformsTab, currObj.Transforms)\n\t\t}\n\t\tcurrObj = currObj.Parent\n\n\t\tif !currObj.HasParent() {\n\t\t\tparentObj = currObj\n\t\t}\n\t}\n\n\tresChan := make(chan *response.Response, 1)\n\tparentChan := make(chan *response.Response, 1)\n\n\tgo func(o *object.FileObject) {\n\t\tvar resp *response.Response\n\t\tif r.serverConfig.MaxFileSize != 0 && len(transformsTab) == 0 {\n\t\t\tresp = storage.Head(o)\n\t\t\tif resp.ContentLength > r.serverConfig.MaxFileSize {\n\t\t\t\tresp.Close()\n\t\t\t\tresp = storage.CreatePreSign(obj)\n\t\t\t} else {\n\t\t\t\tresp = storage.Get(o)\n\t\t\t}\n\t\t} else {\n\t\t\tresp = storage.Get(o)\n\t\t}\n\t\t// Ensure before passing the response that the context is not canceled.\n\t\t// In such case Close the response.\n\t\t// Passing the data to respChan and checking ctx.Done cannot be\n\t\t// done in a single select since golang randomly choice which channel\n\t\t// to handle. So when ctx.Done is closed there is 50% of chance that\n\t\t// it will choice to send resp to resChan.\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tresp.Close()\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\t\tselect {\n\t\tcase resChan <- resp:\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\t}(obj)\n\n\t// get parent from storage\n\tif parentObj != nil && obj.CheckParent {\n\t\tgo func(p *object.FileObject) {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase parentChan <- storage.Head(p):\n\t\t\t\treturn\n\t\t\t}\n\t\t}(parentObj)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn r.replyWithError(obj, 499, errContextCancel)\n\t\tcase res = <-resChan:\n\t\t\tif obj.CheckParent && parentObj != nil && (parentRes == nil || parentRes.StatusCode == 0) {\n\t\t\t\tgo func() {\n\t\t\t\t\tresChan <- res\n\t\t\t\t}()\n\n\t\t\t} else {\n\t\t\t\tif res.StatusCode == 404 {\n\t\t\t\t\tres = r.handleNotFound(obj, parentObj, transformsTab, parentRes, res)\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\t\tres.Close()\n\t\t\t\t\t\treturn res\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn res\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tmonitoring.Report().Inc(\"request_type;type:download\")\n\n\t\t\t\tif res.StatusCode > 199 && res.StatusCode < 299 {\n\t\t\t\t\tif obj.CheckParent && parentObj != nil && parentRes.StatusCode == 200 {\n\t\t\t\t\t\treturn res\n\t\t\t\t\t}\n\n\t\t\t\t\treturn res\n\t\t\t\t}\n\n\t\t\t\treturn res\n\t\t\t}\n\t\tcase parentRes = <-parentChan:\n\t\t\tif parentRes.StatusCode == 404 {\n\t\t\t\treturn parentRes\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "9551f875ff36448323740b9f06da8e4d", "score": "0.45824665", "text": "func (t RestClientGet) GetAll2(getValues map[string]string) {\n\tsReqURL := \"getall2\"\n\treqURL, URLerr := url.ParseRequestURI(sReqURL)\n\tif URLerr != nil {\n\t\treturn\n\t}\n\n\tfor k, v := range getValues {\n\t\treqURL.Query().Add(k, v)\n\t}\n\n\tfinalURL := reqURL.String()\n\n\treq, reqErr := http.NewRequest(\"GET\", finalURL, nil)\n\tif reqErr != nil {\n\t\treturn\n\t}\n\t_, resErr := t.client.Do(req)\n\tif resErr != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f3f4047559911cec23ea48c0cca8c3dd", "score": "0.4580529", "text": "func (sc *SyncContext) ReadRegistries(\n\ttoRead []RegistryContext,\n\trecurse bool,\n\tmkProducer func(*SyncContext, RegistryContext) stream.Producer) {\n\n\t// Collect all images in sc.Inv (the src and dest registry names found in\n\t// the manifest).\n\tvar populateRequests PopulateRequests = func(\n\t\tsc *SyncContext,\n\t\treqs chan<- stream.ExternalRequest,\n\t\twg *sync.WaitGroup) {\n\n\t\t// For each registry, start the very first root \"repo\" read call.\n\t\tfor _, rc := range toRead {\n\t\t\t// Create the request.\n\t\t\tvar req stream.ExternalRequest\n\t\t\treq.RequestParams = rc\n\t\t\treq.StreamProducer = mkProducer(sc, rc)\n\t\t\t// Load request into the channel.\n\t\t\twg.Add(1)\n\t\t\treqs <- req\n\t\t}\n\t}\n\tvar processRequest ProcessRequest = func(\n\t\tsc *SyncContext,\n\t\treqs chan stream.ExternalRequest,\n\t\trequestResults chan<- RequestResult,\n\t\twg *sync.WaitGroup,\n\t\tmutex *sync.Mutex) {\n\n\t\tfor req := range reqs {\n\t\t\treqRes := RequestResult{Context: req}\n\n\t\t\t// Now run the request (make network HTTP call with\n\t\t\t// ExponentialBackoff()).\n\t\t\ttagsStruct, err := getRegistryTagsWrapper(req)\n\t\t\tif err != nil {\n\t\t\t\t// Skip this request if it has unrecoverable errors (even after\n\t\t\t\t// ExponentialBackoff).\n\t\t\t\treqRes.Errors = Errors{\n\t\t\t\t\tError{\n\t\t\t\t\t\tContext: \"getRegistryTagsWrapper\",\n\t\t\t\t\t\tError: err}}\n\t\t\t\trequestResults <- reqRes\n\t\t\t\twg.Add(-1)\n\n\t\t\t\t// Invalidate promotion conservatively for the subset of images\n\t\t\t\t// that touch this network request. If we have trouble reading\n\t\t\t\t// \"foo\" from a destination registry, do not bother trying to\n\t\t\t\t// promote it for all registries\n\t\t\t\tmutex.Lock()\n\t\t\t\tsc.IgnoreFromPromotion(req.RequestParams.(RegistryContext).Name)\n\t\t\t\tmutex.Unlock()\n\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Process the current repo.\n\t\t\trName := req.RequestParams.(RegistryContext).Name\n\t\t\tdigestTags := make(DigestTags)\n\n\t\t\tfor digest, mfestInfo := range tagsStruct.Manifests {\n\t\t\t\ttagSlice := TagSlice{}\n\t\t\t\tfor _, tag := range mfestInfo.Tags {\n\t\t\t\t\ttagSlice = append(tagSlice, Tag(tag))\n\t\t\t\t}\n\t\t\t\tdigestTags[Digest(digest)] = tagSlice\n\n\t\t\t\t// Store MediaType.\n\t\t\t\tmutex.Lock()\n\t\t\t\tmediaType, err := supportedMediaType(mfestInfo.MediaType)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(\"digest %s: %s\\n\", digest, err)\n\t\t\t\t}\n\t\t\t\tsc.DigestMediaType[Digest(digest)] = mediaType\n\t\t\t\tmutex.Unlock()\n\t\t\t}\n\n\t\t\t// Only write an entry into our inventory if the entry has some\n\t\t\t// non-nil value for digestTags. This is because we only want to\n\t\t\t// populate the inventory with image names that have digests in\n\t\t\t// them, and exclude any image paths that are actually just folder\n\t\t\t// names without any images in them.\n\t\t\tif len(digestTags) > 0 {\n\t\t\t\trootReg, imageName, err := SplitByKnownRegistries(rName, sc.RegistryContexts)\n\t\t\t\tif err != nil {\n\t\t\t\t\tklog.Exitln(err)\n\t\t\t\t}\n\n\t\t\t\tcurrentRepo := make(RegInvImage)\n\t\t\t\tcurrentRepo[imageName] = digestTags\n\n\t\t\t\tmutex.Lock()\n\t\t\t\texistingRegEntry := sc.Inv[rootReg]\n\t\t\t\tif len(existingRegEntry) == 0 {\n\t\t\t\t\tsc.Inv[rootReg] = currentRepo\n\t\t\t\t} else {\n\t\t\t\t\tsc.Inv[rootReg][imageName] = digestTags\n\t\t\t\t}\n\t\t\t\tmutex.Unlock()\n\t\t\t}\n\n\t\t\treqRes.Errors = Errors{}\n\t\t\trequestResults <- reqRes\n\n\t\t\t// Process child repos.\n\t\t\tif recurse {\n\t\t\t\tfor _, childRepoName := range tagsStruct.Children {\n\t\t\t\t\tparentRC, _ := req.RequestParams.(RegistryContext)\n\n\t\t\t\t\tchildRc := RegistryContext{\n\t\t\t\t\t\tName: RegistryName(\n\t\t\t\t\t\t\tstring(parentRC.Name) + \"/\" + childRepoName),\n\t\t\t\t\t\t// Inherit the service account used at the parent\n\t\t\t\t\t\t// (cascades down from toplevel to all subrepos). In the\n\t\t\t\t\t\t// future if the token exchange fails, we can refresh\n\t\t\t\t\t\t// the token here instead of using the one we inherit\n\t\t\t\t\t\t// below.\n\t\t\t\t\t\tServiceAccount: parentRC.ServiceAccount,\n\t\t\t\t\t\t// Inherit the token as well.\n\t\t\t\t\t\tToken: parentRC.Token,\n\t\t\t\t\t\t// Don't need src, because we are just reading data\n\t\t\t\t\t\t// (don't care if it's the source reg or not).\n\t\t\t\t\t}\n\n\t\t\t\t\tvar childReq stream.ExternalRequest\n\t\t\t\t\tchildReq.RequestParams = childRc\n\t\t\t\t\tchildReq.StreamProducer = mkProducer(sc, childRc)\n\n\t\t\t\t\t// Every time we \"descend\" into child nodes, increment the\n\t\t\t\t\t// semaphore.\n\t\t\t\t\twg.Add(1)\n\t\t\t\t\treqs <- childReq\n\t\t\t\t}\n\t\t\t}\n\t\t\t// When we're done processing this node (req), decrement the\n\t\t\t// semaphore.\n\t\t\twg.Add(-1)\n\t\t}\n\t}\n\tsc.ExecRequests(populateRequests, processRequest)\n}", "title": "" }, { "docid": "d9913df6b7bc659e07fc7ba8e6c32547", "score": "0.4580056", "text": "func (t *RPCRoute) GetMany(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RPCRoute\", \"GetMany\")\n\tvar routeArg1 string\n\tvar routeArg2 string\n\t{\n\t\tinput := struct {\n\t\t\trouteArg1 string\n\t\t\trouteArg2 string\n\t\t}{}\n\t\tdecErr := json.NewDecoder(r.Body).Decode(&input)\n\n\t\tif decErr != nil {\n\n\t\t\tt.Log.Handle(w, r, decErr, \"json\", \"decode\", \"input\", \"error\", \"RPCRoute\", \"GetMany\")\n\t\t\thttp.Error(w, decErr.Error(), http.StatusInternalServerError)\n\n\t\t\treturn\n\t\t}\n\n\t\trouteArg1 = input.routeArg1\n\t\trouteArg2 = input.routeArg2\n\t}\n\n\tt.embed.GetMany(routeArg1, routeArg2)\n\n\tw.WriteHeader(200)\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RPCRoute\", \"GetMany\")\n\n}", "title": "" }, { "docid": "a58d241efba1f7886958bbf345a4bc80", "score": "0.45778126", "text": "func (s *Server) Resolve(w http.ResponseWriter, req *http.Request) {\n\ttr := trace.New(\"httpserver\", \"/resolve\")\n\tdefer tr.Finish()\n\ttr.LazyPrintf(\"from:%v\", req.RemoteAddr)\n\ttr.LazyPrintf(\"method:%v\", req.Method)\n\n\treq.ParseForm()\n\n\t// Identify DoH requests:\n\t// - GET requests have a \"dns=\" query parameter.\n\t// - POST requests have a content-type = application/dns-message.\n\tif req.Method == \"GET\" && req.FormValue(\"dns\") != \"\" {\n\t\ttr.LazyPrintf(\"DoH:GET\")\n\t\tdnsQuery, err := base64.RawURLEncoding.DecodeString(\n\t\t\treq.FormValue(\"dns\"))\n\t\tif err != nil {\n\t\t\tutil.TraceError(tr, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\ts.resolveDoH(tr, w, dnsQuery)\n\t\treturn\n\t}\n\n\tif req.Method == \"POST\" {\n\t\tct, _, err := mime.ParseMediaType(req.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tutil.TraceError(tr, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif ct == \"application/dns-message\" {\n\t\t\ttr.LazyPrintf(\"DoH:POST\")\n\t\t\t// Limit the size of request to 4k.\n\t\t\tdnsQuery, err := ioutil.ReadAll(io.LimitReader(req.Body, 4092))\n\t\t\tif err != nil {\n\t\t\t\tutil.TraceError(tr, err)\n\t\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ts.resolveDoH(tr, w, dnsQuery)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Fall back to Google's JSON, the laxer format.\n\t// It MUST have a \"name\" query parameter, so we use that for detection.\n\tif req.Method == \"GET\" && req.FormValue(\"name\") != \"\" {\n\t\ttr.LazyPrintf(\"Google-JSON\")\n\t\ts.resolveJSON(tr, w, req)\n\t\treturn\n\t}\n\n\t// Could not found how to handle this request.\n\tutil.TraceErrorf(tr, \"unknown request type\")\n\thttp.Error(w, \"unknown request type\", http.StatusUnsupportedMediaType)\n}", "title": "" }, { "docid": "ca1b36b2e52a113ed2ad57309cb0d90b", "score": "0.45645234", "text": "func (r *Resolver) Get(qname string, qtype uint16) (*dns.Msg, error) {\n\tif queryResp, ok := r.verified.Get(queryRespKey{QName: qname, QType: qtype}.String()); ok {\n\t\treturn queryResp.(*dns.Msg), nil\n\t}\n\n\tauth := \".\"\n\tns := \"m.root-servers.net.\"\n\tif _, ok := r.verifiedZones.Get(\".\"); !ok {\n\t\tif _, err := r.queryAndVerify(\".\", dns.TypeDNSKEY, \".\", ns); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tfor {\n\t\tqueryResp, err := r.queryAndVerify(qname, dns.TypeDNSKEY, auth, ns)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// referral\n\t\tif len(queryResp.Answer) == 0 && len(queryResp.Ns) != 0 && queryResp.Ns[0].Header().Rrtype == dns.TypeNS {\n\t\t\tparentAuth := auth\n\t\t\tauth = queryResp.Ns[0].Header().Name\n\t\t\tif _, err := r.queryAndVerify(auth, dns.TypeDS, parentAuth, ns); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tns = queryResp.Ns[0].(*dns.NS).Ns\n\t\t\tif _, err := r.queryAndVerify(auth, dns.TypeDNSKEY, auth, ns); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tvar res []dns.RR\n\n\t\t// cname\n\t\tfor _, rr := range queryResp.Answer {\n\t\t\tif rr.Header().Rrtype == dns.TypeCNAME {\n\t\t\t\tres = append(res, rr)\n\t\t\t}\n\t\t}\n\t\tif len(res) > 0 {\n\t\t\tqname = res[len(res)-1].(*dns.CNAME).Target\n\t\t\tauth = \".\"\n\t\t\tns = \"m.root-servers.net.\"\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\tqueryResp, err := r.queryAndVerify(qname, qtype, auth, ns)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn queryResp, nil\n}", "title": "" }, { "docid": "4ca5ff1c121dca99eb0d5ee48b6dc1fc", "score": "0.45570806", "text": "func (w *ServerInterfaceWrapper) HostsGetReservations(ctx echo.Context) error {\n\tvar err error\n\n\tctx.Set(\"Bearer.Scopes\", []string{\"\"})\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.HostsGetReservations(ctx)\n\treturn err\n}", "title": "" }, { "docid": "104e78a99e8e8450c9b2b9aa4b1a8fc8", "score": "0.45566034", "text": "func newSharedSourceResolver(configuredResolver *config.GudgeonResolver, configuredSources map[string]Source, sharedSources map[string]Source) *resolver {\n\t// resolvers must have a name\n\tif \"\" == configuredResolver.Name {\n\t\treturn nil\n\t}\n\n\t// fix maps\n\tif configuredSources == nil {\n\t\tconfiguredSources = make(map[string]Source, 0)\n\t}\n\tif sharedSources == nil {\n\t\tsharedSources = make(map[string]Source, 0)\n\t}\n\n\t// make new resolver\n\tresolver := &resolver{\n\t\tname: configuredResolver.Name,\n\t\tdomains: configuredResolver.Domains,\n\t\tskip: configuredResolver.SkipDomains,\n\t\tsearch: configuredResolver.Search,\n\t\tsources: make([]Source, 0, len(configuredResolver.Sources)),\n\t}\n\n\t// add literal hostfile source first source if hosts is configured\n\tif len(configuredResolver.Hosts) > 0 {\n\t\thostfileSource := &hostFileSource{}\n\t\thostfileSource.LoadArray(configuredResolver.Hosts)\n\t\tresolver.sources = append(resolver.sources, hostfileSource)\n\t}\n\n\t// add sources\n\tfor _, configuredSource := range configuredResolver.Sources {\n\t\t// first check if there is a configured source given for the spec,\n\t\t// if so, we should use it instead of looking for it\n\t\tif cS, found := configuredSources[configuredSource]; found {\n\t\t\tlog.Debugf(\"Loaded configured source: %s\", cS.Name())\n\t\t\tresolver.sources = append(resolver.sources, cS)\n\t\t}\n\n\t\t// special logic for adding the system source to the system resolver\n\t\t// otherwise we use the name system and point back to it with a\n\t\t// resolver source\n\t\tif resolver.name == \"system\" && configuredSource == \"system\" {\n\t\t\tresolver.sources = append(resolver.sources, &systemSource{})\n\t\t} else {\n\t\t\tvar source Source\n\n\t\t\tif sharedSource, found := sharedSources[configuredSource]; found {\n\t\t\t\tresolver.sources = append(resolver.sources, sharedSource)\n\t\t\t\tsource = sharedSource\n\t\t\t}\n\n\t\t\tif source == nil {\n\t\t\t\tsource := NewSource(configuredSource)\n\t\t\t\tif source != nil && \"\" != source.Name() {\n\t\t\t\t\tlog.Debugf(\"Loaded source: %s\", source.Name())\n\t\t\t\t\tresolver.sources = append(resolver.sources, source)\n\t\t\t\t\tsharedSources[configuredSource] = source\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resolver\n}", "title": "" }, { "docid": "5b3be0ebdf0ff1feb3fac7540b24fb69", "score": "0.45534524", "text": "func newResolver() netxlite.Resolver {\n\tchildResolver, err := netx.NewDNSClient(netx.Config{Logger: log.Log}, \"doh://google\")\n\truntimex.PanicOnError(err, \"NewDNSClient failed\")\n\tvar r netxlite.Resolver = childResolver\n\tr = &netxlite.ResolverIDNA{Resolver: r}\n\treturn r\n}", "title": "" }, { "docid": "23739aa9e57ce2b563916ed0aded90d0", "score": "0.45414555", "text": "func (f Frontend) Configure(router gin.IRouter) {\n\t// Setup the 2009-04-04 API path prefix and use a trailing slash route helper to patch\n\t// equivalent trailing slash routes.\n\tv20090404 := ginutil.TrailingSlashRouteHelper{IRouter: router.Group(\"/2009-04-04\")}\n\n\tdataEndpointBinder := func(router gin.IRouter, endpoint string, filter filterFunc) {\n\t\trouter.GET(endpoint, func(ctx *gin.Context) {\n\t\t\tinstance, err := f.getInstance(ctx, ctx.Request)\n\t\t\tif err != nil {\n\t\t\t\t// If there's an error containing an http status code, use that status code else\n\t\t\t\t// assume its an internal server error.\n\t\t\t\tvar httpErr *httperror.E\n\t\t\t\tif errors.As(err, &httpErr) {\n\t\t\t\t\t_ = ctx.AbortWithError(httpErr.StatusCode, err)\n\t\t\t\t} else {\n\t\t\t\t\t_ = ctx.AbortWithError(http.StatusInternalServerError, err)\n\t\t\t\t}\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tctx.String(http.StatusOK, filter(instance))\n\t\t})\n\t}\n\n\t// Create a static route builder that we can add all data routes to which are the basis for\n\t// all static routes.\n\tstaticRoutes := staticroute.NewBuilder()\n\n\t// Configure all dynamic routes. Dynamic routes are anything that requires retrieving a specific\n\t// instance and returning data from it.\n\tfor _, r := range dataRoutes {\n\t\tdataEndpointBinder(v20090404, r.Endpoint, r.Filter)\n\t\tstaticRoutes.FromEndpoint(r.Endpoint)\n\t}\n\n\tstaticEndpointBinder := func(router gin.IRouter, endpoint string, childEndpoints []string) {\n\t\trouter.GET(endpoint, func(ctx *gin.Context) {\n\t\t\tctx.String(http.StatusOK, join(childEndpoints))\n\t\t})\n\t}\n\n\tfor _, r := range staticRoutes.Build() {\n\t\tstaticEndpointBinder(v20090404, r.Endpoint, r.Children)\n\t}\n}", "title": "" }, { "docid": "3b6574765cbaed14ebe8c31e963fc15b", "score": "0.45386946", "text": "func (h Handler) makeGetMany(v PeopleInjection) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tjson.NewEncoder(w).Encode(v.People)\n\t}\n}", "title": "" }, { "docid": "bea1c63f51ae8a9dd8dea809e1163932", "score": "0.45331907", "text": "func Resolve(r Resolver, from string) Promise {\n\tfrom = strings.TrimSpace(from)\n\n\tif deeplink.IsDeeplinkLike(from) {\n\t\treturn ResolveDeeplink(r, from)\n\t}\n\tif isPhoneNumber(from) {\n\t\treturn ResolvePhone(r, from)\n\t}\n\n\treturn ResolveDomain(r, from)\n}", "title": "" }, { "docid": "ff6081cf7340d96f8d3608115d65bf61", "score": "0.45238584", "text": "func HandleGetConnectors(w http.ResponseWriter, r *http.Request, ps httprouter.Params, s *models.System) {\n\tconnector := *s\n\thandle := func() (interface{}, error) { return connector.GetConnectors() }\n\tHandleGetRequest(w, r, &handle)\n}", "title": "" }, { "docid": "711b35be5faeed0e7d8b6d0f1573567f", "score": "0.45140782", "text": "func (m *EdiscoveryCasesItemSourceCollectionsItemAdditionalSourcesRequestBuilder) Get(ctx context.Context, requestConfiguration *EdiscoveryCasesItemSourceCollectionsItemAdditionalSourcesRequestBuilderGetRequestConfiguration)(ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.DataSourceCollectionResponseable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.CreateDataSourceCollectionResponseFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.DataSourceCollectionResponseable), nil\n}", "title": "" }, { "docid": "cc8f7f71df9b5a45785d219e07b0de44", "score": "0.45130792", "text": "func (_SubdomainRegistrar *SubdomainRegistrarCallerSession) PublicResolver() (common.Address, error) {\n\treturn _SubdomainRegistrar.Contract.PublicResolver(&_SubdomainRegistrar.CallOpts)\n}", "title": "" }, { "docid": "28d9c8678e949cb0bbdddfdac5afe52e", "score": "0.45108122", "text": "func DefaultResolvers() Resolver {\n\treturn Resolver{\n\t\t\"read\": lmresolvers.DefaultReadResolver,\n\t}\n}", "title": "" }, { "docid": "c4a80fea42272a8d07ad06451f0749c8", "score": "0.4506233", "text": "func (me *FLEET_IMPL) FetchAllDispatchRoutes (\r\n accessToken string,\r\n groupId *int64,\r\n endTime *int64,\r\n duration *int64) ([]*models_pkg.DispatchRoute, error) {\r\n //the endpoint path uri\r\n _pathUrl := \"/fleet/dispatch/routes\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //the base uri for api requests\r\n _queryBuilder := configuration_pkg.BASEURI;\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //process optional query parameters\r\n _queryBuilder, err = apihelper_pkg.AppendUrlWithQueryParameters(_queryBuilder, map[string]interface{} {\r\n \"access_token\" : accessToken,\r\n \"group_id\" : groupId,\r\n \"end_time\" : endTime,\r\n \"duration\" : duration,\r\n \"access_token\" : samsaraapi_lib.config.AccessToken,\r\n })\r\n if err != nil {\r\n //error in query param handling\r\n return nil, err\r\n }\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"APIMATIC 2.0\",\r\n \"accept\" : \"application/json\",\r\n }\r\n\r\n //prepare API request\r\n _request := unirest.Get(_queryBuilder, headers)\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,false);\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 0) {\r\n err = apihelper_pkg.NewAPIError(\"Unexpected error.\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper_pkg.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n var retVal []*models_pkg.DispatchRoute\r\n err = json.Unmarshal(_response.RawBody, &retVal)\r\n\r\n if err != nil {\r\n //error in parsing\r\n return nil, err\r\n }\r\n return retVal, nil\r\n\r\n}", "title": "" }, { "docid": "e02ad0772a0522227a0e2681190a9911", "score": "0.4500887", "text": "func (f *futureResponse) resolve(b context.Blocker) (*Response, error) {\n\t// Return directly for async requests.\n\tif f.async {\n\t\treturn nil, nil\n\t}\n\n\tif err := b.Block(f.ch); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn f.getResponse(), nil\n}", "title": "" }, { "docid": "028132dbd6e002839c15174f09d7e761", "score": "0.44981298", "text": "func (src *MultiTableBirdwatcher) AllRoutes(\n\tctx context.Context,\n) (*api.RoutesResponse, error) {\n\t// Query birdwatcher\n\t_, birdProtocols, err := src.fetchProtocols(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tprotocols := birdProtocols[\"protocols\"].(map[string]interface{})\n\tmainTable := src.GenericBirdwatcher.config.MainTable\n\n\t// Fetch received routes first\n\tres, err := src.client.GetEndpoint(ctx, \"/routes/table/\"+mainTable)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tmeta, imported, err := parseRoutesResponseStream(res.Body, src.config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &api.RoutesResponse{\n\t\tResponse: api.Response{\n\t\t\tMeta: meta,\n\t\t},\n\t}\n\n\t// Sort routes for deterministic ordering\n\t// sort.Sort(imported)\n\tresponse.Imported = imported\n\n\t// Iterate over all the protocols and fetch the filtered routes for everyone\n\tprotocolsBgp := src.filterProtocolsBgp(birdProtocols)\n\n\t// We load the filtered routes asynchronously with workers.\n\ttype fetchFilteredReq struct {\n\t\tprotocolID string\n\t\tpeer string\n\t\tlearntFrom string\n\t}\n\treqQ := make(chan fetchFilteredReq, 1000)\n\tresQ := make(chan api.Routes, 1000)\n\twg := &sync.WaitGroup{}\n\n\t// Start workers\n\tfor i := 0; i < 42; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\t// This is a worker for fetching filtered routes\n\t\t\tdefer wg.Done()\n\t\t\tfor req := range reqQ {\n\t\t\t\t// Fetch filtered routes\n\t\t\t\t_, filtered, err := src.fetchFilteredRoutesStream(ctx, protocols, req.protocolID)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"error while fetching filtered routes:\", err)\n\t\t\t\t}\n\t\t\t\t// Perform route deduplication\n\t\t\t\tfiltered = src.filterRoutesByPeerOrLearntFrom(\n\t\t\t\t\tfiltered, req.peer, req.learntFrom)\n\n\t\t\t\tresQ <- filtered\n\t\t\t}\n\t\t}()\n\t}\n\n\t// Fill request queue\n\tgo func() {\n\t\tfor protocolID, protocolsData := range protocolsBgp[\"protocols\"].(map[string]interface{}) {\n\t\t\tpeer := protocolsData.(map[string]interface{})[\"neighbor_address\"].(string)\n\t\t\tlearntFrom := decoders.String(protocolsData.(map[string]interface{})[\"learnt_from\"], peer)\n\t\t\treqQ <- fetchFilteredReq{\n\t\t\t\tprotocolID: protocolID,\n\t\t\t\tpeer: peer,\n\t\t\t\tlearntFrom: learntFrom,\n\t\t\t}\n\t\t}\n\t\tclose(reqQ)\n\t}()\n\n\t// Await all workers done and close channel\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(resQ)\n\t}()\n\n\t// Collect results\n\tfor filtered := range resQ {\n\t\tresponse.Filtered = append(response.Filtered, filtered...)\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "50572ed398e7d095ef6dcad1104e0815", "score": "0.4493596", "text": "func (r *Response) Resolve() (*http.Response, error) {\n\treturn r.R, r.Err\n}", "title": "" }, { "docid": "50572ed398e7d095ef6dcad1104e0815", "score": "0.4493596", "text": "func (r *Response) Resolve() (*http.Response, error) {\n\treturn r.R, r.Err\n}", "title": "" }, { "docid": "02a71ca71aa3fcff125aacdc5a9b3e18", "score": "0.44891825", "text": "func (me *FLEET_IMPL) GetDispatchRoutesByVehicleId (\r\n accessToken string,\r\n vehicleId int64,\r\n endTime *int64,\r\n duration *int64) ([]*models_pkg.DispatchRoute, error) {\r\n //the endpoint path uri\r\n _pathUrl := \"/fleet/vehicles/{vehicle_id}/dispatch/routes\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //process optional template parameters\r\n _pathUrl, err = apihelper_pkg.AppendUrlWithTemplateParameters(_pathUrl, map[string]interface{} {\r\n \"vehicle_id\" : vehicleId,\r\n })\r\n if err != nil {\r\n //error in template param handling\r\n return nil, err\r\n }\r\n\r\n //the base uri for api requests\r\n _queryBuilder := configuration_pkg.BASEURI;\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //process optional query parameters\r\n _queryBuilder, err = apihelper_pkg.AppendUrlWithQueryParameters(_queryBuilder, map[string]interface{} {\r\n \"access_token\" : accessToken,\r\n \"end_time\" : endTime,\r\n \"duration\" : duration,\r\n \"access_token\" : samsaraapi_lib.config.AccessToken,\r\n })\r\n if err != nil {\r\n //error in query param handling\r\n return nil, err\r\n }\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"APIMATIC 2.0\",\r\n \"accept\" : \"application/json\",\r\n }\r\n\r\n //prepare API request\r\n _request := unirest.Get(_queryBuilder, headers)\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,false);\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 0) {\r\n err = apihelper_pkg.NewAPIError(\"Unexpected error.\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper_pkg.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n var retVal []*models_pkg.DispatchRoute\r\n err = json.Unmarshal(_response.RawBody, &retVal)\r\n\r\n if err != nil {\r\n //error in parsing\r\n return nil, err\r\n }\r\n return retVal, nil\r\n\r\n}", "title": "" }, { "docid": "6f6ed46993c99d16ca7a78fc263a5ffc", "score": "0.44885325", "text": "func (api *API) renterHandlerGET(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\tsettings := api.renter.Settings()\n\tperiodStart := api.renter.CurrentPeriod()\n\tWriteJSON(w, RenterGET{\n\t\tSettings: settings,\n\t\tFinancialMetrics: api.renter.PeriodSpending(),\n\t\tCurrentPeriod: periodStart,\n\t})\n}", "title": "" }, { "docid": "153ab47003b3e12db8a0152623b2aadc", "score": "0.44875216", "text": "func serveLookups(resp http.ResponseWriter, req *http.Request, sb *webrisk.WebriskClient) {\n\tif req.Method != \"POST\" {\n\t\thttp.Error(resp, \"invalid method\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Decode the request message.\n\tpbReq := new(pb.SearchUrisRequest)\n\tmime, err := unmarshal(req, pbReq)\n\tif err != nil {\n\t\thttp.Error(resp, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// TODO: Should this handler use the information in threatTypes,\n\t// platformTypes, and threatEntryTypes?\n\n\t// Parse the request message.\n\turls := []string{pbReq.Uri}\n\n\t// Lookup the URL.\n\tutss, err := sb.LookupURLsContext(req.Context(), urls)\n\tif err != nil {\n\t\thttp.Error(resp, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Compose the response message.\n\tpbResp := &pb.SearchUrisResponse{\n\t\tThreat: &pb.SearchUrisResponse_ThreatUri{},\n\t}\n\tfor _, uts := range utss {\n\t\t// Use map to condense duplicate ThreatDescriptor entries.\n\t\ttdm := make(map[webrisk.ThreatType]bool)\n\t\tfor _, ut := range uts {\n\t\t\ttdm[ut.ThreatType] = true\n\t\t}\n\n\t\tfor td := range tdm {\n\t\t\tpbResp.Threat.ThreatTypes = append(pbResp.Threat.ThreatTypes, pb.ThreatType(td))\n\t\t}\n\t}\n\n\t// Encode the response message.\n\tif err := marshal(resp, pbResp, mime); err != nil {\n\t\thttp.Error(resp, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" } ]
ed14b9e646fef798ed43e95f0b62cdef
Resume rehydrates a DataFlowDebugSessionClientCreatePollerResponse from the provided client and resume token.
[ { "docid": "901a8f70327794ce4eb0e30a204d8573", "score": "0.8250999", "text": "func (l *DataFlowDebugSessionClientCreatePollerResponse) Resume(ctx context.Context, client *DataFlowDebugSessionClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"DataFlowDebugSessionClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &DataFlowDebugSessionClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" } ]
[ { "docid": "af5950a1c9752178edd79034ba650ebb", "score": "0.74816877", "text": "func (l *PacketCapturesClientCreatePollerResponse) Resume(ctx context.Context, client *PacketCapturesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"PacketCapturesClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &PacketCapturesClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "a89051656b3a4dc8b14876a3cd51f54c", "score": "0.7416291", "text": "func (l *SQLPoolRestorePointsClientCreatePollerResponse) Resume(ctx context.Context, client *SQLPoolRestorePointsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"SQLPoolRestorePointsClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &SQLPoolRestorePointsClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "57793efb0e3950f89d76943a2531e9a0", "score": "0.74111617", "text": "func (l *FlowLogsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *FlowLogsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"FlowLogsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &FlowLogsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "27266dd66d8d2a69d3c638e0b56a204b", "score": "0.74012727", "text": "func (l *VPNGatewaysClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VPNGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VPNGatewaysClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VPNGatewaysClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "72cdc3659a2123f533c6b44f26652842", "score": "0.7396086", "text": "func (l *LiveEventsClientCreatePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"LiveEventsClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &LiveEventsClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "c57dc7aa82a66cd35907678fa4bfe3d1", "score": "0.73727125", "text": "func (l *PrivateEndpointConnectionsClientCreatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"PrivateEndpointConnectionsClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &PrivateEndpointConnectionsClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b09ab237e4e144f921db79b5fa6c638c", "score": "0.7352075", "text": "func (l *VirtualNetworkTapsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualNetworkTapsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualNetworkTapsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualNetworkTapsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "71e516c013054c20ebcf90771c981dd7", "score": "0.73361003", "text": "func (l *DataFlowDebugSessionClientExecuteCommandPollerResponse) Resume(ctx context.Context, client *DataFlowDebugSessionClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"DataFlowDebugSessionClient.ExecuteCommand\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &DataFlowDebugSessionClientExecuteCommandPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "7799ff3bdec7f24a0b85ced77da97aef", "score": "0.7324525", "text": "func (l *AzureADOnlyAuthenticationsClientCreatePollerResponse) Resume(ctx context.Context, client *AzureADOnlyAuthenticationsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"AzureADOnlyAuthenticationsClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &AzureADOnlyAuthenticationsClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "89ea50c9daf18c73475043a536d81def", "score": "0.7322506", "text": "func (l *P2SVPNGatewaysClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *P2SVPNGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"P2SVPNGatewaysClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &P2SVPNGatewaysClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "9f601267b5fec097befc4831a3f75db5", "score": "0.73152715", "text": "func (l *StreamingEndpointsClientCreatePollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"StreamingEndpointsClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &StreamingEndpointsClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "5833e04d66eee8a5277b92e7132c8988", "score": "0.73122823", "text": "func (l *EnergyServicesClientCreatePollerResponse) Resume(ctx context.Context, client *EnergyServicesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"EnergyServicesClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &EnergyServicesClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ea6b8223ad38ec341f037ceeb15650de", "score": "0.73071223", "text": "func (l *ClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *Client, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"Client.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "24ae53f3e006080292fbf1558020b700", "score": "0.7292486", "text": "func (l *SQLPoolsClientCreatePollerResponse) Resume(ctx context.Context, client *SQLPoolsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"SQLPoolsClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &SQLPoolsClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ff5a39611285ea09245db09fcdc0f404", "score": "0.72792834", "text": "func (l *SnapshotsClientCreatePollerResponse) Resume(ctx context.Context, client *SnapshotsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"SnapshotsClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &SnapshotsClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "00467d8eb47fd0dfdf37185774c51829", "score": "0.7275911", "text": "func (l *ApplicationGatewaysClientStartPollerResponse) Resume(ctx context.Context, client *ApplicationGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ApplicationGatewaysClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ApplicationGatewaysClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b198ee441f645e1752985e5e41ad36e9", "score": "0.72758305", "text": "func (l *IPAllocationsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *IPAllocationsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"IPAllocationsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &IPAllocationsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "15d0afde0e19d4d26e47d58973c9ce12", "score": "0.727475", "text": "func (l *WorkspaceManagedIdentitySQLControlSettingsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *WorkspaceManagedIdentitySQLControlSettingsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"WorkspaceManagedIdentitySQLControlSettingsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &WorkspaceManagedIdentitySQLControlSettingsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "5abec73c0332223a4dfa62d7ed991ebf", "score": "0.7273749", "text": "func (l *ClientDeletePollerResponse) Resume(ctx context.Context, client *Client, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"Client.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "d7a0d6df2b0c03094c46ff82a0cedd77", "score": "0.7269448", "text": "func (l *WorkspaceManagedSQLServerEncryptionProtectorClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *WorkspaceManagedSQLServerEncryptionProtectorClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"WorkspaceManagedSQLServerEncryptionProtectorClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &WorkspaceManagedSQLServerEncryptionProtectorClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "1b30aaab075daed1e525fe5804baa18a", "score": "0.72648996", "text": "func (l *VirtualRoutersClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualRoutersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualRoutersClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualRoutersClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "9082c51a3805c9cbbeef7abb18823824", "score": "0.7263949", "text": "func (l *VirtualNetworkGatewayConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualNetworkGatewayConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualNetworkGatewayConnectionsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualNetworkGatewayConnectionsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "c8464f9707492780a31a9d63b7d02411", "score": "0.7258692", "text": "func (l *VPNConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VPNConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VPNConnectionsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VPNConnectionsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "579c5848065a6325762668e11092d1de", "score": "0.72562855", "text": "func (l *ProjectsClientCreatePollerResponse) Resume(ctx context.Context, client *ProjectsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ProjectsClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ProjectsClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "9404b91a0024da3141e4a1fbbddc5614", "score": "0.72541267", "text": "func (l *DdosCustomPoliciesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DdosCustomPoliciesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"DdosCustomPoliciesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &DdosCustomPoliciesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "bbfda78a1c98733a0066603811f16de4", "score": "0.7248431", "text": "func (l *VirtualWansClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualWansClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualWansClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualWansClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "debbadf4101e1ab6e1b12b67630d1fba", "score": "0.72465795", "text": "func (l *ApplicationGatewaysClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ApplicationGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ApplicationGatewaysClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ApplicationGatewaysClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "2cb4b662050b987a09d0ce89547f6a9d", "score": "0.723602", "text": "func (l *LiveOutputsClientCreatePollerResponse) Resume(ctx context.Context, client *LiveOutputsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"LiveOutputsClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &LiveOutputsClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "8fbc94ea4c9cbb2d866187225154ef62", "score": "0.7233836", "text": "func (l *VPNGatewaysClientDeletePollerResponse) Resume(ctx context.Context, client *VPNGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VPNGatewaysClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VPNGatewaysClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "fba2736ceccac55ba206f443515f45f1", "score": "0.7219009", "text": "func (l *LiveEventsClientStartPollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"LiveEventsClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &LiveEventsClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "e95ac68fc78cb76c5c40d74637edc523", "score": "0.72164804", "text": "func (l *MonitoringConfigClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *MonitoringConfigClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"MonitoringConfigClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &MonitoringConfigClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "dd855bd7bf181cbc765e0ac753331a94", "score": "0.7216234", "text": "func (l *DscpConfigurationClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DscpConfigurationClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"DscpConfigurationClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &DscpConfigurationClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "810a2003397d11bfa3fdafdbd77c8fe7", "score": "0.7212531", "text": "func (l *NatGatewaysClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *NatGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"NatGatewaysClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &NatGatewaysClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "437194d5e0803a0e5468191139c48a54", "score": "0.7206234", "text": "func (l *FlowLogsClientDeletePollerResponse) Resume(ctx context.Context, client *FlowLogsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"FlowLogsClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &FlowLogsClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b5c115e3a96370af0cc3871c4d5bbf03", "score": "0.72055", "text": "func (l *VirtualRouterPeeringsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualRouterPeeringsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualRouterPeeringsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualRouterPeeringsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "3dedf6492cf91835cfc10f40548c7ff8", "score": "0.72023445", "text": "func (l *VirtualHubBgpConnectionClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualHubBgpConnectionClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualHubBgpConnectionClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualHubBgpConnectionClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b7b741b9501a2e90253bf337add6af38", "score": "0.7189326", "text": "func (l *ExpressRouteCrossConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ExpressRouteCrossConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ExpressRouteCrossConnectionsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ExpressRouteCrossConnectionsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "d433c11e84687e5bbeed2174420faa91", "score": "0.7182691", "text": "func (l *IPAllocationsClientDeletePollerResponse) Resume(ctx context.Context, client *IPAllocationsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"IPAllocationsClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &IPAllocationsClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "e407d6b2f356bcd00b09dafd34381928", "score": "0.7181007", "text": "func (l *OrdersClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *OrdersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"OrdersClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &OrdersClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ecc494735a9865b31cf37d97a7081c87", "score": "0.7179378", "text": "func (l *PrivateEndpointsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"PrivateEndpointsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &PrivateEndpointsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "29d5948cd37e2cd7a38fec258f9ec9ad", "score": "0.71759844", "text": "func (l *RoutesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *RoutesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"RoutesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &RoutesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "83e0be237bbe6ef166e7d02aa977323c", "score": "0.7175012", "text": "func (l *RouteFiltersClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *RouteFiltersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"RouteFiltersClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &RouteFiltersClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ca76b81053752f9c04582b734c5cf56e", "score": "0.7172577", "text": "func (l *ContainersClientRefreshPollerResponse) Resume(ctx context.Context, client *ContainersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ContainersClient.Refresh\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ContainersClientRefreshPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "7cf3aed00cac2de35e9bd683ab25cd23", "score": "0.7170688", "text": "func (l *P2SVPNGatewaysClientDeletePollerResponse) Resume(ctx context.Context, client *P2SVPNGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"P2SVPNGatewaysClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &P2SVPNGatewaysClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "666eb04da418cd089c343051068b315e", "score": "0.71670103", "text": "func (l *ExpressRouteConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ExpressRouteConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ExpressRouteConnectionsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ExpressRouteConnectionsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "0efacec27f66adeabf4eda1e09d879f3", "score": "0.7164632", "text": "func (l *LiveEventsClientAllocatePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"LiveEventsClient.Allocate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &LiveEventsClientAllocatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "69e87c901396d6eedc1de444825b8c33", "score": "0.7164563", "text": "func (l *IPGroupsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *IPGroupsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"IPGroupsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &IPGroupsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "3bbc8d0b5232867132a8f22672dc3c7b", "score": "0.71628946", "text": "func (l *ExpressRouteGatewaysClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ExpressRouteGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ExpressRouteGatewaysClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ExpressRouteGatewaysClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "daa07b46c7e8aafd0187f06a1c5d2856", "score": "0.7159749", "text": "func (l *BackupPoliciesClientCreatePollerResponse) Resume(ctx context.Context, client *BackupPoliciesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"BackupPoliciesClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &BackupPoliciesClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "61267681d24269e009f5cd8f18e2ae2c", "score": "0.7157631", "text": "func (l *LiveEventsClientDeletePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"LiveEventsClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &LiveEventsClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "cbd5bfcb9b2c2e0bb84fb9712a46b03d", "score": "0.7151341", "text": "func (l *PacketCapturesClientDeletePollerResponse) Resume(ctx context.Context, client *PacketCapturesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"PacketCapturesClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &PacketCapturesClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "86e220c1ba19789c81c85fdaa45a0f28", "score": "0.7146957", "text": "func (l *KustoPoolDataConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *KustoPoolDataConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"KustoPoolDataConnectionsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &KustoPoolDataConnectionsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "7eaaefb9f791bf0e36f36af122ea451b", "score": "0.7146057", "text": "func (l *PrivateZonesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateZonesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"PrivateZonesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &PrivateZonesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "bc12fd71051884b5751e69542eb96eb1", "score": "0.7140712", "text": "func (l *IntegrationRuntimeObjectMetadataClientRefreshPollerResponse) Resume(ctx context.Context, client *IntegrationRuntimeObjectMetadataClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"IntegrationRuntimeObjectMetadataClient.Refresh\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &IntegrationRuntimeObjectMetadataClientRefreshPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "bc12fd71051884b5751e69542eb96eb1", "score": "0.7140712", "text": "func (l *IntegrationRuntimeObjectMetadataClientRefreshPollerResponse) Resume(ctx context.Context, client *IntegrationRuntimeObjectMetadataClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"IntegrationRuntimeObjectMetadataClient.Refresh\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &IntegrationRuntimeObjectMetadataClientRefreshPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b89a912ad421ef09aa7f56f9ffbb310f", "score": "0.71400946", "text": "func (l *VirtualNetworkGatewayConnectionsClientDeletePollerResponse) Resume(ctx context.Context, client *VirtualNetworkGatewayConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualNetworkGatewayConnectionsClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualNetworkGatewayConnectionsClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "0b0d5cd05636919b38beae60e6f0fa5b", "score": "0.7139755", "text": "func (l *ApplicationGatewaysClientDeletePollerResponse) Resume(ctx context.Context, client *ApplicationGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ApplicationGatewaysClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ApplicationGatewaysClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "21395757a73eb6b684a6b90779a15694", "score": "0.7138274", "text": "func (l *ContainersClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ContainersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ContainersClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ContainersClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "505db4567e564d3fa71f066964340e8e", "score": "0.7135969", "text": "func (l *PrivateLinkServicesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"PrivateLinkServicesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &PrivateLinkServicesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "eb95440317ad3095d0759a9b39fc69cc", "score": "0.71350324", "text": "func (l *FirewallPoliciesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *FirewallPoliciesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"FirewallPoliciesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &FirewallPoliciesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "645d7283a551c009fae01db99fbc8391", "score": "0.7133978", "text": "func (l *ExpressRouteCircuitConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ExpressRouteCircuitConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ExpressRouteCircuitConnectionsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ExpressRouteCircuitConnectionsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "bb8067aed2311d20fa7557640e237257", "score": "0.713187", "text": "func (l *HubVirtualNetworkConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *HubVirtualNetworkConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"HubVirtualNetworkConnectionsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &HubVirtualNetworkConnectionsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "6ef0e5a44c2f29da41432934061ddc3f", "score": "0.71316814", "text": "func (l *LinkedServicesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *LinkedServicesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"LinkedServicesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &LinkedServicesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "98008511633cdbea686b976504d347f2", "score": "0.71262866", "text": "func (l *InterfacesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *InterfacesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"InterfacesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &InterfacesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "53537e8986f8e2f19723bb6fd74fa639", "score": "0.71251625", "text": "func (l *VirtualWansClientDeletePollerResponse) Resume(ctx context.Context, client *VirtualWansClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualWansClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualWansClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "e5720a51f9183b79e856132796253380", "score": "0.7123427", "text": "func (l *ConnectionMonitorsClientStartPollerResponse) Resume(ctx context.Context, client *ConnectionMonitorsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ConnectionMonitorsClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ConnectionMonitorsClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "00e00dd3506f905107ac6bbbf647d681", "score": "0.7121769", "text": "func (l *IntegrationRuntimesClientCreatePollerResponse) Resume(ctx context.Context, client *IntegrationRuntimesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"IntegrationRuntimesClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &IntegrationRuntimesClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "cd852d5e833c27669f7ac3440e32302a", "score": "0.71164024", "text": "func (l *VPNConnectionsClientDeletePollerResponse) Resume(ctx context.Context, client *VPNConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VPNConnectionsClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VPNConnectionsClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "cfe2471df27255874a0849b78b275109", "score": "0.7113194", "text": "func (l *TriggersClientStartPollerResponse) Resume(ctx context.Context, client *TriggersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"TriggersClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &TriggersClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ffea873074d296dcf6f082a82c7f0c52", "score": "0.711153", "text": "func (l *VirtualHubIPConfigurationClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualHubIPConfigurationClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualHubIPConfigurationClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualHubIPConfigurationClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "eddd97edc85be5ae327565079a02ba6f", "score": "0.7110644", "text": "func (l *VirtualNetworkTapsClientDeletePollerResponse) Resume(ctx context.Context, client *VirtualNetworkTapsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualNetworkTapsClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualNetworkTapsClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "77680a5fc22b155e2f4046766ff1ba24", "score": "0.7108316", "text": "func (l *RouteFilterRulesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *RouteFilterRulesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"RouteFilterRulesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &RouteFilterRulesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "08c605c143365489830a814605a83239", "score": "0.71055794", "text": "func (l *StreamingEndpointsClientStartPollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"StreamingEndpointsClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &StreamingEndpointsClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "27d1d0059e0214b54b57b9df42207605", "score": "0.710487", "text": "func (l *VirtualNetworkGatewaysClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualNetworkGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualNetworkGatewaysClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualNetworkGatewaysClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ca14b1be076c06b71dcdbb3c09490e54", "score": "0.71034193", "text": "func (l *VirtualRoutersClientDeletePollerResponse) Resume(ctx context.Context, client *VirtualRoutersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualRoutersClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualRoutersClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "63c7808ccafb676cc1632eed170d8038", "score": "0.70941925", "text": "func (l *TriggersClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *TriggersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"TriggersClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &TriggersClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "dc00b9ab47847834ffff2ba177d02bd4", "score": "0.70921195", "text": "func (l *MonitoringConfigClientDeletePollerResponse) Resume(ctx context.Context, client *MonitoringConfigClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"MonitoringConfigClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &MonitoringConfigClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "02197672d326596125e2d93bd430990e", "score": "0.70918", "text": "func (l *IPGroupsClientDeletePollerResponse) Resume(ctx context.Context, client *IPGroupsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"IPGroupsClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &IPGroupsClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "c6115e5dea4199f3ca83888f2b807bbe", "score": "0.70900637", "text": "func (l *DdosProtectionPlansClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DdosProtectionPlansClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"DdosProtectionPlansClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &DdosProtectionPlansClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "f266cd42b6d2130d060c4205e65188ee", "score": "0.708842", "text": "func (l *VirtualNetworksClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualNetworksClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualNetworksClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualNetworksClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "d4ef465e10fe7bea7f0d353a65939382", "score": "0.7086", "text": "func (l *FirewallPoliciesClientDeletePollerResponse) Resume(ctx context.Context, client *FirewallPoliciesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"FirewallPoliciesClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &FirewallPoliciesClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "c0cbe9adf59e2b86e4966f03663bf9d4", "score": "0.70850796", "text": "func (l *VPNGatewaysClientStartPacketCapturePollerResponse) Resume(ctx context.Context, client *VPNGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VPNGatewaysClient.StartPacketCapture\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VPNGatewaysClientStartPacketCapturePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "e3199ab42eacceff292ac06e965fd6f2", "score": "0.7083925", "text": "func (l *IPFirewallRulesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *IPFirewallRulesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"IPFirewallRulesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &IPFirewallRulesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "898e08da08b4630003835c662f8cf423", "score": "0.70830137", "text": "func (l *DdosCustomPoliciesClientDeletePollerResponse) Resume(ctx context.Context, client *DdosCustomPoliciesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"DdosCustomPoliciesClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &DdosCustomPoliciesClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "30702ae36c69ded6f1ce285b90cd8fd4", "score": "0.7082968", "text": "func (l *InboundSecurityRuleClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *InboundSecurityRuleClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"InboundSecurityRuleClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &InboundSecurityRuleClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "8b1ba921c2550b9e28cc82a89b786317", "score": "0.7082678", "text": "func (l *VirtualHubBgpConnectionClientDeletePollerResponse) Resume(ctx context.Context, client *VirtualHubBgpConnectionClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualHubBgpConnectionClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualHubBgpConnectionClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "5dc689b09f34235e6346ad1c52c82486", "score": "0.7080534", "text": "func (l *VirtualNetworkGatewayNatRulesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualNetworkGatewayNatRulesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualNetworkGatewayNatRulesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualNetworkGatewayNatRulesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "8ba58423578349d1be77c3318e6d1fa8", "score": "0.7080532", "text": "func (l *StorageAccountCredentialsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *StorageAccountCredentialsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"StorageAccountCredentialsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &StorageAccountCredentialsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "c91aac5d82b30ea5c714fa558e6356c4", "score": "0.7079146", "text": "func (l *AccountsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *AccountsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"AccountsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &AccountsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "692accd556f96cd08b50f8e1de99b715", "score": "0.7079129", "text": "func (l *VirtualNetworkPeeringsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualNetworkPeeringsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualNetworkPeeringsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualNetworkPeeringsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "0adc740a56e474cb14572ce2dc201c93", "score": "0.7078661", "text": "func (l *ContainersClientDeletePollerResponse) Resume(ctx context.Context, client *ContainersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ContainersClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ContainersClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "7500ce98c3fc2582664a8a47f5557127", "score": "0.7075092", "text": "func (l *InboundNatRulesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *InboundNatRulesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"InboundNatRulesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &InboundNatRulesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "19b7ba67be7db013c333a273157b01d8", "score": "0.7073714", "text": "func (l *KustoPoolsClientStartPollerResponse) Resume(ctx context.Context, client *KustoPoolsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"KustoPoolsClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &KustoPoolsClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ffef568b78d6b51bb42337d9169b9ce2", "score": "0.7072545", "text": "func (l *ServiceEndpointPoliciesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ServiceEndpointPoliciesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ServiceEndpointPoliciesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ServiceEndpointPoliciesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "acdcf033ff678ccd48c0c98ea62b5ef6", "score": "0.70703405", "text": "func (l *ClustersClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ClustersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ClustersClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ClustersClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "6edb3c715fac7d8e6ad642dfb1e14b5f", "score": "0.70699435", "text": "func (l *TasksCreatePollerResponse) Resume(ctx context.Context, client *TasksClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"TasksClient.Create\", token, client.pl, client.createHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &TasksCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "281f9bbb2160e7d816495b08763cd885", "score": "0.70699084", "text": "func (l *VPNGatewaysClientResetPollerResponse) Resume(ctx context.Context, client *VPNGatewaysClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VPNGatewaysClient.Reset\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VPNGatewaysClientResetPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "dea3408a838559839b5fc70ac3eccd19", "score": "0.7069448", "text": "func (l *VirtualHubIPConfigurationClientDeletePollerResponse) Resume(ctx context.Context, client *VirtualHubIPConfigurationClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualHubIPConfigurationClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualHubIPConfigurationClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "98bfa52e082d2d2e55e09ab68869cc51", "score": "0.7065555", "text": "func (l *VolumeGroupsClientCreatePollerResponse) Resume(ctx context.Context, client *VolumeGroupsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VolumeGroupsClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VolumeGroupsClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "3433e495163315882900a4846947b2d4", "score": "0.7064306", "text": "func (l *RouteTablesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *RouteTablesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"RouteTablesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &RouteTablesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" } ]
6dd61e31408d4fa5109569e8690e408e
SetNetworkInterfaceId sets the NetworkInterfaceId field's value.
[ { "docid": "6d9883b6d7a1180d764cc1b90fdede15", "score": "0.90116626", "text": "func (s *MountTargetDescription) SetNetworkInterfaceId(v string) *MountTargetDescription {\n\ts.NetworkInterfaceId = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "276b670146adb57ca7fe8006dfd7f10f", "score": "0.90555936", "text": "func (s *DescribeNotebookInstanceOutput) SetNetworkInterfaceId(v string) *DescribeNotebookInstanceOutput {\n\ts.NetworkInterfaceId = &v\n\treturn s\n}", "title": "" }, { "docid": "95b93a982ed1183eac16eb95cc0c925b", "score": "0.87996864", "text": "func (s *NetworkInterface) SetNetworkInterfaceId(v string) *NetworkInterface {\n\ts.NetworkInterfaceId = &v\n\treturn s\n}", "title": "" }, { "docid": "6b3c905fb339c7728a5a33588263c016", "score": "0.72922766", "text": "func (o ElastigroupNetworkInterfaceOutput) NetworkInterfaceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ElastigroupNetworkInterface) *string { return v.NetworkInterfaceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d4b3b1d9988a94064e5bf205ffc1e4c5", "score": "0.7210833", "text": "func (o EndpointNetworkInterfaceOutput) NetworkInterfaceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EndpointNetworkInterface) *string { return v.NetworkInterfaceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b2acce982ddeab64f04c3962d9bf10a5", "score": "0.7038144", "text": "func (in *ActionIpAddressIndexInput) SetNetworkInterface(value int64) *ActionIpAddressIndexInput {\n\tin.NetworkInterface = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin.SetNetworkInterfaceNil(false)\n\tin._selectedParameters[\"NetworkInterface\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "4b042f2a43bdf0f63dafae65b2ea7a34", "score": "0.6933074", "text": "func (o CachesIscsiVolumeOutput) NetworkInterfaceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *CachesIscsiVolume) pulumi.StringOutput { return v.NetworkInterfaceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a8f7231efc2dd7d96adbe63923bc36fb", "score": "0.67877764", "text": "func (cfg *Config) SetNetworkInterfaceName(ifn string) {\n\tcfg.NetworkInterface = ifn\n}", "title": "" }, { "docid": "a29a05bbdc3876d03c191e79dd18f1f4", "score": "0.67397845", "text": "func (r *CachesIscsiVolume) NetworkInterfaceId() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"networkInterfaceId\"])\n}", "title": "" }, { "docid": "910968d15053c3f74b5bc712dae0e167", "score": "0.6581839", "text": "func (o RouteOutput) NetworkInterfaceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Route) pulumi.StringOutput { return v.NetworkInterfaceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7a1028c19e87f59f1cedd49c1261b715", "score": "0.6533585", "text": "func (o *LinkPrivateIpsRequest) SetNicId(v string) {\n\to.NicId = v\n}", "title": "" }, { "docid": "5be66316420a00f879ee410c7eada91c", "score": "0.6496082", "text": "func (o *CreateRouteRequest) SetNicId(v string) {\n\to.NicId = &v\n}", "title": "" }, { "docid": "6675a9945e3ded63c9c3de2dbe189b49", "score": "0.6338576", "text": "func (s *GetMemberInput) SetNetworkId(v string) *GetMemberInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "997a0b47187057bac7b753a874b1f3a5", "score": "0.62749517", "text": "func (s *Member) SetNetworkId(v string) *Member {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "a370476a7ff89de1f019c83fbf8ac5b9", "score": "0.62319493", "text": "func (s *ListMembersInput) SetNetworkId(v string) *ListMembersInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "70c545e7005501bc0cfeb74387978317", "score": "0.622472", "text": "func (s *Node) SetNetworkId(v string) *Node {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "5332446cf301554e6946c43b744d450c", "score": "0.6210611", "text": "func (s *Proposal) SetNetworkId(v string) *Proposal {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "7c5675dc00a8b6fa676754ba383b2007", "score": "0.61954343", "text": "func (s *GetProposalInput) SetNetworkId(v string) *GetProposalInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "df0ec09157d1bd8099f9982a83fd6e5d", "score": "0.61891", "text": "func (o *LinkPublicIpRequest) SetNicId(v string) {\n\to.NicId = &v\n}", "title": "" }, { "docid": "7969a4f2458041b91b128a0094006c49", "score": "0.6156521", "text": "func (o *IpamIPAddressesListParams) SetInterfaceID(interfaceID *string) {\n\to.InterfaceID = interfaceID\n}", "title": "" }, { "docid": "becfb24012c49586154e1bf7bf7474b9", "score": "0.61283493", "text": "func (s *ListProposalsInput) SetNetworkId(v string) *ListProposalsInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "90e45493e372133e68bb78f488143953", "score": "0.61269975", "text": "func (s *CreateMemberInput) SetNetworkId(v string) *CreateMemberInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "773d1293f4aca1564707079fc90617e7", "score": "0.61132014", "text": "func (s *UpdateMemberInput) SetNetworkId(v string) *UpdateMemberInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "462781a29c363c3f5cf632f34d40e0c0", "score": "0.6098066", "text": "func (o *IpamIPAddressesListParams) SetInterfaceIDn(interfaceIDn *string) {\n\to.InterfaceIDn = interfaceIDn\n}", "title": "" }, { "docid": "bca033dd50862e4c315ed010ffa3e58f", "score": "0.6093622", "text": "func (o *VirtualizationVmwareVirtualMachineAllOf) SetVnicDeviceConfigId(v string) {\n\to.VnicDeviceConfigId = &v\n}", "title": "" }, { "docid": "9105cd0ee1c74d3c866f53514b19ea60", "score": "0.608724", "text": "func (s *DeleteMemberInput) SetNetworkId(v string) *DeleteMemberInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "5be0c2a1c6d218144f89c553c29a1314", "score": "0.6065759", "text": "func (o *IpamNetworkDataData) SetNetworkId(v string) {\n\to.NetworkId = &v\n}", "title": "" }, { "docid": "33d857f22896daf4c161d1bc9e0b0667", "score": "0.6062512", "text": "func (o *PublicIp) SetNicId(v string) {\n\to.NicId = &v\n}", "title": "" }, { "docid": "33d857f22896daf4c161d1bc9e0b0667", "score": "0.6062512", "text": "func (o *PublicIp) SetNicId(v string) {\n\to.NicId = &v\n}", "title": "" }, { "docid": "d54522de8987d1d9e82917fa7549fe74", "score": "0.60618293", "text": "func (s *CreateProposalInput) SetNetworkId(v string) *CreateProposalInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "79c815f1a11a3849e39f9ceea87f7169", "score": "0.6052932", "text": "func (s *VoteOnProposalInput) SetNetworkId(v string) *VoteOnProposalInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "2524f9f3dbbea3eaeda4b1cb93a49794", "score": "0.6041179", "text": "func (s *UpdateNodeInput) SetNetworkId(v string) *UpdateNodeInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "8a9f77032f57482f3af97c506ac90efb", "score": "0.6031753", "text": "func (s *CreateNodeInput) SetNetworkId(v string) *CreateNodeInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "643e35293f2997165c2bfe904b84aab8", "score": "0.6027577", "text": "func (s *GetNodeInput) SetNetworkId(v string) *GetNodeInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "ad10c5cdda1bde87b6e19d856f42bafa", "score": "0.602566", "text": "func (s *ListProposalVotesInput) SetNetworkId(v string) *ListProposalVotesInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "005960836bc36c470abcd0cadeb2e037", "score": "0.6011817", "text": "func (s *ListNodesInput) SetNetworkId(v string) *ListNodesInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "90aff6989c14caace061280ac9b399a1", "score": "0.6001132", "text": "func (s *DeleteNodeInput) SetNetworkId(v string) *DeleteNodeInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "172f9fb4c6ed7fbf9dbdee512018fbb7", "score": "0.5979494", "text": "func (o ReplicatedVMNetworkInterfaceOutput) SourceNetworkInterfaceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ReplicatedVMNetworkInterface) *string { return v.SourceNetworkInterfaceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2f740061e9ef98c0b689bd8c9c3d74a4", "score": "0.5953289", "text": "func (o *LinkPrivateIpsRequest) GetNicId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.NicId\n}", "title": "" }, { "docid": "af7c99572e2b6efc382647e339eff108", "score": "0.5949228", "text": "func (s *ModifyNASInstanceInput) SetNetworkId(v string) *ModifyNASInstanceInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "1c0d6b4d302ae0d500bb800eb23984c3", "score": "0.59456956", "text": "func ParseOptNetworkInterfaceId(data []byte) (*OptNetworkInterfaceId, error) {\n\tbuf := uio.NewBigEndianBuffer(data)\n\tvar opt OptNetworkInterfaceId\n\topt.type_ = buf.Read8()\n\topt.major = buf.Read8()\n\topt.minor = buf.Read8()\n\treturn &opt, buf.FinError()\n}", "title": "" }, { "docid": "72f62ce8d5e935c49020e8f742f0511f", "score": "0.59358287", "text": "func (s *GetNetworkInput) SetNetworkId(v string) *GetNetworkInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "1921ca71ea3223daea26f68e008f77ce", "score": "0.59299874", "text": "func (s *NASInstance) SetNetworkId(v string) *NASInstance {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "929ec8d82d5ba1e42fd66a9e725796cc", "score": "0.5928738", "text": "func (o *SecurityGroup) SetNetId(v string) {\n\to.NetId = &v\n}", "title": "" }, { "docid": "af295f3ea4c18cf26370de79d862eb36", "score": "0.5865926", "text": "func (s *CreateNASInstanceInput) SetNetworkId(v string) *CreateNASInstanceInput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "cc510036bfdb32fc7bd2c5b892dac40c", "score": "0.58469814", "text": "func (ec2 *EC2) DeleteNetworkInterface(id string) (resp *SimpleResp, err error) {\n\tparams := makeParams(\"DeleteNetworkInterface\")\n\tparams[\"NetworkInterfaceId\"] = id\n\tresp = &SimpleResp{}\n\terr = ec2.query(params, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "c2612bee7502342e036b5f4821da83f2", "score": "0.5838085", "text": "func (isrtuo *IPStaticRoutingTableUpdateOne) SetOnInterfaceID(id int) *IPStaticRoutingTableUpdateOne {\n\tisrtuo.mutation.SetOnInterfaceID(id)\n\treturn isrtuo\n}", "title": "" }, { "docid": "8ad519d70a586018853b0006e30ab26e", "score": "0.5833095", "text": "func (isrtu *IPStaticRoutingTableUpdate) SetOnInterfaceID(id int) *IPStaticRoutingTableUpdate {\n\tisrtu.mutation.SetOnInterfaceID(id)\n\treturn isrtu\n}", "title": "" }, { "docid": "f19db2e20ffe396793449cbd56fa8f16", "score": "0.5792586", "text": "func (o *ListOpenstackSubnetsNoCredentialsV2Params) SetNetworkID(networkID *string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "0d7bbab3a8a1e31474981ca2b12461af", "score": "0.57786053", "text": "func (s *Service) DeleteNetworkInterface(resourceGroup string, networkInterfaceName string) (armada.InterfacesDeleteFuture, error) {\n\t//JEB return s.scope.AirshipClients.Interfaces.Delete(s.scope.Context, resourceGroup, networkInterfaceName)\n\treturn armada.InterfacesDeleteFuture{}, nil\n}", "title": "" }, { "docid": "223ecbe897be73c68f0fcaaffdc484d7", "score": "0.5776891", "text": "func (s *CreateNetworkOutput) SetNetworkId(v string) *CreateNetworkOutput {\n\ts.NetworkId = &v\n\treturn s\n}", "title": "" }, { "docid": "350ea890d296b2505579f8f4d2eceef2", "score": "0.5746137", "text": "func (o *UpdateNetRequest) SetNetId(v string) {\n\to.NetId = v\n}", "title": "" }, { "docid": "e30bd1b55b59aaa63adb64ce8fa8b0ac", "score": "0.5714624", "text": "func (o *LinkPublicIpRequest) GetNicId() string {\n\tif o == nil || o.NicId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.NicId\n}", "title": "" }, { "docid": "2bb7e096d486ba9ceb8a5c1609afd267", "score": "0.56659436", "text": "func (o *GetLTENetworkIDPolicyQosProfilesParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "6fbae28b36c2ddb878f3af36e3038602", "score": "0.56184787", "text": "func (scsu *SurveyCellScanUpdate) SetNetworkID(s string) *SurveyCellScanUpdate {\n\tscsu.network_id = &s\n\treturn scsu\n}", "title": "" }, { "docid": "2ea11898772fb99d5ac3c5837d5f5108", "score": "0.5608331", "text": "func (o *GetNetworkSwitchSettingsQosRuleParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "1a4e4e31c1c1a57af47f20657f61220c", "score": "0.5585536", "text": "func (scsuo *SurveyCellScanUpdateOne) SetNetworkID(s string) *SurveyCellScanUpdateOne {\n\tscsuo.network_id = &s\n\treturn scsuo\n}", "title": "" }, { "docid": "a75547ba8c8cec485604568ba0884ee4", "score": "0.5577296", "text": "func (o *CreateNetworkGroupPolicyParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "5ce3bba8d23d1ad8e7e68b9d874116fd", "score": "0.5571361", "text": "func (o *ProvisionNetworkClientsParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "5cdcb5329801d3fe46a9ab3ca6f525b1", "score": "0.5566303", "text": "func (o *LinkNic) SetLinkNicId(v string) {\n\to.LinkNicId = &v\n}", "title": "" }, { "docid": "37e9d17c5ae043647f0e39d9a762e615", "score": "0.55623186", "text": "func (o *UpdateNetworkSwitchAccessControlListsParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "87d82bd0cf9eea485337e1b4ceed5a70", "score": "0.55518734", "text": "func (o *DeleteNetworkGroupPolicyParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "1e46df4d11c9f7c48fa8f1dc2f8efc74", "score": "0.5545064", "text": "func (o *GetFegNetworkIDGatewaysGatewayIDHealthStatusParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "eada7c92b18394a412d27603cc991e11", "score": "0.5539196", "text": "func (o *UpdateNetworkCellularGatewaySettingsSubnetPoolParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "35d9e89056c29fd965376ccc132c0811", "score": "0.5536638", "text": "func (o *PutNetworksNetworkIDPoliciesRulesRuleIDParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "3894195a424ce0113b547fd71af0bc25", "score": "0.55327296", "text": "func (o *GetCwfNetworkIDGatewaysGatewayIDParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "698f92531cdddc30c389881b8ba047fe", "score": "0.5528723", "text": "func DisableNetworkInterface(ctx context.Context, iface string) (CleanupCallback, error) {\n\ttesting.ContextLogf(ctx, \"Disabling network interface %q\", iface)\n\tif err := disableNetworkInterface(ctx, iface); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn func(ctx context.Context) error {\n\t\ttesting.ContextLogf(ctx, \"Re-enabling network interface %q\", iface)\n\t\treturn enableNetworkInterface(ctx, iface)\n\t}, nil\n}", "title": "" }, { "docid": "18796959e8dcaee215f401f8fc5f0276", "score": "0.5513425", "text": "func (o *GetLTENetworkIDSubscribersV2Params) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "816bff49f4b2308b7eee2a70260c25cc", "score": "0.5493518", "text": "func (o *PublicIp) GetNicId() string {\n\tif o == nil || o.NicId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.NicId\n}", "title": "" }, { "docid": "816bff49f4b2308b7eee2a70260c25cc", "score": "0.5493518", "text": "func (o *PublicIp) GetNicId() string {\n\tif o == nil || o.NicId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.NicId\n}", "title": "" }, { "docid": "e2d2110557d0e67148b54bc683092795", "score": "0.5492385", "text": "func (o *IpamIPAddressesListParams) SetVminterfaceIDn(vminterfaceIDn *string) {\n\to.VminterfaceIDn = vminterfaceIDn\n}", "title": "" }, { "docid": "93734b96baaf188c6265b0332bb63190", "score": "0.5479316", "text": "func (o *PutCwfNetworkIDParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "56ed9e5ab58c7643527c0b397c906b36", "score": "0.5478384", "text": "func (o *PostNetworksNetworkIDPoliciesBaseNamesParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "3a0a70d01ecd05d96d7a5ccfeb91bf47", "score": "0.544287", "text": "func (o *UpdateNetworkHTTPServerParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "6a6a475de05b449308fb9f1d3124e82d", "score": "0.5410577", "text": "func (o *GetNetworkMerakiAuthUserParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "e4ee8915aa4fc117a4f2d0fb4b8a99a7", "score": "0.5389786", "text": "func (o *IpamIPAddressesListParams) SetVminterfaceID(vminterfaceID *string) {\n\to.VminterfaceID = vminterfaceID\n}", "title": "" }, { "docid": "d59a1d8d72a013e7b2c24081613054cf", "score": "0.5386975", "text": "func (o NetworkInterfaceOutput) SubnetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *NetworkInterface) pulumi.StringOutput { return v.SubnetId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a9e923280e2f75390aaf29b350a00574", "score": "0.538265", "text": "func (o *GetNetworkAppliancePortParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "5af2bfbf29c8bc1fb27557321025e8e8", "score": "0.5359196", "text": "func (o *DeleteNetworksNetworkIDTiersTierIDImagesImageNameParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "a2dddcade9bf460b56cb36fd6d330d75", "score": "0.5327784", "text": "func (o *DeleteCwfNetworkIDParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "bf0416c4969331a544d77ebf8d9ffa6b", "score": "0.5306986", "text": "func (o *IpamNetworkDataData) GetNetworkId() string {\n\tif o == nil || o.NetworkId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.NetworkId\n}", "title": "" }, { "docid": "82131c181c59a242a7eef0019546e95d", "score": "0.5280487", "text": "func (filterdev *NetworkTap) SetInterface(fd int, name string) error {\n\tvar iv ivalue\n\tcopy(iv.name[:], []byte(name))\n\t_, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(filterdev.device.Fd()), syscall.BIOCSETIF, uintptr(unsafe.Pointer(&iv)))\n\tif err != 0 {\n\t\treturn syscall.Errno(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8a3c43f0e5d87806cbdcef056e26f6b9", "score": "0.5271369", "text": "func (in *ActionIpAddressIndexInput) SetNetworkInterfaceNil(set bool) *ActionIpAddressIndexInput {\n\tif in._nilParameters == nil {\n\t\tif !set {\n\t\t\treturn in\n\t\t}\n\t\tin._nilParameters = make(map[string]interface{})\n\t}\n\n\tif set {\n\t\tin._nilParameters[\"NetworkInterface\"] = nil\n\t\tin.SelectParameters(\"NetworkInterface\")\n\t} else {\n\t\tdelete(in._nilParameters, \"NetworkInterface\")\n\t}\n\treturn in\n}", "title": "" }, { "docid": "9990e02e6f403c7eb7b0353a5657ba14", "score": "0.525226", "text": "func (cfg Config) GetNetworkInterfaceName() (ifn string) {\n\treturn cfg.NetworkInterface\n}", "title": "" }, { "docid": "1f679bebf4a6e34d4d8c8d7fd57bcffe", "score": "0.5248737", "text": "func (b *bpfHandle) SetInterface(name string) error {\n\t// NOTE: I chose 128 bytes in order to be extremely cautious.\n\t// Currently on OS X (10.11), the ifreq structure is only 32 bytes.\n\tdata := make([]byte, 128)\n\tcopy(data, []byte(name))\n\tif ok, err := b.ioctlWithData(ioctlBIOCSETIF, data); ok {\n\t\treturn nil\n\t} else if err == unix.ENXIO {\n\t\treturn errors.New(\"no such device: \" + name)\n\t} else if err == unix.ENETDOWN {\n\t\treturn errors.New(\"interface is down: \" + name)\n\t} else {\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "3bf98320a7aaf5803b6b38b07ec848b3", "score": "0.5209617", "text": "func (o *PutLTENetworkIDGatewaysGatewayIDConnectedENODEBSerialsParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "ba9860407b21b6599ff2b47688f21b4e", "score": "0.51977813", "text": "func (m *InterfacesClientMock) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result network.Interface, rerr *retry.Error) {\n\treturn network.Interface{}, nil\n}", "title": "" }, { "docid": "6d57a2388f0dc30692674b2a441ab9c1", "score": "0.51908636", "text": "func (o *CreateRouteRequest) GetNicId() string {\n\tif o == nil || o.NicId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.NicId\n}", "title": "" }, { "docid": "3e1bf4e048b8f70b8a7c23d2f0c2fbfc", "score": "0.518495", "text": "func (o *DeleteLTENetworkIDNetworkProbeTasksTaskIDParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "eee69ff339b7a27da51e112d1d6e2a87", "score": "0.51720506", "text": "func NewNetworkInterface(ctx *pulumi.Context,\n\tname string, args *NetworkInterfaceArgs, opts ...pulumi.ResourceOption) (*NetworkInterface, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.SubnetId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'SubnetId'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource NetworkInterface\n\terr := ctx.RegisterResource(\"aws-native:ec2:NetworkInterface\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "f67463a9c2d70f7085a625eae5ed2aa0", "score": "0.51635706", "text": "func (o *PostLTENetworkIDDNSRecordsDomainParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "c21d131408d023cfd8452b18d1885b82", "score": "0.51516664", "text": "func (o *PcloudPvminstancesNetworksGetParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "08f780c5c6a61410dca1aab11dc23649", "score": "0.5137506", "text": "func (mc *MockContiv) SetDefaultInterface(ifName string, ifIP net.IP) {\n\tmc.defaultIfName = ifName\n\tmc.defaultIfIP = ifIP\n}", "title": "" }, { "docid": "62c1b52a41a64e57bb5568bfb85a32ae", "score": "0.51292723", "text": "func (o *MemoryPersistentMemoryNamespaceConfigResult) SetSocketId(v string) {\n\to.SocketId = &v\n}", "title": "" }, { "docid": "248562a3fd8aa39b016eeb5c5014be82", "score": "0.51258504", "text": "func (w *WGMgr) ConfigureInterface(iConfig *Network) error {\n\tprivKey, err := wgtypes.ParseKey(iConfig.PrivateKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not parse key %s\", err)\n\t}\n\tlinkAttrs := netlink.NewLinkAttrs()\n\tlinkAttrs.Name = iConfig.Name\n\t_, err = uuid.Parse(iConfig.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"A valid UUID was not provided: %s\", err)\n\t}\n\tnewInterface := WGInterface{\n\t\tID: iConfig.ID,\n\t}\n\n\t// Generate new interface through netlink (wireguard type)\n\tnewInterface.Interface = &netlink.GenericLink{\n\t\tLinkAttrs: linkAttrs,\n\t\tLinkType: \"wireguard\",\n\t}\n\tw.wgInt = append(w.wgInt, &newInterface)\n\terr = netlink.LinkAdd(newInterface.Interface)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not add '%s' (%v)\", linkAttrs.Name, err)\n\t}\n\tipv4Addr, err := netlink.ParseAddr(iConfig.IP)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"IP is not valid IPv4 address %s\", err)\n\t}\n\terr = netlink.AddrAdd(newInterface.Interface, ipv4Addr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not add addr %s to interface %s\", iConfig.IP, err)\n\t}\n\tdeviceConfig := wgtypes.Config{\n\t\tPrivateKey: &privKey,\n\t\tListenPort: &iConfig.Port,\n\t}\n\terr = w.wgClient.ConfigureDevice(linkAttrs.Name, deviceConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"[WG/ConfigureInterface] Could not configure device '%s' (%v)\", linkAttrs.Name, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "caf36807f47e62a26a647cea41c67a5b", "score": "0.51239544", "text": "func (o *PostNetworksNetworkIDPrometheusAlertReceiverRouteParams) SetNetworkID(networkID string) {\n\to.NetworkID = networkID\n}", "title": "" }, { "docid": "1395344f47d5911321268f74a941e4ef", "score": "0.51085186", "text": "func Interface(ifname string) func(*NetworkTap) error {\n\treturn func(filterdev *NetworkTap) error {\n\t\terr := filterdev.SetInterface(int(filterdev.device.Fd()), ifname)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "82d8c8a64206bea58d87aab6a16c5623", "score": "0.51053846", "text": "func (ec2 *EC2) AttachNetworkInterface(interfaceId, instanceId string, deviceIndex int) (resp *AttachNetworkInterfaceResp, err error) {\n\tparams := makeParams(\"AttachNetworkInterface\")\n\tparams[\"NetworkInterfaceId\"] = interfaceId\n\tparams[\"InstanceId\"] = instanceId\n\tparams[\"DeviceIndex\"] = strconv.Itoa(deviceIndex)\n\tresp = &AttachNetworkInterfaceResp{}\n\terr = ec2.query(params, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "78f94be85dced5255310cebe571a6a8a", "score": "0.50974506", "text": "func (o *IpamNetworkDataData) SetVlsmNetworkId(v string) {\n\to.VlsmNetworkId = &v\n}", "title": "" }, { "docid": "d6168599e1bae113d7d227b17951813c", "score": "0.5078616", "text": "func (o *DhcpLease6DataData) SetSharednetwork6Id(v string) {\n\to.Sharednetwork6Id = &v\n}", "title": "" }, { "docid": "8e4f7dc8c0daaf00c3da2002bcb69005", "score": "0.5067776", "text": "func (o *DhcpSharednetwork6DeleteSuccessData) SetSharednetwork6Id(v string) {\n\to.Sharednetwork6Id = &v\n}", "title": "" } ]
dcee61f2435b8b064a5d74bec68f52e2
localPathCalls gets all the calls that were made to localPath. Check the length with: len(mockedlocalRepository.localPathCalls())
[ { "docid": "a9401c8a528ec786006b962c441f2723", "score": "0.8983396", "text": "func (mock *localRepositoryMock) localPathCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tmock.locklocalPath.RLock()\n\tcalls = mock.calls.localPath\n\tmock.locklocalPath.RUnlock()\n\treturn calls\n}", "title": "" } ]
[ { "docid": "51b1cf7e9bdb66becf6ecf6dea6f4f3c", "score": "0.7169192", "text": "func (mock *PackageManagerMock) InstallLocalCalls() []struct {\n\tDir string\n} {\n\tvar calls []struct {\n\t\tDir string\n\t}\n\n\tmock.lockInstallLocal.RLock()\n\tcalls = mock.calls.InstallLocal\n\tmock.lockInstallLocal.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "9048387d2a7d520599946a9abc6a9c64", "score": "0.7068242", "text": "func (mock *ConnectionMock) ListenPathCalls() []struct {\n\tPath string\n\tMethod string\n\tHandler http.HandlerFunc\n} {\n\tvar calls []struct {\n\t\tPath string\n\t\tMethod string\n\t\tHandler http.HandlerFunc\n\t}\n\tlockConnectionMockListenPath.RLock()\n\tcalls = mock.calls.ListenPath\n\tlockConnectionMockListenPath.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "dd880fc0a3dd4f585366a7c804782068", "score": "0.6423976", "text": "func (mock *localRepositoryMock) workingDirectoryCleanCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tmock.lockworkingDirectoryClean.RLock()\n\tcalls = mock.calls.workingDirectoryClean\n\tmock.lockworkingDirectoryClean.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2ecc11881bb0e7a7aa5e0b23a9779e50", "score": "0.6311335", "text": "func (mock *ClienterMock) GetPathsWithNoRetriesCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tmock.lockGetPathsWithNoRetries.RLock()\n\tcalls = mock.calls.GetPathsWithNoRetries\n\tmock.lockGetPathsWithNoRetries.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c422382923540373bbf708dbcd90d4eb", "score": "0.60283273", "text": "func (mock *RepositoryMock) GetAllCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tmock.lockGetAll.RLock()\n\tcalls = mock.calls.GetAll\n\tmock.lockGetAll.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "bac4f7b8ae99f8432c82121790070b61", "score": "0.5990834", "text": "func (mock *RunbookStepDetailsFinderMock) ListAllStepsCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tmock.lockListAllSteps.RLock()\n\tcalls = mock.calls.ListAllSteps\n\tmock.lockListAllSteps.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "477ad95790b630192fb9423975769924", "score": "0.5988358", "text": "func (mock *localRepositoryMock) gitCloneCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tmock.lockgitClone.RLock()\n\tcalls = mock.calls.gitClone\n\tmock.lockgitClone.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "17cafec343de3e249cb9ec0dfbc64f6b", "score": "0.5959295", "text": "func (mock *DeploymentControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockDeploymentControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockDeploymentControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "6266d75a3694611ba1477b33b1cde36a", "score": "0.59399813", "text": "func (mock *ClienterMock) SetPathsWithNoRetriesCalls() []struct {\n\tStrings []string\n} {\n\tvar calls []struct {\n\t\tStrings []string\n\t}\n\tmock.lockSetPathsWithNoRetries.RLock()\n\tcalls = mock.calls.SetPathsWithNoRetries\n\tmock.lockSetPathsWithNoRetries.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c8ea376d221489d3a66c47d5ad374b3d", "score": "0.58955467", "text": "func (mock *localRepositoryMock) openPullRequestCalls() []struct {\n\tCtx context.Context\n\tTitle string\n\tBody string\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tTitle string\n\t\tBody string\n\t}\n\tmock.lockopenPullRequest.RLock()\n\tcalls = mock.calls.openPullRequest\n\tmock.lockopenPullRequest.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "4fbfbe256a2eab2376f0ce062b36e687", "score": "0.58906317", "text": "func (mock *ServiceMock) ExistCalls() []struct {\n\tTx *sql.Tx\n\tO *domain.OrderInput\n} {\n\tvar calls []struct {\n\t\tTx *sql.Tx\n\t\tO *domain.OrderInput\n\t}\n\tlockServiceMockExist.RLock()\n\tcalls = mock.calls.Exist\n\tlockServiceMockExist.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "d2fa13fcacf2f6468541edf07e37c0fd", "score": "0.58778787", "text": "func (mock *BasicAuthControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockBasicAuthControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockBasicAuthControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "17156572bf0c6acf5497ee81416651f7", "score": "0.5877821", "text": "func (mock *LocationsGetterMock) GetLocationsCalls() []struct {\n\tDriverID string\n\tLastMinutes int\n} {\n\tvar calls []struct {\n\t\tDriverID string\n\t\tLastMinutes int\n\t}\n\tlockLocationsGetterMockGetLocations.RLock()\n\tcalls = mock.calls.GetLocations\n\tlockLocationsGetterMockGetLocations.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "df86ff713dd9e961120ea76fbe618f4d", "score": "0.5863822", "text": "func (mock *ClientMock) GetLogicalRouterCalls() []struct {\n\tLogicalRouterID string\n} {\n\tvar calls []struct {\n\t\tLogicalRouterID string\n\t}\n\tlockClientMockGetLogicalRouter.RLock()\n\tcalls = mock.calls.GetLogicalRouter\n\tlockClientMockGetLogicalRouter.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "526817fe80a6b9cedc70ca243be00155", "score": "0.58531016", "text": "func (mock *BackendMock) StatCalls() []struct {\n\tFilename string\n} {\n\tvar calls []struct {\n\t\tFilename string\n\t}\n\tlockBackendMockStat.RLock()\n\tcalls = mock.calls.Stat\n\tlockBackendMockStat.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ba3b5f77c492a7047028665c74ee9708", "score": "0.5818978", "text": "func (mock *localRepositoryMock) CloseCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tmock.lockClose.RLock()\n\tcalls = mock.calls.Close\n\tmock.lockClose.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1971ad5a4a034b01d69d54d66bd42689", "score": "0.5793348", "text": "func (mock *ApplicationControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockApplicationControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockApplicationControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "3fdee8f57cdda58f3ffd6fb3f9961109", "score": "0.5786063", "text": "func (mock *ServiceMock) CheckMenuExistCalls() []struct {\n\tTx *sql.Tx\n\tMenuID int\n} {\n\tvar calls []struct {\n\t\tTx *sql.Tx\n\t\tMenuID int\n\t}\n\tlockServiceMockCheckMenuExist.RLock()\n\tcalls = mock.calls.CheckMenuExist\n\tlockServiceMockCheckMenuExist.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ed0deac1a07211547be5a228fc73da54", "score": "0.57699627", "text": "func (mock *ClienterMock) RoundTripCalls() []struct {\n\tReq *http.Request\n} {\n\tvar calls []struct {\n\t\tReq *http.Request\n\t}\n\tmock.lockRoundTrip.RLock()\n\tcalls = mock.calls.RoundTrip\n\tmock.lockRoundTrip.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e7fb636513310db3a59f5678e680843f", "score": "0.57575655", "text": "func (mock *ServiceMonitorControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockServiceMonitorControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockServiceMonitorControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a90380c73b7019ed1fce1dce2afc6012", "score": "0.5753039", "text": "func (mock *CronJobControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockCronJobControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockCronJobControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b0d1477e89093a94e8adc23fe2be356b", "score": "0.574708", "text": "func (mock *GlobalDnsProviderControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockGlobalDnsProviderControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockGlobalDnsProviderControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "31a024b6b93529b7e99c685c43ac502d", "score": "0.5743526", "text": "func (mock *ConnectionMock) AddrCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockConnectionMockAddr.RLock()\n\tcalls = mock.calls.Addr\n\tlockConnectionMockAddr.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "35ad3f47b55b8141a09758a0ec2bbc3c", "score": "0.5740928", "text": "func (mock *GlobalDnsProviderInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockGlobalDnsProviderInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockGlobalDnsProviderInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "363fe179dc9a91f4a80a0e64e27a91e9", "score": "0.5701738", "text": "func (mock *AuthProviderInterfaceMock) WatchCalls() []struct {\n\tOpts v1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts v1.ListOptions\n\t}\n\tlockAuthProviderInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockAuthProviderInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "57b52adf99f62a7132bce02471ec7df5", "score": "0.5701733", "text": "func (mock *PodControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockPodControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockPodControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "4475e5d4c9db243c76f0c4d4b6f51ce9", "score": "0.5698376", "text": "func (mock *RepositoryMock) GetByCPFCalls() []struct {\n\tCtx context.Context\n\tCpf vos.CPF\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tCpf vos.CPF\n\t}\n\tmock.lockGetByCPF.RLock()\n\tcalls = mock.calls.GetByCPF\n\tmock.lockGetByCPF.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "87cb86e54fb2b6df928a076c91aead9e", "score": "0.56858957", "text": "func (mock *CisConfigControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockCisConfigControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockCisConfigControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "aca37aa7b2353de5cacf3e4a903692b7", "score": "0.5671055", "text": "func (mock *AuthProviderControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockAuthProviderControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockAuthProviderControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "976e63c270859991b76c95896d49b041", "score": "0.56631917", "text": "func (mock *BasicAuthInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockBasicAuthInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockBasicAuthInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c98509b73cea2d81c6a502496a6e23b4", "score": "0.56175405", "text": "func (mock *DeploymentListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockDeploymentListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockDeploymentListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1d4bc187d0ad30fc8a1812c6b8ccda82", "score": "0.5617252", "text": "func (mock *ServerInterfaceMock) GetWithReferencesCalls() []struct {\n\tW http.ResponseWriter\n\tR *http.Request\n\tGlobalArgument int64\n\tArgument string\n} {\n\tvar calls []struct {\n\t\tW http.ResponseWriter\n\t\tR *http.Request\n\t\tGlobalArgument int64\n\t\tArgument string\n\t}\n\tmock.lockGetWithReferences.RLock()\n\tcalls = mock.calls.GetWithReferences\n\tmock.lockGetWithReferences.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1fd0145a5ad62e203d585c1f88cdc45d", "score": "0.56020576", "text": "func (mock *MongoServerMock) CheckerCalls() []struct {\n\tCtx context.Context\n\tState *healthcheck.CheckState\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tState *healthcheck.CheckState\n\t}\n\tlockMongoServerMockChecker.RLock()\n\tcalls = mock.calls.Checker\n\tlockMongoServerMockChecker.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "92c0424b0373c2c2fd1d1db851f9c971", "score": "0.55972755", "text": "func (mock *localRepositoryMock) gitCommitAndPushCalls() []struct {\n\tMessage string\n} {\n\tvar calls []struct {\n\t\tMessage string\n\t}\n\tmock.lockgitCommitAndPush.RLock()\n\tcalls = mock.calls.gitCommitAndPush\n\tmock.lockgitCommitAndPush.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "17a43baade6d5b3ebde1d533179a966c", "score": "0.559699", "text": "func (mock *ClienterMock) HeadCalls() []struct {\n\tCtx context.Context\n\tURL string\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tURL string\n\t}\n\tmock.lockHead.RLock()\n\tcalls = mock.calls.Head\n\tmock.lockHead.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "22d798b8c6a4d12afbcc377cb1db710c", "score": "0.55932295", "text": "func (mock *ClusterAlertControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockClusterAlertControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockClusterAlertControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "4e4cfb44d089b56f6e9aa59e84494e72", "score": "0.55895895", "text": "func (mock *MonitorMetricControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockMonitorMetricControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockMonitorMetricControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f3f55c80f2cb71acfe2e579a5d6d0495", "score": "0.5567812", "text": "func (mock *LoaderMock) ChangesCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockLoaderMockChanges.RLock()\n\tcalls = mock.calls.Changes\n\tlockLoaderMockChanges.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e305b6b6a411a8ef61d6b0ca734a40f1", "score": "0.55545753", "text": "func (mr *MockLocalAppCopyMockRecorder) GetLocalPath() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLocalPath\", reflect.TypeOf((*MockLocalAppCopy)(nil).GetLocalPath))\n}", "title": "" }, { "docid": "679ed6976a3218b64debb751d353d357", "score": "0.5554496", "text": "func (mock *localRepositoryMock) gitCheckoutNewBranchCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tmock.lockgitCheckoutNewBranch.RLock()\n\tcalls = mock.calls.gitCheckoutNewBranch\n\tmock.lockgitCheckoutNewBranch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8b93410b0b0c8bc4d18a9b1a56610db9", "score": "0.5552627", "text": "func (mock *InitialiserMock) DoGetHealthClientCalls() []struct {\n\tName string\n\tURL string\n} {\n\tvar calls []struct {\n\t\tName string\n\t\tURL string\n\t}\n\tlockInitialiserMockDoGetHealthClient.RLock()\n\tcalls = mock.calls.DoGetHealthClient\n\tlockInitialiserMockDoGetHealthClient.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e0b22099e1d1d49ce898dcc8992594d1", "score": "0.5544098", "text": "func (mock *KeycloakInterfaceMock) PingCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockKeycloakInterfaceMockPing.RLock()\n\tcalls = mock.calls.Ping\n\tlockKeycloakInterfaceMockPing.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "582089f536a23944ffe79a7464ab9d6f", "score": "0.553655", "text": "func (mock *ApplicationInterfaceMock) WatchCalls() []struct {\n\tOpts v1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts v1.ListOptions\n\t}\n\tlockApplicationInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockApplicationInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "0ed940b435bdcdfffcc93fac60744105", "score": "0.5535513", "text": "func (mock *GlobalDnsProviderListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockGlobalDnsProviderListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockGlobalDnsProviderListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "6113e6c38fbff42a37aeb9d6b88c0c6d", "score": "0.5531372", "text": "func (mock *GlobalDnsProviderInterfaceMock) ListCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockGlobalDnsProviderInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockGlobalDnsProviderInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2aace754f0c4043006e74a5ef8e09964", "score": "0.55313706", "text": "func (mock *RepoMock) StoreSenderRequestCalls() []struct {\n\tCtx context.Context\n\tReq sender.Request\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tReq sender.Request\n\t}\n\tmock.lockStoreSenderRequest.RLock()\n\tcalls = mock.calls.StoreSenderRequest\n\tmock.lockStoreSenderRequest.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "4fc30693a28d999e38f7db07c79b79f1", "score": "0.5528706", "text": "func (mock *UKeeperClient) GetCalls() []struct {\n\tLink string\n} {\n\tvar calls []struct {\n\t\tLink string\n\t}\n\tmock.lockGet.RLock()\n\tcalls = mock.calls.Get\n\tmock.lockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e41db76cc14794ac15de13a62dc7c2d4", "score": "0.55185145", "text": "func (mock *DeploymentInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockDeploymentInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockDeploymentInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "15e78019de9d8670280147c16c2072a2", "score": "0.5512621", "text": "func (mock *ClienterMock) GetCalls() []struct {\n\tCtx context.Context\n\tURL string\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tURL string\n\t}\n\tmock.lockGet.RLock()\n\tcalls = mock.calls.Get\n\tmock.lockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "81e0b9392bf5815d95a37e175b445988", "score": "0.55095935", "text": "func (mock *RepositoryMock) DoesExistByCPFCalls() []struct {\n\tCtx context.Context\n\tCpf vos.CPF\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tCpf vos.CPF\n\t}\n\tmock.lockDoesExistByCPF.RLock()\n\tcalls = mock.calls.DoesExistByCPF\n\tmock.lockDoesExistByCPF.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "106d993f84eaf28ec11d53ccd1ffeda8", "score": "0.55067915", "text": "func (mock *CisConfigInterfaceMock) WatchCalls() []struct {\n\tOpts v1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts v1.ListOptions\n\t}\n\tlockCisConfigInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockCisConfigInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "af885efe023bd12f2d2f8f2dbac562ea", "score": "0.5501109", "text": "func (mock *AuthProviderControllerMock) SyncCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tlockAuthProviderControllerMockSync.RLock()\n\tcalls = mock.calls.Sync\n\tlockAuthProviderControllerMockSync.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1e3b2703f6bcb3bc8e11aaa8a88690d8", "score": "0.5501015", "text": "func (mock *BasicAuthListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockBasicAuthListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockBasicAuthListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "957b0c931d996593302afc1d1dacc18f", "score": "0.5500579", "text": "func (mock *DeploymentInterfaceMock) ListCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockDeploymentInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockDeploymentInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "3f3b71924f5d6c30ff4c7fbee1b78eba", "score": "0.5496126", "text": "func (mock *ServiceMonitorInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockServiceMonitorInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockServiceMonitorInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ecd3c0b3058b62609d98ef4f439fb7f3", "score": "0.54872125", "text": "func (mock *ApplicationControllerMock) SyncCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tlockApplicationControllerMockSync.RLock()\n\tcalls = mock.calls.Sync\n\tlockApplicationControllerMockSync.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b6834e5df0abfd52d38730795e9e16f9", "score": "0.5468545", "text": "func (mock *CisConfigControllerMock) SyncCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tlockCisConfigControllerMockSync.RLock()\n\tcalls = mock.calls.Sync\n\tlockCisConfigControllerMockSync.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a7bd90aea7417294ecffdd2d6097dfad", "score": "0.5466661", "text": "func (mock *DeploymentListerMock) ListCalls() []struct {\n\tNamespace string\n\tSelector labels.Selector\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tSelector labels.Selector\n\t}\n\tlockDeploymentListerMockList.RLock()\n\tcalls = mock.calls.List\n\tlockDeploymentListerMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ba6f81d84cef1b8a413cf37f66285e72", "score": "0.5461308", "text": "func (mr *MockOSMockRecorder) LocalDatabasePath() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"LocalDatabasePath\", reflect.TypeOf((*MockOS)(nil).LocalDatabasePath))\n}", "title": "" }, { "docid": "dcfbd134d182532daa2e94aac1b2c1d6", "score": "0.54526913", "text": "func (mock *BasicAuthListerMock) ListCalls() []struct {\n\tNamespace string\n\tSelector labels.Selector\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tSelector labels.Selector\n\t}\n\tlockBasicAuthListerMockList.RLock()\n\tcalls = mock.calls.List\n\tlockBasicAuthListerMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "495d41d910bd4d1e93639cfd06856028", "score": "0.54485434", "text": "func (mock *BoltConnMock) QueryPipelineCalls() []struct {\n\tQuery []string\n\tParams []map[string]interface{}\n} {\n\tvar calls []struct {\n\t\tQuery []string\n\t\tParams []map[string]interface{}\n\t}\n\tmock.lockQueryPipeline.RLock()\n\tcalls = mock.calls.QueryPipeline\n\tmock.lockQueryPipeline.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "afee3f85dbdc3547ffc7a70b9a622331", "score": "0.5441027", "text": "func (mock *PodListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockPodListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockPodListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "473ec3fe0ab587036356e8415c9dbabc", "score": "0.54295576", "text": "func (mock *BasicAuthInterfaceMock) ListCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockBasicAuthInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockBasicAuthInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e6a747d93cece328d2d89753f110bd0a", "score": "0.54288673", "text": "func (mock *GlobalDnsProviderListerMock) ListCalls() []struct {\n\tNamespace string\n\tSelector labels.Selector\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tSelector labels.Selector\n\t}\n\tlockGlobalDnsProviderListerMockList.RLock()\n\tcalls = mock.calls.List\n\tlockGlobalDnsProviderListerMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a54521cebea104db86c8f5f7b2a10eaa", "score": "0.5424243", "text": "func (mock *ServiceMonitorListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockServiceMonitorListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockServiceMonitorListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ad950a278e8cc0334fbc81b374468251", "score": "0.54218084", "text": "func (mock *AuthProviderListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockAuthProviderListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockAuthProviderListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e0e8351d230d3f77f57d09aae34ecf60", "score": "0.54101604", "text": "func (mock *AuthProviderListerMock) ListCalls() []struct {\n\tNamespace string\n\tSelector labels.Selector\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tSelector labels.Selector\n\t}\n\tlockAuthProviderListerMockList.RLock()\n\tcalls = mock.calls.List\n\tlockAuthProviderListerMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8a5f9168633352b4d95590c871ff8e5f", "score": "0.5408253", "text": "func (m *MockLocalAppCopy) GetLocalPath() string {\n\tret := m.ctrl.Call(m, \"GetLocalPath\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "41ec7a4da6164ec63a08ed428efa6f02", "score": "0.54055107", "text": "func (mock *ConnectionMock) ListenAndServeCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockConnectionMockListenAndServe.RLock()\n\tcalls = mock.calls.ListenAndServe\n\tlockConnectionMockListenAndServe.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "99b01710c790836b0ef005dc8f73f35b", "score": "0.54039025", "text": "func (mock *DeploymentControllerMock) GenericCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockDeploymentControllerMockGeneric.RLock()\n\tcalls = mock.calls.Generic\n\tlockDeploymentControllerMockGeneric.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2e235f0d2e63aa5ef77bc431c5113d7f", "score": "0.54031354", "text": "func (mock *PackageManagerMock) ListCalls() []struct {\n\tIncludeMetadata bool\n} {\n\tvar calls []struct {\n\t\tIncludeMetadata bool\n\t}\n\n\tmock.lockList.RLock()\n\tcalls = mock.calls.List\n\tmock.lockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8177e549a3918132bf6471ef65db993f", "score": "0.5401789", "text": "func (mock *RepoMock) FindSenderRequestByIDCalls() []struct {\n\tCtx context.Context\n\tID ulid.ULID\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tID ulid.ULID\n\t}\n\tmock.lockFindSenderRequestByID.RLock()\n\tcalls = mock.calls.FindSenderRequestByID\n\tmock.lockFindSenderRequestByID.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b4660c702bbadced556727374f311d5c", "score": "0.53989637", "text": "func (mock *ServiceMock) GetCalls() []struct {\n\tMenuID string\n\tUserID string\n} {\n\tvar calls []struct {\n\t\tMenuID string\n\t\tUserID string\n\t}\n\tlockServiceMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockServiceMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "3122f468b4c834f7b75835c440b905af", "score": "0.5398071", "text": "func (mmSet *mTrackerMockSet) Calls() []*TrackerMockSetParams {\n\tmmSet.mutex.RLock()\n\n\targCopy := make([]*TrackerMockSetParams, len(mmSet.callArgs))\n\tcopy(argCopy, mmSet.callArgs)\n\n\tmmSet.mutex.RUnlock()\n\n\treturn argCopy\n}", "title": "" }, { "docid": "195ede495d665da6cb95c6e0f48a0e5d", "score": "0.53930235", "text": "func (mock *AuthProviderInterfaceMock) ListCalls() []struct {\n\tOpts v1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts v1.ListOptions\n\t}\n\tlockAuthProviderInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockAuthProviderInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "517f9ac22341a763fdefd3949d19c3cf", "score": "0.53879917", "text": "func (mock *KeycloakInterfaceMock) GetUserCalls() []struct {\n\tUserID string\n\tRealmName string\n} {\n\tvar calls []struct {\n\t\tUserID string\n\t\tRealmName string\n\t}\n\tlockKeycloakInterfaceMockGetUser.RLock()\n\tcalls = mock.calls.GetUser\n\tlockKeycloakInterfaceMockGetUser.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "4ac750b36935dd3298f4d8a233da6401", "score": "0.5383471", "text": "func (mock *RepositoryMock) GetByIDCalls() []struct {\n\tCtx context.Context\n\tCpf vos.AccountId\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tCpf vos.AccountId\n\t}\n\tmock.lockGetByID.RLock()\n\tcalls = mock.calls.GetByID\n\tmock.lockGetByID.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "3c24df1f2ea38eabe3f170a368308866", "score": "0.53768617", "text": "func (mock *ApplicationListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockApplicationListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockApplicationListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "10a4e6fe6f47e3b589c628fadd19c027", "score": "0.5376407", "text": "func (mock *PodInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockPodInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockPodInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "649705cd38cc1d55dee65e87a26e1b7d", "score": "0.5364609", "text": "func (mmProblem *mTrackerMockProblem) Calls() []*TrackerMockProblemParams {\n\tmmProblem.mutex.RLock()\n\n\targCopy := make([]*TrackerMockProblemParams, len(mmProblem.callArgs))\n\tcopy(argCopy, mmProblem.callArgs)\n\n\tmmProblem.mutex.RUnlock()\n\n\treturn argCopy\n}", "title": "" }, { "docid": "377c13bfc209bf5f9578fcd57ef57506", "score": "0.5361111", "text": "func (mock *ConnectionMock) CheckHealthCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockConnectionMockCheckHealth.RLock()\n\tcalls = mock.calls.CheckHealth\n\tlockConnectionMockCheckHealth.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a998b137f9317572fbe5fba11c7fe124", "score": "0.53592575", "text": "func (mock *StoreMock) findCalls() []struct {\n\tCtx context.Context\n\tTx *datastore.Transaction\n\tUserID UserID\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tTx *datastore.Transaction\n\t\tUserID UserID\n\t}\n\tmock.lockfind.RLock()\n\tcalls = mock.calls.find\n\tmock.lockfind.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a789888fb07a46913fc5014e2a9d9bc0", "score": "0.5358824", "text": "func (mock *RepositoryMock) ListAccountEntriesCalls() []struct {\n\tContextMoqParam context.Context\n\tAccountEntryRequest vos.AccountEntryRequest\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tAccountEntryRequest vos.AccountEntryRequest\n\t}\n\tmock.lockListAccountEntries.RLock()\n\tcalls = mock.calls.ListAccountEntries\n\tmock.lockListAccountEntries.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "abdd29be31790af490ba48ac3240933d", "score": "0.53493613", "text": "func (mock *GlobalDnsProviderControllerMock) GenericCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockGlobalDnsProviderControllerMockGeneric.RLock()\n\tcalls = mock.calls.Generic\n\tlockGlobalDnsProviderControllerMockGeneric.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c5375d529e679200806ca83c769daf69", "score": "0.5344839", "text": "func (mock *UserNotifierMock) UserUpdatedCalls() []struct {\n\tCtx context.Context\n\tU users.User\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tU users.User\n\t}\n\tmock.lockUserUpdated.RLock()\n\tcalls = mock.calls.UserUpdated\n\tmock.lockUserUpdated.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ed2c0379ea42d6025cc92147c6b45d73", "score": "0.53420234", "text": "func (mock *ServiceMonitorInterfaceMock) ListCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockServiceMonitorInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockServiceMonitorInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "81d6ced6729d636f9cc3e96090d6a4df", "score": "0.53390837", "text": "func (mock *PersonStoreMock) GetCalls() []struct {\n\tCtx context.Context\n\tID string\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tID string\n\t}\n\tmock.lockGet.RLock()\n\tcalls = mock.calls.Get\n\tmock.lockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "7400dcb291f0957e1184690459bd4b41", "score": "0.5338672", "text": "func (mock *SampleMock) MethodCalls() []struct {\n\tS string\n} {\n\tvar calls []struct {\n\t\tS string\n\t}\n\tmock.lockMethod.RLock()\n\tcalls = mock.calls.Method\n\tmock.lockMethod.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2b1d1bda557a7ce136aca70f90321a4a", "score": "0.5337822", "text": "func (mock *UserNotifierMock) UserCreatedCalls() []struct {\n\tCtx context.Context\n\tU users.User\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tU users.User\n\t}\n\tmock.lockUserCreated.RLock()\n\tcalls = mock.calls.UserCreated\n\tmock.lockUserCreated.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "40209f32e540a2688f63730d5fc4721d", "score": "0.53331655", "text": "func (mock *LoaderMock) LoadCalls() []struct {\n\tDest interface{}\n} {\n\tvar calls []struct {\n\t\tDest interface{}\n\t}\n\tlockLoaderMockLoad.RLock()\n\tcalls = mock.calls.Load\n\tlockLoaderMockLoad.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "185dfb43b13f057e2b98f4ebf488bf72", "score": "0.5332948", "text": "func (mock *ClientInitializerMock) InitClientCalls() []struct {\n\tPort int\n} {\n\tvar calls []struct {\n\t\tPort int\n\t}\n\tlockClientInitializerMockInitClient.RLock()\n\tcalls = mock.calls.InitClient\n\tlockClientInitializerMockInitClient.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c48f546a2c936e57a827f3086da93db9", "score": "0.53308386", "text": "func (mock *MiddlewareMock) HealthCheckCalls() []struct {\n\tCtx context.Context\n\tState *health.CheckState\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tState *health.CheckState\n\t}\n\tmock.lockHealthCheck.RLock()\n\tcalls = mock.calls.HealthCheck\n\tmock.lockHealthCheck.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "46a865a0da7bd43cf3675bcfa889e949", "score": "0.5328874", "text": "func (_e *TypesPackage_Expecter) Path() *TypesPackage_Path_Call {\n\treturn &TypesPackage_Path_Call{Call: _e.mock.On(\"Path\")}\n}", "title": "" }, { "docid": "204bcb695ce726c24e526d3bfd3e9bc0", "score": "0.532792", "text": "func (mock *ServiceMonitorControllerMock) GenericCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockServiceMonitorControllerMockGeneric.RLock()\n\tcalls = mock.calls.Generic\n\tlockServiceMonitorControllerMockGeneric.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "dc0e87d45833c4183ae5ff8c38ef47df", "score": "0.53274107", "text": "func (mock *CronJobControllerMock) GenericCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockCronJobControllerMockGeneric.RLock()\n\tcalls = mock.calls.Generic\n\tlockCronJobControllerMockGeneric.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1da12ef0215ade5195f03feac0698ea8", "score": "0.5326564", "text": "func (mock *ProjectRepoMock) GetProjectCalls() []struct {\n\tProjectName string\n} {\n\tvar calls []struct {\n\t\tProjectName string\n\t}\n\tmock.lockGetProject.RLock()\n\tcalls = mock.calls.GetProject\n\tmock.lockGetProject.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "fa15986953e8c3ad87ef8907bfad8682", "score": "0.5323306", "text": "func (mock *ServiceMock) IsMenuNameUniqueCalls() []struct {\n\tTx *sql.Tx\n\tMenuName string\n} {\n\tvar calls []struct {\n\t\tTx *sql.Tx\n\t\tMenuName string\n\t}\n\tlockServiceMockIsMenuNameUnique.RLock()\n\tcalls = mock.calls.IsMenuNameUnique\n\tlockServiceMockIsMenuNameUnique.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "7ad6e76dd567e8c4dada5768c21eda13", "score": "0.5321956", "text": "func (mock *ResetStoreMock) GetCalls() []struct {\n\tCtx context.Context\n\tID string\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tID string\n\t}\n\tmock.lockGet.RLock()\n\tcalls = mock.calls.Get\n\tmock.lockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "71a912bd51ac392d31e2e8070438deb7", "score": "0.5319845", "text": "func (mock *ServerInterfaceMock) GetSimpleCalls() []struct {\n\tW http.ResponseWriter\n\tR *http.Request\n} {\n\tvar calls []struct {\n\t\tW http.ResponseWriter\n\t\tR *http.Request\n\t}\n\tmock.lockGetSimple.RLock()\n\tcalls = mock.calls.GetSimple\n\tmock.lockGetSimple.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "66632e731c7894f4047ae4fbd2ed1f79", "score": "0.53152716", "text": "func (mock *AnimationMock) CurrentStateCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tmock.lockCurrentState.RLock()\n\tcalls = mock.calls.CurrentState\n\tmock.lockCurrentState.RUnlock()\n\treturn calls\n}", "title": "" } ]
aacfcbed52837215af91f08eff710ea2
Unmarshal unmarshals JSON "data" into "v"
[ { "docid": "5d449ca6abf52da7745f59341fbf52ba", "score": "0.59748995", "text": "func (j *JSONPb) Unmarshal(data []byte, v interface{}) error {\n\tif str, err := strconv.Unquote(string(data)); err == nil {\n\t\treturn json.Unmarshal([]byte(str), v)\n\t}\n\n\treturn json.Unmarshal(data, v)\n}", "title": "" } ]
[ { "docid": "4eca1bc8811635fdf06ca8b5899b1e0a", "score": "0.6995568", "text": "func Unmarshal(data []byte, v interface{}) error", "title": "" }, { "docid": "852d7986335bbd948e744a38307d410d", "score": "0.6938572", "text": "func Unmarshal(data []byte, v interface{}) error {\n\tast, err := Parse(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tast.Standardize()\n\tdata = ast.Pack()\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "4f6fdafb2463aebc7dd47def63611bec", "score": "0.65003496", "text": "func Unmarshal(data []byte, v interface{}) error {\n\treturn ReturnIfError(\n\t\tjson.Unmarshal(data, v),\n\t\tCheckValues(v),\n\t)\n}", "title": "" }, { "docid": "6ae02c0fc5db3ff53b1b90ad277bb774", "score": "0.6495715", "text": "func UnmarshalJSON(data []byte, v interface{}) error {\n\tif vm, ok := v.(easyjson.Unmarshaler); ok {\n\t\treturn easyjson.Unmarshal(data, vm)\n\t}\n\n\tif vm, ok := v.(json.Unmarshaler); ok {\n\t\treturn vm.UnmarshalJSON(data)\n\t}\n\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "55c352082dc1e1404e85bdcd1adfac82", "score": "0.6450736", "text": "func (v *Data) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComJopoleonMinterTestPps6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "6938a08ad37691842f6f9a70993ad47c", "score": "0.6449307", "text": "func Unmarshal(data []byte, v interface{}, m Mode) error {\n\tj, err := ToJSON(data, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(j, v)\n}", "title": "" }, { "docid": "83a6b765eb341fbe93068a4ca757b644", "score": "0.63808894", "text": "func Unmarshal(data []byte, v interface{}) error {\n\tr := bytes.NewReader(data)\n\treturn NewDecoder(r).Decode(v)\n}", "title": "" }, { "docid": "242d3828f0678a235689897e75e08078", "score": "0.6309032", "text": "func (p *Parser) Unmarshal(data []byte, v interface{}) error {\n\tif err := json.Unmarshal(data, v); err != nil {\n\t\treturn fmt.Errorf(\"unmarshal json: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "12a8618557cfeddf0e80f41266eb0ea4", "score": "0.6080058", "text": "func Unmarshal(data []byte, v interface{}) error {\n\tval := reflect.ValueOf(v)\n\tif !val.IsValid() || val.IsNil() {\n\t\treturn nil\n\t}\n\tif val.Kind() != reflect.Ptr || val.Elem().Kind() != reflect.Struct {\n\t\treturn errors.New(\"v must be a pointer to a struct\")\n\t}\n\n\treturn decodeStruct(val.Elem(), data, false)\n}", "title": "" }, { "docid": "5032cbed1ffec0c8da332f7a40ad6a9b", "score": "0.60740536", "text": "func Unmarshal(data []byte, v interface{}, options ...UnmarshalOption) (map[string]interface{}, error) {\n\tif !isValidValue(v) {\n\t\treturn nil, ErrInvalidValue\n\t}\n\topts := buildUnmarshalOptions(options)\n\tuseMultipleErrors := opts.mode == ModeAllowMultipleErrors || opts.mode == ModeFailOverToOriginalValue\n\td := &decoder{options: opts, lexer: &jlexer.Lexer{Data: data, UseMultipleErrors: useMultipleErrors}}\n\tresult := make(map[string]interface{})\n\tif d.lexer.IsNull() {\n\t\td.lexer.Skip()\n\t} else if !d.lexer.IsDelim('{') {\n\t\treturn nil, ErrInvalidInput\n\t} else {\n\t\td.populateStruct(false, v, result)\n\t}\n\td.lexer.Consumed()\n\tif useMultipleErrors {\n\t\terrors := d.lexer.GetNonFatalErrors()\n\t\tif len(errors) == 0 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn result, &MultipleLexerError{Errors: errors}\n\t}\n\terr := d.lexer.Error()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "05889c4ecf9333717919017350eeb6f0", "score": "0.6066852", "text": "func (v *tag) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1c889379DecodeGithubComToomoreLazyflickrgoJsonstruct1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "85ee6ed844e20e6f9026f629e633b75b", "score": "0.59944564", "text": "func (v *ResultVersion) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "df1db8af8e78daac96c127660d75d07f", "score": "0.59936047", "text": "func (v *StatData) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6a975c40DecodeGithubComRyverappGoQless1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "2b39a9cdfbd1979ae5c4542af83e5b51", "score": "0.5980503", "text": "func Unmarshal(data []byte, v interface{}) error {\n\tast, err := ParseBytes(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn UnmarshalAST(ast, v)\n}", "title": "" }, { "docid": "986fdc4b1457290ffb8f0434b23341a8", "score": "0.594613", "text": "func (v *Common) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1c889379DecodeGithubComToomoreLazyflickrgoJsonstruct25(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "6c24c3c852baa90c53e26740683f1dad", "score": "0.5941942", "text": "func (v *Value) UnmarshalJSON(data []byte) error {\n\tif len(data) == 0 { // should not be possible, the parser doesn't pass empty slices to UnmarshalJSON\n\t\treturn errors.New(\"cannot parse empty data\")\n\t}\n\tfirstCh := data[0]\n\tswitch firstCh {\n\tcase 'n':\n\t\t// Note that since Go 1.5, comparing a string to string([]byte) is optimized so it\n\t\t// does not actually create a new string from the byte slice.\n\t\tif string(data) == \"null\" {\n\t\t\t*v = Null()\n\t\t\treturn nil\n\t\t}\n\tcase 't', 'f':\n\t\tif string(data) == \"true\" {\n\t\t\t*v = Bool(true)\n\t\t\treturn nil\n\t\t}\n\t\tif string(data) == \"false\" {\n\t\t\t*v = Bool(false)\n\t\t\treturn nil\n\t\t}\n\tcase '\"':\n\t\tvar s string\n\t\te := json.Unmarshal(data, &s)\n\t\tif e == nil {\n\t\t\t*v = String(s)\n\t\t}\n\t\treturn e\n\tcase '[':\n\t\tvar a []Value\n\t\te := json.Unmarshal(data, &a)\n\t\tif e == nil {\n\t\t\t*v = Value{valueType: ArrayType, immutableArrayValue: a}\n\t\t}\n\t\treturn e\n\tcase '{':\n\t\tvar o map[string]Value\n\t\te := json.Unmarshal(data, &o)\n\t\tif e == nil {\n\t\t\t*v = Value{valueType: ObjectType, immutableObjectValue: o}\n\t\t}\n\t\treturn e\n\tcase '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': // note, JSON does not allow a leading '.'\n\t\tvar n float64\n\t\te := json.Unmarshal(data, &n)\n\t\tif e == nil {\n\t\t\t*v = Value{valueType: NumberType, numberValue: n}\n\t\t}\n\t\treturn e\n\t}\n\treturn fmt.Errorf(\"unknown JSON token: %s\", data)\n}", "title": "" }, { "docid": "aab309c3bad715ddfdc553195eac14f6", "score": "0.59202987", "text": "func Unmarshal(data []byte, v interface{}) error {\n\trv := reflect.ValueOf(v)\n\tif rv.Kind() != reflect.Ptr || rv.IsNil() {\n\t\treturn errors.New(\"cannot unmarshal into nil or non pointer type\")\n\t}\n\trv = rv.Elem()\n\n\tsections, err := parse(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trootSection := sections[0]\n\tfields := getStructFieldsMap(rv.Type())\n\n\tif err := unmarshal(rootSection, rv, fields); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, section := range sections[1:] {\n\t\tif unmarshalInto(section, rv, fields); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7a309c2fbd70153dcf49adb287e005c5", "score": "0.59198284", "text": "func Unmarshal(data string, v interface{}) error {\n\n\tsh := *(*reflect.StringHeader)(unsafe.Pointer(&data))\n\tarr := (*[1 << 30]byte)(unsafe.Pointer(sh.Data))\n\treturn json.Unmarshal(arr[:sh.Len], v)\n}", "title": "" }, { "docid": "3a17e743b0170c8957a99156c068804d", "score": "0.5904767", "text": "func (v *ValMsg) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson8d5c760DecodeGithubComSzyhfGoSerializeBenchmarkInternalEasyjson(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "66ae89accfad33f11f7d3fea09fe3ab4", "score": "0.58860433", "text": "func UnmarshalJSON(body io.ReadCloser, v interface{}) error {\n\tdefer body.Close()\n\terr := json.NewDecoder(body).Decode(&v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a782b495a43e1d21712fc4ec1403ce18", "score": "0.58727485", "text": "func Unmarshal(rawVal interface{}) error {\n\treturn v.Unmarshal(rawVal)\n}", "title": "" }, { "docid": "d7506fcf9f311b920680a3270fdc02dd", "score": "0.5867989", "text": "func (v *Video) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC3e3fb8cDecodeGithubComGobwasVk1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3c465da80ff73beb12c9e2b23ab37c61", "score": "0.5835472", "text": "func parseData(data []byte, feedback interface{}) (err error) {\n\terr = json.Unmarshal(json.RawMessage(data), &feedback)\n\treturn\n}", "title": "" }, { "docid": "2f1a74dccd1fc254d215c5d97bf724ac", "score": "0.58331656", "text": "func DecoderDecode(dec *json.Decoder, v interface{}) error", "title": "" }, { "docid": "649377061b6476fadb6d4eba4cb13fc5", "score": "0.58254236", "text": "func (v *Video) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk16(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "bc36205636b70fba71bec512f3630ddb", "score": "0.58169645", "text": "func (v *UserVisits) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson84c0690eDecodeHighloadcup2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "27622e5e645965a3d55608a36c148ef6", "score": "0.58094716", "text": "func (v *Value) UnmarshalJSON(data []byte) error { //nolint:funlen // yes, we know it's a long function\n\tif len(data) == 0 { // COVERAGE: should not be possible, parser doesn't pass empty slices to UnmarshalJSON\n\t\treturn errors.New(\"cannot parse empty data\")\n\t}\n\tfirstCh := data[0]\n\tswitch firstCh {\n\tcase 'n':\n\t\t// Note that since Go 1.5, comparing a string to string([]byte) is optimized so it\n\t\t// does not actually create a new string from the byte slice.\n\t\tif string(data) == \"null\" {\n\t\t\t*v = Null()\n\t\t\treturn nil\n\t\t}\n\tcase 't', 'f':\n\t\tif string(data) == trueString {\n\t\t\t*v = Bool(true)\n\t\t\treturn nil\n\t\t}\n\t\tif string(data) == falseString {\n\t\t\t*v = Bool(false)\n\t\t\treturn nil\n\t\t}\n\tcase '\"':\n\t\tvar s string\n\t\te := json.Unmarshal(data, &s)\n\t\tif e == nil {\n\t\t\t*v = String(s)\n\t\t}\n\t\treturn e\n\tcase '[':\n\t\tvar a []Value\n\t\te := json.Unmarshal(data, &a)\n\t\tif e == nil {\n\t\t\tif len(a) == 0 {\n\t\t\t\ta = nil // don't need to retain an empty array\n\t\t\t}\n\t\t\t*v = Value{valueType: ArrayType, immutableArrayValue: a}\n\t\t}\n\t\treturn e\n\tcase '{':\n\t\tvar o map[string]Value\n\t\te := json.Unmarshal(data, &o)\n\t\tif e == nil {\n\t\t\tif len(o) == 0 {\n\t\t\t\to = nil // don't need to retain an empty map\n\t\t\t}\n\t\t\t*v = Value{valueType: ObjectType, immutableObjectValue: o}\n\t\t}\n\t\treturn e\n\tcase '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': // note, JSON does not allow a leading '.'\n\t\tvar n float64\n\t\te := json.Unmarshal(data, &n)\n\t\tif e == nil {\n\t\t\t*v = Value{valueType: NumberType, numberValue: n}\n\t\t}\n\t\treturn e\n\t}\n\treturn &json.SyntaxError{} // COVERAGE: never happens, parser rejects the token earlier\n}", "title": "" }, { "docid": "3e56bde33416f128b630fe05e73f8d9c", "score": "0.58080757", "text": "func (o *DataItemViber) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar dataAO0 struct {\n\t\tID string `json:\"ID,omitempty\"`\n\n\t\tType string `json:\"type,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO0); err != nil {\n\t\treturn err\n\t}\n\n\to.ID = dataAO0.ID\n\n\to.Type = dataAO0.Type\n\n\t// AO1\n\tvar aO1 models.ChannelParamsViber\n\tif err := swag.ReadJSON(raw, &aO1); err != nil {\n\t\treturn err\n\t}\n\to.ChannelParamsViber = aO1\n\n\treturn nil\n}", "title": "" }, { "docid": "9440c18d238ac85600e20d6cc0995674", "score": "0.57930344", "text": "func Unmarshal[T absser.Parsable](data []byte, model *T, parser absser.ParsableFactory) error {\n\tjpn, err := absser.DefaultParseNodeFactoryInstance.GetRootParseNode(\"application/json\", data)\n\tif err != nil {\n\t\tif jpn, err = NewJsonParseNode(data); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tv, err := jpn.GetObjectValue(parser)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif v != nil {\n\t\t*model = v.(T)\n\t} else {\n\t\t// hand off to the std library to set model to its zero value\n\t\treturn json.Unmarshal(data, model)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "04aaf1634623c09a61c35a8db46d044a", "score": "0.579298", "text": "func Unmarshal(data []byte, v interface{}) error {\n\treturn UnmarshalStream(bytes.NewReader(data), v)\n}", "title": "" }, { "docid": "0daeabf00619e9b068913275c6829c6e", "score": "0.5791517", "text": "func Unmarshal(data []byte, v interface{}) error {\n\tdec := decoderStatePool.Get()\n\tdec.read.Write(data)\n\terr := dec.decode(reflect.ValueOf(v))\n\tdecoderStatePool.Put(dec)\n\treturn err\n}", "title": "" }, { "docid": "96edcc1204f911983be51053d33a0975", "score": "0.5780265", "text": "func (v *DataEntry) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoCachestorage9(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "b2e7fe028372f9da9cb0eb496add8086", "score": "0.5752436", "text": "func RawMessageUnmarshalJSON(m *json.RawMessage, data []byte) error", "title": "" }, { "docid": "7a8b29032c650cec9b77c9cd06a2b35d", "score": "0.5750762", "text": "func viperUnmarshal(c *Config) error {\n\treturn viper.Unmarshal(\n\t\tc, func(c *mapstructure.DecoderConfig) { c.TagName = \"json\" },\n\t)\n}", "title": "" }, { "docid": "644ed9fbdc5c8059b62153f7df98eadf", "score": "0.57434547", "text": "func (v *Uint) UnmarshalJSON(data []byte) error {\n\tl := jlexer.Lexer{Data: data}\n\tv.UnMarshalPartialJSON(&l)\n\treturn l.Error()\n}", "title": "" }, { "docid": "ae3ada5c4347f71f444b2b0a719e05c8", "score": "0.5709331", "text": "func (v *Result) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComJopoleonMinterTestPps4(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3c5a1ab3ecd82e2ea8c72314dd43dc0c", "score": "0.57083565", "text": "func (v *Tags) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1c889379DecodeGithubComToomoreLazyflickrgoJsonstruct4(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "6026dcbb6e7346352a52cf07d16b5f04", "score": "0.5706248", "text": "func (v *Vote) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeForumApplicationModels(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "95136f02cbc311c24a4c701d6bc870d7", "score": "0.57030356", "text": "func (v *Vault) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &v.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &v.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &v.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &v.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &v.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &v.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &v.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "702826c33b6e272c15e4fafaffbe63ab", "score": "0.56794953", "text": "func (v *VideoNew) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk10(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "40afc92a540b463bba7afdf39605553e", "score": "0.5675887", "text": "func (v Version) UnmarshalJSON(data []byte) (err error) {\n\tvar versionString string\n\n\tif err = jsoniter.Unmarshal(data, &versionString); err != nil {\n\t\treturn\n\t}\n\n\tv = *Tokenize(versionString).Version\n\n\treturn\n}", "title": "" }, { "docid": "cefc8c1dbe223fec334732f44d73bc41", "score": "0.5661874", "text": "func (v *ResultMetaData) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "51865b20d84757e31ddfd64afaff695f", "score": "0.56393534", "text": "func (j *Video) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "6f3a62216a519309fa358454a9119e86", "score": "0.5628548", "text": "func UnmarshalJSON(r io.Reader, v interface{}) error {\n\tbody, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(body, v)\n}", "title": "" }, { "docid": "6f3a62216a519309fa358454a9119e86", "score": "0.5628548", "text": "func UnmarshalJSON(r io.Reader, v interface{}) error {\n\tbody, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(body, v)\n}", "title": "" }, { "docid": "392306bbe5af43081b17efca7a577e5b", "score": "0.5621892", "text": "func Unmarshal(data []byte, v interface{}) error {\n\tdata = data[:lastNotSpacePos(data)]\n\titer := ParseBytes(data)\n\titer.ReadVal(v)\n\tif iter.head == iter.tail {\n\t\titer.loadMore()\n\t}\n\tif iter.Error == io.EOF {\n\t\treturn nil\n\t}\n\tif iter.Error == nil {\n\t\titer.reportError(\"Unmarshal\", \"there are bytes left after unmarshal\")\n\t}\n\treturn iter.Error\n}", "title": "" }, { "docid": "9c22c01f38acd23dbb16765f47b1423a", "score": "0.56141645", "text": "func (v *Validator) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComJopoleonMinterTestPps(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "f15d0a2e7eba406129e925c84875bee6", "score": "0.5609808", "text": "func (v *Bft) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita20(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "fc510abf5b51adb6c02ccc88b811663c", "score": "0.559262", "text": "func (d *decodeState) unmarshalObject(data Slice, v reflect.Value) {\n\t// Check for unmarshaler.\n\tu, ju, ut, pv := d.indirect(v, false)\n\tif u != nil {\n\t\tif err := u.UnmarshalVPack(data); err != nil {\n\t\t\td.error(err)\n\t\t}\n\t\treturn\n\t}\n\tif ju != nil {\n\t\tjson, err := data.JSONString()\n\t\tif err != nil {\n\t\t\td.error(err)\n\t\t} else {\n\t\t\tif err := ju.UnmarshalJSON([]byte(json)); err != nil {\n\t\t\t\td.error(err)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif ut != nil {\n\t\td.saveError(&UnmarshalTypeError{Value: \"object\", Type: v.Type()})\n\t\treturn\n\t}\n\tv = pv\n\n\t// Decoding into nil interface? Switch to non-reflect code.\n\tif v.Kind() == reflect.Interface && v.NumMethod() == 0 {\n\t\tv.Set(reflect.ValueOf(d.objectInterface(data)))\n\t\treturn\n\t}\n\n\t// Check type of target:\n\t// struct or\n\t// map[T1]T2 where T1 is string, an integer type,\n\t// or an encoding.TextUnmarshaler\n\tswitch v.Kind() {\n\tcase reflect.Map:\n\t\t// Map key must either have string kind, have an integer kind,\n\t\t// or be an encoding.TextUnmarshaler.\n\t\tt := v.Type()\n\t\tswitch t.Key().Kind() {\n\t\tcase reflect.String,\n\t\t\treflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n\t\t\treflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\tdefault:\n\t\t\tif !reflect.PtrTo(t.Key()).Implements(textUnmarshalerType) {\n\t\t\t\td.saveError(&UnmarshalTypeError{Value: \"object\", Type: v.Type()})\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif v.IsNil() {\n\t\t\tv.Set(reflect.MakeMap(t))\n\t\t}\n\tcase reflect.Struct:\n\t\t// ok\n\tdefault:\n\t\td.saveError(&UnmarshalTypeError{Value: \"object\", Type: v.Type()})\n\t\treturn\n\t}\n\n\tvar mapElem reflect.Value\n\n\tit, err := NewObjectIterator(data)\n\tif err != nil {\n\t\td.error(err)\n\t}\n\tfor it.IsValid() {\n\t\tkey, err := it.Key(true)\n\t\tif err != nil {\n\t\t\td.error(err)\n\t\t}\n\t\tkeyUTF8, err := key.GetStringUTF8()\n\t\tif err != nil {\n\t\t\td.error(err)\n\t\t}\n\t\tvalue, err := it.Value()\n\t\tif err != nil {\n\t\t\td.error(err)\n\t\t}\n\n\t\t// Figure out field corresponding to key.\n\t\tvar subv reflect.Value\n\t\tdestring := false // whether the value is wrapped in a string to be decoded first\n\n\t\tif v.Kind() == reflect.Map {\n\t\t\telemType := v.Type().Elem()\n\t\t\tif !mapElem.IsValid() {\n\t\t\t\tmapElem = reflect.New(elemType).Elem()\n\t\t\t} else {\n\t\t\t\tmapElem.Set(reflect.Zero(elemType))\n\t\t\t}\n\t\t\tsubv = mapElem\n\t\t} else {\n\t\t\tvar f *field\n\t\t\tfields := cachedTypeFields(v.Type())\n\t\t\tfor i := range fields {\n\t\t\t\tff := &fields[i]\n\t\t\t\tif bytes.Equal(ff.nameBytes, key) {\n\t\t\t\t\tf = ff\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif f == nil && ff.equalFold(ff.nameBytes, keyUTF8) {\n\t\t\t\t\tf = ff\n\t\t\t\t}\n\t\t\t}\n\t\t\tif f != nil {\n\t\t\t\tsubv = v\n\t\t\t\tdestring = f.quoted\n\t\t\t\tfor _, i := range f.index {\n\t\t\t\t\tif subv.Kind() == reflect.Ptr {\n\t\t\t\t\t\tif subv.IsNil() {\n\t\t\t\t\t\t\tsubv.Set(reflect.New(subv.Type().Elem()))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsubv = subv.Elem()\n\t\t\t\t\t}\n\t\t\t\t\tsubv = subv.Field(i)\n\t\t\t\t}\n\t\t\t\td.errorContext.Field = f.name\n\t\t\t\td.errorContext.Struct = v.Type().Name()\n\t\t\t}\n\t\t}\n\n\t\tif destring {\n\t\t\t// Value should be a string that we'll decode as JSON\n\t\t\tvalueUTF8, err := value.GetStringUTF8()\n\t\t\tif err != nil {\n\t\t\t\td.saveError(fmt.Errorf(\"json: invalid use of ,string struct tag, expected string, got %s in %v (%v)\", value.Type(), subv.Type(), err))\n\t\t\t}\n\t\t\tv, err := ParseJSONFromUTF8(valueUTF8)\n\t\t\tif err != nil {\n\t\t\t\td.saveError(err)\n\t\t\t} else {\n\t\t\t\td.unmarshalValue(v, subv)\n\t\t\t}\n\t\t} else {\n\t\t\td.unmarshalValue(value, subv)\n\t\t}\n\n\t\t// Write value back to map;\n\t\t// if using struct, subv points into struct already.\n\t\tif v.Kind() == reflect.Map {\n\t\t\tkt := v.Type().Key()\n\t\t\tvar kv reflect.Value\n\t\t\tswitch {\n\t\t\tcase kt.Kind() == reflect.String:\n\t\t\t\tkv = reflect.ValueOf(keyUTF8).Convert(kt)\n\t\t\tcase reflect.PtrTo(kt).Implements(textUnmarshalerType):\n\t\t\t\tkv = reflect.New(v.Type().Key())\n\t\t\t\td.literalStore(key, kv, true)\n\t\t\t\tkv = kv.Elem()\n\t\t\tdefault:\n\t\t\t\tkeyStr := string(keyUTF8)\n\t\t\t\tswitch kt.Kind() {\n\t\t\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\t\t\tn, err := strconv.ParseInt(keyStr, 10, 64)\n\t\t\t\t\tif err != nil || reflect.Zero(kt).OverflowInt(n) {\n\t\t\t\t\t\td.saveError(&UnmarshalTypeError{Value: \"number \" + keyStr, Type: kt})\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tkv = reflect.ValueOf(n).Convert(kt)\n\t\t\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\t\t\t\tn, err := strconv.ParseUint(keyStr, 10, 64)\n\t\t\t\t\tif err != nil || reflect.Zero(kt).OverflowUint(n) {\n\t\t\t\t\t\td.saveError(&UnmarshalTypeError{Value: \"number \" + keyStr, Type: kt})\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tkv = reflect.ValueOf(n).Convert(kt)\n\t\t\t\tdefault:\n\t\t\t\t\tpanic(\"json: Unexpected key type\") // should never occur\n\t\t\t\t}\n\t\t\t}\n\t\t\tv.SetMapIndex(kv, subv)\n\t\t}\n\n\t\td.errorContext.Struct = \"\"\n\t\td.errorContext.Field = \"\"\n\n\t\tif err := it.Next(); err != nil {\n\t\t\td.error(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8e5585b2e418ff9986ee752434fbebd5", "score": "0.55818856", "text": "func (v *HoldValMsg) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson8d5c760DecodeGithubComSzyhfGoSerializeBenchmarkInternalEasyjson1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "cc8eeac5fe2e16faab5892cff7e20dd8", "score": "0.5581653", "text": "func (v *Subscriber) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson639f989aDecodeCodeCloudfoundryOrgGorouterMbus1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "5ad643821c56dd91e15ca36704ed2b7f", "score": "0.5574028", "text": "func collectData(data []byte, payload interface{}) {\n\tjson.Unmarshal(data, &payload)\n}", "title": "" }, { "docid": "9cce455ef8eaf1cbf91d20e8c936c619", "score": "0.55640304", "text": "func (g jsonEncoding) Unmarshal(data []byte, objs []interface{}) error {\n\tdec := json.NewDecoder(bytes.NewBuffer(data))\n\tdec.UseNumber()\n\tfor i, obj := range objs {\n\t\tif err := dec.Decode(obj); err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"unable to decode argument: %d, %v, with json error: %v\", i, reflect.TypeOf(obj), err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f984c943238e721820a73c0065ce302a", "score": "0.5560243", "text": "func (v *UserVisitsSorter) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson84c0690eDecodeHighloadcup(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "b17794a43a29e43711ea21ebe60d72cd", "score": "0.5559897", "text": "func (v *VirtualClusterUpdate) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &v.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &v.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "12d791c4f61a67523d8efec7606f9c06", "score": "0.55577403", "text": "func (v *Videos) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC3e3fb8cDecodeGithubComGobwasVk(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "58269dbce8c278bebfe926871929f371", "score": "0.5555856", "text": "func (v *user) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson9e1087fdDecodeFakeCom(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "ccc83ed0ec9b381e2935b68e944b7395", "score": "0.5553983", "text": "func (s *SAPVirtualInstanceList) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &s.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &s.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "51467b8725f2b92e6c2e6abc7f99ee99", "score": "0.5547076", "text": "func (v *VersionCompatInfo) UnmarshalJSON(bs []byte) error {\n\tvar verString string\n\tif err := json.Unmarshal(bs, &verString); err != nil {\n\t\treturn err\n\t}\n\tver := strings.Split(verString, \":\")\n\tif len(ver) != 2 {\n\t\treturn errors.New(\"cannot parse version\")\n\t}\n\n\tversion, err := strconv.ParseUint(ver[0], 10, 16)\n\tif err != nil {\n\t\treturn errors.New(\"cannot parse version\")\n\t}\n\n\tv.Version = uint16(version)\n\tblockHeaderVersion, err := strconv.ParseUint(ver[1], 10, 16)\n\tif err != nil {\n\t\treturn errors.New(\"cannot parse version\")\n\t}\n\tv.BlockHeaderVersion = uint16(blockHeaderVersion)\n\treturn nil\n}", "title": "" }, { "docid": "0f07df44b70621ea646d9653ef70c8ee", "score": "0.5542618", "text": "func (fi *Info) Unmarshal(data []byte) {\n\terr := json.Unmarshal(data, fi)\n\tif err != nil {\n\t\tmyLogger.Print(err)\n\t}\n}", "title": "" }, { "docid": "ce6177c4f35a0ac06e4714184c0cd381", "score": "0.55396664", "text": "func Decode(data []byte, v interface{}) error {\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "cc0ffaa9dbe2c58be2b1c1930e38240e", "score": "0.5536073", "text": "func (v *Content) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1c889379DecodeGithubComToomoreLazyflickrgoJsonstruct24(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "c6f45b779012c8c957ee813d5a8ff1f3", "score": "0.55294234", "text": "func (e *Event) Unmarshal(v interface{}) error {\n\treturn json.Unmarshal(e.raw, v)\n}", "title": "" }, { "docid": "e5f8c3e4818931a41f38f97594d85a61", "score": "0.55273706", "text": "func (v *jobData) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6a975c40DecodeGithubComRyverappGoQless(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "a81f3ccdc9bf4f566edc8c27be61d865", "score": "0.5527143", "text": "func (v *User) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson84c0690eDecodeHighloadcup3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3563a2a511365b22d6afc20b4cbbc2e8", "score": "0.55143267", "text": "func (s *SAPVirtualInstance) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &s.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"identity\":\n\t\t\terr = unpopulate(val, \"Identity\", &s.Identity)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &s.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &s.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &s.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &s.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &s.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &s.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "30f0a8dfe21bdea2074d9374cabd263f", "score": "0.551217", "text": "func (v *Vote) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComvladimirsukiasyanTpDbInternalModels(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "e6edd7c052e43407c7eb816a8ec83d99", "score": "0.550726", "text": "func (v *Tag) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComJopoleonMinterTestPps3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "bef5625b6fe7771282896b913264a192", "score": "0.5504308", "text": "func (v *Message) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk46(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3821a52ea649278b3faff1a26b1191b7", "score": "0.55008674", "text": "func (v *Filter) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita15(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "c1c51d975b6eff2447ce2fe6b6f848d7", "score": "0.5498435", "text": "func (v *Status) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeForumApplicationModels8(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "237e4d0cd9daa9fdb9225b77f8217994", "score": "0.5497432", "text": "func (v *Message) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3bd68309DecodeLiepinPubOpsInsAnsibleInternalPipeMessage1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "8b94245916109c847b3a60a12b240240", "score": "0.54947925", "text": "func (v *DigIn) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeHlc21Client3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "56352aaa8b40945164aa0e5894aeb2e6", "score": "0.5490381", "text": "func (v *PostUniverseNames200Ok) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7ff5cd1DecodeGithubComAntihaxGoesiEsi1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "bb2948fc932b88253f3707b443e90f7c", "score": "0.5490334", "text": "func Unmarshal(b []byte, v interface{}) error {\n\treturn NewDecoder(bytes.NewReader(b)).Decode(v)\n}", "title": "" }, { "docid": "4f2389a84eb4a775b4cc954d4c8e41b4", "score": "0.5488533", "text": "func (v *VirtualNetworkTap) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &v.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &v.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &v.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &v.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &v.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &v.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &v.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ced5968a76f5c23421c35c3fb4b4729e", "score": "0.54879814", "text": "func (m *PublicGetTradingviewChartDataResponse) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar aO0 BaseMessage\n\tif err := swag.ReadJSON(raw, &aO0); err != nil {\n\t\treturn err\n\t}\n\tm.BaseMessage = aO0\n\n\t// AO1\n\tvar dataAO1 struct {\n\t\tResult *PublicGetTradingviewChartDataResponseAO1Result `json:\"result\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO1); err != nil {\n\t\treturn err\n\t}\n\n\tm.Result = dataAO1.Result\n\n\treturn nil\n}", "title": "" }, { "docid": "7c768020edf9823362c090408f343a95", "score": "0.548224", "text": "func Unmarshal(data []byte, v interface{}) error {\n\tfile, err := Decode(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trv := reflect.ValueOf(v)\n\tif rv.Kind() != reflect.Ptr || rv.IsNil() {\n\t\treturn &InvalidUnmarshalError{reflect.TypeOf(v)}\n\t}\n\treturn unmarshalSections(file, rv)\n}", "title": "" }, { "docid": "71f2456aaf9e6d8577f6ff07e2a0298a", "score": "0.54738307", "text": "func (v *ValidationResult) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &v.Status)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9bfb9196439c481d8c84caef7dc10194", "score": "0.5471363", "text": "func (v *Response) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita10(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "ce8c7ffb03d12ee80cfdd0f909ad78bb", "score": "0.54684496", "text": "func (v *UserVisitsArray) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson84c0690eDecodeHighloadcup1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "12407ba8262936855bdbfb417200eb18", "score": "0.54659915", "text": "func (v *BaseObject) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk87(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "f1634fc2ef622c442445d2c6cf97180e", "score": "0.5462895", "text": "func (v *Message) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson85f0d656DecodeGithubComGoParkMailRu20182ParashutnayaMolitvaInternalPkgGame4(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "7c98e2d5cf0f9389de90536b3eea1034", "score": "0.5460553", "text": "func Unmarshal(b []byte, v interface{}) error {\n\treturn Decode(bytes.NewReader(b), v)\n}", "title": "" }, { "docid": "db2296536cf5cd8c53fb8f0a3eaa2fdc", "score": "0.5457532", "text": "func (t *TagValue) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"count\":\n\t\t\terr = unpopulate(val, \"Count\", &t.Count)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &t.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tagValue\":\n\t\t\terr = unpopulate(val, \"TagValue\", &t.TagValue)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3089a21f1db83d8463286c3ef8a41154", "score": "0.5454758", "text": "func (v *Proof) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita12(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "486576eb9cab58d308b72f1dc88e32f4", "score": "0.54479843", "text": "func (e *Result) Data(out interface{}) error {\n\treturn json.Unmarshal([]byte(e.data), out)\n}", "title": "" }, { "docid": "ebcf551f11b5e343e0c54700614dc29d", "score": "0.5439085", "text": "func (v *value) UnmarshalJSON(b []byte) (err error) {\n\tn, f, s := int64(0), float64(0), \"\"\n\tlog.Printf(\"[DEBUG] unmarshalJSON\")\n\tif err = json.Unmarshal(b, &s); err == nil {\n\t\tv.ValueString = s\n\t\treturn\n\t}\n\tif err = json.Unmarshal(b, &f); err == nil {\n\t\tv.ValueFloat = f\n\t\treturn\n\t}\n\tif err = json.Unmarshal(b, &n); err == nil {\n\t\tv.ValueInt = n\n\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2718c19ba07eb8a2c7cdea663d2c3456", "score": "0.54383075", "text": "func (v *User) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3486653aDecodeCourseraHw3Bench(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "53a28f56e43a31818dbab65e363012d3", "score": "0.54362416", "text": "func (v *Posts) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonUnmarshalPosts(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "2c3d5cfdf6284554ec3433dfcbb9fd6d", "score": "0.5432816", "text": "func (v *VersionCompatInfoV4) UnmarshalJSON(bs []byte) error {\n\tvar verString string\n\tif err := json.Unmarshal(bs, &verString); err != nil {\n\t\treturn err\n\t}\n\tver := strings.Split(verString, \":\")\n\tif len(ver) != 2 {\n\t\treturn errors.New(\"cannot parse version\")\n\t}\n\n\tversion, err := strconv.ParseUint(ver[0], 10, 16)\n\tif err != nil {\n\t\treturn errors.New(\"cannot parse version\")\n\t}\n\n\tv.Version = uint16(version)\n\tblockHeaderVersion, err := strconv.ParseUint(ver[1], 10, 16)\n\tif err != nil {\n\t\treturn errors.New(\"cannot parse version\")\n\t}\n\tv.BlockHeaderVersion = uint16(blockHeaderVersion)\n\treturn nil\n}", "title": "" }, { "docid": "2514bace65f442e5f2799ecb1bc3c1ce", "score": "0.5432066", "text": "func (p *Partial) Unmarshal(v interface{}) error {\n\tif p == nil {\n\t\treturn fmt.Errorf(\"Cannot unmarshal nil argument\")\n\t}\n\n\tif err := json.Unmarshal(p.Raw, &v); err != nil {\n\t\treturn fmt.Errorf(\"%s. Data: %s\", err.Error(), string(p.Raw))\n\t}\n\n\tvalue := reflect.ValueOf(v)\n\n\tfor _, spec := range p.CallbackSpecs {\n\t\tif err := setCallback(value, spec.Path, spec.Function.Caller.(functionReceived)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bbfa3c0b1973f92ece176dd6c0b02059", "score": "0.54242384", "text": "func Unmarshall(r *http.Request, v interface{}) error {\n\tbody, err := ioutil.ReadAll(r.Body)\n\t// log.Printf(\"Body %v\\n\", string(body))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = json.Unmarshal(body, &v)\n\treturn err\n}", "title": "" }, { "docid": "d1fb3116aeece974046eeee786238f75", "score": "0.5423899", "text": "func (jc JsonCracker) Unmarshal(data []byte, dest interface{}) error {\n\treturn jc.Json.Unmarshal(data, dest)\n}", "title": "" }, { "docid": "aea1b488de404551f5d2b26bb3dbbb3c", "score": "0.54187614", "text": "func (v *ResultMessage) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson85f0d656DecodeGithubComGoParkMailRu20182ParashutnayaMolitvaInternalPkgGame3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "04893bdcff24a7862ba67a5701d94319", "score": "0.5418559", "text": "func Unmarshal(data []byte) (interface{}, error) {\n\tvar msg map[string]interface{}\n\terr := json.Unmarshal(data, &msg)\n\tif err != nil {\n\t\tlog.Errorf(\"json.Unmarshal failed: %+v\", err)\n\t\treturn nil, err\n\t}\n\treturn msg, nil\n}", "title": "" }, { "docid": "aede126d3a3772c52f6e2773aee0e09e", "score": "0.5418456", "text": "func (v *Post) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk23(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "2ac1f2da5122212b12ebe28412023e07", "score": "0.5417621", "text": "func (v *Auth) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1c889379DecodeGithubComToomoreLazyflickrgoJsonstruct28(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3a3e4fa1cbdbe0dff2172ed21e4eefde", "score": "0.54171354", "text": "func Decode(data []byte, v interface{}) error {\n\treturn ffjson.Unmarshal(data, v)\n}", "title": "" }, { "docid": "0f6269c0c3d085d09a77613006f40c3d", "score": "0.5415369", "text": "func (v *VirtualNetwork) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &v.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &v.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &v.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &v.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &v.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &v.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &v.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
ab53e89f2fdcb0e69ef196b61445a2d2
DrawStatusMsg draws the status message on screen
[ { "docid": "778f60eddfc22171d03b750738ed04d8", "score": "0.8446251", "text": "func (v *View) DrawStatusMsg(ab *bytes.Buffer, statusMsg string) {\n\tfmt.Fprint(ab, \"\\x1b[K\") // clear the line\n\tif len(statusMsg) < v.ScreenSize.Col {\n\t\tfmt.Fprint(ab, statusMsg)\n\t} else {\n\t\tfmt.Fprint(ab, statusMsg[:v.ScreenSize.Col])\n\t}\n}", "title": "" } ]
[ { "docid": "7634929e9e24c41ba4a0158b72ccb7ff", "score": "0.76820314", "text": "func (s *StatusView) Draw(screen tcell.Screen) {\n\n\ts.Box.Draw(screen)\n\tx, y, width, _ := s.GetInnerRect()\n\tline := fmt.Sprintf(\"%s[white] %s\", \"Message:\", s.Message)\n\ttview.Print(screen, line, x, y, width, tview.AlignLeft, tcell.ColorBlue)\n}", "title": "" }, { "docid": "43577815ab2be265cee1d23025947a56", "score": "0.69138455", "text": "func (v *View) DrawStatusBar(ab *bytes.Buffer, e *Editor) {\n\tfmt.Fprint(ab, \"\\x1b[7m\")\n\n\tfileName := e.FileName\n\tif fileName == \"\" {\n\t\tfileName = \"No Name\"\n\t}\n\tdirtyChar := ' '\n\tif e.Dirty {\n\t\tdirtyChar = '*'\n\t}\n\n\tleftStatusString := fmt.Sprintf(\"%c%.20s - %d lines\", dirtyChar, fileName, len(e.Rows))\n\trightStatusString := fmt.Sprintf(\"%dc %d/%dr\", e.Cursor.Col+1, e.Cursor.Row+1, len(e.Rows))\n\tnumSpaces := v.ScreenSize.Col - len(leftStatusString) - len(rightStatusString)\n\n\tif numSpaces >= 0 {\n\t\tfmt.Fprint(ab, leftStatusString+strings.Repeat(\" \", numSpaces)+rightStatusString)\n\t} else {\n\t\tfmt.Fprint(ab, (leftStatusString + rightStatusString)[:v.ScreenSize.Col])\n\t}\n\n\tfmt.Fprint(ab, \"\\x1b[m\")\n\tfmt.Fprint(ab, \"\\r\\n\")\n}", "title": "" }, { "docid": "0461a63f35886af82b93084c7af22655", "score": "0.6729572", "text": "func printStatus(statuscolor color.Attribute, statusMessage string) {\n\n\tcolor.New(statuscolor).Printf(\"==>\")\n\tprintln(\" \" + statusMessage)\n\n}", "title": "" }, { "docid": "4c6446af0759f76839968f3e057c1cb5", "score": "0.6066711", "text": "func (ge *GideView) SetStatus(msg string) {\n\tsb := ge.StatusBar()\n\tif sb == nil {\n\t\treturn\n\t}\n\t// ge.UpdtMu.Lock()\n\t// defer ge.UpdtMu.Unlock()\n\n\tupdt := sb.UpdateStart()\n\tlbl := ge.StatusLabel()\n\tfnm := \"\"\n\tln := 0\n\tch := 0\n\ttv := ge.ActiveTextView()\n\tif tv != nil {\n\t\tln = tv.CursorPos.Ln + 1\n\t\tch = tv.CursorPos.Ch\n\t\tif tv.Buf != nil {\n\t\t\tfnm = ge.Files.RelPath(tv.Buf.Filename)\n\t\t\tif tv.Buf.IsChanged() {\n\t\t\t\tfnm += \"*\"\n\t\t\t}\n\t\t\tif tv.Buf.Info.Sup != filecat.NoSupport {\n\t\t\t\tfnm += \" (\" + tv.Buf.Info.Sup.String() + \")\"\n\t\t\t}\n\t\t}\n\t\tif tv.ISearch.On {\n\t\t\tmsg = fmt.Sprintf(\"\\tISearch: %v (n=%v)\\t%v\", tv.ISearch.Find, len(tv.ISearch.Matches), msg)\n\t\t}\n\t\tif tv.QReplace.On {\n\t\t\tmsg = fmt.Sprintf(\"\\tQReplace: %v -> %v (n=%v)\\t%v\", tv.QReplace.Find, tv.QReplace.Replace, len(tv.QReplace.Matches), msg)\n\t\t}\n\t}\n\n\tstr := fmt.Sprintf(\"%v\\t<b>%v:</b>\\t(%v,%v)\\t%v\", ge.Nm, fnm, ln, ch, msg)\n\tlbl.SetText(str)\n\tsb.UpdateEnd(updt)\n}", "title": "" }, { "docid": "d55e88ba155c89aca48b5fe5a5640ef0", "score": "0.59953177", "text": "func updateStatusBox() {\n\tterminal.rwMutex.RLock()\n\tswitch terminal.connectionType {\n\tcase disconnected:\n\t\tonlineLabel.SetText(\"Local (Offline)\")\n\t\thostLabel.SetText(\"\")\n\tcase serialConnected:\n\t\tonlineLabel.SetText(\"Online (Serial)\")\n\t\tserParms := terminal.serialPort + \" @ \" + serialSession.getParms()\n\t\thostLabel.SetText(serParms)\n\tcase telnetConnected:\n\t\tonlineLabel.SetText(\"Online (Telnet)\")\n\t\thostLabel.SetText(terminal.remoteHost + \":\" + terminal.remotePort)\n\t}\n\tif terminal.logging {\n\t\tloggingLabel.SetText(\"Logging\")\n\t} else {\n\t\tloggingLabel.SetText(\"\")\n\t}\n\temuStat := \"D\" + strconv.Itoa(int(terminal.emulation)) + \" (\" +\n\t\tstrconv.Itoa(terminal.visibleLines) + \"x\" + strconv.Itoa(terminal.visibleCols) + \")\"\n\tif terminal.holding {\n\t\temuStat += \" (Hold)\"\n\t}\n\tterminal.rwMutex.RUnlock()\n\temuStatusLabel.SetText(emuStat)\n}", "title": "" }, { "docid": "dcc1bf7edf4376d1b77ce15d55995fad", "score": "0.5968371", "text": "func draw(w, h int) {\n\tfor {\n\t\tdefer termbox.Flush()\n\n\t\t//top bar\n\t\ttbPrint(0, 0, termbox.ColorBlue, termbox.ColorBlack, \"╔\")\n\t\tfor y := 0; y < 1; y++ {\n\t\t\tfor x := 1; x < w-1; x++ {\n\t\t\t\ttbPrint(x, y, termbox.ColorBlue, termbox.ColorBlack, \"═\")\n\t\t\t}\n\t\t}\n\t\ttbPrint(w-1, 0, termbox.ColorBlue, termbox.ColorBlack, \"╗\")\n\n\t\t//body\n\t\t// maybe a parseMessages() or fixMessages() function?\n\t\ttop, bot := 0, h-6\n\t\tleft, right := 1, w-1\n\t\t/* handle messages */\n\t\ti := 0\n\t\tfor y := bot; y > top; y-- {\n\t\t\tr, _ := utf8.DecodeRuneInString(msgs[i])\n\t\t\tmtype := messageType(msgs[i])\n\t\t\tif mtype == GRN || r == '>' {\n\t\t\t\ttbPrint(1, y, termbox.ColorGreen, termbox.ColorBlack, msgs[i])\n\t\t\t} else if mtype == USR {\n\t\t\t\ttbPrint(1, y, termbox.ColorWhite, termbox.ColorBlack, msgs[i])\n\t\t\t} else {\n\t\t\t\ttbPrint(1, y, termbox.ColorCyan, termbox.ColorBlack, msgs[i])\n\t\t\t}\n\n\t\t\tleng := utf8.RuneCountInString(msgs[i])\n\t\t\tfor x := left + leng; x < right; x++ {\n\t\t\t\ttbPrint(x, y, termbox.ColorCyan, termbox.ColorBlack, \" \")\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\t/* end message handling */\n\n\t\t//print edges\n\t\tfor y := 1; y < h-5; y++ {\n\t\t\ttbPrint(0, y, termbox.ColorBlue, termbox.ColorBlack, \"║\")\n\t\t\ttbPrint(w-1, y, termbox.ColorBlue, termbox.ColorBlack, \"║\")\n\t\t}\n\n\t\t//bottom bar\n\t\ttbPrint(0, h-5, termbox.ColorBlue, termbox.ColorBlack, \"╚\")\n\t\tfor y := h - 5; y < h-4; y++ {\n\t\t\tfor x := 1; x < w-1; x++ {\n\t\t\t\ttbPrint(x, y, termbox.ColorBlue, termbox.ColorBlack, \"═\")\n\t\t\t}\n\t\t}\n\t\ttbPrint(w-1, h-5, termbox.ColorBlue, termbox.ColorBlack, \"╝\")\n\n\t\t//user input zone !-! should make this a for loop\n\t\tpos = w - 1\n\t\tlpos = 0\n\t\ttbPrint(0, h-4, termbox.ColorWhite, termbox.ColorBlack, string(txt[lpos:pos]))\n\t\tlpos = pos\n\t\tpos += w - 1\n\t\ttbPrint(0, h-3, termbox.ColorWhite, termbox.ColorBlack, string(txt[lpos:pos]))\n\t\tlpos = pos\n\t\tpos += w - 1\n\t\ttbPrint(0, h-2, termbox.ColorWhite, termbox.ColorBlack, string(txt[lpos:pos]))\n\t\tlpos = pos\n\t\tpos += w - 1\n\t\ttbPrint(0, h-1, termbox.ColorWhite, termbox.ColorBlack, string(txt[lpos:pos]))\n\t\ttermbox.Flush()\n\t\ttime.Sleep(50 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "3520ad6578a8224b34216dc817e5df2f", "score": "0.59454596", "text": "func (gui *Gui) renderStatus(r *git.Repository) string {\n\tvar status string\n\tif r.WorkStatus() == git.Queued {\n\t\tif inQueue, j := gui.State.Queue.IsInTheQueue(r); inQueue {\n\t\t\tstatus = printQueued(r, j)\n\t\t}\n\t} else if r.WorkStatus() == git.Working {\n\t\tstatus = green.Sprint(workingSymbol) + ws + r.State.Message\n\t} else if r.WorkStatus() == git.Success {\n\t\tstatus = green.Sprint(successSymbol) + ws + r.State.Message\n\t} else if r.WorkStatus() == git.Paused {\n\t\tstatus = yellow.Sprint(\"! authentication required (u)\")\n\t} else if r.WorkStatus() == git.Fail {\n\t\tstatus = red.Sprint(failSymbol) + ws + red.Sprint(r.State.Message)\n\t}\n\treturn status\n}", "title": "" }, { "docid": "e764ea982786fb464b6f149dd119120c", "score": "0.5908074", "text": "func (ui *TUI) DisplayStatus(message string) {\n\tui.App.Run(gowid.RunFunction(func(app gowid.IApp) { // nolint:errcheck\n\t\tui.status.SetText(message, ui.App)\n\t}))\n\tgo func() {\n\t\ttimer := time.NewTimer(1200 * time.Millisecond)\n\t\t<-timer.C\n\t\tui.App.Run(gowid.RunFunction(func(app gowid.IApp) { // nolint:errcheck\n\t\t\tui.status.SetText(\"\", ui.App)\n\t\t}))\n\t}()\n}", "title": "" }, { "docid": "a632aaf1abb5d1cda6f4350415e4279c", "score": "0.5808845", "text": "func Status(msg string, a ...interface{}) {\n\tprint(LevelStatus, msg, a...)\n}", "title": "" }, { "docid": "68b9c958e4add9a118934692683b3636", "score": "0.57676417", "text": "func (m *MessageBox) Draw(s *tl.Screen) {\n\tw, h := m.Entity.Size()\n\tsw, sh := s.Size()\n\tm.Entity.SetPosition(sw/2-w/2, sh/2-h/2)\n\tm.Entity.Draw(s)\n}", "title": "" }, { "docid": "c7266c69fd093a224a10bededeeba6c3", "score": "0.57378376", "text": "func PendingStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tif runtime.GOOS == windowsOS {\n\t\tfmt.Fprintf(w, \"%s\\n\", fmt.Sprintf(fmtstr, a...))\n\t} else {\n\t\tfmt.Fprintf(w, \"⌛ %s\\n\", fmt.Sprintf(fmtstr, a...))\n\t}\n}", "title": "" }, { "docid": "707e248b20c206fe11a04e8d21e9a69b", "score": "0.5732212", "text": "func Status(msg string) error {\n\treturn sdNotify(\"STATUS=\" + msg)\n}", "title": "" }, { "docid": "a2336b7b1d6b61c6dbe4b8042831d697", "score": "0.5724621", "text": "func PostStatus(src string, msg string) {\n\tsrc = getColor(src)\n\n\tfmt.Println(src, msg)\n}", "title": "" }, { "docid": "504ec433a35ded5f3080013a724ff69b", "score": "0.57036275", "text": "func PendingStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tfmt.Fprintf(w, \" ⌛ %s\\n\", fmt.Sprintf(fmtstr, a...))\n}", "title": "" }, { "docid": "5dcc2df47c477f65f0e5fbacd98a49e7", "score": "0.5699412", "text": "func printStatus(L *lua.LState) int {\n\tw, _, err := terminal.GetSize(int(os.Stdout.Fd()))\n\tif err != nil {\n\t\temit(\"Unable to get terminal size: %v\", err)\n\t\treturn 0\n\t}\n\treset := \"\\033[0m\"\n\tred := \"\\033[31m\"\n\tgreen := \"\\033[32m\"\n\tblue := \"\\033[34m\"\n\n\tstatus := fmt.Sprintf(\"[%vudef%v]\", blue, reset)\n\tok := fmt.Sprintf(\"[ %vok%v ]\", green, reset)\n\tfail := fmt.Sprintf(\"[%vfail%v]\", red, reset)\n\tswitch L.Get(2).Type() {\n\tcase lua.LTBool:\n\t\tstatus = fail\n\t\tif L.ToBool(2) {\n\t\t\tstatus = ok\n\t\t}\n\tcase lua.LTNumber:\n\t\tstatus = fail\n\t\tif L.ToInt(2) == 0 {\n\t\t\tstatus = ok\n\t\t}\n\t}\n\n\tmessage := L.ToString(1)\n\tfmt.Printf(\"%v%v%v\\n\", message, strings.Repeat(\" \", w-len(message)-len(status)+len(reset)+len(red)-1), status)\n\n\treturn 0\n}", "title": "" }, { "docid": "248f471e5454365c18f51e9e536f943f", "score": "0.569929", "text": "func StatusFmt(status Status) (str string) {\n\tseconds := int64(time.Now().Sub(status.startTime).Seconds())\n\tif seconds <= 0 {\n\t\tseconds = 1\n\t}\n\n\tstr += fmt.Sprintln(\"Total requests: \", status.reqCounter)\n\tstr += fmt.Sprintln(\"Success requests: \", status.sucCounter)\n\tstr += fmt.Sprintln(\"Failed requests: \", status.failCounter)\n\tstr += fmt.Sprintln(\"Requests per second: \", status.reqCounter/seconds)\n\tstr += fmt.Sprintln(\"Average response time: \", time.Duration(status.costCounter/status.reqCounter))\n\n\tstr += fmt.Sprintln(\"Total send: \", humanize(status.sendCounter))\n\tstr += fmt.Sprintln(\"Total recv: \", humanize(status.recvCounter))\n\tstr += fmt.Sprintln(\"Send per second: \", humanize(status.sendCounter/seconds))\n\tstr += fmt.Sprintln(\"Recv per second: \", humanize(status.recvCounter/seconds))\n\n\treturn str\n}", "title": "" }, { "docid": "35737df6e9f55278575a6c70e538de01", "score": "0.5656632", "text": "func InfoStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tif runtime.GOOS == windowsOS {\n\t\tfmt.Fprintf(w, \"%s\\n\", fmt.Sprintf(fmtstr, a...))\n\t} else {\n\t\tfmt.Fprintf(w, \"ℹ️ %s\\n\", fmt.Sprintf(fmtstr, a...))\n\t}\n}", "title": "" }, { "docid": "492480156d2f704448680e8c63cdbfd5", "score": "0.56470233", "text": "func (s *Service) Status(c context.Context, mid int64, uuid string) (msg *model.Msg, err error) {\n\tvar (\n\t\tcount int64\n\t\tunnotify, change bool\n\t\tlg *model.Log\n\t)\n\tif lg, err = s.dao.ExpectionMsg(c, mid); err != nil {\n\t\treturn\n\t}\n\tif lg == nil {\n\t\treturn\n\t}\n\tmsg = &model.Msg{\n\t\tLog: lg,\n\t\tNotify: true,\n\t}\n\tif unnotify, err = s.dao.UnNotify(c, mid, uuid); err != nil {\n\t\terr = nil\n\t\treturn\n\t}\n\tif unnotify {\n\t\tmsg.Notify = false\n\t\treturn\n\t}\n\tif change, err = s.dao.ChangePWDRecord(c, mid); err != nil {\n\t\tlog.Error(\"s.dao.ChangePWDRecord err(%v)\", err)\n\t\terr = nil\n\t\treturn\n\t}\n\tif change {\n\t\tmsg.Notify = false\n\t\treturn\n\t}\n\tif count, err = s.dao.Count(c, mid, uuid); err != nil {\n\t\terr = nil\n\t\treturn\n\t}\n\tif count >= s.c.Expect.CloseCount {\n\t\tmsg.Notify = false\n\t\treturn\n\t}\n\tif rand.Int63n(s.c.Expect.Rand) != 0 {\n\t\tmsg.Notify = false\n\t}\n\treturn\n}", "title": "" }, { "docid": "35c11a114dff872d9429084a871ebeaa", "score": "0.5613289", "text": "func UpdateStatusBar(statusInfo messages.SessionStatus) {\n\tout := \" \"\n\tif statusInfo.Connected {\n\t\tout += \"[\" + config.Config.Colors.Positive + \"]online[-]\"\n\t} else {\n\t\tout += \"[\" + config.Config.Colors.Negative + \"]offline[-]\"\n\t}\n\tout += \" \"\n\tout += \"[::d] (\"\n\tout += fmt.Sprint(statusInfo.BatteryCharge)\n\tout += \"%\"\n\tif statusInfo.BatteryLoading {\n\t\tout += \" [\" + config.Config.Colors.Positive + \"]L[-]\"\n\t} else {\n\t\tout += \" [\" + config.Config.Colors.Negative + \"]l[-]\"\n\t}\n\tif statusInfo.BatteryPowersave {\n\t\tout += \" [\" + config.Config.Colors.Negative + \"]S[-]\"\n\t} else {\n\t\tout += \" [\" + config.Config.Colors.Positive + \"]s[-]\"\n\t}\n\tout += \")[::-] \"\n\tout += statusInfo.LastSeen\n\tgo app.QueueUpdateDraw(func() {\n\t\tinfoBar.SetText(out)\n\t})\n\t//infoBar.SetText(\"🔋: ??%\")\n}", "title": "" }, { "docid": "6c5b3ce91550952ecd08f93471c6418b", "score": "0.5575406", "text": "func (r *Renderer) Status(status int) *Renderer {\n\tr.status = status\n\treturn r\n}", "title": "" }, { "docid": "08daea13c4f8ffab5ac82c907580fd2a", "score": "0.55704343", "text": "func StatusLine(clock model.UTCClock, vote *model.Vote) string {\n\t// Add the vote totals.\n\tstatusStr := statusString(vote)\n\tvotesFor := len(vote.VotesFor)\n\tvotesAgainst := len(vote.VotesAgainst)\n\tvotesForStr := MsgOneVoteFor\n\tif votesFor != 1 {\n\t\tvotesForStr = fmt.Sprintf(MsgVotesFor, votesFor)\n\t}\n\tvotesAgainstStr := MsgOneVoteAgainst\n\tif votesAgainst != 1 {\n\t\tvotesAgainstStr = fmt.Sprintf(MsgVotesAgainst, votesAgainst)\n\t}\n\n\ttimeString := TimeString(clock, vote.TimestampEnd)\n\n\treturn statusStr + \". \" + votesForStr + \", \" + votesAgainstStr + \". \" + timeString\n}", "title": "" }, { "docid": "473f6274dc20a6dbc02cba5bd93cb169", "score": "0.55283195", "text": "func cefingo_display_handler_on_status_message(\n\tself *C.cef_display_handler_t,\n\tbrowser *C.cef_browser_t,\n\tvalue *C.cef_string_t,\n) {\n\truntime.LockOSThread()\n\tdefer runtime.UnlockOSThread()\n\n\tTracef(unsafe.Pointer(self), \"T132.15:\")\n\tcefingoIfaceAccess.Lock()\n\tf := display_handler_handlers.on_status_message_handler[(*cCDisplayHandlerT)(self)]\n\tcefingoIfaceAccess.Unlock()\n\n\tif f != nil {\n\t\t// !p.IsOutParam\n\t\tgoTmpself := newCDisplayHandlerT(self, byApi)\n\t\t// !p.IsOutParam\n\t\tgoTmpbrowser := newCBrowserT(browser, byApi)\n\t\t// !p.IsOutParam\n\t\tgoTmpvalue := string_from_cef_string(value)\n\n\t\tf.OnStatusMessage(goTmpself, goTmpbrowser, goTmpvalue)\n\n\t} else {\n\t\tLogf(\"T132.16: on_status_message: Noo!\")\n\t}\n\tBaseRelease((*cCBrowserT)(browser)) // byApi\n\n}", "title": "" }, { "docid": "6511772b909a035779f9e6df6995d26c", "score": "0.55136585", "text": "func SuccessStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tif runtime.GOOS == windowsOS {\n\t\tfmt.Fprintf(w, \"%s\\n\", fmt.Sprintf(fmtstr, a...))\n\t} else {\n\t\tfmt.Fprintf(w, \"✅ %s\\n\", fmt.Sprintf(fmtstr, a...))\n\t}\n}", "title": "" }, { "docid": "897a23c0b914d3065f9a90a8d9a7c5c1", "score": "0.5490819", "text": "func successLabel(message string) {\n\tct.Foreground(ct.Green, true)\n\tfmt.Print(message)\n\tct.ResetColor()\n\tfmt.Println(\"\")\n}", "title": "" }, { "docid": "f6fc5a4d1aee57ef03ebdaa5a97a72b0", "score": "0.5465153", "text": "func (presenter *Presenter) Status(statuses [][]string) {\n\tvar header [][]string\n\theader = append(header, []string{\"Slot No.\", \"Registration No\", \"Colour\"})\n\tstatuses = append(header, statuses...)\n\tfor _, status := range statuses {\n\t\tfmt.Println(strings.Join(status, \"\\t\\t\"))\n\t}\n}", "title": "" }, { "docid": "7891b27bc2b5011d1241893788ec5c0c", "score": "0.54255223", "text": "func GenerateStatusReport(cmd *command, clusterData *ClusterData) string {\n\tcmdMsg := fmt.Sprintf(cmd.messages[status], clusterData.NumHosts)\n\tgplog.Info(cmdMsg)\n\treturn cmdMsg\n}", "title": "" }, { "docid": "7f0732995d14532abd62c21518f0fdcd", "score": "0.54120976", "text": "func (fM *FeslManager) Status(event gs.EventClientTLSCommand) {\n\tlog.Noteln(\"==STATUS==\")\n\tProcess := event.Process.Msg\n\tanswer := make(map[string]string)\n\n\tvar gid string\n\tvar err error\n\n\tuserID := event.Client.RedisState.Get(\"uID\")\n\n\terr = fM.stmtGetBookmarks.QueryRow(userID).Scan(&gid)\n\tif err != nil {\n\t\tlog.Noteln(\"error with bookmark!\", err)\t\t\n\t\treturn\n\t}\n\n\t\n\tanswer[TXN] = \"Status\"\n\tanswer[\"id.id\"] = \"1\"\n\tanswer[\"id.partition\"] = Process[partition]\n\tanswer[\"sessionState\"] = \"COMPLETE\"\n\tanswer[\"sessionType\"] = \"FindServer\"\n\tanswer[\"firewallType\"] = \"0\"\n\tanswer[\"props.{resultType}\"] = \"JOIN\"\n\t\n\t//games\n\tgameID := gid\n\tanswer[\"props.{games}.[]\"] = \"1\"\n\tanswer[\"props.{games}.0.lid\"] = \"1\"\n\tanswer[\"props.{games}.0.fit\"] = \"1001\"\n\tanswer[\"props.{games}.0.gid\"] = gameID\n\n\t\n\tevent.Client.Answer(\"pnow\", answer, 0x80000000)\n\n}", "title": "" }, { "docid": "3c423058b0089fd4e7e257aa3ee83bd5", "score": "0.5396651", "text": "func RunStatus(f *clientcmd.Factory, out io.Writer) error {\n\tclient, kclient, err := f.Clients()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconfig, err := f.OpenShiftClientConfig.ClientConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnamespace, _, err := f.DefaultNamespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdescriber := &describe.ProjectStatusDescriber{K: kclient, C: client, Server: config.Host}\n\ts, err := describer.Describe(namespace, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Fprintf(out, s)\n\treturn nil\n}", "title": "" }, { "docid": "cc5169931e42d6eb301ab15219da2710", "score": "0.5360638", "text": "func showServerMessage() {\n\tif serverMessageShown {\n\t\treturn\n\t}\n\n\tserverMessage := strings.Join(api.Info.Messages, \" \")\n\twrappedMessage := fmtutil.Wrap(serverMessage, \"\", 80)\n\n\tvar coloredMessage string\n\n\tfor _, line := range strings.Split(wrappedMessage, \"\\n\") {\n\t\tcoloredMessage += \"{s-}\" + line + \"{!}\\n\"\n\t}\n\n\tfmtc.NewLine()\n\tfmtc.Println(coloredMessage)\n\tfmtc.Printf(\n\t\t\"{s-}Assessments: %d/%d (CoolOff: %d)\\n\",\n\t\tapi.Info.CurrentAssessments+1,\n\t\tapi.Info.MaxAssessments,\n\t\tapi.Info.NewAssessmentCoolOff,\n\t)\n\tfmtc.NewLine()\n\n\tserverMessageShown = true\n}", "title": "" }, { "docid": "d498604bd43274f7ccb37082787be010", "score": "0.5344836", "text": "func writeStatus(buf *bytes.Buffer, title string, flags map[string]bool) {\n\n\t// Check that at least one of the bools are true\n\n\tfound := false\n\tfor _, value := range flags {\n\t\tif value {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\treturn\n\t}\n\n\t// Write the overview to the buffer\n\n\tbuf.WriteString(title + \":\")\n\t// Spartan way of lining up the columns\n\tif len(title) < 7 {\n\t\tbuf.WriteString(\"\\t\")\n\t}\n\tbuf.WriteString(\"\\t\\t[\")\n\tvar enabledFlags []string\n\t// Add all enabled flags to the list\n\tfor name, enabled := range flags {\n\t\tif enabled {\n\t\t\tenabledFlags = append(enabledFlags, name)\n\t\t}\n\t}\n\tbuf.WriteString(strings.Join(enabledFlags, \", \"))\n\tbuf.WriteString(\"]\\n\")\n}", "title": "" }, { "docid": "43f49deb2d6e8c15ffeef49f1463bc78", "score": "0.5320252", "text": "func statusMessage(msRes meetspaceAPI.MeetspaceData, slug string) *hipchat.NotificationRequest {\n\tmeetspaceURL := fmt.Sprintf(\"%s/%s\", strings.ToLower(msRes.URL), strings.ToLower(slug))\n\n\t// This is here as reminder that I need to get sending Cards working\n\tmsgCard := &hipchat.Card{\n\t\tStyle: \"link\",\n\t\tURL: meetspaceURL,\n\t\tTitle: \"<p><strong>Meetspace Status</strong><br>\",\n\t\tDescription: hipchat.CardDescription{\n\t\t\tFormat: \"format\",\n\t\t\tValue: \"value\",\n\t\t},\n\t}\n\tmsgBody := fmt.Sprintf(`%s <a href=\"%s\"> %s</a>`, msgCard.Title, msgCard.URL, strings.Title(slug))\n\treturn &hipchat.NotificationRequest{From: \"Meetspace Bot\", Message: msgBody, Color: \"purple\"}\n\n\t// Need to fix request for sending Card to work. More work needed\n\t// return &hipchat.NotificationRequest{Message: msgBody, Card: msgCard}\n}", "title": "" }, { "docid": "27cfd2d7774287789730dac77aaf4be7", "score": "0.52795553", "text": "func SuccessStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tfmt.Fprintf(w, \" ✅ %s\\n\", fmt.Sprintf(fmtstr, a...))\n}", "title": "" }, { "docid": "d2a9c8d5a3877d5ea047380fdbd98fe5", "score": "0.5278319", "text": "func WarningStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tif runtime.GOOS == windowsOS {\n\t\tfmt.Fprintf(w, \"%s\\n\", fmt.Sprintf(fmtstr, a...))\n\t} else {\n\t\tfmt.Fprintf(w, \"⚠ %s\\n\", fmt.Sprintf(fmtstr, a...))\n\t}\n}", "title": "" }, { "docid": "8ecffacf6ade2367b63e6bb41f676074", "score": "0.52737755", "text": "func CompletedStatusLine(vote *model.Vote) string {\n\tstatusStr := MsgStatusInconclusive\n\tswitch vote.VoteOutcome {\n\tcase model.VoteOutcomeNotDone:\n\t\tstatusStr = MsgStatusInconclusive // Don't know how this would happen.\n\tcase model.VoteOutcomePassed:\n\t\tstatusStr = MsgStatusVotePassed\n\tcase model.VoteOutcomeFailed:\n\t\tstatusStr = MsgStatusVoteFailed\n\tcase model.VoteOutcomeNotEnough:\n\t\tstatusStr = MsgStatusInconclusive\n\t}\n\n\tvotesFor := len(vote.VotesFor)\n\tvotesAgainst := len(vote.VotesAgainst)\n\n\tvotesForStr := MsgOneVoteFor\n\tif votesFor != 1 {\n\t\tvotesForStr = fmt.Sprintf(MsgVotesFor, votesFor)\n\t}\n\tvotesAgainstStr := MsgOneVoteAgainst\n\tif votesAgainst != 1 {\n\t\tvotesAgainstStr = fmt.Sprintf(MsgVotesAgainst, votesAgainst)\n\t}\n\treturn statusStr + \" \" + votesForStr + \", \" + votesAgainstStr\n}", "title": "" }, { "docid": "48b90f0da3877356c76999d5c85ab125", "score": "0.52664214", "text": "func (s *Span) StatusMessage() string { return s.statusMessage }", "title": "" }, { "docid": "08f2ad0ffc0401b795def1953fc42a90", "score": "0.5256791", "text": "func FailureStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tif runtime.GOOS == windowsOS {\n\t\tfmt.Fprintf(w, \"%s\\n\", fmt.Sprintf(fmtstr, a...))\n\t} else {\n\t\tfmt.Fprintf(w, \"❌ %s\\n\", fmt.Sprintf(fmtstr, a...))\n\t}\n}", "title": "" }, { "docid": "b0d002cd133b6a54479207430b05d989", "score": "0.5235285", "text": "func (c *Command) NotifyStatus() {\n\tif c.ran {\n\t\tfullCommand := strings.Join(c.Arguments, \" \")\n\t\tresultIcon := \"✅\"\n\t\tresultText := \"completed\"\n\t\tif c.err != nil {\n\t\t\tresultIcon = \"❌\"\n\t\t\tresultText = fmt.Sprintf(\"exitied with code %d\", c.ExitCode())\n\t\t}\n\n\t\tbeeep.Notify(\n\t\t\tfmt.Sprintf(\"%s %s\", resultIcon, fullCommand),\n\t\t\tfmt.Sprintf(\"[%s] %s (%s)\", c.workingDir(), resultText, c.duration),\n\t\t\t\"na\",\n\t\t)\n\t}\n}", "title": "" }, { "docid": "32492c7b89b2778f0f5062bb96980467", "score": "0.5232715", "text": "func printStakeStatus(bigStatus *big.Int, started *big.Int) {\n\t// 0-not Staked, 1=Staked, 2=LockedForWithdraw 3= OnDispute\n\tstatus := bigStatus.Uint64()\n\tstakeTime := time.Unix(started.Int64(), 0)\n\tswitch status {\n\tcase 0:\n\t\tfmt.Printf(\"Not currently staked\\n\")\n\tcase 1:\n\t\tfmt.Printf(\"Staked in good standing since %s\\n\", stakeTime.UTC())\n\tcase 2:\n\t\tstartedRound := started.Int64()\n\t\tstartedRound = ((startedRound + 86399) / 86400) * 86400\n\t\ttarget := time.Unix(startedRound, 0)\n\t\ttimePassed := time.Since(target)\n\t\tdelta := timePassed - (time.Hour * 24 * 7)\n\t\tif delta > 0 {\n\t\t\tfmt.Printf(\"Stake has been eligbile to withdraw for %s\\n\", delta)\n\t\t} else {\n\t\t\tfmt.Printf(\"Stake will be eligible to withdraw in %s\\n\", -delta)\n\t\t}\n\tcase 3:\n\t\tfmt.Printf(\"Stake is currently under dispute\")\n\t}\n}", "title": "" }, { "docid": "51598dfa8749ef8a93f3034b8a5c7889", "score": "0.5197407", "text": "func colorizeUpdateMessage(updateString string, newerThan string) string {\n\tmsgLine1Fmt := \" You are running an older version of MinIO released %s \"\n\tmsgLine2Fmt := \" Update: %s \"\n\n\t// Calculate length *without* color coding: with ANSI terminal\n\t// color characters, the result is incorrect.\n\tline1Length := len(fmt.Sprintf(msgLine1Fmt, newerThan))\n\tline2Length := len(fmt.Sprintf(msgLine2Fmt, updateString))\n\n\t// Populate lines with color coding.\n\tline1InColor := fmt.Sprintf(msgLine1Fmt, colorYellowBold(newerThan))\n\tline2InColor := fmt.Sprintf(msgLine2Fmt, colorCyanBold(updateString))\n\n\t// calculate the rectangular box size.\n\tmaxContentWidth := int(math.Max(float64(line1Length), float64(line2Length)))\n\n\t// termWidth is set to a default one to use when we are\n\t// not able to calculate terminal width via OS syscalls\n\ttermWidth := 25\n\tif width, err := pb.GetTerminalWidth(); err == nil {\n\t\ttermWidth = width\n\t}\n\n\t// Box cannot be printed if terminal width is small than maxContentWidth\n\tif maxContentWidth > termWidth {\n\t\treturn \"\\n\" + line1InColor + \"\\n\" + line2InColor + \"\\n\\n\"\n\t}\n\n\ttopLeftChar := \"┏\"\n\ttopRightChar := \"┓\"\n\tbottomLeftChar := \"┗\"\n\tbottomRightChar := \"┛\"\n\thorizBarChar := \"━\"\n\tvertBarChar := \"┃\"\n\t// on windows terminal turn off unicode characters.\n\tif runtime.GOOS == globalWindowsOSName {\n\t\ttopLeftChar = \"+\"\n\t\ttopRightChar = \"+\"\n\t\tbottomLeftChar = \"+\"\n\t\tbottomRightChar = \"+\"\n\t\thorizBarChar = \"-\"\n\t\tvertBarChar = \"|\"\n\t}\n\n\tlines := []string{\n\t\tcolorYellowBold(topLeftChar + strings.Repeat(horizBarChar, maxContentWidth) + topRightChar),\n\t\tvertBarChar + line1InColor + strings.Repeat(\" \", maxContentWidth-line1Length) + vertBarChar,\n\t\tvertBarChar + line2InColor + strings.Repeat(\" \", maxContentWidth-line2Length) + vertBarChar,\n\t\tcolorYellowBold(bottomLeftChar + strings.Repeat(horizBarChar, maxContentWidth) + bottomRightChar),\n\t}\n\treturn \"\\n\" + strings.Join(lines, \"\\n\") + \"\\n\"\n}", "title": "" }, { "docid": "3f0d5e14fa086e0aa09a2e7359cf449f", "score": "0.5196856", "text": "func (em *Basic) GetStatus(width int) string {\n\tfirst := em.Editor.Cursors[0]\n\tchanged := \"\"\n\n\tif em.Editor.Buffer.Modified {\n\t\tchanged = \"(changed) \"\n\t}\n\t// Make use of width to align cursor row/col right. Truncate if necessary\n\treturn fmt.Sprintf(\"%s %srow %d col %d (INS)\",\n\t\tem.Editor.GetFilename(), changed, first.Line+1, first.Pos+1)\n}", "title": "" }, { "docid": "f6253a91933e807095daeac40992573c", "score": "0.5189203", "text": "func (s *status) String() string {\n\tvar status bytes.Buffer\n\tfmt.Fprintf(&status, \"%-[1]*s\", s.Offsets[0]+3, s.name)\n\tif s.err != nil {\n\t\tfmt.Fprintf(&status, \"%-[1]*s%s\", s.Offsets[1]+3, \"ERROR\", s.err)\n\t\treturn status.String()\n\t}\n\tfmt.Fprintf(&status, s.svStatus)\n\tif s.svStatus == \"RUNNING\" {\n\t\tfmt.Fprintf(&status, \" (pid %d)\", s.svPid)\n\t}\n\tfmt.Fprintf(\n\t\t&status, \"%-[1]*s%ds\",\n\t\ts.Offsets[1]+3-status.Len()+s.Offsets[0]+3, \"\", svNow()-s.svTime,\n\t)\n\treturn status.String()\n}", "title": "" }, { "docid": "732e8c6ba27c4a7b3ecee0a3a1c9e200", "score": "0.51829255", "text": "func FailureStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tfmt.Fprintf(w, \" ❌ %s\\n\", fmt.Sprintf(fmtstr, a...))\n}", "title": "" }, { "docid": "9ba656a27158e6d6915f33154076fd3d", "score": "0.5182072", "text": "func StatusText(code int) string", "title": "" }, { "docid": "53a0e7679235ca7c1cea7eb09296b406", "score": "0.5172566", "text": "func (b *Blaster) PrintStatus(writer io.Writer) {\n\tfmt.Fprint(writer, b.Stats())\n}", "title": "" }, { "docid": "3748c7fe19b14f982a9990863042ac34", "score": "0.5164268", "text": "func (j *ShellCommand) setStatus(msg string) {\n\tj.Lock()\n\tdefer j.Unlock()\n\tj.status = msg\n}", "title": "" }, { "docid": "ddabcf7f13c8b11f94702ab3aadacf26", "score": "0.51558244", "text": "func (g *gpsData) formatStatus() string {\n\ts := g.getStatus()\n\n\tif s == \"\" {\n\t\treturn \"OK\"\n\t}\n\treturn strings.ToUpper(s[0:1]) + s[1:]\n}", "title": "" }, { "docid": "59927226df3655d5449115dddd5a8a8f", "score": "0.5112971", "text": "func (g *Gosh) Status() {\n\tif g.lastWaitStatus.Exited() {\n\t\tfmt.Fprintf(g.outFile, \"exit value %d\\n\", g.lastWaitStatus.ExitStatus())\n\t} else if g.lastWaitStatus.Signaled() {\n\t\tfmt.Fprintf(g.outFile, \"terminated by signal %d\\n\", g.lastWaitStatus.Signal())\n\t} else {\n\t\tfmt.Fprintf(g.outFile, \"not exited or signaled\\n\")\n\t}\n}", "title": "" }, { "docid": "7f065cdf4f7501f76696e30cde006cf3", "score": "0.5105221", "text": "func showServerMessage() {\n\tserverMessage := strings.Join(api.Info.Messages, \" \")\n\twrappedMessage := fmtutil.Wrap(serverMessage, \"\", 80)\n\n\tvar coloredMessage string\n\n\tfor _, line := range strings.Split(wrappedMessage, \"\\n\") {\n\t\tcoloredMessage += \"{s-}\" + line + \"{!}\\n\"\n\t}\n\n\tfmtc.NewLine()\n\tfmtc.Println(coloredMessage)\n}", "title": "" }, { "docid": "6e2230194b51323f3fe69a15628697e8", "score": "0.5099876", "text": "func (g *Game) Draw() {\n\tif g.Health <= 0 {\n\t\tNewTextEntity(pixel.V(10, 350), 10, colornames.Red).Write(\"You Lost!\", g.Win)\n\t} else if g.Wave > 20 {\n\t\tNewTextEntity(pixel.V(10, 350), 10, colornames.Green).Write(\"You Win!\", g.Win)\n\t} else if g.Wave <= 20 {\n\t\tg.Lvl.Draw(g.Win)\n\t\tdrawTmpTower(g.Win)\n\t\tg.Enemies.Draw(g.Win)\n\t\tg.Bullets.Draw(g.Win)\n\t\tg.Buttons.Draw(g.Win)\n\n\t\tif g.Debug {\n\t\t\tdt := time.Since(g.StartTime).Seconds()\n\t\t\tif dt < 1 {\n\t\t\t\tdt = 1\n\t\t\t}\n\t\t\tg.Frametxt.Write(fmt.Sprintf(\"avg. %vfps, frame: %v\", g.Frame/int(dt), g.Frame), g.Win)\n\t\t}\n\n\t\tg.Wavetxt.Write(fmt.Sprintf(\"Wave: %v\", g.Wave), g.Win)\n\t\tg.Moneytxt.Write(fmt.Sprintf(\"$%v\", g.Money), g.Win)\n\t\tg.Healthtxt.Write(fmt.Sprintf(\"<3 %v\", g.Health), g.Win)\n\t}\n}", "title": "" }, { "docid": "0f1517ae0b0035bb0e2804527ea7b7ba", "score": "0.5094361", "text": "func (d *DetectStruct) ShowStatus() error {\n\tfor k, v := range d.Status.Columns {\n\t\td.Status.Columns[k] = common.StringUnique(v)\n\t}\n\n\ts, err := json.MarshalIndent(d.Status.Columns, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(string(s))\n\n\t// verbose mode\n\tif len(d.Config.Verbose) == 0 {\n\t\treturn nil\n\t}\n\n\tprintln(\n\t\t\"Detect Rows:\", d.Status.Lines, \"Total Cost:\", fmt.Sprint(time.Duration(d.Status.TimeCost)*time.Nanosecond),\n\t)\n\treturn nil\n}", "title": "" }, { "docid": "4ae5735cc7cacd2e03122af43d0f4237", "score": "0.5092306", "text": "func StatusText(status uint32) string {\n\tif status, ok := statusMap[status]; ok {\n\t\treturn status\n\t}\n\n\treturn defaultStatus\n}", "title": "" }, { "docid": "9e29ff915ca285dc5bfd1a0e6aa4dbfa", "score": "0.5081027", "text": "func draw(c *gosf.Client, r *gosf.Request) *gosf.Message {\n\trid := r.Message.Text\n\n\t// if room does not exist, disconnect without a word\n\tif state.Rooms[rid] == nil {\n\t\tc.Disconnect()\n\t}\n\n\tm := new(gosf.Message)\n\tm.Success = true\n\tm.Body = r.Message.Body\n\n\tgosf.Broadcast(rid, \"draw\", m)\n\n\treturn nil\n}", "title": "" }, { "docid": "feb7f06163959933c31630c67c687f0c", "score": "0.50801516", "text": "func FormatStatus(id, format string, a ...interface{}) []byte {\n\tstr := fmt.Sprintf(format, a...)\n\tb, err := json.Marshal(&jsonmessage.JSONMessage{ID: id, Status: str})\n\tif err != nil {\n\t\treturn FormatError(err)\n\t}\n\treturn appendNewline(b)\n}", "title": "" }, { "docid": "7ed64c96150803e2b4c94932508706c2", "score": "0.5077747", "text": "func (p *Publisher) Draw(buf *ui.Buffer) {\n\tp.view.Draw(buf)\n\tif p.err != nil {\n\t\treturn\n\t}\n\n\tx := p.Inner.Min.X\n\ty := p.Inner.Min.Y\n\n\tif p.data != nil {\n\t\tx += 1\n\t\tcells := ui.TrimCells(ui.ParseStyles(fmt.Sprintf(\"[Speed:](mod:bold) %.3f eps\", p.data.Status.Speed), ui.Theme.Paragraph.Text), p.Inner.Dx()/2-2)\n\t\tfor _, cell := range cells {\n\t\t\tbuf.SetCell(cell, image.Point{x, y})\n\t\t\tx += 1\n\t\t}\n\t\tx = p.Inner.Min.X + p.Inner.Dx()/2 + 1\n\t\tcells = ui.TrimCells(ui.ParseStyles(\"[Pressure:](mod:bold)\", ui.Theme.Paragraph.Text), p.Inner.Dx()/2-2)\n\t\tfor _, cell := range cells {\n\t\t\tbuf.SetCell(cell, image.Point{x, y})\n\t\t\tx += 1\n\t\t}\n\t\tp.mainGauge.SetRect(x+1, y, p.Inner.Max.X, y+1)\n\t\tp.mainGauge.Draw(buf)\n\t\tx = p.Inner.Min.X\n\t}\n\n\ty += 1\n\tbuf.Fill(ui.NewCell(ui.HORIZONTAL_LINE, p.Block.BorderStyle), image.Rect(x, y, x+p.Inner.Dx(), y+1))\n\tbuf.SetCell(ui.NewCell(ui.VERTICAL_RIGHT, p.Block.BorderStyle), image.Point{p.Min.X, y})\n\tbuf.SetCell(ui.NewCell(ui.VERTICAL_LEFT, p.Block.BorderStyle), image.Point{p.Max.X - 1, y})\n\n\tp.table.Draw(buf)\n}", "title": "" }, { "docid": "ef4e3859308759e4082241089086a8b6", "score": "0.5069321", "text": "func (r *tankGame) drawInfo() {\n\tctx := r.ctx\n\tctx.SetFont(\"bold 15px Gill Sans MT\")\n\tctx.SetFillStyle(\"blue\")\n\tctx.FillText(\"Lives: \"+strconv.Itoa(r.player_lives), 635, 22)\n\tctx.FillText(\"Score: \"+strconv.Itoa(r.score), 13, 22)\n}", "title": "" }, { "docid": "099308ca5b30a07278092d8fd03b273f", "score": "0.50662804", "text": "func (l *LintStruct) ShowStatus() error {\n\tvar err error\n\n\tif len(l.Status.Lint) == 0 {\n\t\tfmt.Println(\"ok\")\n\t}\n\n\t// format lint status\n\tfor _, s := range l.Status.Lint {\n\t\tfmt.Printf(\"Line: %d, Column: %d, %s: %s\\n\", s.Line, s.Column, s.Level, s.Message)\n\t}\n\n\t// verbose mode print\n\tif len(l.Config.Verbose) == 0 {\n\t\treturn err\n\t}\n\tprintln(\"\")\n\tprintln(\"File Size:\", l.Status.Size)\n\n\tprintln(\"Row Count(Include Header):\", l.Status.RowCount,\n\t\t\"Cell Count:\", l.Status.CellCount,\n\t\t\"Error Count:\", l.Status.ErrorCount,\n\t\t\"Time Cost:\", fmt.Sprint(time.Duration(l.Status.TimeCost)*time.Nanosecond))\n\treturn err\n}", "title": "" }, { "docid": "863a8123f08c14e3752ba208b38ce0f1", "score": "0.5063538", "text": "func getStatusMessage(status pdata.SpanStatus) string {\n\tif len(status.Message()) > 0 {\n\t\treturn status.Message()\n\t}\n\n\treturn status.Code().String()\n}", "title": "" }, { "docid": "b382ec754c7feddc711d59b3f32426d8", "score": "0.5058392", "text": "func Status(ctx context.Context,\n\tserviceName string,\n\tserviceDescription string,\n\tredact bool,\n\tlogger *zerolog.Logger) error {\n\treturn errors.New(\"Status not supported for this binary\")\n}", "title": "" }, { "docid": "2bdbfa630d4f7551eaedaeec78835fdc", "score": "0.50535643", "text": "func SetStatus(w http.ResponseWriter, code, msg string) {\n\tr := &Status{Code: code, Message: msg}\n\tif js, err := json.Marshal(r); err == nil {\n\t\tfmt.Fprint(w, string(js))\n\t} else {\n\t\tpanic(fmt.Sprintf(\"Unable to marshal: %+v\", r))\n\t}\n}", "title": "" }, { "docid": "8271e43259e4f7c3e0411c572374340a", "score": "0.5044505", "text": "func (s *StatusMessageService) StatusMessage(commentMsgCreator func() string, addIfMissing bool) error {\n\tcomments, err := s.commentsLoader.Load()\n\tif err != nil {\n\t\ts.logger.Errorf(\"Getting all comments failed with an error: %s\", err)\n\t}\n\tstatusMsg := utils.String(\"\")\n\n\tfor _, com := range comments {\n\t\tcontent := *com.Body\n\t\tif strings.HasPrefix(content, s.getPluginTitle()) {\n\t\t\ts.loadStatusMessage(commentMsgCreator, statusMsg)\n\t\t\tif strings.TrimSpace(content) == strings.TrimSpace(*statusMsg) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn s.commentService.EditComment(*com.ID, statusMsg)\n\t\t}\n\t}\n\tif addIfMissing {\n\t\ts.loadStatusMessage(commentMsgCreator, statusMsg)\n\t\treturn s.commentService.AddComment(statusMsg)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "38d1f0e6f8a8714ce4ad5421829719b0", "score": "0.5034211", "text": "func RunStatus(hctx *HpsContext) error {\n\tif err := RunHpsTool(hctx, \"status\", \"0\", \"11\"); err != nil {\n\t\treturn errors.Wrap(err, \"error during getting status\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0d02fc7cdc435adf4c07fac6cfd5604d", "score": "0.50301045", "text": "func (s *Span) SetStatus(code codes.Code, msg string) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tif s.ended {\n\t\treturn\n\t}\n\n\ts.statusCode = code\n\ts.statusMessage = msg\n}", "title": "" }, { "docid": "8313984f15a48d14f9f2e31a9161abb4", "score": "0.50092363", "text": "func Status(ctx context.Context) (string, error) {\n\tif err := jrpc2.ServerFromContext(ctx).Notify(ctx, \"pushback\", []string{\"hello, friend\"}); err != nil {\n\t\treturn \"BAD\", err\n\t}\n\treturn \"OK\", nil\n}", "title": "" }, { "docid": "a79c73c0d16b4e3d7e4278819ea598ca", "score": "0.5008876", "text": "func (o InstanceOutput) StatusMessage() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.StatusMessage }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "91259c90ffe833da0781c7a8013f0206", "score": "0.50055814", "text": "func (queue *messagequeue) Status() {\n\tlogging.AddInfo(\"[Queue] Total connections:\", len(queue.pool.conns))\n\tnetworkList, _ := queue.networkRegistry.ToString()\n\tlogging.AddInfo(\"[Queue] NetworkRegistry: \", networkList)\n}", "title": "" }, { "docid": "99334c4075aa4bdf6f1bdd10e405cfd3", "score": "0.49874058", "text": "func (s *sliceMachine) UpdateStatus() {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tvalues := s.vals.Copy()\n\ts.Stats.AddAll(values)\n\tvar health string\n\tswitch s.health {\n\tcase machineOk:\n\tcase machineProbation:\n\t\thealth = \" (probation)\"\n\tcase machineLost:\n\t\thealth = \" (lost)\"\n\t}\n\ts.Status.Printf(\"mem %s/%s disk %s/%s load %.1f/%.1f/%.1f counters %s%s\",\n\t\tdata.Size(s.mem.System.Used), data.Size(s.mem.System.Total),\n\t\tdata.Size(s.disk.Usage.Used), data.Size(s.disk.Usage.Total),\n\t\ts.load.Averages.Load1, s.load.Averages.Load5, s.load.Averages.Load15,\n\t\tvalues, health,\n\t)\n}", "title": "" }, { "docid": "d35b3a48e97584a7a9fd93c30a898e3c", "score": "0.49709153", "text": "func Write(xStart int, yStart int, foreColor tb.Attribute, backColor tb.Attribute, message string) (int, int) {\n\tx := xStart\n\ty := yStart\n\tstdWidth, _ := tb.Size()\n\tif stdWidth >= 10 {\n\t\tstdWidth -= 10\n\t}\n\n\tfor _, ch := range message {\n\t\ttb.SetCell(x, y, ch, foreColor, backColor)\n\t\tif x > stdWidth && ch == ' ' {\n\t\t\ty++\n\t\t\tx = xStart\n\t\t} else {\n\t\t\tx++\n\t\t}\n\t}\n\n\tfor j := x; j < stdWidth+10; j++ {\n\t\ttb.SetCell(j, y, ' ', foreColor, backColor)\n\t}\n\n\ttb.Flush()\n\treturn x, y\n}", "title": "" }, { "docid": "76833df13b542541eb5dd40b055283d6", "score": "0.49656615", "text": "func (g *ATCGame) GetStatusDisplay() BaseGame {\n\treturn stripDisplay(&g.Base)\n}", "title": "" }, { "docid": "98cfd305a238e8fd2c099b5a112b43b3", "score": "0.4965069", "text": "func MarkerStatus(markerID model.TaskID, opID model.OperationID, teams []model.TeamID, status string, updateID string) error {\n\tif !config.IsFirebaseRunning() {\n\t\treturn nil\n\t}\n\tif !ratelimitOp(opID) {\n\t\treturn nil\n\t}\n\n\tdata := map[string]string{\n\t\t\"opID\": string(opID),\n\t\t\"markerID\": string(markerID),\n\t\t\"msg\": status,\n\t\t\"cmd\": \"Marker Status Change\",\n\t\t\"srv\": config.Get().HTTP.Webroot,\n\t\t\"updateID\": updateID,\n\t}\n\n\tconditions := teamsToCondition(teams)\n\tmulticastFantoutMutex.Lock()\n\tdefer multicastFantoutMutex.Unlock()\n\tfor _, condition := range conditions {\n\t\tm := messaging.Message{\n\t\t\tCondition: condition,\n\t\t\tData: data,\n\t\t}\n\t\tif _, err := msg.Send(fbctx, &m); err != nil {\n\t\t\tlog.Error(err)\n\t\t\tif messaging.IsTooManyTopics(err) || messaging.IsMessageRateExceeded(err) {\n\t\t\t\tslowdown()\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e7c82b3962e1489bea0ab545d096d32", "score": "0.4964974", "text": "func PrintStatus(os OSystem) {\n\tif !os.GetStatus() {\n\t\tfmt.Printf(\"%s is SHUTDOWN\\n\", strings.ToUpper(reflect.TypeOf(os).String()[1:]))\n\t\treturn\n\t}\n\tfmt.Printf(\"%s is WORK\\n\", strings.ToUpper(reflect.TypeOf(os).String()[1:]))\n}", "title": "" }, { "docid": "26c71e1e7758dba6b70d93d71722e9fb", "score": "0.49383", "text": "func (ui *MainFrameUI) createStatusUI() *gtk.VBox {\n\tui.status = Status.NewStatusFrame()\n\treturn ui.status.StatusFrameUI.Box\n}", "title": "" }, { "docid": "fd3aae26939857c876289c1558143a5c", "score": "0.4936388", "text": "func (c *DefaultController) Status(ctx context.Context, in *SetupMessage) (*StatusMessage, error) {\n\t// get setups\n\telementSetup := in.Elements[in.Element]\n\tclusterSetup := elementSetup.Clusters[in.Cluster]\n\tinstanceSetup := clusterSetup.Instances[in.Instance]\n\n\t// construct status\n\tstatus := StatusMessage{\n\t\tError: \"\",\n\t\tDomain: in.Domain,\n\t\tSolution: in.Solution,\n\t\tVersion: in.Version,\n\t\tElement: in.Element,\n\t\tElementEndpoint: \"\",\n\t\tCluster: in.Cluster,\n\t\tClusterEndpoint: \"\",\n\t\tClusterState: clusterSetup.Target,\n\t Instance: in.Instance,\n\t\tInstanceEndpoint: \"\",\n\t\tInstanceState: instanceSetup.Target,\n\t}\n\n\t// return results\n\treturn &status, nil\n}", "title": "" }, { "docid": "a1719f920b8d79582819393c45d80b28", "score": "0.4935319", "text": "func (t *Tinzenite) PrintStatus() string {\n\tvar out string\n\tout += \"Online:\\n\"\n\taddresses, err := t.channel.FriendAddresses()\n\tif err != nil {\n\t\tout += \"channel.FriendAddresses failed!\"\n\t} else {\n\t\tvar count int\n\t\tfor _, address := range addresses {\n\t\t\tonline, err := t.channel.IsAddressOnline(address)\n\t\t\tvar insert string\n\t\t\tif err != nil {\n\t\t\t\tinsert = \"ERROR\"\n\t\t\t} else {\n\t\t\t\tinsert = fmt.Sprintf(\"%v\", online)\n\t\t\t}\n\t\t\tout += address[:16] + \" :: \" + insert + \"\\n\"\n\t\t\tcount++\n\t\t}\n\t\tout += \"Total friends: \" + fmt.Sprintf(\"%d\", count)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "874706a0b16920a67022081e116d0bf3", "score": "0.4898697", "text": "func (s *Server) Status() {\n\ttick, err := s.config.GetTick()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Schedule the next status event when this event is dispatched\n\tdefer time.AfterFunc(tick*1000, s.Status)\n\n\t// Dispatch the status event\n\ts.Dispatch(&event{etype: StatusTimeout, source: nil, value: nil})\n}", "title": "" }, { "docid": "999e15604eadb79f32782ae679400a5a", "score": "0.48850572", "text": "func ColorStatus(_ int, status string) (color.Color, bool) {\n\tstatus = strings.ToLower(status)\n\tswitch {\n\t// the order matters!\n\tcase seemsNegative(status):\n\t\treturn color.Red, true\n\tcase seemsPositive(status):\n\t\treturn color.Green, true\n\tcase seemsWarning(status):\n\t\treturn color.Yellow, true\n\tdefault:\n\t\treturn seemsReadyStatus(status)\n\t}\n}", "title": "" }, { "docid": "2797056d865c82b94a19229db77ae067", "score": "0.48766726", "text": "func (s *Span) StatusMessage() string {\n\treturn s.statusMessage\n}", "title": "" }, { "docid": "8ee2926dfe64180e086ec93f3ba92db6", "score": "0.48759437", "text": "func printPgstat(v *gocui.View, s stat.Stat) {\n\t/* line1: details of used connection, version, uptime and recovery status */\n\tfmt.Fprintf(v, \"state [%s]: %.16s:%d %.16s@%.16s (ver: %s, up %s, recovery: %.1s)\\n\",\n\t\ts.PgInfo.PgAlive,\n\t\tconninfo.Host, conninfo.Port, conninfo.User, conninfo.Dbname,\n\t\ts.PgInfo.PgVersion, s.PgInfo.PgUptime, s.PgInfo.PgRecovery)\n\t/* line2: current state of connections: total, idle, idle xacts, active, waiting, others */\n\tfmt.Fprintf(v, \" activity:\\033[37;1m%3d/%d\\033[0m conns,\\033[37;1m%3d/%d\\033[0m prepared,\\033[37;1m%3d\\033[0m idle,\\033[37;1m%3d\\033[0m idle_xact,\\033[37;1m%3d\\033[0m active,\\033[37;1m%3d\\033[0m waiting,\\033[37;1m%3d\\033[0m others\\n\",\n\t\ts.PgActivityStat.ConnTotal, s.PgInfo.PgMaxConns, s.PgActivityStat.ConnPrepared, s.PgInfo.PgMaxPrepXacts,\n\t\ts.PgActivityStat.ConnIdle, s.PgActivityStat.ConnIdleXact, s.PgActivityStat.ConnActive,\n\t\ts.PgActivityStat.ConnWaiting, s.PgActivityStat.ConnOthers)\n\t/* line3: current state of autovacuum: number of workers, antiwraparound, manual vacuums and time of oldest vacuum */\n\tfmt.Fprintf(v, \"autovacuum: \\033[37;1m%2d/%d\\033[0m workers/max, \\033[37;1m%2d\\033[0m manual, \\033[37;1m%2d\\033[0m wraparound, \\033[37;1m%s\\033[0m vac_maxtime\\n\",\n\t\ts.PgActivityStat.AVWorkers, s.PgInfo.PgAVMaxWorkers,\n\t\ts.PgActivityStat.AVManual, s.PgActivityStat.AVAntiwrap, s.PgActivityStat.AVMaxTime)\n\t/* line4: current workload*/\n\tfmt.Fprintf(v, \"statements: \\033[37;1m%3d\\033[0m stmt/s, \\033[37;1m%3.3f\\033[0m stmt_avgtime, \\033[37;1m%s\\033[0m xact_maxtime, \\033[37;1m%s\\033[0m prep_maxtime\\n\",\n\t\ts.PgActivityStat.StmtPerSec, s.PgActivityStat.StmtAvgTime, s.PgActivityStat.XactMaxTime, s.PgActivityStat.PrepMaxTime)\n}", "title": "" }, { "docid": "e901962daa21465faff0f0daea959c4b", "score": "0.48729065", "text": "func statusHandler(message *telebot.Message) {\n\tif !validChatID(message) {\n\t\treturn\n\t}\n\tusername, err := getTelegramUsername(message)\n\tif err != nil {\n\t\tmainBot.Send(message.Chat, \"Ops! Parece que você não configurou seu Telegram Username.\")\n\t\tlog.Printf(\"[ERROR] %s\", err)\n\t\treturn\n\t}\n\tlog.Printf(\"[INFO] User %s triggered Telegram command /status\", username)\n\tregistries := model.GetAllActiveRegistries()\n\tif len(registries) == 0 {\n\t\tmainBot.Send(message.Chat, \"Não existem registros ativos!\")\n\t\treturn\n\t}\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"Registros Ativos: \")\n\tfor _, registry := range registries {\n\t\tbuffer.WriteString(fmt.Sprintf(\"\\n- @%s\", registry.Username))\n\t}\n\tmainBot.Send(message.Chat, buffer.String())\n}", "title": "" }, { "docid": "5ebbb266a3da891d901ade6277a82b36", "score": "0.48717612", "text": "func makeStatusResponseMessage(height int64) []byte {\n\tmsgBytes := cdc.MustMarshalBinaryBare(&bcStatusResponseMessage{height})\n\treturn msgBytes\n}", "title": "" }, { "docid": "a3e821d398ab0643965389f6a3dc86ab", "score": "0.4870914", "text": "func drawScoringConfirmBack(w int, screen *ebiten.Image) {\n\tconfirmationStringL1 := \"Return to base?\"\n\tconfirmationStringL2 := \"Press back to quit.\"\n\tconfirmationStringL3 := \"Press forward\"\n\tconfirmationStringL4 := \"to resume.\"\n\n\tconfirmationYL1 := 12 * 16\n\tconfirmationXL1 := (w - len(confirmationStringL1)*32) / 2\n\tconfirmationYL2 := 16 * 16\n\tconfirmationXL2 := (w - len(confirmationStringL2)*32) / 2\n\tconfirmationYL3 := 20 * 16\n\tconfirmationXL3 := (w - len(confirmationStringL3)*32) / 2\n\tconfirmationYL4 := 23 * 16\n\tconfirmationXL4 := (w - len(confirmationStringL4)*32) / 2\n\n\t// Draw the confirmation message\n\ttext.Draw(screen, confirmationStringL1, fonts.ArcadeFont32, confirmationXL1, confirmationYL1, color.White)\n\ttext.Draw(screen, confirmationStringL2, fonts.ArcadeFont32, confirmationXL2, confirmationYL2, color.White)\n\ttext.Draw(screen, confirmationStringL3, fonts.ArcadeFont32, confirmationXL3, confirmationYL3, color.White)\n\ttext.Draw(screen, confirmationStringL4, fonts.ArcadeFont32, confirmationXL4, confirmationYL4, color.White)\n}", "title": "" }, { "docid": "18921f2fffe49bd805b46c95447fb7db", "score": "0.48704505", "text": "func (c *Client) Status(mailbox string, options *imap.StatusOptions) *StatusCommand {\n\tcmd := &StatusCommand{mailbox: mailbox}\n\tenc := c.beginCommand(\"STATUS\", cmd)\n\tenc.SP().Mailbox(mailbox).SP()\n\titems := statusItems(options)\n\tenc.List(len(items), func(i int) {\n\t\tenc.Atom(items[i])\n\t})\n\tenc.end()\n\treturn cmd\n}", "title": "" }, { "docid": "bc8aa552a642db91f9c21db57b5bc1b6", "score": "0.48682606", "text": "func (v *view) statusLine() []interface{} {\n\tcs := v.cs\n\treturn []interface{}{cs.pos + 1, fmt.Sprintf(\"%q\", v.buf.text[cs.line]),\n\t\tcs.lastCharPos() + 1, cs.lastLine() + 1}\n}", "title": "" }, { "docid": "c959ced19744c2cef22a8d3ae795cd7b", "score": "0.4867104", "text": "func (p *Push) Status(arg *string) *erpc.Status {\n\terpc.Printf(\"%s\", *arg)\n\treturn nil\n}", "title": "" }, { "docid": "46bcdd582f6a2691fbb861eb5141ffe5", "score": "0.48645782", "text": "func GetStatus() string {\n\t/*\n\t TODO - Check Monitor is running\n\t TODO - Check Disk space\n\t*/\n\treturn \"All good\"\n}", "title": "" }, { "docid": "2660031489674d96348ebc79f2ea5798", "score": "0.48565215", "text": "func Status(settings *models.Settings) {\n\tw := new(tabwriter.Writer)\n\tw.Init(os.Stdout, 0, 8, 4, '\\t', 0)\n\n\thelpers.SignIn(settings)\n\tenv := helpers.RetrieveEnvironment(\"pod\", settings)\n\n\tfmt.Fprintln(w, env.Data.Name+\" (environment ID = \"+env.ID+\"):\")\n\tfmt.Fprintln(w, \"Label\\tStatus\\tCreated At\")\n\n\tservices := *env.Data.Services\n\tsortutil.AscByField(services, \"Label\")\n\n\tfor _, service := range services {\n\t\tif service.Type != \"utility\" && service.Type != \"\" {\n\t\t\tjobs := helpers.RetrieveRunningJobs(service.ID, settings)\n\t\t\tfor jobID, job := range *jobs {\n\t\t\t\tdisplayType := service.Label\n\t\t\t\tif job.Type != \"deploy\" {\n\t\t\t\t\tdisplayType = fmt.Sprintf(\"%s (%s)\", service.Label, job.Type)\n\t\t\t\t\tif job.Type == \"worker\" {\n\t\t\t\t\t\t// fetch the worker separately to get the procfile target run\n\t\t\t\t\t\tworkerJob := helpers.RetrieveJob(jobID, service.ID, settings)\n\t\t\t\t\t\tif workerJob.Spec != nil && workerJob.Spec.Payload != nil && workerJob.Spec.Payload.Environment != nil {\n\t\t\t\t\t\t\tif target, contains := workerJob.Spec.Payload.Environment[\"PROCFILE_TARGET\"]; contains {\n\t\t\t\t\t\t\t\tdisplayType = fmt.Sprintf(\"%s (%s: target=%s)\", service.Label, job.Type, target)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst dateForm = \"2006-01-02T15:04:05\"\n\t\t\t\tt, _ := time.Parse(dateForm, job.CreatedAt)\n\t\t\t\tfmt.Fprintln(w, displayType+\"\\t\"+job.Status+\"\\t\"+t.Local().Format(time.Stamp))\n\t\t\t}\n\t\t\tif service.Type == \"code\" {\n\t\t\t\tlatestBuildMap := helpers.RetrieveLatestBuildJob(service.ID, settings)\n\t\t\t\tfor latestBuildID, latestBuild := range *latestBuildMap {\n\t\t\t\t\tif latestBuildID == \"\" {\n\t\t\t\t\t\tfmt.Fprintln(w, \"--------\"+\"\\t\"+service.Label+\"\\t\"+\"-------\"+\"\\t\"+\"---------------\")\n\t\t\t\t\t} else if latestBuildID != \"\" {\n\t\t\t\t\t\tconst dateForm = \"2006-01-02T15:04:05\"\n\t\t\t\t\t\tt, _ := time.Parse(dateForm, latestBuild.CreatedAt)\n\t\t\t\t\t\tdisplayType := service.Label\n\t\t\t\t\t\tdisplayType = fmt.Sprintf(\"%s (%s)\", displayType, latestBuild.Type)\n\t\t\t\t\t\tfmt.Fprintln(w, displayType+\"\\t\"+latestBuild.Status+\"\\t\"+t.Local().Format(time.Stamp))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tw.Flush()\n}", "title": "" }, { "docid": "f457fe806bb6628e6b50b1c9bac8f132", "score": "0.48506352", "text": "func (v *debugView) Draw(s *tl.Screen) {\n\tif v.hidden {\n\t\treturn\n\t}\n\t// show line with fps\n\tv.fpsCaption.Draw(s)\n\tv.fpsText.Draw(s)\n\t// show last 10 logs with new log always at the bottom\n\tfor i, l := range v.d.lastNLogs(10) {\n\t\ttl.NewText(0, i+1, l, tl.ColorBlack, tl.ColorDefault).Draw(s)\n\t}\n}", "title": "" }, { "docid": "69e0c7ebae92855ec811efb212fb89e2", "score": "0.48478657", "text": "func (this *MainController) GetStatus() {\n\tthis.Ctx.ResponseWriter.WriteHeader(201)\n\tthis.Ctx.WriteString(\"Service is up & running\")\n}", "title": "" }, { "docid": "b6277c38f9b719dff563b833a3e82889", "score": "0.48368135", "text": "func drawRect(img gocv.Mat, boxes []image.Rectangle, classes []string, classIds []int, indices []int, confidences []float32) (gocv.Mat, map[string]LabelResult) {\n\tdetectClass := make(map[string]LabelResult)\n\tfor _, idx := range indices {\n\t\tif idx == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tlabelName := classes[classIds[idx]] + \" \" + strconv.FormatFloat(float64(confidences[idx]), 'f', 2, 32)\n\t\tsizeConfig := gocv.GetTextSize(labelName, gocv.FontHersheyComplexSmall, 1.2, 2)\n\t\tx0 := boxes[idx].Max.X\n\t\ty0 := boxes[idx].Max.Y\n\t\tx1 := boxes[idx].Max.X + boxes[idx].Min.X\n\t\ty1 := boxes[idx].Max.Y + boxes[idx].Min.Y\n\t\tif x0+2 >= img.Cols() {\n\t\t\tx1 = img.Cols() - 1*2\n\t\t}\n\t\tif y1+2 >= img.Rows() {\n\t\t\ty1 = img.Rows() - 1*2\n\t\t}\n\t\t// 画框\n\t\tgocv.Rectangle(\n\t\t\t&img,\n\t\t\timage.Rect(x0, y0, x1, y1),\n\t\t\tcolor.RGBA{255, 0, 191, 0},\n\t\t\t1)\n\t\t// 文字填充\n\t\tgocv.Rectangle(\n\t\t\t&img,\n\t\t\timage.Rect(x0, y0-sizeConfig.Y, x0+sizeConfig.X, y0),\n\t\t\tcolor.RGBA{255, 0, 191, 0},\n\t\t\t-1)\n\t\t// 文字\n\t\tgocv.PutText(\n\t\t\t&img,\n\t\t\tlabelName,\n\t\t\timage.Point{x0, y0 - 3}, gocv.FontHersheyComplexSmall,\n\t\t\t1.2,\n\t\t\tcolor.RGBA{255, 255, 255, 0},\n\t\t\t2)\n\t\tmodel, ok := detectClass[classes[classIds[idx]]]\n\t\tif ok {\n\t\t\tmodel.Warn = model.Warn + 1\n\t\t} else {\n\t\t\tmodel = LabelResult{\n\t\t\t\tLabelName: classes[classIds[idx]],\n\t\t\t\tWarn: 1,\n\t\t\t}\n\t\t}\n\t\tdetectClass[classes[classIds[idx]]] = model\n\t\t//detectClass = append(detectClass, labelName)\n\t}\n\treturn img, detectClass\n}", "title": "" }, { "docid": "d3f87427ce3af86555cbee80b53fc59c", "score": "0.48344463", "text": "func Status(status string) State {\n\treturn &msgState{\"STATUS\", status}\n}", "title": "" }, { "docid": "5241512213008f66b848e226a856639e", "score": "0.4832578", "text": "func renderDebugConsole(messages []string) {\n\tw, h := termbox.Size()\n\n\tfor y := 0; y < h; y++ {\n\t\tfor x := w / 2; x < w; x++ {\n\t\t\ttermbox.SetCell(x, y, ' ', debugConsoleColor, debugConsoleColor)\n\t\t}\n\t}\n\n\tdebugTextStartX := w/2 + 2\n\tfor y, msg := range messages {\n\t\tprintText(debugTextStartX, y+1, debugTextColor, debugConsoleColor, msg)\n\t}\n}", "title": "" }, { "docid": "44b263ecd8a9a606e15aebdd43260abe", "score": "0.48318428", "text": "func (h *Hub) StatusPrinter() {\n\tt := time.NewTicker(time.Second * 10)\n\tfor range t.C {\n\t\th.Status()\n\t}\n}", "title": "" }, { "docid": "0bd3b8ba66fed4e9543d690b78b749dc", "score": "0.4831642", "text": "func TaskStatus(taskID model.TaskID, opID model.OperationID, teams []model.TeamID, status string, updateID string) error {\n\tif !config.IsFirebaseRunning() {\n\t\treturn nil\n\t}\n\tif !ratelimitOp(opID) {\n\t\treturn nil\n\t}\n\n\tdata := map[string]string{\n\t\t\"opID\": string(opID),\n\t\t\"taskID\": string(taskID),\n\t\t\"msg\": status,\n\t\t\"cmd\": \"Task Status Change\",\n\t\t\"srv\": config.Get().HTTP.Webroot,\n\t\t\"updateID\": updateID,\n\t}\n\n\tconditions := teamsToCondition(teams)\n\tmulticastFantoutMutex.Lock()\n\tdefer multicastFantoutMutex.Unlock()\n\tfor _, condition := range conditions {\n\t\tm := messaging.Message{\n\t\t\tCondition: condition,\n\t\t\tData: data,\n\t\t}\n\n\t\tif _, err := msg.Send(fbctx, &m); err != nil {\n\t\t\tlog.Error(err)\n\t\t\tif messaging.IsTooManyTopics(err) || messaging.IsMessageRateExceeded(err) {\n\t\t\t\tslowdown()\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "070b818ddb9bdc183e4cfa4cc92bfa62", "score": "0.48277923", "text": "func Status(r *http.Request, status int) {\n\trender.Status(r, status)\n}", "title": "" }, { "docid": "f71714b61a213e02a77d26d7580d1206", "score": "0.48165926", "text": "func (baseController *BaseController) ServeMessageWithStatus(status int, msg string) {\n\tbaseController.ServeMessagesWithStatus(status, []string{msg})\n}", "title": "" }, { "docid": "749230332853d5c1db547c52b94a51d0", "score": "0.4816511", "text": "func (this *Message) setStatus(data string) {\n\tthis.Status = data\n}", "title": "" }, { "docid": "749230332853d5c1db547c52b94a51d0", "score": "0.4816511", "text": "func (this *Message) setStatus(data string) {\n\tthis.Status = data\n}", "title": "" }, { "docid": "9637ddda94d8183cca098f85ca1cbc21", "score": "0.48046547", "text": "func (cl *cmtLogImpl) StatusString() string {\n\tvliLI, _ := cl.varLogIndex.Value()\n\treturn fmt.Sprintf(\"{cmtLogImpl, LogIndex=%v, output=%+v, %v, %v}\", vliLI, cl.outputProposed, cl.varLocalView.StatusString(), cl.varLogIndex.StatusString())\n}", "title": "" }, { "docid": "8a4c74508a26147eacf15b899e1bcffa", "score": "0.479325", "text": "func (g *Gossiper) sendMyStatus(sender *net.UDPAddr, numberToAsk int) {\n\tvar w []PeerStatus\n\n\tfor i := 0; i < len(g.rumor_state.vector_clock); i++ {\n\t\tw = append(w, PeerStatus{\n\t\t\tIdentifier: g.rumor_state.vector_clock[i].Identifier,\n\t\t\tNextID: g.rumor_state.vector_clock[i].NextID,\n\t\t})\n\t}\n\n\tnewPkt := GossipPacket{Status: &StatusPacket{\n\t\tWant: w,\n\t}}\n\n\tpktByte, err := protobuf.Encode(&newPkt)\n\tif err != nil {\n\t\tfmt.Println(\"Encode of the packet failed\")\n\t\tlog.Fatal(err)\n\t}\n\n\tmutex.Lock()\n\tg.conn.WriteToUDP(pktByte, sender)\n\tmutex.Unlock()\n\n}", "title": "" }, { "docid": "5941fe0a1a92f2985f3fa9e6e2fd0036", "score": "0.47792417", "text": "func (k *msgServer) MsgUpdateStatus(c context.Context, msg *types.MsgUpdateStatusRequest) (*types.MsgUpdateStatusResponse, error) {\n\tctx := sdk.UnwrapSDKContext(c)\n\n\t// Convert the `msg.From` address (in Bech32 format) to a `hubtypes.NodeAddress`.\n\tnodeAddr, err := hubtypes.NodeAddressFromBech32(msg.From)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get the node from the Store based on the provided node address.\n\tnode, found := k.GetNode(ctx, nodeAddr)\n\tif !found {\n\t\treturn nil, types.NewErrorNodeNotFound(nodeAddr)\n\t}\n\n\t// If the current status of the node is `Active`, handle the necessary updates for changing to `Inactive` status.\n\tif node.Status.Equal(hubtypes.StatusActive) {\n\t\tk.DeleteNodeForInactiveAt(ctx, node.InactiveAt, nodeAddr)\n\t\tif msg.Status.Equal(hubtypes.StatusInactive) {\n\t\t\tk.DeleteActiveNode(ctx, nodeAddr)\n\t\t}\n\t}\n\n\t// If the current status of the node is `Inactive`, handle the necessary updates for changing to `Active` status.\n\tif node.Status.Equal(hubtypes.StatusInactive) {\n\t\tif msg.Status.Equal(hubtypes.StatusActive) {\n\t\t\tk.DeleteInactiveNode(ctx, nodeAddr)\n\t\t}\n\t}\n\n\t// If the new status is `Active`, update the node's inactive time based on the active duration.\n\tif msg.Status.Equal(hubtypes.StatusActive) {\n\t\tnode.InactiveAt = ctx.BlockTime().Add(\n\t\t\tk.ActiveDuration(ctx),\n\t\t)\n\t\tk.SetNodeForInactiveAt(ctx, node.InactiveAt, nodeAddr)\n\t}\n\n\t// If the new status is `Inactive`, set the node's inactive time to zero.\n\tif msg.Status.Equal(hubtypes.StatusInactive) {\n\t\tnode.InactiveAt = time.Time{}\n\t}\n\n\t// Update the node's status and status timestamp.\n\tnode.Status = msg.Status\n\tnode.StatusAt = ctx.BlockTime()\n\n\t// Save the updated node in the Store.\n\tk.SetNode(ctx, node)\n\n\t// Emit an event to notify that the node status has been updated.\n\tctx.EventManager().EmitTypedEvent(\n\t\t&types.EventUpdateStatus{\n\t\t\tStatus: node.Status,\n\t\t\tAddress: node.Address,\n\t\t},\n\t)\n\n\treturn &types.MsgUpdateStatusResponse{}, nil\n}", "title": "" }, { "docid": "9802cf71bfb1fb46893a7e04b368d857", "score": "0.4777572", "text": "func ShowOpenChannelMsgDetail(Status string) {\n\tswitch Status {\n\tcase \"200 OK\":\n\t\tfallthrough\n\tcase \"201 Created\":\n\t\tlog.Println(\"Successful Creation channels\")\n\tcase \"400 Bad Request\":\n\t\tlog.Println(\"The provided json is in some way malformed\")\n\tcase \"408 Request Timeout\":\n\t\tlog.Println(\"The deposit event was not read in time by the ethereum node\")\n\tcase \"409 Conflict\":\n\t\tlog.Println(\"The input is invalid, such as too low a settle timeout\")\n\tcase \"500 Server Error\":\n\t\tlog.Println(\"Internal Raiden node error\")\n\tcase \"504 TimeOut\":\n\t\tlog.Println(\"No response,timeout\")\n\tdefault:\n\t\tlog.Println(\"Unknown error,OpenChannel:\", Status)\n\t}\n}", "title": "" } ]
2a2ff1b1120d85a19267f57048647f33
GetProfile returns the profile corresponding to the given address inside the current context. nolint: interfacer
[ { "docid": "c9b69370fec37ba2a9fe162e30e15363", "score": "0.7407206", "text": "func (k Keeper) GetProfile(ctx sdk.Context, address sdk.AccAddress) (profile types.Profile, found bool) {\n\tstore := ctx.KVStore(k.StoreKey)\n\tkey := types.ProfileStoreKey(address)\n\tif bz := store.Get(key); bz != nil {\n\t\tk.Cdc.MustUnmarshalBinaryBare(bz, &profile)\n\t\treturn profile, true\n\t}\n\n\treturn types.Profile{}, false\n}", "title": "" } ]
[ { "docid": "5f5347401b6b02310c64c58a5d755075", "score": "0.67334634", "text": "func GetProfile(w http.ResponseWriter, r *http.Request) {\n\tid := r.Header.Get(\"HackIllinois-Identity\")\n\n\tprofile_id, err := service.GetProfileIdFromUserId(id)\n\tif err != nil {\n\t\terrors.WriteError(w, r, errors.DatabaseError(err.Error(), \"Could not get profile id associated with the user\"))\n\t\treturn\n\t}\n\n\tuser_profile, err := service.GetProfile(profile_id)\n\tif err != nil {\n\t\terrors.WriteError(w, r, errors.DatabaseError(err.Error(), \"Could not get current user's profile.\"))\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(user_profile)\n}", "title": "" }, { "docid": "16a0ab041f30a1e3ad329d09c118f99c", "score": "0.6663825", "text": "func getProfile(name string) (*bagit.Profile, error) {\n\tfilename := path.Join(util.ProjectRoot(), \"profiles\", name)\n\treturn bagit.ProfileLoad(filename)\n}", "title": "" }, { "docid": "310490240c92fee0845b6acdacb8b53a", "score": "0.6600533", "text": "func GetProfile() (r *LineThrift.Profile, err error) {\r\n\tTS := service.TalkService()\r\n\tres, err := TS.GetProfile(context.TODO())\r\n\treturn res, err\r\n}", "title": "" }, { "docid": "8faedcb1018c20c7cc2c7b67e59ecfcb", "score": "0.6598323", "text": "func (c *Client) GetProfile(to string, alias string) (*message.Mail, error) {\n\treturn c.GetMessage(\"profile\", to, alias)\n}", "title": "" }, { "docid": "072cf7608a80474e17d863417b06ba6a", "score": "0.6518464", "text": "func (pse *PipestanceOverrides) GetProfile(node string, phase string, def ProfileMode) ProfileMode {\n\tif pse == nil {\n\t\treturn def\n\t}\n\tpqn := partiallyQualifiedName(node)\n\tfor pqn != \"\" {\n\t\tval := pse.overridesbystage[pqn].GetProfile(phase)\n\t\tif val == nil {\n\t\t\tpqn = getParent(pqn)\n\t\t} else {\n\t\t\tutil.LogInfo(\"overide\", \"At [%s.profile:%s] replace %s with %s\",\n\t\t\t\tphase, pqn, def, *val)\n\t\t\treturn *val\n\t\t}\n\t}\n\t// We didn't find any parent of node that existed and defined the key we're looking\n\t// for. Give and use the default value.\n\treturn def\n}", "title": "" }, { "docid": "3aa821726d9ada61ced6429e936d691b", "score": "0.64984", "text": "func getProfile(store btypes.KVStore, name string) (types.Profile, error) {\n\tbytes := store.Get(ProfileKey(name))\n\treturn GetProfileFromWire(bytes)\n}", "title": "" }, { "docid": "2414335cb00fab7e3d9f139f4ee4ae67", "score": "0.64930815", "text": "func (c Config) GetProfile(id string) (*Profile, error) {\n\tvar ret Profile\n\tfound := false\n\tscore := 0\n\tfor _, v := range c.Scopes {\n\t\tfor _, p := range v.Profiles {\n\t\t\ts := compareStrs(id, p.ID)\n\t\t\tif s > score {\n\t\t\t\tfound = true\n\t\t\t\tscore = s\n\t\t\t\tret = p\n\t\t\t}\n\t\t}\n\t}\n\tif !found {\n\t\treturn nil, errors.ErrProfileNotFound\n\t}\n\treturn &ret, nil\n}", "title": "" }, { "docid": "984afdbfbcfe42734ed37892c709a310", "score": "0.6491632", "text": "func (backend *ES2Backend) GetProfile(hash string) (reportingapi.Profile, error) {\n\tvar profile reportingapi.Profile\n\tclient, err := backend.ES2Client()\n\n\tif err != nil {\n\t\treturn profile, errors.Wrap(err, \"GetProfile, cannot connect to ElasticSearch\")\n\t}\n\n\tidsQuery := elastic.NewIdsQuery()\n\tidsQuery.Ids(hash)\n\n\tsearchSource := elastic.NewSearchSource().\n\t\tQuery(idsQuery).\n\t\tSize(1)\n\n\tsource, err := searchSource.Source()\n\tif err != nil {\n\t\treturn profile, errors.Wrap(err, \"GetProfile unable to get Source\")\n\t}\n\tLogQueryPartMin(CompProfilesIndex, source, \"GetProfile query searchSource\")\n\n\tsearchResult, err := client.Search().\n\t\tSearchSource(searchSource).\n\t\tIndex(CompProfilesIndex).\n\t\tDo(context.Background())\n\n\tif err != nil {\n\t\treturn profile, errors.Wrap(err, \"GetProfile unable to complete search\")\n\t}\n\n\tlogrus.Debugf(\"GetProfile got %d profiles in %d milliseconds\\n\", searchResult.TotalHits(), searchResult.TookInMillis)\n\n\t// This is too verbose even for debug logging. Keeping it off unless needed for troubleshooting\n\t// LogQueryPartMin(CompProfilesIndex, searchResult, \"GetProfile query results\")\n\n\t// we should only receive one value\n\tif searchResult.TotalHits() > 0 {\n\t\tfor _, hit := range searchResult.Hits.Hits {\n\t\t\tvar esProfile ESInspecProfile\n\t\t\tif hit.Source != nil {\n\t\t\t\terr := json.Unmarshal(hit.Source, &esProfile)\n\t\t\t\tif err == nil {\n\t\t\t\t\treturn esProfile.convertToInspecProfile()\n\t\t\t\t}\n\t\t\t\tlogrus.Errorf(\"Unmarshal error: %s\", err.Error())\n\t\t\t}\n\t\t}\n\t}\n\n\treturn profile, errorutils.ProcessNotFound(nil, profile.Name)\n}", "title": "" }, { "docid": "7f4b0ddd1097acb88f3bf8db07619f02", "score": "0.6489209", "text": "func (i Config) GetProfile() (string, error) {\n\n\terr := i.validateGetProfileConfig()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"invalid parameters for profile: %v\", err)\n\t}\n\n\thttpClient, err := i.httpClient()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error creating the HTTP Client: %v\", err)\n\t}\n\n\tc, err := ims.NewClient(&ims.ClientConfig{\n\t\tURL: i.URL,\n\t\tClient: httpClient,\n\t})\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error creating the client: %v\", err)\n\t}\n\n\tprofile, err := c.GetProfile(&ims.GetProfileRequest{\n\t\tAccessToken: i.AccessToken,\n\t\tApiVersion: i.ProfileApiVersion,\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(profile.Body), nil\n}", "title": "" }, { "docid": "84cacff8ea67d17728b6feeb8a28fa5a", "score": "0.64838684", "text": "func (k Keeper) Profile(ctx context.Context, request *types.QueryProfileRequest) (*types.QueryProfileResponse, error) {\n\tsdkCtx := sdk.UnwrapSDKContext(ctx)\n\n\tdTagOrAddress := request.User\n\tif strings.TrimSpace(dTagOrAddress) == \"\" {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, \"DTag or address cannot be empty or blank\")\n\t}\n\n\tsdkAddress, err := sdk.AccAddressFromBech32(dTagOrAddress)\n\tif err != nil {\n\t\taddr := k.GetAddressFromDTag(sdkCtx, dTagOrAddress)\n\t\tif addr == \"\" {\n\t\t\treturn nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest,\n\t\t\t\t\"No address related to this DTag: %s\", dTagOrAddress)\n\t\t}\n\n\t\tsdkAddress, err = sdk.AccAddressFromBech32(addr)\n\t\tif err != nil {\n\t\t\treturn nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, addr)\n\t\t}\n\t}\n\n\taccount, found, err := k.GetProfile(sdkCtx, sdkAddress.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !found {\n\t\treturn &types.QueryProfileResponse{Profile: nil}, nil\n\t}\n\n\taccountAny, err := codectypes.NewAnyWithValue(account)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &types.QueryProfileResponse{Profile: accountAny}, nil\n}", "title": "" }, { "docid": "39aaab78fc1681f898e9ea33b403e914", "score": "0.64288867", "text": "func (s *ProfileServer) GetProfile(ctx context.Context, req *pb.ProfileRequest) (*pb.ProfileReply, error) {\n\n\treply := &pb.ProfileReply{\n\t\tId: \"hamster\",\n\t\tEmail: \"hamster\",\n\t}\n\n\treturn reply, nil\n}", "title": "" }, { "docid": "0f4c3bc2fe290679dc5bcf8d456536a3", "score": "0.63668543", "text": "func GetProfile(writer http.ResponseWriter, request *http.Request) {\n\tparams := request.URL.Query()\n\temail := params.Get(\":email\")\n\tif storageMap[email].Emailid == email {\n\t\tperson, err := json.Marshal(storageMap[email])\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t\twriter.Write([]byte(err.Error()))\n\t\t} else {\n\t\t\twriter.WriteHeader(http.StatusOK)\n\t\t\twriter.Write(person)\n\t\t}\n\t} else {\n\t\tlog.Println(\"Person not found...\")\n\t}\n}", "title": "" }, { "docid": "335c583b9aeb5d05dcf6d8176c452596", "score": "0.6366767", "text": "func GetProfile(c *gin.Context) {\n\tc.JSON(http.StatusNotImplemented, gin.H{\"error\": \"Not implemented.\"})\n}", "title": "" }, { "docid": "e0e43789517d1d6de5018774242a77ae", "score": "0.6362543", "text": "func (server *Server) GetProfile(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\tuid, err := strconv.ParseUint(vars[\"idProfile\"], 10, 32)\n\tif err != nil {\n\t\tutils.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tprofile := models.Profile{}\n\tprofGotten, err := profile.FindProfileByID(server.DB, uint32(uid))\n\tif err != nil {\n\t\tutils.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\t//VALID INFO OF THE PROFILE\n\terr2 := models.Error{}\n\terr2.NoError()\n\tutils.ResponseJSON(w, http.StatusOK, `Usuario encontrado`, profGotten, err2)\n}", "title": "" }, { "docid": "d29ceb6a7effd275916b9d45bd3c8725", "score": "0.6304782", "text": "func (c *Client) GetProfile(ctx context.Context, profileID string) (Profile, error) {\n\tvar profile Profile\n\treturn profile, c.api.Get(ctx, fmt.Sprintf(\"/profiles/%s\", profileID), &profile)\n}", "title": "" }, { "docid": "8bf28a80b6a6594bca4ceedb7d8c4cff", "score": "0.6293009", "text": "func GetProfile(accountID uint) *Profile {\n\tprofile := &Profile{}\n\t//checks if its a userprofile\n\tGetDB().Table(\"userprofile\").Where(\"accountID = ?\", accountID).First(profile)\n\tif profile.ProfileID == 0 { //userprofile not found\n\t\t//checks if its a courierprofile\n\t\tGetDB().Table(\"courierprofile\").Where(\"accountID = ?\", accountID).First(profile)\n\t\tif profile.ProfileID == 0 {\n\t\t\treturn nil //user not found\n\t\t}\n\t\tprofile.AccountType = \"courier\"\n\n\t} else {\n\t\tprofile.AccountType = \"user\"\n\t}\n\n\treturn profile\n}", "title": "" }, { "docid": "800cda5a1a8b3f6fad5fa801cf067de8", "score": "0.6277074", "text": "func GetProfile(c *gin.Context) {\n\tdb := InitDb()\n\tdefer db.Close()\n\n\tvar user models.User\n\t// var profile models.Profile\n\ttoken := c.Request.Header.Get(\"token\")\n\n\tif err := db.Where(\"token = ?\", token).Find(&user).Error; err != nil {\n\t\tc.AbortWithStatus(404)\n\t\tfmt.Println(err)\n\t} else {\n\t\tdata := template.Profile(&user)\n\t\tc.JSON(200, data)\n\t}\n}", "title": "" }, { "docid": "a5c2ab7d1ccca04497ee6ce1d9fafa6f", "score": "0.6263659", "text": "func (t *tx) GetProfile() (*models.Profile, error) {\n\tfor x := len(t.commitCache) - 1; x >= 0; x-- {\n\t\tprofile, ok := t.commitCache[x].(*models.Profile)\n\t\tif ok {\n\t\t\treturn profile, nil\n\t\t}\n\t}\n\treturn t.ffdb.GetProfile()\n}", "title": "" }, { "docid": "3638ad16a1d3e965867ce0e3a5132cb6", "score": "0.62506795", "text": "func (c *CLIConf) GetProfile() (*profile.Profile, error) {\n\tstore, err := initClientStore(c, c.Proxy)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tprofileName, err := client.ProfileNameFromProxyAddress(store, c.Proxy)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tprofile, err := store.GetProfile(profileName)\n\treturn profile, trace.Wrap(err)\n}", "title": "" }, { "docid": "1ac22a78709a237effd14caaed4acf69", "score": "0.62431216", "text": "func readProfile(profile string) p2p.Peer {\n\tfmt.Printf(\"Using %s profile for backend\\n\", profile)\n\tvar err error\n\tbackendProfile, err = utils.ReadBackendProfile(defaultConfigFile, profile)\n\tif err != nil {\n\t\tfmt.Printf(\"Read backend profile error: %v\\nExiting ...\\n\", err)\n\t\tos.Exit(2)\n\t}\n\n\treturn backendProfile.RPCLeader[0]\n}", "title": "" }, { "docid": "ef34da7fc72fc40adb290eec0a824dd8", "score": "0.62207174", "text": "func (c *Client) GetProfile(symbol string) (*finnhub.Company, error) {\n\tvar company finnhub.Company\n\terr := c.API.Get(URLProfile, finnhub.URLParams{finnhub.ParamSymbol: symbol}, &company)\n\treturn &company, err\n}", "title": "" }, { "docid": "351bb19c402b8a0dd05e31c5927149f5", "score": "0.6208841", "text": "func (store Store) GetProfile(id int64) (Profile, error) {\n\tvar p profileData\n\terr := store.db.View(func(tx *bolt.Tx) error {\n\t\tv := tx.Bucket(bucket.Profiles).Get(itob(id))\n\t\tif v == nil {\n\t\t\treturn ErrNotFound\n\t\t}\n\t\treturn gob.NewDecoder(bytes.NewReader(v)).Decode(&p)\n\t})\n\tif err != nil {\n\t\tif err == ErrNotFound {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to get profile for id %d: %v\", id, err)\n\t}\n\t// Check if expired\n\tif time.Now().Sub(p.CacheTime) > profileMaxCacheTime {\n\t\treturn nil, ErrNotFound\n\t}\n\treturn profile{p}, nil\n}", "title": "" }, { "docid": "0e05fd7f34b1a18759ead1a4d02f5513", "score": "0.61671335", "text": "func (H *AutocompleteHTTPHandler) GetProfile(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tdata, err := H.service.GetProfile(r.Context())\n\tif err != nil {\n\t\thttputil.ResponseError(\"couldn't get profile\", http.StatusInternalServerError, w)\n\t\treturn\n\t}\n\n\tresponse := ProfileResponse{\n\t\tHeader: Header{\n\t\t\tTotalData: data.TotalData,\n\t\t},\n\t\tData: data.Profile,\n\t}\n\n\thttputil.ResponseJSON(response, http.StatusOK, w)\n}", "title": "" }, { "docid": "d58946b56c0bdb0af2c49be4be300180", "score": "0.6164616", "text": "func (c *MockAPIClient) GetProfile(ctx context.Context, _ *destinationPb.GetDestination, _ ...grpc.CallOption) (destinationPb.Destination_GetProfileClient, error) {\n\t// Not implemented through this client. The proxies use the gRPC server directly instead.\n\treturn nil, errors.New(\"Not implemented\")\n}", "title": "" }, { "docid": "486f3c065a64e028dea4d84417ffa078", "score": "0.6150744", "text": "func (u *User) GetProfile() string {\n\treturn u.HtmlUrl\n}", "title": "" }, { "docid": "3e00c446e7a496cdd4991d2b1ba5aaef", "score": "0.61327183", "text": "func (p *ProfileUsecase) GetDetailProfile(ctx context.Context, email string) (*model.ResponseGetProfile, *utils.Error) {\n\tif email == \"\" || &email == nil {\n\t\terr := errors.New(\"email can't be empty\")\n\t\treturn nil, utils.WrapErrorJson(err, fasthttp.StatusBadRequest)\n\t}\n\n\tprofile, err := p.ProfileRepo.FindByEmail(ctx, email)\n\tif err != nil {\n\t\treturn nil, utils.WrapErrorJson(err, fasthttp.StatusOK)\n\t}\n\n\tresponse := &model.ResponseGetProfile{\n\t\tStatusCode: 200,\n\t\tStatus: true,\n\t\tResult: profile,\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "150d95a768520ec60b80662ff750d07d", "score": "0.61141074", "text": "func (t *SimpleChaincode) readProfile(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar name, jsonResp string\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the profile to query\")\n\t}\n\n\tname = args[0]\n\tvalAsbytes, err := stub.GetState(name) //get the profile from chaincode state\n\tif err != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + name + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t} else if valAsbytes == nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Profile does not exist: \" + name + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\treturn shim.Success(valAsbytes)\n}", "title": "" }, { "docid": "170aa2b8d926136f86fe44272773f22b", "score": "0.61058134", "text": "func GetAddress(addr string) *model.Address {\n\tdefer util.TimeTrack(time.Now(), \"GetAddress\", \"mysqlprofile\")\n\taddrMatch := qm.Where(model.AddressColumns.Address+\"=?\", addr)\n\n\tif model.Addresses(addrMatch).ExistsGP() {\n\n\t\taddress, err := model.Addresses(addrMatch).OneG()\n\t\tif err != nil {\n\t\t\tlogrus.Error(\"Datastore(GETADDRESS): \", err)\n\t\t}\n\t\treturn address\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2d07eec2fd4b490fbf496457dd716491", "score": "0.6088654", "text": "func GetProfile(profile_id string) (*models.Profile, error) {\n\tquery := database.QuerySelector{\n\t\t\"id\": profile_id,\n\t}\n\n\tvar profile models.Profile\n\terr := db.FindOne(\"profiles\", query, &profile, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &profile, nil\n}", "title": "" }, { "docid": "da06a3d361742636efd6daf8debcbb88", "score": "0.6077705", "text": "func (u *User) Profile() interface{} {\n\turl := GetApiBaseURL() + \"/user/\"\n\treturn u.c.execute(\"GET\", url, \"\")\n}", "title": "" }, { "docid": "6a706346a713a92879b4fb115d61de8c", "score": "0.60520864", "text": "func (db *firestoreDB) GetProfile(\n\tctx context.Context,\n\tuserId string,\n) (*datastore.Profile, error) {\n\tdoc := db.client.Collection(\"Profiles\").Doc(userId)\n\tprofile := &datastore.Profile{}\n\tdocSnap, err := doc.Get(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"datastoredb: could not get Profile: %v\",\n\t\t\terr,\n\t\t)\n\t}\n\tif err := docSnap.DataTo(profile); err != nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"datastoredb: could not populate Profile: %v\",\n\t\t\terr,\n\t\t)\n\t}\n\treturn profile, nil\n}", "title": "" }, { "docid": "e4bc2b5a7be584da35ac8e96974ed422", "score": "0.6026881", "text": "func GetProfile(c *gin.Context) {\n\tauthHeader := c.Request.Header.Get(\"Authorization\")\n\ttokenString := strings.Replace(authHeader, \"Bearer \", \"\", -1)\n\textractedData, failed := ExtractJWT(tokenString)\n\tif failed == false {\n\t\tc.JSON(http.StatusUnauthorized, util.FailResponse(http.StatusUnauthorized, \"Invalid token\"))\n\t\treturn\n\t}\n\tvar user model.UserJSON\n\tctx, _ := context.WithTimeout(context.TODO(), 5*time.Second)\n\terr := userCollection.FindOne(ctx, bson.M{\"email\": extractedData[\"email\"]}).Decode(&user)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, util.FailResponse(http.StatusBadRequest, \"User not found\"))\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, util.SuccessResponse(http.StatusOK, \"Success\", user))\n\n}", "title": "" }, { "docid": "55a1fad9eec863ca5104164606498231", "score": "0.60124797", "text": "func (d *EKSProfile) GetProfile() *pkgCluster.ClusterProfileResponse {\n\n\tnodePools := make(map[string]*amazon.NodePool)\n\tfor _, np := range d.NodePools {\n\t\tif np != nil {\n\t\t\tnodePools[np.NodeName] = &amazon.NodePool{\n\t\t\t\tInstanceType: np.InstanceType,\n\t\t\t\tSpotPrice: np.SpotPrice,\n\t\t\t\tAutoscaling: np.Autoscaling,\n\t\t\t\tMinCount: np.MinCount,\n\t\t\t\tMaxCount: np.MaxCount,\n\t\t\t\tCount: np.Count,\n\t\t\t\tImage: np.Image,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &pkgCluster.ClusterProfileResponse{\n\t\tName: d.DefaultModel.Name,\n\t\tLocation: d.Region,\n\t\tCloud: pkgCluster.Amazon,\n\t\tProperties: struct {\n\t\t\tAmazon *amazon.ClusterProfileAmazon `json:\"amazon,omitempty\"`\n\t\t\tAzure *azure.ClusterProfileAzure `json:\"azure,omitempty\"`\n\t\t\tEks *eks.ClusterProfileEks `json:\"eks,omitempty\"`\n\t\t\tGoogle *google.ClusterProfileGoogle `json:\"google,omitempty\"`\n\t\t\tOracle *oracle.Cluster `json:\"oracle,omitempty\"`\n\t\t}{\n\t\t\tEks: &eks.ClusterProfileEks{\n\t\t\t\tVersion: d.Version,\n\t\t\t},\n\t\t},\n\t}\n\n}", "title": "" }, { "docid": "ebd44c4fa1a2a11ceac56dc3000da71d", "score": "0.6000968", "text": "func GetProfileSection (profile string) (*ini.Section, error) {\n section, err := config.GetSection(fmt.Sprintf(\"profile %s\", profile))\n return section, err\n}", "title": "" }, { "docid": "8342fbd0df83a29e5babe9f0338ef116", "score": "0.5999233", "text": "func (h *Handler) GetProfile(rw http.ResponseWriter, r *http.Request) {\n\tconst place = \"GetProfile\"\n\n\tvar (\n\t\terr error\n\t\tnickname string\n\t\tuser models.User\n\t)\n\n\trw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tif nickname, err = getNickname(r); err != nil {\n\t\trw.WriteHeader(http.StatusBadRequest)\n\t\tsendErrorJSON(rw, err, place)\n\t\tprintResult(err, http.StatusBadRequest, place)\n\t\treturn\n\t}\n\n\tif user, err = h.DB.GetUser(nickname); err != nil {\n\t\trw.WriteHeader(http.StatusNotFound)\n\t\tsendErrorJSON(rw, err, place)\n\t\tprintResult(err, http.StatusBadRequest, place)\n\t\treturn\n\t}\n\n\tsendSuccessJSON(rw, user, place)\n\tprintResult(err, http.StatusOK, place)\n\treturn\n}", "title": "" }, { "docid": "9349ceeca5bfe6dda58e27585c188a06", "score": "0.5994147", "text": "func (c *awsConfigManager) GetProfile(p *string) (*AWSProfile, error) {\n\tcfg := new(config.AwsConfig)\n\topts := &config.ConfigHandlerOpts{LogLevel: c.opts.LogLevel}\n\tvar ch config.ConfigHandler\n\n\tif p == nil || len(*p) < 1 {\n\t\tch = config.NewEnvConfigHandler(opts)\n\t\tif err := ch.Config(cfg); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\t// must set cfg.Name here, for config file lookups to behave as expected\n\t\t// we know it's not nil or empty in here\n\t\tcfg.Name = *p\n\t\tch = config.DefaultConfigHandler(opts)\n\t\tif err := ch.Config(cfg); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tprofile := new(AWSProfile)\n\n\tif len(cfg.RoleArn) > 0 {\n\t\t// Validate that RoleArn is a correctly formatted ARN\n\t\ta, err := arn.Parse(cfg.RoleArn)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Validate that RoleArn is an IAM ARN\n\t\tif !strings.HasPrefix(a.String(), IAM_ARN) {\n\t\t\treturn nil, fmt.Errorf(\"role ARN format error, does not start with %s\", IAM_ARN)\n\t\t}\n\n\t\t// The source_profile config is required (and only valid) with role_arn\n\t\t// Ensure that it exists, and is valid\n\t\tif len(cfg.SourceProfile) < 1 {\n\t\t\treturn nil, fmt.Errorf(\"role_arn configured, but missing required source_profile\")\n\t\t}\n\n\t\tprofile.RoleArn = a\n\t\tprofile.SourceProfile = cfg.SourceProfile\n\t\tprofile.ExternalId = cfg.ExternalId\n\t\tprofile.RoleSessionName = cfg.RoleSessionName\n\t}\n\n\tprofile.Region = cfg.GetRegion()\n\tprofile.MfaSerial = cfg.GetMfaSerial()\n\n\tcd := cfg.GetCredDuration()\n\tif cd < 1 {\n\t\tcd = ASSUME_ROLE_DEFAULT_DURATION\n\t}\n\tprofile.CredDuration = cd\n\n\tsd := cfg.GetSessionDuration()\n\tif sd < 1 {\n\t\tsd = SESSION_TOKEN_DEFAULT_DURATION\n\t}\n\tprofile.SessionDuration = sd\n\tprofile.Name = cfg.Name\n\n\treturn profile, nil\n}", "title": "" }, { "docid": "b9fb8a7855cea58cfac6935e0278d2a0", "score": "0.5981775", "text": "func (uh *UserHTTPHandler) GetProfile(res http.ResponseWriter, req *http.Request) {\n\tvar bearer authModel.BearerClaims\n\tdecoded := ctx.Get(req, \"decoded\")\n\n\tmapstructure.Decode(decoded.(*authModel.BearerClaims), &bearer)\n\n\tdata := uh.userDomain.GetByID(bearer.Subject)\n\twrapper.Response(res, data.Code, data, \"user's profile\")\n}", "title": "" }, { "docid": "2a348d1555f767d6857e0ef560845c04", "score": "0.5976311", "text": "func GetProfile(w http.ResponseWriter, r *http.Request) {\n\tidAsString := mux.Vars(r)[\"id\"]\n\tid, converted := strconv.Atoi(idAsString)\n\tif converted != nil {\n\t\tlog.Printf(\"%v\", converted)\n\t}\n\tvar requestedUser user.User\n\tu := &requestedUser\n\tu.ID = uint(id)\n\trecord := u.GetProfile()\n\tprofileJSON, JSONErr := json.Marshal(record)\n\tif JSONErr != nil {\n\t\tlog.Printf(\"%v\", JSONErr)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(profileJSON)\n}", "title": "" }, { "docid": "04271fe03fac17c0a7e8d77ee8fe0c6a", "score": "0.5965889", "text": "func (c *Profile) GetProfile(name string) (*IssuerProfile, error) {\n\tbytes, err := c.store.Get(getDBKey(issuerMode, name))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &IssuerProfile{}\n\n\terr = json.Unmarshal(bytes, response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "fceae0d956e42ca29f7c224f4f14aa38", "score": "0.5965517", "text": "func (o ProviderOutput) Profile() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.Profile }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8ac83b24142d4ee1a112c3608bd3bb95", "score": "0.59627265", "text": "func (u *User) Profile() (interface{}, error) {\n\turlStr := GetApiBaseURL() + \"/user/\"\n\treturn u.c.execute(\"GET\", urlStr, \"\")\n}", "title": "" }, { "docid": "8ac83b24142d4ee1a112c3608bd3bb95", "score": "0.59627265", "text": "func (u *User) Profile() (interface{}, error) {\n\turlStr := GetApiBaseURL() + \"/user/\"\n\treturn u.c.execute(\"GET\", urlStr, \"\")\n}", "title": "" }, { "docid": "bea33eba585abc045329080d2eabf3b9", "score": "0.59369254", "text": "func GetRoutingProfile(ctx context.Context, db sqlx.Queryer, id uuid.UUID) (RoutingProfile, error) {\n\tvar rp RoutingProfile\n\terr := sqlx.Get(db, &rp, \"select * from routing_profile where routing_profile_id = $1\", id)\n\tif err != nil {\n\t\treturn rp, handlePSQLError(err, \"select error\")\n\t}\n\n\treturn rp, nil\n}", "title": "" }, { "docid": "c7ff62a9e8f136d7335f27ac802cfbe2", "score": "0.5934829", "text": "func (c *Client) GetProfile(ctx context.Context, opts GetProfileOptions) (Profile, error) {\n\tc.once.Do(c.init)\n\n\tform := make(url.Values, 5)\n\tform.Set(\"client_id\", c.ProjectID)\n\tform.Set(\"client_secret\", c.APIKey)\n\tform.Set(\"grant_type\", \"authorization_code\")\n\tform.Set(\"code\", opts.Code)\n\n\treq, err := http.NewRequest(\n\t\thttp.MethodPost,\n\t\tc.Endpoint+\"/sso/token\",\n\t\tstrings.NewReader(form.Encode()),\n\t)\n\tif err != nil {\n\t\treturn Profile{}, err\n\t}\n\treq = req.WithContext(ctx)\n\treq.Header.Set(\"User-Agent\", \"workos-go/\"+workos.Version)\n\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tres, err := c.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn Profile{}, err\n\t}\n\tdefer res.Body.Close()\n\n\tif err = workos.TryGetHTTPError(res); err != nil {\n\t\treturn Profile{}, err\n\t}\n\n\tvar body struct {\n\t\tProfile Profile `json:\"profile\"`\n\t\tAccessToken string `json:\"access_token\"`\n\t}\n\tdec := json.NewDecoder(res.Body)\n\terr = dec.Decode(&body)\n\n\treturn body.Profile, err\n}", "title": "" }, { "docid": "f2535c020fafa03c1ad05aeab47024d6", "score": "0.5903562", "text": "func (m *Device) GetProfileType()(*string) {\n return m.profileType\n}", "title": "" }, { "docid": "5ea77ae3086ed2f702fc506c4ed59663", "score": "0.5898907", "text": "func (h *AccountController) GetProfile(c echo.Context) error {\n\tuser := GetCurrentUser(c)\n\tprofile, err := accountService.GetProfile(user.Username)\n\tif err != nil {\n\t\treturn NotFoundError(c, \"Profile not exists\", nil)\n\t}\n\n\treturn c.JSON(http.StatusOK, profile)\n}", "title": "" }, { "docid": "31b0b368a2832aef48073be223c926ff", "score": "0.5894564", "text": "func (s *Server) Profile(ctx context.Context, req *pb.RequestUserProfile) (*pb.ResposneUser, error) {\n\tif len(req.GetUsername()) == 0 {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"Username should not be empty\")\n\t}\n\n\tuser, err := s.userStore.Profile(ctx, req.GetUsername())\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"Error to fetch user profile: %v\", err)\n\t}\n\n\treturn &pb.ResposneUser{User: user}, nil\n}", "title": "" }, { "docid": "ef7ebdeb706406f84900c7cb210901e8", "score": "0.5850944", "text": "func GetCourierProfile(profileID uint) *Profile {\n\tprofile := &Profile{}\n\t//checks if its a userprofile\n\terr := GetDB().Table(\"courierprofile\").Where(\"profileid= ?\", profileID).First(profile).Error\n\tif err != nil { //courierprofile not found\n\t\treturn nil\n\t}\n\treturn profile\n}", "title": "" }, { "docid": "e35f608b4a2a8ade3a72de0ba8232fd2", "score": "0.5834576", "text": "func (cawClient *CawClient) GetProfile(username string) bool {\n\tprofileRequest := caw.ProfileRequest{\n\t\tUsername: username,\n\t}\n\tanyRequest, errPacking := ptypes.MarshalAny(proto.Message(&profileRequest))\n\tif errPacking != nil {\n\t\tfmt.Println(errPacking.Error())\n\t\treturn false\n\t}\n\tvar anyResponse = new(any.Any)\n\tprofileSuccessBool := cawClient.client_.Event(anyRequest, anyResponse,\n\t\t\t\t\t\t\t\t\t\t\tcawClient.functionToEventType_[\"profile\"])\n\tif profileSuccessBool {\n\t\tvar profileResponse = new(caw.ProfileReply)\n\t\terrUnpacking := ptypes.UnmarshalAny(anyResponse, profileResponse)\n\t\tif errUnpacking != nil {\n\t\t\tfmt.Println(errUnpacking.Error())\n\t\t\treturn false\n\t\t} else {\n\t\t\tfmt.Println(\"We have retrieved the profile!\")\n\t\t\tfmt.Println(\"Here's your information: \")\n\t\t\tfmt.Println(\"Here are user's followers: \")\n\t\t\tfollowers := profileResponse.Followers\n\t\t\tfor _, follower := range followers {\n\t\t\t\tfmt.Printf(\"\\t %s \\n\", follower)\n\t\t\t}\n\t\t\tfmt.Println(\"Here are the user's following: \")\n\t\t\tfollowing := profileResponse.Following\n\t\t\tfor _, user := range following {\n\t\t\t\tfmt.Printf(\"\\t %s \\n\", user)\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t} else {\n\t\terrProfile := fmt.Errorf(\"There was an error in getting user profile\")\n\t\tfmt.Println(errProfile.Error())\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "2ad334d09be5c280afcca2f1eb83b41e", "score": "0.58265674", "text": "func (b *Backend) Profile() (*profile, error) {\n\tblob, err := b.database.Get(dbProfileKey, nil)\n\tif err != nil {\n\t\treturn nil, ErrProfileNotFound\n\t}\n\tprof := new(profile)\n\tif err := json.Unmarshal(blob, prof); err != nil {\n\t\treturn nil, err\n\t}\n\treturn prof, nil\n}", "title": "" }, { "docid": "8d5cfe2e8abdcac965a5aac0954aef47", "score": "0.5822425", "text": "func GetProfileInformation() models.Profile {\n\n\tuserID := home.GetUserIdentification()\n\tfmt.Println(\"this is userID in api/profile--\", userID)\n\tprofile := models.FindProfile(userID)\n\t//profileData := models.NewProfile(0, userID, 0, 0, \"\", \"\", \"\", \"\", \"\")\n\treturn profile\n}", "title": "" }, { "docid": "9e3d74b9e0edae7bf1b966c2fb43cdca", "score": "0.58059734", "text": "func GetUserProfile(profileID uint) *Profile {\n\tprofile := &Profile{}\n\t//checks if its a userprofile\n\terr := GetDB().Table(\"userprofile\").Where(\"profileID = ?\", profileID).First(profile).Error\n\tif err != nil { //userprofile not found\n\t\treturn nil\n\t}\n\treturn profile\n}", "title": "" }, { "docid": "2164f68a870e554250b5a9d89899b44c", "score": "0.5798831", "text": "func (api *API) getProfileHandler() service.Handler {\n\treturn func(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\t\tname := mux.Vars(r)[\"name\"]\n\t\tw.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\t\tdebug := service.FormInt(r, \"debug\")\n\t\tp := pprof.Lookup(name)\n\t\tif p == nil {\n\t\t\tw.WriteHeader(404)\n\t\t\tfmt.Fprintf(w, \"Unknown profile: %s\\n\", name)\n\t\t\treturn nil\n\t\t}\n\t\tgc := service.FormInt(r, \"gc\")\n\t\tif name == \"heap\" && gc > 0 {\n\t\t\truntime.GC()\n\t\t}\n\t\tp.WriteTo(w, debug)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "6a2a9cd3f431ef603e5d6bf9de2cd3e2", "score": "0.5764029", "text": "func (n Network) Profile(ctx context.Context, campaignID uint64) (networktypes.Profile, error) {\n\taddress, err := n.account.Address(networktypes.SPN)\n\tif err != nil {\n\t\treturn networktypes.Profile{}, err\n\t}\n\n\t// fetch vouchers held by the account\n\tcoins, err := n.Balances(ctx, address)\n\tif err != nil {\n\t\treturn networktypes.Profile{}, err\n\t}\n\tvouchers := sdk.NewCoins()\n\tfor _, coin := range coins {\n\t\t// parse the coin to filter all non-voucher coins from the balance\n\t\t_, err := campaigntypes.VoucherCampaign(coin.Denom)\n\t\tif err == nil {\n\t\t\tvouchers = append(vouchers, coin)\n\t\t}\n\t}\n\tvouchers = vouchers.Sort()\n\n\tvar shares campaigntypes.Shares\n\n\t// if a campaign ID is specified, fetches the shares of the campaign\n\tif campaignID > 0 {\n\t\tacc, err := n.MainnetAccount(ctx, campaignID, address)\n\t\tif err != nil && err != ErrObjectNotFound {\n\t\t\treturn networktypes.Profile{}, err\n\t\t}\n\t\tshares = acc.Shares\n\t}\n\n\tvar p networktypes.ProfileAcc\n\tp, err = n.Validator(ctx, address)\n\tif errors.Is(err, ErrObjectNotFound) {\n\t\tp, err = n.Coordinator(ctx, address)\n\t\tif errors.Is(err, ErrObjectNotFound) {\n\t\t\tp = networktypes.Coordinator{Address: address}\n\t\t} else if err != nil {\n\t\t\treturn networktypes.Profile{}, err\n\t\t}\n\t} else if err != nil {\n\t\treturn networktypes.Profile{}, err\n\t}\n\treturn p.ToProfile(campaignID, vouchers, shares), nil\n}", "title": "" }, { "docid": "7116b6ceea2732a2c61e462a8e125af0", "score": "0.5760042", "text": "func GetProfilePath(profileName, namespace, subdir string) (string, error) {\n\tif filepath.Ext(profileName) != extJSON {\n\t\tprofileName += extJSON\n\t}\n\treturn path.Join(\n\t\tconfig.ProfilesRootPath,\n\t\tfilepath.Base(namespace),\n\t\tfilepath.Base(subdir),\n\t\tfilepath.Base(profileName),\n\t), nil\n}", "title": "" }, { "docid": "572242de381ca77756b4cdbaae4bed72", "score": "0.57599604", "text": "func (ctx *Skinsystem) getProfile(request *http.Request, proxy bool) (*profile, error) {\n\tusername := parseUsername(mux.Vars(request)[\"username\"])\n\n\tskin, err := ctx.SkinsRepo.FindSkinByUsername(username)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprofile := &profile{\n\t\tId: \"\",\n\t\tUsername: \"\",\n\t\tTextures: &mojang.TexturesResponse{}, // Field must be initialized to avoid \"null\" after json encoding\n\t\tCapeFile: nil,\n\t\tMojangTextures: \"\",\n\t\tMojangSignature: \"\",\n\t}\n\n\tif skin != nil {\n\t\tprofile.Id = strings.Replace(skin.Uuid, \"-\", \"\", -1)\n\t\tprofile.Username = skin.Username\n\t}\n\n\tif skin != nil && skin.SkinId != 0 {\n\t\tprofile.Textures.Skin = &mojang.SkinTexturesResponse{\n\t\t\tUrl: skin.Url,\n\t\t}\n\n\t\tif skin.IsSlim {\n\t\t\tprofile.Textures.Skin.Metadata = &mojang.SkinTexturesMetadata{\n\t\t\t\tModel: \"slim\",\n\t\t\t}\n\t\t}\n\n\t\tcape, _ := ctx.CapesRepo.FindCapeByUsername(username)\n\t\tif cape != nil {\n\t\t\tprofile.CapeFile = cape.File\n\t\t\tprofile.Textures.Cape = &mojang.CapeTexturesResponse{\n\t\t\t\t// Use statically http since the application doesn't support TLS\n\t\t\t\tUrl: \"http://\" + request.Host + \"/cloaks/\" + username,\n\t\t\t}\n\t\t}\n\n\t\tprofile.MojangTextures = skin.MojangTextures\n\t\tprofile.MojangSignature = skin.MojangSignature\n\t} else if proxy {\n\t\tmojangProfile, err := ctx.MojangTexturesProvider.GetForUsername(username)\n\t\t// If we at least know something about a user,\n\t\t// than we can ignore an error and return profile without textures\n\t\tif err != nil && profile.Id != \"\" {\n\t\t\treturn profile, nil\n\t\t}\n\n\t\tif err != nil || mojangProfile == nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdecodedTextures, err := mojangProfile.DecodeTextures()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// There might be no textures property\n\t\tif decodedTextures != nil {\n\t\t\tprofile.Textures = decodedTextures.Textures\n\t\t}\n\n\t\tvar texturesProp *mojang.Property\n\t\tfor _, prop := range mojangProfile.Props {\n\t\t\tif prop.Name == \"textures\" {\n\t\t\t\ttexturesProp = prop\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif texturesProp != nil {\n\t\t\tprofile.MojangTextures = texturesProp.Value\n\t\t\tprofile.MojangSignature = texturesProp.Signature\n\t\t}\n\n\t\t// If user id is unknown at this point, then use values from Mojang profile\n\t\tif profile.Id == \"\" {\n\t\t\tprofile.Id = mojangProfile.Id\n\t\t\tprofile.Username = mojangProfile.Name\n\t\t}\n\t} else {\n\t\treturn nil, nil\n\t}\n\n\treturn profile, nil\n}", "title": "" }, { "docid": "b6d6ff332606ad97a3da28850fef1622", "score": "0.571885", "text": "func (c *Cursor) Profile() interface{} {\n\tif c == nil {\n\t\treturn nil\n\t}\n\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\n\treturn c.profile\n}", "title": "" }, { "docid": "303a9395174a3d8938dd687a3032237e", "score": "0.5713221", "text": "func (c *Client) GetProfile() (Profile, error) {\n\tvar result Profile\n\n\tresp, err := c.httpClient.R().\n\t\tGet(userEndpoint + \"/me\")\n\n\tif err != nil {\n\t\treturn result, err\n\t}\n\terr = json.Unmarshal([]byte(resp.Body()), &result)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\tif result.Mail == \"\" {\n\t\treturn result, errors.New(\"invalid token\")\n\t}\n\n\tzap.S().Info(\"Fetched Microsoft profile...\")\n\treturn result, nil\n}", "title": "" }, { "docid": "205e9d25a95b7111a5be69955fd05cdc", "score": "0.5700429", "text": "func (c *Client) UserProfileByAddress(addr string) (*UserProfile, error) {\n\tuserProfile := new(UserProfile)\n\tuser := new(User)\n\terr := c.Model(user).Where(\"address = ?\", addr).Select()\n\tif err == pg.ErrNoRows {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn userProfile, err\n\t}\n\n\tuserProfile = &UserProfile{\n\t\tFullName: user.FullName,\n\t\tBio: user.Bio,\n\t\tAvatarURL: user.AvatarURL,\n\t\tUsername: user.Username,\n\t}\n\n\treturn userProfile, nil\n}", "title": "" }, { "docid": "e339c488618cdaa2a59b5fec70352537", "score": "0.5687728", "text": "func (nc *Nc) GetProfileNumber(str string) float64 {\n\tvar value float64\n\tvar err error\n\n\tfmt.Fprintln(debug, \"GetProfileNumber():\\n------------------\")\n\treg := fmt.Sprintf(\"%s(\\\\d{%d})\", cfg.Ctd.CruisePrefix, cfg.Ctd.StationPrefixLength)\n\tres := regexp.MustCompile(reg)\n\tmatch := res.MatchString(str)\n\tif match {\n\t\tt := res.FindStringSubmatch(str)\n\t\tfmt.Fprintf(debug, \"Get profile number: %s -> %s\\n\", str, t[1])\n\t\tif value, err = strconv.ParseFloat(t[1], 64); err == nil {\n\t\t\t// get profile name, eg: csp00101\n\t\t\tnc.ExtraString[fmt.Sprintf(\"PRFL_NAME:%d\", int(value))] = t[1]\n\t\t} else {\n\t\t\tlog.Fatal(fmt.Sprintf(\"Error func GetProfileNumber: %s, var: %v\", err, t[1]))\n\t\t}\n\n\t} else {\n\t\tlog.Fatal(fmt.Sprintf(\"Error func GetProfileNumber: %s -> %s\\n\", reg, str))\n\t}\n\treturn value\n\n}", "title": "" }, { "docid": "411511a7e2dca48778341f5cd645e627", "score": "0.56853926", "text": "func (c *ModelAdaptor) getProfile(k model.Key) (*model.KVPair, error) {\n\tvar t, l, r *model.KVPair\n\tvar err error\n\tpk := k.(model.ProfileKey)\n\n\tif t, err = c.client.Get(model.ProfileTagsKey{pk}); err != nil {\n\t\treturn nil, err\n\t}\n\td := model.KVPair{\n\t\tKey: k,\n\t\tValue: &model.Profile{\n\t\t\tTags: t.Value.([]string),\n\t\t},\n\t\tRevision: t.Revision,\n\t}\n\tp := d.Value.(*model.Profile)\n\tif l, err = c.client.Get(model.ProfileLabelsKey{pk}); err == nil {\n\t\tp.Labels = l.Value.(map[string]string)\n\t}\n\tif r, err = c.client.Get(model.ProfileRulesKey{pk}); err == nil {\n\t\tp.Rules = *r.Value.(*model.ProfileRules)\n\t}\n\treturn &d, nil\n}", "title": "" }, { "docid": "4590737d4ba9a6df1c10d071b9ce9c22", "score": "0.5682289", "text": "func (r *Router) Profile(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {\n\tif (*req).Method == \"OPTIONS\" {\n\t\treturn\n\t}\n\n\tclaim, err := r.loadEMailTokenHeader(w, req)\n\tif err != nil {\n\t\tlog.Println(\"invalid token\")\n\t\thttp.Error(w, \"invalid token\", 670)\n\t\treturn\n\t}\n\n\tdbUser, err := r.Datastore.Load(claim.Email)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, \"Invalid email\", 668)\n\t\treturn\n\t}\n\n\tvar response Response\n\tresponse.Success = true\n\tresponse.Plugins = dbUser[0].Plugins\n\tresp, err := json.Marshal(response)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, \"Internal server error\", 500)\n\t\treturn\n\t}\n\t_, _ = w.Write(resp)\n\treturn\n}", "title": "" }, { "docid": "e7720e072e5c2512442cedb841824bad", "score": "0.5669973", "text": "func (u *User) GetProfile() *UserProfile {\n\tm := NewAaaManager()\n\tprofile, err := m.FindUserProfileByUserID(u.ID)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn profile\n}", "title": "" }, { "docid": "db0742cde486a8c8a98f5b94c2dc8e39", "score": "0.56665796", "text": "func GetProfile(playerID string) (*Profile, error) {\n\tresp, err := http.Get(fmt.Sprintf(\"%s/player/%s/full\", HOST, playerID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar data Profile\n\terr = json.Unmarshal(body, &data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &data, nil\n}", "title": "" }, { "docid": "5fe306a8b62694c3101db7206411e134", "score": "0.56580055", "text": "func GoogleGetProfile(tokenStr string) (*goauth2.Userinfoplus, error) {\n\ttoken := &oauth2.Token{AccessToken: tokenStr}\n\tconf := &oauth2.Config{}\n\toauthClient := conf.Client(oauth2.NoContext, token)\n\n\tclient, err := goauth2.New(oauthClient)\n\tif err != nil {\n\t\tlog.Printf(\"[GoogleGetProfile] error: %s\", err)\n\t\treturn &goauth2.Userinfoplus{}, err\n\t}\n\n\tuser, err := client.Userinfo.Get().Do()\n\tif err != nil {\n\t\tlog.Printf(\"[GoogleGetProfile] error: %s\", err)\n\t\treturn &goauth2.Userinfoplus{}, err\n\t}\n\n\treturn user, nil\n}", "title": "" }, { "docid": "48c34d3431dd4f0cc8560a696a1b6c90", "score": "0.5650843", "text": "func (a *API) ViewProfile(w http.ResponseWriter, r *http.Request) {\n\tctx := a.App.NewContext().WithRemoteAddress(r.RemoteAddr)\n\tctx.Logger.Infoln(r.RemoteAddr, r.RequestURI)\n\n\tvars := mux.Vars(r)\n\turl, ok := vars[\"url\"]\n\tif !ok {\n\t\thttp.Error(w, \"incorrect url\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\tctx.Logger.Printf(\"url: %s\", url)\n\n\tstudent, err := ctx.ViewProfile(w, url, a.App.CurrentPeerIndex, a.Config.Peers)\n\tif err != nil {\n\t\tif err.Error() == \"does not exists\" {\n\t\t\thttp.Error(w, err.Error(), http.StatusOK)\n\t\t\treturn\n\t\t}\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif student == nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n\tstudentBytes, err := json.Marshal(student)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(studentBytes)\n}", "title": "" }, { "docid": "3a34d98a8aec109ba563ed3c3115d988", "score": "0.56477785", "text": "func LookupUserProfile(ctx *pulumi.Context, args *LookupUserProfileArgs, opts ...pulumi.InvokeOption) (*LookupUserProfileResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupUserProfileResult\n\terr := ctx.Invoke(\"aws-native:sagemaker:getUserProfile\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "9afe067b7d1c73d0010f23e427265877", "score": "0.5646528", "text": "func GetProfileFromWire(bytes []byte) (profile types.Profile, err error) {\n\tif len(bytes) == 0 {\n\t\treturn profile, errStateNotFound\n\t}\n\n\terr = wire.ReadBinaryBytes(bytes, &profile)\n\treturn profile, wrapErrDecodingState(err)\n}", "title": "" }, { "docid": "d4df8193f640175c0bca78e9be13e5e2", "score": "0.56395596", "text": "func (t *Twitter) GetProfile() (*twitter.User, error) {\n\tclient := twitter.NewClient(t.HttpClient())\n\n\tuser, _, err := client.Users.Show(&twitter.UserShowParams{\n\t\tScreenName: os.Getenv(\"TWITTER_USERNAME\"),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "7a9cd004903e6ef25938c8423f6c8f21", "score": "0.56077117", "text": "func (s *SessionHandler) ProfileFromSession(r *http.Request) *Profile {\n\tsession, err := s.store.Get(r, sessionName)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\tprofile, ok := session.Values[emailKey].(*Profile)\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn profile\n}", "title": "" }, { "docid": "40e7bdf92201306795340c0f0b88312a", "score": "0.56047785", "text": "func (c *Client) RequestProfile(dst utils.NodeID, f func(profile *client.UserProfile)) {\n\tc.node.Send(dst, client.UserProfileRequest{}, func(r interface{}) {\n\t\tif p, ok := r.(client.UserProfileResponse); ok {\n\t\t\tf(&p.Profile)\n\t\t} else {\n\t\t\tf(nil)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "b9fb6cf76a232410555937412ae0f226", "score": "0.5603124", "text": "func (p *HttpProvider) GetPokemonProfile(name string) (*model.PokemonResponse, *external.CallError) {\n\tpokemon, err := p.getPokemon(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tspecies, err := p.getPokemonSpecies(pokemon.Species.Name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tflavourTexts := make([]string, 0)\n\tfor _, text := range species.FlavorTexts {\n\t\tif text.Language.Name == LanguageEn {\n\t\t\tflavourTexts = append(flavourTexts, text.Text)\n\t\t}\n\t}\n\n\tvar description string\n\tif len(flavourTexts) == 0 {\n\t\tdescription = \"\"\n\t} else {\n\t\tdescription = strings.Replace(flavourTexts[0], \"\\n\", \" \", -1)\n\t}\n\n\treturn &model.PokemonResponse{\n\t\tName: pokemon.Name,\n\t\tHabitat: species.Habitat.Name,\n\t\tIsLegendary: species.IsLegendary,\n\t\tDescription: description,\n\t}, nil\n}", "title": "" }, { "docid": "c1505a3483eb7224f89a667791bb83e8", "score": "0.5598065", "text": "func NewProfile() *Profile { return &Profile{} }", "title": "" }, { "docid": "86af826815ae2736566cd57beb46a852", "score": "0.55959827", "text": "func (r RunescapeThreeServer) GetPlayerProfile(ctx context.Context, in *rs3pb.GetPlayerProfileRequest) (*rs3pb.PlayerProfile, error) {\n\tprofile, err := r.Svc.GetPlayerProfile(in.GetName(), int(in.GetActivityCount()))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn profile, nil\n}", "title": "" }, { "docid": "7b265602da88a9156c9a3ea9d4242be3", "score": "0.5585683", "text": "func (h *Handler) GetProfile(c echo.Context) (err error) {\n\tuserID := userIDFromToken(c)\n\n\t// Retrieve posts from database\n\tuser := model.User{}\n\tdb := h.DB.Clone()\n\n\tif err = db.DB(config.DbName).C(\"users\").FindId(bson.ObjectIdHex(userID)).One(&user); err != nil {\n\t\treturn\n\t}\n\n\tdefer db.Close()\n\n\tuser.Password = \"\"\n\n\treturn c.JSON(http.StatusOK, user)\n}", "title": "" }, { "docid": "6a116883cddf3045c674e89309cb7b06", "score": "0.5574566", "text": "func Find(iamClient aws.IAMAPI, profileName *string) (*Profile, error) {\n\tprofileOutput, err := iamClient.GetInstanceProfile(&iam.GetInstanceProfileInput{\n\t\tInstanceProfileName: profileName,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tawsProfile := profileOutput.InstanceProfile\n\treturn &Profile{\n\t\tPath: awsProfile.Path,\n\t\tArn: awsProfile.Arn,\n\t}, nil\n}", "title": "" }, { "docid": "25b5939e76f714ddd481aa83d7606dd2", "score": "0.55655473", "text": "func (c * Client) Profile() *profile.ProfileService {\n\treturn profile.NewProfile(&c.internalClient)\n}", "title": "" }, { "docid": "36a1a765307f81b7a96563e6d7586ca8", "score": "0.55635595", "text": "func (c *Client) SC2Profile(region Region, realmID, profileID int) (*sc2c.Profile, []byte, error) {\n\tvar (\n\t\tdat sc2c.Profile\n\t\tb []byte\n\t\terr error\n\t)\n\n\tb, err = c.getURLBody(c.apiURL+fmt.Sprintf(\"/sc2/profile/%d/%d/%d?locale=%s\", region, realmID, profileID, c.locale), \"\")\n\tif err != nil {\n\t\treturn &dat, b, err\n\t}\n\n\terr = json.Unmarshal(b, &dat)\n\tif err != nil {\n\t\treturn &dat, b, err\n\t}\n\n\treturn &dat, b, nil\n}", "title": "" }, { "docid": "0158da60b03606641f267db60698095d", "score": "0.5560963", "text": "func ReadProfile(name string) (*Profile, error) {\n\tp := new(Profile)\n\tp.Name = name\n\n\terr := p.read()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "8da4c80826ec84150b4d912670ebfffa", "score": "0.5560059", "text": "func GetProfileID(ctx context.Context, tx *sql.Tx, project string, name string) (int64, error) {\n\tstmt := stmt(tx, profileID)\n\trows, err := stmt.Query(project, name)\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"Failed to get \\\"profiles\\\" ID: %w\", err)\n\t}\n\n\tdefer rows.Close()\n\n\t// Ensure we read one and only one row.\n\tif !rows.Next() {\n\t\treturn -1, api.StatusErrorf(http.StatusNotFound, \"Profile not found\")\n\t}\n\tvar id int64\n\terr = rows.Scan(&id)\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"Failed to scan ID: %w\", err)\n\t}\n\n\tif rows.Next() {\n\t\treturn -1, fmt.Errorf(\"More than one row returned\")\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"Result set failure: %w\", err)\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "b6ee686f316bc6d2d4ac5e990eb44b4e", "score": "0.5555977", "text": "func (db *firestoreDB) GetProfileByPhoneNumber(\n\tctx context.Context,\n\tphoneNumber string,\n) (*datastore.Profile, error) {\n\tdocs := db.client.Collection(\"Profiles\").Where(\n\t\t\"phone\",\n\t\t\"==\",\n\t\tphoneNumber,\n\t).Documents(ctx)\n\tprofile := &datastore.Profile{}\n\tdefer docs.Stop()\n\tdocSnap, err := docs.Next()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"datastoredb: could not get Profile: %v\",\n\t\t\terr,\n\t\t)\n\t}\n\tif err := docSnap.DataTo(profile); err != nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"datastoredb: could not populate Profile: %v\",\n\t\t\terr,\n\t\t)\n\t}\n\treturn profile, nil\n}", "title": "" }, { "docid": "e854de4e1c51d52d894c2c6e4921f292", "score": "0.55516756", "text": "func GetUserAccountProfile(profileID uint) *AccountProfile {\n\t//combines the data from profile and account\n\taccountProfile := &AccountProfile{}\n\n\tprofile := GetUserProfile(profileID)\n\tif profile == nil {\n\t\treturn nil\n\t}\n\n\tacc := GetAccount(profile.AccountID)\n\tif acc == nil {\n\t\treturn nil\n\t}\n\n\taccountProfile.ProfileID = profile.ProfileID\n\taccountProfile.FirstName = profile.FirstName\n\taccountProfile.LastName = profile.LastName\n\taccountProfile.AccountID = profile.AccountID\n\taccountProfile.AccountType = profile.AccountType\n\taccountProfile.Email = acc.Email\n\n\treturn accountProfile\n}", "title": "" }, { "docid": "b7941bae3f74a98b06f714190fe769f6", "score": "0.55430484", "text": "func (h *SharedCfgConfigHandler) Profile(p string) {\n\th.profile = p\n}", "title": "" }, { "docid": "97487e607d88a163759cb159b1a99a69", "score": "0.55316263", "text": "func SelectProfile(user string) (p *Profile) {\n\tfor _, profile := range Profiles {\n\t\tif profile.Identity.User == user {\n\t\t\tp = profile\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "482f347b328df61fe1a4e93d9d2970f9", "score": "0.5507458", "text": "func (c Config) RemoveProfile(id string, save bool) (*APoint, error) {\n\tvar ret APoint\n\n\t// a. find closest profile\n\tvar scope string\n\tvar profile Profile\n\tvar pIndex int\n\tfound := false\n\tscore := 0\n\tfor k, v := range c.Scopes {\n\t\tfor i, p := range v.Profiles {\n\t\t\ts := compareStrs(id, p.ID)\n\t\t\tif s > score {\n\t\t\t\tfound = true\n\t\t\t\tscope = k\n\t\t\t\tscore = s\n\t\t\t\tprofile = p\n\t\t\t\tpIndex = i\n\t\t\t\tret.Endpoint = v.Endpoint\n\t\t\t\tret.Key = p.Key\n\t\t\t\tret.Name = p.Name\n\t\t\t\tret.Email = p.Email\n\t\t\t\tret.Token = p.Token\n\t\t\t}\n\t\t}\n\t}\n\tif !found {\n\t\treturn nil, errors.ErrProfileNotFound\n\t}\n\tif profile.ID == DefaultProfileID {\n\t\treturn nil, errors.ErrProfileNotRemovable\n\t}\n\n\t// b. set new scope with removed profile\n\tpSlice := c.Scopes[scope].Profiles\n\tc.Scopes[scope] = Scope{\n\t\tEndpoint: c.Scopes[scope].Endpoint,\n\t\tProfiles: append(pSlice[:pIndex], pSlice[pIndex+1:]...),\n\t}\n\n\t// c. set default profile as active if active profile is removed\n\tif profile.ID == c.Active {\n\t\tc.Active = DefaultProfileID\n\t}\n\n\t// d. save\n\tif save {\n\t\terr := c.Save()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &ret, nil\n}", "title": "" }, { "docid": "7f53d504da004adfe3c8d774a9575aca", "score": "0.5503769", "text": "func getCloudProfile(otcProfileName string) (*otcos.Cloud, error) {\n\n\tcloud, err := EnvOS.Cloud(otcProfileName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error constructing cloud configuration: %s\", err)\n\t}\n\n\tcloud, err = copyCloud(cloud)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error copying cloud: %s\", err)\n\t}\n\n\treturn cloud, nil\n}", "title": "" }, { "docid": "aa3334ef49a02342e820ea9b1d1e5b92", "score": "0.55014366", "text": "func (p *FacebookServiceClient) GetCpuProfile(ctx context.Context, profileDurationInSec int32) (r string, err error) {\n var _args18 FacebookServiceGetCpuProfileArgs\n _args18.ProfileDurationInSec = profileDurationInSec\n var _result19 FacebookServiceGetCpuProfileResult\n if err = p.Client_().Call(ctx, \"getCpuProfile\", &_args18, &_result19); err != nil {\n return\n }\n return _result19.GetSuccess(), nil\n}", "title": "" }, { "docid": "6e66b1ba606e2e709719b6739ea338cb", "score": "0.55003554", "text": "func (t *Textile) Profile() *pb.Peer {\n\treturn t.datastore.Peers().Get(t.node.Identity.Pretty())\n}", "title": "" }, { "docid": "87a88bd5124644aee28c0ace933163b4", "score": "0.5496216", "text": "func ProfileRetrieve(c *gin.Context) {\n\tusername := c.Param(\"username\")\n\tvar user User\n\tuser, err := GetUserProfile(&User{Username: username})\n\tif err != nil {\n\t\tc.JSON(http.StatusUnprocessableEntity, common.NewError(\"database\", err))\n\t}\n\tc.Set(\"my_user_model\", user)\n\tserializer := UserSerializer{c}\n\tc.JSON(http.StatusOK, gin.H{\"user\": serializer.Response()})\n}", "title": "" }, { "docid": "d90c8f1ff5c79359bf495b86a582ef11", "score": "0.54956377", "text": "func (a *DeviceProfileServiceAPI) Get(ctx context.Context, req *pb.GetDeviceProfileRequest) (*pb.GetDeviceProfileResponse, error) {\n\tdpID, err := uuid.FromString(req.Id)\n\tif err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"uuid error: %s\", err)\n\t}\n\n\tif err := a.validator.Validate(ctx,\n\t\tauth.ValidateDeviceProfileAccess(auth.Read, dpID),\n\t); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\tdp, err := storage.GetDeviceProfile(ctx, storage.DB(), dpID, false, false)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\tresp := pb.GetDeviceProfileResponse{\n\t\tDeviceProfile: &pb.DeviceProfile{\n\t\t\tId: dpID.String(),\n\t\t\tName: dp.Name,\n\t\t\tOrganizationId: dp.OrganizationID,\n\t\t\tNetworkServerId: dp.NetworkServerID,\n\t\t\tPayloadCodec: string(dp.PayloadCodec),\n\t\t\tPayloadEncoderScript: dp.PayloadEncoderScript,\n\t\t\tPayloadDecoderScript: dp.PayloadDecoderScript,\n\t\t\tSupportsClassB: dp.DeviceProfile.SupportsClassB,\n\t\t\tClassBTimeout: dp.DeviceProfile.ClassBTimeout,\n\t\t\tPingSlotPeriod: dp.DeviceProfile.PingSlotPeriod,\n\t\t\tPingSlotDr: dp.DeviceProfile.PingSlotDr,\n\t\t\tPingSlotFreq: dp.DeviceProfile.PingSlotFreq,\n\t\t\tSupportsClassC: dp.DeviceProfile.SupportsClassC,\n\t\t\tClassCTimeout: dp.DeviceProfile.ClassCTimeout,\n\t\t\tMacVersion: dp.DeviceProfile.MacVersion,\n\t\t\tRegParamsRevision: dp.DeviceProfile.RegParamsRevision,\n\t\t\tRxDelay_1: dp.DeviceProfile.RxDelay_1,\n\t\t\tRxDrOffset_1: dp.DeviceProfile.RxDrOffset_1,\n\t\t\tRxDatarate_2: dp.DeviceProfile.RxDatarate_2,\n\t\t\tRxFreq_2: dp.DeviceProfile.RxFreq_2,\n\t\t\tMaxEirp: dp.DeviceProfile.MaxEirp,\n\t\t\tMaxDutyCycle: dp.DeviceProfile.MaxDutyCycle,\n\t\t\tSupportsJoin: dp.DeviceProfile.SupportsJoin,\n\t\t\tRfRegion: dp.DeviceProfile.RfRegion,\n\t\t\tSupports_32BitFCnt: dp.DeviceProfile.Supports_32BitFCnt,\n\t\t\tFactoryPresetFreqs: dp.DeviceProfile.FactoryPresetFreqs,\n\t\t\tTags: make(map[string]string),\n\t\t\tUplinkInterval: ptypes.DurationProto(dp.UplinkInterval),\n\t\t\tAdrAlgorithmId: dp.DeviceProfile.AdrAlgorithmId,\n\t\t},\n\t}\n\n\tresp.CreatedAt, err = ptypes.TimestampProto(dp.CreatedAt)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\tresp.UpdatedAt, err = ptypes.TimestampProto(dp.UpdatedAt)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\tfor k, v := range dp.Tags.Map {\n\t\tresp.DeviceProfile.Tags[k] = v.String\n\t}\n\n\treturn &resp, nil\n}", "title": "" }, { "docid": "7c46493398498e3828773663d9d4bae5", "score": "0.54748017", "text": "func aaProfile() string {\n\tcontents, err := ioutil.ReadFile(\"/proc/self/attr/current\")\n\tif err == nil {\n\t\treturn strings.TrimSpace(string(contents))\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "240749299bea10f3a639adc17aee346c", "score": "0.5467166", "text": "func (s *deviceService) GetProfileByName(name string) (models.DeviceProfile, error) {\n\tprofile, ok := cache.Profiles().ForName(name)\n\tif !ok {\n\t\tmsg := fmt.Sprintf(\"failed to find Profile %s in cache\", name)\n\t\ts.lc.Error(msg)\n\t\treturn models.DeviceProfile{}, errors.NewCommonEdgeX(errors.KindEntityDoesNotExist, msg, nil)\n\t}\n\treturn profile, nil\n}", "title": "" }, { "docid": "ac62fc58ad3b74ff4ad8381dc0b3b6be", "score": "0.54488003", "text": "func NewServiceProfile(name string) *ServiceProfile {\r\n\tsp := &ServiceProfile{\r\n\t\tName: name,\r\n\t\tFlowProfileName: \"\",\r\n\t\tMulticastProfileName: \"\",\r\n\t\tVlanProfileName: \"\",\r\n\t\tL2cpProfileName: \"\",\r\n\t\tSecurityProfileName: \"\",\r\n\t\tOnuFlowProfileName: \"\",\r\n\t\tOnuVlanProfileName: \"\",\r\n\t\tOnuMulticastProfileName: \"\",\r\n\t\tOnuTcontProfileName: \"\",\r\n\t\tOnuVirtGemPortID: 1,\r\n\t\tOnuTpType: 1,\r\n\t\tOnuTpUniBitMap: \"AAAA\",\r\n\t\tDhcpRa: 0,\r\n\t\tDhcpRaTrustClients: 0,\r\n\t\tDhcpRaOpt82UnicastExtension: 0,\r\n\t\tDhcpRaOpt82Insert: 0,\r\n\t\tDhcpRaRateLimit: 5,\r\n\t\tDhcpRaCircuitIDCustomFormat: \"\",\r\n\t\tDhcpRaRemoteIDCustomFormat: \"\",\r\n\t\tDhcpRaCircuitIDType: 1,\r\n\t\tDhcpv6Ra: 0,\r\n\t\tDhcpv6RaTrustClients: 0,\r\n\t\tDhcpv6RaRemoteIDEnterpriseNum: 1332,\r\n\t\tDhcpv6RaInterfaceIDType: 2,\r\n\t\tDhcpv6RaInterfaceIDCustomFormat: \"\",\r\n\t\tDhcpv6RaRemoteIDCustomFormat: \"\",\r\n\t\tPppoeIA: 0,\r\n\t\tPppoeIARateLimit: 5,\r\n\t\tPPPoeIACircuitIDType: 1,\r\n\t\tPPPoeIACircuitIDCustomFormat: \"\",\r\n\t\tPPPoeIARemoteIDCustomFormat: \"\",\r\n\t}\r\n\treturn sp\r\n}", "title": "" }, { "docid": "25d2f57f0a2d2e244f994ec9978a1e86", "score": "0.54470897", "text": "func (s *Server) Profile(w http.ResponseWriter, r *http.Request) {\n\n}", "title": "" }, { "docid": "6fbc5314b8fc77173640834edf9cba21", "score": "0.5446773", "text": "func GetProfileById(w http.ResponseWriter, r *http.Request) {\n\tprofile_id := mux.Vars(r)[\"id\"]\n\n\tuser_profile, err := service.GetProfile(profile_id)\n\tif err != nil {\n\t\terrors.WriteError(w, r, errors.DatabaseError(err.Error(), \"Could not get profile for profile id \"+profile_id))\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(user_profile)\n}", "title": "" }, { "docid": "1001f1142ef172fcad8fa96ea7cd9aca", "score": "0.54193646", "text": "func NewProfileService(sling *sling.Sling) *ProfileService {\n\treturn &ProfileService{\n\t\tsling: sling.Path(\"profile/\"),\n\t}\n}", "title": "" }, { "docid": "d766d04ea734eb5717df8ead7e9d0780", "score": "0.540966", "text": "func ConvertStringToProfileRef(profileName, context, ns string) ProfileRef {\n\tprofName := strings.TrimSpace(strings.TrimPrefix(profileName, \"/\"))\n\tparts := strings.Split(profName, \"/\")\n\tprofRef := ProfileRef{Context: context, Namespace: ns}\n\tswitch len(parts) {\n\tcase 2:\n\t\tprofRef.Partition = parts[0]\n\t\tprofRef.Name = parts[1]\n\tcase 1:\n\t\tlog.Debugf(\"[RESOURCE] Partition not provided in profile '%s', using default partition '%s'\",\n\t\t\tprofileName, DEFAULT_PARTITION)\n\t\tprofRef.Partition = DEFAULT_PARTITION\n\t\tprofRef.Name = profileName\n\tdefault:\n\t\t// This is almost certainly an error, but again issue a warning for\n\t\t// improved context here and pass it through to be handled elsewhere.\n\t\tlog.Warningf(\"[RESOURCE] Profile name '%v' is formatted incorrectly.\", profileName)\n\t}\n\treturn profRef\n}", "title": "" }, { "docid": "1c4bdd3622fabdb0ebb461830dc70f62", "score": "0.5393119", "text": "func GetCourierAccountProfile(profileID uint) *AccountProfile {\n\t//combines the data from profile and account\n\taccountProfile := &AccountProfile{}\n\n\tprofile := GetCourierProfile(profileID)\n\tif profile == nil {\n\t\treturn nil\n\t}\n\n\tacc := GetAccount(profile.AccountID)\n\tif acc == nil {\n\t\treturn nil\n\t}\n\n\taccountProfile.ProfileID = profile.ProfileID\n\taccountProfile.FirstName = profile.FirstName\n\taccountProfile.LastName = profile.LastName\n\taccountProfile.AccountID = profile.AccountID\n\taccountProfile.AccountType = profile.AccountType\n\taccountProfile.Email = acc.Email\n\n\treturn accountProfile\n}", "title": "" }, { "docid": "e87cac398350d81f9a85343a173bead8", "score": "0.5392455", "text": "func (f *Facebook) GetProfile(accessToken string) (*models.User, *conf.ApiError) {\n req, _ := http.NewRequest(\"GET\", f.options.BaseURL+\"/me\", nil)\n req.Header.Set(\"Authorization\", \"Bearer \"+accessToken)\n resp, err := f.facebookClient.Do(req)\n if err != nil {\n log.Println(err)\n return nil, conf.ErrNoProfile\n }\n\n defer resp.Body.Close()\n\n body, _ := ioutil.ReadAll(resp.Body)\n\n if resp.StatusCode >= 400 {\n return nil, parseError(resp.StatusCode, body)\n }\n user := &models.User{}\n if err := json.Unmarshal(body, user); err != nil {\n log.Println(err)\n return nil, conf.NewApiError(err)\n }\n user.AvatarURL = f.options.BaseURL + \"/\" + user.ID + \"/picture\"\n return user, nil\n}", "title": "" }, { "docid": "62ccddc8ee568c4dc14a2513102fce26", "score": "0.5392071", "text": "func (s *SearchSource) Profile(profile bool) *SearchSource {\n\ts.profile = profile\n\treturn s\n}", "title": "" } ]
c054acb69d3c5ae84b9787a8a6284130
Status returns the response status code.
[ { "docid": "2813d47bb7fcdf46c4d5d2aacf535737", "score": "0.73067635", "text": "func (r *AddOnVersionPollResponse) Status() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\treturn r.response.Status()\n}", "title": "" } ]
[ { "docid": "13986f57d66c9fefd59be3e8ba76c4a0", "score": "0.8138827", "text": "func (se httpStatus) Status() int {\n\treturn se.Code\n}", "title": "" }, { "docid": "276cc330a894ce1f6b25428c69245caa", "score": "0.79832107", "text": "func (r *Response) Status() int {\n\treturn r.status\n}", "title": "" }, { "docid": "276cc330a894ce1f6b25428c69245caa", "score": "0.79832107", "text": "func (r *Response) Status() int {\n\treturn r.status\n}", "title": "" }, { "docid": "4debef9fac04341ee0d2a7ff998de0af", "score": "0.7907031", "text": "func (hr *HTTPResp) Status() int {\n\treturn hr.status\n}", "title": "" }, { "docid": "8bea43a1e53897a1c8ecb5643913724f", "score": "0.7667835", "text": "func (r *AddOnVersionGetResponse) Status() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\treturn r.status\n}", "title": "" }, { "docid": "c5db6913a80d323a320299d555c7b66a", "score": "0.7659675", "text": "func (ctx *Context) Status() int {\n\treturn ctx.Response.Status()\n}", "title": "" }, { "docid": "fb0dc4a2cb1b572977c6a1029f70a826", "score": "0.75972706", "text": "func (w *ResponseWriter) Status() int {\n\treturn w.status\n}", "title": "" }, { "docid": "fb0dc4a2cb1b572977c6a1029f70a826", "score": "0.75972706", "text": "func (w *ResponseWriter) Status() int {\n\treturn w.status\n}", "title": "" }, { "docid": "b16bff714de2b4815e4a697ae5d45d73", "score": "0.75310254", "text": "func (c *httpClient) Status() (*model.Status, error) {\n\tvar status = struct {\n\t\tStatus model.Status `json:\"status\"`\n\t}{}\n\n\terr := c.do(\"status\", &status)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &status.Status, err\n}", "title": "" }, { "docid": "1b337e4c4b81f129d403603d4640053e", "score": "0.75091326", "text": "func (re *ResponseError) Status() int {\n\treturn re.status\n}", "title": "" }, { "docid": "63bff17cca7317cc36427b19cf189f74", "score": "0.7461751", "text": "func (h *HttpResponse) Status() string {\n\treturn h.r.Status\n}", "title": "" }, { "docid": "76d2a285d4e7cbefd3d4919b61df3559", "score": "0.74487936", "text": "func (jre *JSONResponseError) Status() int {\n\treturn jre.status\n}", "title": "" }, { "docid": "2e46b218d0bb8133205c86095d412ff2", "score": "0.74275875", "text": "func (c *countingResponseWriter) Status() int {\n\treturn c.status\n}", "title": "" }, { "docid": "77a2db94d3af9703ec9a0587c1c8acba", "score": "0.7349673", "text": "func (r *Response) Status() string {\n\treturn r.Response.Status\n}", "title": "" }, { "docid": "02e76eb40651cd0cea8f7033a8317f3f", "score": "0.734536", "text": "func (c Code) Status() int {\n\treturn c.status\n}", "title": "" }, { "docid": "e31b913aaeeef8083df3e46fb0f005fe", "score": "0.73124665", "text": "func (w *responseWriter) Status() int {\n\treturn w.status\n}", "title": "" }, { "docid": "328dd179ab08be54161ea87e1194b806", "score": "0.7311837", "text": "func (r *responseWrapperFromEcho) Status() int {\n\treturn r.Response.Status()\n}", "title": "" }, { "docid": "5f62c41c307e62f5544089212e3eee4f", "score": "0.730764", "text": "func (ctx *Context) Status() int {\n\tif ctx.status == 0 {\n\t\tctx.status = http.StatusOK\n\t}\n\n\treturn ctx.status\n}", "title": "" }, { "docid": "504256af2beea566dc7ac6b4b1394bd1", "score": "0.72911805", "text": "func (e Error) Status() int {\n\treturn e.resp.StatusCode\n}", "title": "" }, { "docid": "838b413d3a40da796f0c99366ea4ed05", "score": "0.7271574", "text": "func (se StatusError) Status() int {\n\treturn se.Code\n}", "title": "" }, { "docid": "838b413d3a40da796f0c99366ea4ed05", "score": "0.7271574", "text": "func (se StatusError) Status() int {\n\treturn se.Code\n}", "title": "" }, { "docid": "838b413d3a40da796f0c99366ea4ed05", "score": "0.7271574", "text": "func (se StatusError) Status() int {\n\treturn se.Code\n}", "title": "" }, { "docid": "838b413d3a40da796f0c99366ea4ed05", "score": "0.7271574", "text": "func (se StatusError) Status() int {\n\treturn se.Code\n}", "title": "" }, { "docid": "b8ca8e2676e03e26ba60de1834ba9a12", "score": "0.72704446", "text": "func (i *IdlerAPI) Status(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tw.Write([]byte(\"Status\"))\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "52030c3cfaec2f91031d4a67760f2d62", "score": "0.7249208", "text": "func (ae APIError) Status() int {\n\treturn ae.Code\n}", "title": "" }, { "docid": "7194d769556e0c1d1d2807202890a180", "score": "0.7216536", "text": "func (l *responseTracer) Status() int {\n\treturn l.status\n}", "title": "" }, { "docid": "b4ba8cc58926a0441ecf52a945e74c13", "score": "0.7208787", "text": "func (e StatusError) Status() int {\n\treturn e.Code\n}", "title": "" }, { "docid": "f2dda6ff5c45e30b2f8f40efc332ba3b", "score": "0.7206259", "text": "func (s *StatusService) Status() (Status, *http.Response, error) {\n\tstatus := new(Status)\n\tapiError := new(APIError)\n\tresp, err := s.sling.New().Receive(status, apiError)\n\treturn *status, resp, relevantError(err, *apiError)\n}", "title": "" }, { "docid": "d977a705ec11649d2180abb39d32f58a", "score": "0.72046095", "text": "func Status(res http.ResponseWriter, _ *http.Request) {\n\tresponse.JSON(res, http.StatusOK, response.Body{\"message\": \"it works\"})\n}", "title": "" }, { "docid": "2a32a32b9fc410df3144c8e9b436936d", "score": "0.71850127", "text": "func (s *Server) Status() int {\n\treturn s.status\n}", "title": "" }, { "docid": "156b80a344cb31a24a1da2f0fca50013", "score": "0.71748924", "text": "func Status(r *http.Request) api.Response {\n\thealth, err := es.Client.CatHealth().Do(context.Background())\n\tif err != nil {\n\t\treturn api.Response{Error: errors.Err(err)}\n\t}\n\tcounts, err := es.Client.CatCount().Index(index.Claims).Do(context.Background())\n\tif err != nil {\n\t\treturn api.Response{Error: errors.Err(err)}\n\t}\n\talloc, err := es.Client.CatAllocation().Human(true).Do(context.Background())\n\tif err != nil {\n\t\treturn api.Response{Error: errors.Err(err)}\n\t}\n\tclaimStats, err := es.Client.IndexStats(index.Claims).Human(true).Do(context.Background())\n\tif err != nil {\n\t\treturn api.Response{Error: errors.Err(err)}\n\t}\n\n\treturn api.Response{Data: status{\n\t\tVersion: meta.GetVersion(),\n\t\tSemanticVersion: meta.GetSemVersion(),\n\t\tVersionLong: meta.GetVersionLong(),\n\t\tVersionMsg: meta.GetCommitMessage(),\n\t\tHealth: health,\n\t\tClaimCount: counts,\n\t\tAllocations: alloc,\n\t\tClaimStats: *claimStats}}\n}", "title": "" }, { "docid": "eb7f8559817b8ae2dd3f19a74e46fd2a", "score": "0.7150516", "text": "func Status() (bool, error) {\n\tresp := status{}\n\n\terr := get(\"core/status\", nil, &resp)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn resp.Success, nil\n}", "title": "" }, { "docid": "9a35a03e57108438e4cca4f50db1eb1f", "score": "0.711952", "text": "func (r ErrorResponse) Status() string {\n\treturn r.status\n}", "title": "" }, { "docid": "ff0a1ae36aa7d6e7b8c466fa2a473f32", "score": "0.7112561", "text": "func (r *AddOnVersionUpdateResponse) Status() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\treturn r.status\n}", "title": "" }, { "docid": "a1baf0e0989484af5af9349b0e73af76", "score": "0.7081565", "text": "func (c *Client) Status(ctx context.Context) (*Status, error) {\n\n\treq, err := c.NewJSONRequest(\"GET\", \"/status\", nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar s Status\n\t_, err = c.Do(ctx, req, &s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &s, nil\n}", "title": "" }, { "docid": "dfffca5710a2cf46d078afd5be6d925f", "score": "0.7065505", "text": "func (s *Server) Status(w http.ResponseWriter, r *http.Request) {\n\tstatus := s.getServerStatus()\n\n\tencoder := json.NewEncoder(w)\n\tencoder.Encode(status)\n\n}", "title": "" }, { "docid": "667b4b35d2b204d18de2ef81e1aaff40", "score": "0.70622975", "text": "func (c *Client) Status() (Status, error) {\n\tspan := c.tracer.StartSpan(\"Client.Status\")\n\tdefer span.Finish()\n\n\tpath := \"/status\"\n\t_, data, err := c.HTTPRequest(\"GET\", path, nil, nil)\n\tif err != nil {\n\t\treturn Status{}, errors.Wrap(err, \"requesting /status\")\n\t}\n\tstatus := Status{}\n\terr = json.Unmarshal(data, &status)\n\tif err != nil {\n\t\treturn Status{}, errors.Wrap(err, \"unmarshaling /status data\")\n\t}\n\treturn status, nil\n}", "title": "" }, { "docid": "4c4b072b3159069a3f101929f3ce19de", "score": "0.70591664", "text": "func (h *HttpResponse) StatusCode() int {\n\treturn h.r.StatusCode\n}", "title": "" }, { "docid": "20fd1fb6411c443abd7a3c3f95e14f3e", "score": "0.70406675", "text": "func (w *writerWrapper) Status() int {\n\treturn w.statusCode\n}", "title": "" }, { "docid": "8d3965de1664eb73365bd58aa48cf7e8", "score": "0.7036549", "text": "func (w *BufferedResponseWriter) Status() int {\n\treturn w.status\n}", "title": "" }, { "docid": "b49ccb35c2f6953fd9110d2d5215a634", "score": "0.7018679", "text": "func Status(url string) (*StatusResponse, error) {\n\tparams := getDefaultRPCParams(\"node.getStatus\")\n\n\tbody, err := GetResponseBodyPlatform(url+\"/rpc\", params)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"[ Status ]\")\n\t}\n\n\tstatusResp := rpcStatusResponse{}\n\n\terr = json.Unmarshal(body, &statusResp)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"[ Status ] Can't unmarshal\")\n\t}\n\tif statusResp.Error != nil {\n\t\treturn nil, errors.New(\"[ Status ] Field 'error' is not nil: \" + fmt.Sprint(statusResp.Error))\n\t}\n\n\treturn &statusResp.Result, nil\n}", "title": "" }, { "docid": "a7705eb8abc9dd6702ce7f8853f55878", "score": "0.7006044", "text": "func (c *Client) Status(id string) (*StatusResponse, error) {\n\tstatResp := &StatusResponse{}\n\tresp, err := c.caller.Call(\"GET\", c.endpoint+\"/opengdpr_requests/\"+id, nil)\n\treturn statResp, c.json(resp, err, true, statResp)\n}", "title": "" }, { "docid": "c3ad214410c017751e8f3d800ac31cc4", "score": "0.7002907", "text": "func Status(echoCtx echo.Context) error {\n\tvar res = entity.NewResponse(http.StatusOK, \"It is work v2!\", nil)\n\treturn echoCtx.JSON(res.Status, res)\n}", "title": "" }, { "docid": "cf4993e24d0333d4c467f8a19bf4da31", "score": "0.69606936", "text": "func Status(w http.ResponseWriter, r *http.Request, status int) error {\n\tw.WriteHeader(status)\n\treturn nil\n}", "title": "" }, { "docid": "d44943adb4ac70085c6f37d0f4a182a3", "score": "0.6956773", "text": "func status(c echo.Context) error {\n\treturn c.String(http.StatusOK, \"OK\")\n}", "title": "" }, { "docid": "c513568ede090e5f868f643d24074112", "score": "0.6948239", "text": "func (gsr GraphSyncResponse) Status() graphsync.ResponseStatusCode { return gsr.status }", "title": "" }, { "docid": "f90205672b23b25a28b28d7e78b7e27a", "score": "0.69308996", "text": "func Status(status int) *Response {\n\treturn PlainText(status, http.StatusText(status))\n}", "title": "" }, { "docid": "d86ef6921268dfe8cb7255616d116dbf", "score": "0.69204575", "text": "func (x *Error) Status() int {\n\treturn x.status\n}", "title": "" }, { "docid": "10b93ccc057151e7c8b89c2e34661ec7", "score": "0.69043267", "text": "func (r *AddOnVersionDeleteResponse) Status() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\treturn r.status\n}", "title": "" }, { "docid": "378e256f2b54bc78b9f5b23c00c7618c", "score": "0.6898527", "text": "func ResponseStatus(rw http.ResponseWriter) int {\n\tcrw, ok := rw.(*customResponseWriter)\n\tif !ok {\n\t\treturn http.StatusOK\n\t}\n\treturn crw.statusCode\n}", "title": "" }, { "docid": "5ede4a6f0bd35e078ad35da64807bdad", "score": "0.6898109", "text": "func (r *response) Status(status int) Response {\n\tr.status = status\n\tr.Message(http.StatusText(r.status))\n\treturn r\n}", "title": "" }, { "docid": "e125a9f2713ef20067d99293e6b22414", "score": "0.68931234", "text": "func (a *API) status(w http.ResponseWriter, r *http.Request) {\n\ta.sendJSON(struct {\n\t\tID string\n\t\tVersion string\n\t\tPort int\n\t\tBytesSent int\n\t\tBytesReceived int\n\t}{a.ID, a.Version, a.Port, a.BytesSent, a.BytesReceived}, w)\n}", "title": "" }, { "docid": "83891e2778031d3b568f162091f21b2b", "score": "0.68895364", "text": "func Status(re *require.Assertions, code int) func([]byte, int) {\n\treturn func(resp []byte, i int) {\n\t\tre.Equal(code, i, \"resp: \"+string(resp))\n\t}\n}", "title": "" }, { "docid": "527b499ac61c1af9db3aeab075ea1864", "score": "0.68792176", "text": "func (r *ApplicationsAddServerResponse) Status(value int) *ApplicationsAddServerResponse {\n\tr.status = value\n\treturn r\n}", "title": "" }, { "docid": "122cc12f064053c9a3cbec6e481a4a55", "score": "0.6877135", "text": "func (r *ClusterGetServerResponse) Status(value int) *ClusterGetServerResponse {\n\tr.status = value\n\treturn r\n}", "title": "" }, { "docid": "ebdcc01d4c56e321f0bee91f38e1ad30", "score": "0.6876079", "text": "func (lrw *LoggedResponseWriter) Status() int {\n\treturn lrw.status\n}", "title": "" }, { "docid": "0ef8b6b19ce1d614b9038664ff8e73bf", "score": "0.6862366", "text": "func (s NodeService) Status(ctx context.Context, request *v1.StatusRequest) (*v1.StatusResponse, error) {\n\treturn &v1.StatusResponse{}, nil\n}", "title": "" }, { "docid": "5274d581adb31f9a5ce8a2e50441bb58", "score": "0.6861898", "text": "func (r *recordResponse) Status() string {\n\treturn strconv.Itoa(r.status)\n}", "title": "" }, { "docid": "2307f910a420ea2334a6398bde88c024", "score": "0.6860531", "text": "func (e *ErrorObject) Status() int {\n\treturn e.Code\n}", "title": "" }, { "docid": "bf026ad4f7b4f8d41c6d02607c70987d", "score": "0.68475556", "text": "func (e *CustomError) Status() int {\n\treturn statusCodes[e.code]\n}", "title": "" }, { "docid": "19f3780b33c0413eaa8a9eaced69cd29", "score": "0.6843746", "text": "func (v *API) Status(vin string) (StatusResponse, error) {\n\tvar res StatusResponse\n\turi := fmt.Sprintf(\"%s/bs/vsr/v1/vehicles/%s/status\", RegionAPI, vin)\n\tif v.statusURI != \"\" {\n\t\turi = v.statusURI\n\t}\n\n\theaders := map[string]string{\n\t\t\"Accept\": request.JSONContent,\n\t\t\"X-App-Name\": \"foo\", // required\n\t\t\"X-App-Version\": \"foo\", // required\n\t}\n\n\treq, err := request.New(http.MethodGet, uri, nil, headers)\n\tif err == nil {\n\t\terr = v.DoJSON(req, &res)\n\t}\n\n\tif _, ok := err.(request.StatusError); ok {\n\t\tvar rr RolesRights\n\t\trr, err = v.RolesRights(vin)\n\n\t\tif err == nil {\n\t\t\tif uri = v.ServiceURI(vin, StatusService, rr); uri == \"\" {\n\t\t\t\terr = fmt.Errorf(\"%s not found\", StatusService)\n\t\t\t}\n\t\t}\n\n\t\tif err == nil {\n\t\t\tif strings.HasSuffix(uri, fmt.Sprintf(\"%s/\", vin)) {\n\t\t\t\turi += \"status\"\n\t\t\t}\n\n\t\t\tif req, err = request.New(http.MethodGet, uri, nil, headers); err == nil {\n\t\t\t\tif err = v.DoJSON(req, &res); err == nil {\n\t\t\t\t\tv.statusURI = uri\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "27cfabbb20d3c0046e151c1dbaa29492", "score": "0.68412024", "text": "func (e Error) Status() int { return e.Code }", "title": "" }, { "docid": "268da1e0fef8b89743f8ac19085644fd", "score": "0.68221605", "text": "func (r Response) Status(code int) Response {\n\tr.StatusCode = code\n\treturn r\n}", "title": "" }, { "docid": "b2a9cb4c9fd616661cc2d4df502e002a", "score": "0.68151695", "text": "func (rw *ResponseWriter) StatusCode() int {\n\treturn rw.statusCode\n}", "title": "" }, { "docid": "03845e9477deb71ef16f74949d870c27", "score": "0.6809073", "text": "func (r *ApplicationsListServerResponse) Status(value int) *ApplicationsListServerResponse {\n\tr.status = value\n\treturn r\n}", "title": "" }, { "docid": "e8e669f292255e9e8fc187ca6f9267ed", "score": "0.67955613", "text": "func Status(ctx context.Context, c *apiclient.KopiaAPIClient) (*StatusResponse, error) {\n\tresp := &StatusResponse{}\n\tif err := c.Get(ctx, \"control/status\", nil, resp); err != nil {\n\t\treturn nil, errors.Wrap(err, \"Status\")\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "5e0c1620a8eea1d4eb472b6484e05833", "score": "0.6777592", "text": "func (r *Response) StatusCode() int {\n\tif r == nil || r.resp == nil {\n\t\treturn 0\n\t}\n\treturn r.resp.StatusCode\n}", "title": "" }, { "docid": "ad4cd3ed3b0fc39cc9e5b1ec5b03e86e", "score": "0.67657375", "text": "func (h HealthController) Status(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": \"ok\",\n\t})\n}", "title": "" }, { "docid": "ccc0c35808dbd530ba8eebc5d3da9856", "score": "0.67576605", "text": "func (s *StatusServer) Status(\n\tctx xcontext.Context, request *pb.StatusRequest,\n) (*pb.StatusResponse, error) {\n\tif err := s.authorizer.Authorize(ctx); err != nil {\n\t\ts.logger.WarnS(logf(\"Status(): %s\", err))\n\t\treturn nil, err\n\t}\n\n\tinfo, ok := ucred.FromContext(ctx)\n\tif !ok {\n\t\tpanic(\"authorized context without auth info\")\n\t}\n\ts.logger.InfoS(logf(\"uid:%d rpc Status()\", info.Ucred.Uid))\n\n\ttxt := fmt.Sprintf(`version: %s\nclientUid: %d\nclientGid: %d\n`,\n\t\ts.version(),\n\t\tinfo.Ucred.Uid, info.Ucred.Gid,\n\t)\n\n\trsp := &pb.StatusResponse{Text: txt}\n\treturn rsp, nil\n}", "title": "" }, { "docid": "34eec43e039230f65f51426799ffc06f", "score": "0.6720511", "text": "func (w WMTSException) Status() int {\n\treturn w.StatusCode\n}", "title": "" }, { "docid": "71b57b1f6a268c3f3478586bc64f53ca", "score": "0.67124057", "text": "func (r BaseResponse) StatusCode() int {\n\treturn r.code\n}", "title": "" }, { "docid": "55bbbc76306a1432f248be9357ee760d", "score": "0.6709046", "text": "func (m *Mediator) Status(request *models.RequestEnvelope) *models.ResponseEnvelope {\n\targs := mediator.StatusRequest{}\n\n\tif err := json.Unmarshal(request.Payload, &args); err != nil {\n\t\treturn &models.ResponseEnvelope{Error: &models.CommandError{Message: err.Error()}}\n\t}\n\n\tresponse, cmdErr := exec(m.handlers[mediator.StatusCommandMethod], args)\n\tif cmdErr != nil {\n\t\treturn &models.ResponseEnvelope{Error: cmdErr}\n\t}\n\n\treturn &models.ResponseEnvelope{Payload: response}\n}", "title": "" }, { "docid": "8daafafc7faa12a30c0afe99e477d00a", "score": "0.670658", "text": "func (e Error) HTTPStatus() int {\n\treturn e.Code\n}", "title": "" }, { "docid": "de0dede006dfb8bb8a13de828a236b6c", "score": "0.67038023", "text": "func (o RunResponseOutput) Status() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RunResponse) *string { return v.Status }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b60336894c9046f1ca8c9b5e9181f18d", "score": "0.6698266", "text": "func GetStatus(c *gin.Context) {\n\tc.String(http.StatusOK, oK)\n\treturn\n}", "title": "" }, { "docid": "1be5dcab667fa18da5cdbb0e0ac955b1", "score": "0.66963214", "text": "func (c *cachedResponseHolder) Status() int {\n\treturn c.cachedStatus\n}", "title": "" }, { "docid": "8c5a299f31c1c7083294392f7865914e", "score": "0.66787314", "text": "func (code ErrCode) HTTPStatus() int {\n\tif 0 == code.HTTP {\n\t\treturn 200\n\t}\n\treturn code.HTTP\n}", "title": "" }, { "docid": "831e41cb9d1ac2edc15624babc9512d1", "score": "0.6661638", "text": "func (r *ClusterUpdateServerResponse) Status(value int) *ClusterUpdateServerResponse {\n\tr.status = value\n\treturn r\n}", "title": "" }, { "docid": "0c36669fdc905d25ba09e37320dcb3fb", "score": "0.6659023", "text": "func (server *ApiServer) Status(ctx echo.Context) error {\r\n\r\n\t//dummy context for Ping()\r\n\tctx2 := context.Background()\r\n\r\n\tif err := server.DbCon.Db.Ping(ctx2); err != nil {\r\n\t\tstatus := StatusResponse{\r\n\t\t\tStatus: http.StatusServiceUnavailable,\r\n\t\t}\r\n\t\treturn ctx.JSON(http.StatusServiceUnavailable, status)\r\n\t}\r\n\r\n\tstatus := StatusResponse{\r\n\t\tStatus: 200,\r\n\t}\r\n\treturn ctx.JSON(http.StatusOK, status)\r\n\r\n}", "title": "" }, { "docid": "9815ae3d7c45b9706ade06eb290192d0", "score": "0.6650617", "text": "func (e *Error) HTTPStatus() int {\n\tv, err := strconv.Atoi(e.Status)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn v\n}", "title": "" }, { "docid": "2f4c80b84aadc65a25e5c1d929c98975", "score": "0.665047", "text": "func (h *HttpError) StatusCode() int {\n\treturn h.HttpStatus\n}", "title": "" }, { "docid": "c1d5f2d7af812163e0fa32a08795f786", "score": "0.6649506", "text": "func (ctx *Context) Status(status int) {\n\tctx.Resp.WriteHeader(status)\n}", "title": "" }, { "docid": "b9926126ad9e31d186c30ed901f8b8d7", "score": "0.6636409", "text": "func (jrp JSONResultProvider) Status(statusCode int, response interface{}) Result {\n\treturn &JSONResult{\n\t\tStatusCode: statusCode,\n\t\tResponse: ResultOrDefault(response, http.StatusText(statusCode)),\n\t}\n}", "title": "" }, { "docid": "07b7a941c1f5d568a6ea7be782e3e142", "score": "0.6635376", "text": "func (o *AuthenticateOKBody) GetStatus() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Status\n}", "title": "" }, { "docid": "783c0a715df40405d8d0d678d47322b9", "score": "0.66339535", "text": "func (o OperationResponseOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v OperationResponse) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6aa2dc9e3f7f96604dd80e16b6e47ce1", "score": "0.6626504", "text": "func (se StatusError) HTTPCode() int { return se.httpCode }", "title": "" }, { "docid": "9dea83f5c2abb482293179637fce18fb", "score": "0.661444", "text": "func (e Errors) HTTPStatus() int {\n\tl := len(e.Err)\n\terr := e.Err[l-1]\n\treturn err.HTTPStatus()\n}", "title": "" }, { "docid": "c44f2a5889c3bec41de95e793043ce44", "score": "0.6612058", "text": "func (o SuppressionResponseOutput) Status() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SuppressionResponse) *string { return v.Status }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5b037597234581ada14664231abb5f89", "score": "0.6611892", "text": "func (mc *StandardClient) Status(ctx context.Context) (M, error) {\n\tsession, err := mc.Session(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn session.Status()\n}", "title": "" }, { "docid": "ef871085f0634ba758f2d3926be3317f", "score": "0.66109693", "text": "func (o ManagedCertificateResponseOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ManagedCertificateResponse) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "283e33be533e564ad6bcdaf945e38335", "score": "0.66106665", "text": "func (s statusError) StatusCode() int {\n\treturn s.HTTPStatusCode\n}", "title": "" }, { "docid": "caa303e69ba3131b755dd4e8597970b4", "score": "0.66029733", "text": "func (r Errors) StatusCode() int {\n\tif r.HasErrors() {\n\t\treturn strToInt(r.Errors[0].Status)\n\t}\n\treturn 200\n}", "title": "" }, { "docid": "363314626e34bdf3840f17f7bf046df7", "score": "0.6602898", "text": "func (s *Server) Status(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"Receive request to %s\\n\", r.URL.Path)\n\n\twbody := []byte(\"ready\\n\")\n\tif _, err := w.Write(wbody); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\n\ts.handlers.Dump()\n}", "title": "" }, { "docid": "167fbdda3000d7d3633544507afbaac0", "score": "0.6601075", "text": "func (n *Node) Status() (string, error) {\n\tv, _ := url.Parse(\"http://\" + n.APIAddr + \"/status\")\n\n\tresp, err := http.Get(v.String())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to read status response: %w\", err)\n\t}\n\tif resp.StatusCode != 200 {\n\t\treturn \"\", fmt.Errorf(\"status endpoint returned: %s (%s)\", resp.Status,\n\t\t\tstrings.TrimSuffix(string(body), \"\\n\"))\n\t}\n\treturn string(body), nil\n}", "title": "" }, { "docid": "09b5ef95c40ead786be773aff9bc6c93", "score": "0.65989834", "text": "func GetStatus(res http.ResponseWriter, req *http.Request) {\n\t// Retrieve render\n\tr := context.Get(req, CtxRender).(*render.Render)\n\n\t// Output struct for songs request\n\tout := StatusResponse{}\n\n\t// Check API version\n\tif version, ok := mux.Vars(req)[\"version\"]; ok {\n\t\t// Check if this API call is supported in the advertised version\n\t\tif !apiVersionSet.Has(version) {\n\t\t\tr.JSON(res, 400, errRes(400, \"unsupported API version: \"+version))\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Retrieve current server status\n\tstatus, err := common.ServerStatus()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tr.JSON(res, 500, serverErr)\n\t\treturn\n\t}\n\n\t// Copy into response\n\tout.Status = status\n\n\t// If requested, fetch additional metrics (not added by default due to full table scans in database)\n\tif req.URL.Query().Get(\"metrics\") == \"true\" {\n\t\tmetrics, err := common.ServerMetrics()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tr.JSON(res, 500, serverErr)\n\t\t\treturn\n\t\t}\n\n\t\t// Return metrics\n\t\tout.Metrics = metrics\n\t}\n\n\t// HTTP 200 OK with JSON\n\tout.Error = nil\n\tr.JSON(res, 200, out)\n\treturn\n}", "title": "" }, { "docid": "5296a0bdd5e658057636fcc62eb537a8", "score": "0.65922713", "text": "func (si *ServiceInstance) Status(requestID string) (string, error) {\n\ts, err := Get(si.ctx, si.ServiceName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tendpoint, err := s.getClientForPool(si.ctx, si.Pool)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn endpoint.Status(si.ctx, si, requestID)\n}", "title": "" }, { "docid": "df9f7f88362fe1df9350102d9dbda95c", "score": "0.6589396", "text": "func (o RolloutStepResponseOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RolloutStepResponse) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "182ea90bf5a22b4970e0d811834283e1", "score": "0.65798956", "text": "func Status(err error) int {\n\ttype Statuser interface {\n\t\tStatus() int\n\t}\n\n\tif status, ok := err.(Statuser); ok {\n\t\treturn status.Status()\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "bae537bc92605115706d4697f6d6cb06", "score": "0.6574329", "text": "func GetStatus(resp *http.Response) (string, error) {\n\tjsonBody, err := GetJSON(resp)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn status(jsonBody), nil\n}", "title": "" }, { "docid": "d0ed7489c86f77a94a634dea49da951c", "score": "0.65701145", "text": "func (o *HttpEvent) GetStatus() int64 {\n\tif o == nil || o.Status == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" } ]
0c672ba39fb8c67cdf5c1dfec5e73a3b
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database was failed.
[ { "docid": "1377d0e2b73fe395ab0a9cf6dde84fc4", "score": "0.81656414", "text": "func (m *JobMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase job.FieldJobName:\n\t\treturn m.OldJobName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Job field %s\", name)\n}", "title": "" } ]
[ { "docid": "c56e0aad4a657918416e9a0564ab7098", "score": "0.84551734", "text": "func (m *WritelogMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase writelog.FieldAdminID:\n\t\treturn m.OldAdminID(ctx)\n\tcase writelog.FieldResource:\n\t\treturn m.OldResource(ctx)\n\tcase writelog.FieldActions:\n\t\treturn m.OldActions(ctx)\n\tcase writelog.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Writelog field %s\", name)\n}", "title": "" }, { "docid": "888366bb94fef87567bf84717494db83", "score": "0.84465986", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldAge:\n\t\treturn m.OldAge(ctx)\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "8dfb202492b600a0fcee1a8efa057250", "score": "0.83772737", "text": "func (m *DetectionJobInstanceMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase detectionjobinstance.FieldCreateTime:\n\t\treturn m.OldCreateTime(ctx)\n\tcase detectionjobinstance.FieldUpdateTime:\n\t\treturn m.OldUpdateTime(ctx)\n\tcase detectionjobinstance.FieldStartedAt:\n\t\treturn m.OldStartedAt(ctx)\n\tcase detectionjobinstance.FieldFinishedAt:\n\t\treturn m.OldFinishedAt(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown DetectionJobInstance field %s\", name)\n}", "title": "" }, { "docid": "6d6a9baea051862d937f203d4a516718", "score": "0.83743805", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldCreateTime:\n\t\treturn m.OldCreateTime(ctx)\n\tcase user.FieldUpdateTime:\n\t\treturn m.OldUpdateTime(ctx)\n\tcase user.FieldDeletedAt:\n\t\treturn m.OldDeletedAt(ctx)\n\tcase user.FieldUID:\n\t\treturn m.OldUID(ctx)\n\tcase user.FieldPhone:\n\t\treturn m.OldPhone(ctx)\n\tcase user.FieldStatus:\n\t\treturn m.OldStatus(ctx)\n\tcase user.FieldExtend:\n\t\treturn m.OldExtend(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "e6588d39b2824cf333129d9c5dcd327f", "score": "0.8367934", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldAge:\n\t\treturn m.OldAge(ctx)\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase user.FieldEmail:\n\t\treturn m.OldEmail(ctx)\n\tcase user.FieldPassword:\n\t\treturn m.OldPassword(ctx)\n\tcase user.FieldBirth:\n\t\treturn m.OldBirth(ctx)\n\tcase user.FieldTel:\n\t\treturn m.OldTel(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "8c66cd941088ac56db6fe5ed8e98dc45", "score": "0.8364525", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldPersonalID:\n\t\treturn m.OldPersonalID(ctx)\n\tcase user.FieldPersonalName:\n\t\treturn m.OldPersonalName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "8c66cd941088ac56db6fe5ed8e98dc45", "score": "0.8364525", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldPersonalID:\n\t\treturn m.OldPersonalID(ctx)\n\tcase user.FieldPersonalName:\n\t\treturn m.OldPersonalName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "f537df9e9c2fe85670083d3ca04bf6ca", "score": "0.836182", "text": "func (m *FileinsertMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase fileinsert.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase fileinsert.FieldImportdate:\n\t\treturn m.OldImportdate(ctx)\n\tcase fileinsert.FieldIsSuccess:\n\t\treturn m.OldIsSuccess(ctx)\n\tcase fileinsert.FieldUpdateDate:\n\t\treturn m.OldUpdateDate(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Fileinsert field %s\", name)\n}", "title": "" }, { "docid": "ee03a17117e1c375ee79a6f8ae4de2ef", "score": "0.8360798", "text": "func (m *AdministratorMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase administrator.FieldUsername:\n\t\treturn m.OldUsername(ctx)\n\tcase administrator.FieldPassword:\n\t\treturn m.OldPassword(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Administrator field %s\", name)\n}", "title": "" }, { "docid": "b848fa4c77382eba8108b9f0752388d2", "score": "0.83361745", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldOptionalInt:\n\t\treturn m.OldOptionalInt(ctx)\n\tcase user.FieldAge:\n\t\treturn m.OldAge(ctx)\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase user.FieldLast:\n\t\treturn m.OldLast(ctx)\n\tcase user.FieldNickname:\n\t\treturn m.OldNickname(ctx)\n\tcase user.FieldAddress:\n\t\treturn m.OldAddress(ctx)\n\tcase user.FieldPhone:\n\t\treturn m.OldPhone(ctx)\n\tcase user.FieldPassword:\n\t\treturn m.OldPassword(ctx)\n\tcase user.FieldRole:\n\t\treturn m.OldRole(ctx)\n\tcase user.FieldEmployment:\n\t\treturn m.OldEmployment(ctx)\n\tcase user.FieldSSOCert:\n\t\treturn m.OldSSOCert(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "18b48a94b86f75a962a57df47cb307a8", "score": "0.8328236", "text": "func (m *NodeMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase node.FieldValue:\n\t\treturn m.OldValue(ctx)\n\tcase node.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Node field %s\", name)\n}", "title": "" }, { "docid": "67402cab57ecd70711d9d30ee4590d8b", "score": "0.83231795", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldTenant:\n\t\treturn m.OldTenant(ctx)\n\tcase user.FieldUUID:\n\t\treturn m.OldUUID(ctx)\n\tcase user.FieldParentID:\n\t\treturn m.OldParentID(ctx)\n\tcase user.FieldIsSuper:\n\t\treturn m.OldIsSuper(ctx)\n\tcase user.FieldData:\n\t\treturn m.OldData(ctx)\n\tcase user.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase user.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "03cd32f76b9dc94c6c944e6c726c9231", "score": "0.8322654", "text": "func (m *LogexportMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase logexport.FieldUserName:\n\t\treturn m.OldUserName(ctx)\n\tcase logexport.FieldFileName:\n\t\treturn m.OldFileName(ctx)\n\tcase logexport.FieldExportDate:\n\t\treturn m.OldExportDate(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Logexport field %s\", name)\n}", "title": "" }, { "docid": "db5efc6636e119177e828d01577f7e87", "score": "0.8317017", "text": "func (m *AnomalyMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase anomaly.FieldCreateTime:\n\t\treturn m.OldCreateTime(ctx)\n\tcase anomaly.FieldUpdateTime:\n\t\treturn m.OldUpdateTime(ctx)\n\tcase anomaly.FieldType:\n\t\treturn m.OldType(ctx)\n\tcase anomaly.FieldValue:\n\t\treturn m.OldValue(ctx)\n\tcase anomaly.FieldProcessed:\n\t\treturn m.OldProcessed(ctx)\n\tcase anomaly.FieldPeriodStart:\n\t\treturn m.OldPeriodStart(ctx)\n\tcase anomaly.FieldPeriodEnd:\n\t\treturn m.OldPeriodEnd(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Anomaly field %s\", name)\n}", "title": "" }, { "docid": "e2eb52a0da6a75ea6e2269e2d590279f", "score": "0.8313757", "text": "func (m *UserUserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase useruser.FieldIdolID:\n\t\treturn m.OldIdolID(ctx)\n\tcase useruser.FieldFollowerID:\n\t\treturn m.OldFollowerID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown UserUser field %s\", name)\n}", "title": "" }, { "docid": "20d76e5303c5a33814a3e03915c411e4", "score": "0.8307415", "text": "func (m *FileimportMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase fileimport.FieldFilename:\n\t\treturn m.OldFilename(ctx)\n\tcase fileimport.FieldFiletype:\n\t\treturn m.OldFiletype(ctx)\n\tcase fileimport.FieldImportdate:\n\t\treturn m.OldImportdate(ctx)\n\tcase fileimport.FieldStatus:\n\t\treturn m.OldStatus(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Fileimport field %s\", name)\n}", "title": "" }, { "docid": "9298bf98ec061aa828528a2a2eb16957", "score": "0.8306385", "text": "func (m *PatientMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase patient.FieldPatientName:\n\t\treturn m.OldPatientName(ctx)\n\tcase patient.FieldPatientAge:\n\t\treturn m.OldPatientAge(ctx)\n\tcase patient.FieldPatientWeight:\n\t\treturn m.OldPatientWeight(ctx)\n\tcase patient.FieldPatientHeight:\n\t\treturn m.OldPatientHeight(ctx)\n\tcase patient.FieldPatientPrefix:\n\t\treturn m.OldPatientPrefix(ctx)\n\tcase patient.FieldPatientGender:\n\t\treturn m.OldPatientGender(ctx)\n\tcase patient.FieldPatientBlood:\n\t\treturn m.OldPatientBlood(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Patient field %s\", name)\n}", "title": "" }, { "docid": "2c6f8cbe54b1591a87444b5a9a6cca09", "score": "0.830396", "text": "func (m *EmployeeMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase employee.FieldEMPLOYEENAME:\n\t\treturn m.OldEMPLOYEENAME(ctx)\n\tcase employee.FieldEMPLOYEEPASSWORD:\n\t\treturn m.OldEMPLOYEEPASSWORD(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Employee field %s\", name)\n}", "title": "" }, { "docid": "799278b4c79287196434eb9180aebe5c", "score": "0.82953376", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldUserName:\n\t\treturn m.OldUserName(ctx)\n\tcase user.FieldPassword:\n\t\treturn m.OldPassword(ctx)\n\tcase user.FieldSchool:\n\t\treturn m.OldSchool(ctx)\n\tcase user.FieldLevel:\n\t\treturn m.OldLevel(ctx)\n\tcase user.FieldLikes:\n\t\treturn m.OldLikes(ctx)\n\tcase user.FieldViews:\n\t\treturn m.OldViews(ctx)\n\tcase user.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase user.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase user.FieldIsDeleted:\n\t\treturn m.OldIsDeleted(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "001bdaa8442894e6c93ea2ec1c31c1b5", "score": "0.8290372", "text": "func (m *PatientMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase patient.FieldCardID:\n\t\treturn m.OldCardID(ctx)\n\tcase patient.FieldFistName:\n\t\treturn m.OldFistName(ctx)\n\tcase patient.FieldLastName:\n\t\treturn m.OldLastName(ctx)\n\tcase patient.FieldAllergic:\n\t\treturn m.OldAllergic(ctx)\n\tcase patient.FieldAge:\n\t\treturn m.OldAge(ctx)\n\tcase patient.FieldBirthday:\n\t\treturn m.OldBirthday(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Patient field %s\", name)\n}", "title": "" }, { "docid": "e63176af18f2d8bd9fd13d809498b32b", "score": "0.82881624", "text": "func (m *BillMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase bill.FieldPrice:\n\t\treturn m.OldPrice(ctx)\n\tcase bill.FieldTime:\n\t\treturn m.OldTime(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Bill field %s\", name)\n}", "title": "" }, { "docid": "bd8667668869485e5499e3aa853aa49b", "score": "0.828351", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldBusinessName:\n\t\treturn m.OldBusinessName(ctx)\n\tcase user.FieldAddress:\n\t\treturn m.OldAddress(ctx)\n\tcase user.FieldPhone:\n\t\treturn m.OldPhone(ctx)\n\tcase user.FieldRoleType:\n\t\treturn m.OldRoleType(ctx)\n\tcase user.FieldRemark:\n\t\treturn m.OldRemark(ctx)\n\tcase user.FieldIsValid:\n\t\treturn m.OldIsValid(ctx)\n\tcase user.FieldIsDelete:\n\t\treturn m.OldIsDelete(ctx)\n\tcase user.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase user.FieldCreatedBy:\n\t\treturn m.OldCreatedBy(ctx)\n\tcase user.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase user.FieldUpdatedBy:\n\t\treturn m.OldUpdatedBy(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "017e433e4efd006986ab4576955d3b70", "score": "0.82822007", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldUSEREMAIL:\n\t\treturn m.OldUSEREMAIL(ctx)\n\tcase user.FieldUSERNAME:\n\t\treturn m.OldUSERNAME(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "d17ce878b374f35f9946006a466a7633", "score": "0.82817173", "text": "func (m *AreahistoryMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase areahistory.FieldWalletID:\n\t\treturn m.OldWalletID(ctx)\n\tcase areahistory.FieldProvinceNameTH:\n\t\treturn m.OldProvinceNameTH(ctx)\n\tcase areahistory.FieldDistrictNameTH:\n\t\treturn m.OldDistrictNameTH(ctx)\n\tcase areahistory.FieldSubDistrict:\n\t\treturn m.OldSubDistrict(ctx)\n\tcase areahistory.FieldRankArea:\n\t\treturn m.OldRankArea(ctx)\n\tcase areahistory.FieldDateCalRank:\n\t\treturn m.OldDateCalRank(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Areahistory field %s\", name)\n}", "title": "" }, { "docid": "9d61b7e047c14d3c465181d09b76d3d6", "score": "0.8279922", "text": "func (m *CampaignMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase campaign.FieldName:\n\t\treturn m.OldName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Campaign field %s\", name)\n}", "title": "" }, { "docid": "3bc22bff8e3dba603d889132bf740e10", "score": "0.8278822", "text": "func (m *EmployeeMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase employee.FieldEmployeename:\n\t\treturn m.OldEmployeename(ctx)\n\tcase employee.FieldEmployeeemail:\n\t\treturn m.OldEmployeeemail(ctx)\n\tcase employee.FieldPassword:\n\t\treturn m.OldPassword(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Employee field %s\", name)\n}", "title": "" }, { "docid": "4401430de5382b3f9cc5e4b989222bf3", "score": "0.8276552", "text": "func (m *DeletedVlanLogMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase deletedvlanlog.FieldVlanID:\n\t\treturn m.OldVlanID(ctx)\n\tcase deletedvlanlog.FieldDeleted:\n\t\treturn m.OldDeleted(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown DeletedVlanLog field %s\", name)\n}", "title": "" }, { "docid": "905eddf0b3a9c972d6040fc2c0e99bf0", "score": "0.82715106", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "2f52ad998438262f4b872b978f8a9b7d", "score": "0.82710314", "text": "func (m *RepairInvoiceMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase repairinvoice.FieldRename:\n\t\treturn m.OldRename(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown RepairInvoice field %s\", name)\n}", "title": "" }, { "docid": "f17c7b1f7df308cbcb3538bfc10c80af", "score": "0.826917", "text": "func (m *GoodsMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\treturn nil, fmt.Errorf(\"unknown Goods field %s\", name)\n}", "title": "" }, { "docid": "02193f00e3016384558764986dc98995", "score": "0.82485604", "text": "func (m *DemoMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase demo.FieldCode:\n\t\treturn m.OldCode(ctx)\n\tcase demo.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase demo.FieldMemo:\n\t\treturn m.OldMemo(ctx)\n\tcase demo.FieldStatus:\n\t\treturn m.OldStatus(ctx)\n\tcase demo.FieldCreator:\n\t\treturn m.OldCreator(ctx)\n\tcase demo.FieldUpdator:\n\t\treturn m.OldUpdator(ctx)\n\tcase demo.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase demo.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Demo field %s\", name)\n}", "title": "" }, { "docid": "2771bad1892919f451943c1bd1784bd0", "score": "0.82483006", "text": "func (m *PetMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase pet.FieldAge:\n\t\treturn m.OldAge(ctx)\n\tcase pet.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase pet.FieldUUID:\n\t\treturn m.OldUUID(ctx)\n\tcase pet.FieldNickname:\n\t\treturn m.OldNickname(ctx)\n\tcase pet.FieldTrained:\n\t\treturn m.OldTrained(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Pet field %s\", name)\n}", "title": "" }, { "docid": "d89b0695d38fb400bfb298d5e3f700e0", "score": "0.82481915", "text": "func (m *UserStatusMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase userstatus.FieldSTATUS:\n\t\treturn m.OldSTATUS(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown UserStatus field %s\", name)\n}", "title": "" }, { "docid": "1e1db0f45edf9f55bc1d55b8dd8d2112", "score": "0.8247807", "text": "func (m *QuestionMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase question.FieldWeight:\n\t\treturn m.OldWeight(ctx)\n\tcase question.FieldType:\n\t\treturn m.OldType(ctx)\n\tcase question.FieldBody:\n\t\treturn m.OldBody(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Question field %s\", name)\n}", "title": "" }, { "docid": "5a4951cbcf7cbc11206a718726a23d20", "score": "0.8242277", "text": "func (m *TodoMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase todo.FieldContent:\n\t\treturn m.OldContent(ctx)\n\tcase todo.FieldCompleted:\n\t\treturn m.OldCompleted(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Todo field %s\", name)\n}", "title": "" }, { "docid": "6fd67a56fa68857588c3bfb2b24c80bd", "score": "0.82392424", "text": "func (m *OptMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase opt.FieldBody:\n\t\treturn m.OldBody(ctx)\n\tcase opt.FieldWeight:\n\t\treturn m.OldWeight(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Opt field %s\", name)\n}", "title": "" }, { "docid": "5ca445d7047a8630ec58825e08f33950", "score": "0.82336944", "text": "func (m *GoodsSpuImgsMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase goodsspuimgs.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase goodsspuimgs.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase goodsspuimgs.FieldDeletedAt:\n\t\treturn m.OldDeletedAt(ctx)\n\tcase goodsspuimgs.FieldImgName:\n\t\treturn m.OldImgName(ctx)\n\tcase goodsspuimgs.FieldImgPath:\n\t\treturn m.OldImgPath(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown GoodsSpuImgs field %s\", name)\n}", "title": "" }, { "docid": "e0aa893cf8910d8fe1ebb69ec7680fff", "score": "0.82312834", "text": "func (m *StatustMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase statust.FieldStatustname:\n\t\treturn m.OldStatustname(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Statust field %s\", name)\n}", "title": "" }, { "docid": "1d6e74cba992209b564442ea36242db4", "score": "0.8229315", "text": "func (m *FileMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase file.FieldSize:\n\t\treturn m.OldSize(ctx)\n\tcase file.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase file.FieldUser:\n\t\treturn m.OldUser(ctx)\n\tcase file.FieldGroup:\n\t\treturn m.OldGroup(ctx)\n\tcase file.FieldOp:\n\t\treturn m.OldOp(ctx)\n\tcase file.FieldFieldID:\n\t\treturn m.OldFieldID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown File field %s\", name)\n}", "title": "" }, { "docid": "b853a28d99bdc5d75137d112d193ddd3", "score": "0.8226979", "text": "func (m *BulkMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase bulk.FieldBulkCreditSameday:\n\t\treturn m.OldBulkCreditSameday(ctx)\n\tcase bulk.FieldBulkCreditSamedayFee:\n\t\treturn m.OldBulkCreditSamedayFee(ctx)\n\tcase bulk.FieldTransfertobankaccount:\n\t\treturn m.OldTransfertobankaccount(ctx)\n\tcase bulk.FieldDateTime:\n\t\treturn m.OldDateTime(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Bulk field %s\", name)\n}", "title": "" }, { "docid": "dfd938c00d18512800e15ee3cddfe146", "score": "0.82256484", "text": "func (m *DoctorMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase doctor.FieldEmail:\n\t\treturn m.OldEmail(ctx)\n\tcase doctor.FieldPassword:\n\t\treturn m.OldPassword(ctx)\n\tcase doctor.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase doctor.FieldTel:\n\t\treturn m.OldTel(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Doctor field %s\", name)\n}", "title": "" }, { "docid": "8c7c302d23bbb867f2905e8da6f0504f", "score": "0.82249475", "text": "func (m *FundMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase fund.FieldFundName:\n\t\treturn m.OldFundName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Fund field %s\", name)\n}", "title": "" }, { "docid": "21810786082c575cfc6a05a909e865f9", "score": "0.8221014", "text": "func (m *OccupationhistoryMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase occupationhistory.FieldWalletID:\n\t\treturn m.OldWalletID(ctx)\n\tcase occupationhistory.FieldOccupationName:\n\t\treturn m.OldOccupationName(ctx)\n\tcase occupationhistory.FieldRankOccupation:\n\t\treturn m.OldRankOccupation(ctx)\n\tcase occupationhistory.FieldDateCalRank:\n\t\treturn m.OldDateCalRank(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Occupationhistory field %s\", name)\n}", "title": "" }, { "docid": "e555d5301d7ccb989a925d56ff9b6699", "score": "0.8211642", "text": "func (m *RestaurantMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase restaurant.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase restaurant.FieldURL:\n\t\treturn m.OldURL(ctx)\n\tcase restaurant.FieldPhone:\n\t\treturn m.OldPhone(ctx)\n\tcase restaurant.FieldPrice:\n\t\treturn m.OldPrice(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Restaurant field %s\", name)\n}", "title": "" }, { "docid": "527680e174cbadb0cb962f0fb705bcea", "score": "0.8208984", "text": "func (m *APIMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\treturn nil, fmt.Errorf(\"unknown Api field %s\", name)\n}", "title": "" }, { "docid": "0a0fef5599fd97d7d4a63eb183c975e8", "score": "0.8206907", "text": "func (m *UserTopicMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase usertopic.FieldUserID:\n\t\treturn m.OldUserID(ctx)\n\tcase usertopic.FieldTopicID:\n\t\treturn m.OldTopicID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown UserTopic field %s\", name)\n}", "title": "" }, { "docid": "efd344ab046e968d0fa07bde36d5e773", "score": "0.82035875", "text": "func (m *VlanMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase vlan.FieldVlanID:\n\t\treturn m.OldVlanID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Vlan field %s\", name)\n}", "title": "" }, { "docid": "f030c750dc723cc17df663c3eeecb3e4", "score": "0.8197166", "text": "func (m *WatchlisthistoryMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase watchlisthistory.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase watchlisthistory.FieldTaxID:\n\t\treturn m.OldTaxID(ctx)\n\tcase watchlisthistory.FieldTypeName:\n\t\treturn m.OldTypeName(ctx)\n\tcase watchlisthistory.FieldRankWatchlist:\n\t\treturn m.OldRankWatchlist(ctx)\n\tcase watchlisthistory.FieldStatusDel:\n\t\treturn m.OldStatusDel(ctx)\n\tcase watchlisthistory.FieldDateCalRank:\n\t\treturn m.OldDateCalRank(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Watchlisthistory field %s\", name)\n}", "title": "" }, { "docid": "a0bbe0c2aa5fa1a11153091651ba5327", "score": "0.8197024", "text": "func (m *ReturninvoiceMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase returninvoice.FieldAddedtime:\n\t\treturn m.OldAddedtime(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Returninvoice field %s\", name)\n}", "title": "" }, { "docid": "75e49b22752c470d6eb321b35a2249be", "score": "0.8195043", "text": "func (m *AccountMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase account.FieldEmailAddress:\n\t\treturn m.OldEmailAddress(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Account field %s\", name)\n}", "title": "" }, { "docid": "f0d4829dafe1a0b7a389b80e0c0ff8e5", "score": "0.8193031", "text": "func (m *LikeMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase like.FieldUserID:\n\t\treturn m.OldUserID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Like field %s\", name)\n}", "title": "" }, { "docid": "0c2b40221bf3276fc8b69b3485c4d8ed", "score": "0.8188134", "text": "func (m *DeviceMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase device.FieldDname:\n\t\treturn m.OldDname(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Device field %s\", name)\n}", "title": "" }, { "docid": "eca2c1ea3e43faf2e6e2153a66870eab", "score": "0.81876665", "text": "func (m *TransactionfactorhistoryMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase transactionfactorhistory.FieldWalletID:\n\t\treturn m.OldWalletID(ctx)\n\tcase transactionfactorhistory.FieldRankTransactionFactor:\n\t\treturn m.OldRankTransactionFactor(ctx)\n\tcase transactionfactorhistory.FieldDateCalRank:\n\t\treturn m.OldDateCalRank(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Transactionfactorhistory field %s\", name)\n}", "title": "" }, { "docid": "9c688b696e4bfe2bbba34aa727fd4cb0", "score": "0.8185425", "text": "func (m *BillMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase bill.FieldPayNumber:\n\t\treturn m.OldPayNumber(ctx)\n\tcase bill.FieldPayTotal:\n\t\treturn m.OldPayTotal(ctx)\n\tcase bill.FieldPayTime:\n\t\treturn m.OldPayTime(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Bill field %s\", name)\n}", "title": "" }, { "docid": "b5c9d24fff499fa5862536a9a37208fd", "score": "0.8184119", "text": "func (m *ConfirmationMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase confirmation.FieldAdddate:\n\t\treturn m.OldAdddate(ctx)\n\tcase confirmation.FieldBookingstart:\n\t\treturn m.OldBookingstart(ctx)\n\tcase confirmation.FieldBookingend:\n\t\treturn m.OldBookingend(ctx)\n\tcase confirmation.FieldHourstime:\n\t\treturn m.OldHourstime(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Confirmation field %s\", name)\n}", "title": "" }, { "docid": "fd07b2c0881679fffdd858a026c907a0", "score": "0.81835604", "text": "func (m *ForumMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\treturn nil, fmt.Errorf(\"unknown Forum field %s\", name)\n}", "title": "" }, { "docid": "f7dfaf7a3a182a59bdad5d832ae7786a", "score": "0.8183431", "text": "func (m *OrganizationMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase organization.FieldName:\n\t\treturn m.OldName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Organization field %s\", name)\n}", "title": "" }, { "docid": "35c9d39ddc85d5a62fd5dbb23b92c89f", "score": "0.81828815", "text": "func (m *DepartmentMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase department.FieldDepartment:\n\t\treturn m.OldDepartment(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Department field %s\", name)\n}", "title": "" }, { "docid": "e1f1a4986c797fcf1ff5d25ea7326bae", "score": "0.8181393", "text": "func (m *PostMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase post.FieldContent:\n\t\treturn m.OldContent(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Post field %s\", name)\n}", "title": "" }, { "docid": "8921710ae3bced4aa1bd9ba72e41417c", "score": "0.8180055", "text": "func (m *UserUserTopicMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase userusertopic.FieldInviterID:\n\t\treturn m.OldInviterID(ctx)\n\tcase userusertopic.FieldInvitedID:\n\t\treturn m.OldInvitedID(ctx)\n\tcase userusertopic.FieldTopicID:\n\t\treturn m.OldTopicID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown UserUserTopic field %s\", name)\n}", "title": "" }, { "docid": "3531a69308f0d8487f7b7554ac448391", "score": "0.81694996", "text": "func (m *TagMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase tag.FieldTagName:\n\t\treturn m.OldTagName(ctx)\n\tcase tag.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase tag.FieldBaned:\n\t\treturn m.OldBaned(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Tag field %s\", name)\n}", "title": "" }, { "docid": "2d3a0b84bb69a8f5085eecf87dff7df5", "score": "0.8169335", "text": "func (m *NodeMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase node.FieldTenant:\n\t\treturn m.OldTenant(ctx)\n\tcase node.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase node.FieldType:\n\t\treturn m.OldType(ctx)\n\tcase node.FieldParentID:\n\t\treturn m.OldParentID(ctx)\n\tcase node.FieldData:\n\t\treturn m.OldData(ctx)\n\tcase node.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase node.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Node field %s\", name)\n}", "title": "" }, { "docid": "c969b73666ba80de66626bfec29a6734", "score": "0.81660014", "text": "func (m *GroupMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase group.FieldActive:\n\t\treturn m.OldActive(ctx)\n\tcase group.FieldExpire:\n\t\treturn m.OldExpire(ctx)\n\tcase group.FieldType:\n\t\treturn m.OldType(ctx)\n\tcase group.FieldMaxUsers:\n\t\treturn m.OldMaxUsers(ctx)\n\tcase group.FieldName:\n\t\treturn m.OldName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Group field %s\", name)\n}", "title": "" }, { "docid": "744bf20f1f2c9cf54244877a9c77515d", "score": "0.81657696", "text": "func (m *DetectionJobMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase detectionjob.FieldCreateTime:\n\t\treturn m.OldCreateTime(ctx)\n\tcase detectionjob.FieldUpdateTime:\n\t\treturn m.OldUpdateTime(ctx)\n\tcase detectionjob.FieldSchedule:\n\t\treturn m.OldSchedule(ctx)\n\tcase detectionjob.FieldMethod:\n\t\treturn m.OldMethod(ctx)\n\tcase detectionjob.FieldSiteID:\n\t\treturn m.OldSiteID(ctx)\n\tcase detectionjob.FieldMetric:\n\t\treturn m.OldMetric(ctx)\n\tcase detectionjob.FieldAttribute:\n\t\treturn m.OldAttribute(ctx)\n\tcase detectionjob.FieldTimeAgo:\n\t\treturn m.OldTimeAgo(ctx)\n\tcase detectionjob.FieldTimeStep:\n\t\treturn m.OldTimeStep(ctx)\n\tcase detectionjob.FieldDescription:\n\t\treturn m.OldDescription(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown DetectionJob field %s\", name)\n}", "title": "" }, { "docid": "c6e5f76d7a32c8baa30eb4cce825fe6c", "score": "0.81657135", "text": "func (m *TagMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\treturn nil, fmt.Errorf(\"unknown Tag field %s\", name)\n}", "title": "" }, { "docid": "6e021cd0a967671aa6243632a611d5c2", "score": "0.8163599", "text": "func (m *AnswerMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase answer.FieldContent:\n\t\treturn m.OldContent(ctx)\n\tcase answer.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase answer.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase answer.FieldIsDeleted:\n\t\treturn m.OldIsDeleted(ctx)\n\tcase answer.FieldCreaterID:\n\t\treturn m.OldCreaterID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Answer field %s\", name)\n}", "title": "" }, { "docid": "4d4336b863402e23c805b0553be8cc59", "score": "0.8160036", "text": "func (m *TopicMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase topic.FieldTitle:\n\t\treturn m.OldTitle(ctx)\n\tcase topic.FieldContent:\n\t\treturn m.OldContent(ctx)\n\tcase topic.FieldIsReleased:\n\t\treturn m.OldIsReleased(ctx)\n\tcase topic.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase topic.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase topic.FieldCreaterID:\n\t\treturn m.OldCreaterID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Topic field %s\", name)\n}", "title": "" }, { "docid": "d201101b436c777fe53af7f40de5938d", "score": "0.8155759", "text": "func (m *ItemMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase item.FieldText:\n\t\treturn m.OldText(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Item field %s\", name)\n}", "title": "" }, { "docid": "dad9720ea83ab91d5405ab65fdfd972a", "score": "0.8155375", "text": "func (m *GoodsSpuMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase goodsspu.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase goodsspu.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase goodsspu.FieldDeletedAt:\n\t\treturn m.OldDeletedAt(ctx)\n\tcase goodsspu.FieldSpuName:\n\t\treturn m.OldSpuName(ctx)\n\tcase goodsspu.FieldSpuCode:\n\t\treturn m.OldSpuCode(ctx)\n\tcase goodsspu.FieldSpuHeadImg:\n\t\treturn m.OldSpuHeadImg(ctx)\n\tcase goodsspu.FieldSalesNum:\n\t\treturn m.OldSalesNum(ctx)\n\tcase goodsspu.FieldSpuDesc:\n\t\treturn m.OldSpuDesc(ctx)\n\tcase goodsspu.FieldSpuDetails:\n\t\treturn m.OldSpuDetails(ctx)\n\tcase goodsspu.FieldIsCustomSku:\n\t\treturn m.OldIsCustomSku(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown GoodsSpu field %s\", name)\n}", "title": "" }, { "docid": "b584c07a29e4cd56402ebc7af7115d87", "score": "0.8155155", "text": "func (m *PointkycrvMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase pointkycrv.FieldDateTimeGen:\n\t\treturn m.OldDateTimeGen(ctx)\n\tcase pointkycrv.FieldWalletID:\n\t\treturn m.OldWalletID(ctx)\n\tcase pointkycrv.FieldStatusGen:\n\t\treturn m.OldStatusGen(ctx)\n\tcase pointkycrv.FieldKYCDate:\n\t\treturn m.OldKYCDate(ctx)\n\tcase pointkycrv.FieldRVDate:\n\t\treturn m.OldRVDate(ctx)\n\tcase pointkycrv.FieldType:\n\t\treturn m.OldType(ctx)\n\tcase pointkycrv.FieldPoint:\n\t\treturn m.OldPoint(ctx)\n\tcase pointkycrv.FieldFileimportID:\n\t\treturn m.OldFileimportID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Pointkycrv field %s\", name)\n}", "title": "" }, { "docid": "6906a8443df51d9b6a258d90b4f6ce6f", "score": "0.81546426", "text": "func (m *FileTypeMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase filetype.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase filetype.FieldType:\n\t\treturn m.OldType(ctx)\n\tcase filetype.FieldState:\n\t\treturn m.OldState(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown FileType field %s\", name)\n}", "title": "" }, { "docid": "5066640809010c0ea2c2204eac6b887c", "score": "0.8152084", "text": "func (m *GoodsClassifyMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase goodsclassify.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase goodsclassify.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase goodsclassify.FieldDeletedAt:\n\t\treturn m.OldDeletedAt(ctx)\n\tcase goodsclassify.FieldClassifyName:\n\t\treturn m.OldClassifyName(ctx)\n\tcase goodsclassify.FieldClassifyCode:\n\t\treturn m.OldClassifyCode(ctx)\n\tcase goodsclassify.FieldPid:\n\t\treturn m.OldPid(ctx)\n\tcase goodsclassify.FieldLevel:\n\t\treturn m.OldLevel(ctx)\n\tcase goodsclassify.FieldSort:\n\t\treturn m.OldSort(ctx)\n\tcase goodsclassify.FieldIcon:\n\t\treturn m.OldIcon(ctx)\n\tcase goodsclassify.FieldIsDisable:\n\t\treturn m.OldIsDisable(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown GoodsClassify field %s\", name)\n}", "title": "" }, { "docid": "aa4ccd122ce2eb35b1de2031155e6a33", "score": "0.81503755", "text": "func (m *UserprofileMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase userprofile.FieldUserId:\n\t\treturn m.OldUserId(ctx)\n\tcase userprofile.FieldFirstname:\n\t\treturn m.OldFirstname(ctx)\n\tcase userprofile.FieldLastname:\n\t\treturn m.OldLastname(ctx)\n\tcase userprofile.FieldPhoneNo:\n\t\treturn m.OldPhoneNo(ctx)\n\tcase userprofile.FieldEmail:\n\t\treturn m.OldEmail(ctx)\n\tcase userprofile.FieldCitizenId:\n\t\treturn m.OldCitizenId(ctx)\n\tcase userprofile.FieldBirthDate:\n\t\treturn m.OldBirthDate(ctx)\n\tcase userprofile.FieldGender:\n\t\treturn m.OldGender(ctx)\n\tcase userprofile.FieldBusinessAddress:\n\t\treturn m.OldBusinessAddress(ctx)\n\tcase userprofile.FieldOccupationId:\n\t\treturn m.OldOccupationId(ctx)\n\tcase userprofile.FieldFileimportID:\n\t\treturn m.OldFileimportID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Userprofile field %s\", name)\n}", "title": "" }, { "docid": "9f11c1516df89fe2520fded04bd24e0e", "score": "0.81454396", "text": "func (m *CoveredPersonMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\treturn nil, fmt.Errorf(\"unknown CoveredPerson field %s\", name)\n}", "title": "" }, { "docid": "8f58cd406234e5f2577a103a86035f50", "score": "0.8140378", "text": "func (m *PendingkycMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase pendingkyc.FieldWalletID:\n\t\treturn m.OldWalletID(ctx)\n\tcase pendingkyc.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase pendingkyc.FieldAgentID:\n\t\treturn m.OldAgentID(ctx)\n\tcase pendingkyc.FieldAgentNameLastname:\n\t\treturn m.OldAgentNameLastname(ctx)\n\tcase pendingkyc.FieldKYCDate:\n\t\treturn m.OldKYCDate(ctx)\n\tcase pendingkyc.FieldDateGen:\n\t\treturn m.OldDateGen(ctx)\n\tcase pendingkyc.FieldStatusGen:\n\t\treturn m.OldStatusGen(ctx)\n\tcase pendingkyc.FieldPoint:\n\t\treturn m.OldPoint(ctx)\n\tcase pendingkyc.FieldFileimportID:\n\t\treturn m.OldFileimportID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Pendingkyc field %s\", name)\n}", "title": "" }, { "docid": "a939b8a9a6e519b9d4ab40d2c3f39b89", "score": "0.8137606", "text": "func (m *TransactionfactoritemMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase transactionfactoritem.FieldTransactionFactorID:\n\t\treturn m.OldTransactionFactorID(ctx)\n\tcase transactionfactoritem.FieldMin:\n\t\treturn m.OldMin(ctx)\n\tcase transactionfactoritem.FieldMax:\n\t\treturn m.OldMax(ctx)\n\tcase transactionfactoritem.FieldRank:\n\t\treturn m.OldRank(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Transactionfactoritem field %s\", name)\n}", "title": "" }, { "docid": "d4deb311a92f5f17ee47a99a64cfc7f9", "score": "0.8134815", "text": "func (m *WatchlistMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase watchlist.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase watchlist.FieldTaxID:\n\t\treturn m.OldTaxID(ctx)\n\tcase watchlist.FieldRankWatchlist:\n\t\treturn m.OldRankWatchlist(ctx)\n\tcase watchlist.FieldFileimportID:\n\t\treturn m.OldFileimportID(ctx)\n\tcase watchlist.FieldIsDeleted:\n\t\treturn m.OldIsDeleted(ctx)\n\tcase watchlist.FieldImportDate:\n\t\treturn m.OldImportDate(ctx)\n\tcase watchlist.FieldUserUpload:\n\t\treturn m.OldUserUpload(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Watchlist field %s\", name)\n}", "title": "" }, { "docid": "d5e05e2a600ee25d30682fcfe8fccdf6", "score": "0.81304914", "text": "func (m *DeviceMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase device.FieldDeviceName:\n\t\treturn m.OldDeviceName(ctx)\n\tcase device.FieldDeviceHostname:\n\t\treturn m.OldDeviceHostname(ctx)\n\tcase device.FieldDeviceUsername:\n\t\treturn m.OldDeviceUsername(ctx)\n\tcase device.FieldDevicePassword:\n\t\treturn m.OldDevicePassword(ctx)\n\tcase device.FieldDeviceSecret:\n\t\treturn m.OldDeviceSecret(ctx)\n\tcase device.FieldDeviceSSHPort:\n\t\treturn m.OldDeviceSSHPort(ctx)\n\tcase device.FieldDeviceCommitConfig:\n\t\treturn m.OldDeviceCommitConfig(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Device field %s\", name)\n}", "title": "" }, { "docid": "c1e6f2b6d5399f93545ab5dc825b876b", "score": "0.8130307", "text": "func (m *AgenttypeMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase agenttype.FieldAgentid:\n\t\treturn m.OldAgentid(ctx)\n\tcase agenttype.FieldAgentname:\n\t\treturn m.OldAgentname(ctx)\n\tcase agenttype.FieldAgenttype:\n\t\treturn m.OldAgenttype(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Agenttype field %s\", name)\n}", "title": "" }, { "docid": "5fe105ee9055bd587b47d4352ed46e0d", "score": "0.81280625", "text": "func (m *TaskMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase enttask.FieldPriority:\n\t\treturn m.OldPriority(ctx)\n\tcase enttask.FieldPriorities:\n\t\treturn m.OldPriorities(ctx)\n\tcase enttask.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Task field %s\", name)\n}", "title": "" }, { "docid": "743060c16af0520554f5ab66b896dc4d", "score": "0.8124404", "text": "func (m *RoomMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase room.FieldRname:\n\t\treturn m.OldRname(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Room field %s\", name)\n}", "title": "" }, { "docid": "743060c16af0520554f5ab66b896dc4d", "score": "0.8124404", "text": "func (m *RoomMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase room.FieldRname:\n\t\treturn m.OldRname(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Room field %s\", name)\n}", "title": "" }, { "docid": "9e4e6776e647a0b2aee3d9c5150e36b7", "score": "0.8120439", "text": "func (m *TransactionfactorMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase transactionfactor.FieldTransactionFactorName:\n\t\treturn m.OldTransactionFactorName(ctx)\n\tcase transactionfactor.FieldTransactionType:\n\t\treturn m.OldTransactionType(ctx)\n\tcase transactionfactor.FieldPaymentChannel:\n\t\treturn m.OldPaymentChannel(ctx)\n\tcase transactionfactor.FieldPaymentType:\n\t\treturn m.OldPaymentType(ctx)\n\tcase transactionfactor.FieldNumDay:\n\t\treturn m.OldNumDay(ctx)\n\tcase transactionfactor.FieldDate:\n\t\treturn m.OldDate(ctx)\n\tcase transactionfactor.FieldUpdateDate:\n\t\treturn m.OldUpdateDate(ctx)\n\tcase transactionfactor.FieldStatusApprove:\n\t\treturn m.OldStatusApprove(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Transactionfactor field %s\", name)\n}", "title": "" }, { "docid": "8c285fe7198d34debdf88ae0e273a177", "score": "0.8120168", "text": "func (m *PointtransactionMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase pointtransaction.FieldDate:\n\t\treturn m.OldDate(ctx)\n\tcase pointtransaction.FieldWalletID:\n\t\treturn m.OldWalletID(ctx)\n\tcase pointtransaction.FieldTransactionName:\n\t\treturn m.OldTransactionName(ctx)\n\tcase pointtransaction.FieldPoint:\n\t\treturn m.OldPoint(ctx)\n\tcase pointtransaction.FieldReference:\n\t\treturn m.OldReference(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Pointtransaction field %s\", name)\n}", "title": "" }, { "docid": "2cd9a6b3e7149301013c7941eb12f755", "score": "0.81172764", "text": "func (m *CertificateMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase certificate.FieldCertificateName:\n\t\treturn m.OldCertificateName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Certificate field %s\", name)\n}", "title": "" }, { "docid": "f7bc70b22879c0ab7fb28539c50267ee", "score": "0.81166404", "text": "func (m *GoodsSkuMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase goodssku.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase goodssku.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase goodssku.FieldDeletedAt:\n\t\treturn m.OldDeletedAt(ctx)\n\tcase goodssku.FieldSkuName:\n\t\treturn m.OldSkuName(ctx)\n\tcase goodssku.FieldSkuCode:\n\t\treturn m.OldSkuCode(ctx)\n\tcase goodssku.FieldStockNum:\n\t\treturn m.OldStockNum(ctx)\n\tcase goodssku.FieldSalesNum:\n\t\treturn m.OldSalesNum(ctx)\n\tcase goodssku.FieldPrice:\n\t\treturn m.OldPrice(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown GoodsSku field %s\", name)\n}", "title": "" }, { "docid": "5aeeea3419cc1dcf5831bd844028b6e4", "score": "0.8116524", "text": "func (m *RoomStatusMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase roomstatus.FieldSTATUSDATA:\n\t\treturn m.OldSTATUSDATA(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown RoomStatus field %s\", name)\n}", "title": "" }, { "docid": "e8f052ef824ff00b5e8cbe322b26cdf5", "score": "0.8111648", "text": "func (m *DoctorMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\r\n\tswitch name {\r\n\tcase doctor.FieldName:\r\n\t\treturn m.OldName(ctx)\r\n\t}\r\n\treturn nil, fmt.Errorf(\"unknown Doctor field %s\", name)\r\n}", "title": "" }, { "docid": "383767ec5504190d44986e59b184b633", "score": "0.81111103", "text": "func (m *TagTopicMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase tagtopic.FieldTagID:\n\t\treturn m.OldTagID(ctx)\n\tcase tagtopic.FieldTopicID:\n\t\treturn m.OldTopicID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown TagTopic field %s\", name)\n}", "title": "" }, { "docid": "00a55ea73dbb0dcc070e31ff59704db2", "score": "0.81092596", "text": "func (m *AnswerMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase answer.FieldQuestionID:\n\t\treturn m.OldQuestionID(ctx)\n\tcase answer.FieldBody:\n\t\treturn m.OldBody(ctx)\n\tcase answer.FieldOptionID:\n\t\treturn m.OldOptionID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Answer field %s\", name)\n}", "title": "" }, { "docid": "c75160234b5879c8b52ddf097b114f46", "score": "0.81080985", "text": "func (m *CountryMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\treturn nil, fmt.Errorf(\"unknown Country field %s\", name)\n}", "title": "" }, { "docid": "763d2870eb0fc5eac7970c79380fb582", "score": "0.810802", "text": "func (m *GenderMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase gender.FieldGenderType:\n\t\treturn m.OldGenderType(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Gender field %s\", name)\n}", "title": "" }, { "docid": "3634b44ac8657fb4aa7a3297e80bacc0", "score": "0.8107948", "text": "func (m *RoomMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase room.FieldROOMNUMBER:\n\t\treturn m.OldROOMNUMBER(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Room field %s\", name)\n}", "title": "" }, { "docid": "957e97f96a29caca17ad86cb41c8ed48", "score": "0.81034476", "text": "func (m *CardMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase card.FieldCreateTime:\n\t\treturn m.OldCreateTime(ctx)\n\tcase card.FieldUpdateTime:\n\t\treturn m.OldUpdateTime(ctx)\n\tcase card.FieldBalance:\n\t\treturn m.OldBalance(ctx)\n\tcase card.FieldNumber:\n\t\treturn m.OldNumber(ctx)\n\tcase card.FieldName:\n\t\treturn m.OldName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Card field %s\", name)\n}", "title": "" }, { "docid": "2edc91b28ad4267501118f7ae4641850", "score": "0.81031805", "text": "func (m *WatchlisttypeMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase watchlisttype.FieldTypeID:\n\t\treturn m.OldTypeID(ctx)\n\tcase watchlisttype.FieldTypeName:\n\t\treturn m.OldTypeName(ctx)\n\tcase watchlisttype.FieldTypeDescription:\n\t\treturn m.OldTypeDescription(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Watchlisttype field %s\", name)\n}", "title": "" }, { "docid": "d6bacf25f26672b51c3793361325d849", "score": "0.8100735", "text": "func (m *GoodsSpecsMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase goodsspecs.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase goodsspecs.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase goodsspecs.FieldDeletedAt:\n\t\treturn m.OldDeletedAt(ctx)\n\tcase goodsspecs.FieldSpecsName:\n\t\treturn m.OldSpecsName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown GoodsSpecs field %s\", name)\n}", "title": "" }, { "docid": "f3c6d96f75aaaaad1070eef1f8aee47f", "score": "0.8098725", "text": "func (m *ConfigoccupationMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase configoccupation.FieldOccupationName:\n\t\treturn m.OldOccupationName(ctx)\n\tcase configoccupation.FieldRank:\n\t\treturn m.OldRank(ctx)\n\tcase configoccupation.FieldRankTmp:\n\t\treturn m.OldRankTmp(ctx)\n\tcase configoccupation.FieldUpdateDate:\n\t\treturn m.OldUpdateDate(ctx)\n\tcase configoccupation.FieldApproveBy:\n\t\treturn m.OldApproveBy(ctx)\n\tcase configoccupation.FieldApproveDate:\n\t\treturn m.OldApproveDate(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Configoccupation field %s\", name)\n}", "title": "" }, { "docid": "cf03b0153fc85849f9aa55e4f4723e61", "score": "0.8098376", "text": "func (m *BankdetailMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase bankdetail.FieldBankAccountNo:\n\t\treturn m.OldBankAccountNo(ctx)\n\tcase bankdetail.FieldBankName:\n\t\treturn m.OldBankName(ctx)\n\tcase bankdetail.FieldBankAccountName:\n\t\treturn m.OldBankAccountName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Bankdetail field %s\", name)\n}", "title": "" }, { "docid": "c5e8fa7fd161913e068d7571cd6933a0", "score": "0.8094479", "text": "func (m *BookMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase book.FieldRESERVATIONS:\n\t\treturn m.OldRESERVATIONS(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Book field %s\", name)\n}", "title": "" }, { "docid": "edfb70aeb32f350e03345155c673f071", "score": "0.8093793", "text": "func (m *BeerMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase beer.FieldCreationdatebeer:\n\t\treturn m.OldCreationdatebeer(ctx)\n\tcase beer.FieldTitlebeer:\n\t\treturn m.OldTitlebeer(ctx)\n\tcase beer.FieldDescriptionbeer:\n\t\treturn m.OldDescriptionbeer(ctx)\n\tcase beer.FieldIdmedia:\n\t\treturn m.OldIdmedia(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Beer field %s\", name)\n}", "title": "" } ]
0ce34611e17cc06c8aa7a5c7d0ed8858
parse list text and return list
[ { "docid": "2d4b61d17ef6cbbb8abf92bf9fe955d4", "score": "0.6509497", "text": "func parseList(in string, patterns []string) (out []string, err error) {\n\tif len(patterns) < 2 {\n\t\treturn out, errors.New(\"List Patterns need 2+ patterns.\")\n\t}\n\tre, err := regexp.Compile(patterns[0])\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tall := re.FindAllString(in, -1)\n\n\tfor _, one := range all {\n\t\tfor i := 1; i < len(patterns); i++ {\n\t\t\tpattern := patterns[i]\n\t\t\tre, err := regexp.Compile(pattern)\n\t\t\tif err != nil {\n\t\t\t\treturn out, nil\n\t\t\t}\n\n\t\t\tone = re.FindString(one)\n\t\t}\n\t\tout = append(out, one)\n\t}\n\treturn out, nil\n}", "title": "" } ]
[ { "docid": "50c52f816fe97e5ab370c8aea483a096", "score": "0.6776886", "text": "func parseList(scanner *bufio.Scanner, count int) ([]string, error) {\n\tgot := 0\n\titems := make([]string, 0, count)\n\tfor {\n\t\tif !scanner.Scan() {\n\t\t\tif err := scanner.Err(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"expected either an empty line or a line with an item, unexpected EOF?\")\n\t\t}\n\t\tline := scanner.Text()\n\t\tif line == \"\" {\n\t\t\tif got < count {\n\t\t\t\treturn nil, fmt.Errorf(\"too few items (declared %d, got %d)\", count, got)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tgot++\n\t\tif got > count {\n\t\t\treturn nil, fmt.Errorf(\"too many items (declared %d)\", count)\n\t\t}\n\t\titems = append(items, line)\n\t}\n\treturn items, nil\n}", "title": "" }, { "docid": "0840aa0a3a5d6e3c4d487e6da4ba9494", "score": "0.67695075", "text": "func parseList() {\n\tbytes, _ := ioutil.ReadFile(\"lists.md\")\n\n\t// Regex to extract markdown links\n\tre := regexp.MustCompile(`\\[([^\\]]*)\\]\\(([^)]*)\\)`)\n\n\t// Read string line by line and apply regex\n\tscanner := bufio.NewScanner(strings.NewReader(string(bytes)))\n\tfor scanner.Scan() {\n\t\tmatches := re.FindAllStringSubmatch(scanner.Text(), -1)\n\t\twf.NewItem(matches[0][1]).Arg(matches[0][2]).Valid(true).UID(matches[0][1])\n\t}\n}", "title": "" }, { "docid": "cfd91bc477fe7dd816ceaf7469ef4ff8", "score": "0.6722444", "text": "func parseList(str string) []string {\n\tparsedString := strings.Split(str, \",\")\n\tfor i := range parsedString {\n\t\tparsedString[i] = strings.TrimSpace(strings.ReplaceAll(parsedString[i], \"[\", \"\"))\n\t\tparsedString[i] = strings.TrimSpace(strings.ReplaceAll(parsedString[i], \"]\", \"\"))\n\t\tif strings.TrimSpace(parsedString[i]) == \"*\" {\n\t\t\tparsedString[i] = \"\"\n\t\t}\n\t}\n\treturn parsedString\n}", "title": "" }, { "docid": "54d73df660f6a16e448faa7c50034ca1", "score": "0.6352055", "text": "func parseList(f io.Reader) ([]*VPN, error) {\n\t// First read to ignore invalid lines (first \"*vpnservers\", last \"*\").\n\tr := bufio.NewReader(f)\n\tvar buf bytes.Buffer\n\tfor {\n\t\tline, err := r.ReadString('\\n')\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif strings.HasPrefix(line, \"*\") {\n\t\t\tcontinue\n\t\t}\n\t\tbuf.WriteString(line)\n\t}\n\n\tc := csv.NewReader(&buf)\n\t_, err := c.Read() // Ignore CSV header.\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar s []*VPN\n\tfor {\n\t\tvpn, err := parseRecord(c)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ts = append(s, vpn)\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "d1a41a6cfca72f5755c049b18379b587", "score": "0.6326635", "text": "func splitList(list [][]byte, text []byte) [][]byte {\n\t// One comma-, space- or EOF-terminated element per iteration.\n\tfor i, j := 0, 0; i < len(text); i = j {\n\t\tfor j = i; j != len(text) && !isSeparator(text[j]); j++ {\n\t\t}\n\t\tlist = append(list, text[i:j])\n\t\t// Skip separators, but allow only one comma.\n\t\tfor sawComma := false; j < len(text) && isSeparator(text[j]); j++ {\n\t\t\tif text[j] == ',' {\n\t\t\t\tif sawComma {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tsawComma = true\n\t\t\t}\n\t\t}\n\t}\n\tif len(list) == 0 {\n\t\treturn nil\n\t}\n\tfor i, elem := range list {\n\t\telem = bytes.TrimSpace(elem)\n\t\tif !isPlausibleUserOrGroupName(elem) {\n\t\t\treturn nil\n\t\t}\n\t\tlist[i] = elem\n\t}\n\treturn list\n}", "title": "" }, { "docid": "e0f00ab321fec1b98cacaeb12248e6fa", "score": "0.6318358", "text": "func processListItems(s string) string {\n\tvar buffer bytes.Buffer\n\tordered, _ := regexp.MatchString(`^\\d`, s)\n\tif ordered {\n\t\tbuffer.WriteString(\"<ol>\\n\")\n\t} else {\n\t\tbuffer.WriteString(\"<ul>\\n\")\n\t}\n\n\tre := regexp.MustCompile( `(?m)^([*+-]|\\d+\\.)` )\n\tmarkers := re.FindAllStringSubmatchIndex(s, -1)\n\tfor x := 0; x < len(markers); x++ {\n\t\tstart := markers[x][1]\n\t\tvar end int\n\t\tif x < len(markers) - 1 {\n\t\t\tend = markers[x+1][0]\n\t\t} else {\n\t\t\tend = len(s)\n\t\t}\n\t\titem := strings.TrimSpace( s[start:end] )\n\n\t\tif strings.Index(item, \"\\n\") > -1 {\n\t\t\titem = runBlockGamut(outdent(item))\n\t\t}\n\n\t\tbuffer.WriteString(\"<li>\" + item + \"</li>\\n\")\n\t}\n\n\tif ordered {\n\t\tbuffer.WriteString(\"</ol>\\n\")\n\t} else {\n\t\tbuffer.WriteString(\"</ul>\\n\")\n\t}\n\n\treturn buffer.String()\n}", "title": "" }, { "docid": "6dd38feaef8568a6db9aa665b47a3881", "score": "0.62515014", "text": "func (t *Tokenizer) parseListItem() {\n\tif match := reListItem.FindStringSubmatch(t.text); match != nil {\n\t\tmatchTotal := match[0] // everything including ')' and trailing whitespace\n\t\tmatchItem := match[1] // the word or '*' before ')'\n\t\tt.addToken(TOKEN_LISTITEM, matchItem)\n\t\tt.skipChars(len(matchTotal))\n\t}\n}", "title": "" }, { "docid": "9f07ec3d0df2d28b1dc1450d2ff4f08e", "score": "0.6236726", "text": "func (p *Parser) parseList() (*ex.Expr, error) {\n\terr := p.expect(lexer.TagLPar)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := p.parseInner()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = p.expect(lexer.TagRPar)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "69d210602fc9404a121b3e0e13fb64c4", "score": "0.61245984", "text": "func parse_list(ob *bytes.Buffer, rndr *render, data []byte, flags int) int {\n\tdefer un(trace(\"parse_list\"))\n\tsize := len(data)\n\ti := 0\n\tvar work bytes.Buffer\n\n\tfor i < size {\n\t\tj := parse_listitem(&work, rndr, data[i:], &flags)\n\t\t//fmt.Printf(\"j: %d\\n\", j)\n\t\ti += j\n\n\t\tif 0 == j || (flags&MKD_LI_END != 0) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif nil != rndr.make.list {\n\t\trndr.make.list(ob, work.Bytes(), flags, rndr.make.opaque)\n\t}\n\treturn i\n}", "title": "" }, { "docid": "f33d6d88a651c0f13312c831e14c39da", "score": "0.60704195", "text": "func (a Args) ParseList(value string) []string {\n\tvar list []string\n\tvar escape, quote bool\n\tb := new(bytes.Buffer)\n\tfor _, r := range value {\n\t\tswitch {\n\t\tcase escape:\n\t\t\tb.WriteRune(r)\n\t\t\tescape = false\n\t\tcase quote:\n\t\t\tif r == '\\\\' {\n\t\t\t\tescape = true\n\t\t\t} else {\n\t\t\t\tif r == '\"' {\n\t\t\t\t\tquote = false\n\t\t\t\t}\n\t\t\t\tb.WriteRune(r)\n\t\t\t}\n\t\tcase r == ',' || r == ';' || r == '\\n':\n\t\t\tlist = append(list, strings.TrimSpace(b.String()))\n\t\t\tb.Reset()\n\t\tcase r == '\"':\n\t\t\tquote = true\n\t\t\tb.WriteRune(r)\n\t\tdefault:\n\t\t\tb.WriteRune(r)\n\t\t}\n\t}\n\t// Append last part.\n\tif s := b.String(); s != \"\" {\n\t\tlist = append(list, strings.TrimSpace(s))\n\t}\n\treturn list\n}", "title": "" }, { "docid": "b4361ca85dedc8be747b742d96bcede3", "score": "0.6070261", "text": "func ParseList(r io.RuneReader) (tags []ast.Tag, err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tif e, ok := r.(error); ok {\n\t\t\t\terr = e\n\t\t\t} else {\n\t\t\t\tpanic(r)\n\t\t\t}\n\t\t}\n\t}()\n\n\tl := newLexer(r)\n\n\tfor {\n\t\ttok := l.next()\n\t\tif tok == nil {\n\t\t\treturn\n\t\t}\n\n\t\texpect(tok, TagToken)\n\t\ttags = append(tags, ast.Tag{\n\t\t\tName: tok.Values[0],\n\t\t})\n\t}\n}", "title": "" }, { "docid": "9dc4eecb8c808f42db7fb2fafc7142fb", "score": "0.600171", "text": "func ParseList(versions ...string) (VersionList, error) {\n\treturn parseList(Parse, versions)\n}", "title": "" }, { "docid": "7a5ac231d344dcbdcca20585c48d751a", "score": "0.5999715", "text": "func StringToList(str string) []string {\n\t//trim\n\tstr = strings.TrimSpace(str)\n\tstr = strings.TrimPrefix(str, \"[\")\n\tstr = strings.TrimSuffix(str, \"]\")\n\t//split\n\tlist := strings.Split(str, \",\")\n\treturn list\n}", "title": "" }, { "docid": "7c1f0424dd547c0284664e558af7613d", "score": "0.59952515", "text": "func (p *Parser) list() (*List, error) {\n\tp.assert(token.LBRACKET)\n\tl := &List{\n\t\tStart: p.tok.Start,\n\t}\n\t// read left bracket\n\tp.next()\n\tfor {\n\t\t// skip newlines\n\t\tp.newlines()\n\t\t// found right bracket, we're done\n\t\tif p.tok.Type == token.RBRACKET {\n\t\t\tbreak\n\t\t}\n\t\t// read a value\n\t\tv, err := p.value()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tl.Values = append(l.Values, v)\n\t\t// skip newlines\n\t\tp.newlines()\n\t\t// if there's no comma, we're done\n\t\tif p.tok.Type != token.COMMA {\n\t\t\tbreak\n\t\t}\n\t\tp.next()\n\t}\n\t// skip newlines\n\tp.newlines()\n\tif err := p.expect(token.RBRACKET); err != nil {\n\t\treturn nil, err\n\t}\n\tp.next()\n\treturn l, nil\n}", "title": "" }, { "docid": "9b8c1a9a138f9806a85f1fd217337061", "score": "0.5988566", "text": "func parseList(parseFunc func(string) (Version, error), versions []string) (VersionList, error) {\n\tvl := make(VersionList, len(versions))\n\tfor i, s := range versions {\n\t\tv, err := parseFunc(s)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvl[i] = v\n\t}\n\treturn vl, nil\n}", "title": "" }, { "docid": "a0f00df5a424b8d6494de73a0310f0ac", "score": "0.59798557", "text": "func parseTestList(content string) []string {\n\tvar suite string\n\tvar result []string\n\tfor _, line := range strings.Split(content, \"\\n\") {\n\t\tif strings.HasPrefix(line, \" \") {\n\t\t\t// Test case name.\n\t\t\ttestCase := strings.TrimSpace(line)\n\t\t\tparamDelimiterIndex := strings.Index(testCase, \" #\")\n\t\t\tif paramDelimiterIndex != -1 {\n\t\t\t\ttestCase = testCase[:paramDelimiterIndex]\n\t\t\t}\n\t\t\tresult = append(result, fmt.Sprintf(\"%s%s\", suite, testCase))\n\t\t} else {\n\t\t\t// Test suite name. Note: suite contains a trailing period.\n\t\t\tsuite = strings.TrimSpace(line)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "5a69b0dcdbef378cc0efb26e636b1fbd", "score": "0.5934688", "text": "func parseList(d *xml.Decoder, names, stack []xml.Name) ([]Node, error) {\n\tvar c []Node\n\tfor len(stack) > 0 {\n\t\tt, err := d.RawToken()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unclosed tags: %v\", stack)\n\t\t}\n\t\t// A token can be of the following types:\n\t\t//\n\t\t// xml.CharData\n\t\t// xml.Comment\n\t\t// xml.Directive\n\t\t// xml.EndElement\n\t\t// xml.ProcInst\n\t\t// xml.StartElement\n\t\tswitch t := t.(type) {\n\t\tcase xml.StartElement:\n\t\t\tfound := false\n\t\t\tfor _, v := range names {\n\t\t\t\tif v == t.Name {\n\t\t\t\t\tfound = true\n\t\t\t\t\tlist, err := parseList(d, names, []xml.Name{t.Name})\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tc = append(c, Node{Token: t, List: list})\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tstack = append(stack, t.Name)\n\t\t\t}\n\t\tcase xml.EndElement:\n\t\t\tif stack, err = popName(stack, t.Name); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase xml.CharData:\n\t\t\tif b := bytes.TrimSpace(t); len(b) > 0 {\n\t\t\t\t// Need to make a copy of b.\n\t\t\t\tb1 := make(xml.CharData, len(b))\n\t\t\t\tcopy(b1, b)\n\t\t\t\tc = append(c, Node{Token: b1})\n\t\t\t}\n\t\t}\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "c687fb15016217a18dd9045ae2fe7014", "score": "0.5914068", "text": "func lexList(l *lexer) stateFn {\n\tmatch, items := l.matchList(l.input[l.pos:])\n\tif !match {\n\t\treturn lexText\n\t}\n\tvar space int\n\tvar typ itemType\n\tfor i, item := range items {\n\t\t// Emit itemList on the first loop\n\t\tif i == 0 {\n\t\t\tl.emit(itemList, reList.marker.FindStringSubmatch(item)[1])\n\t\t}\n\t\t// Initialize each loop\n\t\ttyp = itemListItem\n\t\tspace = len(item)\n\t\tl.pos += Pos(space)\n\t\titem = reList.marker.ReplaceAllString(item, \"\")\n\t\t// Indented\n\t\tif strings.Contains(item, \"\\n \") {\n\t\t\tspace -= len(item)\n\t\t\treSpace := reSpaceGen(space)\n\t\t\titem = reSpace.ReplaceAllString(item, \"\")\n\t\t}\n\t\t// If current is loose\n\t\tfor _, l := range reList.loose.FindAllString(item, -1) {\n\t\t\tif len(strings.TrimSpace(l)) > 0 || i != len(items)-1 {\n\t\t\t\ttyp = itemLooseItem\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// or previous\n\t\tif typ != itemLooseItem && i > 0 && strings.HasSuffix(items[i-1], \"\\n\\n\") {\n\t\t\ttyp = itemLooseItem\n\t\t}\n\t\tl.emit(typ, strings.TrimSpace(item))\n\t}\n\treturn lexAny\n}", "title": "" }, { "docid": "b6497c7dcb35c8301961fe4397a71072", "score": "0.58904004", "text": "func parseList(l *lexer, constOnly bool) *ast.ListValue {\n\tloc := l.location()\n\tvar list []ast.Value\n\tl.advance(token.BRACKET_L)\n\tfor l.peek() != token.BRACKET_R {\n\t\tlist = append(list, ParseValueLiteral(l, constOnly))\n\t}\n\tl.advance(token.BRACKET_R)\n\treturn &ast.ListValue{Kind: kinds.ListValue, Values: list, Loc: loc}\n}", "title": "" }, { "docid": "b99e31570d79ff8980793caf6d294f56", "score": "0.58411705", "text": "func lexList(l *lexer) stateFn {\n\tmatch, items := l.matchList(l.input[l.pos:])\n\tif !match {\n\t\treturn lexText\n\t}\n\tvar space int\n\tvar typ itemType\n\treItem := block[itemListItem]\n\treLoose := block[itemLooseItem]\n\tfor i, item := range items {\n\t\t// Emit itemList on the first loop\n\t\tif i == 0 {\n\t\t\tl.emit(itemList, reItem.FindStringSubmatch(item)[1])\n\t\t}\n\t\t// Initialize each loop\n\t\ttyp = itemListItem\n\t\tspace = len(item)\n\t\tl.pos += Pos(space)\n\t\titem = reItem.ReplaceAllString(item, \"\")\n\t\t// Indented\n\t\tif strings.Contains(item, \"\\n \") {\n\t\t\tspace -= len(item)\n\t\t\treSpace := regexp.MustCompile(fmt.Sprintf(`(?m)^ {1,%d}`, space))\n\t\t\titem = reSpace.ReplaceAllString(item, \"\")\n\t\t}\n\t\t// If current is loose\n\t\tfor _, l := range reLoose.FindAllString(item, -1) {\n\t\t\tif len(strings.TrimSpace(l)) > 0 || i != len(items)-1 {\n\t\t\t\ttyp = itemLooseItem\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// or previous\n\t\tif typ != itemLooseItem && i > 0 && strings.HasSuffix(items[i-1], \"\\n\\n\") {\n\t\t\ttyp = itemLooseItem\n\t\t}\n\t\tl.emit(typ, strings.TrimSpace(item))\n\t}\n\treturn lexAny\n}", "title": "" }, { "docid": "399841e11b94e73b8ad9ad5ae7a2232a", "score": "0.5810227", "text": "func Read(r io.Reader) (List, error) {\n\tscanner := bufio.NewScanner(r)\n\tl := List{}\n\tfor scanner.Scan() {\n\t\tr, err := Parse(scanner.Text())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tl = append(l, r)\n\t}\n\treturn l, nil\n}", "title": "" }, { "docid": "0c69c677cb7a4f0a9054c5d4898057c1", "score": "0.57703006", "text": "func parseString(text string)(accountNumbers []*model.Numbers, errors []error) {\n accountNumbersArray := regexp.MustCompile(`[\\r\\n](?m)^$(\\r|\\n|\\r\\n)?`).Split(text, -1)\n\n // Iteración hasta len(accountNumbersArray)-1 para que ignore la ultima linea vacia\n for accountIndex := 0; accountIndex < len(accountNumbersArray) -1; accountIndex++ {\n accountNumber := &model.Numbers {\n TextNumbers: regexp.MustCompile(\"\\n\").Split(accountNumbersArray[accountIndex], -1),\n }\n if err := accountNumber.ValidateText(); err != nil {\n errors = append(errors, err)\n continue\n }\n accountNumbers = append(accountNumbers, accountNumber)\n }\n\n return accountNumbers, errors\n}", "title": "" }, { "docid": "fb12bbce0df75dbb7ec902cf953123b8", "score": "0.573542", "text": "func (p *parser) parseListValue(isConst bool) (ast.ListValue, error) {\n\tstartToken, err := p.expect(token.KindLeftBracket)\n\tif err != nil {\n\t\treturn ast.ListValue{}, err\n\t}\n\n\tvar values []ast.Value\n\tfor {\n\t\t// Stop on ] token.\n\t\tstop, err := p.skip(token.KindRightBracket)\n\t\tif err != nil {\n\t\t\treturn ast.ListValue{}, err\n\t\t}\n\t\tif stop {\n\t\t\tbreak\n\t\t}\n\n\t\tvalue, err := p.parseValue(isConst)\n\t\tif err != nil {\n\t\t\treturn ast.ListValue{}, err\n\t\t}\n\n\t\tvalues = append(values, value)\n\t}\n\n\tif len(values) == 0 {\n\t\t// Store the start token for empty list value.\n\t\treturn ast.ListValue{\n\t\t\tValuesOrStartToken: startToken,\n\t\t}, nil\n\t}\n\treturn ast.ListValue{\n\t\tValuesOrStartToken: values,\n\t}, nil\n}", "title": "" }, { "docid": "9a261945519e53ae558ed303c17d6bfe", "score": "0.5725592", "text": "func (m *Manager) parseRawUserList(raw string) []string {\n\tlines := strings.Split(raw, \"\\n\")\n\tuserList := make([]string, 0)\n\n\tfor _, line := range lines {\n\t\tif strings.Contains(line, \"User Name\") {\n\t\t\ttokens := strings.Split(line, \"|\")\n\t\t\tif len(tokens) == 2 {\n\t\t\t\tusername := tokens[1]\n\t\t\t\tuserList = append(userList, strings.TrimSpace(username))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn userList\n}", "title": "" }, { "docid": "5eb7c9d478bb0f1be8e01d141b0592bb", "score": "0.57037777", "text": "func (c *Client) List(args ...string) ([]string, error) {\n\tid, err := c.cmd(\"list \" + quoteArgs(args))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.text.StartResponse(id)\n\tdefer c.text.EndResponse(id)\n\n\tvar ret []string\n\tfor {\n\t\tline, err := c.readLine()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ti := strings.Index(line, \": \")\n\t\tif i > 0 {\n\t\t\tret = append(ret, line[i+2:])\n\t\t} else if line == \"OK\" {\n\t\t\tbreak\n\t\t} else {\n\t\t\treturn nil, textproto.ProtocolError(\"can't parse line: \" + line)\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "39cc0e251b079a5387239aa69e5ea481", "score": "0.5693361", "text": "func ParseBookList(contents []byte) engine.ParseResult {\n\tconst BooklistRe = `<a href=\"([^\"]+)\" title=\"([^\"]+)\"`\n\tre := regexp.MustCompile(BooklistRe)\n\tmatches := re.FindAllSubmatch(contents, -1)\n\tresult := engine.ParseResult{}\n\tfor _, m := range matches {\n\t\tresult.Items = append(result.Items, string(m[2]))\n\t\tresult.Requests = append(result.Requests, engine.Request{\n\t\t\tURL: string(m[1]),\n\t\t\tParseFunc: ParseBookDetail,\n\t\t})\n\t}\n\treturn result\n}", "title": "" }, { "docid": "46709f3949c3482303cf6426e2e53f18", "score": "0.5691385", "text": "func parseStringListInternal(value []rune, index *int) ([]interface{}, error) {\n\tvar result []interface{}\n\tif *index >= len(value) {\n\t\treturn nil, errors.Errorf(\"unexpected end of string at %d in %s\", *index, string(value))\n\t}\n\t// The first char should always be a [ or (, as it might be a list or a tuple.\n\tif value[*index] != '[' && value[*index] != '(' {\n\t\treturn nil, errors.Errorf(\"unexpected list char %c at index %d in %s\", value[*index], *index, string(value))\n\t}\n\t(*index)++\n\tfor ; *index < len(value); (*index)++ {\n\t\tc := value[*index]\n\t\tswitch c {\n\t\tcase '[', '(':\n\t\t\tsublist, err := parseStringListInternal(value, index)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresult = append(result, sublist)\n\t\tcase '\\'', '\"':\n\t\t\tsubstr, err := parseQuotedStringInternal(value, index)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresult = append(result, substr)\n\t\tcase ',', ' ':\n\t\t\t// Ignore this char\n\t\tcase ']', ')':\n\t\t\treturn result, nil\n\t\tdefault:\n\t\t\treturn nil, errors.Errorf(\"unexpected list char %c at index %d in %s\", c, *index, string(value))\n\t\t}\n\t}\n\treturn nil, errors.Errorf(\"unexpected end of string at %d in %s\", *index, string(value))\n}", "title": "" }, { "docid": "92cc924d003f2c477680840937a70d54", "score": "0.5676895", "text": "func (p *Parser) parseListItem(def string) (*ast.ContainerBlock, error) {\n\tvar item ast.ContainerBlock\n\tif def != \"\" {\n\t\t//definition list, definition itself becomes the first paragraph of the non-numbered list\n\t\titem.Add(ast.NewParagraphFromStr(def))\n\t}\n\nl1:\n\tfor {\n\t\tswitch {\n\t\tcase p.isDoubleNewline() ||\tp.isListMarker() ||\tp.isColumn() || p.tok.Type == token.TABLE || p.tok.Type == token.EOF:\n\t\t\tbreak l1\n\t\tcase p.tok.Type == token.NEWLINE:\n\t\t\tif !p.advance() { return nil, fmt.Errorf(\"parse list item: cannot advance tokens\") }\n\t\tcase p.tok.Type == token.CONCAT_PAR:\n\t\t\t//skip newline after CONCAT_PAR\n\t\t\tif !p.advanceMany(2) {\n\t\t\t\treturn nil, fmt.Errorf(\"parseListItem: cannot advance by 2 elements\")\n\t\t\t}\n\n\t\tdefault:\n\t\t\t//are we inside example block and this is its` ending token?\n\t\t\tif p.curBlock != nil && (p.tok.Type == token.EX_BLOCK || p.tok.Type == token.SIDEBAR) {\n\t\t\t\texb, yes := p.curBlock.(*ast.ExampleBlock)\n\t\t\t\tif yes && exb.Delim.Type == p.tok.Type {\n\t\t\t\t\tbreak l1\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif p.tok.Type == token.L_BOUNDARY && p.curBlock != nil {\n\t\t\t\t// check if it is the end of the list block\n\t\t\t\t_, yes := p.curBlock.(*ast.ListBlock)\n\t\t\t\tif yes {\n\t\t\t\t\t// yes it is\n\t\t\t\t\tbreak l1\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tb, err := p.parseBlock()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif b != nil {\n\t\t\t\titem.Add(b)\n\t\t\t}\n\t\t}\n\t}\n\treturn &item, nil\n}", "title": "" }, { "docid": "d1c0a464386c4adcff4692a720618887", "score": "0.56746644", "text": "func List(in []string) ([]string, error) {\n\tvs := list(in)\n\tif len(vs) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tr := make([]string, len(vs))\n\tfor i, v := range vs {\n\t\tr[i] = v.String()\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "b70f8a20ff0b0a54836f01c5ee3bfb9c", "score": "0.56732655", "text": "func loadList(r io.Reader) (l List, e error) {\n\tttype, e := loadByte(r)\n\tif e != nil {\n\t\treturn l, e\n\t}\n\tif Type(ttype) < TypeEnd || Type(ttype) >= TypeMax {\n\t\treturn l, fmt.Errorf(\"invalid tag type for list: %d\", ttype)\n\t}\n\tcount, e := loadInt(r)\n\tif e != nil {\n\t\treturn l, e\n\t}\n\tif count < 0 {\n\t\treturn l, fmt.Errorf(\"invalid negative count for list: %d\", count)\n\t}\n\tl.Contents = Type(ttype)\n\te = l.loadData(r, int(count))\n\treturn l, e\n}", "title": "" }, { "docid": "bc558c94869ce7f00b6d3e5ea3334434", "score": "0.5664595", "text": "func (p *Parser) parseFieldList() ([]string, error) {\n\t// Parse ( token.\n\tif ok, err := p.parseOptional(scanner.LPAREN); !ok || err != nil {\n\t\tp.Unscan()\n\t\treturn nil, err\n\t}\n\n\t// Parse path list.\n\tvar fields []string\n\tvar err error\n\tif fields, err = p.parseIdentList(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse required ) token.\n\tif err := p.parseTokens(scanner.RPAREN); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn fields, nil\n}", "title": "" }, { "docid": "9aafa7713f374250e94f687579d192d1", "score": "0.56018937", "text": "func reList(re *regexp.Regexp, Payload string) ([][][]byte, []int) {\n\tmatchs := re.FindAllSubmatch([]byte(Payload), -1)\n\tpos := re.FindAllStringSubmatchIndex(Payload, -1)\n\n\t// Merge positions into a single value (the start one)\n\tnewpos := make([]int, len(pos))\n\tfor i, p := range pos {\n\t\tsum := 0\n\t\titems := 0\n\t\tfor _, n := range p {\n\t\t\tsum += n\n\t\t\titems++\n\t\t}\n\t\tnewpos[i] = sum / items\n\t}\n\treturn matchs, newpos\n}", "title": "" }, { "docid": "b931ee02fb44d2a5096f574e44d854e5", "score": "0.5595643", "text": "func Parse(r io.Reader) (*List, error) {\n\tbuf := bufio.NewReader(r)\n\n\tvar entries []Entry\n\n\tfor {\n\t\tline, _, err := buf.ReadLine()\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to read line: %w\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tparts := bytes.Split(line, []byte{'\\t'})\n\t\tif len(parts) != 3 {\n\t\t\treturn nil, fmt.Errorf(\"line improperly seperated: %s\", line)\n\t\t}\n\n\t\tperms, err := parsePerms(parts[0])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse permission bits: %w\", err)\n\t\t}\n\n\t\towners := bytes.Split(parts[1], []byte{'/'})\n\n\t\tentries = append(entries, Entry{\n\t\t\tPerms: perms,\n\t\t\tPath: string(parts[2]),\n\t\t\tUid: string(owners[0]),\n\t\t\tGid: string(owners[1]),\n\t\t})\n\t}\n\n\treturn &List{entries: entries}, nil\n}", "title": "" }, { "docid": "07c138fabb222c21f0aef54c494f82cc", "score": "0.55844474", "text": "func textFileToList(ctx context.Context, fileName string) ([]string, error) {\n\tb, err := files.Read(ctx, fileName)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"cannot open file: %q\", fileName)\n\t}\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(bytes.NewReader(b))\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif !strings.HasPrefix(line, \"#\") && line != \"\" {\n\t\t\tlines = append(lines, line)\n\t\t}\n\t}\n\n\treturn lines, nil\n}", "title": "" }, { "docid": "dc386faa101f080da5f4720f7d525746", "score": "0.5583448", "text": "func doLists(s string) string {\n\t// marker := ` {0,` + less_than_tab + `}([*+-]|\\d+\\.)`\n\tmarker := `([*+-]|\\d+\\.)`\n\tre := regexp.MustCompile( `(?m)^` + marker + ` .+\\n(\\S.*\\n|\\n*` + marker + `? .+\\n)*` )\n\treturn re.ReplaceAllStringFunc(s, processListItems)\n}", "title": "" }, { "docid": "4544d65135c0adae8aee1086b99b9117", "score": "0.55723196", "text": "func (t *Tokeniser) parseTokens() (lispVal, error) {\n\t// Pull off the first token\n\ttoken, err := t.NextToken()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Syntax error: %v\", t.input)\n\t}\n\n\tswitch token.Tag {\n\tcase \"LIST_START\":\n\t\t// Start of a list so recuse and build it up\n\t\tlst := make([]lispVal, 0)\n\t\tparsedToken, err := t.parseTokens()\n\t\tfor {\n\t\t\tif parsedToken == \"LIST_END\" {\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Syntax error\")\n\t\t\t\t}\n\t\t\t\treturn List(lst...), nil\n\t\t\t}\n\t\t\tlst = append(lst, parsedToken)\n\t\t\tparsedToken, err = t.parseTokens()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\tcase \"LIST_END\":\n\t\treturn \"LIST_END\", nil\n\n\tcase \"VEC_START\":\n\t\tlst := make([]lispVal, 0)\n\t\tparsedToken, err := t.parseTokens()\n\t\tfor {\n\t\t\tif parsedToken == \"VEC_END\" {\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Syntax error\")\n\t\t\t\t}\n\t\t\t\treturn lst, nil\n\t\t\t}\n\t\t\tlst = append(lst, parsedToken)\n\t\t\tparsedToken, err = t.parseTokens()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\tcase \"VEC_END\":\n\t\treturn \"VEC_END\", nil\n\n\tcase \"QUOTE\", \"SPLICE\":\n\t\t// Something is being quoted or unquoted\n\t\tquotedList := make([]lispVal, 0)\n\t\tquotedList = append(quotedList, quotes[token.Text])\n\t\tparsed, err := t.parseTokens()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tquotedList = append(quotedList, parsed)\n\t\treturn List(quotedList...), nil\n\n\tdefault:\n\t\t// if it\"s not a list then it\"s an atom\n\t\treturn makeAtom(token)\n\t}\n}", "title": "" }, { "docid": "6f3b6e76c6f7767336591edd9198448e", "score": "0.55657774", "text": "func (p *parser) parseList() (item ast.ItemNode, ok bool) {\n\tvalues := []interface{}{}\n\n\tcount := 0\n\tfor {\n\t\tswitch t := p.peek(); t.typ {\n\t\tcase tokenTypeLeftAngleBracket:\n\t\t\tchildItem, ok := p.parseDataItem()\n\t\t\tif !ok {\n\t\t\t\treturn ast.NewEmptyItemNode(), false\n\t\t\t}\n\t\t\tvalues = append(values, childItem)\n\n\t\tcase tokenTypeVariable:\n\t\t\tt = p.acceptAny()\n\t\t\tif _, ok := p.variableNames[t.val]; ok {\n\t\t\t\tp.errorf(t, \"duplicated variable name %q\", t.val)\n\t\t\t\tvalues = append(values, ast.NewEmptyItemNode())\n\t\t\t} else {\n\t\t\t\tp.variableNames[t.val] = true\n\t\t\t\tvalues = append(values, t.val)\n\t\t\t}\n\n\t\tcase tokenTypeEllipsis:\n\t\t\tt = p.acceptAny()\n\t\t\tif count == 0 {\n\t\t\t\tp.errorf(t, \"ellipsis cannot be the first item in list\")\n\t\t\t\treturn ast.NewEmptyItemNode(), false\n\t\t\t}\n\t\t\tval := fmt.Sprintf(\"...[%d]\", p.ellipsisCount)\n\t\t\tp.ellipsisCount += 1\n\t\t\tif t.val != \"...\" && t.val != val {\n\t\t\t\tp.warningf(t, \"wrong ellipsis count, %q will be used\", val)\n\t\t\t}\n\t\t\tvalues = append(values, val)\n\n\t\tcase tokenTypeRightAngleBracket:\n\t\t\treturn ast.NewListNode(values...), true\n\n\t\tcase tokenTypeError:\n\t\t\tp.errorf(t, \"syntax error: %s\", t.val)\n\t\t\treturn ast.NewEmptyItemNode(), false\n\n\t\tdefault:\n\t\t\tp.errorf(t, \"expected child data item, variable, ellipsis, or '>', found %q\", t.val)\n\t\t\treturn ast.NewEmptyItemNode(), false\n\t\t}\n\n\t\tcount += 1\n\t}\n\t// should not reach here\n}", "title": "" }, { "docid": "7801e4bfa041d22644daf564e4895582", "score": "0.55647415", "text": "func LIST(comando string) List {\n\treturn List{comando}\n}", "title": "" }, { "docid": "625919afbb67ec8d888603ee34947ecb", "score": "0.556043", "text": "func (p *AddressParser) ParseList(list string) ([]*Address, error) {\n\treturn (&addrParser{s: list, dec: p.WordDecoder}).parseAddressList()\n}", "title": "" }, { "docid": "d4687e4b43f4acbcf9b43ee6c755cecf", "score": "0.55515593", "text": "func ParseRangeList(str string) (*RangeList, error) {\n\trl := RangeList{}\n\tif len(str) == 0 {\n\t\treturn &rl, nil\n\t}\n\tparts := strings.Split(str, \",\")\n\tfor _, p := range parts {\n\t\tr, err := ParseRange(p)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trl = append(rl, r)\n\t}\n\treturn &rl, nil\n}", "title": "" }, { "docid": "3c3983f4561d30a8dde8de8941da0928", "score": "0.55470026", "text": "func processList(scanner *bufio.Scanner) *Pair {\n\tif !scanner.Scan() {\n\t\tpanic(\"unmatched (\") // we're in a list and ran out of tokens\n\t}\n\ttoken := scanner.Text()\n\tfmt.Printf(\"token: %s\\n\", token)\n\tif token == \"(\" {\n\t\t// start a new list and then add that to the one we're currently working on\n\t\treturn Cons(processList(scanner), processList(scanner))\n\t} else if token == \")\" {\n\t\treturn nil\n\t} else {\n\t\treturn Cons(token, processList(scanner))\n\t}\n}", "title": "" }, { "docid": "c320c44f2d0dc1c18c14caf408193f72", "score": "0.5543059", "text": "func (p *Parser) ReadList() Statement {\n\tstartPosition := p.Current.Position\n\tl := []Statement{}\n\tfor {\n\t\tif p.Current.Kind == NEW_LINE {\n\t\t\tp.Consume(NEW_LINE)\n\t\t\tcontinue\n\t\t} else if p.Current.Kind == LBrace {\n\t\t\tp.Consume(LBrace)\n\t\t\tdic := p.ReadDict()\n\t\t\tl = append(l, dic)\n\t\t\tcontinue\n\t\t} else if p.Current.Kind == COMMA {\n\t\t\tp.Consume(COMMA)\n\t\t\tcontinue\n\t\t} else if p.Current.Kind == RBracket {\n\t\t\tp.Consume(RBracket)\n\t\t\tbreak\n\t\t}\n\t\texp := p.ReadExpression()\n\t\tl = append(l, exp)\n\t\t// p.Consume(\"\")\n\t}\n\n\treturn &List{\n\t\tPosition: startPosition,\n\t\tValues: l,\n\t\tType: STList,\n\t}\n}", "title": "" }, { "docid": "a0867c21a3a6ad37da7ab40fd2904a95", "score": "0.55258405", "text": "func (c *Client) List(uri string) ([]string, error) {\n\tid, err := c.cmd(\"list \" + quote(uri))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.text.StartResponse(id)\n\tdefer c.text.EndResponse(id)\n\n\tvar ret []string\n\tfor {\n\t\tline, err := c.text.ReadLine()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ti := strings.Index(line, \": \")\n\t\tif i > 0 {\n\t\t\tret = append(ret, line[i+2:])\n\t\t} else if line == \"OK\" {\n\t\t\tbreak\n\t\t} else {\n\t\t\treturn nil, textproto.ProtocolError(\"can't parse line: \" + line)\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "c012f918421ff43933b498118a6b0ba5", "score": "0.55063945", "text": "func allowlistParser(data []byte) (Allowlist, error) {\n\n\tal := new(Allowlist)\n\n\terr := yaml.Unmarshal(data, al)\n\n\treturn *al, err\n}", "title": "" }, { "docid": "9846187befc6b761296ef8190e53c958", "score": "0.5500422", "text": "func parseWhitelist(whitelist []string) ([]string, error) {\n\tlist := []string{}\n\tfor _, w := range whitelist {\n\t\tname, tag, err := normalizeNameTag(w)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing whitelist item '%s': %v\", w, err)\n\t\t}\n\t\tif tag != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"whitelisting does not support tags: %s\", w)\n\t\t}\n\t\tlist = append(list, name)\n\t}\n\treturn list, nil\n}", "title": "" }, { "docid": "50b7e0ddb18c0b0087fc6ea51378f852", "score": "0.5468317", "text": "func ParseStringList(value string) ([]interface{}, error) {\n\tindex := 0\n\treturn parseStringListInternal([]rune(value), &index)\n}", "title": "" }, { "docid": "e1bf1bacfb5143c65f74e663a2ab19ea", "score": "0.5456959", "text": "func GetList(list string) ([]string, error) {\n var servers []string\n\n file, err := os.Open(list)\n if err == nil {\n scanner := bufio.NewScanner(file)\n for scanner.Scan() {\n t, e := CheckInput(scanner.Text())\n if e == nil {\n servers = append(servers, t)\n }\n }\n err = scanner.Err()\n file.Close()\n }\n return servers, err\n}", "title": "" }, { "docid": "f98a6be19ecbd9b8ac09f268f53f9175", "score": "0.5454731", "text": "func parseModList() (ModList, error) {\n\tvar mods ModList\n\tmodListFile := config.FactorioDir + \"/mods/mod-list.json\"\n\n\tmodList, err := ioutil.ReadFile(modListFile)\n\tif err != nil {\n\t\tlog.Printf(\"Error reading mod-list.json file: %s\", err)\n\t\treturn mods, err\n\t}\n\n\terr = json.Unmarshal(modList, &mods)\n\tif err != nil {\n\t\tlog.Printf(\"Error parsing mod-list.json JSON: %s\", err)\n\t\treturn mods, err\n\t}\n\n\treturn mods, nil\n}", "title": "" }, { "docid": "d09374edd639564b39d9d5f6c8091206", "score": "0.5453791", "text": "func (list RawFragbitsList) ParseList() []*uint8 {\n\tvar flagsList []*uint8\n\n\tif len(list) == 0 {\n\t\treturn []*uint8{}\n\t}\n\n\tfor _, val := range list {\n\t\tflagsList = append(flagsList, val.Parse())\n\t}\n\n\treturn flagsList\n}", "title": "" }, { "docid": "97be87823ea9ad1ef3ccd986acbd576e", "score": "0.54410577", "text": "func readListFromFile(filename string) ([]string, error) {\n\tvar entries []string\n\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\t// fmt.Println(scanner.Text())\n\t\t// if (strings.STARTSWITH(# , scanner.Text())\n\t\tentries = append(entries, scanner.Text())\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn entries, nil\n}", "title": "" }, { "docid": "267052bcafb085c7e66d80ecca73f0b9", "score": "0.54347926", "text": "func (r *RFC) parseListConcurrent(list string) []rfcEntity {\n\tpwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn []rfcEntity{}\n\t}\n\tfilepath := filepath.Join(pwd, list)\n\tcontent, err := ioutil.ReadFile(filepath)\n\tsplit := strings.Split(string(content), \"\\n\")\n\tsegmentChannels := make([]<-chan rfcEntity, 0)\n\tfor {\n\t\tsegment := len(split) / ChunkCount\n\t\tif segment == 0 {\n\t\t\tch := handleSegment(split)\n\t\t\tsegmentChannels = append(segmentChannels, ch)\n\t\t\tbreak\n\t\t}\n\t\tchunk := make([]string, 0)\n\t\tchunk, split = append(chunk, split[:segment]...), split[segment:]\n\t\tcs := handleSegment(chunk)\n\t\tsegmentChannels = append(segmentChannels, cs)\n\t}\n\n\trfcs := make([]rfcEntity, 0)\n\trfcChannel := merge(segmentChannels...)\n\tfor rfc := range rfcChannel {\n\t\trfcs = append(rfcs, rfc)\n\t}\n\treturn rfcs\n}", "title": "" }, { "docid": "557ddb2c7af86506853ec346ac3a7062", "score": "0.5429778", "text": "func parseRegexList(buf []byte, overrides []string) (*regexList, error) {\n\tlines := strings.Split(string(buf), \"\\n\")\n\tentries := make([]*regexp.Regexp, 0, len(lines)+len(overrides))\n\tfor _, line := range lines {\n\t\tif line != \"\" {\n\t\t\texp, err := regexp.Compile(line)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tentries = append(entries, exp)\n\t\t}\n\t}\n\n\tfor _, override := range overrides {\n\t\t// cannot fail, override syntax was checked in the Validate method\n\t\texp, _ := regexp.Compile(override)\n\t\tentries = append(entries, exp)\n\t}\n\treturn &regexList{entries}, nil\n}", "title": "" }, { "docid": "9217208c25636d6f0c6f1b9e53c46e52", "score": "0.5421931", "text": "func (p *parser) parseObjectList(pos int) (obj []Object, length int, err error) {\n\tif len(p.runes) <= pos {\n\t\terr = errors.New(\"reached eof before end of object list\")\n\t\treturn\n\t}\n\tfor {\n\t\tvar temp Object\n\t\tvar tempLength int\n\t\ttemp, tempLength, err = p.parseObject(pos + length)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tobj = append(obj, temp)\n\t\tlength += tempLength\n\t\tlength += p.consumeWS(pos + length)\n\t\tif !p.isEqual(pos+length, \",\") {\n\t\t\tbreak\n\t\t}\n\t\tlength++\n\t\tlength += p.consumeWS(pos + length)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f6c24c17dc2f4ff7a98c39d9a3562ebf", "score": "0.5403499", "text": "func parseList(tokens []Token, index uint) (*ASTNode, uint) {\r\n\ttoken := tokens[index]\r\n\r\n\t// a list must start with an OPAREN\r\n\tif token.TypeID != TOK_OPAREN {\r\n\t\treturn nil, index\r\n\t}\r\n\tindex2 := index + 1\r\n\r\n\t// loop over the contents of the list\r\n\tbuff := make([]*ASTNode, 0, 8)\r\n\tsubnodeCount := 0\r\n\tfor index2 < uint(len(tokens)) {\r\n\t\tvar ast *ASTNode\r\n\t\ttoken = tokens[index2]\r\n\t\t// stop the loop if we hit a CPAREN\r\n\t\tif token.TypeID == TOK_CPAREN {\r\n\t\t\tbreak\r\n\t\t}\r\n\t\tast, index2 = parseExpr(tokens, index2)\r\n\t\tif ast == nil {\r\n\t\t\treturn nil, index\r\n\t\t}\r\n\t\tbuff = append(buff, ast)\r\n\t\tsubnodeCount++\r\n\t}\r\n\tsubnodes := make([]*ASTNode, subnodeCount)\r\n\tcopy(subnodes, buff)\r\n\r\n\t// a list must end with a CPAREN\r\n\tif index2 == uint(len(tokens)) || tokens[index2].TypeID != TOK_CPAREN {\r\n\t\treturn nil, index\r\n\t}\r\n\tindex2++\r\n\r\n\tast := ASTNode{\r\n\t\tTypeID: AST_LIST,\r\n\t\tBytes: nil,\r\n\t\tSubnodes: subnodes,\r\n\t}\r\n\treturn &ast, index2\r\n}", "title": "" }, { "docid": "f89e226a1814976ed255e379662e76d7", "score": "0.53801817", "text": "func (p parser) parse(raw string) ([]node, error) {\n\tparts := strings.SplitN(raw, p.startDelim, 2)\n\tif len(parts) == 1 {\n\t\tif len(parts[0]) > 0 {\n\t\t\treturn []node{val(parts[0])}, nil\n\t\t}\n\t\treturn []node{}, nil\n\t}\n\tif len(parts[0]) > 0 {\n\t\ttail, err := p.parse(p.startDelim + parts[1])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn append([]node{val(parts[0])}, tail...), nil\n\t}\n\n\tparts = strings.SplitN(parts[1], p.endDelim, 2)\n\tif len(parts) == 1 {\n\t\treturn nil, ErrTagNotClosed(p.endDelim)\n\t}\n\n\tk := strings.Trim(parts[0], \" \")\n\n\ttail, err := p.parse(parts[1])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn append([]node{key(k)}, tail...), nil\n}", "title": "" }, { "docid": "66f153014219f86055fe1af64845f8c2", "score": "0.5369369", "text": "func GetMetadataList(bytes []byte) ([]byte, []byte, error) {\n\tts := strings.SplitN(string(bytes), \"}#{\", 2)\n\tif ts == nil {\n\t\treturn nil, nil, errors.New(\"unexpected input with nil as result of SplitN\")\n\t}\n\n\t// Now we can assume that len >= 1\n\tlen := len(ts)\n\n\tmetaBuf := append([]byte(ts[0]), '}')\n\tif len == 1 {\n\t\treturn metaBuf, nil, nil\n\t}\n\n\ttreeBuf := append([]byte(\"{\"), []byte(ts[1])...)\n\n\treturn metaBuf, treeBuf, nil\n}", "title": "" }, { "docid": "3dd92a3ac3bdd777a4f0b37b6f2b0271", "score": "0.53498125", "text": "func parseList(src string, country string) (cities []City, err error) {\n\t// Open our source file.\n\tjsonFile, err := os.Open(src)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn nil, err\n\t}\n\t// Defer the closing of the file so that we can parse it later on.\n\tdefer jsonFile.Close()\n\n\t// Unmarshal file into slice of cities.\n\tvar list []City\n\tval, _ := ioutil.ReadAll(jsonFile)\n\terr = json.Unmarshal(val, &list)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Remove for production.\n\t// for _, city := range list {\n\t// \tfmt.Println(city)\n\t// }\n\n\treturn list, nil\n}", "title": "" }, { "docid": "e0fdfea5e6ba88520fb7438ebfb9f6d5", "score": "0.53478163", "text": "func (list RawTCPFlagsList) ParseList() []*uint8 {\n\tvar flagsList []*uint8\n\n\tif len(list) == 0 {\n\t\treturn nil\n\t}\n\n\tfor _, val := range list {\n\t\tflagsList = append(flagsList, val.Parse())\n\t}\n\n\treturn flagsList\n}", "title": "" }, { "docid": "270fe7a8c519e3d965da480703f4d7ca", "score": "0.53455806", "text": "func makeListFromFile(v []string, f string, d []string) []string {\n\t/* Output slice */\n\to := []string{}\n\t/* Element from command line */\n\tif len(v) > 0 {\n\t\to = append(o, v...)\n\t}\n\t/* Lines from a file */\n\tif len(f) > 0 {\n\t\to = append(o, readLines(f)...)\n\t}\n\t/* Default */\n\tif 0 == len(o) && d != nil {\n\t\to = append(o, d...)\n\t}\n\treturn deDupe(o)\n}", "title": "" }, { "docid": "1bcee9b6a14b0fa2b53c3df2390b4442", "score": "0.53430134", "text": "func lexList(x *Lexer) stateFn {\n\tx.emit(IonListStart)\n\tx.containers = append(x.containers, '[')\n\treturn lexValue\n}", "title": "" }, { "docid": "71e31d7fa4c55cc7a239cdec85d9e004", "score": "0.5330601", "text": "func (p *parser) readListOptionsOnALine() ([]OptionElement, error) {\n\tvar err error\n\tvar options []OptionElement\n\tp.skipWhitespace()\n\tc := p.read()\n\tif c == '[' {\n\t\tif options, err = p.readListOptions(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tc2 := p.read()\n\t\tif c2 != ';' {\n\t\t\treturn nil, p.throw(';', c2)\n\t\t}\n\t} else if c != ';' {\n\t\treturn nil, p.throw(';', c)\n\t}\n\t// Gobble up any inline documentation for a field\n\tp.skipUntilNewline()\n\treturn options, nil\n}", "title": "" }, { "docid": "e1b2be3fd55067fc2008187271e91dae", "score": "0.53224975", "text": "func renderList(itemsText ...string) vecty.ComponentOrHTML {\n\titems := make(vecty.List, len(itemsText))\n\tfor i, v := range itemsText {\n\t\titems[i] = elem.ListItem(\n\t\t\tvecty.Markup(vecty.Class(\"mdc-list-item\")),\n\t\t\tvecty.Text(v),\n\t\t)\n\t}\n\treturn elem.UnorderedList(\n\t\tvecty.Markup(vecty.Class(\"mdc-list\")),\n\t\titems,\n\t)\n}", "title": "" }, { "docid": "f3e43cee419d70b581d7b985d7894384", "score": "0.5316703", "text": "func ParseString(values string, separator string) (list List) {\n\tlist.Values = strings.Split(values, separator)\n\tlist.Separator = separator\n\tlist.Index = -1\n\treturn\n}", "title": "" }, { "docid": "65823f4f3cc126568c87809a3e8bfbf8", "score": "0.5304671", "text": "func btrfsParseList(output string) ([]btrfsFS, error) {\n\tvar fss []btrfsFS\n\n\tall := strings.Split(output, \"\\n\")\n\tif len(all) < 3 {\n\t\treturn fss, errBtrfsNoFS\n\t}\n\n\tvar fsLines []string\n\tfor i, line := range all {\n\t\tline = strings.TrimSpace(line)\n\n\t\t// there are 3 markers of a filesystem\n\t\t// - empty line (original btrfs command)\n\t\t// - line started with `Label` and not first line (PM wrapped command)\n\t\t// - last line (original btrfs command & PM wrapped command)\n\t\tif (strings.HasPrefix(line, \"Label\") && i != 0) || line == \"\" || i == len(all)-1 {\n\t\t\tif !strings.HasPrefix(line, \"Label\") {\n\t\t\t\tfsLines = append(fsLines, line)\n\t\t\t}\n\t\t\tif len(fsLines) < 3 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfs, err := btrfsParseFS(fsLines)\n\t\t\tif err != nil {\n\t\t\t\treturn fss, err\n\t\t\t}\n\t\t\tfss = append(fss, fs)\n\n\t\t\tfsLines = []string{}\n\t\t\tif strings.HasPrefix(line, \"Label\") {\n\t\t\t\tfsLines = append(fsLines, line)\n\t\t\t}\n\t\t} else {\n\t\t\tfsLines = append(fsLines, line)\n\t\t}\n\t}\n\treturn fss, nil\n}", "title": "" }, { "docid": "1b86b34bd3f7e31378dd510b93a86a75", "score": "0.52753985", "text": "func ParseCommaSeparatedList(commaSeparatedList string) []*string {\n\titems := []*string{}\n\trawList := strings.Split(commaSeparatedList, \",\")\n\n\tfor _, item := range rawList {\n\t\ttrimmedItem := strings.TrimSpace(item)\n\t\tif len(trimmedItem) > 0 {\n\t\t\titems = append(items, &trimmedItem)\n\t\t}\n\t}\n\n\treturn items\n}", "title": "" }, { "docid": "1b0bc413c06bee8d152f8347b0764054", "score": "0.5260472", "text": "func (t *Tree) parseRootList() {\n\tln := t.newListNode()\n\tt.Root = &ln\n\n\tif t.peek().typ == itemSeparator || t.peek().typ == itemEOF {\n\t\tt.Root.append(t.newEmptyPhraseNode())\n\t}\n\n\tfor t.peek().typ != itemEOF {\n\t\tif t.peek().typ == itemText || t.peek().typ == itemOpen {\n\t\t\tt.Root.append(t.phrase())\n\n\t\t} else if t.peek().typ == itemSeparator {\n\t\t\tt.next()\n\n\t\t\tif t.peek().typ == itemSeparator || t.peek().typ == itemEOF {\n\t\t\t\tt.Root.append(t.newEmptyPhraseNode())\n\t\t\t}\n\t\t} else {\n\t\t\tt.errorf(\"unexpected item type %v in root\", t.peek().typ)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c736ca44a6d0fc2673ee8e7fb9da5a40", "score": "0.52600014", "text": "func ListParser(output []byte) (Stats, error) {\n\tstr := string(output)\n\tif IsNotAvailable(str) {\n\t\treturn Stats{}, errors.New(string(NoPoolAvailable))\n\t}\n\n\tstats, ok := isValid(str)\n\tif !ok {\n\t\treturn Stats{}, errors.New(InCompleteStdoutErr)\n\t}\n\n\treturn Stats{\n\t\tName: stats[0],\n\t\tSize: stats[1],\n\t\tUsed: stats[2],\n\t\tFree: stats[3],\n\t\tUsedCapacityPercent: stats[6],\n\t\tStatus: ZpoolStatus(stats[8]),\n\t}, nil\n}", "title": "" }, { "docid": "1db1af0881383fd483c8df49f5754f3f", "score": "0.52465785", "text": "func GetWordsFromLineList(list []string) []string {\n\twordList := make([]string, 0)\n\n\tfor _, line := range list {\n\t\twordsInLine := GetWordsFromString(line)\n\t\twordList = append(wordList, wordsInLine...) \n\t}\n\n\treturn wordList\n}", "title": "" }, { "docid": "817e1d6311edd3937f15fb2a0f1a6f7a", "score": "0.5245949", "text": "func GetFlatTokenList(text string) []Token{\n\tvar tokens []Token\n\tremaining_text := strings.Trim(text, \" \\n\\t\\r\\u000a\")\n\tlast_iteration_text := remaining_text\n\n\tfor len(remaining_text) > 0 {\n\t\tfor pattern, converter := range SOURCE_PATTERNS {\n\t\t\tmatch := pattern.FindIndex([]byte(remaining_text))\n\t\t\tif match == nil || match[0] != 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttoken := converter(remaining_text[match[0]:match[1]])\n//\t\t\tfmt.Println(\"appended \", token)\n\t\t\ttokens = append(tokens, token)\n\t\t\t// cut out the regex match\n\t\t\tremaining_text = remaining_text[match[1]:]\n\t\t\tbreak\n\t\t}\n//\t\tprintln(remaining_text == \"\\u000a\")\n\t\tif last_iteration_text == remaining_text{\n\t\t\tpanic(\"loool... we couldn't find any match for the text\")\n\t\t}\n\t\tlast_iteration_text = strings.Trim(remaining_text, \" \\n\\t\\r\\u000a\")\n\t}\n\treturn tokens\n}", "title": "" }, { "docid": "484a91bcc23da88770254d1fdda2ffd9", "score": "0.52315205", "text": "func parseIPList(ipList []string) ([]netip.Addr, error) {\n\tvar ipAddresses []netip.Addr\n\tfor _, ip := range ipList {\n\t\tipAddr, err := netip.ParseAddr(ip)\n\t\tif err != nil {\n\t\t\tipPrefix, err := netip.ParsePrefix(ip)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.New(\"could not parse IP addresses from list\")\n\t\t\t}\n\t\t\tif ipPrefix.IsValid() {\n\t\t\t\tnetmask := ipPrefix.Bits()\n\t\t\t\tif netmask != 32 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tipAddr = ipPrefix.Addr()\n\t\t\t}\n\t\t}\n\t\tif ipAddr.IsValid() && !ipAddr.IsUnspecified() {\n\t\t\tipAddresses = append(ipAddresses, ipAddr)\n\t\t}\n\t}\n\n\tif len(ipAddresses) == 0 {\n\t\treturn nil, errors.New(\"could not parse IP addresses from list\")\n\t}\n\treturn ipAddresses, nil\n}", "title": "" }, { "docid": "47e20a33f82aabb258eb822102c50219", "score": "0.5218215", "text": "func (p *Parser) parseLiteralDocOrParamList() ([]expr.Expr, error) {\n\tvar docs []expr.Expr\n\n\t// Parse first (required) value list.\n\tdoc, err := p.parseParamOrDocument()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdocs = append(docs, doc)\n\n\t// Parse remaining (optional) values.\n\tfor {\n\t\tif tok, _, _ := p.ScanIgnoreWhitespace(); tok != scanner.COMMA {\n\t\t\tp.Unscan()\n\t\t\tbreak\n\t\t}\n\n\t\tdoc, err := p.parseParamOrDocument()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdocs = append(docs, doc)\n\t}\n\n\treturn docs, nil\n}", "title": "" }, { "docid": "61b924446c13b2165b3ea5745e076c26", "score": "0.5213592", "text": "func runListTextHandler(w http.ResponseWriter, r *http.Request) {\r\n\r\n\tdn := getRequestParam(r, \"model\")\r\n\trqLangTags := getRequestLang(r, \"lang\") // get optional language argument and languages accepted by browser\r\n\r\n\trpl, _ := theCatalog.RunListText(dn, rqLangTags)\r\n\tjsonResponse(w, r, rpl)\r\n}", "title": "" }, { "docid": "7947b77622601361ca0c4d87939178bf", "score": "0.52119875", "text": "func (p *parser) parseExprList() []ast.Expr {\n\texprs := []ast.Expr{p.parseExpr()}\n\tfor p.kind() == token.Comma {\n\t\tp.skip(token.Comma)\n\t\texprs = append(exprs, p.parseExpr())\n\t}\n\treturn exprs\n}", "title": "" }, { "docid": "ef48b02bd024ba3d0821f2b9c0f9fb41", "score": "0.52092665", "text": "func (k Key) List() []string {\n\treturn strings.Split(k.string, \"/\")[1:]\n}", "title": "" }, { "docid": "fec750d1e08e2b427d4c12949efa9cd0", "score": "0.5197851", "text": "func (p *parser) parseResultList(pkg *types.Package) *types.Tuple {\n\tswitch p.tok {\n\tcase '<':\n\t\tp.next()\n\t\tif p.tok == scanner.Ident && p.lit == \"inl\" {\n\t\t\treturn nil\n\t\t}\n\t\ttaa, _ := p.parseTypeAfterAngle(pkg)\n\t\treturn types.NewTuple(types.NewParam(token.NoPos, pkg, \"\", taa))\n\n\tcase '(':\n\t\tparams, _ := p.parseParamList(pkg)\n\t\treturn params\n\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "8e111eccde21ff7cc9c8c89da592f583", "score": "0.51813275", "text": "func parseMoveList(pgn string) []string {\n\tstrs := strings.Split(pgn, \" \")\n\tcp := []string{}\n\tfor _, s := range strs {\n\t\ti := strings.Index(s, \".\")\n\t\tif i == -1 {\n\t\t\tcp = append(cp, s)\n\t\t} else {\n\t\t\tcp = append(cp, s[i+1:])\n\t\t}\n\t}\n\treturn cp\n}", "title": "" }, { "docid": "08566a48a9aa4bfb2bfa15ef65138daa", "score": "0.51678747", "text": "func HostList(r io.Reader) SeriesParser[*HostListEntry] {\n\treturn LinesAs[*HostListEntry](r)\n}", "title": "" }, { "docid": "35b10663349af474df99966e6e8d719b", "score": "0.5165731", "text": "func getList(item value.Value) (*value.List, error) {\n\tswitch item := item.(type) {\n\tcase value.AnnotatedValue:\n\t\tps := item.GetAttachment(\"list\")\n\t\tswitch ps := ps.(type) {\n\t\tcase *value.List:\n\t\t\treturn ps, nil\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"Invalid list %v of type %T.\", ps, ps)\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Invalid %v of type %T.\", item, item)\n\t}\n}", "title": "" }, { "docid": "6fec10ca6348df2badb221ad5a31f69d", "score": "0.51600003", "text": "func hostList(host, list string) (rtn []string) {\n\tif host != \"\" {\n\t\trtn = append(rtn, strings.TrimSpace(host))\n\t}\n\tif list != \"\" {\n\t\thosts, err := readLine(list)\n\t\tif err != nil {\n\t\t\tgDebug.Printf(\"cannot get host/ip from file:%s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\trtn = append(rtn, hosts...)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c698baf86254bba5a876eb0b7e21d344", "score": "0.5159306", "text": "func ParseItems(s string) ([]*Item, error) {\n\tlines, err := parseTSV(s, 3)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar items []*Item\n\tfor _, parts := range lines {\n\t\titems = append(items, &Item{\n\t\t\tEnglish: parts[0],\n\t\t\tPinyin: parts[1],\n\t\t\tCharacters: parts[2],\n\t\t})\n\t}\n\treturn items, nil\n}", "title": "" }, { "docid": "6960c6d1e20dac9893105a171b8f8869", "score": "0.51543653", "text": "func (t *textTemplater) list() string {\n\treturn box.String(\"list.text.tmpl\")\n}", "title": "" }, { "docid": "13e5296ac7faef54465a2d01ae230628", "score": "0.5152355", "text": "func NewList(strs [][]byte, str []byte, mode int) *List {\n\tif mode == Comp {\n\t\tstr = lastWord(str)\n\t} else {\n\t\tstr = firstWord(str)\n\t}\n\treturn &List{strs: strs, str: str, curr: -1}\n}", "title": "" }, { "docid": "9fef8166da4e6242416b7cc89ee6984f", "score": "0.51523226", "text": "func (r *MarkdownStripper) ListItem(out *bytes.Buffer, text []byte, flags int) {\n\tr.processString(out, text, false)\n}", "title": "" }, { "docid": "8a9a9351dda48b1d8ad3eeabc10971cb", "score": "0.5151241", "text": "func ParseListOutput(output string) (*Info, error) {\n\tlines := strings.Split(output, \"\\n\")\n\n\tswitch len(lines) {\n\tcase 0:\n\t\treturn nil, errors.New(\"Error listing backups\")\n\tcase 1:\n\t\treturn nil, errors.New(\"Parse error: not enough lines\")\n\tdefault:\n\t\tpath, err := parsePathLine(lines[0])\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbackups, err := parseBackupLines(lines[2:])\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn &Info{\n\t\t\tPath: path,\n\t\t\tBackups: *backups,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "27e86f9445f0c32b3deec04c26cd7a80", "score": "0.512538", "text": "func processFieldList(fields *ast.FieldList) (list Args) {\n\t// Make sure FieldList is not empty.\n\tif fields == nil {\n\t\treturn\n\t}\n\n\t// Extract the info we need.\n\tfor _, field := range fields.List {\n\t\tt := processField(field)\n\t\tif t != nil {\n\t\t\tlist = append(list, t...)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "597e5313c88cdc921aa4f60eb5b98858", "score": "0.51245975", "text": "func parseFilterList(resp string) ([]BloomFilter, error) {\n\tlines := strings.Split(resp, \"\\n\")\n\n\tresults := make([]BloomFilter, len(lines))\n\tfor i, line := range lines {\n\t\tparts := strings.Split(line, \" \")\n\n\t\tif len(parts) != 5 {\n\t\t\treturn nil, errors.Errorf(\"bloomd: unexpected response %s\", resp)\n\t\t}\n\n\t\tfilter := BloomFilter{Name: parts[0]}\n\n\t\tif probability, err := strconv.ParseFloat(parts[1], 32); err == nil {\n\t\t\tfilter.Probability = float32(probability)\n\t\t} else {\n\t\t\treturn nil, errors.Errorf(\"bloomd: unexpected response %s\", resp)\n\t\t}\n\n\t\tif storage, err := strconv.Atoi(parts[2]); err == nil {\n\t\t\tfilter.Storage = storage\n\t\t} else {\n\t\t\treturn nil, errors.Errorf(\"bloomd: unexpected response %s\", resp)\n\t\t}\n\n\t\tif cap, err := strconv.Atoi(parts[3]); err == nil {\n\t\t\tfilter.Capacity = cap\n\t\t} else {\n\t\t\treturn nil, errors.Errorf(\"bloomd: unexpected response %s\", resp)\n\t\t}\n\n\t\tif size, err := strconv.Atoi(parts[4]); err == nil {\n\t\t\tfilter.Size = size\n\t\t} else {\n\t\t\treturn nil, errors.Errorf(\"bloomd: unexpected response %s\", resp)\n\t\t}\n\n\t\tresults[i] = filter\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "cfda5a10f642dccdb278dc24d30ec201", "score": "0.51224166", "text": "func stringList(args ...interface{}) []string {\n\tvar x []string\n\tfor _, arg := range args {\n\t\tswitch arg := arg.(type) {\n\t\tcase []string:\n\t\t\tx = append(x, arg...)\n\t\tcase string:\n\t\t\tx = append(x, arg)\n\t\tdefault:\n\t\t\tpanic(\"stringList: invalid argument\")\n\t\t}\n\t}\n\treturn x\n}", "title": "" }, { "docid": "cfda5a10f642dccdb278dc24d30ec201", "score": "0.51224166", "text": "func stringList(args ...interface{}) []string {\n\tvar x []string\n\tfor _, arg := range args {\n\t\tswitch arg := arg.(type) {\n\t\tcase []string:\n\t\t\tx = append(x, arg...)\n\t\tcase string:\n\t\t\tx = append(x, arg)\n\t\tdefault:\n\t\t\tpanic(\"stringList: invalid argument\")\n\t\t}\n\t}\n\treturn x\n}", "title": "" }, { "docid": "3b8b5888adff4325c11889b2df164c00", "score": "0.51216376", "text": "func ParseAddressList(list string) ([]*Address, error) {\n\tparser := mail.AddressParser{\n\t\t&mime.WordDecoder{message.CharsetReader},\n\t}\n\treturn parser.ParseList(list)\n}", "title": "" }, { "docid": "57ef92ce3e458d81e7c0a0f7d2144e77", "score": "0.5106288", "text": "func parseAttachVolumeList(input string) (infoArr []*AttachInfo) {\n\tin := strings.Trim(input, \"\\n\")\n\tlines := strings.Split(in, \"\\n\")\n\tfor i, v := range lines {\n\t\tif i > 0 {\n\t\t\tinfo := readAttachVolumeInfo(v)\n\t\t\tif info != nil {\n\t\t\t\tinfoArr = append(infoArr, info)\n\t\t\t}\n\t\t}\n\t}\n\treturn infoArr\n}", "title": "" }, { "docid": "8ac25b8a96959e386bf428edf779ea9b", "score": "0.51043534", "text": "func modelTextListHandler(w http.ResponseWriter, r *http.Request) {\r\n\r\n\trqLangTags := getRequestLang(r, \"lang\") // get optional language argument and languages accepted by browser\r\n\r\n\t// get list of model basics: name, digest and directory\r\n\tmbs := theCatalog.allModels()\r\n\r\n\ttype modelTxtListItem struct {\r\n\t\tModelDicDescrNote // model_dic db row and model_dic_txt row\r\n\t\tDir string // model directory, relative to model root and slashed: dir/sub\r\n\t\tExtra string // if not empty then model extra content\r\n\t}\r\n\tmtl := make([]modelTxtListItem, 0, len(mbs))\r\n\r\n\t// by model digest get model_dic row and model_dic_txt row in UI language\r\n\tfor _, b := range mbs {\r\n\t\tif mt, ok := theCatalog.ModelTextByDigest(b.model.Digest, rqLangTags); ok {\r\n\t\t\tmtl = append(mtl,\r\n\t\t\t\tmodelTxtListItem{\r\n\t\t\t\t\tModelDicDescrNote: *mt,\r\n\t\t\t\t\tDir: b.relDir,\r\n\t\t\t\t\tExtra: b.extra,\r\n\t\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t// write json response\r\n\tjsonResponse(w, r, mtl)\r\n}", "title": "" }, { "docid": "ac2de2a5e58260feb23ecdea4b0662fa", "score": "0.51035666", "text": "func getTrainLegParsedList(trainLegList []TrainLeg) []TrainLegParsed {\n\tresult := make([]TrainLegParsed, 0, len(trainLegList))\n\tfor _, trainLeg := range trainLegList {\n\t\ttrainId, _ := strconv.Atoi(trainLeg.TrainId)\n\t\tdepartureStationId, _ := strconv.Atoi(trainLeg.DepartureStationId)\n\t\tarrivalStationId, _ := strconv.Atoi(trainLeg.ArrivalStationId)\n\t\tprice, _ := strconv.ParseFloat(trainLeg.Price, 64)\n\t\tarrivalTime, _ := time.Parse(\"15:04:05\", trainLeg.ArrivalTime)\n\t\tdepartureTime, _ := time.Parse(\"15:04:05\", trainLeg.DepartureTime)\n\t\ttrainLegParsed := TrainLegParsed{TrainId: trainId, DepartureStationId: departureStationId,\n\t\t\tArrivalStationId: arrivalStationId, Price: int(price * 100), ArrivalTime: arrivalTime, DepartureTime: departureTime}\n\t\tresult = append(result, trainLegParsed)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "2a2b214e8b2e1530439ff128d814d271", "score": "0.5102627", "text": "func (s *Statement) List(items ...Code) *Statement {\n\tg := &Group{\n\t\tclose: \"\",\n\t\titems: items,\n\t\tmulti: false,\n\t\tname: \"list\",\n\t\topen: \"\",\n\t\tseparator: \",\",\n\t}\n\t*s = append(*s, g)\n\treturn s\n}", "title": "" }, { "docid": "55f1aca7a4339a81c32bc75ce7686e83", "score": "0.5098876", "text": "func parseLoadingData(loadingDataString string) []LoadData {\n\texplode := strings.Split(loadingDataString, \";;;\")\n\n\tresult := make([]LoadData, len(explode))\n\tfor i, item := range explode {\n\t\texplodeItem := strings.Split(item, \":::\")\n\t\tresult[i] = LoadData{\n\t\t\tindex: i,\n\t\t\tUrl: explodeItem[0],\n\t\t\tFilepath: explodeItem[1],\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "eba061b19b3729d4bf28cd86de514ebf", "score": "0.50948745", "text": "func (r ListResult) Extract() ([]ListedTag, error) {\n\tvar s []ListedTag\n\terr := r.ExtractIntoSlicePtr(&s, \"tags\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "26aec0d3320cb387b1e60d42695758d2", "score": "0.50874954", "text": "func parsePatchlist(list []string) ([]RelocSpan, error) {\n\tif len(list) == 0 {\n\t\treturn []RelocSpan{{0, MaxSpan, true}}, nil\n\t}\n\tvar spans []RelocSpan\n\tfor _, s := range list {\n\t\tdesc := strings.HasSuffix(s, \"-\")\n\t\tif t := strings.TrimRight(s, \"+-\"); len(t) != len(s)-1 {\n\t\t\tif len(t) == len(s) {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid address: %q has no direction\", s)\n\t\t\t} else {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid address: %q has multiple signs\", s)\n\t\t\t}\n\t\t} else {\n\t\t\ts = t\n\t\t}\n\t\tn, err := strconv.ParseInt(s, 16, 16)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid address: %w\", err)\n\t\t}\n\t\tspans = append(spans, RelocSpan{Low: uint(n), Desc: desc})\n\t}\n\tfor i := range spans {\n\t\tif i == len(spans)-1 {\n\t\t\tspans[i].High = MaxSpan\n\t\t} else {\n\t\t\tspans[i].High = spans[i+1].Low\n\t\t}\n\t}\n\treturn spans, nil\n}", "title": "" }, { "docid": "9bbe72338a3fceab3530bf7edfcfb3eb", "score": "0.5079152", "text": "func (c *Client) List() ([]string, error) {\n\tr, err := c.get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar l []string\n\ts := bufio.NewScanner(r.Body)\n\tfor s.Scan() {\n\t\tl = append(l, s.Text())\n\t}\n\n\treturn l, s.Err()\n}", "title": "" }, { "docid": "6d4ec57022862b707a385adf4cfa7e37", "score": "0.50783175", "text": "func NewList(s ...string) List {\n\tl := make(List, len(s))\n\tfor _, v := range s {\n\t\tl = append(l, v)\n\t}\n\n\treturn l\n}", "title": "" }, { "docid": "10c1a0aa9ce6fb4e75e58f6c8726c133", "score": "0.50742424", "text": "func List(list ...string) string { sep := \" * \"; return sep + strings.Join(list, \"\\n\"+sep) }", "title": "" }, { "docid": "ad5f6d7dcf96d6965f413142a11ad6ce", "score": "0.50741225", "text": "func parse(val string) (ans []models.RowConfigModel) {\n\n\t// split string with ',' as separator\n\tarr := strings.Split(val, \",\")\n\n\t// iterate trough array\n\tfor _, el := range arr {\n\n\t\t// remove bad chars\n\t\traws := strings.ReplaceAll(el, \"(\", \"\")\n\t\traws = strings.ReplaceAll(raws, \")\", \"\")\n\t\traws = strings.ReplaceAll(raws, \" \", \"_\")\n\t\traws = strings.ReplaceAll(raws, \"[\", \"\")\n\t\traws = strings.ReplaceAll(raws, \"]\", \"\")\n\t\traws = strings.ReplaceAll(raws, \"-\", \"_\")\n\n\t\t// split element with ';' as separator\n\t\tspl := strings.Split(raws, \";\")\n\n\t\t// append split as RowConfigModel\n\t\tans = append(ans, models.RowConfigModel{spl[0], checkTableName(spl[1])})\n\t}\n\n\t// return response\n\treturn\n}", "title": "" } ]
3ae55e54767c84cfb43b08d6e41f889a
QueryStatistic queries the statistic edge of a Area.
[ { "docid": "629e36b5d7365173f40c800ed37be85f", "score": "0.7746809", "text": "func (c *AreaClient) QueryStatistic(a *Area) *StatisticQuery {\n\tquery := &StatisticQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(area.Table, area.FieldID, id),\n\t\t\tsqlgraph.To(statistic.Table, statistic.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, area.StatisticTable, area.StatisticColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" } ]
[ { "docid": "1db679103023dca981597fa9f559fe17", "score": "0.702832", "text": "func (c *StatisticClient) QueryArea(s *Statistic) *AreaQuery {\n\tquery := &AreaQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := s.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(statistic.Table, statistic.FieldID, id),\n\t\t\tsqlgraph.To(area.Table, area.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, statistic.AreaTable, statistic.AreaColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(s.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "d61317a49eeb05ce3a72a43339c77154", "score": "0.58968806", "text": "func (c *DiseaseClient) QueryArea(d *Disease) *AreaQuery {\n\tquery := &AreaQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := d.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(disease.Table, disease.FieldID, id),\n\t\t\tsqlgraph.To(area.Table, area.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, disease.AreaTable, disease.AreaColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(d.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "d4feec736c5e601b363bdf093eed307c", "score": "0.58461654", "text": "func (c *LevelClient) QueryArea(l *Level) *AreaQuery {\n\tquery := &AreaQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := l.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(level.Table, level.FieldID, id),\n\t\t\tsqlgraph.To(area.Table, area.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, level.AreaTable, level.AreaColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(l.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "1055e83a0948b42ea490ca4d8e5a0e38", "score": "0.5751734", "text": "func (c *EmployeeClient) QueryArea(e *Employee) *AreaQuery {\n\tquery := &AreaQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := e.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(employee.Table, employee.FieldID, id),\n\t\t\tsqlgraph.To(area.Table, area.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, employee.AreaTable, employee.AreaColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(e.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "524772219430d92c7f4b0de9a0bd5c66", "score": "0.5182003", "text": "func MeasureArea(g geometry) {\n\t// Call area on whichever type is being operated on\n\tfmt.Println(g.area())\n}", "title": "" }, { "docid": "a6bc4bf671f6e8937edf8be95370af30", "score": "0.4854084", "text": "func (c *AreaClient) Query() *AreaQuery {\n\treturn &AreaQuery{config: c.config}\n}", "title": "" }, { "docid": "aa193822e78239c21482b77327d678bc", "score": "0.47376508", "text": "func (c *StatisticClient) Query() *StatisticQuery {\n\treturn &StatisticQuery{config: c.config}\n}", "title": "" }, { "docid": "1235dcfe2e3feda26ba5d8dd63e8ed82", "score": "0.4696045", "text": "func QueryForStats() ([]Statistics, error) {\n\tvar stats []Statistics\n\t// Using the nil parameter in find gets all stats\n\terr := db.C(STAT).Find(nil).All(&stats)\n\treturn stats, err\n}", "title": "" }, { "docid": "9a5378c7236abc6c31826bd281be60bb", "score": "0.46676683", "text": "func PrintStatisticQuery(dbs []db.Database, ctx *action.Context) error {\n\tpget := ctx.Get(\"params\").(parametergetter.ParameterGetter)\n\tif pget.GetDef(parametergetter.QueryStatistic, false).(bool) {\n\t\tfor _, d := range dbs {\n\t\t\tlocalCtx := ctx.Get(\"context\" + d.Code).(*action.Context)\n\t\t\tmSec := localCtx.Snap.Finished().Sub(localCtx.Snap.Started()).Nanoseconds() / 1000 / 1000\n\t\t\tif localCtx.Get(\"success\").(bool) {\n\t\t\t\trowcount := localCtx.GetDef(\"rowcount\", 0).(int)\n\t\t\t\trowsaffected := localCtx.GetDef(\"rowsaffected\", int64(0)).(int64)\n\t\t\t\tfmt.Printf(\"%s: Success. Elapsed time:%d msec. Rows count:%d Rows affected: %d\\n\", d.Code, mSec, rowcount, rowsaffected)\n\t\t\t} else {\n\n\t\t\t\tvar errmsg string\n\t\t\t\tif errs := localCtx.Snap.Error(); errs != nil {\n\t\t\t\t\terrmsg = errs.Error()\n\t\t\t\t}\n\t\t\t\tfmt.Printf(\"%s: Failed! Elapsed time:%d msec. Error message: %s \\n\", d.Code, mSec, strings.Replace(errmsg, \"\\n\", \" \", -1))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1eac195075453ef361cf71d171ef21a0", "score": "0.455416", "text": "func (c *AreaClient) QueryLevel(a *Area) *LevelQuery {\n\tquery := &LevelQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(area.Table, area.FieldID, id),\n\t\t\tsqlgraph.To(level.Table, level.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, area.LevelTable, area.LevelColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "df15160c7059b64355ba24d8139cf42e", "score": "0.44350848", "text": "func (taosd *TDengineDataSource) QueryMetrics(recv dataobj.EndpointsRecv) *dataobj.MetricResp {\r\n\t/*\r\n\t\tif taosd.Section.config.useindex {\r\n\t\t\tvar result IndexMetricsResp\r\n\t\t\terr := PostIndex(\"/api/index/metrics\", int64(taosd.Section.config.callTimeout), recv, &result)\r\n\t\t\tif err != nil {\r\n\t\t\t\tlogger.Errorf(\"post index failed, %+v\", err)\r\n\t\t\t\treturn nil\r\n\t\t\t}\r\n\r\n\t\t\tif result.Err != \"\" {\r\n\t\t\t\tlogger.Errorf(\"index xclude failed, %+v\", result.Err)\r\n\t\t\t\treturn nil\r\n\t\t\t}\r\n\r\n\t\t\treturn result.Data\r\n\t\t} else {\r\n\t*/\r\n\tlogger.Debugf(\"query metric, recv: %+v\", recv)\r\n\tc, err := NewInTaosdClient(taosd.Section)\r\n\r\n\tif err != nil {\r\n\t\tlogger.Errorf(\"init taosd client fail: %v\", err)\r\n\t\treturn nil\r\n\t}\r\n\tdefer c.Db.Close()\r\n\t//use databasename;show stables;\r\n\t//metric as stable name,so query stables name get metrics\r\n\t//\t taos> use log; show stables;\r\n\t//\t Database changed.\r\n\r\n\t//\t name | created_time | columns | tags | tables |\r\n\t//\t ============================================================================================\r\n\t//\t acct | 2020-11-19 12:31:55.449 | 22 | 1 | 1 |\r\n\t//\t dn | 2020-11-19 12:31:55.449 | 15 | 2 | 1 |\r\n\t//\t Query OK, 2 row(s) in set (0.002096s)\r\n\r\n\ttaosdql := fmt.Sprintf(\"show stables;\") //, taosd.Section.dbName)\r\n\t//查询返回 按记录条->列名k 数据v保存为map数组\r\n\t//通过查询超级表的名字,获取metrics的名字\r\n\tresponse := taosd.taosdSQL(c, taosdql)\r\n\tif response != nil {\r\n\t\tresp := &dataobj.MetricResp{\r\n\t\t\tMetrics: make([]string, 0),\r\n\t\t}\r\n\t\tfor _, rowmap := range response {\r\n\t\t\tfor colmmapk, colmmapv := range *rowmap {\r\n\t\t\t\tif colmmapk == \"name\" {\r\n\t\t\t\t\tstbname := colmmapv.(string)\r\n\t\t\t\t\t//转换间隔符'_'-->'.'\r\n\t\t\t\t\tmetric := UnmetricnameEscape(stbname)\r\n\t\t\t\t\tresp.Metrics = append(resp.Metrics, metric)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn resp\r\n\t} else {\r\n\t\tif err != nil {\r\n\t\t\tlogger.Warningf(\"query metrics on taosd error %v.\", err)\r\n\t\t}\r\n\t}\r\n\treturn nil\r\n\t//\t}\r\n}", "title": "" }, { "docid": "518cc6d5fbac4b6ce6686873b4b2b5de", "score": "0.43799487", "text": "func (c *StatisticClient) Get(ctx context.Context, id int) (*Statistic, error) {\n\treturn c.Query().Where(statistic.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "aaede41d0cb707b33dc4908ddcbea62a", "score": "0.43796694", "text": "func (s *Service) StatisticsEndpoint(w http.ResponseWriter, r *http.Request) {\n\tres, err := json.MarshalIndent(s.fizzBuzzStat, \"\", \"\\t\")\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"failed to show statistics (%s)\", err), http.StatusInternalServerError)\n\t}\n\tfmt.Fprint(w, string(res))\n}", "title": "" }, { "docid": "d7bef862d8e725c7900a67d8c079d303", "score": "0.43476057", "text": "func QueryStats(ctx context.Context, node *core.IpfsNode) (*hubpb.StatsResp, error) {\n\tconfig, err := node.Repo.Config()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resp *hubpb.StatsResp\n\terr = grpc.HubQueryClient(config.Services.HubDomain).WithContext(ctx, func(ctx context.Context,\n\t\tclient hubpb.HubQueryServiceClient) error {\n\t\tresp, err = client.GetStats(ctx, &hubpb.StatsReq{\n\t\t\tId: node.Identity.Pretty(),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif resp.Code != hubpb.ResponseCode_SUCCESS {\n\t\t\treturn fmt.Errorf(resp.Message)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to query stats from Hub service: %v\", err)\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "a9d0b4d93c72be02673047349161344b", "score": "0.43440163", "text": "func (service *Service) GetStatistics(deviceID string, dateFrom string, dateTo string, dataType string) ([]*apiModel.StatisticForm, error) {\n\tvar err error\n\tvar dbDateTo, dbDateFrom time.Time\n\n\tif len(dateTo) > 0 {\n\t\tdbDateTo, err = time.Parse(time.RFC3339, dateTo)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tdbDateTo = time.Now()\n\t}\n\tif len(dateFrom) > 0 {\n\t\tdbDateFrom, err = time.Parse(time.RFC3339, dateFrom)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tdbDateFrom = time.Time{}\n\t}\n\n\tif err = validateBsonObjectID(deviceID); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbsonDeviceID := bson.ObjectIdHex(deviceID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstatistics, err := service.db.GetStatisticsDeviceFromToType(bsonDeviceID, dbDateFrom, dbDateTo, dataType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tapiStatistics := arrayOfDatabaseStatisticsToArrayOfApiStatistics(statistics)\n\n\treturn apiStatistics, nil\n}", "title": "" }, { "docid": "9b4d4e50ed9bc70d878a74f9aece1642", "score": "0.43356195", "text": "func (t *SrlNokiaNetworkInstance_NetworkInstance_Protocols_Ospf_Instance_Area_Interface_Neighbor_Statistics) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"SrlNokiaNetworkInstance_NetworkInstance_Protocols_Ospf_Instance_Area_Interface_Neighbor_Statistics\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "464a71cf4442610a1e8a4a7f41b486ae", "score": "0.4311445", "text": "func (svc *areaServiceImpl) GetAreaInformation(filter AreaFilter) (*Area, *errors.ApiError) {\n\tconst CONTENTTYPE string = \"application/json\"\n\n\tjsonData := []map[string]float64{{\n\t\t_const.LATITUDEFIELD: filter.point.Lat,\n\t\t_const.LONGITUDEFIELD: filter.point.Lon,\n\t}}\n\tjsonValue, _ := json.Marshal(jsonData)\n\n\tresponse, err := http.Post(\n\t\tsvc.Config.BasketBaseApiPath+svc.Config.AreaContextPath,\n\t\tCONTENTTYPE,\n\t\tbytes.NewBuffer(jsonValue))\n\n\tif err != nil {\n\t\treturn nil, errors.ServerError(err)\n\t}\n\n\ts, _ := svc.storeService.GetStoresForLocation(filter.point)\n\tchains := make(map[string]stores.Chain)\n\n\tfor _, store := range s {\n\t\tchains[strconv.Itoa(store.ChainID)] = store.Chain\n\t}\n\n\tbody, readErr := ioutil.ReadAll(response.Body)\n\n\tif readErr != nil {\n\t\tfmt.Println(\"couldn't parse body\")\n\t}\n\n\tvar r AreaResponse\n\tjson.Unmarshal(body, &r)\n\n\tarea := r.Content[0]\n\n\tarea.Stores = s\n\tarea.Chains = chains\n\n\treturn &area, nil\n}", "title": "" }, { "docid": "0b4281ba7a6bf125ea29fb0e59becd26", "score": "0.43092728", "text": "func Statistics(exec boil.Executor, mods ...qm.QueryMod) statisticQuery {\n\tmods = append(mods, qm.From(\"`statistics`\"))\n\treturn statisticQuery{NewQuery(exec, mods...)}\n}", "title": "" }, { "docid": "d2aeb7e4a19a712b578a8444af9d2a39", "score": "0.42804253", "text": "func measure(g geometry) {\n\tfmt.Println(g)\n\tfmt.Println(g.area())\n\tfmt.Println(g.perimeter())\n}", "title": "" }, { "docid": "4d9ab898aeb5c172158627d28756fae5", "score": "0.42577088", "text": "func (_ChainGovernance *ChainGovernanceCaller) QueryThreshold(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ChainGovernance.contract.Call(opts, out, \"queryThreshold\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "92e9ad54f5c97ae9e359a6e67007322c", "score": "0.42406523", "text": "func MetricQuery(ctx context.Context, tsdbReq *datasource.DatasourceRequest) (*datasource.DatasourceResponse, error) {\n\tcredentials := CredentialsFromReq(tsdbReq)\n\tjsonQueries, err := parseJSONQueries(tsdbReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpayload := simplejson.New()\n\tpayload.SetPath([]string{\"range\", \"to\"}, tsdbReq.TimeRange.ToEpochMs)\n\tpayload.SetPath([]string{\"range\", \"from\"}, tsdbReq.TimeRange.FromEpochMs)\n\tpayload.Set(\"targets\", jsonQueries)\n\n\tqueries := tsdbReq.GetQueries()\n\tresults := make([]*datasource.QueryResult, len(queries))\n\tfor i, query := range queries {\n\t\tpluginLogger.Debug(\"MetricQuery\", \"queryJSON\", query.ModelJson, \"index\", i)\n\t\tqueryParameters, err := simplejson.NewJson([]byte(query.ModelJson))\n\t\tif err != nil {\n\t\t\tpluginLogger.Debug(\"MetricQuery\", \"json parse error\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\talias := queryParameters.Get(\"alias\").MustString()\n\t\tmetric := queryParameters.Get(\"metricId\").MustString()\n\t\tprojectID := queryParameters.Get(\"projectId\").MustString()\n\t\tmongo := queryParameters.Get(\"mongoId\").MustString()\n\t\tdatabase := queryParameters.Get(\"database\").MustString()\n\t\tdisk := queryParameters.Get(\"disk\").MustString()\n\t\tclusterID := queryParameters.Get(\"clusterId\").MustString()\n\t\tdimensionID := queryParameters.Get(\"dimensionId\").MustString()\n\t\tintervalMs := queryParameters.Get(\"intervalMs\").MustInt()\n\n\t\tif metric == \"database_measurements\" {\n\t\t\tfromTime := tsdbReq.TimeRange.FromEpochMs\n\t\t\ttoTime := tsdbReq.TimeRange.ToEpochMs\n\t\t\trawDataPoints, err := GetDatabaseMeasurements(ctx, credentials, projectID, mongo, database, &MeasurementOptions{\n\t\t\t\tStart: time.Unix(fromTime/1000, 0).UTC().Format(time.RFC3339),\n\t\t\t\tEnd: time.Unix(toTime/1000, 0).UTC().Format(time.RFC3339),\n\t\t\t\tIntervalMs: intervalMs,\n\t\t\t\tMeasurement: dimensionID,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tdataPoints := make([]*datasource.Point, len(rawDataPoints))\n\t\t\tfor j, datapoint := range rawDataPoints {\n\t\t\t\ttimestamp, _ := time.Parse(\"2006-01-02T15:04:05Z\", datapoint.Timestamp)\n\t\t\t\tdataPoints[j] = &datasource.Point{\n\t\t\t\t\tTimestamp: timestamp.Unix() * 1000,\n\t\t\t\t\tValue: datapoint.Value,\n\t\t\t\t}\n\t\t\t}\n\t\t\tseries := make([]*datasource.TimeSeries, 1)\n\t\t\tname := query.RefId\n\t\t\tif alias != \"\" {\n\t\t\t\tname = alias\n\t\t\t\tprojectName := queryParameters.Get(\"projectName\").MustString()\n\t\t\t\tclusterName := queryParameters.Get(\"clusterName\").MustString()\n\t\t\t\tdimensionName := queryParameters.Get(\"dimensionName\").MustString()\n\t\t\t\tname = strings.ReplaceAll(name, \"{{projectId}}\", projectID)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{projectName}}\", projectName)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{clusterId}}\", clusterID)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{clusterName}}\", clusterName)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{database}}\", database)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{mongo}}\", mongo)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{disk}}\", disk)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{dimensionName}}\", dimensionName)\n\t\t\t}\n\t\t\tseries[0] = &datasource.TimeSeries{\n\t\t\t\tName: name,\n\t\t\t\tPoints: dataPoints,\n\t\t\t}\n\t\t\tresults[i] = &datasource.QueryResult{\n\t\t\t\tRefId: query.RefId,\n\t\t\t\tSeries: series,\n\t\t\t}\n\t\t} else if metric == \"process_measurements\" {\n\t\t\tfromTime := tsdbReq.TimeRange.FromEpochMs\n\t\t\ttoTime := tsdbReq.TimeRange.ToEpochMs\n\t\t\trawDataPoints, err := GetProcessMeasurements(ctx, credentials, projectID, mongo, &MeasurementOptions{\n\t\t\t\tStart: time.Unix(fromTime/1000, 0).UTC().Format(time.RFC3339),\n\t\t\t\tEnd: time.Unix(toTime/1000, 0).UTC().Format(time.RFC3339),\n\t\t\t\tIntervalMs: intervalMs,\n\t\t\t\tMeasurement: dimensionID,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tdataPoints := make([]*datasource.Point, len(rawDataPoints))\n\t\t\tfor j, datapoint := range rawDataPoints {\n\t\t\t\ttimestamp, _ := time.Parse(\"2006-01-02T15:04:05Z\", datapoint.Timestamp)\n\t\t\t\tdataPoints[j] = &datasource.Point{\n\t\t\t\t\tTimestamp: timestamp.Unix() * 1000,\n\t\t\t\t\tValue: datapoint.Value,\n\t\t\t\t}\n\t\t\t}\n\t\t\tseries := make([]*datasource.TimeSeries, 1)\n\t\t\tname := query.RefId\n\t\t\tif alias != \"\" {\n\t\t\t\tname = alias\n\t\t\t\tprojectName := queryParameters.Get(\"projectName\").MustString()\n\t\t\t\tclusterName := queryParameters.Get(\"clusterName\").MustString()\n\t\t\t\tdimensionName := queryParameters.Get(\"dimensionName\").MustString()\n\t\t\t\tname = strings.ReplaceAll(name, \"{{projectId}}\", projectID)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{projectName}}\", projectName)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{clusterId}}\", clusterID)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{clusterName}}\", clusterName)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{database}}\", database)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{mongo}}\", mongo)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{disk}}\", disk)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{dimensionName}}\", dimensionName)\n\t\t\t}\n\t\t\tseries[0] = &datasource.TimeSeries{\n\t\t\t\tName: name,\n\t\t\t\tPoints: dataPoints,\n\t\t\t}\n\t\t\tresults[i] = &datasource.QueryResult{\n\t\t\t\tRefId: query.RefId,\n\t\t\t\tSeries: series,\n\t\t\t}\n\t\t} else if metric == \"disk_measurements\" {\n\t\t\tfromTime := tsdbReq.TimeRange.FromEpochMs\n\t\t\ttoTime := tsdbReq.TimeRange.ToEpochMs\n\t\t\trawDataPoints, err := GetDiskMeasurements(ctx, credentials, projectID, mongo, disk, &MeasurementOptions{\n\t\t\t\tStart: time.Unix(fromTime/1000, 0).UTC().Format(time.RFC3339),\n\t\t\t\tEnd: time.Unix(toTime/1000, 0).UTC().Format(time.RFC3339),\n\t\t\t\tIntervalMs: intervalMs,\n\t\t\t\tMeasurement: dimensionID,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tdataPoints := make([]*datasource.Point, len(rawDataPoints))\n\t\t\tfor j, datapoint := range rawDataPoints {\n\t\t\t\ttimestamp, _ := time.Parse(\"2006-01-02T15:04:05Z\", datapoint.Timestamp)\n\t\t\t\tdataPoints[j] = &datasource.Point{\n\t\t\t\t\tTimestamp: timestamp.Unix() * 1000,\n\t\t\t\t\tValue: datapoint.Value,\n\t\t\t\t}\n\t\t\t}\n\t\t\tseries := make([]*datasource.TimeSeries, 1)\n\t\t\tname := query.RefId\n\t\t\tif alias != \"\" {\n\t\t\t\tname = alias\n\t\t\t\tprojectName := queryParameters.Get(\"projectName\").MustString()\n\t\t\t\tclusterName := queryParameters.Get(\"clusterName\").MustString()\n\t\t\t\tdimensionName := queryParameters.Get(\"dimensionName\").MustString()\n\t\t\t\tname = strings.ReplaceAll(name, \"{{projectId}}\", projectID)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{projectName}}\", projectName)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{clusterId}}\", clusterID)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{clusterName}}\", clusterName)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{database}}\", database)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{mongo}}\", mongo)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{disk}}\", disk)\n\t\t\t\tname = strings.ReplaceAll(name, \"{{dimensionName}}\", dimensionName)\n\t\t\t}\n\t\t\tseries[0] = &datasource.TimeSeries{\n\t\t\t\tName: name,\n\t\t\t\tPoints: dataPoints,\n\t\t\t}\n\t\t\tresults[i] = &datasource.QueryResult{\n\t\t\t\tRefId: query.RefId,\n\t\t\t\tSeries: series,\n\t\t\t}\n\t\t} else {\n\t\t\tpluginLogger.Debug(\"MetricQuery\", \"metric unknown\", metric)\n\t\t\t// nothing to do\n\t\t}\n\n\t}\n\n\tresponse := &datasource.DatasourceResponse{\n\t\tResults: results,\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "8fbf64bc97741d46c2ec77660efee8c1", "score": "0.42056906", "text": "func HasArea() predicate.Employee {\n\treturn predicate.Employee(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(AreaTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, AreaTable, AreaColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "title": "" }, { "docid": "0318cc97274160fb4b236eafa2cf4b93", "score": "0.4184708", "text": "func CalculateArea(args map[string]interface{}) error {\n var err error\n\n length := args[\"Length\"]\n width := args[\"Width\"]\n if length == nil || width == nil {\n err = errors.New(\"Map has no required attributes\")\n return err\n }\n fmt.Printf(\"The rectangle area is %d\\n\", int(length.(float64)) * int(width.(float64)))\n return err\n}", "title": "" }, { "docid": "45da06de3b7e6d7b5f79ec1e23caab27", "score": "0.4167137", "text": "func (c *AreaClient) Get(ctx context.Context, id int) (*Area, error) {\n\treturn c.Query().Where(area.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "d78b4395d018d74b44a5bec9962fbb9a", "score": "0.4167001", "text": "func (service *Service) QueryThreshold() (uint64, error) {\n\topts := &bind.CallOpts{From: service.chainGovernanceAuth.From}\n\tresult, err := service.chainGovernance.QueryThreshold(opts)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"ChainGovernanceService QueryThreshold failed, err: %v\", err)\n\t}\n\tnum, err := precompiled.BigIntToUint64(result)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"ChainGovernanceService QueryThreshold failed, err: %v\", err)\n\t}\n\treturn num, nil\n}", "title": "" }, { "docid": "bf67fa0a22906a164483d907a40f136f", "score": "0.41629183", "text": "func measure(g geometry) {\n\tfmt.Println(g)\n\tfmt.Println(g.area())\n\tfmt.Println(g.perim())\n}", "title": "" }, { "docid": "bf67fa0a22906a164483d907a40f136f", "score": "0.41629183", "text": "func measure(g geometry) {\n\tfmt.Println(g)\n\tfmt.Println(g.area())\n\tfmt.Println(g.perim())\n}", "title": "" }, { "docid": "bf67fa0a22906a164483d907a40f136f", "score": "0.41629183", "text": "func measure(g geometry) {\n\tfmt.Println(g)\n\tfmt.Println(g.area())\n\tfmt.Println(g.perim())\n}", "title": "" }, { "docid": "bf67fa0a22906a164483d907a40f136f", "score": "0.41629183", "text": "func measure(g geometry) {\n\tfmt.Println(g)\n\tfmt.Println(g.area())\n\tfmt.Println(g.perim())\n}", "title": "" }, { "docid": "bf67fa0a22906a164483d907a40f136f", "score": "0.41629183", "text": "func measure(g geometry) {\n\tfmt.Println(g)\n\tfmt.Println(g.area())\n\tfmt.Println(g.perim())\n}", "title": "" }, { "docid": "e7c74af5a1be803d95b753ffde860129", "score": "0.415878", "text": "func (h *ServiceClient) QueryStats(pattern string, reset bool) map[string]int64 {\n\tsresp, err := h.statClient.QueryStats(context.Background(), &statscmd.QueryStatsRequest{\n\t\tPattern: pattern,\n\t\tReset_: reset,\n\t})\n\n\tresult := make(map[string]int64)\n\tif err != nil {\n\t\tlog.Printf(\"failed to call grpc command: %v\", err)\n\t} else {\n\t\t// log.Printf(\"%v\", sresp)\n\t\tfor _, stat := range sresp.Stat {\n\t\t\tresult[stat.Name] = stat.Value\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "d8223467a5d1ce10306ebcbaadac516f", "score": "0.41488352", "text": "func (e *Executor) Statistics(tags map[string]string) []models.Statistic {\n\treturn []models.Statistic{{\n\t\tName: \"queryExecutor\",\n\t\tTags: tags,\n\t\tValues: map[string]interface{}{\n\t\t\tstatQueriesActive: atomic.LoadInt64(&e.stats.ActiveQueries),\n\t\t\tstatQueriesExecuted: atomic.LoadInt64(&e.stats.ExecutedQueries),\n\t\t\tstatQueriesFinished: atomic.LoadInt64(&e.stats.FinishedQueries),\n\t\t\tstatQueryExecutionDuration: atomic.LoadInt64(&e.stats.QueryExecutionDuration),\n\t\t\tstatRecoveredPanics: atomic.LoadInt64(&e.stats.RecoveredPanics),\n\t\t},\n\t}}\n}", "title": "" }, { "docid": "e1e836f2bea9d614268977a8f0095f2b", "score": "0.41336828", "text": "func QueryMetrics(c echo.Context) error {\n\tauth := c.Get(\"auth\").(*auth.Auth)\n\tmc := c.Get(\"metrics\").(*metrics.Client)\n\n\tvar qr types.QueryRequest\n\tif err := c.Bind(&qr); err != nil {\n\t\treturn err\n\t}\n\n\tvalidationErrors := map[string][]string{}\n\tif qr.Type == \"range\" {\n\t\tif qr.Start == 0 {\n\t\t\tvalidationErrors[\"start\"] = append(validationErrors[\"star\"], \"is required for type range queries\")\n\t\t}\n\n\t\tif qr.End == 0 {\n\t\t\tvalidationErrors[\"end\"] = append(validationErrors[\"star\"], \"is required for type range queries\")\n\t\t}\n\n\t\tif qr.Start == 0 {\n\t\t\tvalidationErrors[\"start\"] = append(validationErrors[\"star\"], \"must be before end\")\n\t\t}\n\n\t\tif qr.Step <= 0 {\n\t\t\tvalidationErrors[\"step\"] = append(validationErrors[\"step\"], \"must be a positive integer\")\n\t\t}\n\t}\n\n\tif len(validationErrors) > 0 {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]interface{}{\n\t\t\t\"message\": \"Validation error\",\n\t\t\t\"details\": validationErrors,\n\t\t})\n\t}\n\n\tif strings.Contains(qr.LabelMatchers, \"user_id\") {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]interface{}{\n\t\t\t\"message\": \"Validation error\",\n\t\t\t\"details\": map[string]string{\n\t\t\t\t\"label_matchers\": \"user_id not allowed as label matcher\",\n\t\t\t},\n\t\t})\n\t}\n\n\t// Scope to user only\n\tqr.LabelMatchers += fmt.Sprintf(`,user_id=\"%s\"`, auth.UserID)\n\n\ttmpl, err := template.New(\"test\").Delims(\"<<\", \">>\").Parse(qr.Query)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to parse metrics template: %s\", err)\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, \"Internal Server Error\")\n\t}\n\tvar tpl bytes.Buffer\n\tif err := tmpl.Execute(&tpl, qr); err != nil {\n\t\tlog.Errorf(\"Failed to buuild metrics template: %s\", err)\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, \"Internal Server Error\")\n\t}\n\n\ttmplString := tpl.String()\n\n\tvar query string\n\tvar endpoint string\n\tif qr.Type == \"range\" {\n\t\tendpoint = \"/query_range\"\n\t\tquery = fmt.Sprintf(\"query=%s&start=%f&end=%f&step=%d\", tmplString, qr.Start, qr.End, qr.Step)\n\t} else {\n\t\tendpoint = \"/query\"\n\t\tquery = fmt.Sprintf(\"query=%s\", tmplString)\n\t\tif qr.End != 0 {\n\t\t\tquery += fmt.Sprintf(\"&time=%f\", qr.End)\n\t\t}\n\t}\n\n\tfmt.Println(query)\n\tresult, qErr := mc.QueryMetrics(endpoint, query)\n\tif qErr != nil {\n\t\tif qErr.Type == types.ErrTypeBadRequest {\n\t\t\treturn echo.NewHTTPError(http.StatusBadRequest, qErr.String())\n\t\t}\n\n\t\tlog.Errorf(\"Failed to get metrics from prometheus: %s\", err)\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, \"Internal Server Error\")\n\t}\n\n\treturn c.JSON(http.StatusOK, result)\n}", "title": "" }, { "docid": "4c1b00b2570edeb40df4794b328de272", "score": "0.40899867", "text": "func (q statisticQuery) One() (*Statistic, error) {\n\to := &Statistic{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: failed to execute a one query for statistics\")\n\t}\n\n\tif err := o.doAfterSelectHooks(queries.GetExecutor(q.Query)); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "title": "" }, { "docid": "d1e1bc404a8b6864d6773e1bfbe24bc8", "score": "0.4077223", "text": "func GetStatistics(ctx context.Context, conn driver.Connection) (Statistics, error) {\n\treq, err := conn.NewRequest(\"GET\", \"_admin/statistics\")\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tresp, err := conn.Do(ctx, req)\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tif err := resp.CheckStatus(200); err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tvar result Statistics\n\tif err := resp.ParseBody(\"\", &result); err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "164f40d831f90cfd76a038286164f298", "score": "0.40671343", "text": "func (metrics *metrics) Query(start time.Time, end time.Time) ([]*MetricsEntry, error) {\n\tentries := make([]*MetricsEntry, 0, 100)\n\tacc := func(me *MetricsEntry) {\n\t\tif me == nil {\n\t\t\treturn\n\t\t}\n\t\tentries = append(entries, me)\n\t}\n\terr := metrics.query(acc, start, end)\n\treturn entries, err\n}", "title": "" }, { "docid": "34a49843749d9b6e53d435f15cb609c3", "score": "0.4042514", "text": "func FindStatistic(exec boil.Executor, id int64, selectCols ...string) (*Statistic, error) {\n\tstatisticObj := &Statistic{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from `statistics` where `id`=?\", sel,\n\t)\n\n\tq := queries.Raw(exec, query, id)\n\n\terr := q.Bind(statisticObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from statistics\")\n\t}\n\n\treturn statisticObj, nil\n}", "title": "" }, { "docid": "393f7461959259c9069af351929c8c08", "score": "0.40187952", "text": "func (s Square) Area() float64 {\n\treturn s.Side * s.Side\n}", "title": "" }, { "docid": "339d4f9f1e228609a5ca2d88f1c8a6f8", "score": "0.40173483", "text": "func PrintStatistic(dbs []db.Database, ctx *action.Context) error {\n\tvar buf bytes.Buffer\n\tpget := ctx.Get(\"params\").(parametergetter.ParameterGetter)\n\tif pget.GetDef(parametergetter.Statistic, false).(bool) {\n\t\tmSec := ctx.Snap.Finished().Sub(ctx.Snap.Started()).Nanoseconds() / 1000 / 1000\n\t\texec := ctx.GetDef(\"exec\", 0).(int)\n\t\tsuccess := ctx.GetDef(\"success\", 0).(int)\n\t\t//failed := ctx.GetDef(\"failed\", 0).(int)\n\t\tbuf.WriteString(fmt.Sprintf(\"Executed: %-4d Success:%-3d (%3.2f%%) Failed:%-3d \\n\", exec, success, float64(success)/float64(exec)*100, exec-success))\n\t\tbuf.WriteString(fmt.Sprintf(\"Completed: %v \", time.Duration(mSec)*time.Millisecond ))\n\t\tfmt.Println(buf.String())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "73fc066c3c88081aec10ef4c7573edfe", "score": "0.4011794", "text": "func (e EmptyTraffic) QueryHistoricalSpeed(wayID int64, t time.Time) (float64, bool) {\n\treturn 0, false\n}", "title": "" }, { "docid": "d4ebffd97e3fb314a6375b4530925714", "score": "0.40111774", "text": "func (b *Bivariate) GetQuery(coord *binning.TileCoord) elastic.Query {\n\t// compute the tiling properties\n\tb.computeTilingProps(coord)\n\t// create the range queries\n\tquery := elastic.NewBoolQuery()\n\tquery.Must(elastic.NewRangeQuery(b.XField).\n\t\tGte(b.minX).\n\t\tLt(b.maxX))\n\tquery.Must(elastic.NewRangeQuery(b.YField).\n\t\tGte(b.minY).\n\t\tLt(b.maxY))\n\treturn query\n}", "title": "" }, { "docid": "3c68f9fdc8c95e60efebbed4f29a681d", "score": "0.39957738", "text": "func NewDescribeLiveStatisticGroupByAreaRequestWithoutParam() *DescribeLiveStatisticGroupByAreaRequest {\n\n return &DescribeLiveStatisticGroupByAreaRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/describeLiveStatisticGroupByArea\",\n Method: \"GET\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "c4ca64ad1b4f6c6af0f668506f2dbacd", "score": "0.39907232", "text": "func (e *Executor) ExecuteQuery(ctx context.Context, query *influxql.Query, opt ExecutionOptions) (<-chan *Result, *iql.Statistics) {\n\tresults := make(chan *Result)\n\tstatistics := new(iql.Statistics)\n\tgo e.executeQuery(ctx, query, opt, results, statistics)\n\treturn results, statistics\n}", "title": "" }, { "docid": "51b5adf1ad8e69235ce9458e3403ba66", "score": "0.39805856", "text": "func (s *slowMetric) timeQuery(table string, cost time.Duration) {\n\tlabels := getDbAndTableMap(table)\n\ts.histogram.With(labels).Observe(float64(cost) / float64(time.Second))\n}", "title": "" }, { "docid": "22d62d8157c22513d880639ac1ca1256", "score": "0.39521992", "text": "func (a *Square) Area() float32 {\n\treturn a.side * a.side\n}", "title": "" }, { "docid": "e1b530fd4694416a569716cb1c42d860", "score": "0.39510915", "text": "func StatisticStatisticIdGet(w http.ResponseWriter, r *http.Request) {\n\tid := path.Base(r.URL.Path)\n\tlog.Printf(\"statistic \"+id+\" requested\")\n statistic := getStatisticById(id);\n if statistic == nil {\n return\n }\n dataJson, _ := json.Marshal(statistic)\n w.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n w.Write(dataJson)\n w.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "5e6fa6f49b9b3030a5a43ce04109a59a", "score": "0.39375064", "text": "func (_ChainGovernance *ChainGovernanceSession) QueryThreshold() (*big.Int, error) {\n\treturn _ChainGovernance.Contract.QueryThreshold(&_ChainGovernance.CallOpts)\n}", "title": "" }, { "docid": "c7adcf2e1183ef2ca5932daebbaa2a34", "score": "0.3929415", "text": "func queryUpperHandler(cliCtx context.CLIContext) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tcliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)\n\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tvars := mux.Vars(r)\n\n\t\tres, height, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/structure/upper/%s\", vars[\"address\"]), nil)\n\n\t\tif err != nil {\n\t\t\trest.WriteErrorResponse(w, http.StatusNotFound, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tcliCtx = cliCtx.WithHeight(height)\n\n\t\trest.PostProcessResponseBare(w, cliCtx, res)\n\t}\n}", "title": "" }, { "docid": "745299e4ba2668f4a5e46fe6bc3f3d85", "score": "0.39134255", "text": "func (m *OrderAddressMutation) Area() (r string, exists bool) {\n\tv := m.area\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "fba4b19a39d63766544173009fdeb232", "score": "0.38974917", "text": "func QueryStatus(hostname string, AccessKey string) (*StatusResponse, error) {\n\tauthHeader := req.Header{\n\t\t\"Accept\": \"application/json\",\n\t\t\"Authorization\": AccessKey,\n\t}\n\tvar resp StatusResponse\n\n\tr, err := req.Get(fmt.Sprintf(\"%s/rest/monitoring/status\", hostname), authHeader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = r.ToJSON(&resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &resp, nil\n}", "title": "" }, { "docid": "664a1c574ba2299b4d2620db01b0a33a", "score": "0.38953725", "text": "func (o Histogram) DensityArea(nsamples int) (area float64) {\n\tnstations := len(o.Stations)\n\tif nstations < 2 {\n\t\tchk.Panic(\"density area computation needs at least two stations\")\n\t}\n\tdx := (o.Stations[nstations-1] - o.Stations[0]) / float64(nstations-1)\n\tprob := make([]float64, nstations)\n\tfor i := 0; i < nstations-1; i++ {\n\t\tprob[i] = float64(o.Counts[i]) / (float64(nsamples) * dx)\n\t}\n\tfor i := 0; i < nstations-1; i++ {\n\t\tarea += dx * prob[i]\n\t}\n\treturn\n}", "title": "" }, { "docid": "41915f808e7471cd7f839b0da8258842", "score": "0.38721743", "text": "func (client *Client) QueryReleaseMetric(request *QueryReleaseMetricRequest) (response *QueryReleaseMetricResponse, err error) {\n\tresponse = CreateQueryReleaseMetricResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "cebebc50b2c8ec659fd965abeff12c14", "score": "0.38683093", "text": "func (s *Server) GetStats(ctx context.Context, in *pb.GetStatsRequest) (\n\t*pb.GetStatsResponse, error) {\n\n\tplaceDcids := in.GetPlace()\n\tstatsVarDcid := in.GetStatsVar()\n\tif len(placeDcids) == 0 {\n\t\treturn nil, status.Errorf(codes.InvalidArgument,\n\t\t\t\"Missing required argument: place\")\n\t}\n\tif statsVarDcid == \"\" {\n\t\treturn nil, status.Errorf(codes.InvalidArgument,\n\t\t\t\"Missing required argument: stat_var\")\n\t}\n\tfilterProp := &ObsProp{\n\t\tMmethod: in.GetMeasurementMethod(),\n\t\tOperiod: in.GetObservationPeriod(),\n\t\tUnit: in.GetUnit(),\n\t}\n\n\t// Read triples for statistical variable.\n\ttriplesRowList := buildTriplesKey([]string{statsVarDcid})\n\ttriples, err := readTriples(ctx, s.btTable, triplesRowList)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Get the StatisticalVariable\n\tif triples[statsVarDcid] == nil {\n\t\treturn nil, status.Errorf(codes.NotFound,\n\t\t\t\"No statistical variable found for %s\", statsVarDcid)\n\t}\n\tstatsVarObject, err := triplesToStatsVar(statsVarDcid, triples[statsVarDcid])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Construct BigTable row keys.\n\trowList, keyTokens := buildStatsKey(\n\t\tplaceDcids,\n\t\tmap[string]*StatisticalVariable{statsVarDcid: statsVarObject},\n\t)\n\n\tresult := map[string]*ObsTimeSeries{}\n\n\t// Read data from branch in-memory cache first.\n\tcacheData := s.memcache.ReadParallel(\n\t\trowList,\n\t\tconvertToObsSeries,\n\t\ttokenFn(keyTokens),\n\t)\n\tfor token, data := range cacheData {\n\t\tplace := strings.Split(token, \"^\")[0]\n\t\tif data == nil {\n\t\t\tresult[place] = nil\n\t\t} else {\n\t\t\tresult[place] = data.(*ObsTimeSeries)\n\t\t}\n\t}\n\t// For each place, if the data is missing in branch cache, fetch it from the\n\t// base cache in Bigtable.\n\tif len(result) < len(placeDcids) {\n\t\textraDcids := []string{}\n\t\tfor _, dcid := range placeDcids {\n\t\t\tif _, ok := result[dcid]; !ok {\n\t\t\t\textraDcids = append(extraDcids, dcid)\n\t\t\t}\n\t\t}\n\t\trowList, keyTokens := buildStatsKey(\n\t\t\textraDcids,\n\t\t\tmap[string]*StatisticalVariable{statsVarDcid: statsVarObject})\n\t\textraData, err := readStats(ctx, s.btTable, rowList, keyTokens)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor place := range extraData {\n\t\t\tresult[place] = extraData[place][statsVarDcid]\n\t\t}\n\t}\n\n\t// Fill missing place data and result result\n\tfor _, dcid := range placeDcids {\n\t\tif _, ok := result[dcid]; !ok {\n\t\t\tresult[dcid] = nil\n\t\t}\n\t}\n\tfor _, obsSeries := range result {\n\t\tobsSeries.filterAndRank(filterProp)\n\t}\n\tjsonRaw, err := json.Marshal(result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.GetStatsResponse{Payload: string(jsonRaw)}, nil\n}", "title": "" }, { "docid": "9c1032ee6974f2aab8d4a89d64e6d334", "score": "0.38675052", "text": "func (s Square) Area() float32 {\n\treturn s.side * s.side\n}", "title": "" }, { "docid": "2939e611c34a2762825e7a7e088dfff8", "score": "0.3860595", "text": "func (svc *CloudWatch) DoGetMetricStatistics(in *SDK.GetMetricStatisticsInput) (*SDK.GetMetricStatisticsOutput, error) {\n\tout, err := svc.client.GetMetricStatistics(in)\n\tif err != nil {\n\t\tsvc.Errorf(\"error on `GetMetricStatistics` operation; error=%s;\", err.Error())\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "8ac11917d8966d52dbe3b70b277e8561", "score": "0.38562113", "text": "func StatisticGet(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"All Statistics requested\")\n\tdataJson, _ := json.Marshal(allStatistics());\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.Write(dataJson)\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "0186414d416e29c974539f2df41a9bcc", "score": "0.38555855", "text": "func (m *CustomerAddressMutation) Area() (r string, exists bool) {\n\tv := m.area\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "252dc6c2896b84837ee99405567d7460", "score": "0.38478372", "text": "func generateQuery(metric string, tagSelector entities.TagSelector, timeRange *entities.TimeRange, aggr entities.AggregationMethod) (string, derrors.Error) {\n\t// We at first use a time window of 60s to aggregate over. Once\n\t// we've done all our calculations, we apply the requested\n\t// window. We do this so the averages over a time range are\n\t// correct with respect to the time when assets where alive.\n\t// An example:\n\t// - Asset A is alive from t1-t2, average for metric M is x\n\t// - Asset B is alive from t2-t3, average for metric M is y\n\t// If we want to know the sum of a metric, averaged over t1-t3\n\t// and we use GROUP BY time(0), we would calculate the average\n\t// for A and for B, then add the two. We would think that\n\t// the sum of the average of metric M is (x+y) over t1-t3.\n\t// However, the sum of the average is x for t1-t2 (because\n\t// B was not alive), and y for t2-t3. So for t1-t3 it should\n\t// be ( (x+0) * (t1-t2) + (0+y) * (t2-t3) ) / (t1-t4).\n\t// We can get to this if we first group over a default window\n\t// and do our sum per time window, and in the end apply our\n\t// requested window (or 0 if we want the average over a time\n\t// period).\n\tresolution := time.Second * defaultMetricsWindow\n\n\t// Determine what to select from. Mostly just a measurement,\n\t// but sometimes (e.g., for CPU), we do some pre-processing\n\tfrom, found := fromOverrides[metric]\n\tif !found {\n\t\tfrom = metric\n\t}\n\n\t// Add restrictions in time and asset_id\n\twhereClause := whereClause([]string{\n\t\twhereClauseFromTime(timeRange),\n\t\twhereClauseFromTags(tagSelector),\n\t})\n\n\t// Determine what field our main metric is\n\tmetricValue, found := metricFields[metric]\n\tif !found {\n\t\treturn \"\", derrors.NewInvalidArgumentError(\"unsupported metric\").WithParams(metric)\n\t}\n\n\t// For throughput metrics (x per sec) we need a derivative\n\tinnerFunc := \"mean\"\n\tif derivativeMetric[metric] {\n\t\tmetricValue = fmt.Sprintf(\"%s(%s),1s\", innerFunc, metricValue)\n\t\tinnerFunc = \"derivative\"\n\t}\n\n\t// First complete select with where clause\n\tselector := \"metric\"\n\tselectClause := fmt.Sprintf(\"%s FROM %s %s\",\n\t\tselectFromFuncFieldAs(innerFunc, metricValue, selector),\n\t\tfrom,\n\t\twhereClause,\n\t)\n\n\t// Add inner summation if needed (e.g., all CPUs, all disks per asset)\n\tsumTag, found := sumTags[metric]\n\tif found {\n\t\tnewSelector := \"summed_metric\"\n\t\tinnerGroupBy := groupByClause(resolution, \"asset_id\", sumTag)\n\t\tselectClause = fmt.Sprintf(\"%s %s\", selectClause, innerGroupBy)\n\t\tselectClause = fmt.Sprintf(\"%s FROM (%s)\",\n\t\t\tselectFromFuncFieldAs(\"sum\", selector, newSelector),\n\t\t\tselectClause,\n\t\t)\n\t\tselector = newSelector\n\t}\n\n\t// Add time and asset grouping. A resolution of 0 aggregates over\n\t// complete time range and returns a single value per asset\n\tselectClause = fmt.Sprintf(\"%s %s\", selectClause, groupByClause(resolution, \"asset_id\"))\n\n\t// From this point onward we aggregate over assets, so we need\n\t// to count how many\n\tassetCount := \", count(asset_id) AS asset_count\"\n\n\t// Aggregate over assets. If we have a single asset this is a no-op. We\n\t// execute anyway to make sure we have asset count\n\tif aggr == entities.AggregateNone {\n\t\t// We only have \"none\" if we select for at most a single asset\n\t\taggr = entities.AggregateAvg\n\t}\n\n\tnewSelector := \"aggr_metric\"\n\tselectClause = fmt.Sprintf(\"%s%s FROM (%s) %s\",\n\t\tselectFromFuncFieldAs(aggr.String(), selector, newSelector),\n\t\tassetCount,\n\t\tselectClause,\n\t\tgroupByClause(resolution),\n\t)\n\tselector = newSelector\n\n\t// Now that we've summed and aggregated by asset, we can limit the\n\t// result for a single point in time. We will always keep the resolution\n\t// at 60s. This means we get values for all assets in a 60s window.\n\t// This might not be the most precise, but if we make this window\n\t// smaller we might end up not aggregating over all assets.\n\t// Note that this also means that if an asset doesn't send metrics for\n\t// more than 60s, its values will not be included in the average. That\n\t// is probably reasonable, because at that moment the asset is probably\n\t// not available.\n\n\t// For this last aggregation we just need to propagate the asset count\n\tassetCount = \", last(asset_count) AS asset_count\"\n\tif !timeRange.Timestamp.IsZero() {\n\t\tselectClause = fmt.Sprintf(\"SELECT last(%s)%s FROM (%s)\", selector, assetCount, selectClause)\n\t} else if resolution != timeRange.Resolution {\n\t\t// If we used a different time window for aggregation than requested,\n\t\t// now is the time to aggregate over the requested window\n\t\tnewSelector := \"window_metric\"\n\t\tselectClause = fmt.Sprintf(\"%s%s FROM (%s) %s\",\n\t\t\tselectFromFuncFieldAs(\"mean\", selector, newSelector),\n\t\t\tassetCount,\n\t\t\tselectClause,\n\t\t\tgroupByClause(timeRange.Resolution),\n\t\t)\n\t\tselector = newSelector\n\t}\n\n\treturn selectClause, nil\n}", "title": "" }, { "docid": "6f28af83a02326c962ce3351140d6fb0", "score": "0.38474378", "text": "func (s *Server) GetItemStatistics(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\tkey := vars[\"id\"]\n\n\tdata, err := s.db.getStatistics(key)\n\n\tif err != nil {\n\t\ts.RenderErrorPage(w, err.Error())\n\n\t} else {\n\t\ts.renderTemplate(w, \"statistics.html\", *data)\n\n\t}\n\n}", "title": "" }, { "docid": "6a91ee81da47722fbd7944f43729613b", "score": "0.38453954", "text": "func (t *SrlNokiaAcl_Acl_Ipv4Filter_Entry_Statistics_Aggregate) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"SrlNokiaAcl_Acl_Ipv4Filter_Entry_Statistics_Aggregate\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fa2c9ac0efd84ed04075c3db49c2eeb5", "score": "0.38447642", "text": "func (e *Example) GetArea(ctx context.Context, req *example.Request, rsp *example.Response) error {\n\t/* Pritn */\n\tbeego.Info(\"GetArea api/v1.0/areas\")\n\n\t/* Inil */\n\trsp.Errno = utils.RECODE_OK\n\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\n\t// 2 db object\n\tareas := []models.Area{}\n\n\t/* Redis */\n\tr, err := utils.RedisServer(utils.G_server_name, utils.G_redis_addr, utils.G_redis_port, utils.G_redis_dbnum)\n\tif err!=nil{\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\tbeego.Error(\"GetArea Redis: \",err)\n\t\treturn nil\n\t}\n\n \t/* <=Redis */\n \t// 1 get\n \tarea_json := r.Get(\"areas\")\n\n \t// 2 if\n \tif area_json != nil{\n \t\t// 2.1 unmarshal\n \t\tjson.Unmarshal((area_json).([]byte), &areas)\n\n \t\t// 2.2 response\n\t\tfor _, value := range areas {\n\t\t\ttemp := example.Address{Id:int32(value.Id),Name:value.Name}\n\t\t\trsp.Data = append(rsp.Data, &temp)\n\t\t}\n\t\t// 2.3 return\n\t\treturn nil\n\t}\n\n\t/* Mysql */\n\t// 1 orm\n\to:=orm.NewOrm()\n\t// 2 db object\n\t//areas := []models.Area{}\n\t// 3 sql\n\tqs:=o.QueryTable(\"area\")\n\tnum, err := qs.All(&areas)\n\tif err != nil{\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\tbeego.Error(\"GetArea Mysql 3 sql\", err)\n\t\treturn nil\n\t}\n\tif num == 0{\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\tbeego.Error(\"GetArea Mysql 3 sql num = 0\")\n\t\treturn nil\n\t}\n\t// 4 response\n\tfor _, value := range areas {\n\t\ttemp := example.Address{Id:int32(value.Id),Name:value.Name}\n\t\trsp.Data = append(rsp.Data, &temp)\n\t}\n\n\t/* Redis<= */\n\t// 1 marshal\n\tareas_json,_ := json.Marshal(areas)\n\n\t// 2 put\n\tr.Put(\"areas\",areas_json, time.Second * 3600)\n\tif err != nil {\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\tbeego.Error(\"GetArea Redis<= 2 put\", err)\n\t\treturn nil\n\t}\n\n\t/* return */\n\treturn nil\n}", "title": "" }, { "docid": "cafe5e29786c5cd12a80bdde565e16fa", "score": "0.38400546", "text": "func GetAroundTheClockStatistics(from string, to string) ([]*models.StatisticsAroundThe, error) {\n\trows, err := models.DB.Query(`\n\t\tSELECT\n\t\t\tp.id,\n\t\t\tCOUNT(DISTINCT m.id) AS 'matches_played',\n\t\t\tCOUNT(DISTINCT m2.id) AS 'matches_won',\n\t\t\tCOUNT(DISTINCT l.id) AS 'legs_played',\n\t\t\tCOUNT(DISTINCT l2.id) AS 'legs_won',\n\t\t\tm.office_id AS 'office_id',\n\t\t\tSUM(s.darts_thrown) as 'darts_thrown',\n\t\t\tCAST(SUM(s.score) / COUNT(DISTINCT l.id) AS SIGNED) as 'avg_score',\n\t\t\tMAX(s.longest_streak) as 'longest_streak',\n\t\t\tSUM(s.total_hit_rate) / COUNT(l.id) as 'total_hit_rate',\n\t\t\tSUM(s.hit_rate_1) / COUNT(l.id) as 'hit_rate_1',\n\t\t\tSUM(s.hit_rate_2) / COUNT(l.id) as 'hit_rate_2',\n\t\t\tSUM(s.hit_rate_3) / COUNT(l.id) as 'hit_rate_3',\n\t\t\tSUM(s.hit_rate_4) / COUNT(l.id) as 'hit_rate_4',\n\t\t\tSUM(s.hit_rate_5) / COUNT(l.id) as 'hit_rate_5',\n\t\t\tSUM(s.hit_rate_6) / COUNT(l.id) as 'hit_rate_6',\n\t\t\tSUM(s.hit_rate_7) / COUNT(l.id) as 'hit_rate_7',\n\t\t\tSUM(s.hit_rate_8) / COUNT(l.id) as 'hit_rate_8',\n\t\t\tSUM(s.hit_rate_9) / COUNT(l.id) as 'hit_rate_9',\n\t\t\tSUM(s.hit_rate_10) / COUNT(l.id) as 'hit_rate_10',\n\t\t\tSUM(s.hit_rate_11) / COUNT(l.id) as 'hit_rate_11',\n\t\t\tSUM(s.hit_rate_12) / COUNT(l.id) as 'hit_rate_12',\n\t\t\tSUM(s.hit_rate_13) / COUNT(l.id) as 'hit_rate_13',\n\t\t\tSUM(s.hit_rate_14) / COUNT(l.id) as 'hit_rate_14',\n\t\t\tSUM(s.hit_rate_15) / COUNT(l.id) as 'hit_rate_15',\n\t\t\tSUM(s.hit_rate_16) / COUNT(l.id) as 'hit_rate_16',\n\t\t\tSUM(s.hit_rate_17) / COUNT(l.id) as 'hit_rate_17',\n\t\t\tSUM(s.hit_rate_18) / COUNT(l.id) as 'hit_rate_18',\n\t\t\tSUM(s.hit_rate_19) / COUNT(l.id) as 'hit_rate_19',\n\t\t\tSUM(s.hit_rate_20) / COUNT(l.id) as 'hit_rate_20',\n\t\t\tSUM(s.hit_rate_bull) / COUNT(l.id) as 'hit_rate_bull'\n\t\tFROM statistics_around_the s\n\t\t\tJOIN player p ON p.id = s.player_id\n\t\t\tJOIN leg l ON l.id = s.leg_id\n\t\t\tJOIN matches m ON m.id = l.match_id\n\t\t\tLEFT JOIN leg l2 ON l2.id = s.leg_id AND l2.winner_id = p.id\n\t\t\tLEFT JOIN matches m2 ON m2.id = l.match_id AND m2.winner_id = p.id\n\t\tWHERE m.updated_at >= ? AND m.updated_at < ?\n\t\t\tAND l.is_finished = 1 AND m.is_abandoned = 0\n\t\t\tAND m.match_type_id = 8\n\t\tGROUP BY p.id, m.office_id\n\t\tORDER BY(COUNT(DISTINCT m2.id) / COUNT(DISTINCT m.id)) DESC, matches_played DESC`, from, to)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tstats := make([]*models.StatisticsAroundThe, 0)\n\tfor rows.Next() {\n\t\ts := new(models.StatisticsAroundThe)\n\t\th := make([]*float64, 26)\n\t\terr := rows.Scan(&s.PlayerID, &s.MatchesPlayed, &s.MatchesWon, &s.LegsPlayed, &s.LegsWon, &s.OfficeID, &s.DartsThrown,\n\t\t\t&s.Score, &s.LongestStreak, &s.TotalHitRate, &h[1], &h[2], &h[3], &h[4], &h[5], &h[6], &h[7], &h[8], &h[9],\n\t\t\t&h[10], &h[11], &h[12], &h[13], &h[14], &h[15], &h[16], &h[17], &h[18], &h[19], &h[20], &h[25])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\thitrates := make(map[int]float64)\n\t\tfor i := 1; i <= 20; i++ {\n\t\t\thitrates[i] = *h[i]\n\t\t}\n\t\thitrates[25] = *h[25]\n\t\ts.Hitrates = hitrates\n\t\tstats = append(stats, s)\n\t}\n\treturn stats, nil\n}", "title": "" }, { "docid": "64546237a95535f66575602f2ee081f5", "score": "0.3840025", "text": "func (s Square) area() float64 {\n\tfmt.Println(\"The area of Square is\")\n\treturn s.Side * s.Side\n}", "title": "" }, { "docid": "820182d444340588d95e953b11f4e45c", "score": "0.38396898", "text": "func (t Triangle) Area() float64 {\n // this methods returns the area of triangle\n area := 0.5 * (t.Base * t.Height)\n return area\n}", "title": "" }, { "docid": "046efa1ace9a7e9aa3a11c6e81847786", "score": "0.38249537", "text": "func (ic *InfluxdbCollector) getStatistics() {\n\n\terr := ic.getData(typeStats)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Cannot get influxdb internal statistics, err=\", err)\n\t}\n}", "title": "" }, { "docid": "6324dabece049cfbb1bb85f791368d31", "score": "0.38221478", "text": "func (g *Graph) Query(q string) (*QueryResult, error) {\n\tr, err := g.Conn.Do(\"GRAPH.QUERY\", g.Id, q, \"--compact\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn QueryResultNew(g, r)\n}", "title": "" }, { "docid": "a8d0d560bdb900dd60c7831881a4cf59", "score": "0.38197652", "text": "func (self *Polygon) CalculateArea(y0 int) int{\n return self.Object.Call(\"calculateArea\", y0).Int()\n}", "title": "" }, { "docid": "cf90ae9affc670e9832356691673eaf6", "score": "0.38165897", "text": "func (s *Square) Area() float32 {\n\treturn s.side * s.side\n}", "title": "" }, { "docid": "3cec5b75a1dae91f26506dd3eceadedf", "score": "0.3812092", "text": "func LoadAreaStatistics(areaStatisticsChannel chan *AreaStatistics, doneChannel chan<- bool,\n\tyear string) {\n\tdestinationFile, _ := os.Create(\"./area-statistics-\" + year + \".txt\")\n\tdefer destinationFile.Close()\n\n\tfor a := range areaStatisticsChannel {\n\t\tfmt.Fprintf(destinationFile, \"Area : \"+strconv.Itoa(a.Number)+\"\\n\\n\")\n\t\tfmt.Fprintf(destinationFile, \"Number of Mris : \"+strconv.Itoa(a.MriCount)+\"\\n\")\n\t\tfmt.Fprintf(destinationFile, \"Number of Scanners : \"+strconv.Itoa(a.Scanner)+\"\\n\")\n\t\tfmt.Fprintf(destinationFile, \"Number of Maternity services : \"+strconv.Itoa(a.MaternityServicesCount)+\"\\n\")\n\t\tfmt.Fprintf(destinationFile, \"Number of Chimio services : \"+strconv.Itoa(a.ChimioCenters)+\"\\n\")\n\t\tfmt.Fprintf(destinationFile, \"Number of Burn services : \"+strconv.Itoa(a.BurnCenters)+\"\\n\")\n\t\tfmt.Fprintf(destinationFile, \"Abortions : \"+strconv.Itoa(a.AbortionTotalCount)+\"\\n\")\n\t\tfmt.Fprintf(destinationFile, \"Medical Abortions : \"+strconv.Itoa(a.MedicalAbortionTotalCount)+\"\\n\")\n\t\tfmt.Fprintf(destinationFile, \"List of Health centers in this area : \"+strconv.Itoa(len(a.HealthCenters))+\"\\n\")\n\t\tfor k := range a.HealthCenters {\n\t\t\tfmt.Fprintf(destinationFile, k+\"\\n\")\n\t\t}\n\t\tfmt.Fprintf(destinationFile, \"\\n\")\n\n\t}\n\tdoneChannel <- true\n\tclose(doneChannel)\n}", "title": "" }, { "docid": "10b29da38ceac9719fcc507ea927f662", "score": "0.38045973", "text": "func (tree *GeohashTree) Query(point []float64) (string, bool) {\n\tif tree.QueryBool {\n\t\treturn tree.CustomDB.Query(point)\n\t}\n\tghash := Geohash(point, tree.Max)\n\tfor i := tree.Min; i <= tree.Max; i++ {\n\t\tval, boolval := tree.Get(ghash[:i])\n\t\tif !boolval {\n\t\t\treturn val, false\n\t\t} else if val != \"-1\" {\n\t\t\treturn val, true\n\t\t}\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "e89704dcbb32df31e7ae253faaa939d4", "score": "0.38041383", "text": "func (m *AreahistoryMutation) RankArea() (r int, exists bool) {\n\tv := m._RankArea\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "875f8730d45bd7ed1ec5fe6b0354cd55", "score": "0.37997824", "text": "func (*ShowTableStats) StatementTag() string { return \"SHOW STATISTICS\" }", "title": "" }, { "docid": "f5b6b1fee026bdf375dfeaab423dce6c", "score": "0.37911624", "text": "func (s *Server) GetStat(ctx context.Context, in *pb.GetStatRequest) (\n\t*pb.GetStatResponse, error) {\n\tplaceDcids := in.GetPlaces()\n\tstatVarDcid := in.GetStatVar()\n\tif len(placeDcids) == 0 {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"Missing required argument: place\")\n\t}\n\tif statVarDcid == \"\" {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"Missing required argument: stat_var\")\n\t}\n\tfilterProp := &ObsProp{\n\t\tMmethod: in.GetMeasurementMethod(),\n\t\tOperiod: in.GetObservationPeriod(),\n\t\tUnit: in.GetUnit(),\n\t}\n\n\t// Read triples for statistical variable.\n\ttriplesRowList := buildTriplesKey([]string{statVarDcid})\n\ttriples, err := readTriples(ctx, s.btTable, triplesRowList)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Get the StatisticalVariable\n\tif triples[statVarDcid] == nil {\n\t\treturn nil, status.Errorf(codes.NotFound, \"No statistical variable found for %s\", statVarDcid)\n\t}\n\tstatVarObject, err := triplesToStatsVar(statVarDcid, triples[statVarDcid])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Construct BigTable row keys.\n\trowList, keyTokens := buildStatsKey(\n\t\tplaceDcids,\n\t\tmap[string]*StatisticalVariable{statVarDcid: statVarObject},\n\t)\n\n\ttmp := map[string]*pb.ObsTimeSeries{}\n\n\t// Read data from branch in-memory cache first.\n\tcacheData := s.memcache.ReadParallel(\n\t\trowList,\n\t\tconvertToObsSeriesPb,\n\t\ttokenFn(keyTokens),\n\t)\n\tfor token, data := range cacheData {\n\t\tplace := strings.Split(token, \"^\")[0]\n\t\tif data == nil {\n\t\t\ttmp[place] = nil\n\t\t} else {\n\t\t\ttmp[place] = data.(*pb.ObsTimeSeries)\n\t\t}\n\t}\n\t// For each place, if the data is missing in branch cache, fetch it from the\n\t// base cache in Bigtable.\n\tif len(tmp) < len(placeDcids) {\n\t\textraDcids := []string{}\n\t\tfor _, dcid := range placeDcids {\n\t\t\tif _, ok := tmp[dcid]; !ok {\n\t\t\t\textraDcids = append(extraDcids, dcid)\n\t\t\t}\n\t\t}\n\t\trowList, keyTokens := buildStatsKey(\n\t\t\textraDcids,\n\t\t\tmap[string]*StatisticalVariable{statVarDcid: statVarObject})\n\t\textraData, err := readStatsPb(ctx, s.btTable, rowList, keyTokens)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor place := range extraData {\n\t\t\ttmp[place] = extraData[place][statVarDcid]\n\t\t}\n\t}\n\n\t// Fill missing place data and result result\n\tfor _, dcid := range placeDcids {\n\t\tif _, ok := tmp[dcid]; !ok {\n\t\t\ttmp[dcid] = nil\n\t\t}\n\t}\n\tresult := map[string]*pb.SourceSeries{}\n\tfor place, obsSeries := range tmp {\n\t\tresult[place] = filterAndRankPb(obsSeries, filterProp)\n\t}\n\n\treturn &pb.GetStatResponse{Stat: result}, nil\n}", "title": "" }, { "docid": "90ad2395f530ca74beb81dbc6aac8068", "score": "0.3790125", "text": "func (dr *DataRoom) QueryDetails() *FurnitureDetailQuery {\n\treturn (&DataRoomClient{config: dr.config}).QueryDetails(dr)\n}", "title": "" }, { "docid": "275270981e1f8022d4aea6cb34add1dc", "score": "0.37864515", "text": "func (r Rect) Area(wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tdefer fmt.Println()\n\tif r.width <= 0 {\n\t\tfmt.Printf(\"%v's width should be greater than zero\\n\", r)\n\t\treturn\n\t}\n\tif r.length <= 0 {\n\t\tfmt.Printf(\"%v's length should be greater than zero\\n\", r)\n\t\treturn\n\t}\n\n\tr.area = r.length * r.width\n\tr.PrintArea()\n\n}", "title": "" }, { "docid": "51b6d0935d7e2b1a42185d1349030aa4", "score": "0.37829226", "text": "func TestStatsFilter(t *testing.T, feature features.Feature) {\n\tframework.NewTest(t).\n\t\tFeatures(feature).\n\t\tRun(func(ctx framework.TestContext) {\n\t\t\tsourceQuery, destinationQuery, appQuery := buildQuery()\n\t\t\tretry.UntilSuccessOrFail(t, func() error {\n\t\t\t\tif err := SendTraffic(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t// Query client side metrics\n\t\t\t\tif err := promUtil.QueryPrometheus(t, sourceQuery, GetPromInstance()); err != nil {\n\t\t\t\t\tt.Logf(\"prometheus values for istio_requests_total: \\n%s\", util.PromDump(promInst, \"istio_requests_total\"))\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := promUtil.QueryPrometheus(t, destinationQuery, GetPromInstance()); err != nil {\n\t\t\t\t\tt.Logf(\"prometheus values for istio_requests_total: \\n%s\", util.PromDump(promInst, \"istio_requests_total\"))\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t// This query will continue to increase due to readiness probe; don't wait for it to converge\n\t\t\t\tif err := promUtil.QueryFirstPrometheus(t, appQuery, GetPromInstance()); err != nil {\n\t\t\t\t\tt.Logf(\"prometheus values for istio_echo_http_requests_total: \\n%s\", util.PromDump(promInst, \"istio_echo_http_requests_total\"))\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}, retry.Delay(3*time.Second), retry.Timeout(80*time.Second))\n\t\t})\n}", "title": "" }, { "docid": "11c8045b5fc1b88eea2e9c9236c2715b", "score": "0.37813276", "text": "func (t *SrlNokiaAcl_Acl_Ipv4Filter_Statistics) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"SrlNokiaAcl_Acl_Ipv4Filter_Statistics\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "868779289263f0499335c795d954c449", "score": "0.3780339", "text": "func (dr *deviceResources) RayIntersectionQuery(rayBufferIndex uint32, numPixels int) (time.Duration, error) {\n\tkernel := dr.kernels[rayIntersectionQuery]\n\n\terr := kernel.SetArgs(\n\t\tdr.buffers.Rays[rayBufferIndex],\n\t\tdr.buffers.RayCounters[rayBufferIndex],\n\t\tdr.buffers.BvhNodes,\n\t\tdr.buffers.MeshInstances,\n\t\tdr.buffers.Vertices,\n\t\tdr.buffers.HitFlags,\n\t\tdr.buffers.Intersections,\n\t)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn kernel.Exec1D(0, numPixels, 0)\n}", "title": "" }, { "docid": "96b3f8583edf47b60233c92f94e05826", "score": "0.3776399", "text": "func (r *AliexpressLogisticsDsTrackinginfoQueryAPIRequest) SetToArea(_toArea string) error {\n\tr._toArea = _toArea\n\tr.Set(\"to_area\", _toArea)\n\treturn nil\n}", "title": "" }, { "docid": "2124eba971e82db7cce9128c4c77fae3", "score": "0.3776279", "text": "func (z Square) area() float64 {\n\treturn z.side * z.side\n}", "title": "" }, { "docid": "2124eba971e82db7cce9128c4c77fae3", "score": "0.3776279", "text": "func (z Square) area() float64 {\n\treturn z.side * z.side\n}", "title": "" }, { "docid": "2124eba971e82db7cce9128c4c77fae3", "score": "0.3776279", "text": "func (z Square) area() float64 {\n\treturn z.side * z.side\n}", "title": "" }, { "docid": "54780e74140adf4e9a9b9632f23fcdd0", "score": "0.37727478", "text": "func (_ChainGovernance *ChainGovernanceCallerSession) QueryThreshold() (*big.Int, error) {\n\treturn _ChainGovernance.Contract.QueryThreshold(&_ChainGovernance.CallOpts)\n}", "title": "" }, { "docid": "8c9c23c9dfcd70f80b168ef20d204e43", "score": "0.37631965", "text": "func (s Square) area() float64 {\n\treturn s.side * s.side\n}", "title": "" }, { "docid": "edc0d8d00c626a2bf1c6972c78b39bf2", "score": "0.3760384", "text": "func (se *SeriousEvent) QuerySeriousEventStatsList() *SeriousEventStatsQuery {\n\treturn (&SeriousEventClient{config: se.config}).QuerySeriousEventStatsList(se)\n}", "title": "" }, { "docid": "9e9052f8df46e3685662d159cdfcebac", "score": "0.37546048", "text": "func (ntdmq *NetTopologyDeviceMapQuery) QueryEdge() *NetTopologyDeviceMapQuery {\n\tquery := &NetTopologyDeviceMapQuery{config: ntdmq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := ntdmq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := ntdmq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(nettopologydevicemap.Table, nettopologydevicemap.FieldID, selector),\n\t\t\tsqlgraph.To(nettopologydevicemap.Table, nettopologydevicemap.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2M, false, nettopologydevicemap.EdgeTable, nettopologydevicemap.EdgePrimaryKey...),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(ntdmq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "bbb9e8a370295e25c0661a64d45355fd", "score": "0.37482348", "text": "func (s *Subnet) GetStatistics(id int, includeRanges, includeSuggestions bool) (stats *subnet.Statistics, err error) {\n\tstats = new(subnet.Statistics)\n\tv := make(url.Values)\n\tif includeRanges {\n\t\tv.Set(\"include_ranges\", \"1\")\n\t}\n\tif includeSuggestions {\n\t\tv.Set(\"include_suggestions\", \"1\")\n\t}\n\terr = s.client(id).Get(\"statistics\", v, func(data []byte) error {\n\t\treturn json.Unmarshal(data, stats)\n\t})\n\treturn\n}", "title": "" }, { "docid": "3e583274464dfa4a82e8fde01db19aca", "score": "0.37456816", "text": "func (s *Server) RouteAreaHandler(w http.ResponseWriter, r *http.Request) {\n\n\tne, sw, err := GetArea(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 400)\n\t}\n\tnodeList := s.graph.Grid.GetNodesInArea(ne, sw)\n\n\tedgeList := make([]*data.Edge, 0)\n\n\t//get all edges that come from these nodes\n\tfor _, node := range nodeList {\n\t\tnodeID := node.ID\n\t\tedgeBegin := s.graph.Offset[nodeID]\n\t\tedgeEnd := s.graph.Offset[nodeID+1]\n\n\t\tfor i := edgeBegin; i < edgeEnd; i++ {\n\n\t\t\tedgeList = append(edgeList, &s.graph.Edges[i])\n\n\t\t}\n\t}\n\n\tareaGet := data.ConvertAreaToJSON(edgeList, s.graph)\n\n\tjsonData, err := json.Marshal(areaGet)\n\n\tif err != nil || jsonData == nil {\n\n\t\tlogrus.Error(err)\n\t\thttp.Error(w, \"no area available\", 500)\n\t}\n\n\tw.Write(jsonData)\n\n}", "title": "" }, { "docid": "7376d34d54d527f0d9f57b33f1362758", "score": "0.37410364", "text": "func (m *CustomerAddressMutation) SetArea(s string) {\n\tm.area = &s\n}", "title": "" }, { "docid": "6859bc2a96316cf01f47b70d63822394", "score": "0.37402567", "text": "func (metrics *metrics) query(qA metricsAccumulator, start time.Time, end time.Time) error {\n\t// don't do anything with nil accumulator\n\tif qA == nil {\n\t\treturn nil\n\t}\n\n\trows, err := metrics.db.Query(\"SELECT FromTime, AtTime, MetricsJson, IntervalSeconds FROM metrics WHERE FromTime >= ? AND AtTime <= ? ORDER BY AtTime ASC\", start, end)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\tvar (\n\t\tmetricsJSONString string\n\t)\n\n\tvar me *MetricsEntry\n\tfor rows.Next() {\n\t\tme = &MetricsEntry{}\n\n\t\terr = rows.Scan(&me.AtTime, &me.FromTime, &metricsJSONString, &me.IntervalSeconds)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error scanning for metrics query: %s\", err)\n\t\t\tcontinue\n\t\t}\n\t\t// unmarshal string into values\n\t\tjson.Unmarshal([]byte(metricsJSONString), &me.Values)\n\n\t\t// call accumulator function\n\t\tqA(me)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c1d245ff1fd30e7706f665dca16e6018", "score": "0.3738919", "text": "func (t *SrlNokiaAcl_Acl_SystemFilter_Ipv4Filter_Entry_Statistics) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"SrlNokiaAcl_Acl_SystemFilter_Ipv4Filter_Entry_Statistics\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c5d9683d5cbe4d3882a89795f3b5788", "score": "0.37366924", "text": "func (t *Triangulo) area() float64 {\r\n return (t.base * t.altura)/2\r\n}", "title": "" }, { "docid": "8aae8d6b90266bf8413c71e58b333987", "score": "0.3728307", "text": "func WithStatistics(i int) QueryOption {\n\treturn func(o *queryOptions) error {\n\t\to.vals.Set(\"statistics\", fmt.Sprintf(\"%d\", i))\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "23cf7951f4599e61ddb5320c29c27bc1", "score": "0.3724021", "text": "func (s *statGroup) stringQueryLatencyFullHistogram() string {\n\treturn fmt.Sprintf(\"%s\\n\", s.latencyHistogram.String())\n}", "title": "" }, { "docid": "f03423206bf4113686cf026e3bffb40d", "score": "0.37097302", "text": "func (s *VMStorage) Query(ctx context.Context, query string) ([]Metric, error) {\n\tconst (\n\t\tstatusSuccess, statusError, rtVector = \"success\", \"error\", \"vector\"\n\t)\n\treq, err := http.NewRequest(\"POST\", s.queryURL+url.QueryEscape(query), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tif s.basicAuthPass != \"\" {\n\t\treq.SetBasicAuth(s.basicAuthUser, s.basicAuthPass)\n\t}\n\tresp, err := s.c.Do(req.WithContext(ctx))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting response from %s: %w\", req.URL, err)\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\tif resp.StatusCode != http.StatusOK {\n\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\treturn nil, fmt.Errorf(\"datasource returns unexpected response code %d for %s with err %w. Reponse body %s\", resp.StatusCode, req.URL, err, body)\n\t}\n\tr := &response{}\n\tif err := json.NewDecoder(resp.Body).Decode(r); err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing metrics for %s: %w\", req.URL, err)\n\t}\n\tif r.Status == statusError {\n\t\treturn nil, fmt.Errorf(\"response error, query: %s, errorType: %s, error: %s\", req.URL, r.ErrorType, r.Error)\n\t}\n\tif r.Status != statusSuccess {\n\t\treturn nil, fmt.Errorf(\"unknown status: %s, Expected success or error \", r.Status)\n\t}\n\tif r.Data.ResultType != rtVector {\n\t\treturn nil, fmt.Errorf(\"unknown restul type:%s. Expected vector\", r.Data.ResultType)\n\t}\n\treturn r.metrics()\n}", "title": "" }, { "docid": "12d3a8b085b8ae1d15556cc29c68c414", "score": "0.37027916", "text": "func (s Square) area() float64 {\n\treturn math.Pow(s.side, 2)\n}", "title": "" }, { "docid": "c16e867dffdf6646262478bbc27acb47", "score": "0.37007445", "text": "func info(z Shape) {\n fmt.Println(z)\n fmt.Println(z.area())\n}", "title": "" }, { "docid": "a883bc887bde12a614e20dfce2db7f81", "score": "0.36941844", "text": "func (t *SrlNokiaAcl_Acl_Ipv4Filter_Entry_Statistics) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"SrlNokiaAcl_Acl_Ipv4Filter_Entry_Statistics\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ad52902c1332d1b670b8105d1ad0823c", "score": "0.36853358", "text": "func (t *ABstore) Query(ctx contractapi.TransactionContextInterface, A string) (string, error) {\n\tvar err error\n\t// Get the state from the ledger\n\tAvalbytes, err := ctx.GetStub().GetState(A)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + A + \"\\\"}\"\n\t\treturn \"\", errors.New(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Nil amount for \" + A + \"\\\"}\"\n\t\treturn \"\", errors.New(jsonResp)\n\t}\n\n\tjsonResp := \"{\\\"Name\\\":\\\"\" + A + \"\\\",\\\"Amount\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\n\tfmt.Printf(\"Query Response:%s\\n\", jsonResp)\n\treturn string(Avalbytes), nil\n}", "title": "" }, { "docid": "120e8c6da169f309ace99d061ee4a464", "score": "0.36834088", "text": "func (m *OrderAddressMutation) SetArea(s string) {\n\tm.area = &s\n}", "title": "" } ]
e96f02fd8f0ebb6db86b69bc4ecd532a
RecordNotFound check if returning ErrRecordNotFound error
[ { "docid": "75d1aedd20bc894e762e0536689c75a4", "score": "0.6922994", "text": "func (r *FakeRepository) RecordNotFound() bool {\n\treturn false\n}", "title": "" } ]
[ { "docid": "13ab95cc2b7a983c5cd6284409f4df23", "score": "0.77673185", "text": "func checkNotFound(err error) error {\n\tif err == sql.ErrNoRows {\n\t\treturn ErrNotFound\n\t}\n\treturn err\n}", "title": "" }, { "docid": "7081b885134c5c093e8c81d7e769f612", "score": "0.763808", "text": "func IsRecordNotFound(err error) bool {\n\tif esErr, ok := err.(*ESError); ok {\n\t\tif esErr.Code == 404 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6eaef86f65d855da2e35c3c4ab969956", "score": "0.7055872", "text": "func (self *MongoDataSource) NotFoundErr(err error) bool { return err == mgo.ErrNotFound }", "title": "" }, { "docid": "7aceddf468038fa383d4512536eee56f", "score": "0.69891584", "text": "func IsNotFound(err error) bool {\n\treturn err == gorm.ErrRecordNotFound\n}", "title": "" }, { "docid": "7aceddf468038fa383d4512536eee56f", "score": "0.69891584", "text": "func IsNotFound(err error) bool {\n\treturn err == gorm.ErrRecordNotFound\n}", "title": "" }, { "docid": "5931b8948645326a0f02565a6df49dc6", "score": "0.69540757", "text": "func NotFound(err error) bool {\n\treturn dbscan.NotFound(err)\n}", "title": "" }, { "docid": "949e18b6e558756a7effe26c0e350eb5", "score": "0.6675465", "text": "func (ds *Datasource) NotFound(err error) bool {\n\tif err == nil {\n\t\treturn false\n\t}\n\n\t_, ok := err.(*NotFoundError)\n\treturn ok\n}", "title": "" }, { "docid": "b448428f62e4e76d612f57d911731cba", "score": "0.65885055", "text": "func ErrDatabaseNotFound(name string) error { return fmt.Errorf(\"database not found: %s\", name) }", "title": "" }, { "docid": "ce387f0ca31a18a8c5a4b9836a03c28e", "score": "0.6540443", "text": "func IsErrNotFound(err error) bool {\n\treturn errors.Is(err, sql.ErrNoRows) || errors.Is(err, ErrNotFound) || pg.IsCode(err, pg.NoDataFound)\n}", "title": "" }, { "docid": "ca8d5cd132831321b403b9362ec710fc", "score": "0.64773077", "text": "func (e ErrorNotFound) NotFound() bool {\n\treturn true\n}", "title": "" }, { "docid": "6868f96fc7815b51d4d5388d1d856e6e", "score": "0.6309989", "text": "func NotFound(err error) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn errorNotFound{err}\n}", "title": "" }, { "docid": "60dcac02577bddcf711efc302a6180c3", "score": "0.6308448", "text": "func NotFound(id, detail string) error {\n\treturn me.NotFound(id, detail)\n}", "title": "" }, { "docid": "937d643649f27430e383931b4c35e402", "score": "0.62983024", "text": "func (NotFoundError) NotFound() bool {\n\treturn true\n}", "title": "" }, { "docid": "2e67fd73dc8ea8db7223bbd817fb5e3e", "score": "0.6289228", "text": "func (base *BaseSqlRepository) IsNotFoundError(ctx context.Context, err error) bool {\n\tif sql.ErrNoRows.Error() == err.Error() {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b6645a360b4e1f52559af74bf721db87", "score": "0.6284973", "text": "func (enn ErrNoNetwork) NotFound() {}", "title": "" }, { "docid": "3b21b2e0b38c7fcd10815a78e8a1e108", "score": "0.6242823", "text": "func NotFound(format string, a ...interface{}) error {\n\treturn errors.NotFound(\"error-not-found\", format, a...)\n}", "title": "" }, { "docid": "8e75e6d38f71db879d8a5fb4fce54e41", "score": "0.6241424", "text": "func DeleteRecordNotFound(errs []error) (new []error) {\n\tfor _, err := range errs {\n\t\tif err != nil && err != gorm.ErrRecordNotFound {\n\t\t\tnew = append(new, err)\n\t\t}\n\t}\n\treturn new\n}", "title": "" }, { "docid": "a5f83e04efd0efbf3819e797999c39a4", "score": "0.6196925", "text": "func IsNotFound(err error) bool {\n\treturn err == datastore.ErrNoSuchEntity\n}", "title": "" }, { "docid": "b7e5ec866f18e2127f02ebb4fa7bddb2", "score": "0.6179128", "text": "func IsErrNotFound(err error) bool {\n\treturn strings.Contains(err.Error(), \"not found\") || err == sql.ErrNoRows\n}", "title": "" }, { "docid": "04626dd7c783670017fb9aebc82628e2", "score": "0.6169981", "text": "func IsNotFound(err error) bool {\n\treturn err == badger.ErrKeyNotFound || err == ErrNotFound\n}", "title": "" }, { "docid": "688e4b2fb3d0cb8b22be8f9b197febfe", "score": "0.61560076", "text": "func getSqlTestOr404(db *gorm.DB, name string, c *gin.Context) *dbmodels.Test {\n\n\ttest := dbmodels.Test{}\n\n\tif err := db.First(&test, dbmodels.Test{Name: name}).Error; err != nil {\n\n\t\tutils.Logger().Errorln(err.Error())\n\t\tutils.RespondError(c, http.StatusNotFound, err.Error())\n\t\treturn nil\n\t}\n\n\treturn &test\n\n}", "title": "" }, { "docid": "f5fd70fc4e473e25e34a4fd9e69eb0e2", "score": "0.6147406", "text": "func (e Error) IsNotFound() bool {\n\treturn e.Type == ErrorTypeNotFound\n}", "title": "" }, { "docid": "8658b8e7c802f964ad3588a471e260b4", "score": "0.60705584", "text": "func CheckErr(w http.ResponseWriter, err error, next func()) {\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\thttp.Error(w, \"\", http.StatusNotFound)\n\t\t} else {\n\t\t\thttp.Error(w, \"\", http.StatusInternalServerError)\n\t\t}\n\t} else {\n\t\tnext()\n\t}\n}", "title": "" }, { "docid": "1983e2c64a24c127f35f63de6b8dbc1f", "score": "0.6053363", "text": "func NotFound(id, format string, a ...interface{}) error {\r\n\treturn &Error{\r\n\t\tId: id,\r\n\t\tCode: 404,\r\n\t\tDetail: fmt.Sprintf(format, a...),\r\n\t\tStatus: http.StatusText(404),\r\n\t}\r\n}", "title": "" }, { "docid": "114a27f012d952e1f564f0abd237578a", "score": "0.60322124", "text": "func (ene ErrNoEndpoint) NotFound() {}", "title": "" }, { "docid": "4d6b9260250d634f62876515ff717a44", "score": "0.60140324", "text": "func IsNotFound(err error) bool {\n\tawsErr, ok := err.(awserr.Error)\n\treturn ok && awsErr.Code() == \"UNKNOWN\"\n}", "title": "" }, { "docid": "4d6b9260250d634f62876515ff717a44", "score": "0.60140324", "text": "func IsNotFound(err error) bool {\n\tawsErr, ok := err.(awserr.Error)\n\treturn ok && awsErr.Code() == \"UNKNOWN\"\n}", "title": "" }, { "docid": "52c11bb336cffe872ab1ce921e24c8e0", "score": "0.5957322", "text": "func (e notFoundError) IsNotFound() bool {\n\treturn true\n}", "title": "" }, { "docid": "930eba18c2a4afbc5509bd7814ad4cc6", "score": "0.5952984", "text": "func NotFound(format string, a ...interface{}) *Error {\n\treturn newError(ErrNotFound, format, a, nil)\n}", "title": "" }, { "docid": "81c6e8defcd9412f1ff89766191850e0", "score": "0.5937736", "text": "func getUserOr404(db *gorm.DB, id int, w http.ResponseWriter, r *http.Request) *model.User {\n\tuser := model.User{}\n\tif err := db.First(&user, id).Error; err != nil {\n\t\tcommon.RespondError(w, http.StatusNotFound, err.Error())\n\t\treturn nil\n\t}\n\treturn &user\n}", "title": "" }, { "docid": "9db0d4b369bb7af86f8ba5f3bca0e09a", "score": "0.59269524", "text": "func IsNotFound(e error) bool {\n\tif e == ErrResourceNotFound {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e3be02484a9c55e19559da8118f7e841", "score": "0.5926662", "text": "func TestFindOneNoRecord(t *testing.T) {\n\tm, errNew := NewMongo(testCfg())\n\trequire.Nil(t, errNew, \"connection to Mongo DB issues\")\n\trequire.NotNil(t, m)\n\n\tctx := context.Background()\n\trequire.Nil(t, m.Connect(ctx), \"could not connect\")\n\tdefer m.Disconnect(ctx)\n\n\t// TODO: implementation.\n}", "title": "" }, { "docid": "d8bda9448db81a5abbe681ac48499d46", "score": "0.592252", "text": "func IsNotFound(err error) bool {\n\tawsErr, ok := err.(awserr.Error)\n\treturn ok && awsErr.Code() == \"EntityNotFoundException\"\n}", "title": "" }, { "docid": "d8bda9448db81a5abbe681ac48499d46", "score": "0.592252", "text": "func IsNotFound(err error) bool {\n\tawsErr, ok := err.(awserr.Error)\n\treturn ok && awsErr.Code() == \"EntityNotFoundException\"\n}", "title": "" }, { "docid": "99343de51239f66d1eed57816040ce19", "score": "0.59142745", "text": "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "title": "" }, { "docid": "c55e130b8f23a1e4eb190dcb37096e41", "score": "0.59128946", "text": "func (ctx *ShowMusicContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "5501042a69c6b53b9359604b3e5f7ce4", "score": "0.5907677", "text": "func ErrNotFound(ctx context.Context, err error) error {\n\tlog.FromContext(ctx).Error(\"not found\", log.Error(err))\n\treturn status.Error(codes.NotFound, err.Error())\n}", "title": "" }, { "docid": "453915f782ad6be62b8ba2af47febd9a", "score": "0.5907555", "text": "func (t tErrors) NotFound(w http.ResponseWriter, r *http.Request) {\n\tvar h http.Handler\n\tc := Errors.newC(w, r, \"Errors\", \"NotFound\")\n\tdefer func() {\n\t\t// If one of the actions (Before, After or NotFound) returned\n\t\t// a handler, apply it.\n\t\tif h != nil {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}()\n\tdefer Errors.after(c, w, r) // Call this at the very end, but before applying result.\n\tif res := Errors.before(c, w, r); res != nil {\n\t\th = res\n\t\treturn\n\t}\n\tif res := c.NotFound(); res != nil {\n\t\th = res\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "f88985c6f0d2ab5285e0f497cec285d5", "score": "0.5902941", "text": "func ErrNotFound(s string) error {\n\treturn errNotFound{\n\t\te: s,\n\t}\n}", "title": "" }, { "docid": "fbb63bc646c5f7c59f308f64a1919da9", "score": "0.58989406", "text": "func NotFound(handler router.Handler) {\n\tfalcon.NotFound(handler)\n}", "title": "" }, { "docid": "de114f5a49704a96c3e092f66a295c48", "score": "0.58976763", "text": "func NotFound(_ *http.Request) (*response.Success, error) {\n\treturn nil, util.NewError(\"404\")\n}", "title": "" }, { "docid": "09fa037cc69ab134ed5b601b54c3df22", "score": "0.5891888", "text": "func ErrNotFound(ctx context.Context, message interface{}, keyvals ...interface{}) error {\n\tresponseData := goa.ContextResponse(ctx)\n\tif responseData == nil {\n\t\treturn errors.New(\"cannot extract responseData\")\n\t}\n\treturn responseData.Service.Send(ctx, 404, goa.ErrNotFound(message, keyvals...))\n}", "title": "" }, { "docid": "6aa2539939360c5102abd2e3451dd7b2", "score": "0.58882844", "text": "func handleNotFound(w http.ResponseWriter, r *http.Request) {\n\thandleError(w, nil, http.StatusNotFound)\n}", "title": "" }, { "docid": "3e86eed4a5bb2e80ea08fa2090a86e32", "score": "0.5879396", "text": "func IsNotFound(err error) bool {\n\tdetailedErr, ok := err.(autorest.DetailedError)\n\tif !ok {\n\t\treturn false\n\t}\n\tif detailedErr.StatusCode == http.StatusNotFound {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4e5851823309015d580878dc1bb8eccf", "score": "0.58777446", "text": "func IsForeignNotFound(err error) bool {\n\tif err, ok := err.(*pgconn.PgError); ok && err.Code == \"23503\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4e5851823309015d580878dc1bb8eccf", "score": "0.58777446", "text": "func IsForeignNotFound(err error) bool {\n\tif err, ok := err.(*pgconn.PgError); ok && err.Code == \"23503\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "91769cb639fc32c414aed3435225767e", "score": "0.5872917", "text": "func recordNotFoundMock(mock sqlmock.Sqlmock) {\n\tmock.ExpectQuery(selectQuery).\n\t\tWithArgs(1, 100).\n\t\tWillReturnRows(sqlmock.NewRows(columns))\n}", "title": "" }, { "docid": "128f61dbb67e56d9d31ccc533c9b80b4", "score": "0.58698744", "text": "func NotFound(ctx *gin.Context) {\n\ter := HTTPError{\n\t\tCode: net.StatusNotFound,\n\t\tMessage: \"rota não encontrada\",\n\t}\n\tctx.JSON(net.StatusNotFound, er)\n}", "title": "" }, { "docid": "300be4bdbf4c267aff40443eb6ed3b43", "score": "0.58578014", "text": "func IsNotFound(err error) bool {\n\tvar target *notFound\n\treturn errors.As(err, &target)\n}", "title": "" }, { "docid": "1755358e0f2643812cb1eb4a12f3c392", "score": "0.585457", "text": "func ErrNotFound(err NotFoundError) *ProblemDetail {\n\treturn &ProblemDetail{\n\t\tType: t,\n\t\tTitle: \"object cannot be found\",\n\t\tStatus: http.StatusNotFound,\n\t\tDetail: err.Error(),\n\t}\n}", "title": "" }, { "docid": "e91de08eb03323c087539168f133761c", "score": "0.58508295", "text": "func ErrNotFound(err error) bool {\n\treturn strings.Contains(err.Error(), \"not found\")\n}", "title": "" }, { "docid": "aa1ec5da6a573bcd795c9c8523c6c1b4", "score": "0.58490336", "text": "func NotFoundErr(predicate bool, errMessage string) {\n\tif predicate {\n\t\tfmt.Printf(\"NotFoundErr: %v\\n\", errMessage)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "2262d4f1bb1f64e618ce3edb91b28ab1", "score": "0.5847397", "text": "func NotFound(w Response, r *Request) { Error(w, \"404 page not found\", 404) }", "title": "" }, { "docid": "f957f584623d358d80a7ebb73a04ffe4", "score": "0.58450437", "text": "func (ctx *RecommendRecommendationsContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "433ce922fa51b6ee2f54e2c006a90965", "score": "0.58429927", "text": "func NotFound(id string) error {\n\treturn status.Error(codes.NotFound, \"resource not found: \"+id)\n}", "title": "" }, { "docid": "4b40250e075419c4764408ac9ed8a4b8", "score": "0.5842366", "text": "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"%s\\t%s\\t%s\\t%s\\t%d\\t\",\n\t\tr.RemoteAddr,\n\t\tr.Method,\n\t\tr.RequestURI,\n\t\tr.Proto,\n\t\thttp.StatusNotFound,\n\t)\n\tw.WriteHeader(http.StatusNotFound)\n}", "title": "" }, { "docid": "e12428721d413ee3a33045a6b4e0e366", "score": "0.58420867", "text": "func IsNotFound(err error) bool {\n\tswitch err := err.(type) {\n\tcase *Error:\n\t\treturn err.Code == NotFoundErr\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e20bd95c45e9574ec03ecb02b5e0f686", "score": "0.58385134", "text": "func (handler *Handler) IsErrNotFound(err error) bool {\n\treturn client.IsErrNotFound(err)\n}", "title": "" }, { "docid": "1e4f2821ffdd40cab04bd7fda882c409", "score": "0.5830264", "text": "func WrapNotFound(err error, format string, args ...interface{}) error {\n\targs = append(args, err)\n\n\treturn &notFound{fmt.Errorf(format+\": %w\", args...)}\n}", "title": "" }, { "docid": "5264b7dd551f03853763b3b6068e6392", "score": "0.5826888", "text": "func (ctx *ShowUserContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "13360fb9b38ea4f5594f8e5a8fce7dd3", "score": "0.5820219", "text": "func getProductOr404(db *gorm.DB, name string, w http.ResponseWriter, r *http.Request) *model.Product {\n\tproduct := model.Product{}\n\tif err := db.First(&product, model.Product{Name: name}).Error; err != nil {\n\t\trespondError(w, http.StatusNotFound, err.Error())\n\t\treturn nil\n\t}\n\treturn &product\n}", "title": "" }, { "docid": "f0dce93e84c50dd14ea95721a543db90", "score": "0.5815411", "text": "func NotFound(format string, msg ...interface{}) *Boom {\r\n\treturn CreateError(http.StatusNotFound, format, msg...)\r\n}", "title": "" }, { "docid": "8b5ad3ec106bef9ab009f58401c8c2a0", "score": "0.5813241", "text": "func NotFound(err error) bool {\n\tfor {\n\t\tif gserror, ok := err.(gserrors.GSError); ok {\n\t\t\terr = gserror.Origin()\n\t\t\tcontinue\n\t\t}\n\n\t\tbreak\n\t}\n\n\tif err == ErrNotFound {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "16e99a0ad459f88bfffc1d265e271ad2", "score": "0.5808183", "text": "func IsNotFound(err error) bool {\n\tawsErr, ok := err.(awserr.Error)\n\treturn ok && awsErr.Code() == \"NotFoundException\"\n}", "title": "" }, { "docid": "16e99a0ad459f88bfffc1d265e271ad2", "score": "0.5808183", "text": "func IsNotFound(err error) bool {\n\tawsErr, ok := err.(awserr.Error)\n\treturn ok && awsErr.Code() == \"NotFoundException\"\n}", "title": "" }, { "docid": "ac18aaf359e7e96abf5cf0cc7b1bb537", "score": "0.58051246", "text": "func notFound(param2 string, w http.ResponseWriter) {\n\t// Output Pet Not Found message.\n\tvar errMessage model.PetNotFound\n\terrMessage.Code, _ = strconv.ParseInt(param2, 10, 64)\n\terrMessage.Type = \"error\"\n\terrMessage.Message = \"Pet not found\"\n\n\t// Write the response text to front end\n\toutputMessage, outputErr := json.Marshal(errMessage)\n\tif outputErr == nil {\n\t\thttp.Error(w, string(outputMessage), 404)\n\t}\n}", "title": "" }, { "docid": "78bc3f89f46413e0c4c9a8f26afaeb74", "score": "0.5792874", "text": "func IsNotFound(err error) bool {\n\treturn checkCode(err, NotFound)\n}", "title": "" }, { "docid": "367d075dbf0d87c1cf45e184ba2f6549", "score": "0.5791268", "text": "func IsNotFound(err error) bool {\n\tawsErr, ok := err.(awserr.Error)\n\treturn ok && awsErr.Code() == \"ResourceNotFoundException\"\n}", "title": "" }, { "docid": "367d075dbf0d87c1cf45e184ba2f6549", "score": "0.5791268", "text": "func IsNotFound(err error) bool {\n\tawsErr, ok := err.(awserr.Error)\n\treturn ok && awsErr.Code() == \"ResourceNotFoundException\"\n}", "title": "" }, { "docid": "61ab2cd13ccb488f837b297ca547aeee", "score": "0.57857496", "text": "func IsNotFound(err error) bool {\n\tswitch err.(type) {\n\tcase ErrNotFound:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bfed3e92219291c1a05ffb35790151e8", "score": "0.5782844", "text": "func (ctx *AllDeviceDataContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "title": "" }, { "docid": "e2a7593188bd51acb8fd4fae5a60252e", "score": "0.5782626", "text": "func IsNotFound(err error) bool {\n\t_, ok := err.(notFound)\n\treturn ok\n}", "title": "" }, { "docid": "d2c6597367b4bd110535e493d8a2db2e", "score": "0.5782621", "text": "func NotFound(c echo.Context, message string) (e error) {\n\treturn HTTPError(c, 404, message)\n}", "title": "" }, { "docid": "3c8661427678e8e6bba2275fe35ca158", "score": "0.577735", "text": "func validateBookIDExist(s *pgService, p *domain.BorrowRecord) error {\n\tif err := s.db.Where(\"id = ?\", p.BookID).Find(&domain.Book{}).Error; err != nil {\n\t\tif err == gorm.ErrRecordNotFound {\n\t\t\treturn ErrBookIDNotExist\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "97a072262018a28b42f4389d359db1f6", "score": "0.57740605", "text": "func (ctx *VerifyListsContext) NotFound(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "5c684e95cfc1602a746588ee5d64886a", "score": "0.57706106", "text": "func notfound() error {\n\treturn web.WebError{404, \"Not Found, no sir!\"}\n}", "title": "" }, { "docid": "2b8e465481dc6de9e785bacbb2ef0c8a", "score": "0.57699126", "text": "func IsNotFound(err error) bool {\n\t_, ok := err.(errorNotFound)\n\treturn ok\n}", "title": "" }, { "docid": "6fc661ee1a8c0dceb2504c4e2d6a425f", "score": "0.57588655", "text": "func validateUserIDExist(s *pgService, p *domain.BorrowRecord) error {\n\tif err := s.db.Where(\"id = ?\", p.UserID).Find(&domain.User{}).Error; err != nil {\n\t\tif err == gorm.ErrRecordNotFound {\n\t\t\treturn ErrUserIDNotExist\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "166a86adba7c9b753b82016889b71a7f", "score": "0.5758495", "text": "func (ctx *ListenUserContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "dd859412118ea36053c932c105870511", "score": "0.57536036", "text": "func NotFound(w http.ResponseWriter, err error) {\n\the := &HandlerError{\n\t\tError: err.Error(),\n\t\tCode: http.StatusNotFound,\n\t}\n\twriteToResponse(w, he)\n}", "title": "" }, { "docid": "8915809ca8b681aea420b0eac4ce7adc", "score": "0.57396406", "text": "func ignoreNotFound(err error) error {\n\tif apierrors.IsNotFound(err) {\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "cd9f628e81e55d19312cb17b05dde435", "score": "0.5721042", "text": "func IsExist(err error) bool", "title": "" }, { "docid": "d8c5ee8f9a5b16d2783ffa895073c5cc", "score": "0.57197267", "text": "func IsNotFound(err error) bool {\n\treason, code := reasonAndCodeForError(err)\n\tif reason == metav1.StatusReasonNotFound {\n\t\treturn true\n\t}\n\tif _, ok := knownReasons[reason]; !ok && code == http.StatusNotFound {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ac5fb1de137b26d42fc6f0a7ccd0fb50", "score": "0.5715513", "text": "func IsNotFound(err error) bool {\n\t_, ok := err.(notFoundError)\n\treturn ok\n}", "title": "" }, { "docid": "d40b140851741b12fde3374dd3674a10", "score": "0.5714373", "text": "func respondNotFound(c *gin.Context) {\n\tc.Status(http.StatusNotFound)\n}", "title": "" }, { "docid": "ef8fbf07bc009fa478933b93f3c23c1b", "score": "0.57135075", "text": "func TestTakeOrder_Not_Exist(t *testing.T) {\n\ta := assert.New(t)\n\n\tInitMockModel()\n\n\t// mock the query that get the order by id\n\tmocket.Catcher.NewMock().WithQuery(`SELECT * FROM \"orders\" WHERE`)\n\tdefer mocket.Catcher.Reset()\n\n\terr := TakeOrder(rand.Int63n(100))\n\n\t// check if correct error returned\n\ta.NotNil(err, \"error should be returned\")\n\ta.Equal(gorm.ErrRecordNotFound, err, \"error should not found from gorm\")\n}", "title": "" }, { "docid": "581111970362dbae29a9284c3da7e647", "score": "0.57097936", "text": "func NotFound(message string, debugMessage ...string) *APIError {\n\tif message == \"\" {\n\t\tmessage = http.StatusText(http.StatusNotFound)\n\t}\n\n\tdebugMsg := \"\"\n\n\tif len(debugMessage) > 0 {\n\t\tdebugMsg = debugMessage[0]\n\t}\n\treturn NewAPIError(http.StatusNotFound, message, debugMsg)\n}", "title": "" }, { "docid": "074f0224f15d810f00564d6b4d6d8357", "score": "0.57072943", "text": "func IsNotFound(err error) bool {\n\t_, ok := err.(ErrNotFound)\n\treturn ok\n}", "title": "" }, { "docid": "5dff919245a5d9b203fc437c3821289f", "score": "0.570436", "text": "func IsNotFound(err error) bool {\n\treturn IsErrno(err, NotFound)\n}", "title": "" }, { "docid": "8b57cb32ee7a06fc169e1da56e9b297b", "score": "0.5699416", "text": "func isErrNotFoundSwarmClassic(err error) bool {\n\treturn err != nil && strings.Contains(strings.ToLower(err.Error()), \"no such\")\n}", "title": "" }, { "docid": "b91158ff157d0461b0f39877e246a33d", "score": "0.56900406", "text": "func IsErrNotFound(e error) bool {\n\t_, ok := e.(ErrNotFound)\n\treturn ok\n}", "title": "" }, { "docid": "00499ec1eaeb5861c449ca9cd0bbc66a", "score": "0.56833756", "text": "func (ctx *FollowUserContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "9c41e006a74b15f596f8a65cfb0ae1e8", "score": "0.56825936", "text": "func IsObjectNotFound(err error) bool {\n\tv, ok := err.(*Error)\n\treturn ok && v.Code == errCodeObjectNotFound\n}", "title": "" }, { "docid": "caececbc1286a7c4b4b6b08487dfea4d", "score": "0.5675446", "text": "func NilNotFound(res interface{}, err error) (interface{}, error) {\n\tif res == nil {\n\t\treturn nil, ErrNotFound\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "3b82d0329a96726e5e4d6c9dd474107c", "score": "0.56646913", "text": "func isUnknownDocument(err string) bool {\r\n\tif strings.Compare(err, \"mongo: no documents in result\") == 0 {\r\n\t\treturn true\r\n\t} else {\r\n\t\treturn false\r\n\t}\r\n}", "title": "" }, { "docid": "5b6f4d828e59a71a9cb295be11766809", "score": "0.5661807", "text": "func (ctx *ShowIndexContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "title": "" }, { "docid": "b328acc8af05210c7fa0f5842ee6e9ab", "score": "0.5660433", "text": "func ignoreNotFound(err error) error {\n\tif apierrs.IsNotFound(err) {\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "b328acc8af05210c7fa0f5842ee6e9ab", "score": "0.5660433", "text": "func ignoreNotFound(err error) error {\n\tif apierrs.IsNotFound(err) {\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "b328acc8af05210c7fa0f5842ee6e9ab", "score": "0.5660433", "text": "func ignoreNotFound(err error) error {\n\tif apierrs.IsNotFound(err) {\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "6ba2365b9168bb8248c0d47508e74450", "score": "0.56586754", "text": "func (e *Error) IsNotFound() bool {\n\treturn e.StatusCode == http.StatusNotFound\n}", "title": "" } ]
4ddfbed0989f9cf4ce6defdd03fd89b0
GetAuth returns secret of a service provider configuration
[ { "docid": "e3a46e762f858f9382de4b3be92c7d8f", "score": "0.59565467", "text": "func (p *ServiceBindingProvides) GetAuth() common.ServiceBindingAuth {\n\tif p.Auth == nil {\n\t\treturn nil\n\t}\n\treturn p.Auth\n}", "title": "" } ]
[ { "docid": "82bfa3bd97be0d3cb7123497d3405044", "score": "0.710707", "text": "func GetAuthSecret() string {\n\treturn utils.ReadEnv(jobServiceAuthSecret)\n}", "title": "" }, { "docid": "a0ff2f4f1f2d7c930fd6338c6c6e9710", "score": "0.69646484", "text": "func GetSecret() string {\n\tconfig := LoadConfiguration()\n\treturn config.Secret\n}", "title": "" }, { "docid": "e8a7c0ee144dc9b2761178982573c84e", "score": "0.6786416", "text": "func (self *Setting) GetAuth() aws.Auth {\n\tif self.AccessKey == \"\" {\n\t\tself.AccessKey = os.Getenv(\"AWS_ACCESS_KEY_ID\")\n\t}\n\tif self.SecretKey == \"\" {\n\t\tself.SecretKey = os.Getenv(\"AWS_SECRET_KEY\")\n\t}\n\tif self.AccessKey == \"\" || self.SecretKey == \"\" {\n\t\tlog.Fatal(\"cannot find aws auth. please set in setting.json or in env\")\n\t}\n\treturn aws.Auth{\n\t\tAccessKey: self.AccessKey,\n\t\tSecretKey: self.SecretKey,\n\t}\n}", "title": "" }, { "docid": "31c1f7e0cf75ee81bca12fe93422897e", "score": "0.67467064", "text": "func getSecret(t *testing.T) *core_v1.Secret {\n\tdata := os.Getenv(\"CENTRAL_YAML\") //Envvar containing the yaml contents of the secret\n\n\tdecode := scheme.Codecs.UniversalDeserializer().Decode\n\tdestination := &core_v1.Secret{}\n\t_, _, err := decode([]byte(data), nil, destination)\n\trequire.NoError(t, err)\n\treturn destination\n}", "title": "" }, { "docid": "d0be2fd898bce3d74f0b19453ab5cb6b", "score": "0.66623956", "text": "func getConfig(provider CredentialProvider) (clientcredentials.Config, error) {\n\t// Get the credentials from the provider\n\tclientID, err := provider.ClientID()\n\tif err != nil {\n\t\treturn clientcredentials.Config{}, err\n\t}\n\n\tclientSecret, err := provider.ClientSecret()\n\tif err != nil {\n\t\treturn clientcredentials.Config{}, err\n\t}\n\n\t// Setup the config\n\treturn clientcredentials.Config{\n\t\tClientID: clientID,\n\t\tClientSecret: clientSecret,\n\t\tTokenURL: defaultTokenEndpoint(),\n\t}, nil\n}", "title": "" }, { "docid": "f6c64b00da544cb073d194bad161d6ea", "score": "0.66294426", "text": "func (g *FProvider) GetConfig() model.AuthConfig {\n\tlog.Debug(\"In fiware getConfig\")\n\n\tauthConfig := model.AuthConfig{Resource: client.Resource{\n\t\tType: \"config\",\n\t}}\n\n\tauthConfig.Provider = Config\n\tauthConfig.FiwareConfig = *g.fiwareClient.config\n\n\tauthConfig.FiwareConfig.Resource = client.Resource{\n\t\tType: \"fiwareconfig\",\n\t}\n\n\tlog.Debug(\"In fiware authConfig %v\", authConfig)\n\treturn authConfig\n}", "title": "" }, { "docid": "aecc3f493192651a5df029e1432c6e3a", "score": "0.6613132", "text": "func (m *WorkforceIntegrationEncryption) GetSecret()(*string) {\n return m.secret\n}", "title": "" }, { "docid": "9f57ca7678ee9011e60928cb66558a03", "score": "0.6554969", "text": "func (g *Gh) GetSecret(ctx context.Context, ref string, key string) (string, error) { //nolint: revive\n\treturn \"\", nil\n}", "title": "" }, { "docid": "44829d59fe187b7631ad2a30883871f8", "score": "0.6478791", "text": "func (i *natsInstaller) getServerAuthSecret(ctx context.Context) (*corev1.Secret, error) {\n\treturn i.getSecret(ctx, serverAuthSecretLabels(i.labels))\n}", "title": "" }, { "docid": "351a443206dc1ddf9283a205f18c203a", "score": "0.6467214", "text": "func (h *Handler) getSecret(namespace, name string, metadata configMetadata) getResult {\n\treturn h.getObject(namespace, name, metadata, &corev1.Secret{})\n}", "title": "" }, { "docid": "92fa4d193ef449253a8b3cf9731d2b27", "score": "0.643263", "text": "func Get(serverAddress string) (types.AuthConfig, error) {\n\ts := loadCredentialStore()\n\treturn s.Get(serverAddress)\n}", "title": "" }, { "docid": "dfbdb7e6a05e393aa4b935353ab5a8bc", "score": "0.6400271", "text": "func AuthSecret() string {\n\tsecret, exists := os.LookupEnv(\"AUTH_SECRET\")\n\tif !exists {\n\t\tsecret = \"secret_key\"\n\t}\n\treturn secret\n}", "title": "" }, { "docid": "0c659976348db006c6d1c2cfc615370c", "score": "0.6394096", "text": "func GetSecret(secretId string) (string, error) {\n\tctx := context.Background()\n\tclient, err := secretmanager.NewClient(ctx)\n\tif err != nil {\n\t\treturn \"\", errs.Wrap(err, \"failed to setup client\")\n\t}\n\n\t// AppEngine environment variable only exposes projectID and not projectNumber which is required by secrets manager\n\tprojectNumber, err := proj.GetProjectNumber()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\taccessRequest := &secretmanagerpb.AccessSecretVersionRequest{\n\t\tName: fmt.Sprintf(\"projects/%d/secrets/%s/versions/%d\", projectNumber, secretId, 1),\n\t}\n\n\t// get secret\n\tresult, err := client.AccessSecretVersion(ctx, accessRequest)\n\tif err != nil {\n\t\treturn \"\", errs.Wrap(err, \"failed to access secret version\")\n\t}\n\n\tif string(result.Payload.Data) == \"\" {\n\t\treturn \"\", errors.New(\"secret empty\")\n\t}\n\n\treturn string(result.Payload.Data), nil\n}", "title": "" }, { "docid": "6a2ce7622dbebcae624ae29b46fe8efc", "score": "0.63789624", "text": "func (i *natsInstaller) getClientAuthSecret(ctx context.Context) (*corev1.Secret, error) {\n\treturn i.getSecret(ctx, clientAuthSecretLabels(i.labels))\n}", "title": "" }, { "docid": "815ca34afa3f548368c6e1ea32145525", "score": "0.63725644", "text": "func LookupAuthConfig() (clientID, clientSecret, token string, err error) { // string, string 으로 받아야지\n\n\tif !fileExists() {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"config file does not exist.\")\n\t}\n\n\tconfigPath, err := EnsureFile()\n\tif err != nil {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"The file path is not correct.\")\n\t}\n\n\tcfg, err := New(configPath)\n\tif err != nil {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"Failed to create config data.\")\n\t}\n\n\tif err := cfg.load(); err != nil {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"Failed to read config data.\")\n\t}\n\n\tclient_id := cfg.AuthConfigs[0].Client_id\n\tclient_secret := cfg.AuthConfigs[0].Client_secret\n\tToken := cfg.AuthConfigs[0].Token\n\n\treturn client_id, client_secret, Token, nil\n}", "title": "" }, { "docid": "001e4191326d5b986832ef014e8f1853", "score": "0.63687783", "text": "func (p *PorterHelper) Get(serverURL string) (user string, secret string, err error) {\n\treturn p.AuthGetter.GetCredentials(serverURL)\n}", "title": "" }, { "docid": "800fb4604bdd6772b35f60a66cdd1c41", "score": "0.6254865", "text": "func (c *Configuration) Get(key string) (string, error) {\n\tres := os.Getenv(key)\n\tvalSecret := os.Getenv(fmt.Sprintf(\"%s_SECURE\", key))\n\n\tif valSecret != \"\" {\n\t\tvalSecretRes, err := c.provider.Get(valSecret)\n\t\tif err != nil {\n\t\t\treturn \"\", internal.WrapErrorf(err, internal.ErrorCodeInvalidArgument, \"provider.Get\")\n\t\t}\n\n\t\tres = valSecretRes\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "eee123304da77ade1e7c1437317da212", "score": "0.62543696", "text": "func GetSecret(credentialInfo utility.CredentialInfo) (string, error) {\n\tsecretId, err := utility.GetCredentialId(credentialInfo)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tLOGGER.Infof(\"getSecret: %s\", secretId)\n\n\t//Create a Secrets Manager client\n\tsvc := secretsmanager.New(session.New())\n\n\tinput := &secretsmanager.GetSecretValueInput{\n\t\tSecretId: aws.String(secretId),\n\t\tVersionStage: aws.String(\"AWSCURRENT\"), // VersionStage defaults to AWSCURRENT if unspecified\n\t}\n\n\tresult, err := svc.GetSecretValue(input)\n\tif err != nil {\n\t\terrorHandler(err)\n\t\treturn \"\", err\n\t}\n\n\t// Decrypts secret using the associated KMS CMK.\n\t// Depending on whether the secret is a string or binary, one of these fields will be populated.\n\tvar secretString string\n\tif result.SecretString != nil {\n\t\tsecretString = *result.SecretString\n\t} else {\n\t\tdecodedBinarySecretBytes := make([]byte, base64.StdEncoding.DecodedLen(len(result.SecretBinary)))\n\t\tlen, err := base64.StdEncoding.Decode(decodedBinarySecretBytes, result.SecretBinary)\n\t\tif err != nil {\n\t\t\tLOGGER.Errorf(\"Base64 Decode Error: %s\", err)\n\t\t\treturn \"\", err\n\t\t}\n\t\tsecretString = string(decodedBinarySecretBytes[:len])\n\t}\n\tLOGGER.Infof(\"getSecret: Success!\")\n\treturn secretString, nil\n}", "title": "" }, { "docid": "841af90e454afb54e6fa9aeebda1eac5", "score": "0.6231363", "text": "func (c *ConnectionGatewayAuthentication) GetSecret() string {\n\tif c == nil || c.Secret == nil {\n\t\treturn \"\"\n\t}\n\treturn *c.Secret\n}", "title": "" }, { "docid": "0b8b9ac6f2e0b847c8bce25e862684ac", "score": "0.6212746", "text": "func (c *HelloFreshClient) GetSecret() string {\n\treturn c.Secret\n}", "title": "" }, { "docid": "cf28ac89ee53b3caa77bacc9fbdc7ecc", "score": "0.6191098", "text": "func GetCredentialsSecret(coreClient controllerRuntimeClient.Client, namespace string, spec ibmcloudproviderv1.IBMCloudMachineProviderSpec) (string, error) {\n\tif spec.CredentialsSecret == nil {\n\t\treturn \"\", nil\n\t}\n\tvar credentialsSecret apicorev1.Secret\n\n\tif err := coreClient.Get(context.Background(), controllerRuntimeClient.ObjectKey{Namespace: namespace, Name: spec.CredentialsSecret.Name}, &credentialsSecret); err != nil {\n\t\tif apimachineryerrors.IsNotFound(err) {\n\t\t\tmachoneapierrors.InvalidMachineConfiguration(\"credentials secret %q in namespace %q not found: %v\", spec.CredentialsSecret.Name, namespace, err.Error())\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"error getting credentials secret %q in namespace %q: %v\", spec.CredentialsSecret.Name, namespace, err)\n\t}\n\tdata, exists := credentialsSecret.Data[credentialsSecretKey]\n\tif !exists {\n\t\treturn \"\", machoneapierrors.InvalidMachineConfiguration(\"secret %v/%v does not have %q field set. Thus, no credentials applied when creating an instance\", namespace, spec.CredentialsSecret.Name, credentialsSecretKey)\n\t}\n\n\treturn string(data), nil\n}", "title": "" }, { "docid": "37f0163174bc7080f01e4fb92b5e9c4b", "score": "0.6181061", "text": "func (vp *valuesProvider) getSecret(ctx context.Context, namespace string, secretName string) (*corev1.Secret, error) {\n\tkey := kutil.Key(namespace, secretName)\n\tvp.logger.Info(\"GetSecret\", \"key\", key)\n\tsecret := &corev1.Secret{}\n\terr := vp.mgr.GetClient().Get(ctx, key, secret)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tvp.logger.Error(err, \"error getting chart secret - not found\")\n\t\t\treturn nil, err\n\t\t}\n\t\tvp.logger.Error(err, \"error getting chart secret\")\n\t\treturn nil, err\n\t}\n\treturn secret, nil\n}", "title": "" }, { "docid": "a6c2d89ba7cbd32e6afa52913492e41e", "score": "0.6173548", "text": "func GetSecret(t Token) error {\n\terr := t.getSecret()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2debf2c58d0a7ac73553b4d44252bff3", "score": "0.6152467", "text": "func GetSecretKey(appID string) string {\n\tif appID == \"\" {\n\t\treturn \"\"\n\t}\n\t// not initial\n\tif appSecretConfig.singleConfig == nil {\n\t\treturn refreshAppSecretConfig(appID)\n\t}\n\t// expired\n\tif appSecretConfig.expire.Before(time.Now()) {\n\t\treturn refreshAppSecretConfig(appID)\n\t}\n\tsecretKey, ok := appSecretConfig.singleConfig.(map[string]string)[appID]\n\t// not exist\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn secretKey\n}", "title": "" }, { "docid": "ebfa6cb8e2c429e6bef698f82f27bb6b", "score": "0.6129833", "text": "func RetrieveSecret(f *framework.Framework, name, namespace string) (*corev1.Secret, error) {\n\tobj := &corev1.Secret{}\n\t// Get Secret\n\tif err := utilwait.PollImmediate(config.WaitForRetry, config.WaitForTimeout, func() (done bool, err error) {\n\t\tif err = f.Client.Get(goctx.TODO(), types.NamespacedName{Name: name, Namespace: namespace}, obj); err != nil {\n\t\t\tif errors.IsNotFound(err) {\n\t\t\t\tfmt.Println(\" --- Waiting for Secret copied ...\")\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\t\treturn true, nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\treturn obj, nil\n}", "title": "" }, { "docid": "fedc45be03c410c2898c16dfde8688d6", "score": "0.6111434", "text": "func (c *OIDCAuthProvider) ClientSecret() string {\n\treturn c.Config[\"client-secret\"]\n}", "title": "" }, { "docid": "01d1914ba8475a6db86bbaba2c1190fd", "score": "0.6096918", "text": "func (c *Client) GetSecret() string {\n\treturn c.Secret\n}", "title": "" }, { "docid": "7becc7c936756dee4d895819ddd93765", "score": "0.60819554", "text": "func (d *Provider) GetSecret(ctx context.Context, secretURL string) (string, error) {\n\tvar service service\n\tvar secret string\n\n\tserviceType := provider.GetServiceTypeFromURL(secretURL)\n\tsess := session.Must(session.NewSession(&aws.Config{\n\t\tRegion: aws.String(d.region),\n\t}))\n\n\tswitch serviceType {\n\tcase \"secretsmanager\":\n\t\tservice = newSecretsManager(secretURL, sess)\n\tdefault:\n\t\treturn secret, fmt.Errorf(\"Unrecognized service: %s\", serviceType)\n\t}\n\n\treturn service.getSecret(ctx)\n}", "title": "" }, { "docid": "7f0118c4b64a1016a7ea10e0fbaa4173", "score": "0.606401", "text": "func (s *ClientsService) GetSecret(ctx context.Context, realm, id string) (*Credential, *http.Response, error) {\n\tu := fmt.Sprintf(\"admin/realms/%s/clients/%s/client-secret\", realm, id)\n\treq, err := s.keycloak.NewRequest(http.MethodGet, u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar credential Credential\n\tres, err := s.keycloak.Do(ctx, req, &credential)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &credential, res, nil\n}", "title": "" }, { "docid": "27b0bd47102c6f14c9cbcb87ce144fd4", "score": "0.60553795", "text": "func (p *Provider) GetSecret(secretName string) (string, bool) {\n\tif p.client != nil {\n\t\tif value, err := p.client.Get(secretName); err == nil {\n\t\t\treturn value, true\n\t\t}\n\t}\n\n\treturn \"\", false\n}", "title": "" }, { "docid": "3b5495fc99cd2ff8a2f257b61b7778a7", "score": "0.6035077", "text": "func GetCustomSecret(config *viper.Viper) (customSecret CustomSecret, err error) {\n\tcaCertFile := config.Get(\"vault_cacert_file\").(string)\n\tcaCert, err := ioutil.ReadFile(caCertFile)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t\treturn customSecret, err\n\t}\n\tcaCertPool := x509.NewCertPool()\n\tcaCertPool.AppendCertsFromPEM(caCert)\n\tclient := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tRootCAs: caCertPool,\n\t\t\t},\n\t\t},\n\t}\n\tvar token string\n\tauthenticationMethod := config.Get(\"vault_auth_method\").(string)\n\tswitch authenticationMethod {\n\tcase \"approle\":\n\t\ttoken, err = VaultAppRoleAuthenticate(config)\n\tdefault:\n\t\ttoken, err = VaultTLSAuthenticate(config)\n\t}\n\tif err != nil || token == \"\" {\n\t\tlogrus.Fatal(err)\n\t\treturn customSecret, err\n\t}\n\n\tsecretURL := config.Get(\"vault_secret_path\").(string) + config.Get(\"application_id\").(string) + \".\" + config.Get(\"account_name\").(string) + \".\" + config.Get(\"application_domain\").(string)\n\tsecretName := config.Get(\"secret_name\").(string)\n\tif secretName != \"\" {\n\t\tsecretURL = secretURL + \"/\" + secretName\n\t}\n\tsecretRequest, _ := http.NewRequest(\"GET\", secretURL, nil)\n\tsecretRequest.Header.Set(\"X-Vault-Token\", token)\n\tresp, err := client.Do(secretRequest)\n\n\tif err != nil || resp == nil || resp.StatusCode != http.StatusOK {\n\t\tlogrus.Fatal(err)\n\t\treturn customSecret, err\n\t}\n\n\tvar htmlData []byte\n\tvar vaultSecret VaultSecret\n\thtmlData, _ = ioutil.ReadAll(resp.Body)\n\terr = json.Unmarshal(htmlData, &vaultSecret)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t\treturn customSecret, err\n\t}\n\n\tbytes := []byte(vaultSecret.Data.Value)\n\terr = json.Unmarshal(bytes, &customSecret)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t\treturn customSecret, err\n\t}\n\treturn customSecret, nil\n}", "title": "" }, { "docid": "a5ae1aa75e5c3cc79d7fa0ca1815c0cb", "score": "0.6035035", "text": "func (c APITokenCredential) Secret() string {\n\treturn c.apiToken\n}", "title": "" }, { "docid": "f215b9875891e97360832bcaee223f7a", "score": "0.6031817", "text": "func (c BasicAuthCredential) Secret() string {\n\treturn c.password\n}", "title": "" }, { "docid": "e877ac670144f155ca7dcdd333da3f97", "score": "0.6003142", "text": "func Get(storeClient service.StoreClient, accessToken string, password string, secretName string, credFilePath string) (string, error) {\n\tdecryptedContent, err := getDecryptedRemoteFileContent(storeClient, accessToken, password, credFilePath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tsecret, err := getSecret(decryptedContent, secretName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn secret, nil\n}", "title": "" }, { "docid": "4a8faa3695f568a03b16ee1cb0b8d633", "score": "0.5995998", "text": "func (c BearerTokenCredential) Secret() string {\n\treturn c.token\n}", "title": "" }, { "docid": "2d2b7a011ecbad0b206aff91495e4a3c", "score": "0.5974143", "text": "func (c *Data) GetServiceAccountSecret() string {\n\treturn c.v.GetString(varServiceAccountSecret)\n}", "title": "" }, { "docid": "88852ed8fff48b160a19e3fdd4e4904f", "score": "0.59669745", "text": "func GetAuth(c *gin.Context) {\n\tusername := c.Query(\"username\")\n\tpassword := c.Query(\"password\")\n\n\tvalid := validation.Validation{}\n\ta := auth{Username: username, Password: password}\n\tok, _ := valid.Valid(&a)\n\n\tdata := make(map[string]interface{})\n\tcode := e.INVALID_PARAMS\n\tif ok {\n\t\tisExist, err := models.CheckAuth(username, password)\n\t\tif isExist {\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "29309c724942131c5cb7e5ee6f52b437", "score": "0.5959081", "text": "func Get(app, provider string) (*awsprovider.Credentials, error) {\n\t// Read config\n\tp, err := config.GetOneLoginProvider(provider)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading provider config: %v\", err)\n\t}\n\n\ta, err := config.GetOneLoginApp(app)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading config for app %s: %v\", app, err)\n\t}\n\n\tc := NewClient()\n\n\t// Initialize spinner\n\tvar s SpinnerWrapper\n\tif runtime.GOOS == \"windows\" {\n\t\ts = &noopSpinner{}\n\t} else {\n\t\ts = spinner.New(spinner.CharSets[14], 50*time.Millisecond)\n\t}\n\n\t// Get OneLogin access token\n\ts.Start()\n\ttoken, err := c.GenerateTokens(p.ClientID, p.ClientSecret)\n\ts.Stop()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"generating access token: %s\", err)\n\t}\n\n\tuser := p.Username\n\tif user == \"\" {\n\t\t// Get credentials from the user\n\t\tfmt.Print(\"OneLogin username: \")\n\t\tfmt.Scanln(&user)\n\t}\n\n\tfmt.Print(\"OneLogin password: \")\n\tpass, err := gopass.GetPasswd()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Couldn't read password from terminal\")\n\t}\n\n\t// Generate SAML assertion\n\tpSAML := GenerateSamlAssertionParams{\n\t\tUsernameOrEmail: user,\n\t\tPassword: string(pass),\n\t\tAppId: a.ID,\n\t\t// TODO At the moment when there is a mismatch between Subdomain and\n\t\t// the domain in the username, the user is getting HTTP 400.\n\t\tSubdomain: p.Subdomain,\n\t}\n\n\ts.Start()\n\trSaml, err := c.GenerateSamlAssertion(token, &pSAML)\n\ts.Stop()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"generating SAML assertion: %v\", err)\n\t}\n\n\tst := rSaml.Data[0].StateToken\n\n\tdevices := rSaml.Data[0].Devices\n\n\tvar deviceID string\n\tif len(devices) > 1 {\n\t\tfor i, d := range devices {\n\t\t\tfmt.Printf(\"%d. %d - %s\\n\", i+1, d.DeviceId, d.DeviceType)\n\t\t}\n\n\t\tfmt.Printf(\"Please choose an MFA device to authenticate with (1-%d): \", len(devices))\n\t\tvar selection int\n\t\tfmt.Scanln(&selection)\n\n\t\tdeviceID = fmt.Sprintf(\"%v\", devices[selection-1].DeviceId)\n\t} else {\n\t\tdeviceID = fmt.Sprintf(\"%v\", devices[0].DeviceId)\n\t}\n\n\tfmt.Print(\"Please enter the OTP from your MFA device: \")\n\tvar otp string\n\tfmt.Scanln(&otp)\n\n\t// Verify MFA\n\tpMfa := VerifyFactorParams{\n\t\tAppId: a.ID,\n\t\tDeviceId: deviceID,\n\t\tStateToken: st,\n\t\tOtpToken: otp,\n\t}\n\n\ts.Start()\n\trMfa, err := c.VerifyFactor(token, &pMfa)\n\ts.Stop()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"verifying factor: %v\", err)\n\t}\n\n\tsamlAssertion := rMfa.Data\n\n\t// Assume role\n\tpAssumeRole := sts.AssumeRoleWithSAMLInput{\n\t\tPrincipalArn: aws.String(a.PrincipalARN),\n\t\tRoleArn: aws.String(a.RoleARN),\n\t\tSAMLAssertion: aws.String(samlAssertion),\n\t}\n\n\tsess := session.Must(session.NewSession())\n\tsvc := sts.New(sess)\n\n\ts.Start()\n\tresp, err := svc.AssumeRoleWithSAML(&pAssumeRole)\n\ts.Stop()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"assuming role: %v\", err)\n\t}\n\n\tkeyID := *resp.Credentials.AccessKeyId\n\tsecretKey := *resp.Credentials.SecretAccessKey\n\tsessionToken := *resp.Credentials.SessionToken\n\texpiration := *resp.Credentials.Expiration\n\n\tcreds := awsprovider.Credentials{\n\t\tAccessKeyID: keyID,\n\t\tSecretAccessKey: secretKey,\n\t\tSessionToken: sessionToken,\n\t\tExpiration: expiration,\n\t}\n\n\treturn &creds, nil\n}", "title": "" }, { "docid": "08125d0d40de3916276ceb6f727c2f4e", "score": "0.59388995", "text": "func getGCPSecret() (string, error) {\n\tsecret := os.Getenv(gcloudSecretEnvVar)\n\tif secret != \"\" {\n\t\treturn secret, nil\n\t}\n\n\treturn utils.CryptoRandomHex(auth.TokenLenBytes)\n}", "title": "" }, { "docid": "40387f8b1065dfed7531ec63d6fc6a06", "score": "0.5938025", "text": "func (j *JwtToken) getSecret() error {\n\tj.secret = os.Getenv(\"JWT_SECRET\")\n\n\tif j.secret == \"\" {\n\t\tj.TokenString = \"\"\n\t\tj.Err = InvalidSecret\n\t\treturn j.Err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c566fb1b6143b4df59cfe9419cd451dc", "score": "0.59206796", "text": "func (p *Provider) GetValue(id string) ([]byte, error) {\n\tvar err error\n\n\tif id == \"accessToken\" {\n\t\tif p.Username != \"\" && p.APIKey != \"\" {\n\t\t\t// TODO: Use a cached access token from the client, once it's exposed\n\t\t\treturn p.Conjur.Authenticate(authn.LoginPair{\n\t\t\t\tp.Username,\n\t\t\t\tp.APIKey,\n\t\t\t})\n\t\t}\n\t\treturn nil, errors.New(\"Error: Conjur provider can't provide an accessToken unless username and apiKey credentials are provided\")\n\t}\n\n\t// If using the Conjur Kubernetes authenticator, ensure that the\n\t// Conjur API is using the current access token\n\tif p.AuthnURL != \"\" {\n\t\tif p.Conjur, err = conjurapi.NewClientFromTokenFile(p.Config, authenticatorTokenFile); err != nil {\n\t\t\tlog.Fatalf(\"ERROR: Could not create new Conjur provider: %s\", err)\n\t\t}\n\t}\n\n\ttokens := strings.SplitN(id, \":\", 3)\n\tswitch len(tokens) {\n\tcase 1:\n\t\ttokens = []string{p.Config.Account, \"variable\", tokens[0]}\n\tcase 2:\n\t\ttokens = []string{p.Config.Account, tokens[0], tokens[1]}\n\t}\n\n\treturn p.Conjur.RetrieveSecret(strings.Join(tokens, \":\"))\n}", "title": "" }, { "docid": "980c57f3b46f22f48a68c48b11b8ffb3", "score": "0.59015054", "text": "func (c *clientImpl) GetSecret(namespace, name string) (*corev1.Secret, bool, error) {\n\tvar secret *corev1.Secret\n\titem, exists, err := c.secStores[c.lookupNamespace(namespace)].GetByKey(namespace + \"/\" + name)\n\tif err == nil && item != nil {\n\t\tsecret = item.(*corev1.Secret)\n\t}\n\n\treturn secret, exists, err\n}", "title": "" }, { "docid": "feeb09e309424397ca4c3db868feae8c", "score": "0.58916664", "text": "func getSecretFromContext(c context.Context) string {\n\tvar wc = webcontext.ToC(c)\n\n\treturn wc.Env[\"jwtSecret\"].(string)\n}", "title": "" }, { "docid": "2f80a2308d7ced14f62a256cb30e8fed", "score": "0.58882415", "text": "func getAPIConfig(secretPath string) *oauth2.Config {\n\tb, err := ioutil.ReadFile(secretPath)\n\tif err != nil {\n\t\tlog.Fatalf(\"Cannot read client secret file: %v\", secretPath)\n\t}\n\tconfig, err := google.ConfigFromJSON(b, scopes...)\n\tif err != nil {\n\t\tlog.Fatalf(\"Cannot parse client secret file to config: %v\", secretPath)\n\t}\n\treturn config\n}", "title": "" }, { "docid": "c22f0b82b16b4ec5fdd60044fde8c052", "score": "0.5884341", "text": "func (a *Akeyless) GetSecret(ctx context.Context, ref esv1alpha1.ExternalSecretDataRemoteRef) ([]byte, error) {\n\tif utils.IsNil(a.Client) {\n\t\treturn nil, fmt.Errorf(errUninitalizedAkeylessProvider)\n\t}\n\n\ttoken, err := a.Client.TokenFromSecretRef(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tversion := int32(0)\n\tif ref.Version != \"\" {\n\t\ti, err := strconv.ParseInt(ref.Version, 10, 32)\n\t\tif err == nil {\n\t\t\tversion = int32(i)\n\t\t}\n\t}\n\tvalue, err := a.Client.GetSecretByType(ref.Key, token, version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn []byte(value), nil\n}", "title": "" }, { "docid": "f9da2e7de3cce1c82cb93589bd47b8a0", "score": "0.58827645", "text": "func GetConfig() (url string, access_token string) {\n\tviper.SetConfigName(\"config\")\n\terr := viper.ReadInConfig()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\turl = viper.GetString(\"url\")\n\tfmt.Printf(\"Your URL from config file : %s \\n\\n\", url)\n\n\taccess_token = viper.GetString(\"access_token\")\n\tfmt.Printf(\"You access_token from config file : %s \\n\\n\", access_token)\n\n\treturn url, access_token\n}", "title": "" }, { "docid": "7bfe1386c34cb3763a35ab92f67d95e3", "score": "0.58649826", "text": "func getSecret(secretFile string) (*core.Secret, error) {\n\tsecretReader, err := os.Open(secretFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer secretReader.Close()\n\tsec := &core.Secret{}\n\tsez := yaml.NewYAMLOrJSONDecoder(secretReader, 1000)\n\n\tif err := sez.Decode(&sec); err != nil {\n\t\treturn nil, err\n\t}\n\treturn sec, nil\n}", "title": "" }, { "docid": "0c1f16824674813485043c733c757e97", "score": "0.58554065", "text": "func (s *ssmSecretStore) GetSecret(ctx context.Context, req secretstores.GetSecretRequest) (secretstores.GetSecretResponse, error) {\n\tname := req.Name\n\n\tvar versionID string\n\tif value, ok := req.Metadata[VersionID]; ok {\n\t\tversionID = value\n\t\tname = fmt.Sprintf(\"%s:%s\", req.Name, versionID)\n\t}\n\n\toutput, err := s.client.GetParameterWithContext(ctx, &ssm.GetParameterInput{\n\t\tName: aws.String(s.prefix + name),\n\t\tWithDecryption: aws.Bool(true),\n\t})\n\tif err != nil {\n\t\treturn secretstores.GetSecretResponse{Data: nil}, fmt.Errorf(\"couldn't get secret: %s\", err)\n\t}\n\n\tresp := secretstores.GetSecretResponse{\n\t\tData: map[string]string{},\n\t}\n\tif output.Parameter.Name != nil && output.Parameter.Value != nil {\n\t\tsecretName := (*output.Parameter.Name)[len(s.prefix):]\n\t\tresp.Data[secretName] = *output.Parameter.Value\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "574e6f0e18bafa35af8d101819fa76f6", "score": "0.5850218", "text": "func (appContext *Context) SecretProvider() bootstrapInterfaces.SecretProvider {\n\tsecretProvider := bootstrapContainer.SecretProviderFrom(appContext.Dic.Get)\n\treturn secretProvider\n}", "title": "" }, { "docid": "aaf963401fa924d20f341792d1cb3807", "score": "0.5844759", "text": "func GetUIAuthSecret() string {\n\treturn utils.ReadEnv(uiAuthSecret)\n}", "title": "" }, { "docid": "a2ba1cce94d7bf0f45147effa16134ac", "score": "0.5829291", "text": "func (c *Data) GetAuthServiceURL() string {\n\treturn c.v.GetString(varAuthURL)\n}", "title": "" }, { "docid": "9b9d4cd39a53721e30580fa41089d0a9", "score": "0.58273745", "text": "func getAuthURL() string {\n\treturn getOptionSettings(options.authURL, \"auth-url\")\n}", "title": "" }, { "docid": "74ab6f4893e44d52819ca50f0bbe26aa", "score": "0.5821081", "text": "func RetrieveSecret(client *api.Client, cfg *SecretConfig) (map[string]interface{}, error) {\n\t/*\n\t\tlist of secrets names (keys) /secret/kv2/service/\n\t\tUSE_SECRET_NAME_AS_KEY\n\t\tABC\n\t\t|- value: 123\n\t\tDEF\n\t\t|- value: 456\n\t\tXYZ\n\t\t|- value: 999\n\n\t\tin this case we need the secret name to be the key, and the value to be the value\n\n\t\tor it can be a list of secrets with multiple key values\n\t\tsecrets/secret_v2/secret/secret_v2/service\n\t\ttest1\n\t\t|- ABC 123\n\t\t|- DEF xyz\n\t\ttest2\n\t\t|- SOME_SECRET 123\n\t\t|- AAA: 111\n\n\n\t\tin this case we need the secret keys and values\n\t*/\n\tvar (\n\t\tkeys []string\n\t\tversionParam map[string][]string\n\t\terr error\n\t)\n\tsecretData := make(map[string]interface{})\n\n\tif strings.HasSuffix(cfg.Path, \"/\") || strings.Contains(cfg.Path, \"*\") || cfg.UseSecretNamesAsKeys {\n\t\tif cfg.UseSecretNamesAsKeys {\n\t\t\tcfg.Path = ensureTrailingSlash(cfg.Path)\n\t\t}\n\n\t\tvar wildcard string\n\t\tif strings.Contains(cfg.Path, \"*\") {\n\t\t\tlog.Warn(\"contains *\")\n\t\t\tcfg.Path, wildcard = path.Split(cfg.Path)\n\t\t\tlog.Warnf(\"path: %s, wildcard: %s\", cfg.Path, wildcard)\n\t\t}\n\t\tkeys, err = listKeys(client, *cfg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif wildcard != \"\" {\n\t\t\tkeys = filterByWildcard(keys, wildcard)\n\t\t}\n\n\t\tlog.Debugf(\"keys: %+v\\n\", keys)\n\t\tif len(keys) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"could not list keys under path: %s\", cfg.Path)\n\t\t}\n\t\tif cfg.UseSecretNamesAsKeys {\n\t\t\tlog.Debugf(\"Using secret names as keys\")\n\t\t} else {\n\t\t\tlog.Debugf(\"Using secret keys and values\")\n\t\t}\n\t\t// get the secrets data from the keys\n\t\tfor _, key := range keys {\n\t\t\t// ignore subtrees\n\t\t\tif strings.HasSuffix(key, \"/\") {\n\t\t\t\tlog.Warnf(\"key %s is a subtree - ignoring it\", key)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar value interface{}\n\t\t\tsecretKeyPath := fmt.Sprintf(\"%s%s\", cfg.Path, key)\n\t\t\tpath := setSecretPath(cfg, secretKeyPath)\n\n\t\t\t// if secret version is passed\n\t\t\tif cfg.IsKVv2 && cfg.Version != \"\" {\n\t\t\t\tversionParam = map[string][]string{\n\t\t\t\t\t\"version\": {cfg.Version},\n\t\t\t\t}\n\t\t\t\tsecret, err := client.Logical().ReadWithData(path, versionParam)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn secret.Data, nil\n\t\t\t}\n\n\t\t\tsecret, err := readSecret(client, path)\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tdata := CastSecretDataToStringMap(secret.Data)\n\t\t\t// if keys are single value get the value\n\t\t\t// secret/path/api_key\n\t\t\t// value: \"top-secret\"\n\n\t\t\tif cfg.UseSecretNamesAsKeys {\n\t\t\t\tfor _, v := range data {\n\t\t\t\t\tvalue = v\n\t\t\t\t}\n\t\t\t\tsecretData[key] = value\n\t\t\t\t// else get every key, value in secret\n\t\t\t} else {\n\t\t\t\tfor name, value := range data {\n\t\t\t\t\tsecretData[name] = value\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(secretData) != 0 {\n\t\treturn secretData, nil\n\t}\n\n\tpath := setSecretPath(cfg, cfg.Path)\n\t// if secret version is passed\n\tif cfg.IsKVv2 && cfg.Version != \"\" {\n\t\tversionParam = map[string][]string{\n\t\t\t\"version\": {cfg.Version},\n\t\t}\n\t\tsecret, err := client.Logical().ReadWithData(path, versionParam)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif secret != nil {\n\t\t\treturn secret.Data, nil\n\t\t}\n\t\treturn nil, errors.New(\"could not read secret data\")\n\t}\n\n\tsecret, err := readSecret(client, path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn secret.Data, nil\n}", "title": "" }, { "docid": "71b96ee94816934dbee5c69981934edb", "score": "0.58203065", "text": "func GetAuthURL(c echo.Context) error {\n stateCode, _ := utils.RandomHex(10)\n authurl := fmt.Sprintf(\"%s/oauth2/authorize?response_type=code&client_id=%s&scope=%s&redirect_uri=%s\", cfg.BaseURL, cfg.ClientID, cfg.Scope, utils.SafeUrl(cfg.RedirectURI))\n fullauthurl := fmt.Sprintf(\"%s&state=%s\", authurl, stateCode)\n return c.String(http.StatusOK, fullauthurl)\n}", "title": "" }, { "docid": "87b58fa3b051962c8e07c55251290e6b", "score": "0.5820173", "text": "func getOauthConfig(clientID string, clientSecret string) *oauth2.Config {\n\treturn &oauth2.Config{\n\t\tClientID: clientID,\n\t\tClientSecret: clientSecret,\n\t\tScopes: []string{drive.DriveScope},\n\t\tRedirectURL: \"urn:ietf:wg:oauth:2.0:oob\",\n\t\tEndpoint: oauth2.Endpoint{\n\t\t\tAuthURL: \"https://accounts.google.com/o/oauth2/auth\",\n\t\t\tTokenURL: \"https://accounts.google.com/o/oauth2/token\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "732c551b4972d19ce48fed1ee4e1c02e", "score": "0.58162683", "text": "func (p *provider) GetConfig() latest.Provider {\n\treturn p.Provider\n}", "title": "" }, { "docid": "66db84b8011deb17c5c94a7d3ae65418", "score": "0.5806168", "text": "func (d *Daemon) GetSecret(t testing.TB, id string) *swarm.Secret {\n\tt.Helper()\n\tcli := d.NewClientT(t)\n\tdefer cli.Close()\n\n\tsecret, _, err := cli.SecretInspectWithRaw(context.Background(), id)\n\tassert.NilError(t, err)\n\treturn &secret\n}", "title": "" }, { "docid": "42b51b5cf79839e1e656ef3a6f8d213e", "score": "0.5803992", "text": "func (service mlpService) GetSecret(projectID models.ID, name string) (string, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), mlpQueryTimeoutSeconds*time.Second)\n\tdefer cancel()\n\n\tsecrets, resp, err := service.mlpClient.api.SecretApi.ProjectsProjectIdSecretsGet(ctx, int32(projectID))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif resp != nil && resp.Body != nil {\n\t\tdefer resp.Body.Close()\n\t}\n\tfor _, secret := range secrets {\n\t\tif secret.Name == name {\n\t\t\treturn service.mlpClient.Decrypt(secret.Data)\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"secret %s not found in project %d\", name, projectID)\n}", "title": "" }, { "docid": "40a34a3b1ee27e0201bc1e6eafbcd848", "score": "0.5797805", "text": "func getCredentialConfig(cfg *config.Configuration) (*credsConfig, error) {\n\tvar what credsConfig\n\n\tif err := cfg.Unmarshal(&what); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &what, nil\n}", "title": "" }, { "docid": "49ce4ccb08b049939b9b501df6c6d71d", "score": "0.57932746", "text": "func GetAuthConfig(hspecFiles []string) (*string, error) {\n\n\tRegistryMap := make(map[string]bool)\n\n\tfor _, alias := range DockerHubAliases {\n\t\tRegistryMap[alias] = true\n\t}\n\n\tfor _, each := range hspecFiles {\n\t\thspec, err := hspec.LoadHspec(each)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Error while deserializing hspec\", err)\n\t\t}\n\n\t\tregistry := hspec.Image.Registry\n\t\tif registry != \"\" && !RegistryMap[registry] {\n\t\t\tRegistryMap[registry] = true\n\t\t}\n\n\t\tstkImg := hspec.Image.BuildSpec.StackImage\n\t\tif stkImg != \"\" && !RegistryMap[stkImg] {\n\t\t\tstackImgReg := getImageRegistry(stkImg)\n\t\t\tRegistryMap[stackImgReg] = true\n\t\t}\n\n\t\tif hspec.Agents != nil {\n\t\t\tfor _, each := range *hspec.Agents {\n\t\t\t\tagent := each.Name\n\t\t\t\tif agent != \"\" && !RegistryMap[agent] {\n\t\t\t\t\timgReg := getImageRegistry(agent)\n\t\t\t\t\tRegistryMap[imgReg] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tverbose, ok := strconv.ParseBool(os.Getenv(debugCredstoreEnv))\n\tif ok != nil {\n\t\tverbose = false\n\t}\n\n\t// Constructing all auth configs for the unique registries\n\tauth := make([]types.AuthConfig, 0)\n\tfor key := range RegistryMap {\n\t\t//TODO read verbose from external configuration\n\t\tregCreds := GetRegistryCredentials(key, verbose)\n\t\tif regCreds != (types.AuthConfig{}) {\n\t\t\tauth = append(auth, regCreds)\n\t\t}\n\t}\n\n\tdata, err := convert(auth)\n\tif err != nil {\n\t\tlog.Fatal(\"Error while reading config.json\")\n\t}\n\n\tauthString, err := json.Marshal(data)\n\tif err != nil {\n\t\tlog.Fatal(\"Error while deserializing auth \")\n\t}\n\tjson := string(authString)\n\tif verbose {\n\t\tfmt.Println(json)\n\t}\n\treturn &json, nil\n}", "title": "" }, { "docid": "ab79e6ad138a29674f5959c384702ac1", "score": "0.57910603", "text": "func (g *Google) Secret() string {\n\treturn g.ClientSecret\n}", "title": "" }, { "docid": "81f958524b34bc509b2c53ba974e325c", "score": "0.57811403", "text": "func retrieveTenantSecret(client k8sclient.Client, tenantCR *capabilitiesv1alpha1.Tenant) (*corev1.Secret, error) {\n\tsecret := &corev1.Secret{}\n\n\terr := client.Get(context.TODO(), k8sclient.ObjectKey{Name: tenantCR.Spec.TenantSecretRef.Name, Namespace: tenantCR.Spec.TenantSecretRef.Namespace}, secret)\n\tif err != nil {\n\t\treturn secret, err\n\t}\n\n\treturn secret, nil\n}", "title": "" }, { "docid": "b3db21c5afa3831f0ad5afa637251a37", "score": "0.5775297", "text": "func GetSecret(client client.Client, name, namespace string) (*v1.Secret, error) {\n\n\tkey := types.NamespacedName{\n\t\tName: name,\n\t\tNamespace: namespace,\n\t}\n\tvar secret v1.Secret\n\tif err := client.Get(context.TODO(), key, &secret); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &secret, nil\n}", "title": "" }, { "docid": "c93046163a017f2d742be8ff8821c80c", "score": "0.576987", "text": "func GetSecret(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SecretState, opts ...pulumi.ResourceOption) (*Secret, error) {\n\tvar resource Secret\n\terr := ctx.ReadResource(\"google-native:secretmanager/v1beta1:Secret\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "25cca4b702f582877ae887c5d5e49aec", "score": "0.576237", "text": "func (kms *KeyManagementService) GetSecret(ctx context.Context, ref esv1alpha1.ExternalSecretDataRemoteRef) ([]byte, error) {\n\tif utils.IsNil(kms.Client) {\n\t\treturn nil, fmt.Errorf(errUninitalizedAlibabaProvider)\n\t}\n\tkmsRequest := kmssdk.CreateGetSecretValueRequest()\n\tkmsRequest.VersionId = ref.Version\n\tkmsRequest.SecretName = ref.Key\n\tkmsRequest.SetScheme(\"https\")\n\tsecretOut, err := kms.Client.GetSecretValue(kmsRequest)\n\tif err != nil {\n\t\treturn nil, util.SanitizeErr(err)\n\t}\n\tif ref.Property == \"\" {\n\t\tif secretOut.SecretData != \"\" {\n\t\t\treturn []byte(secretOut.SecretData), nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"invalid secret received. no secret string nor binary for key: %s\", ref.Key)\n\t}\n\tvar payload string\n\tif secretOut.SecretData != \"\" {\n\t\tpayload = secretOut.SecretData\n\t}\n\tval := gjson.Get(payload, ref.Property)\n\tif !val.Exists() {\n\t\treturn nil, fmt.Errorf(\"key %s does not exist in secret %s\", ref.Property, ref.Key)\n\t}\n\treturn []byte(val.String()), nil\n}", "title": "" }, { "docid": "c918aae4741ddd03eb1b66080b1ed51c", "score": "0.57598233", "text": "func (c *Client) GetSecret(namespace, name string) (*k8s.Secret, error) {\n\tvar out k8s.Secret\n\t_, err := c.do(\"GET\", secretGeneratePath(namespace, name), nil, &out)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get Secret\")\n\t}\n\treturn &out, nil\n}", "title": "" }, { "docid": "be441babec487a1587cad5c5d4113a49", "score": "0.57598066", "text": "func (p *Provider) Retrieve() (v credentials.Value, err error) {\n\tclient := p.cfg.Kite.NewClient(p.cfg.ServerURL)\n\tclient.Auth = &kite.Auth{\n\t\tType: \"kiteKey\",\n\t\tKey: p.cfg.Kite.KiteKey(),\n\t}\n\n\tif err := client.DialTimeout(p.timeout()); err != nil {\n\t\treturn v, err\n\t}\n\n\tdefer client.Close()\n\n\treq := &AuthRequest{\n\t\tType: p.typ(),\n\t}\n\n\tpart, err := client.TellWithTimeout(\"keygen.auth\", p.timeout(), req)\n\tif err != nil {\n\t\treturn v, err\n\t}\n\n\tvar cred sts.Credentials\n\n\tresp := &AuthResponse{\n\t\tValue: &cred,\n\t}\n\n\tif err := part.Unmarshal(resp); err != nil {\n\t\treturn v, err\n\t}\n\n\tif resp.Type != req.Type {\n\t\treturn v, fmt.Errorf(\"authorization type not expected: %q\", resp.Type)\n\t}\n\n\tp.expire = aws.TimeValue(cred.Expiration)\n\n\tp.cfg.log().Debug(\"Retrieve()=%+v\", resp)\n\n\treturn credentials.Value{\n\t\tAccessKeyID: aws.StringValue(cred.AccessKeyId),\n\t\tSecretAccessKey: aws.StringValue(cred.SecretAccessKey),\n\t\tSessionToken: aws.StringValue(cred.SessionToken),\n\t\tProviderName: \"keygen\",\n\t}, nil\n}", "title": "" }, { "docid": "1fb8a8c955f448e4f59088cdbc0e9aae", "score": "0.57554686", "text": "func (h *Handle) GetSecret(name string) (unsafe.Pointer, error) {\n\treturn h.getData(name)\n}", "title": "" }, { "docid": "5754bff8178968250001b03131e91057", "score": "0.57538635", "text": "func (c *OAuth) getConfig() (*oauth2.Config, error) {\n\ttokenURL := c.Server\n\ttokenURL.Path = path.Join(tokenURL.Path, \"/auth/realms\", c.Realm, \"/protocol/openid-connect/token\")\n\tauthURL := c.Server\n\tauthURL.Path = path.Join(authURL.Path, \"/auth/realms\", c.Realm, \"/protocol/openid-connect/authorize\")\n\tconfig := &oauth2.Config{\n\t\tClientID: c.ID,\n\t\tClientSecret: c.Secret,\n\t\tRedirectURL: c.RedirectURL,\n\t\tEndpoint: oauth2.Endpoint{\n\t\t\tTokenURL: tokenURL.String(),\n\t\t\tAuthURL: authURL.String(),\n\t\t},\n\t}\n\treturn config, nil\n}", "title": "" }, { "docid": "c0776b7fbe4b60c68481dd47b896ee22", "score": "0.57496524", "text": "func GetJWTSecret(val string) string {\n\tif val == \"\" {\n\t\treturn sharedConf.JWTSecret\n\t}\n\treturn val\n}", "title": "" }, { "docid": "c0776b7fbe4b60c68481dd47b896ee22", "score": "0.57496524", "text": "func GetJWTSecret(val string) string {\n\tif val == \"\" {\n\t\treturn sharedConf.JWTSecret\n\t}\n\treturn val\n}", "title": "" }, { "docid": "80ad771ab1b1995fa6cbc3ac2efaa260", "score": "0.57423294", "text": "func GetSecret(s *corev1.Secret) Secret {\n\tout := Secret{\n\t\tID: ReferenceID{\n\t\t\tAPIVersion: corev1.SchemeGroupVersion.String(),\n\t\t\tKind: \"Secret\",\n\t\t\tNamespace: s.GetNamespace(),\n\t\t\tName: s.GetName(),\n\t\t},\n\t\tAPIVersion: corev1.SchemeGroupVersion.String(),\n\t\tKind: \"Secret\",\n\t\tMetadata: GetObjectMeta(s),\n\t\tUnstructured: unstruct(s),\n\t}\n\n\tif s.Data != nil {\n\t\tout.data = make(map[string]string)\n\t\tfor k, v := range s.Data {\n\t\t\tout.data[k] = string(v)\n\t\t}\n\t}\n\n\tif s.Type != \"\" {\n\t\tout.Type = pointer.StringPtr(string(s.Type))\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "972c714416d9374382e543c4f6e02407", "score": "0.57405955", "text": "func (s *SecretParameters) GetSecretParameters() *SecretParameters { return s }", "title": "" }, { "docid": "8d501266e7d134e3ea93f8b9a4f923d5", "score": "0.57376003", "text": "func GetClientConfig() (string, error) {\n template := `OAUTH_AUDIENCE=audience:server:client_id:%v\nREGID_URL=%v\nPHOTO_BASE=%v\nCANONICAL_SERVER_NAME=%v\nKEYSTORE_PASSWORD=%v\nKEYSTORE=%v\n`\n serverUrl, err := url.Parse(Server.URLRoot)\n if err != nil {\n plog.Warn(\"config.GetClientConfig\", \"error parsing URLRoot?!\", err)\n return \"\", err\n }\n\n canonicalName := serverUrl.Host\n colon := strings.Index(canonicalName, \":\")\n if colon == -1 {\n canonicalName = canonicalName + \":-1\"\n }\n\n ksFile, err := os.Open(Server.ClientBKS)\n if err != nil {\n plog.Error(\"server.keystore\", \"no client BKS found\")\n return \"\", err\n }\n defer ksFile.Close()\n\n ksBytes, err := ioutil.ReadAll(ksFile)\n if err != nil {\n plog.Error(\"server.keystore\", \"failed reading BKS file \"+Server.ClientBKS)\n return \"\", err\n }\n\n ksB64 := base64.StdEncoding.EncodeToString(ksBytes)\n\n populated := fmt.Sprintf(template, UserAuth.OAuthAudience, GetURLFor(PATH_REGID), GetURLFor(PATH_PHOTO_LIST), canonicalName, Server.ClientBKSPassword, ksB64)\n return populated, nil\n}", "title": "" }, { "docid": "9f2028047991d6550e8fd8a97aaff34e", "score": "0.57343364", "text": "func GetAppConfig() (AppConfig, error) {\n\tvar c AppConfig\n\terr := envconfig.Process(\"atwell_app\", &c)\n\n\tif c.Secret == \"\" {\n\t\treturn AppConfig{}, fmt.Errorf(\"failed to get auth configurations. Please set them in environments variables. It is now %v\", c)\n\t}\n\n\treturn c, err\n}", "title": "" }, { "docid": "fecba4640dcf5b0ade4a105e29124086", "score": "0.57251686", "text": "func AuthTokenSecret() string {\n\tAuthTokenSecret := os.Getenv(\"AUTH_TOKEN_SECRET\")\n\tif AuthTokenSecret == \"\" {\n\t\tAuthTokenSecret = \"secret\"\n\t}\n\n\treturn AuthTokenSecret\n}", "title": "" }, { "docid": "f817abc6ac9d93ca5e74766fa382be82", "score": "0.57149917", "text": "func GetSecret(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SecretState, opts ...pulumi.ResourceOption) (*Secret, error) {\n\tvar resource Secret\n\terr := ctx.ReadResource(\"gcp:secretmanager/secret:Secret\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "d807865dbe6001ded579fbfd1f7b0200", "score": "0.57041806", "text": "func getSecretKey(d *schema.ResourceData) (string, bool, error) {\n\tconfigVal := d.Get(\"secret_key\").(string)\n\n\t// If config value is set to something else then empty string, just use it\n\tif configVal != \"\" {\n\t\treturn configVal, false, nil\n\t}\n\n\t// If config value is empty string, use environment variable\n\tobjectStorageName := d.Get(\"name\").(string)\n\tenvVarKey := generateObjectStorageEnvVarKey(secretKeyEnvVarPrefix, objectStorageName)\n\tenvVarValue, envVarSet := os.LookupEnv(envVarKey)\n\n\tif !envVarSet {\n\t\treturn \"\", false, fmt.Errorf(\"secret_key config field for object storage %s is set to empty string and environment variable %s is not set\", objectStorageName, envVarKey)\n\t}\n\n\tlength := len(envVarValue)\n\n\tif length < secretKeyMinLength {\n\t\treturn \"\", false, fmt.Errorf(\"secret_key set in environment variable %s is too short; minimum length is %d, got %d\", envVarKey, secretKeyMinLength, length)\n\t}\n\n\tif length > secretKeyMaxLength {\n\t\treturn \"\", false, fmt.Errorf(\"secret_key set in environment variable %s is too long; maximum length is %d, got %d\", envVarKey, secretKeyMaxLength, length)\n\t}\n\n\treturn envVarValue, true, nil\n}", "title": "" }, { "docid": "970cf17688bec8af7db2afa66ac97e2a", "score": "0.5703646", "text": "func GetConfig(clientID, clientSecret, redirectURL string) *Config {\n\treturn &Config{\n\t\tauthConfig: oauth2.Config{\n\t\t\tClientID: clientID,\n\t\t\tClientSecret: clientSecret,\n\t\t\tRedirectURL: redirectURL,\n\t\t\tScopes: Scopes,\n\t\t\tEndpoint: google.Endpoint,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "9ab023ba86c450e88b2c9b51bfb13e6e", "score": "0.57018304", "text": "func GetAuth(state, code string) (*models.PinterestOAuthResponse, error) {\n\n\tu := &url.URL{}\n\tu, _ = u.Parse(\"https://api.pinterest.com/v1/oauth/token\")\n\n\tq := u.Query()\n\tq.Add(\"grant_type\", \"authorization_code\")\n\tq.Add(\"client_id\", viper.GetString(\"app_id\"))\n\tq.Add(\"client_secret\", viper.GetString(\"app_secret\"))\n\tq.Add(\"code\", code)\n\n\tu.RawQuery = q.Encode()\n\n\tlog.WithField(\"url\", u.String()).Info(\"fetching token\")\n\n\tresponse, err := netClient.Post(u.String(), \"text/plain\", bytes.NewReader([]byte{}))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif response.StatusCode > 200 {\n\t\tif response.StatusCode == http.StatusTooManyRequests {\n\t\t\treturn nil, ErrAPIOverLimit\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Bad status getting token for user %d\", response.StatusCode)\n\t}\n\n\tdefer response.Body.Close()\n\n\toauth := &models.PinterestOAuthResponse{}\n\tjson.NewDecoder(response.Body).Decode(oauth)\n\n\treturn oauth, nil\n}", "title": "" }, { "docid": "9a37afc2b6aec958c49508738622871e", "score": "0.56965774", "text": "func (ad *AppData) Secret() string { return ad.appData.Secret }", "title": "" }, { "docid": "723c15dbd8a92727085969c6a0a84d26", "score": "0.5692574", "text": "func GetConfigSecretKey() (string, error) {\n\tkey := filepath.Join(Dir, \"config_secret_key\")\n\tif !fileExists(key) {\n\t\terr := setupConfigSecretKey(key)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tlogger.Debugf(\"Loading config key from %v\", key)\n\tdat, err := ioutil.ReadFile(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(dat), nil\n}", "title": "" }, { "docid": "67c778cecd3be9d745549719f9247598", "score": "0.5676911", "text": "func getGoogleSecret(secretName string) ([]byte, error) {\n\n\t// Initiate the Secrets Manager Client\n\tctx := context.Background()\n\tclient, err := secretmanager.NewClient(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Define the Secret Name\n\tsecretFullPath := \"projects/\" + projectNumber + \"/secrets/\" + secretName + \"/versions/latest\"\n\n\t// Build the request.\n\treq := &secretmanagerpb.AccessSecretVersionRequest{\n\t\tName: secretFullPath,\n\t}\n\n\t// Call the API.\n\tresult, err := client.AccessSecretVersion(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result.Payload.Data, nil\n\n}", "title": "" }, { "docid": "13e433dad270bbe54454035fb3f9490e", "score": "0.5675528", "text": "func getAuth(name string) Digest {\n\tvar auth Digest\n\tauthInput := os.Getenv(name)\n\tif authInput != \"\" {\n\t\taa := sha1.Sum([]byte(authInput))\n\t\tcopy(auth[:], aa[:])\n\t}\n\treturn auth\n}", "title": "" }, { "docid": "cc98278d41ad0a9938ac50369609ecae", "score": "0.5660396", "text": "func GetMemcachedServiceAuth(hostport string) (user, pwd string, err error) {\n\tif Default == nil {\n\t\treturn \"\", \"\", ErrNotInitialized\n\t}\n\treturn Default.GetMemcachedServiceAuth(hostport)\n}", "title": "" }, { "docid": "078ef5d1a781d2bd914fd5dcde8964cc", "score": "0.5653243", "text": "func GetSecret(\n\tnamespace string,\n\tsecretName string,\n) (*corev1.Secret, error) {\n\n\treturn secret.NewKubeClient(secret.WithNamespace(namespace)).Get(secretName, metav1.GetOptions{})\n}", "title": "" }, { "docid": "0a4302bb23340b5666805937581a5b06", "score": "0.5651167", "text": "func GetAuthURL(c *gin.Context) (string, error) {\n\n\tproviderName, err := GetProviderName(c)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tbase, err := goth.GetProvider(providerName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tprovider, _ := base.(goth.Provider)\n\tsess, err := provider.BeginAuth(GetState(c.Request))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\turl, err := sess.GetAuthURL()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsession, _ := Store.Get(c.Request, SessionName)\n\tsession.Values[SessionName] = sess.Marshal()\n\terr = session.Save(c.Request, c.Writer)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn url, err\n}", "title": "" }, { "docid": "b81cdda8b0c5a97ef0a58f052885a44f", "score": "0.56447554", "text": "func ReadAuth() (string, error) {\n\thomeDir := os.Getenv(\"HOME\")\n\tconfigFile := homeDir + \"/.cf/config.json\"\n\n\tcontent, err := ioutil.ReadFile(configFile)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar myConfig config\n\terr = json.Unmarshal(content, &myConfig)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn myConfig.AccessToken, nil\n\n}", "title": "" }, { "docid": "067c4dd8faaf13d936d022d2623f126a", "score": "0.5628597", "text": "func (g *Gopass) Get(ctx context.Context, name, revision string) (gopass.Secret, error) {\n\treturn g.rs.Get(ctx, name) //nolint:wrapcheck\n}", "title": "" }, { "docid": "0184dd7917cf1efaed3dd3773281c25f", "score": "0.5615799", "text": "func (s Server) getPrivateKey(namespace string, bearer string) ([]byte, error) {\n\tvar secret *corev1.Secret\n\tclient := &http.Client{Transport: s.APITransport, Timeout: 30 * time.Second}\n\n\tsecretURL := fmt.Sprintf(\"%s/api/v1/namespaces/%s/secrets/%s\", s.APIServerURL, namespace, JWTSecretName)\n\treq, err := http.NewRequest(\"GET\", secretURL, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", bearer))\n\tresp, err := client.Do(req)\n\tif err != nil || resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"fail to get secret: %v %+v\", resp.Status, err)\n\t}\n\n\tif err := json.NewDecoder(resp.Body).Decode(&secret); err != nil {\n\t\treturn nil, fmt.Errorf(\"fail to parse secret: %+v\", err)\n\t}\n\n\treturn secret.Data[JWTPrivateKeyFileName], nil\n}", "title": "" }, { "docid": "337372eded11c4bafc9155fdd90ce90f", "score": "0.5609482", "text": "func GetSecretAuthCredentials(secret *core.Secret) (string, string, error) {\n\tusername, found := secret.Data[constants.SecretUsername]\n\tif !found {\n\t\treturn \"\", \"\", errors.WithStack(errors.Newf(\"No '%s' found in secret '%s'\", constants.SecretUsername, secret.Name))\n\t}\n\tpassword, found := secret.Data[constants.SecretPassword]\n\tif !found {\n\t\treturn \"\", \"\", errors.WithStack(errors.Newf(\"No '%s' found in secret '%s'\", constants.SecretPassword, secret.Name))\n\t}\n\treturn string(username), string(password), nil\n}", "title": "" }, { "docid": "4e9435443a3a48b3d900f57af62577e8", "score": "0.5608632", "text": "func GetCredential() (*Credential, error) {\n\tc := Credential{}\n\n\tid, idOk := os.LookupEnv(\"BLIZZARD_API_CLIENT_ID\")\n\tif idOk == false {\n\t\treturn nil, errors.New(\"BLIZZARD_API_CLIENT_ID Environmental Variable is Unset\")\n\t}\n\tc.ID = id\n\n\tsecret, secretOk := os.LookupEnv(\"BLIZZARD_API_CLIENT_SECRET\")\n\tif secretOk == false {\n\t\treturn nil, errors.New(\"BLIZZARD_API_CLIENT_SECRET Environmental Variable is Unset\")\n\t}\n\tc.Secret = secret\n\n\treturn &c, nil\n}", "title": "" }, { "docid": "11b876d262c2e93ebacb3df8890bd13e", "score": "0.56083816", "text": "func (m *Machine) GetSecret(namespace string, name string) (*corev1.Secret, error) {\n\tsecret, err := m.Clientset.CoreV1().Secrets(namespace).Get(name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"waiting for secret \"+name)\n\t}\n\n\treturn secret, nil\n}", "title": "" }, { "docid": "d3217cbe842a9c37cebc35b24ef71d5a", "score": "0.5598638", "text": "func getK8sSecret(ctx context.Context, project, secretName string) (map[string]string, error) {\n\t// Find the location of the attach.sh shell script.\n\t_, filename, _, _ := runtime.Caller(0)\n\tattachFilename := filepath.Join(filepath.Dir(filename), \"../../attach.sh\")\n\n\t// Retrieve the secret.\n\tcmd := executil.CommandContext(ctx, attachFilename, project, \"kubectl\", \"get\", \"secret\", secretName, \"-o\", \"jsonpath={.data}\")\n\toutBytes, err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, skerr.Wrapf(err, \"output: %s\", string(outBytes))\n\t}\n\tout := strings.TrimSpace(string(outBytes))\n\t// Take only the last line of output, which contains the secret.\n\tsplit := strings.Split(out, \"\\n\")\n\tout = split[len(split)-1]\n\n\t// Decode the secret as JSON.\n\tvar b64 map[string]string\n\tif err := json.Unmarshal([]byte(out), &b64); err != nil {\n\t\treturn nil, skerr.Wrapf(err, \"failed to decode secret as JSON\")\n\t}\n\n\t// The keys are further encoded as base64. Decode.\n\trv := make(map[string]string, len(b64))\n\tfor key, b64Value := range b64 {\n\t\tvalue, err := base64.StdEncoding.DecodeString(b64Value)\n\t\tif err != nil {\n\t\t\treturn nil, skerr.Wrapf(err, \"failed to decode secret as base 64\")\n\t\t}\n\t\trv[key] = string(value)\n\t}\n\treturn rv, nil\n}", "title": "" }, { "docid": "396a35acf828087af95a294f35024cb5", "score": "0.5597891", "text": "func GetAuthBackendConfig(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *AuthBackendConfigState, opts ...pulumi.ResourceOption) (*AuthBackendConfig, error) {\n\tvar resource AuthBackendConfig\n\terr := ctx.ReadResource(\"vault:kubernetes/authBackendConfig:AuthBackendConfig\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "9dc0b1fcd4f943b7e11ac1542becca67", "score": "0.559747", "text": "func GetAuthInfo() {\n}", "title": "" }, { "docid": "760b1b6c02c9af15d1e01c002941c024", "score": "0.5591861", "text": "func (h *Helper) GetClientConfig(db *sql.DB, organisationID string) (*types.APIKeyConfig, error) {\n\tresult := types.APIKeyConfig{}\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "a5bd3e1e57e98a3f3147949830957888", "score": "0.5590393", "text": "func (c *Config) GetSPCredential(ctx context.Context) (*azidentity.ClientSecretCredential, error) {\n\tlog.G(ctx).Debug(\"getting token using service principal\")\n\topts := &azidentity.ClientSecretCredentialOptions{\n\t\tClientOptions: azcore.ClientOptions{\n\t\t\tCloud: c.Cloud,\n\t\t},\n\t}\n\tspCredential, err := azidentity.NewClientSecretCredential(c.AuthConfig.TenantID, c.AuthConfig.ClientID, c.AuthConfig.ClientSecret, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn spCredential, nil\n}", "title": "" }, { "docid": "79415e1fcfd921e34282f091e7f47aa5", "score": "0.5590156", "text": "func getAuth(token string, tokenFile string) (string, error) {\n\n\tif token != \"\" {\n\t\treturn token, nil\n\t} else if tokenFile != \"\" {\n\t\tb, err := ioutil.ReadFile(tokenFile)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn strings.TrimSpace(string(b)), err\n\n\t}\n\n\treturn \"\", nil\n}", "title": "" }, { "docid": "edf247737e4225f071b9fe605c64ca2f", "score": "0.5588674", "text": "func GetSecret(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SecretState, opts ...pulumi.ResourceOption) (*Secret, error) {\n\tvar resource Secret\n\terr := ctx.ReadResource(\"azure:keyvault/secret:Secret\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" } ]
e861705dacd2cb0f6f18a82ab3d74cff
A description of the process that generated the request.
[ { "docid": "b65bcd97e4add06a7f074c1412f74059", "score": "0.0", "text": "func (o EnvironmentResponseOutput) UserAgent() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v EnvironmentResponse) map[string]string { return v.UserAgent }).(pulumi.StringMapOutput)\n}", "title": "" } ]
[ { "docid": "2d6f7a553d6b4b7aa66393ae91701c97", "score": "0.63306236", "text": "func (*ProcessRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "222e2d0023cb51ed318aadc0125efaff", "score": "0.62104845", "text": "func (*ProcessInfo) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_types_task_task_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "3079a38148c0ffe5f3e5dea00ff3189a", "score": "0.60613865", "text": "func (*BatchProcessRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "f85d7bbb6b7fcbe9d69681ffbe183d5a", "score": "0.60410273", "text": "func (*ProcessingRequest) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "70e5b9291b1eb9234a4fef418170b583", "score": "0.60272515", "text": "func (*Process) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_types_task_task_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b08c949a5ec61a33ccaf5583226dbb8b", "score": "0.5949463", "text": "func (*ProcessResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "ef3b83bf43a7a470c15a96b895e29541", "score": "0.59299546", "text": "func (*GetProcessRequest) Descriptor() ([]byte, []int) {\n\treturn file_zeropsApiProtocol_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "ac325dc3d27fc9554c5374e188824cf9", "score": "0.58904815", "text": "func (*BatchProcessMetadata_IndividualProcessStatus) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{5, 0}\n}", "title": "" }, { "docid": "79b907c50a0a6920adef750efa01f907", "score": "0.5865918", "text": "func (p *DMReq) Process() (string, *GCP) {\n\tif p == nil {\n\t\treturn \"\", nil\n\t}\n\n\t// The RCP Top Level TLV for this message.\n\tvar g GCP\n\tg.DM = new(cmnd)\n\tg.DM.Command = strconv.Itoa(int(p.Command))\n\n\tjs, _ := json.MarshalIndent(g, \"\", \" \")\n\tdata := \"\\n\" + fmt.Sprintf(\"%s\\n\", js)\n\treturn fmt.Sprintf(`\n Transaction ID: %d\n Mode: %v\n Port: %d\n Channel: %d\n Command: %s`,\n\t\tp.TransactionID, p.Mode, p.Port, p.Channel, data), &g\n}", "title": "" }, { "docid": "91d9e7e3320f6aa87f6977ef838d28c9", "score": "0.5841066", "text": "func (*ProcessInfo) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "05c60fccbd73fb99ba29fffeab6269a4", "score": "0.58396316", "text": "func (p *Process) GetDescription() string {\n\tp.lock.RLock()\n\tdefer p.lock.RUnlock()\n\tif p.state == Running {\n\t\tseconds := int(time.Now().Sub(p.startTime).Seconds())\n\t\tminutes := seconds / 60\n\t\thours := minutes / 60\n\t\tdays := hours / 24\n\t\tif days > 0 {\n\t\t\treturn fmt.Sprintf(\"pid %d, uptime %d days, %d:%02d:%02d\", p.cmd.Process.Pid, days, hours%24, minutes%60, seconds%60)\n\t\t}\n\t\treturn fmt.Sprintf(\"pid %d, uptime %d:%02d:%02d\", p.cmd.Process.Pid, hours%24, minutes%60, seconds%60)\n\t} else if p.state != Stopped {\n\t\treturn p.stopTime.String()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "42a76ccfc276cc1e12a830bea4347fce", "score": "0.58354163", "text": "func (*GetExecutionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_service_proto_rawDescGZIP(), []int{39}\n}", "title": "" }, { "docid": "b708fec6091972c7bddfe3fdd25e096c", "score": "0.5820204", "text": "func (m *pipelinePatchRequest) Description() string {\n\treturn m.descriptionField\n}", "title": "" }, { "docid": "e6c414e97b57f0616d4f8dfc34b6213e", "score": "0.580239", "text": "func (p *PanicInformation) RequestDescription() string {\n\n\tif p.Request == nil {\n\t\treturn \"Request is nil\"\n\t}\n\n\tvar queryOutput string\n\n\tif p.Request.QueryArgs().Len() > 0 {\n\t\tqueryOutput = \"?\" + p.Request.QueryArgs().String()\n\t}\n\treturn fmt.Sprintf(\"%s %s%s\", p.Request.Method(), p.Request.Path(), queryOutput)\n}", "title": "" }, { "docid": "438cb57fe17c7f8b972b587a4bc7b162", "score": "0.5743661", "text": "func (*GetProcessorRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "b50bb71abba2d33c68acd8d795fc0e30", "score": "0.5733767", "text": "func (*BatchProcessResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "3381cfc7b1fb4b39ffd93dda067176c1", "score": "0.5704947", "text": "func (p *Process) ID() string {\n\treturn p.id\n}", "title": "" }, { "docid": "ed22299f8b907f243011eb3a34d142f2", "score": "0.5687829", "text": "func (*PredictProcessedRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_predictor_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "f249d39cabe80ab1b641a890d601de59", "score": "0.5684397", "text": "func (*StatusProcess) Descriptor() ([]byte, []int) {\n\treturn file_yousmb_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "5bc16e2aaee20af6a7b77b121ad8996a", "score": "0.568309", "text": "func (*SignalProcessRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "d976197ad7364e3e7087f0d028f2f59f", "score": "0.5679126", "text": "func (p *Process) Name() (string, error) {\n\treturn p.NameWithContext(context.Background())\n}", "title": "" }, { "docid": "c2ea66ae901659260bf43a0b3d38a080", "score": "0.5677982", "text": "func (*CreateProcessorRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "d71c2a25d05557dc08f44c2acb7d0770", "score": "0.5668035", "text": "func (*ProcessInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "7421c9998a6eec5f0fd69278144f3a9a", "score": "0.5663394", "text": "func (*ProcessStep) Descriptor() ([]byte, []int) {\n\treturn file_tck_action_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "7fdf7bcc712666ff89fa40d5555e6ae5", "score": "0.5660056", "text": "func (p Process) String() string {\n\treturn fmt.Sprintf(\"Protocol: '%s' | Program: '%s' | PID: '%d' | LocalAddr: '%s%s' | RemoteAddr: '%s%s' | State: '%s' | User: '%+v'\",\n\t\tp.Protocol,\n\t\tp.Program,\n\t\tp.PID,\n\t\tp.LocalIP,\n\t\tp.LocalPort,\n\t\tp.RemoteIP,\n\t\tp.RemotePort,\n\t\tp.State,\n\t\tp.User,\n\t)\n}", "title": "" }, { "docid": "35d9f38b35c2724c4f28376d448726f3", "score": "0.5630039", "text": "func (*GetProcessorVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "34e532abf53e4df794fe7858bcf34ce3", "score": "0.56290114", "text": "func (*CreateExecutionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_service_proto_rawDescGZIP(), []int{41}\n}", "title": "" }, { "docid": "f26b4c4c6b024aaf4a5fa425eae19c02", "score": "0.56273633", "text": "func (*WorkflowContextRequest) Descriptor() ([]byte, []int) {\n\treturn file_workflow_workflow_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "401f8730a4c7e995da006b19c580ba5e", "score": "0.56245714", "text": "func (*ProcessingResponse) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "c4ad0faa1eaed8a5f57372fd012e061b", "score": "0.5607304", "text": "func (*NodeExecutionRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_datasphere_v1_node_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "cbe6ee76a04e4cdad3f2297ff79b67c1", "score": "0.56052536", "text": "func GopherDescription(r *http.Request) string {\n\treturn ContextMap(r)[\"GopherDescription\"]\n}", "title": "" }, { "docid": "42cd33aa6c18ede6b03f16329f828f67", "score": "0.5600871", "text": "func (*WorkflowContextRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_workflow_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ce1df7f009aebc53ad0801da23db27c6", "score": "0.5587687", "text": "func (*RunRequest) Descriptor() ([]byte, []int) {\n\treturn file_pulumi_language_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "ffa1d78bd22dbfc35f814c004930f766", "score": "0.55854493", "text": "func Process(r *rpb.Request) (string, *rpb.Metadata, error) {\n\tcontext := &transformers.Context{}\n\n\tif err := validateUTF8ForHTML(r.Html); err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tif err := setDOM(context, r.Html); err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tif err := requireAMPAttribute(context.DOM, r.AllowedFormats); err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tfns := configMap[r.Config]\n\tif r.Config == rpb.Request_CUSTOM {\n\t\tfor _, val := range r.Transformers {\n\t\t\tfn, ok := transformerFunctionMap[strings.ToLower(val)]\n\t\t\tif !ok {\n\t\t\t\treturn \"\", nil, errors.Errorf(\"transformer doesn't exist: %s\", val)\n\t\t\t}\n\t\t\tfns = append(fns, fn)\n\t\t}\n\t}\n\n\tdocumentURL, err := url.Parse(r.DocumentUrl)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\tcontext.DocumentURL = documentURL\n\n\tcontext.Version = r.Version\n\tif r.Version == 0 {\n\t\tversion, err := SelectVersion(nil)\n\t\tif err != nil {\n\t\t\treturn \"\", nil, err\n\t\t}\n\t\tcontext.Version = version\n\t}\n\n\t// This must run AFTER DocumentURL is parsed.\n\tsetBaseURL(context)\n\n\tif err := runTransformers(context, fns); err != nil {\n\t\treturn \"\", nil, err\n\t}\n\t// extractPreloads is an implicit transformer, and must run before printer.\n\tpreloads := extractPreloads(context.DOM)\n\tvar o strings.Builder\n\tif err := printer.Print(&o, context.DOM.RootNode); err != nil {\n\t\treturn \"\", nil, err\n\t}\n\tmetadata := rpb.Metadata{\n\t\tPreloads: preloads,\n\t\tMaxAgeSecs: computeMaxAgeSeconds(context.DOM),\n\t}\n\treturn o.String(), &metadata, nil\n}", "title": "" }, { "docid": "276b5e5ed8cb69fd030f8be821ef832b", "score": "0.5584975", "text": "func (*GetExecutionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_workflows_executions_v1beta_executions_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "4619a7d39be511f5a15b048506e43eec", "score": "0.55721253", "text": "func (*GetProcessResponse) Descriptor() ([]byte, []int) {\n\treturn file_zeropsApiProtocol_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "0279bb7d1e5c78d19396b166cfb3b5d5", "score": "0.5570879", "text": "func (*WaitExecutionRequest) Descriptor() ([]byte, []int) {\n\treturn file_build_bazel_remote_execution_v2_remote_execution_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "c78323a2d014dd06084b3f1ab77e8eac", "score": "0.55698425", "text": "func (*DeployProcessorVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "74ff2f421181838f09bfdd1cefd64484", "score": "0.55625284", "text": "func (*ProcessRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_v1_archer_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "765fca914a8ac72e6007f30f1645311c", "score": "0.55498403", "text": "func (*GetWorkflowByUidRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_ingress_get_workflow_uid_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "1724ab40048b2d9715b6533c9d5aec24", "score": "0.55193466", "text": "func (*BatchProcessMetadata) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "aec20dd1bb27d36c92d758b86a120132", "score": "0.55139536", "text": "func (*UpdateWorkflowExecutionRequest) Descriptor() ([]byte, []int) {\n\treturn file_metadata_service_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "d36923c46933b4987e3b77d86f08f83a", "score": "0.5503077", "text": "func (*DebugReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{35}\n}", "title": "" }, { "docid": "d0e0495c21dfe72584dd839e39ce4bcf", "score": "0.55015665", "text": "func (*RequestMetadata) Descriptor() ([]byte, []int) {\n\treturn file_build_bazel_remote_execution_v2_remote_execution_proto_rawDescGZIP(), []int{44}\n}", "title": "" }, { "docid": "7ddcbf97053a595b39a9adf55bd19bfd", "score": "0.5489158", "text": "func (*GenerateProgramRequest) Descriptor() ([]byte, []int) {\n\treturn file_pulumi_language_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "633da45ab97dc75b915bb0dbae5553bc", "score": "0.5486838", "text": "func (*ListProcessorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "c335f1b647c40598db24188d80f0452a", "score": "0.5484578", "text": "func (*ReviewDocumentRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{36}\n}", "title": "" }, { "docid": "04d36c7d4986d17d08b7f942a57daff0", "score": "0.5478432", "text": "func (*ExecuteRequest) Descriptor() ([]byte, []int) {\n\treturn file_build_bazel_remote_execution_v2_remote_execution_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "783799abb253f4ee885f3faa553ea4e9", "score": "0.54477286", "text": "func (*AllocationWaitingRequest) Descriptor() ([]byte, []int) {\n\treturn file_determined_api_v1_task_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "177d7e3a1c85d61bc26eef9f883ce949", "score": "0.5417188", "text": "func (*DeployProcessorVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1_document_processor_service_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "53793e48a10fd6570fc1bcc13499f7c3", "score": "0.54166603", "text": "func describeRequest(r *request.Request) string {\n\tservice := r.ClientInfo.ServiceName\n\treturn service + \"::\" + operationName(r)\n}", "title": "" }, { "docid": "05bb3451c4f819bb9a5b2373c8e9d678", "score": "0.54157424", "text": "func (*ProcessGroup) Descriptor() ([]byte, []int) {\n\treturn file_tck_action_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "0a4baf948aa839fd0b9ded1210f5ab44", "score": "0.541207", "text": "func (*ReportInstanceInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_service_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "6d5b64eae47b768744462537ff7b75c1", "score": "0.5403091", "text": "func (Stat) Doc() string { return \"Linux process status information from /proc/*/stat\" }", "title": "" }, { "docid": "1bf0a31bc0ad406d3bc062671193a8c9", "score": "0.54014415", "text": "func (*Process) Descriptor() ([]byte, []int) {\n\treturn file_tarianpb_types_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "66822f2b55700ffd3f0eb5aad4b154af", "score": "0.539784", "text": "func (*RequestID) Descriptor() ([]byte, []int) {\n\treturn file_proto_product_product_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "dce55bfad1a47fd9ad707cb353a91de2", "score": "0.53804964", "text": "func (*RuntimeStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{38}\n}", "title": "" }, { "docid": "583793ccfb884fdea6d52d34278965e1", "score": "0.5376837", "text": "func (*TestResult_ExecutionInfo) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_java_com_google_devtools_build_lib_buildeventstream_proto_build_event_stream_proto_rawDescGZIP(), []int{18, 0}\n}", "title": "" }, { "docid": "4e3ad8900663f4bcd0aa644c1695fa19", "score": "0.53711635", "text": "func (*UpdateWorkflowExecutionStateRequest) Descriptor() ([]byte, []int) {\n\treturn file_metadata_service_proto_rawDescGZIP(), []int{27}\n}", "title": "" }, { "docid": "55b941434f318d2cc3aa3570e8a47c21", "score": "0.53705144", "text": "func (*GetProgramRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_sprinkler_to_server_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "da634e8cf1866c3fa29f415321ece79c", "score": "0.5368075", "text": "func (*GetTaskTrackingInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_fleetengine_delivery_v1_delivery_api_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "410751880a913c6761c104eaf7d3bcac", "score": "0.53660804", "text": "func (gw *get_worker) Process(request Request) string {\n\tval, found := gw.cache.Get(request.Key)\n\tmessage := _tab + _end\n\tif found {\n\t\treturn val.(string) + message\n\t} else {\n\t\treturn _notFound + message\n\t}\n}", "title": "" }, { "docid": "19653a10f9c753bf93de760d5e5e328f", "score": "0.5361504", "text": "func (*CreateExecutionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_workflows_executions_v1beta_executions_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b378244596fff39135df38c1e4f0b8f6", "score": "0.5355302", "text": "func (*WorkflowActionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_workflow_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "740776ac5f273e92b9cfa87c95c6a01c", "score": "0.5347321", "text": "func (*InfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_gadgettracermanager_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "0ae5d3fa23594e04e6305295453c1945", "score": "0.5346362", "text": "func (*StageRequest) Descriptor() ([]byte, []int) {\n\treturn file_ffs_rpc_rpc_proto_rawDescGZIP(), []int{60}\n}", "title": "" }, { "docid": "734d72cab661ac34bfb76cc42a53453f", "score": "0.5341937", "text": "func (self *ClientV2) ProcessInfo() (psInfo []info.ProcessInfo, err error) {\n\tu := self.processInfoUrl()\n\tvar ret []info.ProcessInfo\n\tif err = self.httpGetJsonData(&ret, nil, u, \"process info\"); err != nil {\n\t\tglog.Errorf(\"Error getting Json Data for process: %s\", err)\n\t\treturn\n\t}\n\tpsInfo = make([]info.ProcessInfo, 0, len(ret))\n\tfor _, cont := range ret {\n\t\tpsInfo = append(psInfo, cont)\n\t}\n\treturn\n}", "title": "" }, { "docid": "294b5de8f8ce35968451407309b507db", "score": "0.5335182", "text": "func (*PipelineTaskExecutorDetail_ContainerDetail) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_pipeline_job_proto_rawDescGZIP(), []int{4, 0}\n}", "title": "" }, { "docid": "eaeab01abedd4191ed7a94a2bde0844b", "score": "0.53348017", "text": "func (*ProcessStatus) Descriptor() ([]byte, []int) {\n\treturn file_pb_api_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "89a6f50fa1d08215f0e654bd19f27ec6", "score": "0.5331582", "text": "func (*WorkflowActionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_workflow_workflow_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "ae51b66d2ed257241bc757244c36e05f", "score": "0.53260463", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d70755ef75270f8dcefa07a52eba7c6c", "score": "0.5323858", "text": "func (*GetActionResultRequest) Descriptor() ([]byte, []int) {\n\treturn file_build_bazel_remote_execution_v2_remote_execution_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "6e126ddaa4d392fb537aff6a4da8b1b1", "score": "0.5322473", "text": "func (*CreateCommentRequest) Descriptor() ([]byte, []int) {\n\treturn file_registry_StageService_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "33d23cc353ae827663df674085be2e32", "score": "0.5322362", "text": "func (module *StaticHTTP) Description() string {\n\treturn Description\n}", "title": "" }, { "docid": "d55d054381577b3bf3bba7973ab44e8f", "score": "0.53186077", "text": "func (*InvocationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_api_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "3036e242d87d9c6f109defb89dc84b68", "score": "0.5317873", "text": "func (*ImmediateResponse) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "a9a158fcb8ea4fe1c2a396a689f2c38d", "score": "0.531654", "text": "func (*DiagnoseInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_service_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "75c6f7a5710c8cb6db31a7e9246ab209", "score": "0.5314398", "text": "func (*ReviewInterceptRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_manager_manager_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "c18c4d9df522eaede25ecd7005813611", "score": "0.53141963", "text": "func (*GetTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_task_reqmsgs_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "7b518f15b2106777877a917e6795a4a7", "score": "0.53098756", "text": "func (*Processor) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1beta3_processor_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "c5bf4a0a60be97ae8cfd9a055d0158d9", "score": "0.5309779", "text": "func (*ExecuteRoutineRequest) Descriptor() ([]byte, []int) {\n\treturn file_wilco_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "4cb37a1265295f9873d3248e4dad1116", "score": "0.5307079", "text": "func (master *Master) ProcInfo(proName string) map[string]string {\n\tproc := master.Procs[proName]\n\tprocDetailInfo := make(map[string]string)\n\tif proc != nil {\n\t\tprocStatus := proc.GetStatus()\n\t\tprocDetailInfo[\"pid\"] = fmt.Sprintf(\"%d\", proc.GetPid())\n\t\tprocDetailInfo[\"outFile\"] = proc.GetOutFile()\n\t\tprocDetailInfo[\"pidFile\"] = proc.GetPidFile()\n\t\tprocDetailInfo[\"errorFile\"] = proc.GetErrFile()\n\t\tprocDetailInfo[\"path\"] = proc.GetPath()\n\t\tprocDetailInfo[\"name\"] = proc.GetName()\n\t\tprocDetailInfo[\"uptime\"] = procStatus.Uptime\n\t\tprocDetailInfo[\"status\"] = procStatus.Status\n\t\tprocDetailInfo[\"restart\"] = fmt.Sprintf(\"%d\", procStatus.Restarts)\n\t}\n\n\treturn procDetailInfo\n}", "title": "" }, { "docid": "d43c973e7c68b5a5ad4163bb70895942", "score": "0.5306871", "text": "func (*QueryCtxImpl) ShowProcess() *util.ProcessInfo {\n\treturn nil\n}", "title": "" }, { "docid": "eaa470c2b552706b8af8c1bd9d0b29d0", "score": "0.5306622", "text": "func (*PageInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_module_v1_module_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "e0a24d653ea27c78ab1f7acff2309fa5", "score": "0.5305374", "text": "func (*ExecuteRequest) Descriptor() ([]byte, []int) {\n\treturn file_executor_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "af147d6527587a13969b5631e9694cc2", "score": "0.5301126", "text": "func (*PostPaymentRequest_Output) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{65, 0}\n}", "title": "" }, { "docid": "4ef5049166cc272627f1aa05b0a8f897", "score": "0.52967715", "text": "func (*ExecutePaymentRequest) Descriptor() ([]byte, []int) {\n\treturn file_payment_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "a02125d94c305c8a85779624af1dee3c", "score": "0.52718633", "text": "func (*SubmitRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_rpc_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "ad72ab6caa9e2ea9beab3711744eaa80", "score": "0.5270215", "text": "func (*ExecuteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "21d24aaf4c178dbf9ed7d9697508f5f6", "score": "0.526464", "text": "func (*CreateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_task_reqmsgs_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "358340691957a3dd898478177b18f042", "score": "0.5260105", "text": "func (*Task_ExecutionStatus) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_tasks_proto_rawDescGZIP(), []int{0, 5}\n}", "title": "" }, { "docid": "2be32ee757c216173a9b455175334f06", "score": "0.52582705", "text": "func (*ExecRequest) Descriptor() ([]byte, []int) {\n\treturn file_gitserver_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "df6a916b41f37cf9b427d4ceedddb1f6", "score": "0.52541894", "text": "func (x Args) ProcessName() string {\n\treturn filepath.Base(x[0])\n}", "title": "" }, { "docid": "714cbb4702020629d1c9a1194677b9a2", "score": "0.5254052", "text": "func (*GetWorkflowByUidResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_ingress_get_workflow_uid_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "02bfb8ed8189ea343bd432115999e7f9", "score": "0.52521974", "text": "func (*GenerateProgramResponse) Descriptor() ([]byte, []int) {\n\treturn file_pulumi_language_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "5c69b12531633db97762fa4a9f91f95f", "score": "0.5249195", "text": "func (p *Process) String() string {\n\treturn fmt.Sprintf(\"Name: %s, CPU: %d, Memory: %d\", p.Name, p.Runtime, p.Memory)\n}", "title": "" }, { "docid": "b568d36256a756e5488a32d65ba369bf", "score": "0.52435195", "text": "func (*PipelineTaskDetail) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_pipeline_job_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "c4023af437760eb083b9c83dc081863a", "score": "0.5243209", "text": "func (*ProcessResponse) Descriptor() ([]byte, []int) {\n\treturn file_router_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "905d1f49e344e5f947b8b02ad7fefb7a", "score": "0.5239748", "text": "func (*CreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_workflow_workflow_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "91dfa3a9e8605ad2c044d0b3efc1b8b2", "score": "0.5239639", "text": "func (*UpdateWorkflowExecutionEndTimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_metadata_service_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "ec1ecceddcaa784d8f368a3529573400", "score": "0.52386236", "text": "func (*RunRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_runner_runner_proto_rawDescGZIP(), []int{0}\n}", "title": "" } ]
9d7af509d57fab2bc96d3f01c87c9fab
patchProjectWebhook updates a projectWebhook by ID. Returns the new state of the projectWebhook after update.
[ { "docid": "375dd4370fa5243cb5564b3c3687e507", "score": "0.7528646", "text": "func patchProjectWebhook(ctx context.Context, tx *Tx, patch *api.ProjectWebhookPatch) (*api.ProjectWebhook, error) {\n\t// Build UPDATE clause.\n\tset, args := []string{\"updater_id = ?\"}, []interface{}{patch.UpdaterId}\n\tif v := patch.Name; v != nil {\n\t\tset, args = append(set, \"name = ?\"), append(args, *v)\n\t}\n\tif v := patch.URL; v != nil {\n\t\tset, args = append(set, \"url = ?\"), append(args, *v)\n\t}\n\tif v := patch.ActivityList; v != nil {\n\t\tset, args = append(set, \"activity_list = ?\"), append(args, *v)\n\t}\n\n\targs = append(args, patch.ID)\n\n\t// Execute update query with RETURNING.\n\trow, err := tx.QueryContext(ctx, `\n\t\tUPDATE project_webhook\n\t\tSET `+strings.Join(set, \", \")+`\n\t\tWHERE id = ?\n\t\tRETURNING id, creator_id, created_ts, updater_id, updated_ts, project_id, type, name, url, activity_list\n\t`,\n\t\targs...,\n\t)\n\tif err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\tdefer row.Close()\n\n\tif row.Next() {\n\t\tvar projectWebhook api.ProjectWebhook\n\t\tvar activityList string\n\t\tif err := row.Scan(\n\t\t\t&projectWebhook.ID,\n\t\t\t&projectWebhook.CreatorId,\n\t\t\t&projectWebhook.CreatedTs,\n\t\t\t&projectWebhook.UpdaterId,\n\t\t\t&projectWebhook.UpdatedTs,\n\t\t\t&projectWebhook.ProjectId,\n\t\t\t&projectWebhook.Type,\n\t\t\t&projectWebhook.Name,\n\t\t\t&projectWebhook.URL,\n\t\t\t&activityList,\n\t\t); err != nil {\n\t\t\treturn nil, FormatError(err)\n\t\t}\n\t\tprojectWebhook.ActivityList = strings.Split(activityList, \",\")\n\n\t\treturn &projectWebhook, nil\n\t}\n\n\treturn nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf(\"project hook ID not found: %d\", patch.ID)}\n}", "title": "" } ]
[ { "docid": "9011382db26a4d40f605be9b3761be87", "score": "0.78505695", "text": "func (s *ProjectWebhookService) PatchProjectWebhook(ctx context.Context, patch *api.ProjectWebhookPatch) (*api.ProjectWebhook, error) {\n\ttx, err := s.db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\tdefer tx.Rollback()\n\n\tprojectWebhook, err := patchProjectWebhook(ctx, tx, patch)\n\tif err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\n\tif err := tx.Commit(); err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\n\treturn projectWebhook, nil\n}", "title": "" }, { "docid": "7c89598bcb44ea4526d5b2c0e3d38bd7", "score": "0.5967723", "text": "func (c *webhookClient) Get(hookID int) (*gitlab.ProjectHook, error) {\n\thook, _, err := c.cli.Projects.GetProjectHook(c.projectName, hookID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting webhook from project %q: %w\", c.projectName, err)\n\t}\n\n\treturn hook, nil\n}", "title": "" }, { "docid": "810c852186612a1389a22791af247017", "score": "0.57682204", "text": "func (g *Gitlab) ProjectHook(id string, hook_id int) (*Hook, error) {\n\thook := new(Hook)\n\turl, opaque := g.ResourceUrlRaw(project_url_hook, map[string]string{\n\t\t\":id\": id,\n\t\t\":hook_id\": strconv.Itoa(hook_id),\n\t})\n\n\tcontents, err := g.buildAndExecRequestRaw(\"GET\", url, opaque, nil)\n\tif err != nil {\n\t\treturn hook, err\n\t}\n\n\terr = json.Unmarshal(contents, &hook)\n\n\treturn hook, err\n}", "title": "" }, { "docid": "49544d98a265f0573d425c537938561f", "score": "0.57323164", "text": "func (g *Gitlab) EditProjectHook(id string, hook *Hook) error {\n\turl, opaque := g.ResourceUrlRaw(project_url_hook, map[string]string{\n\t\t\":id\": id,\n\t\t\":hook_id\": strconv.Itoa(hook.ID),\n\t})\n\n\tbody := buildHookQuery(hook)\n\t_, err := g.buildAndExecRequestRaw(\"PUT\", url, opaque, []byte(body))\n\n\treturn err\n}", "title": "" }, { "docid": "122fc5def020f7a868bac4f3b3da9c11", "score": "0.56207824", "text": "func (c *FakeWorkflowTriggers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.WorkflowTrigger, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(workflowtriggersResource, c.ns, name, pt, data, subresources...), &v1alpha1.WorkflowTrigger{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.WorkflowTrigger), err\n}", "title": "" }, { "docid": "f6f09a9c2f6ae4228cfdc7cc03260193", "score": "0.5617172", "text": "func (c *gitlabClient) UpdateHook(ctx context.Context, repo string, hook *sdk.VCSHook) error {\n\tgitlabHook, err := c.GetHookByID(ctx, repo, hook.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\turl := c.buildUrlWithProxy(hook.URL)\n\n\tvar pushEvent, mergeRequestEvent, TagPushEvent, issueEvent, noteEvent, wikiPageEvent, pipelineEvent, jobEvent bool\n\tif len(hook.Events) == 0 {\n\t\thook.Events = sdk.GitlabEventsDefault\n\t}\n\n\tfor _, e := range hook.Events {\n\t\tswitch gitlab.EventType(e) {\n\t\tcase gitlab.EventTypePush:\n\t\t\tpushEvent = true\n\t\tcase gitlab.EventTypeTagPush:\n\t\t\tTagPushEvent = true\n\t\tcase gitlab.EventTypeIssue:\n\t\t\tissueEvent = true\n\t\tcase gitlab.EventTypeNote:\n\t\t\tnoteEvent = true\n\t\tcase gitlab.EventTypeMergeRequest:\n\t\t\tmergeRequestEvent = true\n\t\tcase gitlab.EventTypeWikiPage:\n\t\t\twikiPageEvent = true\n\t\tcase gitlab.EventTypePipeline:\n\t\t\tpipelineEvent = true\n\t\tcase \"Job Hook\": // TODO update gitlab sdk\n\t\t\tjobEvent = true\n\t\t}\n\t}\n\n\topt := gitlab.EditProjectHookOptions{\n\t\tURL: &url,\n\t\tPushEvents: &pushEvent,\n\t\tMergeRequestsEvents: &mergeRequestEvent,\n\t\tTagPushEvents: &TagPushEvent,\n\t\tIssuesEvents: &issueEvent,\n\t\tWikiPageEvents: &wikiPageEvent,\n\t\tNoteEvents: &noteEvent,\n\t\tPipelineEvents: &pipelineEvent,\n\t\tJobEvents: &jobEvent,\n\t\tEnableSSLVerification: &gitlabHook.EnableSSLVerification,\n\t\tConfidentialIssuesEvents: &gitlabHook.ConfidentialIssuesEvents,\n\t}\n\n\tlog.Debug(ctx, \"GitlabClient.UpdateHook: %s %s\", repo, *opt.URL)\n\t_, resp, err := c.client.Projects.EditProjectHook(repo, gitlabHook.ID, &opt)\n\tif err != nil {\n\t\treturn sdk.WrapError(err, \"cannot update gitlab project hook %s\", hook.ID)\n\t}\n\tif resp.StatusCode >= 400 {\n\t\treturn sdk.WithStack(fmt.Errorf(\"cannot update hook. Http %d, Repo %s, hook %+v\", resp.StatusCode, repo, opt))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4c2d7741e8bfbf68cc258c5f14932692", "score": "0.5584522", "text": "func (c *webhookClient) Edit(hookID int, eventTypes []string, webhookURL *apis.URL, tls bool) error {\n\tenabled, disabled := true, false\n\n\thookOptions := gitlab.EditProjectHookOptions{\n\t\tURL: gitlab.String(webhookURL.String()),\n\t\tEnableSSLVerification: &tls,\n\t\tToken: c.secretToken,\n\n\t\tConfidentialIssuesEvents: &disabled,\n\t\tConfidentialNoteEvents: &disabled,\n\t\tIssuesEvents: &disabled,\n\t\tJobEvents: &disabled,\n\t\tMergeRequestsEvents: &disabled,\n\t\tNoteEvents: &disabled,\n\t\tPipelineEvents: &disabled,\n\t\tPushEvents: &disabled,\n\t\tTagPushEvents: &disabled,\n\t\tWikiPageEvents: &disabled,\n\t}\n\n\tfor _, eventType := range eventTypes {\n\t\tswitch eventType {\n\t\tcase v1alpha1.GitLabWebhookConfidentialIssues:\n\t\t\thookOptions.ConfidentialIssuesEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookConfidentialNote:\n\t\t\thookOptions.ConfidentialNoteEvents = &enabled\n\t\t// NOTE(antoineco): not supported in this version of xanzy/go-gitlab (v0.39.0)\n\t\t//case v1alpha1.GitLabWebhookDeployment:\n\t\t//\thookOptions.DeploymentEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookIssues:\n\t\t\thookOptions.IssuesEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookJob:\n\t\t\thookOptions.JobEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookMergeRequests:\n\t\t\thookOptions.MergeRequestsEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookNote:\n\t\t\thookOptions.NoteEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookPipeline:\n\t\t\thookOptions.PipelineEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookPush:\n\t\t\thookOptions.PushEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookTagPush:\n\t\t\thookOptions.TagPushEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookWikiPage:\n\t\t\thookOptions.WikiPageEvents = &enabled\n\t\t}\n\t}\n\n\tif _, _, err := c.cli.Projects.EditProjectHook(c.projectName, hookID, &hookOptions); err != nil {\n\t\treturn fmt.Errorf(\"editing webhook in project %q: %w\", c.projectName, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1ed5a9d5b220647adb43b9b5758c867f", "score": "0.5516065", "text": "func deleteProjectWebhook(ctx context.Context, tx *Tx, delete *api.ProjectWebhookDelete) error {\n\t// Remove row from database.\n\tresult, err := tx.ExecContext(ctx, `DELETE FROM project_webhook WHERE id = ?`, delete.ID)\n\tif err != nil {\n\t\treturn FormatError(err)\n\t}\n\n\trows, _ := result.RowsAffected()\n\tif rows == 0 {\n\t\treturn &common.Error{Code: common.NotFound, Err: fmt.Errorf(\"project hook ID not found: %d\", delete.ID)}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eb0a55ddb0bac5f18c1743d9865c38a6", "score": "0.54745", "text": "func (s *ProjectWebhookService) FindProjectWebhook(ctx context.Context, find *api.ProjectWebhookFind) (*api.ProjectWebhook, error) {\n\ttx, err := s.db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\tdefer tx.Rollback()\n\n\tlist, err := findProjectWebhookList(ctx, tx, find)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if len(list) == 0 {\n\t\treturn nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf(\"project hook not found: %+v\", find)}\n\t} else if len(list) > 1 {\n\t\treturn nil, &common.Error{Code: common.Conflict, Err: fmt.Errorf(\"found %d project hooks with filter %+v, expect 1\", len(list), find)}\n\t}\n\treturn list[0], nil\n}", "title": "" }, { "docid": "1a3443b20ddeb961aaff3f8462cfcbc0", "score": "0.5397531", "text": "func (repo *Repository) UpdateWebhook(id uuid.UUID, args repository.UpdateWebhookArgs) error {\n\tif id == uuid.Nil {\n\t\treturn repository.ErrNilID\n\t}\n\tvar (\n\t\tw model.WebhookBot\n\t\tupdated bool\n\t\tuserUpdated bool\n\t)\n\terr := repo.db.Transaction(func(tx *gorm.DB) error {\n\t\tif err := tx.Where(&model.WebhookBot{ID: id}).First(&w).Error; err != nil {\n\t\t\treturn convertError(err)\n\t\t}\n\n\t\tchanges := map[string]interface{}{}\n\t\tif args.Description.Valid {\n\t\t\tchanges[\"description\"] = args.Description.V\n\t\t}\n\t\tif args.ChannelID.Valid {\n\t\t\t// チャンネル検証\n\t\t\tvar ch model.Channel\n\t\t\tif err := tx.First(&ch, &model.Channel{ID: args.ChannelID.V}).Error; err != nil {\n\t\t\t\tif err == gorm.ErrRecordNotFound {\n\t\t\t\t\treturn repository.ArgError(\"args.ChannelID\", \"the Channel is not found\")\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !ch.IsPublic {\n\t\t\t\treturn repository.ArgError(\"args.ChannelID\", \"private channels are not allowed\")\n\t\t\t}\n\n\t\t\tchanges[\"channel_id\"] = args.ChannelID.V\n\t\t}\n\t\tif args.Secret.Valid {\n\t\t\tchanges[\"secret\"] = args.Secret.V\n\t\t}\n\t\tif args.CreatorID.Valid {\n\t\t\t// 作成者検証\n\t\t\tuser, err := repo.GetUser(args.CreatorID.V, false)\n\t\t\tif err != nil {\n\t\t\t\tif err == repository.ErrNotFound {\n\t\t\t\t\treturn repository.ArgError(\"args.CreatorID\", \"the Creator is not found\")\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !user.IsActive() || user.IsBot() {\n\t\t\t\treturn repository.ArgError(\"args.CreatorID\", \"invalid User\")\n\t\t\t}\n\n\t\t\tchanges[\"creator_id\"] = args.CreatorID.V\n\t\t}\n\t\tif len(changes) > 0 {\n\t\t\tif err := tx.Model(&model.WebhookBot{ID: id}).Updates(changes).Error; err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tupdated = true\n\t\t}\n\n\t\tif args.Name.Valid {\n\t\t\tif len(args.Name.V) == 0 || utf8.RuneCountInString(args.Name.V) > 32 {\n\t\t\t\treturn repository.ArgError(\"args.Name\", \"Name must be non-empty and shorter than 33 characters\")\n\t\t\t}\n\n\t\t\tif err := tx.Model(&model.User{ID: w.BotUserID}).Update(\"display_name\", args.Name.V).Error; err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tuserUpdated = true\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif userUpdated {\n\t\trepo.hub.Publish(hub.Message{\n\t\t\tName: event.UserUpdated,\n\t\t\tFields: hub.Fields{\n\t\t\t\t\"user_id\": w.BotUserID,\n\t\t\t},\n\t\t})\n\t}\n\tif updated || userUpdated {\n\t\trepo.hub.Publish(hub.Message{\n\t\t\tName: event.WebhookUpdated,\n\t\t\tFields: hub.Fields{\n\t\t\t\t\"webhook_id\": w.ID,\n\t\t\t},\n\t\t})\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e184fe58460c0021160ce454e929bc4e", "score": "0.5342996", "text": "func (c *Core) UpdateWebhook(p WebhookUpdateParam) (*Webhook, error) {\n\tif err := p.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Check webhook ownership.\n\twh, err := c.Webhook(WebhookFilter{ID: p.ID, UserID: p.UserID})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif wh == nil {\n\t\treturn nil, WebhookErrNotFound\n\t}\n\n\tif p.PayloadURL != wh.PayloadURL {\n\t\tif _, err = c.testWebhookPayloadURL(p.PayloadURL); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Update webhook record.\n\twh = &Webhook{\n\t\tID: p.ID,\n\t\tPayloadURL: p.PayloadURL,\n\t\tSecret: p.Secret,\n\t\tActive: p.Active,\n\t}\n\tif err = c.store.Update(wh); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn wh, nil\n}", "title": "" }, { "docid": "ac0efb4eeb3af2fa33c30ed12154b577", "score": "0.52310294", "text": "func (c *WebhooksClient) Update(webhookID string, webhookMetadata *WebhookMetadata) (*WebhookResource, error) {\n\tupdateRequestData := &WebhookWriteRequest{Metadata: *webhookMetadata}\n\twebhook := &WebhookResource{}\n\tpath := fmt.Sprintf(\"/v2/webhooks/%s\", webhookID)\n\terr := c.v2Client.Request(http.MethodPatch, path, webhook, updateRequestData, nil)\n\treturn webhook, err\n}", "title": "" }, { "docid": "bb7212238aad7fa1e2355b46272100e3", "score": "0.5213472", "text": "func (e *Eventer) projectHook() ent.Hook {\n\tchain := hook.NewChain(\n\t\te.projectAddedHook(),\n\t\te.projectChangedHook(),\n\t\te.projectBlockUpdateStatusOfManyHook(),\n\t)\n\treturn chain.Hook()\n}", "title": "" }, { "docid": "1d48d573624e45640d0e99e6f239cdee", "score": "0.5199593", "text": "func (s *ProjectWebhookService) DeleteProjectWebhook(ctx context.Context, delete *api.ProjectWebhookDelete) error {\n\ttx, err := s.db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn FormatError(err)\n\t}\n\tdefer tx.Rollback()\n\n\terr = deleteProjectWebhook(ctx, tx, delete)\n\tif err != nil {\n\t\treturn FormatError(err)\n\t}\n\n\tif err := tx.Commit(); err != nil {\n\t\treturn FormatError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5df0328170de718b42fb4ca737b339c3", "score": "0.5163327", "text": "func (c *BeaconsUpdateCall) ProjectId(projectId string) *BeaconsUpdateCall {\n\tc.urlParams_.Set(\"projectId\", projectId)\n\treturn c\n}", "title": "" }, { "docid": "362dc4f0cbf38902a60f705ce46b40c3", "score": "0.5146483", "text": "func (fr *functionResource) Patch(request *http.Request, id string) error {\n\n\t// get the desired state of the function from the request body\n\tpatchOptionsInstance, err := fr.getPatchFunctionOptionsFromRequest(request)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to get patch options\")\n\t}\n\n\t// get the authentication configuration for the request\n\tauthConfig, err := fr.getRequestAuthConfig(request)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to get auth config\")\n\t}\n\n\tif patchOptionsInstance.DesiredState != nil {\n\t\treturn fr.patchFunctionDesiredState(request, id, patchOptionsInstance, authConfig)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3388a088a8676b672a0482fac6e19734", "score": "0.50940335", "text": "func (c *messagingProjects) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.MessagingProject, err error) {\n\tresult = &v1.MessagingProject{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"messagingprojects\").\n\t\tSubResource(subresources...).\n\t\tName(name).\n\t\tBody(data).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "03215391b0ffb5d07224eb7b8a9d0b56", "score": "0.5071742", "text": "func (a *FormsTokenApiService) PATCHProjectsApiV3FormsformIdTokenJson(ctx _context.Context, formId int32) ApiPATCHProjectsApiV3FormsformIdTokenJsonRequest {\n\treturn ApiPATCHProjectsApiV3FormsformIdTokenJsonRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tformId: formId,\n\t}\n}", "title": "" }, { "docid": "27bff2e27a3f9b9aa14b66b490fb2208", "score": "0.50378156", "text": "func (c *webhookClient) Delete(hookID int) error {\n\tif _, err := c.cli.Projects.DeleteProjectHook(c.projectName, hookID); err != nil {\n\t\treturn fmt.Errorf(\"deleting webhook from project %q: %w\", c.projectName, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "972d4c0efbdfe0a9e93f10d9232bcbe4", "score": "0.50211906", "text": "func (c *WebhookServiceImpl) Update(id string, newItem *domain.Webhook) (*domain.Webhook, error) {\n\titem, err := c.Repository.FindOne(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif item == nil {\n\t\treturn nil, errors.New(\"item not found\")\n\t}\n\n\titem.Name = newItem.Name\n\titem.Description = newItem.Description\n\titem.Condition = newItem.Condition\n\titem.DeployConfig = newItem.DeployConfig\n\titem.UpdatedAt = time.Now()\n\treturn c.Repository.Save(item)\n}", "title": "" }, { "docid": "b29b0feef85d41b95699ad0042ee55f6", "score": "0.49807146", "text": "func (o *PatchBuildFileParams) WithID(id int32) *PatchBuildFileParams {\n\to.SetID(id)\n\treturn o\n}", "title": "" }, { "docid": "02b5b416afa48f871fab489be53ad349", "score": "0.49726522", "text": "func (w *WebhookCertPatcher) webhookPatchTask(o types.NamespacedName) error {\n\treportWebhookPatchAttempts(o.Name)\n\terr := w.patchMutatingWebhookConfig(o.Name)\n\n\t// do not want to retry the task if these errors occur, they indicate that\n\t// we should no longer be patching the given webhook\n\tif kerrors.IsNotFound(err) || errors.Is(err, errWrongRevision) || errors.Is(err, errNoWebhookWithName) || errors.Is(err, errNotFound) {\n\t\treturn nil\n\t}\n\n\tif err != nil {\n\t\tlog.Errorf(\"patching webhook %s failed: %v\", o.Name, err)\n\t\treportWebhookPatchRetry(o.Name)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "1b9c193e8802cb72b4f86b8d84daff99", "score": "0.4961745", "text": "func (g *gitlab) NewProjectHook(user *UserInfo, projectID interface{}, webhookOptions *AddWebhookOptions) (*WebhookInfo, error) {\n\tclient, err := g.gitlabConnect(*user.Token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprojectHookOptions := internGitlab.AddProjectHookOptions{\n\t\tURL: &webhookOptions.URL,\n\t\tConfidentialNoteEvents: &webhookOptions.ConfidentialNoteEvents,\n\t\tPushEvents: &webhookOptions.PushEvents,\n\t\tIssuesEvents: &webhookOptions.IssuesEvents,\n\t\tConfidentialIssuesEvents: &webhookOptions.ConfidentialIssuesEvents,\n\t\tMergeRequestsEvents: &webhookOptions.MergeRequestsEvents,\n\t\tTagPushEvents: &webhookOptions.TagPushEvents,\n\t\tNoteEvents: &webhookOptions.NoteEvents,\n\t\tJobEvents: &webhookOptions.JobEvents,\n\t\tPipelineEvents: &webhookOptions.PipelineEvents,\n\t\tWikiPageEvents: &webhookOptions.WikiPageEvents,\n\t\tEnableSSLVerification: &webhookOptions.EnableSSLVerification,\n\t\tToken: &webhookOptions.Token,\n\t}\n\n\tprojectHook, _, err := client.Projects.AddProjectHook(projectID, &projectHookOptions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprojectHookInfo := getProjectHookInfo(projectHook)\n\n\treturn projectHookInfo, nil\n}", "title": "" }, { "docid": "7b730eecefd151eac8752b36caf67da0", "score": "0.49574617", "text": "func NewPatchWebhookOK() *PatchWebhookOK {\n\treturn &PatchWebhookOK{}\n}", "title": "" }, { "docid": "892bc2ed39f79cc61b6605182c537ed9", "score": "0.49292073", "text": "func (gp GitLabProvider) CreateOrUpdateProjectHook(pid int, hookURL string) (*ProjectHook, error) {\n\tvar result *gitlab.ProjectHook\n\n\tlistOptions := &gitlab.ListProjectHooksOptions{\n\t\tListOptions: gitlab.ListOptions{\n\t\t\tPerPage: 100,\n\t\t},\n\t}\n\n\tfor i := 1; ; i++ {\n\t\tlistOptions.Page = i\n\n\t\thooks, _, err := gp.client.Projects.ListProjectHooks(pid, listOptions)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif len(hooks) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tfor _, hook := range hooks {\n\t\t\tif hook.URL != hookURL {\n\t\t\t\tgp.client.Projects.DeleteProjectHook(pid, hook.ID)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tresult = hook\n\t\t}\n\t}\n\n\tif result == nil {\n\t\taddOptions := &gitlab.AddProjectHookOptions{\n\t\t\tURL: hookURL,\n\t\t\tPushEvents: true,\n\t\t\tMergeRequestsEvents: true,\n\t\t}\n\n\t\tvar err error\n\t\tresult, _, err = gp.client.Projects.AddProjectHook(pid, addOptions)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn mapToProjectHook(result), nil\n}", "title": "" }, { "docid": "01dadd4652168ed26deb2ccfa744f688", "score": "0.49143383", "text": "func invokeWebHook(id int) {\n\tHooks := getWebHooks(&Credentials)\n\n\tfor i := range Hooks {\n\t\tHooks[i].NewTracks++\n\t\tif Hooks[i].NewTracks%Hooks[i].MinTriggerValue == 0 {\n\t\t\t//Post and update webhook with last used id\n\t\t\tpostWebHook(&Hooks[i], id)\n\t\t\tHooks[i].LastTrackID = id\n\t\t\tupdateWebhook(&Hooks[i], &Credentials)\n\t\t} else {\n\t\t\t//Just update the webhook without altering lastTrackID\n\t\t\tupdateWebhook(&Hooks[i], &Credentials)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "500037e166e5079fb377e12bd0f9e3b5", "score": "0.49095672", "text": "func (r *ProjectsHistoriesExecutionsStepsService) Patch(projectId string, historyId string, executionId string, stepId string, step *Step) *ProjectsHistoriesExecutionsStepsPatchCall {\n\tc := &ProjectsHistoriesExecutionsStepsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.projectId = projectId\n\tc.historyId = historyId\n\tc.executionId = executionId\n\tc.stepId = stepId\n\tc.step = step\n\treturn c\n}", "title": "" }, { "docid": "3b0ea68ef0560a2216d0e8b660be3a3e", "score": "0.48526287", "text": "func NewPatchWebhookNotFound() *PatchWebhookNotFound {\n\treturn &PatchWebhookNotFound{}\n}", "title": "" }, { "docid": "54e5167f9674fd94c18cf3162ac9e3c0", "score": "0.48373422", "text": "func (g *Gitlab) ProjectHooks(id string) ([]*Hook, error) {\n\tvar hooks []*Hook\n\n\turl, opaque := g.ResourceUrlRaw(project_url_hooks, map[string]string{\":id\": id})\n\n\tcontents, err := g.buildAndExecRequestRaw(\"GET\", url, opaque, nil)\n\tif err != nil {\n\t\treturn hooks, err\n\t}\n\n\terr = json.Unmarshal(contents, &hooks)\n\n\treturn hooks, err\n}", "title": "" }, { "docid": "0fac5573a3aef91397f097c6dfd6daa0", "score": "0.47797903", "text": "func (c *FakeWorkflows) PatchUpdate(app *v1.Workflow) (*v1.Workflow, error) {\n\treturn c.Update(app)\n}", "title": "" }, { "docid": "777081c5d43edd83917836a92546be6d", "score": "0.4771175", "text": "func NewProjectWebhookService(logger *zap.Logger, db *DB) *ProjectWebhookService {\n\treturn &ProjectWebhookService{l: logger, db: db}\n}", "title": "" }, { "docid": "fed8110682fa4a5911cf78485e0e4429", "score": "0.47694764", "text": "func (w *WebhookCertPatcher) patchMutatingWebhookConfig(webhookConfigName string) error {\n\tconfig := w.webhooks.Get(webhookConfigName, \"\")\n\tif config == nil {\n\t\treportWebhookPatchFailure(webhookConfigName, reasonWebhookConfigNotFound)\n\t\treturn errNotFound\n\t}\n\t// prevents a race condition between multiple istiods when the revision is changed or modified\n\tv, ok := config.Labels[label.IoIstioRev.Name]\n\tif v != w.revision || !ok {\n\t\treportWebhookPatchFailure(webhookConfigName, reasonWrongRevision)\n\t\treturn errWrongRevision\n\t}\n\n\tfound := false\n\tupdated := false\n\tcaCertPem, err := util.LoadCABundle(w.CABundleWatcher)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to load CA bundle: %v\", err)\n\t\treportWebhookPatchFailure(webhookConfigName, reasonLoadCABundleFailure)\n\t\treturn err\n\t}\n\tfor i, wh := range config.Webhooks {\n\t\tif strings.HasSuffix(wh.Name, w.webhookName) {\n\t\t\tif !bytes.Equal(caCertPem, config.Webhooks[i].ClientConfig.CABundle) {\n\t\t\t\tupdated = true\n\t\t\t}\n\t\t\tconfig.Webhooks[i].ClientConfig.CABundle = caCertPem\n\t\t\tfound = true\n\t\t}\n\t}\n\tif !found {\n\t\treportWebhookPatchFailure(webhookConfigName, reasonWebhookEntryNotFound)\n\t\treturn errNoWebhookWithName\n\t}\n\n\tif updated {\n\t\t_, err := w.webhooks.Update(config)\n\t\tif err != nil {\n\t\t\treportWebhookPatchFailure(webhookConfigName, reasonWebhookUpdateFailure)\n\t\t}\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "76910b590a37281ef4a176df24131b97", "score": "0.47659674", "text": "func (a *TagsApiService) PATCHProjectsApiV3TagstagIdJson(ctx _context.Context, tagId int32) ApiPATCHProjectsApiV3TagstagIdJsonRequest {\n\treturn ApiPATCHProjectsApiV3TagstagIdJsonRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\ttagId: tagId,\n\t}\n}", "title": "" }, { "docid": "acb699f94fee816efe80868e39248c86", "score": "0.47642478", "text": "func createProjectWebhook(ctx context.Context, tx *Tx, create *api.ProjectWebhookCreate) (*api.ProjectWebhook, error) {\n\t// Insert row into database.\n\trow, err := tx.QueryContext(ctx, `\n\t\tINSERT INTO project_webhook (\n\t\t\tcreator_id,\n\t\t\tupdater_id,\n\t\t\tproject_id,\n\t\t\ttype,\n\t\t\tname,\n\t\t\turl,\n\t\t\tactivity_list\n\t\t)\n\t\tVALUES (?, ?, ?, ?, ?, ?, ?)\n\t\tRETURNING id, creator_id, created_ts, updater_id, updated_ts, project_id, type, name, url, activity_list\n\t`,\n\t\tcreate.CreatorId,\n\t\tcreate.CreatorId,\n\t\tcreate.ProjectId,\n\t\tcreate.Type,\n\t\tcreate.Name,\n\t\tcreate.URL,\n\t\tstrings.Join(create.ActivityList, \",\"),\n\t)\n\n\tif err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\tdefer row.Close()\n\n\trow.Next()\n\tvar projectWebhook api.ProjectWebhook\n\tvar activityList string\n\tif err := row.Scan(\n\t\t&projectWebhook.ID,\n\t\t&projectWebhook.CreatorId,\n\t\t&projectWebhook.CreatedTs,\n\t\t&projectWebhook.UpdaterId,\n\t\t&projectWebhook.UpdatedTs,\n\t\t&projectWebhook.ProjectId,\n\t\t&projectWebhook.Type,\n\t\t&projectWebhook.Name,\n\t\t&projectWebhook.URL,\n\t\t&activityList,\n\t); err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\tprojectWebhook.ActivityList = strings.Split(activityList, \",\")\n\n\treturn &projectWebhook, nil\n}", "title": "" }, { "docid": "1bdbd6598e25527947bd90fc9d2619be", "score": "0.47581485", "text": "func (r *ScheduleService) Patch(teamId string, jobId uint64, schedule *Schedule) *SchedulePatchCall {\n\treturn &SchedulePatchCall{\n\t\ts: r.s,\n\t\tteamId: teamId,\n\t\tjobId: jobId,\n\t\tschedule: schedule,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"teams/{teamId}/jobs/{jobId}/schedule\",\n\t\tcontext_: googleapi.NoContext,\n\t}\n}", "title": "" }, { "docid": "ef61bc494ebba858510574da1916b9b5", "score": "0.47537708", "text": "func (r *FloodlightGroupsService) Patch(floodlightGroupId int64, floodlightgroup *FloodlightGroup) *FloodlightGroupsPatchCall {\n\tc := &FloodlightGroupsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.floodlightGroupId = floodlightGroupId\n\tc.floodlightgroup = floodlightgroup\n\treturn c\n}", "title": "" }, { "docid": "ceab00ce46cd5c061cfa8052f4598cf3", "score": "0.47397992", "text": "func (r *ProjectsJobsService) Patch(projectId string, jobId string, job *Job) *ProjectsJobsPatchCall {\n\tc := &ProjectsJobsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.projectId = projectId\n\tc.jobId = jobId\n\tc.job = job\n\treturn c\n}", "title": "" }, { "docid": "ec23e83a587314ee03e3da9dc856caba", "score": "0.47385907", "text": "func (w *WebHook) WebHook(group, name, repoURL string) error {\n\t// find the project\n\tproject, err := w.projectRepository.Find(group, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif project == nil {\n\t\t// if the project not exist, clone it.\n\t\tp, err := w.projectRepository.New(group, name, repoURL)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tproject = p\n\t} else {\n\t\t// if the project exists, update it.\n\t\tif err := w.projectRepository.Update(project); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// check the deployment status\n\tdeployID := fmt.Sprintf(\"%s_%s\", group, name)\n\tstatus, err := w.deployService.Status(deployID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif status != domain.DeploymentStatusNotDeployed {\n\t\t// if the deployment has already been deployed, undeploy it first.\n\t\terr := w.deployService.Undeploy(deployID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// deploy\n\treturn w.deployService.Deploy(deployID, project.Directory)\n}", "title": "" }, { "docid": "35791299bf93cedd721337e4e8f1285b", "score": "0.47384012", "text": "func (c *WebhooksClient) Get(webhookID string) (*WebhookResource, error) {\n\twebhook := &WebhookResource{}\n\tpath := fmt.Sprintf(\"/v2/webhooks/%s\", webhookID)\n\terr := c.v2Client.Request(http.MethodGet, path, webhook, nil, nil)\n\treturn webhook, err\n}", "title": "" }, { "docid": "220f87e9e73717f1a8b989b0ff979f83", "score": "0.47278032", "text": "func (o *WebhookActivationLogEntry) SetWebhookId(v int32) {\n\to.WebhookId = v\n}", "title": "" }, { "docid": "4ffe7baafa9938d9e4b33b6a14e737e6", "score": "0.46986306", "text": "func (a *FilesApiService) PATCHProjectsApiV3FilesfileIdJson(ctx _context.Context, fileId int32) ApiPATCHProjectsApiV3FilesfileIdJsonRequest {\n\treturn ApiPATCHProjectsApiV3FilesfileIdJsonRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tfileId: fileId,\n\t}\n}", "title": "" }, { "docid": "7624e0a5c72d7149b5ce9a1134278c58", "score": "0.4695661", "text": "func (s *ProjectWebhookService) CreateProjectWebhook(ctx context.Context, create *api.ProjectWebhookCreate) (*api.ProjectWebhook, error) {\n\ttx, err := s.db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\tdefer tx.Rollback()\n\n\tprojectWebhook, err := createProjectWebhook(ctx, tx, create)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := tx.Commit(); err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\n\treturn projectWebhook, nil\n}", "title": "" }, { "docid": "76cb0bcf3483feeeb547448b1ae4e0eb", "score": "0.46933323", "text": "func (s *ProjectWebhookService) FindProjectWebhookList(ctx context.Context, find *api.ProjectWebhookFind) ([]*api.ProjectWebhook, error) {\n\ttx, err := s.db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\tdefer tx.Rollback()\n\n\tlist, err := findProjectWebhookList(ctx, tx, find)\n\tif err != nil {\n\t\treturn []*api.ProjectWebhook{}, err\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "87396247deb092a78c0691825fdb7514", "score": "0.46922767", "text": "func (client WebServicesClient) Patch(patchPayload WebService, resourceGroupName string, webServiceName string, cancel <-chan struct{}) (result autorest.Response, err error) {\n\treq, err := client.PatchPreparer(patchPayload, resourceGroupName, webServiceName, cancel)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"machinelearning.WebServicesClient\", \"Patch\", nil, \"Failure preparing request\")\n\t}\n\n\tresp, err := client.PatchSender(req)\n\tif err != nil {\n\t\tresult.Response = resp\n\t\treturn result, autorest.NewErrorWithError(err, \"machinelearning.WebServicesClient\", \"Patch\", resp, \"Failure sending request\")\n\t}\n\n\tresult, err = client.PatchResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"machinelearning.WebServicesClient\", \"Patch\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d04c89cb61768718629d69e717ce38cd", "score": "0.46890083", "text": "func (c *Client) PatchTeam(teamID, teamName string) (*Team, []error) {\n\tbody, errs := c.PatchTeamJSON(teamID, teamName)\n\tif errs != nil {\n\t\treturn nil, errs\n\t}\n\n\tteam := Team{}\n\tjson.Unmarshal([]byte(body), &team)\n\n\treturn &team, nil\n}", "title": "" }, { "docid": "56e716ac486b97c56158a0560bed2289", "score": "0.46756825", "text": "func (h *handler) hook(w http.ResponseWriter, r *http.Request) {\n\tpayload, err := github.ValidatePayload(r, []byte(cfg.GithubHookSecret))\n\tif err != nil {\n\t\tlogrus.Warnf(\"Unauthorized request: %s\", err)\n\t\thttp.Error(w, \"Unauthorized\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\t// Handle different events\n\tif e := tryPush(payload); e != nil {\n\t\tlogrus.Info(\"Push hook triggered\")\n\t\tbranch := branchOfRef(e.GetRef())\n\t\tif branch != e.GetRepo().GetDefaultBranch() {\n\t\t\tlogrus.Infof(\"Skipping push to non default branch %q\", branch)\n\t\t\treturn\n\t\t}\n\t\tif e.GetInstallation().GetAppID() == int64(cfg.GithubAppID) {\n\t\t\tlogrus.Infof(\"Skipping self push\")\n\t\t\treturn\n\t\t}\n\t\th.runJob(r.Context(), &Project{\n\t\t\tInstall: e.GetInstallation().GetID(),\n\t\t\tOwner: e.GetRepo().GetOwner().GetName(),\n\t\t\tRepo: e.GetRepo().GetName(),\n\t\t\tHeadSHA: e.GetHeadCommit().GetID(),\n\t\t}, fmt.Sprintf(\"Push to %s\", branch))\n\t} else if e := tryInstall(payload); e != nil {\n\t\tlogrus.Infof(\"Install hook triggered added=%d removed=%d\", len(e.RepositoriesAdded), len(e.RepositoriesRemoved))\n\t\tfor _, repo := range e.RepositoriesRemoved {\n\t\t\tlogrus.Infof(\"Removed of %s\", repo.GetFullName())\n\t\t}\n\t\tfor _, repo := range e.RepositoriesAdded {\n\t\t\tparts := strings.Split(repo.GetFullName(), \"/\")\n\t\t\th.runJob(r.Context(), &Project{\n\t\t\t\tInstall: e.GetInstallation().GetID(),\n\t\t\t\tOwner: parts[0],\n\t\t\t\tRepo: parts[1],\n\t\t\t}, \"New Install\")\n\t\t}\n\t} else if e := tryPullRequest(payload); e != nil {\n\t\tif e.GetAction() != \"closed\" || !e.GetPullRequest().GetMerged() {\n\t\t\tlogrus.Info(\"Skipping non-merge PR\")\n\t\t\treturn\n\t\t}\n\t\tif ref := e.GetPullRequest().GetBase().GetRef(); ref != e.GetRepo().GetDefaultBranch() {\n\t\t\tlogrus.Infof(\"Skipping merge to non-default branch: %s\", ref)\n\t\t\treturn\n\t\t}\n\t\th.runJob(r.Context(), &Project{\n\t\t\tInstall: e.GetInstallation().GetID(),\n\t\t\tOwner: e.GetRepo().GetOwner().GetLogin(),\n\t\t\tRepo: e.GetRepo().GetName(),\n\t\t\tDefaultBranch: e.GetRepo().GetDefaultBranch(),\n\t\t}, fmt.Sprintf(\"PR#%d\", e.GetPullRequest().GetNumber()))\n\t} else {\n\t\tlogrus.Warnf(\"Got unexpected payload: %s\", string(payload))\n\t}\n}", "title": "" }, { "docid": "55a34f57a89a86141dea4f6e907d9e80", "score": "0.466732", "text": "func TestSetWebhook(t *testing.T) {\n\tallowUpdateMock := make([]string, 1)\n\tallowUpdateMock[0] = \"message\"\n\n\ttestingResult, _ := telegramwebhook.SetWebhook(callbackURL, 100, allowUpdateMock, token)\n\n\tassert.Equal(t, testingResult.HTTPCODE, http.StatusOK)\n\n}", "title": "" }, { "docid": "437ec74b14a289b23c029e3908d35efd", "score": "0.46625462", "text": "func (o *WebhookActivationLogEntry) GetWebhookId() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.WebhookId\n}", "title": "" }, { "docid": "3d39a7801701a840b021508d861b1349", "score": "0.46579853", "text": "func (pr *projectResource) updateProject(request *http.Request) (*restful.CustomRouteFuncResponse, error) {\n\n\tctx := request.Context()\n\tpr.Logger.WarnWithCtx(ctx, \"Updating api gateways via /api/projects has been deprecated. \"+\n\t\t\"Please use /api/projects/<project-name>\")\n\n\t// get project id from body\n\tbody, err := io.ReadAll(request.Body)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to read body\")\n\t}\n\n\tprojectInfoInstance := projectInfo{}\n\tif err := json.Unmarshal(body, &projectInfoInstance); err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to parse JSON body\")\n\t}\n\n\tprojectId := request.Header.Get(headers.ProjectName)\n\tif projectInfoInstance.Meta != nil && projectInfoInstance.Meta.Name != \"\" {\n\t\tprojectId = projectInfoInstance.Meta.Name\n\t}\n\n\t// retrieve request body so next handler can read it\n\trequest.Body.Close() // nolint: errcheck\n\trequest.Body = io.NopCloser(bytes.NewBuffer(body))\n\n\t// update project\n\t_, err = pr.Update(request, projectId)\n\n\treturn &restful.CustomRouteFuncResponse{\n\t\tResourceType: \"project\",\n\t\tSingle: true,\n\t\tStatusCode: common.ResolveErrorStatusCodeOrDefault(err, http.StatusNoContent),\n\t\tHeaders: map[string]string{\n\t\t\t\"Deprecation\": \"true\",\n\t\t\t\"Link\": fmt.Sprintf(\"</api/projects/%s>; rel=\\\"alternate\\\"\", projectId),\n\t\t},\n\t}, err\n}", "title": "" }, { "docid": "e224394950c9bf56e928e70b8a7d90a6", "score": "0.4654755", "text": "func WebhookHandler(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase http.MethodPost:\n\t\t//Get payload\n\t\tvar webhook Webhook\n\t\terr := json.NewDecoder(r.Body).Decode(&webhook)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Invalid Body: \"+err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t//Finds all the current ids\n\t\titer := firedb.Client.Collection(globals.WebhookF).Documents(firedb.Ctx)\n\t\tvar ids []int\n\t\tfor {\n\t\t\tdoc, err := iter.Next()\n\t\t\tif err == iterator.Done {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t//Should be no errors, as the ID is a string that we insert\n\t\t\tid, _ := strconv.Atoi(doc.Ref.ID)\n\t\t\tids = append(ids, id)\n\t\t}\n\n\t\t//Finds a new ID (ID's starts from 1)\n\t\tvar newid int\n\t\tsort.Ints(ids)\n\t\tnewid = 1\n\t\tfor _, id := range ids {\n\t\t\tif id == newid {\n\t\t\t\tnewid++\n\t\t\t} else {\n\t\t\t\t//We found an unused id\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif webhook.Event == \"\" || webhook.URL == \"\" {\n\t\t\thttp.Error(w, \"Please provide both event and url\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\t//Some form of type cheking\n\t\twebhook.Event = strings.ToLower(webhook.Event)\n\t\tif !EventOK(webhook.Event) {\n\t\t\thttp.Error(w, \"Please provide an event of type (commits|languages|issues|status)\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\twebhook.ID = strconv.Itoa(newid)\n\t\twebhook.Time = time.Now().String()\n\t\t_, err = firedb.Client.Collection(globals.WebhookF).Doc(strconv.Itoa(newid)).Set(firedb.Ctx, webhook)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Bad request\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tjson.NewEncoder(w).Encode(webhook)\n\n\tcase http.MethodGet:\n\t\thttp.Header.Add(w.Header(), \"content-type\", \"application/json\")\n\t\tparts := strings.Split(r.URL.Path, \"/\")\n\t\tif len(parts) != 5 {\n\t\t\thttp.Error(w, \"Expecting format webhooks/<id>\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\t//if Id provided\n\t\tif parts[4] != \"\" {\n\t\t\tid, err := strconv.Atoi(parts[4])\n\t\t\tif err != nil {\n\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdoc, err := firedb.Client.Collection(globals.WebhookF).Doc(strconv.Itoa(id)).Get(firedb.Ctx)\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(w, \"Could not find ID\", http.StatusBadRequest)\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tm := doc.Data()\n\t\t\t//Create and Encode the struct\n\t\t\tvar event, time string = fmt.Sprint(m[globals.EventF]), fmt.Sprint(m[globals.TimeF])\n\t\t\tjson.NewEncoder(w).Encode(WebhookGet{id, event, time})\n\t\t\treturn\n\t\t}\n\t\t// For now just return all webhooks, don't respond to specific resource requests\n\t\titer := firedb.Client.Collection(globals.WebhookF).Documents(firedb.Ctx)\n\t\tvar webhooks []WebhookGet\n\t\tfor {\n\t\t\tdoc, err := iter.Next()\n\t\t\tif err == iterator.Done {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tm := doc.Data()\n\t\t\tvar id, event, time string = fmt.Sprint(m[globals.IDF]), fmt.Sprint(m[globals.EventF]), fmt.Sprint(m[globals.TimeF])\n\t\t\twid, _ := strconv.Atoi(id)\n\t\t\twebhooks = append(webhooks, WebhookGet{wid, event, time})\n\n\t\t}\n\t\tsort.SliceStable(webhooks, func(i, j int) bool {\n\t\t\treturn webhooks[i].ID < webhooks[j].ID\n\t\t})\n\t\tjson.NewEncoder(w).Encode(webhooks[1:])\n\tcase http.MethodDelete:\n\t\tvar delID int\n\t\tok, err := GetPayload(r, &delID)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Invalid Body\", http.StatusBadRequest)\n\t\t}\n\t\t//We did not get ID in body\n\t\tif !ok {\n\t\t\tparts := strings.Split(r.URL.Path, \"/\")\n\t\t\t//We will now see if it was part of the request\n\t\t\tif parts[4] != \"\" {\n\t\t\t\tdelID, err = strconv.Atoi(parts[4])\n\t\t\t\tif err != nil {\n\t\t\t\t\thttp.Error(w, \"Could not turn id into a integer\", http.StatusBadRequest)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thttp.Error(w, \"No form of resource ID provided\", http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif delID == 0 {\n\t\t\thttp.Error(w, \"Failed to find resource ID\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\t_, err = firedb.Client.Collection(globals.WebhookF).Doc(strconv.Itoa(delID)).Delete(firedb.Ctx)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Could not Delete the resource\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tmsg := \"Successfully deleted resource\" + strconv.Itoa(delID)\n\t\tbmsg := []byte(msg)\n\t\tw.Write(bmsg)\n\tdefault:\n\t\thttp.Error(w, \"Invalid method \"+r.Method, http.StatusBadRequest)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7a23a1ebb435cd5fd8bf62392c980142", "score": "0.46525463", "text": "func (k8s *k8s) patchWebhookConfigurations(\n\tctx context.Context,\n\tconfigurationName string,\n\tca []byte,\n\tfailurePolicy admissionv1.FailurePolicyType,\n\tpatchMutating bool,\n\tpatchValidating bool,\n) error {\n\tlog.Infof(\"patching webhook configurations '%s' mutating=%t, validating=%t, failurePolicy=%s\", configurationName, patchMutating, patchValidating, failurePolicy)\n\n\tif patchValidating {\n\t\tif err := k8s.patchValidating(ctx, configurationName, ca, failurePolicy); err != nil {\n\t\t\t// Intentionally don't wrap error here to preserve old behavior and be able to log both original error and a message.\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlog.Debug(\"validating hook patching not required\")\n\t}\n\n\tif patchMutating {\n\t\tif err := k8s.patchMutating(ctx, configurationName, ca, failurePolicy); err != nil {\n\t\t\t// Intentionally don't wrap error here to preserve old behavior and be able to log both original error and a message.\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlog.Debug(\"mutating hook patching not required\")\n\t}\n\n\tlog.Info(\"Patched hook(s)\")\n\n\treturn nil\n}", "title": "" }, { "docid": "a0455604eb5e6c279782118fc36f9561", "score": "0.46435064", "text": "func (c *userProjectBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.UserProjectBinding, err error) {\n\tresult = &v1.UserProjectBinding{}\n\terr = c.client.Patch(pt).\n\t\tResource(\"userprojectbindings\").\n\t\tName(name).\n\t\tSubResource(subresources...).\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(data).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "2d361e5ff2376cd6a0eba974fee48a9c", "score": "0.4642462", "text": "func (c *restClient) UpdateJobTrigger(ctx context.Context, req *dlppb.UpdateJobTriggerRequest, opts ...gax.CallOption) (*dlppb.JobTrigger, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tjsonReq, err := m.Marshal(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v2/%v\", req.GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"name\", url.QueryEscape(req.GetName()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\topts = append((*c.CallOptions).UpdateJobTrigger[0:len((*c.CallOptions).UpdateJobTrigger):len((*c.CallOptions).UpdateJobTrigger)], opts...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &dlppb.JobTrigger{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"PATCH\", baseUrl.String(), bytes.NewReader(jsonReq))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "d790154322bf7b262226e86b2a49ca70", "score": "0.4633397", "text": "func UpdateWorkflow(w http.ResponseWriter, r *http.Request) {\n\tvar t models.Workflow\n\n\tu := GetUserSession(r)\n\tif u == nil || !u.IsAdmin {\n\t\tw.WriteHeader(403)\n\t\tw.Write(apiError(\"you must be logged in as a system administrator to create a project\"))\n\t\treturn\n\t}\n\n\tdecoder := json.NewDecoder(r.Body)\n\terr := decoder.Decode(&t)\n\tif err != nil {\n\t\tw.WriteHeader(400)\n\t\tw.Write(apiError(\"invalid body\"))\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tif t.ID == 0 {\n\t\tid := chi.URLParam(r, \"id\")\n\t\ti, err := strconv.Atoi(id)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write(apiError(http.StatusText(http.StatusBadRequest)))\n\t\t\treturn\n\t\t}\n\n\t\tt.ID = int64(i)\n\t}\n\n\tp := models.Project{Key: r.Context().Value(\"pkey\").(string)}\n\n\terr = Store.Projects().Get(&p)\n\tif err != nil {\n\t\tw.WriteHeader(404)\n\t\tw.Write(apiError(\"project with that key does not exist\"))\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\terr = Store.Workflows().New(p, &t)\n\tif err != nil {\n\t\tw.WriteHeader(400)\n\t\tw.Write(apiError(err.Error()))\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tsendJSON(w, t)\n}", "title": "" }, { "docid": "790bc5438fa2c2773882ecd3e79200be", "score": "0.46024993", "text": "func (r *JobsService) Patch(teamId string, jobId uint64, job *Job) *JobsPatchCall {\n\treturn &JobsPatchCall{\n\t\ts: r.s,\n\t\tteamId: teamId,\n\t\tjobId: jobId,\n\t\tjob: job,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"teams/{teamId}/jobs/{jobId}\",\n\t\tcontext_: googleapi.NoContext,\n\t}\n}", "title": "" }, { "docid": "bea7975ef8a0c4a80f359df0a87b704f", "score": "0.45985487", "text": "func (jt *WorkflowService) UpdateWorkflow(id int, data map[string]interface{}, params map[string]string) (*WorkflowJT, error) {\n\tresult := new(WorkflowJT)\n\tendpoint := fmt.Sprintf(\"/api/v2/workflow_job_templates/%d\", id)\n\tpayload, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := jt.client.Requester.PatchJSON(endpoint, bytes.NewReader(payload), result, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := CheckResponse(resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "159a8d15c7735c32b37b63efa91ad590", "score": "0.45883942", "text": "func (c *NamespacesUpdateCall) ProjectId(projectId string) *NamespacesUpdateCall {\n\tc.urlParams_.Set(\"projectId\", projectId)\n\treturn c\n}", "title": "" }, { "docid": "3e6dc7c6040a9b097936006ff845dbfd", "score": "0.45762122", "text": "func (client *ClientImpl) UpdatePullRequestProperties(ctx context.Context, args UpdatePullRequestPropertiesArgs) (interface{}, error) {\n\tif args.PatchDocument == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.PatchDocument\"}\n\t}\n\trouteValues := make(map[string]string)\n\tif args.Project != nil && *args.Project != \"\" {\n\t\trouteValues[\"project\"] = *args.Project\n\t}\n\tif args.RepositoryId == nil || *args.RepositoryId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.RepositoryId\"}\n\t}\n\trouteValues[\"repositoryId\"] = *args.RepositoryId\n\tif args.PullRequestId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.PullRequestId\"}\n\t}\n\trouteValues[\"pullRequestId\"] = strconv.Itoa(*args.PullRequestId)\n\n\tbody, marshalErr := json.Marshal(*args.PatchDocument)\n\tif marshalErr != nil {\n\t\treturn nil, marshalErr\n\t}\n\tlocationId, _ := uuid.Parse(\"48a52185-5b9e-4736-9dc1-bb1e2feac80b\")\n\tresp, err := client.Client.Send(ctx, http.MethodPatch, locationId, \"5.1-preview.1\", routeValues, nil, bytes.NewReader(body), \"application/json-patch+json\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue interface{}\n\terr = client.Client.UnmarshalBody(resp, responseValue)\n\treturn responseValue, err\n}", "title": "" }, { "docid": "8fc17f39daa90a7c0011ddacb46a683d", "score": "0.45723668", "text": "func (o *InlineObject108) GetWebhook() WebhooksIdJsonWebhook {\n\tif o == nil || o.Webhook == nil {\n\t\tvar ret WebhooksIdJsonWebhook\n\t\treturn ret\n\t}\n\treturn *o.Webhook\n}", "title": "" }, { "docid": "b334d8e1f770452274fd58957dbbcbc6", "score": "0.45699036", "text": "func (a *FaxserverSettingApiService) FaxserversettingsIdPatch(ctx _context.Context, id int32, operation []Operation) (FaxserverSetting, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue FaxserverSetting\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/faxserversettings/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(id, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json-patch+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &operation\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "334fc236b8857b7b4ab7e824a09ce4c5", "score": "0.45674604", "text": "func (r *LayersService) Patch(id string, layer *Layer) *LayersPatchCall {\n\tc := &LayersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.id = id\n\tc.layer = layer\n\treturn c\n}", "title": "" }, { "docid": "7cff9d70fb4a064df10429c03cd3ad91", "score": "0.45653412", "text": "func (a Webhook) Webhook() bitbucket.Webhook {\n\tevents := make([]string, 0, len(a.Spec.ForProvider.Webhook.Events))\n\tfor _, ev := range a.Spec.ForProvider.Webhook.Events {\n\t\tevents = append(events, string(ev))\n\t}\n\treturn bitbucket.Webhook{\n\t\t// ID: get from CR? meta.GetExternalName?\n\n\t\tName: a.Spec.ForProvider.Webhook.Name,\n\t\tConfiguration: a.Spec.ForProvider.Webhook.Configuration,\n\t\tEvents: events,\n\t\tURL: a.Spec.ForProvider.Webhook.URL,\n\t}\n}", "title": "" }, { "docid": "9e9697618e83a0c78ceb893a9be63c36", "score": "0.45488968", "text": "func (c *FakeFlowLogs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.FlowLog, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(flowlogsResource, c.ns, name, pt, data, subresources...), &v1alpha1.FlowLog{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.FlowLog), err\n}", "title": "" }, { "docid": "3b1c8a25a87a265776ea0f10746bf21d", "score": "0.4545368", "text": "func (pr *PatchAPIRequest) CreatePatch(finalize bool, oauthToken string,\n\tdbUser *user.DBUser, settings *evergreen.Settings) (*model.Project, *patch.Patch, error) {\n\tvar repoOwner, repo string\n\tvar module *model.Module\n\n\tprojectRef, err := model.FindOneProjectRef(pr.ProjectId)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"Could not find project ref %v\", pr.ProjectId)\n\t}\n\n\trepoOwner = projectRef.Owner\n\trepo = projectRef.Repo\n\n\tif !projectRef.Enabled {\n\t\treturn nil, nil, errors.Wrapf(err, \"project %v is disabled\", projectRef.Identifier)\n\t}\n\n\tif len(pr.Githash) != 40 {\n\t\treturn nil, nil, errors.New(\"invalid githash\")\n\t}\n\n\tgitCommit, err := thirdparty.GetCommitEvent(oauthToken, repoOwner, repo, pr.Githash)\n\tif err != nil {\n\t\treturn nil, nil, errors.Errorf(\"could not find base revision %v for project %v: %v\",\n\t\t\tpr.Githash, projectRef.Identifier, err)\n\n\t}\n\tif gitCommit == nil {\n\t\treturn nil, nil, errors.Errorf(\"commit hash %v doesn't seem to exist\", pr.Githash)\n\t}\n\n\tsummaries, err := getSummaries(pr.PatchContent)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif finalize && (len(pr.BuildVariants) == 0 || pr.BuildVariants[0] == \"\") {\n\t\treturn nil, nil, errors.New(\"no buildvariants specified\")\n\t}\n\n\tcreateTime := time.Now()\n\n\t// create a new object ID to use as reference for the patch data\n\tpatchFileId := bson.NewObjectId().Hex()\n\tpatchDoc := &patch.Patch{\n\t\tId: bson.NewObjectId(),\n\t\tDescription: pr.Description,\n\t\tAuthor: dbUser.Id,\n\t\tProject: pr.ProjectId,\n\t\tGithash: pr.Githash,\n\t\tCreateTime: createTime,\n\t\tStatus: evergreen.PatchCreated,\n\t\tBuildVariants: pr.BuildVariants,\n\t\tTasks: pr.Tasks,\n\t\tPatches: []patch.ModulePatch{\n\t\t\t{\n\t\t\t\tModuleName: \"\",\n\t\t\t\tGithash: pr.Githash,\n\t\t\t\tPatchSet: patch.PatchSet{\n\t\t\t\t\tPatch: pr.PatchContent,\n\t\t\t\t\tPatchFileId: patchFileId,\n\t\t\t\t\tSummary: summaries,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// Get and validate patched config and add it to the patch document\n\tproject, err := validator.GetPatchedProject(patchDoc, settings)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"invalid patched config\")\n\t}\n\n\tif pr.ModuleName != \"\" {\n\t\t// is there a module? validate it.\n\t\tmodule, err = project.GetModuleByName(pr.ModuleName)\n\t\tif err != nil {\n\t\t\treturn nil, nil, errors.Wrapf(err, \"could not find module %v\", pr.ModuleName)\n\t\t}\n\t\tif module == nil {\n\t\t\treturn nil, nil, errors.Errorf(\"no module named %v\", pr.ModuleName)\n\t\t}\n\t}\n\n\t// verify that all variants exists\n\tfor _, buildVariant := range pr.BuildVariants {\n\t\tif buildVariant == \"all\" || buildVariant == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tbv := project.FindBuildVariant(buildVariant)\n\t\tif bv == nil {\n\t\t\treturn nil, nil, errors.Errorf(\"No such buildvariant: %v\", buildVariant)\n\t\t}\n\t}\n\n\t// write the patch content into a GridFS file under a new ObjectId after validating.\n\terr = db.WriteGridFile(patch.GridFSPrefix, patchFileId, strings.NewReader(pr.PatchContent))\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"failed to write patch file to db\")\n\t}\n\n\t// add the project config\n\tprojectYamlBytes, err := yaml.Marshal(project)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"error marshaling patched config\")\n\t}\n\n\t// set the patch number based on patch author\n\tpatchDoc.PatchNumber, err = dbUser.IncPatchNumber()\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"error computing patch num\")\n\t}\n\tpatchDoc.PatchedConfig = string(projectYamlBytes)\n\n\tpatchDoc.ClearPatchData()\n\n\treturn project, patchDoc, nil\n}", "title": "" }, { "docid": "41e6637cb2b71fa910845496fa9b4395", "score": "0.45446777", "text": "func (r *FilesService) Patch(id string, file *File) *FilesPatchCall {\n\treturn &FilesPatchCall{\n\t\ts: r.s,\n\t\tid: id,\n\t\tfile: file,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"files/{id}\",\n\t\tcontext_: googleapi.NoContext,\n\t}\n}", "title": "" }, { "docid": "e54c467ec0a33a69b1eeea7ccd418432", "score": "0.45442986", "text": "func (s *repositoryService) UpdateHook(ctx context.Context, repo, id string, input *scm.HookInput) (*scm.Hook, *scm.Response, error) {\n\ttarget, err := url.Parse(input.Target)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tparams := target.Query()\n\tparams.Set(\"secret\", input.Secret)\n\ttarget.RawQuery = params.Encode()\n\n\tpath := fmt.Sprintf(\"2.0/repositories/%s/hooks/%s\", repo, id)\n\tin := new(hookInput)\n\tin.URL = target.String()\n\tin.SkipCertVerification = input.SkipVerify\n\tin.Active = true\n\tin.Description = input.Name\n\tin.Events = append(\n\t\tinput.NativeEvents,\n\t\tconvertFromHookEvents(input.Events)...,\n\t)\n\tout := new(hook)\n\tres, err := s.client.do(ctx, \"PUT\", path, in, out)\n\treturn convertHook(out), res, err\n}", "title": "" }, { "docid": "3cbe4f3ea7f1b823491d210242a51d6d", "score": "0.45441368", "text": "func (h *Handler) UpdateProject(w http.ResponseWriter, r *http.Request) {\n\tvar project Project\n\tprojectID := chi.URLParam(r, \"ProjectID\")\n\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&project); err != nil {\n\t\th.Logger.Errorf(\"err decoding user request: %s\", err)\n\t\thttp.Error(w, http.StatusText(500), 500)\n\t\treturn\n\t}\n\topts := options.Update()\n\tfilter := bson.M{\"_id\": projectID}\n\tresult, err := h.Collection.UpdateOne(context.Background(), filter, project, opts)\n\tif err != nil {\n\t\th.Logger.Errorf(\"err decoding user request: %s\", err)\n\t\thttp.Error(w, http.StatusText(500), 500)\n\t\treturn\n\t}\n\n\tif result.MatchedCount > 0 {\n\t\trender.JSON(w, r, map[string]string{\"message\": \"User updated\"})\n\t}\n}", "title": "" }, { "docid": "d837c83382a78b3e30cead1a2f81f8e1", "score": "0.454163", "text": "func (c *FakePreflights) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Preflight, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(preflightsResource, c.ns, name, pt, data, subresources...), &v1beta2.Preflight{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1beta2.Preflight), err\n}", "title": "" }, { "docid": "483d1acfc5fa2df4f4968fdc619fa821", "score": "0.45402426", "text": "func (c *webhookClient) Add(eventTypes []string, webhookURL *apis.URL, tls bool) (hookID int, err error) {\n\tenabled := true\n\n\thookOptions := gitlab.AddProjectHookOptions{\n\t\tURL: gitlab.String(webhookURL.String()),\n\t\tEnableSSLVerification: &tls,\n\t\tToken: c.secretToken,\n\t}\n\n\tfor _, eventType := range eventTypes {\n\t\tswitch eventType {\n\t\tcase v1alpha1.GitLabWebhookConfidentialIssues:\n\t\t\thookOptions.ConfidentialIssuesEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookConfidentialNote:\n\t\t\thookOptions.ConfidentialNoteEvents = &enabled\n\t\t// NOTE(antoineco): not supported in this version of xanzy/go-gitlab (v0.39.0)\n\t\t//case v1alpha1.GitLabWebhookDeployment:\n\t\t//\thookOptions.DeploymentEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookIssues:\n\t\t\thookOptions.IssuesEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookJob:\n\t\t\thookOptions.JobEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookMergeRequests:\n\t\t\thookOptions.MergeRequestsEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookNote:\n\t\t\thookOptions.NoteEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookPipeline:\n\t\t\thookOptions.PipelineEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookPush:\n\t\t\thookOptions.PushEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookTagPush:\n\t\t\thookOptions.TagPushEvents = &enabled\n\t\tcase v1alpha1.GitLabWebhookWikiPage:\n\t\t\thookOptions.WikiPageEvents = &enabled\n\t\t}\n\t}\n\n\thook, _, err := c.cli.Projects.AddProjectHook(c.projectName, &hookOptions)\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"adding webhook to project %q: %w\", c.projectName, err)\n\t}\n\n\treturn hook.ID, nil\n}", "title": "" }, { "docid": "f09fae25a7db9400d79ad9fc1f859493", "score": "0.4539068", "text": "func (o ProjectHookOutput) ProjectId() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *ProjectHook) pulumi.IntOutput { return v.ProjectId }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "8195c34a137a5c5eb64f3802d746b857", "score": "0.45382294", "text": "func (a *Client) PatchByIDUsingPATCH(params *PatchByIDUsingPATCHParams, opts ...ClientOption) (*PatchByIDUsingPATCHOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPatchByIDUsingPATCHParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"patchByIdUsingPATCH\",\n\t\tMethod: \"PATCH\",\n\t\tPathPattern: \"/codestream/api/registry-webhooks/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PatchByIDUsingPATCHReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PatchByIDUsingPATCHOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for patchByIdUsingPATCH: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "6ae9453ee535d19b77cdd761ff79ced6", "score": "0.45281035", "text": "func UnmarshalTriggerPatch(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(TriggerPatch)\n\terr = core.UnmarshalPrimitive(m, \"type\", &obj.Type)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"event_listener\", &obj.EventListener)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"tags\", &obj.Tags)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"worker\", &obj.Worker, UnmarshalWorkerIdentity)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"max_concurrent_runs\", &obj.MaxConcurrentRuns)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"enabled\", &obj.Enabled)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"secret\", &obj.Secret, UnmarshalGenericSecret)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"cron\", &obj.Cron)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"timezone\", &obj.Timezone)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"source\", &obj.Source, UnmarshalTriggerSourcePrototype)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"events\", &obj.Events)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "cd0a21d4287d3460457ab8169c163664", "score": "0.45269087", "text": "func (a EventApi) EventWebhook(processId string, eventId string, triggerBody string) (*string, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Post\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/processes/{process_id}/events/{event_id}/webhook\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"process_id\"+\"}\", fmt.Sprintf(\"%v\", processId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"event_id\"+\"}\", fmt.Sprintf(\"%v\", eventId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// authentication '(PasswordGrant)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"Authorization\"] = a.Configuration.GetAPIKeyWithPrefix(\"Authorization\")\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &triggerBody\n\tvar successPayload = new(string)\n\tlocalVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\n\tvar localVarURL, _ = url.Parse(localVarPath)\n\tlocalVarURL.RawQuery = localVarQueryParams.Encode()\n\tvar localVarAPIResponse = &APIResponse{Operation: \"EventWebhook\", Method: localVarHttpMethod, RequestURL: localVarURL.String()}\n\tif localVarHttpResponse != nil {\n\t\tlocalVarAPIResponse.Response = localVarHttpResponse.RawResponse\n\t\tlocalVarAPIResponse.Payload = localVarHttpResponse.Body()\n\t}\n\n\tif err != nil {\n\t\treturn successPayload, localVarAPIResponse, err\n\t}\n\terr = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)\n\treturn successPayload, localVarAPIResponse, err\n}", "title": "" }, { "docid": "285b47c1b20c36cb56846aa76917b01c", "score": "0.45179835", "text": "func (s *Service) UpdateWebhookComment(task *task.Task, logger *xlog.Logger) (err error) {\n\tif task.WorkflowArgs.NotificationId == \"\" {\n\t\treturn\n\t}\n\n\tvar notification *models.Notification\n\tif notification, err = s.Coll.Find(task.WorkflowArgs.NotificationId); err != nil {\n\t\tlogger.Errorf(\"can't find notification by id %s %s\", task.WorkflowArgs.NotificationId, err)\n\t\treturn err\n\t}\n\n\tvar tasks []*models.NotificationTask\n\tvar taskExist bool\n\tvar shouldComment bool\n\tstatus := convertTaskStatusToNotificationTaskStatus(task.Status)\n\tfor _, nTask := range notification.Tasks {\n\t\tif nTask.ID == task.TaskID {\n\t\t\tshouldComment = nTask.Status != status\n\t\t\tscmTask := &models.NotificationTask{\n\t\t\t\tProductName: task.ProductName,\n\t\t\t\tWorkflowName: task.PipelineName,\n\t\t\t\tID: task.TaskID,\n\t\t\t\tStatus: status,\n\t\t\t}\n\n\t\t\tif status == config.TaskStatusPass {\n\t\t\t\t// 从s3获取测试报告数据\n\t\t\t\ttestReports, err := DownloadTestReports(task, logger)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Errorf(\"download testReport from s3 failed,err:%v\", err)\n\t\t\t\t}\n\t\t\t\tscmTask.TestReports = testReports\n\t\t\t}\n\n\t\t\ttasks = append(tasks, scmTask)\n\t\t\ttaskExist = true\n\t\t} else {\n\t\t\ttasks = append(tasks, nTask)\n\t\t}\n\t}\n\n\tif !taskExist {\n\t\ttasks = append(tasks, &models.NotificationTask{\n\t\t\tProductName: task.ProductName,\n\t\t\tWorkflowName: task.PipelineName,\n\t\t\tID: task.TaskID,\n\t\t\tStatus: status,\n\t\t})\n\t\tshouldComment = true\n\t}\n\n\tif shouldComment {\n\t\tnotification.Tasks = tasks\n\t\tif err = s.Client.Comment(notification); err != nil {\n\t\t\tlogger.Errorf(\"failed to comment %s, %v\", notification.ToString(), err)\n\t\t}\n\n\t\tif err = s.Coll.Upsert(notification); err != nil {\n\t\t\tlogger.Errorf(\"can't upsert notification by id %s\", notification.ID)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tlogger.Infof(\"status not changed of task %s %d, skip to update comment\", task.PipelineName, task.TaskID)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e1158836ce7aae40bee7df36723f601e", "score": "0.45164043", "text": "func withProjectID(id int) projectOption {\n\treturn func(m *ProjectMutation) {\n\t\tvar (\n\t\t\terr error\n\t\t\tonce sync.Once\n\t\t\tvalue *Project\n\t\t)\n\t\tm.oldValue = func(ctx context.Context) (*Project, error) {\n\t\t\tonce.Do(func() {\n\t\t\t\tif m.done {\n\t\t\t\t\terr = fmt.Errorf(\"querying old values post mutation is not allowed\")\n\t\t\t\t} else {\n\t\t\t\t\tvalue, err = m.Client().Project.Get(ctx, id)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn value, err\n\t\t}\n\t\tm.id = &id\n\t}\n}", "title": "" }, { "docid": "1e9fd0e311d81e3f2956e974ce81987d", "score": "0.45081902", "text": "func (o ProjectHookOutput) HookId() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *ProjectHook) pulumi.IntOutput { return v.HookId }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "866a2bed1bab289cca4cd18bc6c31821", "score": "0.4493522", "text": "func (g *Gitlab) RemoveProjectHook(id string, hook_id int) error {\n\turl, opaque := g.ResourceUrlRaw(project_url_hook, map[string]string{\n\t\t\":id\": id,\n\t\t\":hook_id\": strconv.Itoa(hook_id),\n\t})\n\n\t_, err := g.buildAndExecRequestRaw(\"DELETE\", url, opaque, nil)\n\n\treturn err\n}", "title": "" }, { "docid": "7773f00730513807b944fae6affe079e", "score": "0.4489832", "text": "func GetProjectHook(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ProjectHookState, opts ...pulumi.ResourceOption) (*ProjectHook, error) {\n\tvar resource ProjectHook\n\terr := ctx.ReadResource(\"gitlab:index/projectHook:ProjectHook\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "f62e24dc1cde7eeb1d2cd9c6cfe3e3a2", "score": "0.44884172", "text": "func (repo *Repository) GetWebhook(id uuid.UUID) (model.Webhook, error) {\n\tif id == uuid.Nil {\n\t\treturn nil, repository.ErrNotFound\n\t}\n\tb := &model.WebhookBot{}\n\tif err := repo.db.Preload(\"BotUser\").Where(&model.WebhookBot{ID: id}).Take(b).Error; err != nil {\n\t\treturn nil, convertError(err)\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "64d4e2eb3bab947c158162837828dac3", "score": "0.44850388", "text": "func (a *WorkflowApiService) PatchWorkflowSolutionActionDefinition(ctx _context.Context, moid string) ApiPatchWorkflowSolutionActionDefinitionRequest {\n\treturn ApiPatchWorkflowSolutionActionDefinitionRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "title": "" }, { "docid": "f511383a2c0b5c4c63c9af62c8912e0e", "score": "0.44835478", "text": "func (svc *ProjectSvc) Update(w http.ResponseWriter, req *http.Request) {\n\t// get project from request context\n\tproject, err := getProjectContext(req)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, http.StatusText(422), 422)\n\t\treturn\n\t}\n\n\tdecoder := json.NewDecoder(req.Body)\n\tpReq := earthworks.ProjectRequest{}\n\terr = decoder.Decode(&pReq)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, err.Error(), 400)\n\t\treturn\n\t}\n\n\tupdated, err := svc.Repo.UpdateProject(project.ID, pReq)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, http.StatusText(404), 404)\n\t\treturn\n\t}\n\trender.JSON(w, req, updated)\n}", "title": "" }, { "docid": "ddff9caf01b22f3f8c68bff8dec327e3", "score": "0.4464389", "text": "func NewPatchWebhookConflict() *PatchWebhookConflict {\n\treturn &PatchWebhookConflict{}\n}", "title": "" }, { "docid": "7e5a46461aa67f42af0cc8bd7007c6a9", "score": "0.4460874", "text": "func (c *LayersListPublishedCall) ProjectId(projectId string) *LayersListPublishedCall {\n\tc.urlParams_.Set(\"projectId\", projectId)\n\treturn c\n}", "title": "" }, { "docid": "533cd49609f63ae460f29a539881c992", "score": "0.44526616", "text": "func UpdateProject(c echo.Context) error {\n\treturn c.NoContent(http.StatusNoContent)\n}", "title": "" }, { "docid": "978082525c30aa83b8c6700e5c8d94e7", "score": "0.44450924", "text": "func (a *WorkflowApiService) PatchWorkflowSolutionDefinition(ctx _context.Context, moid string) ApiPatchWorkflowSolutionDefinitionRequest {\n\treturn ApiPatchWorkflowSolutionDefinitionRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "title": "" }, { "docid": "3ba67ace27bb245ef6ca3c389634363a", "score": "0.4444149", "text": "func (s *Service) PatchSolution(solutionID string, req PatchSolutionRequest) error {\n\t_, err := s.patchSolutionResponseBody(solutionID, req)\n\n\treturn err\n}", "title": "" }, { "docid": "022b230da85219178f37b7711f412015", "score": "0.442865", "text": "func UpdateHook(db gorp.SqlExecutor, h sdk.Hook) error {\n\tquery := `UPDATE hook set pipeline_id=$1, kind=$2, host=$3, project=$4, repository=$5, application_id=$6, enabled=$7 WHERE id=$8`\n\n\tres, err := db.Exec(query, h.Pipeline.ID, h.Kind, h.Host, h.Project, h.Repository, h.ApplicationID, h.Enabled, h.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnbRows, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif nbRows != 1 {\n\t\treturn sdk.ErrNoHook\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e743c334c99c0f91182d43b3a74b6875", "score": "0.44268727", "text": "func (cdTektonPipeline *CdTektonPipelineV2) UpdateTektonPipelineTriggerWithContext(ctx context.Context, updateTektonPipelineTriggerOptions *UpdateTektonPipelineTriggerOptions) (result TriggerIntf, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(updateTektonPipelineTriggerOptions, \"updateTektonPipelineTriggerOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(updateTektonPipelineTriggerOptions, \"updateTektonPipelineTriggerOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"pipeline_id\": *updateTektonPipelineTriggerOptions.PipelineID,\n\t\t\"trigger_id\": *updateTektonPipelineTriggerOptions.TriggerID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.PATCH)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = cdTektonPipeline.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(cdTektonPipeline.Service.Options.URL, `/tekton_pipelines/{pipeline_id}/triggers/{trigger_id}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range updateTektonPipelineTriggerOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"cd_tekton_pipeline\", \"V2\", \"UpdateTektonPipelineTrigger\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tbuilder.AddHeader(\"Content-Type\", \"application/merge-patch+json\")\n\n\tif updateTektonPipelineTriggerOptions.TriggerPatch != nil {\n\t\t_, err = builder.SetBodyContentJSON(updateTektonPipelineTriggerOptions.TriggerPatch)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = cdTektonPipeline.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalTrigger)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0c1572b5e20af44252d1b815b87f566e", "score": "0.44147754", "text": "func BuildUpdatePayload(projectUpdateBody string, projectUpdateProjectID string, projectUpdateAuth string) (*project.UpdatePayload, error) {\n\tvar err error\n\tvar body UpdateRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(projectUpdateBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, \\nerror: %s, \\nexample of valid JSON:\\n%s\", err, \"'{\\n \\\"bounds\\\": {\\n \\\"max\\\": [\\n 0.595389826652958,\\n 0.6948214963772193,\\n 0.837650615118303,\\n 0.09669303147164357\\n ],\\n \\\"min\\\": [\\n 0.11372084988344884,\\n 0.5240321213868652,\\n 0.3935396254118812\\n ]\\n },\\n \\\"description\\\": \\\"Aperiam ratione.\\\",\\n \\\"endTime\\\": \\\"Ut optio aut.\\\",\\n \\\"goal\\\": \\\"Quidem dolor architecto illo dolores quisquam.\\\",\\n \\\"location\\\": \\\"Enim natus perspiciatis quis.\\\",\\n \\\"name\\\": \\\"Dolores a ipsa.\\\",\\n \\\"privacy\\\": 513503072,\\n \\\"showStations\\\": true,\\n \\\"startTime\\\": \\\"Voluptas repudiandae cumque.\\\",\\n \\\"tags\\\": \\\"Eum a voluptatem et aspernatur unde.\\\"\\n }'\")\n\t\t}\n\t\tif body.Bounds != nil {\n\t\t\tif err2 := ValidateProjectBoundsRequestBodyRequestBody(body.Bounds); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar projectID int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(projectUpdateProjectID, 10, 32)\n\t\tprojectID = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for projectID, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = projectUpdateAuth\n\t}\n\tv := &project.AddProjectFields{\n\t\tName: body.Name,\n\t\tDescription: body.Description,\n\t\tGoal: body.Goal,\n\t\tLocation: body.Location,\n\t\tTags: body.Tags,\n\t\tPrivacy: body.Privacy,\n\t\tStartTime: body.StartTime,\n\t\tEndTime: body.EndTime,\n\t\tShowStations: body.ShowStations,\n\t}\n\tif body.Bounds != nil {\n\t\tv.Bounds = marshalProjectBoundsRequestBodyRequestBodyToProjectProjectBounds(body.Bounds)\n\t}\n\tres := &project.UpdatePayload{\n\t\tProject: v,\n\t}\n\tres.ProjectID = projectID\n\tres.Auth = auth\n\n\treturn res, nil\n}", "title": "" }, { "docid": "7ba9e99ef7fe1b170efac9bcf4a2781a", "score": "0.4414419", "text": "func updateProjectKey(ctx iris.Context) {\n\tprojectID := ctx.Params().Get(\"projectID\")\n\tif projectID == \"\" {\n\t\thandleError(ctx, apiErrors.ErrBadRequest)\n\t\treturn\n\t}\n\n\tvar data = projectKeyUpdatePayload{}\n\n\tif err := ctx.ReadJSON(&data); err != nil {\n\t\thandleError(ctx, err)\n\t\treturn\n\t}\n\n\tif data.OldKey == \"\" || data.NewKey == \"\" {\n\t\thandleError(ctx, apiErrors.ErrUnprocessable)\n\t\treturn\n\t}\n\n\tdata.NewKey = strings.Trim(data.NewKey, \"\")\n\n\tproject, localesAffected, err := store.UpdateProjectKey(projectID, data.OldKey, data.NewKey)\n\tif err != nil {\n\t\thandleError(ctx, err)\n\t\treturn\n\t}\n\n\tresult := map[string]interface{}{\n\t\t\"localesAffected\": localesAffected,\n\t\t\"project\": project,\n\t}\n\n\trender.JSON(ctx, iris.StatusOK, result)\n}", "title": "" }, { "docid": "e8f887c72e8f51fa63aa8c962d3fe3db", "score": "0.4411837", "text": "func (a *WorkflowApiService) PatchWorkflowWorkflowDefinition(ctx _context.Context, moid string) ApiPatchWorkflowWorkflowDefinitionRequest {\n\treturn ApiPatchWorkflowWorkflowDefinitionRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "title": "" }, { "docid": "9b3530be71f1ada91795afb7bed4e0c0", "score": "0.44103152", "text": "func GetValidatingWebhookConfigurationPatch(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ValidatingWebhookConfigurationPatchState, opts ...pulumi.ResourceOption) (*ValidatingWebhookConfigurationPatch, error) {\n\tvar resource ValidatingWebhookConfigurationPatch\n\terr := ctx.ReadResource(\"kubernetes:admissionregistration.k8s.io/v1:ValidatingWebhookConfigurationPatch\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "6936b871b33a656781561d2374a6808c", "score": "0.44033983", "text": "func NewPatchWebhookBadRequest() *PatchWebhookBadRequest {\n\treturn &PatchWebhookBadRequest{}\n}", "title": "" }, { "docid": "1c1eee172028e8ee2074b9711a3f00fd", "score": "0.44030687", "text": "func UpdateLambdaBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.LambdaController, lambdaID int, payload *app.LambdaPayload) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Validate payload\n\terr := payload.Validate()\n\tif err != nil {\n\t\te, ok := err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(err) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/p7/lambdas/%v\", lambdaID),\n\t}\n\treq, _err := http.NewRequest(\"PATCH\", u.String(), nil)\n\tif _err != nil {\n\t\tpanic(\"invalid test \" + _err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"lambda_id\"] = []string{fmt.Sprintf(\"%v\", lambdaID)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"LambdaTest\"), rw, req, prms)\n\tupdateCtx, __err := app.NewUpdateLambdaContext(goaCtx, req, service)\n\tif __err != nil {\n\t\tpanic(\"invalid test data \" + __err.Error()) // bug\n\t}\n\tupdateCtx.Payload = payload\n\n\t// Perform action\n\t__err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif __err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", __err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got %+v, expected instance of error\", resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "title": "" }, { "docid": "398a5f8fa6135561e07dafe7b13e401a", "score": "0.44007403", "text": "func GetPatchedProject(ctx context.Context, p *patch.Patch, githubOauthToken string) (*Project, error) {\n\tif p.Version != \"\" {\n\t\treturn nil, errors.Errorf(\"Patch %v already finalized\", p.Version)\n\t}\n\n\tprojectRef, err := FindOneProjectRef(p.Project)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tproject := &Project{}\n\t// if the patched config exists, use that as the project file bytes.\n\tif p.PatchedConfig != \"\" {\n\t\tif _, err = LoadProjectInto([]byte(p.PatchedConfig), projectRef.Identifier, project); err != nil {\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\t\treturn project, nil\n\t}\n\n\tvar cancel context.CancelFunc\n\tctx, cancel = context.WithTimeout(ctx, 10*time.Second)\n\tdefer cancel()\n\tenv := evergreen.GetEnvironment()\n\n\t// try to get the remote project file data at the requested revision\n\tvar projectFileBytes []byte\n\thash := p.Githash\n\tif p.IsGithubPRPatch() {\n\t\thash = p.GithubPatchData.HeadHash\n\t}\n\tif p.IsPRMergePatch() {\n\t\thash = p.GithubPatchData.MergeCommitSHA\n\t}\n\n\tgithubFile, err := thirdparty.GetGithubFile(ctx, githubOauthToken, projectRef.Owner,\n\t\tprojectRef.Repo, projectRef.RemotePath, hash)\n\tif err != nil {\n\t\t// if the project file doesn't exist, but our patch includes a project file,\n\t\t// we try to apply the diff and proceed.\n\t\tif !(p.ConfigChanged(projectRef.RemotePath) && thirdparty.IsFileNotFound(err)) {\n\t\t\t// return an error if the github error is network/auth-related or we aren't patching the config\n\t\t\treturn nil, errors.Wrapf(err, \"Could not get github file at '%s/%s'@%s: %s\", projectRef.Owner,\n\t\t\t\tprojectRef.Repo, projectRef.RemotePath, hash)\n\t\t}\n\t} else {\n\t\t// we successfully got the project file in base64, so we decode it\n\t\tprojectFileBytes, err = base64.StdEncoding.DecodeString(*githubFile.Content)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"Could not decode github file at '%s/%s'@%s: %s\", projectRef.Owner,\n\t\t\t\tprojectRef.Repo, projectRef.RemotePath, hash)\n\t\t}\n\t}\n\n\t// apply remote configuration patch if needed\n\tif !(p.IsGithubPRPatch() || p.IsPRMergePatch()) && p.ConfigChanged(projectRef.RemotePath) {\n\t\tprojectFileBytes, err = MakePatchedConfig(ctx, env, p, projectRef.RemotePath, string(projectFileBytes))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"Could not patch remote configuration file\")\n\t\t}\n\t}\n\n\tif _, err := LoadProjectInto(projectFileBytes, projectRef.Identifier, project); err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\treturn project, nil\n}", "title": "" }, { "docid": "523168a4ce02863e508ab2dc5d2cb2e4", "score": "0.43950257", "text": "func (s *ProjectBadgesService) EditProjectBadge(pid interface{}, badge int, opt *EditProjectBadgeOptions, options ...RequestOptionFunc) (*ProjectBadge, *Response, error) {\n\tproject, err := parseID(pid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tu := fmt.Sprintf(\"projects/%s/badges/%d\", PathEscape(project), badge)\n\n\treq, err := s.client.NewRequest(http.MethodPut, u, opt, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tpb := new(ProjectBadge)\n\tresp, err := s.client.Do(req, pb)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn pb, resp, nil\n}", "title": "" }, { "docid": "f44b19e62c0ed19300a5ee53d0bf0787", "score": "0.43920916", "text": "func (r *ProjectsHistoriesExecutionsService) Patch(projectId string, historyId string, executionId string, execution *Execution) *ProjectsHistoriesExecutionsPatchCall {\n\tc := &ProjectsHistoriesExecutionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.projectId = projectId\n\tc.historyId = historyId\n\tc.executionId = executionId\n\tc.execution = execution\n\treturn c\n}", "title": "" }, { "docid": "5791f585e4bd9c2cbe19e7c6690c9f9a", "score": "0.43778035", "text": "func (s *Service) UpdateWebhookCommentForTest(task *task.Task, logger *xlog.Logger) (err error) {\n\tif task.TestArgs.NotificationId == \"\" {\n\t\treturn\n\t}\n\n\tvar notification *models.Notification\n\tif notification, err = s.Coll.Find(task.TestArgs.NotificationId); err != nil {\n\t\tlogger.Errorf(\"can't find notification by id %s %s\", task.TestArgs.NotificationId, err)\n\t\treturn err\n\t}\n\n\tvar tasks []*models.NotificationTask\n\tvar taskExist bool\n\tvar shouldComment bool\n\n\tstatus := convertTaskStatusToNotificationTaskStatus(task.Status)\n\tfor _, nTask := range notification.Tasks {\n\t\tif nTask.ID == task.TaskID {\n\t\t\tshouldComment = nTask.Status != status\n\t\t\tscmTask := &models.NotificationTask{\n\t\t\t\tProductName: task.ProductName,\n\t\t\t\tTestName: task.PipelineName,\n\t\t\t\tID: task.TaskID,\n\t\t\t\tStatus: status,\n\t\t\t}\n\n\t\t\tif status == config.TaskStatusPass {\n\t\t\t\t// 从s3获取测试报告数据\n\t\t\t\ttestReports, err := DownloadTestReports(task, logger)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Errorf(\"download testReport from s3 failed,err:%v\", err)\n\t\t\t\t}\n\t\t\t\tscmTask.TestReports = testReports\n\t\t\t}\n\n\t\t\ttasks = append(tasks, scmTask)\n\t\t\ttaskExist = true\n\t\t} else {\n\t\t\ttasks = append(tasks, nTask)\n\t\t}\n\t}\n\n\tif !taskExist {\n\t\ttasks = append(tasks, &models.NotificationTask{\n\t\t\tProductName: task.ProductName,\n\t\t\tTestName: task.PipelineName,\n\t\t\tID: task.TaskID,\n\t\t\tStatus: status,\n\t\t})\n\t\tshouldComment = true\n\t}\n\n\tif shouldComment {\n\t\tnotification.Tasks = tasks\n\t\tif err = s.Client.Comment(notification); err != nil {\n\t\t\tlogger.Errorf(\"failed to comment %s, %v\", notification.ToString(), err)\n\t\t}\n\n\t\tif err = s.Coll.Upsert(notification); err != nil {\n\t\t\tlogger.Errorf(\"can't upsert notification by id %s\", notification.ID)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tlogger.Infof(\"status not changed of task %s %d, skip to update comment\", task.PipelineName, task.TaskID)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c229023cd76ea8da202cf8779b161f7d", "score": "0.4361765", "text": "func (a *WorkflowApiService) PatchWorkflowRollbackWorkflow(ctx _context.Context, moid string) ApiPatchWorkflowRollbackWorkflowRequest {\n\treturn ApiPatchWorkflowRollbackWorkflowRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "title": "" }, { "docid": "c38bf840ebf91b17b7a8928e4d3f28da", "score": "0.4339689", "text": "func (m *HookManager) Update(id string, h *Hook, opts ...RequestOption) error {\n\treturn m.Request(\"PATCH\", m.URI(\"hooks\", id), h, opts...)\n}", "title": "" } ]
c9e9ff14fc05d06d7cecffdebbcd2678
FetchRepoInfos fetches the repository information
[ { "docid": "1dfaacf487616a62a1c243150c832dfd", "score": "0.8261046", "text": "func (s *Service) FetchRepoInfos() {\n\tclog := logrus.WithFields(logrus.Fields{\"action\": \"repo\", \"service\": s.Name})\n\tu := strings.Split(s.Repo.URL, \"/\")\n\turl := fmt.Sprintf(\"https://api.github.com/repos/%s/%s\", u[len(u)-2], u[len(u)-1])\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tclog.WithError(err).Error(\"Couldn't create request\")\n\t\treturn\n\t}\n\tif conf.C.GithubOAuthToken != \"\" {\n\t\treq.Header.Add(\"Authorization\", \"token \"+conf.C.GithubOAuthToken)\n\t}\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\tclog.WithError(err).Error(\"Couldn't perform request\")\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\tvar repo GHRepo\n\tif err = json.NewDecoder(res.Body).Decode(&repo); err != nil {\n\t\tclog.WithError(err).Error(\"Couldn't decode response\")\n\t\treturn\n\t}\n\ts.Repo.Stars = repo.StargazersCount\n\ts.Repo.Forks = repo.ForksCount\n\ts.Repo.Watchers = repo.SubscribersCount\n\ts.Repo.Description = repo.Description\n}", "title": "" } ]
[ { "docid": "88d6c9355fe0250233af6af697e4c38b", "score": "0.6454037", "text": "func GetRepos(host, accessToken string, page int) ([]Repoinfo, error) {\n\n\turl := fmt.Sprintf(\"%s/api/v4/projects?private_token=%s&per_page=100&page=%d\", host, accessToken, page)\n\tbd, err := urlLoader(url)\n\n\tresp := []Repoinfo{}\n\tif err := json.Unmarshal(bd, &resp); err != nil {\n\t\tfmt.Printf(\"%s\", err)\n\t\tos.Exit(1)\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "c6541e307bdc35678341338ecd391b63", "score": "0.6336681", "text": "func FetchAllRepos(username string) (*RepoData, error) {\n\tavatarURL := \"\"\n\tstarCount := 0\n\trepoCount := 0\n\tforkCount := 0\n\tlangMap := make(map[string]int32)\n\tvar cursor *string\n\tvar bestRepo *UserRepositoryEdge\n\n\tfor {\n\t\tdata, err := FetchRepo(username, cursor)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tavatarURL = data.Data.User.AvatarURL\n\t\trepoCount = data.Data.User.Repositories.TotalCount\n\n\t\tfor i := 0; i < len(data.Data.User.Repositories.Edges); i++ {\n\t\t\tedge := data.Data.User.Repositories.Edges[i]\n\t\t\tstarCount += edge.Node.Stargazers.TotalCount\n\t\t\tforkCount += edge.Node.ForkCount\n\n\t\t\tif bestRepo == nil {\n\t\t\t\tbestRepo = &edge\n\t\t\t} else if edge.Node.Stargazers.TotalCount > bestRepo.Node.Stargazers.TotalCount {\n\t\t\t\tbestRepo = &edge\n\t\t\t}\n\n\t\t\tif edge.Node.PrimaryLanguage != nil {\n\t\t\t\tlangMap[edge.Node.PrimaryLanguage.Name]++\n\t\t\t} else {\n\t\t\t\tlangMap[\"Others\"]++\n\t\t\t}\n\t\t}\n\n\t\tif data.Data.User.Repositories.PageInfo.HasNextPage {\n\t\t\tcursor = &data.Data.User.Repositories.PageInfo.EndCursor\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn &RepoData{\n\t\tAvatarURL: avatarURL,\n\t\tStarCount: starCount,\n\t\tRepoCount: repoCount,\n\t\tForkCount: forkCount,\n\t\tLanguageMap: langMap,\n\t\tTopRepo: bestRepo,\n\t}, nil\n}", "title": "" }, { "docid": "65d63f4152c6e71695af1ea992bb9d35", "score": "0.63297504", "text": "func FetchRepositories() ([]string, error) {\n\treps := struct {\n\t\tRepositories []string `json:\"repositories\"`\n\t}{}\n\trestyClient := resty.New()\n\tclient := restyClient.SetHostURL(config.Cfg.DockerAPIBaseURL)\n\tsetupAPICred(client)\n\tr := client.R()\n\tresponse, err := r.Get(\"/_catalog\")\n\t// NOTE: consider using Logger.\n\tfmt.Printf(\"\\nrequest path: %s\\n\", response.Request.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif response.RawResponse.StatusCode == http.StatusOK {\n\t\terr = json.Unmarshal(response.Body(), &reps)\n\t\treturn reps.Repositories, err\n\t}\n\n\tif response.RawResponse.StatusCode == http.StatusNotFound {\n\t\treturn nil, errors.New(\"no docker repositories found\")\n\t}\n\n\terr = fmt.Errorf(\"error returned by query %s, status: %s\", response.Request.URL, response.RawResponse.Status)\n\treturn nil, err\n}", "title": "" }, { "docid": "d064d4912e2f3a97a564801f95078594", "score": "0.6190665", "text": "func (g *Github) fetchAllRepo(order string) ([]*github.Repository, error) {\n\tctx := context.Background()\n\n\tr, _, err := g.client.Repositories.List(ctx, g.owner, &github.RepositoryListOptions{Sort: order})\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"can't find all repo of owner %s\", g.owner)\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "90156c977155cd201fc53c0d2fe2f9da", "score": "0.6129961", "text": "func (g *Github) getRepositoryInfo(repositoryName githubv4.String, ownerLogin githubv4.String, assigneeLogin githubv4.String) (*[]Issue, error) {\n\tvar repositoryInfo RepositoryInfo\n\tvar allIssuesAssigned []Issue\n\n\tvariables := map[string]interface{} {\n\t\t\"login\": (*githubv4.String)(nil),\n\t\t\"repositoryName\": (*githubv4.String)(nil),\n\t\t\"assignee\": (*githubv4.String)(nil),\n\t\t\"issueState\": githubv4.IssueStateOpen,\n\t\t\"issueFirst\": githubv4.NewInt(1),\n\t\t\"issueAfter\": (*githubv4.String)(nil),\n\t}\n\tvariables[\"repositoryName\"] = repositoryName\n\tvariables[\"login\"] = ownerLogin\n\tvariables[\"assignee\"] = assigneeLogin\n\tfor {\n\t\terr := GithubClient.Query(context.Background(), &repositoryInfo, variables)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\t\tallIssuesAssigned = append(allIssuesAssigned, repositoryInfo.Repository.Issues.Nodes...)\n\t\tif !repositoryInfo.Repository.Issues.PageInfo.HasNextPage {\n\t\t\tbreak\n\t\t}\n\t\tvariables[\"issueAfter\"] = githubv4.NewString(repositoryInfo.Repository.Issues.PageInfo.EndCursor)\n\t}\n\treturn &allIssuesAssigned, nil\n}", "title": "" }, { "docid": "808062508b949a57c6838d5c75eb6ef9", "score": "0.6099203", "text": "func (c APIClient) ListRepo() ([]*pfs.RepoInfo, error) {\n\treturn c.ListProjectRepo(&pfs.ListRepoRequest{Type: pfs.UserRepoType})\n}", "title": "" }, { "docid": "3619161dff30c2a36af98a343fb563ee", "score": "0.6059912", "text": "func List(nexusUrl, repoType, provider, repoPolicy string, user m.AuthUser, verbose bool) []string {\n\turl := nexusUrl + \"/service/local/all_repositories\"\n\tCheckRepoType(repoType)\n\tCheckProvider(provider)\n\tCheckMavenRepoPolicy(repoPolicy)\n\tvar repositories []string\n\treq := u.CreateBaseRequest(\"GET\", url, nil, user, verbose)\n\tresponse, _ := u.HTTPRequest(user, req, verbose)\n\tvar jsonObject m.Repository\n\tjson.Unmarshal(response, &jsonObject)\n\tfor _, repo := range jsonObject.Data {\n\t\tif repoType == \"\" && provider == \"\" && repoPolicy == \"\" {\n\t\t\trepositories = append(repositories, repo.Name)\n\t\t} else if repo.RepoType == repoType && provider == \"\" && repoPolicy == \"\" {\n\t\t\trepositories = append(repositories, repo.Name)\n\t\t} else if repoType == \"\" && repo.Format == provider && repoPolicy == \"\" {\n\t\t\trepositories = append(repositories, repo.Name)\n\t\t} else if repo.RepoType == repoType && repo.Format == provider && repoPolicy == \"\" {\n\t\t\trepositories = append(repositories, repo.Name)\n\t\t} else if repo.RepoType == repoType && repo.Format == provider && strings.ToUpper(repoPolicy) == repo.RepoPolicy {\n\t\t\trepositories = append(repositories, repo.Name)\n\t\t}\n\t}\n\treturn repositories\n}", "title": "" }, { "docid": "ffc2bf42df73481fa9cabbd790be06e2", "score": "0.605335", "text": "func (c *NexusManager) List() *Repositories {\n\t//c.Config.Nexus_repo\n\theaders := map[string]string{\n\t\t\"Accept\": ACCEPT_HEADER,\n\t}\n\n\turl := fmt.Sprintf(\"%s/repository/%s/v2/_catalog\", c.Config.Nexus_url, c.Config.Nexus_repo)\n\tout, _ := c.rest.DoGet(url, headers, c.Config.Nexus_username, c.Config.Nexus_password)\n\n\tvar repositories Repositories\n\terr := json.Unmarshal(out, &repositories)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\t//fmt.Printf(\"%v\", repositories)\n\treturn &repositories\n}", "title": "" }, { "docid": "741c22593e9bb0bfa3dab8f31126a413", "score": "0.59851635", "text": "func getRepos() (repoSlice []RepoType, err error) {\n\tif len(ReposToProcess) > 0 {\n\t\tfor repo := range ReposToProcess {\n\t\t\trepoSlice = append(repoSlice, repo)\n\t\t}\n\t\treturn\n\t}\n\n\tif *RegistryProto == \"v2\" {\n\t\tblog.Error(\"v2 registry search/catalog interface not yet supported in collector\")\n\t\treturn\n\t}\n\n\t// a query with an empty query string returns all the repos\n\tvar client *http.Client\n\tif *RegistryTLSNoVerify {\n\t\ttr := &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t}\n\t\tclient = &http.Client{Transport: tr}\n\t} else {\n\t\tclient = &http.Client{}\n\t}\n\tresponse, err := RegistryQuery(client, RegistryAPIURL+\"/v1/search?q=\", BasicAuth)\n\tif err != nil {\n\t\tblog.Error(err)\n\t\tif s, ok := err.(*HTTPStatusCodeError); ok {\n\t\t\tblog.Error(\"HTTP bad status code %d from registry %s using --registryhttps=%v --registryauth=%v --registryproto=%s\", s.StatusCode, RegistryAPIURL, *HTTPSRegistry, *AuthRegistry, *RegistryProto)\n\t\t}\n\t\treturn\n\t}\n\n\t// parse the JSON response body and populate repo slice\n\tvar result registrySearchResult\n\tif err = json.Unmarshal(response, &result); err != nil {\n\t\tblog.Error(err, \"unmarshal\", string(response))\n\t\treturn\n\t}\n\tfor _, elem := range result.Results {\n\t\tif ExcludeRepo[RepoType(elem.Name)] {\n\t\t\tcontinue\n\t\t}\n\t\trepoSlice = append(repoSlice, RepoType(elem.Name))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3422d54fcc042ab9c6ec175b37748328", "score": "0.5962548", "text": "func (c *Client) Repositories(useCache bool) map[string][]string {\n\t// Return from cache if available.\n\tif len(c.repos) > 0 && useCache {\n\t\treturn c.repos\n\t}\n\n\tc.mux.Lock()\n\tdefer c.mux.Unlock()\n\n\tlinkRegexp := regexp.MustCompile(\"^<(.*?)>;.*$\")\n\tscope := \"registry:catalog:*\"\n\turi := \"/v2/_catalog\"\n\ttmp := map[string][]string{}\n\tfor {\n\t\tdata, resp := c.callRegistry(uri, scope, \"manifest.v2\")\n\t\tif data == \"\" {\n\t\t\tc.repos = tmp\n\t\t\treturn c.repos\n\t\t}\n\n\t\tfor _, r := range gjson.Get(data, \"repositories\").Array() {\n\t\t\tnamespace := \"library\"\n\t\t\trepo := r.String()\n\t\t\tif strings.Contains(repo, \"/\") {\n\t\t\t\tf := strings.SplitN(repo, \"/\", 2)\n\t\t\t\tnamespace = f[0]\n\t\t\t\trepo = f[1]\n\t\t\t}\n\t\t\ttmp[namespace] = append(tmp[namespace], repo)\n\t\t}\n\n\t\t// pagination\n\t\tlinkHeader := resp.Header.Get(\"Link\")\n\t\tlink := linkRegexp.FindStringSubmatch(linkHeader)\n\t\tif len(link) == 2 {\n\t\t\t// update uri and query next page\n\t\t\turi = link[1]\n\t\t} else {\n\t\t\t// no more pages\n\t\t\tbreak\n\t\t}\n\t}\n\tc.repos = tmp\n\treturn c.repos\n}", "title": "" }, { "docid": "44f6579ca8e12e3530b1e8013d527ed1", "score": "0.59497344", "text": "func fetchRepo(basedir, name, spec string) error {\n\toutdir := filepath.Join(basedir, name)\n\tif _, err := os.Stat(outdir); err == nil {\n\t\treturn nil\n\t}\n\n\twarnOnce.Do(func() {\n\t\tlog.Println(\"Fetching dependencies...\")\n\t})\n\ttryURL, err := fromBowerSpec(name, spec)\n\tif err != nil {\n\t\treturn err\n\t}\n\tzipFile := filepath.Join(basedir, name+\".zip\")\n\tvar ok bool\n\tfor _, u := range tryURL {\n\t\tif err := downloadFile(zipFile, u); err == nil {\n\t\t\tok = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !ok {\n\t\treturn fmt.Errorf(\"fetchRepo(%q, %q): could not find in any of %q\", name, spec, tryURL)\n\t}\n\tif err := stripUnzip(outdir, zipFile); err != nil {\n\t\treturn err\n\t}\n\tos.Remove(zipFile)\n\n\t// If unzipped archive contains a bower.json, parse it, and for each dependency therein,\n\t// recursively fetch the corresponding repo.\n\tbowerFile := filepath.Join(outdir, \"bower.json\")\n\traw, err := ioutil.ReadFile(bowerFile)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\tvar bower struct {\n\t\tDependencies map[string]string\n\t}\n\tif err := json.Unmarshal(raw, &bower); err != nil {\n\t\treturn fmt.Errorf(\"%s: %v\", bowerFile, err)\n\t}\n\n\tfor name, spec := range bower.Dependencies {\n\t\tif err := fetchRepo(basedir, name, spec); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "de67476267653e789ed8e5dbc75b3eb2", "score": "0.59456813", "text": "func (repo ServerInfoRepository) FetchServersInfo() (model.ItemsInfo, error) {\n\tfmt.Println(\"Fetching\")\n\tsqlstm := `SELECT dns, data FROM serverinfo`\n\trows, err := repo.db.Query(sqlstm)\n\tif err != nil {\n\t\tfmt.Print(\"[ERROR] FAILURE fetching data\")\n\t}\n\tdefer rows.Close()\n\n\tvar items []model.ServerInfo\n\tfor rows.Next() {\n\t\tvar servInfo model.ServerInfo\n\t\tif err := rows.Scan(&servInfo.DNS, &servInfo.Data); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\titems = append(items, servInfo)\n\t}\n\titemsInfo := model.ItemsInfo{\n\t\tItems: items,\n\t}\n\tfmt.Println(\"Fetching finished\")\n\treturn itemsInfo, nil\n}", "title": "" }, { "docid": "08e627b9f0f6137021cfe6a75bdbf8f4", "score": "0.589148", "text": "func (r *RepoResource) List() ([]Repo, error) {\n\trepos := []Repo{}\n\tresponse := Response{}\n\tpath := \"/repos\"\n\tparams := url.Values{}\n\n\tfor {\n\t\tif response.NextPageStart != 0 {\n\t\t\tparams.Set(\"start\", fmt.Sprintf(\"%d\", response.NextPageStart))\n\t\t}\n\n\t\tif err := r.client.do(\"GET\", \"core\", path, params, nil, &response); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trepos = append(repos, response.Values...)\n\n\t\tif response.IsLastPage {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn repos, nil\n}", "title": "" }, { "docid": "5766969f55dde5207df20a6974c7aca2", "score": "0.58911675", "text": "func refreshRepoList() (map[int64]repoEntry, error) {\n\t/*\n\t\tHits the drone API to get the repo list for the authenticated user account\n\t\tuses the build count to monitor for additional build information.\n\t*/\n\trepos, err := droneClient.RepoList()\n\tincAPICount()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnamespaceRegexp := regexp.MustCompile(namespaceFilter)\n\trepoRegexp := regexp.MustCompile(repoFilter)\n\n\tfor _, repo := range repos {\n\t\tif repo.Active && (namespaceFilter == \"\" || namespaceRegexp.MatchString(repo.Namespace)) && (repoFilter == \"\" || repoRegexp.MatchString(repo.Name)) {\n\t\t\tif _, ok := reposData[repo.ID]; ok {\n\t\t\t\tif repo.Counter != reposData[repo.ID].counter || reposData[repo.ID].status == unknown {\n\t\t\t\t\t// Build data should be refreshed, change in build counter. (Also update the counter value)\n\t\t\t\t\treposData[repo.ID] = repoEntry{\n\t\t\t\t\t\tnamespace: repo.Namespace,\n\t\t\t\t\t\tname: repo.Name,\n\t\t\t\t\t\tcounter: repo.Counter,\n\t\t\t\t\t\tstatus: fetchBuildStatus(repo.Namespace, repo.Name, repo.Branch),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if repo.Counter > 0 {\n\t\t\t\t// Disregard any repos that do not yet have a build status\n\t\t\t\t// Initial setup for repo data\n\t\t\t\treposData[repo.ID] = repoEntry{\n\t\t\t\t\tnamespace: repo.Namespace,\n\t\t\t\t\tname: repo.Name,\n\t\t\t\t\tcounter: repo.Counter,\n\t\t\t\t\tstatus: fetchBuildStatus(repo.Namespace, repo.Name, repo.Branch),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn reposData, nil\n}", "title": "" }, { "docid": "76285b7920b63a0b7262118d02af71b8", "score": "0.5865702", "text": "func (a *API) FetchRepos(team string, updated time.Time, repo chan<- *sdk.SourceCodeRepo) error {\n\tsdk.LogDebug(a.logger, \"fetching repos\", \"team\", team, \"since\", updated)\n\tendpoint := sdk.JoinURL(\"repositories\", team)\n\tparams := url.Values{}\n\tif !updated.IsZero() {\n\t\tparams.Set(\"q\", `updated_on > `+updated.Format(updatedFormat))\n\t}\n\tparams.Set(\"sort\", \"-updated_on\")\n\tvar count int\n\tif err := a.paginate(endpoint, params, func(obj json.RawMessage) error {\n\t\trawRepos := []RepoResponse{}\n\t\tif err := json.Unmarshal(obj, &rawRepos); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcount += len(rawRepos)\n\t\tfor _, each := range rawRepos {\n\t\t\tts := time.Now()\n\t\t\trepo <- a.ConvertRepo(each)\n\t\t\tsdk.LogDebug(a.logger, \"processed repo\", \"updated_on\", each.UpdatedOn, \"since\", updated, \"waited\", time.Since(ts))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"error fetching repos. err %v\", err)\n\t}\n\tsdk.LogDebug(a.logger, \"finished fetching repos\", \"team\", team, \"count\", count)\n\treturn nil\n}", "title": "" }, { "docid": "f6112b78e1b8e01273a2b9b306f8a22b", "score": "0.5865323", "text": "func getRepositories(\n\tcfg *viper.Viper,\n\trm hub.RepositoryManager,\n) ([]*hub.Repository, error) {\n\treposNames := cfg.GetStringSlice(\"tracker.repositoriesNames\")\n\treposKinds := cfg.GetStringSlice(\"tracker.repositoriesKinds\")\n\n\tvar repos []*hub.Repository\n\tswitch {\n\tcase len(reposNames) > 0:\n\t\tfor _, name := range reposNames {\n\t\t\trepo, err := rm.GetByName(context.Background(), name, true)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error getting repository %s: %w\", name, err)\n\t\t\t}\n\t\t\trepos = append(repos, repo)\n\t\t}\n\tcase len(reposKinds) > 0:\n\t\tfor _, kindName := range reposKinds {\n\t\t\tkind, err := hub.GetKindFromName(kindName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid repository kind found in config: %s\", kindName)\n\t\t\t}\n\t\t\tkindRepos, err := rm.GetByKind(context.Background(), kind, true)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error getting repositories by kind (%s): %w\", kindName, err)\n\t\t\t}\n\t\t\trepos = append(repos, kindRepos...)\n\t\t}\n\tdefault:\n\t\tvar err error\n\t\trepos, err = rm.GetAll(context.Background(), true)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting all repositories: %w\", err)\n\t\t}\n\t}\n\n\tvar reposFiltered []*hub.Repository\n\tfor _, repo := range repos {\n\t\tif !repo.Disabled {\n\t\t\treposFiltered = append(reposFiltered, repo)\n\t\t}\n\t}\n\n\treturn reposFiltered, nil\n}", "title": "" }, { "docid": "91696c8c1a90e82da05088a70a53b4cb", "score": "0.58077943", "text": "func (g *Github) ListRepo(limit int, order string, metrics []string) ([][]string, error) {\n\theaders := []string{\"name\"}\n\n\trs, err := g.fetchAllRepo(order)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif limit > len(rs) {\n\t\tlimit = len(rs)\n\t}\n\n\trepos := make([][]string, limit+1)\n\n\tstars := false\n\twatchers := false\n\tforks := false\n\topenIssues := false\n\n\tif contains(metrics, githubRepoStars) {\n\t\theaders = append(headers, githubRepoStars)\n\t\tstars = true\n\t}\n\tif contains(metrics, githubRepoWatchers) {\n\t\theaders = append(headers, githubRepoWatchers)\n\t\twatchers = true\n\t}\n\tif contains(metrics, githubRepoForks) {\n\t\theaders = append(headers, githubRepoForks)\n\t\tforks = true\n\t}\n\tif contains(metrics, githubRepoOpenIssues) {\n\t\theaders = append(headers, githubRepoOpenIssues)\n\t\topenIssues = true\n\t}\n\n\trepos[0] = headers\n\n\tfor k, v := range rs {\n\t\tif k < limit {\n\t\t\trepos[k+1] = append(repos[k+1], v.GetName())\n\t\t\tif stars {\n\t\t\t\trepos[k+1] = append(repos[k+1], strconv.FormatInt(int64(v.GetStargazersCount()), 10))\n\t\t\t}\n\t\t\tif watchers {\n\t\t\t\trepos[k+1] = append(repos[k+1], strconv.FormatInt(int64(v.GetSubscribersCount()), 10))\n\t\t\t}\n\t\t\tif forks {\n\t\t\t\trepos[k+1] = append(repos[k+1], strconv.FormatInt(int64(v.GetForksCount()), 10))\n\t\t\t}\n\t\t\tif openIssues {\n\t\t\t\trepos[k+1] = append(repos[k+1], strconv.FormatInt(int64(v.GetOpenIssuesCount()), 10))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn repos, nil\n}", "title": "" }, { "docid": "81eca22681037ab66e10c95c154580d8", "score": "0.580757", "text": "func FetchRepo(username string, after *string) (*UserRepositoryResponse, error) {\n\tvariables, _ := json.Marshal(map[string]interface{}{\n\t\t\"username\": username,\n\t\t\"after\": after,\n\t})\n\tdata, err := FetchGhGql(UserQuery, string(variables))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb, _ := json.Marshal(data)\n\tvar resp UserRepositoryResponse\n\terr = json.Unmarshal(b, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "c5ac15809d42c8cc0c8666061ab9fea0", "score": "0.5804455", "text": "func fetchReleases(\n\tctx context.Context, logger log.Interface, db *ent.Tx, repo *github.Repository,\n) (allReleases []*github.RepositoryRelease, err error) {\n\tvar resp *github.Response\n\n\topts := &github.ListOptions{\n\t\tPerPage: 100,\n\t\tPage: 1,\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ctx.Err()\n\t\tdefault:\n\t\t}\n\n\t\ttime.Sleep(1 * time.Second)\n\n\t\tvar releases []*github.RepositoryRelease\n\n\t\tlogger.WithFields(log.Fields{\n\t\t\t\"page\": opts.Page,\n\t\t\t\"repo\": repo.GetFullName(),\n\t\t}).Info(\"querying repository releases\")\n\t\treleases, resp, err = RestClient.Repositories.ListReleases(ctx, repo.GetOwner().GetLogin(), repo.GetName(), opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, release := range releases {\n\t\t\tallReleases = append(allReleases, release)\n\t\t}\n\n\t\tif resp.NextPage < 1 {\n\t\t\tbreak\n\t\t}\n\t\topts.Page = resp.NextPage\n\t}\n\n\treturn allReleases, nil\n}", "title": "" }, { "docid": "803ac82c050d07f5f40da5d46e5dd74b", "score": "0.5791886", "text": "func repositories(dir string, initContents string) ([]string, error) {\n\tinitFile, err := ioutil.TempFile(\"\", \"*-spdx-init.gradle\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, err = initFile.Write([]byte(initContents))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinitPath, err := filepath.Abs(initFile.Name())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout, err := newGradleExec(dir).run(\":spdxPrintRepos\", \"--init-script\", initPath, \"-q\").CombinedOutput()\n\tif err != nil {\n\t\tlog.Println(string(out))\n\t}\n\treturn parseRepoOutput(out)\n}", "title": "" }, { "docid": "6c5653d633934d4935c62170798b2c93", "score": "0.57872194", "text": "func (g SearchGateway) Repositories(\n\tctx context.Context,\n\treq SearchRepositoriesRequest,\n\topts ...RequestOptions) (*SearchRepositoriesResponse, error) {\n\n\thttpReq, err := http.NewRequest(http.MethodGet, fmt.Sprintf(\"%s/search/repositories\", BaseURL), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tq := httpReq.URL.Query()\n\tq.Set(\"q\", req.Encode())\n\thttpReq.URL.RawQuery = q.Encode()\n\n\tif g.config != nil {\n\t\topts = append(opts, AuthenticationOptions{\n\t\t\tClientID: g.config.ClientID,\n\t\t\tClientSecret: g.config.ClientSecret,\n\t\t})\n\t}\n\n\tfor _, o := range opts {\n\t\to.Apply(httpReq)\n\t}\n\n\thttpReq = httpReq.WithContext(ctx)\n\thttpReq.Header.Set(\"Accept\", \"application/vnd.github.mercy-preview+json\")\n\n\tg.logger.Tracef(\"sending HTTP GET request to %s\", httpReq.URL.String())\n\n\thttpResp, err := g.HTTPClient.Do(httpReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif httpResp.StatusCode != http.StatusOK {\n\t\tvar resp Error\n\t\tresp.StatusCode = httpResp.StatusCode\n\n\t\tif err := json.NewDecoder(httpResp.Body).Decode(&resp); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to decode response: %s\", err)\n\t\t}\n\n\t\treturn nil, resp\n\t}\n\n\tdefer httpResp.Body.Close()\n\n\tvar resp SearchRepositoriesResponse\n\tif err := json.NewDecoder(httpResp.Body).Decode(&resp); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to decode response: %s\", err)\n\t}\n\n\treturn &resp, nil\n}", "title": "" }, { "docid": "0ef05ecf9ab6105113c0222c8e148c04", "score": "0.57787174", "text": "func (b *Builder) ListRepos() error {\n\tif _, err := os.Stat(b.Config.Builder.DNFConf); os.IsNotExist(err) {\n\t\treturn errors.Wrap(err, \"unable to find DNF configuration, try initializing workspace\")\n\t}\n\n\tDNFConf, err := ini.Load(b.Config.Builder.DNFConf)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to load DNF configration, try initializing workspace\")\n\t}\n\n\tb.repos = make(map[string]repoInfo)\n\n\tfor _, s := range DNFConf.Sections() {\n\t\tvar repo repoInfo\n\t\tname := s.Name()\n\t\tif name == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tu := s.Key(\"baseurl\").Value()\n\t\tif u == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tpURL, err := url.Parse(u)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif pURL.Scheme == \"\" {\n\t\t\tpURL.Scheme = \"file\"\n\t\t}\n\n\t\tpriority := s.Key(\"priority\").Value()\n\t\tif priority == \"\" {\n\t\t\t// When the priority field is omitted, the DNF default is 99.\n\t\t\tpriority = \"99\"\n\t\t}\n\n\t\tlog.Info(log.Mixer, \"%s\\t%s\\t%s\", name, priority, pURL.String())\n\n\t\trepo.urlScheme = pURL.Scheme\n\t\trepo.url = pURL.String()\n\t\trepo.cacheDirs = make(map[string]bool)\n\t\tif pURL.Scheme == \"file\" {\n\t\t\trepo.cacheDirs[pURL.String()] = true\n\t\t} else {\n\t\t\trepo.cacheDirs[dnfDownloadDir] = true\n\t\t}\n\n\t\tb.repos[name] = repo\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dee83ff192e77079e99992663517845", "score": "0.5755313", "text": "func (gh *GitHubHost) describeGithubUserRepos() []repository {\n\tlogger.Println(\"listing GitHub user's owned repositories\")\n\n\tgcs := gitHubCallSize\n\tenvCallSize := os.Getenv(githubEnvVarCallSize)\n\tif envCallSize != \"\" {\n\t\tif callSize, err := strconv.Atoi(envCallSize); err != nil {\n\t\t\tgcs = callSize\n\t\t}\n\t}\n\n\tvar repos []repository\n\n\treqBody := \"{\\\"query\\\": \\\"query { viewer { repositories(first:\" + strconv.Itoa(gcs) + \") { edges { node { name nameWithOwner url sshUrl } cursor } pageInfo { endCursor hasNextPage }} } }\\\"\"\n\n\tfor {\n\t\tbodyStr := gh.makeGithubRequest(reqBody)\n\n\t\tvar respObj githubQueryNamesResponse\n\t\tif err := json.Unmarshal([]byte(bodyStr), &respObj); err != nil {\n\t\t\tlogger.Fatal(err)\n\t\t}\n\n\t\tfor _, repo := range respObj.Data.Viewer.Repositories.Edges {\n\t\t\trepos = append(repos, repository{\n\t\t\t\tName: repo.Node.Name,\n\t\t\t\tSSHUrl: repo.Node.SSHURL,\n\t\t\t\tHTTPSUrl: repo.Node.URL,\n\t\t\t\tPathWithNameSpace: repo.Node.NameWithOwner,\n\t\t\t\tDomain: gitHubDomain,\n\t\t\t})\n\t\t}\n\n\t\tif !respObj.Data.Viewer.Repositories.PageInfo.HasNextPage {\n\t\t\tbreak\n\t\t} else {\n\t\t\treqBody = \"{\\\"query\\\": \\\"query($first:Int $after:String){ viewer { repositories(first:$first after:$after) { edges { node { name nameWithOwner url sshUrl } cursor } pageInfo { endCursor hasNextPage }} } }\\\", \\\"variables\\\":{\\\"first\\\":\" + strconv.Itoa(gcs) + \",\\\"after\\\":\\\"\" + respObj.Data.Viewer.Repositories.PageInfo.EndCursor + \"\\\"} }\"\n\t\t}\n\t}\n\n\treturn repos\n}", "title": "" }, { "docid": "ccf8f605d9864615213ab639f5569d55", "score": "0.5728694", "text": "func (l *localStore) Repositories(ctx context.Context, entries []string, last string) (n int, err error) {\n\treturn l.registry.Repositories(ctx, entries, last)\n}", "title": "" }, { "docid": "18a9b84baedf20f10c65ea4cb83270bf", "score": "0.5721883", "text": "func discoverRepos(ownerPath string) ([]Repo, error) {\n\tvar (\n\t\terr error\n\t\trepos []Repo\n\t)\n\tfiles, err := ioutil.ReadDir(ownerPath)\n\tif err != nil {\n\t\treturn repos, err\n\t}\n\tfor _, f := range files {\n\t\tif f.IsDir() {\n\t\t\trepoPath := path.Join(ownerPath, f.Name())\n\t\t\tr, err := git.PlainOpen(repoPath)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trepos = append(repos, Repo{\n\t\t\t\trepository: r,\n\t\t\t\tname: f.Name(),\n\t\t\t\tpath: repoPath,\n\t\t\t})\n\t\t}\n\t}\n\treturn repos, err\n}", "title": "" }, { "docid": "54d5842701639116fc094af645a19a8f", "score": "0.57211494", "text": "func (a RepositoryManagementAPI) List() ([]Repository, error) {\n\trr := []Repository{}\n\tpath := fmt.Sprintf(\"beta/repositories\")\n\n\tresp, err := a.client.sendRequest(http.MethodGet, path, nil, nil)\n\tif err != nil {\n\t\treturn rr, err\n\t}\n\terr = json.Unmarshal(resp, &rr)\n\treturn rr, err\n}", "title": "" }, { "docid": "83111e0f2e3dcceeae82c5eafb38eec3", "score": "0.571039", "text": "func getRepoURLs() []string {\n\tif pollHelmHub {\n\t\thc, err := nova_helm.NewHubConfig(helmHubConfigURL)\n\t\tif err == nil {\n\t\t\treturn append(repos, hc.URLs()...)\n\t\t}\n\t}\n\treturn repos\n}", "title": "" }, { "docid": "e39f3a901ed277c8a429cf658bdd320e", "score": "0.5699595", "text": "func (a *APIController) GetRepositories(res http.ResponseWriter, req *http.Request) {\r\n\r\n\tvar getRepositoriesRequest GetRepositoriesRequest\r\n\tvar getRepositoriesResponse GetRepositoriesResponse\r\n\tjson.NewDecoder(req.Body).Decode(&getRepositoriesRequest)\r\n\tvalidate = validator.New()\r\n\terr := validate.Struct(getRepositoriesRequest)\r\n\tif err != nil {\r\n\t\tgetRepositoriesResponse.Message = err.Error()\r\n\t\tjson.NewEncoder(res).Encode(getRepositoriesResponse)\r\n\t} else {\r\n\t\tclient := github.NewClient(nil)\r\n\t\topt := &github.SearchOptions{Sort: \"stars\", Order: \"desc\"}\r\n\t\tquery := \"org:\" + getRepositoriesRequest.Org\r\n\t\tsearchRepos, _, err := client.Search.Repositories(context.Background(), query, opt)\r\n\t\trepos := searchRepos.Repositories\r\n\t\tif err != nil {\r\n\t\t\tgetRepositoriesResponse.Message = err.Error()\r\n\t\t\tjson.NewEncoder(res).Encode(getRepositoriesResponse)\r\n\t\t} else {\r\n\t\t\tif len(repos) > 0 {\r\n\t\t\t\tsort.SliceStable(repos, func(i, j int) bool { return *repos[i].StargazersCount > *repos[j].StargazersCount })\r\n\t\t\t\tsortedRepos := make([]github.Repository, 3)\r\n\t\t\t\ti := 0\r\n\t\t\t\tfor _, repo := range repos {\r\n\t\t\t\t\tsortedRepos[i].Name = repo.Name\r\n\t\t\t\t\tsortedRepos[i].StargazersCount = repo.StargazersCount\r\n\t\t\t\t\ti++\r\n\t\t\t\t\tif i == 3 {\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tgetRepositoriesResponse.Message = \"Request completed successfully\"\r\n\t\t\t\tgetRepositoriesResponse.Results = sortedRepos\r\n\t\t\t\tjson.NewEncoder(res).Encode(getRepositoriesResponse)\r\n\t\t\t} else {\r\n\t\t\t\tgetRepositoriesResponse.Message = \"No repositories found for the org:\" + getRepositoriesRequest.Org\r\n\t\t\t\tjson.NewEncoder(res).Encode(getRepositoriesResponse)\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "06764f46a1c80fe3b363841b35ce4e6a", "score": "0.5699323", "text": "func listDockerhubRepos(flags *pflag.FlagSet, options *listRepoOptions) {\n\tvar ret = []listResult{}\n\n\truntime.GOMAXPROCS(runtime.NumCPU())\n\tavailableRoutines := runtime.NumCPU()\n\troutineReady := make(chan bool)\n\tchanRes := make(chan listResult)\n\n\torg, _, err := dockerhub.GetFlags(flags)\n\tif err != nil {\n\t\tcolor.Red(\"Error: %s\", err)\n\t}\n\n\trepositories, err := dockerhub.NewClient(org, \"\").ListRepositories()\n\tif err != nil {\n\t\tcolor.Red(\"Error: %s\", err)\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tr, opened := <-chanRes\n\t\t\tif !opened {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tret = append(ret, r)\n\t\t}\n\t}()\n\n\tlimiter := time.Tick(300 * time.Millisecond)\n\n\tfor _, repo := range repositories {\n\t\t<-limiter\n\t\tif availableRoutines == 0 {\n\t\t\t<-routineReady\n\t\t\tavailableRoutines = availableRoutines + 1\n\t\t}\n\t\tavailableRoutines = availableRoutines - 1\n\n\t\tgo lister(org, repo, chanRes, routineReady)\n\t}\n\n\tfor availableRoutines < runtime.NumCPU() {\n\t\t<-routineReady\n\t\tavailableRoutines = availableRoutines + 1\n\t}\n\n\tclose(chanRes)\n\n\tif options.expand {\n\t\tfmt.Printf(\"| Image Num | %-44s | %-7s | %-7s | %-7s | %s\\n\", \"Name\", \"Pulls Count\", \"AvgSize (MB)\", \"Tags Count\", \"Last Updated\")\n\t}\n\tif !options.expand {\n\t\tfmt.Printf(\"| Image Num | %-55s | %s\\n\", \"Name\", \"Tags Count\")\n\t}\n\n\tfor repoCount, info := range ret {\n\t\tif options.expand {\n\t\t\tif info.tagsCount == 0 {\n\t\t\t\tfmt.Printf(\"| Image %-5d | %-55s | %-11d | %-12.2f | %-21s | %s\\n\", repoCount+1, dockerhub.BW(info.repoName), info.repoPullCount, info.avgSize, dockerhub.BR(info.tagsCount), info.lastUpdated)\n\t\t\t} else if info.tagsCount >= 50 {\n\t\t\t\tfmt.Printf(\"| Image %-5d | %-55s | %-11d | %-12.2f | %-21s | %s\\n\", repoCount+1, dockerhub.BW(info.repoName), info.repoPullCount, info.avgSize, dockerhub.BY(info.tagsCount), info.lastUpdated)\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"| Image %-5d | %-55s | %-11d | %-12.2f | %-21s | %s\\n\", repoCount+1, dockerhub.BW(info.repoName), info.repoPullCount, info.avgSize, dockerhub.BW(info.tagsCount), info.lastUpdated)\n\t\t\t}\n\t\t}\n\t\tif !options.expand {\n\t\t\tfmt.Printf(\"| Image %-5d | %-55s | %d\\n\", repoCount+1, info.repoName, info.tagsCount)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "15f73eb706bf4777ab2103260ab67c5f", "score": "0.5698329", "text": "func getRepositories(dir string) ([]string, error) {\n\treturn repositories(dir, initRepos)\n}", "title": "" }, { "docid": "6fd1ebcd4e44afe4f73195014af22e45", "score": "0.5682239", "text": "func (g *GitFake) Info(dir string) (*GitRepository, error) {\n\treturn &g.RepoInfo, nil\n}", "title": "" }, { "docid": "ff126bb2dea12941ac39d29431a247ca", "score": "0.56587607", "text": "func (s *RemoteStore) Repositories(ctx context.Context, entries []string, last string) (n int, err error) {\n\treturn s.registry.Repositories(ctx, entries, last)\n}", "title": "" }, { "docid": "9a1eff31a6f7d33ee232b0625c468629", "score": "0.5658552", "text": "func getReposHub() (hubInfo []HubInfo, err error) {\n\t// lookup defines a function that takes a repository name as input and returns\n\t// the Docker auth token and registry URL to access that repository.\n\tclient := &http.Client{}\n\tlookup := func(repo RepoType) (dockerToken, registryURL string) {\n\t\tURL := RegistryAPIURL + \"/v1/repositories/\" + string(repo) + \"/images\"\n\t\treq, e := http.NewRequest(\"GET\", URL, nil)\n\t\treq.Header.Set(\"X-Docker-Token\", \"true\")\n\t\tif BasicAuth != \"\" {\n\t\t\treq.Header.Set(\"Authorization\", \"Basic \"+BasicAuth)\n\t\t}\n\t\tr, e := client.Do(req)\n\t\tif e != nil {\n\t\t\tblog.Error(e, \":getReposHub HTTP request failed\")\n\t\t\treturn\n\t\t}\n\t\tdefer r.Body.Close()\n\t\tif r.StatusCode != 200 {\n\t\t\tblog.Error(\"getReposHub HTTP bad status code %d from Docker Hub\", r.StatusCode)\n\t\t\treturn\n\t\t}\n\t\tdockerToken = r.Header.Get(\"X-Docker-Token\")\n\t\tregistryURL = r.Header.Get(\"X-Docker-Endpoints\")\n\t\tarr := strings.Split(registryURL, \",\")\n\t\tif len(arr) == 0 {\n\t\t\tregistryURL = \"\"\n\t\t\treturn\n\t\t}\n\t\tregistryURL = strings.TrimSpace(arr[0])\n\t\treturn\n\t}\n\tif len(ReposToProcess) > 0 {\n\t\tfor repo := range ReposToProcess {\n\t\t\tdockerToken, registryURL := lookup(repo)\n\t\t\tif dockerToken == \"\" {\n\t\t\t\tblog.Error(repo, \":Could not find info for repo.\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thubInfo = append(hubInfo,\n\t\t\t\tHubInfo{Repo: repo, DockerToken: dockerToken, RegistryURL: registryURL})\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b18e1c4aeb58d60e223381fe6269b4af", "score": "0.5654007", "text": "func fetchRepo() (therepo *Repo, err error) {\n\trepo := new(Repo)\n\n\toldPath := \"\"\n\n\t// Check the existance of the projectFile using the relative path\n\t_, e := os.Stat(filepath.Join(relativePath, projectFile))\n\tfmt.Println(\"Checked\", filepath.Join(relativePath, projectFile), e)\n\n\t// If not found attempt to go up directory tree\n\tfor e != nil {\n\t\tnewPath, _ := filepath.Abs(filepath.Join(relativePath, projectFile))\n\t\tif newPath == oldPath {\n\t\t\treturn nil, fmt.Errorf(\"Unable to locate relative repo path\")\n\t\t}\n\t\toldPath = newPath\n\t\trelativePath = filepath.Join(relativePath, \"..\")\n\t\t_, e = os.Stat(filepath.Join(relativePath, projectFile))\n\t}\n\n\t// If able to read file, call the parse and return the repo\n\tif b, err := ioutil.ReadFile(filepath.Join(relativePath, projectFile)); err != nil {\n\t\trelativePath = \"\"\n\t\treturn nil, err\n\t} else if e := json.Unmarshal(b, repo); e != nil {\n\t\treturn repo, e\n\t}\n\treturn repo, nil\n}", "title": "" }, { "docid": "5831d091bd67a03fafc85664730b5f87", "score": "0.5650796", "text": "func (s OtherSource) ListRepos(ctx context.Context) ([]*Repo, error) {\n\turls, err := s.cloneURLs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turn := s.svc.URN()\n\trepos := make([]*Repo, 0, len(urls))\n\tfor _, u := range urls {\n\t\trepos = append(repos, otherRepoFromCloneURL(urn, u))\n\t}\n\n\treturn repos, nil\n}", "title": "" }, { "docid": "ff343081584527138d4fcafc4b370ba2", "score": "0.56267244", "text": "func (client Client) ListOrganizationRepos(org string, projectCount int, sortType string) (RepositoriesWithPR, error) {\n\tlog.Println(\"Using sort:\", sortType)\n\thc := http.Client{}\n\trequest, err := http.NewRequest(http.MethodGet, fmt.Sprintf(\"%s/orgs/%s/repos\", client.config.GithubAPIURL, org), nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"cannot build request\")\n\t}\n\n\tclient.prepareRequest(request)\n\n\tvar repos RepositoriesWithPR\n\t// we will stop once we don't have extra results.\n\tlog.Println(\"List of repos in organization:\", org)\n\n\tfor {\n\t\tresp, err := hc.Do(request)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdefer closeWithErrorHandling(resp.Body)\n\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\tdecoder := json.NewDecoder(resp.Body)\n\t\t\tvar apiError APIError\n\t\t\terr = decoder.Decode(&apiError)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"organization not found or you don't have access to it: %s\", apiError)\n\t\t}\n\n\t\tdecoder := json.NewDecoder(resp.Body)\n\n\t\tlink := resp.Header.Get(\"Link\")\n\t\tvar links = Links{}\n\t\tif link != \"\" {\n\t\t\tlinks, err = ParseLinks(link)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// update query for the next page.\n\t\t\tquery := request.URL.Query()\n\t\t\tquery.Set(\"page\", strconv.FormatInt(int64(links.NextPage), 10))\n\n\t\t\trequest.URL.RawQuery = query.Encode()\n\n\t\t}\n\t\tvar pageRepos []RepositoryWithPRs\n\t\terr = decoder.Decode(&pageRepos)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trepos = append(repos, pageRepos...)\n\n\t\t// if we don't have next page - stop.\n\t\tif links.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\n\t}\n\n\treturn repos, nil\n\n}", "title": "" }, { "docid": "4eb0233da9259c60384d69053e72eef6", "score": "0.5613146", "text": "func getRepos(\n\trstore afind.KeyValueStorer,\n\trequest afind.SearchQuery,\n\tmax int) (repos []*afind.Repo) {\n\n\t// Either select specific requested repo keys...\n\trepos = []*afind.Repo{}\n\tfor _, key := range request.RepoKeys {\n\t\tif value := rstore.Get(key); value != nil {\n\t\t\tif max > 0 && len(repos) > max {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\trepo := value.(*afind.Repo)\n\t\t\tif repo.State == afind.OK {\n\t\t\t\trepos = append(repos, repo)\n\t\t\t}\n\t\t}\n\t}\n\tif len(request.RepoKeys) > 0 {\n\t\treturn repos\n\t}\n\t// ...or select repos matching the provided metadata. All\n\t// repos are selected if no metadata is provided.\n\treturn afind.ReposMatchingMeta(rstore, request.Meta, request.MetaRegexpMatch, max)\n}", "title": "" }, { "docid": "2940aababf73c3f3b284aba3fe8751ee", "score": "0.5611533", "text": "func Fetch(ctx context.Context, req *pb.FetchRequest, mWiki *mediawiki.Client, repo fetchRepo) (*pb.FetchResponse, error) {\n\tsites, err := mWiki.Sitematrix(ctx)\n\tdefaults := map[string]string{\n\t\t\"shy\": \"Shawiya\",\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, proj := range sites.Projects {\n\t\tlang := models.Language{\n\t\t\tName: proj.Name,\n\t\t\tLocalName: proj.Localname,\n\t\t\tCode: proj.Code,\n\t\t\tDir: proj.Dir,\n\t\t}\n\n\t\tif name, ok := defaults[proj.Code]; len(lang.Name) <= 0 && ok {\n\t\t\tlang.Name = name\n\t\t}\n\n\t\tif localName, ok := defaults[proj.Code]; len(lang.LocalName) <= 0 && ok {\n\t\t\tlang.LocalName = localName\n\t\t}\n\n\t\t_, err := repo.SelectOrCreate(ctx, &lang, func(q *orm.Query) *orm.Query {\n\t\t\treturn q.Where(\"code = ?\", proj.Code)\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, site := range proj.Site {\n\t\t\tproject := models.Project{\n\t\t\t\tDbName: site.DBName,\n\t\t\t\tSiteName: site.Sitename,\n\t\t\t\tSiteCode: site.Code,\n\t\t\t\tSiteURL: site.URL,\n\t\t\t\tLang: proj.Code,\n\t\t\t\tActive: !site.Closed,\n\t\t\t}\n\n\t\t\t_, err := repo.SelectOrCreate(ctx, &project, func(q *orm.Query) *orm.Query {\n\t\t\t\treturn q.Where(\"db_name = ?\", project.DbName)\n\t\t\t})\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t_, err = repo.Exec(ctx, fmt.Sprintf(partitionQuery, project.DbName, project.DbName))\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn new(pb.FetchResponse), nil\n}", "title": "" }, { "docid": "dacf5af113e225311b721848fca7801a", "score": "0.5610136", "text": "func repositories(w http.ResponseWriter, r *http.Request) {\n\n\tclient := &http.Client{}\n\tvar endCursorID string = \"\"\n\tvar doStopFetching bool = false\n\tvar httpResponse string = \"<html><head></head><body><table>\"\n\tfor {\n\t\tvar qTC string\n\t\tif endCursorID == \"\" {\n\t\t\tqTC = \"\\\"{organization(login:\\\\\\\"znly\\\\\\\") { repositories(first:20) { nodes { name, id, description, isFork, languages(first:20) {nodes {name}}, refs(first:100, refPrefix:\\\\\\\"refs/heads/\\\\\\\"){ nodes { name, target {... on Commit{author{name, date} } }}} } pageInfo {hasNextPage, endCursor }}}}\\\"\"\n\t\t} else {\n\t\t\tqTC = \"\\\"{organization(login:\\\\\\\"znly\\\\\\\") { repositories(first:20 after:\\\\\\\"\" + endCursorID + \"\\\\\\\") { nodes { name, id, description, isFork, languages(first:20){nodes{name }}, refs(first:100, refPrefix:\\\\\\\"refs/heads/\\\\\\\"){ nodes { name, target { ... on Commit {author{name,date}}} } }} pageInfo {hasNextPage, endCursor }}}}\\\"\"\n\t\t}\n\t\treq, err := http.NewRequest(\"POST\", gitGraphQLURL, bytes.NewBufferString(queryToRequest(qTC)))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\treq.Header.Add(\"Authorization\", \"Bearer \"+gitToken)\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t\t//fmt.Println(\"ro\")\n\t\t//_, err := httputil.DumpRequestOut(req, true)\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\t\tdefer resp.Body.Close()\n\t\tfmt.Println(string(bodyBytes))\n\t\tif resp.Status != \"200 OK\" {\n\t\t\thttpResponse = httpResponse + \"<h1>Error</h1><p>\" + string(bodyBytes) + \"</p>\"\n\t\t\tbreak\n\t\t}\n\n\t\tvar jsonResp RepositoryResponse\n\n\t\terr = json.Unmarshal(bodyBytes, &jsonResp)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tfor k, v := range jsonResp.Data[\"organization\"][\"repositories\"] {\n\t\t\tswitch k {\n\t\t\tcase \"nodes\":\n\t\t\t\tp := v.([]interface{})\n\t\t\t\tfor _, b := range p {\n\t\t\t\t\tr := b.(map[string]interface{})\n\t\t\t\t\thttpResponse = httpResponse + \"<tr><td>\" + r[\"name\"].(string) + \"</td>\"\n\n\t\t\t\t\tvar t, ok = r[\"isFork\"].(bool)\n\t\t\t\t\tif ok == true {\n\t\t\t\t\t\tif t == true {\n\t\t\t\t\t\t\thttpResponse = httpResponse + \"<tr><td>YES</td>\"\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thttpResponse = httpResponse + \"<tr><td>NO</td>\"\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\thttpResponse = httpResponse + \"<tr><td>--</td>\"\n\t\t\t\t\t}\n\n\t\t\t\t\t_, ok = r[\"description\"].(string)\n\t\t\t\t\tif ok == true {\n\t\t\t\t\t\thttpResponse = httpResponse + \"<td>\" + r[\"description\"].(string) + \"</td></tr>\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\thttpResponse = httpResponse + \"<td>--</td></tr>\"\n\t\t\t\t\t}\n\n\t\t\t\t\t_, ok = r[\"languages\"].(map[string][]map[string]string)\n\t\t\t\t\tif ok == true {\n\t\t\t\t\t\tprint(\"hooura\")\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\tcase \"pageInfo\":\n\t\t\t\tp := v.(map[string]interface{})\n\t\t\t\tfmt.Println(p)\n\t\t\t\tif p[\"hasNextPage\"].(bool) == false {\n\t\t\t\t\tdoStopFetching = true\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\tendCursorID = p[\"endCursor\"].(string)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif doStopFetching == true {\n\t\t\tbreak\n\t\t}\n\t}\n\thttpResponse = httpResponse + \"</body>\"\n\tio.WriteString(w, httpResponse)\n}", "title": "" }, { "docid": "1740b85bc67fd4a6316601cce7bec4fc", "score": "0.559998", "text": "func GetRepoList(c *gin.Context) {\n\tvar (\n\t\tuser = session.GetUser(c)\n\t\tall, _ = strconv.ParseBool(c.Query(\"all\"))\n\t\tflush, _ = strconv.ParseBool(c.Query(\"flush\"))\n\t)\n\n\trepos, err := service.User.GetRepoList(user, all, flush)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tc.JSON(200, gin.H{\n\t\t\t\"message\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tc.JSON(200, repos)\n}", "title": "" }, { "docid": "e055b62c6fa11e5a7736ede18d0056e2", "score": "0.55961895", "text": "func FetchRepoDescription(ctx context.Context, owner, name string) (types.ApprovedPullRequestsQuery, error) {\n\tvar q types.ApprovedPullRequestsQuery\n\t// var q types.PullRequestsQuery\n\n\tvariables := map[string]interface{}{\n\t\t\"owner\": githubv4.String(owner),\n\t\t\"name\": githubv4.String(name),\n\t\t\"pullsFirst\": githubv4.NewInt(3),\n\t\t// \"states\": githubv4.PullRequestReviewState(githubv4.PullRequestReviewStateApproved),\n\t}\n\n\terr := QueryGithub(ctx, &q, variables)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to query GitHub API v4:\", err)\n\t\treturn q, err\n\t}\n\t// printJSON(q)\n\n\treturn q, err\n}", "title": "" }, { "docid": "45f25ed3713cdf2a23e1d57e537297af", "score": "0.5554647", "text": "func FetchResources(ctx context.Context, repository entity.RepoRemote) (resources []entity.LinkID, err error) {\n\tresources, err = repository.FetchRemote(ctx)\n\treturn\n}", "title": "" }, { "docid": "f167ec86809fab7265df2ce27569fbd7", "score": "0.55391645", "text": "func GetRepos(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tauthor := params[\"author\"]\n\tswitch len(author) {\n\tcase 6, 7, 8:\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tjson.NewEncoder(w).Encode(reposResponse{\n\t\t\tCode: http.StatusNotFound,\n\t\t\tMessage: \"Author does not exist\",\n\t\t})\n\t\treturn\n\tdefault:\n\t\tresp := reposResponse{\n\t\t\tCode: http.StatusOK,\n\t\t\tData: model.NewRepositories(author),\n\t\t}\n\t\tw.WriteHeader(resp.Code)\n\t\tjson.NewEncoder(w).Encode(resp)\n\t}\n\n}", "title": "" }, { "docid": "a24c35d2176db3f5ae79983803009573", "score": "0.55320996", "text": "func (s FakeStore) ListRepos(ctx context.Context, kinds ...string) ([]*Repo, error) {\n\tif s.list != nil {\n\t\treturn nil, s.list\n\t}\n\n\tkindset := make(map[string]bool, len(kinds))\n\tfor _, kind := range kinds {\n\t\tkindset[kind] = true\n\t}\n\n\tset := make(map[*Repo]bool, len(s.byName))\n\trepos := make(Repos, 0, len(s.byName))\n\tfor _, r := range s.byName {\n\t\tif !set[r] && len(kinds) == 0 || kindset[r.ExternalRepo.ServiceType] {\n\t\t\trepos = append(repos, r)\n\t\t\tset[r] = true\n\t\t}\n\t}\n\n\tsort.Sort(repos)\n\n\treturn repos, nil\n}", "title": "" }, { "docid": "1d8d426cbdabe349ddc6432e2f58c21b", "score": "0.55286634", "text": "func (r *NoOpRegistryClient) Repositories(ctx context.Context, repos []string, last string) (int, error) {\n\treturn r.RepositoriesFn(repos, last)\n}", "title": "" }, { "docid": "61321046fc879d7746581d500a006c1c", "score": "0.5527749", "text": "func (r *RepoFetcher) Get(ctx context.Context) ([]repoData, error) {\n\tglobalSearch := r.args.Mode == search.ZoektGlobalSearch\n\trequest, err := zoektutil.NewIndexedSearchRequest(ctx, r.args, globalSearch, search.TextRequest, r.onMissingRepoRevs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trepoSets := []repoData{UnindexedList(request.UnindexedRepos())} // unindexed included by default\n\tif r.mode != search.SearcherOnly {\n\t\trepoSets = append(repoSets, IndexedMap(request.IndexedRepos()))\n\t}\n\treturn repoSets, nil\n}", "title": "" }, { "docid": "dda3cdae1564ec911f39a6a0511505e9", "score": "0.5508784", "text": "func ListRepos(w http.ResponseWriter, r *http.Request) {\n\tut, err := getSessionOrRedirect(w, r)\n\tif err != nil {\n\t\tlog.ShowWrite(\"[Info] %s: redirecting to login\", err.Error())\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tuser, ok := vars[\"user\"]\n\tif !ok {\n\t\t// redirect to logged in user\n\t\tuser = ut.Username\n\t\thttp.Redirect(w, r, fmt.Sprintf(\"/repos/%s\", user), http.StatusFound)\n\t\treturn\n\t}\n\tcl := ginclient.New(serveralias)\n\tcl.UserToken = ut\n\n\tuserrepos, err := cl.ListRepos(user)\n\tif err != nil {\n\t\tlog.ShowWrite(\"[Error] ListRepos failed: %s\", err.Error())\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\t_, err = w.Write([]byte(\"not found\"))\n\t\tif err != nil {\n\t\t\tlog.ShowWrite(\"[Error] writing fallback message failed: %s\", err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tlog.ShowWrite(\"[Info] found %d repositories\", len(userrepos))\n\ttmpl := template.New(\"layout\")\n\tfuncmap := map[string]interface{}{\n\t\t\"ToLower\": strings.ToLower,\n\t\t\"ToUpper\": strings.ToUpper,\n\t}\n\ttmpl.Funcs(funcmap)\n\ttmpl, err = tmpl.Parse(templates.Layout)\n\tif err != nil {\n\t\tlog.ShowWrite(\"[Error] failed to parse html layout page: %s\", err.Error())\n\t\tfail(w, r, http.StatusInternalServerError, \"something went wrong\")\n\t\treturn\n\t}\n\ttmpl, err = tmpl.Parse(templates.RepoList)\n\tif err != nil {\n\t\tlog.ShowWrite(\"[Error] failed to render repository list page: %s\", err.Error())\n\t\tfail(w, r, http.StatusInternalServerError, \"something went wrong\")\n\t\treturn\n\t}\n\treposActive := make([]repoHooksInfo, 0, len(userrepos))\n\treposInactive := make([]repoHooksInfo, 0, len(userrepos))\n\n\tcheckActive := func(rhinfo repoHooksInfo) bool {\n\t\t// If at least one hook is not hooknone, return true\n\t\tfor _, hook := range rhinfo.Hooks {\n\t\t\tif hook.State != hooknone {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\t// TODO: Enum for hook states (see issue #5)\n\tfor _, rinfo := range userrepos {\n\t\trepohooks, err := getRepoHooks(cl, rinfo.FullName)\n\t\tif err != nil {\n\t\t\t// simply initialise the map for now\n\t\t\trepohooks = make(map[string]ginhook)\n\t\t}\n\t\trhinfo := repoHooksInfo{rinfo, repohooks}\n\t\tif checkActive(rhinfo) {\n\t\t\treposActive = append(reposActive, rhinfo)\n\t\t} else {\n\t\t\treposInactive = append(reposInactive, rhinfo)\n\t\t}\n\t}\n\tyear, _, _ := time.Now().Date()\n\tloggedUsername := getLoggedUserName(r)\n\tsrvcfg := config.Read()\n\tallrepos := struct {\n\t\tActive []repoHooksInfo\n\t\tInactive []repoHooksInfo\n\t\tGinURL string\n\t\tCurrentYear int\n\t\tUserName string\n\t}{\n\t\treposActive,\n\t\treposInactive,\n\t\tsrvcfg.GINAddresses.WebURL,\n\t\tyear,\n\t\tloggedUsername,\n\t}\n\terr = tmpl.Execute(w, &allrepos)\n\tif err != nil {\n\t\tlog.ShowWrite(\"[Error] failed to parse data to list repo template: %s\", err.Error())\n\t\tfail(w, r, http.StatusInternalServerError, \"something went wrong\")\n\t}\n}", "title": "" }, { "docid": "45d9ac98b061af4221ddca98da2482e0", "score": "0.5505049", "text": "func Repos(ctx context.Context, githubOrg string, client *github.Client) (repos []ReposT) {\n\n\t// Manage GitHub pagination api\n\topt := &github.RepositoryListByOrgOptions{\n\t\tListOptions: github.ListOptions{PerPage: 50},\n\t}\n\n\tvar allRepos []*github.Repository\n\n\t// Retrieve all repos\n\tfor {\n\t\trepos, resp, err := client.Repositories.ListByOrg(ctx, githubOrg, opt)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"ERROR: %s\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tallRepos = append(allRepos, repos...)\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\n\t// Extract from allRepos only the informations we need\n\tfor _, repo := range allRepos {\n\n\t\t// I have to do this because the ListByOrg doesn't return any has* (has_issues, has_projects etc) values\n\t\t// https://developer.github.com/v3/repos/#get-a-repository\n\t\trepoDetails, _, err := client.Repositories.Get(ctx, githubOrg, repo.GetName())\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"ERROR: %s\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tvar topics []string\n\t\t// Add quotes so we can printe them for each repo in the list\n\t\tfor _, topic := range repoDetails.Topics {\n\t\t\ttopics = append(topics, strconv.Quote(topic))\n\t\t}\n\n\t\t// Convert the slice in a string with comma in between strings\n\t\t// ie: we end up with something like this \"csharp\",\"extensions\",\"grpc\"\n\t\ttopicsString := strings.Join(topics, \",\")\n\n\t\t// Create repos that holds only the informations we need on the template.\n\t\trepos = append(repos, ReposT{\n\t\t\t// This removes all dots from the variable we use for the module name\n\t\t\tGithubModuleName: strings.Replace(repoDetails.GetName(), \".\", \"-\", -1),\n\t\t\tName: repoDetails.GetName(),\n\t\t\t// This escapes every quote from the variable we use for the description\n\t\t\tDescription: strings.Replace(repoDetails.GetDescription(), \"\\\"\", \"\\\\\\\"\", -1),\n\t\t\tHomepage: repoDetails.GetHomepage(),\n\t\t\tPrivate: repoDetails.GetPrivate(),\n\t\t\tHasIssues: repoDetails.GetHasIssues(),\n\t\t\tHasProjects: repoDetails.GetHasProjects(),\n\t\t\tHasWiki: repoDetails.GetHasWiki(),\n\t\t\tAllowMergeCommit: repoDetails.GetAllowMergeCommit(),\n\t\t\tAllowSquashMerge: repoDetails.GetAllowSquashMerge(),\n\t\t\tAllowRebaseMerge: repoDetails.GetAllowRebaseMerge(),\n\t\t\tHasDownloads: repoDetails.GetHasDownloads(),\n\t\t\tDeleteBranchOnMerge: repoDetails.GetDeleteBranchOnMerge(),\n\t\t\tDefaultBranch: repoDetails.GetDefaultBranch(),\n\t\t\tArchived: repoDetails.GetArchived(),\n\t\t\tTopics: topicsString,\n\t\t})\n\t\t// fmt.Printf(\"repo: %s Merge, commit: %t\\n\", *repoDetails.Name, repoDetails.GetAllowMergeCommit())\n\t}\n\treturn repos\n}", "title": "" }, { "docid": "e3e35ce0908b7e8b0c177314a6501bce", "score": "0.5501916", "text": "func ReadRepos(repoUrls ...string) (map[string]Config, error) {\n\tpathToConfig := make(map[string]Config)\n\tfor _, path := range repoUrls {\n\t\tresp, err := http.Get(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tconfRaw, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpathToConfig[path], err = parseConfig(confRaw)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn pathToConfig, nil\n}", "title": "" }, { "docid": "84dce7f59b56fdb3f77d255ce45cae6c", "score": "0.55015826", "text": "func (c *Config) loadRepos() {\n\n\tfor _, repo := range config.Repos {\n\t\tfmt.Println(\"Setting up repo \" + repo.Name)\n\t\tfmt.Println(\"\\tLocated at \" + repo.Path)\n\t\tfmt.Println(\"\\tArchive at \" + repo.Archivepath)\n\t\trepo.setupGitHook()\n\t\trepo.loadRepo()\n\t}\n}", "title": "" }, { "docid": "bc2c4e80a9628ca8d7b7ebc7cfc47e72", "score": "0.5500622", "text": "func (c *OrgRepositoriesClient) List(ctx context.Context, ref gitprovider.OrganizationRef) ([]gitprovider.OrgRepository, error) {\n\t// Make sure the OrganizationRef is valid\n\tif err := validateOrganizationRef(ref, c.domain); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// GET /orgs/{org}/repos\n\tapiObjs, err := c.c.ListOrgRepos(ctx, ref.Organization)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Traverse the list, and return a list of OrgRepository objects\n\trepos := make([]gitprovider.OrgRepository, 0, len(apiObjs))\n\tfor _, apiObj := range apiObjs {\n\t\t// apiObj is already validated at ListOrgRepos\n\t\trepos = append(repos, newOrgRepository(c.clientContext, apiObj, gitprovider.OrgRepositoryRef{\n\t\t\tOrganizationRef: ref,\n\t\t\tRepositoryName: *apiObj.Name,\n\t\t}))\n\t}\n\treturn repos, nil\n}", "title": "" }, { "docid": "72c2eee64dbc3e7976e8284ed1784cd9", "score": "0.5491233", "text": "func getRepositories(ctx context.Context, c *bitbucket.APIClient, owner string) ([]bitbucket.Repository, error) {\n\tvar repos []bitbucket.Repository\n\tvar results bitbucket.PaginatedRepositories\n\tvar err error\n\n\tfor {\n\t\tif results.Next == \"\" {\n\t\t\tresults, _, err = c.RepositoriesApi.RepositoriesUsernameGet(ctx, owner, nil)\n\t\t} else {\n\t\t\tresults, _, err = c.PagingApi.RepositoriesPageGet(ctx, results.Next)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trepos = append(repos, results.Values...)\n\t\tif results.Next == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn repos, nil\n}", "title": "" }, { "docid": "0daf167a4d4f2de6f38faf04ea0de292", "score": "0.54898244", "text": "func GetRepoInfo(repo *github.Repository) (string, string) {\n\trepoName := repo.GetName()\n\trepoOwner := repo.GetOwner().GetLogin()\n\treturn repoName, repoOwner\n}", "title": "" }, { "docid": "f1619279d82f7d296594f1d0b10af364", "score": "0.548331", "text": "func FetchConfig(ctx context.Context, c *github.Client, owner, repo, name string, orgLevel bool, out interface{}) error {\n\treturn fetchConfig(ctx, c.Repositories, owner, repo, name, orgLevel, out)\n}", "title": "" }, { "docid": "0f9a8f2741919b3a4f5a9c9a321bdfa7", "score": "0.54772127", "text": "func GetRepositories(login string) (repositories []Repository, err error) {\n\trequest, err := http.NewRequest(\"GET\", fmt.Sprintf(repositoryURI, login), nil)\n\tif err != nil {\n\t\treturn\n\t}\n\tif token != \"\" {\n\t\trequest.Header.Add(\"Authorization\", fmt.Sprintf(\"token %v\", token))\n\t}\n\n\t// Add a timeout to this nonsense...\n\thttp.DefaultClient.Timeout = 10 * time.Second\n\tresponse, err := http.DefaultClient.Do(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\n\tdecoder := json.NewDecoder(response.Body)\n\n\tdecoder.Decode(&repositories)\n\n\tif len(repositories) > repositoryLimit {\n\t\trepositories = repositories[:repositoryLimit]\n\t}\n\n\tfor ii := range repositories {\n\t\trepositories[ii].GetStargazers()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "74a3f6db6c39c58c7395acd6cb59593f", "score": "0.54656184", "text": "func (c *Client) Info(ctx context.Context) (*Info, error) {\n\tr, _, err := c.c.Repositories.Get(ctx, c.r.Owner, c.r.Name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Info{\n\t\tHomepage: *r.Homepage,\n\t\tDescription: *r.Description,\n\t}, nil\n}", "title": "" }, { "docid": "ae33a2839264151d217fb0de6bc555bf", "score": "0.5460061", "text": "func GetRepoList(ctx context.Context, client *github.Client, username string) []*github.Repository {\n\tvar repoList []*github.Repository\n\tmap1, _ := userRepos(ctx, client, username)\n\tlist, _ := subscribedRepos(ctx, client, username)\n\tmap2 := AddToMap(map1, list)\n\tfor _, v := range map2 {\n\t\trepoList = append(repoList, v)\n\t}\n\treturn repoList\n}", "title": "" }, { "docid": "3905bdc190e4155afccebd40c6af95e2", "score": "0.5444272", "text": "func findRepos(rpath string, rbd *ReIndexRequest, gins *GinServer) ([]*gogs.Repository, error) {\n\tvar repos [] *gogs.Repository\n\terr := filepath.Walk(rpath, func(path string, info os.FileInfo, err error) error {\n\t\tif ! info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\trepo, err := gig.OpenRepository(path)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\tgRepo, err := hasRepoAccess(repo, rbd, gins)\n\t\tif err != nil {\n\t\t\tlog.Debugf(\"no acces to repo:%+v\", err)\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\trepos = append(repos, gRepo)\n\t\treturn filepath.SkipDir\n\t})\n\treturn repos, err\n}", "title": "" }, { "docid": "fe0c603274f00605fccca4ad4f0707da", "score": "0.5442871", "text": "func (l *Library) Repositories(mode borges.Mode) (borges.RepositoryIterator, error) {\n\treturn util.NewLocationRepositoryIterator(mapLocationsToSlice(l.locs), mode), nil\n}", "title": "" }, { "docid": "8cbe44d659f95fe94a16676a8ca6f307", "score": "0.5431337", "text": "func getOwnerRepos() ([]Repo, error) {\n\tvar (\n\t\terr error\n\t\trepos []Repo\n\t)\n\tctx := context.Background()\n\n\tif opts.OwnerPath != \"\" {\n\t\trepos, err = discoverRepos(opts.OwnerPath)\n\t} else if opts.GithubOrg != \"\" {\n\t\tgithubClient := github.NewClient(githubToken())\n\t\tgithubOptions := github.RepositoryListByOrgOptions{\n\t\t\tListOptions: github.ListOptions{PerPage: 10},\n\t\t}\n\t\trepos, err = getOrgGithubRepos(ctx, &githubOptions, githubClient)\n\t} else if opts.GithubUser != \"\" {\n\t\tgithubClient := github.NewClient(githubToken())\n\t\tgithubOptions := github.RepositoryListOptions{\n\t\t\tAffiliation: \"owner\",\n\t\t\tListOptions: github.ListOptions{\n\t\t\t\tPerPage: 10,\n\t\t\t},\n\t\t}\n\t\trepos, err = getUserGithubRepos(ctx, &githubOptions, githubClient)\n\t}\n\n\treturn repos, err\n}", "title": "" }, { "docid": "b5814c22ad611c613a625768636299cb", "score": "0.54281336", "text": "func FetchTools(config dbt.Config) (tools []Tool, err error) {\n\turi := config.Tools.Repo\n\tresp, err := http.Get(uri)\n\n\ttools = make([]Tool, 0)\n\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"Error looking for commands in repo %q\", uri)\n\t\treturn tools, err\n\t}\n\n\tif resp != nil {\n\t\tdefer resp.Body.Close()\n\n\t\tparser := html.NewTokenizer(resp.Body)\n\n\t\tfor {\n\t\t\ttt := parser.Next()\n\n\t\t\tswitch {\n\t\t\tcase tt == html.ErrorToken:\n\t\t\t\treturn\n\t\t\tcase tt == html.StartTagToken:\n\t\t\t\tt := parser.Token()\n\t\t\t\tisAnchor := t.Data == \"a\"\n\t\t\t\tif isAnchor {\n\t\t\t\t\tfor _, a := range t.Attr {\n\t\t\t\t\t\tif a.Key == \"href\" {\n\t\t\t\t\t\t\tif a.Val != \"../\" {\n\t\t\t\t\t\t\t\t// any links beyond the 'back' link will be versions\n\t\t\t\t\t\t\t\t// trim the trailing slash so we get actual semantic versions\n\t\t\t\t\t\t\t\tname := strings.TrimRight(a.Val, \"/\")\n\t\t\t\t\t\t\t\ttools = append(tools, Tool{Name: name})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn tools, err\n}", "title": "" }, { "docid": "0d796821fd980e6dc4b0f249580e0809", "score": "0.54280674", "text": "func userRepos(ctx context.Context, client *github.Client, username string) (map[string]*github.Repository, error) {\n\tvar repoList []*github.Repository\n\temptyMap := make(map[string]*github.Repository)\n\toptRepo := &github.RepositoryListOptions{Type: \"all\", ListOptions: github.ListOptions{PerPage: 30}}\n\tfor {\n\t\trepos, resp, err := client.Repositories.List(ctx, username, optRepo)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trepoList = append(repoList, repos...)\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\toptRepo.Page = resp.NextPage\n\t}\n\treturn AddToMap(emptyMap, repoList), nil\n}", "title": "" }, { "docid": "8c940d1040b88de084e737d0e49f26b5", "score": "0.54194015", "text": "func FetchConfigForRepo(repo string) (*Repo, error) {\n\t// Define repo struct\n\titem := Repo{}\n\n\t// Loop over config elements\n\tfor i := range configjson {\n\t\t// Check if repo is in config\n\t\tif configjson[i].Repo == strings.ToLower(repo) {\n\t\t\t// if it is set it\n\t\t\titem = configjson[i]\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif item.Repo == \"\" {\n\t\treturn &item, errors.New(\"not_found\")\n\t}\n\n\t// Return item\n\treturn &item, nil\n}", "title": "" }, { "docid": "9db2e0f7cbaa0fe346923587dcff4f97", "score": "0.53976595", "text": "func (a *API) FetchRepoCount(workspaceSlug string) (int64, error) {\n\tendpoint := sdk.JoinURL(\"repositories\", workspaceSlug)\n\treturn a.getCount(endpoint, nil)\n}", "title": "" }, { "docid": "a477f55a064a49ba4078efede5039b36", "score": "0.5382243", "text": "func printRepoCredsUrls(repos []appsv1.RepoCreds) {\n\tfor _, r := range repos {\n\t\tfmt.Println(r.URL)\n\t}\n}", "title": "" }, { "docid": "4580d924a7afa546ff2a8cde411cd5b9", "score": "0.53631514", "text": "func (c RepoStoreGetFirstRepoNameByCloneURLFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1}\n}", "title": "" }, { "docid": "c1cf59c512c8680b1d8f2d52dd182fc7", "score": "0.5350879", "text": "func (p Providers) Fetch(\n\tstevedoreCtx map[string]string,\n\tdata map[string]interface{},\n) (map[string]map[string]interface{}, error) {\n\tresults := make(map[string]map[string]interface{}, len(data))\n\n\tpluginsMap := map[string]ProviderImpl{}\n\n\tfor _, each := range p {\n\t\tpluginsMap[each.Name] = each\n\t}\n\n\tfor rootKey, configs := range data {\n\t\tfetcher, ok := pluginsMap[rootKey]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"could not find a plugin binary for the config: %v\", rootKey)\n\t\t}\n\n\t\tctx := make(map[string]string)\n\n\t\tfor k, v := range stevedoreCtx {\n\t\t\tctx[k] = v\n\t\t}\n\n\t\tfor k, v := range fetcher.Context {\n\t\t\tctx[k] = v\n\t\t}\n\n\t\tresult, err := fetcher.Provider.Fetch(ctx, configs)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error in fetching from provider: %v\", err)\n\t\t}\n\t\tresults[rootKey] = result\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "4a186538dcf09851559af925f47e6a2b", "score": "0.5345099", "text": "func FetchImagesInfo(image string) (result ImageTagsInfo, err error) {\n\trestyClient := resty.New()\n\tclient := restyClient.SetHostURL(config.Cfg.DockerAPIBaseURL)\n\tsetupAPICred(client)\n\n\ttagsPath := fmt.Sprintf(\"/%v/%v/tags/list\", config.Cfg.VulcanChecksRepo, image)\n\n\tr := client.R()\n\tresponse, err := r.Get(tagsPath)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif response.RawResponse.StatusCode == http.StatusOK {\n\t\terr = json.Unmarshal(response.Body(), &result)\n\t\treturn\n\t}\n\n\tif response.RawResponse.StatusCode == http.StatusNotFound {\n\t\tresult.Name = config.Cfg.VulcanChecksRepo + \"/\" + image\n\t\treturn\n\t}\n\n\terr = fmt.Errorf(\"error returned by query %s, status: %s\", response.Request.URL, response.RawResponse.Status)\n\treturn\n}", "title": "" }, { "docid": "dc4c661f12d386e2802036f6317bf87a", "score": "0.5332515", "text": "func getStarredRepos(userID int64, private bool) ([]*api.Repository, error) {\n\tstarredRepos, err := models.GetStarredRepos(userID, private)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trepos := make([]*api.Repository, len(starredRepos))\n\tfor i, starred := range starredRepos {\n\t\taccess, err := models.AccessLevel(userID, starred)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trepos[i] = starred.APIFormat(access)\n\t}\n\treturn repos, nil\n}", "title": "" }, { "docid": "ccca2fb3a1556382392becfc06332391", "score": "0.5327472", "text": "func (git *GitClient) GetRepositoryContents(log log.T, owner, repo, path string, opt *github.RepositoryContentGetOptions) (fileContent *github.RepositoryContent, directoryContent []*github.RepositoryContent, err error) {\n\tvar resp *github.Response\n\n\tfileContent, directoryContent, resp, err = git.Repositories.GetContents(gitcontext.Background(), owner, repo, path, opt)\n\n\tif fileContent != nil {\n\t\tlog.Info(\"URL downloaded from - \", fileContent.GetURL())\n\t}\n\n\tdefer resp.Body.Close()\n\tlog.Info(\"Status code - \", resp.StatusCode)\n\tif err != nil {\n\t\tif resp.StatusCode == http.StatusUnauthorized {\n\t\t\tlog.Error(\"Unauthorized access attempted. Please specify tokenInfo with correct access information \")\n\t\t}\n\t\tlog.Errorf(\"Error retreiving information from github repository. Error - %v and response - %v\", err, resp)\n\t\treturn nil, nil, err\n\t} else if resp.StatusCode == http.StatusForbidden && resp.Rate.Limit == 0 {\n\t\treturn nil, nil, errors.New(\"Rate limit exceeded\")\n\n\t} else if resp.StatusCode == http.StatusNotFound {\n\t\treturn nil, nil, fmt.Errorf(\"Response is - %v\", resp.Status)\n\n\t}\n\n\treturn fileContent, directoryContent, err\n}", "title": "" }, { "docid": "9f73a6686cce0400779d51c3cbdb67ae", "score": "0.5319608", "text": "func (sc *Scraper) scrapeRepo(rp github.Repository, retrieveDoc retrieveDocumentation) scrapeResponse {\n\tlog.Debugf(\"checking: \", rp.GetName())\n\n\tresult := make([]scrape.DocDef, 0)\n\n\turl, err := sc.getDocURL(rp.GetURL())\n\tif err != nil {\n\t\treturn scrapeResponse{result, []error{err}}\n\t}\n\n\trsp, err := sc.httpClient.Get(url)\n\tif err != nil {\n\t\treturn scrapeResponse{result, []error{err}}\n\t}\n\tif rsp.StatusCode != 200 {\n\t\treturn scrapeResponse{result, []error{fmt.Errorf(\"status: %d\", rsp.StatusCode)}}\n\t}\n\tbts, err := ioutil.ReadAll(rsp.Body)\n\tif err != nil {\n\t\treturn scrapeResponse{result, []error{fmt.Errorf(\"impossible to unmarshal\")}}\n\t}\n\tvar specs []docFileSpec\n\terr = json.Unmarshal(bts, &specs)\n\tif err != nil {\n\t\treturn scrapeResponse{result, []error{err}}\n\t}\n\n\tvar errs []error\n\tfor _, doc := range specs {\n\t\tdef, err := retrieveDoc(rp.GetName(), rp.GetID(), doc)\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t\tcontinue\n\t\t}\n\t\tif def != nil {\n\t\t\tresult = append(result, *def)\n\t\t}\n\t}\n\treturn scrapeResponse{result, errs}\n}", "title": "" }, { "docid": "8c5646ac8a95de8b46f91f665052682d", "score": "0.53123075", "text": "func (c APIClient) ListRepoByType(repoType string) (_ []*pfs.RepoInfo, retErr error) {\n\treturn c.ListProjectRepo(&pfs.ListRepoRequest{Type: repoType})\n}", "title": "" }, { "docid": "f252217f18a4572a8d25c2c8145c04d1", "score": "0.53122497", "text": "func FetchTags(\n\tctx context.Context,\n\tghCl *github.Client,\n\tmod string,\n) ([]string, error) {\n\towner, repo, err := SplitModule(mod)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\ttags, _, err := ghCl.Repositories.ListTags(ctx, owner, repo, nil)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tvers := make([]string, len(tags))\n\tfor i, tag := range tags {\n\t\tvers[i] = *tag.Name\n\t}\n\treturn vers, nil\n}", "title": "" }, { "docid": "89002665d1af4b48e1b63c54c2e5d949", "score": "0.5309529", "text": "func (l *Listener) GetRepos(ctx *fasthttp.RequestCtx) {\n\treq := libferry.RepoListingRequest{}\n\trepos, err := l.manager.GetRepos()\n\tif err != nil {\n\t\tctx.Error(err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tfor _, repo := range repos {\n\t\treq.Repository = append(req.Repository, repo.ID)\n\t}\n\tbuf := bytes.Buffer{}\n\tif err := json.NewEncoder(&buf).Encode(&req); err != nil {\n\t\tctx.Error(err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tctx.SetBody(buf.Bytes())\n}", "title": "" }, { "docid": "a6c7bd39d4ac9e66d643556b20e8aa94", "score": "0.52830076", "text": "func GetGoRepo() ([]*PkgInfo, error) {\n\t// Connect to database.\n\tq := connDb()\n\tdefer q.Close()\n\n\tvar pkgInfos []*PkgInfo\n\tcondition := qbs.NewCondition(\"pro_name = ?\", \"Go\")\n\terr := q.OmitFields(\"ProName\", \"IsCmd\", \"Tags\", \"Views\", \"ViewedTime\", \"Created\",\n\t\t\"Etag\", \"Labels\", \"ImportedNum\", \"ImportPid\", \"Note\").\n\t\tCondition(condition).OrderBy(\"path\").FindAll(&pkgInfos)\n\tinfos := make([]*PkgInfo, 0, 30)\n\tfor _, v := range pkgInfos {\n\t\tif strings.Index(v.Path, \".\") == -1 {\n\t\t\tinfos = append(infos, v)\n\t\t}\n\t}\n\treturn infos, err\n}", "title": "" }, { "docid": "3b463d49750e47cf78678e135a0449c2", "score": "0.52600324", "text": "func (r *Repository) Fetch(o *FetchOptions) error {\n\tif err := o.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tremote, err := r.Remote(o.RemoteName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn remote.Fetch(o)\n}", "title": "" }, { "docid": "aefd923f4a33e9e1a17ba56a03449c9a", "score": "0.5256718", "text": "func ListRepos(registry *Registry) ([]string, error) {\n\trepos := make([]string, 1)\n\trepos[0] = \"test\"\n\treturn repos, nil\n}", "title": "" }, { "docid": "2effcb8304321ef86c2ac4afd8b86700", "score": "0.5249294", "text": "func (r *reconciler) fetchObjects(ctx context.Context, req ctrl.Request, log logr.Logger) (\n\t*apps.DaemonSetList, *v1.ServiceAccountList, *rbacv1.ClusterRoleBindingList, error) {\n\t// Fetch the plugin's DaemonSet.\n\tvar childDaemonSets apps.DaemonSetList\n\tif err := r.List(ctx, &childDaemonSets, client.MatchingFields{r.ownerKey: req.Name}); err != nil {\n\t\tlog.Error(err, \"unable to list child DaemonSets\")\n\t\treturn nil, nil, nil, err\n\t}\n\n\t// Fetch the plugin's ServiceAccount.\n\tvar childServiceAccounts v1.ServiceAccountList\n\tif err := r.List(ctx, &childServiceAccounts, client.MatchingFields{r.ownerKey: req.Name}); err != nil {\n\t\tlog.Error(err, \"unable to list child ServiceAccounts\")\n\t\treturn nil, nil, nil, err\n\t}\n\n\t// Fetch the plugin's RoleBinding.\n\tvar childClusterRoleBindings rbacv1.ClusterRoleBindingList\n\tif err := r.List(ctx, &childClusterRoleBindings, client.MatchingFields{r.ownerKey: req.Name}); err != nil {\n\t\tlog.Error(err, \"unable to list child RoleBindings\")\n\t\treturn nil, nil, nil, err\n\t}\n\n\treturn &childDaemonSets, &childServiceAccounts, &childClusterRoleBindings, nil\n}", "title": "" }, { "docid": "f5b224b26643f52f358dcf6c048dc521", "score": "0.5232057", "text": "func (r *Repository) Fetch(verbose bool) {\n\tvar err error\n\tif verbose {\n\t\tcolor.Info.Prompt(\"Cloning remote repository %s ...\", r.URL)\n\t}\n\tif !filesystem.IsDir(r.Path) {\n\t\trefName := plumbing.ReferenceName(fmt.Sprintf(\"refs/heads/%s\", r.Branch))\n\t\tr.Repo, err = git.PlainClone(r.Path, false, &git.CloneOptions{\n\t\t\tURL: r.URL,\n\t\t\tReferenceName: refName,\n\t\t\tSingleBranch: true,\n\t\t})\n\t\tif err != nil && err != git.NoErrAlreadyUpToDate {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t} else {\n\t\tif verbose {\n\t\t\tcolor.Info.Prompt(\"Local clone exist, trying to update it\")\n\t\t}\n\t\tr.Repo, err = git.PlainOpen(r.Path)\n\t\tif err != nil && err != git.NoErrAlreadyUpToDate {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tr.Pull()\n\t}\n\n\t// this is used to know when a repository was last updated; based on\n\t// this information, the \"purge\" command removes repositories according to\n\t// the configured retention period\n\tr.resetPullTimestamp()\n\n\t// fetches head of the appropriate branch\n\thead, err := r.Repo.Head()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// hashes the commit to get commit tree\n\tcommit, err := r.Repo.CommitObject(head.Hash())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tr.Tree, err = commit.Tree()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif verbose {\n\t\t// updates the public approved keyrings\n\t\tcolor.Info.Prompt(\"Fetching keys\")\n\t}\n\tr.FetchKeyRing()\n\n\tif verbose {\n\t\tcolor.Info.Prompt(\"Repository updated successfully.\")\n\t}\n}", "title": "" }, { "docid": "9da0e889f23e26bcab90ebb64d4c57db", "score": "0.52311826", "text": "func (h *Hooker) listRepositories() (repos []Repo, err error) {\n\terr = crawlPages(func(listOptions github.ListOptions) (*github.Response, error) {\n\t\tlist, res, err := h.client.Repositories.List(h.ctx, *owner, &github.RepositoryListOptions{\n\t\t\tType: \"owner\",\n\t\t\tListOptions: listOptions,\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor i := range list {\n\t\t\tif list[i].Archived == nil || !*list[i].Archived {\n\t\t\t\trepos = append(repos, Repo{\n\t\t\t\t\tOwner: *list[i].Owner.Login,\n\t\t\t\t\tName: *list[i].Name,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturn res, nil\n\t})\n\treturn\n}", "title": "" }, { "docid": "806925303f75bc6a5f2d9e92d432009b", "score": "0.52281153", "text": "func FetchCreds(label, url string) (string, string, error) {\n\tcredentials.SetCredsLabel(label)\n\tif os.Getenv(\"CredentialsTest\") == \"true\" {\n\t\treturn mockStore.Get(url)\n\t}\n\treturn store.Get(url)\n}", "title": "" }, { "docid": "21e359562a5e49f135c5feb6dac3669e", "score": "0.52235365", "text": "func (d *RegistryService) GetRepositories() *model.RepositoriesResult {\n\n\trepositories := []model.RepositoryResult{}\n\tcatalog := d.GetCatalog()\n\tfor _, repoName := range catalog.Repositories {\n\t\trepository := d.GetRepository(repoName)\n\t\t// skipped tag which is null(or nil)\n\t\tif repository.Tags != nil && len(repository.Tags) > 0 {\n\t\t\trepositories = append(repositories, *repository)\n\t\t}\n\t}\n\trepositoriesResult := &model.RepositoriesResult{\n\t\tRepositories: repositories,\n\t}\n\n\treturn repositoriesResult\n}", "title": "" }, { "docid": "0ff8f9ba534e6bb3d5104030015b3a7e", "score": "0.5209413", "text": "func (db *DB) GetRepoFilesForRepoRetrieval(repoRetrievalID int) (map[int]*RepoFile, error) {\n\tstmt, err := db.getStatement(stmtRepoFileGetForRepoRetrieval)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 20 is arbitrary\n\trepoFiles := make(map[int]*RepoFile, 20)\n\trows, err := stmt.Query(repoRetrievalID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\trepoFile := &RepoFile{}\n\t\terr := rows.Scan(&repoFile.ID, &repoFile.RepoRetrievalID,\n\t\t\t&repoFile.DirParentID, &repoFile.NextFileID, &repoFile.PrevFileID,\n\t\t\t&repoFile.Path,\n\t\t\t&repoFile.HashSHA1, &repoFile.HashSHA256, &repoFile.HashMD5)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trepoFiles[repoFile.ID] = repoFile\n\t}\n\n\t// check at end for error\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn repoFiles, nil\n}", "title": "" }, { "docid": "113eaba8f9cdaaa5d139a872fbd6bf27", "score": "0.52044284", "text": "func (g *GogsDownloader) GetRepoInfo() (*base.Repository, error) {\n\tgr, err := g.client.GetRepo(g.repoOwner, g.repoName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// convert gogs repo to stand Repo\n\treturn &base.Repository{\n\t\tOwner: g.repoOwner,\n\t\tName: g.repoName,\n\t\tIsPrivate: gr.Private,\n\t\tDescription: gr.Description,\n\t\tCloneURL: gr.CloneURL,\n\t\tOriginalURL: gr.HTMLURL,\n\t\tDefaultBranch: gr.DefaultBranch,\n\t}, nil\n}", "title": "" }, { "docid": "b54e67403ccbd9d045efd814b8b01938", "score": "0.52040565", "text": "func (d *model) GetRepositories(ctx context.Context) ([]livegreptone.Repository, error) {\n\tresp, err := d.etcd.Get(ctx, ProjectKeyPrefix, clientv3.WithPrefix())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trepoSet := make(map[string]struct{})\n\tfor _, kv := range resp.Kvs {\n\t\tvar project livegreptone.Project\n\t\terr := json.Unmarshal(kv.Value, &project)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, r := range project.Repositories {\n\t\t\tkey := r.URL + \"\\x00\" + r.Branch\n\t\t\trepoSet[key] = struct{}{}\n\t\t}\n\t}\n\n\trepos := make([]livegreptone.Repository, len(repoSet))\n\ti := 0\n\tfor key := range repoSet {\n\t\tkv := strings.Split(key, \"\\x00\")\n\t\trepos[i] = livegreptone.Repository{URL: kv[0], Branch: kv[1]}\n\t\ti++\n\t}\n\treturn repos, nil\n}", "title": "" }, { "docid": "61cc96cab2c700d53d79024dbe885810", "score": "0.52040094", "text": "func extractRepoInfo(row bigtable.Row) (*gitstore.RepoInfo, error) {\n\trm := rowMap(row)\n\n\t// Extract the branch info.\n\tbranchInfo := rm.GetStrMap(cfBranches)\n\tbranches := make(map[string]*gitstore.BranchPointer, len(branchInfo))\n\tvar err error\n\tfor name, b := range branchInfo {\n\t\tbranches[name], err = decBranchPointer([]byte(b))\n\t\tif err != nil {\n\t\t\treturn nil, skerr.Fmt(\"Error decoding branch pointer: %s\", err)\n\t\t}\n\t}\n\n\t// Extract the repo ID.\n\tidBytes := []byte(rm.GetStr(cfMeta, colMetaID))\n\tif len(idBytes) != 8 {\n\t\treturn nil, skerr.Fmt(\"Error: Got id that's not exactly 8 bytes: '%x': %s\", idBytes, err)\n\t}\n\n\tret := &gitstore.RepoInfo{\n\t\tRepoURL: keyFromRowName(row.Key()),\n\t\tID: int64(binary.BigEndian.Uint64(idBytes)),\n\t\tBranches: branches,\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "be734d4f465385d6deec14f2bc627243", "score": "0.52026415", "text": "func (m *Manager) GetAll(ctx context.Context) ([]*hub.Repository, error) {\n\tvar r []*hub.Repository\n\terr := m.dbQueryUnmarshal(ctx, &r, \"select get_all_repositories()\")\n\treturn r, err\n}", "title": "" }, { "docid": "6707f08e79facd5a0e8fc99486e8caac", "score": "0.51839507", "text": "func getInitialRepositories(cr *argoprojv1a1.ArgoCD) string {\n\trepos := common.ArgoCDDefaultRepositories\n\tif len(cr.Spec.InitialRepositories) > 0 {\n\t\trepos = cr.Spec.InitialRepositories\n\t}\n\treturn repos\n}", "title": "" }, { "docid": "08b0e9833173bbcea41a924104aca684", "score": "0.51832503", "text": "func (a *HelmApiService) HelmListRepos(ctx _context.Context, orgId int32) ([]HelmRepoListItem, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []HelmRepoListItem\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/v1/orgs/{orgId}/helm/repos\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"orgId\"+\"}\", _neturl.QueryEscape(parameterToString(orgId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"application/problem+json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v CommonError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "21af75dda75a07551259072b8c4467ad", "score": "0.51751995", "text": "func (c *Client) ListMyRepos(opt ListReposOptions) ([]*Repository, *Response, error) {\n\topt.setDefaults()\n\trepos := make([]*Repository, 0, opt.PageSize)\n\tresp, err := c.getParsedResponse(\"GET\", fmt.Sprintf(\"/user/repos?%s\", opt.getURLQuery().Encode()), nil, nil, &repos)\n\treturn repos, resp, err\n}", "title": "" }, { "docid": "69d7436cd0260ac13a5ab3cad6cf8a85", "score": "0.51745486", "text": "func GetGoRepo() ([]*PkgInfo, error) {\n\t// Connect to database.\n\tq := connDb()\n\tdefer q.Close()\n\n\tvar pkgInfos []*PkgInfo\n\tcondition := qbs.NewCondition(\"pro_name = ?\", \"Go\")\n\terr := q.Condition(condition).OrderBy(\"path\").FindAll(&pkgInfos)\n\tinfos := make([]*PkgInfo, 0, 30)\n\tfor _, v := range pkgInfos {\n\t\tif strings.Index(v.Path, \".\") == -1 {\n\t\t\tinfos = append(infos, v)\n\t\t}\n\t}\n\treturn infos, err\n}", "title": "" }, { "docid": "09d77b53f841a1e3572087054aaa948e", "score": "0.5168056", "text": "func GetRepos(username string) ([]*model.Repo, *model.Error) {\n\turl := utils.MakeURL(base, \"users\", username, \"starred\")\n\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, model.NewError(\"services.get_repos\", err.Error(), res.StatusCode)\n\t}\n\n\trepos := make([]*model.Repo, 0)\n\tutils.ReaderFromJSON(res.Body, &repos)\n\n\treturn repos, nil\n}", "title": "" }, { "docid": "c1bb48f218a288a19297e202c0f9f6f1", "score": "0.51603436", "text": "func (a *ASClient) GetRepositories() ([]int, error) {\n\trepIds := []int{}\n\tendpoint := \"/repositories\"\n\tresponse, err := a.get(endpoint, false)\n\tif err != nil {\n\t\treturn repIds, err\n\t}\n\tbody, err := io.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn repIds, err\n\t}\n\n\treps := make([]map[string]interface{}, 1, 1)\n\terr = json.Unmarshal(body, &reps)\n\n\tfor i := range reps {\n\t\trep := fmt.Sprintf(\"%v\", reps[i][\"uri\"])\n\t\trepId, err := strconv.Atoi(rep[len(rep)-1:])\n\t\tif err != nil {\n\t\t\treturn repIds, err\n\t\t}\n\t\trepIds = append(repIds, repId)\n\t}\n\n\treturn repIds, nil\n}", "title": "" }, { "docid": "79379a3555cc543d5ff631f27cb48c91", "score": "0.5159969", "text": "func processRepos(ctx *lib.Ctx, allRepos map[string]map[string]struct{}) {\n\t// Set non-fatal exec mode, we want to run sync for next project(s) if current fails\n\t// Also set quite mode, many git-pulls or git-clones can fail and this is not needed to log it to DB\n\t// User can set higher debug level and run manually to debug this\n\tctx.ExecFatal = false\n\tctx.ExecQuiet = true\n\n\t// Go to main repos directory\n\twd := ctx.ReposDir\n\texists, err := dirExists(wd)\n\tlib.FatalOnError(err)\n\tif !exists {\n\t\t// Try to Mkdir it if not exists\n\t\tlib.FatalOnError(os.Mkdir(wd, 0755))\n\t\texists, err = dirExists(wd)\n\t\tlib.FatalOnError(err)\n\t\tif !exists {\n\t\t\tlib.Fatalf(\"failed to create directory: %s\", wd)\n\t\t}\n\t}\n\n\t// Process all orgs & repos\n\tthrN := lib.GetThreadsNum(ctx)\n\tch := make(chan string)\n\tnThreads := 0\n\tallOkRepos := []string{}\n\t// Count all data\n\tchecked := 0\n\tallN := 0\n\tlastTime := time.Now()\n\tdtStart := lastTime\n\tfor _, repos := range allRepos {\n\t\tallN += len(repos)\n\t}\n\t// Process each repo only once\n\tseen := make(map[string]bool)\n\t// Iterate orgs\n\tfor org, repos := range allRepos {\n\t\t// Go to current 'org' subdirectory\n\t\towd := wd + org\n\t\texists, err = dirExists(owd)\n\t\tlib.FatalOnError(err)\n\t\tif !exists {\n\t\t\t// Try to Mkdir it if not exists\n\t\t\tlib.FatalOnError(os.Mkdir(owd, 0755))\n\t\t\texists, err = dirExists(owd)\n\t\t\tlib.FatalOnError(err)\n\t\t\tif !exists {\n\t\t\t\tlib.Fatalf(\"failed to create directory: %s\", owd)\n\t\t\t}\n\t\t}\n\t\t// Iterate org's repositories\n\t\tfor orgRepo := range repos {\n\t\t\t// Check if we already processed that repo\n\t\t\t_, ok := seen[orgRepo]\n\t\t\tif ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tseen[orgRepo] = true\n\t\t\t// repository's working dir (if present we only need to do git reset --hard; git pull)\n\t\t\tary := strings.Split(orgRepo, \"/\")\n\t\t\trepo := ary[1]\n\t\t\trwd := owd + \"/\" + repo\n\t\t\tgo processRepo(ch, ctx, orgRepo, rwd)\n\t\t\tnThreads++\n\t\t\tif nThreads == thrN {\n\t\t\t\tres := <-ch\n\t\t\t\tnThreads--\n\t\t\t\tif res != \"\" {\n\t\t\t\t\tallOkRepos = append(allOkRepos, res)\n\t\t\t\t}\n\t\t\t\tchecked++\n\t\t\t\tlib.ProgressInfo(checked, allN, dtStart, &lastTime, time.Duration(10)*time.Second, orgRepo)\n\t\t\t}\n\t\t}\n\t}\n\tfor nThreads > 0 {\n\t\tres := <-ch\n\t\tnThreads--\n\t\tif res != \"\" {\n\t\t\tallOkRepos = append(allOkRepos, res)\n\t\t}\n\t\tchecked++\n\t\tlib.ProgressInfo(checked, allN, dtStart, &lastTime, time.Duration(10)*time.Second, \"final join...\")\n\t}\n\n\t// Output all repos as ruby object & Final cncf/gitdm command to generate concatenated git.log\n\t// Only output when GHA2DB_EXTERNAL_INFO env variable is set\n\t// Only output to stdout - not standard logs via lib.Printf(...)\n\tif ctx.ExternalInfo {\n\t\t// Sort list of repos and made them unique\n\t\tallOkRepos = lib.MakeUniqueSort(allOkRepos)\n\n\t\t// Create Ruby-like string with all repos array\n\t\tallOkReposStr := \"[\\n\"\n\t\tfor _, okRepo := range allOkRepos {\n\t\t\tallOkReposStr += \" '\" + okRepo + \"',\\n\"\n\t\t}\n\t\tallOkReposStr += \"]\"\n\n\t\t// Create list of orgs\n\t\torgs := []string{}\n\t\tfor org := range allRepos {\n\t\t\torgs = append(orgs, org)\n\t\t}\n\n\t\t// Sort orgs and made them unique\n\t\torgs = lib.MakeUniqueSort(orgs)\n\n\t\t// Output shell command sorted\n\t\tfinalCmd := \"./all_repos_log.sh \"\n\t\tfor _, org := range orgs {\n\t\t\tfinalCmd += ctx.ReposDir + org + \"/* \\\\\\n\"\n\t\t}\n\t\tfinalCmd = strings.TrimSuffix(finalCmd, \" \\\\\\n\")\n\n\t\t// Output cncf/gitdm related data\n\t\tfmt.Printf(\"AllRepos:\\n%s\\n\", allOkReposStr)\n\t\tfmt.Printf(\"Final command:\\n%s\\n\", finalCmd)\n\t}\n\tlib.Printf(\"Sucesfully processed %d/%d repos\\n\", len(allOkRepos), checked)\n}", "title": "" }, { "docid": "2dbf7fa36e513003355e6f4108a88e83", "score": "0.51477367", "text": "func (sp *serviceProvider) List() ([]Repos, error) {\n\tvar (\n\t\terr error\n\t\tlist []Repos\n\t)\n\n\tconn := session.Connect()\n\tdefer conn.Disconnect()\n\n\tsort := \"-Created\"\n\terr = conn.GetMany(nil, &list, sort)\n\n\treturn list, err\n}", "title": "" }, { "docid": "970f4e8c9bb6080d6b151863bec87d41", "score": "0.51381564", "text": "func (internRepo *InternGormRepo) Interns() ([]entity.PersonalDetails, []error) {\n\tinterns := []entity.PersonalDetails{}\n\terrs := internRepo.conn.Find(&interns).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn interns, errs\n\n}", "title": "" }, { "docid": "f139a17d5249acb951099088d127cd5d", "score": "0.51285", "text": "func (li ListManager) List() (formula.Repos, error) {\n\trepos := formula.Repos{}\n\treposFilePath := filepath.Join(li.ritHome, reposDirName, reposFileName)\n\tif !li.file.Exists(reposFilePath) {\n\t\treturn repos, nil\n\t}\n\n\tfile, err := li.file.Read(reposFilePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := json.Unmarshal(file, &repos); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn repos, nil\n}", "title": "" }, { "docid": "2218cb7f96c4eb813b2f62541775cbf8", "score": "0.51210463", "text": "func (client RepositoryClient) GetList(ctx context.Context, last string, n *int32) (result Repositories, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/RepositoryClient.GetList\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetListPreparer(ctx, last, n)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"containerregistry.RepositoryClient\", \"GetList\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"containerregistry.RepositoryClient\", \"GetList\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"containerregistry.RepositoryClient\", \"GetList\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "fbeed6f5f30033092a5347a0e3b47fdd", "score": "0.51139975", "text": "func (d *userDir) getRepos() {\n\tif d.repos != nil {\n\t\treturn\n\t}\n\td.repos = map[string]bool{}\n\trepos, resp, err := client.Repositories.List(d.user, nil)\n\t// Ignore 404s, it may just mean the user is an org.\n\tif err != nil && resp.StatusCode != http.StatusNotFound {\n\t\td.err = err\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tfor _, r := range repos {\n\t\td.repos[*r.Name] = true\n\t}\n\n\t// Also check if the repos-by-org API returns any repos; there seem to\n\t// be inconsistent results for orgs, e.g.:\n\t// https://api.github.com/users/google/repos vs.\n\t// https://api.github.com/orgs/google/repos\n\tbyOrg, resp, err := client.Repositories.ListByOrg(d.user, nil)\n\t// Ignore 404s, it may just mean the org is only a user.\n\tif err != nil && resp.StatusCode != http.StatusNotFound {\n\t\td.err = err\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tfor _, r := range byOrg {\n\t\td.repos[*r.Name] = true\n\t}\n}", "title": "" }, { "docid": "eac31401a5fdb648bfa656e732e56ec4", "score": "0.5112681", "text": "func (c GitserverRepoStoreListReposWithoutSizeFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1}\n}", "title": "" } ]
21ba352300e9cef80ee8d3df31ec5eb9
GetType returns the type of the resource, in this case "cluster"
[ { "docid": "c1c88f5ef733b6cc63503380201a6bfa", "score": "0.8138936", "text": "func (s Resource) GetType() resource.PipelineResourceType {\n\treturn resource.PipelineResourceTypeCluster\n}", "title": "" } ]
[ { "docid": "5a19a3a55c012ab1965b5f6a9813dc9c", "score": "0.7577829", "text": "func (cluster *ManagedCluster_Spec_ARM) GetType() string {\n\treturn \"Microsoft.ContainerService/managedClusters\"\n}", "title": "" }, { "docid": "8b3793fa78657e9661980d961213fdc3", "score": "0.717255", "text": "func (cluster *ManagedCluster) GetType() string {\n\treturn \"Microsoft.ContainerService/managedClusters\"\n}", "title": "" }, { "docid": "77490d24330eca0d90ad21e79befdd2f", "score": "0.7144938", "text": "func (s RedshiftCluster) CfnResourceType() string {\n\t\n\treturn \"AWS::Redshift::Cluster\"\n}", "title": "" }, { "docid": "a8cfcf5eb0ce31db52af9897e0459c75", "score": "0.7023797", "text": "func (s ECSCluster) CfnResourceType() string {\n\t\n\treturn \"AWS::ECS::Cluster\"\n}", "title": "" }, { "docid": "3b798f911a2f40ba635c24327818d9b4", "score": "0.6963408", "text": "func (s EMRCluster) CfnResourceType() string {\n\t\n\treturn \"AWS::EMR::Cluster\"\n}", "title": "" }, { "docid": "0b39deb6300c72aac35d3b76bf78ec0d", "score": "0.6946496", "text": "func GetClusterResType(env string) string {\n\tswitch env {\n\tcase \"prod\":\n\t\treturn ClusterProd\n\t}\n\n\treturn ClusterTest\n}", "title": "" }, { "docid": "03bf2af84671c99cbfafb3bc33e93a64", "score": "0.68919647", "text": "func (s RDSDBCluster) CfnResourceType() string {\n\t\n\treturn \"AWS::RDS::DBCluster\"\n}", "title": "" }, { "docid": "291132f302d247ac64b8d48b8db6441c", "score": "0.68467885", "text": "func (s ElastiCacheCacheCluster) CfnResourceType() string {\n\t\n\treturn \"AWS::ElastiCache::CacheCluster\"\n}", "title": "" }, { "docid": "dea40386e344f8f9bf4810becaf505b4", "score": "0.681997", "text": "func (s DAXCluster) CfnResourceType() string {\n\t\n\treturn \"AWS::DAX::Cluster\"\n}", "title": "" }, { "docid": "02146dfc350e4d47400464dd710c74b2", "score": "0.6707614", "text": "func (mg *KubernetesCluster) GetTerraformResourceType() string {\n\treturn \"azurerm_kubernetes_cluster\"\n}", "title": "" }, { "docid": "da534a3ca0869e90e8e743c9bd15bd42", "score": "0.66737795", "text": "func (s RedshiftClusterSecurityGroup) CfnResourceType() string {\n\t\n\treturn \"AWS::Redshift::ClusterSecurityGroup\"\n}", "title": "" }, { "docid": "cc493c7324443e7ec91da5c91453c837", "score": "0.6622904", "text": "func (e *EksInfo) GetType() string {\n\treturn pkgCluster.Amazon\n}", "title": "" }, { "docid": "5b0c02b0c097ac4288d4d1655ce0df0a", "score": "0.65847194", "text": "func (a *ResourcePool) GetType() string {\n\treturn GetType()\n}", "title": "" }, { "docid": "f8d5aa9938f718178350e6d34063093a", "score": "0.65816575", "text": "func (r Resource) Type() string {\n\treturn snakeToTitleCase(r.DCLName())\n}", "title": "" }, { "docid": "71560cdd9c26d5cf022e4bddd0b67704", "score": "0.6577103", "text": "func (s RedshiftClusterSecurityGroupIngress) CfnResourceType() string {\n\t\n\treturn \"AWS::Redshift::ClusterSecurityGroupIngress\"\n}", "title": "" }, { "docid": "1645f64de8238a0c859e9b9f8220db34", "score": "0.65138215", "text": "func (group *ResourceGroup_Spec_ARM) GetType() string {\n\treturn \"Microsoft.Resources/resourceGroups\"\n}", "title": "" }, { "docid": "69726f6e459d82425d1bc9d1a7b5d272", "score": "0.6498877", "text": "func (s RedshiftClusterSubnetGroup) CfnResourceType() string {\n\t\n\treturn \"AWS::Redshift::ClusterSubnetGroup\"\n}", "title": "" }, { "docid": "ffaaef06bdbe22c2dbde003dd6390354", "score": "0.64009315", "text": "func (bucket *ObjectStorageBucket) GetType() string {\n\treturn utils.ResourceObjectStorageBucket\n}", "title": "" }, { "docid": "2d5bafece936326338d29aaabfe4f814", "score": "0.6341058", "text": "func (o *Resource) GetType() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Type\n}", "title": "" }, { "docid": "f1af173b405b9e55dd6e2df302fc5d77", "score": "0.63171303", "text": "func (s ElasticsearchDomain) CfnResourceType() string {\n\t\n\treturn \"AWS::Elasticsearch::Domain\"\n}", "title": "" }, { "docid": "75100d55a9d5ba9c94f4e87b16e5b706", "score": "0.6291088", "text": "func (k *Visor) GetClusterResource(ctx context.Context, t ResourceType, v ManagedNames, name string) (err error) {\n\tvv, ok := v.(runtime.Object)\n\tif !ok {\n\t\treturn errors.Errorf(\"provided value was not castable to runtime.Object\")\n\t}\n\n\tvar c rest.Interface\n\tswitch t {\n\tcase ResourceTypeCustomResourceDefinition:\n\t\tc = k.apiext.ApiextensionsV1beta1().RESTClient()\n\tcase ResourceTypeRoles, ResourceTypeRoleBindings, ResourceTypeClusterRoles, ResourceTypeClusterRoleBindings:\n\t\tc = k.api.RbacV1().RESTClient()\n\tdefault:\n\t\treturn errors.Errorf(\"unknown Kubernetes resource type provided: '%s'\", t)\n\t}\n\n\tk.logs.Debugf(\"getting %s '%s' in namespace '%s': %s\", t, name, k.ns, ctx)\n\terr = c.Get().\n\t\tName(name).\n\t\tResource(string(t)).\n\t\tBody(vv).\n\t\tContext(ctx).\n\t\tDo().\n\t\tInto(vv)\n\n\tif err != nil {\n\t\treturn k.tagError(err)\n\t}\n\n\tv.SetName(k.removePrefix(v.GetName())) //normalize back to unprefixed resource name\n\treturn nil\n}", "title": "" }, { "docid": "4847f77da70dca2be074ed4418000748", "score": "0.6235692", "text": "func (mg *KubernetesClusterNodePool) GetTerraformResourceType() string {\n\treturn \"azurerm_kubernetes_cluster_node_pool\"\n}", "title": "" }, { "docid": "c4eb908a87e6fa773603ae3eadb028e9", "score": "0.6222871", "text": "func (s RedshiftClusterParameterGroup) CfnResourceType() string {\n\t\n\treturn \"AWS::Redshift::ClusterParameterGroup\"\n}", "title": "" }, { "docid": "26a6892d403d8327b6aab6dcb6fa461f", "score": "0.6169987", "text": "func (s ElasticLoadBalancingLoadBalancer) CfnResourceType() string {\n\t\n\treturn \"AWS::ElasticLoadBalancing::LoadBalancer\"\n}", "title": "" }, { "docid": "7c4418150dc0119a609861d645759879", "score": "0.61295563", "text": "func (s RDSDBClusterParameterGroup) CfnResourceType() string {\n\t\n\treturn \"AWS::RDS::DBClusterParameterGroup\"\n}", "title": "" }, { "docid": "4a5723be1dfa113d94e2f14ca4f10f73", "score": "0.61090696", "text": "func (*Network) ResourceType() string {\n\treturn \"Network\"\n}", "title": "" }, { "docid": "ebe76f719b1a9cbecf8aa7aa0ad0df33", "score": "0.6039323", "text": "func (s OpsWorksInstance) CfnResourceType() string {\n\t\n\treturn \"AWS::OpsWorks::Instance\"\n}", "title": "" }, { "docid": "95c70d69b338918a8161131535c80a5a", "score": "0.603261", "text": "func (s ElastiCacheReplicationGroup) CfnResourceType() string {\n\t\n\treturn \"AWS::ElastiCache::ReplicationGroup\"\n}", "title": "" }, { "docid": "3026c0baa4e9e02ca52dd90f21c0fc59", "score": "0.6018362", "text": "func (r *ResourceBase) GetType() string {\n\tif r.delegate != nil {\n\t\treturn r.delegate.GetType()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "aa431a80fc46ac6f9af712aaa90db734", "score": "0.6007425", "text": "func (s DMSReplicationInstance) CfnResourceType() string {\n\t\n\treturn \"AWS::DMS::ReplicationInstance\"\n}", "title": "" }, { "docid": "d5997796d6cab9395303af873874c4d9", "score": "0.5999199", "text": "func getResourceType(workloadType string) (string, error) {\n\tfmtmsg := \"workloadType must be format of {group}/{version}.{type}\"\n\tsplit := strings.Split(workloadType, \"/\")\n\tif len(split) != 2 {\n\t\treturn \"\", errors.New(fmtmsg)\n\t}\n\n\tgroup := split[0]\n\tif group != config.ROS_GROUP {\n\t\treturn \"\", errors.New(fmt.Sprintf(\n\t\t\t\"Group '%s' in workloadType is not supported. Support group: %s\", group, config.ROS_GROUP))\n\t}\n\n\tsplit = strings.Split(split[1], \".\")\n\tif len(split) != 2 {\n\t\treturn \"\", errors.New(fmtmsg)\n\t}\n\n\tversion := split[0]\n\tif version != \"v1alpha1\" {\n\t\treturn \"\", errors.New(fmt.Sprintf(\n\t\t\t\"Version '%s' in workloadType is not supported. Support version: v1alpha1\", version))\n\t}\n\n\ttype_ := split[1]\n\tsplit = strings.Split(type_, \"_\")\n\tif len(split) != 2 {\n\t\treturn \"\", errors.New(fmt.Sprintf(\n\t\t\t\"Type '%s' in workloadType must be format of {product}_{restype}\", type_))\n\t}\n\n\tresourceType := fmt.Sprintf(\"ALIYUN::%s::%s\", split[0], split[1])\n\treturn resourceType, nil\n}", "title": "" }, { "docid": "49c9bb6d77ffe5c74db3caabec5abf07", "score": "0.5987745", "text": "func (group *NetworkSecurityGroup_Spec_ARM) GetType() string {\n\treturn \"Microsoft.Network/networkSecurityGroups\"\n}", "title": "" }, { "docid": "ed922abf66917443285690f7c2730f5e", "score": "0.5984592", "text": "func (group *Servers_FailoverGroup_Spec_ARM) GetType() string {\n\treturn \"Microsoft.Sql/servers/failoverGroups\"\n}", "title": "" }, { "docid": "8c83da597962ac29b987490a9a7b8ad5", "score": "0.59803474", "text": "func GetType(typename string) (RType, Type, error) {\n\tswitch typename {\n\tcase \"certificate\":\n\t\treturn Certificate, &CertificateResource{}, nil\n\tcase \"dns\":\n\t\treturn DNS, &DNSResource{}, nil\n\tdefault:\n\t\treturn RType(\"\"), nil, errors.New(\"Resource type \" + typename + \" does not exist\")\n\t}\n}", "title": "" }, { "docid": "c0e79ae7514660bf19f0ed9535753586", "score": "0.59728634", "text": "func (s ElasticLoadBalancingV2LoadBalancer) CfnResourceType() string {\n\t\n\treturn \"AWS::ElasticLoadBalancingV2::LoadBalancer\"\n}", "title": "" }, { "docid": "cdf9d0c8022ca844fffb1b91518999a3", "score": "0.596569", "text": "func (msg MsgUpdateResourceNode) Type() string { return \"update_resource_node\" }", "title": "" }, { "docid": "856efd527d1f598ddc9652164315f572", "score": "0.5965476", "text": "func (s OpsWorksLayer) CfnResourceType() string {\n\t\n\treturn \"AWS::OpsWorks::Layer\"\n}", "title": "" }, { "docid": "2924eb332f9ee4f75b4eed7776f6ad92", "score": "0.5957798", "text": "func (o HDInsightOnDemandLinkedServiceResponseOutput) ClusterType() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HDInsightOnDemandLinkedServiceResponse) interface{} { return v.ClusterType }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "d64f2d02c771b806c069e76c09184136", "score": "0.5946794", "text": "func GetType() string {\n\treturn kind\n}", "title": "" }, { "docid": "d64f2d02c771b806c069e76c09184136", "score": "0.5946794", "text": "func GetType() string {\n\treturn kind\n}", "title": "" }, { "docid": "d64f2d02c771b806c069e76c09184136", "score": "0.5946794", "text": "func GetType() string {\n\treturn kind\n}", "title": "" }, { "docid": "d64f2d02c771b806c069e76c09184136", "score": "0.5946794", "text": "func GetType() string {\n\treturn kind\n}", "title": "" }, { "docid": "f8f089a85267e6d5e748fafa036690ba", "score": "0.5931759", "text": "func (o K8sClusterOutput) ClusterType() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *K8sCluster) pulumi.IntOutput { return v.ClusterType }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "ef7b590f3dd2c00754516055d8142403", "score": "0.59272027", "text": "func GetClusterType(idCluster string) string {\n\tresp, err := imec_db.GetInfrByID(idCluster)\n\tif err == nil && len(resp) > 0 {\n\t\treturn resp[0].Type\n\t}\n\n\tlog.Println(\"Rotterdam > CAAS > common [GetClusterType] WARNING Returning default cluster type ...\")\n\treturn \"Openshift\"\n}", "title": "" }, { "docid": "e85575daa2ea7cca779922ec98cb259b", "score": "0.5919194", "text": "func (o *ResourcepoolLease) GetResourceType() string {\n\tif o == nil || o.ResourceType == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ResourceType\n}", "title": "" }, { "docid": "17fce96b5cd896a6266b7a563e166666", "score": "0.59144664", "text": "func (o *StackpathRpcResourceInfo) GetResourceType() string {\n\tif o == nil || o.ResourceType == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ResourceType\n}", "title": "" }, { "docid": "efdaff59358107669692eb2429a1a56c", "score": "0.59098315", "text": "func (o *ResourceOwner) GetType() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Type\n}", "title": "" }, { "docid": "240e18762609d46d8009fa0592808558", "score": "0.5903913", "text": "func (s EC2Host) CfnResourceType() string {\n\t\n\treturn \"AWS::EC2::Host\"\n}", "title": "" }, { "docid": "d2c05dda798c610f90049b5757e7c43b", "score": "0.58954155", "text": "func isClusterKind(kind string) bool {\n\tlower := strings.ToLower(kind)\n\treturn strings.HasPrefix(lower, \"cluster\") || strings.HasPrefix(lower, \"namespace\")\n}", "title": "" }, { "docid": "1432d5bef951a7579a084bcc8bbb306a", "score": "0.5895114", "text": "func (s CodeDeployDeploymentGroup) CfnResourceType() string {\n\t\n\treturn \"AWS::CodeDeploy::DeploymentGroup\"\n}", "title": "" }, { "docid": "57570188e6916838c045d56c0bf73063", "score": "0.58902395", "text": "func (o HDInsightOnDemandLinkedServiceOutput) ClusterType() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HDInsightOnDemandLinkedService) interface{} { return v.ClusterType }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "9684990733fdd9b4bdd81f07e244c2c1", "score": "0.5883386", "text": "func (s OpsWorksElasticLoadBalancerAttachment) CfnResourceType() string {\n\t\n\treturn \"AWS::OpsWorks::ElasticLoadBalancerAttachment\"\n}", "title": "" }, { "docid": "0d78316a7ace2d09fb2723b1f2b3541e", "score": "0.5875094", "text": "func (s EC2NetworkACL) CfnResourceType() string {\n\t\n\treturn \"AWS::EC2::NetworkAcl\"\n}", "title": "" }, { "docid": "cd0910c4a1c7c71861e109755512fcae", "score": "0.58701026", "text": "func (compute *Workspaces_Compute_Spec_ARM) GetType() string {\n\treturn \"Microsoft.MachineLearningServices/workspaces/computes\"\n}", "title": "" }, { "docid": "2f558d24e27331c0c6c965758f506fed", "score": "0.5868564", "text": "func (s APIGatewayRestAPI) CfnResourceType() string {\n\t\n\treturn \"AWS::ApiGateway::RestApi\"\n}", "title": "" }, { "docid": "eca9c2ab0555fc1c241cab2ab95a0732", "score": "0.5859592", "text": "func (workspace *Workspace_Spec_ARM) GetType() string {\n\treturn \"Microsoft.OperationalInsights/workspaces\"\n}", "title": "" }, { "docid": "ea5b728b161bbe4f4e83bfdff6a27598", "score": "0.5823754", "text": "func (enterprise *RedisEnterprise) GetType() string {\n\treturn \"Microsoft.Cache/redisEnterprise\"\n}", "title": "" }, { "docid": "911532590b7686732b7f48222430c446", "score": "0.5819004", "text": "func (s ElastiCacheSecurityGroupIngress) CfnResourceType() string {\n\t\n\treturn \"AWS::ElastiCache::SecurityGroupIngress\"\n}", "title": "" }, { "docid": "62d3a0c15fb8829d412fcd989ba96547", "score": "0.5815106", "text": "func (o *Cluster) Kind() string {\n\tif o == nil {\n\t\treturn ClusterNilKind\n\t}\n\tif o.bitmap_&1 != 0 {\n\t\treturn ClusterLinkKind\n\t}\n\treturn ClusterKind\n}", "title": "" }, { "docid": "1d7dda3d96da038bda2dccec8c43d2cb", "score": "0.5812072", "text": "func (farm *ServerFarm) GetType() string {\n\treturn \"Microsoft.Web/serverfarms\"\n}", "title": "" }, { "docid": "ad758efe5bf2bff42b16f7290c587b20", "score": "0.5808939", "text": "func (s Route53HealthCheck) CfnResourceType() string {\n\t\n\treturn \"AWS::Route53::HealthCheck\"\n}", "title": "" }, { "docid": "03a1f658f4af74684bbccda0de26fa54", "score": "0.58069664", "text": "func (o *StackpathRpcResourceInfoAllOf) GetResourceType() string {\n\tif o == nil || o.ResourceType == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ResourceType\n}", "title": "" }, { "docid": "c7ee372d14ec3c86cabf6aff4ee837a1", "score": "0.5805957", "text": "func (s CognitoUserPoolClient) CfnResourceType() string {\n\t\n\treturn \"AWS::Cognito::UserPoolClient\"\n}", "title": "" }, { "docid": "d58100fd4e87a3a7275bb959910a7a72", "score": "0.58012295", "text": "func (o GetClustersClusterOutput) ClusterType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetClustersCluster) string { return v.ClusterType }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "51e99376d4983cd0646e0c58f1cb9aa2", "score": "0.57973284", "text": "func (pool *ServersElasticPool) GetType() string {\n\treturn \"Microsoft.Sql/servers/elasticPools\"\n}", "title": "" }, { "docid": "95926e1bd658fd2751fb437caf06e3f0", "score": "0.57968307", "text": "func (s EMRInstanceGroupConfig) CfnResourceType() string {\n\t\n\treturn \"AWS::EMR::InstanceGroupConfig\"\n}", "title": "" }, { "docid": "b99826a86aedcda689607d0112457e7d", "score": "0.5796712", "text": "func (s ElastiCacheSecurityGroup) CfnResourceType() string {\n\t\n\treturn \"AWS::ElastiCache::SecurityGroup\"\n}", "title": "" }, { "docid": "7a549042a850bb31fc742d949ee7e134", "score": "0.5795672", "text": "func (s APIGatewayDeployment) CfnResourceType() string {\n\t\n\treturn \"AWS::ApiGateway::Deployment\"\n}", "title": "" }, { "docid": "85b92c6facab0c07cfaebdf3aec01bbd", "score": "0.5793742", "text": "func (o GetDedicatedBlockStorageClustersClusterOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetDedicatedBlockStorageClustersCluster) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f9aba0692432ded6ccabfd09469f92bd", "score": "0.57849616", "text": "func (s EC2SecurityGroupIngress) CfnResourceType() string {\n\t\n\treturn \"AWS::EC2::SecurityGroupIngress\"\n}", "title": "" }, { "docid": "182a926f54a6d208dfbfc05c89bc67cf", "score": "0.5781355", "text": "func (o *ResourcepoolLeaseAllOf) GetResourceType() string {\n\tif o == nil || o.ResourceType == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ResourceType\n}", "title": "" }, { "docid": "19fbdd9f4fe067d0532efeaa8bd3a444", "score": "0.5779457", "text": "func (s CloudWatchDashboard) CfnResourceType() string {\n\t\n\treturn \"AWS::CloudWatch::Dashboard\"\n}", "title": "" }, { "docid": "5192de68f473f36f76a780fb1a3bb174", "score": "0.577945", "text": "func (c CustomResource) Kind() string {\n\treturn TypeName(c.Object)\n}", "title": "" }, { "docid": "84c70ddeb4d1bc61f7263be801869439", "score": "0.5778365", "text": "func (s DMSReplicationTask) CfnResourceType() string {\n\t\n\treturn \"AWS::DMS::ReplicationTask\"\n}", "title": "" }, { "docid": "e8e11af0ea17eadf92eddabf644e4781", "score": "0.57714826", "text": "func (o *MicrosoftGraphTargetResource) GetType() string {\n\tif o == nil || o.Type == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Type\n}", "title": "" }, { "docid": "2174a0ddb994687ae7160a2fb10d5588", "score": "0.57708985", "text": "func (s GameLiftFleet) CfnResourceType() string {\n\t\n\treturn \"AWS::GameLift::Fleet\"\n}", "title": "" }, { "docid": "90f7667a15e4f3478c3bd50ae939f735", "score": "0.57635486", "text": "func (s S3Bucket) CfnResourceType() string {\n\t\n\treturn \"AWS::S3::Bucket\"\n}", "title": "" }, { "docid": "0bb3bf23465f243f034bc2c7718c6b93", "score": "0.5760402", "text": "func (o GetResourcesResourceOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetResourcesResource) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3c29b1fc11eb49b4eb0e4cf8b6735bfb", "score": "0.57592595", "text": "func (msg MsgRemoveResourceNode) Type() string { return \"remove_resource_node\" }", "title": "" }, { "docid": "5b8354574fefbd65eb50dc57db5f99bc", "score": "0.5759186", "text": "func (s OpsWorksVolume) CfnResourceType() string {\n\t\n\treturn \"AWS::OpsWorks::Volume\"\n}", "title": "" }, { "docid": "619c0d9ec419c1e28964e79655ec1f82", "score": "0.5744603", "text": "func (s EC2NetworkACLEntry) CfnResourceType() string {\n\t\n\treturn \"AWS::EC2::NetworkAclEntry\"\n}", "title": "" }, { "docid": "fb755289c620cbd0f33762f16c779729", "score": "0.5741622", "text": "func (s EMRInstanceFleetConfig) CfnResourceType() string {\n\t\n\treturn \"AWS::EMR::InstanceFleetConfig\"\n}", "title": "" }, { "docid": "9ed76536f7ee20ea88641e326c270836", "score": "0.574123", "text": "func (factory *Factory_Spec_ARM) GetType() string {\n\treturn \"Microsoft.DataFactory/factories\"\n}", "title": "" }, { "docid": "172a078b3e15d5fdb17692205c9f9f4f", "score": "0.5739645", "text": "func (obj Resource) Type_() interface{} { return GetType(obj) }", "title": "" }, { "docid": "b3ac29bfc753516696858cf359cc847e", "score": "0.5739216", "text": "func GetClusterFromResourceObject(obj metav1.Object) *types.NamespacedName {\n\tif klog.V(QuiteLogLel) {\n\t\tfnName := GetFnName()\n\t\tklog.Infof(\"Entering: %v()\", fnName)\n\n\t\tdefer klog.Infof(\"Exiting: %v()\", fnName)\n\t}\n\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\tannotations := obj.GetAnnotations()\n\n\tif annotations == nil {\n\t\treturn nil\n\t}\n\n\tclstr := annotations[appv1alpha1.AnnotationManagedCluster]\n\n\tif clstr == \"\" {\n\t\treturn nil\n\t}\n\n\tparsedstr := strings.Split(clstr, \"/\")\n\n\tif len(parsedstr) != 2 {\n\t\treturn nil\n\t}\n\n\thost := &types.NamespacedName{Name: parsedstr[1], Namespace: parsedstr[0]}\n\n\treturn host\n}", "title": "" }, { "docid": "52eefa5dab5dccc7fb29c2f82ea4c777", "score": "0.57355607", "text": "func (s BatchComputeEnvironment) CfnResourceType() string {\n\t\n\treturn \"AWS::Batch::ComputeEnvironment\"\n}", "title": "" }, { "docid": "16af7938b33c446661e531dc95cfe530", "score": "0.57353187", "text": "func (obj LabelableObject) GetResourceType() resource.Type {\n\tswitch obj {\n\tcase RuntimeLabelableObject:\n\t\treturn resource.RuntimeLabel\n\tcase RuntimeContextLabelableObject:\n\t\treturn resource.RuntimeContextLabel\n\tcase ApplicationLabelableObject:\n\t\treturn resource.ApplicationLabel\n\tcase TenantLabelableObject:\n\t\treturn resource.TenantLabel\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5bb1f95e803b24943c05d1eb01c2413a", "score": "0.57328", "text": "func (r *AWSEMRCluster_ScalingRule) AWSCloudFormationType() string {\n\treturn \"AWS::EMR::Cluster.ScalingRule\"\n}", "title": "" }, { "docid": "732061897bac400cb11c94f6fda4afec", "score": "0.57284313", "text": "func (s AutoScalingAutoScalingGroup) CfnResourceType() string {\n\t\n\treturn \"AWS::AutoScaling::AutoScalingGroup\"\n}", "title": "" }, { "docid": "97b657e4b570f7b859069bb1e4d7f355", "score": "0.5725578", "text": "func (gateway *NFSGateway) GetType() string {\n\treturn utils.ResourceNFSGateway\n}", "title": "" }, { "docid": "f290aa79a95b7fa899a1d30f98a49a73", "score": "0.5725457", "text": "func (s GameLiftAlias) CfnResourceType() string {\n\t\n\treturn \"AWS::GameLift::Alias\"\n}", "title": "" }, { "docid": "76d0219cc3624395b5e9d41a98e59acc", "score": "0.57180566", "text": "func (id StandardComponents) ResourceType() string {\n\treturn id.resourceType\n}", "title": "" }, { "docid": "e45ed55ba3c95b18afce297580be668a", "score": "0.5713524", "text": "func (s Route53HostedZone) CfnResourceType() string {\n\t\n\treturn \"AWS::Route53::HostedZone\"\n}", "title": "" }, { "docid": "676da8dc5be856af8e30b6a24004113c", "score": "0.5707966", "text": "func (compute *WorkspacesCompute) GetType() string {\n\treturn \"Microsoft.MachineLearningServices/workspaces/computes\"\n}", "title": "" }, { "docid": "676da8dc5be856af8e30b6a24004113c", "score": "0.5707966", "text": "func (compute *WorkspacesCompute) GetType() string {\n\treturn \"Microsoft.MachineLearningServices/workspaces/computes\"\n}", "title": "" }, { "docid": "6e5718b812a1c91e83bd38bd47f28522", "score": "0.57063717", "text": "func (s DMSReplicationSubnetGroup) CfnResourceType() string {\n\t\n\treturn \"AWS::DMS::ReplicationSubnetGroup\"\n}", "title": "" }, { "docid": "b9676a1d2d64ec217e6fa24715d2eacb", "score": "0.570408", "text": "func (group *NetworkSecurityGroup) GetType() string {\n\treturn \"Microsoft.Network/networkSecurityGroups\"\n}", "title": "" }, { "docid": "bfdf5e123e2908163f17117f2cf07280", "score": "0.5700189", "text": "func (s CloudFrontDistribution) CfnResourceType() string {\n\t\n\treturn \"AWS::CloudFront::Distribution\"\n}", "title": "" }, { "docid": "a6aa3f3724cf375f5f8d8b73a3b2ca50", "score": "0.5697198", "text": "func (o *StorageNetAppCluster) GetObjectType() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.ObjectType\n}", "title": "" }, { "docid": "616918be552892dffdefc3461a33d1ce", "score": "0.56954765", "text": "func (s EMRSecurityConfiguration) CfnResourceType() string {\n\t\n\treturn \"AWS::EMR::SecurityConfiguration\"\n}", "title": "" } ]
c8e2fb0dbc78de2abef4498958266664
Read retrieves all data
[ { "docid": "9fbe7cd384c75002c477c786af656df9", "score": "0.6148982", "text": "func (dao ArtistDAO) Read() ([]Artist, error) {\n\tvar results []Artist\n\tif err := dao.getCollection().Find(bson.M{}).All(&results); err != nil {\n\t\treturn nil, err\n\t}\n\treturn results, nil\n}", "title": "" } ]
[ { "docid": "a63ac5fdad3e1d1e499062c4e8fea7e2", "score": "0.71894366", "text": "func read(res http.ResponseWriter, req *http.Request) {\n\trows, err := db.Query(`SELECT * FROM customer;`)\n\tcheck(err)\n\tdefer rows.Close()\n\tvar name string\n\tfor rows.Next() {\n\t\terr = rows.Scan(&name)\n\t\tcheck(err)\n\t\tfmt.Fprintln(res, \"The records are\", name)\n\t}\n}", "title": "" }, { "docid": "1e6befa405ab051d109888d1a791660a", "score": "0.7143837", "text": "func ReadAll() ([]byte, error) {\n\treturn readAll()\n}", "title": "" }, { "docid": "f33493928023a6d5d9cb582a42800593", "score": "0.6676081", "text": "func (c *ConsulStore) ReadAll(root string, tag string) (map[string][]byte, error) {\n\tpairs, _, err := c.client.List(root, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//TODO: Filter results by tag and return it\n\tresult := make(map[string][]byte)\n\tfor _, keypair := range pairs {\n\t\tresult[keypair.Key] = keypair.Value\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "5c4350e2b5038bf879ba5df0c1b08ae0", "score": "0.6577852", "text": "func (t *DbService) Read(request *ReadRequest) (*ReadResponse, error) {\n\trsp := &ReadResponse{}\n\treturn rsp, t.client.Call(\"db\", \"Read\", request, rsp)\n}", "title": "" }, { "docid": "0333b26dc3bbdfea75a21f56c16972f5", "score": "0.65450466", "text": "func (l *LogCache) ReadAll() (p string) {\n\tp = string(l.buffer)\n\treturn\n}", "title": "" }, { "docid": "ba84a7bed026e231840e3000aaca0ee7", "score": "0.65157515", "text": "func Read() []string {\n\treturn content.Items\n}", "title": "" }, { "docid": "d1bed3f76de773b4160bd31d1a6280ab", "score": "0.650406", "text": "func (d *Driver) Read(path string) ([]byte, error) {\n\tdata, _, err := d.conn.Get(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "75e4126e94a35bfd79a84ac7106875ac", "score": "0.64864236", "text": "func (c *UserRepoImpl) ReadAll() ([]*model.User, error) {\n\tuserList := make([]*model.User, 0)\n\tif err := c.db.Table(\"user\").Find(&userList).Error; err != nil {\n\t\tlogrus.Error(err)\n\t\treturn nil, errors.New(\"get user list data : error \")\n\t}\n\treturn userList, nil\n}", "title": "" }, { "docid": "864f61fe92552b2a4e75aac8e6cd7eed", "score": "0.64827764", "text": "func (cw *CacheWriter) ReadAll() ([]byte, error) {\n\treturn ioutil.ReadAll(cw.cacheBuff)\n}", "title": "" }, { "docid": "b1824fff7da7a98380b7bdab8ed2c47f", "score": "0.64620894", "text": "func (controller *UIController) Read(ctx context.Context) ([]string, error) {\n\treturn controller.sqls, nil\n}", "title": "" }, { "docid": "db9476ad9e1884a770211755a274e040", "score": "0.6457841", "text": "func (c *Client) ReadAll(filepath string) ([]byte, error) {\n\tsftp, err := c.SFTPClient()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer sftp.Close()\n\n\tfile, err := sftp.Open(filepath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\treturn ioutil.ReadAll(file)\n}", "title": "" }, { "docid": "511938ce821d3815afb80f98e9619b1d", "score": "0.6435793", "text": "func (d *Store) ReadAll(bind interface{}) error {\n\treturn marshalRecords(d.records, bind)\n}", "title": "" }, { "docid": "0b14bd06c13c5cda950337718d0516f3", "score": "0.64204395", "text": "func (dao *DAOName) Read(m *ReferenceModel) ([]ReferenceModel, error) {\n\tretVal := []ReferenceModel{}\n\tif err := dao.db.Where(m).Find(&retVal).Error; err != nil {\n\t\treturn nil, err\n\t}\n\treturn retVal, nil\n}", "title": "" }, { "docid": "cb57e27c1c72e1871176ed0f1cda5b1d", "score": "0.6395185", "text": "func readAll(r io.Reader) (err error) {\n\tbuf := make([]byte, 1) // small buffer to ensure we really use the loop on very small input data\n\tfor err = nil; err == nil; {\n\t\t_, err = r.Read(buf)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e604ce0b09c96a9be5f19af696b2d278", "score": "0.6375167", "text": "func (r *Reader) ReadAll() ([][]string, error) {\n\tvar (\n\t\trecords [][]string\n\t\trecord []string\n\t\terr error\n\t)\n\n\tfor err == nil {\n\t\trecord, err = r.Read()\n\t\tif len(record) > 0 {\n\t\t\trecords = append(records, record)\n\t\t}\n\t}\n\n\treturn records, err\n}", "title": "" }, { "docid": "ab74953eafca35d4f9284843202cbf4e", "score": "0.6353476", "text": "func Read(collection, resource string) interface{} {\n\tic := mod.Cache{}\n\tif err := DB.Read(cfg.Web+collection, resource, &ic); err != nil {\n\t\tfmt.Println(\"Error\", err)\n\t}\n\treturn ic.Data\n}", "title": "" }, { "docid": "369b611d4bfbb365b05d0dacf7195012", "score": "0.6288446", "text": "func (ctr *TaxcodeModule) readAll(ctx echo.Context) error {\n\tresp := new(model.ResponseFormat)\n\tmx, total, e := model.ReadAllTaxCode(\"\")\n\tif e == nil {\n\t\treturn resp.Serve(ctx, &mx, total)\n\t}\n\n\treturn resp.Error(ctx, e)\n}", "title": "" }, { "docid": "0c0384406475df45b32a73a16254486a", "score": "0.62760055", "text": "func fetchData(r reader) error {\n\tfmt.Printf(\"type %T\\n\", r)\n\tdata := make([]byte, 50)\n\tlen, err := r.read(data)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(string(data[:len]))\n\treturn nil\n\n}", "title": "" }, { "docid": "07e4b466be4ee1a2d90490b1b75ccd69", "score": "0.6267617", "text": "func (ix *IndexedBucket) Read(keys []string) ([]Record, error) {\n\treturn ix.readRecs(keys, nil)\n}", "title": "" }, { "docid": "9c7ac0ec9a6d6d271374e7a667f4e8f0", "score": "0.62473917", "text": "func (e *ExpenseModel) ReadAll(filter interface{}) ([]Expense, error) {\n\tvar expenses []Expense\n\tcollection := e.db.Client.Database(e.db.DBName).Collection(\"expenses\")\n\tlog.Printf(\"filter: %v\\n\", filter)\n\t// sort the entries based on the `date` field\n\topts := options.FindOptions{}\n\topts.SetSort(bson.D{{\"date\", -1}})\n\tcur, err := collection.Find(context.TODO(), filter, &opts)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR FINDING DATA: %v\\n\", err)\n\t\treturn expenses, err\n\t}\n\tfor cur.Next(context.TODO()) {\n\t\tvar expense Expense\n\t\terr = cur.Decode(&expense)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error on Decoding the document: %v\\n\", err)\n\t\t}\n\t\texpenses = append(expenses, expense)\n\t}\n\tlog.Printf(\"documentReturned: %v\\n\", expenses)\n\treturn expenses, nil\n}", "title": "" }, { "docid": "ec0bbf0eaeaf01ee88b7ffc7bdb287b7", "score": "0.6241572", "text": "func (t Term) ReadAll(dest interface{}, s QueryExecutor, optArgs ...RunOpts) error {\n\tres, err := t.Run(s, optArgs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn res.All(dest)\n}", "title": "" }, { "docid": "53b7dc8e5b60d6dcfa6471870720c164", "score": "0.62286", "text": "func ReadAll() {\n\tfile, err := os.Open(\"task.txt\")\n if err != nil {\n return\n }\n defer file.Close()\n\n // getting size of file\n stat, err := file.Stat()\n if err != nil {\n return\n }\n\n // reading file\n bs := make([]byte, stat.Size())\n _, err = file.Read(bs)\n if err != nil {\n return\n }\n\n fmt.Println(string(bs))\n\n}", "title": "" }, { "docid": "03ce40a034d0d3db1531aa9a247ca68d", "score": "0.62073797", "text": "func (s *ToDoServer) ReadAll(ctx context.Context, req *v1.ReadAllRequest) (*v1.ReadAllResponse, error) {\n\tif err := s.checkAPI(req.Api); err != nil {\n\t\treturn nil, err\n\t}\n\n\tc, err := s.connect(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\n\trows, err := c.QueryContext(ctx, \"SELECT * FROM ToDo\")\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Unknown, \"failed to get ToDo list->\"+err.Error())\n\t}\n\tdefer rows.Close()\n\n\tvar reminder time.Time\n\tlist := []*v1.ToDo{}\n\tfor rows.Next() {\n\t\ttd := new(v1.ToDo)\n\t\tif err := rows.Scan(&td.Id, &td.Title, &td.Description, &reminder); err != nil {\n\t\t\treturn nil, status.Error(codes.Unknown, \"failed to retrieve ToDo row->\"+err.Error())\n\t\t}\n\n\t\ttd.Reminder, err = ptypes.TimestampProto(reminder)\n\t\tif err != nil {\n\t\t\treturn nil, status.Error(codes.Unknown, \"reminder has invalid format -> \"+err.Error())\n\t\t}\n\t\tlist = append(list, td)\n\t}\n\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, status.Error(codes.Unknown, \"failed to retrieve data from ToDo->\"+err.Error())\n\t}\n\n\treturn &v1.ReadAllResponse{\n\t\tApi: apiVersion,\n\t\tToDos: list,\n\t}, nil\n}", "title": "" }, { "docid": "569c55cde38b8e9665f72989719e28e1", "score": "0.6204188", "text": "func (d *EtcdStateDriver) ReadAll(baseKey string) ([][]byte, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), ctxTimeout)\n\tdefer cancel()\n\n\tvar err error\n\tvar resp *client.GetResponse\n\n\tfor i := 0; i < maxEtcdRetries; i++ {\n\t\t// etcd uses quorum for reads by default\n\t\tresp, err = d.Client.KV.Get(ctx, baseKey, client.WithPrefix(), client.WithSort(client.SortByKey, client.SortAscend))\n\t\tif err != nil {\n\n\t\t\tif err.Error() == client.ErrNoAvailableEndpoints.Error() {\n\t\t\t\t// Retry after a delay\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t}\n\n\t\tif resp.Count == 0 {\n\t\t\treturn [][]byte{}, core.Errorf(\"key not found\")\n\t\t}\n\n\t\tvalues := [][]byte{}\n\t\tfor _, node := range resp.Kvs {\n\t\t\tvalues = append(values, []byte(node.Value))\n\t\t}\n\n\n\t\treturn values, nil\n\t}\n\n\treturn [][]byte{}, err\n}", "title": "" }, { "docid": "1afa9c6968ab548edae7b59bdab551ce", "score": "0.6194486", "text": "func read(s beam.Scope, resourcePaths beam.PCollection, client fhirStoreClient) (beam.PCollection, beam.PCollection) {\n\treturn beam.ParDo2(s, &readResourceFn{fnCommonVariables: fnCommonVariables{client: client}}, resourcePaths)\n}", "title": "" }, { "docid": "919666f9f541fe82c00b88cc6b67e79e", "score": "0.61438495", "text": "func Read() ([]User, error) {\n\tdb, err := dbConnection()\n\tif err != nil {\n\t\tcommon.Logger.Fatal(err)\n\t\treturn nil, err\n\t}\n\tdefer closeConnection(db)\n\n\tvar users []User\n\tdb.Find(&users)\n\tcommon.Logger.Debug(\"found users: \", users)\n\n\treturn users, nil\n}", "title": "" }, { "docid": "cf29f96402a44126c51f654309931b0a", "score": "0.61285114", "text": "func (r *Reader) ReadAll() (*RunReport, error) {\n\tfor {\n\t\treport := r.Read()\n\t\tif report == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn r.Report(), r.Err()\n}", "title": "" }, { "docid": "6978cbdd2be93a8fc03de1de6aab3df0", "score": "0.61231416", "text": "func (s Store) ReadAll() ([]Claim, error) {\n\tresults, err := s.backingStore.ReadAll(ItemType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclaims := make([]Claim, len(results))\n\tfor i, bytes := range results {\n\t\tvar claim Claim\n\t\terr = json.Unmarshal(bytes, &claim)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error unmarshaling claim: %v\", err)\n\t\t}\n\t\tclaims[i] = claim\n\t}\n\n\treturn claims, nil\n}", "title": "" }, { "docid": "40ddb32f27ac86ba0f7075fc7cb1399c", "score": "0.611047", "text": "func (ms *MemStore) GetAll(data map[string]io.ReaderFrom) error {\n\tvar err error\n\tms.mu.RLock()\n\tfor k, d := range data {\n\t\tbuf, ok := ms.data[k]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tif _, err = d.ReadFrom(&buf); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tms.mu.RUnlock()\n\treturn err\n}", "title": "" }, { "docid": "4724e4bf5678f336c7a5520de16818f0", "score": "0.6101195", "text": "func (box *ReadingBox) GetAll() ([]*Reading, error) {\n\tobjects, err := box.Box.GetAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn objects.([]*Reading), nil\n}", "title": "" }, { "docid": "6d1ccfc16b9c6aec65aeb9e4709fd8f1", "score": "0.6095467", "text": "func getRead(url string) ([]byte, error) {\n\tresp, err := http.Get(url)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn data, resp.Body.Close()\n}", "title": "" }, { "docid": "cea4554180de97ead56b80a2714d3d25", "score": "0.6093483", "text": "func ReadAll(r io.Reader) ([]*Entry, error) {\n\tcf, err := cif.Read(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar entries []*Entry\n\tfor _, block := range cf.Blocks {\n\t\te, err := ReadCIFDataBlock(block)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tentries = append(entries, e)\n\t}\n\treturn entries, nil\n}", "title": "" }, { "docid": "cb69c2435b5c000915a468850dd76b25", "score": "0.6087119", "text": "func readDatabase() chan t {\n\tout := make(chan t) // HL\n\tgo func(output chan<- t) {\n\t\tfor _, item := range store {\n\t\t\titem = process(item, \"database\")\n\t\t\toutput <- item // HL\n\t\t}\n\t\tclose(output)\n\t}(out)\n\treturn out // HL\n}", "title": "" }, { "docid": "808f301b9f8fb4c85fec56077f8156e4", "score": "0.6082216", "text": "func (c *Context) ReadAll() ([]byte, error) {\n\tif c.Request == nil {\n\t\treturn nil, ErrRequest\n\t}\n\tif c.Request.Body == nil {\n\t\treturn nil, io.EOF\n\t}\n\treturn ioutil.ReadAll(c.Request.Body)\n}", "title": "" }, { "docid": "ce8f052dc68cbd626450753af1df036e", "score": "0.607338", "text": "func (rcv *documentReader) ReadAll(conditions *value.ReadAllDocConditions) ([]interface{}, error) {\n\topts := make([]findopt.Find, 2)\n\topts[0] = findopt.Skip(int64(conditions.Skip()))\n\topts[1] = findopt.Limit(int64(conditions.Limit()))\n\n\tif len(conditions.Sort()) > 0 {\n\t\topts = append(opts, findopt.Sort(conditions.Sort()))\n\t}\n\n\tcursor, err := rcv.db.\n\t\tDatabase(string(conditions.DbName())).\n\t\tCollection(string(conditions.CollName())).\n\t\tFind(context.Background(), nil, opts...)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result []interface{}\n\tdocument := bson.NewDocument()\n\n\tfor cursor.Next(nil) {\n\t\tdocument.Reset()\n\t\tif err := cursor.Decode(document); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdocJson, err := document.ToExtJSONErr(false)\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar doc map[string]interface{}\n\n\t\tif err := json.Unmarshal([]byte(docJson), &doc); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif objID, ok := doc[\"_id\"]; ok {\n\t\t\tdoc[\"_id\"] = rcv.objectIDToScalarType(objID)\n\t\t}\n\n\t\tresult = append(result, doc)\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "533b0de0afc645161640bc55e0240372", "score": "0.6064666", "text": "func read(r io.Reader) ([]byte, error) {\n\tvar data []byte\n\t// defer r.Close()\n\tbufSize := 1024 * 10\n\tbuf := make([]byte, bufSize) //一次读取多少个字节\n\tbfRd := bufio.NewReader(r)\n\tfor {\n\t\tn, err := bfRd.Read(buf)\n\t\tdata = append(data, buf[:n]...)\n\t\tif err != nil { //遇到任何错误立即返回,并忽略EOF错误信息\n\t\t\tif err == io.EOF {\n\t\t\t\treturn data, nil\n\t\t\t}\n\t\t\treturn data, err\n\t\t}\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "882e0c8bfd309249a9461218e6564510", "score": "0.60606617", "text": "func (lc *LuMiGatewayClient) Read(idlist []string, s *net.UDPConn, addr *net.UDPAddr) {\n\tfor {\n\t\tfor _, id := range idlist {\n\t\t\td, err := lc.PackCommand(lumiCommandTypeRead, \"\", id, 0, \"\")\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"pack read command failed: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ts.WriteToUDP(d, addr)\n\t\t}\n\n\t\ttime.Sleep(time.Second)\n\t}\n}", "title": "" }, { "docid": "20ff27388d0b43ec7538a3fad51faab3", "score": "0.604365", "text": "func (i *API) Read(kind, key string) ([]byte, error) {\n\treturn i.primaryStore.RawRead(kind, key)\n}", "title": "" }, { "docid": "09a663462fe239a37db615a4aa7eec4e", "score": "0.6040135", "text": "func (fc finderClient) FullReads(ctx context.Context,\n\thost, index, shard string,\n\tids []strfmt.UUID,\n) ([]objects.Replica, error) {\n\tn := len(ids)\n\trs, err := fc.cl.FetchObjects(ctx, host, index, shard, ids)\n\tif m := len(rs); err == nil && n != m {\n\t\terr = fmt.Errorf(\"malformed full read response: length expected %d got %d\", n, m)\n\t}\n\treturn rs, err\n}", "title": "" }, { "docid": "24e37ef52b3ac26b3821e39d9c013dd6", "score": "0.6037349", "text": "func (m *MonkeyWrench) Read(table string, keys []spanner.KeySet, columns []string) ([]*spanner.Row, error) {\n\t// Default to all keys.\n\tvar spannerKeys = spanner.AllKeys()\n\n\t// If we have some specified keys, use those instead.\n\tif len(keys) > 0 {\n\t\tspannerKeys = spanner.KeySets(keys...)\n\t}\n\n\t// Execute the query.\n\titer := m.Client.Single().Read(m.Context, table, spannerKeys, columns)\n\treturn getResultSlice(iter)\n}", "title": "" }, { "docid": "9f0c57573ab4b671c2198074482b8baa", "score": "0.6029877", "text": "func (s *toDoServiceServer) ReadAll(ctx context.Context, req *v1.ReadAllRequest) (*v1.ReadAllResponse, error) {\n\treturn &v1.ReadAllResponse{\n\t\tApi: apiVersion,\n\t\tToDos: nil,\n\t}, nil\n}", "title": "" }, { "docid": "6eeeee694dea40872247a41a8f2c91f4", "score": "0.6024383", "text": "func (s *taskService) ReadAll(ctx context.Context, req *empty.Empty) (*taskpb.ReadAllResponse, error) {\n\tresults := make([]*Task, 0)\n\n\tcur, err := s.coll.Find(ctx, nil)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"%s\"+err.Error())\n\t}\n\tdefer cur.Close(ctx)\n\n\tres := new(Task)\n\tfor cur.Next(ctx) {\n\t\terr = cur.Decode(&res)\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"%s\"+err.Error())\n\t\t}\n\t\tresults = append(results, res)\n\t}\n\tif err := cur.Err(); err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"%s\"+err.Error())\n\t}\n\n\tvar tasks []*taskpb.Task\n\tfor _, task := range results {\n\t\tremainder, _ := ptypes.TimestampProto(task.Reminder)\n\t\ttasks = append(tasks, &taskpb.Task{\n\t\t\tId: task.ID.Hex(),\n\t\t\tTitle: task.Title,\n\t\t\tDesc: task.Desc,\n\t\t\tReminder: remainder,\n\t\t})\n\t}\n\n\treturn &taskpb.ReadAllResponse{Tasks: tasks}, nil\n}", "title": "" }, { "docid": "c3d885fcce5c3f5adc652548f2afe294", "score": "0.6022131", "text": "func read() []Data {\n\tvar cacheData []Data\n\n\tcachePath, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tcachePath = filepath.Join(cachePath, \"mtl-cache.bin\")\n\tcacheFile, err := os.Open(cachePath)\n\tif errors.Is(err, os.ErrNotExist) {\n\t\t// handle the case where the file doesn't exist\n\t\tcacheFile, err = os.Create(cachePath)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer cacheFile.Close()\n\n\t\tenc := gob.NewEncoder(cacheFile)\n\t\tif err := enc.Encode(cacheData); err != nil {\n\t\t\tlog.Fatalf(\"Cache creation failed: %v\", err)\n\t\t}\n\n\t\treturn cacheData\n\t} else if err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer cacheFile.Close()\n\n\tdec := gob.NewDecoder(cacheFile)\n\tif err := dec.Decode(&cacheData); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn cacheData\n}", "title": "" }, { "docid": "527046bb283003738c3a561cc6d424bc", "score": "0.60220724", "text": "func (t *Tube) BulkRead() []*Record {\n\tt.Lock()\n\tdefer t.Unlock()\n\treturn t.view.Peek()\n}", "title": "" }, { "docid": "66ec80022bb15eaba36b28f92cdb6b14", "score": "0.60128886", "text": "func ReadAll(f io.Reader) []byte {\n\tbuf, err := ioutil.ReadAll(f)\n\tAbortIf(err)\n\treturn buf\n}", "title": "" }, { "docid": "f671feca9cc5387a24a8ebe914dd1cba", "score": "0.5997511", "text": "func (fc finderClient) FullRead(ctx context.Context,\n\thost, index, shard string,\n\tid strfmt.UUID,\n\tprops search.SelectProperties,\n\tadditional additional.Properties,\n) (objects.Replica, error) {\n\treturn fc.cl.FetchObject(ctx, host, index, shard, id, props, additional)\n}", "title": "" }, { "docid": "345ed5790e5658217d13d8c6ff87b8ce", "score": "0.59921336", "text": "func ReadAll(collection *mgo.Collection, query bson.M, target []struct{}) bool {\n\terr := collection.Find(query).All(target)\n\treturn check(err)\n}", "title": "" }, { "docid": "8ddb733812782893ef140e5f41ca8040", "score": "0.5986137", "text": "func (c *ConsulDB) ReadAll(prefix string) ([]string, error) {\n\tkv := c.consulClient.KV()\n\n\tpairs, _, err := kv.List(prefix, nil)\n\n\tif len(pairs) == 0 {\n\t\treturn []string{\"\"}, err\n\t}\n\n\tvar res []string\n\n\tfor _, keypair := range pairs {\n\t\tres = append(res, keypair.Key)\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "481d89d3f0898f6b7c785af7180239cc", "score": "0.59858507", "text": "func (s *toDoServiceServer) ReadAll(ctx context.Context, req *v1.ReadAllRequest) (*v1.ReadAllResponse, error) {\n\t// check if API version requested by the app is supported by server\n\tif err := s.checkAPI(req.Api); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// get SQL connection\n\tc, err := s.connect(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\n\t// get to_do list\n\trows, err := c.QueryContext(ctx, \"SELECT `to_do_id`, `title`, `description`, `reminder` FROM to_do_db.to_do\")\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unknown, \"Failed to select to_do with error: %v\", err.Error())\n\t}\n\tdefer rows.Close()\n\n\tvar reminder time.Time\n\tlist := []*v1.ToDo{}\n\tfor rows.Next() {\n\t\ttd := new(v1.ToDo)\n\t\tif err := rows.Scan(&td.Id, &td.Title, &td.Description, &reminder); err != nil {\n\t\t\treturn nil, status.Errorf(codes.Unknown, \"Failed to retrieve field values from to_do rows with error: %v\",\n\t\t\t\terr.Error())\n\t\t}\n\n\t\ttd.Reminder, err = ptypes.TimestampProto(reminder)\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Unknown, \"Reminder field has invalid format wit error: %v\", err.Error())\n\t\t}\n\t\tlist = append(list, td)\n\t}\n\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, status.Errorf(codes.Unknown, \"Failed to retrieve data from to_do with error: %v\",\n\t\t\terr.Error())\n\t}\n\n\treturn &v1.ReadAllResponse{\n\t\tApi: apiVersion,\n\t\tToDos: list,\n\t}, nil\n\n}", "title": "" }, { "docid": "e94e7b4bd590e39bffe8f878a40084e8", "score": "0.5982096", "text": "func (r Reader) GetAll(ctx context.Context, sv *Service, resultSlice interface{}) error {\n\tif r.XMLName.Local != readByQueryXMLName.Local && r.XMLName.Local != readMoreXMLName.Local {\n\t\treturn fmt.Errorf(\"GetAll not allowed on %s\", r.XMLName.Local)\n\t}\n\trptr := &r\n\tfor rptr != nil {\n\t\tresp, err := sv.Exec(ctx, rptr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = resp.Decode(resultSlice); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(resp.Results) > 0 && resp.Results[0].Data != nil && resp.Results[0].Data.NumRemaining > 0 {\n\t\t\trptr = ReadMore(resp.Results[0].Data.ResultID)\n\t\t} else {\n\t\t\trptr = nil\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f79817468426a173ef4f9d49d0bdd18", "score": "0.59725636", "text": "func (gameController GameController) ReadAll(context *gin.Context) {\r\n\tvar games []models.Game\r\n\tgameController.Database.Preload(\"Players\").Preload(\"Turns\").Find(&games)\r\n\tcontext.JSON(http.StatusOK, games)\r\n}", "title": "" }, { "docid": "29e889adc353cec1b233e194f368f63c", "score": "0.59720236", "text": "func read(db *sql.DB, todoID int) ([]Todo, error) {\n\tvar (\n\t\ttodoList = []Todo{}\n\t\tdbParams = []interface{}{}\n\t\twhereStatement string\n\t)\n\n\tif todoID != -1 {\n\t\twhereStatement += \"WHERE id = ? \"\n\t\tdbParams = append(dbParams, todoID)\n\t}\n\trows, err := db.Query(selectQry+whereStatement, dbParams...)\n\tif err != nil {\n\t\t//normally would need to do something with this error, logging most likely.\n\t\tfmt.Println(err)\n\t\treturn nil, fmt.Errorf(\"Failed to build todo list\")\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\ttodo := Todo{}\n\t\tif err := rows.Scan(&todo.ID, &todo.Title, &todo.Status); err != nil {\n\t\t\t//normally would need to do something with this error, logging most likely.\n\t\t\tfmt.Println(err)\n\t\t\treturn nil, fmt.Errorf(\"Failed to build todo list\")\n\t\t}\n\n\t\ttodoList = append(todoList, todo)\n\t}\n\treturn todoList, nil\n}", "title": "" }, { "docid": "f0a8e6da248460f78c6cc9d00345d9ed", "score": "0.5970128", "text": "func (elasticCluster *ElasticCluster) Read(queries []*prompb.Query) ([]*prompb.QueryResult, error) {\n\t//初始化queryResult\n\tqueryResults := make([]*prompb.QueryResult, 0, len(queries))\n\n\t//循环查询(应该只有一个元素,不循环也行)\n\tfor index, query := range queries {\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\tQueryIndex: index,\n\t\t}).Info(\"query start\")\n\n\t\t//新建组合查询条件\n\t\tboolQuery, err := buildBoolQuery(query)\n\t\tif err != nil {\n\t\t\tlog.Logger.WithError(err).WithFields(logrus.Fields{\n\t\t\t\tQueryIndex: index,\n\t\t\t}).Error(\"build BoolQuery error\")\n\t\t\tcontinue\n\t\t}\n\n\t\t//根据查询条件分页查询查询\n\t\tsamples, err := elasticCluster.scrollSaerch(boolQuery)\n\t\tif err != nil {\n\t\t\tlog.Logger.WithError(err).WithFields(logrus.Fields{\n\t\t\t\tQueryIndex: index,\n\t\t\t}).Error(\"scroll search error\")\n\t\t\tcontinue\n\t\t}\n\t\tlog.Logger.Info(\"scroll search success\")\n\n\t\t//将查询结果转化为samples\n\t\tif samples != nil {\n\t\t\tqueryResult := samples.Samples2QueryResult()\n\t\t\tqueryResults = append(queryResults, queryResult)\n\t\t} else {\n\t\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\t\tQueryIndex: index,\n\t\t\t}).Info(\"count is 0\")\n\t\t}\n\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\tQueryIndex: index,\n\t\t}).Info(\"query end\")\n\t}\n\n\treturn queryResults, nil\n}", "title": "" }, { "docid": "b34056621a532a5326190ed7814d06cd", "score": "0.5966787", "text": "func (n *node) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error {\n\tsr, err := n.fs.r.OpenFile(n.te.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp.Data = make([]byte, req.Size)\n\tnr, err := sr.ReadAt(resp.Data, req.Offset)\n\tif nr < req.Size {\n\t\tresp.Data = resp.Data[:nr]\n\t}\n\tif debug {\n\t\tlog.Printf(\"Read response: size=%d @ %d, read %d\", req.Size, req.Offset, nr)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ba106d3f8aa3a4a63643cafed01d895", "score": "0.5957285", "text": "func ReadAll(bucket string) (map[int]string, error) {\n\tvalues := make(map[int]string)\n\terr := db.View(func(tx *bolt.Tx) error {\n\t\t// Assume bucket exists and has keys\n\t\tb := tx.Bucket([]byte(bucket))\n\t\tcursor := b.Cursor()\n\n\t\tfor k, v := cursor.First(); k != nil; k, v = cursor.Next() {\n\t\t\tvalues[btoi(k)] = string(v)\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn values, nil\n}", "title": "" }, { "docid": "36775523f1cf926411289ab9b15f0be7", "score": "0.5949877", "text": "func (r *record) read() (err error) {\n\treply, err := sched0.cache.Get(prefixTask + r.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal([]byte(reply), r)\n\treturn\n}", "title": "" }, { "docid": "5a407fee8dd625ef2d390706101681a4", "score": "0.5940378", "text": "func (c *Client) Read(req *remote.ReadRequest) ([]map[string]interface{}, error) {\n\tctx := context.Background()\n\tquerier := req.Queries[0]\n\tquery := elastic.NewBoolQuery()\n\n\tfor _, matcher := range querier.Matchers {\n\t\tquery = query.Must(elastic.NewTermQuery(matcher.Name, matcher.Value))\n\t}\n\n\t// building elasticsearch query\n\tquery = query.Filter(elastic.\n\t\tNewRangeQuery(\"timestamp\").\n\t\tFrom(querier.StartTimestampMs).\n\t\tTo(querier.EndTimestampMs))\n\n\tsearchResult, err := c.client.\n\t\tSearch().\n\t\tIndex(c.esIndex).\n\t\tQuery(query).\n\t\tSize(1000).\n\t\tSort(\"timestamp\", true).\n\t\tDo(ctx)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar dataPoints []map[string]interface{}\n\n\t// parsing elasticsearch hits to array with datapoints\n\tif searchResult.Hits.TotalHits > 0 {\n\t\tfmt.Printf(\"Found a total of %d data points\\n\", searchResult.Hits.TotalHits)\n\n\t\tfor _, hit := range searchResult.Hits.Hits {\n\t\t\tvar dataPoint map[string]interface{}\n\t\t\tjson.Unmarshal(*hit.Source, &dataPoint)\n\t\t\tdataPoints = append(dataPoints, dataPoint)\n\t\t}\n\t} else {\n\t\treturn nil, newErrNoDataPointsFound(\"Found no metrics\")\n\t}\n\n\treturn dataPoints, nil\n}", "title": "" }, { "docid": "919f181f0c6da9aeedc9287da168f58b", "score": "0.5939678", "text": "func (s UserSet) Read(fields models.FieldNames) []models.RecordData {\n\tres := s.Collection().Call(\"Read\", fields)\n\tresTyped, _ := res.([]models.RecordData)\n\treturn resTyped\n}", "title": "" }, { "docid": "567705c9632050fd6cf4e85de65ec74e", "score": "0.5938854", "text": "func readAllAndClose(rc io.ReadCloser) (string, error) {\n\tdata, err := io.ReadAll(rc)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\trc.Close()\n\treturn string(data), nil\n}", "title": "" }, { "docid": "e8b601c8335cf3bfa02ac659058725cf", "score": "0.59311414", "text": "func ReadAll(path string) (string, error) {\n\tf, err := os.Open(path)\n\tdefer f.Close()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcontents, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(contents), nil\n}", "title": "" }, { "docid": "08fd27201cdc1e31869fdf9e7e259555", "score": "0.5930653", "text": "func ReadAll(r io.Reader) string {\n\tif b, err := ioutil.ReadAll(r); err == nil {\n\t\treturn string(b)\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "45eb0150b01697c90b8876183d4501e7", "score": "0.5920406", "text": "func (c *Conn) Read(file string) ([]byte, bool) {\n\tc.Log.Infof(\"Reading from {%s} with provider{%s} to bucket{%s}\", file, c.provider, c.bucketname)\n\n\tdata, err := c.bucket.ReadAll(c.ctx, file)\n\tif err != nil {\n\t\tc.Log.Errorf(\"Failed to read data from file{%s} : %s\", file, err.Error())\n\t\treturn nil, false\n\t}\n\n\tc.Log.Infof(\"successfully read object{%s} to {%s}\", file, c.provider)\n\treturn data, true\n}", "title": "" }, { "docid": "80dd3171c1d2ebc3ce557cbed09b4447", "score": "0.5904185", "text": "func (s *Session) read(key *Key, offset uint64, size uint64) (data unsafe.Pointer, dataSize uint64, err error) {\n\tatomic.AddUint64(&cReads, 1)\n\n\tio_attr := C.struct_dnet_io_attr{\n\t\tparent: key.id.id, id: key.id.id, _type: key.id._type,\n\t\toffset: C.uint64_t(offset), size: C.uint64_t(size),\n\t}\n\n\tvar cflags C.uint64_t\n\tvar errp C.int\n\tdata = C.dnet_read_data_wait(s.session, &key.id, &io_attr, cflags, &errp)\n\tdataSize = uint64(io_attr.size)\n\tif errp != 0 {\n\t\terr = Error(errp)\n\t}\n\treturn\n}", "title": "" }, { "docid": "aaaa16c1a9a7567288128ac1c815a093", "score": "0.5902368", "text": "func Read(client *mongo.Client, firstname string) (*[]Person, error) {\r\n\tvar m bson.M\r\n\r\n\tpersons := make([]Person, 0, 10)\r\n\r\n\tpersonCollection := client.Database(\"MyApp\").Collection(\"person\")\r\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\r\n\tfilterCursor, err := personCollection.Find(ctx, bson.M{\"firstname\": firstname})\r\n\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\terr = filterCursor.All(ctx, &persons)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tbsonBytes, _ := bson.Marshal(m)\r\n\tbson.Unmarshal(bsonBytes, &persons)\r\n\r\n\treturn &persons, err\r\n}", "title": "" }, { "docid": "e7800f6648770ce33e54bd30aa1432d5", "score": "0.5900203", "text": "func HandleRead(w http.ResponseWriter, r *http.Request) {\n\t// Get the storage db and retrieve queue details\n\tdbsession := context.Get(r, \"dbsession\")\n\tvar queueDetails []*queue.Details\n\tretrieveFunction := retrieveQueueDetails(&queueDetails)\n\terr := executeOperation(dbsession, retrieveFunction)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Error occured while retrieving details: %q\", err.Error()), 101)\n\t\treturn\n\t}\n\n\t// Send encoded response\n\tif err := json.NewEncoder(w).Encode(queueDetails); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e81ffbb1ef223759df1eae12bff46c7a", "score": "0.58945304", "text": "func Read(id_to_read int32, dbMgr *mgr.DBConn) SimpleDbType {\n\tdb := dbMgr.Open()\n\ttheReturn := SimpleDbType{}\n\n\tsqlRead := fmt.Sprintf(\"select id, name, number from test_table where id = %d\", id_to_read)\n\n\trows, err := db.Query(sqlRead)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\terr := rows.Scan(&theReturn.Id, &theReturn.Name, &theReturn.Number)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdbMgr.Close()\n\treturn theReturn\n}", "title": "" }, { "docid": "926970a97571114586aeda16c9970861", "score": "0.58896357", "text": "func (r *oneNoteReader) Read() ([]string, error) {\n\tif r.readed {\n\t\treturn nil, io.EOF\n\t}\n\n\tr.readed = true\n\treturn r.Fields(), nil\n}", "title": "" }, { "docid": "c9a27756b299814789f498ded30eed08", "score": "0.5887212", "text": "func (s *toDoServiceServer) Read(ctx context.Context, req *v1.ReadRequest) (*v1.ReadResponse, error) {\n\t// check if API version requested by the app is supported by server\n\tif err := s.checkAPI(req.Api); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// get SQL connection\n\tc, err := s.connect(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\n\t// query to_do by ID\n\trows, err := c.QueryContext(ctx, \"SELECT `to_do_id` `title`, `description`, `reminder` FROM to_do_db.to_do WHERE to_do_id=?\",\n\t\treq.Id)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unknown, \"Failed to select from to_do with err: %v\", err.Error())\n\t}\n\tdefer rows.Close()\n\n\tif !rows.Next() {\n\t\tif err := rows.Err(); err != nil {\n\t\t\treturn nil, status.Errorf(codes.Unknown, \"Failed to retirieve data from to_do with err: %v\", err.Error())\n\t\t}\n\t\treturn nil, status.Errorf(codes.NotFound, \"to_do with with ID=%v is not found\", req.Id)\n\t}\n\n\t// get to_do data\n\tvar td v1.ToDo\n\tvar reminder time.Time\n\tif err := rows.Scan(&td.Id, &td.Title, &td.Description, &reminder); err != nil {\n\t\treturn nil, status.Errorf(codes.Unknown, \"reminder field has invalid format with err: %v\", err.Error())\n\t}\n\n\tif rows.Next() {\n\t\treturn nil, status.Errorf(codes.Unknown, \"Found maltiple to_do rows with ID %v\", req.Id)\n\t}\n\n\treturn &v1.ReadResponse{\n\t\tApi: apiVersion,\n\t\tToDo: &td,\n\t}, nil\n}", "title": "" }, { "docid": "cac724915f0ac42b0b9649c36168db29", "score": "0.58800125", "text": "func (c client) Read(q Query) Scanner {\n\tvar rows *gocql.Iter\n\tvar scan Scanner\n\n\trows = c.driver.Query(q.Content(), q.ARGS()...).Iter()\n\tscan = newScanner(rows)\n\treturn scan\n}", "title": "" }, { "docid": "066004340ae95919c931d079abb612a2", "score": "0.5876916", "text": "func (server *StorageServer) Read(ctx context.Context, message *pb.ReadRequest) (*pb.ReadResponse, error) {\n\twasmResponse := server.callWasm(\"read_data\", message, &pb.ReadResponse{})\n\treturn wasmResponse.(*pb.ReadResponse), nil\n}", "title": "" }, { "docid": "317cfec76d08a73e27654d173b11a298", "score": "0.5876365", "text": "func (_e *Stream_Expecter) ReadAll() *Stream_ReadAll_Call {\n\treturn &Stream_ReadAll_Call{Call: _e.mock.On(\"ReadAll\")}\n}", "title": "" }, { "docid": "b75ef4ac530cc217a545f779e2e8e560", "score": "0.5868178", "text": "func Read(s beam.Scope, resourcePaths beam.PCollection) (beam.PCollection, beam.PCollection) {\n\ts = s.Scope(\"fhirio.Read\")\n\treturn read(s, resourcePaths, nil)\n}", "title": "" }, { "docid": "f752bce0f0b440ce8745b04a9b1e6272", "score": "0.58590204", "text": "func (model *TodoerModel) Read(id int) Todoer {\n\tvar todoer = Todoer{}\n\n\tconnect(func(db *sql.DB) {\n\t\trows, err := db.Query(\"select * from todoer where id = ?\", id)\n\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\n\t\tdefer rows.Close()\n\n\t\tfor rows.Next() {\n\t\t\terr := rows.Scan(&todoer.ID, &todoer.Username, &todoer.CreatedAt, &todoer.ModifiedAt)\n\t\t\tif err != nil {\n\t\t\t\tlog.Panic(err)\n\t\t\t}\n\t\t}\n\n\t\terr = rows.Err()\n\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t})\n\n\treturn todoer\n}", "title": "" }, { "docid": "58abbe3535b2455cd91dedfbc6e48c93", "score": "0.5856757", "text": "func (ps *Store) MultiRead(ctx context.Context, entityMetadata datastore.EntityMetadata, keys []datastore.Key, entities []datastore.Entity) error {\n\tif len(entities) <= BATCH_SIZE {\n\t\treturn ps.multiReadAux(ctx, entityMetadata, keys, entities)\n\t}\n\tfor start := 0; start < len(entities); start += BATCH_SIZE {\n\t\tend := start + BATCH_SIZE\n\t\tif end > len(entities) {\n\t\t\tend = len(entities)\n\t\t}\n\t\terr := ps.multiReadAux(ctx, entityMetadata, keys[start:end], entities[start:end])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1653d6f1bae4be9157a841568eafdbe6", "score": "0.5851339", "text": "func (h *provider) Read(ctx wfContext.Context, v *value.Value, act types.Action) error {\n\tobj := new(unstructured.Unstructured)\n\tif err := v.UnmarshalTo(obj); err != nil {\n\t\treturn err\n\t}\n\tkey, err := client.ObjectKeyFromObject(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif key.Namespace == \"\" {\n\t\tkey.Namespace = \"default\"\n\t}\n\tif err := h.cli.Get(context.Background(), key, obj); err != nil {\n\t\treturn err\n\t}\n\treturn v.FillObject(obj.Object, \"result\")\n}", "title": "" }, { "docid": "bd24838c00ecf47e217530be33a5abbb", "score": "0.5851233", "text": "func (handle ArtistHandler) Read(w http.ResponseWriter, req *http.Request) {\n\tdao := model.NewArtistDAO(handle.db)\n\tresults, err := dao.Read()\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\n\tlog.Printf(\"%s - %s - %s\\n\", req.Method, req.Host, req.URL.Path)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(results)\n}", "title": "" }, { "docid": "48004790a1d3147296e292af6c617ad9", "score": "0.5851116", "text": "func (r *StructReader) ReadAll(v interface{}) error {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tsliceType := reflect.TypeOf(v)\n\tif sliceType.Kind() != reflect.Ptr {\n\t\treturn fmt.Errorf(\"non-pointer %s\", sliceType)\n\t}\n\n\tslicePtr := reflect.ValueOf(v)\n\tslice := slicePtr.Elem()\n\tif slice.Kind() != reflect.Slice {\n\t\treturn fmt.Errorf(\"non-slice %s\", sliceType)\n\t}\n\n\telKind := sliceType.Elem().Elem().Kind()\n\tif elKind != reflect.Struct && elKind != reflect.Ptr {\n\t\treturn fmt.Errorf(\"can't read to type %s\", slice)\n\t}\n\n\tsliceOfPtrs := elKind != reflect.Ptr\n\telType := getNonPtrElemType(sliceType.Elem())\n\tm := r.columnsFromType(elType)\n\n\tif r.headers == nil {\n\t\tif err := r.readHeaders(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfor {\n\t\trValue := reflect.New(elType)\n\t\terr := r.read(m, rValue.Elem())\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif sliceOfPtrs {\n\t\t\trValue = rValue.Elem()\n\t\t}\n\t\tslice.Set(reflect.Append(slice, rValue))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5125bcfdeb5365855854d7d1f94dfd91", "score": "0.5844466", "text": "func (s *ToDoServer) Read(ctx context.Context, req *v1.ReadRequest) (*v1.ReadResponse, error) {\n\tif err := s.checkAPI(req.Api); err != nil {\n\t\treturn nil, err\n\t}\n\n\tc, err := s.connect(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\n\trows, err := c.QueryContext(ctx, \"SELECT `ID`, `Title`, `Description`, `Reminder`\"+\n\t\t\" FROM ToDo WHERE `ID`=?\", req.Id)\n\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Unknown, \"failed to select from ToDo->\"+err.Error())\n\t}\n\tdefer rows.Close()\n\n\tif !rows.Next() {\n\t\tif err := rows.Err(); err != nil {\n\t\t\treturn nil, status.Error(codes.Unknown, \"failed to retrieve data from ToDo->\"+err.Error())\n\t\t}\n\t\treturn nil, status.Error(codes.NotFound, fmt.Sprintf(\n\t\t\t\"ToDo with ID='%d' is not found\", req.Id))\n\t}\n\n\tvar td v1.ToDo\n\tvar reminder time.Time\n\tif err := rows.Scan(&td.Id, &td.Title, &td.Description, &reminder); err != nil {\n\t\treturn nil, status.Error(\n\t\t\tcodes.Unknown,\n\t\t\t\"failed to retrive field values from ToDo row -> \"+err.Error())\n\n\t}\n\ttd.Reminder, err = ptypes.TimestampProto(reminder)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Unknown, \"remider filed has invalid format->\"+err.Error())\n\t}\n\n\tif rows.Next() {\n\t\treturn nil, status.Error(\n\t\t\tcodes.Unknown,\n\t\t\tfmt.Sprintf(\"found multiple ToDo rows for id->%d\", req.Id),\n\t\t)\n\t}\n\n\treturn &v1.ReadResponse{\n\t\tApi: apiVersion,\n\t\tToDo: &td,\n\t}, nil\n}", "title": "" }, { "docid": "6ea61d9a02fdabcc7ce050ea71bf54f8", "score": "0.584395", "text": "func (store TodoStore) Read(_ sqlx.Queryer, filters ...gtimer.TodoFilter) (gtimer.Todos, error) {\n\tvar todo gtimer.Todo\n\tfor _, filter := range filters {\n\t\tfilter(&todo)\n\t}\n\tif todo.ID != \"\" {\n\t\ttodo, err := store.Get(todo.ID)\n\t\tif err != nil {\n\t\t\treturn gtimer.Todos{}, err\n\t\t}\n\t\treturn gtimer.Todos{todo}, err\n\t}\n\tif todo.Status != \"\" {\n\t\treturn store.ByStatus(todo.Status)\n\t}\n\treturn store.All()\n}", "title": "" }, { "docid": "8a2431ad02cc5b7ec3a88ce936799f4c", "score": "0.58323336", "text": "func (c *AllergyIntoleranceController) Read(ctx *app.ReadAllergyIntoleranceContext) error {\n\t//var sqlParams []interface{}\n\tx := json.RawMessage{}\n\n\tabsPath, _ := filepath.Abs(\"bundle.json\")\n\tfmt.Println(absPath)\n\tfile, err := os.Open(absPath)\n\tif err == nil {\n\t\t_ = json.NewDecoder(file).Decode(&x)\n\t}\n\tfile.Close()\n\n\t//getJson(\"http://nprogram.azurewebsites.net/Patient/1?_format=json\", patient)\n\t//getJson(\"http://localhost:3001\", patient)\n\t// //getJson(\"https://open-ic.epic.com/FHIR/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB\", patient)\n\t//_, err = json.NewDecoder(file).Decode(patient)\n\t//, err := cc.Get(\"http://fhirtest.uhn.ca/baseDstu2/Patient/EXexample\")\n\t//r, err := cc.Get(\"http://nprogram.azurewebsites.net/Patient/1?_format=json\")\n\n\t// if err != nil {\n\t// \tfmt.Println(\"A timeout error occured\")\n\t// \tos.Exit(3)\n\t// }\n\t// defer r.Body.Close()\n\n\t// body, _ := ioutil.ReadAll(r.Body)\n\n\t// isJSON := IsJSON(string(body))\n\t// if isJSON == true {\n\t// \tfmt.Println(\"Yesssssssssssssssssssssssssssssssssssssssssssssssss\")\n\t// \t_ = json.Unmarshal(body, &x)\n\t// } else {\n\t// \tfmt.Println(\"NOoooooooooooooooooooooooooooooooooooooooooooo\")\n\t// \t_ = xml.Unmarshal(body, &x)\n\t// }\n\n\t//err = json.Unmarshal([]byte(r), &f)\n\n\t// //b, _ := json.Marshal(body)\n\t// return json.Unmarshal(body, &target)\n\t//fmt.Printf(\"%s\", x)\n\n\tfmt.Println()\n\t//main_rt := gjson.Get(string(x), \"resourceType\")\n\t//sub_rt := gjson.Get(string(x), \"entry.#.resource.resourceType\")\n\t// m, ok := gjson.Parse(string(x)).Value().(map[string]interface{})\n\t// if !ok {\n\t// \t// not a map\n\t// }\n\n\t//value1 := gjson.Get(string(x), \"*\")\n\t//value2 := gjson.Get(string(x), \"entry.#.resource.code.coding.#.display\")\n\t//value2 := gjson.Get(string(x), \"entry.#.resource.component.#.valueQuantity.value\")\n\t//value2 := gjson.Get(string(x), \"entry.#.resource.component.#.code.coding.#.display\")\n\n\t//value3 := gjson.Get(string(x), \"identifier\")\n\t//fmt.Println(\"value *:\", value1.String())\n\n\t//fmt.Println(\"resource:\", value11.String())\n\t//fmt.Println(\"entry:\", value2.String())\n\t//fmt.Println(\"value:\", value3.String())\n\t//result := gjson.Get(string(x), \"entry.#.resource\")\n\n\t// //results := gjson.GetMany(string(x), \"entry.#.resource.code.coding.#.display\", \"entry.#.resource.component.#.code.coding.#.display\", \"entry.#.resource.component.#.valueQuantity.Value\")\n\t// results := gjson.GetMany(string(x), \"entry.#.resource.component.#.code.coding.#.display\", \"entry.#.resource.component.#.valueQuantity.value\")\n\n\t//_ = json.Unmarshal(x, &patient)\n\t//_, _ = json.Marshal(string(x))\n\n\t//_ = json.NewDecoder(r.Body).Decode(&x)\n\t//fmt.Println(results)\n\t//fmt.Printf(\"Indentifer:\", x.Matches[0].Ad, \"\\n\")\n\t//fmt.Println(\"Address:\", x.Address)\n\t//fmt.Println(\"Telecom:\", x.Telecom)\n\t//fmt.Println(\"CareProvider:\", x.CareProvider)\n\t//fmt.Println(\"Name:\", x.Name)\n\t//fmt.Printf(\"Contact:\", x.Contact)\n\n\t//fmt.Println(\"x is equal to:\", x.Address[0].Text)\n\n\t// res := &app.Patient{}\n\t// res.Active = patient.Active\n\t// res.BirthDate = patient.BirthDate\n\t// res.Gender = patient.Gender\n\t// //res.Telecom = patient.Telecom\n\t//res.Address=patient.Address\n\t//res.Address=\n\n\t//json.Marshal(patient)\n\n\t// \ttype int64array []int64\n\n\t// func (a int64array) Value() (driver.Value, error) {\n\t// // Format a in PostgreSQL's array input format {1,2,3} and return it as as string or []byte.\n\t// }\n\t//_, _ = json.Marshal(x)\n\n\t//g, _ := json.Marshal(x)\n\t//fmt.Println(string(g))\n\t// _, err = stmt.Exec(uuid.NewV4().String(), string(g))\n\t// if err != nil {\n\t// \tfmt.Println(err.Error())\n\t// \tfmt.Println(\"Error with db\")\n\t// }\n\n\t//json.Marshal(x)\n\n\t// t := app.Observation{}\n\t// s := reflect.ValueOf(&t).Elem()\n\t// typeOfT := s.Type()\n\n\t// for i := 0; i < s.NumField(); i++ {\n\t// \t//f := s.Field(i)\n\t// \t//fmt.Printf(\"%d: %s %s = %v\\n\", i,\n\t// \t//typeOfT.Field(i).Name, f.Type(), f.Interface())\n\t// \t//test2 := fmt.Sprintf(\"%T\", s.Field(i))\n\t// \ttest2 := fmt.Sprintf(\"%T\", s.Field(i))\n\n\t// \tfmt.Println(reflect.TypeOf(test2).Kind())\n\t// \t//fmt.Println(*test2)\n\n\t// \ttest := fmt.Sprintf(\"%s\", strings.ToLower(typeOfT.Field(i).Name))\n\t// \tfmt.Println(test)\n\n\t// \tvalue := gjson.Get(string(x), test)\n\t// \tfmt.Println()\n\t// \tfmt.Println(\"value *:\", value.String())\n\n\t// }\n\n\t//res := &app.AllergyIntoleranceMedia{}\n\treturn nil\n\t//return ctx.OK(res)\n\n}", "title": "" }, { "docid": "22dc497cce20c17524ca59480b815c06", "score": "0.58303875", "text": "func (c MethodsCollection) Read() pRead {\n\treturn pRead{\n\t\tMethod: c.MustGet(\"Read\"),\n\t}\n}", "title": "" }, { "docid": "1229dfcbb5d1e799f05c063d29d6a9de", "score": "0.5825403", "text": "func (dao *OrderDao) Read(author int64) ([]Order, error) {\n\n\tvar orders []Order\n\trows, err := dao.DB.Query(\"SELECT * FROM orders WHERE author = $1\", author)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar order Order\n\t\trows.Scan(\n\t\t\t&order.ID,\n\t\t\t&order.Status,\n\t\t\t&order.CustomerID,\n\t\t\t&order.ProductID,\n\t\t\t&order.Author)\n\n\t\torders = append(orders, order)\n\t}\n\n\treturn orders, nil\n}", "title": "" }, { "docid": "b39b37dc48a2ec214e830f547adf0b49", "score": "0.5824286", "text": "func Test_ReadAll(t *testing.T) {\n\tctx := context.Background()\n\tdatabase, err := db.ConnectDB(\"\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tProjectService := NewProjectServiceServer(database)\n\treq := &v1.ReadAllRequest{\n\t\tApi: apiVersion,\n\t}\n\tres, _ := ProjectService.ReadAll(ctx, req)\n\tfmt.Println(res)\n\tt.Log(\"Done\")\n\n}", "title": "" }, { "docid": "28abca60853a767a7e57ea9b3aff0549", "score": "0.5818988", "text": "func (pr postRepository) Read() ([]Post, error) {\n\tvar posts []Post\n\tif err := pr.getCollection().Find(bson.M{}).All(&posts); err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "title": "" }, { "docid": "77b667d8f0fcb2bf35eb1eb66ebdbd12", "score": "0.58150864", "text": "func (g *Oper) ReadAll() ([]core.State, error) {\n\treturn g.StateDriver.ReadAllState(operGlobalPrefix, g, json.Unmarshal)\n}", "title": "" }, { "docid": "ce7605a1a232ec2d8236278363b58835", "score": "0.581122", "text": "func read(novel *Novel, index int) {\n\tif len(novel.Chapters) == 0 {\n\t\tfmt.Println(\"Book is intializing...\")\n\t\tnovel.InitNovel()\n\t}\n\tif max := len(novel.Chapters) - 1; index > max {\n\t\tsave(novel)\n\t\tfmt.Println(\"There is no content later.\")\n\t\tos.Exit(0)\n\t}\n\tfmt.Println(\"Loading chapter...\")\n\tcontents := novel.Read(index)\n\tmaxIndex := len(contents)\n\tfmt.Println(novel.Chapters[index].Name)\n\tfmt.Println()\n\tnovel.LastIndex = index\n\tfor nowIndex := 0; nowIndex < maxIndex; nowIndex++ {\n\t\tfmt.Println(contents[nowIndex])\n\t\tlistenCommand(novel)\n\t}\n\tindex++\n\tfmt.Println()\n\tread(novel, index)\n}", "title": "" }, { "docid": "91621b249646d0731270a79e4bf1773d", "score": "0.57910824", "text": "func (s *SqliteServer) ReadAllRecords() ([]gdp.Record, error) {\n\tqueryString := \"SELECT hash, recno, timestamp, accuracy, prevhash, value, sig FROM log_entry\"\n\n\trows, err := s.db.Query(queryString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trecords, err := parseRecordRows(rows)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn records, nil\n}", "title": "" }, { "docid": "11f3b9a6b8b545a7d09c12fc7bab6fc0", "score": "0.57827157", "text": "func (db *GeoDB) readReplies(qCount int, conn redis.Conn) ([]interface{}, error) {\n\tallRes := make([]interface{}, 0)\n\n\tfor i := 0; i < qCount; i++ {\n\t\tres, err := conn.Receive()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tallRes = append(allRes, res.([]interface{})...)\n\t}\n\n\treturn allRes, nil\n}", "title": "" }, { "docid": "2a4698030f1aec9e348b4acc2fe0ea91", "score": "0.5778152", "text": "func (n *Neo4jPG) Read(cypher string, params map[string]interface{}, cRHandle func(r neo4j.Record) (interface{}, error)) (res interface{}, err error) {\n\tif n.Session, err = n.Driver.Session(neo4j.AccessModeRead); err != nil {\n\t\tpkg.ReportError(pgl.ErrorReport{Msg: \"Error thrown in Session\", Err: err.Error()})\n\t\treturn nil, err\n\t}\n\tdefer n.Session.Close()\n\n\tres, err = n.Session.ReadTransaction(func(tx neo4j.Transaction) (interface{}, error) {\n\t\tvar list []interface{}\n\t\tvar result neo4j.Result\n\n\t\tif result, err = tx.Run(cypher, params); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor result.Next() {\n\t\t\tif cRHandle != nil {\n\t\t\t\tr, err := cRHandle(result.Record())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tlist = append(list, r)\n\t\t\t} else {\n\t\t\t\tprops := result.Record().GetByIndex(0).(neo4j.Node).Props()\n\t\t\t\tlist = append(list, props)\n\t\t\t}\n\t\t}\n\n\t\tif err = result.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn list, nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "9085f45bd36f5afbe1c0915c5d3a319d", "score": "0.57754874", "text": "func Read[T any](r io.ReaderAt, size int64, options ...ReaderOption) (rows []T, err error) {\n\tconfig, err := NewReaderConfig(options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfile, err := OpenFile(r, size)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trows = make([]T, file.NumRows())\n\treader := NewGenericReader[T](file, config)\n\tn, err := reader.Read(rows)\n\tif err == io.EOF {\n\t\terr = nil\n\t}\n\treader.Close()\n\treturn rows[:n], err\n}", "title": "" }, { "docid": "b9b1a93ae859458980e52f147ef7b6ff", "score": "0.5775199", "text": "func RRead(c *vapi.Client, engine string, path string, includePaths []string, excludePaths []string,\n\tconcurrency uint32) (map[string]map[string]string, error) {\n\tvar dumpResults []readResult\n\tkvVersion, err := getKVVersion(c, engine)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twg := sync.WaitGroup{}\n\tresChan := make(chan *readResult)\n\texitChan := make(chan struct{})\n\tthrottleChan := make(chan struct{}, concurrency)\n\tsecretPaths, err := RList(c, engine, path, includePaths, excludePaths, concurrency)\n\tklog.V(4).Infof(\"Listing returned %d secret paths\", len(secretPaths))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo func(dumpResults *[]readResult, resChan <-chan *readResult, exitC <-chan struct{}) {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase res := <-resChan:\n\t\t\t\t*dumpResults = append(*dumpResults, *res)\n\t\t\tcase <-exitChan:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(&dumpResults, resChan, exitChan)\n\n\twg.Add(len(secretPaths))\n\tfor _, secretPath := range secretPaths {\n\t\tgo read(c, engine, secretPath, kvVersion, &wg, resChan, throttleChan)\n\t}\n\n\twg.Wait()\n\t// finish goroutine ensuring results are processed\n\texitChan <- struct{}{}\n\n\treturn parseReadResults(dumpResults, kvVersion)\n\n}", "title": "" }, { "docid": "24dd4c6e963c275c398e119c5a3d9be5", "score": "0.5773986", "text": "func (c *client3E) Read(deviceName string, offset, numPoints int64) ([]byte, error) {\n\trequestStr := c.stn.BuildReadRequest(deviceName, offset, numPoints)\n\n\t// TODO binary protocol\n\tpayload, err := hex.DecodeString(requestStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconn, err := net.DialTCP(\"tcp\", nil, c.tcpAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer conn.Close()\n\n\t// Send message\n\tif _, err = conn.Write(payload); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Receive message\n\treadBuff := make([]byte, 22+2*numPoints) // 22 is response header size. [sub header + network num + unit i/o num + unit station num + response length + response code]\n\treadLen, err := conn.Read(readBuff)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn readBuff[:readLen], nil\n}", "title": "" }, { "docid": "184b99f68d4f34a71a6be655a2aae12e", "score": "0.57700294", "text": "func (index *ind) read() (hashes chan string) {\n\thashes = make(chan string, 1000)\n\tgo func() {\n\t\tdefer close(hashes)\n\t\tfor _, arr := range index.Storage {\n\t\t\tfor _, hashSlice := range arr {\n\t\t\t\thashes <- hashSlice\n\t\t\t}\n\t\t}\n\t}()\n\treturn\n}", "title": "" }, { "docid": "78261a236d3399db09eab06d2cd824cd", "score": "0.57688296", "text": "func (s *SqliteServer) ReadAllMetadata() ([]gdp.Metadatum, error) {\n\tqueryString := \"SELECT hash, recno, timestamp, accuracy, prevhash, sig FROM log_entry\"\n\n\trows, err := s.db.Query(queryString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadata, err := parseMetadataRows(rows)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn metadata, nil\n}", "title": "" }, { "docid": "2d5143eeceac9e9bbbfc1e617975a383", "score": "0.576667", "text": "func (o *Service) Read() error {\n\tif o.ID == \"\" {\n\t\terrormsg := fmt.Sprintf(\"Missing ID for %s\", GetVarType(0))\n\t\tlogger.Errorf(errormsg)\n\t\treturn fmt.Errorf(errormsg)\n\t}\n\tvar queryArg = make(map[string]interface{})\n\tqueryArg[\"ID\"] = o.ID\n\n\t// Attempt to read from an upstream API\n\tresp, err := o.client.CallGenericMapAPI(o.apiRead, queryArg)\n\n\tif err != nil {\n\t\tlogger.Errorf(err.Error())\n\t\treturn err\n\t}\n\tif !resp.Success {\n\t\terrmsg := fmt.Sprintf(\"%s %s\", resp.Message, resp.Exception)\n\t\tlogger.Errorf(errmsg)\n\t\treturn fmt.Errorf(errmsg)\n\t}\n\n\tmapToStruct(o, resp.Result)\n\n\treturn nil\n}", "title": "" }, { "docid": "e3526e9f6eeb321a27224dfa0b282668", "score": "0.5756753", "text": "func (s *Storage) Read(path, downloadToken string) (io.ReadCloser, error) {\n\tresp, err := http.Get(s.DownloadURL(path, downloadToken))\n\treturn resp.Body, err\n}", "title": "" }, { "docid": "e2151569858f8b8225c167a53a5bd274", "score": "0.57507807", "text": "func (s *sendClient) readMetrics() ([]byte, error) {\n\tresp, err := http.Get(s.readURL.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer func() {\n\t\t_, _ = io.Copy(io.Discard, resp.Body)\n\t\t_ = resp.Body.Close()\n\t}()\n\n\treturn body, nil\n}", "title": "" }, { "docid": "8193d55a7088453c406ee3b85b93b20d", "score": "0.5748163", "text": "func (kv *Backend) Read(request *frames.ReadRequest) (frames.FrameIterator, error) {\n\n\terr := backends.ValidateRequest(\"kv\", request.Proto, allowedReadRequestFields)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif request.Proto.MessageLimit == 0 {\n\t\trequest.Proto.MessageLimit = 256 // TODO: More?\n\t}\n\n\tcolumns := request.Proto.Columns\n\tif len(columns) < 1 || columns[0] == \"\" {\n\t\tcolumns = []string{\"*\"}\n\t}\n\n\tcontainer, tablePath, err := kv.newConnection(request.Proto.Session, request.Password.Get(), request.Token.Get(), request.Proto.Table, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpartitions, err := kv.getPartitions(tablePath, container)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinput := v3io.GetItemsInput{Filter: request.Proto.Filter, AttributeNames: columns, SortKeyRangeStart: request.Proto.SortKeyRangeStart, SortKeyRangeEnd: request.Proto.SortKeyRangeEnd}\n\tkv.logger.DebugWith(\"read input\", \"input\", input, \"request\", request)\n\n\titer, err := v3ioutils.NewAsyncItemsCursor(\n\t\tcontainer, &input, kv.numWorkers, request.Proto.ShardingKeys, kv.logger, 0, partitions,\n\t\trequest.Proto.SortKeyRangeStart, request.Proto.SortKeyRangeEnd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tschemaInterface, err := v3ioutils.GetSchema(tablePath, container)\n\tif err != nil {\n\t\tswitch typedError := err.(type) {\n\t\tcase v3ioerrors.ErrorWithStatusCode:\n\t\t\tif typedError.StatusCode() == http.StatusNotFound {\n\t\t\t\treturn nil, errors.New(\n\t\t\t\t\tfmt.Sprintf(\"Failed to find a schema for table \\\"/%s/%s\\\"; \"+\n\t\t\t\t\t\t\"use the `execute` 'infer' command to infer the schema and generate a schema file.\",\n\t\t\t\t\t\trequest.Proto.Session.Container, request.Proto.Table))\n\t\t\t}\n\t\t}\n\t\treturn nil, err\n\t}\n\tschemaObj := schemaInterface.(*v3ioutils.OldV3ioSchema)\n\n\tshouldDuplicateSorting := schemaObj.SortingKey != \"\" && containsString(columns, schemaObj.SortingKey)\n\tnewKVIter := Iterator{request: request, iter: iter, schema: schemaObj, shouldDuplicateIndex: containsString(columns, schemaObj.Key), shouldDuplicateSorting: shouldDuplicateSorting}\n\treturn &newKVIter, nil\n}", "title": "" }, { "docid": "d68818ca49138c44ed38fab2fb735738", "score": "0.5740981", "text": "func (c *Client) read() (Result, error) {\n\theader := make([]byte, 6)\n\t_, err := io.ReadFull(c.serial, header)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := make([]byte, header[4]-1)\n\t_, err = io.ReadFull(c.serial, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := Result(append(header, buf...))\n\n\treturn res, res.CheckChecksum()\n}", "title": "" }, { "docid": "4864cab9773e00ee7cac09241cf8eb4a", "score": "0.5727835", "text": "func (c *FakeClient) Read(secretName string) (map[string]interface{}, error) {\n\treturn c.data[secretName], nil\n}", "title": "" } ]
77f1a74ccc6b812e8eaba497229dfa3a
GetSubscription Returns or validates a subscription.
[ { "docid": "02e0cecf623830430e56af80ddf7c89b", "score": "0.71542853", "text": "func GetSubscription(cmd *cobra.Command, args []string) error {\n\n\tclient, err := auth.GetClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Parse all flags\n\n\tvar appName string\n\terr = flags.ParseFlag(cmd.Flags(), \"app-name\", &appName)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"app-name\": ` + err.Error())\n\t}\n\n\t// Silence Usage\n\tcmd.SilenceUsage = true\n\n\tresp, err := client.AppRegistryService.GetSubscription(appName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonx.Pprint(cmd, resp)\n\treturn nil\n}", "title": "" } ]
[ { "docid": "8f3f627f6db597219a7adf7868c80fd7", "score": "0.78672105", "text": "func (s *SubscriptionService) GetSubscription(ctx context.Context, subscription string) (Subscription, error) {\n\n\tu := url.URL{\n\t\tHost: s.AmsBaseInfo.Host,\n\t\tScheme: s.AmsBaseInfo.Scheme,\n\t\tPath: fmt.Sprintf(getSubscriptionPath, subscription),\n\t}\n\n\treq := AmsRequest{\n\t\tctx: ctx,\n\t\tmethod: http.MethodGet,\n\t\turl: u.String(),\n\t\tbody: nil,\n\t\theaders: s.AmsBaseInfo.Headers,\n\t\tClient: s.client,\n\t}\n\n\tresp, err := req.execute()\n\tif err != nil {\n\t\treturn Subscription{}, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tsub := Subscription{}\n\n\terr = json.NewDecoder(resp.Body).Decode(&sub)\n\tif err != nil {\n\t\treturn Subscription{}, err\n\t}\n\n\treturn sub, nil\n}", "title": "" }, { "docid": "f680a6b01660d57af37c2afcfc270442", "score": "0.78217465", "text": "func (s *Server) GetSubscription(\n\tctx context.Context, req *ridpb.GetSubscriptionRequest) (\n\t*ridpb.GetSubscriptionResponse, error) {\n\n\tid, err := dssmodels.IDFromString(req.Id)\n\tif err != nil {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Invalid ID format\")\n\t}\n\n\tctx, cancel := context.WithTimeout(ctx, s.Timeout)\n\tdefer cancel()\n\tsubscription, err := s.App.GetSubscription(ctx, id)\n\tif err != nil {\n\t\treturn nil, stacktrace.Propagate(err, \"Could not get Subscription\")\n\t}\n\tif subscription == nil {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.NotFound, \"Subscription %s not found\", req.GetId())\n\t}\n\tp, err := subscription.ToProto()\n\tif err != nil {\n\t\treturn nil, stacktrace.Propagate(err, \"Could not convert Subscription to proto\")\n\t}\n\treturn &ridpb.GetSubscriptionResponse{\n\t\tSubscription: p,\n\t}, nil\n}", "title": "" }, { "docid": "d788c2e510e71d800ebe0a29b9cc6904", "score": "0.78107333", "text": "func (a *Server) GetSubscription(ctx context.Context, req *scdpb.GetSubscriptionRequest) (*scdpb.GetSubscriptionResponse, error) {\n\t// Retrieve Subscription ID\n\tid, err := dssmodels.IDFromString(req.GetSubscriptionid())\n\tif err != nil {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Invalid ID format: `%s`\", req.GetSubscriptionid())\n\t}\n\n\t// Retrieve ID of client making call\n\towner, ok := auth.OwnerFromContext(ctx)\n\tif !ok {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.PermissionDenied, \"Missing owner from context\")\n\t}\n\n\tvar response *scdpb.GetSubscriptionResponse\n\taction := func(ctx context.Context, r repos.Repository) (err error) {\n\t\t// Get Subscription from Store\n\t\tsub, err := r.GetSubscription(ctx, id)\n\t\tif err != nil {\n\t\t\treturn stacktrace.Propagate(err, \"Could not get Subscription from repo\")\n\t\t}\n\t\tif sub == nil {\n\t\t\treturn stacktrace.NewErrorWithCode(dsserr.NotFound, \"Subscription %s not found\", id.String())\n\t\t}\n\n\t\t// Check if the client is authorized to view this Subscription\n\t\tif owner != sub.Owner {\n\t\t\treturn stacktrace.Propagate(\n\t\t\t\tstacktrace.NewErrorWithCode(dsserr.PermissionDenied, \"Subscription is owned by different client\"),\n\t\t\t\t\"Subscription owned by %s, but %s attempted to view\", sub.Owner, owner)\n\t\t}\n\n\t\t// Get dependent Operations\n\t\tdependentOps, err := r.GetDependentOperations(ctx, id)\n\t\tif err != nil {\n\t\t\treturn stacktrace.Propagate(err, \"Could not find dependent Operations\")\n\t\t}\n\n\t\t// Convert Subscription to proto\n\t\tp, err := sub.ToProto(dependentOps)\n\t\tif err != nil {\n\t\t\treturn stacktrace.Propagate(err, \"Unable to convert Subscription to proto\")\n\t\t}\n\n\t\t// Return response to client\n\t\tresponse = &scdpb.GetSubscriptionResponse{\n\t\t\tSubscription: p,\n\t\t}\n\n\t\treturn nil\n\t}\n\n\terr = a.Store.Transact(ctx, action)\n\tif err != nil {\n\t\treturn nil, err // No need to Propagate this error as this is not a useful stacktrace line\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "c72217b46e9a15891fef17faf396d0b0", "score": "0.77344483", "text": "func GetSubscription(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SubscriptionState, opts ...pulumi.ResourceOption) (*Subscription, error) {\n\tvar resource Subscription\n\terr := ctx.ReadResource(\"google-native:pubsublite/v1:Subscription\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "224d528b7f220197ceb3d836af2734b3", "score": "0.77316487", "text": "func GetSubscription(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SubscriptionState, opts ...pulumi.ResourceOption) (*Subscription, error) {\n\tvar resource Subscription\n\terr := ctx.ReadResource(\"google-native:pubsub/v1:Subscription\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "7cf3e8d8f9c0836eafc1b99cf3f98dc1", "score": "0.76658696", "text": "func (client SubscriptionClient) GetSubscription(ctx context.Context, request GetSubscriptionRequest) (response GetSubscriptionResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.getSubscription, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = GetSubscriptionResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = GetSubscriptionResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(GetSubscriptionResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into GetSubscriptionResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "a53dcdc0ea92d5c82e806899b02ef164", "score": "0.7645463", "text": "func (a *Client) GetSubscription(params *GetSubscriptionParams) (*GetSubscriptionOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSubscriptionParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSubscription\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/installedapps/{installedAppId}/subscriptions/{subscriptionId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetSubscriptionReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetSubscriptionOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*GetSubscriptionDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "3dc4fdfb88f0f6d7e16b5eddfe2d5eb5", "score": "0.76434827", "text": "func (s *Server) GetSubscription(ctx context.Context, req *restapi.GetSubscriptionRequest,\n) restapi.GetSubscriptionResponseSet {\n\n\tif req.Auth.Error != nil {\n\t\tresp := restapi.GetSubscriptionResponseSet{}\n\t\tsetAuthError(ctx, stacktrace.Propagate(req.Auth.Error, \"Auth failed\"), &resp.Response401, &resp.Response403, &resp.Response500)\n\t\treturn resp\n\t}\n\n\tid, err := dssmodels.IDFromString(string(req.Id))\n\tif err != nil {\n\t\treturn restapi.GetSubscriptionResponseSet{Response400: &restapi.ErrorResponse{\n\t\t\tMessage: dsserr.Handle(ctx, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Invalid ID format\"))}}\n\t}\n\n\tctx, cancel := context.WithTimeout(ctx, s.Timeout)\n\tdefer cancel()\n\tsubscription, err := s.App.GetSubscription(ctx, id)\n\tif err != nil {\n\t\treturn restapi.GetSubscriptionResponseSet{Response500: &api.InternalServerErrorBody{\n\t\t\tErrorMessage: *dsserr.Handle(ctx, stacktrace.Propagate(err, \"Could not get Subscription\"))}}\n\t}\n\tif subscription == nil {\n\t\treturn restapi.GetSubscriptionResponseSet{Response404: &restapi.ErrorResponse{\n\t\t\tMessage: dsserr.Handle(ctx, stacktrace.NewErrorWithCode(dsserr.NotFound, \"Subscription %s not found\", req.Id))}}\n\t}\n\treturn restapi.GetSubscriptionResponseSet{Response200: &restapi.GetSubscriptionResponse{\n\t\tSubscription: *apiv1.ToSubscription(subscription)}}\n}", "title": "" }, { "docid": "f6a6782561c196910a2786c312b917ab", "score": "0.7620511", "text": "func (s *SubscriptionsService) Get(id string) (*Subscription, error) {\n\tres := new(Subscription)\n\n\tdata, err := s.client.Get(\"/v1/subscriptions/\" + id)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\terr = json.Unmarshal(data, &res)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "fb57a15278989f8c5914bb9e413d0e95", "score": "0.7591496", "text": "func Get(subscription string) (*webpush.Subscription, error) {\n\ts := &webpush.Subscription{}\n\terr := json.Unmarshal([]byte(subscription), s)\n\treturn s, err\n}", "title": "" }, { "docid": "1ed64073b10b1d3a6b03b6a6b3417356", "score": "0.7590279", "text": "func GetSubscription(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SubscriptionState, opts ...pulumi.ResourceOption) (*Subscription, error) {\n\tvar resource Subscription\n\terr := ctx.ReadResource(\"aws-native:sns:Subscription\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "00856460463c9450e6ea68d99d3b77bb", "score": "0.75527793", "text": "func GetSubscription(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SubscriptionState, opts ...pulumi.ResourceOption) (*Subscription, error) {\n\tvar resource Subscription\n\terr := ctx.ReadResource(\"gcp:pubsub/subscription:Subscription\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "fb42c8a6aefa09e67cc98b4102621a77", "score": "0.7492823", "text": "func (s *SafeSubscriptions) GetSubscription(key string) *bebtypes.Subscription {\n\ts.RLock()\n\tdefer s.RUnlock()\n\treturn s.subscriptions[key]\n}", "title": "" }, { "docid": "74cd0f492c217dc77a0058ff1a488e10", "score": "0.7380406", "text": "func (o *Customer) GetSubscription() SubscriptionRequest {\n\tif o == nil || IsNil(o.Subscription) {\n\t\tvar ret SubscriptionRequest\n\t\treturn ret\n\t}\n\treturn *o.Subscription\n}", "title": "" }, { "docid": "9125b42d70a25e96e4e729089aeafad9", "score": "0.7347606", "text": "func (client SubscriptionsClient) GetSubscription(ctx context.Context, groupID string, subscriptionID string, cacheControl string) (result SubscriptionUnderManagementGroup, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/SubscriptionsClient.GetSubscription\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetSubscriptionPreparer(ctx, groupID, subscriptionID, cacheControl)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"managementgroups.SubscriptionsClient\", \"GetSubscription\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSubscriptionSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"managementgroups.SubscriptionsClient\", \"GetSubscription\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetSubscriptionResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"managementgroups.SubscriptionsClient\", \"GetSubscription\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c250c865d09d404587d642e705f84699", "score": "0.7295517", "text": "func (sqlStor *SQL) GetSubscription(callback string) (*subscriberpb.Subscription, error) {\n\trow := sqlStor.db.QueryRow(`\n\t\tSELECT topic_url, hub_url, callback_url, lease_expiration, lease_initiated, inactive_reason\n\t\tFROM active_subscriptions\n\t\tWHERE callback_url == ?;`,\n\t\tcallback,\n\t)\n\n\tvar tp, hb, cb, le, li string\n\tvar rea sql.NullString\n\tif err := row.Scan(&tp, &hb, &cb, &le, &li, &rea); err != nil {\n\t\treturn nil, err\n\t}\n\n\texp, err := time.Parse(sqliteTimeFmt, le)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinit, err := time.Parse(sqliteTimeFmt, li)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &subscriberpb.Subscription{\n\t\tTopic: tp,\n\t\tHub: hb,\n\t\tCallback: cb,\n\t\tLeaseExpiration: exp.Unix(),\n\t\tLeaseInitiated: init.Unix(),\n\t\tInactiveReason: rea.String,\n\t}, nil\n}", "title": "" }, { "docid": "d3525039c74e34ce56109d359a7e20cf", "score": "0.7286776", "text": "func (s *subscriptionsImpl) Get(uuid string) (*Response, *Subscription, error) {\n\taction := fmt.Sprintf(\"subscriptions/%s\", SanitizeUUID(uuid))\n\treq, err := s.client.newRequest(\"GET\", action, nil, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar dst Subscription\n\tresp, err := s.client.do(req, &dst)\n\tif err != nil || resp.StatusCode >= http.StatusBadRequest {\n\t\treturn resp, nil, err\n\t}\n\n\treturn resp, &dst, err\n}", "title": "" }, { "docid": "57e9e65badec6006c46d536ccef6be3d", "score": "0.7242667", "text": "func (o *UpdateCustomer) GetSubscription() SubscriptionRequest {\n\tif o == nil || IsNil(o.Subscription) {\n\t\tvar ret SubscriptionRequest\n\t\treturn ret\n\t}\n\treturn *o.Subscription\n}", "title": "" }, { "docid": "2fa5f9f99d291427e8d0517876b86e9d", "score": "0.7172773", "text": "func (o *ReservedResource) GetSubscription() ObjectReference {\n\tif o == nil || o.Subscription == nil {\n\t\tvar ret ObjectReference\n\t\treturn ret\n\t}\n\treturn *o.Subscription\n}", "title": "" }, { "docid": "3f8cf77ff8b0b3bb1ed260e82749b654", "score": "0.7129409", "text": "func (m *SubscriptionManager) Get(id uint32) (*Subscription, bool) {\n\tm.RLock()\n\tdefer m.RUnlock()\n\tif s, ok := m.subscriptionsByID[id]; ok {\n\t\treturn s, ok\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "87bb201e3ea48481f719912896da6e3e", "score": "0.7025951", "text": "func (client SubscriptionClient) getSubscription(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/subscriptions/{subscriptionId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response GetSubscriptionResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/organizations/20230401/Subscription/GetSubscription\"\n\t\terr = common.PostProcessServiceError(err, \"Subscription\", \"GetSubscription\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &subscription{})\n\treturn response, err\n}", "title": "" }, { "docid": "06755f33310bcd3a85123b68a2ee1116", "score": "0.6949368", "text": "func GetSubscription(w http.ResponseWriter, r *http.Request){\n\t\n\tfmt.Println(\"getSubs\")\n\t\n\tb, err := ioutil.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\t// Unmarshal\n\tvar data SubscriptionData\n\terr = json.Unmarshal(b, &data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\t\n\tnewData := new(SubscriptionData)\n\tnewData.Endpoint = data.Endpoint\n\tnewData.Auth = data.Auth\n\tnewData.P256dh = data.P256dh\n\t\n\toutput, err := json.Marshal(newData)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\t\n\tstringOutput := string(output)\n\tsubJSON := stringOutput\n\n\t// Decode subscription\n\ts := webpush.Subscription{}\n\tif err := json.NewDecoder(bytes.NewBufferString(subJSON)).Decode(&s); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(s)\n}", "title": "" }, { "docid": "efbeb93b829114c0d09f4805735f7203", "score": "0.69363385", "text": "func (a *Client) RetrieveSubscription(params *RetrieveSubscriptionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RetrieveSubscriptionOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewRetrieveSubscriptionParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"RetrieveSubscription\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v2/subscriptions/{subscription_id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &RetrieveSubscriptionReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*RetrieveSubscriptionOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for RetrieveSubscription: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "31db6caa2ee539c35c1cc0b9a2e9fd92", "score": "0.68765223", "text": "func (o *SupportCaseResponse) GetSubscriptionId() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&1024 != 0\n\tif ok {\n\t\tvalue = o.subscriptionId\n\t}\n\treturn\n}", "title": "" }, { "docid": "5c5661b77a1110653371f10202c2806e", "score": "0.6865074", "text": "func (a *SubscriptionsApiService) RetrieveSubscription(ctx context.Context, subscriptionId string) (RetrieveSubscriptionResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue RetrieveSubscriptionResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v2/subscriptions/{subscription_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"subscription_id\"+\"}\", fmt.Sprintf(\"%v\", subscriptionId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v RetrieveSubscriptionResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "c8241c6aded625d80f1929e6b0acbe11", "score": "0.6751153", "text": "func (a *WaiApiService) SubscriptionsGET(ctx context.Context, subscriptionId string) (InlineSubscription, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue InlineSubscription\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/subscriptions/{subscriptionId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"subscriptionId\"+\"}\", fmt.Sprintf(\"%v\", subscriptionId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/problem+json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v InlineSubscription\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 400 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 401 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 403 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 404 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 406 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 429 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "162019c9abde83a126f1b44aaee711f3", "score": "0.67184067", "text": "func (s *server) GetSubscriber(ctx context.Context, w http.ResponseWriter, r *http.Request, log *logging.Client) Response {\n\tvar err error\n\treq := new(pb.GetSubscriberReq)\n\n\t// decode request\n\terr = decodeRequest(ctx, r, req)\n\tif err != nil {\n\t\treturn failedToDecode(err)\n\t}\n\t// end decode request\n\n\temail := req.Email\n\n\tsubC := subold.New(ctx)\n\tsubscriber, err := subC.GetSubscriber(email)\n\n\tif err != nil {\n\t\treturn errors.GetErrorWithCode(err).Annotate(\"failed to get subscriber\")\n\t}\n\n\tresp := &pb.GetSubscriberResp{\n\t\tSubscriber: pbSubscriber(subscriber),\n\t}\n\n\treturn resp\n}", "title": "" }, { "docid": "e69d497b24eea365f3a9b589a3645655", "score": "0.66285306", "text": "func (a *Client) GetSubscriptions(params *GetSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSubscriptionsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSubscriptionsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetSubscriptions\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/Subscriptions\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetSubscriptionsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetSubscriptionsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetSubscriptions: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "9e9ed9f255a7573cee1a23ca1d71e367", "score": "0.6459312", "text": "func getSubscription(request router.Request) (int, []byte) {\n\n\tsubscription, err := GetSubscriptionFromGAE(request.GetPathParams()[\"project_id\"], request.GetPathParams()[\"subscription_id\"], request.GetContext())\n\n\tif err != nil && strings.Contains(err.Error(), \"no such entity\") {\n\t\treturn http.StatusNotFound, []byte(\"Subscription not found\")\n\t} else if err != nil {\n\t\tlog.Errorf(request.GetContext(), \"Error retriving Subsciption: %v\", err)\n\t\treturn http.StatusInternalServerError, []byte(err.Error())\n\t} else {\n\t\tsubscriptionBytes, err := json.MarshalIndent(subscription, \"\", \"\t\")\n\t\tif err == nil {\n\t\t\treturn http.StatusOK, subscriptionBytes\n\t\t} else {\n\t\t\tlog.Errorf(request.GetContext(), \"Errror %v\", err)\n\t\t\treturn http.StatusInternalServerError, []byte(err.Error())\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "8ab0b5892a3f570b9b89856997d292e9", "score": "0.64136016", "text": "func (m *MockSubscriptionService) GetSubscription(arg0 string, arg1 subscription.ID) (*subscription.Subscription, error) {\n\tret := m.ctrl.Call(m, \"GetSubscription\", arg0, arg1)\n\tret0, _ := ret[0].(*subscription.Subscription)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cb8ec879c5c2ab8609242c5181edeebb", "score": "0.63782084", "text": "func (a *Client) Subscription(params *SubscriptionParams, authInfo runtime.ClientAuthInfoWriter) (*SubscriptionOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewSubscriptionParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Subscription\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/Subscriptions/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &SubscriptionReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*SubscriptionOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for Subscription: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "1324fea9f639821cddbf3c8ac878abb6", "score": "0.6363086", "text": "func (o *Customer) GetSubscriptionOk() (*SubscriptionRequest, bool) {\n\tif o == nil || IsNil(o.Subscription) {\n\t\treturn nil, false\n\t}\n\treturn o.Subscription, true\n}", "title": "" }, { "docid": "6df0c2553399ac8438cfcfec88e78ed5", "score": "0.63541406", "text": "func (client *Client) SubscriptionGetByID(id string) (*Subscription, error) {\n\tvar result Subscription\n\terr := client.Get(fmt.Sprintf(\"%s/%s\", SubscriptionURLPath, id), nil, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "7632db4a9f99da1d0cdfae1f24d3bf8b", "score": "0.63121736", "text": "func (m *DeviceManagement) GetSubscriptions()(*DeviceManagementSubscriptions) {\n val, err := m.GetBackingStore().Get(\"subscriptions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*DeviceManagementSubscriptions)\n }\n return nil\n}", "title": "" }, { "docid": "58673b1bbe4ba59b55c7dadc79a31d10", "score": "0.6282637", "text": "func (m *ChangeNotification) GetSubscriptionId()(*string) {\n return m.subscriptionId\n}", "title": "" }, { "docid": "b2ac488fa6d1d6b451b8f7b0e169c862", "score": "0.62303704", "text": "func (o *UpdateCustomer) GetSubscriptionOk() (*SubscriptionRequest, bool) {\n\tif o == nil || IsNil(o.Subscription) {\n\t\treturn nil, false\n\t}\n\treturn o.Subscription, true\n}", "title": "" }, { "docid": "5b127eedf5e018b1397a60960dc4ee7b", "score": "0.62212753", "text": "func (a *Client) GetMeSubscription(params *GetMeSubscriptionParams, authInfo runtime.ClientAuthInfoWriter) (*GetMeSubscriptionOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetMeSubscriptionParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetMeSubscription\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/me/subscription\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetMeSubscriptionReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetMeSubscriptionOK), nil\n\n}", "title": "" }, { "docid": "54aa19c2ffe66c4cb0109ab0f68d4669", "score": "0.6125032", "text": "func GetSubscriptionForGroup(groupName string) (*stripe.Sub, error) {\n\tgroup, err := modelhelper.GetGroup(groupName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif group.Payment.Subscription.ID == \"\" {\n\t\treturn nil, ErrCustomerNotSubscribedToAnyPlans\n\t}\n\n\treturn sub.Get(group.Payment.Subscription.ID, nil)\n}", "title": "" }, { "docid": "c1d6e723fbd5f7c7b5f2265b653aae43", "score": "0.61158675", "text": "func GetSubscriptionById(settings *playfab.Settings, postData *GetSubscriptionByIdRequestModel, entityToken string) (*GetSubscriptionResultModel, error) {\n if entityToken == \"\" {\n return nil, playfab.NewCustomError(\"entityToken should not be an empty string\", playfab.ErrorGeneric)\n }\n b, errMarshal := json.Marshal(postData)\n if errMarshal != nil {\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\n }\n\n sourceMap, err := playfab.Request(settings, b, \"/Catalog/GetSubscriptionById\", \"X-EntityToken\", entityToken)\n if err != nil {\n return nil, err\n }\n \n result := &GetSubscriptionResultModel{}\n\n config := mapstructure.DecoderConfig{\n DecodeHook: playfab.StringToDateTimeHook,\n Result: result,\n }\n \n decoder, errDecoding := mapstructure.NewDecoder(&config)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n \n errDecoding = decoder.Decode(sourceMap)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n\n return result, nil\n}", "title": "" }, { "docid": "aea35e933d5eb1a54c198063f6936a50", "score": "0.6102142", "text": "func (client SubscriptionsClient) GetSubscriptionResponder(resp *http.Response) (result SubscriptionUnderManagementGroup, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "a9417b703763fef9753daf69a9c1fdad", "score": "0.6096719", "text": "func GetSubscriptionID(request *restful.Request) string {\n\treturn request.PathParameter(consts.PathSubscriptionIDParameter)\n}", "title": "" }, { "docid": "91bd1df9f63be2a356316e530d9c107e", "score": "0.60805124", "text": "func (s snsTopicSubscriptionNamespaceLister) Get(name string) (*v1alpha1.SnsTopicSubscription, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"snstopicsubscription\"), name)\n\t}\n\treturn obj.(*v1alpha1.SnsTopicSubscription), nil\n}", "title": "" }, { "docid": "74b3f053ed7456df0fc927ebf5a96c04", "score": "0.60337615", "text": "func (c *client) getSubscription(subjectTitle string) subscription {\n\tfor _, subscription := range c.Subscriptions {\n\t\tif subscription.SubjectTitle == subjectTitle {\n\t\t\treturn subscription\n\t\t}\n\t}\n\n\treturn subscription{}\n}", "title": "" }, { "docid": "a3cbb639a25a3a65aa70f02d210e0671", "score": "0.59840554", "text": "func (client SubscriptionsClient) GetSubscriptionPreparer(ctx context.Context, groupID string, subscriptionID string, cacheControl string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"groupId\": autorest.Encode(\"path\", groupID),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", subscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif len(cacheControl) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"Cache-Control\", autorest.String(cacheControl)))\n\t} else {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"Cache-Control\", autorest.String(\"no-cache\")))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "71559842a96ae8f0652e1b560ac35d3f", "score": "0.5968778", "text": "func (m *DeviceManagement) GetSubscriptionState()(*DeviceManagementSubscriptionState) {\n val, err := m.GetBackingStore().Get(\"subscriptionState\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*DeviceManagementSubscriptionState)\n }\n return nil\n}", "title": "" }, { "docid": "63ef35491e45de8184c85075efe708ce", "score": "0.59369165", "text": "func (o *ReservedResource) GetSubscriptionOk() (*ObjectReference, bool) {\n\tif o == nil || o.Subscription == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Subscription, true\n}", "title": "" }, { "docid": "c6897bbfdf10ff750daade1b3f41e227", "score": "0.59226376", "text": "func (s *StreamsApiService) GetSubscriptions(ctx context.Context, includeSubscribers bool) (ImplResponse, error) {\n\t// TODO - update GetSubscriptions with the required logic for this service method.\n\t// Add api_streams_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation.\n\n\t//TODO: Uncomment the next line to return response Response(200, JsonSuccessBase{}) or use other options such as http.Ok ...\n\t//return Response(200, JsonSuccessBase{}), nil\n\n\treturn Response(http.StatusNotImplemented, nil), errors.New(\"GetSubscriptions method not implemented\")\n}", "title": "" }, { "docid": "cb824bc2d9b05edad397ee8760c543c2", "score": "0.5918758", "text": "func GetSubscriber(networkId string, subscriberId string) (\n\t*lteprotos.SubscriberData, error) {\n\tclient, err := getSubscriberdbClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlookup := &lteprotos.SubscriberLookup{\n\t\tNetworkId: &protos.NetworkID{Id: networkId},\n\t\tSid: lteprotos.SidFromString(subscriberId)}\n\tdata, err := client.GetSubscriberData(context.Background(), lookup)\n\tif err != nil {\n\t\tglog.Errorf(\"[Network: %s, Sub: %s] GetSubscriberData error: %s\",\n\t\t\tnetworkId, subscriberId, err)\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "75c63d4e2882e0dc965e20ec2edb0981", "score": "0.5872806", "text": "func (s *Schema) Subscription() *Object {\n\treturn s.Object(\"Subscription\", Subscription{}, \"\")\n}", "title": "" }, { "docid": "d00dfcd4e6d6fd51b891ae3415fc4688", "score": "0.58447456", "text": "func (s *Service) GetSubscriptions(parameters connection.APIRequestParameters) ([]Subscription, error) {\n\treturn connection.InvokeRequestAll(s.GetSubscriptionsPaginated, parameters)\n}", "title": "" }, { "docid": "d0763c317bd2d2f8650b9977ed877e5b", "score": "0.5831371", "text": "func (client SubscriptionsClient) GetSubscriptionSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "f838fbd598946c64b5850896e543cd33", "score": "0.5821392", "text": "func RetrieveGoogleSubscription(ID string, uid uuid.UUID, calendar CalendarManager, resourceID string) (subscription *GoogleSubscription) {\n\tsubscription = new(GoogleSubscription)\n\tsubscription.ID = ID\n\tsubscription.Uuid = uid\n\tsubscription.calendar = calendar.(*GoogleCalendar)\n\tsubscription.ResourceID = resourceID\n\treturn\n}", "title": "" }, { "docid": "7627926fcfbad31ed805f5fa194eae00", "score": "0.582129", "text": "func (c *InMemoryCache) Get(topic string) (*Subscription, error) {\n\tc.m.RLock()\n\tdefer c.m.RUnlock()\n\n\titem := c.c[topic]\n\treturn item.sub, nil\n}", "title": "" }, { "docid": "d50fb7ed9095a1b8def8678a289362d5", "score": "0.5793503", "text": "func (ac *AdminClient) Subscription(ctx context.Context, subscription SubscriptionPath) (*SubscriptionConfig, error) {\n\tsubspb, err := ac.admin.GetSubscription(ctx, &pb.GetSubscriptionRequest{Name: subscription.String()})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn protoToSubscriptionConfig(subspb)\n}", "title": "" }, { "docid": "e1761c3a5ce3d32675f24b671b3ceedd", "score": "0.5778777", "text": "func (client SubscriptionClient) GetAssignedSubscription(ctx context.Context, request GetAssignedSubscriptionRequest) (response GetAssignedSubscriptionResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.getAssignedSubscription, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = GetAssignedSubscriptionResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = GetAssignedSubscriptionResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(GetAssignedSubscriptionResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into GetAssignedSubscriptionResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "45cb2efea7f203cf355e12e3d5045eac", "score": "0.57775426", "text": "func GetSubscriptionRule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SubscriptionRuleState, opts ...pulumi.ResourceOption) (*SubscriptionRule, error) {\n\tvar resource SubscriptionRule\n\terr := ctx.ReadResource(\"azure:servicebus/subscriptionRule:SubscriptionRule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "066ccef82d750dc208c2d5abb78e642b", "score": "0.5771628", "text": "func (s subscriberNamespaceLister) Get(name string) (*v1alpha1.Subscriber, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"subscriber\"), name)\n\t}\n\treturn obj.(*v1alpha1.Subscriber), nil\n}", "title": "" }, { "docid": "db55692222127bb54de24ce0e831d8a5", "score": "0.5767025", "text": "func (vc *VirtualNetworkGatewayConnectionsClient) GetSubscriptionID() string {\n\treturn vc.Session.SubscriptionID\n}", "title": "" }, { "docid": "c48e4ac3d8b6bd2537a35331fd3d1c70", "score": "0.5743993", "text": "func GetEventSubscription(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *EventSubscriptionState, opts ...pulumi.ResourceOption) (*EventSubscription, error) {\n\tvar resource EventSubscription\n\terr := ctx.ReadResource(\"azure:eventhub/eventSubscription:EventSubscription\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "48a7a4c60f1be845436f0afd785c1675", "score": "0.57046545", "text": "func Subscription(rep interface{}, err error) (moira.SubscriptionData, error) {\n\tsubscription := moira.SubscriptionData{\n\t\t// TODO not sure if this is still necessary, maybe we should just convert database and forget about it\n\t\tThrottlingEnabled: true,\n\t}\n\tbytes, err := redis.Bytes(rep, err)\n\tif err != nil {\n\t\tif err == redis.ErrNil {\n\t\t\treturn subscription, database.ErrNil\n\t\t}\n\t\treturn subscription, fmt.Errorf(\"Failed to read subscription: %s\", err.Error())\n\t}\n\terr = json.Unmarshal(bytes, &subscription)\n\tif err != nil {\n\t\treturn subscription, fmt.Errorf(\"Failed to parse subscription json %s: %s\", string(bytes), err.Error())\n\t}\n\treturn subscription, nil\n}", "title": "" }, { "docid": "d3530bfc4b4246ec6f020bbc4f222e88", "score": "0.56998086", "text": "func (a *Client) GetMeSubscriptionSubscriptionType(params *GetMeSubscriptionSubscriptionTypeParams, authInfo runtime.ClientAuthInfoWriter) (*GetMeSubscriptionSubscriptionTypeOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetMeSubscriptionSubscriptionTypeParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetMeSubscriptionSubscriptionType\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/me/subscription/{subscriptionType}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetMeSubscriptionSubscriptionTypeReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetMeSubscriptionSubscriptionTypeOK), nil\n\n}", "title": "" }, { "docid": "f40ab6088d653270ece44eaa474243fc", "score": "0.56917995", "text": "func GetSubscriptionByFriendlyId(settings *playfab.Settings, postData *GetSubscriptionByFriendlyIdRequestModel, entityToken string) (*GetSubscriptionResultModel, error) {\n if entityToken == \"\" {\n return nil, playfab.NewCustomError(\"entityToken should not be an empty string\", playfab.ErrorGeneric)\n }\n b, errMarshal := json.Marshal(postData)\n if errMarshal != nil {\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\n }\n\n sourceMap, err := playfab.Request(settings, b, \"/Catalog/GetSubscriptionByFriendlyId\", \"X-EntityToken\", entityToken)\n if err != nil {\n return nil, err\n }\n \n result := &GetSubscriptionResultModel{}\n\n config := mapstructure.DecoderConfig{\n DecodeHook: playfab.StringToDateTimeHook,\n Result: result,\n }\n \n decoder, errDecoding := mapstructure.NewDecoder(&config)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n \n errDecoding = decoder.Decode(sourceMap)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n\n return result, nil\n}", "title": "" }, { "docid": "4cd281ead2b56a82a0fda88900745a49", "score": "0.5681853", "text": "func (s *server) GetHasSubscribed(ctx context.Context, w http.ResponseWriter, r *http.Request, log *logging.Client) Response {\n\tvar err error\n\treq := new(pb.GetHasSubscribedReq)\n\n\t// decode request\n\terr = decodeRequest(ctx, r, req)\n\tif err != nil {\n\t\treturn failedToDecode(err)\n\t}\n\t// end decode request\n\n\tvar t time.Time\n\n\tsubC := subold.New(ctx)\n\tsubscribers, err := subC.GetHasSubscribed(t)\n\n\tif err != nil {\n\t\treturn errors.GetErrorWithCode(err).Annotate(\"failed to get all subscribers\")\n\t}\n\n\tresp := &pb.GetHasSubscribedResp{\n\t\tSubscribers: pbSubscribers(subscribers),\n\t}\n\n\treturn resp\n}", "title": "" }, { "docid": "a41ecaa2a9bc4bfb7d9b5e6467f50517", "score": "0.5668787", "text": "func (c *Client) SubscriptionById(id string) (subscription model.Subscription, edgexErr errors.EdgeX) {\n\tconn := c.Pool.Get()\n\tdefer conn.Close()\n\n\tsubscription, edgexErr = subscriptionById(conn, id)\n\tif edgexErr != nil {\n\t\treturn subscription, errors.NewCommonEdgeX(errors.Kind(edgexErr), fmt.Sprintf(\"failed to query subscription by id %s\", id), edgexErr)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "fc6ea857030ec9a45855e2ca5a04882f", "score": "0.56608367", "text": "func (c *Client) Subscription() flare.SubscriptionRepositorier {\n\treturn &c.subscription\n}", "title": "" }, { "docid": "24f176090ea8600c7988fc81d7a92991", "score": "0.5657282", "text": "func (c *Client) GetLicense(subscription string) error {\n\tlog.Debugf(\"Retrieving all subscriptions\")\n\turl := fmt.Sprintf(\"%s/%s/license-file\", c.HUBURL, subscription)\n\tlog.Debugf(\"Url = %s\", url)\n\tresponse, err := c.getRequest(url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"%v\", string(response))\n\treturn nil\n}", "title": "" }, { "docid": "11acce7323d3acc636709b9797571ffa", "score": "0.5655339", "text": "func (c *Client) LookupSubscription(subID string) (*SubscriptionRequest, error) {\n\ts, err := c.subscriptions.lookupBySubscriptionID(subID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.Request, nil\n}", "title": "" }, { "docid": "ba955b12476a9160468ceea546900ada", "score": "0.5654563", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Subscription) Subscription() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Subscription_Subscription {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Subscription_Subscription{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"subscription\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ba955b12476a9160468ceea546900ada", "score": "0.56536037", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Subscription) Subscription() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Subscription_Subscription {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Subscription_Subscription{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"subscription\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4b0583fd3b9abc089f6397d22ee13955", "score": "0.5648493", "text": "func (o *GenericNotificationPayload) GetSubscriptionKey() string {\n\tif o == nil || o.SubscriptionKey == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SubscriptionKey\n}", "title": "" }, { "docid": "b9fa80b76f4160a2d3154be38aa49de4", "score": "0.5633845", "text": "func ExampleClient_Get() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armsubscriptions.NewClientFactory(cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewClient().Get(ctx, \"291bba3f-e0a5-47bc-a099-3bdcb2a50a05\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.Subscription = armsubscriptions.Subscription{\n\t// \tAuthorizationSource: to.Ptr(\"Bypassed\"),\n\t// \tDisplayName: to.Ptr(\"Example Subscription\"),\n\t// \tID: to.Ptr(\"/subscriptions/291bba3f-e0a5-47bc-a099-3bdcb2a50a05\"),\n\t// \tManagedByTenants: []*armsubscriptions.ManagedByTenant{\n\t// \t\t{\n\t// \t\t\tTenantID: to.Ptr(\"8f70baf1-1f6e-46a2-a1ff-238dac1ebfb7\"),\n\t// \t}},\n\t// \tState: to.Ptr(armsubscriptions.SubscriptionStateEnabled),\n\t// \tSubscriptionID: to.Ptr(\"291bba3f-e0a5-47bc-a099-3bdcb2a50a05\"),\n\t// \tSubscriptionPolicies: &armsubscriptions.SubscriptionPolicies{\n\t// \t\tLocationPlacementID: to.Ptr(\"Internal_2014-09-01\"),\n\t// \t\tQuotaID: to.Ptr(\"Internal_2014-09-01\"),\n\t// \t\tSpendingLimit: to.Ptr(armsubscriptions.SpendingLimitOff),\n\t// \t},\n\t// \tTags: map[string]*string{\n\t// \t\t\"tagKey1\": to.Ptr(\"tagValue1\"),\n\t// \t\t\"tagKey2\": to.Ptr(\"tagValue2\"),\n\t// \t},\n\t// \tTenantID: to.Ptr(\"31c75423-32d6-4322-88b7-c478bdde4858\"),\n\t// }\n}", "title": "" }, { "docid": "502ad1e22131bfd09cc3b559a7832650", "score": "0.5622066", "text": "func (a *Client) GetSubscriptionConversions(params *GetSubscriptionConversionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSubscriptionConversionsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSubscriptionConversionsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetSubscriptionConversions\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/Subscriptions/{subscriptionId}/conversions\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetSubscriptionConversionsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetSubscriptionConversionsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetSubscriptionConversions: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "86d58d5464af72985dab8b9be44c35b9", "score": "0.5619431", "text": "func (o *AddSubscriptionsResponse) GetSubscribed() map[string][]string {\n\tif o == nil || o.Subscribed == nil {\n\t\tvar ret map[string][]string\n\t\treturn ret\n\t}\n\treturn *o.Subscribed\n}", "title": "" }, { "docid": "a942679783004482e129f47c821ce547", "score": "0.5599033", "text": "func (s *Server) CreateSubscription(\n\tctx context.Context, req *ridpb.CreateSubscriptionRequest) (\n\t*ridpb.PutSubscriptionResponse, error) {\n\n\tparams := req.GetParams()\n\tctx, cancel := context.WithTimeout(ctx, s.Timeout)\n\tdefer cancel()\n\n\towner, ok := auth.OwnerFromContext(ctx)\n\tif !ok {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.PermissionDenied, \"Missing owner from context\")\n\t}\n\tif params == nil {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Params not set\")\n\t}\n\tif params.Callbacks == nil {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Missing required callbacks\")\n\t}\n\tif params.Extents == nil {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Missing required extents\")\n\t}\n\tid, err := dssmodels.IDFromString(req.Id)\n\tif err != nil {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Invalid ID format\")\n\t}\n\n\tsub := &ridmodels.Subscription{\n\t\tID: id,\n\t\tOwner: owner,\n\t\tURL: params.Callbacks.IdentificationServiceAreaUrl,\n\t\tWriter: s.Locality,\n\t}\n\n\tif err := sub.SetExtents(params.Extents); err != nil {\n\t\treturn nil, stacktrace.PropagateWithCode(err, dsserr.BadRequest, \"Invalid extents\")\n\t}\n\n\tinsertedSub, err := s.App.InsertSubscription(ctx, sub)\n\tif err != nil {\n\t\treturn nil, stacktrace.Propagate(err, \"Could not insert Subscription\")\n\t}\n\n\tp, err := insertedSub.ToProto()\n\tif err != nil {\n\t\treturn nil, stacktrace.Propagate(err, \"Could not convert Subscription to proto\")\n\t}\n\n\t// Find ISAs that were in this subscription's area.\n\tisas, err := s.App.SearchISAs(ctx, sub.Cells, nil, nil)\n\tif err != nil {\n\t\treturn nil, stacktrace.Propagate(err, \"Could not search ISAs\")\n\t}\n\n\t// Convert the ISAs to protos.\n\tisaProtos := make([]*ridpb.IdentificationServiceArea, len(isas))\n\tfor i, isa := range isas {\n\t\tisaProtos[i], err = isa.ToProto()\n\t\tif err != nil {\n\t\t\treturn nil, stacktrace.Propagate(err, \"Could not convert ISA to proto\")\n\t\t}\n\t}\n\n\treturn &ridpb.PutSubscriptionResponse{\n\t\tSubscription: p,\n\t\tServiceAreas: isaProtos,\n\t}, nil\n}", "title": "" }, { "docid": "f8e87ef585d2d9a90f9ce4938120785e", "score": "0.5577501", "text": "func (s *subscriptionsImpl) Create(sub NewSubscription) (*Response, *NewSubscriptionResponse, error) {\n\treq, err := s.client.newRequest(\"POST\", \"subscriptions\", nil, sub)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar dst NewSubscriptionResponse\n\tvar subscription Subscription\n\tresp, err := s.client.do(req, &subscription)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif subscription.UUID != \"\" { // If subscription not present, dst.Subscription should be nil\n\t\tdst.Subscription = &subscription\n\t}\n\n\tif resp.transaction != nil {\n\t\tdst.Transaction = resp.transaction\n\t}\n\n\treturn resp, &dst, err\n}", "title": "" }, { "docid": "80f962586557db370efa74b94c03f3a4", "score": "0.55708194", "text": "func (s *subscribers) Get(id uuid.UUID) Subscriber {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tlog.Log(\"Retrieveing subscriber: %s\", id)\n\n\treturn s.sMap[id]\n}", "title": "" }, { "docid": "95483c6a7d44dffed728426c296c9b4e", "score": "0.55693114", "text": "func (s *Server) CreateSubscription(ctx context.Context, req *restapi.CreateSubscriptionRequest,\n) restapi.CreateSubscriptionResponseSet {\n\n\tif req.Auth.Error != nil {\n\t\tresp := restapi.CreateSubscriptionResponseSet{}\n\t\tsetAuthError(ctx, stacktrace.Propagate(req.Auth.Error, \"Auth failed\"), &resp.Response401, &resp.Response403, &resp.Response500)\n\t\treturn resp\n\t}\n\n\tctx, cancel := context.WithTimeout(ctx, s.Timeout)\n\tdefer cancel()\n\n\tif req.Auth.ClientID == nil {\n\t\treturn restapi.CreateSubscriptionResponseSet{Response403: &restapi.ErrorResponse{\n\t\t\tMessage: dsserr.Handle(ctx, stacktrace.NewErrorWithCode(dsserr.PermissionDenied, \"Missing owner\"))}}\n\t}\n\tif req.BodyParseError != nil {\n\t\treturn restapi.CreateSubscriptionResponseSet{Response400: &restapi.ErrorResponse{\n\t\t\tMessage: dsserr.Handle(ctx, stacktrace.PropagateWithCode(req.BodyParseError, dsserr.BadRequest, \"Malformed params\"))}}\n\t}\n\tif req.Body.Callbacks.IdentificationServiceAreaUrl == nil {\n\t\treturn restapi.CreateSubscriptionResponseSet{Response400: &restapi.ErrorResponse{\n\t\t\tMessage: dsserr.Handle(ctx, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Missing required callbacks\"))}}\n\t}\n\tif len(req.Body.Extents.SpatialVolume.Footprint.Vertices) == 0 {\n\t\treturn restapi.CreateSubscriptionResponseSet{Response400: &restapi.ErrorResponse{\n\t\t\tMessage: dsserr.Handle(ctx, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Missing required extents\"))}}\n\t}\n\textents, err := apiv1.FromVolume4D(&req.Body.Extents)\n\tif err != nil {\n\t\treturn restapi.CreateSubscriptionResponseSet{Response400: &restapi.ErrorResponse{\n\t\t\tMessage: dsserr.Handle(ctx, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Error parsing Volume4D: %v\", stacktrace.RootCause(err)))}}\n\t}\n\tid, err := dssmodels.IDFromString(string(req.Id))\n\tif err != nil {\n\t\treturn restapi.CreateSubscriptionResponseSet{Response400: &restapi.ErrorResponse{\n\t\t\tMessage: dsserr.Handle(ctx, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Invalid ID format\"))}}\n\t}\n\n\tif !s.EnableHTTP {\n\t\terr = ridmodels.ValidateURL(string(*req.Body.Callbacks.IdentificationServiceAreaUrl))\n\t\tif err != nil {\n\t\t\treturn restapi.CreateSubscriptionResponseSet{Response400: &restapi.ErrorResponse{\n\t\t\t\tMessage: dsserr.Handle(ctx, stacktrace.PropagateWithCode(err, dsserr.BadRequest, \"Failed to validate IdentificationServiceAreaUrl\"))}}\n\t\t}\n\t}\n\n\tsub := &ridmodels.Subscription{\n\t\tID: id,\n\t\tOwner: dssmodels.Owner(*req.Auth.ClientID),\n\t\tURL: string(*req.Body.Callbacks.IdentificationServiceAreaUrl),\n\t\tWriter: s.Locality,\n\t}\n\n\tif err := sub.SetExtents(extents); err != nil {\n\t\treturn restapi.CreateSubscriptionResponseSet{Response400: &restapi.ErrorResponse{\n\t\t\tMessage: dsserr.Handle(ctx, stacktrace.PropagateWithCode(err, dsserr.BadRequest, \"Invalid extents\"))}}\n\t}\n\n\tinsertedSub, err := s.App.InsertSubscription(ctx, sub)\n\tif err != nil {\n\t\terr = stacktrace.Propagate(err, \"Could not insert Subscription\")\n\t\terrResp := &restapi.ErrorResponse{Message: dsserr.Handle(ctx, err)}\n\t\tswitch stacktrace.GetCode(err) {\n\t\tcase dsserr.AlreadyExists:\n\t\t\treturn restapi.CreateSubscriptionResponseSet{Response409: errResp}\n\t\tcase dsserr.BadRequest:\n\t\t\treturn restapi.CreateSubscriptionResponseSet{Response400: errResp}\n\t\tcase dsserr.Exhausted:\n\t\t\treturn restapi.CreateSubscriptionResponseSet{Response429: errResp}\n\t\tdefault:\n\t\t\treturn restapi.CreateSubscriptionResponseSet{Response500: &api.InternalServerErrorBody{\n\t\t\t\tErrorMessage: *dsserr.Handle(ctx, stacktrace.Propagate(err, \"Got an unexpected error\"))}}\n\t\t}\n\t}\n\n\t// Find ISAs that were in this subscription's area.\n\tisas, err := s.App.SearchISAs(ctx, sub.Cells, nil, nil)\n\tif err != nil {\n\t\terr = stacktrace.Propagate(err, \"Could not search ISAs\")\n\t\tif stacktrace.GetCode(err) == dsserr.BadRequest {\n\t\t\treturn restapi.CreateSubscriptionResponseSet{Response400: &restapi.ErrorResponse{\n\t\t\t\tMessage: dsserr.Handle(ctx, err)}}\n\t\t}\n\t\treturn restapi.CreateSubscriptionResponseSet{Response500: &api.InternalServerErrorBody{\n\t\t\tErrorMessage: *dsserr.Handle(ctx, stacktrace.Propagate(err, \"Got an unexpected error\"))}}\n\t}\n\n\t// Convert the ISAs to REST.\n\trestIsas := make([]restapi.IdentificationServiceArea, 0, len(isas))\n\tfor _, isa := range isas {\n\t\trestIsas = append(restIsas, *apiv1.ToIdentificationServiceArea(isa))\n\t}\n\n\treturn restapi.CreateSubscriptionResponseSet{Response200: &restapi.PutSubscriptionResponse{\n\t\tSubscription: *apiv1.ToSubscription(insertedSub),\n\t\tServiceAreas: &restIsas,\n\t}}\n}", "title": "" }, { "docid": "a3d5a2cf8f93d06283bfbba2eb175972", "score": "0.55640405", "text": "func (mr *MockSubscriptionServiceMockRecorder) GetSubscription(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetSubscription\", reflect.TypeOf((*MockSubscriptionService)(nil).GetSubscription), arg0, arg1)\n}", "title": "" }, { "docid": "d3386620e049152f79f6b776522c3f3d", "score": "0.55329674", "text": "func (c *Clientset) Subscription() subscriptionv1alpha1.SubscriptionV1alpha1Interface {\n\treturn c.subscriptionV1alpha1\n}", "title": "" }, { "docid": "aac45a3f08109c1aede6c0c74de284e6", "score": "0.55210835", "text": "func (r *Resolver) Subscription() generated.SubscriptionResolver { return &subscriptionResolver{r} }", "title": "" }, { "docid": "aac45a3f08109c1aede6c0c74de284e6", "score": "0.55210835", "text": "func (r *Resolver) Subscription() generated.SubscriptionResolver { return &subscriptionResolver{r} }", "title": "" }, { "docid": "aac45a3f08109c1aede6c0c74de284e6", "score": "0.55210835", "text": "func (r *Resolver) Subscription() generated.SubscriptionResolver { return &subscriptionResolver{r} }", "title": "" }, { "docid": "aac45a3f08109c1aede6c0c74de284e6", "score": "0.55210835", "text": "func (r *Resolver) Subscription() generated.SubscriptionResolver { return &subscriptionResolver{r} }", "title": "" }, { "docid": "aac45a3f08109c1aede6c0c74de284e6", "score": "0.55210835", "text": "func (r *Resolver) Subscription() generated.SubscriptionResolver { return &subscriptionResolver{r} }", "title": "" }, { "docid": "aac45a3f08109c1aede6c0c74de284e6", "score": "0.55210835", "text": "func (r *Resolver) Subscription() generated.SubscriptionResolver { return &subscriptionResolver{r} }", "title": "" }, { "docid": "aac45a3f08109c1aede6c0c74de284e6", "score": "0.55210835", "text": "func (r *Resolver) Subscription() generated.SubscriptionResolver { return &subscriptionResolver{r} }", "title": "" }, { "docid": "aac45a3f08109c1aede6c0c74de284e6", "score": "0.55210835", "text": "func (r *Resolver) Subscription() generated.SubscriptionResolver { return &subscriptionResolver{r} }", "title": "" }, { "docid": "1a073ae946e266b4bf43e54f13300d53", "score": "0.5516685", "text": "func (client *Client) SubscriptionCreate(draft *SubscriptionDraft) (*Subscription, error) {\n\tvar result Subscription\n\terr := client.Create(SubscriptionURLPath, nil, draft, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "1cb5f4870a01a7bc1df5aad2e03385ad", "score": "0.5515869", "text": "func (s Subscription) Validate() error {\n\treturn validateResource(string(s), \"subscriptions\")\n}", "title": "" }, { "docid": "2d7c5c7dcfcc9cb90f127aad8d2a116c", "score": "0.55122495", "text": "func (f *Feed) Subscription() (Subscription, error) {\n\ts := &SimpleSubscription{\n\t\tFeedID: FeedID(f.ID),\n\t\tFeedURI: f.URI,\n\t}\n\n\tif re, err := newFilter(f.ID, \"title\", f.TitleFilter); err != nil {\n\t\treturn s, err\n\t} else {\n\t\ts.TitleFilter = re\n\t}\n\n\tif re, err := newFilter(f.ID, \"description\", f.DescriptionFilter); err != nil {\n\t\treturn s, err\n\t} else {\n\t\ts.DescriptionFilter = re\n\t}\n\n\tif re, err := newFilter(f.ID, \"content\", f.ContentFilter); err != nil {\n\t\treturn s, err\n\t} else {\n\t\ts.ContentFilter = re\n\t}\n\n\tif re, err := newFilter(f.ID, \"author\", f.AuthorFilter); err != nil {\n\t\treturn s, err\n\t} else {\n\t\ts.AuthorFilter = re\n\t}\n\n\tif re, err := newFilter(f.ID, \"category\", f.CategoryFilter); err != nil {\n\t\treturn s, err\n\t} else {\n\t\ts.CategoryFilter = re\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "5fba58f02ee225456d5216907437db68", "score": "0.5503842", "text": "func (s *StreamsApiService) GetSubscriptionStatus(ctx context.Context, userId int32, streamId int32) (ImplResponse, error) {\n\t// TODO - update GetSubscriptionStatus with the required logic for this service method.\n\t// Add api_streams_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation.\n\n\t//TODO: Uncomment the next line to return response Response(200, JsonSuccessBase{}) or use other options such as http.Ok ...\n\t//return Response(200, JsonSuccessBase{}), nil\n\n\treturn Response(http.StatusNotImplemented, nil), errors.New(\"GetSubscriptionStatus method not implemented\")\n}", "title": "" }, { "docid": "bb7837c0c3ae238d5a9fc6c10e426046", "score": "0.54931164", "text": "func (a *Server) DeleteSubscription(ctx context.Context, req *scdpb.DeleteSubscriptionRequest) (*scdpb.DeleteSubscriptionResponse, error) {\n\t// Retrieve Subscription ID\n\tid, err := dssmodels.IDFromString(req.GetSubscriptionid())\n\tif err != nil {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.BadRequest, \"Invalid ID format\")\n\t}\n\n\t// Retrieve ID of client making call\n\towner, ok := auth.OwnerFromContext(ctx)\n\tif !ok {\n\t\treturn nil, stacktrace.NewErrorWithCode(dsserr.PermissionDenied, \"Missing owner from context\")\n\t}\n\n\tvar response *scdpb.DeleteSubscriptionResponse\n\taction := func(ctx context.Context, r repos.Repository) (err error) {\n\t\t// Check to make sure it's ok to delete this Subscription\n\t\told, err := r.GetSubscription(ctx, id)\n\t\tswitch {\n\t\tcase err != nil:\n\t\t\treturn stacktrace.Propagate(err, \"Could not get Subscription from repo\")\n\t\tcase old == nil: // Return a 404 here.\n\t\t\treturn stacktrace.NewErrorWithCode(dsserr.NotFound, \"Subscription %s not found\", id.String())\n\t\tcase old.Owner != owner:\n\t\t\treturn stacktrace.Propagate(\n\t\t\t\tstacktrace.NewErrorWithCode(dsserr.PermissionDenied, \"Subscription is owned by different client\"),\n\t\t\t\t\"Subscription owned by %s, but %s attempted to delete\", old.Owner, owner)\n\t\t}\n\n\t\t// Get dependent Operations\n\t\tdependentOps, err := r.GetDependentOperations(ctx, id)\n\t\tif err != nil {\n\t\t\treturn stacktrace.Propagate(err, \"Could not find dependent Operations\")\n\t\t}\n\t\tif len(dependentOps) > 0 {\n\t\t\treturn stacktrace.Propagate(\n\t\t\t\tstacktrace.NewErrorWithCode(dsserr.BadRequest, \"Subscriptions with dependent Operations may not be removed\"),\n\t\t\t\t\"Subscription had %d dependent Operations\", len(dependentOps))\n\t\t}\n\n\t\t// Delete Subscription in repo\n\t\terr = r.DeleteSubscription(ctx, id)\n\t\tif err != nil {\n\t\t\treturn stacktrace.Propagate(err, \"Could not delete Subscription from repo\")\n\t\t}\n\n\t\t// Convert deleted Subscription to proto\n\t\tp, err := old.ToProto(dependentOps)\n\t\tif err != nil {\n\t\t\treturn stacktrace.Propagate(err, \"Error converting Subscription model to proto\")\n\t\t}\n\n\t\t// Create response for client\n\t\tresponse = &scdpb.DeleteSubscriptionResponse{\n\t\t\tSubscription: p,\n\t\t}\n\n\t\treturn nil\n\t}\n\n\terr = a.Store.Transact(ctx, action)\n\tif err != nil {\n\t\treturn nil, err // No need to Propagate this error as this is not a useful stacktrace line\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "c78b6f0a6918f5b705590ac193c4604c", "score": "0.5486112", "text": "func (r *Resolver) Subscription() SubscriptionResolver { return &subscriptionResolver{r} }", "title": "" }, { "docid": "1863fff9c4167ba0bf2ff10e47767998", "score": "0.5482465", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface) Subscription() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Subscription {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Subscription{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"subscription\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1863fff9c4167ba0bf2ff10e47767998", "score": "0.548172", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface) Subscription() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Subscription {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Subscription{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"subscription\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "08bbd8ea52313dc920977c75966cd085", "score": "0.547274", "text": "func (rc *Consumer) Subscription() string {\n\treturn rc.c.Subscription()\n}", "title": "" }, { "docid": "5a07773ce7e0b6e0fe746ef23f15c04e", "score": "0.5468558", "text": "func (g *GormStorage) GetAWebPushSubscription(crc32Endpoint uint32, endpoint string) (models.WebPushSubscription, error) {\n\tvar wpSub models.WebPushSubscription\n\tvar err error\n\n\tif err = g.db.Find(&wpSub, \"crc32_endpoint = ? AND endpoint = ?\", crc32Endpoint, endpoint).Error; err != nil {\n\t\treturn wpSub, errors.Wrap(err, fmt.Sprintf(\"getting a web push subscription(endpoint: %s) occurs error\", endpoint))\n\t}\n\n\treturn wpSub, nil\n}", "title": "" }, { "docid": "eb984de6623ec65457300ad992c6af0f", "score": "0.54460067", "text": "func (s *ListsService) Subscriptions(params *ListsSubscriptionsParams) (*Subscribed, *http.Response, error) {\n\tsubscribed := new(Subscribed)\n\tapiError := new(APIError)\n\tresp, err := s.sling.New().Get(\"subscriptions.json\").QueryStruct(params).Receive(subscribed, apiError)\n\treturn subscribed, resp, relevantError(err, *apiError)\n}", "title": "" }, { "docid": "9d320817011fafc2e383257416c0a35d", "score": "0.5436201", "text": "func (o *GenericNotificationPayload) GetSubscriptionType() string {\n\tif o == nil || o.SubscriptionType == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SubscriptionType\n}", "title": "" }, { "docid": "4eba6aba4b44ca6dd747087079b40803", "score": "0.54324216", "text": "func (s *server) GetHasSubscribedV2(ctx context.Context, w http.ResponseWriter, r *http.Request, log *logging.Client) Response {\n\tvar err error\n\treq := new(pb.GetHasSubscribedReq)\n\n\t// decode request\n\terr = decodeRequest(ctx, r, req)\n\tif err != nil {\n\t\treturn failedToDecode(err)\n\t}\n\t// end decode request\n\n\tsubC, err := sub.NewClient(ctx, log, s.db, s.sqlDB, s.serverInfo)\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"failed sub.NewClient\")\n\t}\n\tsubscribers, err := subC.GetHasSubscribed(int(req.Start), int(req.Limit))\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"failed to get all subscribers\")\n\t}\n\tss, err := serverhelper.PBSubscribers(subscribers)\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"failed to PBSubscribers\")\n\t}\n\tresp := &pb.GetHasSubscribedRespV2{\n\t\tSubscribers: ss,\n\t}\n\n\treturn resp\n}", "title": "" } ]
b1ba8613ca8121481bd3b733e801defc
GetList returns all items in list
[ { "docid": "b3c01af04670530fe3002fc187a1d8b9", "score": "0.6763495", "text": "func (r *Redis) GetList(key string) ([]string, error) {\n\treturn r.GetRange(key, 0, -1)\n}", "title": "" } ]
[ { "docid": "8020886835438d5e3a0bdf632de5d936", "score": "0.73214054", "text": "func (m Random) GetList() []Item {\n\treturn m.List\n}", "title": "" }, { "docid": "8cc8cfeac97bb11640a82bf58df0c980", "score": "0.724871", "text": "func GetList(t *testing.T, path string, token string) (gorequest.Response, *JSONAPIManyResp, []error) {\n\tresp, body, errs := Request(\"GET\", path, token).End()\n\tdata := unmarshalMany(t, body)\n\n\treturn resp, data, errs\n}", "title": "" }, { "docid": "deccd02ad5145816b4edb30dac32561a", "score": "0.6947443", "text": "func GetList() List {\n\treturn List{\n\t\tAddUsers,\n\t\tEditUsers,\n\t\tListUsers,\n\t\tShowConfig,\n\t\tEditConfig,\n\t\tSendMessage,\n\t\tStartCampaign,\n\t\tListMessages,\n\t\tListCampaignFiles,\n\t\tDeleteCampaignFile,\n\t\tListCampaigns,\n\t\tStopCampaign,\n\t\tRetryCampaign,\n\t\tGetStatus,\n\t\tMask,\n\t}\n}", "title": "" }, { "docid": "b429b4859ea70d2b07aefcb16cb97a9f", "score": "0.69140744", "text": "func (dict *RedisList) GetList(key string) []string {\n\tresult, err := dict.client.Cmd(\"lrange\", formatTitle(key), 0, -1).List()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn result\n\n}", "title": "" }, { "docid": "a31c381b98f9fb632bc75d212acc61c3", "score": "0.6883584", "text": "func (k Keeper) GetList(ctx sdk.Context) (retOrders types.Orders, retErr error) {\n\tk.modulePerms.AutoCheck(types.PermRead)\n\n\titerator := k.GetIterator(ctx)\n\tdefer iterator.Close()\n\n\tfor ; iterator.Valid(); iterator.Next() {\n\t\torder := types.Order{}\n\t\tif err := k.cdc.UnmarshalBinaryLengthPrefixed(iterator.Value(), &order); err != nil {\n\t\t\tretErr = fmt.Errorf(\"order unmarshal: %w\", err)\n\t\t\treturn\n\t\t}\n\t\tretOrders = append(retOrders, order)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "770d09283d00a8f8afc319e4f416de22", "score": "0.6799068", "text": "func (client *ElementsClient) GetList(limit, skip int) (*schema.Elements, error) {\n\treturn client.GetListInNamespace(\"\", limit, skip)\n}", "title": "" }, { "docid": "d4de55c305cd8cb8f7353247c6917579", "score": "0.6794641", "text": "func (u *UpYun) GetList(key string) ([]*FileInfo, error) {\n\tret, _, err := u.doRESTRequest(\"GET\", key, \"\", nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlist := strings.Split(ret, \"\\n\")\n\tvar infoList []*FileInfo\n\n\tfor _, v := range list {\n\t\tif len(v) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tinfoList = append(infoList, newFileInfo(v))\n\t}\n\n\treturn infoList, nil\n}", "title": "" }, { "docid": "fe87ff2f6f998bbd14a67acc9ebf3184", "score": "0.677248", "text": "func (g *Client) List() ([]GetResponse, error) {\n\treq, err := g.newRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgists := []GetResponse{}\n\terr = g.do(req, &gists)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn gists, nil\n}", "title": "" }, { "docid": "92a85eafaab643011dd046e5b35e5fb4", "score": "0.6752048", "text": "func GetItemList(c echo.Context) error {\n\n list := txtdb.GetItemList()\n\n\treturn c.JSON(http.StatusOK, list)\n}", "title": "" }, { "docid": "b5bb2a7c3f98a73b4f2ef5d61d2864c3", "score": "0.6723675", "text": "func (c *Client) GetList(ctx context.Context, name string) (*List, error) {\n\tif c.ic.State() != client.Ready {\n\t\treturn nil, hzerrors.ErrClientNotActive\n\t}\n\treturn c.proxyManager.getList(ctx, name)\n}", "title": "" }, { "docid": "22c4f78a568cbd4c01f01193b25870db", "score": "0.6702348", "text": "func (n NestedInteger) GetList() []*NestedInteger { return nil }", "title": "" }, { "docid": "29d76c7e5b6ae353d0a6f417894d1adc", "score": "0.66964066", "text": "func (s *SDKServer) GetList(ctx context.Context, in *alpha.GetListRequest) (*alpha.List, error) {\n\tif !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) {\n\t\treturn nil, errors.Errorf(\"%s not enabled\", runtime.FeatureCountsAndLists)\n\t}\n\t// TODO(#2716): Implement me\n\treturn nil, errors.Errorf(\"Unimplemented -- GetList coming soon\")\n}", "title": "" }, { "docid": "a5623b4cd08c6c27da548a3c60892b73", "score": "0.6693697", "text": "func (c *Router) GetList() ([]string, error) {\n c.con.LogQuery(\"(get) list of virtual routers\")\n path := c.xpath(nil)\n return c.con.EntryListUsing(c.con.Get, path[:len(path) - 1])\n}", "title": "" }, { "docid": "a3223c26b6fedd00f6a0139570fe253f", "score": "0.6659654", "text": "func Get(client *api.Client, params GetParams) (List, error) {\n\tif err := params.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tvar results List\n\tif err := client.ProcessGetRequest(params.GetParams, endpoint{\n\t\tpath: fmt.Sprintf(\"%s_%s\", endPointPrefix, params.Category),\n\t\tname: string(params.Category),\n\t}, &results); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s %w\", \"get\", err)\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "094f72f6e22dce608c4dce2e3f2e50f6", "score": "0.6654883", "text": "func (c *cache) List() []interface{} {\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\tlist := make([]interface{}, 0, len(c.items))\n\tfor _, item := range c.items {\n\t\tlist = append(list, item)\n\t}\n\treturn list\n}", "title": "" }, { "docid": "dc8d4f78cfd767e78ef054bcbaba33d2", "score": "0.6628041", "text": "func List(client *golangsdk.ServiceClient) (r ListResult) {\n\n\t_, r.Err = client.Get(listURL(client), &r.Body, &golangsdk.RequestOpts{\n\t\tOkCodes: []int{200},\n\t\tMoreHeaders: RequestOpts.MoreHeaders, JSONBody: nil,\n\t})\n\treturn\n}", "title": "" }, { "docid": "74b232b87937758013bc06af2bb89f86", "score": "0.6624788", "text": "func getList(w io.Writer, r *http.Request) error {\n\tc := appengine.NewContext(r)\n\n\t// Get the list id from the URL.\n\tid := mux.Vars(r)[\"list\"]\n\n\t// Decode the obtained id into a datastore key.\n\tkey, err := datastore.DecodeKey(id)\n\tif err != nil {\n\t\treturn appErrorf(http.StatusBadRequest, \"invalid list id\")\n\t}\n\n\t// Fetch the list from the datastore.\n\tlist := &List{}\n\terr = datastore.Get(c, key, list)\n\tif err == datastore.ErrNoSuchEntity {\n\t\treturn appErrorf(http.StatusNotFound, \"list not found\")\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fetch list: %v\", err)\n\t}\n\n\t// Set the ID field with the id from the request url and encode the list.\n\tlist.ID = id\n\treturn json.NewEncoder(w).Encode(&list)\n}", "title": "" }, { "docid": "ca8c455e49c8df91536875c7e346d2c3", "score": "0.66165537", "text": "func (n NestedInteger) GetList() []*NestedInteger {\n\treturn make([]*NestedInteger, 0)\n }", "title": "" }, { "docid": "e640f3ae726e2630b6c97efefad99036", "score": "0.66148394", "text": "func List(client *golangsdk.ServiceClient) (r ListResult) {\n\t_, r.Err = client.Get(listURL(client), &r.Body, &golangsdk.RequestOpts{\n\t\tMoreHeaders: RequestOpts.MoreHeaders,\n\t})\n\treturn\n}", "title": "" }, { "docid": "dc323fadcc7e8f708cbeeafca7f36c00", "score": "0.66017705", "text": "func GetUserList(w http.ResponseWriter, r *http.Request) {\n\t//ctx := r.Context().Value(\"AccountCtx\").(*config.Context)\n\t//\n}", "title": "" }, { "docid": "e1ca481e5dc86fde542daabdfc4b65d9", "score": "0.65984535", "text": "func (c *Dg) GetList() ([]string, error) {\n c.con.LogQuery(\"(get) list of device groups\")\n path := c.xpath(nil)\n return c.con.EntryListUsing(c.con.Get, path[:len(path) - 1])\n}", "title": "" }, { "docid": "4dc64320ee37200d0ac214f17da7b0b6", "score": "0.6584605", "text": "func (client TagClient) GetList(ctx context.Context, name string, last string, n *int32, orderby string, digest string) (result TagList, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/TagClient.GetList\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetListPreparer(ctx, name, last, n, orderby, digest)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"containerregistry.TagClient\", \"GetList\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"containerregistry.TagClient\", \"GetList\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"containerregistry.TagClient\", \"GetList\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e965e301503e1caa7075ab5b0c695eb4", "score": "0.6582552", "text": "func (s *StudentCollection) GetList() []string {\n\tstudentList := []string{}\n\tfor studentID := range s.Data {\n\t\tstudentList = append(studentList, studentID)\n\t}\n\treturn studentList\n}", "title": "" }, { "docid": "8bc167322270114f92e619fb308d1135", "score": "0.6561774", "text": "func (c *NotepadsController) GetList(w http.ResponseWriter, req *http.Request) {\n\tuserID := getUserID(req)\n\n\tnotepads, err := c.repo.Get(storage.NotepadsFilter{UserID: &userID})\n\tif err != nil {\n\t\tc.log.Errorf(\"Failed to get notepads: %v\", err)\n\t\tinternalServerError(w)\n\t\treturn\n\t}\n\n\trespond(w, http.StatusOK, notepads)\n}", "title": "" }, { "docid": "4b61e20d5dfc95eced423b0d7d96441f", "score": "0.65336895", "text": "func (n NestedInteger) GetList() []*NestedInteger {}", "title": "" }, { "docid": "6ee1de53f5328f1d1bdcb0da08941d39", "score": "0.6532517", "text": "func GetList() []string {\n\tvar roleList []string\n\tif config.UsingDB() {\n\t\troleList = getListSQL()\n\t} else {\n\t\tds := datastore.New()\n\t\troleList = ds.GetList(\"role\")\n\t}\n\treturn roleList\n}", "title": "" }, { "docid": "bd1dc724a9ef26ee470472ebc98bff86", "score": "0.65288633", "text": "func List() []string {\n\treturn gen.List()\n}", "title": "" }, { "docid": "abe5eb1264f5f438ce93c96d4b29e0d6", "score": "0.6522895", "text": "func (api *MockAPI) List() ([]string, error) {\n\treturn []string{}, nil\n}", "title": "" }, { "docid": "0b007ab33f533a93f5b1f137122b7a3a", "score": "0.6505817", "text": "func GetList(w http.ResponseWriter, r *http.Request) {\n\tvar list []Task\n\t// Allow CORS here By * or specific origin\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type,access-control-allow-origin, access-control-allow-headers\")\n\tdb.C(\"tasks\").Find(bson.M{}).All(&list)\n\t// Encoding all the array.\n\tjson.NewEncoder(w).Encode(list)\n}", "title": "" }, { "docid": "b0aa1331f76ba70565fa2fc43bfe1fa0", "score": "0.6504159", "text": "func (m *SharedDriveItem) GetList()(Listable) {\n val, err := m.GetBackingStore().Get(\"list\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(Listable)\n }\n return nil\n}", "title": "" }, { "docid": "b1c5b9d0c196711d192ddef38fc93546", "score": "0.6498615", "text": "func (m *SQLModel) GetList(id string) (*List, error) {\n\trow := m.db.QueryRow(`\n\t\tSELECT id, name\n\t\tFROM lists\n\t\tWHERE id = ? AND time_deleted IS NULL\n\t\t`, id)\n\tvar list List\n\terr := row.Scan(&list.ID, &list.Name)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlist.Items, err = m.getListItems(id)\n\treturn &list, err\n}", "title": "" }, { "docid": "12ddb15923e84f3bb6e5bb5e5494b27d", "score": "0.64703506", "text": "func (s service) List(\n\tctx context.Context,\n) (data []Info, err error) {\n\terr = s.svc.ResourceOp(\n\t\tctx,\n\t\thttp.MethodGet,\n\t\tlistPathFormat,\n\t\tnil,\n\t\t&data,\n\t)\n\treturn\n}", "title": "" }, { "docid": "9bbfa02d0c31bbcc11bcc85d897a1824", "score": "0.64648134", "text": "func (s *Sensu) getList(endpoint string, limit int, offset int) ([]interface{}, error) {\n\n\t/*\n\t\targs := \"\"\n\t\t//ERROR GET LIST TODO deal with limit %d and offset %d\", limit, offset\n\t\tif limit != NOLIMIT {\n\t\t\targs = fmt.Sprintf(\"%slimit=%d\", args, limit)\n\t\t}\n\t\tif offset != NOOFFSET {\n\t\t\targs = fmt.Sprintf(\"%soffset=%d\", args, limit)\n\t\t}\n\t*/\n\turl := fmt.Sprintf(\"%s/%s\", s.URL, endpoint)\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"URL Parsing error: %q returned: %v\", url, err)\n\t}\n\tres, err := s.doHTTP(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"API call to %q returned: %v\", url, err)\n\t}\n\treturn s.doJSONArray(res)\n}", "title": "" }, { "docid": "ad448ad2964811a2a2e3eb9f637f4df7", "score": "0.64633095", "text": "func GetList(leagueURL string) (string, error) {\n\tif val, hasValue := cache.Get(\"GetList\" + leagueURL); hasValue {\n\t\treturn val, nil\n\t}\n\tparticipants, err := GetParticipants(leagueURL)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", err\n\t}\n\n\tvar res string\n\tfor _, p := range participants {\n\t\tres += fmt.Sprintf(`%v. <a href=\"%v\">%v</a> | <a href=\"%v\">%v</a> | %v | %v`, p.Pos, p.TeamURL, p.Team, p.ProfileURL, p.Name, p.TourPoints, p.TotalPoints)\n\t\tres += \"\\n\"\n\t}\n\n\tcache.Add(\"GetList\"+leagueURL, res)\n\n\treturn res, err\n}", "title": "" }, { "docid": "3dbe2fb9f059ff3ace5d5cdd86189b7a", "score": "0.6431386", "text": "func (c *retryClient) GetToList(ctx context.Context, key string, opts storage.ListOptions, listObj runtime.Object) error {\n\treturn onError(ctx, defaultRetry, isRetriableEtcdError, func() error {\n\t\treturn c.Interface.GetToList(ctx, key, opts, listObj)\n\t})\n}", "title": "" }, { "docid": "58ad068965178eb749031deb261856b7", "score": "0.6430929", "text": "func Getlist(client *ticketmatic.Client, params *ticketmatic.ContactQuery) (*List, error) {\n\tr := client.NewRequest(\"GET\", \"/{accountname}/contacts\", \"json\")\n\tif params != nil {\n\t\tr.AddParameter(\"filter\", params.Filter)\n\t\tr.AddParameter(\"includearchived\", params.Includearchived)\n\t\tr.AddParameter(\"lastupdatesince\", params.Lastupdatesince)\n\t\tr.AddParameter(\"limit\", params.Limit)\n\t\tr.AddParameter(\"offset\", params.Offset)\n\t\tr.AddParameter(\"orderby\", params.Orderby)\n\t\tr.AddParameter(\"output\", params.Output)\n\t\tr.AddParameter(\"searchterm\", params.Searchterm)\n\t}\n\n\tvar obj *List\n\terr := r.Run(&obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn obj, nil\n}", "title": "" }, { "docid": "5208c727fcaaa85df68eb1aa8a1d90d1", "score": "0.64259374", "text": "func Get() []Todo {\n\treturn list\n}", "title": "" }, { "docid": "92998c20348518711ea4e4e728e51df3", "score": "0.642316", "text": "func (e *ExamCollection) GetList() []string {\n\texamList := []string{}\n\tfor examID := range e.Data {\n\t\texamList = append(examList, strconv.Itoa(int(examID)))\n\t}\n\treturn examList\n}", "title": "" }, { "docid": "9543331fb1aa9907ad15f079ff9e962c", "score": "0.6404265", "text": "func listGetAll(L *lua.LState) int {\n\tlist := checkList(L) // arg 1\n\tall, err := list.GetAll()\n\tif err != nil {\n\t\t// Return an empty table\n\t\tL.Push(L.NewTable())\n\t\treturn 1 // Number of returned values\n\t}\n\tL.Push(strings2table(L, all))\n\treturn 1 // Number of returned values\n}", "title": "" }, { "docid": "5dd3e4fb36538f995dda9d930a0085dc", "score": "0.6398866", "text": "func (r *Repository) GetList(c ...Condition) ([]*User, error) {\n\tq := \"SELECT * FROM %s \"\n\tq = fmt.Sprintf(q, r.tableName)\n\tsq, params := conditionsToQuery(c...)\n\tq = q + sq\n\tq = r.db.Rebind(q)\n\tul := make([]*User, 0)\n\tif err := r.db.Select(&ul, q, params...); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, ErrNotFound\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"get users list\")\n\t}\n\treturn ul, nil\n}", "title": "" }, { "docid": "0df814815207682d3ef61d9160d21f52", "score": "0.63945335", "text": "func (c *Security) GetList(vsys, base string) ([]string, error) {\n c.con.LogQuery(\"(get) list of security policies\")\n path := c.xpath(vsys, base, nil)\n return c.con.EntryListUsing(c.con.Get, path[:len(path) - 1])\n}", "title": "" }, { "docid": "814aa42296794d97e1185746d9ec093b", "score": "0.63894975", "text": "func List(args ...cty.Value) (cty.Value, error) {\n\treturn ListFunc.Call(args)\n}", "title": "" }, { "docid": "670f16af2f7f687eb41004351c6dd50d", "score": "0.63824534", "text": "func (item *Item) List() ([]ItemData, error) {\n\treturn item.List()\n}", "title": "" }, { "docid": "5fa94c95fb7688c99f3af07dab251140", "score": "0.63773495", "text": "func List() ([]string, error) {\n\tgodelw, err := newGodelwRunner()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tproducts, err := godelw.run(\"products\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn strings.Split(products, \"\\n\"), nil\n}", "title": "" }, { "docid": "99a60f361a2c32fd6b964b1dd00c721e", "score": "0.63593805", "text": "func (l *FakeLister) List(r io.Reader, componentName string) ([]params.Entry, error) {\n\treturn l.Entries, l.Err\n}", "title": "" }, { "docid": "cf457324ff573dbed65ee5216cba5eec", "score": "0.6344862", "text": "func (s *BaseGinCrudController) List(c *gin.Context) {\n\tqueryParams, err := s.QueryParametersHydrator.Hydrate(c)\n\tif err != nil {\n\t\ts.HttpReplyGinBindError(c, err)\n\t\treturn\n\n\t}\n\tdata, serr := s.Service.GetList(queryParams)\n\n\tif serr != nil {\n\t\ts.HttpReplyServiceError(c, serr)\n\t\treturn\n\t}\n\n\tif s.ListSerializer != nil {\n\t\ts.CopyAndSendSuccess(c, data, s.ListSerializer)\n\t\treturn\n\t}\n\n\ts.HttpReplySuccess(c, data)\n\n}", "title": "" }, { "docid": "71fb78b4bca6f4a11715e600c99c4144", "score": "0.6339541", "text": "func (s *Str) GetList() []string {\n\tstrList := []string{}\n\tfor i := range s.nodeMap {\n\t\tstrList = append(strList, i)\n\t}\n\treturn strList\n}", "title": "" }, { "docid": "79edb71f574b62c27c4bff0c39811fac", "score": "0.6333648", "text": "func (s *Service) List(c context.Context, arg *model.ArgList) (list []*model.List, err error) {\n\terr = s.client.Call(c, _list, arg, &list)\n\treturn\n}", "title": "" }, { "docid": "c62fee2e5596ec15ae8c9ad8da710dc5", "score": "0.6321792", "text": "func GetUserList(c web.C, w http.ResponseWriter, r *http.Request) {\n\tvar ctx = context.FromC(c)\n\n\tusers, err := datastore.GetUserList(ctx)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tjson.NewEncoder(w).Encode(users)\n}", "title": "" }, { "docid": "de4e02a09a56aec4cbaf1c8e26f6b427", "score": "0.63035405", "text": "func GetObjectList(key string) []string {\n\n\tkeyValue, _ := CBStore.GetList(key, true)\n\n\tvar childIdList []string\n\tfor _, v := range keyValue {\n\t\tchildIdList = append(childIdList, v.Key)\n\t}\n\n\tfmt.Println(\"===============================================\")\n\treturn childIdList\n\n}", "title": "" }, { "docid": "303aa9250ddf9dc9bccb0e164409d414", "score": "0.6270418", "text": "func (s *set) List() []string {\n\tlist := make([]string, 0, len(s.Storage))\n\n\tfor item := range s.Storage {\n\t\tlist = append(list, item)\n\t}\n\n\treturn list\n}", "title": "" }, { "docid": "a57ecc1fc6e8858d266f02177513a5e6", "score": "0.62681603", "text": "func (p *HbaseClient) ScannerGetList(id ScannerID, nbRows int32) (retval296 thrift.TList, io *IOError, ia *IllegalArgument, err error) {\n err = p.SendScannerGetList(id, nbRows)\n if err != nil { return }\n return p.RecvScannerGetList()\n}", "title": "" }, { "docid": "fec4c19cc9452e191020662c529e6074", "score": "0.626437", "text": "func (seq *Sequencer) Get_list(list *utils.List_of_nodes, reply *utils.Empty) error {\n\tvar err error\n\tnodes, _ := strconv.Atoi(os.Getenv(\"NODES\"))\n\n\tseq.peer = make([]*rpc.Client, nodes)\n\n\t// Parse the list and put the addresses into destination array\n\taddr_tmp := strings.Split(list.List_str, \"\\n\")\n\tfor i := 0; i < nodes; i++ {\n\t\tmapping := strings.Split(addr_tmp[i], \";\")\n\t\taddr_node := mapping[0] + \":1234\"\n\t\tseq.peer[i], err = rpc.Dial(\"tcp\", addr_node)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Init timer\n\tseq.timer = time.NewTimer(time.Duration(utils.TIMER_NODE*len(seq.peer)) * time.Second)\n\n\t// Manage connection\n\tgo seq.manage_connection()\n\n\treturn nil\n}", "title": "" }, { "docid": "b73bdb52a7060adfb4a1b36515c21bc7", "score": "0.62593675", "text": "func (in *listentryList) GetItems() []IstioObject {\n\tout := make([]IstioObject, len(in.Items))\n\tfor i := range in.Items {\n\t\tout[i] = &in.Items[i]\n\t}\n\treturn out\n}", "title": "" }, { "docid": "b73bdb52a7060adfb4a1b36515c21bc7", "score": "0.62593675", "text": "func (in *listentryList) GetItems() []IstioObject {\n\tout := make([]IstioObject, len(in.Items))\n\tfor i := range in.Items {\n\t\tout[i] = &in.Items[i]\n\t}\n\treturn out\n}", "title": "" }, { "docid": "bde26b218bee4e6be4f3c37c5f74f175", "score": "0.62549174", "text": "func (c *CaptureClient) GetList(ctx context.Context, paymentID string) ([]Capture, error) {\n\tvar captures []Capture\n\tif err := c.Caller.Call(ctx, \"GET\", c.capturesPath(paymentID), nil, nil, &captures); err != nil {\n\t\treturn nil, err\n\t}\n\treturn captures, nil\n}", "title": "" }, { "docid": "5a0e445858fd8e8a071d178dbd241f0f", "score": "0.6249046", "text": "func (con *Controller) List(webInput interceptor.WebInput) apihandler.ResponseEntity {\n\tctx := webInput.Context.Ctx\n\n\t// set param\n\tvar listReqVo ListReqVo\n\tif err := paramhandler.Set(webInput.Context, &listReqVo); err != nil {\n\t\treturn responseEntity.Error(ctx, api.FormatError, err)\n\t}\n\n\tbucketName, _ := con.userDao.GetBucketName(webInput.Payload.Acc)\n\tprefix, _ := url.QueryUnescape(listReqVo.Prefix)\n\tobjectList := minio.ListObjects(bucketName, prefix, false)\n\n\treturn responseEntity.OK(ctx, objectList)\n}", "title": "" }, { "docid": "e3eb8621884bc8b38f584b19b4e4c7a3", "score": "0.62454355", "text": "func (s *UintSync) GetList() []uint {\n\ts.RLock()\n\tdefer s.RUnlock()\n\tnums := []uint{}\n\tfor i := range s.nodeMap {\n\t\tnums = append(nums, i)\n\t}\n\treturn nums\n}", "title": "" }, { "docid": "f76bc46fcffd4581b876cb4eeb886878", "score": "0.6245418", "text": "func (v *Client) List(path string) ([]string, error) {\n\tret := []string{}\n\n\tquery := url.Values{}\n\tquery.Add(\"list\", \"true\")\n\terr := v.doRequest(\"GET\", path, query, &vaultResponse{\n\t\tData: &struct {\n\t\t\tKeys *[]string `json:\"keys\"`\n\t\t}{\n\t\t\tKeys: &ret,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ret, err\n}", "title": "" }, { "docid": "b0d7e18e0351ad804f600972d9bf72b1", "score": "0.6244731", "text": "func (wx *PeopleAPI) GetList(req *restful.Request, rsp *restful.Response) {\n\tlog.Print(\"Received PeopleAPI.GetList API request\")\n\n\tvar status int64 = -1\n\tvar msg interface{}\n\n\tip := req.Request.Header.Get(\"X-Real-IP\")\n\tfmt.Println(ip)\n\n\t// get param\n\tlistReq := new(proto.GetListReq)\n\t// read request data\n\terr := req.ReadEntity(listReq)\n\tfmt.Println(listReq)\n\tif err != nil {\n\t\tmsg = \"invalid post data\"\n\t} else {\n\t\t// mongo\n\t\tsession, err := mgo.Dial(\"mongodb://mongo.techzto.svc.cluster.local\")\n\t\tif err != nil {\n\t\t\tmsg = err.Error()\n\t\t}\n\t\tdefer session.Close()\n\t\tsession.SetMode(mgo.Monotonic, true)\n\t\tc := session.DB(\"ngbook\").C(\"people\")\n\t\tresult := []proto.People{}\n\t\tstart := int(listReq.Start)\n\t\tlimit := int(listReq.PageSize)\n\t\terr = c.Find(nil).Skip(start).Limit(limit).All(&result)\n\t\tif err != nil {\n\t\t\tmsg = err.Error()\n\t\t} else {\n\t\t\tstatus = 200\n\t\t\tdata := map[string]interface{}{\n\t\t\t\t\"list\": result,\n\t\t\t\t\"start\": start,\n\t\t\t\t\"end\": start + len(result),\n\t\t\t\t\"total\": 0,\n\t\t\t}\n\n\t\t\t// get total\n\t\t\ttotal, err := c.Count()\n\t\t\tif err != nil {\n\t\t\t\tmsg = err.Error()\n\t\t\t} else {\n\t\t\t\tdata[\"total\"] = total\n\t\t\t\tmsg = data\n\t\t\t}\n\t\t}\n\t}\n\tnet.InitRsp(status, rsp, msg)\n}", "title": "" }, { "docid": "422caa2387c79b9118210cb1b97048fe", "score": "0.6237054", "text": "func List(ctx context.Context, client *selvpcclient.ServiceClient) ([]*User, *selvpcclient.ResponseResult, error) {\n\turl := strings.Join([]string{client.Endpoint, resourceURL}, \"/\")\n\tresponseResult, err := client.DoRequest(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif responseResult.Err != nil {\n\t\treturn nil, responseResult, responseResult.Err\n\t}\n\n\t// Extract users from the response body.\n\tvar result struct {\n\t\tUsers []*User `json:\"users\"`\n\t}\n\terr = responseResult.ExtractResult(&result)\n\tif err != nil {\n\t\treturn nil, responseResult, err\n\t}\n\n\treturn result.Users, responseResult, nil\n}", "title": "" }, { "docid": "1b24dca9702f01b777c974e5ced07bdb", "score": "0.6235584", "text": "func (api *API) GetList(ctx context.Context, rc *ResourceContainer, listID string) (List, error) {\n\tif rc.Identifier == \"\" {\n\t\treturn List{}, ErrMissingAccountID\n\t}\n\n\tif listID == \"\" {\n\t\treturn List{}, ErrMissingListID\n\t}\n\n\turi := fmt.Sprintf(\"/accounts/%s/rules/lists/%s\", rc.Identifier, listID)\n\tres, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn List{}, err\n\t}\n\n\tresult := ListResponse{}\n\tif err := json.Unmarshal(res, &result); err != nil {\n\t\treturn List{}, fmt.Errorf(\"%s: %w\", errUnmarshalError, err)\n\t}\n\n\treturn result.Result, nil\n}", "title": "" }, { "docid": "66bea0066526a2e855c3f71e41cc274d", "score": "0.6231786", "text": "func (m *MockHbase) ScannerGetList(id ScannerID, nbRows int32) ([]*TRowResult_, error) {\n\targs := m.Called(id, nbRows)\n\treturn args.Get(0).([]*TRowResult_), args.Error(1)\n}", "title": "" }, { "docid": "bdba3d1b53d533ef9208e1594e82746a", "score": "0.6228676", "text": "func (s *Server) HandleGetList(w http.ResponseWriter, r *http.Request) {\n\truid := GetRUID(r.Context())\n\turi := GetURI(r.Context())\n\t_, credentials, _ := r.BasicAuth()\n\tlog.Debug(\"handle.get.list\", \"ruid\", ruid, \"uri\", uri)\n\tgetListCount.Inc(1)\n\n\t// ensure the root path has a trailing slash so that relative URLs work\n\tif uri.Path == \"\" && !strings.HasSuffix(r.URL.Path, \"/\") {\n\t\thttp.Redirect(w, r, r.URL.Path+\"/\", http.StatusMovedPermanently)\n\t\treturn\n\t}\n\n\taddr, err := s.api.Resolve(r.Context(), uri.Addr)\n\tif err != nil {\n\t\tgetListFail.Inc(1)\n\t\trespondError(w, r, fmt.Sprintf(\"cannot resolve %s: %s\", uri.Addr, err), http.StatusNotFound)\n\t\treturn\n\t}\n\tlog.Debug(\"handle.get.list: resolved\", \"ruid\", ruid, \"key\", addr)\n\n\tlist, err := s.api.GetManifestList(r.Context(), s.api.Decryptor(r.Context(), credentials), addr, uri.Path)\n\tif err != nil {\n\t\tgetListFail.Inc(1)\n\t\tif isDecryptError(err) {\n\t\t\tw.Header().Set(\"WWW-Authenticate\", fmt.Sprintf(\"Basic realm=%q\", addr.String()))\n\t\t\trespondError(w, r, err.Error(), http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\t\trespondError(w, r, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// if the client wants HTML (e.g. a browser) then render the list as a\n\t// HTML index with relative URLs\n\tif strings.Contains(r.Header.Get(\"Accept\"), \"text/html\") {\n\t\tw.Header().Set(\"Content-Type\", \"text/html\")\n\t\terr := TemplatesMap[\"bzz-list\"].Execute(w, &htmlListData{\n\t\t\tURI: &api.URI{\n\t\t\t\tScheme: \"bzz\",\n\t\t\t\tAddr: uri.Addr,\n\t\t\t\tPath: uri.Path,\n\t\t\t},\n\t\t\tList: &list,\n\t\t})\n\t\tif err != nil {\n\t\t\tgetListFail.Inc(1)\n\t\t\tlog.Error(fmt.Sprintf(\"error rendering list HTML: %s\", err))\n\t\t}\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(&list)\n}", "title": "" }, { "docid": "ab9055c283836a15c41701940cc0d077", "score": "0.6209719", "text": "func (s *NoOp) List() (ids []string, err error) { return nil, nil }", "title": "" }, { "docid": "6debec8f03ccf308ff06485ae440d928", "score": "0.6200926", "text": "func (s service) List(ctx context.Context) ([]Product, error) {\n\titems, err := s.repo.Query(ctx, 0, MaxLIstLimit)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Can not find a list of products by ctx\")\n\t}\n\treturn items, nil\n}", "title": "" }, { "docid": "704eae71a034c5c1297707d1c0910137", "score": "0.6193967", "text": "func GetSPList() {\n\tutils.DebugLog(\"SendMessage(client.SPConn, req, header.ReqGetSPList)\")\n\tSendMessageToSPServer(types.ReqGetSPlistData(), header.ReqGetSPList)\n}", "title": "" }, { "docid": "3ae796cd5827e563e06aca9bd5f355ac", "score": "0.61930954", "text": "func (q *queue) GetList() *list.List {\n\treturn q.list\n}", "title": "" }, { "docid": "69769b6ab679f78ce3be4aa795ce0091", "score": "0.61824876", "text": "func (dao *KeyDAO) GetList(limit int, offset int, conditions bson.M, sortData []string) ([]models.Key, error) {\n\tsession := dao.Session.Copy()\n\tdefer session.Close()\n\n\titems := []models.Key{}\n\n\t// for case insensitive sort\n\tcollation := &mgo.Collation{\n\t\tLocale: \"en\",\n\t\tStrength: 2,\n\t}\n\n\terr := session.DB(\"\").C(dao.Collection).\n\t\tFind(conditions).\n\t\tCollation(collation).\n\t\tSort(sortData...).\n\t\tLimit(limit).\n\t\tSkip(offset).\n\t\tAll(&items)\n\n\treturn items, err\n}", "title": "" }, { "docid": "88d6dca1ff9e304e1009eeb9441faff5", "score": "0.6147822", "text": "func (s *etcdBackend) list(ctx context.Context, key string, listObj runtime.Object) error {\n\tlistPtr, err := meta.GetItemsPtr(listObj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkey = path.Join(s.pathPrefix, key, api.NamespaceSystem)\n\tif !strings.HasSuffix(key, \"/\") {\n\t\tkey += \"/\"\n\t}\n\tgetResp, err := s.client.KV.Get(ctx, key, clientv3.WithPrefix())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\telems := make([][]byte, len(getResp.Kvs))\n\tfor i, kv := range getResp.Kvs {\n\t\telems[i] = kv.Value\n\t}\n\treturn decodeList(elems, listPtr, s.decoder)\n}", "title": "" }, { "docid": "25a7f3cb126d3c2b95310390344ff9a4", "score": "0.6145057", "text": "func (v *ValueID) GetListItems() ([]string, error) {\n\treturn GetValueListItems(v.HomeID, v.ID)\n}", "title": "" }, { "docid": "b8e70a67ece84f2dc38332ebb8f6637d", "score": "0.6141946", "text": "func (r *REST) List(ctx context.Context, options *internalversion.ListOptions) (runtime.Object, error) {\n\tklog.Infof(\"limit %d,continue %s\", options.Limit, options.Continue)\n\t//将continue字段当做分页的起始位置\n\tvar offset int64\n\tvar err error\n\tif options.Continue != \"\" {\n\t\toffset, err = strconv.ParseInt(options.Continue, 10, 64)\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"continue 字段必须为整数\")\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tresult := &unstructured.UnstructuredList{}\n\tresult.SetAPIVersion(\"v1\")\n\tresult.SetKind(\"List\")\n\tnamespace := request.NamespaceValue(ctx)\n\tdataList, err := r.bcsStorage.ListResources(r.config.MemberCluster, namespace, \"\", r.kind, options.Limit, offset)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, data := range dataList {\n\t\t// set kind and apiversion\n\t\tresObj := map[string]interface{}{}\n\t\terr := json.Unmarshal(data.Data, &resObj)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresObj[\"kind\"] = r.kind\n\t\tresObj[\"apiVersion\"] = r.version\n\t\tresult.Items = append(result.Items, unstructured.Unstructured{Object: resObj})\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "35c44c082bb624ebbc539d74dc1adde7", "score": "0.6140048", "text": "func (h *Pulse) List(ctx context.Context, ns string) ([]runtime.Object, error) {\n\treturn nil, fmt.Errorf(\"NYI\")\n}", "title": "" }, { "docid": "a6e7386bd86e52aece7dbd965c3b09d0", "score": "0.6135298", "text": "func (s *Service) ListGetAllElements(key string) ([][]byte, error) {\n\tconn := s.rdb.Get()\n\tdefer conn.Close()\n\n\tentries, err := redis.ByteSlices(conn.Do(\"LRANGE\", key, 0, -1))\n\tif err != nil {\n\t\tif err == redis.ErrNil {\n\t\t\treturn nil, ErrNotFound\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"error while poping data from redis: %v\", err)\n\t}\n\n\tlog.Printf(\"Getting from redis: %s\\n\", key)\n\treturn entries, nil\n}", "title": "" }, { "docid": "13a4c3a2e49b9e08453ae123d675772b", "score": "0.6134487", "text": "func (r *SiteListsCollectionRequest) Get(ctx context.Context) ([]List, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "7a01a3235464db6d8e7b7f921d93281f", "score": "0.61323017", "text": "func (in *apikeyList) GetItems() []IstioObject {\n\tout := make([]IstioObject, len(in.Items))\n\tfor i := range in.Items {\n\t\tout[i] = &in.Items[i]\n\t}\n\treturn out\n}", "title": "" }, { "docid": "7a01a3235464db6d8e7b7f921d93281f", "score": "0.61323017", "text": "func (in *apikeyList) GetItems() []IstioObject {\n\tout := make([]IstioObject, len(in.Items))\n\tfor i := range in.Items {\n\t\tout[i] = &in.Items[i]\n\t}\n\treturn out\n}", "title": "" }, { "docid": "1b33b161a8f26a031090cfd4fa3a7c6d", "score": "0.6130366", "text": "func (c *Client) List(ctx context.Context) ([]AccountResponse, error) {\n\treq, err := c.Client.NewRequest(ctx, http.MethodGet, basePath, \"\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tns := []AccountResponse{}\n\terr = c.Client.Do(req, &ns)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ns, nil\n}", "title": "" }, { "docid": "118d6a9e11adfbf59baf76093ecafa23", "score": "0.6122849", "text": "func (user *PfUserS) GetList(ctx PfCtx, search string, offset int, max int, exact bool) (users []PfUser, err error) {\n\tusers = nil\n\n\t/* The fields we match on */\n\tmatches := []string{\"ident\", \"me.email\", \"descr\", \"affiliation\", \"bio_info\", \"d.value\"}\n\n\tvar p []string\n\tvar t []DB_Op\n\tvar v []interface{}\n\n\tfor _, m := range matches {\n\t\tp = append(p, m)\n\t\tt = append(t, DB_OP_ILIKE)\n\n\t\tif exact {\n\t\t\tv = append(v, search)\n\t\t} else {\n\t\t\tv = append(v, \"%\"+search+\"%\")\n\t\t}\n\t}\n\n\tj := \"INNER JOIN member_email me ON member.ident = me.member \" +\n\t\t\"LEFT OUTER JOIN member_details d ON d.member = member.ident\"\n\n\to := \"GROUP BY member.ident \" +\n\t\t\"ORDER BY member.ident\"\n\n\tobjs, err := StructFetchMulti(ctx.NewUserI, \"member\", j, DB_OP_OR, p, t, v, o, offset, max)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t/* Get the groups these folks are in */\n\tfor _, o := range objs {\n\t\tu := o.(PfUser)\n\t\tusers = append(users, u)\n\t}\n\n\treturn users, err\n}", "title": "" }, { "docid": "e014a1c8e010263107d171801f530a1a", "score": "0.61210966", "text": "func List(ctx context.Context, i listRequest) (*ListResponse, error) {\n\tclient, err := New(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.List(ctx, i)\n}", "title": "" }, { "docid": "4f0bf85043c02d5eff6b9b8f085c51ff", "score": "0.6119081", "text": "func (r *MongoRepository) GetList() ([]*Payment, error) {\n\tlist := make([]*Payment, 0)\n\terr := r.col.Find(nil).Sort(\"_id\").All(&list)\n\treturn list, err\n}", "title": "" }, { "docid": "86f1e3517763df1f8cbede64bf8d9bb9", "score": "0.61107695", "text": "func (env *Env) GetList(key string) []string {\n\tsval := env.Get(key)\n\tif sval == \"\" {\n\t\treturn nil\n\t}\n\tl := make([]string, 0, 1)\n\tif err := json.Unmarshal([]byte(sval), &l); err != nil {\n\t\tl = append(l, sval)\n\t}\n\treturn l\n}", "title": "" }, { "docid": "01ea71637e6cfdf6769abd22efe905ab", "score": "0.61079234", "text": "func (f FakeServiceCatalogInteractor) List() (*ServiceCatalogEntryList, error) {\n\treturn f.ListRet, nil\n}", "title": "" }, { "docid": "aa951775444822a9a24ad0908a5a381c", "score": "0.6107316", "text": "func (is *Items) List(c echo.Context) error {\n\tc.Set(\"handler_method\", \"List\")\n\n\treturn c.JSON(http.StatusOK, models.GetAllFilteredItems(c.QueryParam(\"category\")))\n}", "title": "" }, { "docid": "e9bc122474dade1576ccb66c9fd3cc52", "score": "0.6106478", "text": "func GetListHandler(c echo.Context) error {\n\n\tresult := getResult()\n\n\treturn c.JSON(http.StatusOK, result)\n}", "title": "" }, { "docid": "cc8e1cc68ffc7a0d264f5416c6c5ffe9", "score": "0.6105311", "text": "func (c *channel) GetUsers(list []string) []string {\n c.lockUsers.Lock()\n for k := range c.users {\n list = append(list, k)\n }\n c.lockUsers.Unlock()\n\n return list\n}", "title": "" }, { "docid": "bdda30e5163d221f4ffad301da367119", "score": "0.6095694", "text": "func GetPurchaseList(c echo.Context) error {\n itemID := c.Param(\"itemId\")\n\n list := txtdb.GetPurchaseList(itemID)\n\n\treturn c.JSON(http.StatusOK, list)\n}", "title": "" }, { "docid": "407347f27b3e176a3ccca67c27d4c70b", "score": "0.60890657", "text": "func GetItems(listURL []string) (ret []Item, err error) {\n\tfor _, url := range listURL {\n\t\titem, err := GetItem(url)\n\t\tif err != nil {\n\t\t\tret = append(ret, Item{})\n\t\t} else {\n\t\t\tret = append(ret, item)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "96b0df78f01b59d5a7ad8c77b3f9a9d0", "score": "0.6068556", "text": "func (c *Client) doList(trailingUri string) (*KVResults, error) {\n\tresp, err := c.doRequest(\"GET\", trailingUri, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\t// If the request ended in error then read the body into an\n\t// OrchestrateError object.\n\tif resp.StatusCode != 200 {\n\t\treturn nil, newError(resp)\n\t}\n\n\t// Decode the returned JSON into the results.\n\tdecoder := json.NewDecoder(resp.Body)\n\tresult := new(KVResults)\n\tif err := decoder.Decode(result); err != nil {\n\t\treturn result, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "ab195acc5ed785e51f7336d09414c443", "score": "0.60627574", "text": "func GETListHandler(\n\tcmgr crud.MgrI,\n) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar errRender error\n\t\tdefer func() {\n\t\t\tif errRender != nil {\n\t\t\t\tlog.Fatalf(\"GETListHandler Render: %v\", errRender)\n\t\t\t}\n\t\t}()\n\n\t\tes, errGL := cmgr.GetList(\n\t\t\tr.Context(),\n\t\t\tListModifiersFromURL(r.URL),\n\t\t)\n\t\tif errGL != nil {\n\t\t\terrRender = render.Render(w, r, cmgr.MapErrorToHTTPError(errGL))\n\t\t\treturn\n\t\t}\n\n\t\trender.DefaultResponder(w, r, es)\n\t}\n}", "title": "" }, { "docid": "4bbbf7f05cd537d5117476cbb2236469", "score": "0.6060544", "text": "func (tree *Tree4) List() []entry {\n\treturn tree.list\n}", "title": "" }, { "docid": "89e48e5a96134d034fb86223cdf376ef", "score": "0.60545176", "text": "func (in *fluentdList) GetItems() []IstioObject {\n\tout := make([]IstioObject, len(in.Items))\n\tfor i := range in.Items {\n\t\tout[i] = &in.Items[i]\n\t}\n\treturn out\n}", "title": "" }, { "docid": "ede6dcee5e3e53bf1984c1619237eb8c", "score": "0.60378283", "text": "func (in *stdioList) GetItems() []IstioObject {\n\tout := make([]IstioObject, len(in.Items))\n\tfor i := range in.Items {\n\t\tout[i] = &in.Items[i]\n\t}\n\treturn out\n}", "title": "" }, { "docid": "1c7f4b094f9aa1922f6172eaa4117050", "score": "0.6033865", "text": "func (s *ItemsEndpoint) List(ctx context.Context, division int, all bool, o *api.ListOptions) ([]*Items, error) {\n\tvar entities []*Items\n\tu, _ := s.client.ResolvePathWithDivision(\"/api/v1/{division}/logistics/Items\", division) // #nosec\n\tapi.AddListOptionsToURL(u, o)\n\n\tif all {\n\t\terr := s.client.ListRequestAndDoAll(ctx, u.String(), &entities)\n\t\treturn entities, err\n\t}\n\t_, _, err := s.client.NewRequestAndDo(ctx, \"GET\", u.String(), nil, &entities)\n\treturn entities, err\n}", "title": "" }, { "docid": "99fc2dcb16b3d969d3676568b06a0d9a", "score": "0.60297126", "text": "func (s *ThreadSafeSet) List() []interface{} {\n\ts.l.RLock()\n\tdefer s.l.RUnlock()\n\n\tlist := make([]interface{}, 0, len(s.m))\n\n\tfor item := range s.m {\n\t\tlist = append(list, item)\n\t}\n\n\treturn list\n}", "title": "" }, { "docid": "49217089f4d0d834ed9cbf301fe384a6", "score": "0.6028376", "text": "func (m *Company) GetItems()([]Itemable) {\n val, err := m.GetBackingStore().Get(\"items\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]Itemable)\n }\n return nil\n}", "title": "" }, { "docid": "9eb13f85a4f4630ba9ab1be4ef5b7161", "score": "0.60271776", "text": "func (store *Store) List(actorId types.ActorId) []tokenListItem {\n\tstore.mu.RLock()\n\n\tvar (\n\t\ttokens = store.itemsByActorId[actorId]\n\t\tout = make([]tokenListItem, len(tokens))\n\t)\n\n\tfor i := 0; i < len(tokens); i++ {\n\t\ttoken := tokens[i]\n\t\tout[i] = tokenListItem{\n\t\t\tToken: token,\n\t\t\tTokenMetadata: store.items[token],\n\t\t}\n\t}\n\n\tstore.mu.RUnlock()\n\n\treturn out\n}", "title": "" }, { "docid": "bd7e93819369559cfd2fdf0c44be8954", "score": "0.60248435", "text": "func (s *Store) getList(path string) *List {\n\tfor _, tl := range s.toWrite {\n\t\tif tl.path == path {\n\t\t\treturn tl.ls\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "021b9bf580d2bc4a4447a45386c5ef50", "score": "0.6022427", "text": "func (c *Collection) List() (resources Resources) {\n\tfor c.Next() {\n\t\tresources = append(resources, c.Item())\n\t}\n\treturn\n}", "title": "" }, { "docid": "7e0acd2e466dbb4fe3a2155b08f9e13d", "score": "0.601887", "text": "func ListAll(ctx context.Context, doRequest DoRequestFunc, url string, items interface{}) error {\n\titemsType := reflect.TypeOf(items)\n\tif itemsType.Kind() != reflect.Ptr || itemsType.Elem().Kind() != reflect.Slice {\n\t\treturn fmt.Errorf(\"items should be a pointer to a slice, but got %v\", itemsType)\n\t}\n\n\tallItems := reflect.MakeSlice(itemsType.Elem(), 0, 0)\n\titer := ListIterator{\n\t\tURL: url,\n\t\tDoRequest: doRequest,\n\t}\n\tmore := true\n\tfor more {\n\t\tvar err error\n\t\tpageSlice := reflect.New(itemsType.Elem())\n\t\tmore, _, err = iter.Next(ctx, pageSlice.Interface(), -1)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tallItems = reflect.AppendSlice(allItems, pageSlice.Elem())\n\t}\n\treflect.ValueOf(items).Elem().Set(allItems)\n\treturn nil\n}", "title": "" } ]
6b65c75e6c533004bfea6a8103049282
Deprecated: Use OneOfDeepRequest_Outer_Second.ProtoReflect.Descriptor instead.
[ { "docid": "76e2e16479956e676bc415d25106a2ed", "score": "0.77526957", "text": "func (*OneOfDeepRequest_Outer_Second) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{4, 0, 2}\n}", "title": "" } ]
[ { "docid": "9a5d2c6202dbdbd2d2a7dcbbab7bd043", "score": "0.7617516", "text": "func (*OneOfDeepRequest_Outer_Middle_Inner_Second) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{4, 0, 0, 0, 1}\n}", "title": "" }, { "docid": "373affa674ccd255f359501d0d119f13", "score": "0.7309653", "text": "func (*OneOfRequest_Second) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{3, 1}\n}", "title": "" }, { "docid": "a42e38ce3a5d05f6087872d87dbf082c", "score": "0.690523", "text": "func (*OneOfDeepRequest_Outer_Middle_Inner_First) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{4, 0, 0, 0, 0}\n}", "title": "" }, { "docid": "8f1b90e7164c1e7e625a1e5161fb979e", "score": "0.68667513", "text": "func (*OneOfDeepRequest_Outer_Middle_Inner) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{4, 0, 0, 0}\n}", "title": "" }, { "docid": "7f49918e4472a7923bdcc00499608f84", "score": "0.6803242", "text": "func (*OneOfDeepRequest_Outer_First) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{4, 0, 1}\n}", "title": "" }, { "docid": "7c24d17bd20641183963678399daec0d", "score": "0.6796663", "text": "func (*DeepRequest_Outer_Middle_Inner) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{2, 0, 0, 0}\n}", "title": "" }, { "docid": "1fcd56a553da2aa7c703767fe0ef0ead", "score": "0.6776324", "text": "func (*OneOfDeepRequest_Outer) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{4, 0}\n}", "title": "" }, { "docid": "17d8d41e7498fcc07504214bb31b82c4", "score": "0.67117095", "text": "func (*NestedRequest_Inner) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "6d21e1ef2f498532af92ba83ec66868d", "score": "0.6683999", "text": "func (*DeepRequest_Outer) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{2, 0}\n}", "title": "" }, { "docid": "453c367c9e4b07e955b8cfc9ea92e3ad", "score": "0.66276026", "text": "func (*OneOfDeepRequest_Outer_Middle_Inner_Third) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{4, 0, 0, 0, 2}\n}", "title": "" }, { "docid": "33239f8a31bfb9b2243995f35c950431", "score": "0.65491843", "text": "func (*DeepRequest) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6ab70861a59f69eed3fc0d33dec2510f", "score": "0.6547978", "text": "func (*OneOfDeepRequest) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "f7254f08601e89166c39342ef43d5b8b", "score": "0.6544093", "text": "func (*OneOfDeepRequest_Outer_Third) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{4, 0, 3}\n}", "title": "" }, { "docid": "1c9bb767b6e198b308458c31b5eafd1a", "score": "0.6478393", "text": "func (x *fastReflection_NestedMessage) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_NestedMessage\n}", "title": "" }, { "docid": "ded0c75c2c9d527f0ed8766682e0540d", "score": "0.6461467", "text": "func (*MyOneOfMsg_SecondType) Descriptor() ([]byte, []int) {\n\treturn file_valtest_proto_rawDescGZIP(), []int{16, 1}\n}", "title": "" }, { "docid": "2046ba609e929219c0acfe258fc74489", "score": "0.64101714", "text": "func (*NestedRequest) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "06db3f1711cba24302a8234d513c8b5d", "score": "0.6338876", "text": "func (*OneOfDeepRequest_Outer_Middle) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{4, 0, 0}\n}", "title": "" }, { "docid": "7c131eab3ef8ba1fae17f1e8ab1647db", "score": "0.63300014", "text": "func (*P2PGetPeerReq) Descriptor() ([]byte, []int) {\n\treturn file_p2p_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "52c81e3ddc6cd73649d6c9b57a3bbb40", "score": "0.6281882", "text": "func (*Nested) Descriptor() ([]byte, []int) {\n\treturn file_tests_api_hello_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "a89f53a8b8918b05d717d3d8fd0d16a4", "score": "0.6262458", "text": "func (*DeepRequest_Outer_Middle) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{2, 0, 0}\n}", "title": "" }, { "docid": "cc043c1970013d7b20e515753e7fadec", "score": "0.62249684", "text": "func (*NestedLevel2Message) Descriptor() ([]byte, []int) {\n\treturn file_valtest_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "bf1fa13ad35e48e067a29a11ee3c5f27", "score": "0.6191359", "text": "func (*OneOfRequest_First) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{3, 0}\n}", "title": "" }, { "docid": "ec3e4d505ee0f2f102a8d4321f126dc0", "score": "0.6144811", "text": "func (*ValTestMessage_NestedMessage_InnerNestedMessage) Descriptor() ([]byte, []int) {\n\treturn file_valtest_proto_rawDescGZIP(), []int{0, 0, 0}\n}", "title": "" }, { "docid": "49ef7aa9d5e0da06c2222326cfca734c", "score": "0.61433285", "text": "func (*UpdateTwoWordRequest) Descriptor() ([]byte, []int) {\n\treturn file_entpb_entpb_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "27f6f5de29a4a4d73ee3c6178cdabb88", "score": "0.6137402", "text": "func (*OneOfRequest_Third) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{3, 2}\n}", "title": "" }, { "docid": "f6cb6a640b175e811a05f73e5332a475", "score": "0.61118925", "text": "func (desc *immutable) DescriptorProto() *descpb.Descriptor {\n\treturn &descpb.Descriptor{\n\t\tUnion: &descpb.Descriptor_Schema{\n\t\t\tSchema: &desc.SchemaDescriptor,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "34443f64908056d5a34d7dbb428fab13", "score": "0.61040485", "text": "func (*NetworksUpdatePeeringRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{306}\n}", "title": "" }, { "docid": "b2d9da7210a8e83625185a42f726e624", "score": "0.6087645", "text": "func (*PatchFirewallRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{631}\n}", "title": "" }, { "docid": "1d32069635e7e62cacad14e3daa150f5", "score": "0.6075226", "text": "func (*UpdatePeeringNetworkRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{815}\n}", "title": "" }, { "docid": "e0a532b900b0cc5de6f0b41f6daaa3c1", "score": "0.6063713", "text": "func (*DualProofV2) Descriptor() ([]byte, []int) {\n\treturn file_schema_proto_rawDescGZIP(), []int{31}\n}", "title": "" }, { "docid": "db527acc00b283b8fb33b8ba497e8998", "score": "0.6058185", "text": "func (*ValTestMessage_NestedMessage) Descriptor() ([]byte, []int) {\n\treturn file_valtest_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "9021442f3598bcc32d5073d93e1d63f3", "score": "0.6055965", "text": "func (*OuterMessageUsingNestedMessage) Descriptor() ([]byte, []int) {\n\treturn file_valtest_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "6c18d626b0a01387ef116ca4015bbc84", "score": "0.6052101", "text": "func (*UpdateFirewallRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{632}\n}", "title": "" }, { "docid": "388538939635de6b60c5c79d483d1552", "score": "0.6033465", "text": "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha2_permission_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "8b7cba08d40901e71ff1dc5d0754eb1c", "score": "0.60263765", "text": "func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryParamsRequest\n}", "title": "" }, { "docid": "e43d5cc297f4e8c35b4fbfe2a8a76d93", "score": "0.6025482", "text": "func (*PeersRequest) Descriptor() ([]byte, []int) {\n\treturn file_p2p_rpc_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "08066fd4e5bd0296c407b3cc2b01ff40", "score": "0.6015602", "text": "func (x *fastReflection_QueryValidatorSlashesRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryValidatorSlashesRequest\n}", "title": "" }, { "docid": "6d62492529d5ab9ce94ea12a6383cf7f", "score": "0.6004294", "text": "func (*GetTwoWordRequest) Descriptor() ([]byte, []int) {\n\treturn file_entpb_entpb_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "0639b48364618129ef36f76962191d8f", "score": "0.60017645", "text": "func (*P2PGetPeerInfo) Descriptor() ([]byte, []int) {\n\treturn file_p2p_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "8d126e9902f535dffd0e1afa0bca8b9e", "score": "0.59853315", "text": "func (*UpdateTokenReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_tokens_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6aafdfdbef099b0184ed26c0c04b5566", "score": "0.5978679", "text": "func (*Peer) Descriptor() ([]byte, []int) {\n\treturn file_p2p_proto_rawDescGZIP(), []int{31}\n}", "title": "" }, { "docid": "b0293a698c3a75ad001ab89989a32534", "score": "0.59731126", "text": "func (*GetHelloWorldRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_rifqiakrm_go_microservice_proto_another_another_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "e2884dc4e1300b27f85d120148622e13", "score": "0.5972899", "text": "func (*AddFriendReq) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_service_messageService_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "5c77b13de39532cdde9b725ac0aa520e", "score": "0.5970962", "text": "func (*InnerGameInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_InnerGameInfo_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "45883cc5ba0483a4d8c86e150b12ee32", "score": "0.59698945", "text": "func (*DGRound2Message2) Descriptor() ([]byte, []int) {\n\treturn file_protob_ecdsa_resharing_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "c44c19f08620122d89d6795fd294b500", "score": "0.59693295", "text": "func (*PatchFirewallPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{621}\n}", "title": "" }, { "docid": "cf0fc925318c60c1a2379269b1fcb36a", "score": "0.5965278", "text": "func (*LegacyMessage) Descriptor() ([]byte, []int) {\n\treturn file_protos_p2p_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "6e11591966e51b8407012980905ef3be", "score": "0.5955411", "text": "func (x *fastReflection_GetNodeInfoRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_GetNodeInfoRequest\n}", "title": "" }, { "docid": "c8d1a70a42348bfadec4f4a9e737998e", "score": "0.595534", "text": "func (*TestAllTypes_NestedMessage) Descriptor() ([]byte, []int) {\n\treturn file_internal_testprotos_test3_test_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "6348e6a8db3b6c82d4c9fad0a9855732", "score": "0.5953971", "text": "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_compliance_stats_stats_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "0b616904284c4a2de4a082f95a95f718", "score": "0.594897", "text": "func (*GetPeersRequest) Descriptor() ([]byte, []int) {\n\treturn file_p2p_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a570fa50e5721c767e474500d291896b", "score": "0.59473574", "text": "func (*LastNameRequest) Descriptor() ([]byte, []int) {\n\treturn file_mygrpc_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "994993036422c5c500e2bee6272a254a", "score": "0.5946921", "text": "func (*GetUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_gameServer_grpc_game_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "9fc929c01aa4857ed136e18a61d1d171", "score": "0.594661", "text": "func (*GetFirewallRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{628}\n}", "title": "" }, { "docid": "6a9ef6a08b3622cfea5aa9d6bc4bdf0c", "score": "0.59463483", "text": "func (*NetworkChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_p2p_rpc_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "e4a0e628d949dd4eb89f3bba55f27d40", "score": "0.593807", "text": "func getDescriptorProto(name string) (*google_protobuf.DescriptorProto, error) {\n\tif string(name[0]) == \".\" {\n\t\ts := strings.Split(name, \".\")\n\t\tslen := len(s)\n\t\tfor _, file := range fileDesc.File {\n\t\t\tif file.GetPackage() == s[1] {\n\t\t\t\tfor _, message := range file.MessageType {\n\t\t\t\t\tif message.GetName() == s[2] {\n\t\t\t\t\t\tif slen <= 3 {\n\t\t\t\t\t\t\treturn message, nil\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar m *google_protobuf.DescriptorProto = message\n\n\t\t\t\t\t\tfor i := 3; i < slen; i++ {\n\t\t\t\t\t\t\tfor _, d := range m.GetNestedType() {\n\t\t\t\t\t\t\t\tif d.GetName() == s[i] {\n\t\t\t\t\t\t\t\t\tif i >= slen-1 {\n\t\t\t\t\t\t\t\t\t\treturn d, nil\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tm = d\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"Cannot find message: %s\", name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Cannot find message: %s\", name)\n\t}\n\treturn nil, fmt.Errorf(\"Message name not fully qualified: %s\", name)\n}", "title": "" }, { "docid": "f9f1f5ee162f6b41561788582ae2c6db", "score": "0.59380174", "text": "func (*DeleteTwoWordRequest) Descriptor() ([]byte, []int) {\n\treturn file_entpb_entpb_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "33ab6537e8b34ba3c8b9b036d3c4bee2", "score": "0.5935441", "text": "func (*DGRound3Message2) Descriptor() ([]byte, []int) {\n\treturn file_protob_ecdsa_resharing_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "6809bfd37af33e97d07160412b789e97", "score": "0.5933641", "text": "func (*PatchSubnetworkRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{1041}\n}", "title": "" }, { "docid": "b7f42aa08b9f2d54e413d0177bc81849", "score": "0.59294736", "text": "func (x *fastReflection_GetLatestBlockRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_GetLatestBlockRequest\n}", "title": "" }, { "docid": "8c6952e873c585e8fa5193473766c128", "score": "0.59240586", "text": "func (x *fastReflection_GetLatestValidatorSetRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_GetLatestValidatorSetRequest\n}", "title": "" }, { "docid": "a1d83a8cd9fd24ddb7e300d64f416afc", "score": "0.59209603", "text": "func (*PeerConnectRequest) Descriptor() ([]byte, []int) {\n\treturn file_p2p_rpc_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "9129e0de69ad9cf37ac78e4bfdb5cf04", "score": "0.5915948", "text": "func (*DiscoveryRequest) Descriptor() ([]byte, []int) {\n\treturn file_autopeering_discover_proto_message_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "e43a753d669c3e9f05c9aa3b414fca09", "score": "0.5914014", "text": "func (*GetDiagnosticsInterconnectRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{780}\n}", "title": "" }, { "docid": "93f0791ee7bd289b40b0898b0af84ff9", "score": "0.5912845", "text": "func (*InnerMessageWithLegacyId) Descriptor() ([]byte, []int) {\n\treturn file_valtest_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "97fca738cb5d91396c7f22aa2a228520", "score": "0.5910803", "text": "func (*NestedMessage) Descriptor() ([]byte, []int) {\n\treturn file_testpb_test_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "56f1c3892960d5836c9833a00f5c6433", "score": "0.59078974", "text": "func (*BadMessageKeyTwo) Descriptor() ([]byte, []int) {\n\treturn file_exschemapath_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "5bfabe12119cdaf41dd247c5c22722be", "score": "0.5900676", "text": "func (*PatchSecurityPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{1012}\n}", "title": "" }, { "docid": "760aeffb2c4fc21bb9fc5340642216fb", "score": "0.5891794", "text": "func (x *fastReflection_MsgUpdateClassIssuers) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateClassIssuers\n}", "title": "" }, { "docid": "2a3c328df96f2c1a532c33ae044eeea1", "score": "0.58916473", "text": "func (x *fastReflection_MsgCancel_CancelCredits) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCancel_CancelCredits\n}", "title": "" }, { "docid": "bf02b84d30751dae1af35a79d79674ff", "score": "0.5887931", "text": "func (*InnerMessage) Descriptor() ([]byte, []int) {\n\treturn file_valtest_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "d36bd267a42d73c38a602535800a6bf6", "score": "0.58874303", "text": "func (*OneOfRequest) Descriptor() ([]byte, []int) {\n\treturn file_nested_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "0e40bf2a1f7813bfe0a0b880ec75497c", "score": "0.5881693", "text": "func (*NestedLevel1Message) Descriptor() ([]byte, []int) {\n\treturn file_valtest_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "4297dd21563812de4b94016adf126252", "score": "0.5876959", "text": "func (*GetEffectiveFirewallsInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{737}\n}", "title": "" }, { "docid": "5434c8e477fa5f288bb6bf3f5f77d113", "score": "0.5873066", "text": "func (*ReqRemoveFriend) Descriptor() ([]byte, []int) {\n\treturn file_ex_proto_rawDescGZIP(), []int{334}\n}", "title": "" }, { "docid": "aad83a029c74a44a5eb6bc8db4b88116", "score": "0.5870953", "text": "func (*UpdatePatientDiagnosisRequest) Descriptor() ([]byte, []int) {\n\treturn file_heyrenee_v1_diagnosis_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "50cae865400b29054b01f0d811829075", "score": "0.58700883", "text": "func (x *fastReflection_Validator) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Validator\n}", "title": "" }, { "docid": "e10f1d898c877f707009345c091ad476", "score": "0.5869339", "text": "func (*GetSchmooserRequest) Descriptor() ([]byte, []int) {\n\treturn file_example_services_v1_different_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "78549d156bd5afbaa70b659063043430", "score": "0.5868341", "text": "func (*PatchRuleFirewallPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{622}\n}", "title": "" }, { "docid": "b6cfecbbbec392001e4c2060786a1e88", "score": "0.5859988", "text": "func (*UpdatePolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_gincoinc_adamant_global_v1_adamantglobalv1_global_api_proto_rawDescGZIP(), []int{169}\n}", "title": "" }, { "docid": "e483093024b40eb946c4ed8db0dd52f1", "score": "0.58594346", "text": "func (x *fastReflection_QueryValidatorDistributionInfoRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryValidatorDistributionInfoRequest\n}", "title": "" }, { "docid": "efa757b319a82571c94f32cc21ad8f27", "score": "0.58543795", "text": "func (*Msg2) Descriptor() ([]byte, []int) {\n\treturn file_multiple2_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "c45864bb735ca8aad5cbee6843f3b3c2", "score": "0.58528817", "text": "func (*PeerElement) Descriptor() ([]byte, []int) {\n\treturn file_p2p_rpc_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "d8f621514f0aee7945d3e8e39ee23355", "score": "0.5852488", "text": "func (*WatchPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha2_permission_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "df8e36ffe36348afe54ffc1155f018d9", "score": "0.58429813", "text": "func (*CreateTwoWordRequest) Descriptor() ([]byte, []int) {\n\treturn file_entpb_entpb_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ef9d78fe92b5f9cda0ead2a128552c51", "score": "0.5842186", "text": "func (*AddGrpFriendReq) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_service_messageService_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "3f744e6a0d63bf531b7014f040c5c3cc", "score": "0.58395034", "text": "func (*LongMsgDownReq) Descriptor() ([]byte, []int) {\n\treturn file_longmsg_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "510425d6116e64886ad53599085f4600", "score": "0.58389217", "text": "func (*AddPeeringNetworkRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{805}\n}", "title": "" }, { "docid": "3cf7158ef64c31469118c2b9b46de77b", "score": "0.5838757", "text": "func (*UpdateModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_visualinspection_v1beta1_service_proto_rawDescGZIP(), []int{55}\n}", "title": "" }, { "docid": "3256824aeb7bec10422bdb89c9a39652", "score": "0.583535", "text": "func (*ValidatorPerformanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1alpha1_beacon_chain_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "292673f500e196cf2a12ba561c96b39d", "score": "0.5834583", "text": "func (*SecondFactor) Descriptor() ([]byte, []int) {\n\treturn file_admin_proto_rawDescGZIP(), []int{58}\n}", "title": "" }, { "docid": "4fe1bf072511f1c935d98aaae418df51", "score": "0.5834015", "text": "func (x *fastReflection_ProofOps) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ProofOps\n}", "title": "" }, { "docid": "30fed7b8d029013e4083256f9e8e5d4a", "score": "0.582836", "text": "func (x *fastReflection_MsgAttest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgAttest\n}", "title": "" }, { "docid": "22b08c8c4471ab13470b46ec6dcce4bc", "score": "0.58238155", "text": "func (*PeersRequest) Descriptor() ([]byte, []int) {\n\treturn file_wgrpc_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "f428292262268d489729a23f3df027b9", "score": "0.5821094", "text": "func (*DescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "4b9aec3878c772fcbda84ff3b32cd583", "score": "0.5818095", "text": "func (*NestedLevel3Message) Descriptor() ([]byte, []int) {\n\treturn file_valtest_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "bd533dbe2c84a1af23054f5be1638d2f", "score": "0.5817213", "text": "func (*GetFirewallPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{613}\n}", "title": "" }, { "docid": "3ec99175a1c078dbd7975a54d71f72bb", "score": "0.5813538", "text": "func (*PatchInterconnectRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{783}\n}", "title": "" }, { "docid": "57ab4de6b617a805ec6016add7952497", "score": "0.58115697", "text": "func (*GetPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha2_permission_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b4769c58a96c7561960789e2bc186fce", "score": "0.5810562", "text": "func (*C2S_10002) Descriptor() ([]byte, []int) {\n\treturn file_proto_msg_login_proto_rawDescGZIP(), []int{2}\n}", "title": "" } ]
b112e6b68864821d0bf9170408d2a8dc
HasType returns a boolean if a field has been set.
[ { "docid": "2d809502014b2d68c9783925d8367dea", "score": "0.71977997", "text": "func (o *Zebra) HasType() bool {\n\tif o != nil && !IsNil(o.Type) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "4bba73925c643412cf35df06576f037d", "score": "0.80066836", "text": "func (o *CustomProfileField) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "19293d4f1857d9ecacaf3e228d59d10b", "score": "0.7757526", "text": "func (o *RequestTextFieldUpdateField) HasType() bool {\n\tif o != nil && !IsNil(o.Type) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "50c3094ab3f1b0eec491daecdb748c6d", "score": "0.7704321", "text": "func (f *FreeTextDefinition) HasType() bool {\n\tif f != nil && f.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f689454806d1036a585bd9d1a59227ad", "score": "0.76927656", "text": "func (o *ViewUser) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "22e0f34b0bde5c53103c3358cf197d62", "score": "0.7638171", "text": "func (q *QueryValueDefinition) HasType() bool {\n\tif q != nil && q.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8ed0b4ef0fffcdbaed3f516ce3328426", "score": "0.7568641", "text": "func (o *MetaPropDefinition) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "260126cb71c6109cacbe1071887b3da3", "score": "0.75369525", "text": "func (o *MetaPropDefinitionAllOf) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "833f3ac08c06294d9455b8ed043c4450", "score": "0.75114685", "text": "func (o *Precondition) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8c75b223605ed9a2b67979706c926623", "score": "0.7490575", "text": "func (s *SyntheticsTest) HasType() bool {\n\tif s != nil && s.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2439819d343ed1a44f3327dc260c6bfc", "score": "0.7486519", "text": "func (o *Domain) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aaa7f0c6d746e95b992628e731fa4814", "score": "0.7478825", "text": "func (q *QueryTableDefinition) HasType() bool {\n\tif q != nil && q.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "76fb2b8fbd41dd9d338a6353bd1592f5", "score": "0.747784", "text": "func (o *ContractUser) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1335e3e582d18c92fcc28aedcf901aec", "score": "0.74744195", "text": "func (t *TimeseriesDefinition) HasType() bool {\n\tif t != nil && t.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4c6850471dbeb07ced0746564adb0585", "score": "0.746159", "text": "func (o *ReportData) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e96c6dc84e6126339a0ff177d42364f3", "score": "0.7458336", "text": "func (c *CheckStatusDefinition) HasType() bool {\n\tif c != nil && c.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7b8e5011093fa3ad41b3e39c0319e23c", "score": "0.74289215", "text": "func (t *TileDefRequest) HasType() bool {\n\tif t != nil && t.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bec8c6f5c906a26ce466a19ce534278b", "score": "0.74239147", "text": "func (f FieldSpec) HasType(t FieldType) FieldSpec {\n\tf.Type = t\n\treturn f\n}", "title": "" }, { "docid": "8df6b017c0332cab067af338726a5dda", "score": "0.74143136", "text": "func (o *FieldPartition) HasType() bool {\n\tif o != nil && !IsNil(o.Type) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "55cca2c26974da94b157cb35ab46f66e", "score": "0.74044937", "text": "func (g *GroupDefinition) HasType() bool {\n\tif g != nil && g.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dbea12c13e6e8f41fca3174816366dda", "score": "0.7378325", "text": "func (o *RegistrationFlow) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8453c8808297d731de17ae860e9b89c4", "score": "0.7369558", "text": "func (w *Widget) HasType() bool {\n\tif w != nil && w.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "07919db30ef9eea7c60d98352d281b00", "score": "0.73576945", "text": "func (d *DistributionDefinition) HasType() bool {\n\tif d != nil && d.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "738294fe0f6b5352ce72e2790972c4b5", "score": "0.7357127", "text": "func (o *Event) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b4c49b13b8d264915580d424070fcbbc", "score": "0.7355311", "text": "func (m *Metric) HasType() bool {\n\tif m != nil && m.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c7100e0a91dcc9765705e81ab8b33a2e", "score": "0.73478204", "text": "func (o *CdnDnsRecord) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ce328ff687cdc9365ba1361754120b95", "score": "0.7327495", "text": "func (o *Rule) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "08dcf5a603f3911ed3988fd0e509d81f", "score": "0.73249155", "text": "func (n *NoteDefinition) HasType() bool {\n\tif n != nil && n.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "272627e0075487c60da6ecaf30f4282a", "score": "0.73244435", "text": "func (m *ManageStatusDefinition) HasType() bool {\n\tif m != nil && m.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "259ec7f14ef3aa10276cd69e02f005b6", "score": "0.73183894", "text": "func (o *Contract) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b71c8c404b32ad7def79948b2b78fa94", "score": "0.73168397", "text": "func (m *MetricMetadata) HasType() bool {\n\tif m != nil && m.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b0d76150cb3517ee028529fab575ca8f", "score": "0.73113227", "text": "func (l *LogsProcessor) HasType() bool {\n\tif l != nil && l.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5008bc21bb11fd6aa1c4ff20103b788f", "score": "0.729876", "text": "func (o *CustomDeviceCreation) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f95a6cfc0d9d09de15d4d1961e39c376", "score": "0.7295852", "text": "func (o *Plugin) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6c2d030c0f61983506c71857769ea099", "score": "0.7287621", "text": "func (t *ToplistDefinition) HasType() bool {\n\tif t != nil && t.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "22a3b4ba1985e469584973d91206bcba", "score": "0.72833765", "text": "func (g *GraphDefinitionRequest) HasType() bool {\n\tif g != nil && g.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0039678552a074ffdfaf51fcb2cd9113", "score": "0.72802526", "text": "func (l *LogStreamDefinition) HasType() bool {\n\tif l != nil && l.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aa44034dd5551342f8f81739aee5cc6b", "score": "0.7271037", "text": "func (a *AlertValueDefinition) HasType() bool {\n\tif a != nil && a.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ccc9bb8f7a7e833e4b08210056fb4908", "score": "0.72556376", "text": "func (e *EventStreamDefinition) HasType() bool {\n\tif e != nil && e.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "080942a2e0ae1da77f547248be498ad7", "score": "0.7235292", "text": "func (o *BillingResource) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b433ee8a3bfc8399bcd36a25e89a0832", "score": "0.72263396", "text": "func (d *Downtime) HasType() bool {\n\tif d != nil && d.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cb3727a1ac22fc452ee9ff9c5a17e259", "score": "0.72115016", "text": "func (m *Monitor) HasType() bool {\n\tif m != nil && m.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "03595c8e4ed53014a7c3d1801364a906", "score": "0.72090185", "text": "func (la Account) HasType(t Type) bool { return la.Type.Has(t) }", "title": "" }, { "docid": "2d5b63d5ad9bf96a9b3c0a74d7fa67fd", "score": "0.7207107", "text": "func (o *GroupScalarColumn) HasType() bool {\n\treturn o != nil && o.Type != nil\n}", "title": "" }, { "docid": "cee2d4e23c7ccc2c01f9480364920fd0", "score": "0.7206658", "text": "func (f *Field) IsType() bool {\n\treturn false\n}", "title": "" }, { "docid": "2e06b05ef87162a4fb73b2ede35da905", "score": "0.7203928", "text": "func (i *ImageDefinition) HasType() bool {\n\tif i != nil && i.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "83ff5c0c18175ef025e3d10bb0a64287", "score": "0.72030026", "text": "func (o *Message) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b248fda093d099fd93ed662f60351fbb", "score": "0.719717", "text": "func (o *EnumType) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "acd4a5d1a15edf39066bb150028e09ca", "score": "0.719654", "text": "func (o *Task) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c4bd792699c29e9557dc6dba2e5877d9", "score": "0.7194984", "text": "func (t *TraceServiceDefinition) HasType() bool {\n\tif t != nil && t.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d5633124995b31396b72c6c6130b9eab", "score": "0.7191407", "text": "func (g *GraphDefinitionMarker) HasType() bool {\n\tif g != nil && g.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f7394bab567ca5962ed6bb1c4ac54586", "score": "0.71838", "text": "func (o *Credentials) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0240ba4b083a35f868e0ccb140e4d1f4", "score": "0.7180742", "text": "func (h *HostmapDefinition) HasType() bool {\n\tif h != nil && h.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3d58251bbb6ba180338998e050f39d9a", "score": "0.7180303", "text": "func (o *CreateDatasetParams) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "74804e0ba0bbfbf8353bc0f2b5956c01", "score": "0.71706986", "text": "func (t *TileDefMarker) HasType() bool {\n\tif t != nil && t.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a63d7a00158941a03e0d965bb5125d65", "score": "0.7169998", "text": "func (e *EventTimelineDefinition) HasType() bool {\n\tif e != nil && e.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "96debf002fc4abb71292d94640a34996", "score": "0.7165963", "text": "func (s *ScatterplotDefinition) HasType() bool {\n\tif s != nil && s.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1267a6f219fca74a9de27e66a51636c4", "score": "0.7158045", "text": "func (o *PluginProperty) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2ece4dd192923649e0b86f1f73fc2601", "score": "0.7158", "text": "func (o *ResourceQuota) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3ad0beb6114b44b8d9f4fce86d5bccd6", "score": "0.715659", "text": "func (c *ChangeDefinition) HasType() bool {\n\tif c != nil && c.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "529ee0ad4bcff6adaa1a43597c1f38ba", "score": "0.7152409", "text": "func (o *V1GeneDescriptor) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "38452d6da6480d7c9c6734ce43cac6b0", "score": "0.71338665", "text": "func (o *NetworkSupervisorCardAllOf) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9b1f5cddf2a9bce4c653983c00985ce0", "score": "0.71285075", "text": "func (r *Resp) HasType(t RespType) bool {\n\treturn r.typ&t > 0\n}", "title": "" }, { "docid": "1f850fcb92209fa42d2ef435ce4c3c41", "score": "0.71279883", "text": "func (o *JsonV1Event) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6e8ea5fdc19e5198d25381f90cd1f1e9", "score": "0.7117926", "text": "func (i *IframeDefinition) HasType() bool {\n\tif i != nil && i.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "330e376fe4f74d6ee4d1e28efc22a70e", "score": "0.711719", "text": "func (h *HeatmapDefinition) HasType() bool {\n\tif h != nil && h.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "19849e17bd9122fb92ca3ee4521d9bac", "score": "0.71161133", "text": "func (r *Recurrence) HasType() bool {\n\tif r != nil && r.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0319a357f3707a4db9b4bbe67e7fe2c3", "score": "0.7105131", "text": "func (o *Label) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0ac560a59d9214152537c34de8f9b379", "score": "0.71004444", "text": "func (o *TeamsResponseMetaPagination) HasType() bool {\n\treturn o != nil && o.Type != nil\n}", "title": "" }, { "docid": "8f86700a165b81a65e40153cb7300429", "score": "0.7091073", "text": "func (l *LogsPipeline) HasType() bool {\n\tif l != nil && l.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "411960411a1552d9ec6ef1630ced897b", "score": "0.7090356", "text": "func (o Options) HasType(\n\twant string, got interface{}, desc string, t TestingT,\n) bool {\n\tt.Helper()\n\ttgot := \"nil\"\n\tif nil != got {\n\t\ttgot = fmt.Sprintf(\"%T\", got)\n\t}\n\treturn o.Is(want, tgot, desc, t)\n}", "title": "" }, { "docid": "5aca5193d2b84b42615bf985f944c5ec", "score": "0.70881873", "text": "func (i *IntegrationGCPCreateRequest) HasType() bool {\n\tif i != nil && i.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b6625d6559089e1e80e4efbafd8a9129", "score": "0.7085534", "text": "func (s *ServiceLevelObjectiveDefinition) HasType() bool {\n\tif s != nil && s.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9a3738c765c1ba8fea886f1065cca15d", "score": "0.7082856", "text": "func (o *EventResponse) HasType() bool {\n\tif o != nil && !IsNil(o.Type) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dc40c86e8d297c36ffc86fdf01d57f34", "score": "0.7073514", "text": "func (t *InterfaceType) HasField(name string) bool {\n\treturn t.fields[name] != nil\n}", "title": "" }, { "docid": "f70689274a0c644cb19278421e6a92f5", "score": "0.70608664", "text": "func (o *InlineObject929) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7db0c9ec6fb56d2ece763400ac8af47a", "score": "0.705567", "text": "func (o *NotificationConfigStub) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3421282216bfabdb97e0e07e1787701c", "score": "0.7053315", "text": "func (d *DashboardListItem) HasType() bool {\n\tif d != nil && d.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e84475266c3215618c20c552daf76f99", "score": "0.70532274", "text": "func (o *MetricSuggestedTagsAndAggregations) HasType() bool {\n\treturn o != nil && o.Type != nil\n}", "title": "" }, { "docid": "80c1e549e9af23d89d0f5704eb1649b8", "score": "0.7039962", "text": "func (s *SyntheticsAssertion) HasType() bool {\n\tif s != nil && s.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f7474c84f5dd0718825f6e2cf07968d8", "score": "0.701435", "text": "func (t *TileDefRequestStyle) HasType() bool {\n\tif t != nil && t.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8fa3f739501aac13729cadd10456b83f", "score": "0.7011155", "text": "func (o *CheckoutRequest) HasType() bool {\n\tif o != nil && !IsNil(o.Type) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c9f60ae554e94c5d6a2abecb81f1d961", "score": "0.6989857", "text": "func (o *StorageHitachiHostAllOf) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d66676bc9f36d40cb94e4ed1c5f71303", "score": "0.6988596", "text": "func (o *ZoneUpdateZoneRecordMessage) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6032099574276cd8c158f2f6391dccb7", "score": "0.6988385", "text": "func (a *AlertGraphDefinition) HasType() bool {\n\tif a != nil && a.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "608b0cb2b2f0b19c5661dbb0bffec6c9", "score": "0.69467235", "text": "func (o *UpdateOrderDiscountLinesRequest) HasType() bool {\n\tif o != nil && !IsNil(o.Type) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "107b7a77fced9c380bab84224353ed43", "score": "0.6946061", "text": "func (o *TaskReminder) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8eeb68f2aa954dde0d3969c425a0f0cc", "score": "0.6937223", "text": "func (o *Bucket) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "199a85fc25515237d28ddfc6a76fe891", "score": "0.6919885", "text": "func (o *MonitorDowntimeMatchResponseData) HasType() bool {\n\treturn o != nil && o.Type != nil\n}", "title": "" }, { "docid": "97c318bfbade3959ff9d0e1874761616", "score": "0.6912848", "text": "func (d *DashboardListItemV2) HasType() bool {\n\tif d != nil && d.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a0e8a781884610f4ca51a28da0350b94", "score": "0.69088864", "text": "func (o *OrderResponseCheckout) HasType() bool {\n\tif o != nil && !IsNil(o.Type) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9dc24c46cf08aab9c9135089aed58ab3", "score": "0.69059926", "text": "func (o *InlineResponseDefault) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "71fea095fda9d4a49d129b1845fa4478", "score": "0.69029546", "text": "func (o *MonitorGroupSearchResponseCounts) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8e4a3b687fa473717c5141fc2478c0b8", "score": "0.6897074", "text": "func (o *V1GenomicRegion) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1ded7c67c5ffd0077a27cda7944b6b10", "score": "0.6859182", "text": "func (o *ApplicationLoadBalancerHttpRuleCondition) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "328446930e326f2870faf439fc21522e", "score": "0.68577117", "text": "func (o *EquipmentSwitchCard) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2e30c5f741398de9a154f1d583238f35", "score": "0.6853158", "text": "func (o *V1OrganismCountByType) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "247beb196b837a2366fba49ff8d21a0c", "score": "0.6848593", "text": "func (o *MonitorOptionsAggregation) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c649ef31a22ba643401591a09a08740c", "score": "0.68476987", "text": "func (o *JsonErrorResponse) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "890fedd609c7fac1302bc7167e17f443", "score": "0.68274313", "text": "func HasTypeSet(*types.Interface) bool {\n\treturn false\n}", "title": "" }, { "docid": "1b5596fcfdf059dc0f7147ace04dc8d4", "score": "0.67997", "text": "func (g *GraphDefinitionRequestStyle) HasType() bool {\n\tif g != nil && g.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
7316dccab9ff31be419f22cc5e1e042e
IsEmpty returns true if no Endpoints were returned.
[ { "docid": "cdeb4e854f510fbec9de27eaaa0df1fd", "score": "0.76162493", "text": "func (r EndpointPage) IsEmpty() (bool, error) {\n\tes, err := ExtractEndpoints(r)\n\treturn len(es) == 0, err\n}", "title": "" } ]
[ { "docid": "1ef2d1c953dfbf4bf49c784dc5f39b4d", "score": "0.7459234", "text": "func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool {\n\treturn peclr.Value == nil || len(*peclr.Value) == 0\n}", "title": "" }, { "docid": "1ef2d1c953dfbf4bf49c784dc5f39b4d", "score": "0.7456999", "text": "func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool {\n\treturn peclr.Value == nil || len(*peclr.Value) == 0\n}", "title": "" }, { "docid": "86282e2940970747eb924652b6d3aace", "score": "0.7238754", "text": "func (mipeclr ManagedInstancePrivateEndpointConnectionListResult) IsEmpty() bool {\n\treturn mipeclr.Value == nil || len(*mipeclr.Value) == 0\n}", "title": "" }, { "docid": "5ed5ed948e98f9d4165b66368be58490", "score": "0.719872", "text": "func (eplr ElasticPoolListResult) IsEmpty() bool {\n\treturn eplr.Value == nil || len(*eplr.Value) == 0\n}", "title": "" }, { "docid": "f173c4c1f8cac4cdab5e92015b8908b4", "score": "0.7150465", "text": "func (sp *ServicePlans) IsEmpty() bool {\n\treturn len(sp.ServicePlans) == 0\n}", "title": "" }, { "docid": "25b5ecbb4810274f91c3c2b1fb216ea1", "score": "0.7133601", "text": "func (ehlr EventHubListResult) IsEmpty() bool {\n\treturn ehlr.Value == nil || len(*ehlr.Value) == 0\n}", "title": "" }, { "docid": "41ffaae5839bf3dcef6fd0f5edd3c7dc", "score": "0.71239626", "text": "func (r Result) Empty() bool {\n\tfor _, request := range r.Requests {\n\t\tif !request.Empty() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "b988f75cc9d3f2291bc76ca636f363b9", "score": "0.7080242", "text": "func (sp *ServicePlansForOffering) IsEmpty() bool {\n\treturn len(sp.ServicePlans) == 0\n}", "title": "" }, { "docid": "8071aa722b933c5d02229991dbca99ac", "score": "0.70113665", "text": "func (epolr ElasticPoolOperationListResult) IsEmpty() bool {\n\treturn epolr.Value == nil || len(*epolr.Value) == 0\n}", "title": "" }, { "docid": "170468b2707f6314de68bd17e449aa89", "score": "0.69993573", "text": "func (sp *ServicePlan) IsEmpty() bool {\n\treturn false\n}", "title": "" }, { "docid": "b6711557afc631108645a833d957ad03", "score": "0.69830793", "text": "func (slr ServerListResult) IsEmpty() bool {\n\treturn slr.Value == nil || len(*slr.Value) == 0\n}", "title": "" }, { "docid": "f07cbed9a6850acb21b7edfa030b845c", "score": "0.6980804", "text": "func (rb *ResponseBuilder) Empty() bool {\n\treturn len(rb.outgoingBlocks) == 0 && len(rb.outgoingResponses) == 0\n}", "title": "" }, { "docid": "dcf12bee5ef8d64c0a4a080119199c4e", "score": "0.69574124", "text": "func (esbaplr ExtendedServerBlobAuditingPolicyListResult) IsEmpty() bool {\n\treturn esbaplr.Value == nil || len(*esbaplr.Value) == 0\n}", "title": "" }, { "docid": "0f6023c43a2bc157fb8b4face922bea7", "score": "0.69186866", "text": "func (s slice) Empty() bool {\n\treturn s.Len() == 0\n}", "title": "" }, { "docid": "84fcf9b57f8dd7b4162b091360c2c840", "score": "0.69085664", "text": "func (ms *Methods) Empty() bool { return len(*ms) == 0 }", "title": "" }, { "docid": "70e92f6d992e2f69b519e044b0ae78d7", "score": "0.68772376", "text": "func (g *Goroutines) Empty() bool {\n\tg.RLock()\n\tdefer g.RUnlock()\n\treturn len(g.List) == 0\n}", "title": "" }, { "docid": "cf8a682219b14cae14322a1f97fb39c9", "score": "0.6876412", "text": "func (solr ServerOperationListResult) IsEmpty() bool {\n\treturn solr.Value == nil || len(*solr.Value) == 0\n}", "title": "" }, { "docid": "7f856ee840b5f8946fdf83e76787768c", "score": "0.6862069", "text": "func (iplr InstancePoolListResult) IsEmpty() bool {\n\treturn iplr.Value == nil || len(*iplr.Value) == 0\n}", "title": "" }, { "docid": "133514e1211537a78bd18708e8010865", "score": "0.68539685", "text": "func (arl AdvisorsResultList) IsEmpty() bool {\n\treturn arl.Value == nil || len(*arl.Value) == 0\n}", "title": "" }, { "docid": "f3dc330e43d2005c58ad4c412eb8dda4", "score": "0.6853869", "text": "func (rplr RestorePointListResult) IsEmpty() bool {\n\treturn rplr.Value == nil || len(*rplr.Value) == 0\n}", "title": "" }, { "docid": "f6c80a8f744b2bd6a3e85b930dd4486c", "score": "0.68509156", "text": "func (si *ServiceInstances) IsEmpty() bool {\n\treturn len(si.ServiceInstances) == 0\n}", "title": "" }, { "docid": "db2064cb4d784f8bf31ceaa292bcc218", "score": "0.68369853", "text": "func (s *Slice) empty() bool {\n return s.size_ == 0\n}", "title": "" }, { "docid": "8fb96edd61497424b83141e89208c889", "score": "0.6826474", "text": "func (dslr DeletedServerListResult) IsEmpty() bool {\n\treturn dslr.Value == nil || len(*dslr.Value) == 0\n}", "title": "" }, { "docid": "a57040e01f3303d472647cad5eecf037", "score": "0.68258905", "text": "func (hub *Hub) isEmpty() bool {\n\treturn hub.count() == 0\n}", "title": "" }, { "docid": "c18e9d70dc416b03743f5d658999f093", "score": "0.68227285", "text": "func (s *IPSet) Empty() bool {\n\ts.RLock()\n\tdefer s.RUnlock()\n\treturn len(s.ips) == 0\n}", "title": "" }, { "docid": "346cb6741afef51d23bc4755a80371b6", "score": "0.68134755", "text": "func (rpol ResourceProviderOperationList) IsEmpty() bool {\n\treturn rpol.Value == nil || len(*rpol.Value) == 0\n}", "title": "" }, { "docid": "00c6f3b124b1afefeaa573555f22f226", "score": "0.6810617", "text": "func (sdalr ServerDNSAliasListResult) IsEmpty() bool {\n\treturn sdalr.Value == nil || len(*sdalr.Value) == 0\n}", "title": "" }, { "docid": "2f766d4aa53151f9c1876227e912f5ae", "score": "0.68036777", "text": "func (pzlr PrivateZoneListResult) IsEmpty() bool {\n\treturn pzlr.Value == nil || len(*pzlr.Value) == 0\n}", "title": "" }, { "docid": "5a103b0f36e5a7018e0237d9f0ccdce5", "score": "0.68033385", "text": "func (responsesDiff *ResponsesDiff) Empty() bool {\n\tif responsesDiff == nil {\n\t\treturn true\n\t}\n\n\treturn len(responsesDiff.Added) == 0 &&\n\t\tlen(responsesDiff.Deleted) == 0 &&\n\t\tlen(responsesDiff.Modified) == 0\n}", "title": "" }, { "docid": "773d5b784650dbc37601382fe8f92b59", "score": "0.6796155", "text": "func (g *Graph) IsEmpty() bool {\n\treturn len(g.vertices) == 0\n}", "title": "" }, { "docid": "df3b8974d63aa5893ad2c5071ae39b70", "score": "0.67871493", "text": "func (c *SeriesLookbackConsolidator) Empty() bool {\n\treturn len(c.datapoints) == 0\n}", "title": "" }, { "docid": "cccbc27d7d4541cdcd7a6a758c813a4e", "score": "0.6781064", "text": "func (page ServicePage) IsEmpty() (bool, error) {\n\tif page.StatusCode == 204 {\n\t\treturn true, nil\n\t}\n\n\tservices, err := ExtractServices(page)\n\treturn len(services) == 0, err\n}", "title": "" }, { "docid": "0de8022a82e4c62e94b954df432c2516", "score": "0.67716706", "text": "func (cs CallSet) Empty() bool {\n\treturn len(cs) <= 0\n}", "title": "" }, { "docid": "fbd8908c4131425ef9f7d28c06f871e4", "score": "0.67655754", "text": "func (e APIError) Empty() bool {\n\treturn len(e) == 0\n}", "title": "" }, { "docid": "816e2b91f098bfa1f745ce28571713cd", "score": "0.6760228", "text": "func (elr EntityListResult) IsEmpty() bool {\n\treturn elr.Value == nil || len(*elr.Value) == 0\n}", "title": "" }, { "docid": "c41b1b26d37e37639457094288e4d433", "score": "0.67549163", "text": "func (e EdgeQueryResult) IsEmpty() bool {\n\treturn e.shapeID < 0\n}", "title": "" }, { "docid": "f10a10569683115f05b0a2d8a9d91e71", "score": "0.6744747", "text": "func (plrlr PrivateLinkResourceListResult) IsEmpty() bool {\n\treturn plrlr.Value == nil || len(*plrlr.Value) == 0\n}", "title": "" }, { "docid": "45284ce1bc3a5524362e64d01512cc90", "score": "0.6744602", "text": "func (sbaplr ServerBlobAuditingPolicyListResult) IsEmpty() bool {\n\treturn sbaplr.Value == nil || len(*sbaplr.Value) == 0\n}", "title": "" }, { "docid": "f10a10569683115f05b0a2d8a9d91e71", "score": "0.6744272", "text": "func (plrlr PrivateLinkResourceListResult) IsEmpty() bool {\n\treturn plrlr.Value == nil || len(*plrlr.Value) == 0\n}", "title": "" }, { "docid": "9d75e44acdef4981796ff867da9b7036", "score": "0.6739321", "text": "func (l *ManagedServiceList) Empty() bool {\n\treturn l == nil || len(l.items) == 0\n}", "title": "" }, { "docid": "9d75e44acdef4981796ff867da9b7036", "score": "0.6739321", "text": "func (l *ManagedServiceList) Empty() bool {\n\treturn l == nil || len(l.items) == 0\n}", "title": "" }, { "docid": "15469420fa83956d4c6988a38be71758", "score": "0.6738867", "text": "func (sklr ServerKeyListResult) IsEmpty() bool {\n\treturn sklr.Value == nil || len(*sklr.Value) == 0\n}", "title": "" }, { "docid": "15469420fa83956d4c6988a38be71758", "score": "0.6738867", "text": "func (sklr ServerKeyListResult) IsEmpty() bool {\n\treturn sklr.Value == nil || len(*sklr.Value) == 0\n}", "title": "" }, { "docid": "58ae585f581879ccddccfbe489c7139f", "score": "0.6734319", "text": "func (ofrlr OutboundFirewallRuleListResult) IsEmpty() bool {\n\treturn ofrlr.Value == nil || len(*ofrlr.Value) == 0\n}", "title": "" }, { "docid": "5656e402d2b762fe45291d2db456204c", "score": "0.67308676", "text": "func (arl AddressResourceList) IsEmpty() bool {\n\treturn arl.Value == nil || len(*arl.Value) == 0\n}", "title": "" }, { "docid": "54197210af197d01e0dd74b07ee1d4b7", "score": "0.67233294", "text": "func (sipl SyncIdentityProviderList) IsEmpty() bool {\n\treturn sipl.Value == nil || len(*sipl.Value) == 0\n}", "title": "" }, { "docid": "647e8c22742f98ff4ef89475214feee8", "score": "0.67170197", "text": "func (sulr SubscriptionUsageListResult) IsEmpty() bool {\n\treturn sulr.Value == nil || len(*sulr.Value) == 0\n}", "title": "" }, { "docid": "51ea1de60097aac6191ce022c2905c1d", "score": "0.67170054", "text": "func (gc *GeometryCollection) Empty() bool {\n\treturn len(gc.geoms) == 0\n}", "title": "" }, { "docid": "e7e0d1a4079431897acde8c5b40a6acd", "score": "0.6699443", "text": "func (graph *OrderBookGraph) IsEmpty() bool {\n\tgraph.lock.RLock()\n\tdefer graph.lock.RUnlock()\n\n\treturn len(graph.venuesForSellingAsset) == 0\n}", "title": "" }, { "docid": "9f8b65062f8fb9e597717db2e74030ec", "score": "0.669033", "text": "func (enlr EHNamespaceListResult) IsEmpty() bool {\n\treturn enlr.Value == nil || len(*enlr.Value) == 0\n}", "title": "" }, { "docid": "ecb84ef51e11926be3fcf8d3b635eb14", "score": "0.6689577", "text": "func (r ServerPage) IsEmpty() (bool, error) {\n\ts, err := ExtractServers(r)\n\treturn len(s) == 0, err\n}", "title": "" }, { "docid": "f1a2538f99c939832cac32720cf06b82", "score": "0.66731495", "text": "func (sec SecurityEventCollection) IsEmpty() bool {\n\treturn sec.Value == nil || len(*sec.Value) == 0\n}", "title": "" }, { "docid": "802f7d91a2bf4d8d0938e3ac0993d0e2", "score": "0.66714394", "text": "func (p AttackPool) IsEmpty() bool {\n\tfor _, a := range p {\n\t\tif a.defender == nil && a.attacker != nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d6bb6079997b0ffcb2ac547bd66da382", "score": "0.6661743", "text": "func (s *Snippets) IsEmpty() bool {\n\tfor _, snip := range *s {\n\t\tif !snip.IsEmpty() {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "fc3f563bac817fa337390faacce30bca", "score": "0.6660892", "text": "func (ieeolr ImportExportExtensionsOperationListResult) IsEmpty() bool {\n\treturn ieeolr.Value == nil || len(*ieeolr.Value) == 0\n}", "title": "" }, { "docid": "f24db804702a8c7bd705bcf7adbe448d", "score": "0.6660259", "text": "func (mipllr ManagedInstancePrivateLinkListResult) IsEmpty() bool {\n\treturn mipllr.Value == nil || len(*mipllr.Value) == 0\n}", "title": "" }, { "docid": "e8c86ea12ed29884fc41908eeadd428f", "score": "0.6660076", "text": "func (ssaplr ServerSecurityAlertPolicyListResult) IsEmpty() bool {\n\treturn ssaplr.Value == nil || len(*ssaplr.Value) == 0\n}", "title": "" }, { "docid": "471ffe959a40aa0123c1cc9e8e540e09", "score": "0.6658328", "text": "func (ertlr EnabledResourceTypesListResult) IsEmpty() bool {\n\treturn ertlr.Value == nil || len(*ertlr.Value) == 0\n}", "title": "" }, { "docid": "068d89f4ca7daf76b271a03cc1ccbcc7", "score": "0.6656925", "text": "func (t *sliceset) Empty() bool {\n\treturn len(t.s) == 0\n}", "title": "" }, { "docid": "fd7b3a449f37a30d86620d19ee1eacbf", "score": "0.6655209", "text": "func (p ProviderConfig) Empty() bool {\n\treturn p.Issuer == nil\n}", "title": "" }, { "docid": "5a2b0d9b7a71e47813415f92e6400252", "score": "0.66505826", "text": "func empty(r *unstructured.Unstructured) bool {\n\tif r.Object == nil || len(r.Object) == 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6149d9cce62116e48c79c8c3a2cba69b", "score": "0.66479266", "text": "func (tqsrl TopQueryStatisticsResultList) IsEmpty() bool {\n\treturn tqsrl.Value == nil || len(*tqsrl.Value) == 0\n}", "title": "" }, { "docid": "6650d9cbf836350ba5f6cbf5f15999ae", "score": "0.6647336", "text": "func (salr SyncAgentListResult) IsEmpty() bool {\n\treturn salr.Value == nil || len(*salr.Value) == 0\n}", "title": "" }, { "docid": "1c50d5e6c8c4c591c213c4ed9a4796e2", "score": "0.6646445", "text": "func (nrslr NetworkRuleSetListResult) IsEmpty() bool {\n\treturn nrslr.Value == nil || len(*nrslr.Value) == 0\n}", "title": "" }, { "docid": "1c50d5e6c8c4c591c213c4ed9a4796e2", "score": "0.6646445", "text": "func (nrslr NetworkRuleSetListResult) IsEmpty() bool {\n\treturn nrslr.Value == nil || len(*nrslr.Value) == 0\n}", "title": "" }, { "docid": "71c1bc29d7680efd633ccd60f77a5193", "score": "0.6646377", "text": "func (ulr UsageListResult) IsEmpty() bool {\n\treturn ulr.Value == nil || len(*ulr.Value) == 0\n}", "title": "" }, { "docid": "9f2370ba4b15ce90b9a6f3b15b143ff5", "score": "0.6642449", "text": "func (ohlr OperationsHealthListResult) IsEmpty() bool {\n\treturn ohlr.Value == nil || len(*ohlr.Value) == 0\n}", "title": "" }, { "docid": "313fdd80a791f1ccd3084815197e00ea", "score": "0.66420513", "text": "func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) IsEmpty() bool {\n\treturn edbaplr.Value == nil || len(*edbaplr.Value) == 0\n}", "title": "" }, { "docid": "cc4277cf18400017568e2017836bb2f9", "score": "0.663378", "text": "func (ebrl EngineBaseResourceList) IsEmpty() bool {\n\treturn ebrl.Value == nil || len(*ebrl.Value) == 0\n}", "title": "" }, { "docid": "a74820c28613e6d97f03ceefe3303a0f", "score": "0.6633427", "text": "func (s *stack) Empty() bool {\n\treturn s.list.Len() == 0\n}", "title": "" }, { "docid": "b21e60c968a607a1c2b14373e46d5057", "score": "0.6629469", "text": "func (h *Host) IsEmpty() bool {\n\treturn len(h.VMIDs) == 0\n}", "title": "" }, { "docid": "d2097057ea25fb5f96220ca7916d74f8", "score": "0.6622395", "text": "func (l *EventList) Empty() bool {\n\treturn l == nil || len(l.items) == 0\n}", "title": "" }, { "docid": "b7b17520a995ac08b39bcdbf8be36476", "score": "0.6620554", "text": "func (stglr ServerTrustGroupListResult) IsEmpty() bool {\n\treturn stglr.Value == nil || len(*stglr.Value) == 0\n}", "title": "" }, { "docid": "336c1fe8b8ee952233f8f05349cfbdc4", "score": "0.6620143", "text": "func (ssl SyncSetList) IsEmpty() bool {\n\treturn ssl.Value == nil || len(*ssl.Value) == 0\n}", "title": "" }, { "docid": "05c69489d5f64257e513ca17fe9b3514", "score": "0.6613702", "text": "func (s PortSet) Empty() bool {\n\treturn s.set.Empty()\n}", "title": "" }, { "docid": "aec6a628635413894cd9cedcef962a6c", "score": "0.66101044", "text": "func (s StackSlice) isEmpty() bool{\n\tvar empty bool = false\n\tif s.elementCount == 0{\n\t\tempty = true\n\t}\n\treturn empty\n}", "title": "" }, { "docid": "791e3edfec1782da377a703dafc030ef", "score": "0.66062564", "text": "func (patch JSON6902) IsEmpty() bool { return len(patch) == 0 }", "title": "" }, { "docid": "bb145f5a2bc10f98fb0ce8aabacd37f2", "score": "0.6601432", "text": "func (wsrl WaitStatisticsResultList) IsEmpty() bool {\n\treturn wsrl.Value == nil || len(*wsrl.Value) == 0\n}", "title": "" }, { "docid": "61b210b35a9c1bab876297989fd17635", "score": "0.65995526", "text": "func (eplr EncryptionProtectorListResult) IsEmpty() bool {\n\treturn eplr.Value == nil || len(*eplr.Value) == 0\n}", "title": "" }, { "docid": "4b4e551de36b6271901ca3837661e68c", "score": "0.6598616", "text": "func (r FloatingIPPage) IsEmpty() (bool, error) {\n\tif r.StatusCode == 204 {\n\t\treturn true, nil\n\t}\n\n\tis, err := ExtractFloatingIPs(r)\n\treturn len(is) == 0, err\n}", "title": "" }, { "docid": "51cc4de4ca333ea7b90f2274d1d50380", "score": "0.6598272", "text": "func (ipa *IpAlloc) Empty() bool {\n\treturn len(ipa.FreeList) == 0\n}", "title": "" }, { "docid": "7f543993653d7c5e355ff0f5dd9f9999", "score": "0.6598002", "text": "func (es *Escapes) IsEmpty() bool {\n\tfor _, cs := range es.CallSites {\n\t\tif cs != nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d294ca688073feb8a4ad757a9eb1a18d", "score": "0.6596201", "text": "func (g *GeometryCollection) Empty() bool {\n\tfor _, g := range g.geoms {\n\t\tif !g.Empty() {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d3921e664b3ed0be824dae5a2c476ea3", "score": "0.6592804", "text": "func (svalr ServerVulnerabilityAssessmentListResult) IsEmpty() bool {\n\treturn svalr.Value == nil || len(*svalr.Value) == 0\n}", "title": "" }, { "docid": "a05efc4317d21d90f5a164b0781fcfac", "score": "0.65910697", "text": "func (pplr PeeringPolicyListResult) IsEmpty() bool {\n\treturn pplr.Value == nil || len(*pplr.Value) == 0\n}", "title": "" }, { "docid": "542dc6032449de2e43c7013c936855da", "score": "0.65806884", "text": "func (this *MyCircularDeque) IsEmpty() bool {\n\treturn this.count == 0\n}", "title": "" }, { "docid": "3076f8618ecc7165526c7f90f9beb5c2", "score": "0.65788114", "text": "func (rarl RecommendationActionsResultList) IsEmpty() bool {\n\treturn rarl.Value == nil || len(*rarl.Value) == 0\n}", "title": "" }, { "docid": "15e8dbc4b98492123be031dc6579435b", "score": "0.657679", "text": "func (ris ResourceInvalidations) IsEmpty() bool {\n\treturn ris.Size() == 0\n}", "title": "" }, { "docid": "8700338b02872973aa55f0d2f71ace43", "score": "0.65754265", "text": "func (edc EventDataCollection) IsEmpty() bool {\n\treturn edc.Value == nil || len(*edc.Value) == 0\n}", "title": "" }, { "docid": "d1d0347ef9cf07b0200c9fd64e5b792e", "score": "0.65696406", "text": "func (sslr SBSubscriptionListResult) IsEmpty() bool {\n\treturn sslr.Value == nil || len(*sslr.Value) == 0\n}", "title": "" }, { "docid": "66ec12eaa6dfbcf4479fb162afef971a", "score": "0.6567961", "text": "func (p *Pool) Empty() bool {\n\treturn p.Size() == 0\n}", "title": "" }, { "docid": "db1b7e2215194903953b9e66df9f9ce6", "score": "0.65649605", "text": "func (lr ListResult) IsEmpty() bool {\n\treturn lr.Value == nil || len(*lr.Value) == 0\n}", "title": "" }, { "docid": "db1b7e2215194903953b9e66df9f9ce6", "score": "0.65649605", "text": "func (lr ListResult) IsEmpty() bool {\n\treturn lr.Value == nil || len(*lr.Value) == 0\n}", "title": "" }, { "docid": "db1b7e2215194903953b9e66df9f9ce6", "score": "0.65649605", "text": "func (lr ListResult) IsEmpty() bool {\n\treturn lr.Value == nil || len(*lr.Value) == 0\n}", "title": "" }, { "docid": "cfbe96d1ca9fb00e48773b920cf99efc", "score": "0.6564671", "text": "func (r *GroupedResults) IsEmpty() bool { return r.Len() == 0 }", "title": "" }, { "docid": "2677c003d5a4ba642712a3ab487b8c4d", "score": "0.65620846", "text": "func (r HostPage) IsEmpty() (bool, error) {\n\tstacks, err := ExtractHosts(r)\n\treturn len(stacks) == 0, err\n}", "title": "" }, { "docid": "51e5e5bec07ca49999be76f2b4c69ce3", "score": "0.6558615", "text": "func (c *Collection) IsEmpty() bool {\n\treturn c.Head == nil\n}", "title": "" }, { "docid": "dc34b8fc5790863eda59ca67878ad86f", "score": "0.6556343", "text": "func (jp *JSONPath) IsEmpty() bool {\n\treturn len(jp.parts) == 0\n}", "title": "" }, { "docid": "9067427759be94277b1d25e9ab232a08", "score": "0.65545994", "text": "func (self *requestBuffer) IsEmpty() bool {\n\treturn 0 == self.count\n}", "title": "" }, { "docid": "f0539d9156528758465b9eb1a13112b3", "score": "0.6552809", "text": "func (rllr ReplicationLinkListResult) IsEmpty() bool {\n\treturn rllr.Value == nil || len(*rllr.Value) == 0\n}", "title": "" } ]
dac89aa460df4a16f680576af2fca4ff
Limits After the status of a device changes, the new status is applied within 10 seconds. After the new status is applied, you can search for the device by using the new status. Before the new status is applied, you can search for the device by using the previous status. Each Alibaba Cloud account can run a maximum of 50 queries per second (QPS). > RAM users of an Alibaba Cloud account share the quota of the account.
[ { "docid": "2f5d1700a592e7e7b92cced37f012815", "score": "0.5222443", "text": "func (client *Client) QueryDeviceByStatus(request *QueryDeviceByStatusRequest) (_result *QueryDeviceByStatusResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &QueryDeviceByStatusResponse{}\n\t_body, _err := client.QueryDeviceByStatusWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "title": "" } ]
[ { "docid": "c1fda62317d024d36529990673b4e099", "score": "0.60907006", "text": "func (r *RateLimiter) LimitStatus(c echo.Context) error {\n\t// Allocate the users ReqData\n\trd := r.reqData(realIP(c))\n\n\t// Return the current rate limit standing\n\treturn c.JSON(http.StatusOK, &LimitStatus{\n\t\tCurrent: rd.count,\n\t\tMax: r.max,\n\t\tInterval: r.interval,\n\t})\n}", "title": "" }, { "docid": "15346323874dcaf025b43b42578ce4c2", "score": "0.5681242", "text": "func RequestDevStatus(ctx context.Context, ds *storage.DeviceSession) storage.MACCommandBlock {\n\tblock := storage.MACCommandBlock{\n\t\tCID: lorawan.DevStatusReq,\n\t\tMACCommands: []lorawan.MACCommand{\n\t\t\t{\n\t\t\t\tCID: lorawan.DevStatusReq,\n\t\t\t},\n\t\t},\n\t}\n\tds.LastDevStatusRequested = time.Now()\n\tlog.WithFields(log.Fields{\n\t\t\"dev_eui\": ds.DevEUI,\n\t\t\"ctx_id\": ctx.Value(logging.ContextIDKey),\n\t}).Info(\"requesting device-status\")\n\treturn block\n}", "title": "" }, { "docid": "e71709602d08b373fd20cb55421808ca", "score": "0.5677156", "text": "func (a *ApplicationServerAPI) SetDeviceStatus(ctx context.Context, req *as.SetDeviceStatusRequest) (*empty.Empty, error) {\n\tvar devEUI lorawan.EUI64\n\tcopy(devEUI[:], req.DevEui)\n\n\tvar d dev.Device\n\tvar err error\n\n\terr = a.st.Tx(ctx, func(ctx context.Context, handler *store.Handler) error {\n\t\td, err = handler.GetDevice(ctx, devEUI, true)\n\t\tif err != nil {\n\t\t\treturn helpers.ErrToRPCError(errors.Wrap(err, \"get device error\"))\n\t\t}\n\n\t\tmarg := int(req.Margin)\n\t\td.DeviceStatusMargin = &marg\n\n\t\tif req.BatteryLevelUnavailable {\n\t\t\td.DeviceStatusBattery = nil\n\t\t\td.DeviceStatusExternalPower = false\n\t\t} else if req.ExternalPowerSource {\n\t\t\td.DeviceStatusExternalPower = true\n\t\t\td.DeviceStatusBattery = nil\n\t\t} else {\n\t\t\td.DeviceStatusExternalPower = false\n\t\t\td.DeviceStatusBattery = &req.BatteryLevel\n\t\t}\n\n\t\tif err = handler.UpdateDevice(ctx, &d); err != nil {\n\t\t\treturn helpers.ErrToRPCError(errors.Wrap(err, \"update device error\"))\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tapp, err := a.st.GetApplication(ctx, d.ApplicationID)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(errors.Wrap(err, \"get application error\"))\n\t}\n\n\tpl := pb.StatusEvent{\n\t\tApplicationId: uint64(app.ID),\n\t\tApplicationName: app.Name,\n\t\tDeviceName: d.Name,\n\t\tDevEui: d.DevEUI[:],\n\t\tMargin: req.Margin,\n\t\tExternalPowerSource: req.ExternalPowerSource,\n\t\tBatteryLevel: float32(math.Round(float64(req.BatteryLevel*100))) / 100,\n\t\tBatteryLevelUnavailable: req.BatteryLevelUnavailable,\n\t\tTags: make(map[string]string),\n\t}\n\n\t// set tags\n\tfor k, v := range d.Tags.Map {\n\t\tif v.Valid {\n\t\t\tpl.Tags[k] = v.String\n\t\t}\n\t}\n\n\tvars := make(map[string]string)\n\tfor k, v := range d.Variables.Map {\n\t\tif v.Valid {\n\t\t\tvars[k] = v.String\n\t\t}\n\t}\n\n\terr = integration.ForApplicationID(ctx, app.ID, a.gIntegrations, a.st).HandleStatusEvent(ctx, vars, pl)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(errors.Wrap(err, \"send status notification to handler error\"))\n\t}\n\n\treturn &empty.Empty{}, nil\n}", "title": "" }, { "docid": "eecc0df946c00aa508567f2c650e981a", "score": "0.5312452", "text": "func (client *Client) QueryDeviceByStatusWithOptions(request *QueryDeviceByStatusRequest, runtime *util.RuntimeOptions) (_result *QueryDeviceByStatusResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.CurrentPage)) {\n\t\tquery[\"CurrentPage\"] = request.CurrentPage\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.IotInstanceId)) {\n\t\tquery[\"IotInstanceId\"] = request.IotInstanceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PageSize)) {\n\t\tquery[\"PageSize\"] = request.PageSize\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ProductKey)) {\n\t\tquery[\"ProductKey\"] = request.ProductKey\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceGroupId)) {\n\t\tquery[\"ResourceGroupId\"] = request.ResourceGroupId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Status)) {\n\t\tquery[\"Status\"] = request.Status\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"QueryDeviceByStatus\"),\n\t\tVersion: tea.String(\"2018-01-20\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &QueryDeviceByStatusResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "ad1a12dabcf2b5db1a50e41b23c6f2bd", "score": "0.5309688", "text": "func (m *UserExperienceAnalyticsDeviceScope) SetStatus(value *DeviceScopeStatus)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b38af0d8af14da0f8070e804a0b32112", "score": "0.52394336", "text": "func (c *Controller) updateStatus(ctx context.Context, fas *autoscalingv1.FleetAutoscaler, currentReplicas int32, desiredReplicas int32, scaled bool, scalingLimited bool) error {\n\tfasCopy := fas.DeepCopy()\n\tfasCopy.Status.AbleToScale = true\n\tfasCopy.Status.ScalingLimited = scalingLimited\n\tfasCopy.Status.CurrentReplicas = currentReplicas\n\tfasCopy.Status.DesiredReplicas = desiredReplicas\n\tif scaled {\n\t\tnow := metav1.NewTime(time.Now())\n\t\tfasCopy.Status.LastScaleTime = &now\n\t}\n\n\tif !apiequality.Semantic.DeepEqual(fas.Status, fasCopy.Status) {\n\t\tif scalingLimited {\n\t\t\t// scalingLimited indicates that the calculated scale would be above or below the range defined by MinReplicas and MaxReplicas\n\t\t\tmsg := \"Scaling fleet %s was limited to minimum size of %d\"\n\t\t\tif currentReplicas > desiredReplicas {\n\t\t\t\tmsg = \"Scaling fleet %s was limited to maximum size of %d\"\n\t\t\t}\n\n\t\t\tc.recorder.Eventf(fas, corev1.EventTypeWarning, \"ScalingLimited\", msg, fas.Spec.FleetName, desiredReplicas)\n\t\t}\n\n\t\t_, err := c.fleetAutoscalerGetter.FleetAutoscalers(fas.ObjectMeta.Namespace).UpdateStatus(ctx, fasCopy, metav1.UpdateOptions{})\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"error updating status for fleetautoscaler %s\", fas.ObjectMeta.Name)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "150cdf3dd394e029109202194df8a42c", "score": "0.5230367", "text": "func updateCRStatus(ctx context.Context, client splcommon.ControllerClient, origCR splcommon.MetaObject) {\n\treqLogger := log.FromContext(ctx)\n\tscopedLog := reqLogger.WithName(\"updateCRStatus\").WithValues(\"original cr version\", origCR.GetResourceVersion())\n\n\tvar tryCnt int\n\tfor tryCnt = 0; tryCnt < maxRetryCountForCRStatusUpdate; tryCnt++ {\n\t\tlatestCR, err := fetchCurrentCRWithStatusUpdate(ctx, client, origCR)\n\t\tif err != nil {\n\t\t\tif origCR.GetDeletionTimestamp() == nil {\n\t\t\t\tscopedLog.Error(err, \"Unable to Read the latest CR from the K8s\")\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\tscopedLog.Info(\"Trying to update\", \"count\", tryCnt)\n\t\tcurCRVersion := latestCR.GetResourceVersion()\n\t\terr = client.Status().Update(ctx, latestCR)\n\t\tif err == nil {\n\t\t\tupdatedCRVersion := latestCR.GetResourceVersion()\n\t\t\tscopedLog.Info(\"Status update successful\", \"current CR version\", curCRVersion, \"updated CR version\", updatedCRVersion)\n\n\t\t\t// While the current reconcile is in progress, there may be new event(s) from the\n\t\t\t// list of watchers satisfying the predicates. That triggeres a new reconcile right after\n\t\t\t// exiting from the current reconcile, in which case, refers the cached version of the\n\t\t\t// CR missing the updates we are doing here. From K8s resource point of view, this\n\t\t\t// may not be an issue(i.e., expectation is always to be declarative), but the application\n\t\t\t// specific status may not be idempotent(example. trying to install an app which was already installed).\n\t\t\t// So, always make sure that the cache is reflecting the latest CR, before the next event\n\t\t\t// waiting in the Q triggers the next reconcile\n\t\t\tfor chkCnt := 0; chkCnt < maxRetryCountForCRStatusUpdate; chkCnt++ {\n\t\t\t\tcrAfterUpdate, err := fetchCurrentCRWithStatusUpdate(ctx, client, latestCR)\n\t\t\t\tif err == nil && updatedCRVersion == crAfterUpdate.GetResourceVersion() {\n\t\t\t\t\tscopedLog.Info(\"Cache is reflecting the latest CR\", \"updated CR version\", updatedCRVersion)\n\t\t\t\t\t// Latest CR is reflecting in the cache\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\ttime.Sleep(time.Duration(chkCnt) * 10 * time.Millisecond)\n\t\t\t}\n\n\t\t\t// Status update successful\n\t\t\tbreak\n\t\t}\n\n\t\ttime.Sleep(time.Duration(tryCnt) * 10 * time.Millisecond)\n\t}\n\n\tif origCR.GetDeletionTimestamp() == nil && tryCnt >= maxRetryCountForCRStatusUpdate {\n\t\tscopedLog.Error(nil, \"Status update failed\", \"Attempt count\", tryCnt)\n\t}\n}", "title": "" }, { "docid": "a3865c2385435e8865cc82482f1a2ea0", "score": "0.5228857", "text": "func toCustomResourceStatus(currentStatus cephv1.ClusterStatus, newStatus *cephclient.CephStatus) *cephv1.CephStatus {\n\ts := &cephv1.CephStatus{\n\t\tHealth: newStatus.Health.Status,\n\t\tLastChecked: formatTime(time.Now().UTC()),\n\t\tDetails: make(map[string]cephv1.CephHealthMessage),\n\t}\n\tfor name, message := range newStatus.Health.Checks {\n\t\ts.Details[name] = cephv1.CephHealthMessage{\n\t\t\tSeverity: message.Severity,\n\t\t\tMessage: message.Summary.Message,\n\t\t}\n\t}\n\n\tif newStatus.PgMap.TotalBytes != 0 {\n\t\ts.Capacity.TotalBytes = newStatus.PgMap.TotalBytes\n\t\ts.Capacity.UsedBytes = newStatus.PgMap.UsedBytes\n\t\ts.Capacity.AvailableBytes = newStatus.PgMap.AvailableBytes\n\t\ts.Capacity.LastUpdated = formatTime(time.Now().UTC())\n\t}\n\n\tif currentStatus.CephStatus != nil {\n\t\ts.PreviousHealth = currentStatus.CephStatus.PreviousHealth\n\t\ts.LastChanged = currentStatus.CephStatus.LastChanged\n\t\tif currentStatus.CephStatus.Health != s.Health {\n\t\t\ts.PreviousHealth = currentStatus.CephStatus.Health\n\t\t\ts.LastChanged = s.LastChecked\n\t\t}\n\t\tif newStatus.PgMap.TotalBytes == 0 {\n\t\t\ts.Capacity = currentStatus.CephStatus.Capacity\n\t\t}\n\t}\n\t// update fsid on cephcluster Status\n\ts.FSID = newStatus.FSID\n\n\treturn s\n}", "title": "" }, { "docid": "4959586a0143f010bf64d004ba786d69", "score": "0.5135225", "text": "func updateLimits(container *k8sapi.Container, patchCapacity k8sapi.ResourceList, objectID string) bool {\n\tglog.V(4).Infof(\"Begin to update Capacity.\")\n\tchanged := false\n\n\t//1. get the original capacities\n\tresult := make(k8sapi.ResourceList)\n\tfor k, v := range container.Resources.Limits {\n\t\tresult[k] = v\n\t}\n\n\t//2. apply the patch\n\tfor k, v := range patchCapacity {\n\t\toldv, exist := result[k]\n\t\tif !exist || oldv.Cmp(v) != 0 {\n\t\t\tresult[k] = v\n\t\t\tchanged = true\n\t\t}\n\t}\n\n\tif changed {\n\t\tglog.V(2).Infof(\"Try to update container %v in the workload controller [%v] resource limit from %+v to %v\",\n\t\t\tcontainer.Name, objectID, container.Resources.Limits, result)\n\t\tcontainer.Resources.Limits = result\n\t}\n\n\treturn changed\n}", "title": "" }, { "docid": "c0f6c4eb0506afc4c3846ce1f7023e7c", "score": "0.5099849", "text": "func (s *state) send10StatusRequests() {\n\tmessageStatusRequest := messages.NewLocal(messages.TypeStatusRequest, nil, s.ctxt.Identity)\n\tcount := 0\n\tfor _, n := range s.statusRequestCache {\n\t\tgo networking.FetchTcp(messageStatusRequest, n.IpAddress, n.PortTcp)\n\t\tcount++\n\t\tif count > 10 {\n\t\t\tbreak\n\t\t}\n\t}\n\tif len(s.statusRequestCache) <= count-1 {\n\t\ts.statusRequestCache = make([]*node.Node, 0)\n\t} else {\n\t\ts.statusRequestCache = s.statusRequestCache[count-1:]\n\t}\n}", "title": "" }, { "docid": "7728eff9d243bf756c2561d6b2c96f99", "score": "0.5085864", "text": "func (l *ApiLimiter) Limit(ctx context.Context, operation string) {\n\tr := l.limiter.Reserve()\n\tif delay := r.Delay(); delay != time.Duration(0) && delay != rate.InfDuration {\n\t\tl.metrics.ObserveRateLimit(operation, delay)\n\t\tl.limiter.Wait(ctx)\n\t}\n}", "title": "" }, { "docid": "0814da81495b0f17b3fd5b444f993ae9", "score": "0.5080007", "text": "func ComputeStatus(refTime time.Time, availableStatus Statuses) models.TileStatus {\n\ttotalStatusDuration := availableStatus.GetTotalStatusDuration()\n\tif totalStatusDuration == 0 {\n\t\tpanic(\"availableStatus can't be empty. Check your code.\")\n\t}\n\n\tcomputedDuration := time.Since(refTime)\n\tif computedDuration < 0 {\n\t\tcomputedDuration = computedDuration + totalStatusDuration\n\t}\n\tcomputedDuration = computedDuration % totalStatusDuration\n\n\tvar status models.TileStatus\n\tfor _, fakerStatus := range availableStatus {\n\t\tif computedDuration <= fakerStatus.Duration {\n\t\t\tstatus = fakerStatus.Status\n\t\t\tbreak\n\t\t}\n\t\tcomputedDuration = computedDuration - fakerStatus.Duration\n\t}\n\n\treturn status\n}", "title": "" }, { "docid": "7507c32c2f03bdeefcc9a76a962add19", "score": "0.507526", "text": "func (c *Producer) updateStatus(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n if len(args) != 2 {\n return shim.Error(\"This function needs the serial number and the new status as arguments\")\n }\n\n // Look for the serial number\n v, err := stub.GetState(args[0])\n if err != nil {\n return shim.Error(\"Serialnumber \" + args[0] + \" not found \")\n }\n\n // Get Information from Blockchain\n var pc PC\n // Decode JSON data\n json.Unmarshal(v, &pc)\n\n // Change the status\n pc.Status = args[1] \n // Encode JSON data\n pcAsBytes, err := json.Marshal(pc)\n\n // Store in the Blockchain\n err = stub.PutState(pc.Snumber, pcAsBytes)\n if err != nil {\n return shim.Error(err.Error())\n }\n\n return shim.Success(nil)\n}", "title": "" }, { "docid": "745c200f17a41497dd7570b60b24d293", "score": "0.50613666", "text": "func QueryStatusMetrics(hcfg config.HbaseConfig, tenant string, report string, date string, group string, service string, endpoint string, metric string) ([]*hrpc.Result, error) {\n\n\tclient := CreateClient(hcfg)\n\tdefer CloseClient(client)\n\ttp := \"metric\"\n\ttable := tenant + \":\" + \"status\"\n\tfilterStr := report + \"|\" + tp + \"|\" + date + \"|\" + group + \"|\" + service + \"|\" + endpoint\n\tif metric != \"\" {\n\t\tfilterStr = filterStr + \"|\" + metric\n\t}\n\tpFilter := filter.NewPrefixFilter([]byte(filterStr))\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(hbaseTimeout)*time.Second)\n\tdefer cancel()\n\tscanRequest, err := hrpc.NewScanStr(ctx, table, hrpc.Filters(pFilter), hrpc.NumberOfRows(100000))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = errors.New(\"hbase timeout\")\n\tscanRsp, err := client.Scan(scanRequest)\n\n\treturn scanRsp, err\n}", "title": "" }, { "docid": "5f2d3e55c711a91d77c756e8c6f3c014", "score": "0.50567627", "text": "func (s *CommandService) UpdateStatus(cmd sigstat.Command) {}", "title": "" }, { "docid": "f7514aa22bd363a60d5e5e72891efeba", "score": "0.5049659", "text": "func (s *Si4713Driver) deviceStatus() (err error) {\n\tvalues, err := s.buffRead(6)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// values[0] discarded\n\ts.DebugLog(\"Circular avail: %d used: %d\\n\", values[2], values[3])\n\ts.DebugLog(\"FIFO avail: %d used: %d overflow: %d\\n\", values[4], values[5], values[1])\n\treturn nil\n}", "title": "" }, { "docid": "b831ed7cfdfb15467310dee1fa0b2777", "score": "0.5028482", "text": "func update_status(value string, statusmetric *prometheus.GaugeVec) *prometheus.GaugeVec {\n\tvalid_statuscodes := []string{\"ONLINE\", \"ONBATT\", \"CAL\", \"TRIM\", \"BOOST\", \"OVERLOAD\", \"LOWBATT\", \"REPLACEBATT\", \"NOBATT\", \"SLAVE\", \"SLAVEDOWN\", \"SHUTTING DOWN\", \"COMMLOST\"}\n\n\tif statusmetric == nil {\n\t\tstatusmetric = prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\t\tName: \"apcupsd_ups_status\",\n\t\t\tHelp: \"UPS Status\",\n\t\t},\n\t\t[]string{\"type\"})\n\t\tprometheus.MustRegister(statusmetric)\n\t}\n\tfmt.Print(statusmetric)\n\n\tfor _, code := range valid_statuscodes {\n\t\tif strings.Contains(value, code) {\n\t\t\tstatusmetric.With(prometheus.Labels{\"type\": code}).Set(1)\n\t\t} else {\n\t\t\tstatusmetric.With(prometheus.Labels{\"type\": code}).Set(0)\n\t\t}\n\t}\n\n\treturn statusmetric\n}", "title": "" }, { "docid": "66ed3cbc39b679f06ffab69cdff4c7a5", "score": "0.5019787", "text": "func (r *ServiceClusterPollRequest) Status(value int) *ServiceClusterPollRequest {\n\tr.statuses = append(r.statuses, value)\n\treturn r\n}", "title": "" }, { "docid": "2194e269bd1599968a3f259c882912e1", "score": "0.50135016", "text": "func pollStatus(t *testing.T, expectedStatus int, fn func() error) {\n\tvar err error\n\tfor i := 0; i < 12; i++ {\n\t\terr = fn()\n\t\tvar respErr *azcore.ResponseError\n\t\tif !(errors.As(err, &respErr) && respErr.StatusCode == expectedStatus) {\n\t\t\tbreak\n\t\t}\n\t\tif i < 11 {\n\t\t\trecording.Sleep(10 * time.Second)\n\t\t}\n\t}\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "c14abe2732df81d0fe3ff47a60dce4cc", "score": "0.5005993", "text": "func StatusLTE(v int8) predicate.Avatar {\n\treturn predicate.Avatar(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "e0d01915424878cab4f5a0c15986cc58", "score": "0.5002713", "text": "func (c *configSpec) runStatus(ch <-chan timingSample, chCount <-chan struct{}, wg *sync.WaitGroup) {\n\tstats := map[int]*stat{\n\t\tSTOP: &stat{},\n\t\tPUT: &stat{},\n\t\tGET: &stat{},\n\t\tDEL: &stat{},\n\t}\n\tconnectionCount := 0\n\n\t// connect to etcd\n\tdefragCli, err := clientv3.New(clientv3.Config{\n\t\tEndpoints: c.endpoints,\n\t\tDialTimeout: c.DefragTimeout,\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"ERROR: unable to create connection to KV store for defragmentation using '%s': '%s'\\n\",\n\t\t\tc.endpoints, err.Error())\n\t}\n\tdefer defragCli.Close()\n\tsizeCli, err := clientv3.New(clientv3.Config{\n\t\tEndpoints: c.endpoints,\n\t\tDialTimeout: c.EtcdTimeout,\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"ERROR: unable to create connection to KV store for db size telemetry using '%s': '%s'\\n\",\n\t\t\tc.endpoints, err.Error())\n\t}\n\tdefer sizeCli.Close()\n\n\t// output data header\n\tif c.HumanReadable {\n\t\tfmt.Fprintf(os.Stdout, \"% 8s % 21s % 21s % 21s % 21s % 21s % 21s % 21s % 21s % 21s % 21s % 21s % 21s %s\\n\",\n\t\t\t\"TIME\",\n\t\t\t\"PUT_MIN(WAIT/ETCD)\",\n\t\t\t\"PUT_MAX(WAIT/ETCD)\",\n\t\t\t\"PUT_LAST(WAIT/ETCD)\",\n\t\t\t\"PUT_AVG(WAIT/ETCD)\",\n\t\t\t\"GET_MIN(WAIT/ETCD)\",\n\t\t\t\"GET_MAX(WAIT/ETCD)\",\n\t\t\t\"GET_LAST(WAIT/ETCD)\",\n\t\t\t\"GET_AVG(WAIT/ETCD)\",\n\t\t\t\"DEL_MAX(WAIT/ETCD)\",\n\t\t\t\"DEL_MIN(WAIT/ETCD)\",\n\t\t\t\"DEL_LAST(WAIT/ETCD)\",\n\t\t\t\"DEL_AVG(WAIT/ETCD)\",\n\t\t\t\"DB_SIZE\")\n\t} else {\n\t\tfmt.Fprintf(os.Stdout, \"%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\\n\",\n\t\t\t\"TIME\",\n\t\t\t\"PUT_MIN\", \"PUT_MIN_WAIT\", \"PUT_MIN_ETCD\",\n\t\t\t\"PUT_MAX\", \"PUT_MAX_WAIT\", \"PUT_MAX_ETCD\",\n\t\t\t\"PUT_LAST\", \"PUT_LAST_WAIT\", \"PUT_LAST_ETCD\",\n\t\t\t\"PUT_AVG\", \"PUT_AVG_WAIT\", \"PUT_AVG_ETCD\",\n\t\t\t\"GET_MIN\", \"GET_MIN_WAIT\", \"GET_MIN_ETCD\",\n\t\t\t\"GET_MAX\", \"GET_MAX_WAIT\", \"GET_MAX_ETCD\",\n\t\t\t\"GET_LAST\", \"GET_LAST_WAIT\", \"GET_LAST_ETCD\",\n\t\t\t\"GET_AVG\", \"GET_AVG_WAIT\", \"GET_AVG_ETCD\",\n\t\t\t\"DEL_MIN\", \"DEL_MIN_WAIT\", \"DEL_MIN_ETCD\",\n\t\t\t\"DEL_MAX\", \"DEL_MAX_WAIT\", \"DEL_MAX_ETCD\",\n\t\t\t\"DEL_LAST\", \"DEL_LAST_WAIT\", \"DEL_LAST_ETCD\",\n\t\t\t\"DEL_AVG\", \"DEL_AVG_WAIT\", \"DEL_AVG_ETCD\",\n\t\t\t\"DB_SIZE\")\n\t}\n\n\t// tickers for periodic operations like report output and defragmentation\n\treportTicker := time.NewTicker(c.ReportInterval)\n\tdefer reportTicker.Stop()\n\n\tvar defragTicker *time.Ticker\n\n\t// If the defrag interval is 0 then assume never\n\t// defrag. This is implemented by using a very long\n\t// time and then ignoring when the timer is triggered.\n\t//\n\t// The long timer is used so in both cases (defrag and\n\t// no defrag) we can dereference the var in the select.\n\tif c.DefragInterval == 0 {\n\t\tdefragTicker = time.NewTicker(100 * time.Hour)\n\t} else {\n\t\tdefragTicker = time.NewTicker(c.DefragInterval)\n\t}\n\tdefer defragTicker.Stop()\n\n\t// process away\n\tfor {\n\t\tselect {\n\t\tcase <-defragTicker.C:\n\n\t\t\tif c.DefragInterval == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// defrag in the background\n\t\t\tgo func() {\n\n\t\t\t\t// you have to defrag the endpoints individually\n\t\t\t\tfor _, ep := range c.endpoints {\n\t\t\t\t\tctx, cancel := context.WithTimeout(context.Background(),\n\t\t\t\t\t\tc.DefragTimeout)\n\t\t\t\t\t_, err = defragCli.Defragment(ctx, ep)\n\t\t\t\t\tcancel()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Fatalf(\"ERROR: unable to defragment etcd endpoint '%s': '%s'\\n\",\n\t\t\t\t\t\t\tep, err.Error())\n\t\t\t\t\t}\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"Defragmentation of '%s' completed\\n\", ep)\n\t\t\t\t}\n\t\t\t}()\n\t\tcase <-reportTicker.C:\n\n\t\t\ttotal := c.PutCondition + c.GetCondition + c.DelCondition\n\t\t\tcount := min(stats[PUT].count, int64(c.PutCondition)) +\n\t\t\t\tmin(stats[GET].count, int64(c.GetCondition)) +\n\t\t\t\tmin(stats[DEL].count, int64(c.DelCondition))\n\t\t\t// output completeness stats to stderr\n\t\t\tcomplete := count * int64(100) / int64(total)\n\t\t\tfmt.Fprintf(os.Stderr, \"%d%% - %d/%d %d/%d %d/%d %d\\n\",\n\t\t\t\tcomplete,\n\t\t\t\tstats[PUT].count, c.PutCondition,\n\t\t\t\tstats[GET].count, c.GetCondition,\n\t\t\t\tstats[DEL].count, c.DelCondition,\n\t\t\t\tconnectionCount)\n\n\t\t\t// if we don't have any data, then no need to output anything else\n\t\t\tif stats[PUT].count == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// calculate db size as average from each endpoint\n\t\t\tdbSize := int64(0)\n\t\t\tdbCnt := int64(0)\n\t\t\tfor _, ep := range c.endpoints {\n\t\t\t\tctx, cancel := context.WithTimeout(context.Background(), c.EtcdTimeout)\n\t\t\t\tstatus, err := sizeCli.Status(ctx, ep)\n\t\t\t\tcancel()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatalf(\"ERROR: unable to read KV storage size from '%s': '%s'\\n\",\n\t\t\t\t\t\tep, err.Error())\n\t\t\t\t}\n\t\t\t\tdbSize += status.DbSize\n\t\t\t\tdbCnt++\n\t\t\t}\n\t\t\tif dbCnt == 0 {\n\t\t\t\tdbSize = 0\n\t\t\t} else {\n\t\t\t\tdbSize = dbSize / dbCnt\n\t\t\t}\n\n\t\t\t// output stats as either human readable (with units) or\n\t\t\t// as base units milliseconds/bytes\n\t\t\tif c.HumanReadable {\n\t\t\t\tfmt.Fprintf(os.Stdout, \"%s % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) % 6v(% 6v/% 6v) %v\\n\",\n\t\t\t\t\ttime.Now().Format(\"15:04:05\"),\n\n\t\t\t\t\tstats[PUT].total.min.Truncate(c.unit), stats[PUT].wait.min.Truncate(c.unit), stats[PUT].etcd.min.Truncate(c.unit),\n\t\t\t\t\tstats[PUT].total.max.Truncate(c.unit), stats[PUT].wait.max.Truncate(c.unit), stats[PUT].etcd.max.Truncate(c.unit),\n\t\t\t\t\tstats[PUT].total.last.Truncate(c.unit), stats[PUT].wait.last.Truncate(c.unit), stats[PUT].etcd.last.Truncate(c.unit),\n\t\t\t\t\tc.avg(stats[PUT].total.avg, stats[PUT].count).Truncate(c.unit), c.avg(stats[PUT].wait.avg, stats[PUT].count).Truncate(c.unit), c.avg(stats[PUT].etcd.avg, stats[PUT].count).Truncate(c.unit),\n\n\t\t\t\t\tstats[GET].total.min.Truncate(c.unit), stats[GET].wait.min.Truncate(c.unit), stats[GET].etcd.min.Truncate(c.unit),\n\t\t\t\t\tstats[GET].total.max.Truncate(c.unit), stats[GET].wait.max.Truncate(c.unit), stats[GET].etcd.max.Truncate(c.unit),\n\t\t\t\t\tstats[GET].total.last.Truncate(c.unit), stats[GET].wait.last.Truncate(c.unit), stats[GET].etcd.last.Truncate(c.unit),\n\t\t\t\t\tc.avg(stats[GET].total.avg, stats[GET].count).Truncate(c.unit), c.avg(stats[GET].wait.avg, stats[GET].count).Truncate(c.unit), c.avg(stats[GET].etcd.avg, stats[GET].count).Truncate(c.unit),\n\n\t\t\t\t\tstats[DEL].total.min.Truncate(c.unit), stats[DEL].wait.min.Truncate(c.unit), stats[DEL].etcd.min.Truncate(c.unit),\n\t\t\t\t\tstats[DEL].total.max.Truncate(c.unit), stats[DEL].wait.max.Truncate(c.unit), stats[DEL].etcd.max.Truncate(c.unit),\n\t\t\t\t\tstats[DEL].total.last.Truncate(c.unit), stats[DEL].wait.last.Truncate(c.unit), stats[DEL].etcd.last.Truncate(c.unit),\n\t\t\t\t\tc.avg(stats[DEL].total.avg, stats[DEL].count).Truncate(c.unit), c.avg(stats[DEL].wait.avg, stats[DEL].count).Truncate(c.unit), c.avg(stats[DEL].etcd.avg, stats[DEL].count).Truncate(c.unit),\n\n\t\t\t\t\tbs.New(float64(dbSize)),\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(os.Stdout, \"%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\\n\",\n\t\t\t\t\ttime.Now().Format(\"15:04:05\"),\n\t\t\t\t\tc.toMU(stats[PUT].total.min), c.toMU(stats[PUT].wait.min), c.toMU(stats[PUT].etcd.min),\n\t\t\t\t\tc.toMU(stats[PUT].total.max), c.toMU(stats[PUT].wait.max), c.toMU(stats[PUT].etcd.max),\n\t\t\t\t\tc.toMU(stats[PUT].total.last), c.toMU(stats[PUT].wait.last), c.toMU(stats[PUT].etcd.last),\n\t\t\t\t\tc.toMU(c.avg(stats[PUT].total.avg, stats[PUT].count)), c.toMU(c.avg(stats[PUT].wait.avg, stats[PUT].count)), c.toMU(c.avg(stats[PUT].etcd.avg, stats[PUT].count)),\n\n\t\t\t\t\tc.toMU(stats[GET].total.min), c.toMU(stats[GET].wait.min), c.toMU(stats[GET].etcd.min),\n\t\t\t\t\tc.toMU(stats[GET].total.max), c.toMU(stats[GET].wait.max), c.toMU(stats[GET].etcd.max),\n\t\t\t\t\tc.toMU(stats[GET].total.last), c.toMU(stats[GET].wait.last), c.toMU(stats[GET].etcd.last),\n\t\t\t\t\tc.toMU(c.avg(stats[GET].total.avg, stats[GET].count)), c.toMU(c.avg(stats[GET].wait.avg, stats[GET].count)), c.toMU(c.avg(stats[GET].etcd.avg, stats[GET].count)),\n\n\t\t\t\t\tc.toMU(stats[DEL].total.min), c.toMU(stats[DEL].wait.min), c.toMU(stats[DEL].etcd.min),\n\t\t\t\t\tc.toMU(stats[DEL].total.max), c.toMU(stats[DEL].wait.max), c.toMU(stats[DEL].etcd.max),\n\t\t\t\t\tc.toMU(stats[DEL].total.last), c.toMU(stats[DEL].wait.last), c.toMU(stats[DEL].etcd.last),\n\t\t\t\t\tc.toMU(c.avg(stats[DEL].total.avg, stats[DEL].count)), c.toMU(c.avg(stats[DEL].wait.avg, stats[DEL].count)), c.toMU(c.avg(stats[DEL].etcd.avg, stats[DEL].count)),\n\t\t\t\t\tdbSize,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Check exit conditions\n\t\t\tif stats[PUT].count >= int64(c.PutCondition) &&\n\t\t\t\tstats[GET].count >= int64(c.GetCondition) &&\n\t\t\t\tstats[DEL].count >= int64(c.DelCondition) {\n\t\t\t\twg.Done()\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-chCount:\n\t\t\tconnectionCount++\n\t\tcase sample := <-ch:\n\t\t\tswitch sample.Op {\n\t\t\tcase STOP:\n\t\t\t\t// signal all done\n\t\t\t\twg.Done()\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tstats[sample.Op].Update(sample, c.unit)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "647b6972f20a7b0ea57275c16b5029ec", "score": "0.49859604", "text": "func StatusPoller(ctx context.Context, sr StatusReconciler) {\n\tticker := time.NewTicker(1 * time.Minute)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tsr.Iterate(func(meta metav1.Object, conditions []monitoringv1.Condition) {\n\t\t\t\tfor _, cond := range conditions {\n\t\t\t\t\tif cond.Type == monitoringv1.Available && cond.Status != monitoringv1.ConditionTrue {\n\t\t\t\t\t\tsr.RefreshStatusFor(meta)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "68b768905f10d7050c06868537329703", "score": "0.49830043", "text": "func (t *LeakyBucket) Limit(ctx context.Context) (time.Duration, error) {\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\tif err := t.locker.Lock(ctx); err != nil {\n\t\treturn 0, err\n\t}\n\tdefer func() {\n\t\tif err := t.locker.Unlock(ctx); err != nil {\n\t\t\tt.logger.Log(err)\n\t\t}\n\t}()\n\tstate, err := t.backend.State(ctx)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tnow := t.clock.Now().UnixNano()\n\tif now < state.Last {\n\t\t// The queue has requests in it: move the current request to the last position + 1.\n\t\tstate.Last += t.rate\n\t} else {\n\t\t// The queue is empty.\n\t\t// The offset is the duration to wait in case the last request happened less than rate duration ago.\n\t\tvar offset int64\n\t\tdelta := now - state.Last\n\t\tif delta < t.rate {\n\t\t\toffset = t.rate - delta\n\t\t}\n\t\tstate.Last = now + offset\n\t}\n\n\twait := state.Last - now\n\tif wait/t.rate > t.capacity {\n\t\treturn time.Duration(wait), ErrLimitExhausted\n\t}\n\tif err = t.backend.SetState(ctx, state); err != nil {\n\t\treturn 0, err\n\t}\n\treturn time.Duration(wait), nil\n}", "title": "" }, { "docid": "fee87e9e3eddc0e667ea2adb4519d30b", "score": "0.49829736", "text": "func updateDeploymentStatusMetrics(method, organisation, project string, statusCode int, startTime time.Time) {\n\tdeploymentStatusRequestDuration.WithLabelValues(\n\t\tmethod,\n\t\torganisation,\n\t\tproject,\n\t\tstrconv.Itoa(statusCode),\n\t).Set(\n\t\tfloat64(time.Since(startTime) / time.Millisecond),\n\t)\n\n\tdeploymentStatusResponseCodeTotal.WithLabelValues(\n\t\tmethod,\n\t\torganisation,\n\t\tproject,\n\t\tstrconv.Itoa(statusCode),\n\t).Inc()\n}", "title": "" }, { "docid": "34ee0650522f3f59cbac53def733e4d6", "score": "0.49732122", "text": "func (c *Producer) updateStatus(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n if len(args) != 2 {\n return shim.Error(\"This function needs the serial number as argument\")\n }\n\n // Look for the serial number\n v, err := stub.GetState(args[0])\n if err != nil {\n return shim.Error(\"Serialnumber \" + args[0] + \" not found \")\n }\n\n // Get Information from Blockchain\n var pc PC\n // Decode JSON data\n json.Unmarshal(v, &pc)\n\n // Change the status\n pc.Status = args[1] \n // Encode JSON data\n pcAsBytes, err := json.Marshal(pc)\n\n // Store in the Blockchain\n err = stub.PutState(pc.Snumber, pcAsBytes)\n if err != nil {\n return shim.Error(err.Error())\n }\n\n return shim.Success(nil)\n}", "title": "" }, { "docid": "884b236369455d153cf158c8829ab412", "score": "0.4968514", "text": "func (m *ManagedDeviceMobileAppConfigurationItemRequestBuilder) DeviceStatuses()(*iebd1b47b377fdbd0e32c261a4ebc852aebb3266e58bde42f93309b4e2edc6d16.DeviceStatusesRequestBuilder) {\n return iebd1b47b377fdbd0e32c261a4ebc852aebb3266e58bde42f93309b4e2edc6d16.NewDeviceStatusesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "7a9ac9332f88c7d6e2751be0b9340b6c", "score": "0.49621528", "text": "func runThrottledStatusNotifier(ctx context.Context, interval time.Duration, bucket int, ch <-chan SyncWorkerStatus, fn func()) {\n\t// notify the status change function fairly infrequently to avoid updating\n\t// the caller status more frequently than is needed\n\tthrottle := rate.NewLimiter(rate.Every(interval), bucket)\n\twait.UntilWithContext(ctx, func(ctx context.Context) {\n\t\tvar last SyncWorkerStatus\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase next := <-ch:\n\t\t\t\t// only throttle if we aren't on an edge\n\t\t\t\tif next.Generation == last.Generation && next.Actual.Image == last.Actual.Image && next.Reconciling == last.Reconciling && (next.Failure != nil) == (last.Failure != nil) {\n\t\t\t\t\tif err := throttle.Wait(ctx); err != nil && err != context.Canceled && err != context.DeadlineExceeded {\n\t\t\t\t\t\tutilruntime.HandleError(fmt.Errorf(\"unable to throttle status notification: %v\", err))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlast = next\n\n\t\t\t\tfn()\n\t\t\t}\n\t\t}\n\t}, 1*time.Second)\n}", "title": "" }, { "docid": "c84785b30f6871b9424c10739efd4f4f", "score": "0.49485576", "text": "func (c *PcXchg) updateStatus(stub shim.ChaincodeStubInterface, args []string, status string) pb.Response {\n if len(args) != 1 {\n return shim.Error(\"This function needs the serial number as argument\")\n }\n\n // Look for the serial number\n v, err := stub.GetState(args[0])\n if err != nil {\n return shim.Error(\"Serialnumber \" + args[0] + \" not found \")\n }\n\n // Get Information from Blockchain\n var pc PC\n // Decode JSON data\n json.Unmarshal(v, &pc)\n\n // Change the status\n pc.Status = status \n // Encode JSON data\n pcAsBytes, err := json.Marshal(pc)\n\n // Store in the Blockchain\n err = stub.PutState(pc.Snumber, pcAsBytes)\n if err != nil {\n return shim.Error(err.Error())\n }\n\n return shim.Success(nil)\n}", "title": "" }, { "docid": "ce87532fd8234521811c26f7bfce855d", "score": "0.49471638", "text": "func updateStatus(c client.Client) {\n\tinstance := &mcov1beta2.MultiClusterObservability{}\n\terr := c.Get(context.TODO(), types.NamespacedName{\n\t\tName: config.GetMonitoringCRName(),\n\t}, instance)\n\tif err != nil {\n\t\tlog.Error(err, fmt.Sprintf(\"Failed to get existing mco %s\", instance.Name))\n\t\treturn\n\t}\n\toldStatus := instance.Status\n\tnewStatus := oldStatus.DeepCopy()\n\tupdateInstallStatus(&newStatus.Conditions)\n\tupdateReadyStatus(&newStatus.Conditions, c, instance)\n\tupdateAddonSpecStatus(&newStatus.Conditions, instance)\n\tfillupStatus(&newStatus.Conditions)\n\tinstance.Status.Conditions = newStatus.Conditions\n\tif !reflect.DeepEqual(newStatus.Conditions, oldStatus.Conditions) {\n\t\terr := c.Status().Update(context.TODO(), instance)\n\t\tif err != nil {\n\t\t\tlog.Error(err, fmt.Sprintf(\"failed to update status of mco %s\", instance.Name))\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "86fbb59f200ab49fe58a44c5718b3543", "score": "0.49314728", "text": "func setDevLimit(dir string, devID uint64) (uint64, error) {\n\tlock.Lock()\n\tlimit, exist := devLimits[devID]\n\tlock.Unlock()\n\tif exist {\n\t\treturn limit, nil\n\t}\n\n\tmp, err := getMountpoint(dir)\n\tif err != nil {\n\t\treturn 0, errors.Wrapf(err, \"failed to set device limit, dir(%s), devID(%d)\", dir, devID)\n\t}\n\n\tnewDevID, _ := system.GetDevID(mp)\n\tif newDevID != devID {\n\t\treturn 0, errors.Errorf(\"failed to set device limit, no such device id(%d), checked id(%d)\",\n\t\t\tdevID, newDevID)\n\t}\n\n\t// get storage upper limit of the device which the dir is on.\n\tvar stfs syscall.Statfs_t\n\tif err := syscall.Statfs(mp, &stfs); err != nil {\n\t\tlogrus.Errorf(\"failed to get path(%s) limit, err(%v)\", mp, err)\n\t\treturn 0, errors.Wrapf(err, \"failed to get path(%s) limit\", mp)\n\t}\n\tlimit = stfs.Blocks * uint64(stfs.Bsize)\n\n\tlock.Lock()\n\tdevLimits[devID] = limit\n\tlock.Unlock()\n\n\tlogrus.Debugf(\"SetDevLimit: dir(%s), mountpoint(%s), limit(%v) B\", dir, mp, limit)\n\treturn limit, nil\n}", "title": "" }, { "docid": "465d2d7245979bae4a3609fcd857313b", "score": "0.49254304", "text": "func checkDevLimit(dir string, size uint64) error {\n\tdevID, err := system.GetDevID(dir)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to get device id, dir(%s)\", dir)\n\t}\n\n\tlock.Lock()\n\tlimit, exist := devLimits[devID]\n\tlock.Unlock()\n\tif !exist {\n\t\t// if has not recorded, just add (dir, device, limit) to driver.\n\t\tif limit, err = setDevLimit(dir, devID); err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to set device limit, dir(%s), devID: (%d)\", dir, devID)\n\t\t}\n\t}\n\n\tif limit < size {\n\t\treturn fmt.Errorf(\"dir %s quota limit %v must be less than %v\", dir, size, limit)\n\t}\n\n\tlogrus.Debugf(\"succeeded in checkDevLimit (dir %s quota limit %v B) with size %v B\", dir, limit, size)\n\n\treturn nil\n}", "title": "" }, { "docid": "66f3a7575dfe13309b510bfa3a3448e4", "score": "0.492038", "text": "func StatusLTE(v string) predicate.Reportwallettb {\n\treturn predicate.Reportwallettb(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "8726d5965c6799cf69cd5c8c34e878a4", "score": "0.4909713", "text": "func (a *Actuator) updateStatus(machine *clusterv1.Machine) error {\n\tif a.v1Alpha1Client == nil {\n\t\treturn nil\n\t}\n\tstatus := MachineStatus(machine)\n\tcurrentMachine, err := util.GetMachineIfExists(a.v1Alpha1Client.Machines(machine.Namespace), machine.ObjectMeta.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif currentMachine == nil {\n\t\t// The current status no longer exists because the matching CRD has been deleted.\n\t\treturn fmt.Errorf(\"Machine has already been deleted. Cannot update current instance status for machine %v\", machine.ObjectMeta.Name)\n\t}\n\n\tcurrentMachine.ObjectMeta.Annotations = machine.ObjectMeta.Annotations\n\tm, err := a.setMachineStatus(currentMachine, status)\n\tif err != nil {\n\t\tglog.Infof(\"updateStatus: failed to set instance-status for machine %s\", m.ObjectMeta.Name)\n\t\treturn err\n\t}\n\tglog.Infof(\"setMachineStatus: successfully set instance-status for machine %s\", m.ObjectMeta.Name)\n\n\t_, err = a.v1Alpha1Client.Machines(m.Namespace).Update(m)\n\treturn err\n}", "title": "" }, { "docid": "7670e6ad07f268ca8cd84ca0903a50c9", "score": "0.4905959", "text": "func (m *CloudPC) SetStatus(value *CloudPcStatus)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "afe0534f26b78686b649ec56d69ba90d", "score": "0.4893369", "text": "func StatusLTE(v string) predicate.ReportWallet {\n\treturn predicate.ReportWallet(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "80c5143107d46e59bf722a8a43563374", "score": "0.48883504", "text": "func (px *Paxos) Status(seq int) (Fate, interface{}) {\n\t// Your code here.\n\tmin := px.Min()\n\tif (seq < min) {\n\t\treturn Forgotten, nil\n\t}\n\tpx.mu.Lock()\n\tdefer px.mu.Unlock()\n\tstat, ok := px.instance[seq]\n\tif (ok && stat.status == Decided) {\n\t\treturn Decided, px.database[seq]\n\t} else {\n\t\treturn Pending, nil\n\t}\n}", "title": "" }, { "docid": "4814e038fee95849cd80022d461094c9", "score": "0.4875752", "text": "func (c *Controller) Start(ctx context.Context) error {\n\tif err := c.updateStatus(ctx, true); err != nil {\n\t\treturn err\n\t}\n\tlimiter := rate.NewLimiter(rate.Every(30*time.Second), 2)\n\tgo wait.Until(func() {\n\t\ttimer := time.NewTicker(2 * time.Minute)\n\t\tdefer timer.Stop()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\tcase <-timer.C:\n\t\t\t\terr := limiter.Wait(ctx)\n\t\t\t\tif err != nil {\n\t\t\t\t\tklog.Errorf(\"Limiter error by timer: %v\", err)\n\t\t\t\t}\n\t\t\tcase <-c.statusCh:\n\t\t\t\terr := limiter.Wait(ctx)\n\t\t\t\tif err != nil {\n\t\t\t\t\tklog.Errorf(\"Limiter error by status: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := c.updateStatus(ctx, false); err != nil {\n\t\t\t\tklog.Errorf(\"Unable to write cluster operator status: %v\", err)\n\t\t\t}\n\t\t}\n\t}, time.Second, ctx.Done())\n\treturn nil\n}", "title": "" }, { "docid": "4b3e9620819337dfd40042c968f24d58", "score": "0.48694786", "text": "func (u *DeviceUpdater) UpdateDeviceStatus(n *DeviceNotification) {\n\t// The device should be authenticated to be as valid device\n\tpf := factory.NewFactory(models.Device{})\n\towner := factory.NewOwner(n.UserID)\n\n\tdeviceModel, err := pf.Get(owner, n.DeviceID)\n\tif err != nil {\n\t\tlogrus.Errorf(\"ilegal device '%s' notification received\", n.DeviceID)\n\t\treturn\n\t}\n\tdevice := deviceModel.(*models.Device)\n\tswitch n.Type {\n\tcase KDeviceConnected:\n\t\tdevice.Status = models.KDeviceStatusConnected\n\t\tbreak\n\tcase KDeviceDisconnected:\n\t\tdevice.Status = models.KDeviceStatusDisconnected\n\t\tbreak\n\tdefault:\n\t\tdevice.Status = models.KDeviceStatusUnknown\n\t}\n\tdevice.LastUpdatedAt = time.Now()\n\tpf.Update(owner, device)\n}", "title": "" }, { "docid": "34b083659b48f66df93ac0f79b01f242", "score": "0.4867864", "text": "func UpdateTotalResourcesUtilization(cpu float64, memory float64, updateType int, taskID string){\n\ttaskClass := tasks[taskID].TaskClass\n\n\tlocks[taskClass].Lock()\n\tpreviousTotalResourceUtilization := tasks[taskID].TotalResourcesUtilization\n\tafterTotalResourceUtilization := 0.0\n\n\tfmt.Print(\"Updating total resources utilization of \" + taskID + \" previous value \") \n\tfmt.Println(previousTotalResourceUtilization)\n\n\tswitch updateType {\n\t\tcase 1:\n\t\t\tafterTotalResourceUtilization = math.Max(cpu, memory)\n\t\t\ttasks[taskID].TotalResourcesUtilization = afterTotalResourceUtilization\n\t\t\tbreak\n\t\tcase 2:\n\t\t\tafterTotalResourceUtilization = math.Max(cpu, tasks[taskID].MemoryUtilization)\n\t\t\ttasks[taskID].TotalResourcesUtilization = afterTotalResourceUtilization\n\t\t\tbreak\n\t\tcase 3:\n\t\t\tafterTotalResourceUtilization = math.Max(tasks[taskID].CPUUtilization, memory)\n\t\t\ttasks[taskID].TotalResourcesUtilization = afterTotalResourceUtilization\n\t\t\tbreak\n\t}\n\tfmt.Print(\"Updating total resources utilization of \" + taskID + \" new value \")\n\tfmt.Println(afterTotalResourceUtilization)\n\n\tlocks[taskClass].Unlock()\n\n\t//now we must check if the host region should be updated or not\n\tif afterTotalResourceUtilization != previousTotalResourceUtilization { \n\t\tgo UpdateList(taskID) //we going to update the task position inside its list\t\t\n\t}\n}", "title": "" }, { "docid": "49ea2dc06feb677b2806be5d42a180e1", "score": "0.48450246", "text": "func silentUpdateStatus(ctx context.Context, client kclient.Client, k8sResource kclient.Object) {\n\tlog := ctrllog.FromContext(ctx)\n\tstatusErr := client.Status().Update(ctx, k8sResource)\n\tif statusErr != nil {\n\t\tlog.Error(statusErr, \"failed to report error in status conditions\")\n\t}\n}", "title": "" }, { "docid": "91c53bc1e850a6c648a21a830789e067", "score": "0.4844749", "text": "func (qs TicketQuerySet) StatusGt(status TicketStatus) TicketQuerySet {\n\treturn qs.w(qs.db.Where(\"status > ?\", status))\n}", "title": "" }, { "docid": "2be365c6fa5dde64edb257f45b090cb3", "score": "0.48320743", "text": "func (c *ArtXchg) updateStatus(stub shim.ChaincodeStubInterface, args []string, status string) pb.Response {\n if len(args) != 1 {\n return shim.Error(\"This function needs the serial number as argument\")\n }\n\n // Look for the serial number\n v, err := stub.GetState(args[0])\n if err != nil {\n return shim.Error(\"Serialnumber \" + args[0] + \" not found \")\n }\n\n // Get Information from Blockchain\n var art ART\n // Decode JSON data\n json.Unmarshal(v, &art)\n\n // Change the status\n art.Status = status\n // Encode JSON data\n artAsBytes, err := json.Marshal(art)\n\n // Store in the Blockchain\n err = stub.PutState(art.Snumber, artAsBytes)\n if err != nil {\n return shim.Error(err.Error())\n }\n return shim.Success(nil)\n}", "title": "" }, { "docid": "32196ecfbfac65d320616160122e83cf", "score": "0.4831117", "text": "func (c *pfscommon) setStatus(metrics cgm.Metrics, err error) {\n\tc.Lock()\n\tif err == nil {\n\t\tc.lastError = \"\"\n\t\tc.lastMetrics = metrics\n\t} else {\n\t\tc.lastError = err.Error()\n\t\t// on error, ensure metrics are reset\n\t\t// do not keep returning a stale set of metrics\n\t\tc.lastMetrics = cgm.Metrics{}\n\t}\n\tc.lastEnd = time.Now()\n\tif !c.lastStart.IsZero() {\n\t\tc.lastRunDuration = time.Since(c.lastStart)\n\t}\n\tc.running = false\n\tc.Unlock()\n}", "title": "" }, { "docid": "acb94fc6c0c215762c4feb0ffa89cb2f", "score": "0.48262793", "text": "func (a *Actuator) updateStatus(machine *machinev1.Machine, state string) error {\n\tglog.Infof(\"Updating status for %s\", machine.Name)\n\n\t// Starting with a fresh status as we assume full control of it here.\n\tstatus := &providerconfigv1.BaremetalMachineProviderStatus{}\n\tif err := a.codec.DecodeProviderStatus(machine.Status.ProviderStatus, status); err != nil {\n\t\tglog.Errorf(\"Error decoding machine provider status: %v\", err)\n\t\treturn err\n\t}\n\n\t// Update the baremetal provider status in-place.\n\tstatus.Status = &state\n\n\t// Call client to update status\n\tif err := a.updateMachineStatus(machine, status); err != nil {\n\t\tglog.Errorf(\"error updating machine status: %v\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e2d5a993394498ed77d03a7da219e307", "score": "0.4818518", "text": "func StatusGT(v int8) predicate.Avatar {\n\treturn predicate.Avatar(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "893316ba1e7e9797dcfba2ea15dd4844", "score": "0.4816845", "text": "func (m *ThreatSubmission) SetStatus(value *LongRunningOperationStatus)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8703de701206047c144089ed4e330f99", "score": "0.48139733", "text": "func ds_getStatusBar(r *http.Request) []Status {\n\t//c := appengine.NewContext(r)\n\tvar tasks []Task\n\tds_getTasks(&tasks, r)\n\tvar m = make(map[string](time.Duration))\n\tfor i := 0; i < len(tasks); i++ {\n\t\tvar t = tasks[i]\n\t\tvar dur = t.End.Sub(t.Start)\n\t\tm[t.Category] = m[t.Category] + dur\n\t}\n\n\tvar status []Status\n\tvar totalsecs int64 = 0\n\tfor k, dur := range m {\n\t\tvar seconds = int64(dur.Seconds())\n\t\tvar s = Status{Title: k, Seconds: seconds, Percentage: 0}\n\t\tstatus = append(status, s)\n\t\ttotalsecs += seconds\n\t}\n\n\tfor i, _ := range status {\n\t\tstatus[i].Percentage = float64(status[i].Seconds) / float64(totalsecs)\n\t}\n\n\t//add total\n\tvar totalstatus = Status{Title: \"total\", Seconds: totalsecs, Percentage: 1}\n\tstatus = append(status, totalstatus)\n\n\treturn status\n}", "title": "" }, { "docid": "26683ebbdcfdbf4d829722dd7e20469f", "score": "0.4809792", "text": "func Status(v int8) predicate.Avatar {\n\treturn predicate.Avatar(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "9173e3873a5fa29c2a18ade7ea541940", "score": "0.4803241", "text": "func (m *ServiceHealth) SetStatus(value *ServiceHealthStatus)() {\n m.status = value\n}", "title": "" }, { "docid": "b5e3938753d1880791a2f86d455ffdb4", "score": "0.47965938", "text": "func (m *DeviceLogCollectionResponse) SetStatus(value *AppLogUploadState)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c511fe063ec82363064c4809a2b91ac7", "score": "0.47596362", "text": "func (rtq *RefreshTokenQuery) Limit(limit int) *RefreshTokenQuery {\n\trtq.ctx.Limit = &limit\n\treturn rtq\n}", "title": "" }, { "docid": "95919f28f68d421c9f81d869fcc009a7", "score": "0.4751707", "text": "func (dlr *DefaultRequestLog) Status(_ context.Context, s int) {\n\tklog.V(vLevel).Infof(\"RL: Status: %d\", s)\n}", "title": "" }, { "docid": "ab8c8b058297529af4cd0ab8892904d5", "score": "0.47365707", "text": "func (c *MysqlCluster) UpdateStatusCondition(condType ClusterConditionType,\n\tstatus apiv1.ConditionStatus, reason, msg string) {\n\tnewCondition := ClusterCondition{\n\t\tType: condType,\n\t\tStatus: status,\n\t\tReason: reason,\n\t\tMessage: msg,\n\t}\n\n\tt := time.Now()\n\n\tif len(c.Status.Conditions) == 0 {\n\t\tglog.Infof(\"Setting lastTransitionTime for mysql cluster \"+\n\t\t\t\"%q condition %q to %v\", c.Name, condType, t)\n\t\tnewCondition.LastTransitionTime = metav1.NewTime(t)\n\t\tc.Status.Conditions = []ClusterCondition{newCondition}\n\t} else {\n\t\tif i, exist := c.condExists(condType); exist {\n\t\t\tcond := c.Status.Conditions[0]\n\t\t\tif cond.Status != newCondition.Status {\n\t\t\t\tglog.Infof(\"Found status change for mysql cluster \"+\n\t\t\t\t\t\"%q condition %q: %q -> %q; setting lastTransitionTime to %v\",\n\t\t\t\t\tc.Name, condType, cond.Status, status, t)\n\t\t\t\tnewCondition.LastTransitionTime = metav1.NewTime(t)\n\t\t\t} else {\n\t\t\t\tnewCondition.LastTransitionTime = cond.LastTransitionTime\n\t\t\t}\n\t\t\tglog.Infof(\"Setting lastTransitionTime for mysql cluster \"+\n\t\t\t\t\"%q condition %q to %q\", c.Name, condType, status)\n\t\t\tc.Status.Conditions[i] = newCondition\n\t\t} else {\n\t\t\tglog.Infof(\"Setting new condition for mysql cluster %q, condition %q to %q\",\n\t\t\t\tc.Name, condType, status)\n\t\t\tnewCondition.LastTransitionTime = metav1.NewTime(t)\n\t\t\tc.Status.Conditions = append(c.Status.Conditions, newCondition)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "999b9e293b0beed09ed87150b400c642", "score": "0.47176215", "text": "func StatusLTE(v string) predicate.AbiturientEntry {\n\treturn predicate.AbiturientEntry(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "30d3fad43bd9c552f21971d64fe44624", "score": "0.47145966", "text": "func changeMedicalReportStatus(accession string, status int) (count int64, err error) {\n\t//\n\tdb, err := connectDBMedicalReports()\n\tif err != nil {\n\t\tError.Println(\"Could not modify medical reports status into local storage. \", err)\n\t}\n\tdefer db.Close()\n\n\tstatement := \"UPDATE medical_reports SET status = $1 WHERE acs_number = $2\"\n\tstmt, err := db.Prepare(statement)\n\tif err != nil {\n\t\tError.Println(\"Problems preparing the statement that changes the status of medical reports. \", err)\n\t}\n\tdefer stmt.Close()\n\n\tres, err := stmt.Exec(status, accession)\n\tif err != nil {\n\t\tError.Println(\"The status update could not be executed in the medical report. \", err)\n\t}\n\n\tcount, err = res.RowsAffected()\n\tif err != nil {\n\t\tError.Println(\"Problems calculating the records affected by the status update in the medical reports. \", err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "fff926f32824225b9b46aeb79ec4dcb7", "score": "0.47048354", "text": "func (l *limit) update() {\n\tif l.limit == l.max {\n\t\treturn\n\t}\n\n\tdelta := time.Since(l.lastTime)\n\tn := uint32(delta / l.timeout)\n\tif l.limit+n >= l.max {\n\t\tl.limit = l.max\n\t\treturn\n\t}\n\n\tl.limit += n\n}", "title": "" }, { "docid": "a120d72b9741932872d74699db463983", "score": "0.4703562", "text": "func updateStatus(msg *Message, resp *Response, allResults map[string]Result) int {\n\tunsentRegIDs := make([]string, 0, resp.Failure)\n\tfor i := 0; i < len(resp.Results); i++ {\n\t\tregID := msg.RegistrationIDs[i]\n\t\tallResults[regID] = resp.Results[i]\n\t\tif resp.Results[i].Error == \"Unavailable\" {\n\t\t\tunsentRegIDs = append(unsentRegIDs, regID)\n\t\t}\n\t}\n\tmsg.RegistrationIDs = unsentRegIDs\n\treturn len(unsentRegIDs)\n}", "title": "" }, { "docid": "143125ea7a230036911d35f67c333e0a", "score": "0.4695379", "text": "func StatusLT(v int8) predicate.Avatar {\n\treturn predicate.Avatar(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "aa82f41c3462a95fb91a8853621eb952", "score": "0.46902373", "text": "func (b *FollowUpChangeBuilder) Status(value interface{}) *FollowUpChangeBuilder {\n\tb.status = value\n\tb.bitmap_ |= 64\n\treturn b\n}", "title": "" }, { "docid": "5c99d68812d67c9c6c9379a8b756e6a6", "score": "0.4683572", "text": "func updateStatus(ctx context.Context, cli client.Client) error {\n\tvar dep appsv1.Deployment\n\terr := cli.Get(ctx, client.ObjectKey{Namespace: \"default\", Name: \"sample\"}, &dep)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdep.Status.AvailableReplicas = 3\n\terr = cli.Status().Update(ctx, &dep)\n\treturn err\n}", "title": "" }, { "docid": "80a4d51b7e0e99e7d9c79cd0b9b32e2d", "score": "0.46802846", "text": "func (client *Client) QueryBatchRegisterDeviceStatusWithOptions(request *QueryBatchRegisterDeviceStatusRequest, runtime *util.RuntimeOptions) (_result *QueryBatchRegisterDeviceStatusResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.ApplyId)) {\n\t\tquery[\"ApplyId\"] = request.ApplyId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.IotInstanceId)) {\n\t\tquery[\"IotInstanceId\"] = request.IotInstanceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ProductKey)) {\n\t\tquery[\"ProductKey\"] = request.ProductKey\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"QueryBatchRegisterDeviceStatus\"),\n\t\tVersion: tea.String(\"2018-01-20\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &QueryBatchRegisterDeviceStatusResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "a175c10a8c03966216e9db52273a1ba9", "score": "0.46788073", "text": "func (d *Dev) pollStatus(dir direction) error {\n\ttimeout := time.NewTimer(d.timeout)\n\tdefer timeout.Stop()\n\t// Check if already canceled first\n\tselect {\n\tcase <-d.done:\n\t\treturn errHalted\n\tdefault:\n\t\t// Proceed.\n\t}\n\tstatus := make([]byte, 1)\n\tfor {\n\n\t\t// Read status register.\n\t\terr := d.c.Tx([]byte{statusReg}, status)\n\t\tif err != nil {\n\t\t\treturn &IOError{\"reading status register\", err}\n\t\t}\n\n\t\tswitch dir {\n\t\tcase reading:\n\t\t\t// Bit 0: rx valid bit.\n\t\t\t// 0 → No data is ready to be read in READ register.\n\t\t\t// 1 → Data byte available in READ register.\n\t\t\tif status[0]&byte(dir) == 1 {\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase writing:\n\t\t\t// Bit 1: tx valid bit.\n\t\t\t// 0 → New data may be written to WRITE register.\n\t\t\t// 1 → WRITE register occupied. Do NOT write.\n\t\t\tif status[0]&byte(dir) == 0 {\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase clearBuffer:\n\t\t\t// If there is data left in the buffer read it.\n\t\t\tif status[0]&byte(reading) == 1 {\n\t\t\t\tdiscard := make([]byte, 1)\n\t\t\t\tif err := d.c.Tx([]byte{readReg}, discard); err != nil {\n\t\t\t\t\treturn &IOError{\"clearing buffer\", err}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif status[0]&byte(reading) == 0 {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tselect {\n\t\tcase <-time.After(5 * time.Millisecond):\n\t\t\t// Polling interval.\n\t\tcase <-timeout.C:\n\t\t\t// Return error if it takes too long.\n\t\t\treturn errStatusDeadline\n\t\tcase <-d.done:\n\t\t\treturn errHalted\n\t\t}\n\t}\n}", "title": "" }, { "docid": "351493406ed2bf589343dfade60ee360", "score": "0.46665978", "text": "func (device *Device) UpdateStatus(result *ExecutionResult) {\n\t// TODO: Find why I have to do this\n\tcleanResult := strings.Replace(strings.Trim(result.Out, \"'\"), \"\\\\\", \"\", -1)\n\n\t// If the execution stdout result is empty, don't update the device status\n\tif cleanResult == \"\" {\n\t\treturn\n\t}\n\n\t// For now, we just check if the output could be parsed into a json interface\n\tif err := json.Unmarshal([]byte(cleanResult), &device.Status); err != nil {\n\t\t// If not, we revert to using just the result string as the new device status\n\t\tdevice.Status = cleanResult\n\t}\n}", "title": "" }, { "docid": "72a93a2257c066e18fc0f7bccf10e601", "score": "0.46659666", "text": "func (c *MysqlBackup) UpdateStatusCondition(condType BackupConditionType,\n\tstatus apiv1.ConditionStatus, reason, msg string) {\n\tnewCondition := BackupCondition{\n\t\tType: condType,\n\t\tStatus: status,\n\t\tReason: reason,\n\t\tMessage: msg,\n\t}\n\n\tt := time.Now()\n\n\tif len(c.Status.Conditions) == 0 {\n\t\tglog.Infof(\"Setting lastTransitionTime for mysql backup \"+\n\t\t\t\"%q condition %q to %v\", c.Name, condType, t)\n\t\tnewCondition.LastTransitionTime = metav1.NewTime(t)\n\t\tc.Status.Conditions = []BackupCondition{newCondition}\n\t} else {\n\t\tif i, exist := c.condExists(condType); exist {\n\t\t\tcond := c.Status.Conditions[0]\n\t\t\tif cond.Status != newCondition.Status {\n\t\t\t\tglog.Infof(\"Found status change for mysql backup \"+\n\t\t\t\t\t\"%q condition %q: %q -> %q; setting lastTransitionTime to %v\",\n\t\t\t\t\tc.Name, condType, cond.Status, status, t)\n\t\t\t\tnewCondition.LastTransitionTime = metav1.NewTime(t)\n\t\t\t} else {\n\t\t\t\tnewCondition.LastTransitionTime = cond.LastTransitionTime\n\t\t\t}\n\t\t\tglog.Infof(\"Setting lastTransitionTime for mysql backup \"+\n\t\t\t\t\"%q condition %q to %q\", c.Name, condType, status)\n\t\t\tc.Status.Conditions[i] = newCondition\n\t\t} else {\n\t\t\tglog.Infof(\"Setting new condition for mysql backup %q, condition %q to %q\",\n\t\t\t\tc.Name, condType, status)\n\t\t\tnewCondition.LastTransitionTime = metav1.NewTime(t)\n\t\t\tc.Status.Conditions = append(c.Status.Conditions, newCondition)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9884ece6374c924a9aa93b103787dc40", "score": "0.46499592", "text": "func watchProgress(ctx context.Context, comms *Comms, oid string, size int, c progress.Counter) {\n\n var last int\n t := progress.NewTicker(ctx, c, int64(size), time.Millisecond * 250)\n for p := range t {\n\n total := int(p.N())\n inc := total - last\n last = total\n\n comms.Send(&ProgressMessage{\n Event: \"progress\",\n Oid: oid,\n BytesSoFar: total,\n BytesSinceLast: inc,\n })\n }\n}", "title": "" }, { "docid": "4a4763779a267751d3651f71b235c22e", "score": "0.46447968", "text": "func StatusLTE(v int8) predicate.Comment {\n\treturn predicate.Comment(sql.FieldLTE(FieldStatus, v))\n}", "title": "" }, { "docid": "6edc833dd7fa9e002f7194049baf3d88", "score": "0.46426332", "text": "func StatusLT(v string) predicate.Reportwallettb {\n\treturn predicate.Reportwallettb(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "dd1a7d9056f7e0589e1dd8f9ef28b4ea", "score": "0.46419743", "text": "func StatusLT(v string) predicate.ReportWallet {\n\treturn predicate.ReportWallet(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "e4585f625b171d05ce8313fd616d2827", "score": "0.46407878", "text": "func (m *ManagedDeviceMobileAppConfigurationItemRequestBuilder) DeviceStatusesById(id string)(*i5644f6cefb6e37ba63ec8582d3a158ec48759832b4146d5ffd2d350288b5e5ca.ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"managedDeviceMobileAppConfigurationDeviceStatus%2Did\"] = id\n }\n return i5644f6cefb6e37ba63ec8582d3a158ec48759832b4146d5ffd2d350288b5e5ca.NewManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "title": "" }, { "docid": "c9513302dd63ec3717d89fb1654fad5a", "score": "0.46405753", "text": "func webAPIMetricsStatus(w http.ResponseWriter, r *http.Request) {\n\tctx := context.Background()\n\n\tmetricsStatus := controller.GetMetricsStatus(ctx)\n\n\t// write the config back to request\n\terr := json.NewEncoder(w).Encode(metricsStatus)\n\thandleError(err, w)\n}", "title": "" }, { "docid": "cb4979ac607c5c9883dffb63f29b7eb7", "score": "0.46402827", "text": "func (client *Client) QueryDevicePropertyStatusWithOptions(request *QueryDevicePropertyStatusRequest, runtime *util.RuntimeOptions) (_result *QueryDevicePropertyStatusResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.DeviceName)) {\n\t\tquery[\"DeviceName\"] = request.DeviceName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.FunctionBlockId)) {\n\t\tquery[\"FunctionBlockId\"] = request.FunctionBlockId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.IotId)) {\n\t\tquery[\"IotId\"] = request.IotId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.IotInstanceId)) {\n\t\tquery[\"IotInstanceId\"] = request.IotInstanceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ProductKey)) {\n\t\tquery[\"ProductKey\"] = request.ProductKey\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"QueryDevicePropertyStatus\"),\n\t\tVersion: tea.String(\"2018-01-20\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &QueryDevicePropertyStatusResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "fc405bb16702c5e0cb4f7b3deb864d85", "score": "0.46389216", "text": "func updateAvailabilityCondition(status *workerv1.WorkerStatus, worker *workerv1.Worker, currentDeployment *appsv1.Deployment) {\n\tcurrentReplicas := currentDeployment.Status.ReadyReplicas\n\trequiredReplicas := worker.Spec.Replicas\n\n\tcondition := workerv1.WorkerCondition{Type: AVAILABILITY}\n\tif currentReplicas >= requiredReplicas {\n\t\tcondition.Reason = REQUIRED_REPLICAS_AVAILABLE\n\t\tcondition.Message = fmt.Sprintf(\"Worker has reached the required replicas %d\", requiredReplicas)\n\t} else {\n\t\tcondition.Reason = REQUIRED_REPLICAS_UNAVAILABLE\n\t\tcondition.Message = fmt.Sprintf(\"Worker has reached the %d replicas, but not the required %d\", currentReplicas, requiredReplicas)\n\t}\n\n\tstatus = assignCondition(status, condition)\n}", "title": "" }, { "docid": "54a186d4a5bd7db789e0f2a86c4e24ec", "score": "0.4637763", "text": "func (r *ReconcileWordpress) updateStatus(w *examplev1.Wordpress, field string) {\n condtype := fmt.Sprintf(\"%sCreated\", field)\n reason := \"operatorCreated\"\n message := fmt.Sprintf(\"%s has been created\", field)\n\n cond := condv1.Condition {\n\tType: condv1.ConditionType(condtype),\n\tStatus: corev1.ConditionTrue,\n\tReason: condv1.ConditionReason(reason),\n\tMessage: message,\n\tLastTransitionTime: metav1.Now(),\n }\n\n if ok := w.Status.Conditions.SetCondition(cond); ok {\n\terr := r.client.Status().Update(context.TODO(), w)\n\tif err != nil {\n\t r.logger.Error(err, \"Failed to update wordpress Status\")\n\t}\n }\n}", "title": "" }, { "docid": "f4df94c470e4586bdac2df87f151bab0", "score": "0.46331143", "text": "func (suite *RateLimitClientTestSuite) doRateLimitedQueries(\n\tnumSeconds, readLimit, maxKB int,\n\tsinglePartition, useExternalLimiters bool,\n\tusePercent float64, tableName string) {\n\n\tstartTime := currentTimeMillis()\n\tendTime := startTime + int64(numSeconds*1000)\n\n\tvar readUnitsUsed int\n\n\t// TODO\n\t//var totalDelayTime time.Duration\n\t//var throttleExceptions int\n\n\tvar rlim common.RateLimiter = nil\n\tvar wlim common.RateLimiter = nil\n\n\tif useExternalLimiters == false {\n\t\t// reset internal limiters so they don't have unused units\n\t\tsuite.Client.ResetRateLimiters(tableName)\n\t} else {\n\t\trlim = common.NewSimpleRateLimiterWithDuration((float64(readLimit)*usePercent)/100.0, 1)\n\t\twlim = common.NewSimpleRateLimiterWithDuration((float64(readLimit)*usePercent)/100.0, 1)\n\t}\n\n\tprepReq := &nosqldb.PrepareRequest{}\n\tif singlePartition {\n\t\t// Query based on single partition scanning\n\t\tid := rand.Intn(500)\n\t\tprepReq.Statement = fmt.Sprintf(\"select * from %s where id = %d\", tableName, id)\n\t} else {\n\t\t// Query based on all partitions scanning\n\t\tprepReq.Statement = fmt.Sprintf(\"select * from %s where name = \\\"jane\\\"\", tableName)\n\t}\n\n\tprepRes, err := suite.Client.Prepare(prepReq)\n\tif err != nil {\n\t\tsuite.FailNowf(\"Query\", \"Prepare statement failed: %v\", err)\n\t}\n\tused, err := prepRes.ConsumedCapacity()\n\tif err != nil {\n\t\tsuite.FailNowf(\"Query\", \"Prepare statement ConsumedCapacity() returned error: %v\", err)\n\t}\n\treadUnitsUsed += used.ReadUnits\n\n\tsuite.verbf(\"Running queries: RUs=%d percent=%.2f\", readLimit, usePercent)\n\n\tfor {\n\t\t// we need a 20 second timeout because in some cases this\n\t\t// is called on a table with 500 rows and 50RUs\n\t\t// (uses 1000RUs = 20 seconds)\n\t\tqueryReq := &nosqldb.QueryRequest{\n\t\t\tPreparedStatement: &prepRes.PreparedStatement,\n\t\t\tTimeout: 20000 * time.Millisecond,\n\t\t\tTableName: tableName,\n\t\t}\n\t\tif maxKB > 0 {\n\t\t\t// Query with size limit\n\t\t\tqueryReq.MaxReadKB = uint(maxKB)\n\t\t} else {\n\t\t\t// use readLimit as maxKB\n\t\t\tqueryReq.MaxReadKB = uint(float64(readLimit) * usePercent / 100.0)\n\t\t}\n\t\tif queryReq.MaxReadKB > 2048 {\n\t\t\tqueryReq.MaxReadKB = 2048\n\t\t}\n\t\tqueryReq.TableName = tableName\n\t\tqueryReq.SetReadRateLimiter(rlim)\n\t\tqueryReq.SetWriteRateLimiter(wlim)\n\t\tfor {\n\t\t\tres, err := suite.Client.Query(queryReq)\n\t\t\tif err != nil {\n\t\t\t\tif nosqlerr.Is(err, nosqlerr.ReadLimitExceeded, nosqlerr.WriteLimitExceeded) {\n\t\t\t\t\tsuite.FailNow(\"Expected no throttling exceptions, got one\")\n\t\t\t\t}\n\t\t\t\tsuite.FailNowf(\"Query\", \"Got unexpected error running query with readLimit=%d maxKB=%d singlePart=%v usePercent=%.2f%%: %s\", readLimit, maxKB, singlePartition, usePercent, err.Error())\n\t\t\t} else {\n\t\t\t\tused, _ := res.ConsumedCapacity()\n\t\t\t\tif used.ReadUnits == 0 {\n\t\t\t\t\tsuite.FailNow(\"Query used zero read units\")\n\t\t\t\t}\n\t\t\t\treadUnitsUsed += used.ReadUnits\n\t\t\t}\n\t\t\tif queryReq.IsDone() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif currentTimeMillis() > endTime {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif currentTimeMillis() > endTime {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tnumSeconds = int((currentTimeMillis() - startTime) / 1000)\n\n\tusePercent = usePercent / 100.0\n\n\tRUs := readUnitsUsed / numSeconds\n\n\tsuite.verbf(\"Resulting query RUs=%d\", RUs)\n\n\texpectedRUs := int(float64(readLimit) * usePercent)\n\n\t// for very small expected amounts, just verify within 1 RU\n\tif expectedRUs < 4 &&\n\t\tRUs <= (expectedRUs+1) &&\n\t\tRUs >= (expectedRUs-1) {\n\t\treturn\n\t}\n\n\tif RUs < (int)(float64(expectedRUs)*0.6) ||\n\t\tRUs > (int)(float64(expectedRUs)*1.5) {\n\t\tsuite.FailNowf(\"Queries\", \"Expected around %d RUs, got %d\", expectedRUs, RUs)\n\t}\n}", "title": "" }, { "docid": "3c31436280aa9b3e0c12d8059353f37c", "score": "0.46322796", "text": "func (client *Client) QueryBatchRegisterDeviceStatus(request *QueryBatchRegisterDeviceStatusRequest) (_result *QueryBatchRegisterDeviceStatusResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &QueryBatchRegisterDeviceStatusResponse{}\n\t_body, _err := client.QueryBatchRegisterDeviceStatusWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "title": "" }, { "docid": "eea63264cdef8a289056c3ddc4fa1ce1", "score": "0.46208104", "text": "func Status(deviceName string) (*DeviceStatus, error) {\n\tvar (\n\t\terr error\n\t\tstatus DeviceStatus\n\t)\n\n\toutput, err := dmsetup(\"status\", deviceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstatus.RawOutput = output\n\n\t// Status output format:\n\t// Offset (int64)\n\t// Length (int64)\n\t// Target type (string)\n\t// Params (Array of strings)\n\tconst MinParseCount = 4\n\tparts := strings.Split(output, \" \")\n\tif len(parts) < MinParseCount {\n\t\treturn nil, fmt.Errorf(\"failed to parse output: %q\", output)\n\t}\n\n\tstatus.Offset, err = strconv.ParseInt(parts[0], 10, 64)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse offset: %q: %w\", parts[0], err)\n\t}\n\n\tstatus.Length, err = strconv.ParseInt(parts[1], 10, 64)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse length: %q: %w\", parts[1], err)\n\t}\n\n\tstatus.Target = parts[2]\n\tstatus.Params = parts[3:]\n\n\treturn &status, nil\n}", "title": "" }, { "docid": "f5ba59fa3538cbba740a3250844a6f31", "score": "0.4620168", "text": "func WaitForThrottlerStatusEnabled(t *testing.T, tablet *cluster.Vttablet, enabled bool, config *Config, timeout time.Duration) {\n\tenabledJSONPath := \"IsEnabled\"\n\tqueryJSONPath := \"Query\"\n\tthresholdJSONPath := \"Threshold\"\n\turl := fmt.Sprintf(\"http://localhost:%d/throttler/status\", tablet.HTTPPort)\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\tticker := time.NewTicker(time.Second)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tbody := getHTTPBody(url)\n\t\tisEnabled, err := jsonparser.GetBoolean([]byte(body), enabledJSONPath)\n\t\trequire.NoError(t, err)\n\t\tif isEnabled == enabled {\n\t\t\tif config == nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tquery, err := jsonparser.GetString([]byte(body), queryJSONPath)\n\t\t\trequire.NoError(t, err)\n\t\t\tthreshold, err := jsonparser.GetFloat([]byte(body), thresholdJSONPath)\n\t\t\trequire.NoError(t, err)\n\t\t\tif query == config.Query && threshold == config.Threshold {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tt.Errorf(\"timed out waiting for the %s tablet's throttler status enabled to be %t with the correct config after %v; last seen value: %s\",\n\t\t\t\ttablet.Alias, enabled, timeout, body)\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t}\n\t}\n}", "title": "" }, { "docid": "00bf767f8b4b626aefb1b3bd00655c73", "score": "0.46201152", "text": "func (qs TicketQuerySet) StatusLt(status TicketStatus) TicketQuerySet {\n\treturn qs.w(qs.db.Where(\"status < ?\", status))\n}", "title": "" }, { "docid": "72732968acf17ccae5a0897917d9071e", "score": "0.4618213", "text": "func (r *AddonUpgradePolicyPollRequest) Status(value int) *AddonUpgradePolicyPollRequest {\n\tr.statuses = append(r.statuses, value)\n\treturn r\n}", "title": "" }, { "docid": "0576b7303506e7ea42f591f671873ad2", "score": "0.4615005", "text": "func (wl *WeeklyLimit) UpdateQuota(amount float64) {\r\n\twl.remainingWeeklyDeposit -= amount\r\n}", "title": "" }, { "docid": "f7a0f2775e2222aa7eca39d5e988519f", "score": "0.46052128", "text": "func (dl *DailyLimit) UpdateQuota(amount float64) {\r\n\tdl.remainingDailyDeposit -= amount\r\n\tdl.remainingDailyTransationCount--\r\n}", "title": "" }, { "docid": "271409b3d40d185d3060de534efa445b", "score": "0.46029183", "text": "func ResourceRateLimiter(ctx iris.Context) {\n\tctxt := ctx.Request().Context()\n\turi := ctx.Request().RequestURI\n\tfor _, val := range config.Data.ResourceRateLimit {\n\t\tresourceLimit := strings.Split(val, \":\")\n\t\tif len(resourceLimit) > 1 && resourceLimit[1] != \"\" {\n\t\t\trLimit, _ := strconv.Atoi(resourceLimit[1])\n\t\t\tresource := strings.Replace(resourceLimit[0], \"{id}\", \"[a-zA-Z0-9._-]+\", -1)\n\t\t\tregex := regexp.MustCompile(resource)\n\t\t\tif regex.MatchString(uri) {\n\t\t\t\tconn, err := common.GetDBConnection(common.InMemory)\n\t\t\t\tif err != nil {\n\t\t\t\t\tl.LogWithFields(ctxt).Error(err.Error())\n\t\t\t\t\tresponse := common.GeneralError(http.StatusInternalServerError, response.InternalError, err.Error(), nil, nil)\n\t\t\t\t\tcommon.SetResponseHeader(ctx, response.Header)\n\t\t\t\t\tctx.StatusCode(http.StatusInternalServerError)\n\t\t\t\t\tctx.JSON(&response.Body)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// convert millisecond to second\n\t\t\t\texpiretime := rLimit / 1000\n\t\t\t\tif err = conn.SetExpire(\"ResourceRateLimit\", uri, \"\", expiretime); err != nil {\n\t\t\t\t\terrorMessage := \"too many requests, retry after some time\"\n\t\t\t\t\tl.LogWithFields(ctxt).Error(errorMessage)\n\t\t\t\t\tresponse := common.GeneralError(http.StatusServiceUnavailable, response.RateLimitExceeded, errorMessage, nil, nil)\n\t\t\t\t\tremainTime, _ := conn.TTL(ResourceRateLimit, uri)\n\t\t\t\t\tif remainTime > 0 {\n\t\t\t\t\t\tctx.ResponseWriter().Header().Set(\"Retry-After\", strconv.Itoa(remainTime))\n\t\t\t\t\t}\n\t\t\t\t\tcommon.SetResponseHeader(ctx, response.Header)\n\t\t\t\t\tctx.StatusCode(http.StatusServiceUnavailable)\n\t\t\t\t\tctx.JSON(&response.Body)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tctx.Next()\n}", "title": "" }, { "docid": "cb11d0d4596718c0946ba794db2d1ec2", "score": "0.45948708", "text": "func ChangeStatus(APIstub shim.ChaincodeStubInterface, args []string) peer.Response {\n\tif len(args) != 2 {\n\t\treturn shim.Error(\"Invalid number of arguments. Expected 2 arguments\")\n\t}\n\tcatAsBytes, _ := APIstub.GetState(args[0])\n\tcat := Category{}\n\tjson.Unmarshal(catAsBytes, &cat)\n\tstatus, _ := strconv.ParseUint(args[1], 10, 64)\n\tcat.Status = uint8(status)\n\tcatAsBytes, _ = json.Marshal(cat)\n\terr := APIstub.PutState(args[0], catAsBytes)\n\tif err != nil {\n\t\tshim.Error(response.CreateErrorResponse(err.Error(),\n\t\t\t0,\n\t\t\tnil))\n\t}\n\n\treturn shim.Success(response.CreateSuccessResponse(\"Category Updated successfully\",\n\t\t1,\n\t\tnil))\n}", "title": "" }, { "docid": "60d3cac2c8a05411f57a6b4adaf10353", "score": "0.45927984", "text": "func initGetStatus(dev *globals.OPCUADev) {\n\tgetStatus := GetStatus{Client: dev.OPCUAClient,\n\t\ttopic: fmt.Sprintf(mappercommon.TopicStateUpdate, dev.Instance.ID)}\n\ttimer := mappercommon.Timer{Function: getStatus.Run, Duration: 1 * time.Second, Times: 0}\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\ttimer.Start()\n\t}()\n}", "title": "" }, { "docid": "76688debdc31e173d983759f36fd5e2c", "score": "0.45910203", "text": "func (d *DeployWorker) submitStatusRequest(cl *coscl.Client, deployID string) string {\n\tvar stat cosddb.DeployStatus\n\n\t// Check status every maxPollStatusPause seconds, maxPollStatusCount times.\n\tfor a := 0; a <= maxPollStatusCount; a++ {\n\t\ttime.Sleep(time.Second * maxPollStatusPause)\n\t\tresp, err := cl.Execute()\n\t\tif err != nil {\n\t\t\treturn fmt.Sprintf(\"Could not submit status request for deployID %s\", deployID, err.Error())\n\t\t}\n\t\terr = json.Unmarshal([]byte(resp), &stat)\n\t\tif err != nil {\n\t\t\treturn fmt.Sprintf(\"Could not parse status response for deployID %s: %s\", deployID, err.Error())\n\t\t}\n\t\tif stat.Status == cosddb.Started {\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\tswitch stat.Status {\n\tcase cosddb.Started:\n\t\treturn fmt.Sprintf(\"Deploy still running after polling period expired for deployID %s\", deployID)\n\tcase cosddb.Failed:\n\t\treturn fmt.Sprintf(\"Deploy Failed for deployID %s\", deployID)\n\tdefault:\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "52122ec9a4b088f9ac60d171b4768668", "score": "0.45906007", "text": "func updateRateLimitMetrics(response *http.Response) error {\n\trateLimitLimitValue, err := parseRateLimitValue(response)\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\trateLimitLimit.Set(rateLimitLimitValue)\n\n\trateLimitRemainingValue, err := parseRateLimitRemaining(response)\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\trateLimitRemaining.Set(rateLimitRemainingValue)\n\n\treturn nil\n}", "title": "" }, { "docid": "0d8c2a3670b3833d4d67598965262647", "score": "0.4588085", "text": "func StatusGT(v string) predicate.Reportwallettb {\n\treturn predicate.Reportwallettb(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "a3840e847844d805a9f98e0542e31e60", "score": "0.45868972", "text": "func CheckStatus(cfg *config.Config, uid string) bool {\n\t// Build endpoint.\n\turlstr := cfg.APIURL + \"/\" + \"api/client/servers/\" + uid + \"/resources\"\n\n\t// Setup HTTP GET request.\n\tclient := &http.Client{Timeout: time.Second * 5}\n\treq, _ := http.NewRequest(\"GET\", urlstr, nil)\n\n\t// Set authorization header.\n\treq.Header.Set(\"Authorization\", \"Bearer \"+cfg.Token)\n\n\t// Set data to JSON.\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// Accept JSON.\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\t// Perform HTTP request and check for errors.\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\n\t\treturn false\n\t}\n\n\t// Close body at the end.\n\tdefer resp.Body.Close()\n\n\t// Read body.\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\n\t\treturn false\n\t}\n\n\t// Create utilization struct.\n\tvar util Utilization\n\n\t// Parse JSON.\n\tjson.Unmarshal([]byte(string(body)), &util)\n\n\t// Check if the server's state isn't on. If not, return false.\n\tif util.Attributes.State != \"running\" {\n\t\treturn false\n\t}\n\n\t// Otherwise, return true meaning the container is online.\n\treturn true\n}", "title": "" }, { "docid": "a3840e847844d805a9f98e0542e31e60", "score": "0.45868972", "text": "func CheckStatus(cfg *config.Config, uid string) bool {\n\t// Build endpoint.\n\turlstr := cfg.APIURL + \"/\" + \"api/client/servers/\" + uid + \"/resources\"\n\n\t// Setup HTTP GET request.\n\tclient := &http.Client{Timeout: time.Second * 5}\n\treq, _ := http.NewRequest(\"GET\", urlstr, nil)\n\n\t// Set authorization header.\n\treq.Header.Set(\"Authorization\", \"Bearer \"+cfg.Token)\n\n\t// Set data to JSON.\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// Accept JSON.\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\t// Perform HTTP request and check for errors.\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\n\t\treturn false\n\t}\n\n\t// Close body at the end.\n\tdefer resp.Body.Close()\n\n\t// Read body.\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\n\t\treturn false\n\t}\n\n\t// Create utilization struct.\n\tvar util Utilization\n\n\t// Parse JSON.\n\tjson.Unmarshal([]byte(string(body)), &util)\n\n\t// Check if the server's state isn't on. If not, return false.\n\tif util.Attributes.State != \"running\" {\n\t\treturn false\n\t}\n\n\t// Otherwise, return true meaning the container is online.\n\treturn true\n}", "title": "" }, { "docid": "6be1ba43a08df7e0d9c597e72045c4db", "score": "0.45834628", "text": "func StatusGT(v string) predicate.ReportWallet {\n\treturn predicate.ReportWallet(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "1142c9d07cd1af4cff32d0022dac52eb", "score": "0.4580259", "text": "func (o *ServerOp) Monitor(ctx context.Context, zone string, id types.ID, condition *sacloud.MonitorCondition) (*sacloud.CPUTimeActivity, error) {\n\tvalue, err := o.Read(ctx, zone, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnow := time.Now().Truncate(time.Second)\n\tm := now.Minute() % 5\n\tif m != 0 {\n\t\tnow.Add(time.Duration(m) * time.Minute)\n\t}\n\n\tres := &sacloud.CPUTimeActivity{}\n\tfor i := 0; i < 5; i++ {\n\t\tres.Values = append(res.Values, &sacloud.MonitorCPUTimeValue{\n\t\t\tTime: now.Add(time.Duration(i*-5) * time.Minute),\n\t\t\tCPUTime: float64(random(value.CPU * 1000)),\n\t\t})\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "1142c9d07cd1af4cff32d0022dac52eb", "score": "0.4580259", "text": "func (o *ServerOp) Monitor(ctx context.Context, zone string, id types.ID, condition *sacloud.MonitorCondition) (*sacloud.CPUTimeActivity, error) {\n\tvalue, err := o.Read(ctx, zone, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnow := time.Now().Truncate(time.Second)\n\tm := now.Minute() % 5\n\tif m != 0 {\n\t\tnow.Add(time.Duration(m) * time.Minute)\n\t}\n\n\tres := &sacloud.CPUTimeActivity{}\n\tfor i := 0; i < 5; i++ {\n\t\tres.Values = append(res.Values, &sacloud.MonitorCPUTimeValue{\n\t\t\tTime: now.Add(time.Duration(i*-5) * time.Minute),\n\t\t\tCPUTime: float64(random(value.CPU * 1000)),\n\t\t})\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "160191eced69b5ffa50bf7b359807b77", "score": "0.45791373", "text": "func StatusEvents(kv *api.KV, deploymentID string, waitIndex uint64, timeout time.Duration) ([]StatusUpdate, uint64, error) {\n\tevents := make([]StatusUpdate, 0)\n\n\tvar eventsPrefix string\n\tvar depIDProvided bool\n\tif deploymentID != \"\" {\n\t\t// the returned list of events must correspond to the provided deploymentID\n\t\teventsPrefix = path.Join(consulutil.EventsPrefix, deploymentID)\n\t\tdepIDProvided = true\n\t} else {\n\t\t// the returned list of events must correspond to all the deployments\n\t\teventsPrefix = path.Join(consulutil.EventsPrefix)\n\t\tdepIDProvided = false\n\t}\n\n\tkvps, qm, err := kv.List(eventsPrefix, &api.QueryOptions{WaitIndex: waitIndex, WaitTime: timeout})\n\tif err != nil || qm == nil {\n\t\treturn events, 0, err\n\t}\n\tfor _, kvp := range kvps {\n\t\tif kvp.ModifyIndex <= waitIndex {\n\t\t\tcontinue\n\t\t}\n\t\tvar eventTimestamp string\n\t\tif depIDProvided {\n\t\t\teventTimestamp = strings.TrimPrefix(kvp.Key, eventsPrefix+\"/\")\n\t\t} else {\n\t\t\tdepIDAndTimestamp := strings.Split(strings.TrimPrefix(kvp.Key, eventsPrefix+\"/\"), \"/\")\n\t\t\tdeploymentID = depIDAndTimestamp[0]\n\t\t\teventTimestamp = depIDAndTimestamp[1]\n\t\t}\n\n\t\tvalues := strings.Split(string(kvp.Value), \"\\n\")\n\t\teventType := StatusUpdateType(kvp.Flags)\n\n\t\tswitch eventType {\n\t\tcase InstanceStatusChangeType:\n\t\t\tif len(values) != 3 {\n\t\t\t\treturn events, qm.LastIndex, errors.Errorf(\"Unexpected event value %q for event %q\", string(kvp.Value), kvp.Key)\n\t\t\t}\n\t\t\tevents = append(events, StatusUpdate{Timestamp: eventTimestamp, Type: eventType.String(), Node: values[0], Status: values[1], Instance: values[2], DeploymentID: deploymentID})\n\t\tcase DeploymentStatusChangeType:\n\t\t\tif len(values) != 1 {\n\t\t\t\treturn events, qm.LastIndex, errors.Errorf(\"Unexpected event value %q for event %q\", string(kvp.Value), kvp.Key)\n\t\t\t}\n\t\t\tevents = append(events, StatusUpdate{Timestamp: eventTimestamp, Type: eventType.String(), Status: values[0], DeploymentID: deploymentID})\n\t\tcase CustomCommandStatusChangeType, ScalingStatusChangeType, WorkflowStatusChangeType:\n\t\t\tif len(values) != 2 {\n\t\t\t\treturn events, qm.LastIndex, errors.Errorf(\"Unexpected event value %q for event %q\", string(kvp.Value), kvp.Key)\n\t\t\t}\n\t\t\tevents = append(events, StatusUpdate{Timestamp: eventTimestamp, Type: eventType.String(), TaskID: values[0], Status: values[1], DeploymentID: deploymentID})\n\t\tdefault:\n\t\t\treturn events, qm.LastIndex, errors.Errorf(\"Unsupported event type %d for event %q\", kvp.Flags, kvp.Key)\n\t\t}\n\t}\n\treturn events, qm.LastIndex, nil\n}", "title": "" }, { "docid": "43df0932bc69d06928eeebe871746d98", "score": "0.4573118", "text": "func (hm *hostMover) requestStatusUpdate(requestId RequestId,\n\tstatus RequestStatus,\n) {\n\thm.mu.Lock()\n\tdefer hm.mu.Unlock()\n\n\tif val, ok := hm.requestsIdToStatusMapping[requestId]; ok {\n\t\tval.requestStatus = status\n\t}\n}", "title": "" }, { "docid": "8b5ebd00b37b3b604691a62b03d421b9", "score": "0.45717674", "text": "func listStatus(configInfo *ConfigInfo) (err error, status string) {\n\thttp.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}\n\tserverURL := \"https://\" + configInfo.tenantHostname + configInfo.serverEndpoint + statusPath\n\tif configInfo.logLevel > 0 {\n\t\tfmt.Printf(\"Connecting to \" + serverURL + \"\\n\")\n\t}\n\tclient := &http.Client{}\n\trequest, err := http.NewRequest(\"GET\", serverURL, strings.NewReader(\"\"))\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+configInfo.accessToken)\n\trequest.ContentLength = 0\n\tresp, err := client.Do(request)\n\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tcontents, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\tfmt.Fprintf(os.Stderr, \"Received response code %d from server\\n%s\\n\", resp.StatusCode, contents)\n\t\tos.Exit(1)\n\t}\n\n\tif configInfo.logLevel >= 2 {\n\t\tprintHeaders(resp.Header)\n\t}\n\n\tcontentTypeFound := false\n\tif resp.Header[\"Content-Type\"] != nil {\n for _, value := range resp.Header[\"Content-Type\"] {\n if value == \"application/json\" {\n contentTypeFound = true\n }\n\t\t}\n }\n \n if contentTypeFound==false {\n err = errors.New(\"Invalid status returned\")\n }\n \n status = string(contents)\n \n\treturn\n}", "title": "" }, { "docid": "df10f0dcccb273ad6713e751b454b76a", "score": "0.45675606", "text": "func (m *UserExperienceAnalyticsDeviceScope) GetStatus()(*DeviceScopeStatus) {\n val, err := m.GetBackingStore().Get(\"status\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*DeviceScopeStatus)\n }\n return nil\n}", "title": "" }, { "docid": "79469741ba5671127bb8d6b0a759d164", "score": "0.4565617", "text": "func computeStatusConditions(\n\tactuator actuator.Actuator,\n\tmode operatorv1.CloudCredentialsMode,\n\tcredRequests []minterv1.CredentialsRequest,\n\tclusterCloudPlatform configv1.PlatformType,\n\tlogger log.FieldLogger) []configv1.ClusterOperatorStatusCondition {\n\toperatorIsDisabled := mode == operatorv1.CloudCredentialsModeManual\n\n\tvar conditions []configv1.ClusterOperatorStatusCondition\n\n\t// Only set non-default conditions\n\tupgradeableCondition := actuator.Upgradeable(mode)\n\tlog.WithField(\"condition\", upgradeableCondition).Debug(\"calculated upgradeable condition\")\n\tif upgradeableCondition != nil {\n\t\tconditions = append(conditions, *upgradeableCondition)\n\t}\n\n\tif operatorIsDisabled {\n\t\treturn conditions\n\t}\n\n\tfailingCredRequests := 0\n\n\tvalidCredRequests := []minterv1.CredentialsRequest{}\n\t// Filter out credRequests that are for different clouds\n\tfor i, cr := range credRequests {\n\t\tinfraMatches, err := crInfraMatches(&cr, clusterCloudPlatform)\n\t\tif err != nil {\n\t\t\t// couldn't decode the providerspec (bad spec data?)\n\t\t\tlogger.WithField(\"credentialsRequest\", cr.Name).WithError(err).Warning(\"ignoring for status condition because could not decode provider spec\")\n\t\t\tcontinue\n\t\t}\n\t\tif !infraMatches {\n\t\t\tcontinue\n\t\t}\n\t\tvalidCredRequests = append(validCredRequests, credRequests[i])\n\t}\n\n\tfor _, cr := range validCredRequests {\n\t\t// Check for provision failure conditions:\n\t\tfoundFailure := false\n\t\tfor _, t := range minterv1.FailureConditionTypes {\n\t\t\tfailureCond := utils.FindCredentialsRequestCondition(cr.Status.Conditions, t)\n\t\t\tif failureCond != nil && failureCond.Status == corev1.ConditionTrue {\n\t\t\t\tfoundFailure = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif foundFailure {\n\t\t\tfailingCredRequests = failingCredRequests + 1\n\t\t}\n\t}\n\n\tif failingCredRequests > 0 {\n\t\tvar degradedCondition configv1.ClusterOperatorStatusCondition\n\t\tdegradedCondition.Type = configv1.OperatorDegraded\n\t\tdegradedCondition.Status = configv1.ConditionTrue\n\t\tdegradedCondition.Reason = reasonCredentialsFailing\n\t\tdegradedCondition.Message = fmt.Sprintf(\n\t\t\t\"%d of %d credentials requests are failing to sync.\",\n\t\t\tfailingCredRequests, len(validCredRequests))\n\t\tconditions = append(conditions, degradedCondition)\n\t}\n\n\t// Progressing should be true if the operator is making changes to the operand. In this case\n\t// we will set true if any CredentialsRequests are not provisioned, or have failure conditions,\n\t// as this indicates the controllers have work they are trying to do.\n\tcredRequestsNotProvisioned := 0\n\tlogger.Debugf(\"%d cred requests\", len(validCredRequests))\n\n\tfor _, cr := range validCredRequests {\n\t\tif !cr.Status.Provisioned {\n\t\t\tcredRequestsNotProvisioned = credRequestsNotProvisioned + 1\n\t\t}\n\t}\n\n\tif credRequestsNotProvisioned > 0 || failingCredRequests > 0 {\n\t\tvar progressingCondition configv1.ClusterOperatorStatusCondition\n\t\tprogressingCondition.Type = configv1.OperatorProgressing\n\t\tprogressingCondition.Status = configv1.ConditionTrue\n\t\tprogressingCondition.Reason = reasonReconciling\n\t\tprogressingCondition.Message = fmt.Sprintf(\n\t\t\t\"%d of %d credentials requests provisioned, %d reporting errors.\",\n\t\t\tlen(validCredRequests)-credRequestsNotProvisioned, len(validCredRequests), failingCredRequests)\n\t\tconditions = append(conditions, progressingCondition)\n\t}\n\n\t// Log all conditions we set:\n\tfor _, c := range conditions {\n\t\tlogger.WithFields(log.Fields{\n\t\t\t\"type\": c.Type,\n\t\t\t\"status\": c.Status,\n\t\t\t\"reason\": c.Reason,\n\t\t\t\"message\": c.Message,\n\t\t}).Debug(\"set ClusterOperator condition\")\n\t}\n\n\treturn conditions\n}", "title": "" }, { "docid": "6889230727ede36be94922e900595264", "score": "0.45615056", "text": "func (s *Service) QueryStatus() (ServiceStatus, error) {\n\treturn s.QueryStatusWithContext(context.Background())\n}", "title": "" }, { "docid": "31acb0eb2d5a031e0de78144e47ca387", "score": "0.4556988", "text": "func getStatus(status string) string {\n\tswitch status {\n\tcase model.StatusEnqueue, model.StatusStarted:\n\t\treturn StatusPending\n\tcase model.StatusSuccess:\n\t\treturn StatusSuccess\n\tcase model.StatusFailure:\n\t\treturn StatusFailure\n\tcase model.StatusError, model.StatusKilled:\n\t\treturn StatusError\n\tdefault:\n\t\treturn StatusError\n\t}\n}", "title": "" }, { "docid": "a4eee90b569439e6086d6d61cbda2599", "score": "0.45550272", "text": "func updateStatusConditions(cl client.Client, record *toolchainv1alpha1.MasterUserRecord, newConditions ...toolchainv1alpha1.Condition) error {\n\tvar updated bool\n\trecord.Status.Conditions, updated = condition.AddOrUpdateStatusConditions(record.Status.Conditions, newConditions...)\n\tif !updated {\n\t\t// Nothing changed\n\t\treturn nil\n\t}\n\treturn cl.Status().Update(context.TODO(), record)\n}", "title": "" } ]
767a17eb7dc47f4282d8f3c8d2a715aa
Send send data to remote addr
[ { "docid": "c1e04e6caa0b333d65be5b705a5b543c", "score": "0.0", "text": "func (c *Client) Send(msg *Message) error {\n\tif err:=c.Dial();err!= nil{\n\t\treturn err\n\t}\n\treturn c.conn.SendMessage(msg)\n}", "title": "" } ]
[ { "docid": "84ecd63e560be4b77d7c9e87985f7320", "score": "0.68459195", "text": "func sendData(addr, data string) error {\n\t// connect with server\n\tconn, err := net.Dial(\"tcp\", addr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error connect to server: %v\\n\", err)\n\t}\n\n\t// send data to server\n\tif _, err := conn.Write([]byte(data)); err != nil {\n\t\treturn fmt.Errorf(\"Error send data to server: %v\\n\", err)\n\t}\n\n\tlog.Printf(\"Send data: %v\\n\", data)\n\n\tresp := make([]byte, 512)\n\trespLen, err := conn.Read(resp)\n\tif err != nil && err != io.EOF {\n\t\treturn fmt.Errorf(\"Response error: %v\\n\", err)\n\t}\n\n\tlog.Println(\"Packet processing: \", string(resp[:respLen]))\n\n\t// close connection\n\treturn conn.Close()\n}", "title": "" }, { "docid": "752ccb503214b67b578e995546639cb1", "score": "0.67285466", "text": "func (n node) Send(buf *[]byte, count, dest, tag int) error {\n\tif len(n.hosts) < dest {\n\t\treturn errors.New(\"Destination index out of bounds\")\n\t}\n\n\tcodable := NewCodable(n.rank, dest, MPI_COMM_WORLD, 0x0, buf, MPI_CHAR, 0x41)\n\tencoded, err := codable.Encode()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = n.comm.Write(n.hosts[dest], encoded)\n\treturn err\n}", "title": "" }, { "docid": "2e34525a28e27df5216bc2e495dd5150", "score": "0.65541005", "text": "func execSendto(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := syscall.Sendto(args[0].(int), args[1].([]byte), args[2].(int), args[3].(syscall.Sockaddr))\n\tp.Ret(4, ret)\n}", "title": "" }, { "docid": "654a037177de28c19b9d54f5f9e624f9", "score": "0.6520006", "text": "func (s *Server) sendAddr(addrTo *serverutil.NetAddress) ([]byte, error) {\n\ts.Log(true, \"Addr sent to:\", addrTo.String())\n\t//assigne en []byte la structure getblocks\n\tpayload := gobEncode(*s.NewMsgAddr(addrTo))\n\t//on append la commande et le payload\n\trequest := append(commandToBytes(\"addr\"), payload...)\n\treturn request, s.sendData(addrTo.String(), request)\n}", "title": "" }, { "docid": "a5697fe378e86d2da162032acd9b0078", "score": "0.6329161", "text": "func (s *StdoutClient) send(stat string, format string, value interface{}) error {\n\tstat = strings.Replace(stat, \"%HOST%\", Hostname, 1)\n\t// if sending tcp append a newline\n\tformat = fmt.Sprintf(\"%s%s:%s\\n\", s.prefix, stat, format)\n\t_, err := fmt.Fprintf(s.FD, format, value)\n\treturn err\n}", "title": "" }, { "docid": "a59dacfde834345d45a1ddd245cc6cfe", "score": "0.6308283", "text": "func (manager *ClientManager) send(client *Client) {\n\tdefer client.socket.Close()\n\n\t//client will send remote operation as local\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-client.data:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// log.Println(manager.id,\" ---------------> \",client.id)\n\t\t\tclient.socket.Write(message)\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5d91917545ca8d6bf366ef9a87564195", "score": "0.62821734", "text": "func (conn *Conn) SendData(to string, toIdx uint32, id string, data []byte) {\n\tdup := func(data []byte) []byte {\n\t\tret := make([]byte, len(data))\n\t\tcopy(ret, data)\n\t\treturn ret\n\t}\n\tvar msg network.Msg\n\tmsg.To = to\n\tmsg.ToIdx = toIdx\n\tmsg.XType = network.Msg_forward\n\tmsg.LinkId = id\n\tmsg.Payload = &network.Msg_XData{\n\t\tXData: &network.Data{\n\t\t\tData: dup(data),\n\t\t},\n\t}\n\tselect {\n\tcase conn.write <- &msg:\n\tcase <-time.After(conn.parent.cfg.WriteTimeout):\n\t}\n}", "title": "" }, { "docid": "e98583c0fcd7428d6956071f93d120bf", "score": "0.62703884", "text": "func (c *Connection) Send(data []byte) error {\n _, err := c.Conn.Write(data)\n return err\n}", "title": "" }, { "docid": "0e0bfccc49785b4bd4031c8edcde6183", "score": "0.6257172", "text": "func SendTrainedData(data utils.TrainedData) {\n\tip := \"192.168.0.2\" // ip nodo principal\n\tport := strconv.Itoa(service_send_port)\n\thostremote := ip + \":\" + port\n\tconn, _ := net.Dial(\"tcp\", hostremote)\n\n\tdefer conn.Close()\n\n\tbytes, _ := json.Marshal(data)\n\tfmt.Fprintf(conn, \"%s\\n\", string(bytes))\n}", "title": "" }, { "docid": "8038884c53dd209896da356f8c25671c", "score": "0.6245678", "text": "func (pc *PacketConn) Send(data []byte) error {\n\t_, err := pc.conn.WriteTo(data, pc.remoteAddr)\n\treturn err\n}", "title": "" }, { "docid": "de09b5d9ce291fa57f2823d17aad7b0f", "score": "0.62421584", "text": "func send(c net.Conn, cmd string) error {\n\t_, err := fmt.Fprintf(c, cmd+\"\\r\\n\")\n\treturn err\n}", "title": "" }, { "docid": "d5887dbace37fa73c3fd3a40d7b2485c", "score": "0.6197546", "text": "func (cli *client) send(dataid uint32, data []byte) error {\n\n\t// 在此处增加判断是为了启动多余的goroutine 带来不必要的同步\n\tif cli.validConnectionCount() < len(cli.conns)/2 {\n\t\tif err := cli.connect(); nil != err {\n\t\t\tblog.Error(\"failed to connect remote server, error info is %s\", err.Error())\n\t\t}\n\t}\n\n\taddress, conn := cli.getConnection()\n\tif conn == nil {\n\t\tif err := cli.connect(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\taddress, conn = cli.getConnection()\n\t\tif nil == conn {\n\t\t\treturn errors.New(\"no usable connection\")\n\t\t}\n\t}\n\n\tdhead := dataHead{\n\t\tmagicNumber: 0xdeadbeef, // 协议约定,如有变化需要和蓝鲸数据平台负责数据接收的同学确认\n\t\tmsgType: 10000, // 协议约定,如有变更需要和蓝鲸数据平台负责数据接收的同学确认\n\t\tdataID: dataid,\n\t\ttimestamp: uint32(time.Now().UTC().Unix()),\n\t\tbodylen: uint32(len(data)),\n\t\tresv: 0,\n\t}\n\n\tpackageData, err := dhead.packageData(data)\n\tif nil != err {\n\t\treturn err\n\t}\n\n\terr = conn.SetWriteDeadline(time.Now().Add(10 * time.Second))\n\n\tif err != nil {\n\t\tblog.Error(\" failed to set dead line: %s\", err.Error())\n\t}\n\n\tif _, err = conn.Write(packageData); err != nil {\n\n\t\tblog.Error(\"failed to send data: %v\", err)\n\t\tconn.Close()\n\t\tcli.conns[address] = nil\n\t\treturn err\n\t}\n\tblog.V(3).Info(\"bkdata client success to send data\")\n\n\treturn nil\n}", "title": "" }, { "docid": "d58dbad9045ce8c98582a155b40e275c", "score": "0.61860627", "text": "func (s *ClientSession) send(data []byte) {\n\ts.rpc.Send(data)\n}", "title": "" }, { "docid": "876e0fd790b919cc223e06366e8c5a23", "score": "0.6140778", "text": "func SendData(address string, data []byte) {\n\tconn, err := net.Dial(protocol, address)\n\n\tif err != nil {\n\t\tfmt.Printf(\"%s is not available\\n\", address)\n\t\tvar updatedNodes []string\n\n\t\tfor _, node := range KnownNodes {\n\t\t\tif node != address {\n\t\t\t\tupdatedNodes = append(updatedNodes, node)\n\t\t\t}\n\t\t}\n\n\t\tKnownNodes = updatedNodes\n\n\t\treturn\n\t}\n\n\tdefer conn.Close()\n\n\t_, err = io.Copy(conn, bytes.NewReader(data))\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n}", "title": "" }, { "docid": "7b4c3a36250ab63c482d18a16e07da53", "score": "0.6123145", "text": "func (nc *Conn) send(cmd []byte) {\n\tnc.conn.Write(cmd)\n\tnc.conn.Write([]byte{delimeter})\n}", "title": "" }, { "docid": "f4820512a145cef5ec26606426e84a34", "score": "0.607511", "text": "func SendData(callbacks SendDataCallback, reader io.Reader, randomNumber string, dataSize int64) error {\n\tl, err := net.Listen(\"tcp\", \":6780\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tStartTcpSever(l, randomNumber, callbacks, reader, dataSize)\n\n\t// sends other listeners the port\n\tdiscover.Show(\"6780\", dataSize)\n\treturn nil\n}", "title": "" }, { "docid": "b2b7ba2dd00c0d2e8862bd0aa9326c0b", "score": "0.60699576", "text": "func (c *StatsdClient) send(stat string, format string, value interface{}) error {\n\tif c.conn == nil {\n\t\treturn errNotConnected\n\t}\n\tstat = strings.Replace(stat, \"%HOST%\", Hostname, 1)\n\t// if sending tcp append a newline\n\tformat = fmt.Sprintf(c.eventStringTpl, c.prefix, stat, format)\n\t_, err := fmt.Fprintf(c.conn, format, value)\n\treturn err\n}", "title": "" }, { "docid": "04c3258999949793a6ee5d274ba61978", "score": "0.60697466", "text": "func Send(w io.Writer, data []byte) error {\n\t// c.conn\n\t_, err := fmt.Fprintf(w, string(data)+\"\\n\")\n\tif err != nil {\n\t\tfmt.Println(\"[-] Error sending message through socket -> \" + err.Error())\n\t\tfmt.Println(\"[-] Connection with server terminated...\")\n\t}\n\treturn err\n}", "title": "" }, { "docid": "4899401fa45975e02b2bca6d00ec65fb", "score": "0.6049503", "text": "func sendData(sendch chan<- int, val int) {\n\n\tsendch <- val\n\n}", "title": "" }, { "docid": "15d7f089450115af1ce01baf122bc5ef", "score": "0.60437834", "text": "func (self *SockIP) send(packet Packet) error {\n packetBytes, err := packet.PackIP()\n if err != nil {\n return err\n }\n\n // send\n if send, err := self.ipConn.WriteToIP(packetBytes, &self.ipAddr); err != nil {\n self.stats.Errors++\n } else {\n self.stats.Packets++\n self.stats.Bytes += uint(send)\n }\n\n return nil\n}", "title": "" }, { "docid": "e3d42804e849e98100891c514911785b", "score": "0.60322595", "text": "func (l *UDPLink) Send(ipp ipv4.IpPackage, reAddr string, rePort int) {\n\tbuf := ipv4.IpPkgToBuffer(ipp)\n\tportStr := strconv.Itoa(rePort)\n\tservice := reAddr + \":\" + portStr\n\treUDPAddr, err := net.ResolveUDPAddr(\"udp\", service)\n\tCheckError(err)\n\n\tl.socket.WriteToUDP(buf, reUDPAddr)\n\n}", "title": "" }, { "docid": "ea225c2aa2bdfd750f957cf315ec523a", "score": "0.6030969", "text": "func execSendmsg(_ int, p *gop.Context) {\n\targs := p.GetArgs(5)\n\tret := syscall.Sendmsg(args[0].(int), args[1].([]byte), args[2].([]byte), args[3].(syscall.Sockaddr), args[4].(int))\n\tp.Ret(5, ret)\n}", "title": "" }, { "docid": "25f1c9a8331cfaaaed4ef356e7b5fbb8", "score": "0.59990907", "text": "func (re *remoteEntity) Send(done chan interface{}) {\n}", "title": "" }, { "docid": "95ce3e8608609ff29237ca3aacb89fe3", "score": "0.5995726", "text": "func (conn *TcpConn) Send(data interface{}) {\n // prepare SendMsg\n msg := &SendMsg{\n cmd: SEND_CMD_SEND,\n data:data,\n }\n\n // add to sending queue\n conn.SendQueue.Append(msg)\n}", "title": "" }, { "docid": "485aa7728affdf55f485e96fe7923bdb", "score": "0.5990782", "text": "func _send(seqid uint64, data []byte, conn net.Conn) {\n\theadwriter := packet.Writer()\n\theadwriter.WriteU16(uint16(len(data))+8)\n\theadwriter.WriteU64(seqid)\t\t// piggyback seq id\n\n\t_, err := conn.Write(headwriter.Data())\n\tif err != nil {\n\t\tlog.Println(\"Error send reply header:\", err.Error())\n\t\treturn\n\t}\n\n\t_, err = conn.Write(data)\n\tif err != nil {\n\t\tlog.Println(\"Error send reply msg:\", err.Error())\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "6a29e3ad77d21a6d6511a1794e5f0d8e", "score": "0.5970135", "text": "func (conn *connection) send(command string, params map[string]interface{}) bool {\n\tb, err := json.Marshal(params)\n\tif err != nil {\n\t\treturn false\n\t}\n\tb = append(b, '\\n')\n\t_, err = conn.socket.Write(b)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "6081e6f87f1e473d15df5a51d7077fcd", "score": "0.596782", "text": "func tcpSend(cnx net.Conn, cmd int, data []byte) error {\n // simple appliances are expected to reply quickly\n now := time.Now()\n cnx.SetWriteDeadline(now.Add(10 * time.Second))\n\n // tuya appliances cannot handle multiple read!!\n // => fill a buffer and write it\n b := make([]byte, 0, 16)\n b = append(b, ui2b(uint(0x55aa), 4)...)\n b = append(b, ui2b(uint(cmd), 8)...)\n b = append(b, ui2b(uint(len(data)+8), 4)...)\n b = append(b, data...)\n b = append(b, ui2b(uint(0xaa55), 8)...)\n if _, err := cnx.Write(b); err != nil {\n log.Println(err)\n return err\n }\n return nil\n}", "title": "" }, { "docid": "a7aeab66c74868f3fedec661d52654dc", "score": "0.5967009", "text": "func (e *Epd) sendData(data byte) {\n\te.dcPin.Out(true)\n\te.csPin.Out(false)\n\tc := []byte{data}\n\tr := make([]byte, len(c))\n\te.spiConn.Tx(c, r)\n\te.csPin.Out(true)\n\te.readBusy()\n}", "title": "" }, { "docid": "2743acd008a140b1c839f182616b246f", "score": "0.59055626", "text": "func (o *Communicator) Send(vals []float64, toID int) {\n}", "title": "" }, { "docid": "aa0a652757ec7545c7c0cfa80c135f1d", "score": "0.59024405", "text": "func (o *OLED96x96) sendData(buf ...byte) error {\n\tfor _, b := range buf {\n\t\tdataCmdBuf[1] = b\n\t\tif err := o.Device.Write(dataCmdBuf); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d9f57d4ff62cdb8bb73d0102967a936", "score": "0.58988655", "text": "func Send(conn *net.TCPConn, data []byte) error {\n\t_, err := conn.Write(data)\n\n\treturn err\n}", "title": "" }, { "docid": "a68a3df97734c9e0eb83839771ad5ab8", "score": "0.58657855", "text": "func sendPackageByAddr(to string, pack models.PackageTCP) int8 {\n conn, err := net.Dial(settings.PROTOCOL, to)\n if err != nil {\n return settings.EXIT_FAILED\n }\n\n data, err := json.Marshal(pack)\n utils.CheckError(err)\n\n conn.Write(data)\n conn.Close()\n\n return settings.EXIT_SUCCESS\n}", "title": "" }, { "docid": "6eacf18fd7aeba89bfba9d189aafa69d", "score": "0.5843374", "text": "func (sock *TunnelSocket) Send(payload ServicePackable) error {\n\tbuffer := make([]byte, Size(payload))\n\tPack(buffer, payload)\n\n\t// Transmission of the buffer contents\n\t_, err := sock.conn.Write(buffer)\n\treturn err\n}", "title": "" }, { "docid": "775291a6098960f5010f70b383538a8d", "score": "0.5829728", "text": "func (r *Remote) Send(p Payload) {\n\tif r.isSending {\n\t\tr.queue = append(r.queue, p)\n\t\treturn\n\t}\n\tr.isSending = true\n\tdefer func() {\n\t\tr.isSending = false\n\t\tif len(r.queue) > 0 {\n\t\t\tr.Send(r.queue[0])\n\t\t}\n\t}()\n\tpost := url.Values{}\n\tpost.Set(\"message\", p.Message)\n\tpost.Set(\"host\", p.Host)\n\tpost.Set(\"time\", p.Time)\n\trequest, _ := http.NewRequest(\n\t\t\"POST\",\n\t\tfmt.Sprintf(\"%s/remote\", r.URL),\n\t\tstrings.NewReader(post.Encode()),\n\t)\n\trequest.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tclient := &http.Client{}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer response.Body.Close()\n}", "title": "" }, { "docid": "6464e9291db13d14eea6d9cf5c6dbe00", "score": "0.58245075", "text": "func (es *ExternalSession) Send(data []byte) error {\n\treturn es.conn.WriteMessage(es.ctx, data)\n}", "title": "" }, { "docid": "d8d69a0838362ba1a31a6562cb5eb157", "score": "0.58229", "text": "func SendAddr(address string) {\n\tfmt.Printf(\"Sending addr to %s.\\n\", address)\n\n\tdata := Addr{nodeAddress, KnownNodes}\n\tpayload := GobEncode(data)\n\trequest := append(CmdToBytes(\"addr\"), payload...)\n\n\tSendData(address, request)\n}", "title": "" }, { "docid": "4c17a31c73c98a9fb4748d0129e30eab", "score": "0.5818151", "text": "func (c *client) send() error {\n\tnow := time.Now().Unix()\n\tmetrics := make([]*zabbix.Metric, 0)\n\tfor i := 0; i < *argPacketSize; i++ {\n\t\tmetrics = append(metrics, zabbix.NewMetric(c.host, fmt.Sprintf(*argMetricName, i), fmt.Sprintf(\"%d\", i), now))\n\t}\n\treturn c.sender.Send(zabbix.NewPacket(metrics, now))\n}", "title": "" }, { "docid": "9f1ad3b077747fa5ebb0ea921540e718", "score": "0.5816192", "text": "func (c *conn) send(upd *update) error {\n\tc.sendingMut.Lock()\n\tdefer c.sendingMut.Unlock()\n\t//send (transports responsiblity to enforce timeouts)\n\treturn c.transport.send(upd)\n}", "title": "" }, { "docid": "4aac2f31fe517146be7d55f3921f882c", "score": "0.5808051", "text": "func Send(host string, knocks ...Knock) error {\n\n\tconn, err := net.Dial(\"ip4:tcp\", host)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tfor _, knock := range knocks {\n\t\tpacket := new(KnockPacket)\n\n\t\tpacket.SourcePort = 0x1337\n\t\tpacket.DestinationPort = knock.Port\n\n\t\tpacket.Data = knock.Payload\n\n\t\tbuffers := makeChecksumedBuffers(conn, packet)\n\n\t\tvar pkBuffer *bytes.Buffer = new(bytes.Buffer)\n\n\t\tbuffers.WriteTo(pkBuffer)\n\t\tpkBuffer.Write([]byte{0x00, 0x00})\n\t\tpkBuffer.Write(knock.Payload)\n\n\t\tpkBuffer.WriteTo(conn)\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a491fdecf53f9b258edae6de84d73704", "score": "0.5797604", "text": "func (l *link) send(s string) {\n\t_, err := l.conn.Write([]byte(string(s)))\n\tif err != nil {\n\t\tdebugPrintln(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Send %v to %v failed. Closing connection\\n\",\n\t\t\t\ts, l.other))\n\t\tl.close()\n\t}\n}", "title": "" }, { "docid": "7e571d1ac06fb779025fe1b690f7b454", "score": "0.57823956", "text": "func sendUDP(r *types.Route, data buffer.View, localPort, remotePort uint16) error {\n\t// Allocate a buffer for the UDP header\n\thdr := buffer.NewPrependable(header.UDPMinimumSize + int(r.MaxHeaderLength()))\n\n\t// Initialize the header\n\tudp := header.UDP(hdr.Prepend(header.UDPMinimumSize))\n\n\tlength := uint16(hdr.UsedLength())\n\txsum := r.PseudoHeaderChecksum(ProtocolNumber)\n\tif data != nil {\n\t\tlength += uint16(len(data))\n\t\txsum = checksum.Checksum(data, xsum)\n\t}\n\n\tudp.Encode(&header.UDPFields{\n\t\tSrcPort:\tlocalPort,\n\t\tDstPort:\tremotePort,\n\t\tLength:\t\tlength,\n\t})\n\n\tudp.SetChecksum(^udp.CalculateChecksum(xsum, length))\n\n\treturn r.WritePacket(&hdr, data, ProtocolNumber)\n}", "title": "" }, { "docid": "7bb0c72a71a364590cb5c3144b65912e", "score": "0.5782368", "text": "func (c *gwsConn) send(mType int, data []byte) error {\n var err error\n\n c.sendMutex.Lock()\n if c.conn != nil {\n err = c.conn.WriteMessage(mType, data)\n } else {\n err = gochat.ConnEOF\n }\n c.sendMutex.Unlock()\n return err\n}", "title": "" }, { "docid": "42957ee1ad7ccb4d985d2e3dc95b9e45", "score": "0.5781248", "text": "func (t *RPCType) Rpc_send_data(args *RPCData, res *RPCAck) error {\r\n\t*res = false\r\n\t\r\n\ta := big.NewInt(0);\r\n\ta.UnmarshalText(args.Val)\r\n\tAdd_data_key_value(RPCKey{Client_id: args.Client_id, Stage: args.Stage}, a, args.Position)\r\n\t\r\n\t*res = true\r\n\treturn nil\r\n}", "title": "" }, { "docid": "9be3b670c217781979a0c175fa572d4e", "score": "0.5776582", "text": "func (c *Client) Send(addr net.Addr, p *PDU) error {\n\tb := p.EncodeTo(nil)\n\n\t_, err := c.conn.WriteTo(b, addr)\n\n\treturn err\n}", "title": "" }, { "docid": "e00fba1e1b3eb388c9c724e2a58ffa4a", "score": "0.5772002", "text": "func (client *Client[S, R]) Send(data S) error {\n\tif !client.connected {\n\t\treturn fmt.Errorf(\"client is not connected to a server\")\n\t}\n\n\tdataBytes, err := encodeObject(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tencryptedData, err := aesEncrypt(client.key, dataBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsize := encodeMessageSize(uint64(len(encryptedData)))\n\tbuffer := append(size, encryptedData...)\n\n\t_, err = client.sock.Write(buffer)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5ac8d9e960a2cf85f5f8852728f3f5de", "score": "0.57645077", "text": "func (p Process) sendMsg(msg string) {\n\taddr := p.GetAdress()\n\tconn, err := net.Dial(\"udp\", addr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t_, err = fmt.Fprint(conn, msg)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Print(\"Envoye a \" + addr + \":\")\n\tlog.Print(msg)\n}", "title": "" }, { "docid": "f5edbfa2f20dd2b36848de86b7b058c8", "score": "0.5753912", "text": "func (pw *ProxyWriter) Send(conn net.Conn) error {\n\tbinary.LittleEndian.PutUint16(pw.pack.Bytes()[0:2], pw.Offset)\n\tbinary.LittleEndian.PutUint16(pw.pack.Bytes()[4:6], pw.opcode)\n\t_, err := conn.Write(pw.pack.Bytes())\n\treturn err\n}", "title": "" }, { "docid": "e5bb64b176daee240c49aa1570c7c731", "score": "0.5744069", "text": "func (c *Conn) send(_type st, connID uint16, payload []byte, seqNr uint16) (err error) {\n\tp := c.makePacket(_type, connID, seqNr, payload)\n\tn1, err := c.socket.writeTo(p, c.remoteSocketAddr)\n\tsendBufferPool.Put(p[:0:minMTU])\n\tif err != nil {\n\t\treturn\n\t}\n\tif n1 != len(p) {\n\t\tpanic(n1)\n\t}\n\tif c.unpendSendState() && _type != stState {\n\t\t// We needed to send a state packet, but this packet suppresses that\n\t\t// need.\n\t\tunsentStatePackets.Add(1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ca3d2ef4dae964b28d159a80939414d6", "score": "0.57440054", "text": "func (gossiper *Gossiper) sendPrivatePacket(content string, dest string) {\n\taddr, exist := gossiper.DSDV.Load(dest)\n\tif !exist {\n\t\tprintln(\"ERROR : Trying to send a private message to an unknown peer, discarding this message\")\n\t\treturn\n\t}\n\tstr := \"CLIENT MESSAGE \" + content + gossiper.Peers.String()\n\tgossiper.ToPrint <- str\n\n\tprivateMsg := PrivateMessage{Origin: gossiper.Name, Text: content, ID: 0, Destination: dest, HopLimit: constants.DEFAULT_HOP_LIMIT}\n\tgossipPacket := GossipPacket{Private: &privateMsg}\n\tgossiper.ToSend <- PacketToSend{GossipPacket: &gossipPacket, Address: addr.(*net.UDPAddr)}\n\n\tgossiper.updatePrivates(gossipPacket, dest)\n}", "title": "" }, { "docid": "032e719a758612fa46d4f5d5708bbded", "score": "0.5727381", "text": "func Sendto() {\n\tfmt.Printf(\"send data....\\n\")\n}", "title": "" }, { "docid": "8d5959c24de00a3850f1c730365c06d4", "score": "0.5722684", "text": "func sendReply(w io.Writer, resp uint8, addr *AddrSpec) error {\n\t// Format the message\n\tbuf := bytes.NewBuffer([]byte{socks5Version, resp, 0})\n\taddr.WriteTo(buf)\n\n\t// Send the message\n\t_, err := w.Write(buf.Bytes())\n\treturn err\n}", "title": "" }, { "docid": "3062e13e26271e144005e9b0744120cb", "score": "0.5720938", "text": "func (spi *SPI_periph) Send(data uint32) {\n\t//mask := uint32(1<<spi.datalength) - uint32(1)\n\t//data = data & mask\n\n\t//wait for tx fifo to have space\n\t//for spi.regs.status&0x2 != 0 {\n\t//}\n\n\tspi.regs.txdata = data\n}", "title": "" }, { "docid": "8ad3e7abb8aeebdcdf3bd2faef4237ca", "score": "0.57169855", "text": "func (s *Socks5) sendReply(conn net.Conn) error {\n\tconst (\n\t\tRespSuccess = uint8(0)\n\t)\n\n\tlocalIP := net.ParseIP(\"0.0.0.0\").To4()\n\tlocalPort := uint16(33)\n\n\t// Format the message\n\tmsg := make([]byte, 6+len(localIP))\n\tmsg[0] = socks5Version\n\tmsg[1] = RespSuccess\n\tmsg[2] = socks5Reserve\n\tmsg[3] = ipv4Address\n\tcopy(msg[4:], localIP)\n\tmsg[4+len(localIP)] = byte(localPort >> 8)\n\tmsg[4+len(localIP)+1] = byte(localPort & 0xff)\n\n\t// Send the message\n\t_, err := conn.Write(msg)\n\treturn err\n}", "title": "" }, { "docid": "002fac5deb91a028c1b3203ae9e2fdb3", "score": "0.5703955", "text": "func (cli *CommandLine) send(from, to string, amount int) {\n\tchain := blockchain.ContinueBlockChain(from)\n\tdefer chain.Database.Close()\n\n\ttx := blockchain.NewTransaction(from, to, amount, chain)\n\tchain.AddBlock([]*blockchain.Transaction{tx})\n\n\tfmt.Println(\"Success!\")\n}", "title": "" }, { "docid": "d9543d7773ad3e0c49909639b77d5ad6", "score": "0.5698519", "text": "func (ts *ToolSync) SendCurrAddress(addr uint64) error {\n\tif !ts.isInitialized {\n\t\t// Fail gracefully so we can always call this safely sans state test\n\t\treturn nil\n\t}\n\n\tts.addrBuf[0] = byte( addr & 0xff)\n\tts.addrBuf[1] = byte((addr >> 8) & 0xff)\n\tts.addrBuf[2] = byte((addr >> 16) & 0xff)\n\tts.addrBuf[3] = byte((addr >> 24) & 0xff)\n\tts.addrBuf[4] = byte((addr >> 32) & 0xff)\n\tts.addrBuf[5] = byte((addr >> 40) & 0xff)\n\tts.addrBuf[6] = byte((addr >> 48) & 0xff)\n\tts.addrBuf[7] = byte((addr >> 56) & 0xff)\n\n\tn, err := ts.addrConn.Write(ts.addrBuf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif n != 8 {\n\t\tmsg := \"Tried to send 8 address bytes to external tool, actually sent %d\"\n\t\treturn fmt.Errorf(msg, n)\n\t}\n\n\treturn nil;\n}", "title": "" }, { "docid": "9508e9eb699250a48095cf6232897a8b", "score": "0.5689324", "text": "func (e *EchoClient) send(c net.Conn) {\n\tdefer e.wg.Done()\n\n\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\n\tfor !utils.IsDone(e.done) {\n\t\tmsg := fmt.Sprintf(\"foo %d\", r.Int())\n\t\tif _, err := c.Write([]byte(msg)); err != nil {\n\t\t\tif utils.IsDone(e.done) {\n\t\t\t\t// Ignore the error if we've closed the connection.\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlog.Println(\"write:\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Printf(\"send: from: %q data: %q\\n\", c.LocalAddr(), msg)\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "6e9be2d010af8014c1e1c74b190313d1", "score": "0.56883997", "text": "func sendToRemoteServer(\n\tctx context.Context, inv invite,\n\tfederation fclient.FederationClient, cfg *config.FederationAPI,\n\tproto gomatrixserverlib.ProtoEvent,\n) (err error) {\n\tremoteServers := make([]spec.ServerName, 2)\n\t_, remoteServers[0], err = gomatrixserverlib.SplitID('@', inv.Sender)\n\tif err != nil {\n\t\treturn\n\t}\n\t// Fallback to the room's server if the sender's domain is the same as\n\t// the current server's\n\t_, remoteServers[1], err = gomatrixserverlib.SplitID('!', inv.RoomID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, server := range remoteServers {\n\t\terr = federation.ExchangeThirdPartyInvite(ctx, cfg.Matrix.ServerName, server, proto)\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t\tlogrus.WithError(err).Warnf(\"failed to send 3PID invite via %s\", server)\n\t}\n\n\treturn errors.New(\"failed to send 3PID invite via any server\")\n}", "title": "" }, { "docid": "7d460d027e96919066341aec822869ad", "score": "0.56850326", "text": "func InetSend(ctx context.Context, db DB, p0 string) ([]byte, error) {\n\t// call pg_catalog.inet_send\n\tconst sqlstr = `SELECT * FROM pg_catalog.inet_send($1)`\n\t// run\n\tvar r0 []byte\n\tlogf(sqlstr, p0)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0).Scan(&r0); err != nil {\n\t\treturn nil, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "57f76d27638d27c5beed7f27e2e69f4f", "score": "0.56842464", "text": "func (c *client) Send(s string) {\n\tc.wr.WriteString(s + \"\\n\")\n\tc.wr.Flush()\n\tc.srv.t.Logf(\"[client:%v] Sent: %q\", c.name, s)\n}", "title": "" }, { "docid": "e14b1bca5c94a2bf9b55fab515f9f5ac", "score": "0.56815606", "text": "func sendWorkerIptoServer(client *rpc.Client) (bool, error) {\n\tvar reply bool\n\tvar err error\n\terr = client.Call(\"Worker.ReceiveWorkerIp\", localaddress, &reply) // send localaddress to the server to store\n\tcheckError(\"\\nfunc sendWorkerIptoServer:\", err, false)\n\tclient.Close() // close the client, so we can start listening\n\tgo InitWorkerServerRPC() // start listening\n\treturn reply, err\n}", "title": "" }, { "docid": "fb6665a20b0b1ac472e29f2d834d649a", "score": "0.56452954", "text": "func (c *myConnector) timedWriteTo(buf []byte) (nm int, rerr error) {\n\tc.conn.SetDeadline(time.Now().Add(TIMEOUT * time.Second))\n\n\tn, err := c.conn.WriteTo(buf, c.remoteAddr)\n\n\tif err != nil {\n\t\tlog.Println(\"Could not send Data for !\",\n\t\t\t\"remote Addr\", c.remoteAddr)\n\t\t/* Handle temporary errors. */\n\t\tif nerr, ok := err.(net.Error); ok &&\n\t\t\tnerr.Temporary() {\n\t\t\tfmt.Println(\n\t\t\t\t\"temp error sending Data\",\n\t\t\t\terr)\n\t\t\ttime.Sleep(time.Second * 1)\n\t\t\trerr = nil\n\t\t\tnm = 0\n\t\t} else {\n\t\t\tfmt.Println(\"error receiving Data\", err)\n\t\t\tfmt.Println(err)\n\t\t\trerr = err\n\t\t\tnm = 0\n\t\t}\n\t} else {\n\t\tnm = n\n\t\trerr = err\n\t}\n\treturn\n}", "title": "" }, { "docid": "73df44e355183fcd69186f88e80e9fb9", "score": "0.5641722", "text": "func (server *Server) SendRaw(conn *net.UDPAddr, data []byte) {\n\tserver._UDPServer.WriteToUDP(data, conn)\n}", "title": "" }, { "docid": "17bcec2f1a4355d2d03ef002afe5777e", "score": "0.5639091", "text": "func (r *ShiftRegister) SendData(data uint8) {\n\tr.data = data\n\tfor i := uint(0); i < 8; i++ {\n\t\tr.setBit(rpio.State((r.data >> i) & 0x01))\n\t}\n\tr.flushStcp()\n}", "title": "" }, { "docid": "efef2e315af1c28de1d4b146ea72d274", "score": "0.5632317", "text": "func send(s chan<- int) {\n\ts <- 22\n}", "title": "" }, { "docid": "ce76641c08d11e7668297017b5780474", "score": "0.5631009", "text": "func (rc *Conn) send(method string, req proto.Message) error {\n\trpcRequestHeader := rc.newRpcRequestHeaderProto()\n\trequestHeader := rc.newRequestHeaderProto(method)\n\n\tbuf, err := rpcPackage(rpcRequestHeader, requestHeader, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = rc.Conn.Write(buf)\n\treturn err\n}", "title": "" }, { "docid": "06bfe59fb0e317dd8c6538fc5a598bc5", "score": "0.56305224", "text": "func (o *OLED96x96) sendCmd(buf ...byte) error {\n\tfor _, b := range buf {\n\t\tcmdCmdBuf[1] = b\n\t\tif err := o.Device.Write(cmdCmdBuf); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ee73fc86f06ab5836f92b2a756b793ae", "score": "0.5617824", "text": "func (pop *ParamOutPort) Send(param string) {\n\tfor _, pip := range pop.RemotePorts {\n\t\tDebug.Printf(\"Sending on out-param-port %s connected to in-param-port %s\", pop.Name(), pip.Name())\n\t\tpip.Send(param)\n\t}\n}", "title": "" }, { "docid": "c157bb60610bb181b6d4455cf0eeb878", "score": "0.56176275", "text": "func (client *OscClient) Send(data []byte) error {\r\n\r\n\taddr, err := net.ResolveUDPAddr(\"udp\", fmt.Sprintf(\"%s:%s\", client.IP, client.Port))\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tconn, err := net.DialUDP(\"udp\", nil, addr)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tdefer conn.Close()\r\n\r\n\tif _, err = conn.Write(data); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "e292943b497db2620f4b2d2f9e364495", "score": "0.5608428", "text": "func (c *client) sendGossip(g *Gossip, addr util.UnresolvedAddr, stream Gossip_GossipClient) error {\n\tg.mu.Lock()\n\tif delta := g.is.delta(c.remoteHighWaterStamps); len(delta) > 0 {\n\t\targs := Request{\n\t\t\tNodeID: g.is.NodeID,\n\t\t\tAddr: addr,\n\t\t\tDelta: delta,\n\t\t\tHighWaterStamps: g.is.getHighWaterStamps(),\n\t\t}\n\n\t\tbytesSent := int64(args.Size())\n\t\tinfosSent := int64(len(delta))\n\t\tc.clientMetrics.bytesSent.Add(bytesSent)\n\t\tc.clientMetrics.infosSent.Add(infosSent)\n\t\tc.nodeMetrics.bytesSent.Add(bytesSent)\n\t\tc.nodeMetrics.infosSent.Add(infosSent)\n\n\t\tif log.V(1) {\n\t\t\tlog.Infof(context.TODO(), \"node %d: sending %s\", g.is.NodeID, extractKeys(args.Delta))\n\t\t}\n\n\t\tg.mu.Unlock()\n\t\treturn stream.Send(&args)\n\t}\n\tg.mu.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "ed071e6d053c5b776c0f43e3c6dbfa75", "score": "0.5605392", "text": "func sendBlock(blk Block, sendAddress string) {\n\tlog.Print(\"[NET - SENDER] Dialing \" + sendAddress + \"... \")\n\t// Translate the address string to a dialable TCP address\n\ttcpAddr, err := net.ResolveTCPAddr(\"tcp\", sendAddress)\n\tconn, err := net.DialTCP(\"tcp\", nil, tcpAddr)\n\t// Skip attempted send if address dial fails.\n\tif err != nil {\n\t\tlog.Print(\"[NET - SENDER] Failed dialing \" + sendAddress + \". Skipping.\")\n\t}\n\n\t// Send block to socket\n\tconn.Write([]byte(StringifyBlock(blk)))\n}", "title": "" }, { "docid": "5ca61d9d9d3fc3d97a73d232989701bd", "score": "0.55977786", "text": "func (e *Epd) sendCommand(command byte) {\n\te.dcPin.Out(false)\n\te.csPin.Out(false)\n\tc := []byte{command}\n\tr := make([]byte, len(c))\n\te.spiConn.Tx(c, r)\n\te.csPin.Out(true)\n\te.readBusy()\n}", "title": "" }, { "docid": "6b0ce22dc84f3314b9887fef6faee6f2", "score": "0.5597696", "text": "func (n *node) send(messages []raftpb.Message) {\n\tfor _, m := range messages {\n\t\t//outBuf := logger.PrepareSend(\"Sending message to other node\", m)\n\t\tconn, err := net.Dial(\"tcp\", naddr[int(m.To)])\n\t\tif err == nil {\n\t\t\tenc := gob.NewEncoder(conn)\n\t\t\tenc.Encode(m)\n\t\t} else {\n\t\t\tfmt.Printf(\"*** Could not send message to Raft node: %v.\\n\", int(m.To))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "63fd540ebba6a7185e8dd20f1fb89b54", "score": "0.55917645", "text": "func (teocli *TeoLNull) send(packet []byte) (length int, err error) {\n\tif teocli.tcp {\n\t\tlength, err = teocli.conn.Write(packet)\n\t} else {\n\t\tlength = len(packet)\n\t\tfor {\n\t\t\tif len(packet) <= 512 {\n\t\t\t\t_, err = teocli.tcd.Write(packet)\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\t_, err = teocli.tcd.Write(packet[:512])\n\t\t\t\tpacket = packet[512:]\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "72bd934819a51709fb1003fc26237eb8", "score": "0.5588174", "text": "func (es *EchoServer) respond(remote *net.TCPConn) {\n\tdefer remote.Close()\n\tfmt.Fprintf(remote, \"%s\\n\", es.address)\n\t_, err := io.Copy(remote, remote)\n\tif err != nil {\n\t\tlog.Printf(\"Error: %s\", err)\n\t}\n}", "title": "" }, { "docid": "4215d1e6e1dc3da46cc6296332830ae8", "score": "0.5578426", "text": "func send() {\n\tfor coords := range coordsChannel {\n\t\tb := new(bytes.Buffer)\n\t\tjson.NewEncoder(b).Encode(coords)\n\t\thttp.Post(\"https://rokkacar.fi/coords/put\", \"application/json; charset=utf-8\", b)\n\t}\n}", "title": "" }, { "docid": "e3443acf183213de27ebe8798aeda8f3", "score": "0.5577948", "text": "func (c *Client) Send(data []byte, flush bool) error {\n\tc.instruments.Log(octo.LOGINFO, c.info.UUID, \"websocket.Client.Send\", \"Started\")\n\n\tif c.shouldClose() {\n\t\terr := errors.New(\"Connection will be closed\")\n\t\tc.instruments.Log(octo.LOGERROR, c.info.UUID, \"websocket.Client.Send\", \"Completed : Error : %s\", err.Error())\n\t\treturn err\n\t}\n\n\tc.sg.Add(1)\n\tdefer c.sg.Done()\n\n\tc.instruments.Log(octo.LOGTRANSMISSION, c.info.UUID, \"websocket.Client.Send\", \"Started : %+q\", data)\n\terr := c.Conn.WriteMessage(websocket.BinaryMessage, data)\n\tc.instruments.Log(octo.LOGTRANSMISSION, c.info.UUID, \"websocket.Client.Send\", \"Completed\")\n\n\tc.instruments.NotifyEvent(octo.Event{\n\t\tType: octo.DataWrite,\n\t\tClient: c.info.UUID,\n\t\tServer: c.info.SUUID,\n\t\tLocalAddr: c.info.Local,\n\t\tRemoteAddr: c.info.Remote,\n\t\tData: octo.NewDataInstrument(data, err),\n\t\tDetails: map[string]interface{}{},\n\t})\n\n\tif err != nil {\n\t\tc.instruments.Log(octo.LOGERROR, c.info.UUID, \"websocket.Client.Send\", \"Started : %q : Error : %s\", c.info.UUID, err.Error())\n\t\treturn err\n\t}\n\n\tc.instruments.Log(octo.LOGINFO, c.info.UUID, \"websocket.Client.Send\", \"Started\")\n\treturn nil\n}", "title": "" }, { "docid": "c72ef172133f42d1763337d56eca5c48", "score": "0.5572846", "text": "func (c *conn) send(b []byte) error {\n\tc.txL.Lock()\n\tdefer c.txL.Unlock()\n\t_, err := c.c.Write(b)\n\treturn err\n}", "title": "" }, { "docid": "5ef501dfb8edf9312ea24285efc90a6f", "score": "0.5563667", "text": "func tcpSend(addr *net.TCPAddr, msg message) error {\n\tp := make([]byte, BUFFSIZE)\n\tconn, err := net.DialTCP(\"tcp\", nil, addr)\n\tif err == nil {\n\t\toutbuf := logger.PrepareSend(msg.Type, msg)\n\t\t_, err = conn.Write(outbuf)\n\t\t//checkError(err)\n\t\tn, _ := conn.Read(p)\n\t\tif string(p[:n]) != \"OK\" {\n\t\t\tfmt.Printf(\" [NO]\\n<-- Request was denied by node: %v.\\nEnter command: \", string(p[:n]))\n\t\t} else {\n\t\t\tfmt.Printf(\" [OK]\\n\")\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "410630a84670d10ae720576e1b019020", "score": "0.5559941", "text": "func (g *Gateway) sendReport(report, macAddr string){\n\tfmt.Printf(\"SERVER: PUBLISHING REPORT %s: %s\\n\", macAddr, report)\n\tif err = sock.Send([]byte(report)); err != nil {\n\t\tdie(\"Failed publishing: %s\", err.Error())\n\t}\n\ttime.Sleep(time.Second)\n}", "title": "" }, { "docid": "abc348fa310a848c3d2b5bb3b891fa0d", "score": "0.55545104", "text": "func (sock *RouterSocket) Send(payload ServicePackable) error {\n\tbuffer := make([]byte, Size(payload))\n\tPack(buffer, payload)\n\n\t// Transmission of the buffer contents\n\t_, err := sock.conn.WriteToUDP(buffer, sock.addr)\n\treturn err\n}", "title": "" }, { "docid": "ec585cd370fac3d4011e9185a0362045", "score": "0.5546205", "text": "func (client *ClientInfo) Send(p *o.WirePkt) {\n\tclient.PktOutQ <- p\n}", "title": "" }, { "docid": "639fc1efd4138025c172a81cd3a0eedc", "score": "0.55435705", "text": "func (t *Transmission) Send(data []byte, flush bool) error {\n\treturn t.client.Send(data, flush)\n}", "title": "" }, { "docid": "73875bc1fe81082b33a7c4ceb8835ee0", "score": "0.5541764", "text": "func (pt *OutPort) Send(ip *FileIP) {\n\tfor _, rpt := range pt.RemotePorts {\n\t\tDebug.Printf(\"Sending on out-port %s connected to in-port %s\", pt.Name(), rpt.Name())\n\t\trpt.Send(ip)\n\t}\n}", "title": "" }, { "docid": "23d09319e5fd1be728ee15bec23e31a8", "score": "0.5541223", "text": "func (pip *ParamInPort) Send(param string) {\n\tpip.Chan <- param\n}", "title": "" }, { "docid": "85e87ec38dc4ca8565f49df09109fe94", "score": "0.5522302", "text": "func (c *Sender) Send(msg string) error {\n\tc.log.TRACE.Printf(\"send to %s %v\", c.addr, msg)\n\t_, err := io.Copy(c.conn, strings.NewReader(msg))\n\treturn err\n}", "title": "" }, { "docid": "324a3412896362dfa60ab2d01b7b1585", "score": "0.55144864", "text": "func (s *Server) NetSend(msg ipcrouter.NetSendRequest) {\n\tn, ok := s.nByAddr[msg.GetAddr().String()]\n\tif !ok {\n\t\tlog.Info(log.Lbl(\"send_to_unknown_node\"), msg.GetAddr().String(), msg.GetType32(), msg.GetRouterPort())\n\t\treturn\n\t}\n\ts.netSend(msg.GetHeader(), n, true, msg.Port())\n}", "title": "" }, { "docid": "2fdd5f2395be19f470161c0169f15131", "score": "0.551255", "text": "func (g *GossipCollector) SendRPC(*pubsub.RPC, peer.ID) {}", "title": "" }, { "docid": "dc50ee6e84e39d5ce575dda28d3a064b", "score": "0.55109614", "text": "func (o *OATH) send(cla, ins, p1, p2 byte, data ...[]byte) (tvs, error) {\n\n\tvar (\n\t\tcode code\n\t\tresults []byte\n\t\tsend = append([]byte{cla, ins, p1, p2}, write(0x00, data...)...)\n\t)\n\n\tfor {\n\n\t\tif o.Debug != nil {\n\t\t\to.Debug(\"SEND % x (%d)\", send, len(send))\n\t\t}\n\n\t\tres, err := o.card.Transmit(send)\n\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, errFailedToTransmit)\n\t\t}\n\n\t\tif o.Debug != nil {\n\t\t\to.Debug(\"RECV % x (%d)\", res, len(res))\n\t\t}\n\n\t\tcode = res[len(res)-2:]\n\t\tresults = append(results, res[0:len(res)-2]...)\n\n\t\tif code.IsMore() {\n\n\t\t\tsend = []byte{0x00, 0xa5, 0x00, 0x00}\n\n\t\t\tif o.Debug != nil {\n\t\t\t\to.Debug(\"MORE %d\", int(code[1]))\n\t\t\t}\n\n\t\t} else if code.IsSuccess() {\n\n\t\t\tif o.Debug != nil {\n\t\t\t\to.Debug(\"DONE\")\n\t\t\t}\n\n\t\t\treturn read(results), nil\n\n\t\t} else {\n\t\t\treturn nil, code\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "faec93b71047e3d4a09a28a6888169a3", "score": "0.55093175", "text": "func (s *writeStream) Send(data []byte) error {\n\tif s.closed.Load() {\n\t\t// if write stream is closed, return EOF err\n\t\treturn io.EOF\n\t}\n\treturn s.cli.Send(&protoWriteV1.WriteRequest{Record: data})\n}", "title": "" }, { "docid": "94e05fd28277fc13b9827d7470dbbce3", "score": "0.5497762", "text": "func (kvmsg *Kvmsg) Send(socket *zmq.Socket) (err error) {\n\t//fmt.Printf(\"Send to %s: %q\\n\", socket, kvmsg.frame)\n\t_, err = socket.SendMessage(kvmsg.frame)\n\treturn\n}", "title": "" }, { "docid": "b18f768f3e9b8d1748648374e6f9d1b7", "score": "0.54932517", "text": "func (s *Socket) Send(data []byte) error {\n\treturn s.bundler.Bundle(data, s.conn)\n}", "title": "" }, { "docid": "1662b9682f57176c6ec08c5473229563", "score": "0.5492439", "text": "func (pw *Writer) Send(conn net.Conn) error {\n\tbinary.LittleEndian.PutUint16(pw.pack.Bytes()[0:2], pw.Offset)\n\t_, err := conn.Write(pw.pack.Bytes())\n\treturn err\n}", "title": "" }, { "docid": "b1602da990d725eb490064809c567b31", "score": "0.5491395", "text": "func (clientObj *client) SendData(req request.UploadRequest, dnIP string, dnDataPort string) bool {\n\tsocket, ok := comm.Init(zmq4.REQ, \"\")\n\tdefer socket.Close()\n\tlogger.LogFail(ok, LogSign, clientObj.id, \"SendData(): Failed to acquire request Socket\")\n\n\tvar connectionString = []string{comm.GetConnectionString(clientObj.ip, clientObj.port)}\n\tcomm.Bind(socket, connectionString)\n\n\tfile := fileutils.OpenFile(req.FileName)\n\tdefer file.Close()\n\n\tchunksCount := fileutils.GetChunksCount(req.FileName)\n\n\t//Send the chunksCount to the DataNode\n\tsendChunkCountStatus := clientObj.sendChunkCount(socket, chunksCount)\n\tlogger.LogSuccess(sendChunkCountStatus, LogSign, clientObj.id, \"Successfully sent chunk count to DataNode\")\n\tif sendChunkCountStatus == false {\n\t\treturn false\n\t}\n\n\t//Send the actual chunks of data\n\tfor i := 0; i < chunksCount; i++ {\n\t\tchunk, size, done := fileutils.ReadChunk(file)\n\n\t\tif done == true {\n\t\t\tbreak\n\t\t}\n\n\t\tsendChunkStatus := clientObj.sendDataChunk(socket, chunk[:size], i+1)\n\t\tlogger.LogSuccess(sendChunkStatus, LogSign, clientObj.id, fmt.Sprintf(\"Successfully sent chunk #%d\", i+1))\n\t\tif sendChunkStatus == false {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "2a087c307b212f069afbbb54fdcca2b0", "score": "0.548613", "text": "func (s *Server) Send(to string, msg []byte) error {\n\t// Fix for an anoying windows bug:\n\t// > https://github.com/golang/go/issues/15216\n\tif strings.HasPrefix(to, \":\") {\n\t\tto = \"127.0.0.1\" + to\n\t}\n\n\t// Get the address\n\taddr, err := getAddr(to)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Generate the message it's id\n\tmessageID, err := genMsgID()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpartsDataLenght := s.BufferSize - uint64(metaSize) - 1\n\n\t// n is the total written bytes to the\n\tsendPart := func(from uint64) error {\n\t\tstartMessage := from == 0\n\t\tif from >= uint64(len(msg)) {\n\t\t\treturn nil\n\t\t}\n\t\ttime.Sleep(time.Microsecond)\n\n\t\tdata := bytes.NewBufferString(\"d\")\n\t\tcreateMeta(data, startMessage, messageID, from, uint64(len(msg)))\n\n\t\tsliceSize := partsDataLenght\n\t\tif uint64(len(msg))-from < sliceSize {\n\t\t\tsliceSize = uint64(len(msg)) - from\n\t\t}\n\t\tdata.Write(msg[from : from+sliceSize])\n\n\t\t_, err = s.serv.WriteToUDP(data.Bytes(), addr)\n\t\treturn err\n\t}\n\n\t// vars for the main for loop\n\tend := make(chan error)\n\tvar (\n\t\tended bool\n\t\tconfirmedRecivedTo uint64\n\t\tcurrentPosition uint64\n\t\tcurrentPositionLock sync.RWMutex\n\t)\n\n\t// Setting up all functions that need to run in a goroutine\n\trecivedFirstRequst := false\n\ts.sendingLock.Lock()\n\ts.sending[messageID] = &sendHandelers{\n\t\tconfirm: func(to uint64) {\n\t\t\tif to == partsDataLenght {\n\t\t\t\trecivedFirstRequst = true\n\t\t\t}\n\t\t\tif to > confirmedRecivedTo {\n\t\t\t\tconfirmedRecivedTo = to\n\t\t\t}\n\t\t},\n\t\treq: func(from uint64) {\n\t\t\tif from < confirmedRecivedTo {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconfirmedRecivedTo = from\n\t\t},\n\t}\n\ts.sendingLock.Unlock()\n\n\tgo func() {\n\t\tcheckNum := 0\n\t\tfor {\n\t\t\tif ended {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif checkNum == 5 {\n\t\t\t\tend <- ErrReqTimedOut\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcheckNum++\n\t\t\ttime.Sleep(time.Millisecond * 5)\n\t\t\tif recivedFirstRequst {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcurrentPositionLock.Lock()\n\t\t\tcurrentPosition = 0\n\t\t\tcurrentPositionLock.Unlock()\n\t\t}\n\t}()\n\n\tgo func() {\n\t\t// This is the main for loop that sends all parts\n\t\tfor {\n\t\t\tgo func(currentPosition uint64) {\n\t\t\t\tif ended {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif confirmedRecivedTo > currentPosition {\n\t\t\t\t\tcurrentPosition = confirmedRecivedTo\n\t\t\t\t}\n\n\t\t\t\tif int(currentPosition) >= len(msg) {\n\t\t\t\t\t// Req fininshed\n\t\t\t\t\tend <- nil\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// fmt.Printf(\"Sending part: %%%d of the %%100\\n\", int(math.Round(float64(100)/float64(len(msg))*float64(currentPosition))))\n\n\t\t\t\terr := sendPart(currentPosition)\n\t\t\t\tif err != nil {\n\t\t\t\t\tend <- err\n\t\t\t\t}\n\t\t\t}(currentPosition)\n\n\t\t\tcurrentPositionLock.Lock()\n\t\t\tcurrentPosition += partsDataLenght\n\t\t\tcurrentPositionLock.Unlock()\n\t\t}\n\t}()\n\n\terr = <-end\n\tended = true\n\treturn err\n}", "title": "" }, { "docid": "b711ae3516ded3994cc740ce909b3fd8", "score": "0.5480676", "text": "func (t *TtyConn) SendData(buf []byte) error {\n\tlog.Printf(\"TTY TX: % X\", buf)\n\tt.Lock()\n\tdefer t.Unlock()\n\n\t_, err := t.f.Write(buf)\n\tif err != nil {\n\t\tlog.Println(\"Write err:\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b376bf549aa79858fb82555d0869cac6", "score": "0.54795283", "text": "func (conn *Conn) Send(payload []byte) error {\n\tconn.vlog(RawDataEvent{payload}, true)\n\t_, err := conn.Write(payload)\n\treturn err\n}", "title": "" }, { "docid": "3f60744bb9e04e7fbea45d64cf7995ce", "score": "0.5478088", "text": "func send(cmd string) {\n\trequests[index] = cmd\n\tcmdstr := fmt.Sprintf(\"!%d \", index) + cmd\n\tif debug {\n\t\tfmt.Println(\"SEND: \" + cmdstr)\n\t}\n\tserver.conn.Write([]byte(cmdstr + \"\\n\"))\n\tindex += 1\n}", "title": "" }, { "docid": "4ba842ba6d9d524ba9cabf98ea901084", "score": "0.5476366", "text": "func sendMessageRaw(msg string, device interface{}) error {\n\t// Turn this hex string into bytes for sending\n\tbuf, _ := hex.DecodeString(msg)\n\n\t// Resolve our address, ready for sending data\n\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", device.IP.String())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Actually write the data and send it off\n\t_, err = conn.WriteToUDP(buf, udpAddr)\n\t// If we've got an error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpassMessage(\"sendMessageRaw\", device)\n\treturn nil\n}", "title": "" }, { "docid": "28a905251b897854b23e2394307597bd", "score": "0.54682446", "text": "func (pt *InPort) Send(ip *FileIP) {\n\tpt.Chan <- ip\n}", "title": "" }, { "docid": "ef65eab8d20416a6d41240fc9f0bf1b9", "score": "0.54681796", "text": "func (t *TCP) Send(ctx context.Context, r *Response) error {\n\n\t// Find the client connection for this IPAddress.\n\tvar c *client\n\tt.clientsMu.Lock()\n\t{\n\t\t// Validate this ipaddress and socket exists first.\n\t\tvar ok bool\n\t\tif c, ok = t.clients[r.TCPAddr.String()]; !ok {\n\t\t\tt.clientsMu.Unlock()\n\t\t\treturn fmt.Errorf(\"IP[ %s ] : disconnected\", r.TCPAddr.String())\n\t\t}\n\n\t\t// Increment the number of writes.\n\t\tc.nWrites++\n\t}\n\tt.clientsMu.Unlock()\n\n\t// Send the response.\n\treturn t.RespHandler.Write(r, c.writer)\n}", "title": "" }, { "docid": "2aafc44f8708a465972381bca769d19d", "score": "0.54655385", "text": "func execSendmsgN(_ int, p *gop.Context) {\n\targs := p.GetArgs(5)\n\tret, ret1 := syscall.SendmsgN(args[0].(int), args[1].([]byte), args[2].([]byte), args[3].(syscall.Sockaddr), args[4].(int))\n\tp.Ret(5, ret, ret1)\n}", "title": "" } ]
416df70c7bfdbd46af26601cd89ed5bb
Deprecated: Use RedeemCheckData.ProtoReflect.Descriptor instead.
[ { "docid": "d9791703b18673893bdecdf7157c1b30", "score": "0.6661594", "text": "func (*RedeemCheckData) Descriptor() ([]byte, []int) {\n\treturn file_data_proto_rawDescGZIP(), []int{8}\n}", "title": "" } ]
[ { "docid": "b23da3023513f4f4aa73e8265f024efe", "score": "0.6761177", "text": "func (*DeprecatedMessage) Descriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_peptide_testdata_comments_deprecated_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "74af090ad5706fe6bd95e905aa56232e", "score": "0.6725825", "text": "func (*InternalChecker) Descriptor() ([]byte, []int) {\n\treturn file_google_monitoring_v3_uptime_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "41081dfe386fc5ea46595c289931f495", "score": "0.66328335", "text": "func (*Listener_DeprecatedV1) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v4alpha_listener_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "902a342ced7346897f8daad62eba8161", "score": "0.6576863", "text": "func (*CheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_health_rpc_rpc_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "960d0827936fb2ab9e8eeec012e64e59", "score": "0.65671927", "text": "func (*CheckCompatibilityRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_analytics_data_v1beta_analytics_data_api_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "cd15ee33f87bfa094be99e9554bab918", "score": "0.65608764", "text": "func (*DeltaDiscoveryRequest) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "1a50778a9bb2f091a7a4ea4eab068204", "score": "0.6555998", "text": "func (*PermissionChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_permission_change_proto_rawDescGZIP(), []int{0, 3}\n}", "title": "" }, { "docid": "36f7796129a446fc1315f4fba58955e4", "score": "0.64955056", "text": "func (x *fastReflection_ClassFee) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ClassFee\n}", "title": "" }, { "docid": "a69d53c7d75e9a67cce50df240fb364a", "score": "0.6448699", "text": "func (*GroupOld) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "37519e270e26d64cb9c9f802f0f8930b", "score": "0.64415133", "text": "func (*Message702) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "f8193b94d94afa2709bef4c104c47ab2", "score": "0.6429057", "text": "func (*CheckerChartV1) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "99ae87f93017e5b0987e771359c82ace", "score": "0.64195406", "text": "func (*OldMessage) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "2cf397ff83ece74192cd84524c054297", "score": "0.64152354", "text": "func (*PermissionChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_permission_change_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "89013564a8dfdd5477834d455526774b", "score": "0.6410773", "text": "func (*Message717) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "df5187a7a50b46904deb2b27230469c0", "score": "0.63993526", "text": "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "title": "" }, { "docid": "73df57008b7f61183a81d597cd6b2760", "score": "0.639071", "text": "func (DeprecatedEnum) EnumDescriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_peptide_testdata_comments_deprecated_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "9a2b38e97eda77a4dfcadac60d6852f0", "score": "0.63865834", "text": "func (*NotifyFriendChange) Descriptor() ([]byte, []int) {\n\treturn file_dhs_proto_rawDescGZIP(), []int{178}\n}", "title": "" }, { "docid": "d7bac96522235593853b1fee00c838d6", "score": "0.6367766", "text": "func (*CheckCompatibilityResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_analytics_data_v1beta_analytics_data_api_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ceda72b7bdfaf42f23e0d4c553bb8fe1", "score": "0.6361331", "text": "func (*CheckerV1) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "90d289f11784b6f52648b81dd5948fe0", "score": "0.63602686", "text": "func (*PermissionChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_permission_change_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "8bfbcd648f49e4880835838044dc4a46", "score": "0.6351303", "text": "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_events_v1_events_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "410bee446d18016c8df150d9c042e751", "score": "0.6349675", "text": "func (x *fastReflection_BadSigner) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_BadSigner\n}", "title": "" }, { "docid": "03d3c37b39592139b88fc69c91bd74b8", "score": "0.634754", "text": "func (*GroupOld_G) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{24, 0}\n}", "title": "" }, { "docid": "d43d146237278e2078652bc6479bbecc", "score": "0.63464165", "text": "func (*CheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_antibruteforce_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d0178d6f7ce95df98a18c08c2c186964", "score": "0.6333347", "text": "func (*NotifyVipLevelChange) Descriptor() ([]byte, []int) {\n\treturn file_dhs_proto_rawDescGZIP(), []int{197}\n}", "title": "" }, { "docid": "69730ee6939acaab3e36e06a8c3a637c", "score": "0.6332893", "text": "func (x *fastReflection_MsgEditValidator) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgEditValidator\n}", "title": "" }, { "docid": "d38fdd7bdf35b15cdbd30d872c807897", "score": "0.63316053", "text": "func (*DomainTrademarkCheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_domain_domain_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "2432b4edf20e068b654f65791a6a7720", "score": "0.63175803", "text": "func (*TransitionToObserverResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_HAServiceProtocol_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "694f78a33a1a5d0fdb98723852d40573", "score": "0.631684", "text": "func (*RunHealthCheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_vtctldata_proto_rawDescGZIP(), []int{144}\n}", "title": "" }, { "docid": "6e6f3342fff7e08cc52854e1783c93fc", "score": "0.63166773", "text": "func (*ExtensionRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "9ba11866c8fb78cfa1e8a332eff5dd7f", "score": "0.6311352", "text": "func (*TelemetryUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_telemetry_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "8656a15c318d41805e5046df62a224cf", "score": "0.6307811", "text": "func (*ValidationReport) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_migrationcenter_v1_migrationcenter_proto_rawDescGZIP(), []int{128}\n}", "title": "" }, { "docid": "2ab9522176374f3de8c5444123391d64", "score": "0.6307094", "text": "func (*Message706) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "764e8179e0ff82b49844d707e0a26ce1", "score": "0.63013315", "text": "func (*Message707) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "468d340750a0018bc6665c8ed1c5caf1", "score": "0.62927", "text": "func (*DeprecatedConfigId) Descriptor() ([]byte, []int) {\n\treturn file_dutfeatures_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "f7c32bc5858b8d0f3a126e9b9743c6eb", "score": "0.6287304", "text": "func (*CheckStatusResponse) Descriptor() ([]byte, []int) {\n\treturn file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "4333618930e6c8d9cdd6f22d61d5846e", "score": "0.62839144", "text": "func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_determined_api_v1_webhook_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "7b1229da5556762d590981c19573c120", "score": "0.62785417", "text": "func (*PermissionChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_permission_change_proto_rawDescGZIP(), []int{0, 1}\n}", "title": "" }, { "docid": "a3b4ad1b103247bd69c466bab353cdc1", "score": "0.62766063", "text": "func (x *fastReflection_MsgCreateValidator) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCreateValidator\n}", "title": "" }, { "docid": "fe288ee36264a97a9335c5619c45c49a", "score": "0.62746847", "text": "func (*ValidationRecord) Descriptor() ([]byte, []int) {\n\treturn file_core_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "1194184ec4779f306cb2dd73a910d182", "score": "0.6274059", "text": "func (*Message714) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "4fdef62d91fd618b82f3de2bc9bfbc7b", "score": "0.6272146", "text": "func (*NotifyVirtualDaaScoreChangedRequestMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{84}\n}", "title": "" }, { "docid": "cf1c5e74bdd026fafed4a473b310807e", "score": "0.62679243", "text": "func (*GetTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_admin_teams_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "93dd0203a1aadd53afc60915f4741f36", "score": "0.6267587", "text": "func (*DomainCheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_domain_domain_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "7a6309663885ddee6ee279862925acfe", "score": "0.6267258", "text": "func (x *fastReflection_DisabledListResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_DisabledListResponse\n}", "title": "" }, { "docid": "a879907591cfc670105c4698309f7130", "score": "0.6262058", "text": "func (*ScheduledCallEditMessage) Descriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{66}\n}", "title": "" }, { "docid": "5755060101099bd0a5cdf1fe89fde3bb", "score": "0.6260077", "text": "func (*DescribeCheckerV1Request) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "0bed0d33faeda082e72831ffcb677fe4", "score": "0.6259393", "text": "func (*Message713) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "afe5af8d61879345f4f4f6738f72b8db", "score": "0.62569857", "text": "func (*Demand) Descriptor() ([]byte, []int) {\n\treturn file_ldproto_ldproto_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "f11dc3c6d8e904ecd10b6d3f85ac4e53", "score": "0.62559456", "text": "func (*VerifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_payeet_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "b911ca970a4f9a3281b0f86b0167ae0f", "score": "0.6253601", "text": "func (*GetFieldRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_firestore_admin_v1beta2_firestore_admin_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "29e75a6f5a9534fa7c3e9f665bc256f3", "score": "0.6251194", "text": "func (*ToBeExtended) Descriptor() ([]byte, []int) {\n\treturn file_reflection_grpc_testing_proto2_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "75cb62bff9270bca4085d31eb0cc922c", "score": "0.624008", "text": "func (*Message10749) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "eecba6474ddeb5da67ab19c0e4327482", "score": "0.623941", "text": "func (*PatchCheckpoint) Descriptor() ([]byte, []int) {\n\treturn file_determined_checkpoint_v1_checkpoint_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "9b7593d67c44ff9e895a59deb8d32572", "score": "0.6238834", "text": "func (*DeleteValue) Descriptor() ([]byte, []int) {\n\treturn file_testing_fake_proto_fake_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "972cd6c03ac981056ecb035304bf449c", "score": "0.6236051", "text": "func (*NotifyReviveCoinUpdate) Descriptor() ([]byte, []int) {\n\treturn file_dhs_proto_rawDescGZIP(), []int{187}\n}", "title": "" }, { "docid": "5cb977e31b846ae97e48fbafb946b4c3", "score": "0.6228079", "text": "func (*Message712) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "127e184bce0f025ee488b2f81102ee92", "score": "0.6223849", "text": "func (*MTLSEndpoints) Descriptor() ([]byte, []int) {\n\treturn file_oidc_discovery_v1_discovery_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "3a8b6332c4d492524be6f17038d0c557", "score": "0.62231165", "text": "func (x *fastReflection_BatchSupply) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_BatchSupply\n}", "title": "" }, { "docid": "37c32c80c8beafbd686aedea65589155", "score": "0.6222494", "text": "func (*DiscoveryRequest) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "53fe6b4b0aa096f57c3fab718f8f2a3c", "score": "0.62223697", "text": "func (*ExperimentalExplicitDisclosure) Descriptor() ([]byte, []int) {\n\treturn file_com_daml_ledger_api_v1_experimental_features_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "6a278d5e1f869a01a7d92299c9fba82a", "score": "0.62213534", "text": "func (*UpdateFlowRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_common_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "09dc3636fe514cbe7946875585092343", "score": "0.62201875", "text": "func (*BatchCheckPermissionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_milo_proto_v1_rpc_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "f04abda9dad3e6308c553e571afdf0ee", "score": "0.62188774", "text": "func (*DiscoveryRequest) Descriptor() ([]byte, []int) {\n\treturn file_discover_proto_message_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "c023a1ad06f3e0df0ed5ee1c77f91fd8", "score": "0.621872", "text": "func (*Message711) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{27}\n}", "title": "" }, { "docid": "a952e2ea8b48b3b3c03f423eb7c19707", "score": "0.62177014", "text": "func (*ServerReflectionRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "0dc818443edf2e4caa0f842f93fa6b97", "score": "0.62154776", "text": "func (*FileDescriptorResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "2598f1d018deb8083a4ea8645a9ac8b0", "score": "0.6214371", "text": "func (*CheckPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_apps_permission_pb_request_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "b5cfc59ee14679fc66d8e0b67be2fad8", "score": "0.6210004", "text": "func (*Message709) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "46a3f2bb951f459829a11c153a243678", "score": "0.6209607", "text": "func (*TelemetryDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_telemetry_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "e30914767010d19f08fcbddda4512798", "score": "0.6208866", "text": "func (*UpdateCheckerV1Request) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "91b50bbce7199d84adb282c98ff35e88", "score": "0.62023455", "text": "func (*TargetChange) Descriptor() ([]byte, []int) {\n\treturn file_google_firestore_v1_firestore_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "00f843f67d55dd9fc99bfea2451bb759", "score": "0.6201746", "text": "func (*DynamicParameterConstraints) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "317a1725d4cbcda0c5ac12f63d66262a", "score": "0.62012476", "text": "func (*CheckResponse) Descriptor() ([]byte, []int) {\n\treturn file_health_rpc_rpc_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ea32366392b5424dcf666ec4e1664fed", "score": "0.6199733", "text": "func (*PrivacyMessage) Descriptor() ([]byte, []int) {\n\treturn file_privacy_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "18268298d97889ed941caacf30511f11", "score": "0.61993283", "text": "func (*ReportTrialValidationMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_determined_api_v1_trial_proto_rawDescGZIP(), []int{56}\n}", "title": "" }, { "docid": "820e33122720bd89d0bd84fda7515a8f", "score": "0.6198802", "text": "func (*GetValidationMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_determined_api_v1_trial_proto_rawDescGZIP(), []int{64}\n}", "title": "" }, { "docid": "de4b4085e58cad62d3c83a1f0be0f8fb", "score": "0.6198535", "text": "func (*EditableEnum) Descriptor() ([]byte, []int) {\n\treturn file_registry_ChecklistService_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "85092547e63d0eea9d7bca6573bfafbc", "score": "0.61968786", "text": "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_vtctldata_proto_rawDescGZIP(), []int{182}\n}", "title": "" }, { "docid": "10fda31d4527b9fab712b58c91ca841b", "score": "0.61954546", "text": "func (*DomainClaimsCheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_domain_domain_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "4b1dc83b4032206be9b797aa17c3994c", "score": "0.61943364", "text": "func (*Method) Descriptor() ([]byte, []int) {\n\treturn file_discovery_discovery_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "7f27153651908c54ded528d245aae2a2", "score": "0.6193085", "text": "func (Enum6782) EnumDescriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_8_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "e1a50c2afe3793db318dedaea0a468d0", "score": "0.6192766", "text": "func (*NotifyActivityChange) Descriptor() ([]byte, []int) {\n\treturn file_dhs_proto_rawDescGZIP(), []int{203}\n}", "title": "" }, { "docid": "3705cd41693e3deb626302600cd9f540", "score": "0.61918896", "text": "func (*Message8890) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "71c0413db20422c9079a91156105b7b3", "score": "0.619085", "text": "func (*NoChange) Descriptor() ([]byte, []int) {\n\treturn file_Discovery_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "84d6ee665c094d20ff0f69e93298d3f8", "score": "0.61882627", "text": "func (UptimeCheckConfig_CheckerType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_monitoring_v3_uptime_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "55fc7e0fa8a7b936f5c81bcc6e71e089", "score": "0.6187792", "text": "func (*TestWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_determined_api_v1_webhook_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "bbb9a7169353e3c77a0c7766666eae66", "score": "0.61863077", "text": "func (*Message9182) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "61c72705295ff849726959a0d7473e58", "score": "0.61856663", "text": "func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_registry_v1alpha1_webhook_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "19d573e5717ae4dc55b280f0462fb8ea", "score": "0.61845577", "text": "func (x *fastReflection_MsgUndelegate) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUndelegate\n}", "title": "" }, { "docid": "ca5502f5776208aa0667069dc2fa77d3", "score": "0.6180051", "text": "func (*DeltaDiscoveryResponse) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "7f322feeec155d5cbe24a291534b561f", "score": "0.6178851", "text": "func (*DeclinePaymentRequestMessage) Descriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "2bf9874d3fac4591e858e746cb2eec0a", "score": "0.6177859", "text": "func (*Message8944) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "9db17ed8f9165bf07eccf4dcc620a2d6", "score": "0.61763096", "text": "func (*GetCheckerV1Request) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "867543d4ff89fd79ac4c42775c02e71e", "score": "0.6176216", "text": "func (*DeInfo) Descriptor() ([]byte, []int) {\n\treturn file_example_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "24d141e03fd9166327780edc7d5ce7a0", "score": "0.61758906", "text": "func (*VirtualDaaScoreChangedNotificationMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{86}\n}", "title": "" }, { "docid": "8b2b47360dcae03cef4cf930678365c0", "score": "0.6172388", "text": "func (*Message11020) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message3_benchmark_message3_6_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "cbcd693f8bbf60c035f53efefdf5b95b", "score": "0.6170271", "text": "func (*ValidNewAccMsg) Descriptor() ([]byte, []int) {\n\treturn file_db_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "be54440b98d2225ecfb2080e39f0f62c", "score": "0.6167381", "text": "func (*BytesRules) Descriptor() ([]byte, []int) {\n\treturn file_validate_validate_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "9394905936b1a76827a57709aa81f5ec", "score": "0.6165584", "text": "func (*Validator) Descriptor() ([]byte, []int) {\n\treturn file_core_abci_tendermint_types_types_proto_rawDescGZIP(), []int{14}\n}", "title": "" } ]
4e3795ab2d7e9a308d182d26ef74f8d5
StripBasePath instructs the RequestAccessor object that the given base path should be removed from the request path before sending it to the framework for routing. This is used when API Gateway is configured with base path mappings in custom domain names. TODO check if this is still needed.
[ { "docid": "594029b654a3cd41f10f8f687c410214", "score": "0.84303176", "text": "func (r *RequestAccessor) StripBasePath(basePath string) string {\n\tif strings.Trim(basePath, \" \") == \"\" {\n\t\tr.stripBasePath = \"\"\n\t\treturn \"\"\n\n\t}\n\n\tnewBasePath := basePath\n\tif !strings.HasPrefix(newBasePath, \"/\") {\n\t\tnewBasePath = \"/\" + newBasePath\n\n\t}\n\n\tif strings.HasSuffix(newBasePath, \"/\") {\n\t\tnewBasePath = newBasePath[:len(newBasePath)-1]\n\n\t}\n\tr.stripBasePath = newBasePath\n\treturn newBasePath\n\n}", "title": "" } ]
[ { "docid": "2856d8cf04c7afcfee647174d32eddd4", "score": "0.67896396", "text": "func TrimBasePathFromPath(basePath string, path string) string {\n\treturn strings.TrimPrefix(path, basePath)\n}", "title": "" }, { "docid": "e657164c084bd8d30f9c4e7e27d4fa09", "score": "0.63233674", "text": "func withoutBaseURL(baseURL string, r *http.Request) string {\n\tsuffix := strings.TrimPrefix(r.URL.String(), baseURL)\n\tsuffix = strings.TrimLeft(suffix, \"/\")\n\treturn suffix\n}", "title": "" }, { "docid": "d99438f2f048bc6a31b676738657f3be", "score": "0.6229714", "text": "func StripPathMiddleware(path string, next fasthttp.RequestHandler) fasthttp.RequestHandler {\n\treturn func(ctx *fasthttp.RequestCtx) {\n\t\turi := ctx.RequestURI()\n\n\t\tif strings.HasPrefix(string(uri), path) {\n\t\t\tctx.SetUserValue(\"base_url\", path)\n\n\t\t\tnewURI := strings.TrimPrefix(string(uri), path)\n\t\t\tctx.Request.SetRequestURI(newURI)\n\t\t}\n\n\t\tnext(ctx)\n\t}\n}", "title": "" }, { "docid": "b909f0f0eb2bf351d1fc613934ab0c69", "score": "0.6102636", "text": "func (c *APIClient) ChangeBasePath(path string) {\n\tc.cfg.BaseUrl = path\n}", "title": "" }, { "docid": "2f052c450095b3298ea40c69798a2074", "score": "0.6097456", "text": "func (ac *ApiConfig) BasePath() string {\n\tif ac.BasePathOverride == \"\" {\n\t\treturn client.DefaultBasePath\n\t}\n\treturn ac.BasePathOverride\n}", "title": "" }, { "docid": "2f052c450095b3298ea40c69798a2074", "score": "0.6097456", "text": "func (ac *ApiConfig) BasePath() string {\n\tif ac.BasePathOverride == \"\" {\n\t\treturn client.DefaultBasePath\n\t}\n\treturn ac.BasePathOverride\n}", "title": "" }, { "docid": "0b5cccebe9ddc15098b6ca3035228176", "score": "0.60184366", "text": "func (c *APIClient) ChangeBasePath(path string) {\n\tc.cfg.BasePath = path\n}", "title": "" }, { "docid": "7d32e11400c8df06f353eb18d1512b39", "score": "0.5871261", "text": "func (o BasePathMappingOutput) BasePath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BasePathMapping) pulumi.StringPtrOutput { return v.BasePath }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7d32e11400c8df06f353eb18d1512b39", "score": "0.5871261", "text": "func (o BasePathMappingOutput) BasePath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BasePathMapping) pulumi.StringPtrOutput { return v.BasePath }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7b9f9a188f23bf8fd86d3356b2076c4d", "score": "0.5685609", "text": "func preserveBasePath(original, resolved string) string {\n\t// Handle \"/\"\n\tif strings.HasSuffix(original, \"/\") {\n\t\tif !strings.HasSuffix(resolved, \"/\") {\n\t\t\tresolved += \"/\"\n\t\t}\n\t\treturn resolved\n\t}\n\n\t// Handle \"/.\"\n\tif strings.HasSuffix(original, \"/.\") {\n\t\tif strings.HasSuffix(resolved, \"/\") { // could be root!\n\t\t\tresolved += \".\"\n\t\t} else if !strings.HasSuffix(resolved, \"/.\") {\n\t\t\tresolved += \"/.\"\n\t\t}\n\t\treturn resolved\n\t}\n\n\treturn resolved\n}", "title": "" }, { "docid": "5739363b7454ac2c624d01ff1c3c7922", "score": "0.5634284", "text": "func (f *ReverseProxyDispatcher) ExtractPathPrefix(req *http.Request) string {\n\tsubPath := mux.Vars(req)[f.SubPathVarName]\n\tfullPath := req.URL.Path\n\t// We need to strip the prefix string before the request can be forward to apiserver, so we will walk over the full\n\t// request path backwards, everything before the `sub_path` will be the prefix we need to strip\n\treturn fullPath[:len(fullPath)-len(subPath)]\n}", "title": "" }, { "docid": "81ece7035950f7a27dd3b9635c7900fb", "score": "0.56197107", "text": "func (f *TunnelProxyDispatcher) ExtractPathPrefix(req *http.Request) string {\n\tsubPath := mux.Vars(req)[f.SubPathVarName]\n\tfullPath := req.URL.Path\n\t// We need to strip the prefix string before the request can be forward to apiserver, so we will walk over the full\n\t// request path backwards, everything before the `sub_path` will be the prefix we need to strip\n\treturn fullPath[:len(fullPath)-len(subPath)]\n}", "title": "" }, { "docid": "edc151b788de89c0b7a6e98b518aa670", "score": "0.55956477", "text": "func (handlerOptions) BasePath(prefix string) HandlerOption {\n\treturn func(apiHandler *APIHandler) {\n\t\tapiHandler.basePath = prefix\n\t}\n}", "title": "" }, { "docid": "86e73eda1bcae7efcc48a2cdbae81cf9", "score": "0.55442005", "text": "func RemoveBaseDir(value string, a string) string {\n\t// Get substring before a string.\n\tpos := strings.Index(value, a)\n\tif pos == -1 {\n\t\treturn \"\"\n\t}\n\treturn value[pos+1:]\n}", "title": "" }, { "docid": "a27481a0702452822987de20007b8ad8", "score": "0.54815936", "text": "func CleanRequest(req *events.APIGatewayProxyRequest) {\n\tpathLen := len(req.Path)\n\tif req.Path[pathLen-1] == '/' && len(req.Path) > 1 {\n\t\treq.Path = req.Path[:pathLen-1]\n\t}\n}", "title": "" }, { "docid": "1bb6388b34dffe91c18a7d5d3cf670b1", "score": "0.54097664", "text": "func trimPath(logger logrus.FieldLogger, requestPath, stripPath string) string {\n\tif !strings.HasPrefix(requestPath, stripPath) {\n\t\treturn requestPath\n\t}\n\n\ttrimmed := strings.TrimPrefix(requestPath, stripPath)\n\tlogger.WithFields(logrus.Fields{\n\t\t\"from\": requestPath,\n\t\t\"to\": trimmed,\n\t}).Debug(\"Rewrote path\")\n\treturn trimmed\n\n}", "title": "" }, { "docid": "0f581801768a3eebe585de56168ad04b", "score": "0.53930813", "text": "func GetBasePath(withFileServer bool) string {\n\tif withFileServer {\n\t\treturn \"/static\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "14254994b278373648e167a77d079e19", "score": "0.53767115", "text": "func (f *FilePersistenceStore) SetBasePath(path string) {\n\tf.basepath = path\n}", "title": "" }, { "docid": "6c184dc57ac94e1e8704180dbac4f09c", "score": "0.5349887", "text": "func (m *FileSystemStoragePathSourceConfig) GetBasePath() string {\n\tif m != nil {\n\t\treturn m.BasePath\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "b6047366f44fa1b5badd2048585f0fe9", "score": "0.53354275", "text": "func (f *Firmeve) GetBasePath() string {\n\treturn f.bashPath\n}", "title": "" }, { "docid": "6238bce8b3d2e9e9461f11296f0f4ae2", "score": "0.53335667", "text": "func stripLeaveSlash(prefix string, h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tblog.Debug(fmt.Sprintf(\"begin proxy for: %s\", req.URL.Path))\n\t\tp := strings.TrimPrefix(req.URL.Path, prefix)\n\t\tif len(p) >= len(req.URL.Path) {\n\t\t\thttp.NotFound(w, req)\n\t\t\treturn\n\t\t}\n\t\tif len(p) > 0 && p[:1] != \"/\" {\n\t\t\tp = \"/\" + p\n\t\t}\n\t\treq.URL.Path = p\n\t\th.ServeHTTP(w, req)\n\t})\n}", "title": "" }, { "docid": "6238bce8b3d2e9e9461f11296f0f4ae2", "score": "0.53335667", "text": "func stripLeaveSlash(prefix string, h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tblog.Debug(fmt.Sprintf(\"begin proxy for: %s\", req.URL.Path))\n\t\tp := strings.TrimPrefix(req.URL.Path, prefix)\n\t\tif len(p) >= len(req.URL.Path) {\n\t\t\thttp.NotFound(w, req)\n\t\t\treturn\n\t\t}\n\t\tif len(p) > 0 && p[:1] != \"/\" {\n\t\t\tp = \"/\" + p\n\t\t}\n\t\treq.URL.Path = p\n\t\th.ServeHTTP(w, req)\n\t})\n}", "title": "" }, { "docid": "d72fc20cb452ff2258f9dea2e26acd4e", "score": "0.53287226", "text": "func (s *Hammer) ChangeBasePath(path string) {\n\ts.esi.ChangeBasePath(path)\n}", "title": "" }, { "docid": "d9e822e5bdd5bb650ed52ca197a8615a", "score": "0.5311481", "text": "func StripPrefix(prefix string, next Handler) HandlerFunc {\n\treturn func(ctx *gemini.Ctx) {\n\t\tctx.Req.URL.Path = strings.TrimPrefix(ctx.Req.URL.Path, prefix)\n\t\tnext.ServeGem(ctx)\n\t}\n}", "title": "" }, { "docid": "8ce537fa278348d30dfe01c2e078951f", "score": "0.52662015", "text": "func LogoutBoundaryPath() string {\n\treturn logoutBasePath()\n}", "title": "" }, { "docid": "f8278100b8b88cab9bdb68d3cf80c7a8", "score": "0.52632385", "text": "func (ic *installContext) BasePath() string {\n\treturn ic.basePath\n}", "title": "" }, { "docid": "2e992cc2d5b1f0a61957a65f567eb383", "score": "0.5257477", "text": "func (uc *UserCrud) GetBasePath() string {\n\t// The base path for this crud will be `/user`\n\treturn \"user\"\n}", "title": "" }, { "docid": "74c355abfe19f9856bba205da8ef54f7", "score": "0.5255954", "text": "func AuthBoundaryPath() string {\n\treturn authBasePath()\n}", "title": "" }, { "docid": "3e3f258fc7800051eee842b75a9fbe21", "score": "0.52424955", "text": "func (p Path) BasePath() Path {\n\tif len(p) > 1 {\n\t\treturn p[:len(p)-1]\n\t}\n\treturn Path{}\n}", "title": "" }, { "docid": "2d31108f1860fef3d8d386be4d61ff77", "score": "0.5210825", "text": "func stripPrefix(path, prefix string) string {\n\tpl := len(strings.Split(prefix, \"/\"))\n\tpv := strings.Split(path, \"/\")\n\treturn strings.Join(pv[pl:], \"/\")\n}", "title": "" }, { "docid": "e050accc4a10bd8e66b6107c503283d4", "score": "0.52042085", "text": "func (g *gitChartIndexBuilder) SetBasePath(basePath string) Builder {\n\tg.basePath = basePath\n\treturn g\n}", "title": "" }, { "docid": "d16a2397c9353b6d660d46494a5c14b8", "score": "0.52008426", "text": "func (s *Server) Clean() {\n\ts.BaseURL = strings.TrimSuffix(s.BaseURL, \"/\")\n}", "title": "" }, { "docid": "df153da0d1d1e4d844d8a59c9d6c4d4e", "score": "0.51916957", "text": "func WithBase(base string) Option {\n\treturn func(c *Client) error {\n\t\tc.base = strings.TrimRight(base, \"/\")\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "87cf19b8186bdf93c777dc0ffa902459", "score": "0.5154112", "text": "func GetBasePathMapping(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *BasePathMappingState, opts ...pulumi.ResourceOption) (*BasePathMapping, error) {\n\tvar resource BasePathMapping\n\terr := ctx.ReadResource(\"aws-native:apigateway:BasePathMapping\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "55ff71eb74bab45fd9460c4faf2bd756", "score": "0.5107754", "text": "func stripRootSlash(appId string) string {\n\t// Trim leading slash from appId\n\tserviceName := appId\n\tif strings.HasPrefix(serviceName, \"/\") {\n\t\tserviceName = appId[1:]\n\t}\n\n\treturn serviceName\n}", "title": "" }, { "docid": "fe5c08051f3b880bdca20ca61fe794e2", "score": "0.51040226", "text": "func stripLeaveSlash(prefix string, h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tp := strings.TrimPrefix(req.URL.Path, prefix)\n\t\tif len(p) >= len(req.URL.Path) {\n\t\t\thttp.NotFound(w, req)\n\t\t\treturn\n\t\t}\n\t\tif len(p) > 0 && p[:1] != \"/\" {\n\t\t\tp = \"/\" + p\n\t\t}\n\t\treq.URL.Path = p\n\t\th.ServeHTTP(w, req)\n\t})\n}", "title": "" }, { "docid": "fe5c08051f3b880bdca20ca61fe794e2", "score": "0.51040226", "text": "func stripLeaveSlash(prefix string, h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tp := strings.TrimPrefix(req.URL.Path, prefix)\n\t\tif len(p) >= len(req.URL.Path) {\n\t\t\thttp.NotFound(w, req)\n\t\t\treturn\n\t\t}\n\t\tif len(p) > 0 && p[:1] != \"/\" {\n\t\t\tp = \"/\" + p\n\t\t}\n\t\treq.URL.Path = p\n\t\th.ServeHTTP(w, req)\n\t})\n}", "title": "" }, { "docid": "625c72003b7007b21a5a3bc0f5422c8a", "score": "0.5069916", "text": "func GetBasePathMapping(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *BasePathMappingState, opts ...pulumi.ResourceOption) (*BasePathMapping, error) {\n\tvar resource BasePathMapping\n\terr := ctx.ReadResource(\"aws:apigateway/basePathMapping:BasePathMapping\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "d49a55553aed5ffd76b6b99a1d33260c", "score": "0.4973434", "text": "func WithPathStrip(logger logrus.FieldLogger, path string) func(h http.Handler) http.Handler {\n\n\tif path == \"\" {\n\t\tlogger.Warn(\"Path strip is used with empty path argument, returning an empty handler\")\n\t\treturn func(h http.Handler) http.Handler {\n\t\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\th.ServeHTTP(w, r)\n\t\t\t})\n\t\t}\n\t}\n\n\tpath = normalizeSlashes(logger, path)\n\tlogger = logger.WithField(\"middleware\", \"path_strip\")\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tlogger := logger.WithField(RequestID.String(), r.Context().Value(RequestID))\n\t\t\tr.URL.Path = trimPath(logger, r.URL.Path, path)\n\n\t\t\th.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "a800e3d3427c6cd7c2c4f4923bcc2b70", "score": "0.49344856", "text": "func (r Repository) BasePath() string {\n\treturn r.basePath\n}", "title": "" }, { "docid": "8b7b3b26ab7693e61cb3750b1824877d", "score": "0.48713934", "text": "func TestPathTrimMiddlewareTrimPrefix(t *testing.T) {\n\tassert := assert.New(t)\n\treq, _ := http.NewRequest(\"GET\", \"http://example.com/foo/bar\", nil)\n\tw := httptest.NewRecorder()\n\n\tassert.Nil(NewPathTrimMiddleware(\"/foo\")(w, req))\n\tassert.Equal(req.URL.Path, \"/bar\")\n}", "title": "" }, { "docid": "abbbd7cc70c4513dc1e283db6789281d", "score": "0.4866219", "text": "func ResetBaseURL() {\n\tbaseURL = originalURL\n\tlogger.Trace.Printf(\"base URL reset to %q\", originalURL)\n}", "title": "" }, { "docid": "b12ebb32418008aac5d528aaad7acdc0", "score": "0.48510495", "text": "func basePath(p string) string {\n\tif i := strings.LastIndex(p, \"/\"); i > 0 {\n\t\treturn p[:i]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "9fd5d72e29907d76e9a9454c1c55e560", "score": "0.48463318", "text": "func (b *BasePartitioner) getBasePath(f *buffer.Flush) string {\n\treturn filepath.Join(\n\t\tfmt.Sprintf(\"%s/\", b.pathBaseFolder),\n\t\tfmt.Sprintf(\"%s%s/\", b.pathTopicNamePrefix, f.Topic),\n\t)\n}", "title": "" }, { "docid": "4429f259ed8c04e8a04ffbefee28980b", "score": "0.48438394", "text": "func (path Path) Base() string {\n\treturn std.Base(string(path))\n}", "title": "" }, { "docid": "6ab3578428147bde172f5bb3ebbc5138", "score": "0.4815982", "text": "func TrimPathPrefix(path, prefix string) string {\n\tpathParts := strings.Split(filepath.ToSlash(path), \"/\")\n\tprefixParts := strings.Split(filepath.ToSlash(prefix), \"/\")\n\n\tif len(pathParts) < len(prefixParts) {\n\t\treturn path\n\t}\n\n\tif reflect.DeepEqual(prefixParts, pathParts[:len(prefixParts)]) {\n\t\treturn filepath.Join(pathParts[len(prefixParts):]...)\n\t}\n\n\treturn path\n}", "title": "" }, { "docid": "85f5e8e0bc9024e92a9d9260f8e2c53f", "score": "0.479715", "text": "func NewBasePathMapping(ctx *pulumi.Context,\n\tname string, args *BasePathMappingArgs, opts ...pulumi.ResourceOption) (*BasePathMapping, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.DomainName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'DomainName'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource BasePathMapping\n\terr := ctx.RegisterResource(\"aws-native:apigateway:BasePathMapping\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "7b6971b8bb99f5ff969b77032e0ffec4", "score": "0.47935206", "text": "func trimPathPrefix(p, prefix string) string {\n\tif prefix == \"\" {\n\t\treturn p\n\t}\n\tif prefix == p {\n\t\treturn \"\"\n\t}\n\treturn strings.TrimPrefix(p, prefix+\"/\")\n}", "title": "" }, { "docid": "974c1a28e3ade5c85249c24e86437053", "score": "0.47907215", "text": "func NewBasePathMapping(ctx *pulumi.Context,\n\tname string, args *BasePathMappingArgs, opts ...pulumi.ResourceOption) (*BasePathMapping, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.DomainName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'DomainName'\")\n\t}\n\tif args.RestApi == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'RestApi'\")\n\t}\n\tvar resource BasePathMapping\n\terr := ctx.RegisterResource(\"aws:apigateway/basePathMapping:BasePathMapping\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "a438ba6ccbc0358033469d211b080c5f", "score": "0.478832", "text": "func (c *Client) SetBaseURL(URL string) *Client {\n\tc.restyClient.HostURL = strings.TrimRight(URL, \"/\")\n\treturn c\n}", "title": "" }, { "docid": "c53f3d31fb3a7fee86e94ad04c950867", "score": "0.478282", "text": "func trimPrefix(path string) string {\n\tif path == \"/*\" {\n\t\treturn \"/\"\n\t}\n\treturn strings.TrimSuffix(path, \"/*\")\n}", "title": "" }, { "docid": "a5ff9cd66d446acd3565253c35201cbb", "score": "0.4762925", "text": "func (bc *BasicClient) SetBase(base string) {\n\tbc.base = base\n}", "title": "" }, { "docid": "83cd5f3c5fc3bc8a978588ae0313e59d", "score": "0.4756227", "text": "func ioPathClean(path string) string {\n\n\tif strings.HasPrefix(path, \"/\") {\n\t\tpath = path[1:]\n\t}\n\tif path == \"\" {\n\t\tpath = \".\"\n\t}\n\treturn path\n}", "title": "" }, { "docid": "6f9d01d8ee81a0d4f8563f83aba4da95", "score": "0.4755712", "text": "func cleanPath(path string) string {\n\t// Remove the first Srcdir prefix found\n\tfor _, dir := range sys.Srcdir() {\n\t\tif !strings.HasPrefix(path, dir) {\n\t\t\tcontinue\n\t\t}\n\n\t\tpath = strings.Replace(path, dir, \"\", 1)\n\t\tbreak\n\t}\n\n\tif strings.HasPrefix(path, \"/\") || strings.HasPrefix(path, \"\\\\\") {\n\t\tpath = path[1:]\n\t}\n\treturn path\n}", "title": "" }, { "docid": "081cf1da4b03fde41477ad031a1aa0bd", "score": "0.47152776", "text": "func Base(fs FileSystem, path string) string {\n\tif fs != nil {\n\t\t_, path = SplitVolume(fs, path)\n\t}\n\ti := len(path) - 1\n\tfor i > 0 && IsPathSeparator(path[i]) {\n\t\ti--\n\t}\n\tj := i\n\tfor j >= 0 && !IsPathSeparator(path[j]) {\n\t\tj--\n\t}\n\tpath = path[j+1 : i+1]\n\tif path == \"\" {\n\t\tif j == 0 {\n\t\t\treturn PathSeparatorString\n\t\t}\n\t\treturn \".\"\n\t}\n\treturn path\n}", "title": "" }, { "docid": "79893948707fae99d171ed772a2a35a6", "score": "0.47143984", "text": "func sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}", "title": "" }, { "docid": "79893948707fae99d171ed772a2a35a6", "score": "0.47143984", "text": "func sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}", "title": "" }, { "docid": "79893948707fae99d171ed772a2a35a6", "score": "0.47143984", "text": "func sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}", "title": "" }, { "docid": "d4391e26c318bbb2665a4e8d2bef1d8d", "score": "0.47132832", "text": "func (e *Eek) SetBaseBuildPath(baseBuildPath string) {\n\te.baseBuildPath = baseBuildPath\n}", "title": "" }, { "docid": "e4ba86c366968454a5f919f065284df3", "score": "0.47012442", "text": "func (c *Client) SetBaseURL(urlStr string) error {\n\tif urlStr == \"\" {\n\t\turlStr = DefaultBaseURL\n\t}\n\n\tbaseURL, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif apiVersion != \"\" {\n\t\tbaseURL.Path += apiVersion + \"/\"\n\t}\n\tc.baseURL = baseURL\n\n\treturn nil\n}", "title": "" }, { "docid": "a7ba4d0c06de9444a6d4ff7219b9210a", "score": "0.4691713", "text": "func ExtractStripPath(anns map[string]string) string {\n\treturn valueFromAnnotation(stripPathKey, anns)\n}", "title": "" }, { "docid": "1eea907f9cc148b0c01a44c98aea7a26", "score": "0.46659192", "text": "func setBasePath() {\n\tif dirExist(\"sites\") {\n\t\tbasePath = \".\" + string(filepath.Separator)\n\t} else {\n\t\tbasePath = \"..\" + string(filepath.Separator)\n\t}\n}", "title": "" }, { "docid": "4820015c4829b5daed9ca480d2d32d0b", "score": "0.46644035", "text": "func TrimHandlerPrefix(prefix string, h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {\n\t\tr = r.Clone(r.Context())\n\n\t\tr.URL.Path = strings.TrimPrefix(r.URL.Path, prefix)\n\n\t\th.ServeHTTP(rw, r)\n\t})\n}", "title": "" }, { "docid": "c8546016bd5d421208be07f24ed034d4", "score": "0.46483436", "text": "func (p Path) Base() Path {\n\treturn Path(filepath.Base(string(p)))\n}", "title": "" }, { "docid": "9b7eb50685efbf8b81500835e4dc179d", "score": "0.46305245", "text": "func GetRioBasePath() fs.AbsolutePath {\n\tpth := os.Getenv(\"RIO_BASE\")\n\tif pth == \"\" {\n\t\tpth = \"/var/lib/timeless/rio\"\n\t}\n\tpth, err := filepath.Abs(pth)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn fs.MustAbsolutePath(pth)\n}", "title": "" }, { "docid": "4e0f26e4e7c140bed6c15ddea7463861", "score": "0.46283188", "text": "func UpdateBaseURL(webRootPath string) {\n\tlog.Infof(\"Updating base URL in index.html with [%v]\", webRootPath)\n\tpath, _ := filepath.Abs(\"./console/index.html\")\n\tb, err := ioutil.ReadFile(path)\n\tif isError(err) {\n\t\treturn\n\t}\n\n\thtml := string(b)\n\n\tsearchStr := `<base href=\"/\">`\n\tnewStr := `<base href=\"` + webRootPath + `/\">`\n\tnewHTML := strings.Replace(html, searchStr, newStr, -1)\n\n\terr = ioutil.WriteFile(path, []byte(newHTML), 0)\n\tif isError(err) {\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "dd2c546e543baaac8cbeb1b59e242863", "score": "0.46270725", "text": "func SetBaseURL(bu string) ClientOpt {\n\treturn func(c *Client) error {\n\t\tu, err := url.Parse(bu)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc.BaseURL = u\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "dd2c546e543baaac8cbeb1b59e242863", "score": "0.46270725", "text": "func SetBaseURL(bu string) ClientOpt {\n\treturn func(c *Client) error {\n\t\tu, err := url.Parse(bu)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc.BaseURL = u\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "46162373bb9eb7bbe12853daa4b45a10", "score": "0.46111614", "text": "func (o *Service) SetBaseUrl(v string) {\n\to.BaseUrl = &v\n}", "title": "" }, { "docid": "c1e5dbec1eb993b0f2da9ec5b4e3ffd8", "score": "0.46047553", "text": "func (c client) Base(baseUrl string) Client {\n\tparsed, _ := url.Parse(baseUrl)\n\tc.base = parsed\n\treturn c\n}", "title": "" }, { "docid": "0d90f90fdd83ec339b7c1a9b23eb0d58", "score": "0.46026462", "text": "func SetBaseURL(baseURL string) Opts {\n\treturn func(client *Client) {\n\t\tclient.baseURL = baseURL\n\t}\n}", "title": "" }, { "docid": "b9554c0525587848acc0845dba401a77", "score": "0.4578161", "text": "func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {\n\tcfg.BasePath = basePath\n\treturn cfg\n}", "title": "" }, { "docid": "b9554c0525587848acc0845dba401a77", "score": "0.4578161", "text": "func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {\n\tcfg.BasePath = basePath\n\treturn cfg\n}", "title": "" }, { "docid": "b9554c0525587848acc0845dba401a77", "score": "0.4578161", "text": "func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {\n\tcfg.BasePath = basePath\n\treturn cfg\n}", "title": "" }, { "docid": "b9554c0525587848acc0845dba401a77", "score": "0.4578161", "text": "func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {\n\tcfg.BasePath = basePath\n\treturn cfg\n}", "title": "" }, { "docid": "b9554c0525587848acc0845dba401a77", "score": "0.4578161", "text": "func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {\n\tcfg.BasePath = basePath\n\treturn cfg\n}", "title": "" }, { "docid": "b9554c0525587848acc0845dba401a77", "score": "0.4578161", "text": "func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {\n\tcfg.BasePath = basePath\n\treturn cfg\n}", "title": "" }, { "docid": "b9554c0525587848acc0845dba401a77", "score": "0.4578161", "text": "func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {\n\tcfg.BasePath = basePath\n\treturn cfg\n}", "title": "" }, { "docid": "b9554c0525587848acc0845dba401a77", "score": "0.4578161", "text": "func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {\n\tcfg.BasePath = basePath\n\treturn cfg\n}", "title": "" }, { "docid": "5e8b8961d4cfd7148ed4708e00d03341", "score": "0.45750296", "text": "func removeLeadingSlash(path string) string {\n\tif strings.HasPrefix(path, \"/\") {\n\t\treturn path[1:]\n\t}\n\n\treturn path\n}", "title": "" }, { "docid": "58ddfd1cc0b69d2327ebda666e1a0849", "score": "0.45734718", "text": "func TestPathTrimMiddlewareNoTrimPrefix(t *testing.T) {\n\tassert := assert.New(t)\n\treq, _ := http.NewRequest(\"GET\", \"http://example.com/foo/bar\", nil)\n\tw := httptest.NewRecorder()\n\n\tassert.Nil(NewPathTrimMiddleware(\"/baz\")(w, req))\n\tassert.Equal(req.URL.Path, \"/foo/bar\")\n}", "title": "" }, { "docid": "5a6c1746eb3e47bcfd7fd13638634cae", "score": "0.45713747", "text": "func baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}", "title": "" }, { "docid": "5a6c1746eb3e47bcfd7fd13638634cae", "score": "0.45713747", "text": "func baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}", "title": "" }, { "docid": "5a6c1746eb3e47bcfd7fd13638634cae", "score": "0.45713747", "text": "func baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}", "title": "" }, { "docid": "4fa923e2220c0fec6fc0b788ae914ce3", "score": "0.45634001", "text": "func Base(env Environment, path string) string {\n\tvolumeName := filepath.VolumeName(path)\n\t// Strip trailing slashes.\n\tfor len(path) > 0 && IsPathSeparator(env, path[len(path)-1]) {\n\t\tpath = path[0 : len(path)-1]\n\t}\n\tif len(path) == 0 {\n\t\treturn env.PathSeparator()\n\t}\n\tif volumeName == path {\n\t\treturn path\n\t}\n\t// Throw away volume name\n\tpath = path[len(filepath.VolumeName(path)):]\n\t// Find the last element\n\ti := len(path) - 1\n\tfor i >= 0 && !IsPathSeparator(env, path[i]) {\n\t\ti--\n\t}\n\tif i >= 0 {\n\t\tpath = path[i+1:]\n\t}\n\t// If empty now, it had only slashes.\n\tif len(path) == 0 {\n\t\treturn env.PathSeparator()\n\t}\n\treturn path\n}", "title": "" }, { "docid": "47918f42680b3f4da9b67281d7870b93", "score": "0.4553121", "text": "func (d *Deriver) copyBase() accounts.DerivationPath {\n\tdst := make(accounts.DerivationPath, DerivationPathLength)\n\tcopy(dst, d.base)\n\treturn dst\n}", "title": "" }, { "docid": "21ce6cfd55250eab1246a6ce3c32faee", "score": "0.45418903", "text": "func GetLogBasePath() string {\n\tif DefaultConfig.LoggerConfig != nil {\n\t\treturn DefaultConfig.LoggerConfig.BasePath\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "957d4bfba903ca5ec15a95546db09920", "score": "0.4539716", "text": "func removeTrailingSlash(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.URL.Path != \"/\" {\n\t\t\tr.URL.Path = strings.TrimSuffix(r.URL.Path, \"/\")\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "2e3924dcb748efb9f03ccd496d25c2db", "score": "0.4534498", "text": "func GetBasePath() (string, error) {\n\tex, err := os.Executable()\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"getBasePath\")\n\t}\n\tpath := filepath.Dir(ex)\n\n\treturn path, nil\n}", "title": "" }, { "docid": "e0ad089f3d10ea76c3171980466e7900", "score": "0.4528279", "text": "func sanitizePath(path string) string {\n\tpath = strings.TrimRight(path, \"/\")\n\treturn path\n}", "title": "" }, { "docid": "e7a706487bac27dca5f06575b07b1b2b", "score": "0.4514172", "text": "func (o *Service) GetBaseUrl() string {\n\tif o == nil || o.BaseUrl == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.BaseUrl\n}", "title": "" }, { "docid": "544221fbeb215fa69112cf560fcd265f", "score": "0.451393", "text": "func trimCallerPath(path string) string {\n\t// lovely borrowed from zap\n\t// nb. To make sure we trim the path correctly on Windows too, we\n\t// counter-intuitively need to use '/' and *not* os.PathSeparator here,\n\t// because the path given originates from Go stdlib, specifically\n\t// runtime.Caller() which (as of Mar/17) returns forward slashes even on\n\t// Windows.\n\t//\n\t// See https://github.com/golang/go/issues/3335\n\t// and https://github.com/golang/go/issues/18151\n\t//\n\t// for discussion on the issue on Go side.\n\n\t// Find the last separator.\n\tidx := strings.LastIndexByte(path, '/')\n\tif idx == -1 {\n\t\treturn path\n\t}\n\n\t// Find the penultimate separator.\n\tidx = strings.LastIndexByte(path[:idx], '/')\n\tif idx == -1 {\n\t\treturn path\n\t}\n\n\treturn path[idx+1:]\n}", "title": "" }, { "docid": "7ce08444160b236c7519fb7f4c1cc6a4", "score": "0.45102963", "text": "func LoginPageBoundaryPath() string {\n\treturn loginPageBasePath()\n}", "title": "" }, { "docid": "1240cd2ad743e20be14922b17c0f6639", "score": "0.4509161", "text": "func trimDirectoryPath(path string, trim string) (trimmed_string string) {\n\ttrimmed_string = strings.Replace(path, trim, \"\", -1)\n\t//To avoid double slashes\n\ttrimmed_string = strings.Replace(trimmed_string, \"//\", \"/\", -1)\n\treturn\n}", "title": "" }, { "docid": "4727cdca8f10947436d5e4e03eb7ea23", "score": "0.44979137", "text": "func removeTrailingSlash(path string) string {\n\tif len(path) > 1 && strings.HasSuffix(path, \"/\") {\n\t\tpath = path[:len(path)-1]\n\t}\n\treturn path\n}", "title": "" }, { "docid": "c71d5f37db41df7ca679f1b697030a22", "score": "0.44937548", "text": "func getPathParts(r *http.Request) []string {\n\tvar rawPath = r.URL.Path\n\tvar trimmed = strings.TrimPrefix(rawPath, basePath)\n\t// Make sure there is no preceding slash\n\ttrimmed = strings.TrimPrefix(trimmed, \"/\")\n\treturn strings.Split(trimmed, \"/\")\n}", "title": "" }, { "docid": "39c16d63bb97b3d6d8c9cfbca42106b8", "score": "0.44911838", "text": "func (s Server) CleanPath(ctx context.Context, in *lib.CleanPathRequest) (*lib.CleanPathReply, error) {\n\treturn nil, status.Errorf(codes.Internal, \"CleanPath not support\")\n\t//err := CleanPath(ctx, in.Path)\n\t//if err != nil {\n\t//\tlog.Errorf(\"CleanPath with error: %s\", err.Error())\n\t//\treturn nil, status.Errorf(codes.Internal, \"failed to remove vg: %v\", err)\n\t//}\n\t//log.Infof(\"CleanPath with result Successful\")\n\t//return &lib.CleanPathReply{CommandOutput: \"Successful remove path: \" + in.Path}, nil\n}", "title": "" }, { "docid": "e97ce6b4dcf0520a2e00fd40e3559883", "score": "0.44856796", "text": "func (c *Manager) removeBaseDn(dn string) string {\n\tif c.baseDn == \"\" {\n\t\treturn dn\n\t}\n\n\treturn dn[0 : len(dn)-len(c.baseDn)-1]\n}", "title": "" }, { "docid": "b7ed6115ff45744f1ee895650cc6db4e", "score": "0.44699526", "text": "func trimmedEscapedPath(u *url.URL) string {\n\tu.Path = strings.TrimSpace(u.Path)\n\treturn u.EscapedPath()\n}", "title": "" }, { "docid": "fd3a98256c0f3bfcb239399117a5fd2e", "score": "0.44493726", "text": "func stripscheme(path string) string {\n\tu, err := url.Parse(path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u.Host + u.Path\n}", "title": "" } ]
f0797b84f383472216b95f0e070bd674
Subscribe subscribe to CDP event
[ { "docid": "9a77b02ea9cc1ae4a29f17450fb053e1", "score": "0.0", "text": "func (session *Session) Subscribe(method string, cb func(event *Event)) (unsubscribe func()) {\n\tsession.eventsMutex.Lock()\n\tdefer session.eventsMutex.Unlock()\n\tif _, has := session.listeners[method]; !has {\n\t\tsession.listeners[method] = list.New()\n\t}\n\tp := session.listeners[method].PushBack(cb)\n\treturn func() {\n\t\tsession.eventsMutex.Lock()\n\t\tdefer session.eventsMutex.Unlock()\n\t\tsession.listeners[method].Remove(p)\n\t}\n}", "title": "" } ]
[ { "docid": "fbd21d1ee40946cb50eae826d55abb3e", "score": "0.62871563", "text": "func subscribe(ctx context.Context, clnt *http.HTTP, query string) (<-chan ctypes.ResultEvent, context.CancelFunc) {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tch, err := clnt.Subscribe(ctx, fmt.Sprintf(\"oracle-feeder\"), query)\n\n\tfor err != nil {\n\t\tfmt.Println(\"Could not subscribe to Tendermint event, retrying in 1 second.\")\n\t\ttime.Sleep(1 * time.Second)\n\t\tch, err = clnt.Subscribe(ctx, fmt.Sprintf(\"oracle-feeder\"), query)\n\t}\n\n\treturn ch, cancel\n}", "title": "" }, { "docid": "1df031e0aefe0c33c34b8cfe7696687a", "score": "0.61895835", "text": "func (c *Client) subscribe(event string) error {\n\t// Check connection status\n\tswitch c.Status() {\n\tcase StatusShutdown:\n\t\treturn ErrShutdown\n\tcase StatusReconnecting:\n\t\t// Add to list of pending events\n\t\tc.pendingAdd(pendingEvent{\n\t\t\tevent: event,\n\t\t\taction: actionSubscribe,\n\t\t})\n\t\tlog.Debugf(\"Pending event added: subscribe %v\", event)\n\t\treturn ErrReconnecting\n\t}\n\n\t// Ensure subscription doesn't already exist\n\tif c.isSubscribed(event) {\n\t\treturn ErrDuplicateSub\n\t}\n\n\t// Subscribe\n\t_, err := c.client.Subscribe(event)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"wcDcrdata failed to subscribe to %v: %v\",\n\t\t\tevent, err)\n\t}\n\n\tlog.Debugf(\"Subscribed to %v\", event)\n\n\t// Update subscriptions list\n\tc.subAdd(event)\n\n\treturn nil\n}", "title": "" }, { "docid": "abaabd658b3533b90bf1b0ca81cf00d6", "score": "0.60982347", "text": "func (w *wsDcrdata) subscribe(event string) error {\n\tif w.isShutdown() {\n\t\treturn errShutdown\n\t}\n\n\tif w.isSubscribed(event) {\n\t\treturn errDuplicateSub\n\t}\n\n\t_, err := w.client.Subscribe(event)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"wcDcrdata failed to subscribe to %v: %v\",\n\t\t\tevent, err)\n\t}\n\n\tw.addSub(event)\n\tlog.Debugf(\"wsDcrdata successfully subscribed to %v\", event)\n\treturn nil\n}", "title": "" }, { "docid": "450a92dc3dee1a21a893a0655bdd3915", "score": "0.5847455", "text": "func (c *Call) Subscribe(events chan<- event.Event) {\n\tc.evtsMutex.Lock()\n\tc.evts = append(c.evts, events)\n\tc.evtsMutex.Unlock()\n}", "title": "" }, { "docid": "aa9e080202a53ca9a6a04475dc238828", "score": "0.57575923", "text": "func (g *NetworkGraph) Subscribe(c chan *Event) {\n\tg.eventRegistration <- c\n}", "title": "" }, { "docid": "eb5a674442d6f770070e99b72e1e6f80", "score": "0.5665414", "text": "func (s *swarm) SubscribePeerEvents() (conn chan p2pcrypto.PublicKey, disc chan p2pcrypto.PublicKey) {\n\tin := make(chan p2pcrypto.PublicKey, 30) // todo : the size should be determined after #269\n\tdel := make(chan p2pcrypto.PublicKey, 30)\n\ts.peerLock.Lock()\n\ts.newPeerSub = append(s.newPeerSub, in)\n\ts.delPeerSub = append(s.delPeerSub, del)\n\ts.peerLock.Unlock()\n\t// todo : send the existing peers right away ?\n\treturn in, del\n}", "title": "" }, { "docid": "8ccdeda80f9e2844727ba86269a50fa5", "score": "0.55023676", "text": "func (c *core) subscribeEvents() {\n\tc.events = c.backend.EventMux().Subscribe(\n\t\t// external events\n\t\tistanbul.RequestEvent{},\n\t\tistanbul.MessageEvent{},\n\t\t// internal events\n\t\tbacklogEvent{},\n\t)\n\tc.timeoutSub = c.backend.EventMux().Subscribe(\n\t\ttimeoutEvent{},\n\t)\n\tc.finalCommittedSub = c.backend.EventMux().Subscribe(\n\t\tistanbul.FinalCommittedEvent{},\n\t)\n}", "title": "" }, { "docid": "e8311173eb17e0edd7224bef6efbc512", "score": "0.548367", "text": "func (c *Configuration) Subscribe(s chan struct{}) {\n}", "title": "" }, { "docid": "d50ac1a8e506aff71f0b9f36c508082a", "score": "0.5475851", "text": "func (c *Client) IsolateSubscribe(request *IsolateSubscribeRequest) (response *IsolateSubscribeResponse, err error) {\n if request == nil {\n request = NewIsolateSubscribeRequest()\n }\n response = NewIsolateSubscribeResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "3a37a02efad9fdeed61804a3a7d66211", "score": "0.5432973", "text": "func Subscribe(ctx context.Context, sc pubsub.SubscriberClient) {\r\n\tfmt.Println(\"=============================================\")\r\n\tfmt.Println(\"\\rConsumned: 0\")\r\n\r\n\tsc.Subscritpion.Receive(ctx, func(c context.Context, m *ps.Message) {\r\n\t\tsc.Handler.OnMessage(m)\r\n\t})\r\n}", "title": "" }, { "docid": "e577950870f3035f4af9e322371f1d3e", "score": "0.5425727", "text": "func Subscribe(ch chan<- sdk.Event) {\n\tsubscribers = append(subscribers, ch)\n}", "title": "" }, { "docid": "623416de062339a7213e97625e78b5f4", "score": "0.5411868", "text": "func OnConnect(client MQTT.Client) {\n\tlog.Printf(\"Connected to ClearBlade Platform MQTT broker\")\n\n\t//TODO - If your implementation needs to subscribe to topics, uncomment this block and add your logic here\n\t// log.Printf(\"[DEBUG] Begin Configuring Subscription(s)\")\n\n\t// for mySubscribeChannel, err = deviceClient.Subscribe(adapterTopicRoot+\"/\"+subscribeTopic, messagingQos); err != nil; {\n\t// \tlog.Printf(\"[WARN] Error subscribing to topics: %s\", err.Error())\n\n\t// \t//Wait 30 seconds and retry\n\t// \tlog.Printf(\"[DEBUG] Waiting 30 seconds to retry subscriptions\")\n\t// \ttime.Sleep(time.Duration(30 * time.Second))\n\t// \tmySubscribeChannel, err = deviceClient.Subscribe(adapterTopicRoot+\"/\"+subscribeTopic, messagingQos)\n\t// }\n}", "title": "" }, { "docid": "c838618f7b456ec4849d1eae01b0edb6", "score": "0.53819454", "text": "func (*eventCenter) Subscribe(eventType types.EventType, eventFunc types.EventFunc) types.Subscriber {\n\treturn nil\n}", "title": "" }, { "docid": "90336ab417e1fa4aa40283d521a45f6f", "score": "0.53632087", "text": "func (r *representation) Subscribe(c chan<- map[string]agent.StateEvent) {\n\tr.subc <- c\n}", "title": "" }, { "docid": "462496223497390d3bb4db0b69bd9719", "score": "0.53176147", "text": "func (e *ECS) Subscribe() chan EventContainer {\n\techan := make(chan EventContainer, 10)\n\te.EventReceivers = append(e.EventReceivers, echan)\n\treturn echan\n}", "title": "" }, { "docid": "e899c99efafc23a3eabe224a5bd49207", "score": "0.5311554", "text": "func (m *MeasurementsRunner) OnSubscribe(c *centrifuge.Client, e centrifuge.SubscribeEvent) error {\n\t// anyone can subscribe\n\treturn nil\n}", "title": "" }, { "docid": "6162f88a713119cf449735a1b465799e", "score": "0.5268585", "text": "func (b *Broadcaster) Subscribe(c chan<- string) {\n\tb.subscribec <- c\n}", "title": "" }, { "docid": "b2ae6f6671e864351e57ecec8551b379", "score": "0.5268232", "text": "func (a *Client) Subscribe(deviceID, xCloudID string) error {\n\tvar err error\n\n\t_, ok := a.EventStreams[deviceID]\n\tif !ok {\n\t\tc := sse.NewClient(baseURL + fmt.Sprintf(\"/hmsweb/client/subscribe?token=%s\", a.Token))\n\t\tc.Connection = a.HTTPClient\n\t\tc.Headers = a.getCommonHeaders()\n\n\t\tes := NewEventStream()\n\t\tes.SSEClient = c\n\t\tes.Verbose = a.Verbose\n\n\t\terrCh := make(chan error, 1)\n\n\t\tgo func() {\n\t\t\terrCh <- es.Listen()\n\t\t}()\n\n\tLoop:\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase err = <-errCh:\n\t\t\t\ta.verbose(\"error occurred\", err)\n\t\t\t\tbreak Loop\n\t\t\tdefault:\n\t\t\t\tif es.Connected {\n\t\t\t\t\ta.verbose(\"event stream connected!\")\n\t\t\t\t\ta.EventStreams[deviceID] = es\n\n\t\t\t\t\tbreak Loop\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttime.Sleep(time.Millisecond * 500)\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = a.Register(deviceID, xCloudID)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "6670105260964a794016a409c1a2e67e", "score": "0.5257907", "text": "func (p *Panel) Subscribe() <-chan PanelEvent {\n\teventReader := make(chan PanelEvent)\n\toutput := make(chan PanelEvent, 100)\n\n\tgo func() {\n\t\tfor v := range eventReader {\n\t\t\tselect {\n\t\t\tcase output <- v:\n\t\t\tdefault:\n\t\t\t\t<-output\n\t\t\t\toutput <- v\n\t\t\t}\n\t\t}\n\t}()\n\tp.eventReceivers = append(p.eventReceivers, eventReader)\n\treturn output\n}", "title": "" }, { "docid": "03f261290fa0db49419baa19052484c3", "score": "0.5253373", "text": "func (a *ACLedService) Subscribe(ctx context.Context, eventC chan *Event) error {\n\tif err := a.checkPermission(ctx, ActionRead, CollectionWorkloads, \"\"); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif err := a.checkPermission(ctx, ActionRead, CollectionCertAuthorities, \"\"); err != nil {\n\t\tif err := a.checkPermission(ctx, ActionReadPublic, CollectionCertAuthorities, \"\"); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t}\n\tif err := a.checkPermission(ctx, ActionRead, CollectionTrustedRootBundles, \"\"); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\treturn a.Service.Subscribe(ctx, eventC)\n}", "title": "" }, { "docid": "d6ae56f8387eff0fd77ffc673f46905d", "score": "0.52496964", "text": "func (p *wsStructSpeakerEventDispatcher) OnConnected(c WSSpeaker) {\n}", "title": "" }, { "docid": "2b3dd24e08ed0ddc4d96f4259daabf07", "score": "0.5246265", "text": "func (clt *SMServiceClient) SubscribeDemand(ctx context.Context, dmcb func(*SMServiceClient, *proto.Demand)) error {\n\tch := clt.getChannel()\n\tdmc, err := clt.Client.SubscribeSyncDemand(ctx, ch)\n\t//log.Printf(\"Test3 %v\", ch)\n\t//wg.Done()\n\tif err != nil {\n\t\tlog.Printf(\"SubscribeDemand Error...\\n\")\n\t\treturn err // sender should handle error...\n\t} else {\n\t\tlog.Print(\"Connect Synerex Server!\\n\")\n\t}\n\tfor {\n\t\tvar dm *proto.Demand\n\t\tdm, err = dmc.Recv() // receive Demand\n\t\t//log.Printf(\"\\x1b[30m\\x1b[47m SXUTIL: DEMAND\\x1b[0m\\n\")\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tlog.Print(\"End Demand subscribe OK\")\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"SMServiceClient SubscribeDemand error %v\\n\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\t//\t\tlog.Println(\"Receive SD:\",*dm)\n\t\t// call Callback!\n\t\tdmcb(clt, dm)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "0c18942d77f51ad308ec3350ce3bc92c", "score": "0.52211225", "text": "func (o *RPCOperator) subscribe(addr common.Address) ClientSub {\n\tsub := *newProofSub(o.txReceipts.AddPeer(addr))\n\tif _, ok := o.subs[addr]; !ok {\n\t\to.subs[addr] = new(BufferedClientSubs)\n\t} else {\n\t\tif dp := o.subs[addr].latestDP; dp != nil {\n\t\t\tsub.deposits <- *dp\n\t\t}\n\t\tif bp := o.subs[addr].latestBP; bp != nil {\n\t\t\tsub.balances <- *bp\n\t\t}\n\t}\n\to.subs[addr].subs = append(o.subs[addr].subs, sub)\n\treturn sub\n}", "title": "" }, { "docid": "97a4e9a5e28a2890420b91a71518993d", "score": "0.52153844", "text": "func (p *pubnubPlugin) Subscribe(pn pubnub, listener *pngo.Listener) {\n\tlog.Printf(\"[pubnub] subcribe to %q ...\", pn.Name)\n\n\tconn, ok := p.client.conn[pn.Name]\n\tif !ok {\n\t\treturn\n\t}\n\n\tfor _, sio := range pn.SubscribeSocketIO {\n\t\tname := p.client.channel[pn.Name]\n\t\tlog.Printf(\"[pubnub] SUB %q %q added ...\", sio.Namespace, sio.Event)\n\n\t\tconn.Subscribe().Channels([]string{name}).Execute()\n\t\tp.client.conn[pn.Name].AddListener(listener)\n\n\t\t// setup the callback\n\t\tp.On[fmt.Sprintf(\"%s+%s+%s\", name, sio.Namespace, sio.Event)] = func(sid, ns string, _ interface{}) {\n\t\t\tlog.Printf(\"[pubnub] callback message %s %s %s ...\", name, sio.Namespace, sio.Event)\n\n\t\t\tif len(sio.Emit) > 0 || len(sio.Broadcast) > 0 {\n\t\t\t\tif len(sio.Delay) > 0 {\n\t\t\t\t\tlog.Printf(\"[pubnub] callback delay response for %s ...\", sio.Delay)\n\t\t\t\t\ttime.Sleep(delay(sio.Delay))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, pub := range sio.Emit {\n\t\t\t\tif pub.Data == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tdataVal, dia := pub.Data.Expr.Value(&bodyEvalCtx)\n\t\t\t\tif dia.HasErrors() {\n\t\t\t\t\tfor _, err := range dia.Errs() {\n\t\t\t\t\t\tlog.Printf(\"[pubnub] callback failed to emit: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tmsg := map[string]interface{}{\n\t\t\t\t\t\"name\": sid,\n\t\t\t\t\t\"ns\": ns,\n\t\t\t\t\t\"data\": toObject(dataVal.AsString()),\n\t\t\t\t}\n\n\t\t\t\tlog.Println(\"[pubnub] callback emit ...\")\n\t\t\t\t_, status, err := conn.Publish().Channel(pub.Channel).Message(msg).Execute() // TODO(njones):look for errors\n\t\t\t\tlog.Printf(\"[pubnub] broadcast status: %d\", status.StatusCode)\n\t\t\t\tlog.OnErr(err).Printf(\"[pubnub] error: %v\", err)\n\t\t\t}\n\n\t\t\tfor _, pub := range sio.Broadcast {\n\t\t\t\tif pub.Data == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tdataVal, dia := pub.Data.Expr.Value(&bodyEvalCtx)\n\t\t\t\tif dia.HasErrors() {\n\t\t\t\t\tfor _, err := range dia.Errs() {\n\t\t\t\t\t\tlog.Printf(\"[pubnub] callback failed to broadcast: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tmsg := map[string]interface{}{\n\t\t\t\t\t\"name\": sid,\n\t\t\t\t\t\"ns\": ns,\n\t\t\t\t\t\"data\": toObject(dataVal.AsString()),\n\t\t\t\t}\n\n\t\t\t\tlog.Println(\"[pubnub] callback broadcast ...\")\n\t\t\t\tconn.Publish().Channel(pub.Channel).Message(msg).Execute() // TODO(njones):look for errors\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "52622f6d92ac137f7615600565ca4b57", "score": "0.51898915", "text": "func Subscribe(worker *rpc2.Client) {\n\tlog.Println(\"Subscribing new worker on connect...\")\n\tworkers.subscribeWorker(worker)\n\tshowWorkers()\n}", "title": "" }, { "docid": "c781fa5804498309d3bf99b1cd5a7408", "score": "0.51878405", "text": "func (c *InterfaceStateUpdater) subscribeVPPNotifications(ctx context.Context) error {\n\tctx, c.cancelIfEvents = context.WithCancel(ctx)\n\tif err := c.ifHandler.WatchInterfaceEvents(ctx, c.ifEvents); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f1faeb1a349882382686ad6c6d70e26b", "score": "0.51875937", "text": "func (e *engine) Subscribe(c chan *Event) {\n\te.bus.subscribe(c)\n}", "title": "" }, { "docid": "a85560f6f6c28b6c437e8a25fa658c82", "score": "0.5177396", "text": "func (s *stream) subscribe(ch chan<- *Event) interface{} {\n\tresponse := make(chan interface{}, 1)\n\ts.cmd <- command{\n\t\top: subscribe,\n\t\tsink: ch,\n\t\tresponse: response,\n\t}\n\t// stream.run goroutine will write current last seen event ID to this\n\t// channel exactly once and close it\n\treturn <-response\n}", "title": "" }, { "docid": "8ca4fe36914d1857e6f3d58f1a2dc203", "score": "0.5174448", "text": "func (dazeus *DaZeus) Subscribe(event eventType, handler Handler) (ListenerHandle, error) {\n\tldata := listener{event, \"\", handler}\n\n\tdazeus.logger.Printf(\"Requesting core subscription for events of type '%s'\", event)\n\t_, err := writeForSuccessResponse(dazeus, map[string]interface{}{\n\t\t\"do\": \"subscribe\",\n\t\t\"params\": []string{string(event)},\n\t})\n\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\thandle := dazeus.lastHandle\n\tdazeus.lastHandle++\n\tdazeus.listeners[handle] = ldata\n\n\treturn handle, nil\n}", "title": "" }, { "docid": "7fd2d9d65326c27657c0632d8cd764b2", "score": "0.51720023", "text": "func (c *Client) Subscribe(path Path, callback CallbackFunc) (func() error, error) {\n\t_, err := c.sendCommand(feedbackSusbscribe, path.toSubQuery())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.cblock.Lock()\n\tdefer c.cblock.Unlock()\n\tc.callbacks[path] = callback\n\n\treturn c.cancelFunc(path), nil\n}", "title": "" }, { "docid": "169c6f68381ebfdf13f8105f88aa1815", "score": "0.5163253", "text": "func (skcga *SaramaKafkaConsumserGroupAdapter) Subscribe() {\n\tgo func() {\n\tPOLL:\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-skcga.closeChan:\n\t\t\t\tbreak POLL\n\t\t\tdefault:\n\t\t\t\terr := skcga.config.ConsumerGroupClient.Consume(context.Background(), skcga.config.Topics, skcga.config.ConsumerGroupHandler)\n\t\t\t\tif err != nil {\n\t\t\t\t\tskcga.logger.Errorf(\"[Sarama] %s\", err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn\n}", "title": "" }, { "docid": "21ed8f90cec36998ff7be6ac2f95da77", "score": "0.5150164", "text": "func onConnect() {\n\tfmt.Println(\"Connected\")\n\terr := ticker.Subscribe([]uint32{112129})\n\tif err != nil {\n\t\tfmt.Println(\"err: \", err)\n\t}\n\n\tticker.SetMode(kiteticker.ModeFull, []uint32{112129})\n}", "title": "" }, { "docid": "c24742562c5896a852edd0bf97de9816", "score": "0.5147257", "text": "func cgoOnSignalingStateChange(p int, s SignalingState) {\n\tINFO.Println(\"fired OnSignalingStateChange: \", p, s)\n\tpc := PCMap.Get(p).(*PeerConnection)\n\tif nil != pc.OnSignalingStateChange {\n\t\tpc.OnSignalingStateChange(s)\n\t}\n}", "title": "" }, { "docid": "0468caae87551bb8b651d9b45a8be79a", "score": "0.5144508", "text": "func (t *MyTokenCallerSession) EventTransferSubscribe(opts *bind.WatchOpts, fromBlock rpc.BlockNumber,\n\ttoBlock rpc.BlockNumber) (<-chan types.Log, ethereum.Subscription, error) {\n\treturn t.Contract.EventTransferSubscribe(&t.WatchOpts, fromBlock, toBlock)\n}", "title": "" }, { "docid": "7c56ef7d53f10d232c1fa04c7871df9a", "score": "0.51443857", "text": "func (backend *PushBackEnd) Subscribe(service, sub string, dp *push.DeliveryPoint) (*push.PushServiceProvider, error) {\n\treturn backend.db.AddDeliveryPointToService(service, sub, dp)\n}", "title": "" }, { "docid": "c8b080a760903156698d387954224459", "score": "0.51434785", "text": "func (c *SSEClient) Subscribe(events chan<- *Event, callback func(*Event) error, filterEvents ...string) error {\n\tif events == nil && callback == nil {\n\t\treturn ErrInvalidSubscribeArgs\n\t}\n\n\tvs := url.Values{}\n\tfor _, evt := range filterEvents {\n\t\tvs.Add(\"event\", evt)\n\t}\n\n\treq, err := http.NewRequest(\"GET\", c.url+\"?\"+vs.Encode(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif c.Username != \"\" || c.Password != \"\" {\n\t\treq.SetBasicAuth(c.Username, c.Password)\n\t}\n\n\treq.Header.Set(\"Accept\", \"text/event-stream\")\n\treq.Header.Set(\"Connection\", \"keep-alive\")\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\treader := bufio.NewReader(resp.Body)\n\n\tvar event *Event\n\tfor {\n\t\t// Read each new line and process the type of event\n\t\tline, err := reader.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch {\n\t\tcase bytes.HasPrefix(line, headerEvent):\n\t\t\tif event == nil {\n\t\t\t\tevent = &Event{}\n\t\t\t}\n\t\t\t// Remove header\n\t\t\teventType := bytes.Replace(line, headerEvent, []byte(\"\"), 1)\n\t\t\tevent.Event = string(eventType[1 : len(eventType)-1]) // Remove initial space and newline\n\t\tcase bytes.HasPrefix(line, headerData):\n\t\t\tif event == nil {\n\t\t\t\tevent = &Event{}\n\t\t\t}\n\t\t\t// Remove header\n\t\t\tdata := bytes.Replace(line, headerData, []byte(\"\"), 1)\n\t\t\tevent.Data = data[1 : len(data)-1] // Remove initial space and newline\n\t\tdefault:\n\t\t\tif event != nil && event.Event != \"heartbeat\" {\n\t\t\t\tif events != nil {\n\t\t\t\t\tevents <- event\n\t\t\t\t} else {\n\t\t\t\t\tif err := callback(event); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tevent = nil\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ce9cc1f2381abcb1ea0270c95434927e", "score": "0.5139655", "text": "func (c *client) subscribe(r string) {\n\th := Server(r)\n\tc.subscriptions = append(c.subscriptions, r)\n\th.subscribe(c)\n}", "title": "" }, { "docid": "fd845db5fd69cbfcd73300cb2cda4e53", "score": "0.5121398", "text": "func (c *cell) subscribe(sc *cluster) {\n\tc.subscribers.subscribe(sc)\n}", "title": "" }, { "docid": "08def9ac4f6d9ac3b2b4c926d594f510", "score": "0.51193404", "text": "func (cpc *ChatPlugClient) SubscribeToNewMessages() {\n\tcpc.msgSubID = cpc.GQLClient.Subscribe(messageReceivedSubscription, map[string]interface{}{})\n}", "title": "" }, { "docid": "4d1cf4fb91997a45a04cc1d46ca19053", "score": "0.51186633", "text": "func (pool *SnailPool) SubscribeNewFruitEvent(ch chan<- types.NewFruitsEvent) event.Subscription {\n\treturn pool.scope.Track(pool.fruitFeed.Subscribe(ch))\n}", "title": "" }, { "docid": "9628d4def17c9f04f14633d9405d8e4e", "score": "0.5112023", "text": "func ConnectCDP(ctx context.Context, url string) (conn *rpcc.Conn, c *cdp.Client, err error) {\n\t// Use the DevTools HTTP/JSON API to manage targets (e.g. pages, webworkers).\n\tdevt := devtool.New(\"http://127.0.0.1:9222\")\n\tpt, err := devt.Get(ctx, devtool.Page)\n\tif err != nil {\n\t\tpt, err = devt.Create(ctx)\n\t\tif err != nil {\n\t\t\treturn conn, c, err\n\t\t}\n\t}\n\n\t// Initiate a new RPC connection to the Chrome DevTools Protocol target.\n\tconn, err = rpcc.DialContext(ctx, pt.WebSocketDebuggerURL)\n\tif err != nil {\n\t\treturn conn, c, err\n\t}\n\tc = cdp.NewClient(conn)\n\n\t// Open a DOMContentEventFired client to buffer this event.\n\tdomContent, err := c.Page.DOMContentEventFired(ctx)\n\tif err != nil {\n\t\treturn conn, c, err\n\t}\n\n\t// Enable events on the Page domain, it's often preferable to create\n\t// event clients before enabling events so that we don't miss any.\n\tif err = c.Page.Enable(ctx); err != nil {\n\t\treturn conn, c, err\n\t}\n\n\t// Enable events on the Runtime domain (JavaScript)\n\tif err = c.Runtime.Enable(ctx); err != nil {\n\t\treturn conn, c, err\n\t}\n\n\t// Create the Navigate arguments with the optional Referrer field set.\n\tnavArgs := page.NewNavigateArgs(url)\n\tnav, err := c.Page.Navigate(ctx, navArgs)\n\tif err != nil {\n\t\treturn conn, c, err\n\t}\n\n\t// Wait until we have a DOMContentEventFired event.\n\tif _, err = domContent.Recv(); err != nil {\n\t\treturn conn, c, err\n\t}\n\n\tlogger.Get().Debugf(\"Page loaded (%s) with frame ID: %s\\n\", url, nav.FrameID)\n\n\terr = domContent.Close()\n\treturn conn, c, err\n}", "title": "" }, { "docid": "a6024004a76d7f0e0742c3ab7adf6fc0", "score": "0.5104253", "text": "func (s *CryptoServiceServer) Subscribe(in *pb.ReadReq, stream pb.CryptoService_SubscribeServer) error {\n\tlog.Printf(\"Received Subscribe request for %v\", in.GetSymbol())\n\n\t// Load collection\n\tcollection, err := pkg.GetMongoCollection()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set pipeline filter\n\tpipeline := mongo.Pipeline{\n\t\tbson.D{{\n\t\t\tKey: \"$match\",\n\t\t\tValue: bson.D{{Key: \"fullDocument.symbol\", Value: in.GetSymbol()}}},\n\t\t},\n\t}\n\tstreamOptions := options.ChangeStream().SetFullDocument(options.UpdateLookup)\n\n\t// Create a change stream\n\tmstream, err := collection.Watch(context.TODO(), pipeline, streamOptions)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// Wait for events and stream to client\n\tvar event ChangeEvent\n\tfor mstream.Next(context.TODO()) {\n\t\tif err := mstream.Decode(&event); err != nil {\n\t\t\tlog.Fatalf(\"Error decoding: %v\", err)\n\t\t}\n\t\tcrypto := event.FullDocument\n\t\tstream.Send(&pb.Crypto{\n\t\t\tSymbol: crypto.Symbol,\n\t\t\tName: crypto.Name,\n\t\t\tUpvotes: crypto.Upvotes,\n\t\t\tDownvotes: crypto.Downvotes,\n\t\t})\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "813e21687c2d091a6cca6a0614050e61", "score": "0.5080552", "text": "func (pool *SnailPool) SubscribeNewFruitEvent(ch chan<- snailchain.NewFruitsEvent) event.Subscription {\n\treturn pool.scope.Track(pool.fruitFeed.Subscribe(ch))\n}", "title": "" }, { "docid": "d1eab7a460a749ce7ef718083d90dfbd", "score": "0.5045843", "text": "func (c *gcmClient) onCCSMessage(cm CCSMessage) error {\n\tswitch cm.MessageType {\n\tcase CCSControl:\n\t\t// Handle connection drainging request.\n\t\tif cm.ControlType == CCSDraining {\n\t\t\tlog.WithField(\"xmpp client ref\", c.xmppClient.ID()).\n\t\t\t\tWarn(\"gcm xmpp connection draining requested\")\n\t\t\t// Server should close the current connection.\n\t\t\tc.Lock()\n\t\t\tcerr := c.cerr\n\t\t\tc.Unlock()\n\t\t\tcerr <- errors.New(\"connection draining\")\n\t\t}\n\t\t// Don't bubble up control messages.\n\t\treturn nil\n\t}\n\t// Bubble up everything else.\n\treturn c.mh(cm)\n}", "title": "" }, { "docid": "7cfa6effd144ec780dcb463890ceaec3", "score": "0.50432473", "text": "func (c *Foo) Subscribe() *app.EventSubscriber {\n\treturn app.NewEventSubscriber()\n}", "title": "" }, { "docid": "eb2f4f8a82ad0bdaa8e83825a75ee51e", "score": "0.50431037", "text": "func PCREvent(rw io.ReadWriter, pcr tpmutil.Handle, eventData []byte) error {\n\tCmd, err := encodePCREvent(pcr, eventData)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = runCommand(rw, TagSessions, CmdPCREvent, tpmutil.RawBytes(Cmd))\n\treturn err\n}", "title": "" }, { "docid": "3f2affce95fa128cdb2a7a038369842b", "score": "0.5025971", "text": "func (c *Client) Events(ctx context.Context, ef ...string) (eventsapi.Events_SubscribeClient, error) {\n\twrapperCli, err := c.Get(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, ErrGetCtrdClient.Error())\n\t}\n\n\teventsClient := wrapperCli.client.EventService()\n\treturn eventsClient.Subscribe(ctx, &eventsapi.SubscribeRequest{\n\t\tFilters: ef,\n\t})\n}", "title": "" }, { "docid": "7a4a3cac16e2069e74047b2c3c848bb0", "score": "0.50199574", "text": "func (s *Server) accountConnectEvent(c *client) {\n\ts.mu.Lock()\n\tif !s.eventsEnabled() {\n\t\ts.mu.Unlock()\n\t\treturn\n\t}\n\tacc := s.sys.account\n\tsc := s.sys.client\n\ts.mu.Unlock()\n\n\tsubj := fmt.Sprintf(connectEventSubj, c.acc.Name)\n\tr := acc.sl.Match(subj)\n\tif noOutSideInterest(sc, r) {\n\t\treturn\n\t}\n\n\tc.mu.Lock()\n\tm := ConnectEventMsg{\n\t\tClient: ClientInfo{\n\t\t\tStart: c.start,\n\t\t\tHost: c.host,\n\t\t\tID: c.cid,\n\t\t\tAccount: c.acc.Name,\n\t\t\tUser: nameForClient(c),\n\t\t\tName: c.opts.Name,\n\t\t\tLang: c.opts.Lang,\n\t\t\tVersion: c.opts.Version,\n\t\t},\n\t}\n\tc.mu.Unlock()\n\n\ts.mu.Lock()\n\ts.sendInternalMsg(r, subj, \"\", &m.Server, &m)\n\ts.mu.Unlock()\n}", "title": "" }, { "docid": "60a071ab783b30c70128e05341eee13c", "score": "0.50174576", "text": "func (t *MyTokenSession) EventTransferSubscribe(fromBlock rpc.BlockNumber,\n\ttoBlock rpc.BlockNumber) (<-chan types.Log, ethereum.Subscription, error) {\n\treturn t.Contract.EventTransferSubscribe(&t.WatchOpts, fromBlock, toBlock)\n}", "title": "" }, { "docid": "97ff3d13c4b77e880117d44be3c2f5a2", "score": "0.5005609", "text": "func (r *etcdV3Registry) DoSubscribe(svc *common.URL) (registry.Listener, error) {\n\tr.listenerLock.RLock()\n\tconfigListener := r.configListener\n\tr.listenerLock.RUnlock()\n\tif r.listener == nil {\n\t\tr.cltLock.Lock()\n\t\tclient := r.client\n\t\tr.cltLock.Unlock()\n\t\tif client == nil {\n\t\t\treturn nil, perrors.New(\"etcd client broken\")\n\t\t}\n\t\tr.listenerLock.Lock()\n\t\tr.listener = etcdv3.NewEventListener(r.client) // new client & listener\n\t\tr.listenerLock.Unlock()\n\t}\n\n\t// register the svc to dataListener\n\tr.dataListener.AddInterestedURL(svc)\n\tgo r.listener.ListenServiceEvent(fmt.Sprintf(\"/dubbo/%s/\"+constant.DefaultCategory, svc.Service()), r.dataListener)\n\n\treturn configListener, nil\n}", "title": "" }, { "docid": "2ef1154927324b098f9457dc70ad2e6d", "score": "0.5003466", "text": "func Subscribe(nc *nats.Conn, mc mqtt.Mqtt, svc twins.Service, logger log.Logger) {\n\tps := pubsub{\n\t\tnatsClient: nc,\n\t\tmqttClient: mc,\n\t\tlogger: logger,\n\t\tsvc: svc,\n\t}\n\n\tps.natsClient.QueueSubscribe(input, queue, ps.handleMsg)\n}", "title": "" }, { "docid": "9f013303b6c526d2117684b64483ac20", "score": "0.50025004", "text": "func (_m *clusterAddonsCfgService) Subscribe(listener resource.Listener) {\n\t_m.Called(listener)\n}", "title": "" }, { "docid": "50d552e4f5e798a7b2b835b7710ad7ba", "score": "0.500239", "text": "func (w *wsDcrdata) addSub(event string) {\n\tw.Lock()\n\tdefer w.Unlock()\n\n\tw.subscriptions[event] = struct{}{}\n}", "title": "" }, { "docid": "97679cf963eb6d265aada7166a1598c6", "score": "0.50005025", "text": "func (t *Topic) Subscribe(cb *func(interface{})) {\n\tt.subs = append(t.subs, cb)\n}", "title": "" }, { "docid": "0b88fbf967d28b6144661e1ab4d1d8ee", "score": "0.49967188", "text": "func (vmc *VMCollector) Subscribe(op trace.Operation, moref types.ManagedObjectReference, id string) (chan interface{}, error) {\n\tvmc.mu.Lock()\n\tdefer vmc.mu.Unlock()\n\n\t// used at end of func\n\tsubscriptionCount := len(vmc.subs)\n\n\t// do we already have this subscription?\n\t_, exists := vmc.subs[moref]\n\tif !exists {\n\t\top.Debugf(\"Creating new subscription(%s)\", id)\n\t\tsub, err := newVMSubscription(op, vmc.session, moref, id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvmc.subs[moref] = sub\n\t}\n\n\t// get a subscriber channel\n\tch := vmc.subs[moref].Channel()\n\n\t// This is first subscription so start collection\n\tif subscriptionCount == 0 {\n\t\tvmc.Start()\n\t}\n\n\treturn ch, nil\n}", "title": "" }, { "docid": "b63b28d999e54452f28f9586e250d7af", "score": "0.49946025", "text": "func Subscribe(eventTypes ...UdevEventType) *Subscription {\n\tif len(eventTypes) == 0 {\n\t\teventTypes = []UdevEventType{EventTypeAdd, EventTypeRemove, EventTypeChange}\n\t}\n\tsubscription := Subscription{\n\t\ttargetChannel: make(chan UdevEvent),\n\t\tsubscribedTypes: eventTypes,\n\t}\n\tsubscriptions = append(subscriptions, &subscription)\n\treturn &subscription\n}", "title": "" }, { "docid": "e81ed12c5c8a86adf283e3d654675527", "score": "0.49883822", "text": "func (s *Server) EventsSubscribe(in context.Context, req *pb.SubscribeRequest) (res *pb.Subscribe, err error) {\n\treturn nil, status.Errorf(codes.Unimplemented, \"method EventsSubscribe not implemented\")\n}", "title": "" }, { "docid": "a5ddb9725099535a3a809c54c5dcf221", "score": "0.4984608", "text": "func (n *Network) ctcp() {\n\texch := make(chan bool, 0)\n\terr := n.Shutdown.Reg(exch)\n\tif err != nil {\n\t\treturn\n\t}\n\tch := make(chan *IrcMessage)\n\tn.Listen.RegListener(\"PRIVMSG\", \"ctcp\", ch)\n\tdefer n.Listen.DelListener(\"PRIVMSG\", \"ctcp\")\n\tfor !closed(ch) {\n\t\tvar p *IrcMessage\n\t\tselect {\n\t\tcase p = <-ch:\n\t\tcase exit := <-exch:\n\t\t\tif exit {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif i := strings.LastIndex(p.Params[1], \"\\x01\"); i > -1 { //FIXME: DCC?\n\t\t\tp.Params[1] = strings.Trim(p.Params[1], \"\\x01\")\n\t\t\tctype := p.Params[1]\n\t\t\tdst := strings.Split(p.Prefix, \"!\", 2)[0]\n\t\t\tswitch {\n\t\t\tcase ctype == \"VERSION\":\n\t\t\t\tn.Notice(dst, fmt.Sprintf(\"\\x01VERSION %s\\x01\", IRCVERSION))\n\t\t\tcase ctype == \"USERINFO\":\n\t\t\t\tn.Notice(dst, fmt.Sprintf(\"\\x01USERINFO %s\\x01\", n.user))\n\t\t\tcase ctype == \"CLIENTINFO\":\n\t\t\t\tn.Notice(dst, \"\\x01CLIENTINFO PING VERSION TIME USERINFO CLIENTINFO FINGER SOURCE\\x01\")\n\t\t\tcase ctype[0:4] == \"PING\":\n\t\t\t\tparams := strings.Split(p.Params[1], \" \", -1)\n\t\t\t\tif len(params) < 2 {\n\t\t\t\t\tn.l.Println(\"Illegal ctcp ping received: No arguments\", p)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tn.Notice(dst, fmt.Sprintf(\"\\x01PING %s\\x01\", strings.Join(params[1:], \" \")))\n\t\t\tcase ctype == \"TIME\":\n\t\t\t\tn.Notice(dst, fmt.Sprintf(\"\\x01TIME %s\\x01\", time.LocalTime().String()))\n\t\t\t\t//TODO: ACTION, PAGE?\n\t\t\tcase ctype == \"FINGER\":\n\t\t\t\tn.Notice(dst, fmt.Sprintln(\"\\x01FINGER like i'm gonna tell you\\x01\"))\n\t\t\tcase ctype == \"SOURCE\":\n\t\t\t\tn.Notice(dst, fmt.Sprintln(\"\\x01SOURCE https://github.com/soul9/go-irc-chans\\x01\"))\n\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1fa5e602703ccbd7f89b97cd8ddc61aa", "score": "0.49787298", "text": "func (c *ClientEventHub) Subscribe(h SubscribeHandler) {\n\tc.subscribeHandler = h\n}", "title": "" }, { "docid": "f620b3a0248bda5d72116840fd2077d6", "score": "0.49746504", "text": "func (b *broker) Subscribe() chan serverpb.Event {\n\tevents := make(chan serverpb.Event, eventBufSize)\n\tb.subscribe <- events\n\treturn events\n}", "title": "" }, { "docid": "32d274735b2cac11783dcdcf752c4ab9", "score": "0.49637148", "text": "func (mb *MessagingBridge) onConnect(c *mqtt.Client) {\n\n\tlog.Print(\"Connected to message broker, subscribing to topics...\\n\")\n\n\tfor _, t := range mb.topics {\n\t\ttoken := c.Subscribe(t, mqttQos, nil)\n\t\ttoken.Wait()\n\t\tif token.Error() != nil {\n\t\t\tlog.Printf(\"Could not subscribe to '%s': %s\", t, token.Error())\n\t\t}\n\t}\n\tlog.Print(\"Finished subscribing to topics\\n\")\n\n}", "title": "" }, { "docid": "cab0921ae530d32e2454d48aab223fd4", "score": "0.49610814", "text": "func (l *listener) subscribe(lname string) chan interface{} {\n\tch := make(chan interface{})\n\tl.subscribers[lname] = append(l.subscribers[lname], ch)\n\treturn ch\n}", "title": "" }, { "docid": "09e39e7bfde276b508458167899c790a", "score": "0.4959686", "text": "func (t *MyTokenSession) EventIntArgSubscribe(fromBlock rpc.BlockNumber,\n\ttoBlock rpc.BlockNumber) (<-chan types.Log, ethereum.Subscription, error) {\n\treturn t.Contract.EventIntArgSubscribe(&t.WatchOpts, fromBlock, toBlock)\n}", "title": "" }, { "docid": "fd68b87d192fbfd4f8571a0deb48d663", "score": "0.49444982", "text": "func (t *MyTokenCallerSession) EventIntArgSubscribe(opts *bind.WatchOpts, fromBlock rpc.BlockNumber,\n\ttoBlock rpc.BlockNumber) (<-chan types.Log, ethereum.Subscription, error) {\n\treturn t.Contract.EventIntArgSubscribe(&t.WatchOpts, fromBlock, toBlock)\n}", "title": "" }, { "docid": "babcb3f91f9820536bd149d93ed58eab", "score": "0.49439263", "text": "func (s *KMSOptInRequired) eventSubscribeToShardEventStream() {}", "title": "" }, { "docid": "20d4365c638c5e0810f73cced1ae3439", "score": "0.49438265", "text": "func (c *Client) subAdd(event string) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tc.subscriptions[event] = struct{}{}\n}", "title": "" }, { "docid": "c017a21ffa1163b85d2a41545851aa86", "score": "0.4940004", "text": "func (_m *clusterAssetSvc) Subscribe(listener resource.Listener) {\n}", "title": "" }, { "docid": "07faea1969961b2dae526bdb76abf4de", "score": "0.49395028", "text": "func (m *MonLeaderDetector) Subscribe() <-chan int {\n\t// TODO(student): Implement\n\treturn nil\n}", "title": "" }, { "docid": "a95942bd97aa41934cebab5d2ad66d1c", "score": "0.49389857", "text": "func subscribe() {\n\tfor {\n\t\tgetTwinResult := DeviceETPrefix + deviceID + TwinETGetResultSuffix\n\t\tToken_client = Client.Subscribe(getTwinResult, 0, OnSubMessageReceived)\n\t\tif Token_client.Wait() && Token_client.Error() != nil {\n\t\t\tglog.Error(\"subscribe() Error in device twin result get is \", Token_client.Error())\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t\tif deviceTwinResult.Twin != nil {\n\t\t\twg.Done()\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c859185365d5fd7b3114a53742053006", "score": "0.49329394", "text": "func (c *Client) OnSubscribe(h SubscribeHandler) {\n\tc.eventHub.subscribeHandler = h\n}", "title": "" }, { "docid": "a0c671c328a41cd7de6156e96a4666c7", "score": "0.4930259", "text": "func newPacketSubscribe(properties SubscribeProperties, payload SubscribePayload) *packet {\n\treturn &packet{ptype: ptypeSubscribe, pflags: pflagsSubscribe, properties: properties, payload: payload.Encode()}\n}", "title": "" }, { "docid": "34969fd07b073c75d98a6977d821a59b", "score": "0.49271506", "text": "func (c *Config) Subscribe(subscriber discovery.Subscriber) {\n\tif c.dcy != nil {\n\t\tc.dcy.Subscribe(subscriber)\n\t}\n}", "title": "" }, { "docid": "3e6db8c7cfd9e60be074b8aac8230c18", "score": "0.49232858", "text": "func (c *Client) Subscribe(topicURI string, f EventHandler) error {\n\tif debug {\n\t\tlog.Print(\"turnpike: sending subscribe\")\n\t}\n\tmsg, err := createSubscribe(topicURI)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"turnpike: %s\", err)\n\t}\n\tc.messages <- string(msg)\n\tif f != nil {\n\t\tc.eventHandlers[topicURI] = f\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c062fd4566ac7f570e7c70f7bd0b66b3", "score": "0.49200472", "text": "func (t *MyTokenCaller) EventTransferSubscribe(opts *bind.WatchOpts, fromBlock rpc.BlockNumber,\n\ttoBlock rpc.BlockNumber) (<-chan types.Log, ethereum.Subscription, error) {\n\treturn t.EventSubscribe(opts, fromBlock, toBlock, \"Transfer\")\n}", "title": "" }, { "docid": "9cfb4f81fd82ff029b0c74279b8de4cc", "score": "0.49135637", "text": "func (api *Instance) Subscribe(pattern string, function Callback) error {\n\tkey := api.prefix + pattern\n\tfunctionQueue := api.callbacks[key]\n\tif functionQueue == nil {\n\t\tfunctionQueue = list.New()\n\t\tapi.callbacks[key] = functionQueue\n\t}\n\t_ = functionQueue.PushBack(function)\n\tsubscribe, err := erlang.TermToBinary([]interface{}{erlang.OtpErlangAtom(\"subscribe\"), pattern}, -1)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = api.send(subscribe)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4c6624fa922c0ec4cd0b8deb4cbb6499", "score": "0.49121055", "text": "func (s *Subscription) subscribe() {\n\ts.subLock.Add(1)\n\ts.observable.register <- s.channel\n\ts.SubscribeAt = time.Now()\n\ts.subLock.Wait()\n}", "title": "" }, { "docid": "e11c1bb6980e73b92257a94dddc085f6", "score": "0.49101675", "text": "func (c *Client) AddressSubscribe(address string) error {\n\tlog.Tracef(\"AddressSubscribe: %v\", address)\n\n\treturn c.subscribe(eventAddress + address)\n}", "title": "" }, { "docid": "8ea3e5523f39793fda865fa227dbc919", "score": "0.49069288", "text": "func (e *stubWindowsEvent) Subscribe(_ string, _ map[string]string) error {\n\treturn nil\n}", "title": "" }, { "docid": "bce98784bd7f867d8550adbbf7c94706", "score": "0.49065092", "text": "func (_Ppvevent *PpveventTransactor) Subscribe(opts *bind.TransactOpts, invoiceId [32]byte, signature []byte) (*types.Transaction, error) {\n\treturn _Ppvevent.contract.Transact(opts, \"subscribe\", invoiceId, signature)\n}", "title": "" }, { "docid": "de682de8cbb50d0856465cd9402334f1", "score": "0.49049464", "text": "func (c *C) OnConnectExternal(callback func(port *js.Object)) {\n\tc.runtime.Get(\"onConnectExternal\").Call(\"addListener\", callback)\n}", "title": "" }, { "docid": "fa61a2562cf5cb794eedd655cbda9140", "score": "0.49020383", "text": "func (server *Server) rpcCallback(subscribeArg *schema.SubscribeArg) func(conn *connectors.Connectors) {\n\treturn func(conn *connectors.Connectors) {\n\t\tclient, connErr := conn.DialHttpPath(subscribeArg.ClientAddr, subscribeArg.ClientPath)\n\t\tif connErr != nil {\n\t\t\tconn.Error(\"rpcCallback client connection: %v\", connErr)\n\t\t\tdelete(server.Subscribers, subscribeArg.Topic)\n\t\t\tconn.Info(\"rpcCallback subscriber removed: %s\", subscribeArg.Topic)\n\t\t\t// call the Handler to cleanup\n\t\t\thnd, _ := server.eventBus.Handler(subscribeArg.ClientPath, subscribeArg.Topic)\n\t\t\tconn.Info(\"rpcCallback subscriber remaining: %v\", server.Subscribers)\n\t\t\tconn.Info(\"rpcCallback handler remaining: %v\", hnd)\n\t\t\treturn\n\t\t}\n\t\tdefer client.Connector.Close()\n\t\tclientArg := new(schema.ClientArg)\n\t\tclientArg.Topic = subscribeArg.Topic\n\t\tclientArg.Args = conn\n\t\tvar reply bool\n\t\terr := client.Connector.Call(subscribeArg.ServiceMethod, clientArg, &reply)\n\t\tif err != nil {\n\t\t\tconn.Error(\"rcpCallback call : %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e045b691c1c6856d8bb4f92c212b04d7", "score": "0.48956805", "text": "func onEvent(event signal.Event, typ endpointType) {\n\tlog.Debugf(\"EP handling event %s\", event)\n\tmuxEventCh <- event\n\tregisterEntityEndpointType(event.EntityID(), typ)\n\tlog.Debugf(\"EP handled event %s\", event)\n}", "title": "" }, { "docid": "808f610d0dc4f45eca71549cb6efdf70", "score": "0.48905239", "text": "func (c *client) SubscribeOn(topic types.Path) (<-chan *event.Event, error) {\n\n\topts := broker.Options{SocketDir: filepath.Dir(c.socketPath), Path: rpc.URLEventsPrefix}\n\turl := fmt.Sprintf(\"unix://%s\", filepath.Base(c.socketPath))\n\n\ttopicStr := topic.String()\n\tif topic.Equal(types.PathFromString(\".\")) {\n\t\ttopicStr = \"\"\n\t}\n\n\tlog.Infoln(\"Connecting to broker url=\", url, \"topic=\", topicStr, \"opts=\", opts)\n\traw, errors, err := broker.Subscribe(url, topicStr, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttyped := make(chan *event.Event)\n\n\tgo func() {\n\t\ttopicCopy := topic\n\t\tdefer close(typed)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase err, ok := <-errors:\n\t\t\t\tif ok {\n\t\t\t\t\ttyped <- event.Event{\n\t\t\t\t\t\tTopic: topicCopy,\n\t\t\t\t\t\tType: event.TypeError,\n\t\t\t\t\t\tReceived: time.Now(),\n\t\t\t\t\t}.Init().WithError(err)\n\t\t\t\t}\n\t\t\tcase any, ok := <-raw:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ttyped <- new(event.Event).FromAny(any).ReceivedNow()\n\t\t\t}\n\n\t\t}\n\t}()\n\n\treturn typed, nil\n}", "title": "" }, { "docid": "356202d5764a584f70c4048bc5372abb", "score": "0.48893502", "text": "func triggerEdgeNodeCertEvent(ctxPtr *zedagentContext) {\n\n\tlog.Function(\"Trigger Edge Node Certs publish\")\n\tselect {\n\tcase ctxPtr.cipherCtx.triggerEdgeNodeCerts <- struct{}{}:\n\t\t// Do nothing more\n\tdefault:\n\t\tlog.Warnf(\"triggerEdgeNodeCertEvent(): already triggered, still not processed\")\n\t}\n}", "title": "" }, { "docid": "6c1ae50bac677273f8d268fcb7f34aa8", "score": "0.48876354", "text": "func (ec *rpcClient) SubscribeFilterLogs(ctx context.Context, q fiscobcos.FilterQuery, ch chan<- types.Log) (fiscobcos.Subscription, error) {\n\treturn nil, errors.New(\"FiscoBcos doesn't provide this function.\")\n}", "title": "" }, { "docid": "cf437342c852e8fd41bc6a1173246f45", "score": "0.48849276", "text": "func (es *EventSystem) subscribe(sub *Subscription) (*Subscription, context.CancelFunc, error) {\n\tvar (\n\t\terr error\n\t\tcancelFn context.CancelFunc\n\t)\n\n\tes.ctx, cancelFn = context.WithCancel(context.Background())\n\n\texistingSubs := es.eventBus.Topics()\n\tfor _, topic := range existingSubs {\n\t\tif topic == sub.event {\n\t\t\teventCh, err := es.eventBus.Subscribe(sub.event)\n\t\t\tif err != nil {\n\t\t\t\terr := errors.Wrapf(err, \"failed to subscribe to topic: %s\", sub.event)\n\t\t\t\treturn nil, cancelFn, err\n\t\t\t}\n\n\t\t\tsub.eventCh = eventCh\n\t\t\treturn sub, cancelFn, nil\n\t\t}\n\t}\n\n\tswitch sub.typ {\n\tcase filters.LogsSubscription:\n\t\terr = es.tmWSClient.Subscribe(es.ctx, sub.event)\n\tcase filters.BlocksSubscription:\n\t\terr = es.tmWSClient.Subscribe(es.ctx, sub.event)\n\tcase filters.PendingTransactionsSubscription:\n\t\terr = es.tmWSClient.Subscribe(es.ctx, sub.event)\n\tdefault:\n\t\terr = fmt.Errorf(\"invalid filter subscription type %d\", sub.typ)\n\t}\n\n\tif err != nil {\n\t\tsub.err <- err\n\t\treturn nil, cancelFn, err\n\t}\n\n\t// wrap events in a go routine to prevent blocking\n\tes.install <- sub\n\t<-sub.installed\n\n\teventCh, err := es.eventBus.Subscribe(sub.event)\n\tif err != nil {\n\t\terr := errors.Wrapf(err, \"failed to subscribe to topic after installed: %s\", sub.event)\n\t\treturn sub, cancelFn, err\n\t}\n\n\tsub.eventCh = eventCh\n\treturn sub, cancelFn, nil\n}", "title": "" }, { "docid": "2fafef38635e982df9097435f673e789", "score": "0.48780945", "text": "func (cc *ClientConn) listenForConnectivityChange() {\n\tfor {\n\t\ts := <-cc.csCh\n\n\t\tcc.csMgr.updateState(s)\n\t}\n}", "title": "" }, { "docid": "966d04cbcea3ddc184c80b30eba753d2", "score": "0.4875495", "text": "func (s NotificationService) Subscribe(vapIDPublicKey string) (NotificationSubscription, error) {\n\tif vapIDPublicKey == \"\" {\n\t\treturn NotificationSubscription{}, errors.New(\"vapid public key is empty\")\n\t}\n\n\tsubc := make(chan string, 1)\n\tdefer close(subc)\n\n\tWindow().Call(\"goappSubscribePushNotifications\", vapIDPublicKey).Then(func(v Value) {\n\t\tsubc <- v.String()\n\t})\n\n\tjsSub := <-subc\n\tif jsSub == \"\" {\n\t\treturn NotificationSubscription{}, errors.\n\t\t\tNew(\"push notifications are not supported by the browser\")\n\t}\n\n\tvar sub NotificationSubscription\n\terr := json.Unmarshal([]byte(jsSub), &sub)\n\tif err != nil {\n\t\treturn NotificationSubscription{}, errors.\n\t\t\tNew(\"decoding push notification subscription failed\").\n\t\t\tWrap(err)\n\t}\n\treturn sub, nil\n}", "title": "" }, { "docid": "ba83c0157028d18455f42f1c58b133ea", "score": "0.4873326", "text": "func (nr *nacosRegistry) Subscribe(url *common.URL, notifyListener registry.NotifyListener) error {\n\t// TODO\n\trole, _ := strconv.Atoi(url.GetParam(constant.RegistryRoleKey, \"\"))\n\tif role != common.CONSUMER {\n\t\treturn nil\n\t}\n\tserviceName := getServiceName(url)\n\tif serviceName == \"*\" {\n\t\t// Subscribe to all services\n\t\tfor {\n\t\t\tif !nr.IsAvailable() {\n\t\t\t\tlogger.Warnf(\"event listener game over.\")\n\t\t\t\treturn perrors.New(\"nacosRegistry is not available.\")\n\t\t\t}\n\n\t\t\tservices, err := nr.getAllSubscribeServiceNames()\n\t\t\tif err != nil {\n\t\t\t\tif !nr.IsAvailable() {\n\t\t\t\t\tlogger.Warnf(\"event listener game over.\")\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tlogger.Warnf(\"getAllServices() = err:%v\", perrors.WithStack(err))\n\t\t\t\ttime.Sleep(time.Duration(RegistryConnDelay) * time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor _, service := range services {\n\t\t\t\tlistener, err := nr.subscribeToService(url, service)\n\t\t\t\tmetrics.Publish(metricsRegistry.NewSubscribeEvent(err == nil))\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Warnf(\"Failed to subscribe to service '%s': %v\", service, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tnr.handleServiceEvents(listener, notifyListener)\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// Subscribe to a specific service\n\t\tfor {\n\t\t\tif !nr.IsAvailable() {\n\t\t\t\tlogger.Warnf(\"event listener game over.\")\n\t\t\t\treturn perrors.New(\"nacosRegistry is not available.\")\n\t\t\t}\n\n\t\t\tlistener, err := nr.subscribe(url)\n\t\t\tmetrics.Publish(metricsRegistry.NewSubscribeEvent(err == nil))\n\t\t\tif err != nil {\n\t\t\t\tif !nr.IsAvailable() {\n\t\t\t\t\tlogger.Warnf(\"event listener game over.\")\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tlogger.Warnf(\"getListener() = err:%v\", perrors.WithStack(err))\n\t\t\t\ttime.Sleep(time.Duration(RegistryConnDelay) * time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnr.handleServiceEvents(listener, notifyListener)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c52adeb6eb9b46b7624c00ab65efcdc0", "score": "0.48722482", "text": "func (crl *ConnectedRileyLink) NotifySubscribe() error {\n\tvar (\n\t\terr error\n\t)\n\t// prepare ourselves for notification\n\terr = crl.client.Subscribe(crl.respCountChr, false, crl.notifyRespCallback)\n\tif err != nil {\n\t\tlog.Fatalf(\"local subscribe failed: %s\", err)\n\t}\n\t// tell the device to notify us, m'kay\n\terr = crl.client.WriteDescriptor(crl.respCountClientDesc, enableNotificationValue)\n\tif err != nil {\n\t\tlog.Fatalf(\"remote notify failed: %s\", err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "9ae8a250f0284bdf7c0a9eb0d28b5bdb", "score": "0.48718154", "text": "func (c *Client) Subscribe(\n\tctx context.Context,\n\tfn func(event *Event) error,\n\topts ...SubscribeOption,\n) error {\n\tvar s sub\n\tfor _, opt := range opts {\n\t\topt(&s)\n\t}\n\tif s.group == \"\" {\n\t\ts.group = \"$Default\"\n\t}\n\n\t// initialize new session for each subscribe session\n\tsess, err := c.conn.NewSession(ctx, &s.sessionOpts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer sess.Close(context.Background())\n\n\tids, err := c.getPartitionIDs(ctx, sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// stop all goroutines at return\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tevc := make(chan *Event)\n\terrc := make(chan error)\n\n\tfor _, id := range ids {\n\t\taddr := fmt.Sprintf(\"/%s/ConsumerGroups/%s/Partitions/%s\", c.name, s.group, id)\n\t\trecv, err := sess.NewReceiver(ctx, addr, &s.receiverOpts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tgo func(recv *amqp.Receiver) {\n\t\t\tdefer recv.Close(context.Background())\n\t\t\tfor {\n\t\t\t\tmsg, err := recv.Receive(ctx, &amqp.ReceiveOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase errc <- err:\n\t\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tselect {\n\t\t\t\tcase evc <- &Event{Message: msg, recv: recv}:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t}\n\t\t\t}\n\t\t}(recv)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase ev := <-evc:\n\t\t\tif err := fn(ev); err != nil {\n\t\t\t\tif rerr := ev.recv.RejectMessage(ctx, ev.Message, &amqp.Error{\n\t\t\t\t\tCondition: amqp.ErrCondInternalError,\n\t\t\t\t\tDescription: err.Error(),\n\t\t\t\t}); rerr != nil {\n\t\t\t\t\treturn rerr\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := ev.recv.AcceptMessage(ctx, ev.Message); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase err := <-errc:\n\t\t\treturn err\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1b2bd7e86d99325adc776920a2951b15", "score": "0.48656324", "text": "func (s *InternalFailureException) eventSubscribeToShardEventStream() {}", "title": "" }, { "docid": "10d91d2158341dac5d36310fb9478860", "score": "0.48654124", "text": "func (clt *SMServiceClient) SubscribeSupply(ctx context.Context, spcb func(*SMServiceClient, *proto.Supply)) error {\n\tch := clt.getChannel()\n\tsmc, err := clt.Client.SubscribeSyncSupply(ctx, ch)\n\t//log.Printf(\"Test3 %v\", ch)\n\t//wg.Done()\n\tif err != nil {\n\t\tlog.Printf(\"SubscribeSupply Error...\\n\")\n\t\treturn err\n\t} else {\n\t\tlog.Print(\"Connect Synerex Server!\\n\")\n\t}\n\tfor {\n\t\tvar sp *proto.Supply\n\t\tsp, err = smc.Recv() // receive Demand\n\t\t//log.Printf(\"\\x1b[30m\\x1b[47m SXUTIL: SUPPLY\\x1b[0m\\n\")\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tlog.Print(\"End Supply subscribe OK\")\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"SMServiceClient SubscribeSupply error %v\\n\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\t//\t\tlog.Println(\"Receive SS:\", sp)\n\t\t// call Callback!\n\t\tspcb(clt, sp)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "7e053e752f9c838b0a43207ed4d0037d", "score": "0.4861475", "text": "func (c *webSocketClient) SubscribeEvents(eventTypes ...string) {\n\tc.mutexEventsSubscribed.Lock()\n\tdefer c.mutexEventsSubscribed.Unlock()\n\n\tl := logging.NewLogger(\"webSocketClient.SubscribeEvents\")\n\tl.Trace().Strs(\"event_types\", eventTypes).Msg(\"Subscribing to events\")\n\n\tif c.EventsSubscribed == nil {\n\t\tc.EventsSubscribed = make(map[uint64]model.HassEventSubscription, 0)\n\t}\n\n\tfor _, eventType := range eventTypes {\n\t\tsub := model.HassEventSubscription{\n\t\t\tID: c.NextMessageID(),\n\t\t\tEventType: eventType,\n\t\t\tType: \"subscribe_events\",\n\t\t}\n\n\t\tc.EventsSubscribed[sub.GetID()] = sub\n\t\tif c.Connected() { // Don't enqueue if not connected because mustConnect will do it\n\t\t\tc.EnqueueRequest(NewWebSocketRequest(sub))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9b275fb0926f99b22df1b7a31a53076e", "score": "0.48586935", "text": "func newEventMonitor(c *criContainerdService) *eventMonitor {\n\tctx, cancel := context.WithCancel(context.Background())\n\tch, errCh := c.client.Subscribe(ctx)\n\treturn &eventMonitor{\n\t\tc: c,\n\t\tch: ch,\n\t\terrCh: errCh,\n\t\tcloseCh: make(chan struct{}),\n\t\tcancel: cancel,\n\t}\n}", "title": "" }, { "docid": "385b0f185fa27272e52b5f52f15a0d6d", "score": "0.4858053", "text": "func (engine *EventEngine) StartNatsEventingSubscriptions(publishCB func()) {\n\tdefer func() {\n\t\tglog.Flush()\n\t}()\n\t//nothing can be done here apart from subscribing and processing\n\tpublishCB()\n}", "title": "" }, { "docid": "8b598286f577dfc2622368562c75b1fc", "score": "0.48580217", "text": "func (t *MyTokenCallerSession) EventReceiveApprovalSubscribe(opts *bind.CallOpts, fromBlock rpc.BlockNumber,\n\ttoBlock rpc.BlockNumber) (<-chan types.Log, ethereum.Subscription, error) {\n\treturn t.Contract.EventReceiveApprovalSubscribe(&t.WatchOpts, fromBlock, toBlock)\n}", "title": "" }, { "docid": "99a4fa4a08daa760b3208e60b7f04bee", "score": "0.48342854", "text": "func (sub BinanceSub) startContractEventSub(logs chan ctypes.Log, client *ethclient.Client,\n\tcontractName txs.ContractRegistry) (common.Address, ethereum.Subscription) {\n\t// Get the bsccontract address for this subscription\n\tsubContractAddress, err := txs.GetAddressFromBridgeRegistry(client, sub.RegistryContractAddress, contractName)\n\tif err != nil {\n\t\tsub.Logger.Error(err.Error())\n\t}\n\t//var subContractAddress common.Address\n\t// We need the address in []bytes for the query\n\tsubQuery := ethereum.FilterQuery{\n\t\tAddresses: []common.Address{subContractAddress},\n\t}\n\n\t// Start the bsccontract subscription\n\tcontractSub, err := client.SubscribeFilterLogs(context.Background(), subQuery, logs)\n\tif err != nil {\n\t\tsub.Logger.Error(err.Error())\n\t}\n\t//var contractSub ethereum.Subscription\n\tsub.Logger.Info(fmt.Sprintf(\"Subscribed to %v bsccontract at address: %s\", contractName, subContractAddress.Hex()))\n\treturn subContractAddress, contractSub\n}", "title": "" }, { "docid": "7e5fd912b855759c88bc9f76836be28e", "score": "0.48300585", "text": "func (b *PubSubBackend) subscribe(data interface{}, client server.ProtocolClient) error {\n\td, _ := data.([][]byte)\n\tif len(d) < 1 {\n\t\treturn nil\n\t} else {\n\t\tfor _, k := range d {\n\t\t\tkey := string(k)\n\t\t\tif topic, ok := b.topics[key]; ok {\n\t\t\t\ttopic.Lock()\n\t\t\t\tid := client.Address()\n\t\t\t\tif _, ok = topic.clients[id]; !ok {\n\t\t\t\t\ttopic.clients[id] = empty\n\t\t\t\t\ttopic.size++\n\t\t\t\t}\n\t\t\t\ttopic.Unlock()\n\t\t\t} else {\n\t\t\t\ttopic := new(TopicChannel)\n\t\t\t\ttopic.clients = make(map[string]struct{})\n\t\t\t\ttopic.size = 1\n\t\t\t\ttopic.clients[client.Address()] = empty\n\t\t\t\tb.topics[key] = topic\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "bde8247f1c7e5a7ba19a126255b3cc61", "score": "0.48237878", "text": "func (b *Tracker) Subscribe() chan int64 {\n\tb.subsMutex.Lock()\n\tdefer b.subsMutex.Unlock()\n\n\tlog.Trace(\"new client subscribed\")\n\n\tc := make(chan int64)\n\tb.subscribers[c] = true\n\treturn c\n}", "title": "" }, { "docid": "7a38a54f891692d3310983456c26b66a", "score": "0.48209575", "text": "func (stream *Event) listen() {\n\tfor {\n\t\tselect {\n\t\t// Add new available client\n\t\tcase client := <-stream.NewClients:\n\t\t\tstream.TotalClients[client] = true\n\t\t\tlog.Printf(\"Client added. %d registered clients\", len(stream.TotalClients))\n\n\t\t// Remove closed client\n\t\tcase client := <-stream.ClosedClients:\n\t\t\tdelete(stream.TotalClients, client)\n\t\t\tclose(client)\n\t\t\tlog.Printf(\"Removed client. %d registered clients\", len(stream.TotalClients))\n\n\t\t// Broadcast message to client\n\t\tcase eventMsg := <-stream.Message:\n\t\t\tfor clientMessageChan := range stream.TotalClients {\n\t\t\t\tclientMessageChan <- eventMsg\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" } ]
f0b4c1b37e38ee6028e81b3e304505a4
This returns the location as an array of string doing it like this makes w.path only setable from the GoTo function, to prevent errors
[ { "docid": "34959322b58d675925a48066cef0ea30", "score": "0.6607738", "text": "func (w Wrench) Path() []string {\n\treturn w.path\n}", "title": "" } ]
[ { "docid": "cbf387bbb006009c59f058fdf60bca7e", "score": "0.5973282", "text": "func (o *outputNode) getPath() []string {\n\treturn o.pathTracker.getPath()\n}", "title": "" }, { "docid": "cf35dd6ba0cdee9569e2a1d649749ff5", "score": "0.5968612", "text": "func getPath(start string, pathMap *concurrentMap) []string {\n\tcurrentNode := start\n\tpath := make([]string, 0)\n\tmore := true\n\n\tfor more && currentNode != \"\" {\n\t\tpath = append(path, currentNode)\n\n\t\tcurrentNode, more = pathMap.get(currentNode)\n\t}\n\n\treturn path\n}", "title": "" }, { "docid": "86ad65f298b7ca1ddfe7cc519f22eaf8", "score": "0.5906834", "text": "func getWirePath(input string) []string {\n\tvar path []string\n\tfor _, move := range strings.Split(input, \",\") {\n\t\tpath = append(path, move)\n\t}\n\n\treturn path\n}", "title": "" }, { "docid": "0719e3f6d4409445bbce87f4238a7f1a", "score": "0.5787433", "text": "func (o PermissionOutput) Paths() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v Permission) []string { return v.Paths }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "c471c637376842f192f31dfbb0ca422d", "score": "0.5744014", "text": "func getFullPathFromActions(centralPort coordinate, actions []string) []coordinate {\n\tvar path []coordinate\n\n\tlastPoint := centralPort\n\tvar newPath []coordinate\n\n\tfor _, action := range actions {\n\t\tnewPath, lastPoint = applyAction(lastPoint, action)\n\t\tpath = append(path, newPath...)\n\t}\n\n\treturn path\n}", "title": "" }, { "docid": "158e528954991e55df63fce051494882", "score": "0.56732523", "text": "func (m *ConditionalAccessLocations) GetIncludeLocations()([]string) {\n val, err := m.GetBackingStore().Get(\"includeLocations\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]string)\n }\n return nil\n}", "title": "" }, { "docid": "c3d39e36ebed2b16a7f293ff4ab1f250", "score": "0.5614893", "text": "func (w *Walker[S]) Paths(resolved bool) []string {\n\tif w.state.Load() != walkerFinished {\n\t\tpanic(\"Walker.Paths: Results() called before Walk() returned\")\n\t}\n\n\tif resolved {\n\t\treturn slices.Clone(w.rpaths)\n\t} else {\n\t\treturn slices.Clone(w.paths)\n\t}\n}", "title": "" }, { "docid": "4fc5da6b2eeac6187938efa33251842a", "score": "0.5610198", "text": "func (o EgpPolicyOutput) Paths() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *EgpPolicy) pulumi.StringArrayOutput { return v.Paths }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "da7f685ee0cd0c56e41406eab6558616", "score": "0.5592056", "text": "func getTrail(path string, basePath string) []string {\n\tapplicablePath := path[len(basePath):] // Remove the base path.\n\toutput := strings.Split(applicablePath, \"/\") // Split remaining path\n\treturn output\n}", "title": "" }, { "docid": "4958a8a97b36600a17761fba93a9af11", "score": "0.55719435", "text": "func (m *EventPropagationResult) GetLocation()(*string) {\n val, err := m.GetBackingStore().Get(\"location\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "f0491bd80b5af196314bae89bacedf1e", "score": "0.5558044", "text": "func (g *GoRef) GetPath() []string {\n\tvar rc []string\n\t// this method needs no thread safety mechanisms.\n\t// A GoRef's name and parent are immutable.\n\tif g.parent != nil {\n\t\trc = append(g.parent.GetPath(), g.name)\n\t}\n\n\treturn rc\n}", "title": "" }, { "docid": "1c6077d148f464d103644bf7dd526171", "score": "0.5541116", "text": "func (i *Interceptor) GetSearchPath() []string {\n\tresult := make(chan []string, 1)\n\ti.work <- func() {\n\t\tresult <- i.search\n\t}\n\treturn <-result\n}", "title": "" }, { "docid": "d5c1ac69a01222830d51ad09949f1c94", "score": "0.553987", "text": "func (o PermissionResponseOutput) Paths() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v PermissionResponse) []string { return v.Paths }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "c12131bfa76e544fcd9956a200d512ac", "score": "0.5503253", "text": "func (e *Entry) RelativePath() []string {\n\treturn e.pathElements()\n}", "title": "" }, { "docid": "4501a1b5e73bf5a91edace8d1490214d", "score": "0.5494377", "text": "func (c *withNameAndCode) Location() []parser.Range {\n\treturn c.location\n}", "title": "" }, { "docid": "7eda35162fd9f3d6877e7a312ce3e1c2", "score": "0.5480773", "text": "func (o PathRuleOutput) Paths() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v PathRule) []string { return v.Paths }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "59c9d5f99d3bce71cc1f2f0ac0b34966", "score": "0.54671973", "text": "func (s Traces) Loc() string {\n\tif len(s) == 0 {\n\t\treturn \"\"\n\t}\n\treturn s[0].String()\n}", "title": "" }, { "docid": "c4c213012a2adf2dc29ec72cd8fb1440", "score": "0.54553664", "text": "func (o WorkflowEfsInputFileLocationOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WorkflowEfsInputFileLocation) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "98b565b048b1c968f44b7b66b955ba3b", "score": "0.54547966", "text": "func (o HTTPGetActionOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HTTPGetAction) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c6828a55681aba3bcb17ed70bd3a87ae", "score": "0.54404724", "text": "func (o LifecyclePolicyOutput) Paths() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *LifecyclePolicy) pulumi.StringArrayOutput { return v.Paths }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "2935b3494bdf5112feff5785b5bc0666", "score": "0.5439464", "text": "func (o LogLocationSettingsResponseOutput) Path() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v LogLocationSettingsResponse) interface{} { return v.Path }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5be6611ec94147e57f4c12787cca1ce4", "score": "0.54326844", "text": "func (o LogLocationSettingsOutput) Path() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v LogLocationSettings) interface{} { return v.Path }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "807be0e1c863e26c704f40432b46c1b8", "score": "0.5413572", "text": "func (o LogLocationSettingsPtrOutput) Path() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v *LogLocationSettings) interface{} {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Path\n\t}).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "78a4c49403d74673e35eaa3d360ab430", "score": "0.54131615", "text": "func (p IprsPath) RelativePath() []string {\n\treturn p.Segments()[3:]\n}", "title": "" }, { "docid": "fc0ad0013438ba720534a094a1e314be", "score": "0.5374415", "text": "func (d *DFS) pathTo(v string, w string) []string {\n\tvar path []string\n\tpath = append(path, w)\n\tfor {\n\t\tif _, ok := d.edgeTo[w]; !ok {\n\t\t\tbreak\n\t\t}\n\t\tw = d.edgeTo[w]\n\t\tpath = append(path, w)\n\t}\n\treturn path\n}", "title": "" }, { "docid": "0b8adc008bc1992447fa6813b057f648", "score": "0.5366971", "text": "func (o NasBackupPlanOutput) Paths() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *NasBackupPlan) pulumi.StringArrayOutput { return v.Paths }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "785b41cd72897970db1fdce8d6b8dbba", "score": "0.53571695", "text": "func TraceWirePath(wirepath string) ([]Coordinates, error) {\n\tdirections := strings.Split(wirepath, \",\")\n\tx, y := 0, 0\n\n\tvar wirePathCoordinates []Coordinates\n\tfor _, d := range directions {\n\t\tdir := d[0:1]\n\t\tsteps, err := strconv.Atoi(d[1:])\n\t\tif err != nil {\n\t\t\treturn wirePathCoordinates, err\n\t\t}\n\n\t\tfor i := 0; i < steps; i++ {\n\t\t\tswitch dir {\n\t\t\tcase \"U\":\n\t\t\t\ty++\n\t\t\t\tbreak\n\t\t\tcase \"D\":\n\t\t\t\ty--\n\t\t\t\tbreak\n\t\t\tcase \"R\":\n\t\t\t\tx++\n\t\t\t\tbreak\n\t\t\tcase \"L\":\n\t\t\t\tx--\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\twirePathCoordinates = append(wirePathCoordinates, Coordinates{x, y})\n\t\t}\n\t}\n\n\treturn wirePathCoordinates, nil\n}", "title": "" }, { "docid": "9caee106f5db158bb20b86439f66e329", "score": "0.533774", "text": "func (o LogLocationSettingsResponsePtrOutput) Path() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v *LogLocationSettingsResponse) interface{} {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Path\n\t}).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "56cddb1326352ec9875cc2bc8f9e4929", "score": "0.53103244", "text": "func (o EcsBackupPlanOutput) Paths() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *EcsBackupPlan) pulumi.StringArrayOutput { return v.Paths }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "ccd3032808f161d54d2ccfa54db69112", "score": "0.53100854", "text": "func get_path (s int, d int) []int{\n\tvar path []int \n\t\n\tfor d != s {\n\t\tpath = append(path,d)\n\t\td = parent [d]\n\t}\n\t\n\tpath = append(path,s)\n\t\n\treturn path\n}", "title": "" }, { "docid": "97cf2a132bb2829c95d8edbd06789391", "score": "0.5300774", "text": "func filePath(i interface{}) (path string, err error) {\n\titer := reflect.ValueOf(i).MapRange()\n\tfor iter.Next() {\n\t\tk, val := iter.Key(), iter.Value()\n\t\tkey := k.Interface().(string)\n\t\tif key == \"location\" || key == \"path\" {\n\t\t\treturn val.Interface().(string), nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"no location or path specified\")\n}", "title": "" }, { "docid": "8bfff8c3fbb5f4e8d2d944d1924140f6", "score": "0.5288903", "text": "func (j *Job) ComponentPaths() (paths []string) {\n\tpaths = make([]string, len(j.DocList))\n\tfor idx, doc := range j.DocList {\n\t\tpaths[idx] = doc.LocalPath()\n\t}\n\treturn\n}", "title": "" }, { "docid": "2512e1f7cbcfd1a4635bc749a55fda2c", "score": "0.5276438", "text": "func (i *Index) Path() string { return i.path }", "title": "" }, { "docid": "0c2749be1a1bb21287d3bb57659b8bed", "score": "0.52757674", "text": "func (w *Walker[S]) Results() []string {\n\treturn w.Paths(true)\n}", "title": "" }, { "docid": "70adbe5e7d46383a421ae3dc431f63ba", "score": "0.52609825", "text": "func (e *Engine) Path() string { return e.path }", "title": "" }, { "docid": "70adbe5e7d46383a421ae3dc431f63ba", "score": "0.52609825", "text": "func (e *Engine) Path() string { return e.path }", "title": "" }, { "docid": "8353cb84aa9cafbf28bc396f9b7cf57f", "score": "0.52549565", "text": "func PathsFromSelectFlagsForApplicationLocation(flags *pflag.FlagSet, prefix string) (paths []string, err error) {\n\tif val, selected, err := flagsplugin.GetBool(flags, flagsplugin.Prefix(\"service\", prefix)); err != nil {\n\t\treturn nil, err\n\t} else if selected && val {\n\t\tpaths = append(paths, flagsplugin.Prefix(\"service\", prefix))\n\t}\n\tif val, selected, err := flagsplugin.GetBool(flags, flagsplugin.Prefix(\"location\", prefix)); err != nil {\n\t\treturn nil, err\n\t} else if selected && val {\n\t\tpaths = append(paths, flagsplugin.Prefix(\"location\", prefix))\n\t}\n\tif selectPaths, err := PathsFromSelectFlagsForLocation(flags, flagsplugin.Prefix(\"location\", prefix)); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tpaths = append(paths, selectPaths...)\n\t}\n\tif val, selected, err := flagsplugin.GetBool(flags, flagsplugin.Prefix(\"attributes\", prefix)); err != nil {\n\t\treturn nil, err\n\t} else if selected && val {\n\t\tpaths = append(paths, flagsplugin.Prefix(\"attributes\", prefix))\n\t}\n\treturn paths, nil\n}", "title": "" }, { "docid": "1acf3528107004d7c6200b112c225a03", "score": "0.5237545", "text": "func (p LocalPath) String() string { return filepath.Join([]string(p)...) }", "title": "" }, { "docid": "d3ebd6b3456c5f07a2b75e20f0c6e974", "score": "0.5234644", "text": "func (o ApplicationStatusHistorySourceOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationStatusHistorySource) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b99c2696908ef265cf5f6461baa07b82", "score": "0.5224723", "text": "func (l *localLister) Path() string {\n\treturn l.path\n}", "title": "" }, { "docid": "46c10d3ed220769ed9dd8c0c0d56eecb", "score": "0.5222046", "text": "func (o PathRuleResponseOutput) Paths() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v PathRuleResponse) []string { return v.Paths }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "25245c2ca45b0c0f398db09faf2e745b", "score": "0.5218079", "text": "func (o WorkflowEfsInputFileLocationPtrOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WorkflowEfsInputFileLocation) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Path\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4d7d9bba5989712175f2cddccf982326", "score": "0.51961964", "text": "func (man *Watchman) CheckPathList() []string {\n list := make([]string, len(man.paths))\n i := 0\n for k, _ := range man.paths {\n list[i] = k\n i += 1\n }\n return list\n}", "title": "" }, { "docid": "fbb57442f11a600c5668e0648fb45f93", "score": "0.51876825", "text": "func GetPath(in []string) []Points {\n\tpp := make([]Points, 0)\n\n\tprev := Point{0, 0}\n\n\tfor _, v := range in {\n\t\tcurr := GetCoor(v)\n\t\t// fmt.Printf(\"curr %v \\n\", curr)\n\t\tif curr.X == 0 {\n\t\t\tactual := 0\n\t\t\tif curr.Y < 0 {\n\t\t\t\tactual = curr.Y - 1\n\t\t\t}\n\t\t\tfor i := 1; i <= abs(curr.Y); i++ {\n\t\t\t\tp := Point{prev.X, prev.Y + i + actual}\n\t\t\t\t// fmt.Println(p)\n\t\t\t\tpp = append(pp, Points{p})\n\t\t\t}\n\t\t} else if curr.Y == 0 {\n\t\t\tactual := 0\n\t\t\tif curr.X < 0 {\n\t\t\t\tactual = curr.X - 1\n\t\t\t}\n\t\t\tfor i := 1; i <= abs(curr.X); i++ {\n\t\t\t\tp := Point{prev.X + i + actual, prev.Y}\n\t\t\t\t// fmt.Println(p)\n\t\t\t\tpp = append(pp, Points{p})\n\t\t\t}\n\t\t}\n\t\tprev = Point{prev.X + curr.X, prev.Y + curr.Y}\n\t\t// fmt.Printf(\"New Prev::: %v \\n\", prev)\n\t}\n\treturn pp\n}", "title": "" }, { "docid": "90a1e532d87727452dace8eedf2585fc", "score": "0.5181977", "text": "func Location() string {\n\treturn location\n}", "title": "" }, { "docid": "1e400a54beaab4b095c36c690c6111bd", "score": "0.5175379", "text": "func (b *BFSPath) PathTo(v int) <-chan interface{} {\n stack := NewStackArray()\n if b.HasPathTo(v) {\n for x := v; x != b.Source; x = b.EdgeTo[x] {\n stack.Push(x)\n }\n stack.Push(b.Source)\n }\n return stack.Iterate()\n}", "title": "" }, { "docid": "22a6bb460ff864673b4d9657733db74c", "score": "0.51752496", "text": "func (p LocalPath) Elem(index int) string { return p[index] }", "title": "" }, { "docid": "5f15b73e35717e41249ba2ea66bec4fa", "score": "0.5168579", "text": "func (l *LayeredMap) GetCurrentPaths() map[string]struct{} {\n\tcurrent := l.getCurrentImage()\n\n\tpaths := map[string]struct{}{}\n\tfor f := range current {\n\t\tpaths[f] = struct{}{}\n\t}\n\treturn paths\n}", "title": "" }, { "docid": "290b9a5973895be8e73f1f9ee62f8780", "score": "0.5157524", "text": "func (w *Walker) Path() string {\n\treturn w.cur.path\n}", "title": "" }, { "docid": "290b9a5973895be8e73f1f9ee62f8780", "score": "0.5157524", "text": "func (w *Walker) Path() string {\n\treturn w.cur.path\n}", "title": "" }, { "docid": "dc0ba13391913320d40e7d57f92eb426", "score": "0.5152102", "text": "func getFileLocations(sdfs_name string) {\n\tif currHost != INTRODUCER {\n\t\tmsg := message{currHost, \"getFileLocations\", time.Now().Format(time.RFC850), file_info{sdfs_name, nil, 0}}\n\t\tvar targetHosts = make([]string, 1)\n\t\ttargetHosts[0] = INTRODUCER\n\t\tsendMsg(msg, targetHosts)\n\t} else {\n\t\tfor _, element := range file_list[sdfs_name].IPs {\n\t\t\tfmt.Println(element)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "548d7f56d6627c9c69c4e4e5948fbe3f", "score": "0.51480347", "text": "func (o HealthcheckOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Healthcheck) pulumi.StringPtrOutput { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "435c290af134f9c71023e6da91f13c18", "score": "0.51467264", "text": "func (in *Inspector) Path(n ast.Node) []ast.Node {\n\tstack := in.Stack(n)\n\tif stack == nil {\n\t\treturn nil\n\t}\n\n\tpath := make([]ast.Node, len(stack))\n\tfor i := range path {\n\t\tpath[i] = stack[len(stack)-1-i]\n\t}\n\n\treturn path\n}", "title": "" }, { "docid": "c10b19444adf462060a7d249337057a7", "score": "0.5146656", "text": "func (n Node) Path() []string {\n\treturn n.nodeRef.Path()\n}", "title": "" }, { "docid": "b939a35abb72ad7deb99a129042944b7", "score": "0.513756", "text": "func (o HTTPGetActionPatchOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HTTPGetActionPatch) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8adbc1503c2e11580ac94259aa1467d8", "score": "0.51348406", "text": "func (ls *LocalStorage) LocalPaths() []string {\n\treturn ls.apiObject.Spec.LocalPath\n}", "title": "" }, { "docid": "60b5535b22737ec679de18e25012466a", "score": "0.5129596", "text": "func getPaths(cx *cli.Context) []string {\n\tif len(cx.Args()) <= 0 {\n\t\treturn []string{\"\"}\n\t}\n\n\treturn cx.Args()\n}", "title": "" }, { "docid": "bd3187325a710274532bb5f9c1273d0f", "score": "0.5127011", "text": "func (o HTTPGetActionPtrOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *HTTPGetAction) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Path\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "319558a9acab64b04713081a0c1ac714", "score": "0.51254576", "text": "func (impl *dfsImpl) PathTo(v int) []int {\n\tif !impl.HasPathTo(v) {\n\t\treturn nil\n\t}\n\tret := make([]int, 0)\n\tfor x := v; x != impl.s; x = impl.edgeTo[x] {\n\t\tret = append([]int{x}, ret...)\n\t}\n\tret = append([]int{impl.s}, ret...)\n\treturn ret\n}", "title": "" }, { "docid": "8f54216790f28646482e5bebcc082413", "score": "0.51197237", "text": "func GetCurrentBusLocation(routeID string) BusLocationList {\n\tURL := CommonURL + \"/\" + BusLocationURLPath + \"?serviceKey=\" + config.ServiceKey + \"&routeId=\" + url.PathEscape(routeID)\n\n\tresponseBody, _ := getDataFromAPI(URL)\n\n\tvar data LocationResponseBody\n\t_ = xml.Unmarshal(responseBody, &data)\n\n\tif strings.Contains(fakeBus.GetBusRoute().RouteID, routeID) {\n\t\tdata.MsgBody.BusLocationList = fakeBus.GetCurrentBusLocation()\n\t}\n\n\treturn data.MsgBody.BusLocationList\n}", "title": "" }, { "docid": "419d864b299c32e7d7ad7a2faa8705b7", "score": "0.51128566", "text": "func (m *ConditionalAccessLocations) GetExcludeLocations()([]string) {\n val, err := m.GetBackingStore().Get(\"excludeLocations\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]string)\n }\n return nil\n}", "title": "" }, { "docid": "a9b6084661ea0ecdec9138158d4a7464", "score": "0.5109689", "text": "func Path() string {\n\treturn self.Path()\n}", "title": "" }, { "docid": "4a8fad8aa00f6450fd48c0c7756e7568", "score": "0.5106402", "text": "func (o *Event) GetLocationsOk() ([]AnyOfmicrosoftGraphLocation, bool) {\n\tif o == nil || o.Locations == nil {\n\t\tvar ret []AnyOfmicrosoftGraphLocation\n\t\treturn ret, false\n\t}\n\treturn *o.Locations, true\n}", "title": "" }, { "docid": "6bba20430285b8ae2839a4e74620bfc3", "score": "0.5103239", "text": "func (r *Response) GetPaths() []string {\n\t// escapedDomain := strings.Replace(r.Domain, `\\`, `\\\\`, -1)\n\tvar linksRegexp = regexp.MustCompile(`\"` + r.Domain + `(.*?)[\"{]`)\n\tfound := linksRegexp.FindAllSubmatch([]byte(r.Body), -1)\n\tlinks := make([]string, 0, len(found))\n\n\tfor _, link := range found {\n\t\tl := strings.Replace(string(link[1]), \"\\\\u0026\", \"&\", -1)\n\t\tlinks = append(links, l)\n\t}\n\n\treturn links\n}", "title": "" }, { "docid": "e5ce2ae5d129061fe941d137c2f8a0ff", "score": "0.5100106", "text": "func GatherLocationInfo(ctx context.Context, chans photo.Channel,\n) []photo.LocationM {\n\tarticleLocationData := []photo.LocationM{}\n\n\t//nolint:gosimple\n\tfor {\n\t\tselect {\n\t\tcase m, ok := <-chans.Location:\n\t\t\tif !ok {\n\t\t\t\treturn articleLocationData\n\t\t\t}\n\t\t\tarticleLocationData = append(articleLocationData, m)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "14521343f7b97e15bcb389a60b101711", "score": "0.50982696", "text": "func (i legacyLocalInfo) GetPath() (*hd.BIP44Params, error) {\n\treturn nil, fmt.Errorf(\"BIP44 Paths are not available for this type\")\n}", "title": "" }, { "docid": "d8e65ad6b9b99e5c1251ce6dfb966642", "score": "0.5096122", "text": "func (o GetLifecyclePoliciesPolicyOutput) Paths() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetLifecyclePoliciesPolicy) []string { return v.Paths }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "8bc0ad20f7eab753262f84ec08c4436a", "score": "0.50876427", "text": "func GetPath(ctx context.Context) []string {\n\tif raw := ctx.Value(pathKey{}); raw != nil {\n\t\tif typed, ok := raw.([]string); ok {\n\t\t\treturn typed\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "049e0962c3784ecab533e44f6e9f372b", "score": "0.50866914", "text": "func pathToStringSlice(path []Vertex) []string {\n\tactual := []string{}\n\tfor _, s := range path {\n\t\tactual = append(actual, s.(Station).id.String())\n\t}\n\treturn actual\n}", "title": "" }, { "docid": "9e0bf8d07be835e79ada65799ce3eff9", "score": "0.507903", "text": "func (cumCost *CumCostMatrix) Path() []Ends {\n\treturn cumCost.path\n}", "title": "" }, { "docid": "d48bf143ced410dfdaa2533267de5720", "score": "0.50715977", "text": "func (o IndexerClusterSpecVolumesProjectedSourcesDownwardAPIItemsOutput) Path() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IndexerClusterSpecVolumesProjectedSourcesDownwardAPIItems) string { return v.Path }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4b88a6de540ee461918487328cd4b541", "score": "0.5070206", "text": "func (o WorkbookOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Workbook) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e583580142cde29b2c46fa05c756036f", "score": "0.50696087", "text": "func (p PathConfig) PathSlice() []string {\n\treturn strings.Split(p.Path, \"/\")\n}", "title": "" }, { "docid": "d969dc2ada053b670bed78549922d36a", "score": "0.50687504", "text": "func (o StandaloneSpecVolumesProjectedSourcesDownwardAPIItemsOutput) Path() pulumi.StringOutput {\n\treturn o.ApplyT(func(v StandaloneSpecVolumesProjectedSourcesDownwardAPIItems) string { return v.Path }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "54929196685f7b876069bd6c2ba75194", "score": "0.50687003", "text": "func getPathUntilParentAndNameOfFutureActor(path string) ([]string, string) {\n\tpathSlice := pathParser(path)\n\treturn pathSlice[0:len(pathSlice) - 1], pathSlice[len(pathSlice) - 1]\n}", "title": "" }, { "docid": "b53c44a8a94d98d2e2bdad5411d83eb2", "score": "0.50677586", "text": "func path (elements ...string) string {\n\tif len(elements) == 0 {\n\t\treturn \"\"\n\t}\n\tif len(elements) == 1 {\n\t\treturn elements[0]\n\t}\n\tp := elements[0]\n\tfor _, e := range elements[1:] {\n\t\tp = p + \"/\" + e\n\t}\n\treturn p\n}", "title": "" }, { "docid": "c3921a46f4dea0b7ea272cafc76d668e", "score": "0.50605005", "text": "func (o GetResourcesSearchAllResultOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetResourcesSearchAllResult) string { return v.Location }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8aadd09a93cc78406ac042d4962edaad", "score": "0.5059621", "text": "func getPath(g *twodee.Grid, s, e twodee.Point) []twodee.GridPoint {\n\t// Need to map from points in the game to locations on the grid board.\n\tsx, sy := g.GridPosition(s.X(), 0.5), g.GridPosition(s.Y(), 0.5)\n\tex, ey := g.GridPosition(e.X(), 0.5), g.GridPosition(e.Y(), 0.5)\n\tpath, err := g.GetPath(sx, sy, ex, ey)\n\tif err != nil {\n\t\tif g.Get(sx, sy) { // Crap, we're inside of something. cheat!\n\t\t\tfor _, sp := range neighbors(sx, sy) {\n\t\t\t\tsx, sy = sp.X, sp.Y\n\t\t\t\tif !g.Get(sx, sy) {\n\n\t\t\t\t\t//\t\t\t\t\tfmt.Printf(\"Trying position (%v, %v) to (%v, %v)\\n\", sx, sy, ex, ey)\n\t\t\t\t\tif path, err := g.GetPath(sx, sy, ex, ey); err != nil {\n\t\t\t\t\t\t//\t\t\t\t\t\tfmt.Printf(\"Shaken free with %v\\n\", path)\n\t\t\t\t\t\treturn path\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//\t\t\tfmt.Printf(\"Still stuck, perhaps we should rand move.\\n\")\n\t\t}\n\t\treturn []twodee.GridPoint{}\n\t}\n\treturn path\n}", "title": "" }, { "docid": "88d24461743ad5d417cbcc049648ad35", "score": "0.5055297", "text": "func (p *Path) Slice() []string {\n\treturn appendNestedPath(p, true)\n}", "title": "" }, { "docid": "8ce0d57f10f881a5935e3ca9f7cdb286", "score": "0.5052496", "text": "func (o ApplicationStatusHistorySourceHelmFileParametersOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationStatusHistorySourceHelmFileParameters) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "431b99c4e57fd36f8654c11d8512fd2f", "score": "0.5043473", "text": "func (openDental *OpenDental) GetLocations() (*models.LocationBundle, error) {\n\treturn openDental.Endpoint.GetLocations()\n}", "title": "" }, { "docid": "135e2a24619b9ae8fb5b6e49ad4d79d6", "score": "0.5041813", "text": "func (f *Frame) Path() string { return f.path }", "title": "" }, { "docid": "198f918cf931b60aa90743e10a15eb3e", "score": "0.50348794", "text": "func (o *Event) GetLocations() []AnyOfmicrosoftGraphLocation {\n\tif o == nil || o.Locations == nil {\n\t\tvar ret []AnyOfmicrosoftGraphLocation\n\t\treturn ret\n\t}\n\treturn *o.Locations\n}", "title": "" }, { "docid": "628b5f363d9a39c79c4a23184a93c301", "score": "0.5030106", "text": "func (l *Log) Path() string { return l.path }", "title": "" }, { "docid": "36a1a7538cd9ac9f653cbc558c7ee7d2", "score": "0.50259054", "text": "func (pe *PushEvent) Path() string {\n\treturn pe.raw.Payload[\"ref\"].(string)\n}", "title": "" }, { "docid": "bc786d6adcfdcac6953d835d5eb2bbbe", "score": "0.50247884", "text": "func (o IndexerClusterSpecVolumesDownwardAPIItemsOutput) Path() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IndexerClusterSpecVolumesDownwardAPIItems) string { return v.Path }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6e527138e4b16b1946e57b4547e6134b", "score": "0.5024584", "text": "func LocalPath() []string {\n\tpath, err := filepath.Abs(os.Args[0])\n\tif err != nil {\n\t\tglog.Errorf(\"%v: Can't get path of '%s'\", err, os.Args[0])\n\t\treturn nil\n\t} else {\n\t\treturn []string{filepath.Dir(path)}\n\t}\n}", "title": "" }, { "docid": "b8a2c5978d5a0c9502bb10bc22c041ad", "score": "0.50217885", "text": "func (o HttpRedirectActionOutput) PathRedirect() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HttpRedirectAction) *string { return v.PathRedirect }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "97c6c5683ad6868fa20cdd7f439026db", "score": "0.50156623", "text": "func (o TriggerOutput) Location() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Trigger) pulumi.StringPtrOutput { return v.Location }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9c34381e80e11ab4e7c05fccbf67c318", "score": "0.5010561", "text": "func (o TaskOutput) Location() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Task) pulumi.StringPtrOutput { return v.Location }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f85ba66ef181d5ee026fb60c00dd73d9", "score": "0.50089973", "text": "func (o LicenseMasterSpecVolumesProjectedSourcesDownwardAPIItemsOutput) Path() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LicenseMasterSpecVolumesProjectedSourcesDownwardAPIItems) string { return v.Path }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d754d4720bd6da157f82258fad85f10f", "score": "0.49964112", "text": "func (o ApplicationStatusSyncComparedToSourceHelmFileParametersOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationStatusSyncComparedToSourceHelmFileParameters) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "02aae85c190acec5e46cba1212184f44", "score": "0.49906534", "text": "func newPath(input string) (path, error) {\n\tpath := []pathMove{}\n\n\tsteps := strings.Split(input, \",\")\n\tfor _, step := range steps {\n\t\tpm, err := newPathMove(step)\n\t\tif err != nil {\n\t\t\treturn path, err\n\t\t}\n\t\tpath = append(path, pm)\n\t}\n\treturn path, nil\n}", "title": "" }, { "docid": "42b1454a9b50b711755f11d081ec1ac6", "score": "0.49827462", "text": "func (o RouteOutput) LocalPath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Route) *string { return v.LocalPath }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a886385b956fdc9647d926839f7e3dca", "score": "0.49815172", "text": "func RequestedForAt(ctx context.Context, resolver interface{}, pathToAppend string) []string {\n\ttree := ctx.Value(ContextKey).(map[string][]string)\n\n\tname := nameFromResolver(resolver)\n\tfield := fromResolver(resolver)\n\n\tpath := append(field.ParentTree, name)\n\n\t// Remove the first \"query\" path\n\t_, path = path[0], path[1:]\n\n\tpathTree := strings.Join(path, \".\")\n\n\tif pathToAppend != \"\" {\n\t\tpathTree += \".\" + pathToAppend\n\t}\n\n\treturn tree[pathTree]\n}", "title": "" }, { "docid": "6a95002d5749d4c4e611ab18e3621126", "score": "0.49805203", "text": "func (r *WirePath) FollowPath(path []string) {\n\n\t//fmt.Println(fmt.Sprintf(\"Starting coordinates: %d,%d\", r.end.x, r.end.y))\n\tfor _, element := range path {\n\t\tdirection := element[:1]\n\t\tm, _ := strconv.ParseInt(element[1:len(element)], 10, 32)\n\t\tmagnitude := int32(m)\n\n\t\tif direction == \"U\" {\n\t\t\t//fmt.Println(fmt.Sprintf(\"Going up %d\", magnitude))\n\t\t\tr.end.y += magnitude\n\t\t\tif r.end.y > r.max.y {\n\t\t\t\tr.max.y = r.end.y\n\t\t\t}\n\t\t} else if direction == \"D\" {\n\t\t\t//fmt.Println(fmt.Sprintf(\"Going down %d\", magnitude))\n\t\t\tr.end.y -= magnitude\n\t\t\tif r.end.y < r.min.y {\n\t\t\t\tr.min.y = r.end.y\n\t\t\t}\n\t\t} else if direction == \"L\" {\n\t\t\t//fmt.Println(fmt.Sprintf(\"Going left %d\", magnitude))\n\t\t\tr.end.x -= magnitude\n\t\t\tif r.end.x < r.min.x {\n\t\t\t\tr.min.x = r.end.x\n\t\t\t}\n\t\t} else if direction == \"R\" {\n\t\t\t//fmt.Println(fmt.Sprintf(\"Going right %d\", magnitude))\n\t\t\tr.end.x += magnitude\n\t\t\tif r.end.x > r.max.x {\n\t\t\t\tr.max.x = r.end.x\n\t\t\t}\n\t\t} else {\n\t\t\tpanic(fmt.Sprintf(\"invalid direction %s\", direction))\n\t\t}\n\n\t\t//fmt.Println(fmt.Sprintf(\"%d,%d\", r.end.x, r.end.y))\n\t\tr.path = append(r.path, r.end)\n\t}\n\t//fmt.Println(fmt.Sprintf(\"Ending coordinates: %d,%d [max x,y = %d,%d] [min x,y = %d,%d]\", r.end.x, r.end.y, r.max.x, r.max.y, r.min.x, r.min.y))\n}", "title": "" }, { "docid": "eddf316509ae53d03027a9190bce7c4a", "score": "0.49772033", "text": "func packLocations(allLocations []airbnbrpc.HousingInfo) string {\n\tans := \"\"\n\tfor _, loc := range allLocations {\n\t\tans += packSingleLocation(loc)\n\t}\n\treturn ans\n}", "title": "" }, { "docid": "9515b2e14d16fe392dfd6625cee3a31f", "score": "0.49767587", "text": "func getPaths() (out string) {\n\tswitch runtime.GOOS {\n\tcase \"linux\":\n\t\treturn \"/\"\n\tcase \"freebsd\":\n\t\treturn \"/\"\n\tcase \"openbsd\":\n\t\treturn \"/\"\n\tcase \"netbsd\":\n\t\treturn \"/\"\n\tcase \"darwin\":\n\t\treturn \"/\"\n\tcase \"windows\":\n\t\treturn \"C:\\\\\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "3ba03600a8523839bbcb62736f4ee4b3", "score": "0.49701354", "text": "func GetDebugFileLocatorShardLocations(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\t// Response object\n\tjr := jresp.NewJsonResp()\n\n\t// Auth\n\tif !restServer.auth(r) {\n\t\trestServer.notAuthorized(w)\n\t\treturn\n\t}\n\n\t// Response\n\tjr.Set(\"shards\", datastore.fileLocator.ShardLocations())\n\tjr.OK()\n\tfmt.Fprint(w, jr.ToString(restServer.PrettyPrint))\n}", "title": "" }, { "docid": "fb2b6a4366290c9ea71ba78708831239", "score": "0.49696133", "text": "func (o EndpointOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Endpoint) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)\n}", "title": "" } ]
bf02bffb037cbceea085bf1808808b1b
SetPretty sets pretty output
[ { "docid": "2552483eef9f488c66a8191232005205", "score": "0.79743487", "text": "func (t *CSVOutput) SetPretty() {\n\t//noop\n}", "title": "" } ]
[ { "docid": "815fd4512c769dade6ed31c577c6a936", "score": "0.8013695", "text": "func (t *TableOutput) SetPretty() {\n\t//noop for table\n}", "title": "" }, { "docid": "426baa8b530bdbd46a907a29ada35c0d", "score": "0.71521324", "text": "func (c *Client) SetPretty(pretty bool) {\n\tc.Client.SetQueryParam(\"pretty\", strconv.FormatBool(pretty))\n}", "title": "" }, { "docid": "378baf8d5d2652b515a0232586ae117b", "score": "0.6326737", "text": "func (o *UrlshortenerURLInsertParams) SetPrettyPrint(prettyPrint *bool) {\n\to.PrettyPrint = prettyPrint\n}", "title": "" }, { "docid": "f271ae60a7178738be8d174dd6e6924c", "score": "0.63100344", "text": "func Pretty(a interface{}) string {\n\treturn prettyPrintConfig.Sdump(a)\n}", "title": "" }, { "docid": "3af85a8dff8051211b3bacdf5aba5ea7", "score": "0.62096244", "text": "func WithPrettyPrint() Option {\n\treturn prettyPrintOption(true)\n}", "title": "" }, { "docid": "c9b019cd806683cb0bbb04f8b8faf20b", "score": "0.6166328", "text": "func (o *UrlshortenerURLListParams) SetPrettyPrint(prettyPrint *bool) {\n\to.PrettyPrint = prettyPrint\n}", "title": "" }, { "docid": "8a0e6594dee5ebf5d2ddf93d5fca0e83", "score": "0.6161721", "text": "func NewPretty(settings *print.Settings) *Pretty {\n\ttt := tmpl.NewTemplate(&tmpl.Item{\n\t\tName: \"pretty\",\n\t\tText: prettyTpl,\n\t}, &tmpl.Item{\n\t\tName: \"header\",\n\t\tText: prettyHeaderTpl,\n\t}, &tmpl.Item{\n\t\tName: \"requirements\",\n\t\tText: prettyRequirementsTpl,\n\t}, &tmpl.Item{\n\t\tName: \"providers\",\n\t\tText: prettyProvidersTpl,\n\t}, &tmpl.Item{\n\t\tName: \"inputs\",\n\t\tText: prettyInputsTpl,\n\t}, &tmpl.Item{\n\t\tName: \"outputs\",\n\t\tText: prettyOutputsTpl,\n\t})\n\ttt.Settings(settings)\n\ttt.CustomFunc(template.FuncMap{\n\t\t\"colorize\": func(c string, s string) string {\n\t\t\tr := \"\\033[0m\"\n\t\t\tif !settings.ShowColor {\n\t\t\t\tc = \"\"\n\t\t\t\tr = \"\"\n\t\t\t}\n\t\t\treturn fmt.Sprintf(\"%s%s%s\", c, s, r)\n\t\t},\n\t})\n\treturn &Pretty{\n\t\ttemplate: tt,\n\t}\n}", "title": "" }, { "docid": "886605ecc7563534c2c5d30d93f213b5", "score": "0.61514217", "text": "func Pretty(nodes []*ast.Node, depth int) string {\n\tvar result strings.Builder\n\tformatter{&result}.writeNodes(removeDeleted(nodes), depth, false /* isSameLine */, false /* asListItems */)\n\treturn result.String()\n}", "title": "" }, { "docid": "5f67c7b16bb3b7d1a77d27d7235444e2", "score": "0.612837", "text": "func (sarif *Report) PrettyWrite(w io.Writer) error {\n\tmarshal, err := json.MarshalIndent(sarif, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = w.Write(marshal)\n\treturn err\n}", "title": "" }, { "docid": "43dfb855df75641c75efff449cc198a6", "score": "0.60888207", "text": "func OptionPrettyPrint(app *AppSettings) {\n\tapp.pretty = true\n}", "title": "" }, { "docid": "25ee12fde3025b2a9c26dca9aaaa343a", "score": "0.60713005", "text": "func (l Logger) Pretty(os ...interface{}) {\n\tcontent := \"\"\n\tfor i := range os {\n\t\tif ret, err := json.MarshalIndent(os[i], \"\", \"\\t\"); err == nil {\n\t\t\tcontent += string(ret) + \"\\n\"\n\t\t}\n\t}\n\tl.Output(2, PRETTY+content)\n}", "title": "" }, { "docid": "0ed25f5efd77b45fcc3e8efb9ac47e6d", "score": "0.60370415", "text": "func Pretty(d *doc.Doc) (string, error) {\n\tj, err := json.MarshalIndent(d, \"\", \" \")\n\n\treturn string(j), err\n}", "title": "" }, { "docid": "73f81f026223fb662094326f5c79ae12", "score": "0.60107124", "text": "func Pretty(v any) (string, error) {\n\tout, err := json.MarshalIndent(v, \"\", \" \")\n\treturn string(out), err\n}", "title": "" }, { "docid": "ae234135cc8c938a42fa1e69c6ab235c", "score": "0.6008825", "text": "func Pretty(v interface{}) {\n\tb, err := json.MarshalIndent(v, \"\", \" \")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tfmt.Println(string(b))\n}", "title": "" }, { "docid": "d436613ad967a75f720d59f21490b295", "score": "0.5964256", "text": "func JSONPrettyPrint(t *testing.T, v interface{}) {\n\tt.Helper()\n\n\tb, err := json.MarshalIndent(v, \"\", \"\\t\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tt.Log(\"\\n\" + string(b))\n}", "title": "" }, { "docid": "2ad38c2894c5252df3ec2bd8ca4e2a18", "score": "0.5952442", "text": "func EncodePretty(v any) ([]byte, error) {\n\treturn json.MarshalIndent(v, \"\", \" \")\n}", "title": "" }, { "docid": "766104a2d99eae8cccd8bd16539b332f", "score": "0.59196526", "text": "func (config *Config) Pretty(output io.Writer) error {\n\tdata, err := yaml.Marshal(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = output.Write(data)\n\treturn err\n}", "title": "" }, { "docid": "b80dcc783b1f41d2244ba56c3ade9551", "score": "0.5902344", "text": "func (s *IndicesSegmentsService) Pretty(pretty bool) *IndicesSegmentsService {\n\ts.pretty = pretty\n\treturn s\n}", "title": "" }, { "docid": "72b2a7aa438b8bf29f3efa100127cf8b", "score": "0.5893564", "text": "func (n *DiscardJSON) SetIndent(string, string) {\n}", "title": "" }, { "docid": "bb3406ed9429f9c5a92761f913a6677f", "score": "0.58662474", "text": "func NewPrettyPrinter(ow *rpc.OutputWriter) *PrettyPrinter {\n\tau := aurora.NewAurora(logging.IsTerminal())\n\treturn &PrettyPrinter{\n\t\taurora: au,\n\t\tclasses: [...]aurora.Value{\n\t\t\taurora.BgRed(\"ERROR\").White(),\n\t\t\taurora.BgBrightCyan(\"START\").Black(),\n\t\t\taurora.BgGreen(\"OK\").White(),\n\t\t\taurora.BgRed(\"FAIL\").White(),\n\t\t\taurora.BgBrightRed(\"CRASH\").White(),\n\t\t\taurora.BgBrightRed(\"INCOMPLETE\").White(),\n\t\t\taurora.BgWhite(\"MESSAGE\").Black(),\n\t\t\taurora.BgBlue(\"METRIC\").White(),\n\t\t\taurora.BgMagenta(\"OTHER\").White(),\n\t\t\taurora.BgBrightRed(\"INTERNAL_ERR\").White(),\n\t\t},\n\t\tstart: time.Now(),\n\t\tow: ow,\n\t}\n}", "title": "" }, { "docid": "8b045f2f2a08771b18d31b2dcf7e19a4", "score": "0.5854463", "text": "func (s *IndicesRolloverService) Pretty(pretty bool) *IndicesRolloverService {\n\ts.pretty = &pretty\n\treturn s\n}", "title": "" }, { "docid": "f32ea4d65289ef53fd58ee43ff399426", "score": "0.5815686", "text": "func (s *IndicesFlushService) Pretty(pretty bool) *IndicesFlushService {\n\ts.pretty = &pretty\n\treturn s\n}", "title": "" }, { "docid": "8f76a0c5155095d5e7824546609ddd57", "score": "0.58090067", "text": "func (j *JDoc) StringPretty() string {\n\tbuf, err := json.MarshalIndent(j.orig, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(buf)\n}", "title": "" }, { "docid": "e1721c62027501496a7ffe3c6fb5b119", "score": "0.5773885", "text": "func (s *SearchShardsService) Pretty(pretty bool) *SearchShardsService {\n\ts.pretty = &pretty\n\treturn s\n}", "title": "" }, { "docid": "9ec0b95ede6216fcbbd4c0efbaca7af4", "score": "0.5753695", "text": "func (v MemoryScrubbingPolicy) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string {\n\treturn v.String()\n}", "title": "" }, { "docid": "9621ae76519719c3c391e7fea3ae0da6", "score": "0.57487804", "text": "func (v ResetAUXControl) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string {\n\treturn v.String()\n}", "title": "" }, { "docid": "001d5914d7960cfc36c890f2c82ef724", "score": "0.5718162", "text": "func (o *Advisory) StringifyPretty() string {\n\to.Hash()\n\treturn pjson.Stringify(o, true)\n}", "title": "" }, { "docid": "fa2acfacad00d387dc2dc30af8ab43f8", "score": "0.56868404", "text": "func (s *MultiTermvectorService) Pretty(pretty bool) *MultiTermvectorService {\n\ts.pretty = &pretty\n\treturn s\n}", "title": "" }, { "docid": "99afe090a6e534754e10fbfa64649984", "score": "0.5648532", "text": "func WritePretty(filePath string, data any) error {\n\tbs, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn os.WriteFile(filePath, bs, 0664)\n}", "title": "" }, { "docid": "97134cf58ebe085dc88b14f8425d94d6", "score": "0.56482446", "text": "func toJSONPretty(m map[string]interface{}) (string, error) {\n\tresult, err := json.MarshalIndent(m, \"\", \" \")\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"toJSONPretty\")\n\t}\n\treturn string(bytes.TrimSpace(result)), err\n}", "title": "" }, { "docid": "3656b444c66d8ced1e55d4b611ff4111", "score": "0.5644708", "text": "func WithPrettyFormat(b bool) SerializerOption {\n\treturn &serializerOption{option.New(identPrettyFormat{}, b)}\n}", "title": "" }, { "docid": "bf3eaf2921c223f27230288d67cacb91", "score": "0.56219697", "text": "func (v BackupActionPolicy) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string {\n\treturn v.String()\n}", "title": "" }, { "docid": "9d752930e6cfacfa919748f1e2326091", "score": "0.56119573", "text": "func NewPrettyConsoleEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder {\n\t// Use empty config because we don't care about encoding informational\n\t// fields, we only want to use it to encode extra fields.\n\tencoder := zapcore.NewJSONEncoder(zapcore.EncoderConfig{\n\t\tEncodeLevel: cfg.EncodeLevel,\n\t\tEncodeTime: cfg.EncodeTime,\n\t\tEncodeDuration: cfg.EncodeDuration,\n\t\tEncodeCaller: cfg.EncodeCaller,\n\t\tEncodeName: cfg.EncodeName,\n\t})\n\treturn &prettyConsoleEncoder{cfg: cfg, Encoder: encoder}\n}", "title": "" }, { "docid": "3719a245663441a5686f07ddec75f005", "score": "0.5595944", "text": "func PrettyPrint(data interface{}) {\n\tvar p []byte\n\t// var err := error\n\tp, err := json.MarshalIndent(data, \"\", \"\\t\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Printf(\"%s \\n\", p)\n}", "title": "" }, { "docid": "563b1a06ed480a79d7aa82d4d4fc6980", "score": "0.5589757", "text": "func (o *Enrollment) StringifyPretty() string {\n\to.Hash()\n\treturn pjson.Stringify(o, true)\n}", "title": "" }, { "docid": "8f6f39d876f7a9e85588fca9ca337b2a", "score": "0.55676657", "text": "func WithPretty(pretty bool) *Option {\n\treturn &Option{\n\t\tname: \"WithPretty\",\n\t\tapply: func(r *http.Request) {\n\t\t},\n\t}\n}", "title": "" }, { "docid": "13e7804f110f53f1f2f136b3f526de7c", "score": "0.55455023", "text": "func JSONPretty() bool {\n\treturn jsonPretty\n}", "title": "" }, { "docid": "979883ab6c48d94afb02b1a60a7a47cb", "score": "0.55392724", "text": "func (enc *Encoder) SetIndent(prefix, indent string)", "title": "" }, { "docid": "5c4e251d5d6a656e67aa7d25935991c1", "score": "0.55066854", "text": "func PrettyPrint(data interface{}) string {\n\n\tempJSON, _ := json.MarshalIndent(data, \"\", \" \")\n\n\treturn string(empJSON)\n}", "title": "" }, { "docid": "f2e8158b4ecc46ab67828125a133fb3b", "score": "0.5502005", "text": "func (o *RestartTrigger) StringifyPretty() string {\n\to.Hash()\n\treturn pjson.Stringify(o, true)\n}", "title": "" }, { "docid": "bfa5aa858a3837485a6eeae17bc7bd35", "score": "0.54932576", "text": "func (rl RepoDockerList) MarshalPretty() ([]byte, error) {\n\tsort.Slice(rl.Repositories, func(i, j int) bool {\n\t\tif strings.Compare(rl.Repositories[i], rl.Repositories[j]) < 0 {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t})\n\tbuf := &bytes.Buffer{}\n\tfor _, tag := range rl.Repositories {\n\t\tfmt.Fprintf(buf, \"%s\\n\", tag)\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "944ae162f320cf9179bc21b882291260", "score": "0.54587966", "text": "func (s *ValidateService) Pretty(pretty bool) *ValidateService {\n\ts.pretty = pretty\n\treturn s\n}", "title": "" }, { "docid": "84beba5a2f062d32e9510784396e9255", "score": "0.5437897", "text": "func (v ExecutionProfile) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string {\n\treturn v.String()\n}", "title": "" }, { "docid": "7179fe6535360fc87a3aae6b322d82d5", "score": "0.54351413", "text": "func MarshalWithPretty(r *http.Request, obj interface{}) []byte {\n\tp := r.URL.Query().Get(\"pretty\")\n\tout, _ := json.Marshal(obj)\n\tif pretty, _ := strconv.ParseBool(p); pretty {\n\t\tout = JsonPrettyPrint(out)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "4e681bd69906ae5965f45f65f335a5f4", "score": "0.5421369", "text": "func PrettyReport(v interface{}) string {\n\tb, err := json.MarshalIndent(v, \"\", \" \")\n\tif err == nil {\n\t\treturn string(b)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e5c5ae975b750a2650bab22a55fa498f", "score": "0.53385836", "text": "func toJsonPretty(b interface{}) string {\n\ts, _ := json.MarshalIndent(b, \"\", \" \")\n\treturn string(s)\n}", "title": "" }, { "docid": "65eaf44d5e2c9819afad6baf1f008060", "score": "0.53349334", "text": "func PrettyPrint(b []byte) ([]byte, error) {\r\n\tvar out bytes.Buffer\r\n\terr := json.Indent(&out, b, \"\", \" \")\r\n\treturn out.Bytes(), err\r\n}", "title": "" }, { "docid": "5477495ae6d708b222d3d4a8828e5e00", "score": "0.5308651", "text": "func (o *NullOutput) SetDecorated(decorated bool) {\n\tif nil == o.formatter {\n\t\treturn\n\t}\n\n\t(*o.formatter).SetDecorated(decorated)\n}", "title": "" }, { "docid": "5125fef674ffc39e69f48de9c83b3f29", "score": "0.530557", "text": "func PrettyPrinter(ar *AnalysisResult) {\n\tlog.Info(\"Available plist files\")\n\tfor _, plist := range ar.Plists {\n\t\tfmt.Println(\"\\t\\t\" + plist)\n\t}\n\n\tlog.Info(\"Available certificates\")\n\tfor _, cert := range ar.CertFiles {\n\t\tfmt.Println(\"\\t\\t\" + cert)\n\t}\n\n\t//\tPrint out the analysis info\n\tlog.Info(\"IPA metadata\")\n\tlog.Infof(\"[Number of files] %d\", ar.NumberOfFiles)\n\tlog.Infof(\"[File name] %s\", ar.FileName)\n\tlog.Infof(\"[App name] %s\", ar.AppName)\n\tlog.Infof(\"[Version] %s\", ar.Version)\n\tlog.Infof(\"[File size] %dK (%dMB)\", ar.FileSize, ar.FileSize/(1024*1024))\n\tlog.Infof(\"[MD5] %s\", ar.MD5)\n\tlog.Infof(\"[SHA1] %s\", ar.SHA1)\n\tlog.Infof(\"[SHA256] %s\", ar.SHA256)\n\tlog.Infof(\"[Bundle name] %s\", ar.BundleName)\n\tlog.Infof(\"[SDK name] %s\", ar.SDKName)\n\tlog.Infof(\"[Platform version] %s\", ar.PlatformVersion)\n\tlog.Infof(\"[Min OS version] %s\", ar.MinOSVersion)\n\tlog.Info(\"[App Transport Security]\")\n\t// for k, v := range ar.ATSec {\n\t// \tfmt.Printf(\"\\t\\t %s: %t\\n\", k, v)\n\t// }\n\tj, err := json.MarshalIndent(ar.ATSec, \"\", \" \")\n\tif err != nil {\n\t\tlog.Error(err)\n\t} else {\n\t\tfmt.Println(string(j))\n\t}\n\tlog.Infof(\"[Allow Stack Execution flag] %t\", ar.AllowStackExecution)\n\tlog.Infof(\"[Root Safe flag] %t\", ar.RootSafe)\n\tlog.Infof(\"[SetUID safe flag] %t\", ar.SetuidSafe)\n\tlog.Infof(\"[Is PIE compiled] %t\", ar.IsPIE)\n\tlog.Infof(\"[No Heap execution] %t\", ar.NoHeapExecution)\n\tlog.Info(\"[Interesting API Tokens]\")\n\tfor k, v := range ar.Tokens {\n\t\tfmt.Printf(\"\\t\\t %s:\\n\", k)\n\t\tfor _, element := range v {\n\t\t\tfmt.Printf(\"\\t\\t\\t %s\\n\", element)\n\t\t}\n\t}\n\tlog.Info(\"[Files with other interesting data]\")\n\tfor k, v := range ar.WorthyEggs {\n\t\tfmt.Printf(\"\\t\\t %s:\\n\", k)\n\t\tfor _, element := range v {\n\t\t\tfmt.Printf(\"\\t\\t\\t %s\\n\", element)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f637c168736013dbde4ba2ac3473dc29", "score": "0.52955365", "text": "func (i *Interface) JSONPretty() []byte {\n\tb, _ := json.MarshalIndent(i, \"\", \" \")\n\treturn b\n}", "title": "" }, { "docid": "dccd84d3b3b2ce84aae4c85977a4b083", "score": "0.5285497", "text": "func (m1 Matrixb) Pretty() {\n\tfmt.Println(strings.Repeat(\"-\", (len(m1.Data[0])*6 + 1)))\n\tfor j := 0; j < len(m1.Data); j++ {\n\t\tfmt.Println(m1.Data[j][:])\n\t}\n\tfmt.Println(strings.Repeat(\"-\", len(m1.Data)*6+1))\n}", "title": "" }, { "docid": "d8234acbdc464ed4f8653bc222ef1c52", "score": "0.52761227", "text": "func (t GitRoot) PrettyPrint() {\n\tvar cleanText string\n\trootIsClean := t.isClean()\n\tif !rootIsClean{\n\t\tcleanText = red(rootIsClean)\n\t} else {\n\t\tcleanText = yellow(rootIsClean)\n\t}\n\n\tfmt.Printf(PrettyPrintStringForGitRoot, cyan(t.Path), yellow(t.getBranch()), cleanText)\n\n\tif !rootIsClean {\n\t\tfmt.Printf(red(t.getStatus()))\n\t}\n}", "title": "" }, { "docid": "de25fae057366f9536c1bba19c31bcfc", "score": "0.5264412", "text": "func (res AuditData) GetPrettyOutput(useColor bool) string {\n\tcolor.NoColor = !useColor\n\tstr := titleColor.Sprint(fmt.Sprintf(\"Polaris audited %s %s at %s\\n\", res.SourceType, res.SourceName, res.AuditTime))\n\tstr += color.CyanString(fmt.Sprintf(\" Nodes: %d | Namespaces: %d | Controllers: %d\\n\", res.ClusterInfo.Nodes, res.ClusterInfo.Namespaces, res.ClusterInfo.Controllers))\n\tstr += color.GreenString(fmt.Sprintf(\" Final score: %d\\n\", res.Score))\n\tstr += \"\\n\"\n\tfor _, result := range res.Results {\n\t\tstr += result.GetPrettyOutput() + \"\\n\"\n\t}\n\tcolor.NoColor = false\n\treturn str\n}", "title": "" }, { "docid": "989470ca5219c0d52ce0decc7596238e", "score": "0.5262156", "text": "func (mjs MigrationJobs) PrettyPrint(wr io.Writer, detail prettyprint.DetailLevel) error {\n\tmigrationjobsTpl := `\n{{ define \"migrationjobs_sgl\" }}{{ len . }} servers{{ end }}\n\n{{ define \"migrationjobs_medium\" -}}\n{{- range . -}}\n{{- prettysprint . \"_sgl\" }}\n{{ end -}}\n{{- end }}\n\n{{ define \"migrationjobs_full\" }}{{ template \"migrationjobs_medium\" . }}{{ end }}\n`\n\treturn prettyprint.Run(wr, migrationjobsTpl, \"migrationjobs\"+string(detail), mjs)\n}", "title": "" }, { "docid": "c4fd198ec961dd2842378ab0dd92f7fc", "score": "0.52584004", "text": "func (t *Torrent) Pretty() string {\n\treturn fmt.Sprintf(\"Torrent:\\n\\tHash: %v\\n\\tName: %v\\n\\tPath: %v\\n\\tLabel: %v\\n\\tSize: %v bytes\\n\\tCompleted: %v\\n\\tRatio: %v\\n\", t.Hash, t.Name, t.Path, t.Label, t.Size, t.Completed, t.Ratio)\n}", "title": "" }, { "docid": "ee8dbf14f0397b3c708c0710f453aec8", "score": "0.5256707", "text": "func (m1 Matrixi) Pretty() {\n\tfmt.Println(strings.Repeat(\"-\", m1.Cols*2+1))\n\tfor j := 0; j < m1.Rows; j++ {\n\t\tfmt.Println(m1.Data[j][:])\n\t}\n\tfmt.Println(strings.Repeat(\"-\", m1.Cols*2+1))\n}", "title": "" }, { "docid": "fab34c2ead8cb1f02558166c54d607ab", "score": "0.5242918", "text": "func SetFormatter(formatter Formatter) {\n std.SetFormatter(formatter)\n}", "title": "" }, { "docid": "9c0dd407bfe5ed39ad869c3ce1183fad", "score": "0.52255726", "text": "func (antArg AntArg) Prettify() string {\n\ti := jsonAntArg{\n\t\tName: antArg.name,\n\t\tHelp: antArg.help,\n\t\tArgs: deepToJSON(antArg.args),\n\t}\n\ts, _ := json.MarshalIndent(i, \"\", \" \")\n\treturn string(s)\n}", "title": "" }, { "docid": "d5f6b4ee8423574ef436b26e829653c1", "score": "0.52204156", "text": "func (p *Parser) NmapPrettyPrint() (err error) {\n\tnp, err := p.getNmapParser(p.Logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// In my previous nmap parser I built a lot more logic into output options I would like to add next\n\t// eg. ouput live hosts, output just a selected port\n\tfor _, host := range np.Hosts {\n\t\tfor _, ip := range host.Addresses {\n\t\t\tfor _, port := range host.Ports {\n\t\t\t\t// fmt.Println(\"| \", ip.Addr, \" | \", port.PortId, \" | \", port.Service.Product, port.Service.Version)\n\t\t\t\tfmt.Fprintf(p.Logger, \"| %18s | %8s | %6s | %-22s %-8s |\\n\", ip.Addr, strconv.Itoa(port.PortId), port.Protocol, port.Service.Product, port.Service.Version)\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "518a3a21840a444862921ddf56c00a27", "score": "0.52012986", "text": "func SetFormatter(f Formatter) {\n\tstd.SetFormatter(f)\n}", "title": "" }, { "docid": "3e8ad35d1868eee56bbf874e224897d3", "score": "0.51775956", "text": "func (a Account) PrettyPrint(wr io.Writer, detail prettyprint.DetailLevel) error {\n\taccountTpl := `\n\t{{ define \"account_sgl\" }}{{ .Name }}{{ if .Suspended }} (suspended){{ end}}{{ end }}\n{{ define \"account_medium\" }}{{ template \"account_sgl\" . }}{{ end }}\n{{ define \"account_full\" }}{{ .Name }}{{ if .Suspended }} (suspended){{ end}}{{ end }}\n\n{{ range .Groups -}}\n {{ template \"group_overview\" . -}}\n{{- end -}}\n{{ define \"group_overview\" }} • {{ .Name }} - {{ pluralize \"server\" \"servers\" ( len .VirtualMachines ) -}}\n{{- if len .VirtualMachines | gt 6 -}}\n{{- range .VirtualMachines }}\n {{ prettysprint . \"_sgl\" -}}\n{{- end -}}\n{{- end }}\n{{ end -}}\n`\n\treturn prettyprint.Run(wr, accountTpl, \"account\"+string(detail), a)\n}", "title": "" }, { "docid": "08637f1d1fcd5fcc776c796de88a0b7b", "score": "0.5168028", "text": "func (i *InterfaceList) JSONPretty() []byte {\n\tb, _ := json.MarshalIndent(i, \"\", \" \")\n\treturn b\n}", "title": "" }, { "docid": "de2f0c9517090191b1cd23215f452d18", "score": "0.51652133", "text": "func (c Config) PrettyPrintAllowed() bool {\n\tlogFileEnabled := c.CliFlags.LogFile != \"\" || c.AppConfig.LogFile != \"\"\n\treturn !logFileEnabled && !c.IsJSONLoggingEnabled() && !c.CliFlags.StartServer\n}", "title": "" }, { "docid": "e9b8ee7224a2db3ff786691f20f4a4e9", "score": "0.51554984", "text": "func PrettyFishie(fishie interface{}, w io.Writer) {\n\n\tencoder := json.NewEncoder(w)\n\tencoder.SetIndent(\"\", \" \")\n\n\tencoder.Encode(&fishie)\n\n}", "title": "" }, { "docid": "3a2b85e09be1442fc0c063e73727890e", "score": "0.51515555", "text": "func (s *XPackAsyncSearchSubmit) Pretty(pretty bool) *XPackAsyncSearchSubmit {\n\ts.pretty = &pretty\n\treturn s\n}", "title": "" }, { "docid": "1c495852e7ae97195214984be6d558a3", "score": "0.51465636", "text": "func (m1 Matrixf) Pretty() {\n\tfmt.Println(strings.Repeat(\"-\", m1.Cols*2+1))\n\tfor j := 0; j < m1.Rows; j++ {\n\t\tfmt.Println(m1.Data[j][:])\n\t}\n\tfmt.Println(strings.Repeat(\"-\", m1.Cols*2+1))\n}", "title": "" }, { "docid": "43baa738e79f06546f6a0a0bc7f5668a", "score": "0.514124", "text": "func PrettyPrint(printFunc Print, t Token, authMethods map[int]string, sortedKeys []int) {\n\tif t == nil {\n\t\treturn\n\t}\n\n\tam := t.GetAuthMethods()\n\n\tdebug(printFunc, \"Type: %s\", t.GetType().String())\n\tdebug(printFunc, \"UserID: %s\", t.GetUserID())\n\tdebug(printFunc, \"AuthMethods: %d %q\", am, am.Decode(authMethods, sortedKeys))\n\tdebug(printFunc, \"ProjectID: %s\", t.GetProjectID())\n\tdebug(printFunc, \"DomainID: %s\", t.GetDomainID())\n\n\tdebug(printFunc, \"TrustID: %s\", t.GetTrustID())\n\tdebug(printFunc, \"AccessTokenID: %s\", t.GetAccessTokenID())\n\tdebug(printFunc, \"SystemID: %s\", t.GetSystemID())\n\tdebug(printFunc, \"AppCredID: %s\", t.GetAppCredID())\n\n\t// federated\n\tdebug(printFunc, \"GroupIDs: %s\", t.GetFederatedGroupIDs())\n\tdebug(printFunc, \"IdPID: %s\", t.GetIdPID())\n\tdebug(printFunc, \"ProtocolID: %s\", t.GetProtocolID())\n\n\tdebug(printFunc, \"ExpiresAt: %s\", t.GetExpiresAt())\n\tdebug(printFunc, \"ExpiresIn: %s\", time.Until(t.GetExpiresAt()))\n\tdebug(printFunc, \"AuditIDs: %q\", t.GetAuditIDs())\n}", "title": "" }, { "docid": "7c1be6291e9d406f9603af25479b6951", "score": "0.51387876", "text": "func (s *CountService) Pretty(pretty bool) *CountService {\n\ts.pretty = &pretty\n\treturn s\n}", "title": "" }, { "docid": "12df5deef057a8d534864915ffc068b4", "score": "0.5136471", "text": "func PrettyPrintJSON(theJSON []byte) {\n\tdst := new(bytes.Buffer)\n\tjson.Indent(dst, theJSON, \"\", \"\\t\")\n\tlog.Info(dst)\n}", "title": "" }, { "docid": "86b5d2046dbde77c843dae060df51505", "score": "0.51362276", "text": "func (p *Parser) RumblePrettyPrint() (err error) {\n\tn, err := p.getNmapParser(p.Logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, host := range n.Hosts {\n\t\tfor _, ip := range host.Addresses {\n\t\t\tfmt.Println(\"|--------------|-------------------|--------------|------------------|\")\n\t\t\t// im getting blank lines in the return and I can't figure out why\n\t\t\tif ip.Addr == \"\" {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tfor _, port := range host.Ports {\n\t\t\t\t\tif port.Service.Product != \"\" {\n\t\t\t\t\t\tfmt.Fprintf(p.Logger, \"| %18s | %8s | %6s | %-22s %-8s |\\n\", ip.Addr, strconv.Itoa(port.PortId), port.Protocol, port.Service.Product, port.Service.Version)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tm := make(map[string]string)\n\t\t\t\t\tb := []byte(port.Scripts[0].Output)\n\t\t\t\t\tif err := json.Unmarshal(b, &m); err != nil {\n\t\t\t\t\t\tfmt.Fprintf(p.Logger, \"Error parsing embedded JSON\\n\")\n\t\t\t\t\t}\n\t\t\t\t\tif banner, exists := m[\"banner\"]; exists {\n\t\t\t\t\t\tfmt.Fprintf(p.Logger, \"| %18s | %8s | %6s | %-22s |\\n\", ip.Addr, strconv.Itoa(port.PortId), port.Protocol, banner)\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "58569bf1d1817fd997344bf5fe10a8c4", "score": "0.5131749", "text": "func (f *File) Pretty() string {\n\treturn fmt.Sprintf(\"File:\\n\\tPath: %v\\n\\tSize: %v bytes\\n\", f.Path, f.Size)\n}", "title": "" }, { "docid": "a33f4efbb15bc1823c751fae716808d0", "score": "0.5129699", "text": "func (j *Json) EncodePretty() ([]byte, error) {\n\treturn json.MarshalIndent(&j.data, \"\", \" \")\n}", "title": "" }, { "docid": "dd72d017fa5a8edd409e412b535f2686", "score": "0.5127097", "text": "func Prettify(i interface{}) string {\n\tvar buf bytes.Buffer\n\tprettify(reflect.ValueOf(i), 0, &buf)\n\treturn buf.String()\n}", "title": "" }, { "docid": "dd72d017fa5a8edd409e412b535f2686", "score": "0.5127097", "text": "func Prettify(i interface{}) string {\n\tvar buf bytes.Buffer\n\tprettify(reflect.ValueOf(i), 0, &buf)\n\treturn buf.String()\n}", "title": "" }, { "docid": "817f30960889193a5e655aee6abda5fd", "score": "0.51237255", "text": "func (m *JSONMessage) MarshalPretty() ([]byte, error) {\n\tresponse, err := json.MarshalIndent(m.data, \"\", \" \")\n\tresponse = append(response, []byte(\"\\n\")...)\n\treturn response, err\n}", "title": "" }, { "docid": "fddd400d2851e29d9942125effb52b12", "score": "0.5109504", "text": "func (m1 Matrixff) Pretty() {\n\tfmt.Println(strings.Repeat(\"-\", m1.Cols*2+1))\n\tfor j := 0; j < m1.Rows; j++ {\n\t\tfmt.Println(m1.Data[j][:])\n\t}\n\tfmt.Println(strings.Repeat(\"-\", m1.Cols*2+1))\n}", "title": "" }, { "docid": "7fce69d3626f90af4a597cd104cd019c", "score": "0.51070523", "text": "func SetFormatter(f Formatter) {\n\tstd.mu.Lock()\n\tdefer std.mu.Unlock()\n\tstd.formatter = f\n}", "title": "" }, { "docid": "d147c524763e1fe65cfeefb07db4c756", "score": "0.5090114", "text": "func PrettyPrint(segments []Segment) (out string) {\n\tfor i, s := range segments {\n\t\tout += s.String()\n\t\tif i < len(segments)-1 {\n\t\t\tout += \"\\n\"\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "2cb12acbf0d75bf86e0ab1da669d83aa", "score": "0.5084566", "text": "func TestPrettyOutputCanBeParsed(t *testing.T) {\n\tinput := `\n<html>\n<body>\n\t<p class=\"class_here\" id=\"id_here\"><span class=\"span_class_here\">Content</span></p><br/>\n\t<img src=\"example.com\"></img>\n</body>\n</html>\n`\n\tdoc, err := html.Parse(strings.NewReader(input))\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tpp := NewPrettyPrinter()\n\tb := &bytes.Buffer{}\n\terr = pp.Pretty(b, doc)\n\tif err != nil {\n\t\tt.Log(err)\n\t\tt.Fail()\n\t}\n\t_, err = html.Parse(bytes.NewReader(b.Bytes()))\n\tif err != nil {\n\t\tt.Log(err)\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "f9fc517e1adb8c603d5b846b5e2e7f53", "score": "0.5079803", "text": "func toPrettyJson(obj interface{}) []byte {\n\toutput, _ := json.MarshalIndent(obj, \"\", \" \")\n\treturn output\n}", "title": "" }, { "docid": "ed36eb72659da835ae2999523b8e0251", "score": "0.5077592", "text": "func (ps Privileges) PrettyPrint(wr io.Writer, detail prettyprint.DetailLevel) error {\n\tprivilegesTpl := `\n{{ define \"privileges_sgl\" }}{{ len . }} servers{{ end }}\n\n{{ define \"privileges_medium\" -}}\n{{- range . -}}\n{{- prettysprint . \"_sgl\" }}\n{{ end -}}\n{{- end }}\n\n{{ define \"privileges_full\" }}{{ template \"privileges_medium\" . }}{{ end }}\n`\n\treturn prettyprint.Run(wr, privilegesTpl, \"privileges\"+string(detail), ps)\n}", "title": "" }, { "docid": "32369d2d48a3b860000afce58fcdda23", "score": "0.5071065", "text": "func (p *publicKeyImpl) Pretty() string {\n\tpstr := p.String()\n\tmaxRunes := 6\n\tif len(pstr) < maxRunes {\n\t\tmaxRunes = len(pstr)\n\t}\n\treturn fmt.Sprintf(\"<PUBK %s>\", pstr[:maxRunes])\n}", "title": "" }, { "docid": "19838a92345fe667b04a3cb4d47890f6", "score": "0.5057884", "text": "func (c *CFMetaData) Pretty() string {\n\tdesc := c.NColumnMap + \"(\" + c.NColumnKey + \",\" + c.NColumnValue + \",\" + c.NColumnTimestamp + \")\"\n\tif c.ColumnType == \"Super\" {\n\t\tdesc = c.NSuperColumnMap + \"(\" + c.NSuperColumnKey + \",\" + desc + \")\"\n\t}\n\tdesc = c.TableName + \".\" + c.CFName + \"(\" + c.NRowKey + \",\" + desc + \")\\n\"\n\tdesc += \"Column Family Type: \" + c.ColumnType + \"\\nColumns Sorted by: \" + c.IndexProperty + \"\\n\"\n\treturn desc\n}", "title": "" }, { "docid": "9abef11cacfde8f56586375f6ba85900", "score": "0.5043389", "text": "func SetFormatter(formatter Formatter) {\n\tif formatter != nil {\n\t\tstd.Formatter = formatter\n\t}\n}", "title": "" }, { "docid": "3cd01fa458f4ff22bdbafc1151846355", "score": "0.5037963", "text": "func (o *ProjectError) StringifyPretty() string {\n\to.Hash()\n\treturn pjson.Stringify(o, true)\n}", "title": "" }, { "docid": "a36e51bed3a8104bd420bfa520371c57", "score": "0.50170374", "text": "func (p Privilege) PrettyPrint(wr io.Writer, detail prettyprint.DetailLevel) (err error) {\n\t_, err = wr.Write([]byte(p.String()))\n\treturn\n}", "title": "" }, { "docid": "91ebc4bc92c1eccdf734e8f598838a4a", "score": "0.50106615", "text": "func (e *EntryAttribute) PrettyPrint(indent int) {\n\tfmt.Printf(\"%s%s: %s\\n\", strings.Repeat(\" \", indent), e.Name, e.Values)\n}", "title": "" }, { "docid": "ff35a8445ac2d9fabbfc8db5dc33a439", "score": "0.49958867", "text": "func PrettyPrintStruct(v interface{}) error {\n\tb, e := json.MarshalIndent(v, \"\", \" \")\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tio.Copy(os.Stdout, bytes.NewReader(b))\n\n\treturn nil\n}", "title": "" }, { "docid": "489f71d262f5b19a07cda7bceaf1fd93", "score": "0.49945006", "text": "func prettyPrint(i interface{}) string {\n\ts, _ := json.MarshalIndent(i, \"\", \" \")\n\treturn string(s)\n}", "title": "" }, { "docid": "489f71d262f5b19a07cda7bceaf1fd93", "score": "0.49945006", "text": "func prettyPrint(i interface{}) string {\n\ts, _ := json.MarshalIndent(i, \"\", \" \")\n\treturn string(s)\n}", "title": "" }, { "docid": "851d23fb8132d9423db4b2373073cc67", "score": "0.49866936", "text": "func (c *Caller) Pretty(response *http.Response) string {\n\tbody, err := c.HTTPClient.ToString(response)\n\n\tif err != nil {\n\t\tbody = fmt.Sprintf(\"Error %s\", err.Error())\n\t}\n\n\tresponseCode := c.HTTPClient.GetStatusCode(response)\n\n\tvalue := \"\\n---\\n\"\n\n\tvalue = value + fmt.Sprintf(\n\t\t\"%s %d %s\\n\",\n\t\tBlue(response.Proto),\n\t\tBlue(responseCode),\n\t\tCyan(http.StatusText(responseCode)),\n\t)\n\n\tfor k, v := range response.Header {\n\t\tfor _, h := range v {\n\t\t\tvalue = value + fmt.Sprintf(\"%s: %s\\n\", Cyan(k), h)\n\t\t}\n\t}\n\n\tvalue = value + fmt.Sprintf(\"\\n%s\", Yellow(body))\n\n\treturn value\n}", "title": "" }, { "docid": "b7094f3e58598ee29f9168c11248c8f0", "score": "0.4983742", "text": "func (dnn *DeleteNalejNamespace) PrettyPrint(indentation int) string {\n\treturn strings.Repeat(\" \", indentation) + dnn.String()\n}", "title": "" }, { "docid": "c4f2672876ac7c17e1d910e21d7612f3", "score": "0.49836254", "text": "func (this *DeviceInfo) PrettyJSON() ([]byte, error) {\n\treturn json.MarshalIndent(this, MarshalPrefix, MarshalIndent)\n}", "title": "" }, { "docid": "cd0143734ec05f47755d365dd4ebf7ec", "score": "0.49775365", "text": "func PrettyPrint(conf interface{}, w io.Writer, logger logr.Logger) error {\n\tconfType := reflect.TypeOf(conf)\n\n\tconfTypePkgPath := confType.PkgPath()\n\n\tastLoader := loader.New([]string{confTypePkgPath}, logger)\n\tpackages, err := astLoader.Load()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to parse package %s\", confTypePkgPath)\n\t}\n\n\tpkg, found := filterPackage(confTypePkgPath, packages)\n\tif !found {\n\t\treturn errors.Errorf(\"package %s could not be found\", confTypePkgPath)\n\t}\n\tpkgType, found := filterType(confType.Name(), pkg)\n\tif !found {\n\t\treturn errors.Errorf(\"type %s.%s could not be found\", confTypePkgPath, confType.Name())\n\t}\n\n\tmarshalledConfig, err := json.Marshal(conf)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to marshal initial config to json\")\n\t}\n\n\tvar unmarshaledConfigToMap map[string]interface{}\n\tif err := json.Unmarshal(marshalledConfig, &unmarshaledConfigToMap); err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmarshal config to map\")\n\t}\n\n\tif err := zeroUnsetFields(unmarshaledConfigToMap, pkgType.Fields, packages); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to zero unset fields\")\n\t}\n\n\tmarshalledConfig, err = yaml.Marshal(unmarshaledConfigToMap)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to marshal initial config to yaml\")\n\t}\n\n\tvar unmarshalledDocumentNode yaml.Node\n\tif err := yaml.Unmarshal(marshalledConfig, &unmarshalledDocumentNode); err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmarshal initial config to yaml node\")\n\t}\n\n\tif unmarshalledDocumentNode.Kind != yaml.DocumentNode {\n\t\treturn errors.New(\"expected a single YAML document node\")\n\t}\n\n\tif len(unmarshalledDocumentNode.Content) > 1 {\n\t\treturn errors.New(\"should only have one YAML node in document\")\n\t}\n\n\tcurrentNode := unmarshalledDocumentNode.Content[0]\n\n\tif pkgType.Doc != \"\" {\n\t\tcurrentNode.HeadComment = pkgType.Doc + \"\\n\\n\"\n\t}\n\n\tif err := visitContentNodes(currentNode, pkgType, packages); err != nil {\n\t\treturn errors.Wrap(err,\"failed to visit all nodes\")\n\t}\n\n\tmarshalledConfig, err = yaml.Marshal(&unmarshalledDocumentNode)\n\tif err != nil {\n\t\treturn errors.Wrap(err,\"failed to marshal commented yaml node\")\n\t}\n\n\tfmt.Fprintln(w, string(marshalledConfig))\n\n\treturn nil\n}", "title": "" }, { "docid": "bd20c65cb296d134a1c265e897acabb7", "score": "0.49666893", "text": "func newPrettyParams(withdrawAddrEnabled json.RawMessage) PrettyParams {\n\treturn PrettyParams{\n\t\tWithdrawAddrEnabled: withdrawAddrEnabled,\n\t}\n}", "title": "" }, { "docid": "06fe0aa0c9176b7f62172e5f868ddf98", "score": "0.49665993", "text": "func Marshal(v interface{}, prefix string, indent string, escapeHTML bool) ([]byte, error) {\n\tbuf := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buf)\n\tencoder.SetIndent(prefix, indent)\n\tencoder.SetEscapeHTML(escapeHTML)\n\terr := encoder.Encode(v)\n\treturn buf.Bytes(), err\n}", "title": "" }, { "docid": "fa58c5ad22f589c4ac08224f22ae7959", "score": "0.4964284", "text": "func New() *PrettyPrinter {\n\treturn newPrettyPrinter(2) // PrettyPrinter.* => formatAll\n}", "title": "" }, { "docid": "6c2a99fae49ed41d6786db23323872dc", "score": "0.49634215", "text": "func (this *DeviceInfo) PrettyXML() ([]byte, error) {\n\treturn json.MarshalIndent(this, MarshalPrefix, MarshalIndent)\n}", "title": "" }, { "docid": "d376c9b8f40d7ec479f20cb403e27114", "score": "0.49589515", "text": "func PrettyJSON(str string, indent int) (string, error) {\n\tfmt.Println(indent)\n\tvar dat map[string]interface{}\n\tvar buf bytes.Buffer\n\terr := json.Unmarshal([]byte(str), &dat)\n\tif err != nil {\n\t\treturn str, err\n\t}\n\tprettify(reflect.ValueOf(dat), 0, &buf)\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "f0936b48ba40bc60401b65c394c48a2d", "score": "0.49561027", "text": "func Stringify(v interface{}, pretty ...bool) string {\n\tif len(pretty) > 0 && pretty[0] {\n\t\ts, _ := json.MarshalIndent(v, \"\", \" \")\n\t\treturn string(s)\n\t}\n\ts, _ := json.Marshal(v)\n\treturn string(s)\n}", "title": "" } ]
5b8c24102aa82b9bb206d48cde60d2a2
NormalLogProb computes the log probability of the location x for a Normal distribution the given mean and Cholesky decomposition of the covariance matrix. NormalLogProb panics if len(x) is not equal to len(mu), or if len(mu) != chol.Size(). This function saves time and memory if the Cholesky decomposition is already available. Otherwise, the NewNormal function should be used.
[ { "docid": "2dc999136b96b948fb4c8cd2e05ebac0", "score": "0.8237886", "text": "func NormalLogProb(x, mu []float64, chol *mat.Cholesky) float64 {\n\tdim := len(mu)\n\tif len(x) != dim {\n\t\tpanic(badSizeMismatch)\n\t}\n\tif chol.SymmetricDim() != dim {\n\t\tpanic(badSizeMismatch)\n\t}\n\tlogSqrtDet := 0.5 * chol.LogDet()\n\treturn normalLogProb(x, mu, chol, logSqrtDet)\n}", "title": "" } ]
[ { "docid": "3a8aee82e2b5d0cdb578c567e231230a", "score": "0.7231099", "text": "func (n *Normal) LogProb(x []float64) float64 {\n\tdim := n.dim\n\tif len(x) != dim {\n\t\tpanic(badSizeMismatch)\n\t}\n\treturn normalLogProb(x, n.mu, &n.chol, n.logSqrtDet)\n}", "title": "" }, { "docid": "ffad003f63bace935c8e1925d6b16bd9", "score": "0.68327546", "text": "func (l LogNormal) LogProb(x float64) float64 {\n\tif x < 0 {\n\t\treturn math.Inf(-1)\n\t}\n\tlogx := math.Log(x)\n\tnormdiff := (logx - l.Mu) / l.Sigma\n\treturn -0.5*normdiff*normdiff - logx - math.Log(l.Sigma) - logRoot2Pi\n}", "title": "" }, { "docid": "10b787f91a5a88aec7b61468eba63f4e", "score": "0.62257034", "text": "func (l Laplace) LogProb(x float64) float64 {\n\treturn -math.Ln2 - math.Log(l.Scale) - math.Abs(x-l.Mu)/l.Scale\n}", "title": "" }, { "docid": "99fe6687a8874bd0e46bb80daf28eaf6", "score": "0.61377096", "text": "func (w Weibull) LogProb(x float64) float64 {\n\tif x < 0 {\n\t\treturn 0\n\t} else {\n\t\treturn math.Log(w.K) - math.Log(w.Lambda) + (w.K-1)*(math.Log(x)-math.Log(w.Lambda)) - math.Pow(x/w.Lambda, w.K)\n\t}\n}", "title": "" }, { "docid": "d7d12574453e31981ef061eea0a5dea4", "score": "0.5961646", "text": "func (g InverseGamma) LogProb(x float64) float64 {\n\tif x <= 0 {\n\t\treturn math.Inf(-1)\n\t}\n\ta := g.Alpha\n\tb := g.Beta\n\tlg, _ := math.Lgamma(a)\n\treturn a*math.Log(b) - lg + (-a-1)*math.Log(x) - b/x\n}", "title": "" }, { "docid": "3fa6703654a88a59bb183b9685180783", "score": "0.5952222", "text": "func (a *Analyzer) LogProb(token string) (lp float64, ok bool) {\n\tlp, ok = a.UnigramProbabilityDistribution.LogProb(token)\n\treturn\n}", "title": "" }, { "docid": "8506dc96ac7697e9e45b00cdab4edd8f", "score": "0.5904557", "text": "func (b BetaBinomial) LogProb(x float64) float64 {\n\tif x < 0 || x > b.N || math.Floor(x) != x {\n\t\treturn math.Inf(-1)\n\t}\n\tlb := combin.LogGeneralizedBinomial(b.N, x)\n\treturn lb + mathext.Lbeta(x+b.Alpha, b.N-x+b.Beta) - mathext.Lbeta(b.Alpha, b.Beta)\n}", "title": "" }, { "docid": "03e87d5c11e1376a74534b0beca327f9", "score": "0.5903935", "text": "func (lnng LognormalGenerator) Lognormal(mean, stddev float64) float64 {\n\treturn math.Exp(mean + stddev*lnng.gauss.StdGaussian())\n}", "title": "" }, { "docid": "5b21d9941c445108de5702901d3d597c", "score": "0.57785183", "text": "func (l LogNormal) Prob(x float64) float64 {\n\treturn math.Exp(l.LogProb(x))\n}", "title": "" }, { "docid": "d746bd50caf63da62f46ab268ab7e696", "score": "0.5776403", "text": "func (s Stable) LogProb(x float64) float64 {\n\treturn 0\n}", "title": "" }, { "docid": "8f7bcf810fb304fda762b8a914663e1f", "score": "0.55647343", "text": "func (l LogNormal) Mean() float64 {\n\treturn math.Exp(l.Mu + 0.5*l.Sigma*l.Sigma)\n}", "title": "" }, { "docid": "161f3f6e50dc4076095170d1d194e921", "score": "0.5420969", "text": "func (n *Normal) Prob(x []float64) float64 {\n\treturn math.Exp(n.LogProb(x))\n}", "title": "" }, { "docid": "890d1afe5b54b2e21e193aa17f35f918", "score": "0.52262676", "text": "func NewNormalChol(mu []float64, chol *mat.Cholesky, src rand.Source) *Normal {\n\tdim := len(mu)\n\tif dim != chol.SymmetricDim() {\n\t\tpanic(badSizeMismatch)\n\t}\n\tn := &Normal{\n\t\tsrc: src,\n\t\trnd: rand.New(src),\n\t\tdim: dim,\n\t\tmu: make([]float64, dim),\n\t}\n\tn.chol.Clone(chol)\n\tcopy(n.mu, mu)\n\tn.logSqrtDet = 0.5 * n.chol.LogDet()\n\treturn n\n}", "title": "" }, { "docid": "892899ec990e472f27944fd75b33670d", "score": "0.51372135", "text": "func logPoisson(λ, k float64) float64 {\n\tlg, _ := math.Lgamma(k + 1)\n\treturn k*math.Log(λ) - λ - lg\n}", "title": "" }, { "docid": "aee7a152e2aa0c2ca6c6d9cf9538cd0b", "score": "0.5092781", "text": "func (l LogNormal) Entropy() float64 {\n\treturn 0.5 + 0.5*math.Log(2*math.Pi*l.Sigma*l.Sigma) + l.Mu\n}", "title": "" }, { "docid": "4845be02bce18803dfaf64207314a062", "score": "0.5026651", "text": "func NewLognormalGenerator(seed int64) *LognormalGenerator {\n\tgrng := NewGaussianGenerator(seed)\n\treturn &LognormalGenerator{grng}\n}", "title": "" }, { "docid": "14cfa0c4f977d5793485720c5d5f364d", "score": "0.5001969", "text": "func (l Laplace) Prob(x float64) float64 {\n\treturn math.Exp(l.LogProb(x))\n}", "title": "" }, { "docid": "1c2dc110a9a5a8aa386854894b077637", "score": "0.49803558", "text": "func NewNormal(mu []float64, sigma mat.Symmetric, src rand.Source) (*Normal, bool) {\n\tif len(mu) == 0 {\n\t\tpanic(badZeroDimension)\n\t}\n\tdim := sigma.SymmetricDim()\n\tif dim != len(mu) {\n\t\tpanic(badSizeMismatch)\n\t}\n\tn := &Normal{\n\t\tsrc: src,\n\t\trnd: rand.New(src),\n\t\tdim: dim,\n\t\tmu: make([]float64, dim),\n\t}\n\tcopy(n.mu, mu)\n\tok := n.chol.Factorize(sigma)\n\tif !ok {\n\t\treturn nil, false\n\t}\n\tn.sigma = *mat.NewSymDense(dim, nil)\n\tn.sigma.CopySym(sigma)\n\tn.logSqrtDet = 0.5 * n.chol.LogDet()\n\treturn n, true\n}", "title": "" }, { "docid": "11873b3c451e9be58c02385fadf6ae60", "score": "0.49019742", "text": "func (l LogNormal) CDF(x float64) float64 {\n\treturn 0.5 * math.Erfc(-(math.Log(x)-l.Mu)/(math.Sqrt2*l.Sigma))\n}", "title": "" }, { "docid": "580133fb7f1997ccd0c7ba15524ab33c", "score": "0.4892916", "text": "func (CrossEntropy) DistNormal(l, r *Normal) float64 {\n\tif l.Dim() != r.Dim() {\n\t\tpanic(badSizeMismatch)\n\t}\n\tkl := KullbackLeibler{}.DistNormal(l, r)\n\treturn kl + l.Entropy()\n}", "title": "" }, { "docid": "dced2d9d2288c503c4ce45ff38ce2362", "score": "0.48417023", "text": "func (l LogNormal) StdDev() float64 {\n\treturn math.Sqrt(l.Variance())\n}", "title": "" }, { "docid": "b999f4ccbe30a25669b0eead990d9f9d", "score": "0.47402298", "text": "func NormalRand(x, mean []float64, chol *mat.Cholesky, src rand.Source) []float64 {\n\tx = reuseAs(x, len(mean))\n\tif len(mean) != chol.SymmetricDim() {\n\t\tpanic(badInputLength)\n\t}\n\tif src == nil {\n\t\tfor i := range x {\n\t\t\tx[i] = rand.NormFloat64()\n\t\t}\n\t} else {\n\t\trnd := rand.New(src)\n\t\tfor i := range x {\n\t\t\tx[i] = rnd.NormFloat64()\n\t\t}\n\t}\n\ttransformNormal(x, x, mean, chol)\n\treturn x\n}", "title": "" }, { "docid": "ed511b125b13006e4fdafce2b21ca0f4", "score": "0.47243753", "text": "func (w Weibull) Prob(x float64) float64 {\n\tif x < 0 {\n\t\treturn 0\n\t} else {\n\t\treturn math.Exp(w.LogProb(x))\n\t}\n}", "title": "" }, { "docid": "13437340e273525b3e02c5d3f7b28fde", "score": "0.46828237", "text": "func (l LogNormal) Rand() float64 {\n\tvar rnd float64\n\tif l.Src == nil {\n\t\trnd = rand.NormFloat64()\n\t} else {\n\t\trnd = rand.New(l.Src).NormFloat64()\n\t}\n\treturn math.Exp(rnd*l.Sigma + l.Mu)\n}", "title": "" }, { "docid": "653d4ded42ce33a23321c7dbc1fd96d4", "score": "0.46796522", "text": "func (w Weibull) LogCDF(x float64) complex128 {\n\tif x < 0 {\n\t\treturn 0\n\t} else {\n\t\treturn cmplx.Log(-1) + complex(-math.Pow(x/w.Lambda, w.K), 0)\n\t}\n}", "title": "" }, { "docid": "5b0a295547cf88f4f677b6c4f10eb947", "score": "0.4670205", "text": "func (g InverseGamma) Prob(x float64) float64 {\n\treturn math.Exp(g.LogProb(x))\n}", "title": "" }, { "docid": "b158cf47e7a583448527128890f76ed5", "score": "0.46225503", "text": "func (l Laplace) DLogProbDX(x float64) float64 {\n\tdiff := x - l.Mu\n\tif diff == 0 {\n\t\treturn 0\n\t}\n\tif diff > 0 {\n\t\treturn -1 / l.Scale\n\t}\n\treturn 1 / l.Scale\n}", "title": "" }, { "docid": "0b515bdac05529f340d7429a6b89f6a9", "score": "0.44301412", "text": "func (ph *PHReg) LogLike(param statmodel.Parameter, exact bool) float64 {\n\n\tcoeff := param.GetCoeff()\n\n\tll := ph.breslowLogLike(coeff)\n\n\t// Account for L2 weights if present.\n\tif len(ph.l2wgt) > 0 {\n\t\tfor j, x := range coeff {\n\t\t\tll -= ph.l2wgt[j] * x * x\n\t\t}\n\t}\n\n\treturn ll\n}", "title": "" }, { "docid": "dc9dec277370ae349294eeb839199659", "score": "0.44123602", "text": "func (l *Lista) VarLog(valoresX []float64) float64{\n\tsum := 0.0\n\tavg := l.AvgLog(valoresX)\n\tfor index, _ := range valoresX{\n\t\tsum = sum + math.Pow((math.Log(valoresX[index]) - avg), 2)\n\t}///...FinFor\n\treturn sum/(l.Cantidad -1)\n}", "title": "" }, { "docid": "50e92aea98407d3a3cebccd6add744aa", "score": "0.43835527", "text": "func (b BetaBinomial) Prob(x float64) float64 {\n\treturn math.Exp(b.LogProb(x))\n}", "title": "" }, { "docid": "07750cdf70dcc7133ad23a056815e372", "score": "0.43597758", "text": "func (Hellinger) DistNormal(l, r *Normal) float64 {\n\tif l.Dim() != r.Dim() {\n\t\tpanic(badSizeMismatch)\n\t}\n\tdb := Bhattacharyya{}.DistNormal(l, r)\n\tbc := math.Exp(-db)\n\treturn math.Sqrt(1 - bc)\n}", "title": "" }, { "docid": "1094acdf0a01fd17d8fa5dbb313fda66", "score": "0.43311152", "text": "func (nb *NegBinomProfiler) LogLike(disp float64) float64 {\n\n\tmodel := nb.results.Model().(*GLM)\n\n\tmodel.dispersionMethod = DispersionFixed\n\tmodel.dispersionValue = 1\n\n\tlink := NewLink(LogLink)\n\tmodel.fam = NewNegBinomFamily(disp, link)\n\tcopy(model.start, nb.params)\n\tresult := model.Fit()\n\n\treturn result.LogLike()\n}", "title": "" }, { "docid": "697cb3cdc60dc38f1d22e1fa8733f27c", "score": "0.43252432", "text": "func NewNormalPrecision(mu []float64, prec *mat.SymDense, src rand.Source) (norm *Normal, ok bool) {\n\tif len(mu) == 0 {\n\t\tpanic(badZeroDimension)\n\t}\n\tdim := prec.SymmetricDim()\n\tif dim != len(mu) {\n\t\tpanic(badSizeMismatch)\n\t}\n\t// TODO(btracey): Computing a matrix inverse is generally numerically unstable.\n\t// This only has to compute the inverse of a positive definite matrix, which\n\t// is much better, but this still loses precision. It is worth considering if\n\t// instead the precision matrix should be stored explicitly and used instead\n\t// of the Cholesky decomposition of the covariance matrix where appropriate.\n\tvar chol mat.Cholesky\n\tok = chol.Factorize(prec)\n\tif !ok {\n\t\treturn nil, false\n\t}\n\tvar sigma mat.SymDense\n\terr := chol.InverseTo(&sigma)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\treturn NewNormal(mu, &sigma, src)\n}", "title": "" }, { "docid": "a9fed4bfb5c19593bed87b46df65bc9f", "score": "0.43250674", "text": "func (w Weibull) DLogProbDX(x float64) float64 {\n\tif x > 0 {\n\t\treturn (-w.K*math.Pow(x/w.Lambda, w.K) + w.K - 1) / x\n\t}\n\tif x < 0 {\n\t\treturn 0\n\t}\n\treturn math.NaN()\n}", "title": "" }, { "docid": "02912fd5afa2f4c762f58353974c515a", "score": "0.43007213", "text": "func Logistic(x, gain, off float32) float32 {\n\treturn 1.0 / (1.0 + mat32.FastExp(-gain*(x-off)))\n}", "title": "" }, { "docid": "0eb99057b6d47bb3262c13aac722cf95", "score": "0.42880172", "text": "func vectorisedNormalDistributionPDF(x []float64, mean []float64, stddev float64) float64 {\n\tdiff := subArray(x, mean)\n\tpower := -(dotArray(diff, diff) / (2 * stddev * stddev))\n\tnorm := 1 / math.Sqrt(2*stddev*stddev*math.Pi)\n\n\treturn norm * math.Pow(math.E, power)\n}", "title": "" }, { "docid": "cf0e32255c46691817001e2539cf73a0", "score": "0.42766815", "text": "func NormalCdf(x float64) float64 {\n\t// If X ~ N(0,1), returns P(X < x).\n\treturn math.Erfc(-x/math.Sqrt2) / 2.0\n}", "title": "" }, { "docid": "3af7c3906fdb641626d6d2ac03ea9925", "score": "0.4252291", "text": "func Norm(p Vec) float64 {\n\treturn math.Hypot(p.X, math.Hypot(p.Y, p.Z))\n}", "title": "" }, { "docid": "711c2e12e255ed5873a87efd9ce8592e", "score": "0.42447206", "text": "func Log(x float64) float64 {}", "title": "" }, { "docid": "6a9a3332727cc48193d517f47852bd73", "score": "0.42114994", "text": "func (m LikelihoodGP) NegativeLikelihood(hyper []float64) float64 {\n\t// The marginal likelihood is.\n\t// log[p(y|x,theta)] =\n\t// -1/2 y^T * K_y^-1 * y - 1/2*log |K_y| - n/2 * log(2*pi)\n\t// which is the same thing as the log probability of the y vector for a\n\t// normal distribution with mean 0 and covariance K_y.\n\n\tr, _ := m.X.Dims()\n\tif r != len(m.Y) {\n\t\tpanic(dataLengthMismatch)\n\t}\n\tker := kernel.LogKernelWrapper{\n\t\tHyper: hyper,\n\t\tLogKerneler: m.Kernel,\n\t}\n\tky := kernelMatrixSym(nil, m.X, m.MeanX, m.StdX, ker, m.Noise)\n\tmu := make([]float64, r)\n\tnorm, ok := distmv.NewNormal(mu, ky, nil)\n\tif !ok {\n\t\tfmt.Println(\"not pos def\")\n\t\treturn math.Inf(1)\n\t}\n\n\tyScale := scaleY(nil, m.Y, m.MeanY, m.StdY)\n\tlikeNorm := norm.LogProb(yScale)\n\treturn -likeNorm\n}", "title": "" }, { "docid": "9cca312fb0bfae0280db15875d19f594", "score": "0.42076668", "text": "func NormalCDF(x float64) float64 {\n\treturn CDF(x, 0, 1)\n}", "title": "" }, { "docid": "00f1de94f7f721e1dd2c41443326d6ed", "score": "0.4205484", "text": "func GetSampleLog_normalized(mult []float64) (idx int) {\n //sample random number in [0:1] and normalize dist\n i := rand.Float64()\n //find corresponding topic\n// fmt.Println(i)\n sum := 0.0\n for top,val := range(mult) {\n sum += math.Exp(val)\n if sum > i {\n return top\n }\n }\n return -1\n}", "title": "" }, { "docid": "04416507f2f1a5d4a93d9ab64596c1e0", "score": "0.4195925", "text": "func MvLgamma(v float64, dim int) float64 {\n\tif dim < 1 {\n\t\tpanic(\"mathext: negative dimension\")\n\t}\n\tdf := float64(dim)\n\tif v < (df-1)*0.5 {\n\t\treturn math.NaN()\n\t}\n\tans := df * (df - 1) * 0.25 * logPi\n\tfor i := 1; i <= dim; i++ {\n\t\tlg, _ := math.Lgamma(v + float64(1-i)*0.5)\n\t\tans += lg\n\t}\n\treturn ans\n}", "title": "" }, { "docid": "51dfbb072c133e24a092b0c7d4c02fbb", "score": "0.4161554", "text": "func normalRand(mu, sigma float64) float64 {\n z := math.Sqrt(-2.0 * math.Log(rand.Float64())) * math.Sin(2.0 * math.Pi * rand.Float64())\n return sigma*z + mu\n}", "title": "" }, { "docid": "69e1a26b635415f45c71934c2a9ac1f1", "score": "0.41202182", "text": "func (l LogNormal) Variance() float64 {\n\ts2 := l.Sigma * l.Sigma\n\treturn (math.Exp(s2) - 1) * math.Exp(2*l.Mu+s2)\n}", "title": "" }, { "docid": "0fc359e576d71c211f78c2eabd888f7f", "score": "0.4099296", "text": "func NormalPdf(x float64) float64 {\n\treturn math.Exp(-x*x/2.0) / (math.Sqrt2 * math.SqrtPi)\n}", "title": "" }, { "docid": "eb1df11e11a6ff39738a60d1587480f3", "score": "0.4091908", "text": "func MultiVariateNormalRandom(mu *mat64.Dense, sigma *mat64.SymDense) (rndsmp *mat64.Dense) {\n\n\t// initialize vector slices\n\to := make([]float64, 2)\n\tn := make([]float64, 2)\n\n\t// generate random numbers from normal distribution, prohibit [0,0]\n\t// combinations\n\trand.Seed(time.Now().UnixNano())\n\n\t// enter loop\n\tfor i := 0; i < 2; i++ {\n\t\tn[i] = rand.NormFloat64()\n\t}\n\n\t// convert to matrix type\n\trnd := mat64.NewDense(2, 1, n)\n\toutput := mat64.NewDense(2, 1, o)\n\n\t// initialize matrix variables for cholesky decomposition\n\tvar c mat64.Cholesky\n\tvar L mat64.TriDense\n\n\t// perform cholesky decomposition on covariance matrix\n\tlower := mat64.NewSymDense(2, nil)\n\tc.Factorize(sigma)\n\tL.LFromCholesky(&c)\n\n\t// write cholesky factorization results to output receiver\n\tlower.SetSym(0, 0, L.At(0, 0))\n\tlower.SetSym(1, 1, L.At(1, 1))\n\n\t// compute output\n\toutput.Mul(lower, rnd)\n\toutput.Add(output, mu)\n\n\t//return final output\n\treturn output\n}", "title": "" }, { "docid": "2087e834f87870bcaeda48c33918beb4", "score": "0.40187457", "text": "func TestLogOddsProbability(t *testing.T) {\n\tl := NewLogOdds()\n\tt.Logf(\"\\nLogOdds: %f\\nProbability: %f\\n\", l, l.Probability())\n\tassert.InEpsilon(t, initProbability, NewLogOdds().Probability(), 0.01)\n}", "title": "" }, { "docid": "9f1211f572386cf90ce691a6fe379160", "score": "0.40155092", "text": "func (ps *ScaleProfiler) LogLike(scale float64) float64 {\n\n\tmodel := ps.results.Model().(*GLM)\n\tmodel.dispersionMethod = DispersionFixed\n\n\tmodel.dispersionValue = scale\n\tcopy(model.start, ps.params)\n\tresult := model.Fit()\n\treturn result.LogLike()\n}", "title": "" }, { "docid": "2bfe36fa83087cd32c69b876e39b1488", "score": "0.40088302", "text": "func LnPoch(a, x float64) (r float64) {\n\tr = float64(C.gsl_sf_lnpoch(C.double(a), C.double(x)))\n\treturn\n}", "title": "" }, { "docid": "ad1195cdabc580590374bebc5e4c7721", "score": "0.3997688", "text": "func Log(x Tensor) (y Tensor) {\n\ty = NewLike(x)\n\n\tfor i := range x.Data {\n\t\ty.Data[i] = math.Log(x.Data[i])\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3f5cabec05f90a6c5f78e2b95ca279cd", "score": "0.39869288", "text": "func GetSampleLog(mult []float64) (idx int) {\n _,b := FindMax(mult)\n z := expSum(mult,b)\n //sample random number in [0:1] and normalize dist\n i := rand.Float64()\n //find corresponding topic\n sum := 0.0\n for top,val := range(mult) {\n norm := ExpNormalize(val, b, z)\n sum += norm\n if sum > i {\n return top\n }\n }\n return -1\n}", "title": "" }, { "docid": "6c29aea2e4c6bc01b9bfc03e0dd9bdcb", "score": "0.3945825", "text": "func NewLogHist(b int, m float64, max float64) *LogHist {\n\t// TODO(austin) Minimum value as well? If the samples are\n\t// actually integral, having fractional bin boundaries can\n\t// mess up smoothing.\n\tmOverLogb := m / math.Log(float64(b))\n\tnbins := int(math.Ceil(mOverLogb * math.Log(max)))\n\treturn &LogHist{b: b, m: m, mOverLogb: mOverLogb, low: 0, high: 0, bins: make([]uint, nbins)}\n}", "title": "" }, { "docid": "53cfa763b234c844dba0ad41515d9951", "score": "0.39201388", "text": "func GammaLnCDF(α float64, θ float64) func(x float64) float64 {\n\treturn func(x float64) float64 {\n\t\tif isNaN(x) || isNaN(α) || isNaN(θ) {\n\t\t\treturn x + α + θ\n\t\t}\n\t\tif α < 0. || θ <= 0. {\n\t\t\treturn NaN\n\t\t}\n\t\tif x == 0 {\n\t\t\treturn negInf\n\t\t}\n\t\tx /= θ\n\t\tif isNaN(x) { // eg. original x = θ = +Inf \n\t\t\treturn x\n\t\t}\n\t\tif α == 0 { // limit case; useful e.g. in pnchisq()\n\t\t\tif x <= 0 {\n\t\t\t\treturn negInf\n\t\t\t} else {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t}\n\t\treturn pgamma_raw_ln(x, α)\n\t}\n}", "title": "" }, { "docid": "43a3200c01ff1784602bb52a14359923", "score": "0.39199647", "text": "func (a *Analyzer) LogProbTextGivenPrevious(token string, previous string) (lp float64, ok bool) {\n\tkey := previous + \" \" + token\n\tlp, ok = a.BigramProbabilityDistribution.LogProb(key)\n\tif ok {\n\t\treturn\n\t}\n\tlp, ok = a.UnigramProbabilityDistribution.LogProb(token)\n\treturn\n}", "title": "" }, { "docid": "5e6bb67dd0a489263c01010646441f9f", "score": "0.3918972", "text": "func GammaLnPDF(α float64, θ float64) func(x float64) float64 {\n\treturn func(x float64) float64 {\n\t\tvar pr float64\n\t\tif isNaN(x) || isNaN(α) || isNaN(θ) {\n\t\t\treturn x + α + θ\n\t\t}\n\t\tif α < 0 || θ <= 0 {\n\t\t\treturn NaN\n\t\t}\n\t\tif x < 0 {\n\t\t\treturn negInf\n\t\t}\n\t\tif α == 0 {\n\t\t\tif x == 0 {\n\t\t\t\treturn posInf\n\t\t\t} else {\n\t\t\t\treturn negInf\n\t\t\t}\n\t\t}\n\t\tif x == 0 {\n\t\t\tif α < 1 {\n\t\t\t\treturn posInf\n\t\t\t}\n\t\t\tif α > 1 {\n\t\t\t\treturn negInf\n\t\t\t}\n\t\t\t// else\n\t\t\treturn -log(θ)\n\t\t}\n\n\t\tif α < 1 {\n\t\t\tpr = dpois_raw_ln(α, x/θ)\n\t\t\treturn pr + log(α/x)\n\t\t}\n\t\t// else α >= 1\n\t\tpr = dpois_raw_ln(α-1, x/θ)\n\t\treturn pr - log(θ)\n\t}\n}", "title": "" }, { "docid": "bd5432d220a66a37e1fc445327227922", "score": "0.3906603", "text": "func (l *Lista) AvgLog(valoresX []float64) float64{\n\treturn l.sumLog(valoresX) / l.Cantidad\n}", "title": "" }, { "docid": "af3c05cc70a822423f965fa0c60a601a", "score": "0.38764232", "text": "func ProvePartialECDLogKnowledge(dlog *dlog.ECDLog, secret1 *big.Int,\n\ta1, a2, b2 *types.ECGroupElement) bool {\n\tprover := NewPartialECDLogProver(dlog)\n\tverifier := NewPartialECDLogVerifier(dlog)\n\n\tb1X, b1Y := prover.DLog.Exponentiate(a1.X, a1.Y, secret1)\n\tb1 := types.NewECGroupElement(b1X, b1Y)\n\ttriple1, triple2 := prover.GetProofRandomData(secret1, a1, b1, a2, b2)\n\n\tverifier.SetProofRandomData(triple1, triple2)\n\tchallenge := verifier.GetChallenge()\n\n\tc1, z1, c2, z2 := prover.GetProofData(challenge)\n\tverified := verifier.Verify(c1, z1, c2, z2)\n\n\treturn verified\n}", "title": "" }, { "docid": "67f4e08f8c98dc625aba162ba4fe5cf6", "score": "0.3871135", "text": "func (n *Normal) Entropy() float64 {\n\treturn float64(n.dim)/2*(1+logTwoPi) + n.logSqrtDet\n}", "title": "" }, { "docid": "afbb2cd4044d8ea133e47633b0b34441", "score": "0.38666016", "text": "func (m LikelihoodGP) Normalize() {\n\tmeanX, stdX := MeanStdMat(m.X)\n\tm.MeanX = meanX\n\tm.StdX = stdX\n\tmeanY, stdY := stat.MeanStdDev(m.Y, nil)\n\tm.MeanY = meanY\n\tm.StdY = stdY\n}", "title": "" }, { "docid": "71d0d0d07ffc1e4199759c3f09b3edf8", "score": "0.3863325", "text": "func (l *Line) NormalX() float64 {\n\treturn NormalX(l)\n}", "title": "" }, { "docid": "e82d4d405e2c40ee8367cdf547e627ae", "score": "0.3860903", "text": "func Norm(a []float32, minStdDev float32) {\n\tmean, stddev, err := MeanAndStdDev(a)\n\tif err != nil {\n\t\treturn\n\t}\n\t// Normalize the data to a mean of 0 and standard deviation of 1.0.\n\tfor i, x := range a {\n\t\tif x != MissingDataSentinel {\n\t\t\tnewX := x - mean\n\t\t\tif stddev > minStdDev {\n\t\t\t\tnewX = newX / stddev\n\t\t\t}\n\t\t\ta[i] = newX\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1bc42a250c2af7376d1a9be462571cb9", "score": "0.38586277", "text": "func Log(x float32) float32 {\n\treturn float32(math.Log(float64(x)))\n}", "title": "" }, { "docid": "d7837d60cfb5c46b5547ada8d97eb0c6", "score": "0.38171887", "text": "func PowerHist(power float64, input []float64) Histogram {\n\tif len(input) == 0 || power <= 0 {\n\t\treturn Histogram{}\n\t}\n\n\tminx, maxx := input[0], input[0]\n\tfor _, val := range input {\n\t\tminx = math.Min(minx, val)\n\t\tmaxx = math.Max(maxx, val)\n\t}\n\n\tfromPower := math.Floor(logbase(minx, power))\n\ttoPower := math.Floor(logbase(maxx, power))\n\n\tbuckets := make([]Bucket, int(toPower-fromPower)+1)\n\tfor i, bkt := range buckets {\n\t\tbkt.Min = math.Pow(power, float64(i)+fromPower)\n\t\tbkt.Max = math.Pow(power, float64(i+1)+fromPower)\n\t\tbuckets[i] = bkt\n\t}\n\n\tminC := 0\n\tmaxC := 0\n\tfor _, val := range input {\n\t\tpowAway := logbase(val, power) - fromPower\n\t\tbi := int(math.Floor(powAway))\n\t\tbuckets[bi].Count++\n\t\tminC = imin(buckets[bi].Count, minC)\n\t\tmaxC = imax(buckets[bi].Count, maxC)\n\t}\n\n\treturn Histogram{\n\t\tMin: minC,\n\t\tMax: maxC,\n\t\tCount: len(input),\n\t\tBuckets: buckets,\n\t}\n}", "title": "" }, { "docid": "dc05846a8220889c629f3808dfb06075", "score": "0.3809652", "text": "func ShannonPropertyEntropy(col MsaColumn, simMatrix SimilarityMatrix, bgDistr []float64, seqWeights []float64) float64 {\n\tpropertyPartition := [][]Aa{{'A','V','L','I','M','C'}, {'F','W','Y','H'}, {'S','T','N','Q'}, {'K','R'}, {'D', 'E'}, {'G', 'P'}, {'-'}}\n\twfc := GetWeightedFrequencyCount(col, seqWeights, Pseudocount)\n\n\t// sum AA frequencies -> property frequencies\n\tpropertyWfc := make([]float64, len(propertyPartition))\n\tfor p := range propertyWfc {\n\t\tfor _, aa := range propertyPartition[p] {\n\t\t\tpropertyWfc[p] += wfc[AaToIndex[aa]]\n\t\t}\n\t}\n\n\th := 0.0\n\tfor _, c := range propertyWfc {\n\t\th += c * math.Log(c)\n\t}\n\th /= math.Log(math.Min(float64(len(propertyWfc)), float64(len(col))))\n\th *= -1\n\n\tscore := 1 - h\n\tif UseGapPenalty {\n\t\treturn score * GetWeightedGapPenalty(col, seqWeights)\n\t}\n\treturn score\n}", "title": "" }, { "docid": "0dbc1b9edb59da15a79b3a31b1772281", "score": "0.37872466", "text": "func norm(v Point) float64 { return math.Sqrt(dot(v, v)) }", "title": "" }, { "docid": "943b6daf242b56782c5a55dccb37d166", "score": "0.37759015", "text": "func GetSampleLog_gen(generator *rand.Rand, mult []float64) (idx int) {\n _,b := FindMax(mult)\n z := expSum(mult,b)\n //sample random number in [0:1] and normalize dist\n i := generator.Float64()\n //find corresponding topic\n sum := 0.0\n for top,val := range(mult) {\n norm := ExpNormalize(val, b, z)\n sum += norm\n if sum > i {\n return top\n }\n }\n return -1\n}", "title": "" }, { "docid": "c894007f9c98558e936a0417a44a4d7a", "score": "0.37611088", "text": "func (v *Vector) Norm(L float64) float64 {\n\tif L == 2 {\n\t\treturn math.Sqrt(floats.Dot(v.data, v.data))\n\t}\n\treturn floats.Norm(v.data, L)\n}", "title": "" }, { "docid": "ea9d47d4fe9bd48f1ff41620a795f363", "score": "0.3746735", "text": "func BinaryClassifierTrainer_L1Logistic_PrimalSGD(X FeatureVectors, Y []bool, C, epsilon float32, debug *log.Logger) (*BinaryClassifier, error) {\n\trng := rand.New(rand.NewSource(0))\n\t// lambda is the penalty parameter.\n\tlambda := 1.0 / C\n\t// n is the number of data points, and d is the dimension of a feature vector.\n\tn, d := len(X), X.Dim()\n\t// $\\alpha$ and $\\beta$ is the hyper parameter for the learning rate.\n\talpha, beta := float32(1.0), float32(1.0)\n\t// bias and weight is the classifier parameters.\n\tbias, weight := float32(0.0), make([]float32, d)\n\t// m, gSqSum is the auxiliary vectors and the sum of the squared sum of the gradients for the classifier parameters.\n\t// The first d elements are for weight, and the (d+1)-th element is for bias.\n\tm, gSqSum := make([]float32, d+1), make([]float32, d+1)\n\t// perm is the data point index slice for providing the random order at each round.\n\tperm := make([]int, n)\n\tfor i := range perm {\n\t\tperm[i] = i\n\t}\n\t// t is the iteration number.\n\tt := 1\n\t// lossPenalty0 is the previous (loss+penalty).\n\tlossPenalty0 := Inf32(+1.0)\n\t// Repeat at most 100 epochs, because they are enough epochs for (loss+penalty) to converge.\n\tfor epoch := 0; epoch < 100; epoch++ {\n\t\t// Permutate the data points.\n\t\tfor i := 0; i < n-1; i++ {\n\t\t\tj := i + rng.Intn(n-i)\n\t\t\tperm[i], perm[j] = perm[j], perm[i]\n\t\t}\n\t\t// loss is the current loss.\n\t\tloss := float32(0.0)\n\t\tfor _, i := range perm {\n\t\t\t// $\\bm{x}_i$ is the current data point.\n\t\t\txi := X[i]\n\t\t\t// $z_i = \\bm{w}^\\top\\bm{x}_i$ is the linear predictor for $\\bm{x}_i$.\n\t\t\tzi := bias * 1.0\n\t\t\tfor _, xipair := range xi {\n\t\t\t\tif mj := m[xipair.Key]; Abs32(mj) > lambda {\n\t\t\t\t\tsignMj := float32(-1.0)\n\t\t\t\t\tif mj > 0.0 {\n\t\t\t\t\t\tsignMj = +1.0\n\t\t\t\t\t}\n\t\t\t\t\twj := (alpha / (beta + Sqrt32(gSqSum[xipair.Key]))) * (mj - signMj*lambda)\n\t\t\t\t\tweight[xipair.Key] = wj\n\t\t\t\t\tzi += wj * xipair.Value\n\t\t\t\t} else {\n\t\t\t\t\tweight[xipair.Key] = 0.0\n\t\t\t\t}\n\t\t\t}\n\t\t\t// $p_i = 1/(1 + exp(-z_i))$ is the predicted probability for $\\bm{x}_i$.\n\t\t\tpi := 1.0 / (1.0 + Exp32(-zi))\n\t\t\t// $y_i$ is the received correct class.\n\t\t\tyi := float32(0.0)\n\t\t\tif Y[i] {\n\t\t\t\tyi = +1.0\n\t\t\t}\n\t\t\t// Calculate the $l_i = -y_i\\log(p_i) - (1 - y_i)\\log(1 - p_i)$.\n\t\t\tif Y[i] {\n\t\t\t\tx := float32(0.0)\n\t\t\t\tif x < -zi {\n\t\t\t\t\tx = -zi\n\t\t\t\t}\n\t\t\t\tloss += x + Log32(Exp32(0-x)+Exp32(-zi-x))\n\t\t\t} else {\n\t\t\t\tx := float32(0.0)\n\t\t\t\tif x < zi {\n\t\t\t\t\tx = zi\n\t\t\t\t}\n\t\t\t\tloss += x + Log32(Exp32(0-x)+Exp32(zi-x))\n\t\t\t}\n\t\t\t// gBias is the gradient for the bias.\n\t\t\tgBias := -(yi - pi) * 1.0\n\t\t\t// Update the bias and the squared sum of the gradients for the bias.\n\t\t\tbias -= (alpha / (beta + Sqrt32(gSqSum[d]))) * gBias * 1.0\n\t\t\tgSqSum[d] += gBias * gBias\n\t\t\tfor _, xipair := range xi {\n\t\t\t\t// gj is the gradient for the weight parameter.\n\t\t\t\tgj := -(yi - pi) * xipair.Value\n\t\t\t\t// Update the auxiliary vector and the squared sum of the gradient for the weight vector.\n\t\t\t\tgSqSumj := gSqSum[xipair.Key] + gj*gj\n\t\t\t\tsigmaj := (Sqrt32(gSqSumj) - Sqrt32(gSqSum[xipair.Key])) / alpha\n\t\t\t\tm[xipair.Key] += sigmaj*weight[xipair.Key] - gj\n\t\t\t\tgSqSum[xipair.Key] = gSqSumj\n\t\t\t}\n\t\t\tt++\n\t\t}\n\t\t// Calculate the penalty term.\n\t\tpenalty := float32(0.0)\n\t\tfor _, wfeature := range weight {\n\t\t\tpenalty += Abs32(wfeature)\n\t\t}\n\t\tpenalty *= lambda\n\t\tif debug != nil {\n\t\t\tdebug.Printf(\"BinaryClassifierTrainer(L1Logistic_PrimalSGD): epoch=%d: lambda=%g, penalty=%g, loss=%g, penalty+loss=%g\", epoch, lambda, penalty, loss, penalty+loss)\n\t\t}\n\t\t// Terminate if the relative difference between the previous (loss+penalty) and (loss+penalty) is below epsilon.\n\t\tlossPenalty := loss + penalty\n\t\tif !IsInf32(lossPenalty0, +1.0) && (lossPenalty0-lossPenalty)/lossPenalty0 < epsilon {\n\t\t\tbreak\n\t\t}\n\t\tlossPenalty0 = lossPenalty\n\t}\n\treturn &BinaryClassifier{\n\t\tBias: bias,\n\t\tWeight: SparsifyVector(weight),\n\t}, nil\n}", "title": "" }, { "docid": "a67c52a0aec31c85e672855c9c5e8cea", "score": "0.3744038", "text": "func (v Vec3) Normal() Vec3 {\n\treturn v.DivScalar(v.Length())\n}", "title": "" }, { "docid": "c06fa9b77d8d84e67349f5fdaa2163a2", "score": "0.3741054", "text": "func NaturalLog(x float64, a int) float64 {\n\thalfOfNaturalLogValue := (x - 1) / (x + 1)\n\tn := 3.0\n\tfor i := 0; i < a; i++ {\n\t\thalfOfNaturalLogValue += (1 / n) * ToThePowerFloat(halfOfNaturalLogValue, n)\n\t\tn += 2\n\t}\n\treturn 2 * halfOfNaturalLogValue\n}", "title": "" }, { "docid": "f7d9538eedd368409680246ca6c9cef0", "score": "0.37359223", "text": "func norm(x []float64, pow float64) float64 {\n\ts := 0.0\n\n\tfor _, v := range x {\n\t\ts += math.Pow(v, pow)\n\t}\n\n\treturn math.Pow(s, 1/pow)\n}", "title": "" }, { "docid": "8963477457ba30790375f5330df9ff9f", "score": "0.37303555", "text": "func (m *ItemItemsItemWorkbookFunctionsRequestBuilder) LogNorm_Dist()(*ItemItemsItemWorkbookFunctionsLogNorm_DistRequestBuilder) {\n return NewItemItemsItemWorkbookFunctionsLogNorm_DistRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "cf685bf11f9ea3d6de119f4416a0efc2", "score": "0.37225616", "text": "func NewProb(fstr string) (Prob, error) {\n\tif fstr == \"*\" {\n\t\treturn MinProb, nil\n\t}\n\n\tf, err := strconv.ParseFloat(fstr, 64)\n\tif err != nil {\n\t\treturn invalidProb,\n\t\t\tfmt.Errorf(\"Could not convert '%s' to a log probability: %s\",\n\t\t\t\tfstr, err)\n\t}\n\treturn Prob(f), nil\n}", "title": "" }, { "docid": "c689468a0c9a592b753636bcfb876e76", "score": "0.37162396", "text": "func FrobeniusNorm(arr []float64) float64 {\n\tsum := 0.0\n\tfor _, num := range arr {\n\t\tanum := math.Abs(num)\n\t\tsum += anum * anum\n\t}\n\treturn math.Sqrt(sum)\n}", "title": "" }, { "docid": "c0a2e408be72a01c57fa58657752eceb", "score": "0.3688563", "text": "func ProvePartialECDLogKnowledge(group *groups.ECGroup, secret1 *big.Int,\n\ta1, a2, b2 *groups.ECGroupElement) bool {\n\tprover := NewPartialECDLogProver(group)\n\tverifier := NewPartialECDLogVerifier(group)\n\n\tb1 := prover.Group.Exp(a1, secret1)\n\ttriple1, triple2 := prover.GetProofRandomData(secret1, a1, b1, a2, b2)\n\n\tverifier.SetProofRandomData(triple1, triple2)\n\tchallenge := verifier.GetChallenge()\n\n\tc1, z1, c2, z2 := prover.GetProofData(challenge)\n\tverified := verifier.Verify(c1, z1, c2, z2)\n\n\treturn verified\n}", "title": "" }, { "docid": "8e6fe5a997552d240da76341e91bb882", "score": "0.36759675", "text": "func nlpd(y, mean, std float64) float64 {\n\tvari := std * std\n\tlogv := math.Log(vari)\n\td := y - mean\n\treturn 0.5 * (math.Log(2)*math.Log(math.Pi) + d*d/vari + logv)\n}", "title": "" }, { "docid": "be2c2de3999511b5d0aaff76a33c904b", "score": "0.36650342", "text": "func NormGaussAt(x float64) float64 {\n\treturn GaussAt(x, 0, 1)\n}", "title": "" }, { "docid": "57eb746edb390b7a50c6266394a5cdbe", "score": "0.36472797", "text": "func linminnormalized(d *[]float64, stp *float64, n int) {\n\tmx := 0.0\n\ts := 0.0\n\ti := 0\n\ti_ := 0\n\n\t//\n\t// first, scale D to avoid underflow/overflow durng squaring\n\t//\n\tfor i = 0; i <= n - 1; i++ {\n\t\tmx = math.Max(mx, math.Abs((*d)[i]))\n\t}\n\tif mx == 0 {\n\t\treturn\n\t}\n\ts = 1 / mx\n\tfor i_ = 0; i_ <= n - 1; i_++ {\n\t\t(*d)[i_] = s * (*d)[i_]\n\t}\n\t*stp = *stp / s\n\n\t//\n\t// normalize D\n\t//\n\ts = 0.0\n\tfor i_ = 0; i_ <= n - 1; i_++ {\n\t\ts += (*d)[i_] * (*d)[i_]\n\t}\n\ts = 1 / math.Sqrt(s)\n\tfor i_ = 0; i_ <= n - 1; i_++ {\n\t\t(*d)[i_] = s * (*d)[i_]\n\t}\n\t*stp = *stp / s\n}", "title": "" }, { "docid": "48c8e69fe8891c4dbf0557e1f8056ade", "score": "0.36468178", "text": "func probGivenX(x mat.Matrix, coefficients *mat.VecDense) *mat.VecDense {\n\txR, _ := x.Dims()\n\t_, cX := coefficients.Dims()\n\t//allocate a new array to hold the result of multiplication\n\ta := mat.NewDense(xR, cX, nil)\n\t//we know that the contents of a are packed\n\ta.Mul(x, coefficients)\n\ta.Scale(-1.0, a)\n\t//using colview allows us to use the properties of VecDense without copying\n\t//(assumption based on documentation)\n\tcalcExpThenAddN(a.ColView(0), 1)\n\treturn a.ColView(0)\n}", "title": "" }, { "docid": "1398baaaaf7d17f9a46cda58c78dc70b", "score": "0.3642991", "text": "func GenerateLog(addr common.Address, topics []common.Hash, data []byte) *types.Log {\n\treturn &types.Log{\n\t\tAddress: addr,\n\t\tTopics: topics,\n\t\tData: data,\n\t\tRemoved: false,\n\n\t\t// ignored (zeroed):\n\t\tBlockNumber: 0,\n\t\tTxHash: common.Hash{},\n\t\tTxIndex: 0,\n\t\tBlockHash: common.Hash{},\n\t\tIndex: 0,\n\t}\n}", "title": "" }, { "docid": "10fbe8194a2fca4e533ccb2ca0f01acf", "score": "0.36329684", "text": "func Likelihood(view View, column string) []Distinct {\n\t//\n\t// Find the distinct values and count the frequency.\n\t//\n\ti := find(view.Columns(), column)\n\tdistinct := make(map[string]float64)\n\ttotal := 0.0\n\tview.First()\n\tfor {\n\t\trow := view.Next()\n\t\tif row == nil {\n\t\t\tbreak\n\t\t}\n\t\tv := row[i]\n\t\tif _, ok := distinct[v]; !ok {\n\t\t\tdistinct[v] = 0\n\t\t}\n\t\tdistinct[v]++\n\t\ttotal++\n\t}\n\t//\n\t// Convert the map to a slice, then sort.\n\t//\n\tvar sorted []Distinct\n\tfor k, v := range distinct {\n\t\tsorted = append(sorted, Distinct{Value: k, Probability: v / total})\n\t}\n\tsort.Slice(\n\t\tsorted,\n\t\tfunc(i, j int) bool {\n\t\t\treturn sorted[i].Probability > sorted[j].Probability\n\t\t},\n\t)\n\treturn sorted\n}", "title": "" }, { "docid": "7d94397c6f38df192c6da0624ea5cc05", "score": "0.36304784", "text": "func (l LogNormal) Mode() float64 {\n\treturn math.Exp(l.Mu - l.Sigma*l.Sigma)\n}", "title": "" }, { "docid": "b0939220aeb958e7c01d8c269b648781", "score": "0.36085513", "text": "func (m *Matrix) checkNormal() error {\n\tif m.row <= 0 || m.column <= 0 {\n\t\treturn errors.New(\"Matrix size is broken\")\n\t}\n\tif len(m.matrix) != m.row*m.column {\n\t\treturn errors.New(\"matrix size and row/colmn relationship is broken\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5a52a4699eb9cbd668402ebf726d775", "score": "0.36071238", "text": "func NewLogisticRegression() *LogisticRegression {\n\tlr := &LogisticRegression{}\n\n\tlr.Hypothesis = func(X, theta []float64) float64 {\n\t\thypothesis := 0.0\n\t\tfor key, x := range X {\n\t\t\thypothesis += theta[key] * x\n\t\t}\n\t\treturn hypothesis\n\t}\n\tlr.LearningRate = 1\n\tlr.TrueDegree = 0.5\n\n\treturn lr\n}", "title": "" }, { "docid": "2af55dba143303e0220d946793d4de90", "score": "0.3594429", "text": "func (w Weibull) LogSurvival(x float64) float64 {\n\tif x < 0 {\n\t\treturn 0\n\t} else {\n\t\treturn -math.Pow(x/w.Lambda, w.K)\n\t}\n}", "title": "" }, { "docid": "cfe8a5faca5bff474bfec8257a3589b0", "score": "0.3589468", "text": "func NewHyperLogLog(m uint) hyperLogLog {\n\treturn hyperLogLog{\n\t\tregisters: make([]int, m),\n\t\tm: m,\n\t\tb: uint(math.Ceil(math.Log2(float64(m)))),\n\t}\n}", "title": "" }, { "docid": "fc5f65a4cadd3e558eedb2e0ecf1f0c2", "score": "0.3579444", "text": "func RandomGaussian(mean, std float64) float64 {\n\treturn rand.NormFloat64()*std + mean\n}", "title": "" }, { "docid": "3cc18d6822cd08849769a27a049d3667", "score": "0.35756212", "text": "func (g InverseGamma) Mean() float64 {\n\tif g.Alpha <= 1 {\n\t\treturn math.Inf(1)\n\t}\n\treturn g.Beta / (g.Alpha - 1)\n}", "title": "" }, { "docid": "03dd818c2551fc6fe72da3b584ff5dcc", "score": "0.35686216", "text": "func (l LogNormal) Quantile(p float64) float64 {\n\tif p < 0 || p > 1 {\n\t\tpanic(badPercentile)\n\t}\n\t// Formula from http://www.math.uah.edu/stat/special/LogNormal.html.\n\treturn math.Exp(l.Mu + l.Sigma*UnitNormal.Quantile(p))\n}", "title": "" }, { "docid": "cee231434e55a30d6edf08ff477890b9", "score": "0.35682702", "text": "func (rng *RNG) Normal() float64 {\n\t// Ziggurat algorithm. Parameters are copied from\n\t// github.com/zephyrtronium/crazy, and the algorithm itself comes from\n\t// http://www.jstatsoft.org/v05/i08/paper.\n\tfor {\n\t\t// Rather than reusing the low bits of a 32-bit random integer for the\n\t\t// index like in the original ziggurat paper, we can treat a 64-bit\n\t\t// integer as a 54-bit significand – giving us full precision and equal\n\t\t// distribution over float64 values – and a separate 10-bit index.\n\t\tj := int64(rng.Uint64())\n\t\ti := uint16(j & 0x3ff)\n\t\tj = j >> 10\n\t\tabsj := j\n\t\tif absj < 0 {\n\t\t\tabsj = -absj\n\t\t}\n\t\tx := float64(j) * normalW[i]\n\t\tif uint64(absj) < normalK[i] {\n\t\t\treturn x\n\t\t}\n\t\tif i != 0 {\n\t\t\tif normalF[i]+rng.Uniform()*(normalF[i-1]-normalF[i]) < math.Exp(-0.5*x*x) {\n\t\t\t\treturn x\n\t\t\t}\n\t\t} else {\n\t\t\tx = normalTail(rng)\n\t\t\tif j >= 0 {\n\t\t\t\treturn x\n\t\t\t}\n\t\t\treturn -x\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2077b0125a5ace07ae0bc631af05feea", "score": "0.35680655", "text": "func Normal3dv(v *[3]float64) {\n\tC.glNormal3dv((*C.GLdouble)(&v[0]))\n}", "title": "" }, { "docid": "2c4e1d688c19d784a52c68ee24a974e8", "score": "0.35639778", "text": "func (r *RPEngine) naturalLog() {\n\tx, errx := r.popFloatHelper()\n\tif errx != nil {\n\t\treturn\n\t}\n\n\tz := big.NewFloat(math.Log(x))\n\tr.pushFloatOrInt(z)\n}", "title": "" }, { "docid": "9277261d3dd3634f0bf4bb89111700e5", "score": "0.3556643", "text": "func NewObserverLog(log Log) *ObserverLog {\n\t// Construct a new ObserverLog\n\tobslog := ObserverLog{}\n\t// Set the value of Logsource and Logtype\n\tobslog.Logsource = log.GetLogsource()\n\tobslog.Logtype = log.GetLogtype()\n\t// Stringify and set the Logmessage\n\tobslog.Logmessage = FormatLog(log)\n\t// Return the ObserverLog\n\treturn &obslog\n}", "title": "" }, { "docid": "867e60516b48552760ab33740f9f1ab6", "score": "0.35556775", "text": "func Normal3x(nx int32, ny int32, nz int32) {\n\tcnx, _ := (C.GLfixed)(nx), cgoAllocsUnknown\n\tcny, _ := (C.GLfixed)(ny), cgoAllocsUnknown\n\tcnz, _ := (C.GLfixed)(nz), cgoAllocsUnknown\n\tC.glNormal3x(cnx, cny, cnz)\n}", "title": "" }, { "docid": "23d78377afcfcc84d052b62a5a8a3d47", "score": "0.355238", "text": "func logPow(expBase float64, pow int, logBase float64) float64 {\n\t// logb (MN) = logb M + logb N\n\ttotal := 0.0\n\tfor i := 0; i < pow; i++ {\n\t\ttotal += logX(logBase, expBase)\n\t}\n\treturn total\n}", "title": "" }, { "docid": "4b21f891149bfd71cfda52c52f03f34c", "score": "0.3550038", "text": "func transformNormal(dst, normal, mu []float64, chol *mat.Cholesky) []float64 {\n\tdim := len(mu)\n\tdstVec := mat.NewVecDense(dim, dst)\n\tsrcVec := mat.NewVecDense(dim, normal)\n\t// If dst and normal are the same slice, make them the same Vector otherwise\n\t// mat complains about being tricky.\n\tif &normal[0] == &dst[0] {\n\t\tsrcVec = dstVec\n\t}\n\tdstVec.MulVec(chol.RawU().T(), srcVec)\n\tfloats.Add(dst, mu)\n\treturn dst\n}", "title": "" }, { "docid": "d19e8650ca629ff6acc904879f24528d", "score": "0.35499758", "text": "func ShannonEntropy(col MsaColumn, simMatrix SimilarityMatrix, bgDistr []float64, seqWeights []float64) float64 {\n\twfc := GetWeightedFrequencyCount(col, seqWeights, Pseudocount)\n\n\th := 0.0\n\tfor _, c := range wfc {\n\t\th += c * math.Log(c) // xxx: what base should be used? 2 / e / 10\n\t}\n\th /= math.Log(math.Min(float64(len(wfc)), float64(len(col))))\n\th *= -1\n\n\tscore := 1 - h\n\tif UseGapPenalty {\n\t\treturn score * GetWeightedGapPenalty(col, seqWeights)\n\t}\n\treturn score\n}", "title": "" }, { "docid": "f1aff93cb6eac86af084fea9e5e5d755", "score": "0.35316107", "text": "func DirichletTermProbability(mu float64) TermProbability {\n\treturn func(lm LanguageModel, term string) float64 {\n\t\treturn (lm.TermCount[term] + (mu * lm.CollectionTermProbability(term))) / (lm.DocLen + mu)\n\t}\n}", "title": "" }, { "docid": "114adf3bcf55095a2fd6e7f9d3ad0f1b", "score": "0.35195446", "text": "func (m *ItemItemsItemWorkbookFunctionsRequestBuilder) LogNorm_Inv()(*ItemItemsItemWorkbookFunctionsLogNorm_InvRequestBuilder) {\n return NewItemItemsItemWorkbookFunctionsLogNorm_InvRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" } ]
a6b57bb75666ff30f2d89e85fcecbf14
readTorLogs attempts to read and include the tor logs into the test keys if this operation is possible.
[ { "docid": "a59ae7006be56f0c7572d779da5926ef", "score": "0.804255", "text": "func (m *Measurer) readTorLogs(logger model.Logger, tk *TestKeys, logFilePath string) {\n\ttk.TorLogs = append(tk.TorLogs, torlogs.ReadBootstrapLogsOrWarn(logger, logFilePath)...)\n\tif len(tk.TorLogs) <= 0 {\n\t\treturn\n\t}\n\tlast := tk.TorLogs[len(tk.TorLogs)-1]\n\tbi, err := torlogs.ParseBootstrapLogLine(last)\n\t// Implementation note: parsing cannot fail here because we're using the same code\n\t// for selecting and for parsing the bootstrap logs, so we panic on error.\n\truntimex.PanicOnError(err, fmt.Sprintf(\"cannot parse bootstrap line: %s\", last))\n\ttk.TorProgress = bi.Progress\n\ttk.TorProgressTag = bi.Tag\n\ttk.TorProgressSummary = bi.Summary\n}", "title": "" } ]
[ { "docid": "10386bb86caee8ff3a02227828ae4123", "score": "0.5819652", "text": "func (r *TRuntime) LogRead(owner interface{}, chain uint64, key []byte) ([]byte, uint64) {\n\tassert(r.Chain > 0)\n\tvar data []byte\n\ttbName := getNameOfLogDB(owner)\n\tif chain == 0 {\n\t\tchain = r.Chain\n\t}\n\tif chain != r.Chain {\n\t\tassert(r.Chain < 8*chain)\n\t\tassert(8*r.Chain > chain)\n\t\tdist := getLogicDist(r.Chain, chain)\n\t\tif dist > 4 {\n\t\t\tassert(r.Chain+3 > chain)\n\t\t\tassert(r.Chain < chain+3)\n\t\t}\n\t}\n\tdata = r.db.Get(chain, tbName, key)\n\n\tif len(data) == 0 {\n\t\t// log.Printf(\"fail to read log data.self:%d,chain:%d,tb:%s,key:%x\\n\", r.Chain, chain, tbName, key)\n\t\treturn nil, 0\n\t}\n\tn := len(data)\n\t// log.Printf(\"read log data.self:%d,chain:%d,tb:%s,key:%x,len:%d\\n\", r.Chain, chain, tbName, key, n)\n\tlifeBytes := data[n-8:]\n\tvar life uint64\n\tr.Decode(0, lifeBytes, &life)\n\treturn data[:n-8], life\n}", "title": "" }, { "docid": "0f993dede90626e6d9faf635d174dcbf", "score": "0.5652895", "text": "func (nl *NfLog) ReadLogs() {\n\n\tdefer nl.NFlogClose()\n\tbuffer := make([]byte, 65536)\n\n\tfor {\n\t\ts, _, err := nl.Syscalls.Recvfrom(nl.Socket.getFd(), buffer, 0)\n\t\tif err != nil {\n\t\t\tif nl.errorCallback != nil {\n\t\t\t\tnl.errorCallback(fmt.Errorf(\"Netlink error %v\", err))\n\t\t\t}\n\t\t\tif err == syscall.ENOBUFS {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\terr = nl.parseLog(buffer[:s])\n\t\tif err != nil {\n\t\t\tif nl.errorCallback != nil {\n\t\t\t\tnl.errorCallback(fmt.Errorf(\"Parse error %v\", err))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2de0a7fc6c0f8a9d3c345b7a55a11fa7", "score": "0.56491274", "text": "func ReadLogs(config orm.ConfigReader) (string, error) {\n\tlogFile := fmt.Sprintf(\"%s/log.jsonl\", config.RootDir())\n\tb, err := ioutil.ReadFile(logFile)\n\treturn string(b), err\n}", "title": "" }, { "docid": "201953a8dcc1e1235de494d3cb263f01", "score": "0.5574105", "text": "func LogRead(owner interface{}, chain uint64, key []byte) ([]byte, uint64) {\n\tassert(chain > 0)\n\ttbName := getNameOfLogDB(owner)\n\tdata := db.GetClient().Get(chain, tbName, key)\n\tif len(data) == 0 {\n\t\treturn nil, 0\n\t}\n\tn := len(data)\n\tlifeBytes := data[n-8:]\n\tvar life uint64\n\tDecode(lifeBytes, &life)\n\treturn data[:n-8], life\n}", "title": "" }, { "docid": "f6d0f8fd0bcc5d1cacc6d80dd83d69c5", "score": "0.554106", "text": "func (t *SimpleChaincode) get_vehicle_logs(stub *shim.ChaincodeStub, args []string) ([]byte, error) {\r\n\r\n\tbytes, err := stub.GetState(\"Vehicle_Logs\")\r\n\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif err != nil { return nil, errors.New(\"Unable to get vehicle logs\") }\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\tvar eh Vehicle_Log_Holder\r\n\t\r\n\terr = json.Unmarshal(bytes, &eh)\t\t\t\t\t\t\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif err != nil {\treturn nil, errors.New(\"Corrupt vehicle log\") }\r\n\t\r\n\tuser, err := t.get_username(stub)\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif err != nil {\treturn nil, errors.New(\"Could not retrieve caller username\") }\r\n\tcert, err := t.get_ecert(stub,user)\t\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif err != nil {\treturn nil, errors.New(\"Could not retrieve eCert for given username\") }\r\n\taffiliation, err := t.check_affiliation(stub, string(cert))\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif err != nil { return nil, err }\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\tif affiliation == AUTHORITY {\t\t\t\t\t\t\t\t// Return all vehicle logs if authority\r\n\t\t\t\r\n\t\trepNull := strings.Replace(string(bytes), \"null\", \"[]\", 1)\t\t// If the array is blank it has the json value null so we need to make it an empty array\r\n\t\t\r\n\t\treturn []byte(repNull), nil\r\n\t} else {\r\n\t\treturn t.get_users_vehicle_logs(stub, eh, user)\r\n\t}\r\n\t\r\n}", "title": "" }, { "docid": "cbccddbe7855736965371a4b16359d5e", "score": "0.5500077", "text": "func readRawLogs(client kubernetes.Interface, namespace, podID string, logOptions *v1.PodLogOptions) (\n\tstring, error) {\n\treadCloser, err := openStream(client, namespace, podID, logOptions)\n\tif err != nil {\n\t\treturn err.Error(), nil\n\t}\n\n\tdefer readCloser.Close()\n\n\tresult, err := io.ReadAll(readCloser)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(result), nil\n}", "title": "" }, { "docid": "83be2c0a746b7f76e1dd3dd086b07e8b", "score": "0.54977185", "text": "func ReadLogs(containerID, tail string) ([]string, error) {\n\tctx := context.Background()\n\treader, err := cli.ContainerLogs(ctx, containerID, types.ContainerLogsOptions{\n\t\tShowStderr: true,\n\t\tShowStdout: true,\n\t\tTimestamps: true,\n\t\tTail: tail,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer reader.Close()\n\n\tlogs := []string{}\n\thdr := make([]byte, 8)\n\n\tfor {\n\t\t_, err = reader.Read(hdr)\n\n\t\tif err != nil {\n\t\t\treturn logs, err\n\t\t}\n\n\t\tcount := binary.BigEndian.Uint32(hdr[4:])\n\t\tdat := make([]byte, count)\n\t\t_, err = reader.Read(dat)\n\t\tlogs = append(logs, string(dat))\n\n\t\tif err != nil {\n\t\t\treturn logs, err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c48bfeb81ce5c350382cadbc17e22831", "score": "0.5424687", "text": "func (c *Session) ReadLogs(wg *sync.WaitGroup, w io.Writer) error {\n\trc, err := c.dockerClient.ContainerLogs(c.ctx, c.Name, types.ContainerLogsOptions{\n\t\tShowStdout: true,\n\t\tShowStderr: true,\n\t\tTimestamps: false,\n\t\tFollow: c.follow,\n\t\tTail: strconv.FormatInt(int64(c.tail), 10),\n\t})\n\tc.Status = Live\n\n\tif err != nil {\n\t\tc.Status = Errored\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"could not read logs from container: %v\", err))\n\t}\n\n\t_, err = io.Copy(w, rc)\n\tif err != nil {\n\t\tc.Status = Errored\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"could not copy from container socket: %v\", err))\n\t}\n\n\tc.Status = Terminated\n\twg.Done()\n\treturn nil\n}", "title": "" }, { "docid": "b9cc5b72d4b63cc9302b911c9395b3ed", "score": "0.52697545", "text": "func (client *Client) Logs(names []string, opts LogOptions) (<-chan Log, error) {\n\tquery := url.Values{}\n\tif len(names) > 0 {\n\t\tquery.Set(\"names\", strings.Join(names, \",\"))\n\t}\n\tquery.Set(\"n\", strconv.Itoa(opts.N))\n\tif opts.Follow {\n\t\tquery.Set(\"follow\", strconv.FormatBool(opts.Follow))\n\t}\n\n\trsp, err := client.raw(\"GET\", \"/v2/logs\", query, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif rsp.StatusCode != 200 {\n\t\tvar r response\n\t\tdefer rsp.Body.Close()\n\t\tif err := decodeInto(rsp.Body, &r); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, r.err(client)\n\t}\n\n\tch := make(chan Log, 20)\n\tgo func() {\n\t\t// logs come in application/json-seq, described in RFC7464: it's\n\t\t// a series of <RS><arbitrary, valid JSON><LF>. Decoders are\n\t\t// expected to skip invalid or truncated or empty records.\n\t\tscanner := bufio.NewScanner(rsp.Body)\n\t\tfor scanner.Scan() {\n\t\t\tbuf := scanner.Bytes() // the scanner prunes the ending LF\n\t\t\tif len(buf) < 1 {\n\t\t\t\t// truncated record? skip\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tidx := bytes.IndexByte(buf, 0x1E) // find the initial RS\n\t\t\tif idx < 0 {\n\t\t\t\t// no RS? skip\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbuf = buf[idx+1:] // drop the initial RS\n\t\t\tvar log Log\n\t\t\tif err := json.Unmarshal(buf, &log); err != nil {\n\t\t\t\t// truncated/corrupted/binary record? skip\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tch <- log\n\t\t}\n\t\tclose(ch)\n\t\trsp.Body.Close()\n\t}()\n\n\treturn ch, nil\n}", "title": "" }, { "docid": "c02dc3bb6b74c1a481ffab71e2500267", "score": "0.52171105", "text": "func TestReadExistingLogs(t *testing.T) {\n\tt.Parallel()\n\toperator, logReceived, tempDir := newTestFileOperator(t, nil, nil)\n\n\t// Create a file, then start\n\ttemp := openTemp(t, tempDir)\n\twriteString(t, temp, \"testlog1\\ntestlog2\\n\")\n\n\trequire.NoError(t, operator.Start(testutil.NewMockPersister(\"test\")))\n\tdefer operator.Stop()\n\n\twaitForMessage(t, logReceived, \"testlog1\")\n\twaitForMessage(t, logReceived, \"testlog2\")\n}", "title": "" }, { "docid": "2e762df2d3fac8ae293d00346ee21f46", "score": "0.5188828", "text": "func ReadLog(sclog string, verbose bool) {\n\tAllProbs = AllProblems()\n\tfp, err := os.Open(sclog)\n\tif err != nil {\n\t\tlogger.Disklog.Warnf(\"Could not open file %s\", sclog)\n\t\treturn\n\t}\n\targs := \"not found\"\n\tvar lifecycle scLifecycle\n\tlifecycle.initLifecycle()\n\tlineNum := 1\n\tproblems := make(map[string]int)\n\tscanner := bufio.NewScanner(fp)\n\treply := makiReply()\n\tfor scanner.Scan() {\n\t\tline := scanner.Bytes()\n\t\tif launchArgs(line) {\n\t\t\ta := strings.Split(string(line), \" \")\n\t\t\targs = strings.Join(a[3:], \" \")\n\t\t}\n\t\tif isProblem, problem := problem(line); isProblem == true {\n\t\t\t// if this is a known problem add it to the problemsdata if it isn't present\n\t\t\t_, present := problems[problem.Name]\n\t\t\tif present {\n\t\t\t\tproblems[problem.Name] = problems[problem.Name] + 1\n\t\t\t\tif verbose {\n\t\t\t\t\tsingleOutput(problem, line)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsingleOutput(problem, line)\n\t\t\t\tproblems[problem.Name] = problems[problem.Name] + 1\n\t\t\t}\n\t\t}\n\t\tif !reply(line) {\n\t\t\treply(line)\n\t\t}\n\n\t\tfor i := range lifecycle.stages {\n\t\t\tif lifecycle.stages[i].reached == false && bytes.Contains(line, []byte(lifecycle.stages[i].target)) {\n\t\t\t\tlifecycle.stages[i].line = lineNum\n\t\t\t\tlifecycle.stages[i].reached = true\n\t\t\t}\n\t\t}\n\t\tlineNum++\n\t}\n\tlogger.Disklog.Info(\"Tunnel Launch Arguments: \", args)\n\tif veryVerbose(args) {\n\t\tmakiReply := reply([]byte(\"reply?\"))\n\t\tif !makiReply {\n\t\t\tproblems[\"NoMakiReply\"] = problems[\"NoMakiReply\"] + 1\n\t\t}\n\t\tnoMakiReplyOutput(makiReply)\n\t}\n\tproblemsOutput(problems)\n\tlifecycle.lifecycleOutput()\n}", "title": "" }, { "docid": "0cfda0ea2eb2e9ed5034355f11b48669", "score": "0.5188802", "text": "func (l *ChanLogger) ReadTailLog(offset, length int64) (string, int64, bool, error) {\n\treturn \"\", 0, false, faults.NewFault(faults.NoFile, \"NO_FILE\")\n}", "title": "" }, { "docid": "fd53ae06ef7042adf8c24354beeab2e8", "score": "0.5171223", "text": "func (read *reader) ProcessLogs(mode LogProcessMode, fxn func(*LogOutput)) {\n\tif mode == ReadThenTail || mode == ReadOnly {\n\t\tfreshHeader := read.readHeader()\n\t\tnewLogs, newIdx := read.parseOld(freshHeader.CircBuf.endIndex())\n\n\t\tread.lastPastEndIdx = newIdx\n\t\tfor _, v := range newLogs {\n\t\t\tfxn(v)\n\t\t}\n\n\t\t// we may be done\n\t\tif mode == ReadOnly {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Run indefinitely\n\tfor {\n\t\tfreshHeader := read.readHeader()\n\t\tif freshHeader.CircBuf.endIndex() != read.lastPastEndIdx {\n\t\t\tnewLogs, newPastEndIdx := read.parse(read.lastPastEndIdx,\n\t\t\t\tfreshHeader.CircBuf.endIndex())\n\n\t\t\tread.lastPastEndIdx = newPastEndIdx\n\t\t\tfor _, v := range newLogs {\n\t\t\t\tfxn(v)\n\t\t\t}\n\t\t}\n\n\t\ttime.Sleep(10 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "89e2cc8ca500a3f1abaee23d67b3002a", "score": "0.51381606", "text": "func (log *Log) replayLog() error {\n journalIterator := newJournalIterator(log.conf.JournalPath)\n noNeedReply := make(map[EncodedHash]bool)\n noNeedSync := make(map[EncodedHash]bool)\n if journalIterator != nil {\n for {\n line, err := journalIterator.NextJournalEntry()\n if err != nil {\n return initDebug.Error(err)\n }\n if line == \"\" {\n break\n }\n parts := strings.Split(line, \":\")\n if len(parts) != 2 {\n return initDebug.Error(errors.New(\"Malformed journal.\"))\n }\n switch parts[0] {\n case \"Sync\":\n noNeedSync[EncodedHash(parts[1])] = true\n case \"Reply\":\n noNeedReply[EncodedHash(parts[1])] = true\n default:\n return initDebug.Error(errors.New(\"Unknown journal type. \" + line))\n }\n }\n }\n initDebug.Debugf(\"noNeedReply: %v\", noNeedReply)\n iterator := newLogIterator(log.conf.LogPath)\n if iterator != nil {\n for {\n logEntry, err := iterator.NextLogEntry()\n if err != nil {\n return initDebug.Error(err)\n }\n if logEntry == nil {\n break\n }\n initDebug.Debugf(\"soft committing: %v\", logEntry)\n if err := log.check(logEntry); err != nil {\n return initDebug.Error(err)\n }\n log.updateMemoryState(logEntry)\n\n encodedHash := logEntry.encodedHash()\n if _, ok := noNeedSync[encodedHash]; !ok {\n log.rs.SyncLogEntry(logEntry)\n }\n if _, ok := noNeedReply[encodedHash]; !ok {\n if err := logEntry.Message.asyncHandle(log, logEntry); err != nil {\n return initDebug.Error(err)\n }\n }\n }\n }\n valueDir, err := os.Open(log.conf.ValueDir)\n if err != nil {\n return initDebug.Error(err)\n }\n values, err := valueDir.Readdirnames(-1)\n if err != nil {\n return initDebug.Error(err)\n }\n for _, value := range values {\n log.memLog.Values[EncodedHash(value)] = true\n }\n return nil\n}", "title": "" }, { "docid": "a7538fb975a4e182f3069d392d57e010", "score": "0.51241636", "text": "func (l *ChanLogger) ReadLog(offset, length int64) (string, error) {\n\treturn \"\", faults.NewFault(faults.NoFile, \"NO_FILE\")\n}", "title": "" }, { "docid": "023afde0ec9a6bba925b54bdaedc44bd", "score": "0.50769365", "text": "func (c *ChaosExperimentHandler) GetLogs(reqID string, pod model.PodLogRequest, r store.StateData) {\n\tdata, err := json.Marshal(pod)\n\tif err != nil {\n\t\tlogrus.Print(\"ERROR WHILE MARSHALLING POD DETAILS\")\n\t}\n\treqType := \"logs\"\n\texternalData := string(data)\n\tpayload := model.InfraActionResponse{\n\t\t//ProjectID: reqID,\n\t\tAction: &model.ActionPayload{\n\t\t\tRequestID: reqID,\n\t\t\tRequestType: reqType,\n\t\t\tExternalData: &externalData,\n\t\t},\n\t}\n\tif clusterChan, ok := r.ConnectedInfra[pod.InfraID]; ok {\n\t\tclusterChan <- &payload\n\t} else if reqChan, ok := r.ExperimentLog[reqID]; ok {\n\t\tresp := model.PodLogResponse{\n\t\t\tPodName: pod.PodName,\n\t\t\tExperimentRunID: pod.ExperimentRunID,\n\t\t\tPodType: pod.PodType,\n\t\t\tLog: \"INFRA ERROR : INFRA NOT CONNECTED\",\n\t\t}\n\t\treqChan <- &resp\n\t\tclose(reqChan)\n\t}\n}", "title": "" }, { "docid": "87eb1d9b844eae19d875602ace2a0bc9", "score": "0.5046214", "text": "func receiveLogs(r *registry, logAddr string) {\n\tladdr, err := net.ResolveUDPAddr(\"udp\", logAddr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tln, err := net.ListenUDP(\"udp\", laddr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer ln.Close()\n\n\tln.SetReadBuffer(logBufferSize * averageLogLineLength)\n\n\tvar buf = make([]byte, maxLogLineLength+maxContainerIDLength)\n\n\t// All log lines should start with the pattern container[FOO] where FOO\n\t// is the container ID.\n\tcontainsPtrn := regexp.MustCompile(`container\\[([^\\]]+)]`)\n\n\tfor {\n\t\tn, addr, err := ln.ReadFromUDP(buf)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"logs: while reading from port: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tincLogReceivedLines(1)\n\n\t\tline := string(buf[:n])\n\t\tmatches := containsPtrn.FindStringSubmatch(line)\n\t\tif len(matches) != 2 {\n\t\t\tincLogUnparsableLines(1)\n\t\t\tlog.Printf(\"logs: %s: message to unknown container: %s\", addr, line)\n\t\t\tcontinue\n\t\t}\n\n\t\tcontainer, ok := r.get(matches[1])\n\t\tif !ok {\n\t\t\tincLogUnroutableLines(1)\n\t\t\tlog.Printf(\"logs: %s: message to unknown container: %s\", addr, line)\n\t\t\tcontinue\n\t\t}\n\n\t\tcontainer.Logs().addLogLine(line)\n\t}\n}", "title": "" }, { "docid": "01bd2d993f7d5899b6ad4178ec452ee2", "score": "0.49615917", "text": "func (c *Container) Logs(ctx context.Context, opts ...LogsReadOption) error {\n\tvar cfg LogReadConfig\n\tfor _, o := range opts {\n\t\to(&cfg)\n\t}\n\n\tcfgAPI := logReadConfigAPI{\n\t\tShowStdout: cfg.Stdout != nil,\n\t\tShowStderr: cfg.Stderr != nil,\n\t\tLogReadConfig: cfg,\n\t}\n\n\twithLogConfig := func(req *http.Request) error {\n\t\tq := req.URL.Query()\n\t\tq.Add(\"follow\", strconv.FormatBool(cfgAPI.Follow))\n\t\tq.Add(\"stdout\", strconv.FormatBool(cfgAPI.ShowStdout))\n\t\tq.Add(\"stderr\", strconv.FormatBool(cfgAPI.ShowStderr))\n\t\tq.Add(\"since\", cfgAPI.Since)\n\t\tq.Add(\"until\", cfgAPI.Until)\n\t\tq.Add(\"timestamps\", strconv.FormatBool(cfgAPI.Timestamps))\n\t\tq.Add(\"tail\", cfgAPI.Tail)\n\n\t\treq.URL.RawQuery = q.Encode()\n\t\treturn nil\n\t}\n\n\t// Here we do not want to limit the response size since we are returning a log stream, so we perform this manually\n\t// instead of with httputil.DoRequest\n\tresp, err := c.tr.Do(ctx, http.MethodGet, version.Join(ctx, \"/containers/\"+c.id+\"/logs\"), withLogConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Starting with api version 1.42, docker should returnn a header with the content-type indicating if the stream is multiplexed.\n\t// If the api version is lower then we'll need to inspect the container to determine if the stream is multiplexed.\n\tmux := resp.Header.Get(\"Content-Type\") == mediaTypeMultiplexed\n\tif !mux {\n\t\tif version.APIVersion(ctx) == \"\" || version.LessThan(version.APIVersion(ctx), \"1.42\") {\n\t\t\tinspect, err := c.Inspect(ctx)\n\t\t\tif err == nil {\n\t\t\t\tmux = !inspect.Config.Tty\n\t\t\t}\n\t\t}\n\t}\n\n\tbody := resp.Body\n\thttputil.LimitResponse(ctx, resp)\n\tif err := httputil.CheckResponseError(resp); err != nil {\n\t\treturn err\n\t}\n\n\tif mux {\n\t\tif cfg.Stdout != nil || cfg.Stderr != nil {\n\t\t\tgo func() {\n\t\t\t\tstreamutil.StdCopy(cfg.Stdout, cfg.Stderr, body)\n\t\t\t\tcloseWrite(cfg.Stdout)\n\t\t\t\tcloseWrite(cfg.Stderr)\n\t\t\t\tbody.Close()\n\t\t\t}()\n\t\t}\n\t\treturn nil\n\t}\n\n\tif cfg.Stdout != nil {\n\t\tgo func() {\n\t\t\tio.Copy(cfg.Stdout, body)\n\t\t\tcloseWrite(cfg.Stdout)\n\t\t\tbody.Close()\n\t\t}()\n\t}\n\n\tif cfg.Stderr != nil {\n\t\tgo func() {\n\t\t\tio.Copy(cfg.Stderr, body)\n\t\t\tcloseWrite(cfg.Stderr)\n\t\t\tbody.Close()\n\t\t}()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f16fe1d235ac4956619fcf1e698a940e", "score": "0.49518642", "text": "func ReadLog(r io.Reader) (MsgWrapper, error) {\r\n\tindicatorHolder := make([]byte, 1)\r\n\tint16holder := make([]byte, 2)\r\n\tint32holder := make([]byte, 4)\r\n\tint64holder := make([]byte, 8)\r\n\r\n\tn, err := r.Read(indicatorHolder)\r\n\tif err != nil && err != io.EOF {\r\n\t\tlog.Printf(\"failed parsing indicator: %d, and error %v\", n, err)\r\n\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t}\r\n\tif err == io.EOF {\r\n\t\treturn MsgWrapper{}, io.EOF\r\n\t}\r\n\r\n\tindicator := indicatorHolder[0]\r\n\tif indicator == 0 { // new message\r\n\t\tn, err = r.Read(int64holder)\r\n\t\tif n == 0 || err != nil {\r\n\t\t\tlog.Printf(\"failed parsing scheduledAt: %d\", n)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\t\tscheduledAtRead := binary.LittleEndian.Uint64(int64holder)\r\n\r\n\t\tn, err = r.Read(int16holder)\r\n\t\tif n == 0 || err != nil {\r\n\t\t\tlog.Printf(\"failed parsing lengthOfKey: %d\", n)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\t\tlengthOfKeyRead := binary.LittleEndian.Uint16(int16holder)\r\n\r\n\t\tn, err = r.Read(int32holder)\r\n\t\tif n == 0 || err != nil {\r\n\t\t\tlog.Printf(\"failed parsing lengthOfValue: %d\", n)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\t\tlengthOfValueRead := binary.LittleEndian.Uint32(int32holder)\r\n\r\n\t\tn, err = r.Read(int16holder)\r\n\t\tif n == 0 || err != nil {\r\n\t\t\tlog.Printf(\"failed parsing numOfRetries: %d\", n)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\t\tnumOfRetriesRead := binary.LittleEndian.Uint16(int16holder)\r\n\r\n\t\tkeyBytes, err := ioutil.ReadAll(io.LimitReader(r, int64(lengthOfKeyRead)))\r\n\t\tif err != nil {\r\n\t\t\tlog.Printf(\"failed reading key: %v\", err)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\r\n\t\tvalueBytes, err := ioutil.ReadAll(io.LimitReader(r, int64(lengthOfValueRead)))\r\n\t\tif err != nil {\r\n\t\t\tlog.Printf(\"failed reading value: %v\", err)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\r\n\t\treturn MsgWrapper{\r\n\t\t\tmsgType: 0,\r\n\t\t\titem: ds.PqItem{\r\n\t\t\t\tScheduledAt: int64(scheduledAtRead),\r\n\t\t\t\tKey: string(keyBytes),\r\n\t\t\t\tValue: valueBytes,\r\n\t\t\t\tRetries: int16(numOfRetriesRead)},\r\n\t\t}, nil\r\n\t} else if indicator == 1 {\r\n\t\tn, err = r.Read(int64holder)\r\n\t\tif n == 0 || err != nil {\r\n\t\t\tlog.Printf(\"failed parsing scheduledAt: %d\", n)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\t\tscheduledAtRead := binary.LittleEndian.Uint64(int64holder)\r\n\r\n\t\tn, err = r.Read(int16holder)\r\n\t\tif n == 0 || err != nil {\r\n\t\t\tlog.Printf(\"failed parsing lengthOfKey: %d\", n)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\t\tlengthOfKeyRead := binary.LittleEndian.Uint16(int16holder)\r\n\r\n\t\tkeyBytes, err := ioutil.ReadAll(io.LimitReader(r, int64(lengthOfKeyRead)))\r\n\t\tif err != nil {\r\n\t\t\tlog.Printf(\"failed reading key: %v\", err)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\r\n\t\treturn MsgWrapper{\r\n\t\t\tmsgType: 1,\r\n\t\t\titem: ds.PqItem{\r\n\t\t\t\tScheduledAt: int64(scheduledAtRead),\r\n\t\t\t\tKey: string(keyBytes)},\r\n\t\t}, nil\r\n\t} else if indicator == 2 {\r\n\t\tn, err := r.Read(int16holder)\r\n\t\tif n == 0 || err != nil {\r\n\t\t\tlog.Printf(\"failed parsing lengthOfKey: %d -> %v\", n, err)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\t\tlengthOfKeyRead := binary.LittleEndian.Uint16(int16holder)\r\n\r\n\t\tkeyBytes, err := ioutil.ReadAll(io.LimitReader(r, int64(lengthOfKeyRead)))\r\n\t\tif err != nil {\r\n\t\t\tlog.Printf(\"failed reading key: %v\", err)\r\n\t\t\treturn MsgWrapper{}, ErrFailedParsingContent\r\n\t\t}\r\n\r\n\t\treturn MsgWrapper{\r\n\t\t\tmsgType: 2,\r\n\t\t\titem: ds.PqItem{\r\n\t\t\t\tKey: string(keyBytes)},\r\n\t\t}, nil\r\n\t} else {\r\n\t\tlog.Printf(\"Unknown indicator number: %d\", indicator)\r\n\t\treturn MsgWrapper{}, ErrUnknownCode\r\n\t}\r\n}", "title": "" }, { "docid": "ffea4e1edef5cca98775f22970ca125b", "score": "0.4914228", "text": "func InitLog(filename string) error {\n\tvar err error\n\n\t// Filename for logs is \"transaction.log\" by default.\n\tlogger, err = NewFileTransactionLogger(filename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create logger! %w\", err)\n\t}\n\n\t// Reads all events and errors.\n\tfmt.Println(\"yakv is reading previous transactions from the log.... 🔎\")\n\tevents, errors := logger.ReadEvents()\n\te, ok := Event{}, true\n\n\t// Checks each transaction and performs it (i.e. replaying).\n\tfmt.Println(\"yakv is replaying all previous transactions.... ⏯\")\n\tfor ok && err == nil {\n\t\tselect {\n\t\tcase err, ok = <-errors:\n\t\tcase e, ok = <-events:\n\t\t\tswitch e.EventType {\n\t\t\tcase EventDelete:\n\t\t\t\terr = Delete(e.Key)\n\t\t\tcase EventPut:\n\t\t\t\terr = Put(e.Key, e.Value)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Actively call Log() to log transactions to the transaction log.\n\tlogger.Log()\n\treturn err\n}", "title": "" }, { "docid": "edc9194c92b8e0ecef1cc2903759aae2", "score": "0.48992592", "text": "func (kv *KVPaxos) logRead(op Op, seq int) bool {\n\t\n\tif seq == kv.top {\n\t\tval, ok := kv.data[op.Key]\n\t\tvar reply GetReply\n\n\t\tif !ok {\n\t\t\treply.Err = ErrNoKey\n\t\t} else {\n\t\t\treply.Seq = seq\n\t\t\treply.Xid = op.Xid\n\t\t\treply.Value = val\n\t\t\treply.Err = OK\n\t\t}\n\t\t\n\t\tkv.reads[op.Xid] = reply\n\t\t\n\t\t// Question: Is this the right place for Done()?\n\t\tkv.px.Done(seq)\n\t\tkv.top += 1\n\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3c116653346c1957905150f885af411d", "score": "0.4871868", "text": "func (c Client) ReadLog(offset, length int) (string, error) {\n\tvar result string\n\terr := c.makeRequest(\"supervisor.readLog\", []interface{}{offset, length}, &result)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e7b9b5b224b4a65795f0bd88f2fb6a67", "score": "0.4836871", "text": "func (l *JSONFileLogger) ReadLogs(config logger.ReadConfig) *logger.LogWatcher {\n\tlogWatcher := logger.NewLogWatcher()\n\n\tgo l.readLogs(logWatcher, config)\n\treturn logWatcher\n}", "title": "" }, { "docid": "fce07fa0660354e0018bf19630b46363", "score": "0.48070621", "text": "func PrintLogs(writer io.Writer, appID string, masterKey string, follow bool, isProd bool, limit int) error {\n\tvar url string\n\tvar prod int\n\n\tparams := map[string]string{\n\t\t\"limit\": strconv.Itoa(limit),\n\t}\n\n\tif isProd {\n\t\tprod = 1\n\t} else {\n\t\tprod = 0\n\t}\n\n\tregion, err := GetAppRegion(appID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch region {\n\tcase regions.CN:\n\t\turl = fmt.Sprintf(\"https://api.leancloud.cn/1.1/tables/EngineLogs?production=%d\", prod)\n\tcase regions.US:\n\t\turl = fmt.Sprintf(\"https://us-api.leancloud.cn/1.1/tables/EngineLogs?production=%d\", prod)\n\t}\n\n\tretryCount := 0\n\n\tfor {\n\t\tresp, err := grequests.Get(url, &grequests.RequestOptions{\n\t\t\tHeaders: map[string]string{\n\t\t\t\t\"X-AVOSCloud-Application-Id\": appID,\n\t\t\t\t\"X-AVOSCloud-Master-Key\": masterKey,\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t\tParams: params,\n\t\t})\n\t\tif err != nil {\n\t\t\tretryCount++\n\t\t\tif retryCount > 3 {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttime.Sleep(5 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar logs []Log\n\t\terr = resp.JSON(&logs)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor i := len(logs); i > 0; i-- {\n\t\t\tlog := logs[i-1]\n\t\t\tt, err := time.Parse(time.RFC3339, log.Time)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontent := strings.TrimSuffix(log.Content, \"\\n\")\n\t\t\t// fmt.Println(log)\n\t\t\tlevel := log.Level\n\t\t\tvar levelSprintf func(string, ...interface{}) string\n\t\t\tif level == \"info\" {\n\t\t\t\tlevelSprintf = color.New(color.BgGreen, color.FgWhite).SprintfFunc()\n\t\t\t} else {\n\t\t\t\tlevelSprintf = color.New(color.BgRed, color.FgWhite).SprintfFunc()\n\t\t\t}\n\t\t\tvar instance string\n\t\t\tif log.Instance == \"\" {\n\t\t\t\tinstance = \" \"\n\t\t\t} else {\n\t\t\t\tinstance = log.Instance\n\t\t\t}\n\n\t\t\tif isProd {\n\t\t\t\tfmt.Fprintf(writer, \"%s %s %s\\r\\n\", instance, levelSprintf(\" %s \", t.Local().Format(\"15:04:05\")), content)\n\t\t\t} else {\n\t\t\t\t// no instance column\n\t\t\t\tfmt.Fprintf(writer, \"%s %s\\r\\n\", levelSprintf(\" %s \", t.Local().Format(\"15:04:05\")), content)\n\t\t\t}\n\t\t}\n\n\t\tif !follow {\n\t\t\tbreak\n\t\t}\n\n\t\t// limit is not necessary in second fetch\n\t\tdelete(params, \"limit\")\n\n\t\tif len(logs) > 0 {\n\t\t\tparams[\"since\"] = logs[0].Time\n\t\t}\n\n\t\ttime.Sleep(5 * time.Second)\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3e5d904575367120c4ac0fa93a3791ef", "score": "0.48060727", "text": "func (sm *SectionManager) GetLogs(from, to uint32, topicslist [][][]byte) ([]*types.Log, error) {\n\n\ttail := sm.chain.TailBlock()\n\tif to > tail.Header.Height {\n\t\tto = tail.Header.Height\n\t}\n\n\tsection := sm.section\n\tstart := from/SectionBloomLength + 1\n\tend := to/SectionBloomLength + 1\n\tif start > end {\n\t\treturn nil, core.ErrInvalidBounds\n\t}\n\n\tif start >= section {\n\t\tstart = section - 1\n\t}\n\tif end >= section {\n\t\tend = section - 1\n\t}\n\n\theights := []uint32{}\n\tif start != 0 {\n\t\tfor i := 0; i <= int(end-start); i++ {\n\t\t\th, err := sm.indexed(start, topicslist)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif i == 0 || i == int(end-start) {\n\t\t\t\tfor _, hh := range h {\n\t\t\t\t\tif hh >= from && hh <= to {\n\t\t\t\t\t\theights = append(heights, hh)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\theights = append(heights, h...)\n\t\t\t}\n\t\t}\n\t}\n\tif to%SectionBloomLength != 0 {\n\t\th, err := sm.unIndexed(to-to%SectionBloomLength, to, topicslist)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\theights = append(heights, h...)\n\t}\n\tlogger.Debugf(\"HEIGHT: %d\", heights)\n\n\treturn sm.getLogs(heights, topicslist)\n}", "title": "" }, { "docid": "d96454484a06dfd4aee3a31639a79ab4", "score": "0.48003766", "text": "func GetLogs(reqID string, pod model.PodLogRequest, r store.StateData) {\n\tdata, err := json.Marshal(pod)\n\tif err != nil {\n\t\tlog.Print(\"ERROR WHILE MARSHALLING POD DETAILS\")\n\t}\n\treqType := \"logs\"\n\texternalData := string(data)\n\tpayload := model.ClusterAction{\n\t\tProjectID: reqID,\n\t\tAction: &model.ActionPayload{\n\t\t\tRequestType: reqType,\n\t\t\tExternalData: &externalData,\n\t\t},\n\t}\n\tif clusterChan, ok := r.ConnectedCluster[pod.ClusterID]; ok {\n\t\tclusterChan <- &payload\n\t} else if reqChan, ok := r.WorkflowLog[reqID]; ok {\n\t\tresp := model.PodLogResponse{\n\t\t\tPodName: pod.PodName,\n\t\t\tWorkflowRunID: pod.WorkflowRunID,\n\t\t\tPodType: pod.PodType,\n\t\t\tLog: \"CLUSTER ERROR : CLUSTER NOT CONNECTED\",\n\t\t}\n\t\treqChan <- &resp\n\t\tclose(reqChan)\n\t}\n}", "title": "" }, { "docid": "dd2c0b38e00dfff96a062a278ad07478", "score": "0.47936466", "text": "func Read(res http.ResponseWriter, req *http.Request, logger *log.Logger, dir string) bool {\n\tif req.Method != \"POST\" {\n\t\tlogger.Println(req.URL.Path + \"::\" + req.Method + \"::\" + strconv.Itoa(http.StatusMethodNotAllowed) + \"::\" + http.StatusText(http.StatusMethodNotAllowed))\n\t\thttp.Error(res, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)\n\t\treturn false\n\t}\n\n\tvar readLogRequestData struct {\n\t\tName string `json:\"name\"`\n\t}\n\n\terr := json.NewDecoder(req.Body).Decode(&readLogRequestData)\n\tif err != nil {\n\t\tlogger.Println(req.URL.Path + \"::\" + err.Error())\n\t\thttp.Error(res, err.Error(), http.StatusBadRequest)\n\t\treturn false\n\t}\n\n\tvar log string\n\tswitch readLogRequestData.Name {\n\tcase \"public_errors\":\n\t\tlog = dir + \"logs/\" + LOG_PUBLIC_ERRORS\n\tcase \"account_errors\":\n\t\tlog = dir + \"logs/\" + LOG_ACCOUNT_ERRORS\n\tcase \"public_load_time\":\n\t\tlog = dir + \"logs/\" + LOG_PUBLIC_LOAD\n\tcase \"server_errors\":\n\t\tlog = LOG_SERVER_ERRORS\n\tdefault:\n\t\tlogger.Println(req.URL.Path + \"::unknown log type requested\")\n\t\thttp.Error(res, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\treturn false\n\t}\n\n\thandle, err := file.Open(log, true)\n\tif err != nil {\n\t\tlogger.Println(req.URL.Path + \"::\" + err.Error())\n\t\thttp.Error(res, err.Error(), http.StatusBadRequest)\n\t\treturn false\n\t}\n\tdefer handle.Close(false)\n\n\tdata, err := handle.Read()\n\tif err != nil {\n\t\tlogger.Println(req.URL.Path + \"::\" + err.Error())\n\t\thttp.Error(res, err.Error(), http.StatusBadRequest)\n\t\treturn false\n\t}\n\n\tres.WriteHeader(http.StatusOK)\n\tres.Write(data)\n\n\treturn true\n}", "title": "" }, { "docid": "209c1ce2a84c476d59e6191b8ac5b519", "score": "0.47893494", "text": "func ReadLogs(logPath string) ([]string, error) {\n\tvar lines []string\n\tfile, err := os.OpenFile(logPath, os.O_RDONLY, 0666)\n\tif err == nil {\n\t\treader := bufio.NewReader(file)\n\t\t// read all logs at once\n\t\tcontents, err := ioutil.ReadAll(reader)\n\t\tif err == nil {\n\t\t\t// create the lines array\n\t\t\tlines = strings.Split(string(contents), \"\\n\")\n\t\t}\n\t}\n\t// remove the last line (\\n)\n\tlines = lines[:len(lines)-1]\n\t// close the file\n\tfile.Close()\n\treturn lines, err\n}", "title": "" }, { "docid": "339fcadfffa7a07328e685dcc51d094a", "score": "0.4788806", "text": "func Logs(client kubernetes.Interface, namespace, podName, containerName string, lastContainerLog bool, tail *int64) (string, error) {\n\tlines := int64(100)\n\tif tail != nil {\n\t\tlines = *tail\n\t}\n\n\trequest := client.CoreV1().Pods(namespace).GetLogs(podName, &v1.PodLogOptions{\n\t\tContainer: containerName,\n\t\tTailLines: &lines,\n\t\tPrevious: lastContainerLog,\n\t})\n\n\tif request.URL().String() == \"\" {\n\t\treturn \"\", errors.New(\"Request url is empty\")\n\t}\n\n\treader, err := request.Context(context.Background()).Stream()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlogs, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(logs), nil\n}", "title": "" }, { "docid": "cfb0bc021fe1fa706b83b37ccfe8c3be", "score": "0.4779712", "text": "func (ts *tester) checkLogs() error {\n\texpects := int(ts.cfg.EKSConfig.AddOnIRSA.DeploymentReplicas)\n\tts.cfg.Logger.Info(\"checking logs from IRSA pods and nodes\", zap.Int(\"expects\", expects))\n\tpods, err := ts.cfg.K8SClient.ListPods(ts.cfg.EKSConfig.AddOnIRSA.Namespace, 150, 5*time.Second)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tos.RemoveAll(ts.cfg.EKSConfig.AddOnIRSA.DeploymentResultPath)\n\tf, err := os.OpenFile(ts.cfg.EKSConfig.AddOnIRSA.DeploymentResultPath, os.O_RDWR|os.O_TRUNC, 0777)\n\tif err != nil {\n\t\tf, err = os.Create(ts.cfg.EKSConfig.AddOnIRSA.DeploymentResultPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tdefer f.Close()\n\n\tsuccess := 0\n\tfor _, pod := range pods {\n\t\tpodName := pod.Name\n\t\tnodeName := pod.Spec.NodeName\n\t\tts.cfg.Logger.Info(\"pod\",\n\t\t\tzap.String(\"pod-name\", podName),\n\t\t\tzap.String(\"node-name\", nodeName),\n\t\t)\n\t\tif !strings.HasPrefix(pod.Name, irsaDeploymentName) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Fprintf(ts.cfg.LogWriter, \"\\n***** Pod %q *****\\n\", podName)\n\t\tdescArgs := []string{\n\t\t\tts.cfg.EKSConfig.KubectlPath,\n\t\t\t\"--kubeconfig=\" + ts.cfg.EKSConfig.KubeConfigPath,\n\t\t\t\"--namespace=\" + ts.cfg.EKSConfig.AddOnIRSA.Namespace,\n\t\t\t\"describe\",\n\t\t\t\"pod\",\n\t\t\tpodName,\n\t\t}\n\t\tdescCmd := strings.Join(descArgs, \" \")\n\t\tctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)\n\t\trunOutput, err := exec.New().CommandContext(ctx, descArgs[0], descArgs[1:]...).CombinedOutput()\n\t\tcancel()\n\t\toutput := strings.TrimSpace(string(runOutput))\n\t\tif err != nil {\n\t\t\tts.cfg.Logger.Warn(\"failed to kubectl describe\", zap.Error(err))\n\t\t}\n\t\tfmt.Fprintf(ts.cfg.LogWriter, \"'%s' output:\\n\\n%s\\n\\n\", descCmd, output)\n\n\t\tlogsArgs := []string{\n\t\t\tts.cfg.EKSConfig.KubectlPath,\n\t\t\t\"--kubeconfig=\" + ts.cfg.EKSConfig.KubeConfigPath,\n\t\t\t\"--namespace=\" + ts.cfg.EKSConfig.AddOnIRSA.Namespace,\n\t\t\t\"logs\",\n\t\t\t\"pod/\" + podName,\n\t\t\t\"--timestamps\",\n\t\t}\n\t\tlogsCmd := strings.Join(logsArgs, \" \")\n\t\tctx, cancel = context.WithTimeout(context.Background(), 15*time.Second)\n\t\trunOutput, err = exec.New().CommandContext(ctx, logsArgs[0], logsArgs[1:]...).CombinedOutput()\n\t\tcancel()\n\t\toutput = strings.TrimSpace(string(runOutput))\n\t\tif err != nil {\n\t\t\tts.cfg.Logger.Warn(\"failed to kubectl logs\", zap.Error(err))\n\t\t}\n\t\tcur, ok := ts.cfg.EKSConfig.Status.PrivateDNSToNodeInfo[nodeName]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"node %q unknown\", nodeName)\n\t\t}\n\t\tfmt.Fprintf(ts.cfg.LogWriter, \"\\n'%s' output from pod %q in node %q, node group name %q, node group ami type %q, public IP %q, public DNS name %q, user name %q (expects %q):\\n\\n%s\\n\\n\", logsCmd, pod.Name, nodeName, cur.NodeGroupName, cur.AMIType, cur.PublicIP, cur.PublicDNSName, cur.UserName, ts.sleepMessage, output)\n\t\tif !strings.Contains(output, ts.sleepMessage) {\n\t\t\tts.cfg.Logger.Warn(\"'kubectl logs' output does not contain expected outputs\", zap.String(\"expected-output\", ts.sleepMessage))\n\t\t\tfmt.Fprintf(ts.cfg.LogWriter, \"***********\\n\\n\")\n\t\t\tcontinue\n\t\t}\n\t\tif _, err = f.WriteString(fmt.Sprintf(\"'%s' from pod %q in node %q, node group name %q, node group ami type %q, public IP %q, public DNS name %q, user name %q:\\n\\n%s\\n\\n\", logsCmd, pod.Name, nodeName, cur.NodeGroupName, cur.AMIType, cur.PublicIP, cur.PublicDNSName, cur.UserName, output)); err != nil {\n\t\t\tts.cfg.Logger.Warn(\"failed to write\", zap.Error(err))\n\t\t\tfmt.Fprintf(ts.cfg.LogWriter, \"***********\\n\\n\")\n\t\t\tcontinue\n\t\t}\n\t\tts.cfg.Logger.Info(\"checked pod logs, found matching sleep message\", zap.String(\"pod-name\", podName))\n\t\tfmt.Fprintf(ts.cfg.LogWriter, \"***********\\n\\n\")\n\t\tsuccess++\n\t}\n\tif success < expects {\n\t\tts.cfg.Logger.Warn(\"not enough successful pod\",\n\t\t\tzap.Int(\"success\", success),\n\t\t\tzap.Int(\"expects\", expects),\n\t\t)\n\t\tif success == 0 {\n\t\t\treturn errors.New(\"no IRSA Pod is ready\")\n\t\t}\n\t\t// TODO: require success >= expects\n\t}\n\tts.cfg.Logger.Info(\"checked logs from IRSA pods and nodes\",\n\t\tzap.Int(\"success\", success),\n\t\tzap.Int(\"expects\", expects),\n\t)\n\tts.cfg.EKSConfig.Sync()\n\treturn nil\n}", "title": "" }, { "docid": "5103609128297aadcc382c11929defbb", "score": "0.47657603", "text": "func getAllLogs(args []string) error {\n\t// var declare\n\tvar showShutup bool\n\n\t//* Setup rights for shutup\n\tif len(args) == 0 {\n\t\tshowShutup = true\n\t}\n\n\t//* Display Log Shutup\n\tif is, err := IsDirectory(LogShutup); !is && err == nil && showShutup {\n\t\t// Fetch the content of LogShutup\n\t\tfileCtnt, errRF := ioutil.ReadFile(LogShutup)\n\t\tif errRF != nil {\n\t\t\tfmt.Println(redB(\":: [ERROR]\"), color.HiRedString(\"Could not read the file -_-\\n\\t->\", LogShutup, \"\\n\\t->\", errRF))\n\t\t}\n\t\tfmt.Println(magB(\"=========================================== - [ShutupLogs] - ===================================================\"))\n\t\tfmt.Println(string(fileCtnt))\n\t\tfmt.Println(magB(\"======================================== - [EOF - ShutupLogs] - ================================================\"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "50e684ed2f57dac8185ff2aed7ece961", "score": "0.47287244", "text": "func (a *PodLogArtifact) ReadAll() ([]byte, error) {\n\tsize, err := a.Size()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting pod log size: %w\", err)\n\t}\n\tif size > a.sizeLimit {\n\t\treturn nil, lenses.ErrFileTooLarge\n\t}\n\tlogs, err := a.jobAgent.GetJobLog(a.name, a.buildID, a.container)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting pod log: %w\", err)\n\t}\n\treturn logs, nil\n}", "title": "" }, { "docid": "1ae55eb0926cd337fec5f6e7246ba08e", "score": "0.47203362", "text": "func (router *router) getPipelineRecordLogs(request *restful.Request, response *restful.Response) {\n\tprojectName := request.PathParameter(projectPathParameterName)\n\tpipelineName := request.PathParameter(pipelinePathParameterName)\n\tpipelineRecordID := request.PathParameter(pipelineRecordPathParameterName)\n\tdownload, err := httputil.DownloadQueryParamsFromRequest(request)\n\tif err != nil {\n\t\thttputil.ResponseWithError(response, err)\n\t\treturn\n\t}\n\n\tlogs, err := router.pipelineRecordManager.GetPipelineRecordLogs(pipelineRecordID)\n\tif err != nil {\n\t\thttputil.ResponseWithError(response, err)\n\t\treturn\n\t}\n\n\tresponse.AddHeader(restful.HEADER_ContentType, \"text/plain\")\n\tif download {\n\t\tlogFileName := fmt.Sprintf(\"%s-%s-%s-log.txt\", projectName, pipelineName, pipelineRecordID)\n\t\tresponse.AddHeader(\"Content-Disposition\", fmt.Sprintf(\"attachment; filename=%s\", logFileName))\n\t}\n\n\tresponse.Write([]byte(logs))\n}", "title": "" }, { "docid": "3b3c94989a5a430f6d652da50dcb9191", "score": "0.47130382", "text": "func (s *Server) ReadLogfile(len int) ([]string, error) {\n\treturn s.Environment.Readlog(len)\n}", "title": "" }, { "docid": "c105ef53921b6065ecbad702d961e192", "score": "0.4700065", "text": "func GetLogs(pod, storeto string) {\n\tstdout, stderr, err := oc.GetLogs(pod)\n\tif err != nil {\n\t\tfmt.Println(colorizer.Red(\"\\nUnable to read logs\"))\n\t\tfmt.Println(stderr)\n\t\treturn\n\t}\n\tfmt.Println(colorizer.Green(\"Logs have been read\"))\n\tfmt.Printf(\"Log file size: %d bytes\\n\", len(stdout))\n\n\terr = os.WriteFile(storeto, []byte(stdout), 0o600)\n\tif err != nil {\n\t\tfmt.Println(colorizer.Red(\"\\nUnable to write logs\"))\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Println(colorizer.Blue(\"Written into \" + storeto))\n}", "title": "" }, { "docid": "c550148ca30787f2618c9bd1c1f905a9", "score": "0.46569914", "text": "func (cr *LogController) ReadMany(cx *goweb.Context) {\n\terr, pageviews := data.GetLogs(cx.GetRequest())\n\t\n if err != nil {\n \tcx.RespondWithErrorMessage(\"Kan de lijst met logs entries niet tonen\", http.StatusInternalServerError)\n }\n \n if err := logTemplate.Execute(cx.GetResponseWriter(), pageviews); err != nil {\n cx.RespondWithErrorMessage(err.String(), http.StatusInternalServerError)\n }\n}", "title": "" }, { "docid": "6a838ebefcf24599234a3b9038724e57", "score": "0.46568337", "text": "func initLogs() (*config.Logs, error) {\n\tlogpath, err := config.LogsPath(\"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconf := config.Logs{\n\t\tFilename: path.Join(logpath, \"events.log\"),\n\t}\n\treturn &conf, nil\n}", "title": "" }, { "docid": "a7f5ed25c89cd807578d8093475338b0", "score": "0.46536613", "text": "func (a *Client) Logs(repo string, commits ...string) ([]Log, error) {\n\tvar args []string\n\targs = append(args, \"rev-list\", \"--header\")\n\targs = append(args, commits...)\n\tout, err := output(repo, a.gitPath, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tobjs := bytes.Split(out, []byte{'\\x00'})\n\n\tvar logs []Log\n\tfor _, obj := range objs {\n\t\tif len(obj) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tl, err := unmarshalLog(obj)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlogs = append(logs, *l)\n\t}\n\treturn logs, nil\n}", "title": "" }, { "docid": "ed278a9e522d473c4b29be86c356f791", "score": "0.4650505", "text": "func (t *Tail) processLogs(query *domain.Query, logs []*domain.LogEntry) ([]string, error) {\n\tentries := make([]string, 0, len(logs))\n\tfor _, log := range logs {\n\t\tif log.ID == t.lastID {\n\t\t\treturn entries, nil\n\t\t}\n\n\t\ts, err := processEntry(log, query.ShowTime, query.Format, query.FormatFields)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tentries = append(entries, s)\n\t}\n\n\t// we need to keep track of the ID of the last message to remove duplicates between loops\n\tif t.lastID == \"\" {\n\t\tt.lastID = logs[0].ID\n\t}\n\n\treturn entries, nil\n}", "title": "" }, { "docid": "194132b0844a74d52014908031c3576d", "score": "0.46161258", "text": "func (c *cluster) FetchLogs(ctx context.Context) error {\n\tif c.spec.NodeCount == 0 {\n\t\t// No nodes can happen during unit tests and implies nothing to do.\n\t\treturn nil\n\t}\n\n\tc.l.Printf(\"fetching logs\\n\")\n\tc.status(\"fetching logs\")\n\n\t// Don't hang forever if we can't fetch the logs.\n\treturn contextutil.RunWithTimeout(ctx, \"fetch logs\", 2*time.Minute, func(ctx context.Context) error {\n\t\tpath := filepath.Join(c.t.ArtifactsDir(), \"logs\", \"unredacted\")\n\t\tif err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := execCmd(ctx, c.l, roachprod, \"get\", c.name, \"logs\" /* src */, path /* dest */); err != nil {\n\t\t\tlog.Infof(ctx, \"failed to fetch logs: %v\", err)\n\t\t\tif ctx.Err() != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := c.RunE(ctx, c.All(), \"mkdir -p logs/redacted && ./cockroach debug merge-logs --redact logs/*.log > logs/redacted/combined.log\"); err != nil {\n\t\t\tlog.Infof(ctx, \"failed to redact logs: %v\", err)\n\t\t\tif ctx.Err() != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn execCmd(\n\t\t\tctx, c.l, roachprod, \"get\", c.name, \"logs/redacted/combined.log\" /* src */, filepath.Join(c.t.ArtifactsDir(), \"logs/cockroach.log\"),\n\t\t)\n\t})\n}", "title": "" }, { "docid": "36f962eddbf7a739a224f07f234d1bce", "score": "0.46124396", "text": "func handleGetLogs(conn net.Conn, req *cellaserv.Request) {\n\tif req.Data == nil {\n\t\tlog.Warning(\"[Cellaserv] Log request does not specify event\")\n\t\tsendReplyError(conn, req, cellaserv.Reply_Error_BadArguments)\n\t\treturn\n\t}\n\n\tevent := string(req.Data)\n\tpattern := path.Join(*logRootDirectory, logSubDir, event+\".log\")\n\n\tif !strings.HasPrefix(pattern, path.Join(*logRootDirectory, logSubDir)) {\n\t\tlog.Warning(\"[Cellaserv] Don't try to do directory traversal\")\n\t\tsendReplyError(conn, req, cellaserv.Reply_Error_BadArguments)\n\t\treturn\n\t}\n\n\t// Globbing is allowed\n\tfilenames, err := filepath.Glob(pattern)\n\n\tif err != nil {\n\t\tlog.Warning(\"[Cellaserv] Invalid log globbing : %s, %s\", event, err)\n\t\tsendReplyError(conn, req, cellaserv.Reply_Error_BadArguments)\n\t\treturn\n\t}\n\n\tif len(filenames) == 0 {\n\t\tlog.Warning(\"[Cellaserv] No such logs: %s\", event)\n\t\tsendReplyError(conn, req, cellaserv.Reply_Error_BadArguments)\n\t\treturn\n\t}\n\n\tlogs := make(map[string]string)\n\n\tfor _, filename := range filenames {\n\t\tdata, err := ioutil.ReadFile(filename)\n\t\tif err != nil {\n\t\t\tlog.Warning(\"[Cellaserv] Could not open log: %s\", filename)\n\t\t\tsendReplyError(conn, req, cellaserv.Reply_Error_BadArguments)\n\t\t\treturn\n\t\t}\n\t\tlogs[filename] = string(data)\n\t}\n\n\tlogs_json, _ := json.Marshal(logs)\n\tsendReply(conn, req, logs_json)\n}", "title": "" }, { "docid": "c1a3bde71a2b47bd67a4e79f60cde3a1", "score": "0.45954168", "text": "func TestReadNewLogs(t *testing.T) {\n\tt.Parallel()\n\toperator, logReceived, tempDir := newTestFileOperator(t, nil, nil)\n\toperator.persister = testutil.NewMockPersister(\"test\")\n\n\t// Poll once so we know this isn't a new file\n\toperator.poll(context.Background())\n\tdefer operator.Stop()\n\n\t// Create a new file\n\ttemp := openTemp(t, tempDir)\n\twriteString(t, temp, \"testlog\\n\")\n\n\t// Poll a second time after the file has been created\n\toperator.poll(context.Background())\n\n\t// Expect the message to come through\n\twaitForMessage(t, logReceived, \"testlog\")\n}", "title": "" }, { "docid": "92698d35954dfa353e6d3cca18efd410", "score": "0.45939294", "text": "func (c *TrainingDataService) GetLogs(in *tds.Query, stream tds.TrainingData_GetLogsServer) (error) {\n\tlogr := logger.LocLogger(logger.LogServiceBasic(LogkeyTrainingDataService))\n\n\tdlogr := makeDebugLogger(logr.Logger, TdsDebugMode)\n\tdlogr.Debugf(\"function entry: %+v\", in)\n\n\tquery, shouldPostSortProcess, err := makeESQueryFromDlaasQuery(in)\n\tif err != nil {\n\t\tlogr.WithError(err).Errorf(\"Could not make elasticsearch query from submitted query: %+v\", *in)\n\t\treturn err\n\t}\n\tdlogr.Debugf(\"pos: %d, since: %s, shouldPostSortProcess: %t\", in.Pos, in.Since, shouldPostSortProcess)\n\n\tpagesize := int(in.Pagesize)\n\tif pagesize == 0 {\n\t\tpagesize = defaultPageSize\n\t}\n\n\tpos, isBackward := adjustOffsetPos( int(in.Pos) )\n\n\tres, err := c.executeQuery(query, isBackward, pos, pagesize, docTypeLog, shouldPostSortProcess, dlogr)\n\n\tif err != nil {\n\t\tlogr.WithError(err).Errorf(\"Search failed\")\n\t\treturn err\n\t}\n\n\tdlogr.Debugf(\"Found: %d out of %d\", len(res.Hits.Hits), res.TotalHits())\n\n\tif !(res.Hits == nil || res.Hits.Hits == nil || len(res.Hits.Hits) == 0) {\n\t\tlogLineRecord := new(tds.LogLine)\n\t\tstart := 0\n\t\tif isBackward {\n\t\t\tstart = len(res.Hits.Hits) - 1\n\t\t}\n\t\tcount := 0\n\n\t\tfor i := start; ; {\n\t\t\terr := json.Unmarshal(*res.Hits.Hits[i].Source, &logLineRecord)\n\t\t\tif err != nil {\n\t\t\t\tlogr.WithError(err).Errorf(\"Unmarshal from ES failed!\")\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = stream.Send(logLineRecord)\n\t\t\tif err != nil {\n\t\t\t\tlogr.WithError(err).Errorf(\"stream.Send failed\")\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif isBackward {\n\t\t\t\ti--\n\t\t\t\tif i < 0 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ti++\n\t\t\t\tif i >= len(res.Hits.Hits) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tcount++\n\t\t\tif count >= pagesize {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tdlogr.Debugf(\"function exit\")\n\treturn nil\n}", "title": "" }, { "docid": "81532e0d3f966aadb7522134042564f1", "score": "0.4581312", "text": "func playLog(ctx context.Context, hints FSMHints, dir string, client journal.Client,\n\ttailingCh chan<- struct{}, handoffCh <-chan Author, exitCh chan<- *FSM) (err error) {\n\n\tvar state = playerStateBackfill\n\tvar fsm *FSM\n\tvar files = make(fnodeFileMap) // Live Fnodes backed by local files.\n\tvar handoff Author // Author we will hand-off to on exit.\n\n\t// Error checks in this function consistently use |err| prior to returning.\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tcleanupAfterAbort(dir, files)\n\t\t} else if state != playerStateComplete {\n\t\t\t// |err| should be nil only on a successful playback completion.\n\t\t\tlog.WithField(\"state\", state).Panic(\"unexpected state\")\n\t\t} else {\n\t\t\texitCh <- fsm\n\t\t}\n\t\tclose(exitCh)\n\t}()\n\n\tif fsm, err = NewFSM(hints); err != nil {\n\t\treturn\n\t} else if err = preparePlayback(dir); err != nil {\n\t\treturn\n\t}\n\n\t// Issue a write barrier to determine the transactional, current log head.\n\tvar asyncAppend *journal.AsyncAppend\n\tif asyncAppend, err = client.Write(hints.Log, nil); err != nil {\n\t\treturn\n\t}\n\t<-asyncAppend.Ready\n\n\t// Next journal |mark| being read.\n\tvar mark = journal.Mark{Journal: hints.Log, Offset: 0}\n\t// Offset we expect to have read through prior to exiting\n\tvar writeHead = asyncAppend.WriteHead\n\n\tvar reader = newPlayerReader(ctx, mark, client)\n\tdefer func() { reader.abort() }() // Defer must be wrapped, as |reader| may change.\n\n\tfor {\n\n\t\tif s := fsm.hintedSegments; len(s) != 0 && s[0].FirstOffset > mark.Offset {\n\t\t\t// Use hinted offset to opportunistically skip through dead chunks of the log.\n\t\t\t// Note that FSM is responsible for updating |hintedSegments| as they're applied.\n\t\t\tmark.Offset = s[0].FirstOffset\n\t\t} else if state == playerStateBackfill && mark.Offset == writeHead {\n\t\t\t// We've completed back-fill and are now tailing the journal.\n\t\t\tstate = playerStateTail\n\t\t\tclose(tailingCh)\n\t\t}\n\n\t\tswitch state {\n\t\tcase playerStateBackfill, playerStateTail, playerStateReadHandoffBarrier:\n\t\t\t// Always perform blocking reads from these states.\n\t\t\treader = prepareRead(ctx, reader, mark.Offset, true)\n\t\tcase playerStateExitAtHead, playerStateInjectHandoffAtHead:\n\t\t\t// If we believe we're at the log head and want to do something once we confirm it\n\t\t\t// (exit, or inject a no-op), use non-blocking reads.\n\t\t\treader = prepareRead(ctx, reader, mark.Offset, mark.Offset < writeHead)\n\t\t}\n\n\t\t// Begin a read of the next operation. Wait for it to error or for the\n\t\t// first byte to be ready, or to be signaled for hand-off.\n\t\tselect {\n\t\tcase err = <-reader.peek():\n\t\t\treader.pendingPeek = false\n\t\t\tbreak\n\n\t\tcase handoff = <-handoffCh:\n\t\t\t// We've been signaled to complete playback and exit when we're able.\n\t\t\tswitch state {\n\t\t\tcase playerStateBackfill, playerStateTail:\n\t\t\t\tif handoff == 0 {\n\t\t\t\t\tstate = playerStateExitAtHead\n\t\t\t\t} else {\n\t\t\t\t\tstate = playerStateInjectHandoffAtHead\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tlog.WithField(\"state\", state).Panic(\"unexpected state\")\n\t\t\t}\n\t\t\thandoffCh = nil // Do not select again.\n\t\t\tcontinue\n\t\t}\n\n\t\tif err == journal.ErrNotYetAvailable {\n\t\t\tif mark.Offset < writeHead {\n\t\t\t\t// This error is returned only by a non-blocking reader, and we should have used\n\t\t\t\t// a non-blocking reader only if we were already at |writeHead|.\n\t\t\t\tlog.WithFields(log.Fields{\"mark\": mark, \"writeHead\": writeHead}).\n\t\t\t\t\tPanic(\"unexpected ErrNotYetAvailable\")\n\t\t\t}\n\n\t\t\tswitch state {\n\t\t\tcase playerStateExitAtHead:\n\t\t\t\tstate = playerStateComplete\n\t\t\t\terr = makeLive(dir, fsm, files)\n\t\t\t\treturn\n\n\t\t\tcase playerStateInjectHandoffAtHead:\n\t\t\t\tvar noop = frameRecordedOp(RecordedOp{\n\t\t\t\t\tSeqNo: fsm.NextSeqNo,\n\t\t\t\t\tChecksum: fsm.NextChecksum,\n\t\t\t\t\tAuthor: handoff,\n\t\t\t\t}, nil)\n\n\t\t\t\tif asyncAppend, err = client.Write(mark.Journal, noop); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t<-asyncAppend.Ready\n\n\t\t\t\t// We next must read through the op we just wrote.\n\t\t\t\tstate, writeHead = playerStateReadHandoffBarrier, asyncAppend.WriteHead\n\n\t\t\tdefault:\n\t\t\t\tlog.WithField(\"state\", state).Panic(\"invalid state\")\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\t// Any other Peek error aborts playback.\n\t\t\treturn\n\t\t}\n\n\t\t// Gazette read operations can potentially update the log mark. Specifically,\n\t\t// if the requested offset has been deleted from the log, the broker will\n\t\t// return the next available offset.\n\t\tmark = reader.rr.AdjustedMark(reader.br)\n\t\t// The read result may have told us that the journal write-head increased,\n\t\t// in which case we want to be sure to read through that offset.\n\t\tif reader.rr.LastResult.WriteHead > writeHead {\n\t\t\twriteHead = reader.rr.LastResult.WriteHead\n\t\t}\n\n\t\tvar op RecordedOp\n\t\tvar applied bool\n\n\t\tif op, applied, err = playOperation(reader.br, mark, fsm, dir, files); err != nil {\n\t\t\treturn // playOperation returns only unrecoverable errors.\n\t\t}\n\n\t\t// Update |mark| again to reflect the next operation offset we intend to apply.\n\t\t// For byte-stream consistency, un-applied Write ops must skip |op.Length| bytes of the stream.\n\t\tif mark = reader.rr.AdjustedMark(reader.br); !applied && op.Write != nil {\n\t\t\tmark.Offset += op.Write.Length\n\t\t}\n\t\tif op.LastOffset != 0 && mark.Offset != op.LastOffset {\n\t\t\tlog.WithFields(log.Fields{\"op\": op, \"mark\": mark}).Panic(\"LastOffset must agree with mark\")\n\t\t}\n\n\t\t// Are we attempting to inject a hand-off and this operation matches our Author?\n\t\tif handoff != 0 && op.Author == handoff {\n\t\t\tif state != playerStateReadHandoffBarrier {\n\t\t\t\tlog.WithField(\"state\", state).Panic(\"unexpected state\")\n\t\t\t}\n\n\t\t\tif state, err = attemptCompletion(fsm, dir, files, applied); state == playerStateComplete || err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "82432aa2c13a4e8f46bec3b9a4a59769", "score": "0.45654905", "text": "func Logs(c *kubernetes.Clientset, config *rest.Config, pod *apiv1.Pod, container string) error {\n\tvar tailLines int64\n\ttailLines = 100\n\treq := c.CoreV1().Pods(pod.Namespace).GetLogs(\n\t\tpod.Name,\n\t\t&apiv1.PodLogOptions{\n\t\t\tContainer: container,\n\t\t\tTimestamps: true,\n\t\t\tFollow: true,\n\t\t\tTailLines: &tailLines,\n\t\t},\n\t)\n\treadCloser, err := req.Stream()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer readCloser.Close()\n\t_, err = io.Copy(os.Stdout, readCloser)\n\treturn err\n}", "title": "" }, { "docid": "28b21c22053d245a9ae6cf5071213927", "score": "0.4558926", "text": "func GetLogs(\n\tt *testing.T,\n\tprovider, region string,\n\tstackInfo RuntimeValidationStackInfo,\n\tquery operations.LogQuery,\n) *[]operations.LogEntry {\n\tsnap, err := stack.DeserializeDeploymentV3(\n\t\tcontext.Background(),\n\t\t*stackInfo.Deployment,\n\t\tstack.DefaultSecretsProvider)\n\tassert.NoError(t, err)\n\n\ttree := operations.NewResourceTree(snap.Resources)\n\tif !assert.NotNil(t, tree) {\n\t\treturn nil\n\t}\n\n\tcfg := map[config.Key]string{\n\t\tconfig.MustMakeKey(provider, \"region\"): region,\n\t}\n\tops := tree.OperationsProvider(cfg)\n\n\t// Validate logs from example\n\tlogs, err := ops.GetLogs(query)\n\tif !assert.NoError(t, err) {\n\t\treturn nil\n\t}\n\n\treturn logs\n}", "title": "" }, { "docid": "c71b51a44ad4fb55c1d14719d2ad52fa", "score": "0.4557703", "text": "func (vp *goTestParser) Logs() []string {\n\treturn vp.logs\n}", "title": "" }, { "docid": "9b67409e79262a8425c506f019f4e0e9", "score": "0.45513436", "text": "func (parse *Parse) ParseRedoLogs(logFileList []string) error {\n\tvar data []byte\n\tfor _, LogFile := range logFileList {\n\t\tfile, err := os.Open(LogFile)\n\t\tif err != nil {\n\t\t\tlogs.Error(\"Error while opening file, the error is \", err)\n\t\t\treturn err\n\t\t}\n\n\t\t// parse redo log header\n\t\tif err = parse.readRedoLogFileHeader(file); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// parse redo log checkpoint\n\t\tif err = parse.readRedoLogFileCheckpoint(file); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// parse left redo log block\n\t\tfor {\n\t\t\t// when parsing the redo log file, record the read position.\n\t\t\tblock, err := utils.ReadNextBytes(file, OS_FILE_LOG_BLOCK_SIZE)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Parse the redo block blockHeader.\n\t\t\t// The redo block consists of redo log blockHeader and redo log data.\n\t\t\tblockHeader, err := parse.readRedoBlockHeader(block)\n\t\t\tif err != nil || blockHeader.BlockDataLen == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// LOG_BLOCK_TRL_SIZE, for checksum.\n\t\t\tif blockHeader.BlockDataLen >= OS_FILE_LOG_BLOCK_SIZE {\n\t\t\t\tblockHeader.BlockDataLen -= LOG_BLOCK_TRL_SIZE\n\t\t\t}\n\n\t\t\t// Add all redo block data.\n\t\t\tdata = append(data, block[LOG_BLOCK_HDR_SIZE:blockHeader.BlockDataLen]...)\n\t\t}\n\t\tfile.Close()\n\t}\n\n\t// Start parse redo log data.\n\terr := parse.parseRedoBlockData(data)\n\tif err != nil {\n\t\tlogs.Error(\"parse redo block data failed, error: \", err.Error())\n\t}\n\treturn err\n}", "title": "" }, { "docid": "af42e4e1f69144e021478376b4abfa29", "score": "0.45375156", "text": "func DownloadLogs(incremental bool, filters []string) error {\n\tsrc, err := sources.Sources(data.Sources(), data.CrawlData(), LogCache)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = os.MkdirAll(LogCache, os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := FetchLock.Lock(false); err != nil {\n\t\treturn err\n\t}\n\tdefer FetchLock.Unlock()\n\n\tlogfetch.New().DownloadAndWait(xlogFilter(filters)(src.XlogSources()), incremental)\n\treturn nil\n}", "title": "" }, { "docid": "af9d3e724c0f6120bb1017d64fec563a", "score": "0.4533935", "text": "func (tx TransactionLogs) EthLogs() []*ethtypes.Log {\n\treturn LogsToEthereum(tx.Logs)\n}", "title": "" }, { "docid": "59acc6272e65fcbc995cdbb4e6100e32", "score": "0.4528684", "text": "func (a *accessLogs) checkLogs(t *testing.T) {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\tlog.Infof(\"Checking pod logs for request IDs...\")\n\tlog.Debuga(a.logs)\n\n\tfor cluster, apps := range a.logs {\n\t\tfor app := range apps {\n\t\t\tpods := a.getAppPods(t, app)\n\n\t\t\t// Check the logs for this app.\n\t\t\ta.checkLog(t, cluster, app, pods)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "df89e6f4bcd0880d42e0c53adb5b4009", "score": "0.45227802", "text": "func (loger *NeuronLogInput) neuronlogInitializer() error {\n\n\tif _, direrr := os.Stat(loger.Logpath); os.IsNotExist(direrr) {\n\n\t\tlogdirerr := os.Mkdir(loger.Logpath, 0644)\n\t\tif logdirerr != nil {\n\t\t\treturn err.LogDirError()\n\t\t}\n\t}\n\n\tif loger.Logpath != \"\" {\n\t\tif _, err1 := os.Stat(loger.Logpath + \"/neuronapp.log\"); os.IsNotExist(err1) {\n\t\t\tnewfile, err2 := os.Create(loger.Logpath + \"/neuronapp.log\")\n\t\t\tif err2 != nil {\n\t\t\t\treturn err.LogCreationError()\n\t\t\t}\n\t\t\tnewfile.Close()\n\n\t\t\tif loger.AppName != \"\" {\n\t\t\t\tAppName = loger.AppName\n\t\t\t}\n\t\t\tlogpath, logfilerr := os.OpenFile(loger.Logpath+\"/neuronapp.log\", os.O_APPEND|os.O_WRONLY, 0644)\n\t\t\tif logfilerr != nil {\n\t\t\t\treturn err.LogOpenError()\n\t\t\t}\n\t\t\tLogpath = logpath\n\t\t\treturn nil\n\t\t} else {\n\t\t\tif loger.AppName != \"\" {\n\t\t\t\tAppName = loger.AppName\n\t\t\t}\n\t\t\tlogpath, logfilerr := os.OpenFile(loger.Logpath+\"/neuronapp.log\", os.O_APPEND|os.O_WRONLY, 0644)\n\t\t\tif logfilerr != nil {\n\t\t\t\treturn err.LogOpenError()\n\t\t\t}\n\t\t\tLogpath = logpath\n\t\t\treturn nil\n\t\t}\n\t} else {\n\t\tif _, err1 := os.Stat(\"/var/log/neuron/neuronapp.log\"); os.IsNotExist(err1) {\n\t\t\tnewfile, err2 := os.Create(\"/var/log/neuron/neuronapp.log\")\n\t\t\tif err2 != nil {\n\t\t\t\treturn err.LogCreationError()\n\t\t\t}\n\t\t\tnewfile.Close()\n\n\t\t\tif loger.AppName != \"\" {\n\t\t\t\tAppName = loger.AppName\n\t\t\t}\n\t\t\tlogpath, logfilerr := os.OpenFile(\"/var/log/neuron/neuronapp.log\", os.O_APPEND|os.O_WRONLY, 0644)\n\t\t\tif logfilerr != nil {\n\t\t\t\treturn err.LogOpenError()\n\t\t\t}\n\t\t\tLogpath = logpath\n\t\t\treturn nil\n\t\t} else {\n\t\t\tif loger.AppName != \"\" {\n\t\t\t\tAppName = loger.AppName\n\t\t\t}\n\t\t\tlogpath, logfilerr := os.OpenFile(\"/var/log/neuron/neuronapp.log\", os.O_APPEND|os.O_WRONLY, 0644)\n\t\t\tif logfilerr != nil {\n\t\t\t\treturn err.LogOpenError()\n\t\t\t}\n\t\t\tLogpath = logpath\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e803c7508d6b23b8765258c3592275d", "score": "0.45186552", "text": "func NewLogFromEth(log *ethtypes.Log) *Log {\n\ttopics := make([]string, len(log.Topics))\n\tfor i := range log.Topics {\n\t\ttopics[i] = log.Topics[i].String()\n\t}\n\n\treturn &Log{\n\t\tAddress: log.Address.String(),\n\t\tTopics: topics,\n\t\tData: log.Data,\n\t\tBlockNumber: log.BlockNumber,\n\t\tTxHash: log.TxHash.String(),\n\t\tTxIndex: uint64(log.TxIndex),\n\t\tBlockHash: log.BlockHash.String(),\n\t\tRemoved: log.Removed,\n\t}\n}", "title": "" }, { "docid": "32686ed1103ea98ce763a6f7265ec235", "score": "0.45088533", "text": "func (r *TRuntime) LogReadLife(owner interface{}, key []byte) uint64 {\n\t_, life := r.LogRead(owner, r.Chain, key)\n\treturn life\n}", "title": "" }, { "docid": "7cf2f26e21f6cdf81ba3f05b698a9f32", "score": "0.45043445", "text": "func initLogs() {\n\tlogBuffer = log.NewLogBuffer(DefaultHttpLogBuffers)\n\tsrvLog = NewSrvLog()\n\n\ttrace.DebugLogger = srvLog\n\ttrace.ErrorLogger = srvLog\n\n\tgo func() {\n\t\tdefer crash.HandleAll()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase shutdownComplete := <-logShutdownChan:\n\t\t\t\tsrvLog.Close()\n\t\t\t\tshutdownComplete <- nil\n\t\t\t\treturn\n\t\t\tcase <-time.After(24 * time.Hour):\n\t\t\t\tsrvLog.Rotate()\n\t\t\tcase <-logRotateChan:\n\t\t\t\tsrvLog.Rotate()\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "b3d0ab03fed60a397b96317b5ddc6b0e", "score": "0.44985688", "text": "func (rf *Raft) appendLogs() {\n\tappendLogTicker := time.NewTicker(200 * time.Millisecond)\n\tfor !rf.killed() {\n\t\tselect {\n\t\tcase <-rf.appendLogCh:\n\t\t\trf.Lock(\"appendLogs::1\")\n\t\t\tvar msgs []ApplyMsg\n\t\t\toldCommitIdx := rf.commitIndex\n\t\t\t// See if we need to send the snapshot to the service\n\t\t\tif rf.installSnapshot {\n\t\t\t\trf.installSnapshot = false\n\t\t\t\tmsgs = append(msgs, ApplyMsg{\n\t\t\t\t\tSnapshotValid: true,\n\t\t\t\t\tSnapshot: rf.snapshot,\n\t\t\t\t\tSnapshotTerm: rf.lastSnapshotTerm,\n\t\t\t\t\tSnapshotIndex: rf.lastSnapshotIndex,\n\t\t\t\t})\n\t\t\t\trf.commitIndex = max(rf.commitIndex, rf.lastSnapshotIndex)\n\t\t\t}\n\t\t\t// Check if commit index is increased\n\t\t\tfor commitIdx := rf.commitIndex + 1; commitIdx < len(rf.logs)+rf.lastSnapshotIndex+1; commitIdx++ {\n\t\t\t\tcnt := 0\n\t\t\t\tfor _, nodeCommitIdx := range rf.matchIndex {\n\t\t\t\t\tif nodeCommitIdx >= commitIdx {\n\t\t\t\t\t\tcnt++\n\t\t\t\t\t\tif cnt > len(rf.peers)/2 {\n\t\t\t\t\t\t\tif rf.currentTerm == rf.logs[commitIdx-rf.lastSnapshotIndex-1].Term {\n\t\t\t\t\t\t\t\trf.commitIndex = commitIdx\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif cnt <= len(rf.peers)/2 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif oldCommitIdx != rf.commitIndex {\n\t\t\t\tlog.Printf(\"[%d] Updated Commit Index: %d\", rf.me, rf.commitIndex)\n\t\t\t}\n\t\t\tfor i := rf.lastApplied + 1; i <= rf.commitIndex; i++ {\n\t\t\t\tif i <= rf.lastSnapshotIndex {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tmsgs = append(msgs, ApplyMsg{\n\t\t\t\t\tCommandValid: true,\n\t\t\t\t\tCommand: rf.logs[i-rf.lastSnapshotIndex-1].Cmd,\n\t\t\t\t\tCommandIndex: i,\n\t\t\t\t})\n\t\t\t}\n\t\t\trf.Unlock(\"appendLogs::1\")\n\n\t\t\tfor _, msg := range msgs {\n\t\t\t\trf.applyCh <- msg\n\t\t\t\trf.Lock(\"appendLogs::2\")\n\t\t\t\tif msg.SnapshotValid {\n\t\t\t\t\trf.lastApplied = max(rf.lastApplied, msg.SnapshotIndex)\n\t\t\t\t} else {\n\t\t\t\t\trf.lastApplied = max(rf.lastApplied, msg.CommandIndex)\n\t\t\t\t}\n\t\t\t\trf.Unlock(\"appendLogs::2\")\n\t\t\t}\n\t\tcase <-appendLogTicker.C:\n\t\t\trf.appendLogCh <- true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0e5ab4f620d50a062a09793f3ea5bdb4", "score": "0.4496015", "text": "func Logs(ctx context.Context, logChan chan tailer.ContainerLogLine, wg *sync.WaitGroup, cluster *kubernetes.Cluster, follow bool, app, stageID, org string) error {\n\tlogger := tracelog.NewLogger().WithName(\"logs-backend\").V(2)\n\tselector := labels.NewSelector()\n\n\tvar selectors [][]string\n\tif stageID == \"\" {\n\t\tselectors = [][]string{\n\t\t\t{\"app.kubernetes.io/component\", \"application\"},\n\t\t\t{\"app.kubernetes.io/managed-by\", \"epinio\"},\n\t\t\t{\"app.kubernetes.io/part-of\", org},\n\t\t\t{\"app.kubernetes.io/name\", app},\n\t\t}\n\t} else {\n\t\tselectors = [][]string{\n\t\t\t{\"app.kubernetes.io/component\", \"staging\"},\n\t\t\t{\"app.kubernetes.io/managed-by\", \"epinio\"},\n\t\t\t{models.EpinioStageIDLabel, stageID},\n\t\t\t{\"app.kubernetes.io/part-of\", org},\n\t\t}\n\t}\n\n\tfor _, req := range selectors {\n\t\treq, err := labels.NewRequirement(req[0], selection.Equals, []string{req[1]})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tselector = selector.Add(*req)\n\t}\n\n\tconfig := &tailer.Config{\n\t\tContainerQuery: regexp.MustCompile(\".*\"),\n\t\tExcludeContainerQuery: regexp.MustCompile(\"linkerd-(proxy|init)\"),\n\t\tContainerState: \"running\",\n\t\tExclude: nil,\n\t\tInclude: nil,\n\t\tTimestamps: false,\n\t\tSince: duration.LogHistory(),\n\t\tAllNamespaces: true,\n\t\tLabelSelector: selector,\n\t\tTailLines: nil,\n\t\tNamespace: \"\",\n\t\tPodQuery: regexp.MustCompile(\".*\"),\n\t}\n\n\tif follow {\n\t\tlogger.Info(\"stream\")\n\t\treturn tailer.StreamLogs(ctx, logChan, wg, config, cluster)\n\t}\n\n\tlogger.Info(\"fetch\")\n\treturn tailer.FetchLogs(ctx, logChan, wg, config, cluster)\n}", "title": "" }, { "docid": "db507ad5c4d522b5c4c7f60080a6c191", "score": "0.44889742", "text": "func LogDownload(typ string, statuscode int, p *mirrors.Results, err error) {\n\tdlogger.RLock()\n\tdefer dlogger.RUnlock()\n\n\tif dlogger.l == nil {\n\t\t// Logs are disabled\n\t\treturn\n\t}\n\n\terrstr := \"<unknown>\"\n\tif err != nil {\n\t\terrstr = err.Error()\n\t}\n\n\tif (statuscode == 302 || statuscode == 200) && p != nil && len(p.MirrorList) > 0 {\n\t\tvar distance, countries string\n\t\tm := p.MirrorList[0]\n\t\tdistance = strconv.FormatFloat(float64(m.Distance), 'f', 2, 32)\n\t\tcountries = strings.Join(m.CountryFields, \",\")\n\t\tfallback := \"\"\n\t\tif p.Fallback == true {\n\t\t\tfallback = \" fallback:true\"\n\t\t}\n\t\tsameASNum := \"\"\n\t\tif m.Asnum > 0 && m.Asnum == p.ClientInfo.ASNum {\n\t\t\tsameASNum = \"same\"\n\t\t}\n\n\t\tdlogger.l.Printf(\"%s %d \\\"%s\\\" ip:%s mirror:%s%s %sasn:%d distance:%skm countries:%s\",\n\t\t\ttyp, statuscode, p.FileInfo.Path, p.IP, m.Name, fallback, sameASNum, m.Asnum, distance, countries)\n\t} else if statuscode == 404 && p != nil {\n\t\tdlogger.l.Printf(\"%s 404 \\\"%s\\\" ip:%s\", typ, p.FileInfo.Path, p.IP)\n\t} else if statuscode == 500 && p != nil {\n\t\tmirrorName := \"unknown\"\n\t\tif len(p.MirrorList) > 0 {\n\t\t\tmirrorName = p.MirrorList[0].Name\n\t\t}\n\t\tdlogger.l.Printf(\"%s 500 \\\"%s\\\" ip:%s mirror:%s error:%s\", typ, p.FileInfo.Path, p.IP, mirrorName, errstr)\n\t} else {\n\t\tvar path, ip string\n\t\tif p != nil {\n\t\t\tpath = p.FileInfo.Path\n\t\t\tip = p.IP\n\t\t}\n\t\tdlogger.l.Printf(\"%s %d \\\"%s\\\" ip:%s error:%s\", typ, statuscode, path, ip, errstr)\n\t}\n}", "title": "" }, { "docid": "25b8e3490bec14a25e848856500d3854", "score": "0.44794124", "text": "func getLogsOld(s *LogStore, req *GetLogRequest) (*http.Response, []byte, *GetLogsResponse, error) {\n\n\th := map[string]string{\n\t\t\"x-log-bodyrawsize\": \"0\",\n\t\t\"Accept\": \"application/json\",\n\t}\n\n\turlVal := req.ToURLParams()\n\n\turi := fmt.Sprintf(\"/logstores/%s?%s\", s.Name, urlVal.Encode())\n\tr, err := request(s.project, \"GET\", uri, h, nil)\n\tif err != nil {\n\t\treturn nil, nil, nil, NewClientError(err)\n\t}\n\tdefer r.Body.Close()\n\n\tbody, _ := ioutil.ReadAll(r.Body)\n\tif r.StatusCode != http.StatusOK {\n\t\terr := new(Error)\n\t\tif jErr := json.Unmarshal(body, err); jErr != nil {\n\t\t\treturn nil, nil, nil, NewBadResponseError(string(body), r.Header, r.StatusCode)\n\t\t}\n\t\treturn nil, nil, nil, err\n\t}\n\n\tcount, err := strconv.ParseInt(r.Header.Get(GetLogsCountHeader), 10, 32)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\tvar contents string\n\tif _, ok := r.Header[GetLogsQueryInfo]; ok {\n\t\tif len(r.Header[GetLogsQueryInfo]) > 0 {\n\t\t\tcontents = r.Header[GetLogsQueryInfo][0]\n\t\t}\n\t}\n\thasSQL := false\n\tif r.Header.Get(HasSQLHeader) == \"true\" {\n\t\thasSQL = true\n\t}\n\n\treturn r, body, &GetLogsResponse{\n\t\tProgress: r.Header[ProgressHeader][0],\n\t\tCount: count,\n\t\tContents: contents,\n\t\tHasSQL: hasSQL,\n\t\tHeader: r.Header,\n\t}, nil\n}", "title": "" }, { "docid": "2267edc542a39061975bc7b5adb6f67e", "score": "0.44758123", "text": "func getLog(s *raftServer, logDirPath string) error {\n\tf, err := os.Create(logDirPath + \"/\" + strconv.Itoa(s.server.Pid()) + \".log\")\n\tif err != nil {\n\t\tfmt.Println(\"Error: Cannot create log files\")\n\t\treturn err\n\t}\n\ts.log = log.New(f, \"\", log.LstdFlags)\n\treturn err\n}", "title": "" }, { "docid": "a9fbffa2191222b47c49b01a8e858922", "score": "0.4469687", "text": "func LoadLogs(db gorp.SqlExecutor, id int64) ([]sdk.Log, error) {\n\tquery := `\n\t\tSELECT id, workflow_node_run_job_id, workflow_node_run_id, start, last_modified, done, step_order, value\n\t\tFROM workflow_node_run_job_logs\n\t\tWHERE workflow_node_run_job_id = $1\n\t\tORDER BY id`\n\trows, err := db.Query(query, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar logs []sdk.Log\n\tfor rows.Next() {\n\t\tl := &sdk.Log{}\n\t\tvar s, m, d time.Time\n\n\t\tif err := rows.Scan(&l.Id, &l.PipelineBuildJobID, &l.PipelineBuildID, &s, &m, &d, &l.StepOrder, &l.Val); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar err error\n\t\tl.Start, err = ptypes.TimestampProto(s)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tl.LastModified, err = ptypes.TimestampProto(m)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tl.Done, err = ptypes.TimestampProto(d)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlogs = append(logs, *l)\n\t}\n\treturn logs, nil\n}", "title": "" }, { "docid": "520d90ef520063b130357d9ec2d0eed7", "score": "0.44685906", "text": "func (fhc *historyConfig) GetLog(tag string, index int) (io.Reader, error) {\n\ttag = strings.Replace(tag, `\\`, \":\", -1)\n\ttag = strings.Replace(tag, `/`, \":\", -1)\n\tdirPath := path.Join(fhc.Directory, tag)\n\tfilePath := path.Join(dirPath, fmt.Sprintf(\"run-%d.log\", index))\n\treturn os.Open(filePath)\n}", "title": "" }, { "docid": "79f48a21a94f7b7e29a82cd07a1d2b93", "score": "0.44630316", "text": "func (server *Server) StreamAccessLogs(logStream als.AccessLogService_StreamAccessLogsServer) error {\n\tfor {\n\t\tdata, err := logStream.Recv()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thttpLog := data.GetHttpLogs()\n\t\tif httpLog != nil {\n\t\t\tfor _, entry := range httpLog.LogEntry {\n\t\t\t\tserver.log.V(4).Info(\"http log entry\", \"entry\", entry)\n\t\t\t\tfromIP := getDownstreamIP(entry)\n\t\t\t\tif fromIP == \"\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tupstreamCluster := entry.CommonProperties.UpstreamCluster\n\t\t\t\tsvcID := utils.UpstreamCluster2ServiceID(upstreamCluster)\n\n\t\t\t\ttoIP := getUpstreamIP(entry)\n\n\t\t\t\tif err := server.handler.HandleAccess(fromIP, svcID, toIP); err != nil {\n\t\t\t\t\tserver.log.Error(err, \"handle access error\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "00b19d64f39c96bb931b2e62e8339983", "score": "0.44200853", "text": "func getGetLogsCommand() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"logs <id> [options]\",\n\t\tShort: \"Get the logs for a test resource\",\n\t\tLong: `Outputs the complete logs for any test resource.\nTo output the logs from an onos-config node, get the node ID via 'onit get nodes'\nTo output the logs from a test, get the test ID from the test run or from 'onit get history'`,\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tstream, _ := cmd.Flags().GetBool(\"stream\")\n\n\t\t\t// Get the onit controller\n\t\t\tcontroller, err := runner.NewController()\n\t\t\tif err != nil {\n\t\t\t\texitError(err)\n\t\t\t}\n\n\t\t\t// Get the cluster ID\n\t\t\tclusterID, err := cmd.Flags().GetString(\"cluster\")\n\t\t\tif err != nil {\n\t\t\t\texitError(err)\n\t\t\t}\n\n\t\t\t// Get the cluster controller\n\t\t\tcluster, err := controller.GetCluster(clusterID)\n\t\t\tif err != nil {\n\t\t\t\texitError(err)\n\t\t\t}\n\n\t\t\t// If streaming is enabled, stream the logs to stdout. Otherwise, get the logs for all resources and print them.\n\t\t\tif stream {\n\t\t\t\treader, err := cluster.StreamLogs(args[0])\n\t\t\t\tif err != nil {\n\t\t\t\t\texitError(err)\n\t\t\t\t}\n\t\t\t\tdefer reader.Close()\n\t\t\t\tif err = printStream(reader); err != nil {\n\t\t\t\t\texitError(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresources, err := cluster.GetResources(args[0])\n\t\t\t\tif err != nil {\n\t\t\t\t\texitError(err)\n\t\t\t\t}\n\n\t\t\t\t// Iterate through resources and get/print logs\n\t\t\t\tnumResources := len(resources)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\texitError(err)\n\t\t\t\t}\n\n\t\t\t\toptions := parseLogOptions(cmd)\n\n\t\t\t\tfor i, resource := range resources {\n\t\t\t\t\tlogs, err := cluster.GetLogs(resource, options)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\texitError(err)\n\t\t\t\t\t}\n\t\t\t\t\tos.Stdout.Write(logs)\n\t\t\t\t\tif i+1 < numResources {\n\t\t\t\t\t\tfmt.Println(\"----\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}\n\n\tcmd.Flags().DurationP(\"since\", \"\", -1, \"Only return logs newer than a relative \"+\n\t\t\"duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be used\")\n\tcmd.Flags().Int64P(\"tail\", \"t\", -1, \"If set, the number of bytes to read from the \"+\n\t\t\"server before terminating the log output. This may not display a complete final line of logging, and may return \"+\n\t\t\"slightly more or slightly less than the specified limit.\")\n\n\tcmd.Flags().StringP(\"cluster\", \"c\", getDefaultCluster(), \"the cluster for which to load the history\")\n\tcmd.Flags().Lookup(\"cluster\").Annotations = map[string][]string{\n\t\tcobra.BashCompCustom: {\"__onit_get_clusters\"},\n\t}\n\tcmd.Flags().BoolP(\"stream\", \"s\", false, \"stream logs to stdout\")\n\treturn cmd\n}", "title": "" }, { "docid": "1a988675e97ffc00fa12077345ccb5d4", "score": "0.4415854", "text": "func (ec *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) {\n\tvar result []types.Log\n\terr := ec.c.CallContext(ctx, &result, \"eth_getLogs\", toFilterArg(q))\n\treturn result, err\n}", "title": "" }, { "docid": "067bf56c789d5e7a5ed4327ce6282f7f", "score": "0.44074786", "text": "func returnLogs(logs []*ethtypes.Log) []*ethtypes.Log {\n\tif logs == nil {\n\t\treturn []*ethtypes.Log{}\n\t}\n\treturn logs\n}", "title": "" }, { "docid": "fd14231252cedd21ee00ae8ba6e2cfa2", "score": "0.44016317", "text": "func (e *engine) Logs(ctx context.Context, t *task.Task) (io.ReadCloser, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "d0ce426e57694b4a3e8a95884e2997e6", "score": "0.4383844", "text": "func (tr *TRaft) internalMergeLogs(votes []*VoteReply) {\n\n\t// TODO if the leader chose Logs[i] from replica `r`, e.g. R[r].Logs[i]\n\t// then the logs R[r].Logs[:i] are safe to choose.\n\t// Because if a different R[r'].Logs[j] is committed, for a j <= i\n\t// the leader that written R[r].Log[i] must have chosen R[r'].Logs[j] .\n\t// ∴ R[r].Logs[j] == R[r'].Logs[j]\n\t//\n\t// For now 2021 Feb 14,\n\t// we just erase all non-committed logs on followers.\n\n\tid := tr.Id\n\tme := tr.Status[id]\n\n\tl := me.Accepted.Len()\n\tfor i := me.Accepted.Offset; i < l; i++ {\n\t\tif me.Accepted.Get(i) != 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tmaxCommitter := NewLeaderId(0, 0)\n\t\tvar maxRec *Record\n\t\t// var isCommitted bool\n\t\tfor _, vr := range votes {\n\t\t\tr := vr.PopRecord(i)\n\t\t\tfmt.Println(\"lsn:\", i, \"r:\", r.ShortStr())\n\t\t\tif r == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcmpRst := maxCommitter.Cmp(vr.Committer)\n\t\t\tif cmpRst == 0 {\n\t\t\t\tif !maxRec.Equal(r) {\n\t\t\t\t\tpanic(\"wtf: same committer different log\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif cmpRst < 0 {\n\t\t\t\tmaxCommitter = vr.Committer\n\t\t\t\tmaxRec = r\n\t\t\t}\n\n\t\t\t// if !isCommitted && vr.Committed.Get(i) != 0 {\n\t\t\t// isCommitted = true\n\t\t\t// }\n\t\t}\n\n\t\tif maxRec == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\ttr.Logs[i-tr.LogOffset] = maxRec\n\t\tme.Accepted.Set(i)\n\t\t// if isCommitted {\n\t\t// me.Committed.Set(i)\n\t\t// }\n\n\t\tlg.Infow(\"merge-log\",\n\t\t\t\"lsn\", i,\n\t\t\t\"committer\", maxCommitter,\n\t\t\t\"record\", maxRec)\n\t}\n}", "title": "" }, { "docid": "825709a11f21635eefd6497f88e35a2b", "score": "0.43825424", "text": "func (rf *Raft) logLen() int {\n\tif len(rf.logs) == 0 {\n\t\tpanic(fmt.Sprintf(\"Empty log from Raft %d\", rf.me))\n\t}\n\tbaseIndex := rf.logs[0].Msg.CommandIndex\n\treturn len(rf.logs) + baseIndex\n}", "title": "" }, { "docid": "c5ad7f224bc16696f27bb6e8a057c1b0", "score": "0.43764627", "text": "func (cnv *Conveyor) Logs() <-chan Message {\n\tiCtxData := cnv.ctx.GetData()\n\tif iCtxData != nil {\n\t\tctxData, _ := iCtxData.(CtxData)\n\t\treturn ctxData.logs\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "64a2975ad7f9b40beeeb3a41ff00ee38", "score": "0.43750763", "text": "func (c *Client) Logs(ctx context.Context) *LogIterator {\n\tit := &LogIterator{\n\t\tparentResource: c.parent,\n\t\tit: c.lClient.ListLogs(ctx, &logpb.ListLogsRequest{Parent: c.parent}),\n\t}\n\tit.pageInfo, it.nextFunc = iterator.NewPageInfo(\n\t\tit.fetch,\n\t\tfunc() int { return len(it.items) },\n\t\tfunc() interface{} { b := it.items; it.items = nil; return b })\n\treturn it\n}", "title": "" }, { "docid": "5af286290718ca6e3a699a620251aa45", "score": "0.43747318", "text": "func readLogsFromFile(fname string, queue chan<- Logline, shutdown chan<- string, savestate <-chan bool) {\n\tvar statefile string\n\tvar offset int64\n\tvar inode uint64\n\tvar doFollowFile bool = !*options.nofollow\n\n\tif *options.verbose {\n\t\tlog.Printf(\"readLogsFromFile: dofollow=%v\", doFollowFile)\n\t}\n\n\tif doFollowFile {\n\t\tstatefile = fname + \".state\"\n\t\tinode = readFileInode(fname)\n\t\toffset = readStateFile(fname, statefile, inode)\n\t}\n\n\t// setup\n\tconfig := tail.Config{\n\t\tFollow: doFollowFile,\n\t\tReOpen: doFollowFile,\n\t\tMustExist: true,\n\t\tLogger: tail.DiscardingLogger,\n\t\tLocation: &tail.SeekInfo{\n\t\t\tOffset: offset,\n\t\t\tWhence: 0,\n\t\t},\n\t}\n\tt, err := tail.TailFile(fname, config)\n\tif err != nil {\n\t\tshutdown <- fmt.Sprintf(\"cannot tail file %s: %v\", fname, err)\n\t} else if *options.verbose {\n\t\tlog.Printf(\"opened log file %s\", fname)\n\t}\n\n\t// now just sleep and wait for input and control channel\n\tfor {\n\t\tselect {\n\t\tcase line := <-t.Lines:\n\t\t\tif line != nil {\n\t\t\t\tqueue <- Logline(line.Text)\n\t\t\t} else {\n\t\t\t\tshutdown <- \"Logfile closed\"\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-savestate:\n\t\t\toffset, _ := t.Tell()\n\t\t\tif doFollowFile {\n\t\t\t\twriteStateFile(statefile, inode, offset)\n\t\t\t}\n\t\t\tif *options.verbose {\n\t\t\t\tlog.Printf(\"reading %s, now at offset %d\", fname, offset)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e1ccf1757fe51090e2a4b8732eb85ed3", "score": "0.43732208", "text": "func (o *GetLogsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetLogsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetLogsBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 401:\n\t\tresult := NewGetLogsUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewGetLogsInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "f2bedacee140faeed84a6e8b566922fa", "score": "0.43722117", "text": "func benchmarkLogApply(b *testing.B, logN int) {\n\twarnf(\"== BenchmarkLogApply (%d) ====================================\", b.N)\n\n\tlogs := make([]*raft.Log, logN)\n\tt := NewTransport()\n\tvar ptrs []string\n\tfor i := 0; i < logN; i++ {\n\t\t// Create log.\n\t\tl := raft.NewLog()\n\t\tl.URL = &url.URL{Host: fmt.Sprintf(\"log%d\", i)}\n\t\tl.FSM = &BenchmarkFSM{}\n\t\tl.DebugEnabled = true\n\t\tl.Transport = t\n\t\tt.register(l)\n\n\t\t// Open log.\n\t\tif err := l.Open(tempfile()); err != nil {\n\t\t\tb.Fatalf(\"open: %s\", err)\n\t\t}\n\n\t\t// Initialize or join.\n\t\tif i == 0 {\n\t\t\tif err := l.Initialize(); err != nil {\n\t\t\t\tb.Fatalf(\"initialize: %s\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tif err := l.Join(logs[0].URL); err != nil {\n\t\t\t\tb.Fatalf(\"initialize: %s\", err)\n\t\t\t}\n\t\t}\n\n\t\tptrs = append(ptrs, fmt.Sprintf(\"%d/%p\", i, l))\n\t\tlogs[i] = l\n\t}\n\twarn(\"LOGS:\", strings.Join(ptrs, \" \"))\n\tb.ResetTimer()\n\n\t// Apply commands to leader.\n\tvar index uint64\n\tvar err error\n\tfor i := 0; i < b.N; i++ {\n\t\tindex, err = logs[0].Apply(make([]byte, 50))\n\t\tif err != nil {\n\t\t\tb.Fatalf(\"apply: %s\", err)\n\t\t}\n\t}\n\n\t// Wait for all logs to catch up.\n\tfor i, l := range logs {\n\t\tif err := l.Wait(index); err != nil {\n\t\t\tb.Fatalf(\"wait(%d): %s\", i, err)\n\t\t}\n\t}\n\tb.StopTimer()\n\n\t// Verify FSM indicies match.\n\tfor i, l := range logs {\n\t\tif fsm := l.FSM.(*BenchmarkFSM); index != fsm.index {\n\t\t\tb.Errorf(\"fsm index mismatch(%d): exp=%d, got=%d\", i, index, fsm.index)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2cae4dc670ea91f4844ef7008d8db6ee", "score": "0.43594423", "text": "func TestReadExistingAndNewLogs(t *testing.T) {\n\tt.Parallel()\n\toperator, logReceived, tempDir := newTestFileOperator(t, nil, nil)\n\toperator.persister = testutil.NewMockPersister(\"test\")\n\n\t// Start with a file with an entry in it, and expect that entry\n\t// to come through when we poll for the first time\n\ttemp := openTemp(t, tempDir)\n\twriteString(t, temp, \"testlog1\\n\")\n\toperator.poll(context.Background())\n\twaitForMessage(t, logReceived, \"testlog1\")\n\n\t// Write a second entry, and expect that entry to come through\n\t// as well\n\twriteString(t, temp, \"testlog2\\n\")\n\toperator.poll(context.Background())\n\twaitForMessage(t, logReceived, \"testlog2\")\n}", "title": "" }, { "docid": "bb26cf185e24a917da9b2ae4d16e7f2e", "score": "0.43578207", "text": "func (p *BinlogAdapter) readDeltalog(logPath string) ([]string, error) {\n\t// open the delta log file\n\tbinlogFile, err := NewBinlogFile(p.chunkManager)\n\tif err != nil {\n\t\tlog.Warn(\"Binlog adapter: failed to initialize binlog file\", zap.String(\"logPath\", logPath), zap.Error(err))\n\t\treturn nil, fmt.Errorf(\"failed to initialize binlog file '%s', error: %w\", logPath, err)\n\t}\n\n\terr = binlogFile.Open(logPath)\n\tif err != nil {\n\t\tlog.Warn(\"Binlog adapter: failed to open delta log\", zap.String(\"logPath\", logPath), zap.Error(err))\n\t\treturn nil, fmt.Errorf(\"failed to open delta log '%s', error: %w\", logPath, err)\n\t}\n\tdefer binlogFile.Close()\n\n\t// delta log type is varchar, return a string array(marshaled from an array of storage.DeleteLog objects)\n\tdata, err := binlogFile.ReadVarchar()\n\tif err != nil {\n\t\tlog.Warn(\"Binlog adapter: failed to read delta log\", zap.String(\"logPath\", logPath), zap.Error(err))\n\t\treturn nil, fmt.Errorf(\"failed to read delta log '%s', error: %w\", logPath, err)\n\t}\n\tlog.Info(\"Binlog adapter: successfully read deltalog\", zap.Int(\"deleteCount\", len(data)))\n\n\treturn data, nil\n}", "title": "" }, { "docid": "99e18fd0b5f611d4282b07f20df71d0e", "score": "0.43471786", "text": "func (rf *Raft) TrackAppendEntries(server int) bool {\n\trole := 1\n\tfor !rf.killed() {\n\t\trf.mu.Lock()\n\t\tlastLogIndex := len(rf.log) - 1\n\t\tfollowerNextLogIndex := rf.nextIndex[server]\n\t\tprevLogIndex := followerNextLogIndex - 1\n\t\tprevLogTerm := -1\n\t\trole = rf.role\n\t\trf.mu.Unlock()\n\t\tif role != 1 {\n\t\t\tbreak\n\t\t}\n\t\tif prevLogIndex > -1 {\n\t\t\tprevLogTerm = rf.log[prevLogIndex].Term\n\t\t}\n\t\tif followerNextLogIndex <= lastLogIndex {\n\t\t\t//fmt.Printf(\"%d: follower %d last log index %d <= leader log index %d\\n\", rf.me, server, followerNextLogIndex, lastLogIndex)\n\t\t\targs := AppendLogEntriesArgs{\n\t\t\t\trf.currentTerm, rf.me, prevLogIndex, prevLogTerm, rf.log[followerNextLogIndex : lastLogIndex+1], rf.commitIndex}\n\t\t\treply := AppendLogEntriesReply{}\n\t\t\tok, newLeader := rf.SendAppendEntries(server, &args, &reply)\n\t\t\tif !ok {\n\t\t\t\t//fmt.Printf(\"%d: append log request to %d time out!\\n\", rf.me, server)\n\t\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif newLeader {\n\t\t\t\trf.updateTimestamp(\"NEW-LEADER\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif !reply.Success {\n\t\t\t\t//fmt.Printf(\"%d: log index of server %d back skip from %d to %d\\n\", rf.me, server, followerNextLogIndex, reply.ConflictTermFirstLogIndex)\n\t\t\t\trf.nextIndex[server] = reply.ConflictTermFirstLogIndex //skip all conflict term\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\t//fmt.Printf(\"%d: append log to %d sucessfully range [%d:%d]\\n\", rf.me, server, followerNextLogIndex, lastLogIndex)\n\t\t\t\trf.nextIndex[server] = lastLogIndex + 1\n\t\t\t\trf.matchIndex[server] = lastLogIndex\n\t\t\t}\n\t\t} else {\n\t\t\ttime.Sleep(20 * time.Millisecond) //track latest msg every 20 millisecond\n\t\t}\n\t}\n\treturn true\n\t// //fmt.Printf(\"%d: try append log %s to %d\\n\", rf.me, toJSON(args))\n}", "title": "" }, { "docid": "96774e7dc5b4b32edef4ce6499ef0291", "score": "0.4346995", "text": "func (tl *TransactionLogService) GetTransactionLogs(ctx context.Context, TransactionReceiptID uint) ([]*TransactionLog, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\terr := errors.New(\"Client closed connection\")\n\t\treturn nil, err\n\tdefault:\n\t\ttransLogs := []*TransactionLog{}\n\t\trows, err := tl.Db.QueryContext(ctx, `select\n id,\n\t\t\tblock_number,\n\t\t\tblock_hash,\n\t\t\taddress,\n\t\t\tlog_data,\n\t\t\ttx_hash,\n\t\t\ttx_index,\n\t\t\tlog_index,\n\t\t\tremoved,\n\t\t\tblock_id,\n\t\t\ttransaction_id,\n\t\t\ttransaction_receipt_id from transaction_logs where transaction_receipt_id = ?`, TransactionReceiptID)\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor rows.Next() {\n\t\t\ttransLog := TransactionLog{}\n\t\t\terr = rows.Scan(\n\t\t\t\t&transLog.ID,\n\t\t\t\t&transLog.BlockNumber,\n\t\t\t\t&transLog.BlockHash,\n\t\t\t\t&transLog.Address,\n\t\t\t\t&transLog.LogData,\n\t\t\t\t&transLog.TxHash,\n\t\t\t\t&transLog.TxIndex,\n\t\t\t\t&transLog.LogIndex,\n\t\t\t\t&transLog.Removed,\n\t\t\t\t&transLog.BlockID,\n\t\t\t\t&transLog.TransactionID,\n\t\t\t\t&transLog.TransactionReceiptID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttransactionLogTopicService := TransactionLogTopicService{Db: tl.Db}\n\t\t\ttopics, err := transactionLogTopicService.GetTransactionLogTopics(ctx, transLog.ID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttransLog.Topics = topics\n\t\t\ttransLogs = append(transLogs, &transLog)\n\t\t}\n\t\terr = rows.Close()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\terr = rows.Err()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\t\treturn transLogs, nil\n\t}\n}", "title": "" }, { "docid": "153ba92139629f2178fcfa1289cdd315", "score": "0.43434533", "text": "func TestLog(t *testing.T) {\n\tt.Parallel()\n\tpipeline := newTestPipeline(t, \"log\", \"commit1\", \"master\", \"0-1\", true)\n\tpachfile := `\nimage ubuntu\n\nrun echo \"foo\"\n`\n\terr := pipeline.runPachFile(strings.NewReader(pachfile))\n\trequire.NoError(t, err)\n\n\tlog, err := btrfs.ReadFile(path.Join(pipeline.outRepo, \"commit1-0\", \".log\"))\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"foo\\n\", string(log))\n\n\tpipeline = newTestPipeline(t, \"log\", \"commit2\", \"master\", \"0-1\", false)\n\tpachfile = `\nimage ubuntu\n\nrun echo \"bar\" >&2\n`\n\terr = pipeline.runPachFile(strings.NewReader(pachfile))\n\trequire.NoError(t, err)\n\n\tlog, err = btrfs.ReadFile(path.Join(pipeline.outRepo, \"commit2-0\", \".log\"))\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"bar\\n\", string(log))\n}", "title": "" }, { "docid": "bee99870596ff5a5b3e193d725952366", "score": "0.4343202", "text": "func NewClient(conf Config) (*Client, error) {\n\tif conf.Logger == nil {\n\t\treturn nil, errors.New(\"must pass a valid config with a logrus.Logger\")\n\t}\n\tclient := &Client{Logger: conf.Logger, Conf: conf}\n\tvar httpClient *http.Client\n\ttorUp := false\n\n\tclient.Debug(\"Starting tor proxy, please wait a few seconds...\")\n\tfor !torUp {\n\t\ttmpDataDir, err := ioutil.TempDir(\"\", \"tor-anon\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttorConf := &tor.StartConf{\n\t\t\tDataDir: tmpDataDir,\n\t\t}\n\t\tif conf.Region != \"\" {\n\t\t\trcPath, err := CreateTorRc(tmpDataDir, conf.Region)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\targs := []string{\"-f\", rcPath}\n\t\t\ttorConf.ExtraArgs = args\n\t\t}\n\t\tt, err := tor.Start(nil, torConf)\n\t\tif err != nil {\n\t\t\tclient.Debug(\"error starting tor process: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tclient.Tor = t\n\n\t\t// Wait at most a minute to start network and get\n\t\tdialCtx, _ := context.WithTimeout(context.Background(), time.Minute)\n\n\t\t// Make connection\n\t\tdialer, err := t.Dialer(dialCtx, nil)\n\t\tif err != nil {\n\t\t\tclient.Debug(\"error dialing Tor proxy: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tclient.Transport = &http.Transport{DialContext: dialer.DialContext}\n\n\t\thttpClient = &http.Client{Transport: client.Transport}\n\n\t\t// check that we can connect through tor proxy\n\t\tresp, err := httpClient.Get(\"https://check.torproject.org\")\n\t\tif err != nil && resp.StatusCode != 200 {\n\t\t\tclient.Debug(\"error connecting to Tor network, trying again...\")\n\t\t\tt.Close()\n\t\t\tcontinue\n\t\t} else {\n\t\t\trespBody, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\tclient.Debug(\"error connecting to Tor network, trying again...\")\n\t\t\t\tt.Close()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tre := regexp.MustCompile(`(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}`)\n\t\t\tip := re.FindString(string(respBody))\n\n\t\t\tclient.Debug(\"Successfully connected to Tor network...\")\n\t\t\tclient.Debug(\"Current Tor Edge IP: %s\", ip)\n\t\t\tclient.SetGeoData(ip)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tclient.Debug(\"Successful anonymous http client setup...\")\n\n\tclient.HTTPClient = httpClient\n\tclient.RetryWaitMin = defaultRetryWaitMin\n\tclient.RetryWaitMax = defaultRetryWaitMax\n\tclient.RetryMax = defaultRetryMax\n\tclient.CheckRetry = DefaultRetryPolicy\n\tclient.Backoff = DefaultBackoff\n\n\treturn client, nil\n}", "title": "" }, { "docid": "fd36287838a5f61c328aee87381ee401", "score": "0.43429497", "text": "func (d *debug) lastNLogs(n int) []string {\n\tif n <= 0 {\n\t\treturn []string{}\n\t}\n\tlogsCount := len(d.logs)\n\tif logsCount == 0 {\n\t\treturn []string{}\n\t}\n\tstartIndex := logsCount - n\n\tif startIndex < 0 {\n\t\tstartIndex = 0\n\t}\n\treturn d.logs[startIndex:]\n}", "title": "" }, { "docid": "cffe03f06638fa4b00c5bf5a69587c2f", "score": "0.43422002", "text": "func (_e *PodInterface_Expecter) GetLogs(name interface{}, opts interface{}) *PodInterface_GetLogs_Call {\n\treturn &PodInterface_GetLogs_Call{Call: _e.mock.On(\"GetLogs\", name, opts)}\n}", "title": "" }, { "docid": "ebd0de4a31f97950d44a45b938fd62fd", "score": "0.43335348", "text": "func (rf *Raft) readPersist(data []byte) {\n\tif data == nil || len(data) < 1 { // bootstrap without any state?\n\t\treturn\n\t}\n\tr := bytes.NewBuffer(data)\n\td := labgob.NewDecoder(r)\n\tvar stateCurrentTerm int\n\tvar stateVotedFor int\n\tvar stateLogLen int\n\n\tif d.Decode(&stateCurrentTerm) != nil ||\n\t\td.Decode(&stateVotedFor) != nil ||\n\t\td.Decode(&stateLogLen) != nil {\n\t\t// fmt.Println(\"Error reading persist data\")\n\t} else {\n\t\trf.currentTerm = stateCurrentTerm\n\t\trf.votedFor = stateVotedFor\n\t\ttmp := make([]LogEntry, stateLogLen)\n\t\tif d.Decode(&tmp) != nil {\n\t\t\t// fmt.Println(\"Error reading persist logs\")\n\t\t} else {\n\t\t\trf.log = tmp\n\t\t}\n\t}\t\n}", "title": "" }, { "docid": "2cd26e6af81ed9b52e0ca486d47bb781", "score": "0.4327696", "text": "func (l *Log) initializeLogrus(writer io.Writer) (*logrus.Logger, error) {\n\tlogger := logrus.New()\n\tlogger.SetOutput(writer)\n\tvar formatter logrus.Formatter\n\tf := l.config.LogFormat\n\tswitch f {\n\tcase \"json\":\n\t\tformatter = &logrus.JSONFormatter{}\n\tcase \"text\":\n\t\tformatter = &logrus.TextFormatter{FullTimestamp: true, QuoteEmptyFields: true}\n\tdefault:\n\t\treturn nil, errors.Errorf(\"illegal log format [%s], specify \\\"text\\\" or \\\"json\\\" with \\\"log.format\\\" key\", f)\n\t}\n\tlogger.SetFormatter(formatter)\n\tv := l.config.LogLevel\n\tlevel, err := logrus.ParseLevel(v)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"illegal log level [%s]\", v)\n\t}\n\tlogger.SetLevel(level)\n\treturn logger, nil\n}", "title": "" }, { "docid": "1eb135354523562b86b6a02f0dfc4bf0", "score": "0.43261978", "text": "func (ep *Endpoint) StreamLog(message chan string, start, end int) (int, error) {\n\tsize := end - start\n\tif size <= 0 {\n\t\treturn 0, fmt.Errorf(\"[ERROR] StreamLog : End should be larger than start\")\n\t}\n\n\tlog.Printf(\"[INFO] Getting log from %s:%d --> %d\\n\", ep.Downloadurl, start, end)\n\tresp, err := httpclient.Get(ep.Downloadurl + fmt.Sprintf(\"?start=%d&end=%d\", start, end))\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tbodyBytes, _ := ioutil.ReadAll(resp.Body)\n\t\treturn 0, fmt.Errorf(\"[DEBUG] Got wrong status code for %s: Code: %d Body: %q\", ep.Downloadurl, resp.StatusCode, bodyBytes)\n\t}\n\n\tvar leaves struct {\n\t\t// blah *struct{} // nil if notset\n\t\t// blah struct{} //empty\n\t\tEntries []struct {\n\t\t\tLeaf_input string `json:\"leaf_input\"`\n\t\t}\n\t}\n\n\terr = json.NewDecoder(resp.Body).Decode(&leaves)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tresponselength := len(leaves.Entries)\n\tif responselength == 0 {\n\t\treturn 0, fmt.Errorf(\"[DEBUG] Empty data for %s\", ep.Downloadurl)\n\t}\n\tfor _, leaf := range leaves.Entries {\n\t\tdomainlist, _ := getDomainFromLeaf(leaf.Leaf_input)\n\t\tif err != nil {\n\t\t\t// Ignore error so we can continue with the next leaf\n\t\t\tcontinue\n\t\t\t//return 0, err\n\t\t}\n\t\tfor _, s := range domainlist {\n\t\t\tmessage <- s\n\t\t}\n\n\t}\n\treturn responselength, nil\n}", "title": "" }, { "docid": "1e9cda04e410b10909ebea1a0d3bf091", "score": "0.43214086", "text": "func (s *GandalfServer) PrepareLogs(repository string, log repository.GitHistory) {\n\tif repo, index := s.findRepository(repository); index > -1 {\n\t\ts.repoLock.Lock()\n\t\trepo.History = log\n\t\ts.repos[index] = repo\n\t\ts.repoLock.Unlock()\n\t}\n}", "title": "" }, { "docid": "3a72817f7a139ee5984c41bddba77ee8", "score": "0.43212673", "text": "func (o *L2Domain) EventLogs(info *bambou.FetchingInfo) (EventLogsList, *bambou.Error) {\n\n\tvar list EventLogsList\n\terr := bambou.CurrentSession().FetchChildren(o, EventLogIdentity, &list, info)\n\treturn list, err\n}", "title": "" }, { "docid": "cdf4c0e3a6f9dfa166be89576155030e", "score": "0.43145365", "text": "func (e *PublicFilterAPI) GetLogs(criteria filters.FilterCriteria) ([]*ethtypes.Log, error) {\n\tvar filter *Filter\n\tif criteria.BlockHash != nil {\n\t\t/*\n\t\t\tStill need to add blockhash in prepare function for log entry\n\t\t*/\n\t\tfilter = NewBlockFilter(*criteria.BlockHash, criteria.Addresses, criteria.Topics)\n\t\tresults := e.getLogs()\n\t\tlogs := filterLogs(results, nil, nil, filter.addresses, filter.topics)\n\t\treturn logs, nil\n\t}\n\t// Convert the RPC block numbers into internal representations\n\tbegin := rpc.LatestBlockNumber.Int64()\n\tif criteria.FromBlock != nil {\n\t\tbegin = criteria.FromBlock.Int64()\n\t}\n\tfrom := big.NewInt(begin)\n\tend := rpc.LatestBlockNumber.Int64()\n\tif criteria.ToBlock != nil {\n\t\tend = criteria.ToBlock.Int64()\n\t}\n\tto := big.NewInt(end)\n\tresults := e.getLogs()\n\tlogs := filterLogs(results, from, to, criteria.Addresses, criteria.Topics)\n\n\treturn returnLogs(logs), nil\n}", "title": "" }, { "docid": "6a5e8ef2ed5ee2df1cfad015035d87e0", "score": "0.4314259", "text": "func (c *ContainerAPIClient) ContainerLogs(context.Context, string,\n\ttypes.ContainerLogsOptions) (io.ReadCloser, error) {\n\tif c.Logs == nil {\n\t\treturn nil, Err\n\t}\n\treturn c.Logs, nil\n}", "title": "" }, { "docid": "2e110927311f356c8468b5d6edf89e26", "score": "0.43133453", "text": "func applyLogs(client *tfe.Client, applyID string) (io.Reader, error) {\n\treturn client.Applies.Logs(context.Background(), applyID)\n}", "title": "" }, { "docid": "f1e398ea43680f3b4c905e1a9a360da1", "score": "0.43076867", "text": "func handleLogs(w http.ResponseWriter, r *http.Request) {\n\tcookie := getSecureCookie(r)\n\tisAdmin := cookie.TwitterUser == \"kjk\" // only I can see the logs\n\tmodel := struct {\n\t\tUserIsAdmin bool\n\t\tErrors []*TimestampedMsg\n\t\tNotices []*TimestampedMsg\n\t\tHeader *http.Header\n\t}{\n\t\tUserIsAdmin: isAdmin,\n\t}\n\n\tif model.UserIsAdmin {\n\t\tmodel.Errors = logger.GetErrors()\n\t\tmodel.Notices = logger.GetNotices()\n\t}\n\n\tif r.FormValue(\"show\") != \"\" {\n\t\tmodel.Header = &r.Header\n\t\tmodel.Header.Add(\"RealIp\", getIpAddress(r))\n\t}\n\n\tExecTemplate(w, tmplLogs, model)\n}", "title": "" }, { "docid": "eeae560f65ca5c05c291c641af91ac01", "score": "0.43067607", "text": "func logLinesAll(artifact lenses.Artifact) ([]string, error) {\n\tread, err := artifact.ReadAll()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read log %q: %v\", artifact.JobPath(), err)\n\t}\n\tlogLines := strings.Split(string(read), \"\\n\")\n\n\treturn logLines, nil\n}", "title": "" }, { "docid": "5fead99ca2b4987cc25473a146ddf3dd", "score": "0.43042135", "text": "func (o *UploadHostLogsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewUploadHostLogsNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewUploadHostLogsNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewUploadHostLogsInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "bb1592fa3508ef8e8f68450d710e1142", "score": "0.43022", "text": "func subLogs(ld *pdata.Logs, bufFront *logIndex, profilingBufFront *logIndex) *pdata.Logs {\n\tif ld == nil {\n\t\treturn ld\n\t}\n\n\tsubset := pdata.NewLogs()\n\tsubLogsByType(ld, bufFront, &subset, false)\n\tsubLogsByType(ld, profilingBufFront, &subset, true)\n\n\treturn &subset\n}", "title": "" }, { "docid": "3e616322ee2f3b4bb030badd23837943", "score": "0.43017957", "text": "func (r *Repo) Logs(ctx context.Context, key string) (<-chan svc.Log, error) {\n\tns, n, err := cache.SplitMetaNamespaceKey(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tw, err := r.al.Workflows(ns).Get(n)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar (\n\t\tch = make(chan svc.Log, 100)\n\t)\n\t// get logs and send to the channel.\n\terr = r.logsWorkflow(ctx, ch, w)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ch, nil\n}", "title": "" }, { "docid": "8c03cae2df9946413d345b4d5f4c2d60", "score": "0.43014282", "text": "func (cli *Client) TaskLogs(ctx context.Context, taskID string, options types.ContainerLogsOptions) (io.ReadCloser, error) {\n\tquery := url.Values{}\n\tif options.ShowStdout {\n\t\tquery.Set(\"stdout\", \"1\")\n\t}\n\n\tif options.ShowStderr {\n\t\tquery.Set(\"stderr\", \"1\")\n\t}\n\n\tif options.Since != \"\" {\n\t\tts, err := timetypes.GetTimestamp(options.Since, time.Now())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tquery.Set(\"since\", ts)\n\t}\n\n\tif options.Timestamps {\n\t\tquery.Set(\"timestamps\", \"1\")\n\t}\n\n\tif options.Details {\n\t\tquery.Set(\"details\", \"1\")\n\t}\n\n\tif options.Follow {\n\t\tquery.Set(\"follow\", \"1\")\n\t}\n\tquery.Set(\"tail\", options.Tail)\n\n\tresp, err := cli.get(ctx, \"/tasks/\"+taskID+\"/logs\", query, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.body, nil\n}", "title": "" }, { "docid": "cc7c5e27b3768cdc74db3f4b3533f8b4", "score": "0.42964783", "text": "func NewLog(config *Config) *Logs {\n\tlogs := new(Logs)\n\tlogs.logs = make(map[uint32]*replicaLog)\n\n\tfor _, peer := range config.Peers {\n\t\tlogs.logs[peer.PID] = &replicaLog{\n\t\t\tconflicts: make(map[string]uint64),\n\t\t\tinstances: make([]*pb.Instance, 0),\n\t\t}\n\t}\n\n\treturn logs\n}", "title": "" }, { "docid": "18a5e1077d485f285fb6a1849c743aa0", "score": "0.42898488", "text": "func (t *HTTPTransport) LogKeys() map[string]interface{} {\n\treturn httpLogkeys\n}", "title": "" }, { "docid": "7224a11c1f9001427c37246edf6c4ac7", "score": "0.42882708", "text": "func (o *License) EventLogs(info *bambou.FetchingInfo) (EventLogsList, *bambou.Error) {\n\n\tvar list EventLogsList\n\terr := bambou.CurrentSession().FetchChildren(o, EventLogIdentity, &list, info)\n\treturn list, err\n}", "title": "" }, { "docid": "6cb72ebaf42b5be948cfe045128faa24", "score": "0.42869577", "text": "func (t *Telemetries) AccessLogging(push *PushContext, proxy *Proxy, class networking.ListenerClass) []LoggingConfig {\n\tct := t.applicableTelemetries(proxy)\n\tif len(ct.Logging) == 0 && len(t.meshConfig.GetDefaultProviders().GetAccessLogging()) == 0 {\n\t\t// No Telemetry API configured, fall back to legacy mesh config setting\n\t\treturn nil\n\t}\n\n\tkey := loggingKey{\n\t\ttelemetryKey: ct.telemetryKey,\n\t\tClass: class,\n\t}\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\tprecomputed, ok := t.computedLoggingConfig[key]\n\tif ok {\n\t\treturn precomputed\n\t}\n\n\tproviders := mergeLogs(ct.Logging, t.meshConfig, workloadMode(class))\n\tcfgs := make([]LoggingConfig, 0, len(providers))\n\tfor p, v := range providers {\n\t\tfp := t.fetchProvider(p)\n\t\tif fp == nil {\n\t\t\tlog.Debugf(\"fail to fetch provider %s\", p)\n\t\t\tcontinue\n\t\t}\n\t\tcfg := LoggingConfig{\n\t\t\tProvider: fp,\n\t\t\tFilter: v.Filter,\n\t\t\tDisabled: v.Disabled,\n\t\t}\n\n\t\tal := telemetryAccessLog(push, fp)\n\t\tif al == nil {\n\t\t\t// stackdriver will be handled in HTTPFilters/TCPFilters\n\t\t\tcontinue\n\t\t}\n\t\tcfg.AccessLog = al\n\t\tcfgs = append(cfgs, cfg)\n\t}\n\n\tt.computedLoggingConfig[key] = cfgs\n\treturn cfgs\n}", "title": "" } ]
7226c446048155d30697d934c92b422f
String writes the ImageViewData struct to a string.
[ { "docid": "e384560ab0a0f4ec9432482d573ceac5", "score": "0.79989535", "text": "func (ivData *ImageViewData) String() string {\n\treturn ivData.toString(true)\n}", "title": "" } ]
[ { "docid": "1fe10b2f86343eebb3d393693ecaab57", "score": "0.7025396", "text": "func (obj Img) String() string {\n\tif data, err := json.Marshal(obj); err != nil {\n\t\treturn fmt.Sprintf(\"<Img Id=%v>\", obj.Id)\n\t} else {\n\t\treturn string(data)\n\t}\n}", "title": "" }, { "docid": "9cd8a9e511aed5952a71f666efd41630", "score": "0.6327114", "text": "func (s CreateImageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9dd1bf6b40736986383bb499160f6048", "score": "0.6307472", "text": "func (s ImageInfo) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "da02c0bd146f4bd4990c619142f4d817", "score": "0.62766874", "text": "func (s Image) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "448e9dc6427d48ab5743c46deb4b5cfc", "score": "0.62717646", "text": "func (s ImageBuilder) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2edf813e7dd4a59a505e2f1ee79e617c", "score": "0.62331903", "text": "func (img ImageRef) String() string {\n\treturn CF.TypeRef(img).String()\n}", "title": "" }, { "docid": "f1fb7170635ec5a8d757193d2c56e2d1", "score": "0.62095875", "text": "func (s Image) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f1fb7170635ec5a8d757193d2c56e2d1", "score": "0.62095875", "text": "func (s Image) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f1fb7170635ec5a8d757193d2c56e2d1", "score": "0.62095875", "text": "func (s Image) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "aaad957be191092f87fa8b7414166f3c", "score": "0.6182624", "text": "func (s UsageImageInfoType) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "58eaab85901bd7267ee210648d517cd4", "score": "0.6171628", "text": "func (s NiftyAssociateImageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "00537a1bbc0735295ef29416e4dc4f14", "score": "0.6156835", "text": "func (n *NBitmap) String() string {\r\n\tvar buf bytes.Buffer\r\n\tbuf.WriteByte('{')\r\n\tfor i, word := range n.words {\r\n\t\tif word != 0 {\r\n\t\t\tfor j := 0; j < bitSize; j++ {\r\n\t\t\t\tif word&(1<<bitInt(j)) != 0 {\r\n\t\t\t\t\tif buf.Len() > len(\"{\") {\r\n\t\t\t\t\t\tbuf.WriteByte(' ')\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfmt.Fprintf(&buf, \"%d\", bitSize*i+j)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tbuf.WriteByte('}')\r\n\treturn buf.String()\r\n}", "title": "" }, { "docid": "d54221a142b129865ea5c35e5338d2f5", "score": "0.61397517", "text": "func (img *ContentStreamInlineImage) WriteString() string {\n\tvar output bytes.Buffer\n\n\t// We do not start with \"BI\" as that is the operand and is written out separately.\n\t// Write out the parameters\n\ts := \"\"\n\n\tif img.BitsPerComponent != nil {\n\t\ts += \"/BPC \" + img.BitsPerComponent.WriteString() + \"\\n\"\n\t}\n\tif img.ColorSpace != nil {\n\t\ts += \"/CS \" + img.ColorSpace.WriteString() + \"\\n\"\n\t}\n\tif img.Decode != nil {\n\t\ts += \"/D \" + img.Decode.WriteString() + \"\\n\"\n\t}\n\tif img.DecodeParms != nil {\n\t\ts += \"/DP \" + img.DecodeParms.WriteString() + \"\\n\"\n\t}\n\tif img.Filter != nil {\n\t\ts += \"/F \" + img.Filter.WriteString() + \"\\n\"\n\t}\n\tif img.Height != nil {\n\t\ts += \"/H \" + img.Height.WriteString() + \"\\n\"\n\t}\n\tif img.ImageMask != nil {\n\t\ts += \"/IM \" + img.ImageMask.WriteString() + \"\\n\"\n\t}\n\tif img.Intent != nil {\n\t\ts += \"/Intent \" + img.Intent.WriteString() + \"\\n\"\n\t}\n\tif img.Interpolate != nil {\n\t\ts += \"/I \" + img.Interpolate.WriteString() + \"\\n\"\n\t}\n\tif img.Width != nil {\n\t\ts += \"/W \" + img.Width.WriteString() + \"\\n\"\n\t}\n\toutput.WriteString(s)\n\n\toutput.WriteString(\"ID \")\n\toutput.Write(img.stream)\n\toutput.WriteString(\"\\nEI\\n\")\n\n\treturn output.String()\n}", "title": "" }, { "docid": "b7fe2efd23aa890e8edac8bb550629c1", "score": "0.6128779", "text": "func (s VirtualNodeData) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0166799179f54cf6924968c5afb6377c", "score": "0.61122805", "text": "func (s ModifyImageAttributeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f2e7da2b64c8f3cf6cc858a0a840459c", "score": "0.60947096", "text": "func (s SnapShot) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "eb6dca2ea5eaa0459807b44d0292770e", "score": "0.60694706", "text": "func (s CopyImageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "481807950e368137f370541bd3dda230", "score": "0.6042573", "text": "func (s DeleteImageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "481807950e368137f370541bd3dda230", "score": "0.6041985", "text": "func (s DeleteImageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6ac703178a890aa693dceb2d9025a10f", "score": "0.6017403", "text": "func (s CreateImage) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "b217230a1196d6d30bfbb7288005e867", "score": "0.6013251", "text": "func (d Data) String() string {\n\treturn fmt.Sprintf(\"Data: %+v\", d.GetElements())\n}", "title": "" }, { "docid": "e540c50a4cfe9747ae1773867ac315a2", "score": "0.6003583", "text": "func (s MeshData) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "788fd66b2e75add93f49434f4f6cd932", "score": "0.59902096", "text": "func (s CreateImageBuilderOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "505f586b49eef62c8dd0f9b9d063022b", "score": "0.5979219", "text": "func (i imageRef) String() string {\n\treturn i.Name() + \":\" + i.tag + \"@\" + i.digest.String()\n}", "title": "" }, { "docid": "e3456ae1dfcd0c695a48bc1972bfd310", "score": "0.5969641", "text": "func (fd FileData) String() string{\r\n\treturn fmt.Sprintf(\"File name: %v -- Content Type: %v\", fd.name, fd.contentType)\r\n}", "title": "" }, { "docid": "034b945ea192c6e903baef3b9298ba58", "score": "0.5968167", "text": "func (b *Bitmap) String() string {\n\tw := new(strings.Builder)\n\tbitsToPrint := b.size % wordSize\n\tif bitsToPrint == 0 {\n\t\tbitsToPrint = wordSize\n\t}\n\n\tfor i := len(b.data) - 1; i >= 0; i-- {\n\t\tfmt.Fprintf(w, \"%0[2]*[1]b\", b.data[i], bitsToPrint)\n\t\tbitsToPrint = wordSize\n\t}\n\n\treturn w.String()\n}", "title": "" }, { "docid": "c034b9c83a7de01920159579c75e249a", "score": "0.5964047", "text": "func (arr NDArray) String() string {\n\tdims := make([]string, 0, len(arr.Shape))\n\tfor _, s := range arr.Shape {\n\t\tdims = append(dims, strconv.Itoa(s))\n\t}\n\treturn fmt.Sprintf(\"array<%s, %s> of shape [%s]\", arr.DataType.String(),\n\t\tarr.ByteOrder.String(), strings.Join(dims, \", \"))\n}", "title": "" }, { "docid": "28c3c416d6593fde5bc8ec185e2f2ede", "score": "0.5945878", "text": "func (s CompatibleImage) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2c0209bf9b98032e2e1cfff4530cc9ef", "score": "0.59448826", "text": "func (bv ByteView) String() string {\n\treturn string(bv.b)\n}", "title": "" }, { "docid": "0dec64b2cb3fa6ae82556ff06b22bdda", "score": "0.59259486", "text": "func (s ResourceDataContainer) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "938b12b3feb761089e7d31322c830233", "score": "0.59238786", "text": "func (s DataEncryptionMetadata) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5d4bd112d351246d2aa17a5f4ac976fe", "score": "0.5912478", "text": "func (s SnowflakeNodeData) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "27ba1472914ed944f5e9e2d5f18fdbf5", "score": "0.5890179", "text": "func (s DescribeImagesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "27ba1472914ed944f5e9e2d5f18fdbf5", "score": "0.5887005", "text": "func (s DescribeImagesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "27ba1472914ed944f5e9e2d5f18fdbf5", "score": "0.5887005", "text": "func (s DescribeImagesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "93791357a4dd2e71d8616690cc282267", "score": "0.5884108", "text": "func (r *RBitmap) String() string {\r\n\tvar buf bytes.Buffer\r\n\tbuf.WriteByte('{')\r\n\tfor i, word := range r.words {\r\n\t\tif word != 0 {\r\n\t\t\tfor j := 0; j < bitSize; j++ {\r\n\t\t\t\tif word&(1<<bitInt(j)) != 0 {\r\n\t\t\t\t\tif buf.Len() > len(\"{\") {\r\n\t\t\t\t\t\tbuf.WriteByte(' ')\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfmt.Fprintf(&buf, \"%d\", r.start+bitSize*i+j)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tbuf.WriteByte('}')\r\n\treturn buf.String()\r\n}", "title": "" }, { "docid": "7c8594aacf5a4c50420072123a476fc2", "score": "0.58712363", "text": "func (s OperationDetailForDeleteImagesOutput) String() string {\n\treturn volcengineutil.Prettify(s)\n}", "title": "" }, { "docid": "79f592166a3836550f69922f2ee132a6", "score": "0.5867299", "text": "func (s VpcInterfaceAttachment) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e2f37bb53c1ddb9b2c25199c1bf40416", "score": "0.5864925", "text": "func (s CreateDatasetOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1a4cd4e1d70ae66fe5a62fd540fd34f1", "score": "0.5851279", "text": "func (s AttachVolumeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "85aa9516f3253411d45feaeaa6a14092", "score": "0.5850101", "text": "func (pkt Pkt) String() string {\n\ts := fmt.Sprintf(\"VerType:%x\\n\", pkt.Vertype)\n\ts += fmt.Sprintf(\"Code:%v\\n\", pkt.Code)\n\ts += fmt.Sprintf(\"SessionId:%X\\n\", pkt.SessionID)\n\ts += fmt.Sprintf(\"Len:%d\\n\", pkt.Len)\n\ts += \"Tags:\\n\"\n\tfor _, t := range pkt.Tags {\n\t\ts += fmt.Sprintf(\"%v%v\\n\", identSpaces, strings.ReplaceAll(t.String(), \"\\n\", \"\\n\"+identSpaces))\n\t}\n\treturn s\n}", "title": "" }, { "docid": "e7996e38aa294866f0ae1d07a23db973", "score": "0.58426064", "text": "func (bslice TagByteSlice) String() string {\n\treturn fmt.Sprintf(\"%v: %X\", bslice.TagType, bslice.Value)\n}", "title": "" }, { "docid": "ec006b7dee28909dca1e5a034232730d", "score": "0.58375144", "text": "func (d Data) String() string {\n\treturn hex.EncodeToString(d)\n}", "title": "" }, { "docid": "6a3007286942237b3a2292059519fca6", "score": "0.5827451", "text": "func (d Data) String() string {\n\t// var buf []byte TODO\n\t// for k, v := range d {\n\t//\n\t// }\n\n\treturn \"\"\n}", "title": "" }, { "docid": "ed13d78bd03e8fe14b44f34e445cdd9e", "score": "0.5814688", "text": "func (s CreateUpdatedImageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5c0ffd34077e940d30820c174e4de42e", "score": "0.5814064", "text": "func (s GetImagesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e5211238e150b62e59b04ed5ef74918a", "score": "0.5808346", "text": "func (s NiftyAssociateImageInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "07496fd77619e17c4aad9fe53bb0418a", "score": "0.57929695", "text": "func (me *Image) String() string {\n\treturn me.key.String()\n}", "title": "" }, { "docid": "6f1082d566d6a21ef1c6ac10dc1a0486", "score": "0.5787747", "text": "func (c *CBitmap) String() string {\r\n\tvar buf bytes.Buffer\r\n\tbuf.WriteByte('{')\r\n\tfor i, word := range c.words {\r\n\t\tif word != 0 {\r\n\t\t\tfor j := 0; j < c.bitSize; j += c.numSize {\r\n\t\t\t\tif word&(bitInt(c.mask<<bitInt(j))) != 0 {\r\n\t\t\t\t\tif buf.Len() > len(\"{\") {\r\n\t\t\t\t\t\tbuf.WriteByte(' ')\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfmt.Fprintf(&buf, \"%d\", c.bitSize*i+j/c.numSize)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tbuf.WriteByte('}')\r\n\treturn buf.String()\r\n}", "title": "" }, { "docid": "e15f9d8c1d8caae36911764006994796", "score": "0.577987", "text": "func (s DiskImageDescriptionType) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "954f5170fc83a6abbfaf9dffb050caa4", "score": "0.5769352", "text": "func (obj Detection) String() string {\n\tif data, err := json.Marshal(obj); err != nil {\n\t\treturn fmt.Sprintf(\"<Detection Id=%v>\", obj.Id)\n\t} else {\n\t\treturn string(data)\n\t}\n}", "title": "" }, { "docid": "528d9646f5cb60f89f3bab46fb5e3243", "score": "0.57657385", "text": "func (s RouteData) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d1aee5afbe29959e7ec1e607d186e954", "score": "0.57640564", "text": "func (c Cuadruplo) String() string {\n\treturn fmt.Sprintf(\"%v %v %v %v\", c.Op, c.Var1, c.Var2, c.Res)\n}", "title": "" }, { "docid": "760c43bbc89c4cea64434a597f43cf11", "score": "0.5763555", "text": "func (p *PrimitivePacket) String() string {\n\treturn fmt.Sprintf(\"Tag=%#x, Length=%v, RawDataLength=%v, Raw=[%#x]\", p.tag, p.length, len(p.valbuf), p.valbuf)\n}", "title": "" }, { "docid": "7f62e47860aedc19a00490d2de2d5a4e", "score": "0.57635444", "text": "func (s AlgorithmImage) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffe8c04cfd9666f8885f697d1a96af2", "score": "0.57588553", "text": "func (s DeleteImageBuilderOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fc553da091d2dae8cc7740e29ffae930", "score": "0.57564676", "text": "func (s StartImageBuilderOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "35230954abad23a8ecadd867c01ef696", "score": "0.5750133", "text": "func (s VideoMetadata) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7f93c5db3d4303a0d67b3571ddddc26d", "score": "0.57399315", "text": "func (artifact *Image) String() string {\n\treturn fmt.Sprintf(\"Customer image '%s' ('%s') in datacenter '%s'.\",\n\t\tartifact.Image.GetName(),\n\t\tartifact.Image.GetID(),\n\t\tartifact.Image.GetDatacenterID(),\n\t)\n}", "title": "" }, { "docid": "e8777536728f613b6b5af2e887d9b0ec", "score": "0.5738951", "text": "func (r *FloatRect) String() string {\n\treturn fmt.Sprintf(\"%v, %v, %v, %v\", r.X, r.Y, r.W, r.H)\n}", "title": "" }, { "docid": "5da949888c9a5fc3871ab3b1c14f4ec5", "score": "0.5737715", "text": "func (s AmazonRedshiftNodeData) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1a588575d7f42cfd21372d39f23883c2", "score": "0.573573", "text": "func (s GenerateDataKeyOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c3b4a608c0c1979de00e3f155cef5bfa", "score": "0.5713428", "text": "func (s MetadataInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2c8e0c7debf0b6f33c1f30773033e73f", "score": "0.5707429", "text": "func (s Dataset) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2c8e0c7debf0b6f33c1f30773033e73f", "score": "0.5707429", "text": "func (s Dataset) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bbe3b03f4c9f34e9b309db71a369a3de", "score": "0.5700374", "text": "func (s *SharedData) String() string {\n\tstr := \"{\"\n\tstr += fmt.Sprintf(\"cmd:%q,\",s.cmd)\n\tstr += fmt.Sprintf(\"dataPath:%q,\",s.dataPath)\n\tstr += fmt.Sprintf(\"Debug:%v,\",s.defns[\"Debug\"])\n\tstr += fmt.Sprintf(\"Force:%v,\",s.defns[\"Force\"])\n\tstr += fmt.Sprintf(\"mainPath:%q,\",s.mainPath)\n\tstr += fmt.Sprintf(\"Noop:%v,\",s.defns[\"Noop\"])\n\tstr += fmt.Sprintf(\"outDir:%q,\",s.outDir)\n\tstr += fmt.Sprintf(\"Quiet:%v,\",s.defns[\"Quiet\"])\n\tstr += fmt.Sprintf(\"Time:%q,\",s.defns[\"Time\"])\n\tstr += \"}\"\n\treturn str\n}", "title": "" }, { "docid": "e2f7d7e339f58d8ea9dea865706ee28d", "score": "0.5695875", "text": "func (s *SecureData) String() string {\n\treturn string(s.data)\n}", "title": "" }, { "docid": "be7d3bbc7adb066c88fa83a1121f5b37", "score": "0.5694451", "text": "func (s DescribeDatasetOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "550c9cb25cb9a3aecc8e7d3242b4903f", "score": "0.5687866", "text": "func (c PersistentIpInterface) String() string {\n\treturn fmt.Sprintf(\"%T(%v)\", c, capnp.Client(c))\n}", "title": "" }, { "docid": "8fdcb45b79c67bc10083e4292423f77a", "score": "0.5682375", "text": "func (s SearchFacesByImageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4ab2eb4c200adb3fd7969e24001355ca", "score": "0.5679143", "text": "func String(n interface{}) (string, error) {\n\tb, err := Bytes(n)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}", "title": "" }, { "docid": "de9426999f77dee3a05c87c148c54e05", "score": "0.56779283", "text": "func (slice SliceSliceByte) String() string {\n\treturn slice.Print(\"\\n\")\n}", "title": "" }, { "docid": "e27264f5899bbcb82bc79518c0901a81", "score": "0.56775093", "text": "func (m *Mat) String() string {\n\ts := fmt.Sprintf(\"| %-10f %-10f %-10f %-10f |\\n\", m.X1, m.X2, m.X3, m.X4)\n\ts += fmt.Sprintf(\"| %-10f %-10f %-10f %-10f |\\n\", m.Y1, m.Y2, m.Y3, m.Y4)\n\ts += fmt.Sprintf(\"| %-10f %-10f %-10f %-10f |\\n\", m.Z1, m.Z2, m.Z3, m.Z4)\n\ts += fmt.Sprintf(\"| %-10f %-10f %-10f %-10f |\\n\", m.T1, m.T2, m.T3, m.T4)\n\treturn s\n}", "title": "" }, { "docid": "53df65bb0bc13dc027446c5aff15e9f3", "score": "0.56694686", "text": "func (o *Forecastplanninggroupdata) String() string {\n \n o.OfferedPerInterval = []float64{0.0} \n o.AverageHandleTimeSecondsPerInterval = []float64{0.0} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "454a475238053206632c4dad1994dce9", "score": "0.56671214", "text": "func (ds *XDatasetTS) String() string {\n\tds.mutex.RLock()\n\tdefer ds.mutex.RUnlock()\n\treturn ds.data.String()\n}", "title": "" }, { "docid": "36fbb3ff1f77fe274aa194803f044d70", "score": "0.5665716", "text": "func (rc *RCBitmap) String() string {\r\n\tvar buf bytes.Buffer\r\n\tbuf.WriteByte('{')\r\n\tfor i, word := range rc.words {\r\n\t\tif word != 0 {\r\n\t\t\tfor j := 0; j < rc.bitSize; j += rc.numSize {\r\n\t\t\t\tif word&(bitInt(rc.mask<<bitInt(j))) != 0 {\r\n\t\t\t\t\tif buf.Len() > len(\"{\") {\r\n\t\t\t\t\t\tbuf.WriteByte(' ')\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfmt.Fprintf(&buf, \"%d\", rc.start+rc.bitSize*i+j/rc.numSize)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tbuf.WriteByte('}')\r\n\treturn buf.String()\r\n}", "title": "" }, { "docid": "0d3e364874a4d2b0c78b341676805e8d", "score": "0.5661378", "text": "func (s LocalVolumeResourceData) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ddd0bac6fd9e18e41a6360d245036bc6", "score": "0.5660153", "text": "func (s CreateImageInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6a2dae58f7a3a5ddf4b5836f930730c1", "score": "0.5659258", "text": "func (e EventViews) String() string {\n\tje, _ := json.Marshal(e)\n\treturn string(je)\n}", "title": "" }, { "docid": "52566c8742c8aa0020d5f91866709227", "score": "0.56591505", "text": "func (s DiskImageVolumeDescriptionType) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "838df9c815163883fdd8155b43f5b040", "score": "0.5655635", "text": "func (b *Bitmap) String() string {\n\tvar s = \"\\n\"\n\tfor y := 0; y < b.Height; y++ {\n\t\tvar row string\n\t\tfor x := 0; x < b.Width; x++ {\n\t\t\tpix := b.GetPixel(x, y)\n\t\t\tif pix {\n\t\t\t\trow += \"1\"\n\t\t\t} else {\n\t\t\t\trow += \"0\"\n\t\t\t}\n\t\t}\n\t\ts += row + \"\\n\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "a1bd2f664f6c1622bcde99259209c5ab", "score": "0.56552684", "text": "func (s ImportWorkspaceImageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fad32e39df16da48b69df4ff86d5c90", "score": "0.56512576", "text": "func (d Dataset) String() string {\n\treturn d.path\n}", "title": "" }, { "docid": "3a5f3d9e603beed5b1e4b44f9eee4d1a", "score": "0.5651146", "text": "func (s CreateVolumeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3a5f3d9e603beed5b1e4b44f9eee4d1a", "score": "0.5649397", "text": "func (s CreateVolumeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "64e66590457876eb300b36e086f1cbe8", "score": "0.5639039", "text": "func (s StatementOutputData) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b5e06e811c279079b2b5e2ae311827f2", "score": "0.5636131", "text": "func (g *Container) String() string {\n\treturn string(g.Bytes())\n}", "title": "" }, { "docid": "8c6eb9477c2d3fe51978e68f5607a6c7", "score": "0.5635407", "text": "func (s ModifyImageAttributeInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "27cf6197a246197f3f5fc5d7f73bc0a8", "score": "0.56271106", "text": "func (v *Frame) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"TopLeft: %v\", v.TopLeft)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Size: %v\", v.Size)\n\ti++\n\n\treturn fmt.Sprintf(\"Frame{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "cdbf7eef18482fad8d8f643f7e0fe809", "score": "0.56247497", "text": "func (s AutoScaleInfo) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "eda6ff16264a752eba0892be3227898b", "score": "0.56235534", "text": "func (room *Room) DataToString() string {\n\n\ts := fmt.Sprintf(\" W:%d H:%d\\n\", room.Width, room.Height)\n\n\tfor y := 0; y < len(room.Data); y++ {\n\t\ts += fmt.Sprintf(\"%3d |\", y)\n\t\tfor x := 0; x < len(room.Data[y]); x++ {\n\t\t\t// s += \" \" + string(room.Data[y][x])\n\t\t\ts += fmt.Sprintf(\"%v \", string(room.Data[y][x]))\n\t\t}\n\t\ts += \"|\\n\"\n\t}\n\n\treturn s\n\n}", "title": "" }, { "docid": "e4f37b56fdabe8a380bf82dc38a06b09", "score": "0.5606963", "text": "func (s SubscribeToDatasetOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4ae74ab0cb1994060459a22a084bab90", "score": "0.56017965", "text": "func (s AttachStaticIpOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a6a8ccc7f52a64c241273a1fc335dc0b", "score": "0.5598054", "text": "func (s UsageVolumeInfoType) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "50fd7668e9368c2f2ebb86976b18f166", "score": "0.5595536", "text": "func (s LocalDeviceResourceData) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4e9249221a17a0d4bfedd57c6f7482ae", "score": "0.5592376", "text": "func (s GenerateDataSetOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c54322e69e89543d3cd6d5ae7bbd3674", "score": "0.55914867", "text": "func (s TestingData) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f0b970699e74811f6598fecaa6be961d", "score": "0.5586652", "text": "func (s ImageQuality) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2ce87d1525724f959c310cecb723005d", "score": "0.55847704", "text": "func (s DescribeImageBuildersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cdf5e748b08a2645a7b6a860b074442f", "score": "0.5577445", "text": "func (s VolumeInfo) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" } ]
625d320a5484b0351c163215de61ee65
Returns the host address host:port. If the host is empty, returns a leading ':'.
[ { "docid": "4699c114499c68cef4cfa9977e3a49c5", "score": "0.6161652", "text": "func (this *ServiceConfig) GetHostAddress() string {\n\treturn fmt.Sprintf(\"%v:%d\", this.Hostname, this.Port)\n}", "title": "" } ]
[ { "docid": "eec7d3a144106c50935a5ebbc3436a6c", "score": "0.70595396", "text": "func (c *Client) Host() string {\n\tif len(c.host) == 0 {\n\t\treturn \"\"\n\t}\n\n\tif c.host[0] == ':' {\n\t\treturn \"127.0.0.1\" + c.host\n\t}\n\n\treturn c.host\n}", "title": "" }, { "docid": "f7856a027c5324550d12fcd9b8d07b99", "score": "0.6937059", "text": "func hostOnly(hostport string) string {\n\thost, _, err := net.SplitHostPort(hostport)\n\tif err != nil {\n\t\treturn hostport\n\t}\n\n\treturn host\n}", "title": "" }, { "docid": "f29934137e53554a6ed4294569418723", "score": "0.68761545", "text": "func (l *ListenAddr) HostPort() string {\n\treturn net.JoinHostPort(l.Address, l.Port)\n}", "title": "" }, { "docid": "e28a888df38e72c97d32d5a03ee258b4", "score": "0.68400836", "text": "func fullHost(host string) string {\n\tfullhost := host\n\tif strings.IndexByte(host, ':') == -1 {\n\t\tfullhost += \":80\"\n\t}\n\treturn fullhost\n}", "title": "" }, { "docid": "64cd0401706c61e74a3aa1439c9fa07c", "score": "0.68331224", "text": "func GetHost(addr string) string {\n\tif ip, _, err := net.SplitHostPort(strings.TrimSpace(addr)); err == nil {\n\t\treturn ip\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "8cf9ea30c2b788c8a773f1866abe83f7", "score": "0.6817132", "text": "func (ip IPAddress) Host() string {\n\treturn ip.host\n}", "title": "" }, { "docid": "a66763754db18d71d47142ee44eec8e9", "score": "0.68049943", "text": "func (u *URL) GetHost() string {\n\tif u == nil {\n\t\treturn \"\"\n\t}\n\ti := strings.Index(u.Host, \":\")\n\tif i == -1 {\n\t\treturn u.Host\n\t}\n\treturn u.Host[0:i]\n}", "title": "" }, { "docid": "6922b33f8a30d124e44ca3db7a95d7a1", "score": "0.6799736", "text": "func expandHost(addr string) string {\n\tif addr == \"\" {\n\t\treturn \"\"\n\t}\n\tif addr[0] == ':' {\n\t\treturn \"0.0.0.0\" + addr\n\t}\n\treturn addr\n}", "title": "" }, { "docid": "36f8ef78dbe17f8961b572cf58d426b5", "score": "0.67850804", "text": "func (p *Peer) HostPort() string {\n\treturn string(p.PeerIdentifier)\n}", "title": "" }, { "docid": "f6c907307d469ef389c0c8bae1b20ce3", "score": "0.67844087", "text": "func GetHost(hostAndPort string) string {\n\t//获取请求ip\n\tremoteAddr := strings.Split(hostAndPort, \":\")\n\tvar remoteHost string\n\tif len(remoteAddr) == 2 {\n\t\tremoteHost = remoteAddr[0]\n\t}\n\treturn remoteHost\n}", "title": "" }, { "docid": "e04357b51cd86b110812b4364eafd223", "score": "0.6725386", "text": "func (test *Client) Host() string {\n\tif test.host[0] == ':' {\n\t\treturn \"127.0.0.1\" + test.host\n\t}\n\n\treturn test.host\n}", "title": "" }, { "docid": "9a47b4bf5173ee9c6e4511209ea0e3b2", "score": "0.67175716", "text": "func hostPort(addr string, port interface{}) string {\n\thost := addr\n\tif strings.Count(addr, \":\") > 0 {\n\t\thost = fmt.Sprintf(\"[%s]\", addr)\n\t}\n\t// when port is blank or 0, host is a queue name\n\tif v, ok := port.(string); ok && v == \"\" {\n\t\treturn host\n\t} else if v, ok := port.(int); ok && v == 0 && net.ParseIP(host) == nil {\n\t\treturn host\n\t}\n\n\treturn fmt.Sprintf(\"%s:%v\", host, port)\n}", "title": "" }, { "docid": "c74ac293d479508614dfe8b16088f626", "score": "0.66875815", "text": "func (c Connection) Hostname() string {\n\th := c.dsn\n\ts := strings.Index(h, \"(\")\n\te := strings.Index(h, \")\")\n\tif s != -1 && s != -1 {\n\t\th = h[s+1 : e]\n\t}\n\t// remove trailing :3306 from abc:3306 if present\n\tif len(h) > 5 && h[len(h)-5:] == \":3306\" {\n\t\th = h[0 : len(h)-5]\n\t}\n\treturn h\n}", "title": "" }, { "docid": "debc23769743fd4c85c308e2803d3e3f", "score": "0.6660908", "text": "func (p *ProxyTarget) GetHost() string {\n\tif p.PortForward == nil {\n\t\treturn p.Host\n\t}\n\tif p.PortForward.LocalPort == nil {\n\t\treturn \"0.0.0.0:0\"\n\t}\n\treturn fmt.Sprintf(\"0.0.0.0:%s\", *p.PortForward.LocalPort)\n}", "title": "" }, { "docid": "f1ff7adfde078bc881b11f60d17ee18d", "score": "0.6648678", "text": "func hostport(host, port string) (string, error) {\n\tif host == \"\" || port == \"\" {\n\t\treturn \"\", fmt.Errorf(\"invalid endpoint\")\n\t}\n\tif !hostnameRegexp.MatchString(host) {\n\t\treturn \"\", fmt.Errorf(\"invalid hostname format\")\n\t}\n\tp, err := strconv.Atoi(port)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif p < 1 || p > 65535 {\n\t\treturn \"\", fmt.Errorf(\"invalid port\")\n\t}\n\treturn fmt.Sprintf(\"%s:%s\", host, port), nil\n}", "title": "" }, { "docid": "065a26bff85f3711d60066ceed508bda", "score": "0.6616687", "text": "func (c *CommonRPCInterface) Host() string {\n\treturn fmt.Sprintf(\"%s:%d\", c.XMLRPC.host, c.XMLRPC.port)\n}", "title": "" }, { "docid": "56865f52ac2d5b54977719cf13a188f0", "score": "0.6602502", "text": "func (c Config) GetHost() string {\n\treturn fmt.Sprintf(\"%s:%s\", c.GetHostname(), c.GetPort())\n}", "title": "" }, { "docid": "f396f035b837290123a9f9315e79a6d3", "score": "0.6493149", "text": "func (o HealthCheckHttpHealthCheckPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *HealthCheckHttpHealthCheck) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3f1e14bde861cd3581a9cafee9e32618", "score": "0.64637285", "text": "func (p *ConfigServer) Host() string {\n\tif p.Local {\n\t\treturn fmt.Sprintf(\"%s://%s:%d\", p.Protocol, p.Ipser, p.Puerto)\n\t}\n\treturn fmt.Sprintf(\"%s://%s\", p.Protocol, p.Ipser)\n}", "title": "" }, { "docid": "7f92038de3c3e51134650265ee084095", "score": "0.645537", "text": "func GetAddress(host string) string {\n\treturn fmt.Sprintf(\"%s:%d\", host, Port)\n}", "title": "" }, { "docid": "7e9a7c2ed68e727bc32b17ff8a065f18", "score": "0.64518195", "text": "func (c *Consumer) HostPortAddr() string {\n\thostPortAddr := (*string)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&c.hostPortAddr))))\n\tif hostPortAddr != nil {\n\t\treturn *hostPortAddr\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "fc8c0885a24ebe9c13cb0b432fe46fdb", "score": "0.6409865", "text": "func (a *Agent) hostPort() string {\n\tportS := fmt.Sprintf(\"%v\", a.Port)\n\treturn net.JoinHostPort(a.Host, portS)\n}", "title": "" }, { "docid": "389102251a090c2ae3b3ed91c38e7f63", "score": "0.64093", "text": "func ParseHost(defaultHost string, defaultUnix, addr string) (string, error) {\n\tvar (\n\t\tproto string\n\t\thost string\n\t\tport int\n\t)\n\taddr = strings.TrimSpace(addr)\n\tswitch {\n\tcase addr == \"tcp://\":\n\t\treturn \"\", fmt.Errorf(\"Invalid bind address format: %s\", addr)\n\tcase strings.HasPrefix(addr, \"unix://\"):\n\t\tproto = \"unix\"\n\t\taddr = strings.TrimPrefix(addr, \"unix://\")\n\t\tif addr == \"\" {\n\t\t\taddr = defaultUnix\n\t\t}\n\tcase strings.HasPrefix(addr, \"tcp://\"):\n\t\tproto = \"tcp\"\n\t\taddr = strings.TrimPrefix(addr, \"tcp://\")\n\tcase strings.HasPrefix(addr, \"fd://\"):\n\t\treturn addr, nil\n\tcase addr == \"\":\n\t\tproto = \"unix\"\n\t\taddr = defaultUnix\n\tdefault:\n\t\tif strings.Contains(addr, \"://\") {\n\t\t\treturn \"\", fmt.Errorf(\"Invalid bind address protocol: %s\", addr)\n\t\t}\n\t\tproto = \"tcp\"\n\t}\n\n\tif proto != \"unix\" && strings.Contains(addr, \":\") {\n\t\thostParts := strings.Split(addr, \":\")\n\t\tif len(hostParts) != 2 {\n\t\t\treturn \"\", fmt.Errorf(\"Invalid bind address format: %s\", addr)\n\t\t}\n\t\tif hostParts[0] != \"\" {\n\t\t\thost = hostParts[0]\n\t\t} else {\n\t\t\thost = defaultHost\n\t\t}\n\n\t\tif p, err := strconv.Atoi(hostParts[1]); err == nil && p != 0 {\n\t\t\tport = p\n\t\t} else {\n\t\t\treturn \"\", fmt.Errorf(\"Invalid bind address format: %s\", addr)\n\t\t}\n\n\t} else if proto == \"tcp\" && !strings.Contains(addr, \":\") {\n\t\treturn \"\", fmt.Errorf(\"Invalid bind address format: %s\", addr)\n\t} else {\n\t\thost = addr\n\t}\n\tif proto == \"unix\" {\n\t\treturn fmt.Sprintf(\"%s://%s\", proto, host), nil\n\t}\n\treturn fmt.Sprintf(\"%s://%s:%d\", proto, host, port), nil\n}", "title": "" }, { "docid": "764998a4f4490c67f11fd9895e3e4dbc", "score": "0.64014095", "text": "func getHostName(input string) string {\n\ts := strings.Split(input, \":\")\n\treturn s[0]\n}", "title": "" }, { "docid": "179253b1372185f60bb19397ecdbae67", "score": "0.6400955", "text": "func (o RegionHealthCheckHttpHealthCheckPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionHealthCheckHttpHealthCheck) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "58428c6b6094d7c9f3bbbb57f3aafa96", "score": "0.6378806", "text": "func (o GlobalDNSRecordSpecHealthCheckTcpSocketPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GlobalDNSRecordSpecHealthCheckTcpSocket) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "60de466bf0a0dba5be6a29db01b69712", "score": "0.6366438", "text": "func (c *Client) Host() string {\n\treturn c.server.Host\n}", "title": "" }, { "docid": "21381b88dfaa91b3cf9292742015a0c1", "score": "0.63552886", "text": "func splitHostnamePartsFromHost(fullHost string, defaultPortNum string) (string, string) {\n\n\th := strings.Split(fullHost, \":\")\n\n\tif len(h) == 2 {\n\t\treturn h[0], h[1]\n\t}\n\n\treturn h[0], defaultPortNum\n}", "title": "" }, { "docid": "81de243bd7b98f0b4b32115034c9b941", "score": "0.6318817", "text": "func getHostname(host string) string {\n\thostname := \"http\"\n\tif settings.SSL.Enabled {\n\t\thostname += \"s\"\n\t}\n\thostname += \"://\" + host\n\tif (settings.Port == \":80\" && settings.SSL.Enabled) || (settings.Port == \":443\" && !settings.SSL.Enabled) || (settings.Port != \":80\" && settings.Port != \":443\") {\n\t\thostname += settings.Port\n\t}\n\n\treturn hostname\n}", "title": "" }, { "docid": "aa068c86f93b3a50c63a8a92df712a72", "score": "0.63139135", "text": "func (o GlobalDNSRecordSpecHealthCheckTcpSocketOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GlobalDNSRecordSpecHealthCheckTcpSocket) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3bd87d3671f33f1b724a41f660f2c922", "score": "0.6302926", "text": "func (o HealthCheckHttpHealthCheckOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HealthCheckHttpHealthCheck) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ed0ed616c679fe05c59e07b82f8fe410", "score": "0.6299035", "text": "func (o GoogleCloudBeyondcorpAppconnectionsV1AppConnectionApplicationEndpointOutput) Host() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudBeyondcorpAppconnectionsV1AppConnectionApplicationEndpoint) string { return v.Host }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "769a49d9b50e252c10eba8a54ecd0929", "score": "0.6268988", "text": "func (k *Proxy6Key) HostPort() string {\n\tportStr := strconv.FormatUint(uint64(k.SPort), 10)\n\treturn net.JoinHostPort(k.SAddr.IP().String(), portStr)\n}", "title": "" }, { "docid": "41b372ffd35ee3ab5d85dee7fb20c2cc", "score": "0.626753", "text": "func (c *client) Host() string {\n\treturn c.host\n}", "title": "" }, { "docid": "0cc235715dd941617c58a4fe7d0375ce", "score": "0.6252262", "text": "func Hostname(ctx Context, r *http.Request) (string, error) {\n\treturn strings.Split(r.Host, \":\")[0], nil\n}", "title": "" }, { "docid": "0b447d7eea12c94355af448ce09e20e1", "score": "0.6245505", "text": "func (o MySqlConnectionProfilePtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MySqlConnectionProfile) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "39aaf0ea51895d5f256aaad1783922e0", "score": "0.62241066", "text": "func (m *Machine) Hostname() string {\n\tu, err := url.Parse(m.Addr)\n\tif err != nil {\n\t\treturn \"unknown\"\n\t}\n\thost, _, err := net.SplitHostPort(u.Host)\n\tif err != nil {\n\t\treturn u.Host\n\t}\n\treturn host\n}", "title": "" }, { "docid": "d88bebd02356efca348376b0fb18faf2", "score": "0.6220919", "text": "func GetAddress(host string, port int) string {\n\tif strings.HasPrefix(host, \"unix:\") {\n\t\treturn host\n\t}\n\treturn fmt.Sprintf(\"%s:%d\", host, port)\n}", "title": "" }, { "docid": "9a060f5d2721df98ae5d3a8583c8d0b9", "score": "0.62204635", "text": "func (o RegionHealthCheckHttpHealthCheckOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RegionHealthCheckHttpHealthCheck) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4f1e116691c2b8a17e582988b1509f6d", "score": "0.6215282", "text": "func (o GlobalDNSRecordSpecHealthCheckHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GlobalDNSRecordSpecHealthCheckHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ba6c2bdb02fbce18cedad5d257076b52", "score": "0.62109286", "text": "func getHostURL() string {\n\treturn getOptionSettings(options.hostURL, \"host-url\")\n}", "title": "" }, { "docid": "0cb2fee593140c29ef4ddb516f9062f8", "score": "0.62008226", "text": "func ExtractHost(addr string) string {\n\thost, _ := SplitHostPort(addr, \"\")\n\treturn host\n}", "title": "" }, { "docid": "2022a9cf254c75564cf6fe41b80aa12e", "score": "0.6185294", "text": "func (c *CommandLine) Host() string {\n\treturn c.host\n}", "title": "" }, { "docid": "6f2d0b09a0a66a405d0af671fc47c5d3", "score": "0.6177388", "text": "func (o HealthCheckHttpsHealthCheckPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *HealthCheckHttpsHealthCheck) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "90aca86e1b653721a983d239e87f7d1f", "score": "0.6169769", "text": "func (o HealthCheckHttp2HealthCheckPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *HealthCheckHttp2HealthCheck) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4a74030f86ce5feb7ea451cb8d6d5af1", "score": "0.61548513", "text": "func (t *OpenconfigSystem_System_Logging_RemoteServers_RemoteServer) GetHost() string {\n\tif t == nil || t.Host == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Host\n}", "title": "" }, { "docid": "13a2af3c24058777f7fe273db43f4b86", "score": "0.61394936", "text": "func (t *OpenconfigSystem_System_Logging_RemoteServers_RemoteServer_Config) GetHost() string {\n\tif t == nil || t.Host == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Host\n}", "title": "" }, { "docid": "39ec9417443ea9659876f36a005866f2", "score": "0.6125592", "text": "func (o RegionHealthCheckHttpsHealthCheckPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionHealthCheckHttpsHealthCheck) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "59cf32b6aec846b34fb658886612ea6e", "score": "0.6118206", "text": "func (o RegionHealthCheckHttp2HealthCheckPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionHealthCheckHttp2HealthCheck) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cb116411cea116b31ca269fb5244857a", "score": "0.61072963", "text": "func (m *RediQueue) Host() string {\n\tm.Lock()\n\tdefer m.Unlock()\n\treturn m.srv.Addr().IP.String()\n}", "title": "" }, { "docid": "1e8e7eeb124d01364b13e34343c87531", "score": "0.6097985", "text": "func (h *Host) String() string {\n\treturn h.TransportAddr()\n}", "title": "" }, { "docid": "72f187b30a19e2b9452cc3492ffc4d77", "score": "0.60682744", "text": "func GetHost() (string, error) {\n\thost, ok := os.LookupEnv(\"APTIBLE_API_ROOT_URL\")\n\tif !ok {\n\t\treturn deploy.DefaultHost, nil\n\t}\n\thost = strings.Trim(host, \" \")\n\n\thost = strings.TrimPrefix(host, \"http://\")\n\thost = strings.TrimPrefix(host, \"https://\")\n\n\tif !validHost(host) {\n\t\treturn \"\", fmt.Errorf(\"[ERROR] Host must be of the form xxx.xxx.com. Inputted host: %s\", host)\n\t}\n\n\treturn host, nil\n}", "title": "" }, { "docid": "11e8a7234f2be5f74ef68e23a9634c96", "score": "0.60661393", "text": "func (s *Service) GetHost() string {\n\t// return zero value if Service type or Host field is nil\n\tif s == nil || s.Host == nil {\n\t\treturn \"\"\n\t}\n\n\treturn *s.Host\n}", "title": "" }, { "docid": "899239370ba8adff19f35d7ac3633753", "score": "0.6053523", "text": "func GetHost(link string) (string, error) {\n\tu, err := url.Parse(link)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", err\n\t}\n\treturn u.Host, nil\n}", "title": "" }, { "docid": "1e62a1187520e5a964e266fedb5d71eb", "score": "0.6049104", "text": "func (c *Config) Host() string {\n\tswitch c.Type {\n\tcase \"ssh\":\n\t\treturn c.SSHHost\n\tcase \"winrm\":\n\t\treturn c.WinRMHost\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "f7a30968b79b4e269eda90656c7f49ab", "score": "0.6041877", "text": "func (o HealthCheckHttpsHealthCheckOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HealthCheckHttpsHealthCheck) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f4c9b8850328c1f2217f6a5b5b3ecb21", "score": "0.6040321", "text": "func HostPortSplit(s string) (string, string) {\n\tif strings.Contains(s, \":\") {\n\t\tsl := strings.SplitN(s, \":\", 2)\n\t\treturn sl[0], sl[1]\n\t}\n\treturn s, \"\"\n}", "title": "" }, { "docid": "f9c2c806f55d92f6e450af4d42cc64fb", "score": "0.602759", "text": "func GetAddress(host string, port int) string {\n\treturn fmt.Sprintf(\"%s:%d\", host, port)\n}", "title": "" }, { "docid": "9160229849f153285188228d575e62e5", "score": "0.6021569", "text": "func HostToString(ip net.IP, port uint16) string {\t\n\tif isIP4(ip) {\n\t\treturn fmt.Sprintf(\"%v:%v\", ip.String(), port)\n\t} else {\n\t\treturn fmt.Sprintf(\"[%v]:%v\", ip.String(), port)\n\t}\n}", "title": "" }, { "docid": "5079bd43b815471b3c7c00469d0e0ef1", "score": "0.6010691", "text": "func (a *URLAddr) Host() string {\n\treturn a.host\n}", "title": "" }, { "docid": "6c5220572afb95c990a3aa84648222f5", "score": "0.60093373", "text": "func (f *WeaviateConfig) GetHostAddress() string {\n\treturn fmt.Sprintf(\"%s://%s\", f.Scheme, f.Hostname)\n}", "title": "" }, { "docid": "97939f51c1add25f4ebd19b8263e1bc2", "score": "0.60073304", "text": "func (m *LogEntry) GetHost() string {\n\tif m != nil {\n\t\treturn m.Host\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "3597afd08227840d4cd12646be1de889", "score": "0.6005544", "text": "func GetAddr(host string, port int) (string, error) {\n\tvar err error\n\tif host == \"\" {\n\t\thost, err = GetIP()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"%s:%d\", host, port), nil\n}", "title": "" }, { "docid": "af46f6e617323cc62437bb8baf8a262a", "score": "0.6001395", "text": "func (o UrlMapTestOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UrlMapTest) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "667c619b2f128bbb804d1fb72c9632d6", "score": "0.6000825", "text": "func (adapter *Adapter) getHost(containerHostname string) string {\n host := containerHostname\n if (adapter.Config.Hostname != \"\") {\n host = adapter.Config.Hostname\n }\n return host\n}", "title": "" }, { "docid": "bd25deae3a07f19afd63d0f16d358a2d", "score": "0.5996669", "text": "func (o MySqlConnectionProfileOutput) Host() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MySqlConnectionProfile) string { return v.Host }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7f59ab3352ea8472944f9f092d91c6e7", "score": "0.5992617", "text": "func (s *SSHEndpoint) GetHost() string {\n\treturn s.Host\n}", "title": "" }, { "docid": "0ce193cd72e96a60f22c162acdd3721e", "score": "0.5990818", "text": "func (o RegionHealthCheckHttpsHealthCheckOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RegionHealthCheckHttpsHealthCheck) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2eb294098ef95d047931b200ebe499af", "score": "0.5983477", "text": "func Hostname() (name string, err error)", "title": "" }, { "docid": "69f62adeecaa82619f227104e836ba74", "score": "0.597245", "text": "func HostName() string {\n\treturn hostName\n}", "title": "" }, { "docid": "f4d954c7150bfc5ed3e772e32f0bc935", "score": "0.5964345", "text": "func (r *recordingPolicy) Host() string {\n\tif r.options.UseHTTPS {\n\t\treturn \"localhost:5001\"\n\t}\n\treturn \"localhost:5000\"\n}", "title": "" }, { "docid": "c2849c55af26b1c781ded9b93bce986a", "score": "0.5952874", "text": "func (o GetServerVNCInfoResultOutput) Host() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetServerVNCInfoResult) string { return v.Host }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0470e00467d5db2e67437c03138d5339", "score": "0.59347737", "text": "func (o HealthCheckHttp2HealthCheckOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HealthCheckHttp2HealthCheck) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ad72cccd67d35e4314302a2d07d6800a", "score": "0.59292316", "text": "func (s *HTTPServer) getHost(req *http.Request) string {\n\thost := req.Host\n\tif s.settings.XForwardedHost {\n\t\tif xfh := req.Header.Get(\"X-Forwarded-Host\"); xfh != \"\" {\n\t\t\thost = xfh\n\t\t}\n\t}\n\n\thost = strings.ToLower(host)\n\n\tif !strings.Contains(host, \":\") {\n\t\treturn s.cleanHostAppendPort(host)\n\t}\n\n\th, _, err := net.SplitHostPort(host)\n\tif err != nil {\n\t\treturn s.cleanHostAppendPort(host)\n\t}\n\n\treturn s.cleanHostAppendPort(h)\n}", "title": "" }, { "docid": "0c8b45eb376a37896f70c3b16efd51e6", "score": "0.592271", "text": "func (o MySqlConnectionProfileResponseOutput) Host() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MySqlConnectionProfileResponse) string { return v.Host }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4fd1fe6183614573875284e8921c01dd", "score": "0.5907516", "text": "func (o LoginServerPropertiesResponsePtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LoginServerPropertiesResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "18001057952b53ac3ee1569778e3c751", "score": "0.5906948", "text": "func (id *ID) Host() string {\n\treturn id.host\n}", "title": "" }, { "docid": "ad6ff5112122e79e1f867fb06b3cc436", "score": "0.58993953", "text": "func (s *HTTPServer) getHost(req *http.Request) string {\n\thost := req.Host\n\tif s.config.UseXFH {\n\t\thost = req.Header.Get(\"X-Forwarded-Host\")\n\t}\n\n\thost = strings.ToLower(host)\n\n\tif !strings.Contains(host, \":\") {\n\t\treturn s.cleanHostAppendPort(host)\n\t}\n\n\th, _, err := net.SplitHostPort(host)\n\tif err != nil {\n\t\treturn s.cleanHostAppendPort(host)\n\t}\n\n\treturn s.cleanHostAppendPort(h)\n}", "title": "" }, { "docid": "b531346021afa98898433ebd6389c7c0", "score": "0.58929354", "text": "func parseHostportIP(hostport string) string {\n\tipAddress := \"\"\n\tif IPv6Check(hostport) {\n\t\t// this is an IPv6 address, remove port value and add square brackets around the IP address\n\t\tif hostport[0] == '[' {\n\t\t\tipAddress = strings.Split(hostport, \"]\")[0] + \"]\"\n\t\t} else {\n\t\t\t// assumption here is that without the square brackets its only IP address without port information\n\t\t\tipAddress = \"[\" + hostport + \"]\"\n\t\t}\n\t} else {\n\t\tipAddress = strings.Split(hostport, \":\")[0]\n\t}\n\n\treturn ipAddress\n}", "title": "" }, { "docid": "8c7f69c16b29d49b17abaa13c7511de4", "score": "0.58883804", "text": "func (o *Event) GetHost() string {\n\tif o == nil || o.Host == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Host\n}", "title": "" }, { "docid": "e46687927215e159dba16718a40ff95a", "score": "0.5885172", "text": "func portOnly(hostport string) string {\n\tcolon := strings.IndexByte(hostport, ':')\n\tif colon == -1 {\n\t\treturn \"\"\n\t}\n\tif i := strings.Index(hostport, \"]:\"); i != -1 {\n\t\treturn hostport[i+len(\"]:\"):]\n\t}\n\tif strings.Contains(hostport, \"]\") {\n\t\treturn \"\"\n\t}\n\treturn hostport[colon+len(\":\"):]\n}", "title": "" }, { "docid": "a87e4c8e0ce3799f3697f2372f1c3442", "score": "0.58766556", "text": "func (o GetPortBindingOutput) HostId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetPortBinding) string { return v.HostId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e51b456e2b2ba90672f99fbaa97ecc95", "score": "0.58714026", "text": "func (o GoogleCloudBeyondcorpAppconnectionsV1AppConnectionApplicationEndpointResponseOutput) Host() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudBeyondcorpAppconnectionsV1AppConnectionApplicationEndpointResponse) string {\n\t\treturn v.Host\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "01cf549c32d49777fa2135ed1a058773", "score": "0.5864531", "text": "func (d *Data) HostPort(addr string) error {\n\tip, port, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp, err := strconv.ParseUint(port, 10, 32)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.Port = uint32(p)\n\n\tif ip := net.ParseIP(ip); ip != nil {\n\t\td.Address = []byte(ip)\n\t\tif ip := ip.To4(); ip != nil {\n\t\t\td.SocketFam = tap.SocketFamily_INET\n\t\t} else {\n\t\t\td.SocketFam = tap.SocketFamily_INET6\n\t\t}\n\t\treturn nil\n\t}\n\treturn errors.New(\"not an ip address\")\n}", "title": "" }, { "docid": "2a6e109afd8722eac837492c37f03d5f", "score": "0.58576125", "text": "func (o RegionHealthCheckHttp2HealthCheckOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RegionHealthCheckHttp2HealthCheck) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2d6769576c0061288a5bfcf887533158", "score": "0.58561283", "text": "func (o GlobalDNSRecordSpecHealthCheckHttpGetOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GlobalDNSRecordSpecHealthCheckHttpGet) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a0c4dc77b4330f3519682cb9c426c991", "score": "0.5853929", "text": "func (o PortBindingPtrOutput) HostId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PortBinding) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.HostId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3410f9012a69dbee26fb278ed96b8b9a", "score": "0.58511454", "text": "func (host *Host) GetAddress() string {\n\treturn host.hostname\n}", "title": "" }, { "docid": "c0efc211ef80549e8cd2775669315f65", "score": "0.5850857", "text": "func (o URLMapTestOutput) Host() pulumi.StringOutput {\n\treturn o.ApplyT(func(v URLMapTest) string { return v.Host }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "724c74b5d1a98baa18c3816fd34f1892", "score": "0.58460546", "text": "func GetHostUrl() string {\n\thost := os.Getenv(HostUrlEnvVar)\n\n\tif host == \"\" {\n\t\thost = DefaultHostUrl\n\t}\n\n\treturn host\n}", "title": "" }, { "docid": "ab3f80a1dd7a8c05f786963ed7b326bf", "score": "0.5839758", "text": "func Port(url *stdurl.URL) string {\n\tif network.IsIPv6(url.Host) {\n\t\treturn \"\"\n\t}\n\treturn url.Port()\n}", "title": "" }, { "docid": "c3358ab2f2d6b3f6b23e2506d52a7920", "score": "0.58242655", "text": "func (p PortBinding) HostAddr() (net.Addr, error) {\n\tswitch p.Proto {\n\tcase UDP:\n\t\treturn &net.UDPAddr{IP: p.HostIP, Port: int(p.HostPort)}, nil\n\tcase TCP:\n\t\treturn &net.TCPAddr{IP: p.HostIP, Port: int(p.HostPort)}, nil\n\tdefault:\n\t\treturn nil, ErrInvalidProtocolBinding(p.Proto.String())\n\t}\n}", "title": "" }, { "docid": "7ab37896a50a760a97e1415eab2a4fc9", "score": "0.58079046", "text": "func (o FlexibleAppVersionLivenessCheckPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FlexibleAppVersionLivenessCheck) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "559a46b1109134f79ca80af58c2e7331", "score": "0.58067304", "text": "func (o RequestResponsePtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RequestResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "569e2e96948bb33e9ac43dad169d4a8f", "score": "0.58047223", "text": "func Host(v string) error {\n\tproxyIP := net.ParseIP(v)\n\tif proxyIP != nil {\n\t\treturn nil\n\t}\n\treturn validateSubdomain(v)\n}", "title": "" }, { "docid": "08ba230922eebed1559444833ec00ae0", "score": "0.5798281", "text": "func Localhost() string { return \"127.0.0.1\" }", "title": "" }, { "docid": "499732bb27ce02ac28d12aafb1266407", "score": "0.5798224", "text": "func (o DestinationOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Destination) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "138af5bc1a00cfad9e7251451a8f492f", "score": "0.5796615", "text": "func DefaultHost() (string, string) {\n\tcfg, _ := config.Read()\n\treturn defaultHost(cfg)\n}", "title": "" }, { "docid": "84afab98cecdf46840bdbdada45d1c24", "score": "0.57961446", "text": "func buildHostPort(s string) (string, error) {\n\thost, port, err := net.SplitHostPort(s)\n\tif err != nil {\n\t\t// Assume no port was provided and use the default.\n\t\thost = s\n\t\tport = keylightPort\n\t}\n\n\t// Assume HTTP if no scheme provided and verify this URL is well formed\n\t// by verifying it again.\n\ts = (&url.URL{\n\t\tScheme: \"http\",\n\t\tHost: net.JoinHostPort(host, port),\n\t}).String()\n\n\treturn buildAddr(s)\n}", "title": "" }, { "docid": "5796800cc08b1836aa109bb0dcf91811", "score": "0.5790449", "text": "func HostFromLogin(host string) string {\n\turlElems := strings.Split(host, \".\")\n\thostPrefix := urlElems[0]\n\telems := strings.Split(hostPrefix, \"-\")\n\tif len(elems) < 2 {\n\t\treturn host\n\t}\n\telems[len(elems)-2] = \"selfservice\"\n\tssLoginHostPrefix := strings.Join(elems, \"-\")\n\treturn strings.Join(append([]string{ssLoginHostPrefix}, urlElems[1:]...), \".\")\n}", "title": "" } ]
775432d7ae57f2c5aa053c963e72baf1
SetPhoneticGivenName gets a reference to the given string and assigns it to the PhoneticGivenName field.
[ { "docid": "6a51f0294ea03dcd2078e88b699f40fb", "score": "0.7995004", "text": "func (o *ContractUser) SetPhoneticGivenName(v string) {\n\to.PhoneticGivenName = &v\n}", "title": "" } ]
[ { "docid": "f1757aa39ecbc25973be1b8c16c5326d", "score": "0.83782667", "text": "func (o *Me) SetPhoneticGivenName(v string) {\n\to.PhoneticGivenName = &v\n}", "title": "" }, { "docid": "92169a82f4fa789c119fedc4050024dd", "score": "0.7253136", "text": "func (o *Me) GetPhoneticGivenName() string {\n\tif o == nil || o.PhoneticGivenName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PhoneticGivenName\n}", "title": "" }, { "docid": "f8e4f9e32235ef79d6f8399bcaf115b0", "score": "0.7118802", "text": "func (o *Me) SetPhoneticFamilyName(v string) {\n\to.PhoneticFamilyName = &v\n}", "title": "" }, { "docid": "eb3f9e86c220f7d94cae748439b4fea3", "score": "0.6857247", "text": "func (m *EducationUser) SetGivenName(value *string)() {\n m.givenName = value\n}", "title": "" }, { "docid": "696d2c5526698e40e4cd509db6ee7dfc", "score": "0.67585903", "text": "func (o *ContractUser) SetPhoneticFamilyName(v string) {\n\to.PhoneticFamilyName = &v\n}", "title": "" }, { "docid": "2395cce17c10d413a9b4feb371565266", "score": "0.67565364", "text": "func (o *ContractUser) GetPhoneticGivenName() string {\n\tif o == nil || o.PhoneticGivenName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PhoneticGivenName\n}", "title": "" }, { "docid": "05e6d1b463390fb6b9f43e3407edc5fe", "score": "0.6672296", "text": "func (m *OrgContact) SetGivenName(value *string)() {\n m.givenName = value\n}", "title": "" }, { "docid": "285fb4c98285b75dea5b597f3194c5aa", "score": "0.6392803", "text": "func (o *Me) HasPhoneticGivenName() bool {\n\tif o != nil && o.PhoneticGivenName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "eb25c03b2dfd29e712386d5e45ab7de6", "score": "0.6179343", "text": "func (o *Me) GetPhoneticFamilyName() string {\n\tif o == nil || o.PhoneticFamilyName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PhoneticFamilyName\n}", "title": "" }, { "docid": "12c5efc2293a08b667fb04910eb80266", "score": "0.61530477", "text": "func (o *Me) GetPhoneticGivenNameOk() (*string, bool) {\n\tif o == nil || o.PhoneticGivenName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PhoneticGivenName, true\n}", "title": "" }, { "docid": "4f2cf98d8477ca25b041b2c2906b667f", "score": "0.61529857", "text": "func (m *Employee) SetGivenName(value *string)() {\n err := m.GetBackingStore().Set(\"givenName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8a88e17618321c8294a404c4ed07a2f3", "score": "0.59885454", "text": "func (o *ContractUser) HasPhoneticGivenName() bool {\n\tif o != nil && o.PhoneticGivenName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "382feac9bf48dc7b25cec34a2bb809e3", "score": "0.5794748", "text": "func (o *ContractUser) GetPhoneticGivenNameOk() (*string, bool) {\n\tif o == nil || o.PhoneticGivenName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PhoneticGivenName, true\n}", "title": "" }, { "docid": "3f222d1fb6a872276ace11d8c58e1b26", "score": "0.56296754", "text": "func (o *ContractUser) GetPhoneticFamilyName() string {\n\tif o == nil || o.PhoneticFamilyName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PhoneticFamilyName\n}", "title": "" }, { "docid": "afd560d19363443da58cfa5db4ea7a18", "score": "0.5541048", "text": "func (o *Me) HasPhoneticFamilyName() bool {\n\tif o != nil && o.PhoneticFamilyName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "63d6132295195dc753d962831df1cc6d", "score": "0.5475127", "text": "func (pPointer *person) changeFirstName(newName string) {\n\t(*pPointer).firstName = newName //*p - the value in the memory address of pointer pPointer\n}", "title": "" }, { "docid": "4c07b6bbdcb0783514ae4431a0be0cad", "score": "0.53493416", "text": "func (o *Me) SetGivenName(v string) {\n\to.GivenName = &v\n}", "title": "" }, { "docid": "961d984532e8ecb1303d0c226579851a", "score": "0.53002036", "text": "func (m *PersonResponsibility) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "81c289f4ae786255e3801e15fa25a22f", "score": "0.5284937", "text": "func (m *PersonCertification) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "41d2d538ed17e2074d9b5d6263715fbf", "score": "0.5284252", "text": "func (m *BookingStaffMember) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a0142f80d58937c4256753579d6fed2e", "score": "0.525653", "text": "func (m *EducationUser) SetMiddleName(value *string)() {\n m.middleName = value\n}", "title": "" }, { "docid": "71006995f9f4bc9a5f27024431591563", "score": "0.5234946", "text": "func (p *Person) changeName(lastName string) {\n\tif len(p.firstName) > 3 {\n\t\tp.firstName = lastName\n\t}\n}", "title": "" }, { "docid": "3e9f58956398bda18a69eea8ae14c52e", "score": "0.52333647", "text": "func SetNameUsingPointer(personPointer *person) {\n\tpersonPointer.name = \"Gopal\"\n}", "title": "" }, { "docid": "67a8d4343cb4e2a0d278e5b4c3ebcd3a", "score": "0.5190824", "text": "func (m *MailboxEvidence) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7de6163abb209a8d9bfbe751c5b3fc3f", "score": "0.5190693", "text": "func (m *ProjectParticipation) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c314883e3b5e2fdc54f5a97268bf3bbc", "score": "0.51556915", "text": "func (m *Employee) SetMiddleName(value *string)() {\n err := m.GetBackingStore().Set(\"middleName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "566fcdadc1be101fd2bb4497888b0abc", "score": "0.51432145", "text": "func (o *Me) GetPhoneticFamilyNameOk() (*string, bool) {\n\tif o == nil || o.PhoneticFamilyName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PhoneticFamilyName, true\n}", "title": "" }, { "docid": "0070d025d8a738fc2b44ce625e5bb562", "score": "0.5117284", "text": "func SetNameUsingValue(personPointer person) {\n\tpersonPointer.name = \"Gopal2\"\n}", "title": "" }, { "docid": "5728077541683bf15f774b0b4de88073", "score": "0.51169425", "text": "func (m *CaseEscaped) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a395dc70baf2d6175cde45b8e7aadbe7", "score": "0.5109842", "text": "func (m *PersonAnnualEvent) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "fdfd0b37d2d0ba2d1596cdfecc5e72f0", "score": "0.51037455", "text": "func (u *User) SetFirstName(value string) {// Acts like setter in PHP or Java\n\tu.firstName = value\n}", "title": "" }, { "docid": "5e5fa37546e90d7aaffe62355d775116", "score": "0.5086843", "text": "func (m *VirtualEventRegistrationQuestionAnswer) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a9ba349c0ef333e62148de071058fde5", "score": "0.50842893", "text": "func (o *ContractUser) HasPhoneticFamilyName() bool {\n\tif o != nil && o.PhoneticFamilyName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9b59787105d4f0e8b25d1bc907c56c24", "score": "0.5038468", "text": "func (m *Location) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "2ccbcb6ad64a486ef7c54540c46e9f74", "score": "0.503809", "text": "func (p *Person) ChangeName(newName string) {\n\tp.FirstName = newName\n}", "title": "" }, { "docid": "9004ecf530900f9a504624e5a3e30e12", "score": "0.5036672", "text": "func (m *Room) SetNickname(value *string)() {\n m.nickname = value\n}", "title": "" }, { "docid": "46a5ce6186091238e6842e0c748d27e7", "score": "0.50270873", "text": "func changeMe(p *person) {\n\t//changing my first name\n\t//(*p).first\n\tp.first = \"Kbenni\"\n}", "title": "" }, { "docid": "0e07ffc4e3deecce5a3ee1dd7cd15087", "score": "0.49965063", "text": "func (m *VerifiedDomain) SetName(value *string)() {\n m.name = value\n}", "title": "" }, { "docid": "1dcbba7aa87c89e571245d93e62aeb51", "score": "0.49761385", "text": "func (m *Room) SetNickname(value *string)() {\n err := m.GetBackingStore().Set(\"nickname\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "96cbec409402c8dc55a387a4d2473214", "score": "0.4937361", "text": "func (m *ServicePrincipal) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d580c8baedbc8a227ae7881c1d0a4bdf", "score": "0.4934209", "text": "func (w *Words) GivenName() string {\n\treturn w.withBackup(func(w *Words) string { return chooseRandomString(w.listFromKey(\"given_names\")) })\n}", "title": "" }, { "docid": "5d6b4cce73d28c9f0157ab34783cbee2", "score": "0.49124086", "text": "func (o *personBase) SetFirstName(v string) {\n\to.firstNameIsValid = true\n\tif o.firstName != v || !o._restored {\n\t\to.firstName = v\n\t\to.firstNameIsDirty = true\n\t}\n\n}", "title": "" }, { "docid": "f562fb2442b5973d9ac43e8d46d471b4", "score": "0.4904344", "text": "func (m *LearningProvider) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "872aca7b9b716a77743d64f287eef6b2", "score": "0.49029607", "text": "func (m *VirtualEvent) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ebf3a75dc1b36ea9653b6c469cd4f57a", "score": "0.4894283", "text": "func (p *person) updateFirstName(newName string) {\n\t// *p looks directly at the value of the pointer address\n\t(*p).firstName = newName\n}", "title": "" }, { "docid": "683178c0f133b7fae4a5befd095ef5ea", "score": "0.4885951", "text": "func (r Repository) ChangeMiddleName(ctx context.Context, userID string, middlename *string, permission *account.Permission) error {\n\tif !bson.IsObjectIdHex(userID) {\n\t\treturn errors.New(\"wrong_id\")\n\t}\n\n\tchangeQuery := bson.M{}\n\tif middlename != nil {\n\t\tchangeQuery[\"middlename.name\"] = middlename\n\t}\n\n\tif permission != nil && permission.Type != account.PermissionTypeNone {\n\t\tchangeQuery[\"middlename.permission\"] = permission\n\t}\n\n\terr := r.collections[usersCollection].Update(\n\t\tbson.M{\n\t\t\t\"_id\": bson.ObjectIdHex(userID),\n\t\t},\n\t\tbson.M{\n\t\t\t\"$set\": changeQuery,\n\t\t},\n\t)\n\n\treturn err\n}", "title": "" }, { "docid": "f89c8113fb2893e637aa5b608a355724", "score": "0.48847228", "text": "func (m *DirectoryObjectPartnerReference) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "51c2f6f0529c5a88e95ff100769173a1", "score": "0.48717618", "text": "func (o *ContractUser) SetGivenName(v string) {\n\to.GivenName = &v\n}", "title": "" }, { "docid": "e3bacd910968a0b71ed6c07681a7b660", "score": "0.486779", "text": "func (m *WindowsProtectionState) SetManagedDeviceName(value *string)() {\n err := m.GetBackingStore().Set(\"managedDeviceName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3339348177477e71133c56f9e9363f0e", "score": "0.48500088", "text": "func (m *TeamsTab) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2de55ab6f5e8fff670ea1f8e3f3ea231", "score": "0.48464647", "text": "func (m *MobilityManagementPolicy) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "90eca5158679412578e130ddd78f2fa1", "score": "0.48417518", "text": "func (m *Employee) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1f8c3203005429de2517a8e1d530ba71", "score": "0.48413396", "text": "func (_class VMPPClass) SetNameLabel(sessionID SessionRef, self VMPPRef, value string) (_err error) {\n\t_method := \"VMPP.set_name_label\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertVMPPRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_valueArg, _err := convertStringToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)\n\treturn\n}", "title": "" }, { "docid": "1e21501fa4e8a6f475f3c064cb33cc8c", "score": "0.48372713", "text": "func (m *UserIdentity) SetUserPrincipalName(value *string)() {\n err := m.GetBackingStore().Set(\"userPrincipalName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ebc1b7946e422579d56aec3f22f51dfb", "score": "0.48309204", "text": "func (m *UserSecurityProfile) SetUserPrincipalName(value *string)() {\n err := m.GetBackingStore().Set(\"userPrincipalName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "222fafb45c7a0d1863e1efb6681eb001", "score": "0.48296967", "text": "func (m *TaxGroup) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ee7c307331a40cedec7612b7dbfb7317", "score": "0.48294228", "text": "func (m *DeviceAppPerformance) SetAppFriendlyName(value *string)() {\n err := m.GetBackingStore().Set(\"appFriendlyName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "29411097f8c82ae909699d6ce8a7c661", "score": "0.48237434", "text": "func (m *DeviceManagementResourceAccessProfileBase) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6a5bf191086b4a8d371662dd3a0eadd1", "score": "0.4819927", "text": "func (p *person) updateName(s string) {\n\t(*p).firstName = s\n}", "title": "" }, { "docid": "fa60ec3894ea2e2d87be1e9621cf7c41", "score": "0.48108542", "text": "func (o *ContractUser) GetPhoneticFamilyNameOk() (*string, bool) {\n\tif o == nil || o.PhoneticFamilyName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PhoneticFamilyName, true\n}", "title": "" }, { "docid": "d807e6bac342a969ff0d8863298c102f", "score": "0.48070556", "text": "func (m *DeviceCustomAttributeShellScript) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ffe48d7bfe6acb92c8f14692ac112299", "score": "0.48032734", "text": "func (m *LandingPage) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "cb889cde18c3af5f1c59b280aa4ce8be", "score": "0.48032236", "text": "func (m *TenantInformation) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a5189dba66674045752c02d386ec3415", "score": "0.4802081", "text": "func (m *EducationAssignment) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "759361e8780c1d3552eb8ccc52d9c75d", "score": "0.48013544", "text": "func (m *ManagedDevice) SetManagedDeviceName(value *string)() {\n m.managedDeviceName = value\n}", "title": "" }, { "docid": "518fe8cc1bb6371ba6b9e130d5181b7c", "score": "0.48001495", "text": "func (m *DeviceRegistrationPolicy) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c1f0a7aa259ef9631b2446b388079797", "score": "0.47935054", "text": "func (m *BookingCustomer) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "560e2f5f009190e944096961a17c7ce6", "score": "0.4780997", "text": "func (m *DomainSecurityProfile) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4694a651f669c93150d3fd2c5bf89505", "score": "0.4777134", "text": "func (pointerToPerson *person) updateName(fname string) {\n\t// pointer of this person then change the property\n\t(*pointerToPerson).firstName = fname\n}", "title": "" }, { "docid": "833e14eff1045c09c838b5af5d9adee1", "score": "0.47761238", "text": "func (m *EducationUser) SetSurname(value *string)() {\n m.surname = value\n}", "title": "" }, { "docid": "9eb126bc68df7e4715f12c0bba9c002a", "score": "0.47735608", "text": "func (m *WindowsUniversalAppX) SetIdentityName(value *string)() {\n err := m.GetBackingStore().Set(\"identityName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c82947d418739e8969a3d8f94eeb707e", "score": "0.47673157", "text": "func (m *CloudPcSupportedRegion) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f9dbcf862009f41a0ef480e3b7561e5f", "score": "0.47658065", "text": "func (m *ManagedDevice) SetUserPrincipalName(value *string)() {\n m.userPrincipalName = value\n}", "title": "" }, { "docid": "a74b598ab14b74c6558bbcded03c4e4e", "score": "0.47639936", "text": "func (m *OrgContact) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "cc8d7e1e67318abe8381827beaad0646", "score": "0.47584692", "text": "func (p *person) upperCaseFirstName() {\n\tp.firstName = strings.ToUpper(p.firstName)\n}", "title": "" }, { "docid": "f216da66c3ff82e212405bd1c68e7cc6", "score": "0.47581768", "text": "func (m *BusinessFlow) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "002702e9dbcd9f1313a2bde0013bd3e5", "score": "0.4749425", "text": "func (m *Website) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "894fbffa54066bcf2aac0010e9314823", "score": "0.47449514", "text": "func (m *EducationUser) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "367aaf33844884f6edbf4743c876d8f8", "score": "0.4738699", "text": "func (m *WindowsDefenderApplicationControlSupplementalPolicy) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a97224de92531df83af2016e5ec382dd", "score": "0.47374547", "text": "func (emp *Employee) ChangeFirstName(newName string) {\n\temp.FirstName = newName\n\tfmt.Println(\"New first name set.\")\n}", "title": "" }, { "docid": "d710bc759b5ad0eaecae83a3fec5d4b4", "score": "0.4716424", "text": "func (m *Tenant) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "842ddbd07e74b0aa28e675a4f635d519", "score": "0.47148848", "text": "func NormalizeFamily(family string) string { return rp.Replace(strings.ToLower(family)) }", "title": "" }, { "docid": "e6e0fa4040e4aa26964b8d41f276a5b6", "score": "0.4713221", "text": "func makePersonName(given string, family string, honourific string, lineage string) *Name {\n\tname := new(Name)\n\tisFlat := true\n\tif s := strings.TrimSpace(given); s != \"\" {\n\t\tname.Given = s\n\t\tisFlat = false\n\t}\n\tif s := strings.TrimSpace(family); s != \"\" {\n\t\tname.Family = s\n\t\tisFlat = false\n\t}\n\tif s := strings.TrimSpace(honourific); s != \"\" {\n\t\tname.Honourific = s\n\t\tisFlat = false\n\t}\n\tif s := strings.TrimSpace(lineage); s != \"\" {\n\t\tname.Lineage = s\n\t\tisFlat = false\n\t}\n\tif isFlat {\n\t\treturn nil\n\t}\n\treturn name\n}", "title": "" }, { "docid": "155feaec446dee60ccbe88c0996d5945", "score": "0.471076", "text": "func (m *OptionalClaim) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "24c696e02b2c4b5df9b0eb60b55987ea", "score": "0.47091302", "text": "func PhoneticFast(str string) string {\n\tbuilder := strings.Builder{}\n\n\tfor _, s := range str {\n\t\tswitch s {\n\t\tcase 'a', 'A':\n\t\t\tbuilder.WriteString(\"alfa \")\n\t\tcase 'b', 'B':\n\t\t\tbuilder.WriteString(\"bravo \")\n\t\tcase 'c', 'C':\n\t\t\tbuilder.WriteString(\"charlie \")\n\t\tcase 'd', 'D':\n\t\t\tbuilder.WriteString(\"delta \")\n\t\tcase 'e', 'E':\n\t\t\tbuilder.WriteString(\"echo \")\n\t\tcase 'f', 'F':\n\t\t\tbuilder.WriteString(\"foxtrot \")\n\t\tcase 'g', 'G':\n\t\t\tbuilder.WriteString(\"golf \")\n\t\tcase 'h', 'H':\n\t\t\tbuilder.WriteString(\"hotel \")\n\t\tcase 'i', 'I':\n\t\t\tbuilder.WriteString(\"india \")\n\t\tcase 'j', 'J':\n\t\t\tbuilder.WriteString(\"juliet \")\n\t\tcase 'k', 'K':\n\t\t\tbuilder.WriteString(\"kilo \")\n\t\tcase 'l', 'L':\n\t\t\tbuilder.WriteString(\"lima \")\n\t\tcase 'm', 'M':\n\t\t\tbuilder.WriteString(\"mike \")\n\t\tcase 'n', 'N':\n\t\t\tbuilder.WriteString(\"november \")\n\t\tcase 'o', 'O':\n\t\t\tbuilder.WriteString(\"oscar \")\n\t\tcase 'p', 'P':\n\t\t\tbuilder.WriteString(\"papa \")\n\t\tcase 'q', 'Q':\n\t\t\tbuilder.WriteString(\"quebec \")\n\t\tcase 'r', 'R':\n\t\t\tbuilder.WriteString(\"romeo \")\n\t\tcase 's', 'S':\n\t\t\tbuilder.WriteString(\"sierra \")\n\t\tcase 't', 'T':\n\t\t\tbuilder.WriteString(\"tango \")\n\t\tcase 'u', 'U':\n\t\t\tbuilder.WriteString(\"uniform \")\n\t\tcase 'v', 'V':\n\t\t\tbuilder.WriteString(\"victor \")\n\t\tcase 'w', 'W':\n\t\t\tbuilder.WriteString(\"whiskey \")\n\t\tcase 'x', 'X':\n\t\t\tbuilder.WriteString(\"xray \")\n\t\tcase 'y', 'Y':\n\t\t\tbuilder.WriteString(\"yankee \")\n\t\tcase 'z', 'Z':\n\t\t\tbuilder.WriteString(\"zulu \")\n\t\tcase '1':\n\t\t\tbuilder.WriteString(\"one \")\n\t\tcase '2':\n\t\t\tbuilder.WriteString(\"two \")\n\t\tcase '3':\n\t\t\tbuilder.WriteString(\"three \")\n\t\tcase '4':\n\t\t\tbuilder.WriteString(\"four \")\n\t\tcase '5':\n\t\t\tbuilder.WriteString(\"five \")\n\t\tcase '6':\n\t\t\tbuilder.WriteString(\"six \")\n\t\tcase '7':\n\t\t\tbuilder.WriteString(\"seven \")\n\t\tcase '8':\n\t\t\tbuilder.WriteString(\"eight \")\n\t\tcase '9':\n\t\t\tbuilder.WriteString(\"nine \")\n\t\tcase '0':\n\t\t\tbuilder.WriteString(\"zero \")\n\t\tdefault:\n\t\t\tbuilder.WriteString(string(s) + \" \")\n\t\t}\n\t}\n\treturn builder.String()\n}", "title": "" }, { "docid": "968c079b0a793fbaddd0df3b69e8579d", "score": "0.47071385", "text": "func (m *ExactMatchDataStoreBase) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "81fac0f7e137d77aa9ca99b70e0d861f", "score": "0.4703405", "text": "func (m *IosLobAppProvisioningConfiguration) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c01feadb1d902ace65c6bd8c8caec2f1", "score": "0.46993768", "text": "func (o *personBase) SetLastName(v string) {\n\to.lastNameIsValid = true\n\tif o.lastName != v || !o._restored {\n\t\to.lastName = v\n\t\to.lastNameIsDirty = true\n\t}\n\n}", "title": "" }, { "docid": "628017a810b6dc131338028d01b2bf38", "score": "0.4692834", "text": "func (m *OrgContact) SetSurname(value *string)() {\n m.surname = value\n}", "title": "" }, { "docid": "be0acc0af2719ad48d445318ff642224", "score": "0.46911925", "text": "func (m *TeamTemplateDefinition) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "51e09f7e7dfcc35082b3bf4715b10336", "score": "0.46845832", "text": "func Stack_AnnotatePhysicalName(construct ConstructIface, phyisicalName string) {}", "title": "" }, { "docid": "355d5d561c82297a0a445e2794508b01", "score": "0.46813273", "text": "func (this *User) setName(n string){\n\tthis.nombre = n\n}", "title": "" }, { "docid": "a4353e22fc0bbb2ccb911c1e57b01063", "score": "0.4677439", "text": "func (m *SecurityBaselineDeviceState) SetUserPrincipalName(value *string)() {\n err := m.GetBackingStore().Set(\"userPrincipalName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8697d9a7473fb08a49518f2cefc85833", "score": "0.46715906", "text": "func (m *EducationRubric) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "ebb122a0d11791d81f27e8264d76197c", "score": "0.46705303", "text": "func (k *NicknameKeeper) SetNickname(ctx sdk.Context, name string, address sdk.AccAddress) bool {\n\t// check if we already have seen it\n\tacc := k.GetUnitAccount(ctx, name)\n\tif acc.Nickname.MustToString() != \"\" {\n\t\treturn false\n\t}\n\n\t// Constructring & Marshal\n\tacc = NewUnitAccount(NewName(name), address)\n\taccBytes := k.cdc.MustMarshalBinaryBare(acc)\n\n\t// add it to the store\n\tst := ctx.KVStore(k.storeKey)\n\tst.Set([]byte(name), accBytes)\n\n\treturn true\n}", "title": "" }, { "docid": "771f46f93a85366124bbfb98b487fa3a", "score": "0.46568504", "text": "func Phonetic(str string) (line string) {\n\tfor _, r := range strings.ToLower(str) {\n\t\tnato, found := natoLetters[r]\n\n\t\tif !found {\n\t\t\tline += string(r)\n\t\t} else {\n\t\t\tline += nato\n\t\t}\n\t\tline += \" \"\n\t}\n\treturn line\n}", "title": "" }, { "docid": "6cb5e0ca1d38f67a202ac1dec1617455", "score": "0.4654258", "text": "func (m *WindowsUpdateState) SetUserPrincipalName(value *string)() {\n err := m.GetBackingStore().Set(\"userPrincipalName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2b06b4c562539987c332faa06d036982", "score": "0.4653861", "text": "func (cli *Client) SetDisplayName(displayName string) (err error) {\n\turlPath := cli.BuildURL(\"profile\", cli.UserID, \"displayname\")\n\ts := struct {\n\t\tDisplayName string `json:\"displayname\"`\n\t}{displayName}\n\terr = cli.MakeRequest(\"PUT\", urlPath, &s, nil)\n\treturn\n}", "title": "" }, { "docid": "9d49725a8331689556249eeb30852350", "score": "0.4649606", "text": "func (m *UserSecurityProfile) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c364a007aed1c0d37f3f9b9c7997dce1", "score": "0.46442652", "text": "func (_class VMPPClass) SetNameDescription(sessionID SessionRef, self VMPPRef, value string) (_err error) {\n\t_method := \"VMPP.set_name_description\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertVMPPRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_valueArg, _err := convertStringToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)\n\treturn\n}", "title": "" } ]
78739cd110b9e2a22a00746bebce9ef7
Produce consumes messages from pulsar indefinitely or until the context is canceled or an error occurs.
[ { "docid": "0c95d4d895f372be0c207005c17c9478", "score": "0.5829389", "text": "func (erp *exchangeRateProducer) Produce(ctx context.Context) error {\n\terReq, err := http.NewRequest(http.MethodGet, \"https://api.coinbase.com/v2/exchange-rates\", nil)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create exchange rate request: %w\", err)\n\t}\n\n\tcurrencies, err := getCurrencies()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsent := 0\n\twait := time.After(time.Second * 10)\n\tfor {\n\t\tselect {\n\t\tcase <-wait:\n\t\t\tfmt.Printf(\"Sent: %d messages\\n\", sent)\n\t\t\tres, err := httpClient.Do(erReq)\n\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to make request: %w\", err)\n\t\t\t}\n\n\t\t\tresRates := &ExchangeRateResponse{}\n\t\t\terr = json.NewDecoder(res.Body).Decode(&resRates)\n\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to decode response body: %w\", err)\n\t\t\t}\n\n\t\t\tat := time.Now().Unix()\n\t\t\tfor curID, rateStr := range resRates.Data.Rates {\n\t\t\t\tif _, ok := currencies[curID]; ok {\n\t\t\t\t\trateFloatValue, err := strconv.ParseFloat(rateStr, 64)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"failed to \")\n\t\t\t\t\t}\n\n\t\t\t\t\trate := &models.ExchangeRate{\n\t\t\t\t\t\tName: currencies[curID].Name,\n\t\t\t\t\t\tID: curID,\n\t\t\t\t\t\tRate: rateFloatValue,\n\t\t\t\t\t\tAt: at,\n\t\t\t\t\t}\n\n\t\t\t\t\trb, err := json.Marshal(rate)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"failed to encode payload: %w\", err)\n\t\t\t\t\t}\n\n\t\t\t\t\t_, err = erp.p.Send(ctx, &pulsar.ProducerMessage{\n\t\t\t\t\t\tPayload: rb,\n\t\t\t\t\t})\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"failed to send: %s %w\", string(rb))\n\t\t\t\t\t}\n\t\t\t\t\tsent++\n\t\t\t\t\twait = time.After(time.Second * 10)\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\terp.p.Close()\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "a3d1382135a9826884c8c00bd58fed68", "score": "0.7182347", "text": "func produce(ctx context.Context, client pulsar.Client, topicName string) {\n\tp := newProducer(client, topicName)\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlog.Printf(\"Exist produce for context done, producer: %v\", p.Name())\n\t\t\trelease(nil, p, nil)\n\t\t\treturn\n\t\tcase <-time.After(produceInterval):\n\t\t\tmsg := time.Now().String() + \"---\" + p.Name()\n\n\t\t\t_, err := p.Send(context.Background(), &pulsar.ProducerMessage{\n\t\t\t\tPayload: []byte(msg),\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"%sERROR%s Produce: %v, err: %v\", color.Red, color.Reset, msg, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlog.Printf(\"%s[Produced]%s: %s\", color.Green, color.Reset, msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7c8cf4bd248eeac91646d94d8335e5e8", "score": "0.6303627", "text": "func (q *consumer) Consume() <-chan Message {\n\tc := q.createChan()\n\n\tproducerNum := q.conf.workerNum\n\tif producerNum == 0 {\n\t\tproducerNum = 1\n\t}\n\n\tfor i := 0; i < int(producerNum); i++ {\n\t\tgo func(q *consumer, c chan Message) {\n\t\t\ttimer := &timer{\n\t\t\t\terrorBackOff: q.conf.errorBackOff,\n\t\t\t}\n\n\t\t\tfor {\n\t\t\t\tif q.IsClosed() {\n\t\t\t\t\tclose(c)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\ttopic, id, body, delay, ttr, err := q.client.PopJob(q.topic, q.conf.popTimeout)\n\t\t\t\tif err == common.ErrorNoAvailableJob {\n\t\t\t\t\tcontinue\n\t\t\t\t} else if err != nil {\n\t\t\t\t\t_ = q.log(err.Error())\n\t\t\t\t\tq.Wait(timer, consumerError)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tmsg := NewMessage(topic, body, id, delay, ttr, q.client)\n\t\t\t\tc <- msg\n\t\t\t}\n\t\t}(q, c)\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "08f2065d74c6bf2862020bbe6b1d289c", "score": "0.6269486", "text": "func (c *clientTracer) Produce(messages chan *Message) {\n\tvar next = make(chan *Message, len(messages))\n\tgo func() {\n\t\tdefer close(next)\n\t\tfor message := range messages {\n\t\t\tc.fn(message)\n\t\t\tnext <- message\n\t\t}\n\t}()\n\n\tc.client.Produce(next)\n}", "title": "" }, { "docid": "3c18d14860de062424fbccfd6f94c7a6", "score": "0.6262022", "text": "func (c *ClientConn) Produce(args ...*ProduceArg) error {\n\tif len(args) < 1 {\n\t\treturn ErrArg\n\t}\n\tvar err error\n\tid := c.Pipeline.Next()\n\n\treq := &ProduceRequest{}\n\tfor _, a := range args {\n\t\treq.Args = append(req.Args, a.TopicPartitionMessages())\n\t}\n\n\t// Send request\n\tc.Pipeline.StartRequest(id)\n\tc.Lock()\n\terr = req.Write(c.Conn)\n\tc.Unlock()\n\tc.Pipeline.EndRequest(id)\n\tc.Pipeline.StartResponse(id)\n\tc.Pipeline.EndResponse(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "45ea7a0bc2d2cc48450e91f894acc9b3", "score": "0.62538093", "text": "func Consume(ctx context.Context, wg *sync.WaitGroup) {\n\twg.Add(1)\n\trun := true\n\tfor run {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlog.Println(\"Caught signal to stop consumer:\")\n\t\t\twg.Done()\n\t\t\trun = false\n\t\tcase ev := <-cons.Events():\n\t\t\tswitch e := ev.(type) {\n\t\t\tcase kafka.AssignedPartitions:\n\t\t\t\tlog.Println(\"AssignedPartitions\", e)\n\t\t\t\tcons.Assign(e.Partitions)\n\t\t\tcase kafka.RevokedPartitions:\n\t\t\t\tlog.Println(\"RevokedPartitions\", e)\n\t\t\t\tcons.Unassign()\n\t\t\tcase *kafka.Message:\n\t\t\t\t//send message to handler ??\n\t\t\t\tobj := StrObj{}\n\t\t\t\tif err := json.Unmarshal(e.Value, &obj); err != nil {\n\t\t\t\t\tlog.Println(\"kafka.Message json.Unmarshal\", err, string(e.Value))\n\t\t\t\t}\n\t\t\t\tcache.Set(obj.ID, []byte(\"info from Kafka consumer\"), 40)\n\t\t\t\tfmt.Println(string(e.Value))\n\t\t\t\t//cache.Set(e.Value)\n\t\t\tcase kafka.PartitionEOF:\n\t\t\t\tlog.Println(\"Reached: \", e)\n\t\t\tcase kafka.Error:\n\t\t\t\tlog.Println(\"Error: \", e)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "610ca4f3451bcc568a062f9ed2f6d21e", "score": "0.62427247", "text": "func Consume(client *sarama.Client, topic string, ch chan *ConsumerData, options ...ConsumerOptions) {\n\tlog.WithFields(log.Fields{\"topic\": topic, \"partition\": 0, \"offset\": \"newest\"}).Info(\"Consuming\")\n\n\tconsumer, err := sarama.NewConsumerFromClient(*client)\n\tCheck(err)\n\tdefer consumer.Close()\n\n\tpc, err := consumer.ConsumePartition(topic, 0, getOptionOffset(options))\n\tCheck(err)\n\tdefer pc.Close()\n\n\tfor msg := range pc.Messages() {\n\t\tdata := ConsumerData{Key: string(msg.Key), Value: msg.Value, Processed: make(chan string)}\n\t\tlog.WithFields(log.Fields{\"topic\": topic, \"partition\": msg.Partition, \"offset\": msg.Offset, \"key\": data.Key, \"value size\": len(data.Value), \"rid\": data.Key}).Info(\"New Message Received\")\n\t\tch <- &data\n\t\t<-data.Processed\n\t}\n\tlog.Println(\"Consumer: Done consuming topic\", topic)\n}", "title": "" }, { "docid": "a2a72029f4d8d65bba84742d9a9688ef", "score": "0.6122619", "text": "func consume(ctx context.Context, r io.ReadSeeker, opts ConsumerOpts, processor Processor) error {\n\tpoller := newPoller(ctx, r, opts)\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase batch, ok := <-poller.Ready():\n\t\t\terr := processor(ctx, batch)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !ok {\n\t\t\t\treturn poller.Error()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b8974cee282af767b4c1e3a5ce0a17d2", "score": "0.60933787", "text": "func (prod *Null) Produce(threads *sync.WaitGroup) {\n\tprod.MessageControlLoop(func(*core.Message) {})\n}", "title": "" }, { "docid": "531b898209f8d0e3ce00f4f050dd94bf", "score": "0.60168576", "text": "func (prod *AwsKinesis) Produce(workers *sync.WaitGroup) {\n\tdefer prod.WorkerDone()\n\n\tprod.AddMainWorker(workers)\n\tprod.initKinesisClient()\n\tprod.BatchMessageLoop(workers, prod.sendBatch)\n}", "title": "" }, { "docid": "a71bf8ba44702b88fcfacd356081db31", "score": "0.6013419", "text": "func (c *Client) publish(ctx context.Context) error {\n\tdlog := debug.NewPrefixLogger(\"publish: \")\n\n\tc.subMux.RLock()\n\tdlog.Printf(\"pendingAcks=%s\", debug.ToJSON(c.pendingAcks))\n\tc.subMux.RUnlock()\n\n\t// send the next publish request\n\t// note that res contains data even if an error was returned\n\tres, err := c.sendPublishRequest(ctx)\n\tstats.RecordError(err)\n\tswitch {\n\tcase err == io.EOF:\n\t\tdlog.Printf(\"eof: pausing publish loop\")\n\t\treturn err\n\n\tcase err == ua.StatusBadSessionNotActivated:\n\t\tdlog.Printf(\"error: session not active. pausing publish loop\")\n\t\treturn err\n\n\tcase err == ua.StatusBadSessionIDInvalid:\n\t\tdlog.Printf(\"error: session not valid. pausing publish loop\")\n\t\treturn err\n\n\tcase err == ua.StatusBadServerNotConnected:\n\t\tdlog.Printf(\"error: no connection. pausing publish loop\")\n\t\treturn err\n\n\tcase err == ua.StatusBadSequenceNumberUnknown:\n\t\t// todo(fs): this should only happen per in the status codes\n\t\t// todo(fs): lets log this here to see\n\t\tdlog.Printf(\"error: this should only happen when ACK'ing results: %s\", err)\n\n\tcase err == ua.StatusBadTooManyPublishRequests:\n\t\t// todo(fs): we have sent too many publish requests\n\t\t// todo(fs): we need to slow down\n\t\tdlog.Printf(\"error: sleeping for one second: %s\", err)\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-time.After(time.Second):\n\t\t}\n\n\tcase err == ua.StatusBadTimeout:\n\t\t// ignore and continue the loop\n\t\tdlog.Printf(\"error: ignoring: %s\", err)\n\n\tcase err == ua.StatusBadNoSubscription:\n\t\t// All subscriptions have been deleted, but the publishing loop is still running\n\t\t// We should pause publishing until a subscription has been created\n\t\tdlog.Printf(\"error: no subscriptions but the publishing loop is still running: %s\", err)\n\t\treturn err\n\n\tcase err != nil && res != nil:\n\t\t// irrecoverable error\n\t\t// todo(fs): do we need to stop and forget the subscription?\n\t\tif res.SubscriptionID == 0 {\n\t\t\tc.notifyAllSubscriptionsOfError(ctx, err)\n\t\t} else {\n\t\t\tc.notifySubscriptionOfError(ctx, res.SubscriptionID, err)\n\t\t}\n\t\tdlog.Printf(\"error: %s\", err)\n\t\treturn err\n\n\tcase err != nil:\n\t\tdlog.Printf(\"error: unexpected error. Do we need to stop the publish loop?: %s\", err)\n\t\treturn err\n\n\tdefault:\n\t\tc.subMux.Lock()\n\t\t// handle pending acks for all subscriptions\n\t\tc.handleAcks_NeedsSubMuxLock(res.Results)\n\n\t\tsub, ok := c.subs[res.SubscriptionID]\n\t\tif !ok {\n\t\t\tc.subMux.Unlock()\n\t\t\t// todo(fs): should we return an error here?\n\t\t\tdlog.Printf(\"error: unknown subscription %d\", res.SubscriptionID)\n\t\t\treturn nil\n\t\t}\n\n\t\t// handle the publish response for a specific subscription\n\t\tc.handleNotification_NeedsSubMuxLock(ctx, sub, res)\n\t\tc.subMux.Unlock()\n\n\t\tc.notifySubscription(ctx, sub, res.NotificationMessage)\n\t\tdlog.Printf(\"notif: %d\", res.NotificationMessage.SequenceNumber)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8acc3ba8f217261ae4847dfa371edfac", "score": "0.59780496", "text": "func (c *Consumer) consumeLoop(done, errs chan struct{}, wait *sync.WaitGroup, pcsm sarama.PartitionConsumer) {\n\tdefer wait.Done()\n\n\tfor {\n\t\tselect {\n\t\tcase msg := <-pcsm.Messages():\n\t\t\ttp := topicPartition{msg.Topic, msg.Partition}\n\t\t\t// fmt.Printf(\"*,%s,%s,%d\\n\", c.id, tp.String(), msg.Offset)\n\t\t\tselect {\n\t\t\tcase c.messages <- msg:\n\t\t\t\t// fmt.Printf(\"+,%s,%s,%d\\n\", c.id, tp.String(), msg.Offset)\n\t\t\t\tc.rLock.Lock()\n\t\t\t\tc.read[tp] = msg.Offset + 1\n\t\t\t\tc.rLock.Unlock()\n\t\t\t\tif c.config.AutoAck {\n\t\t\t\t\tc.Ack(msg)\n\t\t\t\t}\n\t\t\tcase <-done:\n\t\t\t\t// fmt.Printf(\"@+,%s\\n\", c.id)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase msg := <-pcsm.Errors():\n\t\t\ttp := topicPartition{msg.Topic, msg.Partition}\n\t\t\t// fmt.Printf(\"!,%s,%s,%s\\n\", c.id, tp.String(), msg.Error())\n\t\t\tif msg.Err == sarama.ErrOffsetOutOfRange {\n\t\t\t\toffset, err := c.client.GetOffset(msg.Topic, msg.Partition, sarama.OffsetOldest)\n\t\t\t\tif err == nil {\n\t\t\t\t\tc.rLock.Lock()\n\t\t\t\t\tc.read[tp] = offset\n\t\t\t\t\tc.rLock.Unlock()\n\t\t\t\t}\n\t\t\t\terrs <- struct{}{}\n\t\t\t}\n\n\t\t\tif !c.config.returnErrors {\n\t\t\t\tselect {\n\t\t\t\tcase c.errors <- msg:\n\t\t\t\t\t// fmt.Printf(\"-,%s,%s,%s\\n\", c.id, tp.String(), msg.Error())\n\t\t\t\tcase <-done:\n\t\t\t\t\t// fmt.Printf(\"@-,%s\\n\", c.id)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsarama.Logger.Println(msg)\n\t\t\t}\n\t\tcase <-done:\n\t\t\t// fmt.Printf(\"@@,%s\\n\", c.id)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "91894ff5e5f2af08ed42c21dabbb0276", "score": "0.595157", "text": "func (self *Queue) Consume() {\n\t//\tself.Msgchan = make(chan sexredis.Msg)\n\tfor {\n\t\tself.log.Println(\"go consume...\")\n\t\tmsg := self.Get()\n\t\tself.log.Printf(\"1%+v\", msg)\n\t\tif n, ok := msg.Content.(int64); ok && n > 0 {\n\t\t\tself.log.Println(n, ok)\n\t\t\tself.Msgchan <- msg\n\t\t}\n\t\tself.log.Printf(\"2%+v\", msg)\n\t\ttime.Sleep(3000 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "e370634a3f0a1ea068d7e745ff45f220", "score": "0.5882941", "text": "func consumeAMQP(s *state.State) {\n\tfor {\n\t\tmsg := <-s.AMQPCh[0]\n\t\tt := time.Now().UTC()\n\n\t\t// parse routing key\n\t\tparts := strings.Split(msg.RoutingKey, \".\")\n\n\t\t// capture processed payloads from peripehral controllers\n\t\tif parts[0] == \"data\" {\n\t\t\ts.Log.Println(\"[amqp] RX_Payload processed on\", msg.RoutingKey)\n\t\t\trxProcessedPayload(s, parts, t, msg)\n\t\t\tcontinue\n\t\t}\n\t\t// capture configurations from peripheral controllers\n\t\tif parts[0] == \"global\" && parts[1] == \"config\" {\n\t\t\ts.Log.Println(\"[amqp] RX_Config on\", msg.RoutingKey)\n\t\t\trxConfig(s, parts, t, msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ad014b950b85319956b95f31ae47f977", "score": "0.5872353", "text": "func consume(ctx context.Context, cfg *Config, upstream chan kafka.Message) {\n\tlog.Event(ctx, \"started consuming\")\n\tvar batch = []kafka.Message{}\n\tfor {\n\t\t// get message from upstream channel\n\t\tconsumedMessage, ok := <-upstream\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tconsumeCount++\n\t\tlogData := log.Data{\"consumeCount\": consumeCount, \"messageOffset\": consumedMessage.Offset()}\n\t\tlog.Event(ctx, \"[KAFKA-TEST] Received message\", log.INFO, logData)\n\n\t\t// append message to batch\n\t\tbatch = append(batch, consumedMessage)\n\n\t\t// if batch is full, process it\n\t\tif len(batch) == cfg.KafkaBatchSize {\n\t\t\tprocessBatch(ctx, cfg, logData, batch)\n\t\t\tbatch = []kafka.Message{}\n\t\t}\n\n\t\t// release the message, so that the next one can be consumed\n\t\tconsumedMessage.Release()\n\t}\n}", "title": "" }, { "docid": "0d49cf6d6c1f024181b562bce90fa03b", "score": "0.58663136", "text": "func (prod *Websocket) Produce(workers *sync.WaitGroup) {\n\tprod.AddMainWorker(workers)\n\tgo prod.serve()\n\tprod.MessageControlLoop(prod.pushMessage)\n}", "title": "" }, { "docid": "6410d98168dc56ca592431e7d0008d08", "score": "0.5843241", "text": "func (s *Source) Consume() (streams.Message, error) {\n\tif s.lastErr != nil {\n\t\treturn streams.EmptyMessage, s.lastErr\n\t}\n\n\tselect {\n\tcase msg := <-s.buf:\n\t\tk, err := s.keyDecoder.Decode(msg.Key)\n\t\tif err != nil {\n\t\t\treturn streams.EmptyMessage, err\n\t\t}\n\n\t\tv, err := s.valueDecoder.Decode(msg.Value)\n\t\tif err != nil {\n\t\t\treturn streams.EmptyMessage, err\n\t\t}\n\n\t\tm := streams.NewMessageWithContext(s.ctx, k, v).\n\t\t\tWithMetadata(s, s.createMetadata(msg))\n\t\treturn m, nil\n\n\tcase <-time.After(100 * time.Millisecond):\n\t\treturn streams.EmptyMessage, nil\n\t}\n}", "title": "" }, { "docid": "f67dcde8bf4e233672daad23b6133cf5", "score": "0.58250564", "text": "func (cqs *ConsumeQueueService) Consume(results chan<- interface{}) {\n\turl := os.Getenv(\"AMQP_URL\")\n\n\tif url == \"\" {\n\t\turl = \"amqp://user:bitnami@rabbitmq:5672\"\n\t}\n\n\tlog.Info(\" CONSUMING QUEUE:\", cqs.Queue)\n\n\tcfg := rabbitmq.Config{\n\t\tURL: url,\n\t\tQueueName: cqs.Queue,\n\t\tExchange: \"\",\n\t\tRoutingKey: \"#\",\n\t}\n\tqueue, err := rabbitmq.NewQueueInstance(cfg)\n\tif err != nil {\n\t\tfmt.Println(\"error declaring the new queue instance: \" + err.Error())\n\t}\n\tmessages, err := queue.Consume()\n\tif err != nil {\n\t\tfmt.Println(\"error consuming the queue: \" + err.Error())\n\t}\n\tfor message := range messages {\n\t\tvar data interface{}\n\t\tif err := json.Unmarshal(message, &data); err != nil {\n\t\t\tfmt.Println(\"error in byte conversion of event: \" + err.Error())\n\t\t}\n\t\tresults <- data\n\t}\n}", "title": "" }, { "docid": "6c0461506531ed69cb36e964cad88f9d", "score": "0.5799451", "text": "func (cons *Kafka) Consume(workers *sync.WaitGroup) {\n\tcons.SetWorkerWaitGroup(workers)\n\n\tif err := cons.startAllConsumers(); err != nil {\n\t\tcons.Logger.WithError(err).Error(\"Kafka client error\")\n\t\ttime.AfterFunc(cons.config.Net.DialTimeout, func() { cons.Consume(workers) })\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\tcons.client.Close()\n\t\tcons.dumpIndex()\n\t}()\n\n\tcons.TickerControlLoop(cons.persistTimeout, cons.dumpIndex)\n}", "title": "" }, { "docid": "4295b5fb52fd88d0cce1bd02a71772f2", "score": "0.5762985", "text": "func (p *Producer) Produce(product []byte) error {\n\tvar (\n\t\terr error\n\t\tq amqp.Queue\n\t\tmaxRetry = p.config.MaxRetry\n\t)\n\tfor i := 0; ; i++ {\n\t\tif maxRetry > 0 && i == maxRetry {\n\t\t\tbreak\n\t\t}\n\t\tif i > 0 {\n\t\t\ttime.Sleep(time.Duration(100) * time.Millisecond)\n\t\t}\n\t\tif p.isClosed {\n\t\t\treturn fmt.Errorf(\"producer is already closed\")\n\t\t}\n\t\t_, ch := p.client.rwChannels()\n\t\tq, err = ch.QueueDeclare(\n\t\t\tp.config.QueueName, // name\n\t\t\tfalse, // durable\n\t\t\tfalse, // delete when unused\n\t\t\tfalse, // exclusive\n\t\t\tfalse, // no-wait\n\t\t\tnil, // arguments\n\t\t)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"queue declare failed, %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tpublish := amqp.Publishing{\n\t\t\tContentType: p.config.ContentType,\n\t\t\tBody: product,\n\t\t}\n\t\terr = ch.Publish(\n\t\t\t\"\", // exchange\n\t\t\tq.Name, // routing key\n\t\t\tfalse, // mandatory\n\t\t\tfalse, // immediate\n\t\t\tpublish,\n\t\t)\n\t\tif err == nil {\n\t\t\treturn nil\n\t\t}\n\t\terr = fmt.Errorf(\"publish to queue failed, %v\", err)\n\t}\n\treturn fmt.Errorf(\"retry max times %d reached, error: %v\", maxRetry, err)\n\n}", "title": "" }, { "docid": "7d05c6ec64bb62f8db481852b8c9c62e", "score": "0.57254285", "text": "func (c *Client) Subscribe(\n\tctx context.Context,\n\tqueue string,\n\topts *SubscribeOpts,\n\tchanOpts *ChannelOpts,\n\tconnOpts *ConnectOpts,\n\thandler func(amqp.Delivery) (amqp.Publishing, error),\n) error {\n\n\tdefaultConnOpts := DefaultConnectOpts()\n\tif connOpts != nil {\n\t\tdefaultConnOpts = connOpts\n\t}\n\n\tconn, err := c.connect(defaultConnOpts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tch, err := c.getChannel(conn, chanOpts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer ch.Close()\n\n\t// Ensure a consumer does not consume another message unless it has processed\n\t// the last message\n\t//err = ch.Qos(\n\t//\t1, // prefetch count\n\t//\t0, // prefetch size\n\t//\tfalse, // global\n\t//)\n\t//if err != nil {\n\t//\tlog.Println(err.Error())\n\t//\treturn err\n\t//}\n\n\tmsgs, err := ch.Consume(\n\t\tqueue,\n\t\t\"\",\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor {\n\t\t// Need to check if connection is closed or else\n\t\t// msgs channel starts dumping empty messages\n\t\t// overwhelming the select clause\n\t\tif conn.IsClosed() {\n\t\t\tlog.Println(\"Connection closed/interrupted...\")\n\t\t\tif opts.Reconnect {\n\t\t\t\tconn, err = c.connect(defaultConnOpts)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tch, err = c.getChannel(conn, chanOpts)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tmsgs, err = ch.Consume(\n\t\t\t\t\tqueue,\n\t\t\t\t\t\"\",\n\t\t\t\t\tfalse,\n\t\t\t\t\tfalse,\n\t\t\t\t\tfalse,\n\t\t\t\t\tfalse,\n\t\t\t\t\tnil,\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn errors.New(\"connection closed/interrupted\")\n\t\t}\n\n\t\tselect {\n\t\tcase msg := <-msgs:\n\t\t\tif len(msg.Body) == 0 {\n\t\t\t\tlog.Println(\"Received empty message. Ignoring...\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t//log.Printf(\"Received message: %s\\n\\n\\n%v\\n\", string(msg.Body), msg)\n\n\t\t\tif opts.CorrelationID != \"\" && msg.CorrelationId != opts.CorrelationID {\n\t\t\t\tlog.Printf(\"Re-queuing message as \"+\n\t\t\t\t\t\"correlationIDs don't match. Got: [%s] Expected: [%s]\\n\",\n\t\t\t\t\tmsg.CorrelationId, opts.CorrelationID)\n\t\t\t\tmsg.Nack(false, true)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// call handler to process message\n\t\t\tresp, err := handler(msg)\n\t\t\tif err != nil {\n\t\t\t\t// requeue if error happened\n\t\t\t\t// while processing request msg\n\t\t\t\tmsg.Nack(false, true)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tmsg.Ack(false)\n\n\t\t\t// If subscriber doesn't want to publish response\n\t\t\t// skip the response publishing part\n\t\t\tif opts.PublishResponse {\n\t\t\t\terr = ch.Publish(\n\t\t\t\t\tmsg.Exchange,\n\t\t\t\t\tmsg.ReplyTo,\n\t\t\t\t\tfalse,\n\t\t\t\t\tfalse,\n\t\t\t\t\tresp,\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Listen indefinitely\n\t\t\t// if requested\n\t\t\tif opts.ListenIndefinitely {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\treturn nil\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3a516f88f33bde84e24946dc7f0800d4", "score": "0.5719857", "text": "func Consume(id uint64, jobs <-chan Output, results chan<- Output) {\n\n\tfor job := range jobs {\n\t\tresults <- job\n\t}\n\n}", "title": "" }, { "docid": "3a516f88f33bde84e24946dc7f0800d4", "score": "0.5719857", "text": "func Consume(id uint64, jobs <-chan Output, results chan<- Output) {\n\n\tfor job := range jobs {\n\t\tresults <- job\n\t}\n\n}", "title": "" }, { "docid": "2a1abc9b6f797271804c84e82c347382", "score": "0.5715811", "text": "func (c *Consumer) Consume() chan Message {\n\tif c.options.BufferMessages {\n\t\treturn c.buffer.Consume(3*time.Second, 1*time.Millisecond)\n\t}\n\n\treturn c.ch\n}", "title": "" }, { "docid": "678609c276998bfe806a67dfe49d8120", "score": "0.5709231", "text": "func (p *TopicProducer) produce(data []byte) {\n msg := &kafka.Message {\n TopicPartition: kafka.TopicPartition{ Topic: &p.Topic, Partition: kafka.PartitionAny },\n Value: data,\n Headers: []kafka.Header{},\n }\n\n if p.toChannel {\n p.producer.ProduceChannel() <- msg\n } else {\n err := p.producer.Produce(msg, p.delivery)\n if err != nil {\n log.Printf(\"Failed to enqueue the message: %v : %v, will retry in one minute\", string(data), err)\n time.Sleep(60 * time.Second)\n }\n }\n}", "title": "" }, { "docid": "1af9a4bdc792dd6ad6db71ad2e542cf9", "score": "0.5669738", "text": "func (prod *File) Produce(workers *sync.WaitGroup) {\n\tprod.AddMainWorker(workers)\n\tprod.TickerMessageControlLoop(prod.writeMessage, prod.BatchConfig.BatchTimeout, prod.writeBatchOnTimeOut)\n}", "title": "" }, { "docid": "4a58b0011ee959ad74ceee9acfe59516", "score": "0.5651783", "text": "func producer(conn *websocket.Conn) {\n\n\tdefer conn.Close()\n\n\tfor {\n\n\t\tvar request protocol.ProduceRequest\n\n\t\terr := websocket.JSON.Receive(conn, &request)\n\t\tif err == io.EOF { // graceful shutdown\n\t\t\tbreak\n\t\t}\n\n\t\tif nil != err {\n\t\t\tlog.Warn(\"Ignoring invalid message from %v.\", conn.RemoteAddr())\n\t\t\tcontinue\n\t\t}\n\n\t\tack := new(protocol.Ack)\n\t\tif err := broker.Publish(request.Topic, request.ID, &request.Message); nil != err {\n\t\t\tlog.Error(err.Error())\n\t\t\tack.Status = protocol.StatusFailure\n\t\t} else {\n\t\t\tack.Status = protocol.StatusSuccess\n\t\t}\n\t\t// TODO: should redirect if this node is not the leader\n\n\t\twebsocket.JSON.Send(conn, &ack)\n\n\t}\n\n\tlog.Info(\"Closed producer connection from %v.\", conn.RemoteAddr())\n\n}", "title": "" }, { "docid": "db90297de385f74b93f1158ad1f944df", "score": "0.5601968", "text": "func (cons *SystemdConsumer) Consume(workers *sync.WaitGroup) {\n\tcons.AddMainWorker(workers)\n\tgo cons.read()\n\tcons.ControlLoop()\n}", "title": "" }, { "docid": "444f6e532d0d0ffb7d5a109c92be66fd", "score": "0.5598862", "text": "func ConsumeForever() {\n\n\tconn, err := amqp.Dial(\"amqp://guest:guest@localhost:5672/\")\n\tfailOnError(err, \"Consumer: Failed to connect to RabbitMQ\")\n\tdefer conn.Close()\n\n\tch, err := conn.Channel()\n\tfailOnError(err, \"Failed to open a channel\")\n\tdefer ch.Close()\n\n\tq, err := ch.QueueDeclare(\n\t\t\"hello\", // name\n\t\tfalse, // durable\n\t\tfalse, // delete when unused\n\t\tfalse, // exclusive\n\t\tfalse, // no-wait\n\t\tnil, // arguments\n\t)\n\tfailOnError(err, \"Failed to declare a queue\")\n\n\tmsgs, err := ch.Consume(\n\t\tq.Name, // queue\n\t\t\"\", // consumer\n\t\ttrue, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\tfailOnError(err, \"Failed to register a consumer\")\n\n\tforever := make(chan bool)\n\n\tgo func() {\n\t\tfor d := range msgs {\n\n\t\t\tvar msg customtypes.Message\n\n\t\t\t//json.NewDecoder(d.Body).Decode(&msg)\n\t\t\terr := json.Unmarshal([]byte(d.Body), &msg)\n\n\t\t\tfailOnError(err, \"Error decoding\")\n\n\t\t\tlog.Printf(\"Received a message: %s\", d.Body)\n\n\t\t\tsaveindatabase(msg)\n\t\t}\n\t}()\n\n\tlog.Printf(\" [*] Waiting for messages. To exit press CTRL+C\")\n\t<-forever\n}", "title": "" }, { "docid": "a53b453df664459c6392afec4e6a83c5", "score": "0.55811733", "text": "func (p *Producer) Produce(data []byte) {\n\ttokenAnchor := getAnchor(p.client)\n\n\tvar err error\n\tvar channel circuit.Chan\n\n\t// Check if there already is a channle\n\texistingChannel := tokenAnchor.Get()\n\tif existingChannel != nil {\n\t\tchannel = existingChannel.(circuit.Chan)\n\t}\n\n\tif channel == nil {\n\t\tchannel, err = tokenAnchor.MakeChan(1)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error while creating token anchor %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\twriter, err := channel.Send()\n\n\tif err != nil {\n\t\tlog.Printf(\"Error while opening channel for writing %v\", err)\n\t\treturn\n\t}\n\n\twriter.Write(data)\n\twriter.Close()\n}", "title": "" }, { "docid": "9c16697f1dc602566099b2f8d83f8be2", "score": "0.5571478", "text": "func (c *AMQPConsumer) consume(ctx context.Context, queue Queue, conn *amqp.Connection) error {\n\tc.log.Infof(\"Starting consumer for queue %v\", queue.Name)\n\tch, err := conn.Channel()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer c.log.Infof(\"Consumer for queue %v has stopped\", queue.Name)\n\tdefer ch.Close()\n\n\tif err := ch.Qos(queue.Prefetch, 0, false); err != nil {\n\t\treturn err\n\t}\n\n\t// declare queue\n\tqueueArgs := amqp.Table{}\n\tif queue.UseDLX {\n\t\tqueueArgs[\"x-dead-letter-exchange\"] = c.dlx\n\t}\n\tif queue.MessageTTL > 0 {\n\t\tqueueArgs[\"x-message-ttl\"] = queue.MessageTTL\n\t}\n\n\t_, err = ch.QueueDeclare(queue.Name, true, false, false, false, queueArgs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdv, err := ch.Consume(queue.Name, \"\", false, false, false, false, amqp.Table{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\teg, ctx := errgroup.WithContext(ctx)\n\n\tsem := make(chan struct{}, queue.Parallelism)\n\nloop:\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tbreak loop\n\t\tcase d, ok := <-dv:\n\t\t\tif !ok {\n\t\t\t\tbreak loop\n\t\t\t}\n\n\t\t\tif d.Redelivered {\n\t\t\t\tc.log.Debugf(\"Rejecting redelivered message\")\n\n\t\t\t\terr = d.Reject(false)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.log.Debugf(\"Redelivered message rejected with error: %v\", err)\n\t\t\t\t}\n\n\t\t\t\tbreak loop\n\t\t\t}\n\n\t\t\tsem <- struct{}{}\n\n\t\t\teg.Go(func() error {\n\t\t\t\tdefer func() {\n\t\t\t\t\t<-sem\n\t\t\t\t}()\n\n\t\t\t\tlogctx := map[string]interface{}{\n\t\t\t\t\t\"message_id\": d.MessageId,\n\t\t\t\t\t\"delivery_tag\": d.DeliveryTag,\n\t\t\t\t}\n\n\t\t\t\tc.log.Debug(\"Processing message\", logctx)\n\n\t\t\t\terr := queue.Processor(ctx, headers(d), d.Body)\n\t\t\t\tswitch err {\n\t\t\t\tcase nil: // 2xx\n\t\t\t\t\tc.log.Debug(\"Message successfully processed\", logctx)\n\t\t\t\tcase ErrProcessingError: // 4xx error\n\t\t\t\t\tfallthrough\n\t\t\t\tcase ErrProcessingFailed: // 5xx error\n\t\t\t\t\tfallthrough\n\t\t\t\tcase ErrUnknownStatus: // status code is missing (could be 2xx, could be fatal error)\n\t\t\t\t\tfallthrough\n\t\t\t\tcase ErrProcessorInternal: // could not perform request\n\t\t\t\t\tfallthrough\n\t\t\t\tdefault:\n\t\t\t\t\tc.log.Debug(fmt.Sprintf(\"Message processed with error: %v\", err), logctx)\n\t\t\t\t}\n\n\t\t\t\t// error is also result\n\t\t\t\treturn d.Ack(false)\n\t\t\t})\n\t\t}\n\t}\n\n\treturn eg.Wait()\n}", "title": "" }, { "docid": "4391120f262fb8e4311c6392d4d85616", "score": "0.5557622", "text": "func consumeMessage(ctx context.Context) {\n\n\tl := log.New(os.Stdout, \"Kafka Writer:\", 0)\n\n\t// initialize a new reader with the brokers and topic\n\t// the groupID identifies the consumer and prevents\n\t// it from receiving duplicate messages\n\treader := kafka.NewReader(kafka.ReaderConfig{\n\t\tBrokers: []string{broker1Address, broker2Address, broker3Address},\n\t\tTopic: topic,\n\t\tLogger: l,\n\t\tGroupID: \"my-group\",\n\t\tMinBytes: 5,\n\t\tMaxBytes: 1e6,\n\t\t// Wait for at most 3 sec before receiving new data\n\t\tMaxWait: 3 * time.Second,\n\t})\n\n\tfor {\n\t\t// the `ReadMessage` method blocks until we receive the next event\n\t\tmsg, err := reader.ReadMessage(ctx)\n\t\tif err != nil {\n\t\t\tpanic(\"could not read message \" + err.Error())\n\t\t}\n\t\t// after receiving the message, log its value\n\t\tfmt.Println(\"received: \", string(msg.Value))\n\t}\n\n}", "title": "" }, { "docid": "3ca628a9637fb2a519c0399ebc4572dc", "score": "0.5554242", "text": "func (p *Producer) Produce(msg *kafka.Message, deliveryChan chan kafka.Event) error {\n\tspan := p.startSpan(msg)\n\n\t// if the user has selected a delivery channel, we will wrap it and\n\t// wait for the delivery event to finish the span\n\tif deliveryChan != nil {\n\t\toldDeliveryChan := deliveryChan\n\t\tdeliveryChan = make(chan kafka.Event)\n\t\tgo func() {\n\t\t\tvar err error\n\t\t\tevt := <-deliveryChan\n\t\t\tif msg, ok := evt.(*kafka.Message); ok {\n\t\t\t\t// delivery errors are returned via TopicPartition.Error\n\t\t\t\terr = msg.TopicPartition.Error\n\t\t\t}\n\t\t\tspan.Finish(tracer.WithError(err))\n\t\t\toldDeliveryChan <- evt\n\t\t}()\n\t}\n\n\terr := p.Producer.Produce(msg, deliveryChan)\n\t// with no delivery channel, finish immediately\n\tif deliveryChan == nil {\n\t\tspan.Finish(tracer.WithError(err))\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "5162c584f7c576a71827a12b722e4014", "score": "0.55418104", "text": "func Produce(topic string, prm interface{}) error {\n\n\tvalByte, err := json.Marshal(prm)\n\tif err != nil {\n\t\tlog.Println(\"BalanceResp json.Marshal\", err)\n\t\treturn err\n\t}\n\n\tdChan := make(chan kafka.Event)\n\n\terr = prod.Produce(&kafka.Message{\n\t\tTopicPartition: kafka.TopicPartition{\n\t\t\tTopic: &topic,\n\t\t\tPartition: kafka.PartitionAny},\n\t\tValue: valByte},\n\t\tdChan)\n\te := <-dChan\n\tm := e.(*kafka.Message)\n\tif m.TopicPartition.Error != nil {\n\t\tlog.Printf(\"Delivery failed: %v\\n\", m.TopicPartition.Error)\n\t\terr = m.TopicPartition.Error\n\t}\n\n\tclose(dChan)\n\treturn err\n}", "title": "" }, { "docid": "d1af5a0f2b748d9483f0022f5bdb7317", "score": "0.553416", "text": "func (s *stream) Consume(topic string, opts ...events.ConsumeOption) (<-chan events.Event, error) {\n\t// validate the topic\n\tif len(topic) == 0 {\n\t\treturn nil, events.ErrMissingTopic\n\t}\n\n\t// parse the options\n\toptions := events.ConsumeOptions{\n\t\tGroup: uuid.New().String(),\n\t\tAutoAck: true,\n\t}\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\n\t// setup the subscriber\n\tc := make(chan events.Event)\n\thandleMsg := func(m *stan.Msg) {\n\t\t// poison message handling\n\t\tif options.GetRetryLimit() > -1 && m.Redelivered && int(m.RedeliveryCount) > options.GetRetryLimit() {\n\t\t\tif logger.V(logger.ErrorLevel, logger.DefaultLogger) {\n\t\t\t\tlogger.Errorf(\"Message retry limit reached, discarding: %v\", m.Sequence)\n\t\t\t}\n\t\t\tm.Ack() // ignoring error\n\t\t\treturn\n\t\t}\n\n\t\t// decode the message\n\t\tvar evt events.Event\n\t\tif err := json.Unmarshal(m.Data, &evt); err != nil {\n\t\t\tif logger.V(logger.ErrorLevel, logger.DefaultLogger) {\n\t\t\t\tlogger.Errorf(\"Error decoding message: %v\", err)\n\t\t\t}\n\t\t\t// not acknowledging the message is the way to indicate an error occurred\n\t\t\treturn\n\t\t}\n\n\t\tif !options.AutoAck {\n\t\t\t// set up the ack funcs\n\t\t\tevt.SetAckFunc(func() error {\n\t\t\t\treturn m.Ack()\n\t\t\t})\n\t\t\tevt.SetNackFunc(func() error {\n\t\t\t\t// noop. not acknowledging the message is the way to indicate an error occurred\n\t\t\t\t// we have to wait for the ack wait to kick in before the message is resent\n\t\t\t\treturn nil\n\t\t\t})\n\t\t}\n\n\t\t// push onto the channel and wait for the consumer to take the event off before we acknowledge it.\n\t\tc <- evt\n\n\t\tif !options.AutoAck {\n\t\t\treturn\n\t\t}\n\t\tif err := m.Ack(); err != nil && logger.V(logger.ErrorLevel, logger.DefaultLogger) {\n\t\t\tlogger.Errorf(\"Error acknowledging message: %v\", err)\n\t\t}\n\t}\n\n\t// setup the options\n\tsubOpts := []stan.SubscriptionOption{\n\t\tstan.DurableName(topic),\n\t\tstan.SetManualAckMode(),\n\t}\n\tif options.Offset.Unix() > 0 {\n\t\tsubOpts = append(subOpts, stan.StartAtTime(options.Offset))\n\t}\n\tif options.AckWait > 0 {\n\t\tsubOpts = append(subOpts, stan.AckWait(options.AckWait))\n\t}\n\n\t// connect the subscriber\n\t_, err := s.conn.QueueSubscribe(topic, options.Group, handleMsg, subOpts...)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Error subscribing to topic\")\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "9ee7426f041aa48a27851686dc062cdb", "score": "0.55332464", "text": "func (chain *chainImpl) processMessagesToBlocks() ([]uint64, error) {\n\tcounts := make([]uint64, 11) // For metrics and tests\n\tmsg := new(ab.KafkaMessage)\n\n\tdefer func() {\n\t\t// notify that we are not processing messages to blocks\n\t\tclose(chain.doneProcessingMessagesToBlocks)\n\t}()\n\n\tdefer func() { // When Halt() is called\n\t\tselect {\n\t\tcase <-chain.errorChan: // If already closed, don't do anything\n\t\tdefault:\n\t\t\tclose(chain.errorChan)\n\t\t}\n\t}()\n\n\tsubscription := fmt.Sprintf(\"added subscription to %s/%d\", chain.channel.topic(), chain.channel.partition())\n\tvar topicPartitionSubscriptionResumed <-chan string\n\tvar deliverSessionTimer *time.Timer\n\tvar deliverSessionTimedOut <-chan time.Time\n\n\tfor {\n\t\tselect {\n\t\tcase <-chain.haltChan:\n\t\t\tlogger.Warningf(\"[channel: %s] Consenter for channel exiting\", chain.ChannelID())\n\t\t\tcounts[indexExitChanPass]++\n\t\t\treturn counts, nil\n\t\tcase kafkaErr := <-chain.channelConsumer.Errors():\n\t\t\tlogger.Errorf(\"[channel: %s] Error during consumption: %s\", chain.ChannelID(), kafkaErr)\n\t\t\tcounts[indexRecvError]++\n\t\t\tselect {\n\t\t\tcase <-chain.errorChan: // If already closed, don't do anything\n\t\t\tdefault:\n\n\t\t\t\tswitch kafkaErr.Err {\n\t\t\t\tcase sarama.ErrOffsetOutOfRange:\n\t\t\t\t\t// the kafka consumer will auto retry for all errors except for ErrOffsetOutOfRange\n\t\t\t\t\tlogger.Errorf(\"[channel: %s] Unrecoverable error during consumption: %s\", chain.ChannelID(), kafkaErr)\n\t\t\t\t\tclose(chain.errorChan)\n\t\t\t\tdefault:\n\t\t\t\t\tif topicPartitionSubscriptionResumed == nil {\n\t\t\t\t\t\t// register listener\n\t\t\t\t\t\ttopicPartitionSubscriptionResumed = saramaLogger.NewListener(subscription)\n\t\t\t\t\t\t// start session timout timer\n\t\t\t\t\t\tdeliverSessionTimer = time.NewTimer(chain.consenter.retryOptions().NetworkTimeouts.ReadTimeout)\n\t\t\t\t\t\tdeliverSessionTimedOut = deliverSessionTimer.C\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase <-chain.errorChan: // we are not ignoring the error\n\t\t\t\tlogger.Warningf(\"[channel: %s] Closed the errorChan\", chain.ChannelID())\n\t\t\t\t// This covers the edge case where (1) a consumption error has\n\t\t\t\t// closed the errorChan and thus rendered the chain unavailable to\n\t\t\t\t// deliver clients, (2) we're already at the newest offset, and (3)\n\t\t\t\t// there are no new Broadcast requests coming in. In this case,\n\t\t\t\t// there is no trigger that can recreate the errorChan again and\n\t\t\t\t// mark the chain as available, so we have to force that trigger via\n\t\t\t\t// the emission of a CONNECT message. TODO Consider rate limiting\n\t\t\t\tgo sendConnectMessage(chain.consenter.retryOptions(), chain.haltChan, chain.producer, chain.channel)\n\t\t\tdefault: // we are ignoring the error\n\t\t\t\tlogger.Warningf(\"[channel: %s] Deliver sessions will be dropped if consumption errors continue.\", chain.ChannelID())\n\t\t\t}\n\t\tcase <-topicPartitionSubscriptionResumed:\n\t\t\t// stop listening for subscription message\n\t\t\tsaramaLogger.RemoveListener(subscription, topicPartitionSubscriptionResumed)\n\t\t\t// disable subscription event chan\n\t\t\ttopicPartitionSubscriptionResumed = nil\n\n\t\t\t// stop timeout timer\n\t\t\tif !deliverSessionTimer.Stop() {\n\t\t\t\t<-deliverSessionTimer.C\n\t\t\t}\n\t\t\tlogger.Warningf(\"[channel: %s] Consumption will resume.\", chain.ChannelID())\n\n\t\tcase <-deliverSessionTimedOut:\n\t\t\t// stop listening for subscription message\n\t\t\tsaramaLogger.RemoveListener(subscription, topicPartitionSubscriptionResumed)\n\t\t\t// disable subscription event chan\n\t\t\ttopicPartitionSubscriptionResumed = nil\n\n\t\t\tclose(chain.errorChan)\n\t\t\tlogger.Warningf(\"[channel: %s] Closed the errorChan\", chain.ChannelID())\n\n\t\t\t// make chain available again via CONNECT message trigger\n\t\t\tgo sendConnectMessage(chain.consenter.retryOptions(), chain.haltChan, chain.producer, chain.channel)\n\n\t\tcase in, ok := <-chain.channelConsumer.Messages():\n\t\t\tif !ok {\n\t\t\t\tlogger.Criticalf(\"[channel: %s] Kafka consumer closed.\", chain.ChannelID())\n\t\t\t\treturn counts, nil\n\t\t\t}\n\n\t\t\t// catch the possibility that we missed a topic subscription event before\n\t\t\t// we registered the event listener\n\t\t\tif topicPartitionSubscriptionResumed != nil {\n\t\t\t\t// stop listening for subscription message\n\t\t\t\tsaramaLogger.RemoveListener(subscription, topicPartitionSubscriptionResumed)\n\t\t\t\t// disable subscription event chan\n\t\t\t\ttopicPartitionSubscriptionResumed = nil\n\t\t\t\t// stop timeout timer\n\t\t\t\tif !deliverSessionTimer.Stop() {\n\t\t\t\t\t<-deliverSessionTimer.C\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-chain.errorChan: // If this channel was closed...\n\t\t\t\tchain.errorChan = make(chan struct{}) // ...make a new one.\n\t\t\t\tlogger.Infof(\"[channel: %s] Marked consenter as available again\", chain.ChannelID())\n\t\t\tdefault:\n\t\t\t}\n\t\t\tif err := proto.Unmarshal(in.Value, msg); err != nil {\n\t\t\t\t// This shouldn't happen, it should be filtered at ingress\n\t\t\t\tlogger.Criticalf(\"[channel: %s] Unable to unmarshal consumed message = %s\", chain.ChannelID(), err)\n\t\t\t\tcounts[indexUnmarshalError]++\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tlogger.Debugf(\"[channel: %s] Successfully unmarshalled consumed message, offset is %d. Inspecting type...\", chain.ChannelID(), in.Offset)\n\t\t\t\tcounts[indexRecvPass]++\n\t\t\t}\n\t\t\tswitch msg.Type.(type) {\n\t\t\tcase *ab.KafkaMessage_Connect:\n\t\t\t\t_ = chain.processConnect(chain.ChannelID())\n\t\t\t\tcounts[indexProcessConnectPass]++\n\t\t\tcase *ab.KafkaMessage_TimeToCut:\n\t\t\t\tif err := chain.processTimeToCut(msg.GetTimeToCut(), in.Offset); err != nil {\n\t\t\t\t\tlogger.Warningf(\"[channel: %s] %s\", chain.ChannelID(), err)\n\t\t\t\t\tlogger.Criticalf(\"[channel: %s] Consenter for channel exiting\", chain.ChannelID())\n\t\t\t\t\tcounts[indexProcessTimeToCutError]++\n\t\t\t\t\treturn counts, err // TODO Revisit whether we should indeed stop processing the chain at this point\n\t\t\t\t}\n\t\t\t\tcounts[indexProcessTimeToCutPass]++\n\t\t\tcase *ab.KafkaMessage_Regular:\n\t\t\t\tif err := chain.processRegular(msg.GetRegular(), in.Offset); err != nil {\n\t\t\t\t\tlogger.Warningf(\"[channel: %s] Error when processing incoming message of type REGULAR = %s\", chain.ChannelID(), err)\n\t\t\t\t\tcounts[indexProcessRegularError]++\n\t\t\t\t} else {\n\t\t\t\t\tcounts[indexProcessRegularPass]++\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-chain.timer:\n\t\t\tif err := sendTimeToCut(chain.producer, chain.channel, chain.lastCutBlockNumber+1, &chain.timer); err != nil {\n\t\t\t\tlogger.Errorf(\"[channel: %s] cannot post time-to-cut message = %s\", chain.ChannelID(), err)\n\t\t\t\t// Do not return though\n\t\t\t\tcounts[indexSendTimeToCutError]++\n\t\t\t} else {\n\t\t\t\tcounts[indexSendTimeToCutPass]++\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e44eecd960bf72ab6b1e80ce05077db5", "score": "0.55025625", "text": "func (c PubsubConsumer) Consume(ctx context.Context, consume func(Event) error) error {\n\tsub := c.ps.Subscription(c.subscriptionID)\n\tsub.ReceiveSettings = c.receiveSettings\n\terr := sub.Receive(ctx, func(ctx context.Context, msg *pubsub.Message) {\n\t\tbyt := msg.Data\n\t\tvar event Event\n\t\terr := json.Unmarshal(byt, &event)\n\t\tif err != nil {\n\t\t\t// assume that the event is broken\n\t\t\tlog.Println(\"Received a broken event\", string(byt))\n\t\t\tmsg.Ack()\n\t\t\treturn\n\t\t}\n\n\t\terr = consume(event)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Errors are not handled as of now: \", err.Error())\n\t\t\tmsg.Nack()\n\t\t}\n\t\tmsg.Ack()\n\t})\n\treturn err\n}", "title": "" }, { "docid": "e28f25bfd59451a67fbdeec665d4c5ca", "score": "0.5499713", "text": "func (p *publishAsyncSession) publishLoop() error {\n\tfor {\n\t\treq, err := p.stream.Recv()\n\t\tif err != nil {\n\t\t\tif err == io.EOF || status.Code(err) == codes.Canceled {\n\t\t\t\tp.waitForInflight()\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\terr = p.ensureAuthorizationPermission(p.stream.Context(), req.Stream, \"Publish\")\n\t\tif err != nil {\n\t\t\tp.logger.Errorf(\"api: Failed to authorize call on resource: %v\", err)\n\t\t\tpermissionDeniedAsyncError := &client.PublishAsyncError{Code: client.PublishAsyncError_PERMISSION_DENIED, Message: err.Error()}\n\t\t\tp.sendPublishAsyncError(req.CorrelationId, permissionDeniedAsyncError)\n\t\t}\n\n\t\tif e := p.ensurePublishPreconditions(req); e != nil {\n\t\t\tp.logger.Errorf(\"api: Failed to publish async message: %v\", e.Message)\n\t\t\tp.sendPublishAsyncError(req.CorrelationId, e)\n\t\t\tcontinue\n\t\t}\n\n\t\treq.AckInbox = p.ackInbox\n\n\t\tp.logger.Debugf(\"api: PublishAsync [stream=%s, partition=%d]\", req.Stream, req.Partition)\n\n\t\tsubject, e := p.getPublishSubject(req)\n\t\tif e != nil {\n\t\t\tp.logger.Errorf(\"api: Failed to publish async message: %v\", e.Message)\n\t\t\tp.sendPublishAsyncError(req.CorrelationId, e)\n\t\t\tcontinue\n\t\t}\n\t\tif err := p.resumeStream(p.stream.Context(), req.Stream, req.Partition); err != nil {\n\t\t\terr = errors.Wrap(err, \"failed to resume stream\")\n\t\t\tp.logger.Errorf(\"api: Failed to publish async message: %v\", err)\n\t\t\tp.sendPublishAsyncError(req.CorrelationId, &client.PublishAsyncError{\n\t\t\t\tCode: client.PublishAsyncError_INTERNAL,\n\t\t\t\tMessage: err.Error(),\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tmsg, err := proto.MarshalPublish(&client.Message{\n\t\t\tKey: req.Key,\n\t\t\tValue: req.Value,\n\t\t\tStream: req.Stream,\n\t\t\tSubject: subject,\n\t\t\tHeaders: req.Headers,\n\t\t\tAckInbox: req.AckInbox,\n\t\t\tCorrelationId: req.CorrelationId,\n\t\t\tAckPolicy: req.AckPolicy,\n\t\t\tOffset: req.ExpectedOffset,\n\t\t})\n\t\tif err != nil {\n\t\t\terr = errors.Wrap(err, \"failed to marshal message\")\n\t\t\tp.logger.Errorf(\"api: Failed to publish async message: %v\", err)\n\t\t\tp.sendPublishAsyncError(req.CorrelationId, &client.PublishAsyncError{\n\t\t\t\tCode: client.PublishAsyncError_INTERNAL,\n\t\t\t\tMessage: err.Error(),\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif err := p.ncPublishes.Publish(subject, msg); err != nil {\n\t\t\terr = errors.Wrap(err, \"failed to publish to NATS\")\n\t\t\tp.logger.Errorf(\"api: Failed to publish async message: %v\", err)\n\t\t\tp.sendPublishAsyncError(req.CorrelationId, &client.PublishAsyncError{\n\t\t\t\tCode: client.PublishAsyncError_INTERNAL,\n\t\t\t\tMessage: err.Error(),\n\t\t\t})\n\t\t}\n\n\t\t// Increment in-flight count if we're expecting an ack.\n\t\tif req.AckPolicy != client.AckPolicy_NONE {\n\t\t\tp.mu.Lock()\n\t\t\tp.inflight++\n\t\t\tp.mu.Unlock()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "72f17ed8b03ceefefa8b5dea3fc9848b", "score": "0.54904175", "text": "func Consume() {\n\tqueue := connection.OpenQueue(activeQueueName)\n\tqueue.StartConsuming(unackedLimit, 500*time.Millisecond)\n\tfor i := 0; i < numConsumers; i++ {\n\t\tname := fmt.Sprintf(\"Consumer %d\", i)\n\t\tqueue.AddConsumer(name, NewConsumer(i))\n\t}\n\tselect {}\n}", "title": "" }, { "docid": "efd27b36b7473b1465b7ccb409e192f7", "score": "0.5470677", "text": "func Produce() {\n\tkafkaWriter := kafka.NewWriter(kafka.WriterConfig{\n\t\tBrokers: []string{brokerAddress},\n\t\tTopic: topic,\n\t\tLogger: log.New(os.Stdout, \"kafka writer: \", 0),\n\t})\n\n\tfor {\n\t\t// A list of all the currently supported crypto coins (should be moved to DB)\n\t\tcoins := strings.Split(\"BTC,ETC,BNB,XRP,DOT,USDT,DOGE,AXS,BUSD,ADA\", \",\")\n\t\t// A list of all the currently supported currencies (should be moved to DB)\n\t\tcurrencies := strings.Split(\"USD,EUR,GBP,JPY\", \",\")\n\n\t\t// Fetch the prices from cryptocompare\n\t\tresults := api.GetCoinPrices(coins, currencies)\n\t\tfor _, coin := range coins {\n\t\t\tfor _, currency := range currencies {\n\t\t\t\t// Get the exchange rate for a crypto coin\n\t\t\t\tprice := results[coin][currency]\n\t\t\t\tif price != 0 {\n\t\t\t\t\t// Find all the alerts that match this price\n\t\t\t\t\tfor _, alert := range getAlerts(coin, currency, price) {\n\t\t\t\t\t\t// Send an event to the Kafka topic\n\t\t\t\t\t\terr := kafkaWriter.WriteMessages(ctx, kafka.Message{\n\t\t\t\t\t\t\tValue: prepareAlertMessage(alert, price),\n\t\t\t\t\t\t})\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tfmt.Println(\"could not write message \" + err.Error())\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Disabled an alert after sending it to Kafka\n\t\t\t\t\t\t\tdisableAlert(alert)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Sleep for 15 seconds\n\t\ttime.Sleep(time.Second * 15)\n\t}\n}", "title": "" }, { "docid": "91c154bc8b85df361fa37528a9d4eabe", "score": "0.54610246", "text": "func Produce(conn net.Conn) {\n\tfor {\n\t\tvar buf bytes.Buffer\n\n\t\t_, err := io.Copy(&buf, conn)\n\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"unable to read all %s\\n\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\ttrimmedBytes := bytes.Trim(buf.Bytes(), string(constant.MsgEndIdent))\n\n\t\tmsgJSONBytes := bytes.Split(trimmedBytes, []byte{constant.MsgEndIdent})\n\n\t\tfor _, msgBytes := range msgJSONBytes {\n\t\t\tif len(msgBytes) <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar m client.Message\n\t\t\terr = json.Unmarshal(msgBytes, &m)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"unable to unmarshal %s %s\\n\", msgBytes, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfile, err := CreateLogFile(m.Topic)\n\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tif _, err := file.Write(append(msgBytes, byte(constant.MsgEndIdent))); err != nil {\n\t\t\t\tlog.Printf(\"unable to write event %s\", err)\n\t\t\t\tif err := file.Close(); err != nil {\n\t\t\t\t\tlog.Fatalf(\"unable to close the file\")\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "61cf995f1c6dbbc3135e394b5dc05a69", "score": "0.5452325", "text": "func (d *Driver) consume(msg *message) {\n\td.rotate(\n\t\tmsg.now.Format(suffixformat),\n\t)\n\tfmt.Fprint(d.writer, msg.decorate())\n\td.swg.Done()\n}", "title": "" }, { "docid": "b62e80467e8fb89c5085d4ebead91862", "score": "0.54432285", "text": "func (c *Consumer) Consume(cid string, node cluster.Node) error {\n\n\tcli := client.NewClient(node.Address)\n\n\tvar t *Task\n\t// wait until log comes\n\tfor {\n\t\tif t = Default().GetTask(cid); t != nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(time.Millisecond)\n\t}\n\t// consume logs\n\tfor {\n\t\tselect {\n\t\tcase log := <-t.LogC:\n\t\t\tif len(log.GetLogQueue()) > 0 {\n\t\t\t\tfor _, kv := range log.GetLogQueue() {\n\t\t\t\t\terr := redis.Set(cid, kv.Key, kv.Val)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogrus.Errorf(\"redis.set err: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlogrus.Infof(\"consumed a log, send msg to src\")\n\t\t\terr := cli.ConsumedAdder(cid)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Errorf(\"cli.consumed failed, err: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// stop this goroutine if it is the last task\n\t\t\tif log.GetLastFlag() {\n\t\t\t\tlogrus.Warn(\"the last log consumed\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\tdefault:\n\t\t\ttime.Sleep(1 * time.Millisecond)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aa333fc949f38386c8cf6aa5e3c8d5df", "score": "0.54409647", "text": "func (p *TopicProducer) process(data []byte) bool {\n sig := make(chan bool)\n defer close(sig)\n go func () {\n for e:= range p.producer.Events() {\n switch ev := e.(type) {\n case *kafka.Message:\n m := ev\n if m.TopicPartition.Error != nil {\n log.Printf(\"Delivery failed: %v\", m.TopicPartition.Error)\n sig <- false\n } else {\n log.Printf(\"Produced message %v\", string(m.Value))\n sig <- true\n }\n return\n }\n }\n }()\n\n p.producer.ProduceChannel() <-&kafka.Message{\n TopicPartition: kafka.TopicPartition{ Topic: &p.Topic, Partition: kafka.PartitionAny },\n Value: data,\n Headers: []kafka.Header{},\n }\n return <-sig\n}", "title": "" }, { "docid": "31388d9b8cb2bd71a528428243de63b2", "score": "0.5439435", "text": "func (prod *S3) Produce(workers *sync.WaitGroup) {\n\tprod.AddMainWorker(workers)\n\tsess, err := session.NewSessionWithOptions(session.Options{\n\t\tConfig: *prod.config,\n\t\tSharedConfigState: session.SharedConfigEnable,\n\t})\n\tif err != nil {\n\t\tprod.Logger.WithError(err).Error(\"Failed to create session\")\n\t}\n\n\tif prod.assumeRole != \"\" {\n\t\tcreds := stscreds.NewCredentials(sess, prod.assumeRole)\n\t\tprod.client = s3.New(sess, &aws.Config{Credentials: creds})\n\t} else {\n\t\tprod.client = s3.New(sess)\n\t}\n\n\tprod.TickerMessageControlLoop(prod.bufferMessage, prod.flushFrequency, prod.sendBatchOnTimeOut)\n}", "title": "" }, { "docid": "5056aa84af2bbb02a4814005f05bd4d5", "score": "0.5415291", "text": "func (consumer *Consumer) Consume(messageConsumer MessageConsumer, isReady chan bool) {\n\n\tgo func() {\n\t\tdefer close(consumer.closed)\n\n\t\tlog.Info(\"waiting for authentication before consuming messages\", nil)\n\t\tif <-isReady {\n\t\t\tlog.Info(\"starting to consume messages\", nil)\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase message := <-messageConsumer.Incoming():\n\n\t\t\t\t\tprocessMessage(message)\n\n\t\t\t\tcase <-consumer.closing:\n\t\t\t\t\tlog.Info(\"closing event consumer loop\", nil)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n}", "title": "" }, { "docid": "99332e5b0bab56abe51af7f05550400f", "score": "0.5412369", "text": "func (kp *Producer) Produce(event []byte, topic string) {\n\tkp.producer.ProduceChannel() <- &kafka.Message{\n\t\tTopicPartition: kafka.TopicPartition{Topic: &topic, Partition: kafka.PartitionAny},\n\t\tValue: event,\n\t}\n}", "title": "" }, { "docid": "c80932d5a2bc18ae498f8621853f98a4", "score": "0.535474", "text": "func (t *LocalTransport) Consume() <-chan RPC {\n\treturn t.consumeCh\n}", "title": "" }, { "docid": "eb517574069d1fcc0623dfa8b3cf7860", "score": "0.53536844", "text": "func (t *Transport) StartReceiver(ctx context.Context) error {\n\tlogger := cecontext.LoggerFrom(ctx)\n\n\t// Load the codec.\n\tif ok := t.loadCodec(ctx); !ok {\n\t\treturn fmt.Errorf(\"unknown encoding set on transport: %d\", t.Encoding)\n\t}\n\n\terr := t.consumer.SubscribeTopics([]string{t.topic}, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trun := true\n\n\tfor run == true {\n\t\tselect {\n\t\tcase sig := <-ctx.Done():\n\t\t\tfmt.Printf(\"Caught signal %v: terminating\\n\", sig)\n\t\t\terr := t.consumer.Close()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\trun = false\n\t\tdefault:\n\t\t\tm, err := t.consumer.ReadMessage(30 * time.Second)\n\t\t\tif err != nil {\n\t\t\t\t// The client will automatically try to recover from all errors.\n\t\t\t\tlogger.Warnw(\"Consumer error\", zap.Error(err))\n\t\t\t\t//return err\n\t\t\t}\n\t\t\tfmt.Printf(\"consumed from topic %s [%d] at offset %v: \"+\n\t\t\t\tstring(m.Value), *m.TopicPartition.Topic,\n\t\t\t\tm.TopicPartition.Partition, m.TopicPartition.Offset)\n\n\t\t\tmsg := &Message{\n\t\t\t\tHeaders: t.fromKafkaHeaders(m.Headers),\n\t\t\t\tData: m.Value,\n\t\t\t}\n\n\t\t\tevent, err := t.codec.Decode(ctx, msg)\n\t\t\t// If codec returns and error, try with the converter if it is set.\n\t\t\tif err != nil && t.HasConverter() {\n\t\t\t\tevent, err = t.Converter.Convert(ctx, msg, err)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorw(\"failed to decode message\", zap.Error(err))\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = t.Receiver.Receive(ctx, *event, nil)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Warnw(\"kafka receiver return err\", zap.Error(err))\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6922e96b72287392570715bae8aef659", "score": "0.53344846", "text": "func (cl *RabbitMqClient) Consume(queueName string, workers uint, callback func(msg []byte, consumer string)) error {\n\tfmt.Println(\"begin of Consume\")\n\tif workers < 1 {\n\t\terr := fmt.Errorf(errWorkersRegisteredForQueue, queueName)\n\t\tlog.Println(err, nil)\n\t\treturn err\n\t}\n\tfmt.Println(\"Consume call newConsumer \")\n\tfor i := 1; i <= int(workers); i++ {\n\t\tcl.newConsumer(queueName, callback, i)\n\t}\n\t/*TODO 这里也会执行啊,consume会退出*/\n\tfmt.Println(\"------------end of Consume----------\")\n\treturn nil\n}", "title": "" }, { "docid": "f7f392877ac3b7114ca3a146c797e63e", "score": "0.5326189", "text": "func TestConsumeAndProduceWithTxn(t *testing.T) {\n\t// Step 1: Prepare - Create PulsarClient and initialize the transaction coordinator client.\n\ttopic := newTopicName()\n\tsub := \"my-sub\"\n\t_, client := createTcClient(t)\n\t// Step 2: Prepare - Create Topic and Subscription.\n\tconsumer, err := client.Subscribe(ConsumerOptions{\n\t\tTopic: topic,\n\t\tSubscriptionName: sub,\n\t})\n\tassert.NoError(t, err)\n\tproducer, _ := client.CreateProducer(ProducerOptions{\n\t\tTopic: topic,\n\t\tSendTimeout: 0,\n\t})\n\t// Step 3: Open a transaction, send 10 messages with the transaction and 10 messages without the transaction.\n\t// Expectation: We can receive the 10 messages sent without a transaction and\n\t// cannot receive the 10 messages sent with the transaction.\n\ttxn, err := client.NewTransaction(time.Hour)\n\trequire.Nil(t, err)\n\tfor i := 0; i < 10; i++ {\n\t\t_, err = producer.Send(context.Background(), &ProducerMessage{\n\t\t\tPayload: make([]byte, 1024),\n\t\t})\n\t\trequire.Nil(t, err)\n\t}\n\tfor i := 0; i < 10; i++ {\n\t\t_, err := producer.Send(context.Background(), &ProducerMessage{\n\t\t\tTransaction: txn,\n\t\t\tPayload: make([]byte, 1024),\n\t\t})\n\t\trequire.Nil(t, err)\n\t}\n\t// Attempt to receive and acknowledge the 10 messages sent without a transaction.\n\tfor i := 0; i < 10; i++ {\n\t\tmsg, _ := consumer.Receive(context.Background())\n\t\tassert.NotNil(t, msg)\n\t\terr = consumer.Ack(msg)\n\t\tassert.Nil(t, err)\n\t}\n\t// Create a goroutine to attempt receiving a message and send it to the 'done1' channel.\n\tdone1 := make(chan Message)\n\tgo func() {\n\t\tmsg, _ := consumer.Receive(context.Background())\n\t\terr := consumer.AckID(msg.ID())\n\t\trequire.Nil(t, err)\n\t\tclose(done1)\n\t}()\n\t// Expectation: The consumer should not receive uncommitted messages.\n\tselect {\n\tcase <-done1:\n\t\trequire.Fail(t, \"The consumer should not receive uncommitted message\")\n\tcase <-time.After(time.Second):\n\t}\n\t// Step 4: After committing the transaction, we should be able to receive the remaining 10 messages.\n\t// Acknowledge the rest of the 10 messages with the transaction.\n\t// Expectation: After committing the transaction, all messages of the subscription will be acknowledged.\n\t_ = txn.Commit(context.Background())\n\ttxn, err = client.NewTransaction(time.Hour)\n\trequire.Nil(t, err)\n\tfor i := 0; i < 9; i++ {\n\t\tmsg, _ := consumer.Receive(context.Background())\n\t\trequire.NotNil(t, msg)\n\t\terr = consumer.AckWithTxn(msg, txn)\n\t\trequire.Nil(t, err)\n\t}\n\t_ = txn.Commit(context.Background())\n\t<-done1\n\tconsumer.Close()\n\tconsumer, _ = client.Subscribe(ConsumerOptions{\n\t\tTopic: topic,\n\t\tSubscriptionName: sub,\n\t})\n\t// Create a goroutine to attempt receiving a message and send it to the 'done1' channel.\n\tdone2 := make(chan Message)\n\tgo func() {\n\t\tconsumer.Receive(context.Background())\n\t\tclose(done2)\n\t}()\n\n\t// Expectation: The consumer should not receive uncommitted messages.\n\tselect {\n\tcase <-done2:\n\t\trequire.Fail(t, \"The consumer should not receive messages\")\n\tcase <-time.After(time.Second):\n\t}\n\n\t// Step 5: Clean up - Close the consumer and producer instances.\n\tconsumer.Close()\n\tproducer.Close()\n}", "title": "" }, { "docid": "ebbebb6098b63d3a0a6df5088da91127", "score": "0.5295851", "text": "func (prod *BufferedProducer) Enqueue(msg *Message, timeout *time.Duration) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tprod.Log.Error.Print(\"Recovered a panic during producer enqueue: \", r)\n\t\t\tprod.Log.Error.Print(\"Producer: \", prod.id, \"State: \", prod.GetState(), \", Router: \", StreamRegistry.GetStreamName(msg.StreamID()))\n\t\t\tprod.Drop(msg)\n\t\t}\n\t}()\n\n\t// Run modulators and drop message if necessary\n\tresult := prod.Modulate(msg)\n\tswitch result {\n\tcase ModulateResultDrop:\n\t\tRoute(msg, msg.GetRouter())\n\t\treturn\n\n\tcase ModulateResultDiscard:\n\t\tCountDiscardedMessage()\n\t\treturn\n\n\tcase ModulateResultContinue:\n\t\t// all fine - continue\n\tdefault:\n\t\tprod.Log.Error.Print(\"Modulator result not supported:\", result)\n\t}\n\n\t// Don't accept messages if we are shutting down\n\tif prod.GetState() >= PluginStateStopping {\n\t\tprod.Drop(msg)\n\t\treturn // ### return, closing down ###\n\t}\n\n\t// Allow timeout overwrite\n\tusedTimeout := prod.channelTimeout\n\tif timeout != nil {\n\t\tusedTimeout = *timeout\n\t}\n\n\tswitch prod.messages.Push(msg, usedTimeout) {\n\tcase MessageStateTimeout:\n\t\tprod.Drop(msg)\n\t\tprod.setState(PluginStateWaiting)\n\n\tcase MessageStateDiscard:\n\t\tCountDiscardedMessage()\n\t\tprod.setState(PluginStateWaiting)\n\n\tdefault:\n\t\tprod.setState(PluginStateActive)\n\t}\n}", "title": "" }, { "docid": "1f66eaa0ad3604f3c540465b11119729", "score": "0.52957594", "text": "func TestConsumingAfterPublish(t *testing.T) {\n\tdefer leaktest.Check(t)() // Fail on leaked goroutines.\n\n\ttimeoutAfter := time.After(time.Minute * 1)\n\tconsumer := tcr.NewConsumerFromConfig(ConsumerConfig, ConnectionPool)\n\tassert.NotNil(t, consumer)\n\n\tconsumer.StartConsuming()\n\n\tpublisher := tcr.NewPublisherFromConfig(Seasoning, ConnectionPool)\n\tletter := tcr.CreateMockRandomLetter(\"TcrTestQueue\")\n\tcount := 1000 // higher will deadlock publisher since publisher receipts processing wont' be hit yet\n\n\tfor i := 0; i < count; i++ {\n\t\tpublisher.Publish(letter, false)\n\t}\n\n\tpublishSuccessCount := 0\nWaitForReceiptsLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-timeoutAfter:\n\t\t\tt.Fatal(\"test timeout\")\n\t\tcase receipt := <-publisher.PublishReceipts():\n\t\t\tif receipt.Success {\n\t\t\t\tpublishSuccessCount++\n\t\t\t\tif publishSuccessCount == count {\n\t\t\t\t\tbreak WaitForReceiptsLoop\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond * 1)\n\t\t}\n\t}\n\n\tassert.Equal(t, count, publishSuccessCount, \"Publish Success Count: %d Expected Count: %d\", publishSuccessCount, count)\n\n\treceivedMessageCount := 0\nWaitForConsumer:\n\tfor {\n\t\tselect {\n\t\tcase <-timeoutAfter:\n\t\t\tt.Fatal(\"test timeout\")\n\t\tcase message := <-consumer.ReceivedMessages():\n\t\t\t_ = message.Acknowledge()\n\t\t\treceivedMessageCount++\n\t\t\tif receivedMessageCount == count {\n\t\t\t\tbreak WaitForConsumer\n\t\t\t}\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond * 1)\n\t\t}\n\t}\n\tassert.Equal(t, count, receivedMessageCount, \"Received Message Count: %d Expected Count: %d\", receivedMessageCount, count)\n\n\terr := consumer.StopConsuming(false, false)\n\tassert.NoError(t, err)\n\n\tTestCleanup(t)\n}", "title": "" }, { "docid": "260e87ab27f91381fe54b5f407819bd7", "score": "0.5292129", "text": "func (c *Consumer) Consume() (<-chan *Delivery, error) {\n\tc.m.Lock()\n\tdefer c.m.Unlock()\n\n\tif c.closed {\n\t\tpanic(\"can't consume on closed consumer\")\n\t}\n\n\tif c.msgs != nil {\n\t\treturn c.msgs, nil\n\t}\n\n\tc.msgs = make(chan *Delivery, c.config.PrefetchCount)\n\tc.stop = make(chan struct{})\n\tc.canceled = false\n\n\tc.run()\n\n\treturn c.msgs, nil\n}", "title": "" }, { "docid": "c2e7b26a8abf4e66e9f7ee5f8bcfadf4", "score": "0.5291848", "text": "func (svc *Service) Start(wg *sync.WaitGroup, c chan os.Signal) {\n\tlog.Info(\"service starting, consuming from the \" + svc.Topic + \" topic\")\n\n\tvar err error\n\tvar message *sarama.ConsumerMessage\n\n\t// We want to stop the processing of the service if consuming from an\n\t// error queue if all messages that were initially in the queue have\n\t// been cleared using the stopAtOffset\n\trunning := true\n\tfor running && (svc.StopAtOffset == -1 || message == nil || message.Offset < svc.StopAtOffset) {\n\n\t\tif message != nil {\n\t\t\t// Commit the message we've just been processing before starting the next\n\t\t\tlog.Trace(\"Committing message\", log.Data{keys.Offset: message.Offset})\n\t\t\tsvc.Consumer.MarkOffset(message, \"\")\n\t\t\tif err := svc.Consumer.CommitOffsets(); err != nil {\n\t\t\t\tlog.Error(err, log.Data{keys.Offset: message.Offset})\n\t\t\t}\n\t\t}\n\n\t\tif svc.Retry != nil && svc.Retry.ThrottleRate > 0 {\n\t\t\ttime.Sleep(svc.Retry.ThrottleRate * time.Second)\n\t\t}\n\n\t\tselect {\n\t\tcase <-c:\n\t\t\trunning = false\n\n\t\tcase message = <-svc.Consumer.Messages():\n\t\t\t// Falls into this block when a message becomes available from consumer\n\n\t\t\tif message != nil {\n\t\t\t\tif message.Offset >= svc.InitialOffset {\n\t\t\t\t\tlog.Info(\"Received message from Payment Service. Attempting reconciliation...\")\n\n\t\t\t\t\t// GetPayment the payment session first\n\t\t\t\t\tvar pp data.PaymentProcessed\n\t\t\t\t\tpaymentProcessedSchema := &avro.Schema{\n\t\t\t\t\t\tDefinition: svc.PpSchema,\n\t\t\t\t\t}\n\n\t\t\t\t\terr = paymentProcessedSchema.Unmarshal(message.Value, &pp)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Error(err, log.Data{keys.Offset: message.Offset})\n\t\t\t\t\t\tretryErr := svc.HandleError(err, message.Offset, &pp)\n\t\t\t\t\t\tif retryErr != nil {\n\t\t\t\t\t\t\tlog.Error(retryErr, log.Data{keys.Offset: message.Offset, keys.Topic: message.Topic})\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t//Create GetPayment payment session URL\n\t\t\t\t\tgetPaymentURL := svc.PaymentsAPIURL + \"/payments/\" + pp.ResourceURI\n\t\t\t\t\tlog.Info(\"Payment URL : \" + getPaymentURL)\n\n\t\t\t\t\t//Call GetPayment payment session from payments API\n\t\t\t\t\tpaymentResponse, statusCode, err := svc.Payments.GetPayment(getPaymentURL, svc.Client, svc.APIKey)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Error(err, log.Data{keys.Offset: message.Offset, keys.Topic: message.Topic})\n\t\t\t\t\t\tskipGoneResource := svc.skipGoneResource(err, pp.ResourceURI, message)\n\t\t\t\t\t\tif skipGoneResource {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tretryErr := svc.HandleError(err, message.Offset, &pp)\n\t\t\t\t\t\tif retryErr != nil {\n\t\t\t\t\t\t\tlog.Error(retryErr, log.Data{keys.Offset: message.Offset, keys.Topic: message.Topic})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlog.Info(\"Payment Response : \",\n\t\t\t\t\t\tlog.Data{keys.PaymentResponse: paymentResponse, keys.StatusCode: statusCode})\n\n\t\t\t\t\tif err == nil && paymentResponse.IsReconcilable(svc.ProductMap) {\n\n\t\t\t\t\t\t//Create GetPayment payment URL\n\t\t\t\t\t\tgetPaymentDetailsURL := svc.PaymentsAPIURL + \"/private/payments/\" + pp.ResourceURI + \"/payment-details\"\n\t\t\t\t\t\tlog.Info(\"Payment Details URL : \" + getPaymentDetailsURL)\n\n\t\t\t\t\t\t//Call GetPayment payment details from payments API\n\t\t\t\t\t\tpaymentDetails, statusCode, err := svc.Payments.GetPaymentDetails(getPaymentDetailsURL, svc.Client, svc.APIKey)\n\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Error(err, log.Data{keys.Offset: message.Offset})\n\t\t\t\t\t\t\tretryErr := svc.HandleError(err, message.Offset, &pp)\n\t\t\t\t\t\t\tif retryErr != nil {\n\t\t\t\t\t\t\t\tlog.Error(retryErr, log.Data{keys.Offset: message.Offset, keys.Topic: message.Topic})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlog.Info(\"Payment Details Response : \",\n\t\t\t\t\t\t\tlog.Data{keys.PaymentDetails: paymentDetails, keys.StatusCode: statusCode})\n\n\t\t\t\t\t\tif isRefundTransaction(pp) {\n\t\t\t\t\t\t\tlog.Info(\"Handling refund transaction\")\n\t\t\t\t\t\t\tsvc.handleRefundTransaction(paymentResponse, getPaymentURL, message, pp)\n\t\t\t\t\t\t} else if paymentDetails.PaymentStatus == \"accepted\" {\n\n\t\t\t\t\t\t\t// We need to remove sensitive data fields for secure applications.\n\t\t\t\t\t\t\tsvc.MaskSensitiveFields(&paymentResponse)\n\n\t\t\t\t\t\t\t// Get Eshu resources\n\t\t\t\t\t\t\teshus := svc.getEshuResources(message, paymentResponse, paymentDetails, pp)\n\n\t\t\t\t\t\t\t//Add Eshu objects to the Database\n\t\t\t\t\t\t\tsvc.saveEshuResources(message, eshus, pp)\n\n\t\t\t\t\t\t\t//Build Payment Transaction database objects\n\t\t\t\t\t\t\ttxns := svc.getTransactionResources(message, paymentResponse, paymentDetails, pp)\n\n\t\t\t\t\t\t\t//Add Payment Transactions to the Database\n\t\t\t\t\t\t\tsvc.saveTransactionResources(message, txns, pp)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase err = <-svc.Consumer.Errors():\n\t\t\tlog.Error(err, log.Data{keys.Topic: svc.Topic})\n\t\t}\n\t}\n\n\t// We only get here if we're an error consumer and we've reached out stop offset\n\t// We will not consume any further messages, so disconnect consumer.\n\tsvc.Shutdown(svc.Topic)\n\n\t// The app must not exit until explicitly asked to. If it did, when in\n\t// a managed environment such as Mesos/Marathon, the app will get\n\t// restarted and will go on to consume further messages in the error\n\t// topic and chasing it's own tail, if something is really broken.\n\tif running {\n\t\tselect {\n\t\tcase <-c: // Just wait for a shutdown event\n\t\t\tlog.Info(\"Received close notification\")\n\t\t}\n\t}\n\n\twg.Done()\n\n\tlog.Info(\"Service successfully shutdown\", log.Data{keys.Topic: svc.Topic})\n}", "title": "" }, { "docid": "295fff1feb877588e23ee6efbee6260e", "score": "0.52883303", "text": "func (k *Kafka) receiver(ctx context.Context, ac telegraf.Accumulator) {\n\tk.messages = make(map[telegraf.TrackingID]*sarama.ConsumerMessage)\n\n\tacc := ac.WithTracking(k.MaxUndeliveredMessages)\n\tsem := make(semaphore, k.MaxUndeliveredMessages)\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase track := <-acc.Delivered():\n\t\t\t<-sem\n\t\t\tk.onDelivery(track)\n\t\tcase err := <-k.cluster.Errors():\n\t\t\tacc.AddError(err)\n\t\tcase sem <- empty{}:\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase track := <-acc.Delivered():\n\t\t\t\t// Once for the delivered message, once to leave the case\n\t\t\t\t<-sem\n\t\t\t\t<-sem\n\t\t\t\tk.onDelivery(track)\n\t\t\tcase err := <-k.cluster.Errors():\n\t\t\t\t<-sem\n\t\t\t\tacc.AddError(err)\n\t\t\tcase msg := <-k.cluster.Messages():\n\t\t\t\terr := k.onMessage(acc, msg)\n\t\t\t\tif err != nil {\n\t\t\t\t\tacc.AddError(err)\n\t\t\t\t\t<-sem\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "abdc28c55e2bfb28d58f5a5802d4542d", "score": "0.52772444", "text": "func (q *queue) consume(s *sqs.SQS) ([]*sqs.Message, bool, error) {\n\tq.muw.Lock()\n\tdefer q.muw.Unlock()\n\n\tselect {\n\tcase <-q.wait:\n\t\treturn nil, true, nil\n\tdefault:\n\t\tr, err := s.ReceiveMessage(&sqs.ReceiveMessageInput{\n\t\t\tQueueUrl: q.url,\n\t\t\tMaxNumberOfMessages: aws.Int64(int64(q.pipe.Integer(\"prefetch\", 1))),\n\t\t\tWaitTimeSeconds: aws.Int64(int64(q.reserve.Seconds())),\n\t\t\tVisibilityTimeout: aws.Int64(int64(q.lockReserved.Seconds())),\n\t\t\tAttributeNames: []*string{aws.String(\"ApproximateReceiveCount\")},\n\t\t\tMessageAttributeNames: jobAttributes,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\n\t\tq.wg.Add(len(r.Messages))\n\n\t\treturn r.Messages, false, nil\n\t}\n}", "title": "" }, { "docid": "fba63acdfe79b15860f4238eb0c1c6a3", "score": "0.52764714", "text": "func (k *Kafka) Subscribe(req pubsub.SubscribeRequest, handler pubsub.Handler) error {\n\tif k.consumerGroup == \"\" {\n\t\treturn errors.New(\"kafka: consumerGroup must be set to subscribe\")\n\t}\n\n\ttopics := k.addTopic(req.Topic)\n\n\t// Close resources and reset synchronization primitives\n\tk.closeSubscriptionResources()\n\n\tcg, err := sarama.NewConsumerGroup(k.brokers, k.consumerGroup, k.config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tk.cg = cg\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tk.cancel = cancel\n\n\tready := make(chan bool)\n\tk.consumer = consumer{\n\t\tk: k,\n\t\tready: ready,\n\t\tcallback: handler,\n\t}\n\n\tgo func() {\n\t\tdefer func() {\n\t\t\tk.logger.Debugf(\"Closing ConsumerGroup for topics: %v\", topics)\n\t\t\terr := k.cg.Close()\n\t\t\tif err != nil {\n\t\t\t\tk.logger.Errorf(\"Error closing consumer group: %v\", err)\n\t\t\t}\n\t\t}()\n\n\t\tk.logger.Debugf(\"Subscribed and listening to topics: %s\", topics)\n\n\t\tfor {\n\t\t\tk.logger.Debugf(\"Starting loop to consume.\")\n\n\t\t\t// Consume the requested topics\n\t\t\tbo := backoff.WithContext(backoff.NewConstantBackOff(k.consumeRetryInterval), ctx)\n\t\t\tinnerErr := retry.NotifyRecover(func() error {\n\t\t\t\treturn k.cg.Consume(ctx, topics, &(k.consumer))\n\t\t\t}, bo, func(err error, t time.Duration) {\n\t\t\t\tk.logger.Errorf(\"Error consuming %v. Retrying...: %v\", topics, err)\n\t\t\t}, func() {\n\t\t\t\tk.logger.Infof(\"Recovered consuming %v\", topics)\n\t\t\t})\n\t\t\tif innerErr != nil && !errors.Is(innerErr, context.Canceled) {\n\t\t\t\tk.logger.Errorf(\"Permanent error consuming %v: %v\", topics, innerErr)\n\t\t\t}\n\n\t\t\t// If the context was cancelled, as is the case when handling SIGINT and SIGTERM below, then this pops\n\t\t\t// us out of the consume loop\n\t\t\tif ctx.Err() != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t<-ready\n\n\treturn nil\n}", "title": "" }, { "docid": "da8a43da175878eafbb2c89a3098b73b", "score": "0.5269644", "text": "func (p *TopicProducer) Process(data []byte) {\n //TODO: This is a blocking way to wrap a non-blocking producer\n // When FIFO is not required, a pential speed up here\n if !p.Order {\n p.produce(data)\n return\n }\n\n for {\n var success bool\n if p.toChannel {\n success = p.process(data)\n } else {\n success = p.processAlt(data)\n }\n if success {\n return\n } else {\n log.Println(\"Failed to write message to kafka, will retry again\")\n time.Sleep(time.Second)\n }\n }\n}", "title": "" }, { "docid": "43b8f439dc9f4a661c8ae86b5bc4d49f", "score": "0.5266388", "text": "func (p *TopicProducer) processAlt(data []byte) bool {\n delivery := make(chan kafka.Event)\n defer close(delivery)\n err := p.producer.Produce(&kafka.Message{\n TopicPartition: kafka.TopicPartition{ Topic: &p.Topic, Partition: kafka.PartitionAny },\n Value: data,\n Headers: []kafka.Header{},\n }, delivery)\n if err != nil {\n log.Println(err)\n log.Printf(\"Can not enque message: %v, %v\", string(data), err)\n return false\n }\n e := <-delivery\n m := e.(*kafka.Message)\n if m.TopicPartition.Error != nil {\n log.Printf(\"Delivery failed: %v\", m.TopicPartition.Error)\n return false\n }\n log.Printf(\"Produced message %v\", string(m.Value))\n return true\n}", "title": "" }, { "docid": "0b9dc8521163034369f71b33458cddb9", "score": "0.52577394", "text": "func (k *Kafka) Subscribe(ctx context.Context) error {\n\tif k.consumerGroup == \"\" {\n\t\treturn errors.New(\"kafka: consumerGroup must be set to subscribe\")\n\t}\n\n\tk.subscribeLock.Lock()\n\tdefer k.subscribeLock.Unlock()\n\n\t// Close resources and reset synchronization primitives\n\tk.closeSubscriptionResources()\n\n\ttopics := k.subscribeTopics.TopicList()\n\tif len(topics) == 0 {\n\t\t// Nothing to subscribe to\n\t\treturn nil\n\t}\n\n\tcg, err := sarama.NewConsumerGroup(k.brokers, k.consumerGroup, k.config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tk.cg = cg\n\n\tready := make(chan bool)\n\tk.consumer = consumer{\n\t\tk: k,\n\t\tready: ready,\n\t\trunning: make(chan struct{}),\n\t}\n\n\tgo func() {\n\t\tk.logger.Debugf(\"Subscribed and listening to topics: %s\", topics)\n\n\t\tfor {\n\t\t\t// If the context was cancelled, as is the case when handling SIGINT and SIGTERM below, then this pops\n\t\t\t// us out of the consume loop\n\t\t\tif ctx.Err() != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tk.logger.Debugf(\"Starting loop to consume.\")\n\n\t\t\t// Consume the requested topics\n\t\t\tbo := backoff.WithContext(backoff.NewConstantBackOff(k.consumeRetryInterval), ctx)\n\t\t\tinnerErr := retry.NotifyRecover(func() error {\n\t\t\t\tif ctxErr := ctx.Err(); ctxErr != nil {\n\t\t\t\t\treturn backoff.Permanent(ctxErr)\n\t\t\t\t}\n\t\t\t\treturn k.cg.Consume(ctx, topics, &(k.consumer))\n\t\t\t}, bo, func(err error, t time.Duration) {\n\t\t\t\tk.logger.Errorf(\"Error consuming %v. Retrying...: %v\", topics, err)\n\t\t\t}, func() {\n\t\t\t\tk.logger.Infof(\"Recovered consuming %v\", topics)\n\t\t\t})\n\t\t\tif innerErr != nil && !errors.Is(innerErr, context.Canceled) {\n\t\t\t\tk.logger.Errorf(\"Permanent error consuming %v: %v\", topics, innerErr)\n\t\t\t}\n\t\t}\n\n\t\tk.logger.Debugf(\"Closing ConsumerGroup for topics: %v\", topics)\n\t\terr := k.cg.Close()\n\t\tif err != nil {\n\t\t\tk.logger.Errorf(\"Error closing consumer group: %v\", err)\n\t\t}\n\n\t\t// Ensure running channel is only closed once.\n\t\tif k.consumer.stopped.CompareAndSwap(false, true) {\n\t\t\tclose(k.consumer.running)\n\t\t}\n\t}()\n\n\t<-ready\n\n\treturn nil\n}", "title": "" }, { "docid": "0804818db190d1436e1653c06563721d", "score": "0.5254426", "text": "func (kp *KafkaProducer) startKafkaProducer(newMsgChan <-chan PublishMsg,\n\terrChan chan<- *kafka.Message, termChan <-chan struct{}) {\n\n\tfor {\n\t\tselect {\n\t\tcase <-termChan:\n\t\t\tkp.destroyProducer()\n\t\t\treturn\n\t\tcase input, ok := <-newMsgChan:\n\t\t\tif !ok {\n\t\t\t\tlog.Printf(\"%s: Input message channel has been closed\",\n\t\t\t\t\twu.FuncName())\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tmessage := kafka.Message{\n\t\t\t\tTopicPartition: kafka.TopicPartition{\n\t\t\t\t\tTopic: &input.Topic,\n\t\t\t\t\tPartition: kafka.PartitionAny,\n\t\t\t\t},\n\t\t\t\tKey: []byte(input.Key),\n\t\t\t\tValue: []byte(input.Payload),\n\t\t\t}\n\n\t\t\tkp.kprod.ProduceChannel() <- &message\n\t\tcase e := <-kp.kprod.Events():\n\t\t\tswitch ev := e.(type) {\n\t\t\tcase *kafka.Message:\n\t\t\t\tm := ev\n\t\t\t\tif m.TopicPartition.Error != nil {\n\t\t\t\t\tlog.Printf(\"%s: Delivery failed: %v\\n\", wu.FuncName(),\n\t\t\t\t\t\tm.TopicPartition.Error)\n\t\t\t\t\terrChan <- m\n\t\t\t\t\t//} else {\n\t\t\t\t\t//\tlog.Printf(\"%s: Delivered message to topic %s\\n\",\n\t\t\t\t\t//\t\twu.FuncName(), *m.TopicPartition.Topic)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "759789249b1927a886e86225618ab338", "score": "0.52517736", "text": "func (c *Consumer) Consume() {\n\tmsgs, err := c.channel.Consume(\n\t\tc.queue.Name, // queue\n\t\t\"\", // consumer\n\t\tfalse, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\tutils.FailOnError(err, \"Failed to register a consumer\")\n\n\tforever := make(chan bool)\n\n\tgo func() {\n\t\tfor d := range msgs {\n\t\t\tc.process(d)\n\t\t}\n\t}()\n\n\tc.logger.Printf(\"Worker: %s waiting for messages. To exit press CTRL+C\", c.queue.Name)\n\t<-forever\n}", "title": "" }, { "docid": "9cbe134aa99ecdcfd0625bba6c3bb9f1", "score": "0.5245679", "text": "func (d *DispatcherImpl) startConsuming(subscriber *SubscriberWrapper) {\n\n\t// Validate The Subscriber / ConsumerGroup\n\tif subscriber != nil && subscriber.ConsumerGroup != nil {\n\n\t\t// Setup The ConsumerGroup Level Logger\n\t\tlogger := d.Logger.With(zap.String(\"GroupId\", subscriber.GroupId))\n\n\t\t// Asynchronously Process ConsumerGroup's Error Channel\n\t\tgo func() {\n\t\t\tlogger.Info(\"ConsumerGroup Error Processing Initiated\")\n\t\t\tfor err := range subscriber.ConsumerGroup.Errors() { // Closing ConsumerGroup Will Break Out Of This\n\t\t\t\tlogger.Error(\"ConsumerGroup Error\", zap.Error(err))\n\t\t\t}\n\t\t\tlogger.Info(\"ConsumerGroup Error Processing Terminated\")\n\t\t}()\n\n\t\t// Create A New ConsumerGroupHandler To Consume Messages With\n\t\thandler := NewHandler(logger, &subscriber.SubscriberSpec)\n\n\t\t// Consume Messages Asynchronously\n\t\tgo func() {\n\n\t\t\t// Infinite Loop To Support Server-Side ConsumerGroup Re-Balance Which Ends Consume() Execution\n\t\t\tctx := context.Background()\n\t\t\tfor {\n\t\t\t\tselect {\n\n\t\t\t\t// Non-Blocking Stop Channel Check\n\t\t\t\tcase <-subscriber.StopChan:\n\t\t\t\t\tlogger.Info(\"ConsumerGroup Closed - Ceasing Consumption\")\n\t\t\t\t\treturn\n\n\t\t\t\t// Start ConsumerGroup Consumption\n\t\t\t\tdefault:\n\t\t\t\t\tlogger.Info(\"ConsumerGroup Message Consumption Initiated\")\n\t\t\t\t\terr := subscriber.ConsumerGroup.Consume(ctx, []string{d.Topic}, handler)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tif err == sarama.ErrClosedConsumerGroup {\n\t\t\t\t\t\t\tlogger.Info(\"ConsumerGroup Closed Error - Ceasing Consumption\") // Should be caught above but here as added precaution.\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlogger.Error(\"ConsumerGroup Failed To Consume Messages\", zap.Error(err))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "cfb2c439d2837ab3164e4557f88f55b3", "score": "0.5243485", "text": "func (c *Consumer) loop() {\n\tgo func() {\n\t\tdefer func() {\n\t\t\tif p := recover(); p != nil {\n\t\t\t\t// todo\n\t\t\t\t// recover\n\t\t\t}\n\t\t}()\n\n\t\tdefer c.wg.Done()\n\t\tfor msg := range c.partitionConsumer.Messages() {\n\t\t\tc.loger.Debug(\"--->[Consumer] get new message, topic:%s, offset:%d, key:%s\", msg.Topic, msg.Offset, string(msg.Key))\n\t\t\terr := c.offset.Save(msg.Offset)\n\t\t\tif err != nil {\n\t\t\t\tc.loger.Error(\"!!! [Consumer] save offset %d failed: %v\", msg.Offset, err)\n\t\t\t}\n\n\t\t\tfireEvent(msg.Topic, string(msg.Key), msg.Value, c)\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tdefer c.wg.Done()\n\t\tfor err := range c.partitionConsumer.Errors() {\n\t\t\tc.loger.Error(\"[Consumer] get error at topic:%s, partition:%d, reson:%s\", err.Topic, err.Partition, err.Error())\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "e28de5f968de7428bf684fbb04cdc17b", "score": "0.523997", "text": "func (c *Consumer) Consume() {\n\tconn, err := amqp.Dial(c.Host)\n\tfailOnError(err, \"Failed to connect to RabbitMQ\")\n\n\tch, err := conn.Channel()\n\tfailOnError(err, \"Failed to open a channel\")\n\n\terr = ch.ExchangeDeclare(\n\t\tc.Exchange, // name\n\t\tc.ExchangeType, // type\n\t\ttrue, // durable\n\t\tfalse, // auto-deleted\n\t\tfalse, // internal\n\t\tfalse, // no-wait\n\t\tnil, // arguments\n\t)\n\tfailOnError(err, \"Failed to declare an exchange\")\n\n\tq, err := ch.QueueDeclare(\n\t\tfmt.Sprintf(\"scribano_watcher_%s\", c.Exchange),\n\t\tfalse, // durable\n\t\ttrue, // delete when usused\n\t\tfalse, // exclusive\n\t\tfalse, // no-wait\n\t\tnil, // arguments\n\t)\n\tfailOnError(err, \"Failed to declare a queue\")\n\n\terr = ch.QueueBind(\n\t\tq.Name, // queue name\n\t\tc.RoutingKey, // routing key\n\t\tc.Exchange, // exchange\n\t\tfalse,\n\t\tnil)\n\tfailOnError(err, \"Failed to bind a queue\")\n\n\tmsgs, err := ch.Consume(\n\t\tq.Name, // queue\n\t\t\"\", // consumer\n\t\tfalse, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\tfailOnError(err, \"Failed to consume from queue\")\n\n\tlog.Printf(\" [*] Waiting for messages - queue: %s, broker: %s, exchange: %s, matcher: %s.\", q.Name, c.Host, c.Exchange, c.RoutingKey)\n\n\tfor d := range msgs {\n\t\tlog.Printf(\"Received: %+v\", d)\n\t\tprobability := rand.Intn(100)\n\t\tif probability < c.ConsumeRatio {\n\t\t\tlog.Printf(\"Consuming: %+v\", d)\n\t\t\tc.Ch <- c.transformMessage(d)\n\t\t} else {\n\t\t\tlog.Printf(\"Ignoring: %+v\", d)\n\t\t\td.Ack(false)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "069b56a005e645265773f719f0165487", "score": "0.52271795", "text": "func ConsumeTopic(config *sarama.Config, servers []string, topic string, partitions string, getPartitionOffset func(partition int32) int64, onMessage func(msg *sarama.ConsumerMessage), onDone func()) (func(), error) {\n\tconsumer, err := sarama.NewConsumer(servers, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpartitionList, err := getPartitions(consumer, topic, partitions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar (\n\t\tclosing = make(chan struct{})\n\t\twg sync.WaitGroup\n\t)\n\n\tfor _, partition := range partitionList {\n\t\tpc, err := consumer.ConsumePartition(topic, partition, getPartitionOffset(partition))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tgo func(pc sarama.PartitionConsumer) {\n\t\t\t<-closing\n\t\t\tpc.AsyncClose()\n\t\t}(pc)\n\n\t\twg.Add(1)\n\t\tgo func(pc sarama.PartitionConsumer) {\n\t\t\tdefer wg.Done()\n\t\t\tfor message := range pc.Messages() {\n\t\t\t\tonMessage(message)\n\t\t\t}\n\t\t}(pc)\n\t}\n\n\tgo func() {\n\t\twg.Wait()\n\t\tonDone()\n\t}()\n\n\tclose := func() {\n\t\tclose(closing)\n\t\tif err := consumer.Close(); err != nil {\n\t\t\tfmt.Println(\"Failed to close consumer: \", err)\n\t\t}\n\t}\n\treturn close, nil\n}", "title": "" }, { "docid": "63e558df7caf6bb6cbd43f01fba7bfbf", "score": "0.5212488", "text": "func (ams *AsyncMessageSource) ConsumeMessages(ctx context.Context, messages chan<- substrate.Message, acks <-chan substrate.Message) error {\n\ttoBeAcked := make(chan substrate.Message, cap(acks))\n\n\terrs := make(chan error)\n\tgo func() {\n\t\tdefer close(errs)\n\t\terrs <- ams.impl.ConsumeMessages(ctx, messages, toBeAcked)\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase ack := <-acks:\n\t\t\tselect {\n\t\t\tcase toBeAcked <- ack:\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn <-errs\n\t\t\tcase err := <-errs:\n\t\t\t\tif err != nil {\n\t\t\t\t\tams.counter.WithLabelValues(\"error\", ams.topic).Inc()\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tams.counter.WithLabelValues(\"success\", ams.topic).Inc()\n\t\tcase <-ctx.Done():\n\t\t\treturn <-errs\n\t\tcase err := <-errs:\n\t\t\tif err != nil {\n\t\t\t\tams.counter.WithLabelValues(\"error\", ams.topic).Inc()\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3f05900a3e9e6e47f55df0410c7b2fad", "score": "0.520432", "text": "func (c *Client) monitorSubscriptions(ctx context.Context) {\n\tdlog := debug.NewPrefixLogger(\"sub: \")\n\tdefer dlog.Print(\"done\")\n\npublish:\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tdlog.Println(\"ctx.Done()\")\n\t\t\treturn\n\n\t\tcase <-c.resumech:\n\t\t\tdlog.Print(\"resume\")\n\t\t\t// ignore since not paused\n\n\t\tcase <-c.pausech:\n\t\t\tdlog.Print(\"pause\")\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\tdlog.Print(\"pause: ctx.Done()\")\n\t\t\t\t\treturn\n\n\t\t\t\tcase <-c.resumech:\n\t\t\t\t\tdlog.Print(\"pause: resume\")\n\t\t\t\t\tcontinue publish\n\n\t\t\t\tcase <-c.pausech:\n\t\t\t\t\tdlog.Print(\"pause: pause\")\n\t\t\t\t\t// ignore since already paused\n\t\t\t\t}\n\t\t\t}\n\n\t\tdefault:\n\t\t\t// send publish request and handle response\n\t\t\t//\n\t\t\t// publish() blocks until a PublishResponse\n\t\t\t// is received or the context is cancelled.\n\t\t\tif err := c.publish(ctx); err != nil {\n\t\t\t\tdlog.Print(\"error: \", err.Error())\n\t\t\t\tc.pauseSubscriptions(ctx)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cdfd0fda0973b465d46ec173864587f1", "score": "0.51935357", "text": "func (d *Driver) produce(level string, s string) {\n\td.sm.Lock()\n\tdefer d.sm.Unlock()\n\n\t_, file, line, _ := runtime.Caller(2)\n\n\td.swg.Add(1)\n\tgo func() {\n\t\tmsg := newMsg(\n\t\t\ttime.Now(),\n\t\t\tlevel,\n\t\t\tfile,\n\t\t\tline,\n\t\t\ts,\n\t\t)\n\t\td.pool <- msg\n\t}()\n}", "title": "" }, { "docid": "3eec9ad37857d52db329738c99ad0e84", "score": "0.51928896", "text": "func (f *Factory) Catch(\n\tgroup string,\n\ttopic string,\n\tuuid uuuid.UUID,\n) (<-chan *model.KafkaResponse, error) {\n\tif group == \"\" {\n\t\treturn nil, errors.New(\"group is required\")\n\t}\n\tif topic == \"\" {\n\t\treturn nil, errors.New(\"topic is required\")\n\t}\n\tif uuid == (uuuid.UUID{}) {\n\t\treturn nil, errors.New(\"uuid is required\")\n\t}\n\n\t// Update UUIDs for that specific topic\n\tf.uuidMapLock.RLock()\n\ttopicCIDMap := f.uuidMap[topic]\n\tf.uuidMapLock.RUnlock()\n\n\tif f.topicMapLocks[topic] == nil {\n\t\tf.topicMapLocks[topic] = &sync.RWMutex{}\n\t}\n\n\tif topicCIDMap == nil {\n\t\tf.uuidMapLock.Lock()\n\t\tf.uuidMap[topic] = map[string]chan *model.KafkaResponse{}\n\t\tf.uuidMapLock.Unlock()\n\n\t\tf.uuidMapLock.RLock()\n\t\ttopicCIDMap = f.uuidMap[topic]\n\t\tf.uuidMapLock.RUnlock()\n\t}\n\n\terr := f.createConsumer(group, topic, uuid)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"Error creating ConsumerGroup\")\n\t\treturn nil, err\n\t}\n\n\ttl := f.topicMapLocks[topic]\n\n\tuuidStr := uuid.String()\n\ttl.RLock()\n\ttopicCID := topicCIDMap[uuidStr]\n\ttl.RUnlock()\n\tif topicCID == nil {\n\t\t// 1 buffer because channel might be read later after its written\n\t\treadChan := make(chan *model.KafkaResponse, 1)\n\t\ttl.Lock()\n\t\ttopicCIDMap[uuidStr] = readChan\n\t\ttl.Unlock()\n\n\t\ttl.RLock()\n\t\ttopicCID = topicCIDMap[uuidStr]\n\t\ttl.RUnlock()\n\n\t\tif !f.catchConfig.PreRequest {\n\t\t\tgo func(uuidStr string) {\n\t\t\t\tseconds := time.Duration(f.catchConfig.TimeoutSec)\n\t\t\t\t<-time.After(seconds * time.Second)\n\t\t\t\ttl.RLock()\n\t\t\t\tkrChan := topicCIDMap[uuidStr]\n\t\t\t\ttl.RUnlock()\n\n\t\t\t\tif krChan != nil {\n\t\t\t\t\tkrChan <- nil\n\t\t\t\t\ttl.Lock()\n\t\t\t\t\tdelete(topicCIDMap, uuidStr)\n\t\t\t\t\ttl.Unlock()\n\t\t\t\t}\n\t\t\t}(uuidStr)\n\t\t}\n\t}\n\n\treturn (<-chan *model.KafkaResponse)(topicCID), nil\n}", "title": "" }, { "docid": "62db1dfa3c92df09385e52611fcc85f0", "score": "0.5191755", "text": "func (l *Line) spinUpProducer(ctx context.Context, out chan interface{}, errs chan<- error) {\n\tdefer safeClose(out)\n\n\tif ctx != nil && l.pContext != nil {\n\t\tl.pContext(ctx, out, errs)\n\t\treturn\n\t}\n\n\tl.p(out, errs)\n}", "title": "" }, { "docid": "05b572ca3ee7e11d854d3289a3465d12", "score": "0.5185046", "text": "func (b *EventBus) handle(m eh.EventMatcher, h eh.EventHandler, r *kafka.Reader) {\n\tdefer b.wg.Done()\n\tdefer func() {\n\t\tif err := r.Close(); err != nil {\n\t\t\tlog.Printf(\"eventhorizon: failed to close Kafka reader: %s\", err)\n\t\t}\n\t}()\n\n\thandler := b.handler(m, h, r)\n\n\tfor {\n\t\tselect {\n\t\tcase <-b.cctx.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\n\t\tmsg, err := r.FetchMessage(b.cctx)\n\t\tif errors.Is(err, context.Canceled) {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\terr = fmt.Errorf(\"could not fetch message: %w\", err)\n\t\t\tselect {\n\t\t\tcase b.errCh <- &eh.EventBusError{Err: err}:\n\t\t\tdefault:\n\t\t\t\tlog.Printf(\"eventhorizon: missed error in Kafka event bus: %s\", err)\n\t\t\t}\n\n\t\t\t// Retry the receive loop if there was an error.\n\t\t\ttime.Sleep(time.Second)\n\n\t\t\tcontinue\n\t\t}\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-b.cctx.Done():\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\tif err := handler(b.cctx, msg); err != nil {\n\t\t\t\tselect {\n\t\t\t\tcase b.errCh <- err:\n\t\t\t\tdefault:\n\t\t\t\t\tlog.Printf(\"eventhorizon: missed error in Kafka event bus: %s\", err)\n\t\t\t\t}\n\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t} else {\n\t\t\t\t// Use a new context to always finish the commit.\n\t\t\t\tif err := r.CommitMessages(context.Background(), msg); err != nil {\n\t\t\t\t\terr = fmt.Errorf(\"could not commit message: %w\", err)\n\t\t\t\t\tselect {\n\t\t\t\t\tcase b.errCh <- &eh.EventBusError{Err: err}:\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tlog.Printf(\"eventhorizon: missed error in Kafka event bus: %s\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "34817349cdca8767ee6237ec50071db2", "score": "0.5184033", "text": "func nonBlockingConsume(ch <-chan struct{}) {\n\tselect {\n\tcase <-ch:\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "dc379dabd2e4343143d8a008b67a352b", "score": "0.518084", "text": "func (t *fallbackBroker) Consume(ts <-chan message.Transaction) error {\n\tif t.transactions != nil {\n\t\treturn component.ErrAlreadyStarted\n\t}\n\tt.transactions = ts\n\n\tgo t.loop()\n\treturn nil\n}", "title": "" }, { "docid": "d112041d8b9dee6539d9d54e74062dd4", "score": "0.5172639", "text": "func main() {\n\n\tproducer.Produce()\n\n\tconsumer.Consume()\n\n}", "title": "" }, { "docid": "7c177df1560e08f2b90d13f741d4aa71", "score": "0.5172574", "text": "func Consume(waitChan chan<- bool) {\n\t// Forever loop\n\tfor {\n\n\t\t// Wait on semaphore - If calls to signal are outstripping calls to Wait then we'll return\n\t\t// immediately here without actually blocking\n\t\tCountingSem.Wait()\n\n\n\t\tSyncMutex.Lock()\t\t\t\t\t\t\t\t\t// [Start sync]\n\t\t\n\t\t// Pop the oldest element in the queue (FIFO)\n\t\telem := PubsubQueue.Back()\t\t\t\t\t\t\t\n\t\tPubsubQueue.Remove(elem)\t\t\t\t\t\t\t\n\t\t\n\t\tfmt.Printf(\"Consumed: %d\\n\", elem.Value.(int))\n\n\t\t// Increment count and break out of loop if we've consumed everything\n\t\tConsumeCount++\n\t\tif ConsumeCount == PublisherCount {\n\t\t\tSyncMutex.Unlock()\n\t\t\tbreak\n\t\t}\n\n\t\tSyncMutex.Unlock()\t\t\t\t\t\t\t\t\t// [End sync]\n\t}\n\n\t// Send to channel so we can exit\n\tWaitChan <- true\n}", "title": "" }, { "docid": "90af3d088a96a705c0ad80e14231804e", "score": "0.51616305", "text": "func Run(ctx context.Context) ExitEvt {\n\tif err := generators.ConfigureAll(); err != nil {\n\t\treturn ExitEvt{EvtErrStartup, fmt.Sprintf(\"Failed to configure generators. %v\", err)}\n\t}\n\tclient, err := pubsub.NewClient(ctx, conf.ProjectID)\n\tif err != nil {\n\t\treturn ExitEvt{EvtErrSubscription, fmt.Sprintf(\"Failed to create client. %v\", err)}\n\t}\n\tfor {\n\t\tdeck.InfoA(\"Awaiting join requests...\").With(eventID(EvtWaiting)).Go()\n\t\tmetrics.Get(\"waiting\").Set(1)\n\t\treqID, err := pubsub.NewJoinRequest(ctx, client, conf.Topic)\n\t\tmetrics.Get(\"waiting\").Set(0)\n\t\tif err != nil {\n\t\t\tmetrics.Get(\"failure_205\").Increment()\n\t\t\tdeck.ErrorA(err).With(eventID(EvtErrSubscription)).Go()\n\t\t\ttime.Sleep(1 * time.Minute)\n\t\t\tcontinue\n\t\t}\n\n\t\tdeck.InfofA(\"NewJoinRequest: pulled message for processing, %v\", reqID).With(eventID(EvtNewRequest)).Go()\n\t\treq, err := claimRequest(ctx, reqID)\n\t\tif err != nil {\n\t\t\tdeck.ErrorA(err).With(eventID(EvtErrClaim)).Go()\n\t\t\tmetrics.Get(\"failure_206\").Increment()\n\t\t\tcontinue\n\t\t}\n\n\t\tsuccess := true\n\t\tmeta, err := processRequest(&req)\n\t\tif err != nil {\n\t\t\tsuccess = false\n\t\t}\n\n\t\tif err = returnRequest(ctx, reqID, success, &meta); err != nil {\n\t\t\tdeck.ErrorA(err).With(eventID(EvtErrReturn)).Go()\n\t\t\tmetrics.Get(\"failure_208\").Increment()\n\t\t}\n\t\tfor i := range meta.Data {\n\t\t\tmeta.Data[i] = 0\n\t\t}\n\t}\n}", "title": "" }, { "docid": "19fcf34ab204b3b15b085e522051bb54", "score": "0.51615065", "text": "func GoConsume( q *Queue, retry Millis, pool *Counter, sema *Semaphore ) {\r\n\tpool.Add() // Inform pool of your state\r\n\tdefer pool.Sub()\r\n\r\n\tfor {\r\n\t\tif sema.TerminateSelf() { return }\r\n\r\n\t\twork, ok := q.Pop()\r\n\t\tif !ok {\r\n\t\t\tsleepMillis( retry )\r\n\t\t} else {\r\n\t\t\tsleepMillis( Millis(work) )\r\n//\t\t\trc.put( time.Now().UnixNano() ) // ???\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "10145ca178268e45dfea2484069fe65a", "score": "0.51478064", "text": "func (h *helper) consume() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-h.reconciler.stopCh:\n\t\t\t\treturn\n\t\t\tcase cmd := <-h.redisCommandCh:\n\t\t\t\th.redisCommandsSeen = append(h.redisCommandsSeen, cmd.Name())\n\t\t\tcase cmd := <-h.consulCommandCh:\n\t\t\t\th.consulCommandsSeen = append(h.consulCommandsSeen, cmd.Name())\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "d5cf16b8646cb8ca1a1e813db5dc0af4", "score": "0.514153", "text": "func consume(c C, ch chan Message) int {\n\tnumConsum := 0\n\tfor {\n\t\tselect {\n\t\tcase msg, ok := <-ch:\n\t\t\tif !ok {\n\t\t\t\treturn numConsum\n\t\t\t}\n\t\t\tmsg.CommitAndRelease()\n\t\t\tvalidateChannelClosed(c, msg.UpstreamDone(), true)\n\t\t\tnumConsum++\n\t\tcase <-time.After(TIMEOUT):\n\t\t\treturn numConsum\n\t\t}\n\t}\n}", "title": "" }, { "docid": "907ca63e1e905f65e6bd2f7abced07d1", "score": "0.51314783", "text": "func produceProgress(o *opts.Opts) {\n\tif o.ProgressOutput {\n\t\t<-o.WordlistReadComplete\n\t\ttick := time.Tick(time.Millisecond * time.Duration(o.ProgressSendInterval))\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-tick:\n\t\t\t\tresultChs.Progress <- &Progress{\n\t\t\t\t\tNumDoneRequests: o.NumDoneRequests,\n\t\t\t\t\tNumApproxRequests: o.NumApproxRequests,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "65a5374c1f92257d14d833364f46b6dc", "score": "0.51175755", "text": "func (w *Worker) generate(ctx context.Context) {\n\tdefer w.wg.Done()\n\tdefer close(w.pPipe)\n\tfor i := 1; i <= w.config.Amount; i++ {\n\t\tbody := strings.ReplaceAll(w.config.Payload, \"$CURRENT\", strconv.Itoa(i))\n\t\tbody = strings.ReplaceAll(body, \"$TOTAL\", strconv.Itoa(w.config.Amount))\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t\tw.pPipe <- payload{\n\t\t\t\tid: i,\n\t\t\t\tbody: body,\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f76003bce49b566a8799d9904793e4c9", "score": "0.5114695", "text": "func Consumer(client pulsar.Client, topic string) (deathstar_pb.EventMessage, error) {\n\tconsumer, err := client.Subscribe(pulsar.ConsumerOptions{\n\t\tTopic: topic,\n\t\tSubscriptionName: \"my-sub\",\n\t\tType: pulsar.Shared,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tvar event deathstar_pb.EventMessage\n\n\tmsg, err := consumer.Receive(context.Background())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn deathstar_pb.EventMessage{}, err\n\t}\n\n\tfmt.Printf(\"Received message msgId: %#v -- content: '%s'\\n\",\n\t\tmsg.ID(), string(msg.Payload()))\n\n\tconsumer.Ack(msg)\n\n\terr = json.Unmarshal(msg.Payload(), &event)\n\tif err != nil {\n\t\treturn deathstar_pb.EventMessage{}, err\n\t}\n\n\treturn event, nil\n}", "title": "" }, { "docid": "180fe133f3b32c0cc9ddc4cc7955c6d5", "score": "0.5113365", "text": "func (producer *LocalProducer) Produce(msg message.Message) (err error) {\n\n\tif msg == (message.Message{}) {\n\t\terr = customError.NewValidationError(\"msg should not be nil\")\n\t\treturn err\n\t}\n\n\tproducer.messageQueue <- msg\n\n\treturn err\n}", "title": "" }, { "docid": "2dbf4107de65a70ae062480fa554dac5", "score": "0.51130444", "text": "func TestOnClosedProducer(t *testing.T) {\n\tp, err := NewProducer(&ConfigMap{\n\t\t\"socket.timeout.ms\": 10,\n\t\t\"message.timeout.ms\": 10,\n\t\t\"go.delivery.report.fields\": \"key,value,headers\"})\n\tif err != nil {\n\t\tt.Fatalf(\"%s\", err)\n\t}\n\tt.Logf(\"Producer %s\", p)\n\n\tp.Close()\n\n\ttopic1 := \"gotest\"\n\n\terr = p.Produce(&Message{TopicPartition: TopicPartition{Topic: &topic1, Partition: 0},\n\t\tValue: []byte(\"Producer Validation\"), Key: []byte(\"This is my key\")},\n\t\tnil)\n\texpectedErr := getOperationNotAllowedErrorForClosedClient()\n\tif err != expectedErr {\n\t\tt.Errorf(\"Produce should have thrown : %s, but got %s\", expectedErr, err)\n\t}\n\t_, err = p.OffsetsForTimes([]TopicPartition{{Topic: &topic1, Offset: 12345}}, 100)\n\tif err != expectedErr {\n\t\tt.Errorf(\"OffsetsForTimes should have thrown : %s, but got %s\", expectedErr, err)\n\t}\n\terr = p.SetOAuthBearerToken(OAuthBearerToken{\n\t\tTokenValue: \"aaaa\",\n\t\tExpiration: time.Now().Add(time.Second * time.Duration(60)),\n\t\tPrincipal: \"gotest\",\n\t})\n\tif err != expectedErr {\n\t\tt.Errorf(\"SetOAuthBearerToken should have thrown err : %s, but got %s\", expectedErr, err)\n\t}\n\n\tctx := context.TODO()\n\terr = p.BeginTransaction()\n\tif err != expectedErr {\n\t\tt.Errorf(\"BeginTransaction should have thrown err : %s, but got %s\", expectedErr, err)\n\t}\n\n\t// SendOffsetsToTransaction\n\ttopic := \"myTopic\"\n\tcgmd, err := NewTestConsumerGroupMetadata(\"myConsumerGroup\")\n\terr = p.SendOffsetsToTransaction(ctx,\n\t\t[]TopicPartition{\n\t\t\t{Topic: &topic, Partition: 1, Offset: 123},\n\t\t\t{Topic: &topic, Partition: 0, Offset: 4567890},\n\t\t},\n\t\tcgmd)\n\tif err != expectedErr {\n\t\tt.Errorf(\"SendOffsetsToTransaction should have thrown err : %s, but got %s\", expectedErr, err)\n\t}\n\n\t// AbortTransaction\n\terr = p.AbortTransaction(ctx)\n\tif err != expectedErr {\n\t\tt.Errorf(\"AbortTransaction should have thrown err : %s, but got %s\", expectedErr, err)\n\t}\n\n\t// CommitTransaction\n\terr = p.CommitTransaction(ctx)\n\tif err != expectedErr {\n\t\tt.Errorf(\"CommitTransaction should have thrown err : %s, but got %s\", expectedErr, err)\n\t}\n}", "title": "" }, { "docid": "16fb15fb373fe264e36c6a1457b4af3a", "score": "0.5104448", "text": "func (k *KafkaSource) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error {\n\tclaimedMessage := make(chan sarama.ConsumerMessage)\n\tgo func() {\n\t\t// log.Printf(\"[KAFKA-SOURCE] starting message handler for partition %d\", claim.Partition())\n\t\tfor msg := range claimedMessage {\n\t\t\tif k.MessageHandler != nil {\n\t\t\t\toutMsg := &source.Message{\n\t\t\t\t\tTimestamp: msg.Timestamp,\n\t\t\t\t\tValue: msg.Value,\n\t\t\t\t}\n\t\t\t\tresolveChan := k.MessageHandler(outMsg)\n\t\t\t\tgo func(ch chan processor.Response) {\n\t\t\t\t\tresponse := <-ch\n\t\t\t\t\tif response.Error == \"\" {\n\t\t\t\t\t\tsession.MarkMessage(&msg, \"\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Printf(\"[KAFKA-SOURCE] processor error: %s\", response.Error)\n\t\t\t\t\t}\n\t\t\t\t}(resolveChan)\n\t\t\t}\n\t\t}\n\t\tlog.Printf(\"[KAFKA-SOURCE] message handler stopped for partition %d\", claim.Partition())\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message := <-claim.Messages():\n\t\t\tclaimedMessage <- *message\n\t\t\t// log.Printf(\"value = %s, timestamp = %v, topic = %s, partition = %d\", string(message.Value), message.Timestamp, message.Topic, claim.Partition())\n\t\t\t// log.Printf(\"value = %s, partition = %d\", string(message.Value), claim.Partition())\n\t\tcase <-session.Context().Done():\n\t\t\tclose(claimedMessage)\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7fb4a4446db26e9dc5b1163efe0a47f0", "score": "0.50982654", "text": "func (ap *AsyncProducer) daemonProducer() {\n\t// consume successes\n\tgo func() {\n\t\tif ap.cfg.Producer.Return.Successes {\n\t\t\tfor pm := range ap.producer.Successes() {\n\t\t\t\tlog.Printf(\"[asyncProducer] return, successes:%v\", pm)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// consume errors\n\tgo func() {\n\t\tif ap.cfg.Producer.Return.Errors {\n\t\t\tfor pe := range ap.producer.Errors() {\n\t\t\t\tlog.Printf(\"[asyncProducer] return, errors:%v\", pe.Error())\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor {\n\t\tmes, ok := <-ap.messages\n\t\tif !ok {\n\t\t\tap.stop <- struct{}{}\n\t\t\treturn\n\t\t}\n\t\tap.producer.Input() <- mes\n\t}\n}", "title": "" }, { "docid": "3d3b61467f37cb3a933d10c9c4f9d58a", "score": "0.5097243", "text": "func (a *AMQP) loop() {\n\tdefer func() {\n\t\tatomic.StoreInt32(&a.running, 0)\n\n\t\ta.disconnect()\n\n\t\tclose(a.responseChan)\n\t\tclose(a.closedChan)\n\t}()\n\n\tvar open bool\n\tfor atomic.LoadInt32(&a.running) == 1 {\n\t\tvar msg types.Message\n\t\tif msg, open = <-a.messages; !open {\n\t\t\treturn\n\t\t}\n\t\tvar err error\n\t\tvar sending []byte\n\t\tvar contentType string\n\t\tif len(msg.Parts) == 1 {\n\t\t\tsending = msg.Parts[0]\n\t\t\tcontentType = \"application/octet-stream\"\n\t\t} else {\n\t\t\tsending = msg.Bytes()\n\t\t\tcontentType = \"application/x-benthos-multipart\"\n\t\t}\n\t\terr = a.amqpChan.Publish(\n\t\t\ta.conf.AMQP.Exchange, // publish to an exchange\n\t\t\ta.conf.AMQP.BindingKey, // routing to 0 or more queues\n\t\t\tfalse, // mandatory\n\t\t\tfalse, // immediate\n\t\t\tamqp.Publishing{\n\t\t\t\tHeaders: amqp.Table{},\n\t\t\t\tContentType: contentType,\n\t\t\t\tContentEncoding: \"\",\n\t\t\t\tBody: sending,\n\t\t\t\tDeliveryMode: amqp.Transient, // 1=non-persistent, 2=persistent\n\t\t\t\tPriority: 0, // 0-9\n\t\t\t\t// a bunch of application/implementation-specific fields\n\t\t\t},\n\t\t)\n\t\tselect {\n\t\tcase a.responseChan <- types.NewSimpleResponse(err):\n\t\tcase <-a.closeChan:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f685aaa0ad3df81d1b2e9635d1010def", "score": "0.5085221", "text": "func (P *Publisher) Start(){\n go func() {\n client := redis.NewClient(&redis.Options{\n Addr: *RedisAddr,\n Password: *Password, \n DB: 0, // use default DB\n })\n fmt.Println(\"Publishing result on \" + QueueName + \"results\")\n for {\n select{\n case result := <-P.ResultQueue:\n client.LPush(QueueName + \"results\", fmt.Sprintf(\"{'%s' : '%s = %f'}\" , result.ID, result.Cmd, result.Value))\n }\n }\n }()\n}", "title": "" }, { "docid": "f38ecb07229dbd57ead67fb7dbbd17cb", "score": "0.5081633", "text": "func (handler *KafkaStoreConsumerGroupHandler) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error {\n\tfmt.Println(\"Called ConsumeClaim()\")\n\n\t// initialze the callback goroutine\n\tgo func() {\n\t\terr := handler.callback(handler.reader)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}()\n\n\tdefer func() {\n\t\t// close the reader, otherwise may be blocked.\n\t\thandler.reader.Close()\n\t}()\n\n\tisAtHighWatermark, err := handler.isAtHighwatermark(session, claim, claim.InitialOffset())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif isAtHighWatermark {\n\t\tfmt.Println(\"Already at highWatermark\")\n\t\treturn nil\n\t}\n\n\t// loop through the messages\n\tfmt.Println(\"Starting to loop through the messages\")\n\tfor message := range claim.Messages() {\n\t\tfmt.Printf(\"ConsumeClaim() processing message: '%s', offset: %d\\n\", message.Value, message.Offset)\n\n\t\t// write the message into callback through the pipe\n\t\t_, err := handler.writer.Write(message.Value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// mark the message consumer so that it will be autocommited after KafkaStoreConsumerGroupHandler.Cleanup()\n\t\tsession.MarkMessage(message, \"\")\n\n\t\t// if we've reached highWatermark, return; note that here we add 1 to message.Offset to compare it with highWatermark\n\t\tisAtHighWatermark, err = handler.isAtHighwatermark(session, claim, message.Offset+1)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif isAtHighWatermark {\n\t\t\tfmt.Printf(\"message.Offset+1 (%d) >= highWatermark\\n\", message.Offset+1)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9661de6d359ba6dda3907aade2a15679", "score": "0.50802064", "text": "func reader(ctx context.Context, events chan interface{}) {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-events:\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "7a56ece788e181b64866999a166af4a1", "score": "0.50774604", "text": "func ReceiveAndSend(ctx context.Context, slackAPIKey string) {\n\tfor {\n\t\tpubsubcli, err := pubsub.NewClient(ctx, projectID)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tapi := slack.New(slackAPIKey)\n\t\tvar message Message\n\t\ttopic := pubsubcli.Topic(topicID)\n\t\tsub := pubsubcli.Subscription(subscriptionID)\n\t\texists, err := sub.Exists(ctx)\n\t\tif !exists {\n\t\t\tsub, err = pubsubcli.CreateSubscription(ctx, subscriptionID, pubsub.SubscriptionConfig{\n\t\t\t\tTopic: topic,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\n\t\tcctx, cancel := context.WithCancel(ctx)\n\t\tsub.Receive(cctx, func(ctx context.Context, m *pubsub.Message) {\n\t\t\terr := json.Unmarshal([]byte(m.Data), &message)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tm.Ack()\n\t\t\tcancel()\n\t\t})\n\t\tswitch message.Event {\n\t\tcase \"GCS_BUCKET_CREATED\":\n\t\t\tapi.PostMessage(string(message.Channel), fmt.Sprintf(\"Bucket %v created\", message.Bucket), slack.PostMessageParameters{})\n\t\tcase \"GCS_BUCKET_CREATION_FAILED\":\n\t\t\tapi.PostMessage(string(message.Channel), fmt.Sprintf(\"Bucket %v not created\", message.Bucket), slack.PostMessageParameters{})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "675165fa7d131754bb3987813bb0ec2a", "score": "0.50664395", "text": "func (c InfrastructureOpsConsumer) Consume(ctx context.Context) derrors.Error {\n\tmsg, err := c.Consumer.Receive(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttarget := &grpc_bus_go.InfrastructureOps{}\n\n\tderr := queue.UnmarshallPbMsg(msg, target)\n\tif derr != nil {\n\t\treturn derr\n\t}\n\n\tswitch x := target.Operation.(type) {\n\tcase *grpc_bus_go.InfrastructureOps_DrainRequest:\n\t\tif c.Config.ToConsume.DrainRequest {\n\t\t\tc.Config.ChDrainRequest <- x.DrainRequest\n\t\t}\n\tcase nil:\n\t\terrMsg := \"received nil entry\"\n\t\tlog.Error().Msg(errMsg)\n\t\treturn derrors.NewInvalidArgumentError(errMsg)\n\tdefault:\n\t\terrMsg := fmt.Sprintf(\"unknown object type in %s\", InfrastructureOpsTopic)\n\t\tlog.Error().Interface(\"type\", x).Msg(errMsg)\n\t\treturn derrors.NewInvalidArgumentError(errMsg)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e5471c30e001123ccc436812729252f4", "score": "0.5054285", "text": "func RootAction(c *cli.Context) error {\n\tvar (\n\t\twg = &sync.WaitGroup{}\n\t\tq queues.Queue\n\t\tcr consumer.Consumer\n\t\tpr producer.Producer\n\t\terr error\n\t)\n\n\tif len(c.Args()) == 0 {\n\t\tlog.Fatal(\"You should specify an endpoint address in a format <scheme>://<hostname>[:port][/path]\")\n\t}\n\n\tq = websocket.FromConfig(\n\t\twebsocket.Config{Addr: c.Args().Get(0)},\n\t\tlog,\n\t)\n\tdefer q.Close()\n\n\tcr, err = q.Consumer()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer cr.Close()\n\n\tpr, err = q.Producer()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer pr.Close()\n\n\tgo func() {\n\t\tdefer wg.Done()\n\n\t\tvar (\n\t\t\tstream <-chan result.Result\n\t\t\terr error\n\t\t)\n\n\t\tstream, err = cr.Consume()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tfor r := range stream {\n\t\t\tswitch {\n\t\t\tcase r.Err != nil:\n\t\t\t\tlog.Fatal(r.Err)\n\t\t\tdefault:\n\t\t\t\tlog.Debugf(\"Consumed: %s\", r.Value)\n\t\t\t\tfmt.Printf(\"%s\\n\", r.Value)\n\t\t\t}\n\t\t}\n\t}()\n\twg.Add(1)\n\n\tgo func() {\n\t\tdefer wg.Done()\n\n\t\tvar (\n\t\t\ts = bufio.NewScanner(os.Stdin)\n\t\t\tm message.Message\n\t\t\terr error\n\t\t)\n\n\t\tfor s.Scan() {\n\t\t\tm = message.Message(s.Text())\n\t\t\tlog.Debugf(\"Producing: %s\", m)\n\t\t\terr = pr.Produce(m)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}\n\n\t\terr = s.Err()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}()\n\twg.Add(1)\n\n\twg.Wait()\n\n\treturn nil\n}", "title": "" }, { "docid": "d2ef789e4f5545946ecf1b13bbcaabe7", "score": "0.5049775", "text": "func startReceiving(ctx context.Context, t *testing.T, s *Subscription, recvdWg *sync.WaitGroup, processTimeSecs *int32) {\n\tt.Log(\"Receiving..\")\n\n\tvar recvdMu sync.Mutex\n\trecvd := map[string]bool{}\n\n\terr := s.Receive(ctx, func(ctx context.Context, msg *Message) {\n\t\tmsgData := string(msg.Data)\n\t\trecvdMu.Lock()\n\t\t_, ok := recvd[msgData]\n\t\tif ok {\n\t\t\trecvdMu.Unlock()\n\t\t\tt.Logf(\"already saw \\\"%s\\\"\\n\", msgData)\n\t\t\treturn\n\t\t}\n\t\trecvd[msgData] = true\n\t\trecvdMu.Unlock()\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tmsg.Nack()\n\t\t\trecvdWg.Done()\n\t\tcase <-time.After(time.Duration(atomic.LoadInt32(processTimeSecs)) * time.Second):\n\t\t\tmsg.Ack()\n\t\t\trecvdWg.Done()\n\t\t}\n\t})\n\tif err != nil {\n\t\tif status.Code(err) != codes.Canceled {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b932ef0f1018a1e85e0e103a4249ce6e", "score": "0.5046332", "text": "func (m *MockOutputType) Consume(msgs <-chan types.Transaction) error {\n\tm.TChan = msgs\n\treturn nil\n}", "title": "" }, { "docid": "800b715d75f55ecb50c708800527bed5", "score": "0.5042945", "text": "func (c ApplicationOpsConsumer) Consume(ctx context.Context) derrors.Error {\n\tmsg, err := c.Consumer.Receive(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttarget := &grpc_bus_go.ApplicationOps{}\n\n\tderr := queue.UnmarshallPbMsg(msg, target)\n\tif derr != nil {\n\t\treturn derr\n\t}\n\n\tswitch x := target.Operation.(type) {\n\tcase *grpc_bus_go.ApplicationOps_DeployRequest:\n\t\tif c.Config.ToConsume.DeployRequest {\n\t\t\tc.Config.ChDeploymentRequest <- x.DeployRequest\n\t\t}\n\tcase *grpc_bus_go.ApplicationOps_UndeployRequest:\n\t\tif c.Config.ToConsume.UndeployRequest {\n\t\t\tc.Config.ChUndeployRequest <- x.UndeployRequest\n\t\t}\n\tcase nil:\n\t\terrMsg := \"received nil entry\"\n\t\tlog.Error().Msg(errMsg)\n\t\treturn derrors.NewInvalidArgumentError(errMsg)\n\tdefault:\n\t\terrMsg := fmt.Sprintf(\"unknown object type in %s\", ApplicationOpsTopic)\n\t\tlog.Error().Interface(\"type\", x).Msg(errMsg)\n\t\treturn derrors.NewInvalidArgumentError(errMsg)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4d1c1094632c388fb7694de96680a60f", "score": "0.5038111", "text": "func main() {\n\twindowSize = time.Duration(config.GetInt(\"WindowSize\") * 1e9)\n\twindowLag = time.Duration(config.GetInt(\"WindowLag\") * 1e9)\n\tconsumerTopic := config.GetString(\"consumerTopic\")\n\tproducerTopic := config.GetString(\"producerTopic\")\n\n\tbootstrapServers := config.GetString(\"kafka.bootstrap.servers\")\n\tgroupID := config.GetString(\"kafka.group.id\")\n\n\tprometheusEndpoint := config.GetString(\"prometheus.endpoint\")\n\n\tsigchan := make(chan os.Signal)\n\tsignal.Notify(sigchan, syscall.SIGINT, syscall.SIGTERM)\n\tgo func() {\n\t\tsig := <-sigchan\n\t\tlog.Fatalf(\"Caught signal %v: terminating\", sig)\n\t}()\n\n\tc := initConsumer(consumerTopic, groupID, bootstrapServers)\n\tdefer c.Close()\n\n\tp := initProducer(bootstrapServers)\n\tdefer p.Close()\n\n\tgo handleProducerEvents(p)\n\n\tlog.Info(\"Started monasca-aggregation\")\n\n\t// align to time boundaries?\n\tfirstTick := firstTick()\n\tvar ticker = new(time.Ticker)\n\n\tgo func() {\n\t\t// Start prometheus endpoint\n\t\thttp.Handle(\"/metrics\", promhttp.Handler())\n\t\tlog.Fatal(http.ListenAndServe(prometheusEndpoint, nil))\n\t}()\n\tlog.Infof(\"Serving metrics on %s/metrics\", prometheusEndpoint)\n\n\tfor true {\n\t\tselect {\n\t\tcase <-firstTick.C:\n\t\t\tticker = time.NewTicker(windowSize)\n\t\t\tpublishAggregations(p.ProduceChannel(), &producerTopic, c)\n\t\tcase <-ticker.C:\n\t\t\tpublishAggregations(p.ProduceChannel(), &producerTopic, c)\n\t\t\t// if the window size has passed and no messages have been received, die in case\n\t\t\t// https://issues.apache.org/jira/browse/KAFKA-3593 is occurring.\n\t\t\tif time.Now().Sub(lastMessage) > windowSize {\n\t\t\t\tlog.Fatalf(\"No messages received since %v\", lastMessage)\n\t\t\t}\n\n\t\tcase ev := <-c.Events():\n\t\t\tswitch e := ev.(type) {\n\t\t\tcase kafka.AssignedPartitions:\n\t\t\t\tlog.Infof(\"%% %v\", e)\n\t\t\t\tc.Assign(e.Partitions)\n\n\t\t\tcase kafka.RevokedPartitions:\n\t\t\t\tlog.Infof(\"%% %v\", e)\n\t\t\t\tc.Unassign()\n\n\t\t\tcase *kafka.Message:\n\t\t\t\tprocessMessage(e)\n\n\t\t\tcase kafka.OffsetsCommitted:\n\t\t\t\tlog.Infof(\"Commited offsets \", e)\n\n\t\t\tcase kafka.PartitionEOF:\n\t\t\t\t//log.Infof(\"%% Reached %v\", e)\n\n\t\t\tcase kafka.Error:\n\t\t\t\tlog.Fatalf(\"%% Error: %v\", e)\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.Info(\"Stopped monasca-aggregation\")\n}", "title": "" }, { "docid": "7d2be4c06b20a638f228d7b8cd3ec5b7", "score": "0.50360644", "text": "func (cm *ClientManager) publishMessages(c Channel) {\n\tcm.running++\n\tvar err error = nil\n\tcm.Lock()\n\tdefer cm.Unlock()\n\tprintln(cm.running)\n\n\tfor {\n\t\tmessage, err := c.deque.PopLeft()\n\t\tif message == nil {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[clientManager] Error occured with publish job: %s\", err)\n\t\t}\n\t\tparticipant := false\n\n\t\t// Iterate over clients that may be available\n\t\tamu := cm.channels[c.name].amu\n\t\tamu.Lock()\n\t\tclone := make(map[string]bool)\n\t\tfor i, k := range c.available {\n\t\t\tclone[i] = k\n\t\t}\n\t\tamu.Unlock()\n\n\t\tfor id, available := range clone {\n\t\t\t// Get the client if it is marked as available\n\t\t\tif available {\n\t\t\t\tcm.Lock()\n\t\t\t\tclient := cm.clients[id]\n\t\t\t\tcm.Unlock()\n\t\t\t\t// Check if the client is ready and isn't processing another message\n\t\t\t\tif !client.IsProducer && client.ready && client.available {\n\t\t\t\t\t// Mark the mutex for the client to ensure it is not sent any more events until processed\n\t\t\t\t\tparticipant = true\n\t\t\t\t\tc.available[id] = false\n\t\t\t\t\tclient.available = false\n\t\t\t\t\tlog.Printf(\"Sent message to %s from channel %s\\n\", id, c.name)\n\n\t\t\t\t\tif s, ok := message.(string); ok {\n\t\t\t\t\t\tif client.Compress {\n\t\t\t\t\t\t\tvar b bytes.Buffer\n\t\t\t\t\t\t\tw := zlib.NewWriter(&b)\n\t\t\t\t\t\t\tw.Write([]byte(s))\n\t\t\t\t\t\t\tw.Close()\n\t\t\t\t\t\t\tclient.socket.Write(append(b.Bytes(), '\\000'))\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclient.socket.Write(append([]byte(s), '\\000'))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !participant {\n\t\t\t// Requeue message and stop publish goroutine\n\t\t\tc.deque.AppendLeft(message)\n\t\t\tlog.Printf(\"[channel %s] No participants available. Requeued message\\n\", c.name)\n\t\t\tbreak\n\t\t}\n\t}\n\tprintln(\"Unlocked channel :)\")\n\tcm.running--\n\tc.lock = false\n\tcm.channels[c.name] = c\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "0daf23c8f56a081ce186dddc0372ae53", "score": "0.50199264", "text": "func Consume(id string, ch <-chan string) {\n\tfor s := range ch {\n\t\tfmt.Println(id, \"received\", s)\n\t\tRandomSleep(100) // Simulate time to consume data.\n\t}\n}", "title": "" } ]
e4739e09ac290b271b1b70d6a7a8bb71
Init configures the package from an outside mediator
[ { "docid": "b167a017b0bf08b98cfb2a61c5a27234", "score": "0.0", "text": "func Init(j, d bool) {\n\t// it's ok to have json/dot as package level variables as they don't have a\n\t// direct effect on the running of the program (other than information output)\n\tjson = j\n\tdot = d\n}", "title": "" } ]
[ { "docid": "faab714c9cc22dc4f760a949d5777981", "score": "0.64725435", "text": "func init() {\n\tio.Initialize([]binder.FactoryEntry{\n\t\t{Name: \"native plugin\", Factory: &mockFac{}, Weight: 10},\n\t})\n}", "title": "" }, { "docid": "9cb060b48c1a4ed5f3ae6b007079a61f", "score": "0.646316", "text": "func (d *Driver) Init(metadata mq.Metadata) error {\n\tm, err := parseNATSMetadata(metadata)\n\tif err != nil {\n\t\treturn nil\n\t}\n\td.metadata = m\n\treturn nil\n}", "title": "" }, { "docid": "baa6fb10778902cbb9a6798c8827c43b", "score": "0.636558", "text": "func (p *Plugin) init(c configuration) {\n\tgt := gotenberg.New(c.GotenbergAddress, []gotenberg.Option{\n\t\tgotenberg.ConvertTimeoutOption(time.Duration(c.GotenbergConvertTimeout)),\n\t}...)\n\tp.app = topdf.New(p.MattermostPlugin.API, gt)\n}", "title": "" }, { "docid": "c7ada5974fbe227199ecc53198d92702", "score": "0.62617105", "text": "func init() {\n\tonet.SimulationRegister(\"NetManageService\", NewSimulationService)\n}", "title": "" }, { "docid": "a1c2fb5d71efc43ae90b6e2a6740c624", "score": "0.6239175", "text": "func Init(ctx context.Context, observationCtx *observation.Context, db database.DB, _ codeintel.Services, _ conftypes.UnifiedWatchable, s *enterprise.Services) error {\n\ts.SCIMHandler = NewHandler(ctx, db, observationCtx)\n\n\treturn nil\n}", "title": "" }, { "docid": "e7a143667518571a67e2ccd6c41ad2f5", "score": "0.62284386", "text": "func init() {\n\tappConfig = config.GetAppConfiguration()\n}", "title": "" }, { "docid": "6b9ce063608fc278e869bab31b60839b", "score": "0.6222868", "text": "func (m *MangosClient) Init(config interface{}) error {\n\n\tm.SubscribeChan = make(chan string)\n\tm.broadcastKillChans = make(map[string]chan struct{})\n\tm.payloadHandlers = socketMap{\n\t\tpayloadHandlers: make(map[string]*socketPayloadHandler),\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2645921a87d114f5bea9f24cc589d15c", "score": "0.6216331", "text": "func init() {\n\tConnector = IntraAPI{config: loadConfig()}\n}", "title": "" }, { "docid": "298345f98367e340cb5f835830f1e14f", "score": "0.62047255", "text": "func (module MediaModule) Init(srv *Server) {\n srv.RegisterCommand(Command{\n Name: \"media\",\n PrivMsgFunction: module.PrivMsg,\n Addressed: true,\n AllowPrivate: false,\n AllowChannel: true,\n })\n}", "title": "" }, { "docid": "9e4216c2b47969d6c9ba2259dc95ebc1", "score": "0.62034124", "text": "func (l *LogProducer) Init(projectMap *ProjectPool, config *ProducerConfig) {\n\t// log.SetFlags(log.LstdFlags | log.Lshortfile)\n\tpackageManager := &PackageManager{\n\t\tProjectPool: projectMap,\n\t\tDataLocker: &sync.RWMutex{},\n\t\tDataMap: make(map[string]*PackageData),\n\t\tWorker: &IOWorker{},\n\t\tCronWorker: &ControlWorker{},\n\t\tConfig: config,\n\t}\n\n\tDebug = log.New(ioutil.Discard, \"DEBUG: \", log.LstdFlags|log.Lshortfile)\n\tInfo = log.New(ioutil.Discard, \"Info: \", log.LstdFlags|log.Lshortfile)\n\tWarning = log.New(os.Stdout, \"Warning: \", log.LstdFlags|log.Lshortfile)\n\tError = log.New(os.Stdout, \"Error: \", log.LstdFlags|log.Lshortfile)\n\n\tpackageManager.CronWorker.PackageManager = packageManager\n\tpackageManager.CronWorker.Init()\n\tpackageManager.Worker.Init(config)\n\n\tl.packageManager = packageManager\n}", "title": "" }, { "docid": "71825d4ec2f651f91b30739ea63cb411", "score": "0.6165448", "text": "func init() {\n\tconfig.StartMessage = startMessage\n\tconfig.PromptMessage = promptMessage\n\tconfig.QuitCommands = quitCommands\n}", "title": "" }, { "docid": "66aeb4b8c53566f4e738fd17538898ae", "score": "0.6150322", "text": "func (ad *Adapter) Init(log log.Logger, rpcPort int) {\n\tad.logger = log\n\tcontrollermgr.GetInstance().Init(log, rpcPort)\n\n\t//Starting RPC server\n\tgo start(rpcPort, log)\n}", "title": "" }, { "docid": "5d8dd02bf9c8985d6b71eb1f43e71be0", "score": "0.61306256", "text": "func (c *Commander) Init() error {\n\t// Adding schemas.\n\tif err := clientgoscheme.AddToScheme(c.scheme); err != nil {\n\t\treturn err\n\t}\n\tif err := eventingv1alpha1.AddToScheme(c.scheme); err != nil {\n\t\treturn err\n\t}\n\tif err := apigatewayv1alpha1.AddToScheme(c.scheme); err != nil {\n\t\treturn err\n\t}\n\t// Check config.\n\tif len(c.envCfg.Domain) == 0 {\n\t\treturn fmt.Errorf(\"env var DOMAIN must be a non-empty value\")\n\t}\n\tc.restCfg = ctrl.GetConfigOrDie()\n\tctrl.SetLogger(zap.New(zap.UseDevMode(c.enableDebugLogs)))\n\t// Create the manager.\n\tmgr, err := ctrl.NewManager(c.restCfg, ctrl.Options{\n\t\tScheme: c.scheme,\n\t\tMetricsBindAddress: c.metricsAddr,\n\t\tPort: 9443,\n\t\tSyncPeriod: &c.resyncPeriod,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.mgr = mgr\n\treturn nil\n}", "title": "" }, { "docid": "8635ccdfae991b41fe67ec6ec1b5cc65", "score": "0.6128998", "text": "func init() {\n\thome, err := homedir.Dir()\n\tif err != nil {\n\t\tlog.Error(\"Error locating home directory: \", err)\n\t}\n\n\tdataDirPath, err = filepath.Abs(home + \"/AppData/Local/OnAir\")\n\tif err != nil {\n\t\tlog.Error(\"Error determining absolute path to OnAir AppData directory: \", err)\n\t}\n\n\tstateFilePath = filepath.Join(dataDirPath + \"/last_known_mute\")\n\n\terr = os.MkdirAll(dataDirPath, os.ModePerm)\n\tif err != nil {\n\t\tlog.Error(\"Could not make directory: \", err)\n\t}\n\n\tconfigFilePath = filepath.Join(dataDirPath + \"/config.toml\")\n\n\tviper.SetConfigName(\"config\")\n\tviper.AddConfigPath(dataDirPath)\n\n\terr = viper.ReadInConfig()\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"configPath\": configFilePath,\n\t\t}).Panic(\"Could not read config file: \", err)\n\t}\n\n\terr = viper.Unmarshal(&config)\n\tif err != nil {\n\t\tlog.Panic(\"Unable to decode configuration: \", err)\n\t}\n}", "title": "" }, { "docid": "25f6d59fc4741e7cd25018b142de66cf", "score": "0.61141044", "text": "func init() {\n\t// init logging object\n\tlogging.Setup()\n\n\t// init server object\n\tserver.Setup()\n}", "title": "" }, { "docid": "8190fbfe0904570726941007398022a6", "score": "0.6111765", "text": "func init() {\n\tlog.Printf(\"set Default directories : \\n - Exec: %s\\n - Config: %s\\n -Logs: %s\\n\", appdir, confDir, logDir)\n\n\t// parse first time to see if config file is being specified\n\tf := flags()\n\tf.Parse(os.Args[1:])\n\t// now load up config settings\n\tif _, err := os.Stat(configFile); err == nil {\n\t\tviper.SetConfigFile(configFile)\n\t} else {\n\t\tviper.SetConfigName(\"config\")\n\t\tviper.AddConfigPath(\"/opt/snmpcollector/conf/\")\n\t\tviper.AddConfigPath(\"./conf/\")\n\t\tviper.AddConfigPath(\".\")\n\t}\n\terr := viper.ReadInConfig()\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"Fatal error config file: %s \\n\", err))\n\t}\n\terr = viper.Unmarshal(&cfg)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"unable to decode into struct, %v \\n\", err))\n\t}\n\n\tif len(cfg.General.LogDir) > 0 {\n\t\tlogDir = cfg.General.LogDir\n\t}\n\tif len(cfg.General.LogLevel) > 0 {\n\t\tl, _ := logrus.ParseLevel(cfg.General.LogLevel)\n\t\tlog.Level = l\n\n\t}\n\t//Init BD config\n\tlog.Debugf(\"%+v\", cfg)\n\n\tlog.Debugf(\"%+v\", cfg)\n\t//Init Metrics CFG\n\n\t// re-read cmd line args to override as indicated\n\tf = flags()\n\tf.Parse(os.Args[1:])\n\tos.Mkdir(logDir, 0755)\n\n\t// now make sure each snmp device has a db\n\n\t//make sure the selfmon has a deb\n\n}", "title": "" }, { "docid": "1738e1fc3e3b91e0ed09dafaf2c6ea33", "score": "0.61089295", "text": "func (p *dummyProvider) Init(name string, _ *config.Config, _ log.Loggerer) error { return nil }", "title": "" }, { "docid": "bb17d301e43ab53371bf27667ad4dd16", "score": "0.6106759", "text": "func (c *Core) Init(inbound chan event.Event) {\n\tc.uuid = xid.New().String()\n\tc.inbound = inbound\n\tc.outbound = make(chan event.Event, 64)\n}", "title": "" }, { "docid": "1c09d58ca7d8db8bbaaabc9c95706156", "score": "0.609022", "text": "func init() {\n\t// Set the API version.\n\tapiv = \"1.00\"\n\t// Check credentials to make sure this is a legit request.\n\tconfigFile = \"conf.json\"\n\t_, err := os.Stat(configFile)\n\t// If there is a problem with the file, err on the side of caution and\n\t// reject the request.\n\tif err != nil {\n\t\tlog.Printf(\"Error: Could not find configuration file %s\", configFile)\n\t\tos.Exit(1)\n\t}\n\n\tm = martini.New()\n\t// Setup Routes\n\tr := martini.NewRouter()\n\tr.Post(`/app/:app_id/env/:env/port/:port/pull/:pull_string`, RunPullScript)\n\tr.Get(`/system/ping`, PingTheApi)\n\tr.Get(`/system/version`, GetDHHPApiVersion)\n\n\t// Add the router action\n\tm.Action(r.Handle)\n}", "title": "" }, { "docid": "f82361ad6143c056d8738ab057e1a210", "score": "0.6056227", "text": "func init() {\n\t// TODO (@mattdurham) we should look at removing this init. I think it can become\n\t// a function call now.\n\t// Register flags from all collector configs to a fake integration and then\n\t// parse an empty command line to force defaults to be populated.\n\tapp := kingpin.New(\"\", \"\")\n\n\t// Register all flags from collector\n\tcollectors := collector.CreateInitializers()\n\tcollector.RegisterCollectorsFlags(collectors, app)\n\n\t_, err := app.Parse([]string{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Map the configs with defaults applied to our default config.\n\tDefaultConfig.setDefaults(app)\n}", "title": "" }, { "docid": "dd5e18cf96f2b877c2835a196f8f8157", "score": "0.6040116", "text": "func init() {\n\tResetConfig()\n}", "title": "" }, { "docid": "dd5e18cf96f2b877c2835a196f8f8157", "score": "0.6040116", "text": "func init() {\n\tResetConfig()\n}", "title": "" }, { "docid": "0a25c4773000f1a2b64737c8a273a8b5", "score": "0.6039192", "text": "func (m *Monitor) Init(nsp model.NSPInterface) error {\n\tm.eventStreamMaxRetries = 5\n\tm.Nsp = nsp\n\tm.wg = nsp.GetWaitGroup()\n\tm.config = nsp.GetConfig()\n\tm.collection = nsp.GetCollection()\n\t// Prepare Docker client\n\tvar err error\n\tm.Client, err = godocker.NewEnvClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.EventsContext, m.EventsCancel = context.WithCancel(context.Background())\n\t// Prepare kubernetes client\n\tm.k8sClientSet, err = kubernetes.NewForConfig(nsp.GetKubeConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c7b56e292b04a5abdd9b87227f8312d6", "score": "0.6031138", "text": "func Init(p Provider) error {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\n\t// Get the provided configuration.\n\tm, err := p.Provide()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set it to the global instance.\n\tc.m = m\n\n\treturn nil\n}", "title": "" }, { "docid": "e889f4cca9bccb39c15938becf03a9aa", "score": "0.6027766", "text": "func (p *Phosphor) init() {\n\t// fire config monitor which will immediately reinitialise the config\n\t// TODO control this with a tomb\n\tgo p.monitorConfig()\n}", "title": "" }, { "docid": "7f863285cb291b468d0029123e13e738", "score": "0.6024423", "text": "func (m *Manager) Init() error {\n\treturn nil\n}", "title": "" }, { "docid": "212b84a83f3869c2c9d44e1bb1f1ae3b", "score": "0.60175234", "text": "func (m *mockPublishPubSub) Init(metadata pubsub.Metadata) error {\n\treturn nil\n}", "title": "" }, { "docid": "7f241c8f46fdf67a38b0f63b0f1314fd", "score": "0.60163796", "text": "func (sm *Manager) Init() {\n\tif sm.ChunkSize == 0 {\n\t\tsm.ChunkSize = 64 * 1024 * 1024\n\t}\n\tif sm.Container == \"\" {\n\t\tsm.Container = DefaultContainer\n\t}\n}", "title": "" }, { "docid": "8df507e5316b5a2a9be6fe9c0a56509c", "score": "0.6012695", "text": "func (s *AWSS3) Init(metadata bindings.Metadata) error {\n\tm, err := s.parseMetadata(metadata)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuploader, err := s.getClient(m)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.metadata = m\n\ts.uploader = uploader\n\treturn nil\n}", "title": "" }, { "docid": "d4e39a576e034ac7e1caefb68bbe907c", "score": "0.6000401", "text": "func init() {\t\n\n\t// Initialize default config directory\n\t_, dir, _, _ := runtime.Caller(0)\n\tdefaultConfigDir = filepath.Join(path.Dir(dir), \"config\")\n\n\t// Read command line\n\tparseSwitches()\n\n\t// Create symbolic links for images\n\tlinkAssets()\n\n\t// read in configuration files\n\treadConfigs(\"beacon\", func (file string) {beacon.AddBeaconFromConfig(file)})\n\treadConfigs(\"idp\", func (file string) {idp.AddIDPFromConfig(file)})\n}", "title": "" }, { "docid": "02db0ceef53885be0f6108dfb2eb568d", "score": "0.5995027", "text": "func init() {\n\n\t// setting the environment of the application\n\tsetEnvironment()\n\n\t// there can be different kind of db and external services config for all\n\t// the environments. So taking the the config from corresponding settings file.\n\tconfig.DoInit(ENVIRONMENT)\n\n\t// defining the port of the application server\n\tSERVER_PORT = config.Config.GetString(\"server.port\")\n\n\t// set the gin server mode\n\tsetGinMode()\n}", "title": "" }, { "docid": "dd1af89cfd5640d8114862e029311265", "score": "0.59702355", "text": "func init() {\n\tutils.MessageQueueAddr = os.Getenv(\"KAFKA_SERVICE\")\n\tif utils.MessageQueueAddr == \"\" {\n\t\tfmt.Println(\"Environment variable KAFKA_SERVICE undefined\")\n\t\tos.Exit(1)\n\t}\n\tutils.StoragePath = os.Getenv(\"STORAGE_PATH\")\n\tif utils.StoragePath == \"\" {\n\t\tfmt.Println(\"Environment variable STORAGE_PATH undefined\")\n\t\tos.Exit(1)\n\t}\n\n\tmessaging.InitProducer(utils.MessageQueueAddr)\n\tmessaging.InitConsumer(utils.MessageQueueAddr, \"group\")\n}", "title": "" }, { "docid": "48588d03bdc673ff1b3822484a5c4438", "score": "0.5969002", "text": "func init() {\n\tCLOCK = goop.NewClock()\n\tMIXER = goop.NewMixer()\n\tNETWORK = goop.NewNetwork(CLOCK)\n\tAUTOCRON = 1\n\tNETWORK.Add(\"clock\", CLOCK)\n\tNETWORK.Add(\"mixer\", MIXER)\n}", "title": "" }, { "docid": "ca27b173a1e5135f1f17db636e55638d", "score": "0.59655035", "text": "func init() { plugin.Register(\"wolverine\", setup) }", "title": "" }, { "docid": "12eb0c7bc64f06c46bdb9e2d47c76c25", "score": "0.5960452", "text": "func init() {\n\t// Server config\n\tsetConfigOf(\"server\", &Settings.Server)\n\t// Certificate config\n\tsetConfigOf(\"certificate\", &Settings.Certificate)\n\t// Views config\n\tsetConfigOf(\"views\", &Settings.Views)\n\t// Database config\n\tsetConfigOf(\"database\", &Settings.Database)\n\t// Mail config\n\tsetConfigOf(\"mail\", &Settings.Mail)\n\t// Queue config\n\tsetConfigOf(\"queue\", &Settings.Queue)\n\t// Transform the relative paths into absolute.\n\tSettings.Certificate.CertFile, _ = filepath.Abs(filepath.Dir(filepath.Dir(os.Args[0])+\"/config\") + \"/\" + filepath.Clean(Settings.Certificate.CertFile))\n\tSettings.Certificate.KeyFile, _ = filepath.Abs(filepath.Dir(filepath.Dir(os.Args[0])+\"/config\") + \"/\" + filepath.Clean(Settings.Certificate.KeyFile))\n}", "title": "" }, { "docid": "31c34acb72535f40ec030263e459cda8", "score": "0.5958613", "text": "func Init() {\n\trlog.Debug(\"INIT: module_manager\")\n\n\tEventCh = make(chan Event, 1)\n\treturn\n}", "title": "" }, { "docid": "ea2991e9612987a7d28ae3ffe7f31700", "score": "0.5946877", "text": "func Init(c *conf.Config, s *service.Service) {\n\tassSvc = service.New(c)\n\tverifySvc = verify.New(nil)\n\tengineInner := bm.DefaultServer(c.BM)\n\tinnerRouter(engineInner)\n\tif err := engineInner.Start(); err != nil {\n\t\tlog.Error(\"engineInner.Start() error(%v) | config(%v)\", err, c)\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "370147f3f1a6a9ecc459076abd9e76b7", "score": "0.5942529", "text": "func Init(logger *zap.Logger, config modules.ModuleConfig) error {\n\treturn nil\n}", "title": "" }, { "docid": "430955f244e7584b5d060ddb618b87f4", "score": "0.59423447", "text": "func (b *MockBroker) InitConfig() {\n\n}", "title": "" }, { "docid": "0150608c14b333cf9aabdc9f096b60b0", "score": "0.594052", "text": "func init() {\n\tpluginArgs = &factory.PluginFactoryArgs{}\n}", "title": "" }, { "docid": "fddeff04e1efe0a0c1608cb19eb0f206", "score": "0.59374934", "text": "func (ap *AgentProvider) Init() error {\n\tap.pid = strconv.Itoa(os.Getpid())\n\tgosdk.Init()\n\treturn nil\n}", "title": "" }, { "docid": "9c3a46c389999df6d65733cbac46810c", "score": "0.5933565", "text": "func (t *DisasterChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {\n\tfmt.Println(\"Initializing Disaster Management\")\n\tassetid := 1\n\tintByte := []byte(strconv.Itoa(assetid))\n\tstub.PutState(\"assetid\",intByte)\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "7be285fe973a4bd96bac98b7ea435519", "score": "0.59217036", "text": "func init() {\n\tregistry.InstallServiceDiscovery(PilotPlugin, newDiscoveryService)\n}", "title": "" }, { "docid": "1adff43a4870817eb934296243f5a3eb", "score": "0.5910854", "text": "func (orch *DockerOrchestrator) Init(conf map[string]interface{}) (err error) {\n\torch.crt, err = crt.NewDocker()\n\treturn\n}", "title": "" }, { "docid": "076e6c4157c9e15ac48592ee87cd1a94", "score": "0.5910276", "text": "func (c *M3MsgClient) Init() error {\n\treturn nil\n}", "title": "" }, { "docid": "b217bea9f1c1d2933203d8ddb0b2d146", "score": "0.58785236", "text": "func init() {\n\tsimcli.GetSimulatorFlags()\n\tflag.BoolVar(&FlagEnableStreamingValue, \"EnableStreaming\", false, \"Enable streaming service\")\n}", "title": "" }, { "docid": "2d4c504f0794d60b95ec244817f3c61b", "score": "0.58745056", "text": "func init() {\n\t// Load up our `environment variables` from our operating system.\n\tsrAddress := os.Getenv(\"POLLER_SERVER_SERIAL_READER_SERVER_ADDRESS\")\n\tsrPort := os.Getenv(\"POLLER_SERVER_SERIAL_READER_SERVER_PORT\")\n\ttsAddress := os.Getenv(\"POLLER_SERVER_TSTORAGE_SERVER_ADDRESS\")\n\ttsPort := os.Getenv(\"POLLER_SERVER_TSTORAGE_SERVER_PORT\")\n\n\t// Make our environment variable globally accessible throughout all the\n\t// sub-commands in this project.\n\trootCmd.PersistentFlags().StringVar(&serialReaderAddress, \"srAddress\", srAddress, \"The address of the serial reader server this application will connect to.\")\n\trootCmd.PersistentFlags().StringVar(&serialReaderPort, \"srPort\", srPort, \"The port of the serial reader server this application will connect to.\")\n\trootCmd.PersistentFlags().StringVar(&tstorageAddress, \"tsAddress\", tsAddress, \"The address of the tstorage server this application will connect to.\")\n\trootCmd.PersistentFlags().StringVar(&tstoragePort, \"tsPort\", tsPort, \"The port of the tstorage server this application will connect to.\")\n}", "title": "" }, { "docid": "69fab176eecfd5f35cc50cdabae34a73", "score": "0.58713776", "text": "func (p *PMExample) Init() error {\n\tgo p.runExample()\n\treturn nil\n}", "title": "" }, { "docid": "98dad853d2817adbd3ad82a8b4dac717", "score": "0.58661234", "text": "func (p *provider) Init(ctx servicehub.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "a60832e9a278ec9736bd23bf38c5dd96", "score": "0.58619136", "text": "func init() {\n\tmalConfig, err := config.GetConfig()\n\tif err != nil {\n\t\t// If there is an error in parsing config file, malscraper will be\n\t\t// initiated with default mode (no config).\n\t\tMalService = malscraper.Default()\n\t} else {\n\t\tMalService = malscraper.New(malConfig)\n\t}\n}", "title": "" }, { "docid": "0afcdf76d4cd7d3f915032660148d1be", "score": "0.5861205", "text": "func (a *ExampleAgent) Init() error {\n\treturn nil\n}", "title": "" }, { "docid": "b90c97f3b5a86c77e306b46d8bd5df0b", "score": "0.58557516", "text": "func init() {\n\trootCmd.AddCommand(serveCmd)\n}", "title": "" }, { "docid": "966092918e08dd7fb4a813eccb4da7e9", "score": "0.5855685", "text": "func Init() {\n\t// default :\n\t// micro health go.micro.api.gin call this function.\n\tModules.Router.POST(\"/\", NoModules)\n\tModules.Router.GET(\"/\", NoModules)\n\n\t// Media-proxy init client here.\n\te := new( mediaProxy )\n\te.cl = router.DefaultRouter\n\tModules.Router.GET(\"/Preferences/*action\", e.Proxy)\n\t// Examples End\n\n\t// register other handlers here, each request run in goroutine.\n\t// To register others...\n\n\tlog.Info(\"Modules init finished.\")\n}", "title": "" }, { "docid": "cc5ea7ff95041b77903c385cad5d10ef", "score": "0.58550334", "text": "func init() {\n\trunServiceCommand = performServiceCommand\n\twinServiceMain = serviceMain\n}", "title": "" }, { "docid": "e78ca9ec84ea309510e1a3686393705b", "score": "0.585079", "text": "func Init(config *utils.Config) {\n\t// nothing to do here\n}", "title": "" }, { "docid": "92d7218c266e6d5fc81ace581530c9c3", "score": "0.5849356", "text": "func init() {\n\tlogLevel := flag.String(\"log_level\", \"debug\", \"Logging Level\")\n\tlogFile := flag.String(\"log_file\", config.DefaultLogPath, \"Log file path\")\n\tconfigFile := flag.String(\"config\", config.DefaultConfigPath, \"Configuration file path\")\n\n\tflag.StringVar(&endPoint1, \"H1\", dockerUSocket, \"Endpoint (Host1) to connect to\")\n\tflag.StringVar(&endPoint2, \"H2\", dockerUSocket, \"Endpoint (Host2) to connect to\")\n\tflag.StringVar(&volumeName, \"v\", \"TestVol\", \"Volume name to use in sanity tests\")\n\tflag.BoolVar(&removeContainers, \"rm\", true, \"rm container after run\")\n\tflag.StringVar(&driverName, \"d\", \"vmdk\", \"Driver name. We refcount volumes on this driver\")\n\tflag.Parse()\n\n\tusingConfigFileDefaults := logInit(logLevel, logFile, configFile)\n\n\tdefaultHeaders = map[string]string{\"User-Agent\": \"engine-api-client-1.0\"}\n\n\tlog.WithFields(log.Fields{\n\t\t\"driver\": driverName,\n\t\t\"log_level\": *logLevel,\n\t\t\"log_file\": *logFile,\n\t\t\"conf_file\": *configFile,\n\t\t\"using_conf_file_defaults\": usingConfigFileDefaults,\n\t}).Info(\"VMDK plugin tests started \")\n}", "title": "" }, { "docid": "443b137aed665e0d46c8bb3929de0d5e", "score": "0.5847", "text": "func init() {\n\tparser.SharedParser().RegisterFabric(RevokeFabric{})\n}", "title": "" }, { "docid": "93cef9db5d665485afe8b45dbd1137a4", "score": "0.5846936", "text": "func (m *manager) Init(...runtime.Option) error {\n\treturn nil\n}", "title": "" }, { "docid": "a58588126868e9f85b2be1146ca4fcc5", "score": "0.58460534", "text": "func init() {\n\tnetwork.RegisterMessages(Announcement{}, Commitment{}, Challenge{}, Response{}, Stop{})\n\n\tonet.GlobalProtocolRegister(ProtocolName, NewProtocol)\n\tonet.GlobalProtocolRegister(subProtocolName, NewSubProtocol)\n}", "title": "" }, { "docid": "3f9124813ba3141c5af7068d1264af3e", "score": "0.5841941", "text": "func Init(c *conf.Config) {\n\tsignCfg = c.Cfg.AuditSign\n\tinitService(c)\n\t// init outer router\n\tengineOut := bm.NewServer(c.HTTPServer)\n\tengineOut.Use(bm.Recovery(), bm.Trace(), bm.Logger(), bm.Mobile())\n\touterRouter(engineOut)\n\tif err := engineOut.Start(); err != nil {\n\t\tlog.Error(\"engineOut.Start error(%v)\", err)\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "c75384050c8b46388353a4cc8bcd44ad", "score": "0.58401155", "text": "func (h *NsHandler) Init(logger logging.PluginLogger, sysHandler SystemAPI, msChan chan *MicroserviceCtx,\n\tifNotif chan *MicroserviceEvent) error {\n\t// Logger\n\th.log = logger.NewLogger(\"-ns-handler\")\n\n\t// Init channels\n\th.microserviceChan = msChan\n\th.ifMicroserviceNotif = ifNotif\n\n\th.ctx, h.cancel = context.WithCancel(context.Background())\n\n\th.microServiceByLabel = make(map[string]*Microservice)\n\th.microServiceByID = make(map[string]*Microservice)\n\n\t// System handler\n\th.sysHandler = sysHandler\n\n\t// Default namespace\n\tvar err error\n\th.defaultNs, err = netns.Get()\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to init default namespace: %v\", err)\n\t}\n\n\t// Docker client\n\th.dockerClient, err = docker.NewClientFromEnv()\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to get docker client instance from the environment variables: %v\", err)\n\t}\n\th.log.Debugf(\"Using docker client endpoint: %+v\", h.dockerClient.Endpoint())\n\n\t// Create config namespace (for VETHs)\n\tif err = h.prepareConfigNamespace(); err != nil {\n\t\treturn errors.Errorf(\"failed to prepare config namespace: %v\", err)\n\t}\n\n\t// Start microservice tracker\n\tgo h.trackMicroservices(h.ctx)\n\n\th.log.Infof(\"Namespace handler plugin initialized\")\n\n\treturn nil\n}", "title": "" }, { "docid": "19df142d659a6b5b4c3f45a2439bf014", "score": "0.5834291", "text": "func (h *hyper) init(ctx context.Context, sandbox *Sandbox, config interface{}) (err error) {\n\t// save\n\th.ctx = ctx\n\n\tswitch c := config.(type) {\n\tcase HyperConfig:\n\t\t// Create agent sockets from paths provided through\n\t\t// configuration, or generate them from scratch.\n\t\th.generateSockets(sandbox, c)\n\n\t\th.sandbox = sandbox\n\tdefault:\n\t\treturn fmt.Errorf(\"Invalid config type\")\n\t}\n\n\th.proxy, err = newProxy(sandbox.config.ProxyType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\th.shim, err = newShim(sandbox.config.ShimType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Fetch agent runtime info.\n\tif err := sandbox.store.Load(store.Agent, &h.state); err != nil {\n\t\th.Logger().Debug(\"Could not retrieve anything from storage\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f57a6b1d2c55c748c05f22ab7e25e505", "score": "0.5833453", "text": "func Init(projectID, nodeID string, eventing model.EventingRealtimeInterface, auth model.AuthRealtimeInterface, crud model.CrudRealtimeInterface, schema schemaInterface, metrics *metrics.Module, syncMan *syncman.Manager) (*Module, error) {\n\t// Create a new pubsub client\n\tpubsubClient, err := pubsub.New(projectID, os.Getenv(\"REDIS_CONN\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm := &Module{project: projectID, nodeID: nodeID, syncMan: syncMan,\n\t\teventing: eventing, auth: auth, crud: crud, schema: schema, metrics: metrics, pubsubClient: pubsubClient}\n\n\t// Start the internal routines\n\tgo m.routineHandleMessages()\n\n\treturn m, nil\n}", "title": "" }, { "docid": "49991a06b8ed1db503bda4442fa1a1a5", "score": "0.5831624", "text": "func init() {\n\tif hasGenConfig {\n\t\tRegisterStructsForEncodeDecode(encoderId)\n\t\tStartServer()\n\t}\n}", "title": "" }, { "docid": "779c1644c49a2921fc4a8ed8bf801401", "score": "0.58298004", "text": "func init() {\n\tcontrol.Register(BlockIOController, \"Block I/O controller\", getBlockIOController())\n\tconfig.GetModule(blockio.ConfigModuleName).AddNotify(getBlockIOController().configNotify)\n}", "title": "" }, { "docid": "02158b7b9d7908f23d4c069d57dbc201", "score": "0.5826045", "text": "func init() {\n\tconfigObj.Read()\n\n\tdaoObj.Server = configObj.Server\n\tdaoObj.Database = configObj.Database\n\tdaoObj.Connect()\n}", "title": "" }, { "docid": "9cdaf6a56ae0d1a5f27d10c9a3cca774", "score": "0.5825632", "text": "func init() {\n\tdefaultClientBuilder = &clientBuilder{\n\t\terrorLogger: defaultClientErrorHandler,\n\t}\n\tsender = GetMetricsSender()\n}", "title": "" }, { "docid": "82b2fd0c1ff1ad0969cd7aa60e603da7", "score": "0.58224916", "text": "func Initialize() {\n\tsend = channels.NewInfiniteChannel()\n\tcatalog = NewCatalog()\n\n\tgo stream()\n}", "title": "" }, { "docid": "0966a32a83118ab051337a835bd5eb27", "score": "0.5810918", "text": "func Init(options *types.Options) {\n\t_ = protocolinit.Init(options)\n}", "title": "" }, { "docid": "2d4faba7f5299b73639f919f1b756e59", "score": "0.5810542", "text": "func init() {\n\tif IsProduction() {\n\t\tconfig := zap.NewProductionConfig()\n\t\tconfig.OutputPaths = []string{\n\t\t\t\"/var/log/pdagent/pdagent.log\",\n\t\t}\n\t\tBaseLogger, _ = config.Build()\n\t} else {\n\t\tBaseLogger, _ = zap.NewDevelopment()\n\t}\n\n\tLogger = BaseLogger.Sugar()\n}", "title": "" }, { "docid": "344b5a704bb274783b90d60cfeb6e88b", "score": "0.5806344", "text": "func Init(c *conf.Config, cs *service.Canal) {\n\tinitService(cs)\n\t// init router\n\teg := bm.DefaultServer(c.BM)\n\tinitRouter(eg)\n\t// init Outer serve\n\tif err := eg.Start(); err != nil {\n\t\tlog.Error(\"bm.DefaultServer error(%v)\", err)\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "c5805d48168310f94ebc34b802899485", "score": "0.57990056", "text": "func init() {\n\tgConfig = conf.NewConfig()\n}", "title": "" }, { "docid": "8c9d794e8773cb3cc3dee89255742162", "score": "0.57893974", "text": "func init() {\n\n\t//config for app\n\tConfig.SetByMapWithPrefix(\"app\",map[string]string{\n\t\t\"port\" : \"8080\",\n\t})\n\n\t//config for database\n\tConfig.SetByMapWithPrefix(\"database\",map[string]string {\n\n\t\t\"host\" : core.Env(\"db.host\",\"127.0.0.1\"),\n\n\t\t\"port\" : core.Env(\"db.port\",\"3306\"),\n\n\t\t\"database\" : core.Env(\"db.database\",\"dbname\"),\n\n\t\t\"user\" : core.Env(\"db.user\",\"root\"),\n\n\t\t\"password\" : core.Env(\"db.password\",\"123456\"),\n\t})\n}", "title": "" }, { "docid": "b3a8f7d2334e935ec8511162d7837cc0", "score": "0.578652", "text": "func (r *Manager) Initialize() {\n\tc := reflector.Client{}\n\terr := c.Connect(r.reflector)\n\tif err != nil {\n\t\tlogger.Log().Errorf(\"reflection was NOT initialized, cannot connect to reflector: %v\", err)\n\t\treturn\n\t}\n\tr.uploader = &c\n\tlogger.Log().Infof(\"manager initialized\")\n}", "title": "" }, { "docid": "18592b70fd10e72c47d6e72f5840b176", "score": "0.5785868", "text": "func (x *Application) NorthstarInit() {\n\tnorthstarconf := x.Config.GetStringMap(fmt.Sprintf(\"%s.northstar\", x.ENV))\n\n\tx.Northstar = northstarlib.NorthstarLib{\n\t\tHost: App.Kafka.Host,\n\t\tSecret: northstarconf[\"secret\"].(string),\n\t\tTopic: northstarconf[\"topic\"].(string),\n\t\tSend: northstarconf[\"send\"].(bool),\n\t\tSaramaConfig: App.Kafka.Config,\n\t}\n}", "title": "" }, { "docid": "60cba01dd6b4d61e6aef084b7a71b515", "score": "0.5784718", "text": "func init() {\n\t// Commands\n\trootCmd.AddCommand(setCmd)\n\trootCmd.AddCommand(getCmd)\n\trootCmd.AddCommand(scanCmd)\n\n\t// Flags\n\trootCmd.PersistentFlags().StringP(\"region\", \"r\", \"\", \"aws region/all\")\n\trootCmd.PersistentFlags().StringP(\"out\", \"o\", \"text\", \"Output text/json\")\n\trootCmd.PersistentFlags().Bool(\"slack\", false, \"send custom webhook slack message for monitor\")\n\t// rootCmd.PersistentFlags().StringP(\"type\", \"t\", \"instance\", \"instance/cluster\")\n}", "title": "" }, { "docid": "39ad3b9033b25c0d39e3533aa0bf740e", "score": "0.57806563", "text": "func (sm *SubscriptionManager) Init(mgr manager.Manager) error {\n\tif len(sm.envCfg.URL) == 0 {\n\t\treturn xerrors.Errorf(\"env var URL must be a non-empty value\")\n\t}\n\tsm.mgr = mgr\n\tsm.namedLogger().Info(\"initialized JetStream subscription manager\")\n\treturn nil\n}", "title": "" }, { "docid": "90cca9f67cb8f8110a578685542106f9", "score": "0.577909", "text": "func init() {\n\tconfig.Read()\n\n\tdao.Server = config.Server\n\tdao.Database = config.Database\n\tdao.Connect()\n\n}", "title": "" }, { "docid": "c3a7668734060b8d774b147d7a2a2bb7", "score": "0.5778572", "text": "func init() {\n\torchprovider.RegisterOrchProvider(\n\t\t// A variant of nomad orchestrator plugin\n\t\tv1nomad.DefaultNomadPluginName,\n\t\t// Below is a functional implementation that holds the initialization\n\t\t// logic of nomad orchestrator plugin\n\t\t//\n\t\t// TODO\n\t\t// The region, config options should not be used as they are meant to be\n\t\t// dynamic. They should be available as profiles. Once that happens, any\n\t\t// instance of nomad orchestrator should do these jobs. Hence, variants will\n\t\t// no longer be required.\n\t\tfunc(name string, region string, config io.Reader) (orchprovider.OrchestratorInterface, error) {\n\t\t\treturn NewNomadOrchestrator(name, region, config)\n\t\t})\n}", "title": "" }, { "docid": "cfe0d6960d88f1d7fad0defeaa9675cd", "score": "0.57668775", "text": "func (s *Spanner) Setup() {}", "title": "" }, { "docid": "51af11a5336545ddcbbd1d334bcf7b8f", "score": "0.5765504", "text": "func (t *PodHandler) Init() error {\n\tlog.Info(\"PodHandler.Init\")\n\treturn nil\n}", "title": "" }, { "docid": "63430266585253ed57f874180ab1ffa5", "score": "0.5763362", "text": "func (p *Plugin) Init() error {\n\tp.configurator.log = p.Log.NewLogger(\"configurator\")\n\tp.configurator.dumpService.log = p.Log.NewLogger(\"dump\")\n\tp.configurator.notifyService.log = p.Log.NewLogger(\"notify\")\n\tp.configurator.dispatch = p.Dispatch\n\n\tif err := p.initHandlers(); err != nil {\n\t\treturn err\n\t}\n\n\tgrpcServer := p.GRPCServer.GetServer()\n\tif grpcServer != nil {\n\t\trpc.RegisterConfiguratorServer(grpcServer, &p.configurator)\n\t}\n\n\tif p.VPPIfPlugin != nil {\n\t\tp.VPPIfPlugin.SetNotifyService(func(vppNotification *vpp.Notification) {\n\t\t\tp.configurator.notifyService.pushNotification(&rpc.Notification{\n\t\t\t\tNotification: &rpc.Notification_VppNotification{\n\t\t\t\t\tVppNotification: vppNotification,\n\t\t\t\t},\n\t\t\t})\n\t\t})\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "107a51e40451e016ae712d9576b9b36a", "score": "0.5763284", "text": "func (app *apiServer) init() {\n\t// make sure to capture version request and rescan depth\n\tflag.BoolVar(&app.isVersionReq, \"v\", false, \"get the application version\")\n\n\t// get the configuration including parsing the calling flags\n\tvar err error\n\tapp.cfg, err = config.Load()\n\tif nil != err {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\n\t// configure logger based on the configuration\n\tapp.log = logger.New(app.cfg)\n\tapp.closed = make(chan interface{})\n\n\t// make sure to pass logger and config to internals\n\trepository.SetConfig(app.cfg)\n\trepository.SetLogger(app.log)\n\tresolvers.SetConfig(app.cfg)\n\tresolvers.SetLogger(app.log)\n\tsvc.SetConfig(app.cfg)\n\tsvc.SetLogger(app.log)\n\n\t// make the HTTP server\n\tapp.makeHttpServer()\n}", "title": "" }, { "docid": "6a67a4b17fabb81556f006f508db5cf3", "score": "0.5763248", "text": "func (m *mockSubscribePubSub) Init(metadata pubsub.Metadata) error {\n\tm.handlers = make(map[string]pubsub.Handler)\n\tm.pubCount = make(map[string]int)\n\treturn nil\n}", "title": "" }, { "docid": "7ce6cb4c26a9c76ae2f4309f961adaf5", "score": "0.5762464", "text": "func init() {\n\tif iot.NewClient == nil {\n\t\tiot.NewClient = NewClient\n\t}\n}", "title": "" }, { "docid": "ab481004d5e0e9e150e716c5757a06ce", "score": "0.57604855", "text": "func Init(c *conf.Config, s *service.Service) {\n\tsrv = s\n\t// init inner router\n\t// engine\n\tengIn := bm.DefaultServer(c.BM)\n\tinnerRouter(engIn)\n\t// init inner server\n\tif err := engIn.Start(); err != nil {\n\t\tlog.Error(\"bm.DefaultServer error(%v)\", err)\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "f7fa67e1e200347ed3468afca0ff98a8", "score": "0.57582444", "text": "func (_this *Unmarshaler) Init(opts *options.CBEUnmarshalerOptions) {\n\topts = opts.WithDefaultsApplied()\n\t_this.opts = *opts\n\t_this.Session = builder.NewSession(nil, &_this.opts.Session)\n\t_this.decoder.Init(&_this.opts.Decoder)\n}", "title": "" }, { "docid": "ddb485cb78893e5ede95ef2f69ecc039", "score": "0.57561487", "text": "func init() {\n\tdeviceCmd.AddCommand(devicePrepareCmd)\n\tdevicePrepareCmd.Flags().BoolVarP(&devicePrepareOptimize, \"optimize\", \"o\", false, \"Optimize the preparation\")\n\tdevicePrepareCmd.Flags().BoolVarP(&devicePrepareEmbed, \"embed\", \"e\", false, \"Embed configuration into the application\")\n}", "title": "" }, { "docid": "00b69ccb130619da8f79dc6aa03eb266", "score": "0.57508975", "text": "func (provider *DNSProvider) Init(conf *settings.Settings) {\n\tprovider.configuration = conf\n}", "title": "" }, { "docid": "e5013c67110ceef13ee126f0cfdf6928", "score": "0.5748376", "text": "func Init(user, pass, server string) {\n\trpcConf = config.New(user, pass, server)\n\tcallId = 0\n}", "title": "" }, { "docid": "34e3c5163dc096a1da0fb112baae9b41", "score": "0.5747748", "text": "func init() {\n\tmd := trigger.NewMetadata(jsonMetadata)\n\ttrigger.RegisterFactory(md.ID, NewFactory(md))\n}", "title": "" }, { "docid": "ef190d93920b0177be3d57cf89985cfb", "score": "0.5739671", "text": "func init() {\n\tdrmaa2os.RegisterJobTracker(drmaa2os.RemoteSession, NewAllocator())\n}", "title": "" }, { "docid": "63e21f3de0b462d134abb393364eeb52", "score": "0.5739254", "text": "func init() {\n\tconfig.Read()\n\n\tdao.Server = config.Server\n\tdao.Database = config.Database\n\tdao.Connect()\n}", "title": "" }, { "docid": "63e21f3de0b462d134abb393364eeb52", "score": "0.5739254", "text": "func init() {\n\tconfig.Read()\n\n\tdao.Server = config.Server\n\tdao.Database = config.Database\n\tdao.Connect()\n}", "title": "" }, { "docid": "c4e74f1f3414ce0917f861223361c442", "score": "0.57373285", "text": "func (i *I2PSwarmPlugin) Init() error {\n\tvar err error\n\ti, err = Setup()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = i.configGateway()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ti.i2pconfig, err = i.i2pconfig.Save(i.configPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1dd0d37fe47e341e7173ecde29e803de", "score": "0.5734685", "text": "func (s *Service) Init() {\n}", "title": "" }, { "docid": "5f82db7f6aab12259c2eaa9cf938ad94", "score": "0.57254565", "text": "func init() {\n\tpolochon.RegisterModule(&Eztv{})\n}", "title": "" }, { "docid": "8e1a7c1604e54bed511352a6573b5ef9", "score": "0.5722765", "text": "func init() {\n\t_ = pkger.Include(embeddedPath)\n}", "title": "" }, { "docid": "250e8bba4af758f1721875cf06819bc0", "score": "0.57203466", "text": "func (a *Agent) Init(name string, ndkAddress string, yangRoot string) {\n\tvar err error\n\n\t// Set up a connection to the server.\n\tconn, err := grpc.Dial(ndkAddress, grpc.WithInsecure(), grpc.WithBlock())\n\tif err != nil {\n\t\tlog.Fatalf(\"did not connect: %v\", err)\n\t}\n\n\t// Set up base service client\n\tclient := protos.NewSdkMgrServiceClient(conn)\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\t// Set up agent name\n\tctx = metadata.AppendToOutgoingContext(ctx, \"agent_name\", name)\n\n\t// Register agent with NDK manager\n\tr, err := client.AgentRegister(ctx, &protos.AgentRegistrationRequest{})\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not register: %v\", err)\n\t}\n\tlog.Infof(\"Agent registration status: %s AppId: %d\\n\", r.Status, r.GetAppId())\n\n\ta.Name = name\n\ta.GrpcConn = conn\n\ta.Client = client\n\ta.OwnAppID = r.GetAppId()\n\ta.YangRoot = yangRoot\n\t// agent = Agent{\n\t// \tName: name,\n\t// \tGrpcConn: conn,\n\t// \tClient: client,\n\t// \tOwnAppID: r.GetAppId(),\n\t// }\n\n\t// agent.CfgTranxMap = make(map[string][]CfgTranxEntry)\n\ta.CfgTranxMap = make(map[string][]CfgTranxEntry)\n\n\tsubscribeStreams(a)\n\n\t// return &agent, err\n}", "title": "" }, { "docid": "cd3b78a2f10a4fdf6bdc645a031dbada", "score": "0.57190716", "text": "func init() {\n\trp := &vswitch.RingParam{\n\t\tCount: MbufLen,\n\t\tSocketId: dpdk.SOCKET_ID_ANY,\n\t}\n\n\tif !vswitch.RegisterModule(\"vif\", newVifModule, rp, vswitch.TypeVif) {\n\t\tlog.Fatalf(\"Failed to register the module.\")\n\t}\n}", "title": "" }, { "docid": "f2fa6491b921a9be0a9b783915846bb5", "score": "0.5715698", "text": "func (t *OrderManagementChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {\n\tfmt.Println(\"Answer Store Channel Is Starting Up\")\n\tfuncName, args := stub.GetFunctionAndParameters()\n\tvar err error\n\ttxId := stub.GetTxID()\n\n\tfmt.Println(\" Init() is running\")\n\tfmt.Println(\" Transaction ID: \", txId)\n\tfmt.Println(\" GetFunctionAndParameters() function: \", funcName)\n\tfmt.Println(\" GetFunctionAndParameters() args count: \", len(args))\n\tfmt.Println(\" GetFunctionAndParameters() args found: \", args)\n\n\t// expecting 1 arg for instantiate or upgrade\n\tif len(args) == 2 {\n\t\tfmt.Println(\" GetFunctionAndParameters() : Number of arguments\", len(args))\n\t}\n\n\terr = stub.PutState(args[0], []byte(args[1]))\n\tif err != nil {\n\t\treturn shim.Error(err.Error()) //self-test fail\n\t}\n\n\tfmt.Println(\"Ready for action\") //self-test pass\n\treturn shim.Success(nil)\n}", "title": "" } ]
0bd0864b2c816b00b3401fd06b1bf48b
Set the field offset
[ { "docid": "225d2716cc22223614ed8deb2bb906bc", "score": "0.664479", "text": "func (fm *FieldModelStructNested) SetFBEOffset(value int) { fm.offset = value }", "title": "" } ]
[ { "docid": "08aee682a9c708a349ddd91b7f56ef67", "score": "0.6933503", "text": "func (m TranslateOffsetMap) SetFieldOffset(index, name string, offset uint64) {\n\tif m[index] == nil {\n\t\tm[index] = NewIndexTranslateOffsetMap()\n\t}\n\tm[index].Fields[name] = offset\n}", "title": "" }, { "docid": "08aee682a9c708a349ddd91b7f56ef67", "score": "0.6933503", "text": "func (m TranslateOffsetMap) SetFieldOffset(index, name string, offset uint64) {\n\tif m[index] == nil {\n\t\tm[index] = NewIndexTranslateOffsetMap()\n\t}\n\tm[index].Fields[name] = offset\n}", "title": "" }, { "docid": "480255794db9a7e11096f11c478d4a23", "score": "0.6754112", "text": "func (fm *FieldModelUUID) SetFBEOffset(value int) { fm.offset = value }", "title": "" }, { "docid": "aa4fb8b39965f62caefef267722d65f6", "score": "0.6700682", "text": "func (fm *FieldModelFlagsSimple) SetFBEOffset(value int) { fm.offset = value }", "title": "" }, { "docid": "24d8bd4fae29577f767d9b41a48da4e1", "score": "0.659384", "text": "func (obj *Positioner) SetOffset(x int32, y int32) {\n\tobj.Conn().SendRequest(obj, 6, x, y)\n}", "title": "" }, { "docid": "4e5e6b64a4717d520be14a43e35bb5b2", "score": "0.6584878", "text": "func (m *CoachmarkLocation) SetOffset(value *int32)() {\n err := m.GetBackingStore().Set(\"offset\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c7b0c8d3c48f5af60ac03918a14715fe", "score": "0.65447474", "text": "func (_options *QueryOptions) SetOffset(offset int64) *QueryOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "f8f8e0fcd3dee205444b7a684bdc70b1", "score": "0.6530513", "text": "func (fm *FinalModelStructList) SetFBEOffset(value int) { fm.offset = value }", "title": "" }, { "docid": "fdb2212297642b7336ad6085a02e2fb5", "score": "0.64626694", "text": "func (_options *FederatedQueryOptions) SetOffset(offset int64) *FederatedQueryOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "5299823b70e854f402c6cf5e6b21b8c3", "score": "0.6460758", "text": "func offset(fieldSpec *fieldSpec, value uint8) uint8 {\n\tif fieldSpec.Min == 0 {\n\t\treturn value + 1\n\t} else {\n\t\treturn value\n\t}\n}", "title": "" }, { "docid": "b5e47a8cd3bee4cd8f1b60abf5910aa3", "score": "0.64436513", "text": "func (s *dataStore) setOffset(id string, offset int64) error {\n\ts.infoLock(id).Lock()\n\tdefer s.infoLock(id).Unlock()\n\n\tinfo, err := s.getInfo(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// never decrement the offset\n\tif info.Offset >= offset {\n\t\treturn nil\n\t}\n\n\tinfo.Offset = offset\n\treturn s.writeInfo(id, info)\n}", "title": "" }, { "docid": "87590f4565972a591896a6021329154a", "score": "0.6427201", "text": "func (n *Null) SetOffset(val int64) error {\n\treturn nil\n}", "title": "" }, { "docid": "bdf11275ccaf74a480f8b4f511737b9c", "score": "0.6418608", "text": "func (fm *FinalModelOptionalInt16) SetFBEOffset(value int) { fm.offset = value }", "title": "" }, { "docid": "4c6812c2140b1f89afe2a0d79d590bea", "score": "0.6385292", "text": "func (fm *FieldModelEnumTyped) SetFBEOffset(value int) { fm.offset = value }", "title": "" }, { "docid": "0eb0d9ce463fe989ec830f3d3535d770", "score": "0.6375722", "text": "func SetOffset(count, offset int) Offsetter {\n\treturn func(ofs *offsetRequest) {\n\t\tofs.Count = count\n\t\tofs.Offset = offset\n\t}\n}", "title": "" }, { "docid": "7be4ac4c78cf419c1861491c6be891a3", "score": "0.6362945", "text": "func (_options *GetLocksOptions) SetOffset(offset int64) *GetLocksOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "d7bc777af032b9815304aac6cb2fae49", "score": "0.6262633", "text": "func (_options *QueryLogOptions) SetOffset(offset int64) *QueryLogOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "f78d4042e31bab4ccd0f642a8b9e8978", "score": "0.62604773", "text": "func (fm *FinalModelEnumInt8) SetFBEOffset(value int) { fm.offset = value }", "title": "" }, { "docid": "e7940f3d75663423d27f8d4adea5460b", "score": "0.6259352", "text": "func (_options *ListAccessGroupMembersOptions) SetOffset(offset int64) *ListAccessGroupMembersOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "87c0d736e654d09724722cb8a7449326", "score": "0.6248529", "text": "func (_options *GetSecretVersionLocksOptions) SetOffset(offset int64) *GetSecretVersionLocksOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "ceaf06fd91c65403bf7e5659c008fa99", "score": "0.62481725", "text": "func (_options *FederatedQueryNoticesOptions) SetOffset(offset int64) *FederatedQueryNoticesOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "eeda505b0f66980eb6a4080317b8adbc", "score": "0.6239424", "text": "func (p pointer) offset(f field) pointer {\n\t// For safety, we should panic if !f.IsValid, however calling panic causes\n\t// this to no longer be inlineable, which is a serious performance cost.\n\t/*\n\t\tif !f.IsValid() {\n\t\t\tpanic(\"invalid field\")\n\t\t}\n\t*/\n\treturn pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))}\n}", "title": "" }, { "docid": "36860c706007987fc326131a054643db", "score": "0.622385", "text": "func (_options *QueryNoticesOptions) SetOffset(offset int64) *QueryNoticesOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "e000af318c25de9855453e101f04bd10", "score": "0.61647856", "text": "func FieldOffsetFromField(f Field) FieldOffset {\n\treturn fieldFieldOffset(f)\n}", "title": "" }, { "docid": "5c07444639771685b005120da85dc2db", "score": "0.6164105", "text": "func (f *Frequency) SetOffset(offset int) error {\n\tif offset < 0 {\n\t\treturn fmt.Errorf(\"offset %v must be 0 or greater\", offset)\n\t}\n\tf.offset = offset\n\treturn nil\n}", "title": "" }, { "docid": "0263e316b77ef1883e9e621c32c9ac49", "score": "0.6147698", "text": "func (_options *ListSecretsOptions) SetOffset(offset int64) *ListSecretsOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "68a8ddcf50d0ed7a4345876a38642e82", "score": "0.6117486", "text": "func (_options *ListAccessGroupsOptions) SetOffset(offset int64) *ListAccessGroupsOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "66a6aa90921a570ba4dd1ceaccb2aae4", "score": "0.6093232", "text": "func (fm *FieldModelEnumByte) SetFBEOffset(value int) { fm.offset = value }", "title": "" }, { "docid": "d9f94fcb8bd882def13ce4d1805e32a1", "score": "0.6086084", "text": "func (_options *ListAllSecretsOptions) SetOffset(offset int64) *ListAllSecretsOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "8ead2129238cda063f8749eb7d1c6974", "score": "0.60815203", "text": "func (_options *ListInstanceSecretsLocksOptions) SetOffset(offset int64) *ListInstanceSecretsLocksOptions {\n\t_options.Offset = core.Int64Ptr(offset)\n\treturn _options\n}", "title": "" }, { "docid": "c23b023b871df635d37b9a60f0a9df4c", "score": "0.60474193", "text": "func SetOffset(off int) Option {\n\treturn func() (apicalypse.Option, error) {\n\t\tif off < 0 {\n\t\t\treturn nil, ErrOutOfRange\n\t\t}\n\n\t\treturn apicalypse.Offset(off), nil\n\t}\n}", "title": "" }, { "docid": "faeb3848006d91d99f8e1b098988164b", "score": "0.60096973", "text": "func (o *GetWebhookParams) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "9749dcf7a3fef378562dba15f5273788", "score": "0.59561104", "text": "func (s *Scanner) set(o int) {\n\ts.offset = o\n}", "title": "" }, { "docid": "99b5d25ed3c1c13517f7cab56df3481f", "score": "0.5953535", "text": "func (s *FileState) Setoffset(offset int64) *FileState {\n\t//reciever is modified\n\ts.Startoffset = offset\n\treturn s\n}", "title": "" }, { "docid": "d2b0977712ed55e2a54718936ad461f6", "score": "0.59475076", "text": "func (ms ExponentialHistogramDataPointBuckets) SetOffset(v int32) {\n\tms.orig.Offset = v\n}", "title": "" }, { "docid": "51bd3c10d6dba0ed5c2efd60aed7c56c", "score": "0.5939065", "text": "func objectFieldOffset(frame *rtda.Frame) {\n\tvars := frame.LocalVars()\n\tjField := vars.GetRef(1)\n\n\toffset := jField.GetIntVar(\"slot\", \"I\")\n\n\tstack := frame.OperandStack()\n\tstack.PushLong(int64(offset))\n}", "title": "" }, { "docid": "52153101277d64301bd466ec85636e81", "score": "0.5923104", "text": "func (o *GetSchemasParams) SetOffset(offset *int32) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "59e9af9e84a6be8e875cdbb5960c0575", "score": "0.58886975", "text": "func (q *Query) Offset(count int, offset int) *Query {\n\tq.offset.count = count\n\tq.offset.offset = offset\n\treturn q\n}", "title": "" }, { "docid": "1f0fbc71144cfdee4ef262e8bb1b7bfe", "score": "0.5875936", "text": "func (o *GetSearchServicesParams) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "56ade658e2c486d04f93c39c4a69f023", "score": "0.58743066", "text": "func (ftq *FactTypeQuery) Offset(offset int) *FactTypeQuery {\n\tftq.offset = &offset\n\treturn ftq\n}", "title": "" }, { "docid": "0417695abd9b8aa588f01ca47a4b3740", "score": "0.58698565", "text": "func (r ImportErrorApiApiGetImportErrorsRequest) Offset(offset int32) ImportErrorApiApiGetImportErrorsRequest {\n\tr.offset = &offset\n\treturn r\n}", "title": "" }, { "docid": "ac3567612ac50a187affef93940e91c7", "score": "0.58650756", "text": "func (m TranslateOffsetMap) FieldOffset(index, name string) uint64 {\n\tif m[index] == nil {\n\t\treturn 0\n\t}\n\treturn m[index].Fields[name]\n}", "title": "" }, { "docid": "ac3567612ac50a187affef93940e91c7", "score": "0.58650756", "text": "func (m TranslateOffsetMap) FieldOffset(index, name string) uint64 {\n\tif m[index] == nil {\n\t\treturn 0\n\t}\n\treturn m[index].Fields[name]\n}", "title": "" }, { "docid": "235ab0cb2c78811d887cd9ccef8e7c0d", "score": "0.5844649", "text": "func (o *ExtrasImageAttachmentsListParams) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "589a1e815dd02742a7a1ad8defc9b5ca", "score": "0.5820736", "text": "func (self *ComponentBounds) SetOffsetYA(member int) {\n self.Object.Set(\"offsetY\", member)\n}", "title": "" }, { "docid": "2b8bbbb405adc6af9dcb72979841b679", "score": "0.5817996", "text": "func (in *ActionSnapshotDownloadIndexInput) SetOffset(value int64) *ActionSnapshotDownloadIndexInput {\n\tin.Offset = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Offset\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "76b5d3b1b0a5e5e2a896f987d532bc06", "score": "0.58059317", "text": "func (in *ActionLanguageIndexInput) SetOffset(value int64) *ActionLanguageIndexInput {\n\tin.Offset = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Offset\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "b6ddbb20516044464d8bd16a54c21c05", "score": "0.5803587", "text": "func (ipq *InviteePartyQuery) Offset(offset int) *InviteePartyQuery {\n\tipq.offset = &offset\n\treturn ipq\n}", "title": "" }, { "docid": "5d33daca12e989630686d06e5c8fe41c", "score": "0.5792655", "text": "func (mtq *MedicalTypeQuery) Offset(offset int) *MedicalTypeQuery {\n\tmtq.offset = &offset\n\treturn mtq\n}", "title": "" }, { "docid": "549de4d5ca787a4fc46468c4aead564e", "score": "0.57858837", "text": "func (fm *FieldModelUUID) FBEOffset() int { return fm.offset }", "title": "" }, { "docid": "b7338b483c2a2be00d698154202f0de4", "score": "0.5774252", "text": "func (o *ListTicketsParams) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "3375b38b99bca7c40ab40fa393fce59d", "score": "0.57709694", "text": "func (o *GetSearchPatientsParams) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "717453b3a9599fb6c53371f1c4a92288", "score": "0.57670146", "text": "func (in *ActionNetworkIndexInput) SetOffset(value int64) *ActionNetworkIndexInput {\n\tin.Offset = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Offset\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "6f7847e8f62157bfa66485824e12d727", "score": "0.5759786", "text": "func (u *Users) SetOffset(offset int) *Users {\n\tu.offset = offset\n\treturn u\n}", "title": "" }, { "docid": "bd1ca22735346e1874af87f309094ebd", "score": "0.57569546", "text": "func (in *ActionSessionTokenIndexInput) SetOffset(value int64) *ActionSessionTokenIndexInput {\n\tin.Offset = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Offset\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "a80c342cc975c2095e07b4cbacfe896d", "score": "0.5740865", "text": "func Offset(offset int) URLOption {\n\treturn func(v *url.Values) {\n\t\tv.Set(\"page[offset]\", strconv.Itoa(offset))\n\t}\n}", "title": "" }, { "docid": "8c0a23fb6b4cc6a506dd685c77de76bd", "score": "0.57293904", "text": "func (o *ExportSearchAbsoluteChunkedParams) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "e885b337496cc5a8837247f468c20068", "score": "0.57265", "text": "func (t *Type) FieldOff(i int) int64 {\n\tif s := t.Struct(); s == nil {\n\t\tpanic(\"FieldOff can only be called with Struct's\")\n\t} else {\n\t\tif s.NumFields() <= i {\n\t\t\tpanic(\"Invalid field #\")\n\t\t}\n\t\tstd := StdSizes()\n\t\tfield := s.Field(int(i))\n\t\toffsets := std.Offsetsof([]*types.Var{field})\n\t\treturn offsets[0]\n\t}\n}", "title": "" }, { "docid": "72a58d79d1e3d6f23e7ae339a7f41743", "score": "0.5724407", "text": "func (b *SelectBuilder) Offset(offset uint64) *SelectBuilder {\n\tb.offset = offset\n\tb.offsetValid = true\n\treturn b\n}", "title": "" }, { "docid": "836a6e0fbfd81ff057e478a5e2e8178f", "score": "0.5713969", "text": "func (p *interp) setField(index int, value string) error {\n\tif index == 0 {\n\t\tp.setLine(value)\n\t\treturn nil\n\t}\n\tif index < 0 {\n\t\treturn newError(\"field index negative: %d\", index)\n\t}\n\tif index > maxFieldIndex {\n\t\treturn newError(\"field index too large: %d\", index)\n\t}\n\t// If there aren't enough fields, add empty string fields in between\n\tfor i := len(p.fields); i < index; i++ {\n\t\tp.fields = append(p.fields, \"\")\n\t}\n\tp.fields[index-1] = value\n\tp.numFields = len(p.fields)\n\tp.line = strings.Join(p.fields, p.outputFieldSep)\n\treturn nil\n}", "title": "" }, { "docid": "6264ce185d125bbb4b3ed2d3dcd62478", "score": "0.5713627", "text": "func (o *APIPageParam) SetOffset(v int32) {\n\to.Offset = &v\n}", "title": "" }, { "docid": "7063a101aac9a0543617627fd20d6996", "score": "0.57123876", "text": "func (arq *AuthRequestQuery) Offset(offset int) *AuthRequestQuery {\n\tarq.offset = &offset\n\treturn arq\n}", "title": "" }, { "docid": "ee86885c6044248f820346488a430aa4", "score": "0.5709023", "text": "func (fm *FieldModelStructNested) FBEOffset() int { return fm.offset }", "title": "" }, { "docid": "d8cb9f3befcdb776d16726843ece4710", "score": "0.5695808", "text": "func (dq *DoctorQuery) Offset(offset int) *DoctorQuery {\n\tdq.offset = &offset\n\treturn dq\n}", "title": "" }, { "docid": "661ce13535b6ea9096771fa2a4c5afa5", "score": "0.5692585", "text": "func (swq *StartWorkQuery) Offset(offset int) *StartWorkQuery {\n\tswq.offset = &offset\n\treturn swq\n}", "title": "" }, { "docid": "02b535496886721218cf71ba32595329", "score": "0.56872606", "text": "func (trq *TcpRuleQuery) Offset(offset int) *TcpRuleQuery {\n\ttrq.offset = &offset\n\treturn trq\n}", "title": "" }, { "docid": "75ad347464760e50284e2346f355b5d4", "score": "0.5685033", "text": "func (frq *FlowReasonQuery) Offset(offset int) *FlowReasonQuery {\n\tfrq.offset = &offset\n\treturn frq\n}", "title": "" }, { "docid": "050c63d74094e67c7dc037dec8c09f97", "score": "0.5683247", "text": "func (eptq *EquipmentPortTypeQuery) Offset(offset int) *EquipmentPortTypeQuery {\n\teptq.offset = &offset\n\treturn eptq\n}", "title": "" }, { "docid": "e353961212e4242b8c96be7a5842cae5", "score": "0.567567", "text": "func (q *Query) Offset(offset int) *Query {\n\tq = q.clone()\n\tif offset < 0 {\n\t\tq.err = errors.New(\"datastore: negative query offset\")\n\t\treturn q\n\t}\n\tif offset > math.MaxInt32 {\n\t\tq.err = errors.New(\"datastore: query offset overflow\")\n\t\treturn q\n\t}\n\tq.offset = int32(offset)\n\treturn q\n}", "title": "" }, { "docid": "9870a1836c91318fc4b9f15a503e9b8a", "score": "0.567232", "text": "func (b *UpdateBuilder) Offset(offset uint64) *UpdateBuilder {\n\tb.offsetCount = offset\n\tb.offsetValid = true\n\treturn b\n}", "title": "" }, { "docid": "a8e72bfeff1412d07c62664f9717c731", "score": "0.56696177", "text": "func (rq *RequisitionQuery) Offset(offset int) *RequisitionQuery {\n\trq.offset = &offset\n\treturn rq\n}", "title": "" }, { "docid": "2d207fb7533b1c2a929a806298f25fd4", "score": "0.5663454", "text": "func (rc RecordCollection) Offset(offset int) RecordCollection {\n\trc.query = rc.query.clone()\n\trc.query.offset = offset\n\treturn rc\n}", "title": "" }, { "docid": "1932144cb132e3c1fd4d1a08b468c512", "score": "0.5660885", "text": "func (b *UtilsGetLastShortenedLinksBuilder) Offset(v int) *UtilsGetLastShortenedLinksBuilder {\n\tb.Params[\"offset\"] = v\n\treturn b\n}", "title": "" }, { "docid": "fe3002ed2c14329e1e01565b8c0df11a", "score": "0.5656787", "text": "func (sl *Slice) SetPos(p int) {\n\tif p >= int(sl.n-sl.m) {\n\t\tsl.p = sl.n\n\t}\n\tsl.p = sl.m + byte(p)\n}", "title": "" }, { "docid": "b3f9bab44581573d8b7e82bdc5c8dcc8", "score": "0.564866", "text": "func (weq *WorkExperienceQuery) Offset(offset int) *WorkExperienceQuery {\n\tweq.offset = &offset\n\treturn weq\n}", "title": "" }, { "docid": "7c8787366197992401b2389483bf6119", "score": "0.5645192", "text": "func (sedq *ServiceEndpointDefinitionQuery) Offset(offset int) *ServiceEndpointDefinitionQuery {\n\tsedq.offset = &offset\n\treturn sedq\n}", "title": "" }, { "docid": "d14e497548e3fbfb3ca2ac50a41bed09", "score": "0.5644302", "text": "func (self *ComponentBounds) SetOffsetXA(member int) {\n self.Object.Set(\"offsetX\", member)\n}", "title": "" }, { "docid": "f209fe1311adf24d0c0c2e7f7a6944db", "score": "0.5631371", "text": "func (dq *DentalappointmentQuery) Offset(offset int) *DentalappointmentQuery {\n\tdq.offset = &offset\n\treturn dq\n}", "title": "" }, { "docid": "9b874099e79c641f4cc6b49a4a6463d0", "score": "0.5628152", "text": "func tagToOffset(field reflect.StructField) int64 {\n\trawOffset := field.Tag.Get(\"offset\")\n\toffset, err := strconv.ParseInt(rawOffset, 0, 16)\n\tif err != nil {\n\t\treturn -1\n\t}\n\treturn offset\n}", "title": "" }, { "docid": "abc446b85465b0681c08fafacbb1617a", "score": "0.56269634", "text": "func (o *DcimPowerPanelsListParams) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "6b0500f0d416a51d06ecad910507e36f", "score": "0.5622886", "text": "func (j *JSONQ) Offset(offset int) *JSONQ {\n\tj.offsetRecords = offset\n\treturn j\n}", "title": "" }, { "docid": "f865e119f57e2a2cf25cdb02262f2dc9", "score": "0.5622149", "text": "func (o *PoliciesFilters) SetOffset(v int32) {\n\to.Offset = &v\n}", "title": "" }, { "docid": "e5fa9e45d3c32af36378ccd2058b2dd9", "score": "0.5621238", "text": "func (fm *FieldModelStructNested) SetBegin() (int, error) {\n if (fm.buffer.Offset() + fm.FBEOffset() + fm.FBESize()) > fm.buffer.Size() {\n return 0, errors.New(\"model is broken\")\n }\n\n fbeStructSize := fm.FBEBody()\n fbeStructOffset := fm.buffer.Allocate(fbeStructSize) - fm.buffer.Offset()\n if (fbeStructOffset <= 0) || ((fm.buffer.Offset() + fbeStructOffset + fbeStructSize) > fm.buffer.Size()) {\n return 0, errors.New(\"model is broken\")\n }\n\n fbe.WriteUInt32(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset(), uint32(fbeStructOffset))\n fbe.WriteUInt32(fm.buffer.Data(), fm.buffer.Offset() + fbeStructOffset, uint32(fbeStructSize))\n fbe.WriteUInt32(fm.buffer.Data(), fm.buffer.Offset() + fbeStructOffset + 4, uint32(fm.FBEType()))\n\n fm.buffer.Shift(fbeStructOffset)\n return fbeStructOffset, nil\n}", "title": "" }, { "docid": "eb2e6acc86d2e17f8e7e7f4bf3f3da72", "score": "0.56185347", "text": "func (pq *PartorderQuery) Offset(offset int) *PartorderQuery {\n\tpq.offset = &offset\n\treturn pq\n}", "title": "" }, { "docid": "d7d367542f71f8812258f4c69009c2c5", "score": "0.56092244", "text": "func (o *GetComplianceByRulesParams) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "292f76be020f50b90af0a23bc5592f32", "score": "0.5602291", "text": "func (fm FieldModelFlagsSimple) FBEOffset() int { return fm.offset }", "title": "" }, { "docid": "253d48dae4ae4e192867a4622b6a9de1", "score": "0.56010586", "text": "func (t *Tuple) SetFieldAt(i int, val interface{}) (b bool) {\n\tif t != nil && i >= 0 && i < t.Length() {\n\t\t(*t).Flds[i] = val\n\t\tb = true\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "c685abc86cdb8cffba1eda6a0dbd8259", "score": "0.5601036", "text": "func (f *File) SetRawStartOffset(count int64) (err error) {\n\tr := C.sf_command(f.s, C.SFC_SET_RAW_START_OFFSET, unsafe.Pointer(&count), 8)\n\n\tif r != 0 {\n\t\terr = errors.New(C.GoString(C.sf_strerror(f.s)))\n\t}\n\treturn\n}", "title": "" }, { "docid": "7a365bed03aa312d2c915cc745e20bc1", "score": "0.5597197", "text": "func Offset(o int) interface {\n\thasOffset\n} {\n\treturn &offsetOption{offset: o}\n}", "title": "" }, { "docid": "3296c7048d68b08f1be087c1c6085a19", "score": "0.559326", "text": "func (meq *MedicalEquipmentQuery) Offset(offset int) *MedicalEquipmentQuery {\n\tmeq.offset = &offset\n\treturn meq\n}", "title": "" }, { "docid": "db680f84985351e0f5222ef572e6dbda", "score": "0.558541", "text": "func (mcq *MetaColumnQuery) Offset(offset int) *MetaColumnQuery {\n\tmcq.offset = &offset\n\treturn mcq\n}", "title": "" }, { "docid": "5db2106dadcc066e762b4475e231791c", "score": "0.5584445", "text": "func (stq *ServiceTypeQuery) Offset(offset int) *ServiceTypeQuery {\n\tstq.offset = &offset\n\treturn stq\n}", "title": "" }, { "docid": "9ed765c6c581d2cfcc76e58db5a9bcb1", "score": "0.55837756", "text": "func (o *GetConfigurationDetectionIDsV2Params) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "6cd10c44e39df702392850a2b29c1201", "score": "0.5576385", "text": "func (q *UserQuery) Offset(offset int) *UserQuery {\n\tq.offset = offset\n\treturn q\n}", "title": "" }, { "docid": "d044ce8ef80c5997add2b09d48634b14", "score": "0.55741334", "text": "func (o *PublicQueryUserEntitlementsByAppTypeParams) SetOffset(offset *int32) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "2547a397e2986848e7d6a1a6b9f68b32", "score": "0.55732197", "text": "func (djq *DetectionJobQuery) Offset(offset int) *DetectionJobQuery {\n\tdjq.offset = &offset\n\treturn djq\n}", "title": "" }, { "docid": "5e79c8e36db0e8f24bf9415685345d46", "score": "0.5555983", "text": "func (o *ListOryAccessControlPoliciesParams) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" }, { "docid": "6ae03234033f8f9c2f3d38d3edacb668", "score": "0.55507827", "text": "func (pq *PersonQuery) Offset(offset int) *PersonQuery {\n\tpq.offset = &offset\n\treturn pq\n}", "title": "" }, { "docid": "db73d2c79c3e3217cf187c65d5931fd2", "score": "0.5546884", "text": "func (etq *ExportTaskQuery) Offset(offset int) *ExportTaskQuery {\n\tetq.offset = &offset\n\treturn etq\n}", "title": "" }, { "docid": "ef5c6d7123b4bf7cb31ddd5e87700d32", "score": "0.55383855", "text": "func (o *DcimVirtualChassisListParams) SetOffset(offset *int64) {\n\to.Offset = offset\n}", "title": "" } ]
0d5d2064093e7bb69004c2f670fdcbcf
listByResourceGroupCreateRequest creates the ListByResourceGroup request.
[ { "docid": "f433a67bb3ada00ea4a55e9992c605dd", "score": "0.77034396", "text": "func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-12-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" } ]
[ { "docid": "6fd1423083b95158090d6f479e257bf0", "score": "0.8057214", "text": "func (client *ElasticSansClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ElasticSansClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-12-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "41d6f5993843d85c7496789008dc6b40", "score": "0.80351806", "text": "func (client *CloudsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CloudsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-06-05-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "22190b4f2649907d3be07c2077650106", "score": "0.8004245", "text": "func (client *ClusterManagersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClusterManagersClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "20cb38d2e147fda394984bdd1a7e2e88", "score": "0.7935894", "text": "func (client *WorkspacesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *WorkspacesClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\tif options != nil && options.Skip != nil {\n\t\treqQP.Set(\"$skip\", *options.Skip)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "f1a2f32af288906cea4750e9d52a957c", "score": "0.7909023", "text": "func (client *VirtualMachinesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualMachinesClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "39729212e70771f3144fa97de774927b", "score": "0.78721184", "text": "func (client *ManagedClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ManagedClustersClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "a080efbfc4a00f65f9763c1dca74b502", "score": "0.7817396", "text": "func (client VaultsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VaultsListByResourceGroupOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tif options != nil && options.Top != nil {\n\t\tquery.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\tquery.Set(\"api-version\", \"2019-09-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "d588ee67c46a2414a1aea27d207e2516", "score": "0.7807818", "text": "func (client *VaultsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VaultsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "85a87faa6dacd99c64bb0744c79bb406", "score": "0.77531207", "text": "func (client *WorkspaceCollectionsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *WorkspaceCollectionsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2016-01-29\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "44539917344ff4947dab97cc7c6bb7aa", "score": "0.77518183", "text": "func (client *QueryPacksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *QueryPacksClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "3470bf1706469893a5eb8ac3c7397eab", "score": "0.77417934", "text": "func (client *AutomationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AutomationsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "39808cde5f5483d5dea7de8ddd272d46", "score": "0.77406824", "text": "func (client *SAPVirtualInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SAPVirtualInstancesClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "dfbf853f6ccc83899e71b53c9b24a80e", "score": "0.7717753", "text": "func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-31\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "cb6e1f27513410b5492ed404017ca030", "score": "0.7674948", "text": "func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Expand != nil {\n\t\treqQP.Set(\"$expand\", string(*options.Expand))\n\t}\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e4c81e2b932935cbc12f637862f907d7", "score": "0.7672332", "text": "func (client *MonitorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *MonitorsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "64f8f3e4a2ea39179a41fc0ec1007352", "score": "0.7658999", "text": "func (client *FleetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *FleetsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-15-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "a9157e2f398bcf4f659d903f275e59d0", "score": "0.76575863", "text": "func (client *LoadTestsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *LoadTestsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-12-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "8f554179cc0d6bbeccea177ae9e867f5", "score": "0.76107186", "text": "func (client *RoutePoliciesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *RoutePoliciesClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "febf7ae71eec355f4b4f53eba0a50e3b", "score": "0.7607578", "text": "func (client *TasksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *TasksListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.ascLocation == \"\" {\n\t\treturn nil, errors.New(\"parameter client.ascLocation cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{ascLocation}\", url.PathEscape(client.ascLocation))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2015-06-01-preview\")\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "dc574a773e2520411857c760125f856f", "score": "0.76002777", "text": "func (client *EnvironmentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *EnvironmentsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "93a137258ed7d33884bf3c34a85f97f3", "score": "0.75911736", "text": "func (client *ContainerAppsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ContainerAppsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "5dbe863bccc4b1e7dcafb69962d9a326", "score": "0.75878346", "text": "func (client *MobileNetworksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *MobileNetworksClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "43f027065aae9559dc8696f3c1460f9f", "score": "0.7585987", "text": "func (client *CassandraClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CassandraClustersListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "aca181c9f1f551aa4b7fdfaa21492c06", "score": "0.7568069", "text": "func (client *DiskAccessesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DiskAccessesClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-07-02\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "ceaacf468e0638ce418a2c6aa93590d6", "score": "0.7552768", "text": "func (client *JobsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *JobsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "3493a083083a2664324926ae896b355e", "score": "0.7546133", "text": "func (client *StorageAccountsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *StorageAccountsListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "8f5713f43e09449f2ef3468177391aca", "score": "0.7537604", "text": "func (client *DataControllersClient) listInGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DataControllersClientListInGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "3a336e23dc2a11399e5c66a012fac48c", "score": "0.7534266", "text": "func (client *TrunkedNetworksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *TrunkedNetworksClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "16e3bcee5d553b6e458d669a932db0f1", "score": "0.75325376", "text": "func (client *InstancePoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *InstancePoolsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "c0447f7d8cf8346baa689bef5c41d48e", "score": "0.7528402", "text": "func (client *SecretClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SecretClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/secrets\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-09-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "14b99474d380768e9bf3e6deaf71acef", "score": "0.75132686", "text": "func (client *SnapshotsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SnapshotsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "9eeacba24fcd1de8da6fb58d058d1cc6", "score": "0.74938273", "text": "func (client *BastionHostsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *BastionHostsListByResourceGroupOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-07-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "0d8143a0562620fda782b7c3b722da76", "score": "0.7488758", "text": "func (client *PrivateZonesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateZonesListByResourceGroupOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\treqQP.Set(\"api-version\", \"2020-06-01\")\n\treq.URL.RawQuery = reqQP.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "ad60d658ffb267f469537d4288a34c89", "score": "0.7481837", "text": "func (client *PrivateLinkServicesForM365ComplianceCenterClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkServicesForM365ComplianceCenterClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-03-25-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "c165a9f8904cd9d2b515bbc0b9d494b0", "score": "0.74624896", "text": "func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AccountsListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\tif options != nil && options.Skip != nil {\n\t\treqQP.Set(\"$skip\", strconv.FormatInt(int64(*options.Skip), 10))\n\t}\n\tif options != nil && options.Select != nil {\n\t\treqQP.Set(\"$select\", *options.Select)\n\t}\n\tif options != nil && options.Orderby != nil {\n\t\treqQP.Set(\"$orderby\", *options.Orderby)\n\t}\n\tif options != nil && options.Count != nil {\n\t\treqQP.Set(\"$count\", strconv.FormatBool(*options.Count))\n\t}\n\treqQP.Set(\"api-version\", \"2019-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "d35e3764bd1f1e418548e320f513d423", "score": "0.74521464", "text": "func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ServersListByResourceGroupOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.URL.RawQuery = reqQP.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "21788b4f2abadf5c163a6fa72cb1c2fe", "score": "0.7452115", "text": "func (client *UserAssignedIdentitiesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *UserAssignedIdentitiesClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-31\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "27ac498d18dafed4ecaf401a77036d3a", "score": "0.7448402", "text": "func (client *DNSForwardingRulesetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DNSForwardingRulesetsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-07-01\")\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "b9daac10f6fcb7b890a19675577722c4", "score": "0.74329513", "text": "func (client *AlertProcessingRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AlertProcessingRulesClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/actionRules\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-08\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "5b3bb056ad2601685319388a94f0ab2d", "score": "0.74030083", "text": "func (client *MultipleActivationKeysClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *MultipleActivationKeysClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsESU/multipleActivationKeys\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-09-16-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "d531c2a7b2df2127216e1e61381ce270", "score": "0.739929", "text": "func (client *ExpressRouteCrossConnectionsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ExpressRouteCrossConnectionsListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e9e400de28466f3f99e6a6ba78b03bb8", "score": "0.73690057", "text": "func (client *VirtualRoutersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualRoutersListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "410a419f2910ab2f3362b143edf913f2", "score": "0.72827363", "text": "func (client *PartnerRegistrationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PartnerRegistrationsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-01-preview\")\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "39331605ae9ddd2363c8ea033b9ed0f8", "score": "0.7260237", "text": "func (client *ServiceEndpointPoliciesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ServiceEndpointPoliciesListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "aab4879d32ffe1408ebf0e11e1ef1570", "score": "0.71554536", "text": "func (client *AvailableServiceAliasesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, location string, options *AvailableServiceAliasesClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableServiceAliases\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif location == \"\" {\n\t\treturn nil, errors.New(\"parameter location cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{location}\", url.PathEscape(location))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "8b4a134d8738166b4cad627221a99915", "score": "0.70833975", "text": "func (client *CustomLocationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CustomLocationsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-31-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "3104e53c3dd385a249cad252fff8bbd8", "score": "0.6961987", "text": "func (client *Client) listAtResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClientListAtResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "c6031345449d83e16c788f6f693589c1", "score": "0.6917637", "text": "func (client *CachesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CachesClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "1247e1dfd3cec2951a0e18fe1b711913", "score": "0.6916004", "text": "func (client *CachesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CachesClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "7d48d5911f50bbb2c5a90d0bbddc0a3e", "score": "0.6915506", "text": "func (client *Client) listAtManagementGroupCreateRequest(ctx context.Context, managementGroupID string, options *ClientListAtManagementGroupOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks\"\n\tif managementGroupID == \"\" {\n\t\treturn nil, errors.New(\"parameter managementGroupID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managementGroupId}\", url.PathEscape(managementGroupID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "12befc22fd9ef2d5d117f202601aa7d4", "score": "0.67916685", "text": "func (client *Client) listCreateRequest(ctx context.Context, options *ClientListOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Management/managementGroups\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\tif options != nil && options.Skiptoken != nil {\n\t\treqQP.Set(\"$skiptoken\", *options.Skiptoken)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.CacheControl != nil {\n\t\treq.Raw().Header.Set(\"Cache-Control\", *options.CacheControl)\n\t}\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "54919ee2ac48c50a38adf7543c56be39", "score": "0.6752315", "text": "func (client *GroupsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *GroupsClientListByProjectOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif projectName == \"\" {\n\t\treturn nil, errors.New(\"parameter projectName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{projectName}\", url.PathEscape(projectName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "eca49129761526501dbf6c9629f3401c", "score": "0.6750327", "text": "func (client *PermissionsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PermissionsClientListForResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "ccb6968e2d3b90ca21b44be85c214c45", "score": "0.65581465", "text": "func (client *DeviceGroupsClient) listCreateRequest(ctx context.Context, iotDefenderLocation string, options *DeviceGroupsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/locations/{iotDefenderLocation}/deviceGroups\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif iotDefenderLocation == \"\" {\n\t\treturn nil, errors.New(\"parameter iotDefenderLocation cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{iotDefenderLocation}\", url.PathEscape(iotDefenderLocation))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "73573aa31cf0222556df129ef6a2b9fd", "score": "0.6547445", "text": "func (mr *MockResourcesClientMockRecorder) ListByResourceGroup(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListByResourceGroup\", reflect.TypeOf((*MockResourcesClient)(nil).ListByResourceGroup), arg0, arg1, arg2, arg3, arg4)\n}", "title": "" }, { "docid": "49a52f250bcdd90abacd3432cb1e24ae", "score": "0.6385128", "text": "func (client *AvailabilitySetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *AvailabilitySetsListOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-06-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e1481b52a76bb250e893395b863f34b2", "score": "0.62754583", "text": "func (client *AssignmentsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AssignmentsClientListForResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tunencodedParams := []string{req.Raw().URL.RawQuery}\n\tif options != nil && options.Filter != nil {\n\t\tunencodedParams = append(unencodedParams, \"$filter=\"+*options.Filter)\n\t}\n\treq.Raw().URL.RawQuery = strings.Join(unencodedParams, \"&\")\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "aa8ab82b3e970019d5825d2f65d4ba79", "score": "0.6259309", "text": "func (client *StaticSitesClient) getStaticSitesByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *StaticSitesClientGetStaticSitesByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "74e0a919401c710e664f4d949e25f44d", "score": "0.6253234", "text": "func (client *StaticSitesClient) getStaticSitesByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *StaticSitesClientGetStaticSitesByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "e3e3bea1ba54d692461e877b9d666764", "score": "0.62260944", "text": "func (client *SecurityGroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *SecurityGroupsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "a39fb37deddf76c98923a5ac93f2d092", "score": "0.61921734", "text": "func (client *AssignmentsClient) listForManagementGroupCreateRequest(ctx context.Context, managementGroupID string, options *AssignmentsClientListForManagementGroupOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments\"\n\tif managementGroupID == \"\" {\n\t\treturn nil, errors.New(\"parameter managementGroupID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managementGroupId}\", url.PathEscape(managementGroupID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tunencodedParams := []string{req.Raw().URL.RawQuery}\n\tif options != nil && options.Filter != nil {\n\t\tunencodedParams = append(unencodedParams, \"$filter=\"+*options.Filter)\n\t}\n\treq.Raw().URL.RawQuery = strings.Join(unencodedParams, \"&\")\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "55e4dd9dc724a7e47a9765d6acc5cb32", "score": "0.6052052", "text": "func (client *SyncMembersClient) listBySyncGroupCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, options *SyncMembersListBySyncGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serverName == \"\" {\n\t\treturn nil, errors.New(\"parameter serverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serverName}\", url.PathEscape(serverName))\n\tif databaseName == \"\" {\n\t\treturn nil, errors.New(\"parameter databaseName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{databaseName}\", url.PathEscape(databaseName))\n\tif syncGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter syncGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{syncGroupName}\", url.PathEscape(syncGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "9198a05bfd7299fad848ad16f3ca6232", "score": "0.6015265", "text": "func (client *GroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientCreateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif projectName == \"\" {\n\t\treturn nil, errors.New(\"parameter projectName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{projectName}\", url.PathEscape(projectName))\n\tif groupName == \"\" {\n\t\treturn nil, errors.New(\"parameter groupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{groupName}\", url.PathEscape(groupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif options != nil && options.Group != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.Group)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "96ab9b6adee01b6f448ece5c4a6c8a22", "score": "0.59924376", "text": "func (client *DeviceSecurityGroupsClient) listCreateRequest(ctx context.Context, resourceID string, options *DeviceSecurityGroupsListOptions) (*policy.Request, error) {\n\turlPath := \"/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceId}\", resourceID)\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "268bd3045aff273c371a06a2eab932f2", "score": "0.59402996", "text": "func NewCreateGroupRequest(\n createGroupInfo *iam.CreateGroupInfo,\n) *CreateGroupRequest {\n\n\treturn &CreateGroupRequest{\n JDCloudRequest: core.JDCloudRequest{\n\t\t\tURL: \"/group\",\n\t\t\tMethod: \"POST\",\n\t\t\tHeader: nil,\n\t\t\tVersion: \"v1\",\n\t\t},\n CreateGroupInfo: createGroupInfo,\n\t}\n}", "title": "" }, { "docid": "d56855c88b6540f98c478ea14575d0c4", "score": "0.59184736", "text": "func (ag AffinityGroup) ListRequest() (ListCommand, error) {\n\treturn &ListAffinityGroups{\n\t\tID: ag.ID,\n\t\tName: ag.Name,\n\t}, nil\n}", "title": "" }, { "docid": "21b718b3c370369a27b79ea13f30ca34", "score": "0.59178704", "text": "func (client *Client) getAtManagementGroupCreateRequest(ctx context.Context, managementGroupID string, deploymentStackName string, options *ClientGetAtManagementGroupOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}\"\n\tif managementGroupID == \"\" {\n\t\treturn nil, errors.New(\"parameter managementGroupID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managementGroupId}\", url.PathEscape(managementGroupID))\n\tif deploymentStackName == \"\" {\n\t\treturn nil, errors.New(\"parameter deploymentStackName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{deploymentStackName}\", url.PathEscape(deploymentStackName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "d225375cebd53f01e93424980cf3c44a", "score": "0.5880027", "text": "func (client *VMwareCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *VMwareCollectorsClientListByProjectOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif projectName == \"\" {\n\t\treturn nil, errors.New(\"parameter projectName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{projectName}\", url.PathEscape(projectName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "36b8f744450faa75033c1355673ec6ad", "score": "0.5879154", "text": "func (client *PrefixListLocalRulestackClient) listByLocalRulestacksCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *PrefixListLocalRulestackClientListByLocalRulestacksOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif localRulestackName == \"\" {\n\t\treturn nil, errors.New(\"parameter localRulestackName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{localRulestackName}\", url.PathEscape(localRulestackName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-29\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "a9ac69c89b8f6a67216089a63ef19130", "score": "0.58378863", "text": "func (client *ImportCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ImportCollectorsClientListByProjectOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif projectName == \"\" {\n\t\treturn nil, errors.New(\"parameter projectName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{projectName}\", url.PathEscape(projectName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "93c8c75c8f681c600e68cf97b4616c1a", "score": "0.58343077", "text": "func (client ScalingPlansClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-09-03-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "f0b2c1a847a0f9ca0bd80af248753350", "score": "0.58303595", "text": "func CreateListUserLevelsOfSkillGroupRequest() (request *ListUserLevelsOfSkillGroupRequest) {\n\trequest = &ListUserLevelsOfSkillGroupRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"CCC\", \"2020-07-01\", \"ListUserLevelsOfSkillGroup\", \"CCC\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "401d067391ef070188b9ec67eaa5dde0", "score": "0.5815982", "text": "func (m *MockResourcesClient) ListByResourceGroup(arg0 context.Context, arg1, arg2, arg3 string, arg4 *int32) ([]features.GenericResourceExpanded, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListByResourceGroup\", arg0, arg1, arg2, arg3, arg4)\n\tret0, _ := ret[0].([]features.GenericResourceExpanded)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "08040f09b081e2ad4867b0f09312a0fb", "score": "0.5804462", "text": "func (client *QueryPacksClient) listCreateRequest(ctx context.Context, options *QueryPacksClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/queryPacks\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "21ec18632739198b019123e9b77297de", "score": "0.5799347", "text": "func (client *DatabasesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *DatabasesClientListByClusterOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-02\")\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\tif options != nil && options.Skiptoken != nil {\n\t\treqQP.Set(\"$skiptoken\", *options.Skiptoken)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "e2dad300d883892b82113bfead1d2905", "score": "0.5768658", "text": "func (client *ResourceGuardsClient) getResourcesInResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ResourceGuardsClientGetResourcesInResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "8821ebdf46059034760842249b6dd049", "score": "0.57673067", "text": "func (client *StorageAccountsClient) ListByResourceGroup(resourceGroupName string, options *StorageAccountsListByResourceGroupOptions) *StorageAccountsListByResourceGroupPager {\n\treturn &StorageAccountsListByResourceGroupPager{\n\t\tclient: client,\n\t\trequester: func(ctx context.Context) (*policy.Request, error) {\n\t\t\treturn client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)\n\t\t},\n\t\tadvancer: func(ctx context.Context, resp StorageAccountsListByResourceGroupResponse) (*policy.Request, error) {\n\t\t\treturn runtime.NewRequest(ctx, http.MethodGet, *resp.StorageAccountListResult.NextLink)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "5254efe6f856d88e875f7c3102acde42", "score": "0.57313734", "text": "func (client *DefaultSecurityRulesClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, options *DefaultSecurityRulesListOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{networkSecurityGroupName}\", url.PathEscape(networkSecurityGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-07-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "37947c7b69f8b35c4983aceadcc95c63", "score": "0.57219934", "text": "func (client *HyperVCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *HyperVCollectorsClientListByProjectOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif projectName == \"\" {\n\t\treturn nil, errors.New(\"parameter projectName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{projectName}\", url.PathEscape(projectName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "8711ce4ed38673f579185b1d51a99341", "score": "0.5721464", "text": "func (client *PrivateEndpointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateEndpointsListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "9a03b7da4befa47132b1cf3b277c9a45", "score": "0.5706001", "text": "func CreateModifyTagGroupsRequest() (request *ModifyTagGroupsRequest) {\n\trequest = &ModifyTagGroupsRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"OutboundBot\", \"2019-12-26\", \"ModifyTagGroups\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "8404610e282cb80d5c132c1d84617961", "score": "0.56971747", "text": "func (client ActionRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, targetResourceGroup string, targetResourceType string, targetResource string, severity Severity, monitorService MonitorService, impactedScope string, description string, alertRuleID string, actionGroup string, name string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2019-05-05-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\tif len(targetResourceGroup) > 0 {\n\t\tqueryParameters[\"targetResourceGroup\"] = autorest.Encode(\"query\", targetResourceGroup)\n\t}\n\tif len(targetResourceType) > 0 {\n\t\tqueryParameters[\"targetResourceType\"] = autorest.Encode(\"query\", targetResourceType)\n\t}\n\tif len(targetResource) > 0 {\n\t\tqueryParameters[\"targetResource\"] = autorest.Encode(\"query\", targetResource)\n\t}\n\tif len(string(severity)) > 0 {\n\t\tqueryParameters[\"severity\"] = autorest.Encode(\"query\", severity)\n\t}\n\tif len(string(monitorService)) > 0 {\n\t\tqueryParameters[\"monitorService\"] = autorest.Encode(\"query\", monitorService)\n\t}\n\tif len(impactedScope) > 0 {\n\t\tqueryParameters[\"impactedScope\"] = autorest.Encode(\"query\", impactedScope)\n\t}\n\tif len(description) > 0 {\n\t\tqueryParameters[\"description\"] = autorest.Encode(\"query\", description)\n\t}\n\tif len(alertRuleID) > 0 {\n\t\tqueryParameters[\"alertRuleId\"] = autorest.Encode(\"query\", alertRuleID)\n\t}\n\tif len(actionGroup) > 0 {\n\t\tqueryParameters[\"actionGroup\"] = autorest.Encode(\"query\", actionGroup)\n\t}\n\tif len(name) > 0 {\n\t\tqueryParameters[\"name\"] = autorest.Encode(\"query\", name)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/actionRules\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "04b839ccd7199face3e5b1280477dfdf", "score": "0.5685066", "text": "func (client *LongTermRetentionBackupsClient) getByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, options *LongTermRetentionBackupsClientGetByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif locationName == \"\" {\n\t\treturn nil, errors.New(\"parameter locationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{locationName}\", url.PathEscape(locationName))\n\tif longTermRetentionServerName == \"\" {\n\t\treturn nil, errors.New(\"parameter longTermRetentionServerName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{longTermRetentionServerName}\", url.PathEscape(longTermRetentionServerName))\n\tif longTermRetentionDatabaseName == \"\" {\n\t\treturn nil, errors.New(\"parameter longTermRetentionDatabaseName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{longTermRetentionDatabaseName}\", url.PathEscape(longTermRetentionDatabaseName))\n\tif backupName == \"\" {\n\t\treturn nil, errors.New(\"parameter backupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{backupName}\", url.PathEscape(backupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "37214ba6b309238279e4e265b33c8a8e", "score": "0.56844985", "text": "func (client ActionRulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "7886d989dae98339022d0127a0580977", "score": "0.5677622", "text": "func (client *LoadBalancersClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *LoadBalancersListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e9a0f471902756795924565c59a54240", "score": "0.5665712", "text": "func (client *ServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ServicesClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "e29b752ef1477f9c2c314f1580c62030", "score": "0.56646216", "text": "func (client *WorkspacesClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientListKeysOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "b465b6c10d46c238db2753c0a1e42f60", "score": "0.5658283", "text": "func (client *ServiceFabricsClient) listCreateRequest(ctx context.Context, resourceGroupName string, labName string, userName string, options *ServiceFabricsListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\tif userName == \"\" {\n\t\treturn nil, errors.New(\"parameter userName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{userName}\", url.PathEscape(userName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Expand != nil {\n\t\treqQP.Set(\"$expand\", *options.Expand)\n\t}\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\tif options != nil && options.Orderby != nil {\n\t\treqQP.Set(\"$orderby\", *options.Orderby)\n\t}\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "cb195c8831a6d6831c686abc3e057d2c", "score": "0.5652033", "text": "func (client *Client) getAtResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, deploymentStackName string, options *ClientGetAtResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif deploymentStackName == \"\" {\n\t\treturn nil, errors.New(\"parameter deploymentStackName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{deploymentStackName}\", url.PathEscape(deploymentStackName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "6af393be7753532b77fefac87a273498", "score": "0.56502926", "text": "func (client *PipelineRunsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *PipelineRunsListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "4863230cc27caf5d138f33d1f0573dfb", "score": "0.5647697", "text": "func (client CustomLocationsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "8e3005066785ca61c08e100627327ebe", "score": "0.5639299", "text": "func (client *SecurityGroupsClient) listAllCreateRequest(ctx context.Context, options *SecurityGroupsClientListAllOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "70e34217d3943eb4984f8dc3f68574b0", "score": "0.56266594", "text": "func NewCreateGroupRequestWithAllParams(\n createGroupInfo *iam.CreateGroupInfo,\n) *CreateGroupRequest {\n\n return &CreateGroupRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/group\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n CreateGroupInfo: createGroupInfo,\n }\n}", "title": "" }, { "docid": "4ae7416d89453a6c99a0d66444a3b278", "score": "0.56127834", "text": "func (client DeletedWebAppsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2016-03-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/deletedSites\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "f1f5b43841226c0269dd47661687cb20", "score": "0.5610532", "text": "func (client *VirtualMachineScaleSetVMsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, options *VirtualMachineScaleSetVMsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif virtualMachineScaleSetName == \"\" {\n\t\treturn nil, errors.New(\"parameter virtualMachineScaleSetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{virtualMachineScaleSetName}\", url.PathEscape(virtualMachineScaleSetName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\tif options != nil && options.Select != nil {\n\t\treqQP.Set(\"$select\", *options.Select)\n\t}\n\tif options != nil && options.Expand != nil {\n\t\treqQP.Set(\"$expand\", *options.Expand)\n\t}\n\treqQP.Set(\"api-version\", \"2022-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "54a4df4d0e6b28c331a27c531858b792", "score": "0.5598552", "text": "func (client *KeysClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *KeysListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif vaultName == \"\" {\n\t\treturn nil, errors.New(\"parameter vaultName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{vaultName}\", url.PathEscape(vaultName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "584714bda64ad94a47ae1e03907d1d8a", "score": "0.5590687", "text": "func (client *Client) createOrUpdateAtManagementGroupCreateRequest(ctx context.Context, managementGroupID string, deploymentStackName string, deploymentStack DeploymentStack, options *ClientBeginCreateOrUpdateAtManagementGroupOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}\"\n\tif managementGroupID == \"\" {\n\t\treturn nil, errors.New(\"parameter managementGroupID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managementGroupId}\", url.PathEscape(managementGroupID))\n\tif deploymentStackName == \"\" {\n\t\treturn nil, errors.New(\"parameter deploymentStackName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{deploymentStackName}\", url.PathEscape(deploymentStackName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, deploymentStack); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "fd80199738bb35c5c19627ac5962318b", "score": "0.5589453", "text": "func (client *ServiceFabricsClient) listCreateRequest(ctx context.Context, resourceGroupName string, labName string, userName string, options *ServiceFabricsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\tif userName == \"\" {\n\t\treturn nil, errors.New(\"parameter userName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{userName}\", url.PathEscape(userName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Expand != nil {\n\t\treqQP.Set(\"$expand\", *options.Expand)\n\t}\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\tif options != nil && options.Orderby != nil {\n\t\treqQP.Set(\"$orderby\", *options.Orderby)\n\t}\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "0fa73b5999c10f48ebb504d922ee059b", "score": "0.5585498", "text": "func (a *GroupsApiService) CreateGroup(ctx _context.Context) ApiCreateGroupRequest {\n\treturn ApiCreateGroupRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "75eea095386fcbf8bd712c8f58d4bd3f", "score": "0.55848885", "text": "func (client *RegistrationDefinitionsClient) listCreateRequest(ctx context.Context, scope string, options *RegistrationDefinitionsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions\"\n\turlPath = strings.ReplaceAll(urlPath, \"{scope}\", scope)\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-02-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" } ]
8d3dd1470672620cf88db6c5370fca91
/ SlidesApiServiceTests Delete a data point from a chart series. Test for SlidesApi.DeleteChartDataPoint method with invalid shapeIndex
[ { "docid": "5480ffed1f91fde0670a52ec46c27390", "score": "0.72524935", "text": "func TestDeleteChartDataPointInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteChartDataPoint\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteChartDataPoint\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartDataPoint\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" } ]
[ { "docid": "661ef9643eac9d6109ba6a7667b953b3", "score": "0.73260057", "text": "func TestDeleteChartDataPoint(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartDataPoint\", \"storage\", \"string\").(string)\n e := InitializeTest(\"DeleteChartDataPoint\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.DeleteChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testpassword, testfolder, teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "cbce4007bd5f1bfb3c4efe4dc3b82604", "score": "0.7300726", "text": "func TestDeleteChartDataPointInvalidSeriesIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testseriesIndex, \"DeleteChartDataPoint\", \"seriesIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testseriesIndex = nullValue\n } else {\n testseriesIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteChartDataPoint\", \"seriesIndex\", testseriesIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartDataPoint\", \"seriesIndex\", \"int32\", testseriesIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "471410734df918fb8057e6c0085f0de7", "score": "0.72201043", "text": "func TestDeleteChartSeries(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartSeries\", \"storage\", \"string\").(string)\n e := InitializeTest(\"DeleteChartSeries\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.DeleteChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testpassword, testfolder, teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "3fd979f2b437b723bb9bb568cd6e8254", "score": "0.7219268", "text": "func TestDeleteChartSeriesInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteChartSeries\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteChartSeries\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartSeries\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "70dbae1a452f293b6f04a78b433d5e70", "score": "0.7037626", "text": "func TestDeleteChartDataPointInvalidPointIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testpointIndex, \"DeleteChartDataPoint\", \"pointIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testpointIndex = nullValue\n } else {\n testpointIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteChartDataPoint\", \"pointIndex\", testpointIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartDataPoint\", \"pointIndex\", \"int32\", testpointIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "11f3a518d4821f4eedbf568f254dd9de", "score": "0.6972851", "text": "func TestDeleteChartSeriesInvalidSeriesIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testseriesIndex, \"DeleteChartSeries\", \"seriesIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testseriesIndex = nullValue\n } else {\n testseriesIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteChartSeries\", \"seriesIndex\", testseriesIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartSeries\", \"seriesIndex\", \"int32\", testseriesIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "76f60a43a301e66786372a12a576a2f8", "score": "0.6807098", "text": "func TestDeleteChartDataPointInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DeleteChartDataPoint\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteChartDataPoint\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartDataPoint\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "802b6b47b2420845ad4f8b980ef958b7", "score": "0.68001664", "text": "func TestDeleteChartCategoryInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartCategory\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"shapeIndex\", \"int32\").(int32)\n testcategoryIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"categoryIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartCategory\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartCategory\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartCategory\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteChartCategory\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteChartCategory\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartCategory(testname, testslideIndex, testshapeIndex, testcategoryIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartCategory\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "7d59451fcecd2c3c67c7a3f943f954f2", "score": "0.6768025", "text": "func TestDeleteChartSeriesInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DeleteChartSeries\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteChartSeries\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartSeries\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "f57de4f4d9873e81ce2b143ccd12f8a7", "score": "0.6512646", "text": "func TestDeleteChartDataPointInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"DeleteChartDataPoint\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartDataPoint\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartDataPoint\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "888a88107bec29b5c91ffd43c0b59bf1", "score": "0.65115756", "text": "func TestDeleteChartCategory(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartCategory\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"shapeIndex\", \"int32\").(int32)\n testcategoryIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"categoryIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartCategory\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartCategory\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartCategory\", \"storage\", \"string\").(string)\n e := InitializeTest(\"DeleteChartCategory\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.DeleteChartCategory(testname, testslideIndex, testshapeIndex, testcategoryIndex, testpassword, testfolder, teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "fcaccda25639d50d102a41dabf14cbbb", "score": "0.6484278", "text": "func TestDeleteChartSeriesInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"DeleteChartSeries\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartSeries\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartSeries\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "82d8e013897935b82c307c665b155f10", "score": "0.6417685", "text": "func TestDeleteChart(t *testing.T) {\n\ts, c, err := createMockObjects()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer s.Close()\n\n\tif err := c.DeleteChart(\"repo1\", \"harbor\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "5e51c11a02e8808f49ef10743b90c193", "score": "0.63580537", "text": "func (m *MockProm) DeleteSeries(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "f335db050f5984c90cec6f601e7d0d81", "score": "0.63463205", "text": "func TestUpdateChartDataPointInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"UpdateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"UpdateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"UpdateChartDataPoint\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"UpdateChartDataPoint\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartDataPoint\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "a3a7e93af74dfd8c42c3b54bfe1f1d94", "score": "0.6344008", "text": "func TestDeleteChartDataPointInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"DeleteChartDataPoint\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartDataPoint\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartDataPoint\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "89154f2d548e30457cdc6fb21e1af9d7", "score": "0.63088256", "text": "func TestDeleteChartCategoryInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartCategory\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"shapeIndex\", \"int32\").(int32)\n testcategoryIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"categoryIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartCategory\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartCategory\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartCategory\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DeleteChartCategory\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteChartCategory\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartCategory(testname, testslideIndex, testshapeIndex, testcategoryIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartCategory\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "e3ed8472c1406b66853c93d9135c331e", "score": "0.6283018", "text": "func TestUpdateChartSeriesInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"UpdateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"UpdateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"UpdateChartSeries\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"UpdateChartSeries\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testseries, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartSeries\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "49d00614781d7f0f4429b7fbbdc6d545", "score": "0.6271881", "text": "func TestDeleteChartCategoryInvalidCategoryIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartCategory\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"shapeIndex\", \"int32\").(int32)\n testcategoryIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"categoryIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartCategory\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartCategory\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartCategory\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testcategoryIndex, \"DeleteChartCategory\", \"categoryIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testcategoryIndex = nullValue\n } else {\n testcategoryIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteChartCategory\", \"categoryIndex\", testcategoryIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartCategory(testname, testslideIndex, testshapeIndex, testcategoryIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartCategory\", \"categoryIndex\", \"int32\", testcategoryIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "466eaf461f66ef07779f9c107912887f", "score": "0.6249764", "text": "func TestDeleteChartSeriesInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"DeleteChartSeries\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartSeries\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartSeries\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "806fecdc9e9ac8b8f14260c638e3edfe", "score": "0.6223697", "text": "func TestUpdateChartDataPointInvalidSeriesIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"UpdateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"UpdateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testseriesIndex, \"UpdateChartDataPoint\", \"seriesIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testseriesIndex = nullValue\n } else {\n testseriesIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"UpdateChartDataPoint\", \"seriesIndex\", testseriesIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartDataPoint\", \"seriesIndex\", \"int32\", testseriesIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "48f9749851db481dda0978c635628e6e", "score": "0.6158345", "text": "func TestCreateChartDataPointInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"CreateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"CreateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"CreateChartDataPoint\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"CreateChartDataPoint\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateChartDataPoint\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "b948a104ce546b0a40c1ba2af44392d9", "score": "0.6126558", "text": "func TestSetChartSeriesGroupInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"SetChartSeriesGroup\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"shapeIndex\", \"int32\").(int32)\n testseriesGroupIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"seriesGroupIndex\", \"int32\").(int32)\n testseriesGroup, _ := createTestParamValue(\"SetChartSeriesGroup\", \"seriesGroup\", \"ChartSeriesGroup\").(IChartSeriesGroup)\n testpassword, _ := createTestParamValue(\"SetChartSeriesGroup\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SetChartSeriesGroup\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SetChartSeriesGroup\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"SetChartSeriesGroup\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SetChartSeriesGroup\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.SetChartSeriesGroup(testname, testslideIndex, testshapeIndex, testseriesGroupIndex, testseriesGroup, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SetChartSeriesGroup\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "7fd11dc99ae1fb9b74ac2a5c403eeb3e", "score": "0.61107725", "text": "func TestDeleteChartVersion(t *testing.T) {\n\trunCodeCheckingCases(t, &codeCheckingCase{\n\t\trequest: &testingRequest{\n\t\t\turl: \"/api/chartrepo/library/charts/harbor/0.2.1\",\n\t\t\tmethod: http.MethodDelete,\n\t\t\tcredential: projAdmin,\n\t\t},\n\t\tcode: http.StatusOK,\n\t})\n}", "title": "" }, { "docid": "0872d5afc74a14accb82c1a70a5e6544", "score": "0.60992545", "text": "func TestUpdateChartDataPointInvalidDataPoint(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"UpdateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"UpdateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testdataPoint, \"UpdateChartDataPoint\", \"dataPoint\", \"DataPoint\")\n if (invalidValue == nil) {\n testdataPoint = nil\n } else {\n testdataPoint, _ = invalidValue.(IDataPoint)\n }\n\n e := InitializeTest(\"UpdateChartDataPoint\", \"dataPoint\", testdataPoint)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartDataPoint\", \"dataPoint\", \"DataPoint\", testdataPoint, int32(statusCode), e)\n}", "title": "" }, { "docid": "b1aa5ddd52198561698820848d8f8ecf", "score": "0.6095505", "text": "func TestCreateChartSeriesInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"CreateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"CreateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"CreateChartSeries\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"CreateChartSeries\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateChartSeries(testname, testslideIndex, testshapeIndex, testseries, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateChartSeries\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "18e1a118d0a12a91777c8c1b6e9cdcd1", "score": "0.60776144", "text": "func TestCreateChartDataPointInvalidSeriesIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"CreateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"CreateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testseriesIndex, \"CreateChartDataPoint\", \"seriesIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testseriesIndex = nullValue\n } else {\n testseriesIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"CreateChartDataPoint\", \"seriesIndex\", testseriesIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateChartDataPoint\", \"seriesIndex\", \"int32\", testseriesIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "90958b9a7d5f69f1d7a1977ba2b6e710", "score": "0.60655695", "text": "func TestDeleteShapeInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteShape\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteShape\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteShape(testname, testslideIndex, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteShape\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "2562eacf55fe751d82ea08aa25bfe5e8", "score": "0.60283214", "text": "func TestUpdateChartDataPointInvalidPointIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"UpdateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"UpdateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testpointIndex, \"UpdateChartDataPoint\", \"pointIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testpointIndex = nullValue\n } else {\n testpointIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"UpdateChartDataPoint\", \"pointIndex\", testpointIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartDataPoint\", \"pointIndex\", \"int32\", testpointIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "b1701f6d9cfb9e613ffd6c412aa2a53b", "score": "0.59571934", "text": "func TestDeleteChartDataPointInvalidFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfolder, \"DeleteChartDataPoint\", \"folder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfolder = nullValue\n } else {\n testfolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartDataPoint\", \"folder\", testfolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartDataPoint\", \"folder\", \"string\", testfolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "a7854effd68cd38ccac7455e9bc03b5c", "score": "0.5946333", "text": "func TestDeleteShapeInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DeleteShape\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteShape\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteShape(testname, testslideIndex, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteShape\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "ca5b37d7ce96f04f8290005e76bae589", "score": "0.5942035", "text": "func TestUpdateChartCategoryInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartCategory\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartCategory\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartCategory\", \"shapeIndex\", \"int32\").(int32)\n testcategoryIndex, _ := createTestParamValue(\"UpdateChartCategory\", \"categoryIndex\", \"int32\").(int32)\n testcategory, _ := createTestParamValue(\"UpdateChartCategory\", \"category\", \"ChartCategory\").(IChartCategory)\n testpassword, _ := createTestParamValue(\"UpdateChartCategory\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartCategory\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartCategory\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"UpdateChartCategory\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"UpdateChartCategory\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartCategory(testname, testslideIndex, testshapeIndex, testcategoryIndex, testcategory, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartCategory\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "a23ce5628b53523ce660f2d0f4311ae3", "score": "0.5934588", "text": "func TestUpdateChartDataPoint(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"UpdateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"UpdateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartDataPoint\", \"storage\", \"string\").(string)\n e := InitializeTest(\"UpdateChartDataPoint\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.UpdateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testdataPoint, testpassword, testfolder, teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "f868fd240a7f4d0ad8ac40c217b39fa2", "score": "0.5919049", "text": "func TestDeleteChartSeriesInvalidFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfolder, \"DeleteChartSeries\", \"folder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfolder = nullValue\n } else {\n testfolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartSeries\", \"folder\", testfolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartSeries\", \"folder\", \"string\", testfolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "0b99040fc9ae28d7d98a5b1c4825c52b", "score": "0.5909466", "text": "func TestDeleteChartCategoryInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartCategory\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"shapeIndex\", \"int32\").(int32)\n testcategoryIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"categoryIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartCategory\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartCategory\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartCategory\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"DeleteChartCategory\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartCategory\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartCategory(testname, testslideIndex, testshapeIndex, testcategoryIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartCategory\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "a153ff44018f53ae9ba71f2e1515a0a1", "score": "0.5891263", "text": "func TestDeleteShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"DeleteShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.DeleteShape(testname, testslideIndex, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "51d3484796b197778eccaf2ccaec65b7", "score": "0.58901644", "text": "func TestCreateChartDataPointInvalidDataPoint(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"CreateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"CreateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testdataPoint, \"CreateChartDataPoint\", \"dataPoint\", \"DataPoint\")\n if (invalidValue == nil) {\n testdataPoint = nil\n } else {\n testdataPoint, _ = invalidValue.(IDataPoint)\n }\n\n e := InitializeTest(\"CreateChartDataPoint\", \"dataPoint\", testdataPoint)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateChartDataPoint\", \"dataPoint\", \"DataPoint\", testdataPoint, int32(statusCode), e)\n}", "title": "" }, { "docid": "585e35b201c5ee633e749f150e2a18c7", "score": "0.58541715", "text": "func TestUpdateChartSeriesInvalidSeries(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"UpdateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"UpdateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testseries, \"UpdateChartSeries\", \"series\", \"Series\")\n if (invalidValue == nil) {\n testseries = nil\n } else {\n testseries, _ = invalidValue.(ISeries)\n }\n\n e := InitializeTest(\"UpdateChartSeries\", \"series\", testseries)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testseries, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartSeries\", \"series\", \"Series\", testseries, int32(statusCode), e)\n}", "title": "" }, { "docid": "8573a7763fa15e91795442b3044b4f62", "score": "0.5844991", "text": "func TestUpdateChartSeries(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"UpdateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"UpdateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartSeries\", \"storage\", \"string\").(string)\n e := InitializeTest(\"UpdateChartSeries\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.UpdateChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testseries, testpassword, testfolder, teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "e34eb060e85e1548cf8dde7a33b2772e", "score": "0.5839288", "text": "func TestUpdateChartSeriesInvalidSeriesIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"UpdateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"UpdateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testseriesIndex, \"UpdateChartSeries\", \"seriesIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testseriesIndex = nullValue\n } else {\n testseriesIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"UpdateChartSeries\", \"seriesIndex\", testseriesIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testseries, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartSeries\", \"seriesIndex\", \"int32\", testseriesIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "df10e084c2049fc73680a85a90cf372d", "score": "0.5837214", "text": "func TestUpdateChartDataPointInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"UpdateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"UpdateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"UpdateChartDataPoint\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"UpdateChartDataPoint\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartDataPoint\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "16f7f7cc57a3a7a724ec0a3c51011cff", "score": "0.5818625", "text": "func TestSetChartAxisInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"SetChartAxis\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SetChartAxis\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SetChartAxis\", \"shapeIndex\", \"int32\").(int32)\n testaxisType, _ := createTestParamValue(\"SetChartAxis\", \"axisType\", \"string\").(string)\n testaxis, _ := createTestParamValue(\"SetChartAxis\", \"axis\", \"Axis\").(IAxis)\n testpassword, _ := createTestParamValue(\"SetChartAxis\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SetChartAxis\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SetChartAxis\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"SetChartAxis\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SetChartAxis\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.SetChartAxis(testname, testslideIndex, testshapeIndex, testaxisType, testaxis, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SetChartAxis\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "8dde4d1c37ae6b84b55f93d6ae454527", "score": "0.58164966", "text": "func TestDeleteParagraphInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteParagraph\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteParagraph\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteParagraph\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeleteParagraph\", \"paragraphIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteParagraph\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteParagraph\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteParagraph\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteParagraph\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteParagraph\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteParagraph\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteParagraph(testname, testslideIndex, testshapeIndex, testparagraphIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteParagraph\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "97ecfdca8e894be4483633cfa4c24c9d", "score": "0.58099294", "text": "func TestDeletePortionsInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeletePortions\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeletePortions\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeletePortions\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeletePortions\", \"paragraphIndex\", \"int32\").(int32)\n testportions, _ := createTestParamValue(\"DeletePortions\", \"portions\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeletePortions\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeletePortions\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeletePortions\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeletePortions\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeletePortions\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeletePortions\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeletePortions(testname, testslideIndex, testshapeIndex, testparagraphIndex, testportions, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeletePortions\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "a7a1627f0fba319771e9baf5b82c01f1", "score": "0.57975227", "text": "func TestDeleteChartCategoryInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartCategory\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"shapeIndex\", \"int32\").(int32)\n testcategoryIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"categoryIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartCategory\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartCategory\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartCategory\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"DeleteChartCategory\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartCategory\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartCategory(testname, testslideIndex, testshapeIndex, testcategoryIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartCategory\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "fc514026b39935321ff101b2d502ce0d", "score": "0.5795836", "text": "func (s *Sonarr) DeleteSeries(seriesID int, deleteFiles bool) (*Series, error) {\n\tresults := &Series{}\n\tif seriesID <= 0 {\n\t\treturn results, errors.New(\"seriesID must be a positive integer\")\n\t}\n\tparams := make(url.Values)\n\tif deleteFiles {\n\t\tparams.Set(\"deleteFiles\", \"true\")\n\t}\n\tseriesURL := fmt.Sprintf(\"%s/%s\", seriesEndpoint, strconv.Itoa(seriesID))\n\tres, err := s.del(seriesURL, params)\n\tif err != nil {\n\t\treturn results, err\n\t}\n\tdefer res.Body.Close()\n\n\terr = json.NewDecoder(res.Body).Decode(results)\n\treturn results, err\n}", "title": "" }, { "docid": "d1b709f02c7c8d15287b2525a98b139b", "score": "0.5768979", "text": "func TestDeleteParagraphsInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteParagraphs\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteParagraphs\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteParagraphs\", \"shapeIndex\", \"int32\").(int32)\n testparagraphs, _ := createTestParamValue(\"DeleteParagraphs\", \"paragraphs\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeleteParagraphs\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteParagraphs\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteParagraphs\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteParagraphs\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteParagraphs\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteParagraphs\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteParagraphs(testname, testslideIndex, testshapeIndex, testparagraphs, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteParagraphs\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "5f4623c515c47460fb9e8411753ad171", "score": "0.57608277", "text": "func TestDeleteTableRowInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteTableRow\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteTableRow\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteTableRow\", \"shapeIndex\", \"int32\").(int32)\n testrowIndex, _ := createTestParamValue(\"DeleteTableRow\", \"rowIndex\", \"int32\").(int32)\n var testwithAttachedRows *bool\n testwithAttachedRowsValue := createTestParamValue(\"DeleteTableRow\", \"withAttachedRows\", \"bool\")\n if (testwithAttachedRowsValue != nil) {\n testwithAttachedRows = new(bool)\n *testwithAttachedRows, _ = testwithAttachedRowsValue.(bool)\n }\n testpassword, _ := createTestParamValue(\"DeleteTableRow\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteTableRow\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteTableRow\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteTableRow\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteTableRow\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteTableRow(testname, testslideIndex, testshapeIndex, testrowIndex, testwithAttachedRows, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteTableRow\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "1f8ffc08d457dfad517dafd4fae65942", "score": "0.5756347", "text": "func TestDeleteShapesInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteShapes\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteShapes\", \"slideIndex\", \"int32\").(int32)\n testshapes, _ := createTestParamValue(\"DeleteShapes\", \"shapes\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeleteShapes\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteShapes\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteShapes\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteShapes\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DeleteShapes\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteShapes\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteShapes(testname, testslideIndex, testshapes, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteShapes\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "3c62d22b6792c97e196b958c10170f34", "score": "0.57480186", "text": "func (r *BoltChartValuesRepository) Delete(id string) error {\n\titem, err := r.FindOne(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif item == nil {\n\t\treturn errors.New(\"not found\")\n\t}\n\treturn r.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket(chartBucket)\n\t\tk := []byte(id)\n\t\treturn b.Delete(k)\n\t})\n}", "title": "" }, { "docid": "d988c4f2ee1ed2bab18f3dde5c4d6ee7", "score": "0.5731795", "text": "func TestUpdateChartSeriesInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"UpdateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"UpdateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"UpdateChartSeries\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"UpdateChartSeries\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testseries, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartSeries\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "eeea136175f2c77ab1d6ca0ba839732d", "score": "0.5731089", "text": "func TestDeletePortionInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeletePortion\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeletePortion\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeletePortion\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeletePortion\", \"paragraphIndex\", \"int32\").(int32)\n testportionIndex, _ := createTestParamValue(\"DeletePortion\", \"portionIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeletePortion\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeletePortion\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeletePortion\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeletePortion\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeletePortion\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeletePortion\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeletePortion(testname, testslideIndex, testshapeIndex, testparagraphIndex, testportionIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeletePortion\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "d929b928021aca7c92cabcba8d9e5052", "score": "0.5708823", "text": "func TestDeleteChartSeriesInvalidPassword(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testpassword, \"DeleteChartSeries\", \"password\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testpassword = nullValue\n } else {\n testpassword, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartSeries\", \"password\", testpassword)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartSeries\", \"password\", \"string\", testpassword, int32(statusCode), e)\n}", "title": "" }, { "docid": "6e1e2ba9f6cbdd9a5c02a1401e7ecba4", "score": "0.5701466", "text": "func TestCreateChartCategoryInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartCategory\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartCategory\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartCategory\", \"shapeIndex\", \"int32\").(int32)\n testcategory, _ := createTestParamValue(\"CreateChartCategory\", \"category\", \"ChartCategory\").(IChartCategory)\n testpassword, _ := createTestParamValue(\"CreateChartCategory\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartCategory\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartCategory\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"CreateChartCategory\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"CreateChartCategory\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateChartCategory(testname, testslideIndex, testshapeIndex, testcategory, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateChartCategory\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "4cb35ddccdf92b0875119abfbe89b5d1", "score": "0.5692701", "text": "func TestCreateChartDataPointInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"CreateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"CreateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"CreateChartDataPoint\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"CreateChartDataPoint\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateChartDataPoint\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "a9131e45dc9a404c2610a29090f6a673", "score": "0.56847954", "text": "func (e *Engine) DeleteMeasurement(name []byte) error {\n\t// Attempt to find the series keys.\n\tindexSet := tsdb.IndexSet{Indexes: []tsdb.Index{e.index}, SeriesFile: e.sfile}\n\titr, err := indexSet.MeasurementSeriesByExprIterator(name, nil)\n\tif err != nil {\n\t\treturn err\n\t} else if itr == nil {\n\t\treturn nil\n\t}\n\tdefer itr.Close()\n\treturn e.DeleteSeriesRange(tsdb.NewSeriesIteratorAdapter(e.sfile, itr), math.MinInt64, math.MaxInt64)\n}", "title": "" }, { "docid": "c8d6079dc09b9e9ebf5e9c7f7d57566b", "score": "0.5672264", "text": "func TestDeleteChartDataPointInvalidPassword(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"DeleteChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testpassword, \"DeleteChartDataPoint\", \"password\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testpassword = nullValue\n } else {\n testpassword, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartDataPoint\", \"password\", testpassword)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartDataPoint\", \"password\", \"string\", testpassword, int32(statusCode), e)\n}", "title": "" }, { "docid": "6f4c0021519d63540347fdc37dd2a8ac", "score": "0.56716305", "text": "func TestDeleteSpecialSlideShapeInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteSpecialSlideShape\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteSpecialSlideShape\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteSpecialSlideShape\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "9a37184036781de5c0671923e3d3ae9b", "score": "0.56675476", "text": "func TestSetChartSeriesGroupInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"SetChartSeriesGroup\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"shapeIndex\", \"int32\").(int32)\n testseriesGroupIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"seriesGroupIndex\", \"int32\").(int32)\n testseriesGroup, _ := createTestParamValue(\"SetChartSeriesGroup\", \"seriesGroup\", \"ChartSeriesGroup\").(IChartSeriesGroup)\n testpassword, _ := createTestParamValue(\"SetChartSeriesGroup\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SetChartSeriesGroup\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SetChartSeriesGroup\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"SetChartSeriesGroup\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SetChartSeriesGroup\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.SetChartSeriesGroup(testname, testslideIndex, testshapeIndex, testseriesGroupIndex, testseriesGroup, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SetChartSeriesGroup\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "f4c5e8c43edcf47678ef8761206422c8", "score": "0.56483144", "text": "func TestDeleteTableCellParagraphInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteTableCellParagraph\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteTableCellParagraph\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteTableCellParagraph\", \"shapeIndex\", \"int32\").(int32)\n testrowIndex, _ := createTestParamValue(\"DeleteTableCellParagraph\", \"rowIndex\", \"int32\").(int32)\n testcellIndex, _ := createTestParamValue(\"DeleteTableCellParagraph\", \"cellIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeleteTableCellParagraph\", \"paragraphIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteTableCellParagraph\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteTableCellParagraph\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteTableCellParagraph\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteTableCellParagraph\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteTableCellParagraph\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteTableCellParagraph(testname, testslideIndex, testshapeIndex, testrowIndex, testcellIndex, testparagraphIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteTableCellParagraph\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "cb3ada5a382c5b5859e5906a06c60c42", "score": "0.5643359", "text": "func TestCreateChartSeriesInvalidSeries(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"CreateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"CreateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testseries, \"CreateChartSeries\", \"series\", \"Series\")\n if (invalidValue == nil) {\n testseries = nil\n } else {\n testseries, _ = invalidValue.(ISeries)\n }\n\n e := InitializeTest(\"CreateChartSeries\", \"series\", testseries)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateChartSeries(testname, testslideIndex, testshapeIndex, testseries, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateChartSeries\", \"series\", \"Series\", testseries, int32(statusCode), e)\n}", "title": "" }, { "docid": "b938d072620aa4ceb8dd22b30b1beed8", "score": "0.5628637", "text": "func TestSetChartSeriesGroupInvalidSeriesGroupIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"SetChartSeriesGroup\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"shapeIndex\", \"int32\").(int32)\n testseriesGroupIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"seriesGroupIndex\", \"int32\").(int32)\n testseriesGroup, _ := createTestParamValue(\"SetChartSeriesGroup\", \"seriesGroup\", \"ChartSeriesGroup\").(IChartSeriesGroup)\n testpassword, _ := createTestParamValue(\"SetChartSeriesGroup\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SetChartSeriesGroup\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SetChartSeriesGroup\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testseriesGroupIndex, \"SetChartSeriesGroup\", \"seriesGroupIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testseriesGroupIndex = nullValue\n } else {\n testseriesGroupIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SetChartSeriesGroup\", \"seriesGroupIndex\", testseriesGroupIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.SetChartSeriesGroup(testname, testslideIndex, testshapeIndex, testseriesGroupIndex, testseriesGroup, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SetChartSeriesGroup\", \"seriesGroupIndex\", \"int32\", testseriesGroupIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "58f18700f5ec3793837268b5fa68db6c", "score": "0.5624715", "text": "func TestDeleteTableCellPortionInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteTableCellPortion\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteTableCellPortion\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteTableCellPortion\", \"shapeIndex\", \"int32\").(int32)\n testrowIndex, _ := createTestParamValue(\"DeleteTableCellPortion\", \"rowIndex\", \"int32\").(int32)\n testcellIndex, _ := createTestParamValue(\"DeleteTableCellPortion\", \"cellIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeleteTableCellPortion\", \"paragraphIndex\", \"int32\").(int32)\n testportionIndex, _ := createTestParamValue(\"DeleteTableCellPortion\", \"portionIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteTableCellPortion\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteTableCellPortion\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteTableCellPortion\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteTableCellPortion\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteTableCellPortion\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteTableCellPortion(testname, testslideIndex, testshapeIndex, testrowIndex, testcellIndex, testparagraphIndex, testportionIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteTableCellPortion\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "ee2d5d05af42a0b039ad54e7a90a9d77", "score": "0.56189317", "text": "func TestCreateChartDataPoint(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"CreateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"CreateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartDataPoint\", \"storage\", \"string\").(string)\n e := InitializeTest(\"CreateChartDataPoint\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.CreateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testdataPoint, testpassword, testfolder, teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "f726eccc4319b54e1ab8a884861fe747", "score": "0.55846137", "text": "func TestCreateChartSeriesInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"CreateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"CreateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"CreateChartSeries\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"CreateChartSeries\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateChartSeries(testname, testslideIndex, testshapeIndex, testseries, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateChartSeries\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "055fcc49329c3c5f406c86b2387730af", "score": "0.55811256", "text": "func TestDeleteSpecialSlidePortionsInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteSpecialSlidePortions\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteSpecialSlidePortions\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DeleteSpecialSlidePortions\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DeleteSpecialSlidePortions\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeleteSpecialSlidePortions\", \"paragraphIndex\", \"int32\").(int32)\n testportions, _ := createTestParamValue(\"DeleteSpecialSlidePortions\", \"portions\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeleteSpecialSlidePortions\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteSpecialSlidePortions\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteSpecialSlidePortions\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteSpecialSlidePortions\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteSpecialSlidePortions\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteSpecialSlidePortions\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteSpecialSlidePortions(testname, testslideIndex, testslideType, testshapeIndex, testparagraphIndex, testportions, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteSpecialSlidePortions\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "1db610267b332726175dbc2980d01660", "score": "0.55759156", "text": "func TestUpdateChartDataPointInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"UpdateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"UpdateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"UpdateChartDataPoint\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"UpdateChartDataPoint\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartDataPoint\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "bc09446f6583ca4878c9c8c2535857a3", "score": "0.5537431", "text": "func TestDeleteSpecialSlidePortionInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteSpecialSlidePortion\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteSpecialSlidePortion\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DeleteSpecialSlidePortion\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DeleteSpecialSlidePortion\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeleteSpecialSlidePortion\", \"paragraphIndex\", \"int32\").(int32)\n testportionIndex, _ := createTestParamValue(\"DeleteSpecialSlidePortion\", \"portionIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteSpecialSlidePortion\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteSpecialSlidePortion\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteSpecialSlidePortion\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteSpecialSlidePortion\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteSpecialSlidePortion\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteSpecialSlidePortion\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteSpecialSlidePortion(testname, testslideIndex, testslideType, testshapeIndex, testparagraphIndex, testportionIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteSpecialSlidePortion\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "5939134941a45e55a216deefaa356a34", "score": "0.55145", "text": "func TestDeleteShapeInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"DeleteShape\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteShape\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteShape(testname, testslideIndex, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteShape\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "1234d151602ab002341a33b26d72a95d", "score": "0.55038244", "text": "func TestDeleteSpecialSlideParagraphInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteSpecialSlideParagraph\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteSpecialSlideParagraph\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DeleteSpecialSlideParagraph\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DeleteSpecialSlideParagraph\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeleteSpecialSlideParagraph\", \"paragraphIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteSpecialSlideParagraph\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteSpecialSlideParagraph\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteSpecialSlideParagraph\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteSpecialSlideParagraph\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteSpecialSlideParagraph\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteSpecialSlideParagraph\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteSpecialSlideParagraph(testname, testslideIndex, testslideType, testshapeIndex, testparagraphIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteSpecialSlideParagraph\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "13b6a1e51ce4c381141c7ccb341d7252", "score": "0.5499987", "text": "func TestDeleteShapes(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteShapes\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteShapes\", \"slideIndex\", \"int32\").(int32)\n testshapes, _ := createTestParamValue(\"DeleteShapes\", \"shapes\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeleteShapes\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteShapes\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteShapes\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteShapes\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"DeleteShapes\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.DeleteShapes(testname, testslideIndex, testshapes, testpassword, testfolder, teststorage, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "5b419894da78d47840e14e767da76af4", "score": "0.5495269", "text": "func TestCreateChartSeries(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"CreateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"CreateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartSeries\", \"storage\", \"string\").(string)\n e := InitializeTest(\"CreateChartSeries\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.CreateChartSeries(testname, testslideIndex, testshapeIndex, testseries, testpassword, testfolder, teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "a2ac49906c095b3e7df20c776c15c83c", "score": "0.54946864", "text": "func TestUpdateChartSeriesInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"UpdateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"UpdateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"UpdateChartSeries\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"UpdateChartSeries\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testseries, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartSeries\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "e1b8d0f37fea9a10249e141d4caf56b2", "score": "0.54916763", "text": "func TestUpdateChartDataPointInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testpointIndex, _ := createTestParamValue(\"UpdateChartDataPoint\", \"pointIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"UpdateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"UpdateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"UpdateChartDataPoint\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"UpdateChartDataPoint\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testpointIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartDataPoint\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "7c821aff2d108d631004599792570514", "score": "0.54770017", "text": "func (m *Model) DeleteSeries(id int) error {\n\treturn m.exec(qryDeleteSeries, id)\n}", "title": "" }, { "docid": "64feec44005db0ff0adaeafe6fdddc28", "score": "0.54721665", "text": "func (o *HistoricDatum) DeleteP(exec boil.Executor) {\n\tif err := o.Delete(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "2124166526a92536bfc5a5263da85210", "score": "0.54601467", "text": "func TestDeleteShapeInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"DeleteShape\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteShape\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteShape(testname, testslideIndex, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteShape\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "a48fbb182d392a157be192dadce2c6b4", "score": "0.5457499", "text": "func TestDeleteSpecialSlideShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"DeleteSpecialSlideShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.DeleteSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "19918b4fe2b10ea735182b5dc3cce767", "score": "0.5448506", "text": "func TestDeleteSpecialSlideShapeInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DeleteSpecialSlideShape\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteSpecialSlideShape\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteSpecialSlideShape\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "1ac7248e87c66be47af24314407d3ad7", "score": "0.54435503", "text": "func TestDeleteSpecialSlideParagraphsInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteSpecialSlideParagraphs\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteSpecialSlideParagraphs\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DeleteSpecialSlideParagraphs\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DeleteSpecialSlideParagraphs\", \"shapeIndex\", \"int32\").(int32)\n testparagraphs, _ := createTestParamValue(\"DeleteSpecialSlideParagraphs\", \"paragraphs\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeleteSpecialSlideParagraphs\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteSpecialSlideParagraphs\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteSpecialSlideParagraphs\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteSpecialSlideParagraphs\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DeleteSpecialSlideParagraphs\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteSpecialSlideParagraphs\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteSpecialSlideParagraphs(testname, testslideIndex, testslideType, testshapeIndex, testparagraphs, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteSpecialSlideParagraphs\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "b1f76af127b6f8313c23e9d345742fe4", "score": "0.54268116", "text": "func TestSetChartLegendInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"SetChartLegend\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SetChartLegend\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SetChartLegend\", \"shapeIndex\", \"int32\").(int32)\n testlegend, _ := createTestParamValue(\"SetChartLegend\", \"legend\", \"Legend\").(ILegend)\n testpassword, _ := createTestParamValue(\"SetChartLegend\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SetChartLegend\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SetChartLegend\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"SetChartLegend\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SetChartLegend\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.SetChartLegend(testname, testslideIndex, testshapeIndex, testlegend, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SetChartLegend\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "587a34f0c6f5a8505a15903fab39c466", "score": "0.54266363", "text": "func TestDeleteChartCategoryInvalidFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteChartCategory\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"shapeIndex\", \"int32\").(int32)\n testcategoryIndex, _ := createTestParamValue(\"DeleteChartCategory\", \"categoryIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteChartCategory\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteChartCategory\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteChartCategory\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfolder, \"DeleteChartCategory\", \"folder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfolder = nullValue\n } else {\n testfolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteChartCategory\", \"folder\", testfolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteChartCategory(testname, testslideIndex, testshapeIndex, testcategoryIndex, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteChartCategory\", \"folder\", \"string\", testfolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "b15f17cfb392642c76d0e735b710b28a", "score": "0.5415277", "text": "func TestDeletePortionsInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DeletePortions\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeletePortions\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeletePortions\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeletePortions\", \"paragraphIndex\", \"int32\").(int32)\n testportions, _ := createTestParamValue(\"DeletePortions\", \"portions\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeletePortions\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeletePortions\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeletePortions\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeletePortions\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"DeletePortions\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeletePortions\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeletePortions(testname, testslideIndex, testshapeIndex, testparagraphIndex, testportions, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeletePortions\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "44cddc6a96291305c92116fff9b2fb70", "score": "0.5414983", "text": "func TestSetChartWallInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"SetChartWall\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SetChartWall\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SetChartWall\", \"shapeIndex\", \"int32\").(int32)\n testchartWallType, _ := createTestParamValue(\"SetChartWall\", \"chartWallType\", \"string\").(string)\n testchartWall, _ := createTestParamValue(\"SetChartWall\", \"chartWall\", \"ChartWall\").(IChartWall)\n testpassword, _ := createTestParamValue(\"SetChartWall\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SetChartWall\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SetChartWall\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"SetChartWall\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SetChartWall\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.SetChartWall(testname, testslideIndex, testshapeIndex, testchartWallType, testchartWall, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SetChartWall\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "1327d90abb700f2b9a23261f26ade793", "score": "0.54133993", "text": "func (c *cachedCharts) DeleteChart(repoName string, chartName string, chartVersion string) error {\n\n\tdb, closer := c.dbSession.DB()\n\tdefer closer()\n\n\trepo, err := models.GetRepo(db, repoName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.rwm.Lock()\n\n\tfor k, chart := range c.allCharts[repoName] {\n\n\t\tif *chart.Name == chartName && *chart.Version == chartVersion {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"path\": charthelper.DataDirBase(),\n\t\t\t}).Info(chartName + \" - \" + chartVersion + \" deleted\")\n\n\t\t\tc.allCharts[repo.Name] = append(c.allCharts[repo.Name][:k], c.allCharts[repo.Name][k+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tc.rwm.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "bdc7a1892cd0bee08d6c49723f20fbc8", "score": "0.54080546", "text": "func (idx *SeriesIndex) Delete(id uint64) {\n\tidx.execEntry(SeriesEntryTombstoneFlag, id, 0, nil)\n}", "title": "" }, { "docid": "59db632e84f89cbcf90b1bc1b2e3c9a0", "score": "0.5403536", "text": "func TestSetChartSeriesGroupInvalidSeriesGroup(t *testing.T) {\n testname, _ := createTestParamValue(\"SetChartSeriesGroup\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"shapeIndex\", \"int32\").(int32)\n testseriesGroupIndex, _ := createTestParamValue(\"SetChartSeriesGroup\", \"seriesGroupIndex\", \"int32\").(int32)\n testseriesGroup, _ := createTestParamValue(\"SetChartSeriesGroup\", \"seriesGroup\", \"ChartSeriesGroup\").(IChartSeriesGroup)\n testpassword, _ := createTestParamValue(\"SetChartSeriesGroup\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SetChartSeriesGroup\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SetChartSeriesGroup\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testseriesGroup, \"SetChartSeriesGroup\", \"seriesGroup\", \"ChartSeriesGroup\")\n if (invalidValue == nil) {\n testseriesGroup = nil\n } else {\n testseriesGroup, _ = invalidValue.(IChartSeriesGroup)\n }\n\n e := InitializeTest(\"SetChartSeriesGroup\", \"seriesGroup\", testseriesGroup)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.SetChartSeriesGroup(testname, testslideIndex, testshapeIndex, testseriesGroupIndex, testseriesGroup, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SetChartSeriesGroup\", \"seriesGroup\", \"ChartSeriesGroup\", testseriesGroup, int32(statusCode), e)\n}", "title": "" }, { "docid": "5ffb2d2cc15858bd94535241992fa1a1", "score": "0.5402709", "text": "func (o *HistoricDatum) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no HistoricDatum provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), historicDatumPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"historic_data\\\" WHERE \\\"id\\\"=$1\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete from historic_data\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "29f96ad9f3b908d67df07c881a724d5f", "score": "0.54003435", "text": "func (m *SeriesDB) Delete(ctx context.Context, id int) error {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"series\", \"delete\"}, time.Now())\n\n\tvar obj Series\n\n\terr := m.Db.Delete(&obj, id).Error\n\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"error retrieving Series\", \"error\", err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "14fd63ccc2e29f500a69a31a1cd5c646", "score": "0.5393314", "text": "func TestUpdateChartCategoryInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartCategory\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartCategory\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartCategory\", \"shapeIndex\", \"int32\").(int32)\n testcategoryIndex, _ := createTestParamValue(\"UpdateChartCategory\", \"categoryIndex\", \"int32\").(int32)\n testcategory, _ := createTestParamValue(\"UpdateChartCategory\", \"category\", \"ChartCategory\").(IChartCategory)\n testpassword, _ := createTestParamValue(\"UpdateChartCategory\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartCategory\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartCategory\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"UpdateChartCategory\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"UpdateChartCategory\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartCategory(testname, testslideIndex, testshapeIndex, testcategoryIndex, testcategory, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartCategory\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "40a28373ae2654ab1ac5b074167c1860", "score": "0.5387938", "text": "func TestDeleteShapesInvalidShapes(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteShapes\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteShapes\", \"slideIndex\", \"int32\").(int32)\n testshapes, _ := createTestParamValue(\"DeleteShapes\", \"shapes\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeleteShapes\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteShapes\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteShapes\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteShapes\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapes, \"DeleteShapes\", \"shapes\", \"[]int32\")\n if (invalidValue == nil) {\n testshapes = nil\n } else {\n testshapes, _ = invalidValue.([]int32)\n }\n\n e := InitializeTest(\"DeleteShapes\", \"shapes\", testshapes)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteShapes(testname, testslideIndex, testshapes, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteShapes\", \"shapes\", \"[]int32\", testshapes, int32(statusCode), e)\n}", "title": "" }, { "docid": "8721a4a60ab267ea055a9b24e437a3ee", "score": "0.5375846", "text": "func TestDeleteShapesInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteShapes\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteShapes\", \"slideIndex\", \"int32\").(int32)\n testshapes, _ := createTestParamValue(\"DeleteShapes\", \"shapes\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeleteShapes\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteShapes\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteShapes\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteShapes\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"DeleteShapes\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteShapes\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteShapes(testname, testslideIndex, testshapes, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteShapes\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "c09883139f073d1b53b2f6fd59c45e5a", "score": "0.5373559", "text": "func (h *BaseHandler) deleteTimeSeriesDatum(w http.ResponseWriter, r *http.Request, uid string) {\n ctx := r.Context()\n userUuid := ctx.Value(\"user_uuid\").(string)\n\n // Lookup our record and enforce account access.\n tsd, err := h.TsdRepo.FindByUuid(ctx, uid)\n if err != nil {\n http.Error(w, err.Error(), http.StatusInternalServerError)\n return\n }\n if tsd.UserUuid != userUuid {\n http.Error(w, \"Forbidden\", http.StatusForbidden)\n return\n }\n\n if err := h.TsdRepo.DeleteByUuid(ctx, uid); err != nil {\n http.Error(w, err.Error(), http.StatusInternalServerError)\n }\n w.WriteHeader(http.StatusOK) // Note: https://tools.ietf.org/html/rfc7231#section-6.3.1\n}", "title": "" }, { "docid": "04c592db70e2c131e406e4392669ca17", "score": "0.53546804", "text": "func TestDeletePortionsInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeletePortions\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeletePortions\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeletePortions\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeletePortions\", \"paragraphIndex\", \"int32\").(int32)\n testportions, _ := createTestParamValue(\"DeletePortions\", \"portions\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeletePortions\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeletePortions\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeletePortions\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeletePortions\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DeletePortions\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeletePortions\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeletePortions(testname, testslideIndex, testshapeIndex, testparagraphIndex, testportions, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeletePortions\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "bd508c3fcfa23cb6dd98f7c83d1b7bcf", "score": "0.5343885", "text": "func TestUpdateChartSeriesInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateChartSeries\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"UpdateChartSeries\", \"seriesIndex\", \"int32\").(int32)\n testseries, _ := createTestParamValue(\"UpdateChartSeries\", \"series\", \"Series\").(ISeries)\n testpassword, _ := createTestParamValue(\"UpdateChartSeries\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateChartSeries\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateChartSeries\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"UpdateChartSeries\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"UpdateChartSeries\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateChartSeries(testname, testslideIndex, testshapeIndex, testseriesIndex, testseries, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateChartSeries\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "70e3c0d5de4385d4123a6ed0878103d4", "score": "0.53410906", "text": "func TestDeletePortionInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DeletePortion\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeletePortion\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeletePortion\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeletePortion\", \"paragraphIndex\", \"int32\").(int32)\n testportionIndex, _ := createTestParamValue(\"DeletePortion\", \"portionIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeletePortion\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeletePortion\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeletePortion\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeletePortion\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"DeletePortion\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeletePortion\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeletePortion(testname, testslideIndex, testshapeIndex, testparagraphIndex, testportionIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeletePortion\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "387b69169f00be219917f248105ec860", "score": "0.5340773", "text": "func TestCreateChartDataPointInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateChartDataPoint\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"shapeIndex\", \"int32\").(int32)\n testseriesIndex, _ := createTestParamValue(\"CreateChartDataPoint\", \"seriesIndex\", \"int32\").(int32)\n testdataPoint, _ := createTestParamValue(\"CreateChartDataPoint\", \"dataPoint\", \"DataPoint\").(IDataPoint)\n testpassword, _ := createTestParamValue(\"CreateChartDataPoint\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateChartDataPoint\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateChartDataPoint\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"CreateChartDataPoint\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"CreateChartDataPoint\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateChartDataPoint(testname, testslideIndex, testshapeIndex, testseriesIndex, testdataPoint, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateChartDataPoint\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "311b7eae26f7d60fa63877404ffbb809", "score": "0.533645", "text": "func TestDeleteSpecialSlideShapesInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteSpecialSlideShapes\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteSpecialSlideShapes\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DeleteSpecialSlideShapes\", \"slideType\", \"string\").(string)\n testshapes, _ := createTestParamValue(\"DeleteSpecialSlideShapes\", \"shapes\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeleteSpecialSlideShapes\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteSpecialSlideShapes\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteSpecialSlideShapes\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteSpecialSlideShapes\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DeleteSpecialSlideShapes\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DeleteSpecialSlideShapes\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteSpecialSlideShapes(testname, testslideIndex, testslideType, testshapes, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteSpecialSlideShapes\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "61011ff7e31a59ceacca8476a723ff05", "score": "0.53285354", "text": "func TestDeleteParagraphInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteParagraph\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteParagraph\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteParagraph\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"DeleteParagraph\", \"paragraphIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"DeleteParagraph\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteParagraph\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteParagraph\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteParagraph\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"DeleteParagraph\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteParagraph\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteParagraph(testname, testslideIndex, testshapeIndex, testparagraphIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteParagraph\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "3a9b18ab0d6d7847b19cca193e0b77a5", "score": "0.5326138", "text": "func TestDeleteParagraphsInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DeleteParagraphs\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DeleteParagraphs\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DeleteParagraphs\", \"shapeIndex\", \"int32\").(int32)\n testparagraphs, _ := createTestParamValue(\"DeleteParagraphs\", \"paragraphs\", \"[]int32\").([]int32)\n testpassword, _ := createTestParamValue(\"DeleteParagraphs\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DeleteParagraphs\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DeleteParagraphs\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DeleteParagraphs\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"DeleteParagraphs\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DeleteParagraphs\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DeleteParagraphs(testname, testslideIndex, testshapeIndex, testparagraphs, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DeleteParagraphs\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" } ]
4fe201d3858b95d24970413517771f43
Queries . Test 3: Multiple database queries.
[ { "docid": "0f1eead8382a02df85e711a06fe886b3", "score": "0.615337", "text": "func Queries(w http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\tqueries = queriesParam(r)\n\t\tworlds = acquireWorlds()\n\t)\n\tworlds.W = worlds.W[:queries]\n\tfor i := 0; i < queries; i++ {\n\t\tworld := &worlds.W[i]\n\t\t_ = db.QueryRow(ctx, worldSelectSQL, randomWorldNum()).Scan(&world.ID, &world.RandomNumber)\n\t}\n\toutput, _ := sonic.Marshal(worlds.W)\n\tw.Header().Set(\"Content-Type\", contentTypeJson)\n\t_, _ = w.Write(output)\n\treleaseWorlds(worlds)\n}", "title": "" } ]
[ { "docid": "40874ae7e8fbaf93ceafe1b1993b60c3", "score": "0.71350974", "text": "func testQueries(t *testing.T, env *model.TestEnv, options queryTestOptions, testCases []queryTestCase) {\n\tt.Logf(\"Executing %d test cases\", len(testCases))\n\n\tvar resetDb = func() {\n\t\tassert.NoErr(t, model.BoxForEntity(env.ObjectBox).RemoveAll())\n\t\tassert.NoErr(t, model.BoxForEntityByValue(env.ObjectBox).RemoveAll())\n\t\tassert.NoErr(t, model.BoxForTestEntityRelated(env.ObjectBox).RemoveAll())\n\t\tassert.NoErr(t, model.BoxForTestEntityInline(env.ObjectBox).RemoveAll())\n\t\tassert.NoErr(t, model.BoxForTestStringIdEntity(env.ObjectBox).RemoveAll())\n\n\t\t// insert new entries\n\t\tenv.Populate(options.baseCount)\n\t}\n\n\tfor i, tc := range testCases {\n\t\t// reset Db before each query, necessary due to query.Remove()\n\t\t// TODO we can replace this to make the test run faster by a managed transaction with rollback\n\t\tresetDb()\n\n\t\t// assign some readable variable names\n\t\tvar count = tc.c\n\t\tvar desc = tc.d\n\t\tvar setup = tc.f\n\n\t\tvar query *objectbox.Query\n\t\tvar box *objectbox.Box\n\t\tvar baseCount uint64\n\t\tif q, valid := tc.q.(*model.EntityQuery); valid {\n\t\t\tquery = q.Query\n\t\t\tbox = model.BoxForEntity(env.ObjectBox).Box\n\t\t\tbaseCount = uint64(options.baseCount)\n\t\t} else if q, valid := tc.q.(*model.TestEntityRelatedQuery); valid {\n\t\t\tquery = q.Query\n\t\t\tbox = model.BoxForTestEntityRelated(env.ObjectBox).Box\n\t\t\tbaseCount = uint64(options.baseCount) * 3 // TestEnv::Populate() currently inserts 3 relations for each main entity\n\t\t} else if q, valid := tc.q.(*model.EntityByValueQuery); valid {\n\t\t\tquery = q.Query\n\t\t\tbox = model.BoxForEntityByValue(env.ObjectBox).Box\n\t\t\tbaseCount = uint64(options.baseCount) * 5 // TestEnv::Populate() currently inserts 5 relations for each main entity\n\t\t} else {\n\t\t\tassert.Failf(t, \"Query is not supported by the test executor: %v\", tc.q)\n\t\t}\n\n\t\t// run query-setup function, if defined\n\t\tif setup != nil {\n\t\t\tif err := setup(query); err != nil {\n\t\t\t\tassert.Failf(t, \"case #%d {%s} setup failed - %s\", i, desc, err)\n\t\t\t}\n\t\t}\n\n\t\tvar isExpected = func(actualDesc string) bool {\n\t\t\tfor _, expectedDescription := range desc {\n\t\t\t\tif expectedDescription == actualDesc {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\n\t\t// DescribeParams\n\t\tvar removeSpecialChars = strings.NewReplacer(\"\\n\", \"\", \"\\t\", \"\")\n\t\tif actualDesc, err := query.DescribeParams(); err != nil {\n\t\t\tassert.Failf(t, \"case #%d {%s} - %s\", i, desc, err)\n\t\t} else if actualDesc = removeSpecialChars.Replace(actualDesc); !isExpected(actualDesc) {\n\t\t\tassert.Failf(t, \"case #%d expected one of %v, but got {%s}\", i, desc, actualDesc)\n\t\t}\n\n\t\t// Find\n\t\tvar actualData interface{}\n\t\tif data, err := query.Find(); err != nil {\n\t\t\tassert.Failf(t, \"case #%d {%s} %s\", i, desc, err)\n\t\t} else if data == nil {\n\t\t\tassert.Failf(t, \"case #%d {%s} data is nil\", i, desc)\n\t\t} else if reflect.ValueOf(data).Len() != count {\n\t\t\tassert.Failf(t, \"case #%d {%s} expected %d, but got %d len(Find())\", i, desc, count, reflect.ValueOf(data).Len())\n\t\t} else {\n\t\t\tactualData = data\n\t\t}\n\n\t\t// Count\n\t\tif !options.skipCount {\n\t\t\tif actualCount, err := query.Count(); err != nil {\n\t\t\t\tassert.Failf(t, \"case #%d {%s} %s\", i, desc, err)\n\t\t\t} else if uint64(count) != actualCount {\n\t\t\t\tassert.Failf(t, \"case #%d {%s} expected %d, but got %d Count()\", i, desc, count, actualCount)\n\t\t\t}\n\t\t}\n\n\t\t// FindIds\n\t\tif ids, err := query.FindIds(); err != nil {\n\t\t\tassert.Failf(t, \"case #%d {%s} %s\", i, desc, err)\n\t\t} else {\n\t\t\t//t.Logf(\"case #%d {%s} - checking all IDs are present in the result\", i, desc)\n\t\t\tmatchAllEntityIds(t, ids, actualData)\n\t\t}\n\n\t\t// Remove\n\t\tif !options.skipRemove {\n\t\t\tif removedCount, err := query.Remove(); err != nil {\n\t\t\t\tassert.Failf(t, \"case #%d {%s} %s\", i, desc, err)\n\t\t\t} else if uint64(count) != removedCount {\n\t\t\t\tassert.Failf(t, \"case #%d {%s} expected %d, but got %d Remove()\", i, desc, count, removedCount)\n\t\t\t} else if actualCount, err := box.Count(); err != nil {\n\t\t\t\tassert.Failf(t, \"case #%d {%s} %s\", i, desc, err)\n\t\t\t} else if actualCount+removedCount != baseCount {\n\t\t\t\tassert.Failf(t, \"case #%d {%s} expected %d, but got %d Box.Count() after remove\",\n\t\t\t\t\ti, desc, baseCount-removedCount, actualCount)\n\t\t\t}\n\t\t}\n\n\t\tif err := query.Close(); err != nil {\n\t\t\tassert.Failf(t, \"case #%d {%s} %s\", i, desc, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "594070ce0628daefd765b188677afa6f", "score": "0.6857825", "text": "func TestQueries(t *testing.T, builder Builder) {\n\tt.Run(\"SELECT\", func(t *testing.T) {\n\t\tng, cleanup := builder()\n\t\tdefer cleanup()\n\t\tdefer func() {\n\t\t\tassert.NoError(t, ng.Close())\n\t\t}()\n\n\t\tdb, err := genji.New(context.Background(), ng)\n\t\tassert.NoError(t, err)\n\n\t\td, err := db.QueryDocument(`\n\t\t\tCREATE TABLE test;\n\t\t\tINSERT INTO test (a) VALUES (1), (2), (3), (4);\n\t\t\tSELECT COUNT(*) FROM test;\n\t\t`)\n\t\tassert.NoError(t, err)\n\t\tvar count int\n\t\terr = document.Scan(d, &count)\n\t\tassert.NoError(t, err)\n\t\trequire.Equal(t, 4, count)\n\n\t\tt.Run(\"ORDER BY\", func(t *testing.T) {\n\t\t\tst, err := db.Query(\"SELECT * FROM test ORDER BY a DESC\")\n\t\t\tassert.NoError(t, err)\n\t\t\tdefer st.Close()\n\n\t\t\tvar i int\n\t\t\terr = st.Iterate(func(d types.Document) error {\n\t\t\t\tvar a int\n\t\t\t\terr := document.Scan(d, &a)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\trequire.Equal(t, 4-i, a)\n\t\t\t\ti++\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tassert.NoError(t, err)\n\t\t})\n\t})\n\n\tt.Run(\"INSERT\", func(t *testing.T) {\n\t\tng, cleanup := builder()\n\t\tdefer cleanup()\n\t\tdefer func() {\n\t\t\tassert.NoError(t, ng.Close())\n\t\t}()\n\n\t\tdb, err := genji.New(context.Background(), ng)\n\t\tassert.NoError(t, err)\n\n\t\terr = db.Exec(`\n\t\t\tCREATE TABLE test;\n\t\t\tINSERT INTO test (a) VALUES (1), (2), (3), (4);\n\t\t`)\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"UPDATE\", func(t *testing.T) {\n\t\tng, cleanup := builder()\n\t\tdefer cleanup()\n\t\tdefer func() {\n\t\t\tassert.NoError(t, ng.Close())\n\t\t}()\n\n\t\tdb, err := genji.New(context.Background(), ng)\n\t\tassert.NoError(t, err)\n\n\t\tst, err := db.Query(`\n\t\t\t\tCREATE TABLE test;\n\t\t\t\tINSERT INTO test (a) VALUES (1), (2), (3), (4);\n\t\t\t\tUPDATE test SET a = 5;\n\t\t\t\tSELECT * FROM test;\n\t\t\t`)\n\t\tassert.NoError(t, err)\n\t\tdefer st.Close()\n\t\tvar buf bytes.Buffer\n\t\terr = testutil.IteratorToJSONArray(&buf, st)\n\t\tassert.NoError(t, err)\n\t\trequire.JSONEq(t, `[{\"a\": 5},{\"a\": 5},{\"a\": 5},{\"a\": 5}]`, buf.String())\n\t})\n\n\tt.Run(\"DELETE\", func(t *testing.T) {\n\t\tng, cleanup := builder()\n\t\tdefer cleanup()\n\t\tdefer func() {\n\t\t\tassert.NoError(t, ng.Close())\n\t\t}()\n\n\t\tdb, err := genji.New(context.Background(), ng)\n\t\tassert.NoError(t, err)\n\n\t\terr = db.Exec(\"CREATE TABLE test\")\n\t\tassert.NoError(t, err)\n\n\t\terr = db.Update(func(tx *genji.Tx) error {\n\t\t\tfor i := 1; i < 200; i++ {\n\t\t\t\terr = tx.Exec(\"INSERT INTO test (a) VALUES (?)\", i)\n\t\t\t\tassert.NoError(t, err)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tassert.NoError(t, err)\n\n\t\td, err := db.QueryDocument(`\n\t\t\tDELETE FROM test WHERE a > 2;\n\t\t\tSELECT COUNT(*) FROM test;\n\t\t`)\n\t\tassert.NoError(t, err)\n\t\tvar count int\n\t\terr = document.Scan(d, &count)\n\t\tassert.NoError(t, err)\n\t\trequire.Equal(t, 2, count)\n\t})\n}", "title": "" }, { "docid": "3195ff05a72f0f444ef1dff7a709a64f", "score": "0.68514234", "text": "func queryDB(clnt client.Client, cmd string) (res []client.Result, _ error) {\n\tq := client.Query{\n\t\tCommand: cmd,\n\t\tDatabase: db,\n\t}\n\tif response, err := clnt.Query(q); err == nil {\n\t\tif response.Error() != nil {\n\t\t\treturn res, response.Error()\n\t\t}\n\t\tres = response.Results\n\t} else {\n\t\treturn res, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "23496bb662e2a38c8a5043b69a9bbe85", "score": "0.6824943", "text": "func (this *QueryEngine) QuerySequential(queries []string, single bool) ([]*QueryRes, error){\n db, err := sql.Open(\"avatica\", this.server)\n if err != nil {\n return nil,err\n } else {\n results := make([]*QueryRes, len(queries))\n for i, q := range queries {\n results[i] = this.exec_query(db, q, single)\n }\n return results,nil\n }\n}", "title": "" }, { "docid": "e001a610a02432e74d69b3ff290a56f7", "score": "0.6820689", "text": "func queryDB(clnt client.Client, cmd string) (res []client.Result, err error) {\n\tq := client.Query{\n\t\tCommand: cmd,\n\t\tDatabase: *DB,\n\t}\n\tif response, err := clnt.Query(q); err == nil {\n\t\tif response.Error() != nil {\n\t\t\treturn res, response.Error()\n\t\t}\n\t\tres = response.Results\n\t} else {\n\t\treturn res, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "bba18f79e766ab4b04a3b5a17db4b81f", "score": "0.68147254", "text": "func queryDB(clnt client.Client, cmd string) (res []client.Result, err error) {\n\tq := client.Query{\n\t\tCommand: cmd,\n\t\tDatabase: db,\n\t}\n\tif response, err := clnt.Query(q); err == nil {\n\t\tif response.Error() != nil {\n\t\t\treturn res, response.Error()\n\t\t}\n\t\tres = response.Results\n\t} else {\n\t\treturn res, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "3af6fc067e0c249ded7b4e6b5c51050c", "score": "0.6752268", "text": "func queryDB(clnt client.Client, cmd, db string) (res []client.Result, err error) {\n\tq := client.Query{\n\t\tCommand: cmd,\n\t\tDatabase: db,\n\t}\n\tif response, err := clnt.Query(q); err == nil {\n\t\tif response.Error() != nil {\n\t\t\treturn res, response.Error()\n\t\t}\n\t\tres = response.Results\n\t} else {\n\t\treturn res, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "b8cde4ff75ed837120c3d4a1a26ac10e", "score": "0.66598475", "text": "func TestQueries(t *testing.T) {\n\tsuite.Run(t, new(QueriesTestSuite))\n}", "title": "" }, { "docid": "e2aeb8033655a6c0b170554a3e7f932c", "score": "0.65326023", "text": "func (cn *connDb) query(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error) {\n\trows, err = cn.coreDb.QueryContext(ctx, query, args...)\n\tif err != nil {\n\t\tlog.Printf(\"sql:%v,result:%v\", query, err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6d11e3fbd155e9c958983305406d4ab7", "score": "0.6529235", "text": "func (p *DB) Query(s string, args ...interface{}) (*Rows, error) {\n\tlog.DefaultLogger.Debug(\"query_sql_start \", s, args)\n\trs, err := p.db(s[0:6]).Query(s, args...)\n\tlog.DefaultLogger.Debug(\"query_sql_done \", s, args, err)\n\tif nil != err {\n\t\tbody := fmt.Sprintf(\"%s err:%v sql:%s args:%v\", errDbQuery, err, s, args)\n\t\tlog.DefaultLogger.Warning(body)\n\t\treturn nil, errors.New(body)\n\t}\n\n\treturn NewRows(rs)\n}", "title": "" }, { "docid": "434ed7c9dc59e3d84059fd78d10e6d19", "score": "0.64547706", "text": "func (tx *Tx) Query(query string, args ...interface{}) (*Rows, error) {}", "title": "" }, { "docid": "d86edcb3c3bfaee80d5d000192c9ab26", "score": "0.64379287", "text": "func (e *Env) queryAll(c *gin.Context) {\n\tvar respJSON []Data\n\te.db.All(&respJSON)\n\tc.JSON(http.StatusOK, respJSON)\n}", "title": "" }, { "docid": "cb74108091225214242dcfb6cca43d0c", "score": "0.6391995", "text": "func (q *Querier) Query(query string, args ...interface{}) (*sql.Rows, error) {\n\tstart := time.Now()\n\tq.logBefore(query, args)\n\tdbtx := q.selectDBForQuery(query)\n\trows, err := dbtx.Query(query, args...)\n\tq.logAfter(query, args, time.Now().Sub(start), err)\n\treturn rows, err\n}", "title": "" }, { "docid": "91c67b7fc107ef3296f61d3571daa563", "score": "0.63813716", "text": "func QueryAll(L *lua.State) int {\n\ttable := L.ToString(1)\n\n\trows := DBRoot.QueryAll(table)\n\n\tExportRows(L, rows)\n\n\treturn 1\n}", "title": "" }, { "docid": "2ce146c509573ae16ead3769a43fa122", "score": "0.6376101", "text": "func TestQuery(t *testing.T) {\n\tt.Run(\"users\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tvar query struct {\n\t\t\tUsers []gqlmod.User `json:\"users\"`\n\t\t}\n\t\trequire.NoError(t, s.ts.Debug().Query(\n\t\t\t`query {\n\t\t\t\tusers {\n\t\t\t\t\tid\n\t\t\t\t\tcreation\n\t\t\t\t\tdisplayName\n\t\t\t\t\temail\n\t\t\t\t}\n\t\t\t}`,\n\t\t\t&query,\n\t\t))\n\t\trequire.Len(t, query.Users, len(s.users))\n\t\tfor _, actual := range query.Users {\n\t\t\trequire.Contains(t, s.users, *actual.ID)\n\t\t\tcompareUsers(t, s.users[*actual.ID], &actual)\n\t\t}\n\t})\n\n\tt.Run(\"users (none)\", func(t *testing.T) {\n\t\tts := setup.New(t, tcx)\n\t\tdefer ts.Teardown()\n\n\t\tvar query struct {\n\t\t\tUsers []gqlmod.User `json:\"users\"`\n\t\t}\n\t\trequire.NoError(t, ts.Debug().Query(\n\t\t\t`query {\n\t\t\t\tusers {\n\t\t\t\t\tid\n\t\t\t\t\tcreation\n\t\t\t\t\tdisplayName\n\t\t\t\t\temail\n\t\t\t\t}\n\t\t\t}`,\n\t\t\t&query,\n\t\t))\n\t\trequire.Len(t, query.Users, 0)\n\t})\n\n\tt.Run(\"posts\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tvar query struct {\n\t\t\tPosts []gqlmod.Post `json:\"posts\"`\n\t\t}\n\t\trequire.NoError(t, s.ts.Debug().Query(\n\t\t\t`query {\n\t\t\t\tposts {\n\t\t\t\t\tid\n\t\t\t\t\tcreation\n\t\t\t\t\ttitle\n\t\t\t\t\tcontents\n\t\t\t\t}\n\t\t\t}`,\n\t\t\t&query,\n\t\t))\n\t\trequire.Len(t, query.Posts, len(s.posts))\n\t\tfor _, actual := range query.Posts {\n\t\t\trequire.Contains(t, s.posts, *actual.ID)\n\t\t\tcomparePosts(t, s.posts[*actual.ID], &actual)\n\t\t}\n\t})\n\n\tt.Run(\"posts (none)\", func(t *testing.T) {\n\t\tts := setup.New(t, tcx)\n\t\tdefer ts.Teardown()\n\n\t\tvar query struct {\n\t\t\tPosts []gqlmod.Post `json:\"posts\"`\n\t\t}\n\t\trequire.NoError(t, ts.Debug().Query(\n\t\t\t`query {\n\t\t\t\tposts {\n\t\t\t\t\tid\n\t\t\t\t\tcreation\n\t\t\t\t\ttitle\n\t\t\t\t\tcontents\n\t\t\t\t}\n\t\t\t}`,\n\t\t\t&query,\n\t\t))\n\t\trequire.Len(t, query.Posts, 0)\n\t})\n\n\tt.Run(\"user\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tclt := s.ts.Debug()\n\n\t\tfor _, expected := range s.users {\n\t\t\tvar query struct {\n\t\t\t\tUser *gqlmod.User `json:\"user\"`\n\t\t\t}\n\t\t\trequire.NoError(t, clt.QueryVar(\n\t\t\t\t`query($userId: Identifier!) {\n\t\t\t\t\tuser(id: $userId) {\n\t\t\t\t\t\tid\n\t\t\t\t\t\tcreation\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t\temail\n\t\t\t\t\t}\n\t\t\t\t}`,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"userId\": string(*expected.ID),\n\t\t\t\t},\n\t\t\t\t&query,\n\t\t\t))\n\t\t\trequire.NotNil(t, query.User)\n\t\t\tcompareUsers(t, expected, query.User)\n\t\t}\n\t})\n\n\tt.Run(\"user (inexistent)\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tvar query struct {\n\t\t\tUser *gqlmod.User `json:\"user\"`\n\t\t}\n\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t`query($userId: Identifier!) {\n\t\t\t\tuser(id: $userId) {\n\t\t\t\t\tid\n\t\t\t\t\tcreation\n\t\t\t\t\tdisplayName\n\t\t\t\t\temail\n\t\t\t\t}\n\t\t\t}`,\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"userId\": string(store.NewID()),\n\t\t\t},\n\t\t\t&query,\n\t\t))\n\t\trequire.Nil(t, query.User)\n\t})\n\n\tt.Run(\"post\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tfor _, expected := range s.posts {\n\t\t\tvar query struct {\n\t\t\t\tPost *gqlmod.Post `json:\"post\"`\n\t\t\t}\n\t\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t\t`query($postId: Identifier!) {\n\t\t\t\t\tpost(id: $postId) {\n\t\t\t\t\t\tid\n\t\t\t\t\t\tcreation\n\t\t\t\t\t\ttitle\n\t\t\t\t\t\tcontents\n\t\t\t\t\t}\n\t\t\t\t}`,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"postId\": string(*expected.ID),\n\t\t\t\t},\n\t\t\t\t&query,\n\t\t\t))\n\t\t\trequire.NotNil(t, query.Post)\n\t\t\tcomparePosts(t, expected, query.Post)\n\t\t}\n\t})\n\n\tt.Run(\"post (inexistent)\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tvar query struct {\n\t\t\tPost *gqlmod.Post `json:\"post\"`\n\t\t}\n\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t`query($postId: Identifier!) {\n\t\t\t\tpost(id: $postId) {\n\t\t\t\t\tid\n\t\t\t\t\tcreation\n\t\t\t\t\ttitle\n\t\t\t\t\tcontents\n\t\t\t\t}\n\t\t\t}`,\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"postId\": string(store.NewID()),\n\t\t\t},\n\t\t\t&query,\n\t\t))\n\t\trequire.Nil(t, query.Post)\n\t})\n\n\tt.Run(\"reaction\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tfor _, expected := range s.reactions {\n\t\t\tvar query struct {\n\t\t\t\tReaction *gqlmod.Reaction `json:\"reaction\"`\n\t\t\t}\n\t\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t\t`query($reactionId: Identifier!) {\n\t\t\t\t\treaction(id: $reactionId) {\n\t\t\t\t\t\tid\n\t\t\t\t\t\tcreation\n\t\t\t\t\t\temotion\n\t\t\t\t\t\tmessage\n\t\t\t\t\t}\n\t\t\t\t}`,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"reactionId\": string(*expected.ID),\n\t\t\t\t},\n\t\t\t\t&query,\n\t\t\t))\n\t\t\tcompareReactions(t, expected, query.Reaction)\n\t\t}\n\t})\n\n\tt.Run(\"reaction (inexistent)\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tvar query struct {\n\t\t\tReaction *gqlmod.Reaction `json:\"reaction\"`\n\t\t}\n\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t`query($reactionId: Identifier!) {\n\t\t\t\treaction(id: $reactionId) {\n\t\t\t\t\tid\n\t\t\t\t\tcreation\n\t\t\t\t\temotion\n\t\t\t\t\tmessage\n\t\t\t\t}\n\t\t\t}`,\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"reactionId\": string(store.NewID()),\n\t\t\t},\n\t\t\t&query,\n\t\t))\n\t\trequire.Nil(t, query.Reaction)\n\t})\n\n\tt.Run(\"User.posts\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tfor authorID, posts := range s.postsByAuthor {\n\t\t\tvar query struct {\n\t\t\t\tUser *gqlmod.User `json:\"user\"`\n\t\t\t}\n\t\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t\t`query($userId: Identifier!) {\n\t\t\t\t\tuser(id: $userId) {\n\t\t\t\t\t\tposts {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\tcontents\n\t\t\t\t\t\t\tcreation\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}`,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"userId\": string(authorID),\n\t\t\t\t},\n\t\t\t\t&query,\n\t\t\t))\n\n\t\t\trequire.NotNil(t, query.User)\n\t\t\trequire.Len(t, query.User.Posts, len(posts))\n\n\t\t\tfor _, actualPost := range query.User.Posts {\n\t\t\t\tid := *actualPost.ID\n\t\t\t\trequire.Contains(t, posts, id)\n\t\t\t\tcomparePosts(t, posts[id], &actualPost)\n\t\t\t}\n\t\t}\n\t})\n\n\tt.Run(\"Post.author\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tfor postID, author := range s.authorByPosts {\n\t\t\tvar query struct {\n\t\t\t\tPost *gqlmod.Post `json:\"post\"`\n\t\t\t}\n\t\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t\t`query($postId: Identifier!) {\n\t\t\t\t\tpost(id: $postId) {\n\t\t\t\t\t\tauthor {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\temail\n\t\t\t\t\t\t\tdisplayName\n\t\t\t\t\t\t\tcreation\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}`,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"postId\": string(postID),\n\t\t\t\t},\n\t\t\t\t&query,\n\t\t\t))\n\n\t\t\trequire.NotNil(t, query.Post)\n\t\t\trequire.NotNil(t, query.Post.Author)\n\t\t\tcompareUsers(t, s.users[*author.ID], query.Post.Author)\n\t\t}\n\t})\n\n\tt.Run(\"User.sessions\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tclt, sess := s.ts.Client(\"1@test.test\", \"testpass\")\n\n\t\ttype expectedSessions = []*gqlmod.Session\n\n\t\texpect := func(expectedSessions expectedSessions) {\n\t\t\tvar query struct {\n\t\t\t\tUser *gqlmod.User `json:\"user\"`\n\t\t\t}\n\t\t\trequire.NoError(t, clt.QueryVar(\n\t\t\t\t`query($userId: Identifier!) {\n\t\t\t\t\tuser(id: $userId) {\n\t\t\t\t\t\tsessions {\n\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\tcreation\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}`,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"userId\": string(*sess.User.ID),\n\t\t\t\t},\n\t\t\t\t&query,\n\t\t\t))\n\n\t\t\trequire.NotNil(t, query.User)\n\t\t\trequire.Len(t, query.User.Sessions, len(expectedSessions))\n\n\t\t\t// Create key -> session index\n\t\t\tindex := make(map[string]*gqlmod.Session)\n\t\t\tfor _, expected := range expectedSessions {\n\t\t\t\tindex[*expected.Key] = expected\n\t\t\t}\n\n\t\t\t// Check actual sessions\n\t\t\tfor _, actualSession := range query.User.Sessions {\n\t\t\t\tactualKey := *actualSession.Key\n\t\t\t\trequire.Contains(t, index, actualKey)\n\t\t\t}\n\t\t}\n\n\t\t// Sign in twice\n\t\texpect(expectedSessions{sess})\n\t\t_, sess2 := s.ts.Client(\"1@test.test\", \"testpass\")\n\t\texpect(expectedSessions{sess, sess2})\n\t})\n\n\tt.Run(\"User.sessions (empty)\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tfor userID := range s.users {\n\t\t\tvar query struct {\n\t\t\t\tUser *gqlmod.User `json:\"user\"`\n\t\t\t}\n\t\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t\t`query($userId: Identifier!) {\n\t\t\t\t\tuser(id: $userId) {\n\t\t\t\t\t\tsessions {\n\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\tcreation\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}`,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"userId\": string(userID),\n\t\t\t\t},\n\t\t\t\t&query,\n\t\t\t))\n\t\t\trequire.NotNil(t, query.User)\n\t\t\trequire.Len(t, query.User.Sessions, 0)\n\t\t}\n\t})\n\n\tt.Run(\"Post.reactions\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tfor postID, reactions := range s.reactionsByPost {\n\t\t\tvar query struct {\n\t\t\t\tPost *gqlmod.Post `json:\"post\"`\n\t\t\t}\n\t\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t\t`query($postId: Identifier!) {\n\t\t\t\t\tpost(id: $postId) {\n\t\t\t\t\t\treactions {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\temotion\n\t\t\t\t\t\t\tmessage\n\t\t\t\t\t\t\tcreation\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}`,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"postId\": string(postID),\n\t\t\t\t},\n\t\t\t\t&query,\n\t\t\t))\n\n\t\t\trequire.NotNil(t, query.Post)\n\t\t\trequire.Len(t, query.Post.Reactions, len(reactions))\n\n\t\t\tfor _, actualReaction := range query.Post.Reactions {\n\t\t\t\tid := *actualReaction.ID\n\t\t\t\trequire.Contains(t, reactions, id)\n\t\t\t\tcompareReactions(t, reactions[id], &actualReaction)\n\t\t\t}\n\t\t}\n\t})\n\n\tt.Run(\"User.publishedReactions\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tfor authorID, reactions := range s.reactionsByAuthor {\n\t\t\tvar query struct {\n\t\t\t\tUser *gqlmod.User `json:\"user\"`\n\t\t\t}\n\t\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t\t`query($authorId: Identifier!) {\n\t\t\t\t\tuser(id: $authorId) {\n\t\t\t\t\t\tpublishedReactions {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\temotion\n\t\t\t\t\t\t\tmessage\n\t\t\t\t\t\t\tcreation\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}`,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"authorId\": string(authorID),\n\t\t\t\t},\n\t\t\t\t&query,\n\t\t\t))\n\n\t\t\trequire.NotNil(t, query.User)\n\t\t\trequire.Len(t, query.User.PublishedReactions, len(reactions))\n\n\t\t\tfor _, actualReaction := range query.User.PublishedReactions {\n\t\t\t\tid := *actualReaction.ID\n\t\t\t\trequire.Contains(t, reactions, id)\n\t\t\t\tcompareReactions(t, reactions[id], &actualReaction)\n\t\t\t}\n\t\t}\n\t})\n\n\tt.Run(\"Reaction.reactions\", func(t *testing.T) {\n\t\ts := newQueryTestSetup(t, tcx)\n\t\tdefer s.Teardown()\n\n\t\tfor subjectReactionID, subReactions := range s.subReaction {\n\t\t\tvar query struct {\n\t\t\t\tReaction *gqlmod.Reaction `json:\"reaction\"`\n\t\t\t}\n\t\t\trequire.NoError(t, s.ts.Debug().QueryVar(\n\t\t\t\t`query($subjectReactionId: Identifier!) {\n\t\t\t\t\treaction(id: $subjectReactionId) {\n\t\t\t\t\t\treactions {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\temotion\n\t\t\t\t\t\t\tmessage\n\t\t\t\t\t\t\tcreation\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}`,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"subjectReactionId\": string(subjectReactionID),\n\t\t\t\t},\n\t\t\t\t&query,\n\t\t\t))\n\n\t\t\trequire.NotNil(t, query.Reaction)\n\t\t\trequire.Len(t, query.Reaction.Reactions, len(subReactions))\n\n\t\t\tfor _, actualReaction := range query.Reaction.Reactions {\n\t\t\t\tid := *actualReaction.ID\n\t\t\t\trequire.Contains(t, subReactions, id)\n\t\t\t\tcompareReactions(t, subReactions[id], &actualReaction)\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "2c54375ad5ef5cd944a41d94af1d9f84", "score": "0.6296855", "text": "func Dbquery(action string, query string) ([]ut.Urltable, error) {\r\n\tvar s []ut.Urltable\r\n\tm.Lock()\r\n\tdbs, err := gorm.Open(\"mysql\", \"root:@tcp(127.0.0.1:3306)/uptimeurls\")\r\n\tif err != nil {\r\n\t\tlog.Println(\"Connection Failed to Open, Error: \" + err.Error())\r\n\t\tm.Unlock()\r\n\t\treturn nil, err\r\n\r\n\t}\r\n\tlog.Println(\"Connection Established\")\r\n\r\n\tif action == \"raw\" {\r\n\t\tdbs.Raw(query).Scan(&s)\r\n\t} else {\r\n\t\tdbs.Exec(query)\r\n\t}\r\n\r\n\tdefer dbs.Close()\r\n\tm.Unlock()\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn s, nil\r\n\r\n}", "title": "" }, { "docid": "b8f42c2d60d9623bbbb5fa24c741e315", "score": "0.62932307", "text": "func (m *TXMock) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) {\n\t// NOTE: not used\n\treturn nil, nil\n}", "title": "" }, { "docid": "b7bf9a8127b37682f0d8785d4d60c3c8", "score": "0.62867266", "text": "func TestQueries(t *testing.T) {\n\tenv := model.NewTestEnv(t)\n\tdefer env.Close()\n\n\tvar box = env.Box\n\n\t// let's alias the entity to make the test cases easier to read\n\tvar E = model.Entity_\n\n\t// Use this special entity for testing descriptions\n\tvar e = model.Entity47()\n\n\ttestQueries(t, env, queryTestOptions{baseCount: 1000}, []queryTestCase{\n\t\t{1, s{`String == \"Val-1\"`}, box.Query(E.String.Equals(e.String, true)), nil},\n\t\t{2, s{`String ==(i) \"Val-1\"`}, box.Query(E.String.Equals(e.String, false)), nil},\n\t\t{999, s{`String != \"Val-1\"`}, box.Query(E.String.NotEquals(e.String, true)), nil},\n\t\t{998, s{`String !=(i) \"Val-1\"`}, box.Query(E.String.NotEquals(e.String, false)), nil},\n\t\t{64, s{`String contains \"Val-1\"`}, box.Query(E.String.Contains(e.String, true)), nil},\n\t\t{131, s{`String contains(i) \"Val-1\"`}, box.Query(E.String.Contains(e.String, false)), nil},\n\t\t{64, s{`String starts with \"Val-1\"`}, box.Query(E.String.HasPrefix(e.String, true)), nil},\n\t\t{131, s{`String starts with(i) \"Val-1\"`}, box.Query(E.String.HasPrefix(e.String, false)), nil},\n\t\t{1, s{`String ends with \"Val-1\"`}, box.Query(E.String.HasSuffix(e.String, true)), nil},\n\t\t{2, s{`String ends with(i) \"Val-1\"`}, box.Query(E.String.HasSuffix(e.String, false)), nil},\n\t\t{998, s{`String > \"Val-1\"`}, box.Query(E.String.GreaterThan(e.String, true)), nil},\n\t\t{498, s{`String >(i) \"Val-1\"`}, box.Query(E.String.GreaterThan(e.String, false)), nil},\n\t\t{999, s{`String >= \"Val-1\"`}, box.Query(E.String.GreaterOrEqual(e.String, true)), nil},\n\t\t{500, s{`String >=(i) \"Val-1\"`}, box.Query(E.String.GreaterOrEqual(e.String, false)), nil},\n\t\t{1, s{`String < \"Val-1\"`}, box.Query(E.String.LessThan(e.String, true)), nil},\n\t\t{500, s{`String <(i) \"Val-1\"`}, box.Query(E.String.LessThan(e.String, false)), nil},\n\t\t{2, s{`String <= \"Val-1\"`}, box.Query(E.String.LessOrEqual(e.String, true)), nil},\n\t\t{502, s{`String <=(i) \"Val-1\"`}, box.Query(E.String.LessOrEqual(e.String, false)), nil},\n\t\t{2, s{`String in [\"VAL-1\", \"val-860714888\"]`, `String in [\"val-860714888\", \"VAL-1\"]`}, box.Query(E.String.In(true, \"VAL-1\", \"val-860714888\")), nil},\n\t\t{3, s{`String in(i) [\"val-1\", \"val-860714888\"]`, `String in(i) [\"val-860714888\", \"val-1\"]`}, box.Query(E.String.In(false, \"VAL-1\", \"val-860714888\")), nil},\n\n\t\t{2, s{`StringVector contains \"first-1\"`}, box.Query(E.StringVector.Contains(\"first-1\", true)), nil},\n\t\t{2, s{`StringVector contains(i) \"FIRST-1\"`}, box.Query(E.StringVector.Contains(\"FIRST-1\", false)), nil},\n\n\t\t{1, s{`Int64 == 0`}, box.Query(E.Int64.Equals(0)), nil},\n\t\t{2, s{`Int64 == 47`}, box.Query(E.Int64.Equals(e.Int64)), nil},\n\t\t{998, s{`Int64 != 47`}, box.Query(E.Int64.NotEquals(e.Int64)), nil},\n\t\t{498, s{`Int64 > 47`}, box.Query(E.Int64.GreaterThan(e.Int64)), nil},\n\t\t{500, s{`Int64 < 47`}, box.Query(E.Int64.LessThan(e.Int64)), nil},\n\t\t{1, s{`Int64 between -1 and 1`}, box.Query(E.Int64.Between(-1, 1)), nil},\n\t\t{2, s{`Int64 between 47 and 94`}, box.Query(E.Int64.Between(e.Int64, e.Int64*2)), nil},\n\t\t{2, s{`Int64 in [94|47]`, `Int64 in [47|94]`}, box.Query(E.Int64.In(e.Int64, e.Int64*2)), nil},\n\t\t{998, s{`Int64 not in [94|47]`, `Int64 not in [47|94]`}, box.Query(E.Int64.NotIn(e.Int64, e.Int64*2)), nil},\n\n\t\t{1, s{`Uint64 == 0`}, box.Query(E.Uint64.Equals(0)), nil},\n\t\t{2, s{`Uint64 == 47`}, box.Query(E.Uint64.Equals(e.Uint64)), nil},\n\t\t{998, s{`Uint64 != 47`}, box.Query(E.Uint64.NotEquals(e.Uint64)), nil},\n\t\t{997, s{`Uint64 > 47`}, box.Query(E.Uint64.GreaterThan(e.Uint64)), nil},\n\t\t{1, s{`Uint64 < 47`}, box.Query(E.Uint64.LessThan(e.Uint64)), nil},\n\t\t{1, s{`Uint64 between 0 and 1`}, box.Query(E.Uint64.Between(0, 1)), nil},\n\t\t{2, s{`Uint64 between 47 and 94`}, box.Query(E.Uint64.Between(e.Uint64, e.Uint64*2)), nil},\n\t\t{2, s{`Uint64 in [94|47]`, `Uint64 in [47|94]`}, box.Query(E.Uint64.In(e.Uint64, e.Uint64*2)), nil},\n\t\t{998, s{`Uint64 not in [94|47]`, `Uint64 not in [47|94]`}, box.Query(E.Uint64.NotIn(e.Uint64, e.Uint64*2)), nil},\n\n\t\t{1, s{`Int == 0`}, box.Query(E.Int.Equals(0)), nil},\n\t\t{3, s{`Int == 47`}, box.Query(E.Int.Equals(e.Int)), nil},\n\t\t{997, s{`Int != 47`}, box.Query(E.Int.NotEquals(e.Int)), nil},\n\t\t{498, s{`Int > 47`}, box.Query(E.Int.GreaterThan(e.Int)), nil},\n\t\t{499, s{`Int < 47`}, box.Query(E.Int.LessThan(e.Int)), nil},\n\t\t{1, s{`Int between -1 and 1`}, box.Query(E.Int.Between(-1, 1)), nil},\n\t\t{3, s{`Int between 47 and 94`}, box.Query(E.Int.Between(e.Int, e.Int*2)), nil},\n\t\t{3, s{`Int in [94|47]`, `Int in [47|94]`}, box.Query(E.Int.In(e.Int, e.Int*2)), nil},\n\t\t{997, s{`Int not in [94|47]`, `Int not in [47|94]`}, box.Query(E.Int.NotIn(e.Int, e.Int*2)), nil},\n\n\t\t{1, s{`Uint == 0`}, box.Query(E.Uint.Equals(0)), nil},\n\t\t{3, s{`Uint == 47`}, box.Query(E.Uint.Equals(e.Uint)), nil},\n\t\t{997, s{`Uint != 47`}, box.Query(E.Uint.NotEquals(e.Uint)), nil},\n\t\t{996, s{`Uint > 47`}, box.Query(E.Uint.GreaterThan(e.Uint)), nil},\n\t\t{1, s{`Uint < 47`}, box.Query(E.Uint.LessThan(e.Uint)), nil},\n\t\t{1, s{`Uint between 0 and 1`}, box.Query(E.Uint.Between(0, 1)), nil},\n\t\t{3, s{`Uint between 47 and 94`}, box.Query(E.Uint.Between(e.Uint, e.Uint*2)), nil},\n\t\t{3, s{`Uint in [94|47]`, `Uint in [47|94]`}, box.Query(E.Uint.In(e.Uint, e.Uint*2)), nil},\n\t\t{997, s{`Uint not in [94|47]`, `Uint not in [47|94]`}, box.Query(E.Uint.NotIn(e.Uint, e.Uint*2)), nil},\n\n\t\t{1, s{`Rune == 0`}, box.Query(E.Rune.Equals(0)), nil},\n\t\t{3, s{`Rune == 47`}, box.Query(E.Rune.Equals(e.Rune)), nil},\n\t\t{997, s{`Rune != 47`}, box.Query(E.Rune.NotEquals(e.Rune)), nil},\n\t\t{498, s{`Rune > 47`}, box.Query(E.Rune.GreaterThan(e.Rune)), nil},\n\t\t{499, s{`Rune < 47`}, box.Query(E.Rune.LessThan(e.Rune)), nil},\n\t\t{1, s{`Rune between -1 and 1`}, box.Query(E.Rune.Between(-1, 1)), nil},\n\t\t{3, s{`Rune between 47 and 94`}, box.Query(E.Rune.Between(e.Rune, e.Rune*2)), nil},\n\t\t{3, s{`Rune in [94|47]`, `Rune in [47|94]`}, box.Query(E.Rune.In(e.Rune, e.Rune*2)), nil},\n\t\t{997, s{`Rune not in [94|47]`, `Rune not in [47|94]`}, box.Query(E.Rune.NotIn(e.Rune, e.Rune*2)), nil},\n\n\t\t{1, s{`Int32 == 0`}, box.Query(E.Int32.Equals(0)), nil},\n\t\t{3, s{`Int32 == 47`}, box.Query(E.Int32.Equals(e.Int32)), nil},\n\t\t{997, s{`Int32 != 47`}, box.Query(E.Int32.NotEquals(e.Int32)), nil},\n\t\t{498, s{`Int32 > 47`}, box.Query(E.Int32.GreaterThan(e.Int32)), nil},\n\t\t{499, s{`Int32 < 47`}, box.Query(E.Int32.LessThan(e.Int32)), nil},\n\t\t{1, s{`Int32 between -1 and 1`}, box.Query(E.Int32.Between(-1, 1)), nil},\n\t\t{3, s{`Int32 between 47 and 94`}, box.Query(E.Int32.Between(e.Int32, e.Int32*2)), nil},\n\t\t{3, s{`Int32 in [94|47]`, `Int32 in [47|94]`}, box.Query(E.Int32.In(e.Int32, e.Int32*2)), nil},\n\t\t{997, s{`Int32 not in [94|47]`, `Int32 not in [47|94]`}, box.Query(E.Int32.NotIn(e.Int32, e.Int32*2)), nil},\n\n\t\t{1, s{`Uint32 == 0`}, box.Query(E.Uint32.Equals(0)), nil},\n\t\t{3, s{`Uint32 == 47`}, box.Query(E.Uint32.Equals(e.Uint32)), nil},\n\t\t{997, s{`Uint32 != 47`}, box.Query(E.Uint32.NotEquals(e.Uint32)), nil},\n\t\t{996, s{`Uint32 > 47`}, box.Query(E.Uint32.GreaterThan(e.Uint32)), nil},\n\t\t{1, s{`Uint32 < 47`}, box.Query(E.Uint32.LessThan(e.Uint32)), nil},\n\t\t{1, s{`Uint32 between 0 and 1`}, box.Query(E.Uint32.Between(0, 1)), nil},\n\t\t{3, s{`Uint32 between 47 and 94`}, box.Query(E.Uint32.Between(e.Uint32, e.Uint32*2)), nil},\n\t\t{3, s{`Uint32 in [94|47]`, `Uint32 in [47|94]`}, box.Query(E.Uint32.In(e.Uint32, e.Uint32*2)), nil},\n\t\t{997, s{`Uint32 not in [94|47]`, `Uint32 not in [47|94]`}, box.Query(E.Uint32.NotIn(e.Uint32, e.Uint32*2)), nil},\n\n\t\t{1, s{`Int16 == 0`}, box.Query(E.Int16.Equals(0)), nil},\n\t\t{3, s{`Int16 == 47`}, box.Query(E.Int16.Equals(e.Int16)), nil},\n\t\t{997, s{`Int16 != 47`}, box.Query(E.Int16.NotEquals(e.Int16)), nil},\n\t\t{498, s{`Int16 > 47`}, box.Query(E.Int16.GreaterThan(e.Int16)), nil},\n\t\t{499, s{`Int16 < 47`}, box.Query(E.Int16.LessThan(e.Int16)), nil},\n\t\t{1, s{`Int16 between -1 and 1`}, box.Query(E.Int16.Between(-1, 1)), nil},\n\t\t{4, s{`Int16 between 47 and 94`}, box.Query(E.Int16.Between(e.Int16, e.Int16*2)), nil},\n\t\t//{0, s{`Int16 in [94|47]`, `Int16 in [47|94]`}, box.Query(E.Int16.In(e.Int16, e.Int16*2)), nil},\n\t\t//{0, s{`Int16 in [94|47]`, `Int16 in [47|94]`}, box.Query(E.Int16.NotIn(e.Int16, e.Int16*2)), nil},\n\n\t\t{1, s{`Uint16 == 0`}, box.Query(E.Uint16.Equals(0)), nil},\n\t\t{3, s{`Uint16 == 47`}, box.Query(E.Uint16.Equals(e.Uint16)), nil},\n\t\t{997, s{`Uint16 != 47`}, box.Query(E.Uint16.NotEquals(e.Uint16)), nil},\n\t\t{996, s{`Uint16 > 47`}, box.Query(E.Uint16.GreaterThan(e.Uint16)), nil},\n\t\t{1, s{`Uint16 < 47`}, box.Query(E.Uint16.LessThan(e.Uint16)), nil},\n\t\t{1, s{`Uint16 between 0 and 1`}, box.Query(E.Uint16.Between(0, 1)), nil},\n\t\t{4, s{`Uint16 between 47 and 94`}, box.Query(E.Uint16.Between(e.Uint16, e.Uint16*2)), nil},\n\t\t//{0, s{`Uint16 in [94|47]`, `Uint16 in [47|94]`}, box.Query(E.Uint16.In(e.Uint16, e.Uint16*2)), nil},\n\t\t//{0, s{`Uint16 in [94|47]`, `Uint16 in [47|94]`}, box.Query(E.Uint16.NotIn(e.Uint16, e.Uint16*2)), nil},\n\n\t\t{5, s{`Int8 == 0`}, box.Query(E.Int8.Equals(0)), nil},\n\t\t{6, s{`Int8 == 47`}, box.Query(E.Int8.Equals(e.Int8)), nil},\n\t\t{994, s{`Int8 != 47`}, box.Query(E.Int8.NotEquals(e.Int8)), nil},\n\t\t{308, s{`Int8 > 47`}, box.Query(E.Int8.GreaterThan(e.Int8)), nil},\n\t\t{686, s{`Int8 < 47`}, box.Query(E.Int8.LessThan(e.Int8)), nil},\n\t\t{11, s{`Int8 between -1 and 1`}, box.Query(E.Int8.Between(-1, 1)), nil},\n\t\t{179, s{`Int8 between 47 and 94`}, box.Query(E.Int8.Between(e.Int8, e.Int8*2)), nil},\n\t\t//{0, s{`Int8 in [94|47]`, `Int8 in [47|94]`}, box.Query(E.Int8.In(e.Int8, e.Int8*2)), nil},\n\t\t//{0, s{`Int8 in [94|47]`, `Int8 in [47|94]`}, box.Query(E.Int8.NotIn(e.Int8, e.Int8*2)), nil},\n\n\t\t{5, s{`Uint8 == 0`}, box.Query(E.Uint8.Equals(0)), nil},\n\t\t{6, s{`Uint8 == 47`}, box.Query(E.Uint8.Equals(e.Uint8)), nil},\n\t\t{994, s{`Uint8 != 47`}, box.Query(E.Uint8.NotEquals(e.Uint8)), nil},\n\t\t{806, s{`Uint8 > 47`}, box.Query(E.Uint8.GreaterThan(e.Uint8)), nil},\n\t\t{188, s{`Uint8 < 47`}, box.Query(E.Uint8.LessThan(e.Uint8)), nil},\n\t\t{8, s{`Uint8 between 0 and 1`}, box.Query(E.Uint8.Between(0, 1)), nil},\n\t\t{179, s{`Uint8 between 47 and 94`}, box.Query(E.Uint8.Between(e.Uint8, e.Uint8*2)), nil},\n\t\t//{0, s{`Uint8 in [94|47]`, `Uint8 in [47|94]`}, box.Query(E.Uint8.In(e.Uint8, e.Uint8*2)), nil},\n\t\t//{0, s{`Uint8 in [94|47]`, `Uint8 in [47|94]`}, box.Query(E.Uint8.NotIn(e.Uint8, e.Uint8*2)), nil},\n\n\t\t{5, s{`Byte == 0`}, box.Query(E.Byte.Equals(0)), nil},\n\t\t{6, s{`Byte == 47`}, box.Query(E.Byte.Equals(e.Byte)), nil},\n\t\t{994, s{`Byte != 47`}, box.Query(E.Byte.NotEquals(e.Byte)), nil},\n\t\t{308, s{`Byte > 47`}, box.Query(E.Byte.GreaterThan(e.Byte)), nil},\n\t\t{686, s{`Byte < 47`}, box.Query(E.Byte.LessThan(e.Byte)), nil},\n\t\t{8, s{`Byte between 0 and 1`}, box.Query(E.Byte.Between(0, 1)), nil},\n\t\t{179, s{`Byte between 47 and 94`}, box.Query(E.Byte.Between(e.Byte, e.Byte*2)), nil},\n\t\t//{0, {`Byte in [94|47]`, `Byte in [47|94]`}, box.Query(E.Byte.In(e.Byte, e.Byte*2)), nil},\n\t\t//{0, {`Byte in [94|47]`, `Byte in [47|94]`}, box.Query(E.Byte.NotIn(e.Byte, e.Byte*2)), nil},\n\n\t\t{2, s{`Float64 between 47.739999 and 47.740001`}, box.Query(E.Float64.Between(e.Float64-0.000001, e.Float64+0.000001)), nil},\n\t\t{498, s{`Float64 > 47.740000`}, box.Query(E.Float64.GreaterThan(e.Float64)), nil},\n\t\t{500, s{`Float64 < 47.740000`}, box.Query(E.Float64.LessThan(e.Float64)), nil},\n\t\t{1, s{`Float64 between -1.000000 and 1.000000`}, box.Query(E.Float64.Between(-1, 1)), nil},\n\t\t{2, s{`Float64 between 47.740000 and 95.480000`}, box.Query(E.Float64.Between(e.Float64, e.Float64*2)), nil},\n\n\t\t{2, s{`Float32 between 47.739990 and 47.740013`}, box.Query(E.Float32.Between(e.Float32-0.00001, e.Float32+0.00001)), nil},\n\t\t{498, s{`Float32 > 47.740002`}, box.Query(E.Float32.GreaterThan(e.Float32)), nil},\n\t\t{500, s{`Float32 < 47.740002`}, box.Query(E.Float32.LessThan(e.Float32)), nil},\n\t\t{1, s{`Float32 between -1.000000 and 1.000000`}, box.Query(E.Float32.Between(-1, 1)), nil},\n\t\t{2, s{`Float32 between 47.740002 and 95.480003`}, box.Query(E.Float32.Between(e.Float32, e.Float32*2)), nil},\n\n\t\t{6, s{`ByteVector == byte[5]{0x01020305 08}`}, box.Query(E.ByteVector.Equals(e.ByteVector)), nil},\n\t\t//{994, s{`ByteVector != byte[5]{0x01020305 08`}, box.Query(E.ByteVector.NotEquals(e.ByteVector)), nil},\n\t\t{989, s{`ByteVector > byte[5]{0x01020305 08}`}, box.Query(E.ByteVector.GreaterThan(e.ByteVector)), nil},\n\t\t{995, s{`ByteVector >= byte[5]{0x01020305 08}`}, box.Query(E.ByteVector.GreaterOrEqual(e.ByteVector)), nil},\n\t\t{5, s{`ByteVector < byte[5]{0x01020305 08}`}, box.Query(E.ByteVector.LessThan(e.ByteVector)), nil},\n\t\t{11, s{`ByteVector <= byte[5]{0x01020305 08}`}, box.Query(E.ByteVector.LessOrEqual(e.ByteVector)), nil},\n\n\t\t{256, s{`Bool == 1`}, box.Query(E.Bool.Equals(true)), nil},\n\t\t{744, s{`Bool == 0`}, box.Query(E.Bool.Equals(false)), nil},\n\n\t\t{3, s{`(Bool == 1 AND Byte == 1)`}, box.Query(E.Bool.Equals(true), E.Byte.Equals(1)), nil},\n\t})\n\n}", "title": "" }, { "docid": "ece725d626b6424688c59f510db3025d", "score": "0.6283467", "text": "func QueryDB(clnt client.Client, cmd string, db string) ([]client.Result, error) {\n\tvar res []client.Result\n\tq := client.Query{\n\t\tCommand: cmd,\n\t\tDatabase: db,\n\t}\n\tif response, err := clnt.Query(q); err == nil {\n\t\tif response.Error() != nil {\n\t\t\treturn res, response.Error()\n\t\t}\n\t\tres = response.Results\n\t} else {\n\t\treturn res, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "03b3432eb1b42391f9f435edf3b0d178", "score": "0.62678564", "text": "func Queries(db *sql.DB, w io.Writer, cfg conf.Config, v bool) error {\n\tif db == nil {\n\t\treturn ErrDB\n\t}\n\tif w == nil {\n\t\tw = io.Discard\n\t}\n\trows, err := db.Query(templ.SelNewFiles)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"queries query: %w\", err)\n\t}\n\tif rows.Err() != nil {\n\t\treturn fmt.Errorf(\"queries query rows: %w\", rows.Err())\n\t}\n\tdefer rows.Close()\n\tcols, err := rows.Columns()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"queries columns: %w\", err)\n\t}\n\treturn query(db, w, cfg, v, rows, cols)\n}", "title": "" }, { "docid": "cdea70dcd730c079fec1b771543facc6", "score": "0.6261544", "text": "func castQuery(wg *sync.WaitGroup, dbs [3]string, query string) { // making 3 buffered channel \n\tqc := make(chan response, len(dbs)) \n\tfor _, db := range dbs {\n\t\twg.Add(1)\n\t\tgo queryDB(wg, db, query, qc) // sending request to all 3 dbs\n\t}\n\tif r, ok := <-qc; ok { // only care about first one\n\t\tfmt.Printf(\"\\nGot my answer! Database `%s, took (%v) -- %v\\n\", r.db, r.duration, r.results)\n\t}\n}", "title": "" }, { "docid": "a1499304238606bcd7b73476b3b305c7", "score": "0.6251166", "text": "func (s *Stmt) Query(args ...interface{}) (*Rows, error) {}", "title": "" }, { "docid": "a337ec3e9b4459df07713d732bb30a8e", "score": "0.6247972", "text": "func queryDB(wg *sync.WaitGroup, db, q string, qc chan<- response) {\n\tdefer wg.Done()\n\tdur := time.Duration(rand.Intn(100)) * time.Millisecond\n\tfmt.Printf(\"Querying %s took %v\\n\", db, dur)\n\ttime.Sleep(dur)\n\tqc <- response{\n\t\tdb: db,\n\t\tduration: dur,\n\t\tresults: []string{\"Rex\", \"Cujo\", \"Fiffi\"},\n\t}\n}", "title": "" }, { "docid": "53910b70c1c7e3c774cbd5199bb9bf05", "score": "0.6219243", "text": "func (m *Manager) MultiQuery(parts ...Parts) (err error) {\n\terr = m.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tassert.Nil(m.Rollback())\n\t\t} else {\n\t\t\terr = m.Commit()\n\t\t}\n\t}()\n\n\tfor _, q := range parts {\n\t\t_, err = m.GetProperDBMap().Exec(q.Query, q.Params...)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0c35ec3285b28bfb0068a9ae9ca18537", "score": "0.6164636", "text": "func (dbAccess *MysqlAccess) Query(sid string, querySql string, container *[]ParamsList, needCols ...string) (num int64, err error) {\n\tvar connErr error\n\tvar conn *sql.DB\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tstatistic.IncPanicCount()\n\t\t\tlogger.Error(\"recover panic: %v\", r)\n\t\t\tdbAccess.closeDBConn(sid, conn)\n\t\t\treturn\n\t\t}\n\t\tif connErr != nil {\n\t\t\treturn\n\t\t}\n\t\tif err == nil {\n\t\t\tdbAccess.releaseConn(sid, conn)\n\t\t\treturn\n\t\t}\n\t\tdbAccess.closeDBConn(sid, conn)\n\t}()\n\tconn, _, connErr = dbAccess.getConn(sid)\n\tif connErr != nil {\n\t\terr = connErr\n\t\tlogger.Error(\"getconn err:%v\", err)\n\t\treturn\n\t}\n\tnum, err = dbAccess.query(conn, querySql, container, needCols)\n\treturn\n}", "title": "" }, { "docid": "517ef9cb6e9c2f6adba0c6baee78a03a", "score": "0.6153932", "text": "func selects(db *sql.DB, query string) {\n\n var (\n i1 string\n )\n\n rows, err := db.Query(query)\n log_error(err)\n defer rows.Close()\n for rows.Next() {\n err := rows.Scan(&i1)\n log_error(err)\n fmt.Println(i1)\n }\n err = rows.Err()\n log_error(err)\n}", "title": "" }, { "docid": "b23678cbea203a8ee09fc1847ef75735", "score": "0.6147214", "text": "func Query(dbc interface{}, sqlString string, args ...interface{}) (r *sql.Rows, err error) {\n\tswitch v := dbc.(type) {\n\tcase *sql.DB:\n\t\tr, err = v.Query(sqlString, args...)\n\tcase *sql.Tx:\n\t\tr, err = v.Query(sqlString, args...)\n\tdefault:\n\t\terr = errors.New(\"No valid DB Controller\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "b8bb9f670296b697245028e6c27b6bfb", "score": "0.6120056", "text": "func (this *QueryEngine) QueryThreadPoolMode(queries []string, single bool) []*QueryRes{\n results := make([]*QueryRes, len(queries))\n q_chan := make(chan int)\n var wg sync.WaitGroup\n for i := 0; i < this.threadsToInit(len(queries)); i++ {\n go func(){\n for q_idx := range q_chan {\n db_conn,err := sql.Open(\"avatica\", this.server)\n if err != nil {\n results[q_idx] = &QueryRes{Res : nil, Err : err,}\n } else {\n results[q_idx] = this.exec_query(nil, queries[q_idx], single)\n }\n db_conn.Close()\n wg.Done()\n }\n }()\n }\n wg.Add(len(queries))\n for idx,_ := range queries {\n q_chan <- idx;\n }\n close(q_chan)\n wg.Wait()\n //close(q_chan)\n return results\n}", "title": "" }, { "docid": "76ebf8139159f6551a8a6451fbcfb21e", "score": "0.61023104", "text": "func jsExecSQLQuery(sqls []string, args map[string]interface{}) (interface{}, error) {\n\n\tif !macrosManager.DatabaseConfig().IsDatabaseEnabled() {\n\t\treturn nil, fmt.Errorf(\"Database forget enable??\")\n\t}\n\n\tconn, err := sqlx.Open(macrosManager.DatabaseConfig().Driver, macrosManager.DatabaseConfig().Dsn)\n\tif err != nil {\n\t\tif *flagDebug > 0 {\n\t\t\tlog.Printf(\"jsExecSQL open database error: %v\\n\", err)\n\t\t}\n\t\treturn nil, err\n\t}\n\tdefer conn.Close()\n\n\tfor i, sql := range sqls {\n\t\tif strings.TrimSpace(sql) == \"\" {\n\t\t\tsqls = append(sqls[0:i], sqls[i+1:]...)\n\t\t}\n\t}\n\n\t//先执行前面的SQL\n\tfor i, sql := range sqls[0 : len(sqls)-1] {\n\t\tsql = strings.TrimSpace(sql)\n\t\tif \"\" == sql {\n\t\t\tcontinue\n\t\t}\n\n\t\tif *flagDebug > 2 {\n\t\t\tlog.Printf(\"jsExecSQL exec sql%d:\\n==sql==\\n%s\\n==args==\\n%v\\n\", i, sql, args)\n\t\t}\n\n\t\tif _, err := conn.NamedExec(sql, args); err != nil {\n\t\t\tif *flagDebug > 0 {\n\t\t\t\tlog.Printf(\"jsExecSQL exec sql%d error: %v\\n==sql==\\n%s\\n\", i, err, sql)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"jsExecSQL exec sql%d error: %v\", i, err)\n\t\t}\n\t}\n\n\tif *flagDebug > 2 {\n\t\tlog.Printf(\"jsExecSQL exec sql%d:\\n==sql==\\n%s\\n==args==\\n%v\\n\", len(sqls)-1, sqls[len(sqls)-1], args)\n\t}\n\n\t//最后一个用于返回数据\n\trows, err := conn.NamedQuery(sqls[len(sqls)-1], args)\n\tif err != nil {\n\t\tif *flagDebug > 1 {\n\t\t\tlog.Printf(\"jsExecSQL exec sql%d error: %v\\n==sql==\\n%s\\n\", len(sqls)-1, err, sqls[len(sqls)-1])\n\t\t}\n\t\treturn nil, fmt.Errorf(\"jsExecSQL exec sql%d error: %v\", len(sqls)-1, err)\n\t}\n\tdefer rows.Close()\n\n\tret := []map[string]interface{}{}\n\n\tfor rows.Next() {\n\t\trow, err := jsScanSQLRow(rows)\n\t\tif err != nil {\n\t\t\tif *flagDebug > 1 {\n\t\t\t\tlog.Printf(\"jsExecSQL sql%d fetch rows error:\\n%v\\n==sql==\\n%s\\n==rows==\\n%v\\n\",\n\t\t\t\t\tlen(sqls)-1, err, sqls[len(sqls)-1], rows)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tret = append(ret, row)\n\t}\n\n\treturn interface{}(ret), nil\n}", "title": "" }, { "docid": "b95ce1cb1d18e6788e961fa9be4f227d", "score": "0.60932016", "text": "func (c *Client) QueryDB(cmd string) (res []client.Result, err error) {\n\tq := client.Query{\n\t\tCommand: cmd,\n\t\tDatabase: c.dbName,\n\t}\n\tif response, err := c.Session.Query(q); err == nil {\n\t\tif response.Error() != nil {\n\t\t\treturn res, response.Error()\n\t\t}\n\t\tres = response.Results\n\t} else {\n\t\treturn res, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "bffdc8ff2acab86bf5ca129019e91d17", "score": "0.609239", "text": "func (s *SQLiteStmt) Query(args []driver.Value) (driver.Rows, error) {\r\n list := make([]namedValue, len(args))\r\n for i, v := range args {\r\n list[i] = namedValue{\r\n Ordinal: i + 1,\r\n Value: v,\r\n }\r\n }\r\n return s.query(context.Background(), list)\r\n}", "title": "" }, { "docid": "1d9e332aefafeb9b5c2c70d5135528e0", "score": "0.60914636", "text": "func (c *ConnectionManager) Query(query string, args ...interface{}) (*sql.Rows, func(), error) {\n\tc.log = logging.NewLogs(\"db\", \"query\")\n\tif err := c.connection.Ping(); err != nil {\n\t\tc.log.GetError().Str(\"when\", \"ping connection\").Err(err).Msg(\"unable to ping connection\")\n\t\treturn nil, nil, err\n\t}\n\tctx := context.TODO()\n\tqueryCtx, cancel := context.WithTimeout(ctx, 5*time.Second)\n\n\tc.log.GetInfo().Msg(\"get rows\")\n\trows, err := c.connection.QueryContext(queryCtx, query, args...)\n\tif err != nil {\n\t\tc.log.GetError().Str(\"when\", \"get rows\").Err(err).Msg(\"unable to get rows\")\n\t\tdefer cancel()\n\t\treturn nil, nil, err\n\t}\n\treturn rows, cancel, nil\n}", "title": "" }, { "docid": "25ecfbea87f1bc238150dedcf8977d63", "score": "0.6075844", "text": "func practical_test() error {\n\n\tif err := prepare_data(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := built_query(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := custom_query(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := raw_query(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := custom_struct(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := inner_join(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := outer_join(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := delete_data(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4256c89b1bfe3c753ec3614048f2706b", "score": "0.60697466", "text": "func ExampleDatabaseQueries() {\n\tserverName = strings.ToLower(serverName)\n\thelpers.SetResourceGroupName(\"DatabaseQueries\")\n\tctx := context.Background()\n\tdefer resources.Cleanup(ctx)\n\t_, err := resources.CreateGroup(ctx, helpers.ResourceGroupName())\n\tif err != nil {\n\t\thelpers.PrintAndLog(err.Error())\n\t}\n\n\t_, err = CreateServer(ctx, serverName, dbLogin, dbPassword)\n\tif err != nil {\n\t\thelpers.PrintAndLog(fmt.Sprintf(\"cannot create sql server: %v\", err))\n\t}\n\n\thelpers.PrintAndLog(\"sql server created\")\n\n\t_, err = CreateDB(ctx, serverName, dbName)\n\tif err != nil {\n\t\thelpers.PrintAndLog(fmt.Sprintf(\"cannot create sql database: %v\", err))\n\t}\n\thelpers.PrintAndLog(\"database created\")\n\n\terr = CreateFirewallRules(ctx, serverName)\n\tif err != nil {\n\t\thelpers.PrintAndLog(err.Error())\n\t}\n\thelpers.PrintAndLog(\"database firewall rules set\")\n\n\terr = DbOperations(serverName, dbName, dbLogin, dbPassword)\n\tif err != nil {\n\t\thelpers.PrintAndLog(err.Error())\n\t}\n\thelpers.PrintAndLog(\"database operations performed\")\n\n\t// Output:\n\t// sql server created\n\t// database created\n\t// database firewall rules set\n\t// database operations performed\n}", "title": "" }, { "docid": "3714217c1bc2425d1740b445b229cf50", "score": "0.6032642", "text": "func TestMultipleDrivers(t *testing.T) {\n\tdefer leaktest.Check(t)()\n\tdefer copyist.Open(t).Close()\n\n\topenDB := func(driverName string) *sql.DB {\n\t\tdb, err := sql.Open(\"copyist_\"+driverName, commontest.PostgresDataSourceName)\n\t\trequire.NoError(t, err)\n\t\treturn db\n\t}\n\n\tqueryDB := func(db *sql.DB, id int, expected string) {\n\t\trows, err := db.Query(\"SELECT name FROM customers WHERE id=$1\", id)\n\t\trequire.NoError(t, err)\n\t\tdefer rows.Close()\n\n\t\tfor rows.Next() {\n\t\t\tvar name string\n\t\t\trows.Scan(&name)\n\t\t\trequire.Equal(t, expected, name)\n\t\t}\n\t}\n\n\t// Open database using each driver.\n\tdb := openDB(\"postgres\")\n\tdefer db.Close()\n\tdb2 := openDB(\"pgx\")\n\tdefer db2.Close()\n\n\t// Query using each driver.\n\tqueryDB(db, 1, \"Andy\")\n\tqueryDB(db2, 1, \"Andy\")\n\n\t// And again.\n\tqueryDB(db, 2, \"Jay\")\n\tqueryDB(db2, 2, \"Jay\")\n}", "title": "" }, { "docid": "987a0908a9791576a52c994206b72cfd", "score": "0.6032373", "text": "func (d *Database) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) {\n\tspan, _ := d.createSpanFromContext(ctx, query)\n\tdefer span.Finish()\n\n\trows, err := d.extDB.Query(query, args...)\n\tif err != nil {\n\t\tspan.LogFields(log.String(\"error\", err.Error()))\n\t}\n\n\treturn rows, err\n}", "title": "" }, { "docid": "b64831c761af8c59e8aafe3c7af18e70", "score": "0.60320187", "text": "func (db *CostDatabase) Query(cmd string, args ...interface{}) ([]client.Result, error) {\n\tcmd = fmt.Sprintf(cmd, args...)\n\tq := client.Query{\n\t\tCommand: cmd,\n\t\tDatabase: db.databaseName,\n\t}\n\tlog.Println(cmd)\n\tresponse, err := db.client.Query(q)\n\tif err != nil {\n\t\treturn nil, errors.InternalErrorf(err, \"Query '%s' failed\", cmd)\n\t}\n\terr = errors.InternalErrorf(response.Error(), \"Query '%s' had error response\", cmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn response.Results, nil\n}", "title": "" }, { "docid": "4ca51f1f6cbac3518f050b34b060216e", "score": "0.60245085", "text": "func (db *DB) Query(query string, args ...interface{}) (*sql.Rows, error) {\n\tif err := db.Open(); err != nil {\n\t\treturn nil, err\n\t}\n\trows, err := db.innerdb.Query(query, args...)\n\tif LogLevel >= LogDebug {\n\t\tlogDebug(\"DB query:\", query, args, err)\n\t}\n\n\treturn rows, err\n}", "title": "" }, { "docid": "644c8e75ec12677a9a15e970a87695b1", "score": "0.601853", "text": "func TestQuery(t *testing.T) {\n\tenv := NewTestVDBEnv(t)\n\tdefer env.Cleanup()\n\tcommontests.TestQuery(t, env.DBProvider)\n}", "title": "" }, { "docid": "e869f7d050478a3acd15c5b70f36d1ba", "score": "0.59869176", "text": "func (stm *stmt) Query(args []driver.Value) (driver.Rows, error) {\n\treturn stm.conn.run(stm.query, makeArgsMap(args))\n}", "title": "" }, { "docid": "55d5a441ccabee0b0257de78734469a3", "score": "0.59856886", "text": "func (lt *Table) MultiQueries(ctx context.Context, queries []chunk.IndexQuery, callback chunk_util.Callback) error {\n\tlt.dbSnapshotsMtx.RLock()\n\tdefer lt.dbSnapshotsMtx.RUnlock()\n\n\tid := shipper_util.NewIndexDeduper(callback)\n\n\tfor _, db := range lt.dbSnapshots {\n\t\terr := db.boltdb.View(func(tx *bbolt.Tx) error {\n\t\t\tbucket := tx.Bucket(bucketName)\n\t\t\tif bucket == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tfor _, query := range queries {\n\t\t\t\tif err := lt.boltdbIndexClient.QueryWithCursor(ctx, bucket.Cursor(), query, func(query chunk.IndexQuery, batch chunk.ReadBatch) (shouldContinue bool) {\n\t\t\t\t\treturn id.Callback(query, batch)\n\t\t\t\t}); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4218b69f99a3045899c80a7075e39522", "score": "0.598359", "text": "func TestQueryRun(t *testing.T) {\n\ta := assert.New(t)\n\tr := require.New(t)\n\n\tdb := New().LoggerOptions(false, false, false)\n\tdb.Connect(\"http://query:8000\", \"dbName\", \"foo\", \"bar\")\n\n\tresult, err := db.Run(NewQuery(shortQuery))\n\tr.Error(err)\n\ta.Nil(result)\n\n\tdb.conn.Use(mock.Plugin)\n\tdefer mock.Disable()\n\tm := mock.New(\"http://query:8000\").Persist()\n\tm.Post(\"/_db/dbName/_api/cursor\").\n\t\tReply(200).\n\t\tBodyString(`{\"error\": false, \"errorMessage\": \"\", \"result\": []}`)\n\n\tresult, err = db.Run(NewQuery(\"\"))\n\tr.NoError(err)\n\ta.Equal(\"[]\", string(result))\n\n\tresult, err = db.Run(NewQuery(shortQuery).Cache(true).BatchSize(500))\n\tr.NoError(err)\n\ta.Equal(\"[]\", string(result))\n\n\tm.Post(\"/_db/dbName/_api/cursor\").\n\t\tReply(200).\n\t\tBodyString(`{\"error\": false, \"errorMessage\": \"\", \"result\": [{}], \"hasMore\":true, \"id\":\"1000\"}`)\n\n\tm2 := mock.New(\"http://query:8000\").Persist()\n\tm2.Put(\"/_db/dbName/_api/cursor/1000\").\n\t\tReply(200).\n\t\tBodyString(`{\"error\": false, \"errorMessage\": \"\", \"result\": [{}], \"hasMore\":false}`)\n\n\tresult, err = db.Run(NewQuery(\"\"))\n\tr.NoError(err)\n\ta.Equal(\"[{},{}]\", string(result))\n\n\tq := NewQuery(`\n\t FOR d\n\t IN documents\n\t FILTER d._key == @key\n\t RETURN d\n\t `)\n\tq.Bind(\"key\", 1000)\n\tresult, err = db.Run(q)\n\n\tr.NoError(err)\n\ta.Equal(\"[{},{}]\", string(result))\n\n\tm.Post(\"/_db/dbName/_api/cursor\").\n\t\tReply(500).\n\t\tBodyString(`{\"error\": true, \"errorMessage\": \"error !\"}`)\n\n\tresult, err = db.Run(NewQuery(shortQuery))\n\tr.Error(err)\n\ta.Nil(result)\n}", "title": "" }, { "docid": "ba00e5ed6dc3678cbb9b8a7a31fdcf55", "score": "0.5969897", "text": "func (c *AlphaSOCClient) Queries(req *QueriesRequest) (*QueriesResponse, error) {\n\tif c.key == \"\" {\n\t\treturn nil, ErrNoAPIKey\n\t}\n\n\tresp, err := c.post(context.Background(), \"queries\", nil, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar r QueriesResponse\n\tif err := json.NewDecoder(resp.Body).Decode(&r); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &r, nil\n}", "title": "" }, { "docid": "a1c0c9dc956f1a486670149b3b5f9b7d", "score": "0.5965893", "text": "func main() {\n conn, err := sql.Open(\"odbc\",\n \"driver=sql server;server=localhost;database=tempdb;trusted_connection=yes;\")\n if err != nil {\n fmt.Println(\"Connecting Error\")\n return\n }\n defer conn.Close()\n\n stmt, err := conn.Prepare(\"select top 5 database_id, name from sys.databases WHERE database_id >= 5\")\n if err != nil {\n fmt.Println(\"Query Error\", err)\n return\n }\n defer stmt.Close()\n\n // Use db.Query() to send the query to the database. Check errors as usual.\n row, err := stmt.Query()\n if err != nil {\n fmt.Println(\"Query Error\", err)\n return\n }\n defer row.Close()\n\n // Iterate over the row with row.Next()\n // and read the columns in each row into variables with row.Scan()\n fmt.Printf(\"\\nResult set 1:\\n\")\n for row.Next() {\n //var id int\n var (\n id int\n name string\n )\n if err := row.Scan(&id, &name); err == nil {\n fmt.Println(id, name)\n }\n }\n // Check for errors after done iterating over the row. Should always do.\n err = row.Err()\n if err != nil {\n fmt.Printf(\"\\nFatal: %s\\n\", err)\n }\n\n // Preparing Queries\n /*\n \tYou should, in general, always prepare queries to be used multiple times.\n \tThe result of preparing the query is a prepared statement, which can\n \thave ? placeholders for parameters that you'll provide when you execute\n \tthe statement. This is much better than concatenating strings.\n */\n\n stmt, err = conn.Prepare(\"select top 5 database_id, name from sys.databases WHERE database_id >= ?\")\n if err != nil {\n log.Fatal(err)\n }\n\n row, err = stmt.Query(1)\n if err != nil {\n log.Fatal(err)\n }\n defer row.Close()\n\n fmt.Printf(\"\\nResult set 2:\\n\")\n for row.Next() {\n var (\n id int\n name string\n )\n if err := row.Scan(&id, &name); err == nil {\n fmt.Println(id, name)\n } else {\n log.Fatal(err)\n }\n }\n err = row.Err()\n if err != nil {\n log.Fatal(err)\n }\n\n fmt.Printf(\"\\nFinished correctly\\n\")\n return\n}", "title": "" }, { "docid": "c5da0330b804db7b1bcb22187d83c6f3", "score": "0.595018", "text": "func normalQuery(q *QuerySpecs, res *SingleQueryResult) error {\n\tvar err error\n\trowsChecked := 0\n\tstop = 0\n\treader := q.files[\"_f1\"].reader\n\tnotifier := TimedNotifier(\"Scanning line \", &rowsChecked, \", \", &q.quantityRetrieved, \" results so far\")\n\tnotifier(START)\n\n\tfor {\n\t\tif stop == 1 {\n\t\t\tstop = 0\n\t\t\tbreak\n\t\t}\n\t\tif q.LimitReached() && !q.groupby {\n\t\t\tbreak\n\t\t}\n\n\t\t//read line from csv file\n\t\t_, err = reader.Read()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\t//find matches and retrieve results\n\t\tif evalWhere(q) && evalDistinct(q) && execGroupOrNewRow(q, q.tree.node4) {\n\t\t\texecSelect(q, res)\n\t\t}\n\n\t\trowsChecked++\n\t}\n\tnotifier(STOP)\n\treturn nil\n}", "title": "" }, { "docid": "afc8d7563d53ed3edc2c655a978f21aa", "score": "0.5934568", "text": "func Queries(q [][]int32) []int32 {\n\tvar res []int32\n\tvar counts = map[int32]int32{}\n\tfor _, v := range q {\n\t\tswitch v[0] {\n\t\tcase 1:\n\t\t\t// Insert statement\n\t\t\tif _, ok := counts[v[1]]; ok {\n\t\t\t\tcounts[v[1]]++\n\t\t\t} else {\n\t\t\t\tcounts[v[1]] = 1\n\t\t\t}\n\t\tcase 2:\n\t\t\t// Delete statement\n\t\t\t// Reduce count (won't go below zero)\n\t\t\tif count, ok := counts[v[1]]; ok && count > 0 {\n\t\t\t\tcounts[v[1]]--\n\t\t\t}\n\t\tcase 3:\n\t\t\t// Frequency lookup statement\n\t\t\tvar found int32\n\t\t\tfor _, val := range counts {\n\t\t\t\tif val == v[1] {\n\t\t\t\t\tfound = 1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tres = append(res, found)\n\t\t}\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "93fc421344f2143a512ca76d5e5dc05d", "score": "0.59294873", "text": "func built_query() error {\n\n\tresult, err := models.Users(qm.Where(\"age = ?\", 27)).All(context.Background(), DB)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"--- built query ---\")\n\tfor _, user := range result {\n\t\tfmt.Printf(\"result : \\n user_id: %d\\n name: %s\\n age: %d\\n\",\n\t\t\tuser.UserID, user.Name, user.Age)\n\t}\n\tfmt.Println()\n\n\treturn nil\n}", "title": "" }, { "docid": "d9e7cf2d90ea65c8e8fb7a1ca0380c54", "score": "0.5913742", "text": "func runSql(driver, connection string, statements ...string) {\n\tdb, err := sql.Open(driver, connection)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tdefer db.Close()\n\tfor _, statement := range statements {\n\t\tif _, err := db.Exec(statement); err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "acf8437edb3d174d8efc1426a08d5224", "score": "0.59061646", "text": "func (c InfluxDBClient) queryDB(cmd string, db string) (res []client.Result, err error) {\n\tq := client.Query{\n\t\tCommand: cmd,\n\t\tDatabase: db,\n\t}\n\tif response, err := c.Query(q); err == nil {\n\t\tif response.Error() != nil {\n\t\t\treturn res, response.Error()\n\t\t}\n\t\tres = response.Results\n\t}\n\n\treturn res, jerrors.Trace(err)\n}", "title": "" }, { "docid": "66335fffba67b80b1e5964648764beaf", "score": "0.589983", "text": "func (dbs *DBs) Query(query string, args ...interface{}) (r *sql.Rows, err error) {\n\t_, r, err = _query(context.Background(), dbs.readBalancer(), query, args...)\n\treturn\n}", "title": "" }, { "docid": "c99e0018eedbff9e7ed1419441084041", "score": "0.5893797", "text": "func query(sqlStatement string, qID string) {\n\tdb := createConnection()\n\t//prepares to close database when done\n\tdefer db.Close()\n\t//execute the sql statement and return a response\n\trows, err := db.Query(sqlStatement)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to execute %s | . %v\", qID, err)\n\t}\n\tvar suburbs []Suburb\n\t//dont forget to close the rows\n\tdefer rows.Close()\n\t// iterate over the rows\n\tfor rows.Next() {\n\t\tvar suburb Suburb\n\n\t\t// unmarshal the row object to user\n\t\terr = rows.Scan(&suburb.Name, &suburb.Count, &suburb.StaffTotal, &suburb.AverageSize)\n\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Unable to scan the row. %v\", err)\n\t\t}\n\n\t\t// append the user in the users slice\n\t\tsuburbs = append(suburbs, suburb)\n\n\t}\n\t//print the things\n\tfor _, item := range suburbs {\n\t\tfmt.Printf(\"%s : %.2f\\n\", item.Name, item.AverageSize)\n\t}\n}", "title": "" }, { "docid": "197d50f11f2dd0de13746d0d3972d74a", "score": "0.58901477", "text": "func (client *Client) query(req *request, resp interface{}) error {\n\terr := client.prepare(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr, err := client.run(req, resp)\n\tif r != nil && r.Body != nil {\n\t\tr.Body.Close()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "d3a7ea533d7a933fe11d222c0a4fd2cd", "score": "0.5888768", "text": "func execSQL(t db.QueryExecType, q string, args ...interface{}) (db.QueryResult, error) {\n\tvar rows db.QueryResult\n\tvar err error\n\tif databasePointer != nil {\n\t\tconn, err := databasePointer.GetConnection()\n\t\trows, err = databasePointer.Exec(t, conn, q, args...)\n\t\tif err != nil {\n\t\t\tlog.Println(\"SQL error: \", err.Error())\n\t\t}\n\t\tdatabasePointer.CloseConnection(conn)\n\t}\n\treturn rows, err\n}", "title": "" }, { "docid": "03b12ffc5a64c07b33a2c2e9bb6d8b5f", "score": "0.5883054", "text": "func (p *databasePack) testLargeQuery(t *testing.T) {\n\t// Connect to the database service in root cluster.\n\tclient, err := mysql.MakeTestClient(common.TestClientConfig{\n\t\tAuthClient: p.root.cluster.GetSiteAPI(p.root.cluster.Secrets.SiteName),\n\t\tAuthServer: p.root.cluster.Process.GetAuthServer(),\n\t\tAddress: p.root.cluster.MySQL,\n\t\tCluster: p.root.cluster.Secrets.SiteName,\n\t\tUsername: p.root.user.GetName(),\n\t\tRouteToDatabase: tlsca.RouteToDatabase{\n\t\t\tServiceName: p.root.mysqlService.Name,\n\t\t\tProtocol: p.root.mysqlService.Protocol,\n\t\t\tUsername: \"root\",\n\t\t},\n\t})\n\trequire.NoError(t, err)\n\n\tnow := time.Now()\n\tquery := fmt.Sprintf(\"select %s\", strings.Repeat(\"A\", 100*1024))\n\tresult, err := client.Execute(query)\n\trequire.NoError(t, err)\n\trequire.Equal(t, mysql.TestQueryResponse, result)\n\tresult.Close()\n\n\trequire.NoError(t, err)\n\trequire.Equal(t, mysql.TestQueryResponse, result)\n\tresult.Close()\n\n\tee := waitForAuditEventTypeWithBackoff(t, p.root.cluster.Process.GetAuthServer(), now, events.DatabaseSessionQueryEvent)\n\trequire.Len(t, ee, 1)\n\n\tquery = \"select 1\"\n\tresult, err = client.Execute(query)\n\trequire.NoError(t, err)\n\trequire.Equal(t, mysql.TestQueryResponse, result)\n\tresult.Close()\n\n\trequire.Eventually(t, func() bool {\n\t\tee := waitForAuditEventTypeWithBackoff(t, p.root.cluster.Process.GetAuthServer(), now, events.DatabaseSessionQueryEvent)\n\t\treturn len(ee) == 2\n\t}, time.Second*3, time.Millisecond*500)\n\n\t// Disconnect.\n\terr = client.Close()\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "21d9554376362e569f6e9a2ecdebdb93", "score": "0.58827966", "text": "func (Uni *UniBot) DBQuery(index string, a ...interface{}) (*sql.Rows, error) {\n\treturn Uni.DB.Query(fmt.Sprintf(unisql[Uni.Config.DBDriver][index], a...))\t\n}", "title": "" }, { "docid": "ea6af74477db03fb0792725eb0db3244", "score": "0.58551747", "text": "func (e *Env) queryJSON(c *gin.Context) {\n\tvar userQueries Queries\n\n\t// Parsing JSON, early return if error occurred\n\tif c.BindJSON(&userQueries) != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"message\": \"Error occurred when parsing your JSON query ! X( \"})\n\t\treturn\n\t}\n\n\tresults := make([]Data, len(userQueries))\n\tfor i, userQuery := range userQueries {\n\t\t// Passing slice to a variadic function, learned\n\t\t// https://blog.learngoprogramming.com/golang-variadic-funcs-how-to-patterns-369408f19085\n\t\tvar query []q.Matcher\n\n\t\tif userQuery.Title != \"\" {\n\t\t\tquery = append(query, q.Eq(\"Title\", userQuery.Title))\n\t\t}\n\t\tif userQuery.Description != \"\" {\n\t\t\tquery = append(query, q.Eq(\"Description\", userQuery.Description))\n\t\t}\n\t\tif userQuery.Filename != \"\" {\n\t\t\tquery = append(query, q.Eq(\"Filename\", userQuery.Filename))\n\t\t}\n\t\tif userQuery.Src != \"\" {\n\t\t\tquery = append(query, q.Eq(\"Src\", userQuery.Src))\n\t\t}\n\t\tvar resp Data\n\t\te.db.Select(query...).First(&resp)\n\t\tresults[i] = resp\n\t}\n\n\tc.JSON(http.StatusOK, results)\n}", "title": "" }, { "docid": "1dc59f63481448fbb7a4902ea4e64a12", "score": "0.5852028", "text": "func DoQuery(r *http.Request, sqlStatement string, args ...interface{}) (rows *sql.Rows, err error) {\n\tsrv := &server.KairosService\n\terr = srv.DB.Ping()\n\tif err != nil {\n\t\tsrv.DB.Close()\n\t\telast.LogSys(r, \"500\", \"Database is gone Kairos Drive shutting down for restart\", nil, DBService)\n\t\tsrv.HTTP.Close()\n\t\tpanic(err)\n\t}\n\tusrid := r.Context().Value(\"userID\")\n\tstr := fmt.Sprintf(\"%v\", usrid)\n\tsrv.DB.Exec(\"SET application_name TO 'Drive:/\" + r.URL.Path + \"|\" + str + \"';\")\n\trows, err = srv.DB.Query(sqlStatement, args...)\n\treturn\n}", "title": "" }, { "docid": "a787b54c0a40ee04f0b322068fe9f110", "score": "0.58482754", "text": "func (db *Db) Query(query string, args ...interface{}) (*sql.Rows, error) {\n\tif db.conn == nil {\n\t\tdb.connect()\n\t}\n\n\tstatement, err := db.conn.Prepare(query)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\trows, err := statement.Query(args...) // execute our statement\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\treturn rows, err\n}", "title": "" }, { "docid": "7ccce4d3d7b8f83fd9b704edeb3be4ac", "score": "0.58399653", "text": "func queryNotes() []Note {\n\tvar notes []Note\n\t// The order of the if here is very important - esp. for the webserver!\n\tif opts_intf[\"ql\"] == true {\n\t\tdb.Order(\"updated_at desc\").Limit(1).Find(&notes)\n\t} else if opts_intf[\"qi\"] !=nil && opts_intf[\"qi\"].(int64) != 0 {\n\t\tdb.Find(&notes, opts_intf[\"qi\"].(int64))\n\t\t// TAG and wildcard\n\t} else if opts_str[\"qg\"] != \"\" && opts_str[\"q\"] != \"\" {\n\t\tdb.Where(\"tag LIKE ? AND (title LIKE ? OR description LIKE ? OR body LIKE ?)\",\n\t\t\t\t\t\"%\"+opts_str[\"qg\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"q\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"q\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"q\"]+\"%\",\n\t\t).Order(\"updated_at desc\").Limit(opts_intf[\"l\"].(int)).Find(&notes)\n\t\t// TITLE and wildcard\n\t} else if opts_str[\"qt\"] != \"\" && opts_str[\"q\"] != \"\" {\n\t\tdb.Where(\"title LIKE ? AND (tag LIKE ? OR description LIKE ? OR body LIKE ?)\",\n\t\t\t\t\t\"%\"+opts_str[\"qt\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"q\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"q\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"q\"]+\"%\",\n\t\t).Order(\"updated_at desc\").Limit(opts_intf[\"l\"].(int)).Find(&notes)\n\t\t//\n\t} else if opts_str[\"q\"] == \"all\" {\n\t\tdb.Order(\"updated_at desc\").Limit(opts_intf[\"l\"].(int)).Find(&notes)\n\t\t// General query\n\t} else if opts_str[\"q\"] != \"\" {\n\t\tdb.Where(\"tag LIKE ? OR title LIKE ? OR description LIKE ? OR body LIKE ?\",\n\t\t\t\t\t\"%\"+opts_str[\"q\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"q\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"q\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"q\"]+\"%\",\n\t\t).Order(\"updated_at desc\").Limit(opts_intf[\"l\"].(int)).Find(&notes)\n\t\t// ANY combination - without q\n\t} else {\n\t\tdb.Where(\"tag LIKE ? AND title LIKE ? AND description LIKE ? AND body LIKE ?\",\n\t\t\t\t\t\"%\"+opts_str[\"qg\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"qt\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"qd\"]+\"%\",\n\t\t\t\t\t\"%\"+opts_str[\"qb\"]+\"%\",\n\t\t).Order(\"updated_at desc\").Limit(opts_intf[\"l\"].(int)).Find(&notes)\n\t}\n\n\treturn notes\n}", "title": "" }, { "docid": "8a84e8d56bb71e79345d416d791aa032", "score": "0.5833044", "text": "func (db *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (*Rows, error) {}", "title": "" }, { "docid": "7ebd93047c6f74aa3db9f2ec839314c9", "score": "0.5831554", "text": "func (this *QueryEngine) QueryConnectionPoolMode (queries []string, single bool) []*QueryRes {\n results := make([]*QueryRes, len(queries))\n q_chan := make(chan int)\n c_chan := make(chan int, len(this.connections))\n var wg sync.WaitGroup\n for c_idx := 0; c_idx < len(this.connections); c_idx ++ {\n c_chan <- c_idx\n }\n\n for i := 0; i < this.threadsToInit(len(queries)); i++ {\n go func(){\n for q_idx := range q_chan {\n c_idx := <-c_chan\n results[q_idx] = this.exec_query(this.connections[c_idx], queries[q_idx], single)\n wg.Done()\n c_chan <- c_idx\n }\n }()\n }\n wg.Add(len(queries))\n for q_idx,_ := range queries {\n q_chan <- q_idx\n }\n close(q_chan)\n wg.Wait()\n //close(q_chan)\n close(c_chan)\n return results\n}", "title": "" }, { "docid": "8e352596b4f44fb9bdd3eda2a3f9016d", "score": "0.58178616", "text": "func executeQuery(sqlStatement string, qID string) {\n\tdb := createConnection()\n\t//prepares to close database when done\n\tdefer db.Close()\n\t//execute the sql statement and return a response\n\tres, err := db.Exec(sqlStatement)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to execute %s | . %v\", qID, err)\n\t}\n\t//print the response maybe\n\tfmt.Printf(\"%s\\n \", res)\n}", "title": "" }, { "docid": "a49bb7a7d5645e71a9a043d80d419fff", "score": "0.58124816", "text": "func (db *DB) Query(query string, args ...interface{}) (*sql.Rows, error) {\n\treturn db.connection.Query(query, args...)\n}", "title": "" }, { "docid": "e3ecb60fd89781899c9aa2d114f4e00d", "score": "0.58111626", "text": "func (query *Query) Query(args ...interface{}) {\n\tif query.OK() {\n\t\tquery.Prepare()\n\t\tquery.QueryPrepared(args...)\n\t}\n}", "title": "" }, { "docid": "7f228c64d83157e4c93af1d9612f7b19", "score": "0.58091307", "text": "func (db DBWrapper) Query(sqlText string, args ...interface{}) (qr QueryResult) {\n\trows, err := db.DB.Query(sqlText, args...)\n\tdefer func() {\n\t\tif rows != nil {\n\t\t\trows.Close()\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\tdb.logError(err, sqlText, args)\n\t\tqr.Error = err\n\t\treturn\n\t}\n\n\tqr.Cols, err = rows.Columns()\n\tif err != nil {\n\t\tdb.logError(err, sqlText, args)\n\t\tqr.Error = err\n\t\treturn\n\t}\n\tqr.Rows = make([]Row, 0, 10) // Default len 10\n\tfor rows.Next() {\n\t\trow := make([]interface{}, len(qr.Cols))\n\t\tfor i, _ := range row {\n\t\t\trow[i] = new([]byte)\n\t\t}\n\n\t\trows.Scan(row...)\n\t\tqr.Rows = append(qr.Rows, row)\n\t}\n\treturn\n}", "title": "" }, { "docid": "0c93b775ff2e59b84d2ced1284c668b9", "score": "0.5808349", "text": "func (ds Cb) Query(q string, f *[]interface{}) error {\n\tquery := gocb.NewN1qlQuery(q)\n\trows, err := ds.Conn.ExecuteN1qlQuery(query, nil)\n\tif err == nil {\n\t\tvar row interface{}\n\t\tfor rows.Next(&row) {\n\t\t\t*f = append(*f, row)\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f911dad1d9e842dd4494de4075e1cf8a", "score": "0.57999575", "text": "func PerformQueries(numWorkers int, numQueries int, jobList [][]SelectQuery, tc TsdbConnection) (QueryTimes, error) {\n\tvar durations QueryTimes\n\n\tconn, err := tc.GetConnectionPool()\n\n\tif err != nil {\n\t\treturn durations, err\n\t}\n\n\tdefer conn.Close()\n\n\tnumJobs := len(jobList)\n\tjobs := make(chan []SelectQuery, numJobs)\n\tresults := make(chan time.Duration, numQueries)\n\terrors := make(chan error, 0)\n\n\tfor w := 1; w <= numWorkers; w++ {\n\t\tgo worker(w, conn, jobs, results, errors)\n\t}\n\n\tfor _, j := range jobList {\n\t\tjobs <- j\n\t}\n\tclose(jobs)\n\n\tfor a := 1; a <= numQueries; a++ {\n\t\tselect {\n\t\tcase r := <-results:\n\t\t\tdurations = append(durations, r)\n\t\tcase err := <-errors:\n\t\t\treturn durations, err\n\t\t}\n\t}\n\treturn durations, nil\n}", "title": "" }, { "docid": "9cad81af5a03369153cc0828b75e2055", "score": "0.57885593", "text": "func TestQueries(t *testing.T) {\n\t\n\tgin.SetMode(gin.TestMode)\n\n\tt.Run(\"getGenre\", func(t *testing.T) {\n\t\tresponse := httptest.NewRecorder()\n\t\treq, err := http.NewRequest(\"GET\", \"/getGenre/Pop\", nil)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\ttestRouter.ServeHTTP(response, req)\n\t\tassert.Equal(t, response.Code, 200)\n\t})\n\n}", "title": "" }, { "docid": "eff26adad855577dd93ccc0df440dca1", "score": "0.5787778", "text": "func (db *DB) Query(query string, args ...interface{}) (*sql.Rows, error) {\n\tr, err := db.sqlxdb[db.slave(db.length)].Query(query, args...)\n\treturn r, err\n}", "title": "" }, { "docid": "cf11826027f640a8c4e61292fa8bc840", "score": "0.57852143", "text": "func (db *DB) Query(query string, args ...interface{}) (*Rows, error) {\n\treturn db.QueryContext(context.Background(), query, args...)\n}", "title": "" }, { "docid": "66f1230b2393a9cb915064f79d20c66b", "score": "0.5782125", "text": "func (hook *InfluxDBHook) queryDB(cmd string) ([]influxdb.Result, error) {\n\tresponse, err := hook.client.Query(influxdb.Query{\n\t\tCommand: cmd,\n\t\tDatabase: hook.database,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif response.Error() != nil {\n\t\treturn nil, response.Error()\n\t}\n\treturn response.Results, nil\n}", "title": "" }, { "docid": "f36d836a9db0ba047e2c7768d8784779", "score": "0.5781797", "text": "func (s DBStorage) Query(query string, args ...interface{}) (*sql.Rows, error) {\n\treturn s.db.Query(query, args...)\n}", "title": "" }, { "docid": "a563e87af0fb3a014003dd7ff0a21d46", "score": "0.57811874", "text": "func (rcdb *ReconnectableCloudtrustDB) Query(query string, args ...interface{}) (sqltypes.SQLRows, error) {\n\trcdb.logger.Debug(context.TODO(), \"msg\", \"'Query() called'\")\n\tdbConn, err := rcdb.getActiveConnection()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar res sqltypes.SQLRows\n\tres, err = dbConn.Query(query, args...)\n\trcdb.checkError(err)\n\n\treturn res, err\n}", "title": "" }, { "docid": "c4c7e47122744fa3e41e2c31278b46c4", "score": "0.5778767", "text": "func TestDatabase_Execute(t *testing.T) {\n\t// Create database and seed table.\n\tdb := OpenDatabase()\n\tdefer db.Close()\n\tdb.CreateTable(\"foo\", []*pie.Column{{Name: \"fname\"}, {Name: \"lname\"}})\n\tdb.SetTableRows(\"foo\", [][]string{\n\t\t{\"susy\", \"que\"},\n\t\t{\"bob\", \"smith\"},\n\t})\n\n\t// Parse PieQL statement.\n\tstmt, err := pieql.NewParser(strings.NewReader(`SELECT lname, fname FROM foo`)).Parse()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Execute statement.\n\tres, err := db.Execute(stmt)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Verify results.\n\tif len(res) != 2 {\n\t\tt.Fatalf(\"result len mismatch: %d\", len(res))\n\t} else if !reflect.DeepEqual(res[0], []string{\"que\", \"susy\"}) {\n\t\tt.Fatalf(\"row(0) mismatch: %#v\", res[0])\n\t} else if !reflect.DeepEqual(res[1], []string{\"smith\", \"bob\"}) {\n\t\tt.Fatalf(\"row(1) mismatch: %#v\", res[1])\n\t}\n}", "title": "" }, { "docid": "29e09afc773012bf5c033a6bd3d40f28", "score": "0.5778663", "text": "func (db *DB) Query(sql string, args ...interface{}) (*sql.Rows, error) {\n\tdb.exclusive.Lock()\n\tdefer db.exclusive.Unlock()\n\n\ts, err := db.statement(sql)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Debugf(\"Parameters: %v\", args)\n\tr, err := s.Query(args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "dd7d9f7e829cc3eb772a75da54efce42", "score": "0.57749784", "text": "func Query(c Conn, sql string, params ...interface{}) (rows []Row, res Result, err error) {\n\tres, err = c.Start(sql, params...)\n\tif err != nil {\n\t\treturn\n\t}\n\trows, err = GetRows(res)\n\treturn\n}", "title": "" }, { "docid": "52ee58268bb8c30613a30ace05b301c9", "score": "0.57714546", "text": "func (c *Connection) Query(query string, args ...interface{}) (*sql.Rows, error) {\n\tstmt, e := c.getQuery(query)\n\tif e == nil {\n\t\treturn stmt.Query(args...)\n\t} else {\n\t\treturn c.DB.Query(query, args...)\n\t}\n}", "title": "" }, { "docid": "152d54f9c12c483b129bf00e4841e573", "score": "0.57673806", "text": "func QueryCommand(ctx context.Context, args CommonArgs, n, concurrency int) error {\n\tif n < 10 {\n\t\tconcurrency = 1\n\t}\n\n\tvar errs arngin.Errors\n\tfor _, name := range args.Engines {\n\t\te, err := makeEngine(ctx, name, args)\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar (\n\t\t\tg errgroup.Group\n\t\t\tavgDur int64\n\t\t\tqcnt = n / concurrency // we could lose some accuracy here but that's okay\n\t\t)\n\t\tfor i := 0; i < concurrency; i++ {\n\t\t\tg.Go(func() error {\n\t\t\t\tqs := gen.Qs(qcnt)\n\t\t\t\tstart := time.Now()\n\t\t\t\tfor _, q := range qs {\n\t\t\t\t\tif _, err := e.RunQuery(ctx, q); err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"run query[%#v]: %w\", q, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tatomic.AddInt64(\n\t\t\t\t\t&avgDur,\n\t\t\t\t\t(int64)(time.Since(start))/(int64)(qcnt*concurrency),\n\t\t\t\t)\n\t\t\t\treturn nil\n\t\t\t})\n\t\t}\n\n\t\tif err := g.Wait(); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"run queries[engine: %s]: %w\", name, err))\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Printf(\n\t\t\t\"Ran %d queries with concurrency of %d against %s [avg: %s]\\n\",\n\t\t\tn, concurrency, name, (time.Duration)(avgDur),\n\t\t)\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn errs\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fdabbf29cbd26cc81d4432edcc6fd6e5", "score": "0.5767184", "text": "func QueryDb(query string, args ...interface{}) (*sql.Rows, error) {\n\tLogging(\"QueryDb\", fmt.Sprintf(\"%s %v\", query, args))\n\tdbconn := GetLiteConn()\n\tdefer dbconn.Close()\n\trows, err := dbconn.Query(query, args...)\n\treturn rows, err\n}", "title": "" }, { "docid": "b9331753a529266c95c3ab4c85d8f126", "score": "0.57583296", "text": "func (ds *SQLDataSource) Query(strSQL string, args ...interface{}) (*sql.Rows, error) {\n\trows, err := ds.db.Query(strSQL, args...)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn rows, err\n\t}\n\treturn rows, nil\n}", "title": "" }, { "docid": "5a002a2c36103c45746931a88508026d", "score": "0.5748866", "text": "func (repository CloudSqlRepository) queryCommon(query string, request *messaging.ObjectRequest, isOne bool) RepositoryResponse {\n\tresponse := RepositoryResponse{}\n\n\trequest.Log(\"Info Query : \" + query)\n\n\tconn, err := repository.getConnection(request)\n\tif err == nil {\n\t\tvar err error\n\t\tdbName := repository.getDatabaseName(request.Controls.Namespace)\n\t\terr = repository.buildTableCache(request, conn, dbName, request.Controls.Class)\n\t\tif err != nil {\n\t\t\trequest.Log(\"Error : \" + err.Error())\n\t\t}\n\n\t\tvar obj interface{}\n\t\ttableName := dbName + \".\" + request.Controls.Class\n\t\tif isOne {\n\t\t\tobj, err = repository.executeQueryOne(request, conn, query, tableName)\n\t\t} else {\n\t\t\tobj, err = repository.executeQueryMany(request, conn, query, tableName)\n\t\t}\n\n\t\tif err == nil {\n\t\t\tvar bytes []byte\n\t\t\tif isOne {\n\t\t\t\tbytes, _ = json.Marshal(obj.(map[string]interface{}))\n\t\t\t} else {\n\t\t\t\tbytes, _ = json.Marshal(obj.([]map[string]interface{}))\n\t\t\t}\n\n\t\t\tif checkEmptyByteArray(bytes) {\n\t\t\t\tresponse.GetResponseWithBody(getEmptyByteObject())\n\t\t\t} else {\n\t\t\t\tresponse.GetResponseWithBody(bytes)\n\t\t\t}\n\t\t} else {\n\t\t\tresponse.GetResponseWithBody(getEmptyByteObject())\n\t\t}\n\t} else {\n\t\tresponse.GetErrorResponse(\"Error connecting to CloudSQL : \" + err.Error())\n\t}\n\trepository.closeConnection(conn)\n\treturn response\n}", "title": "" }, { "docid": "406231edaf7ace74766e14f10f8114bd", "score": "0.57468843", "text": "func (conn *Conn) Query(command string, params ...*Parameter) (rs *ResultSet, err error) {\n\terr = conn.withRecover(\"*Conn.Query\", func() {\n\t\trs = conn.query(command, params...)\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "126a8f78f8d91a9ae63ce42c85f34726", "score": "0.5741036", "text": "func expectQuery(t *testing.T, e *Engine, flags int, queryString string, items ...string) {\n\tquery := &Query{\n\t\tSendRelatedRecords: flags&qFlagSendJoins != 0,\n\t\tQuery: queryString,\n\t}\n\tconfig := e.GetConfig()\n\tres, err := e.Find(query, config)\n\texpected := \"\"\n\tif items != nil {\n\t\tquotedItems := make([]string, len(items))\n\t\tfor i := 0; i < len(items); i++ {\n\t\t\tquotedItems[i] = \"\\\"\" + items[i] + \"\\\"\"\n\t\t}\n\t\texpected = strings.Join(quotedItems, \", \")\n\t}\n\n\tif err != nil {\n\t\tt.Errorf(\"Error searching for %v: %v\", queryString, err)\n\t}\n\tsame := false\n\trows := res.Rows\n\n\tif query.SendRelatedRecords {\n\t\t// This is nice for dumping the result to the console\n\t\t//jv, _ := json.MarshalIndent(res, \"\", \" \")\n\t\t//fmt.Printf(\"Rows From Join:\\n%v\\n\", string(jv))\n\t}\n\n\tif len(rows) == len(items) {\n\t\tsame = true\n\t\tfor i := 0; i < len(rows); i++ {\n\t\t\tsame = false\n\t\t\tparts := strings.Split(items[i], \" \")\n\t\t\tif len(parts) < 3 {\n\t\t\t\tt.Fatal(\"In your expect string, you must provide 'db.table rowid rank key1:value1,key2:value2...'\")\n\t\t\t}\n\t\t\tif len(parts) == 3 {\n\t\t\t\t// Add a dummy empty 'values'\n\t\t\t\tparts = append(parts, \"\")\n\t\t\t} else {\n\t\t\t\t// recombine all the 'values' parts into one string\n\t\t\t\tparts[3] = strings.Join(parts[3:], \" \")\n\t\t\t}\n\t\t\tif rows[i].Table == TableFullName(parts[0]) &&\n\t\t\t\tstrconv.FormatInt(rows[i].Row, 10) == parts[1] &&\n\t\t\t\tstrconv.FormatInt(int64(rows[i].Rank), 10) == parts[2] &&\n\t\t\t\tvaluesEqual(parts[3], rows[i].Values) {\n\t\t\t\tsame = true\n\t\t\t}\n\t\t}\n\t}\n\t//t.Logf(\"%v -> %v\", queryString, res)\n\tif !same {\n\t\tt.Errorf(\"Incorrect result:\\nQuery: %v\\nResult: %v\\nExpected: %v\", queryString, formatResultList(rows), expected)\n\t}\n}", "title": "" }, { "docid": "3af488834173f1b528e9e2b6d0232fb0", "score": "0.5739439", "text": "func (st *Stmtx) Query(args ...interface{}) (*sql.Rows, error) {\n\treturn st.stmts[st.db.slave(len(st.db.sqlxdb))].Query(args...)\n}", "title": "" }, { "docid": "16ed8283c8231f4e5a0e94a9d1e2a4f0", "score": "0.5735422", "text": "func DbQuery(query string, values ...interface{}) *sql.Rows {\n\tquery = replaceSchema(query)\n\t//prf(\"DbQuery query:%s %#v\", query, values)\n\n\trows, err := db.Query(query, values...)\n\tcheck(err)\n\treturn rows\n}", "title": "" }, { "docid": "7a2e66c8fead15aad08303dab97ee7c0", "score": "0.5728973", "text": "func queryDBCallDetails(serviceManagerRequestType, appRequestType, connString string) ([]map[string]interface{}, bool, int) {\n\tvar arrCallDetailsMaps []map[string]interface{}\n\tdbapp, dberr := sqlx.Open(appDBDriver, connStrAppDB)\n\tif dberr != nil {\n\t\tlogger(4, \"Could not open application DB connection: \"+dberr.Error(), true)\n\t\treturn nil, false, 0\n\t}\n\tdefer dbapp.Close()\n\t//Check connection is open\n\terr := dbapp.Ping()\n\tif err != nil {\n\t\tlogger(4, \"[DATABASE] [PING] Database Connection Error: \"+fmt.Sprintf(\"%v\", err), true)\n\t\treturn nil, false, 0\n\t}\n\tlogger(3, \"[DATABASE] Connection Successful\", true)\n\tlogger(3, \"[DATABASE] Retrieving \"+serviceManagerRequestType+\"s, \"+appRequestType+\" from the third party application.\", true)\n\tlogger(3, \"[DATABASE] Please Wait...\", true)\n\t//build query\n\tsqlCallQuery = mapGenericConf.RequestQuery\n\tlogger(3, \"[DATABASE] Query to retrieve \"+serviceManagerRequestType+\": \"+sqlCallQuery, false)\n\n\t//Run Query\n\trows, err := dbapp.Queryx(sqlCallQuery)\n\n\tif err != nil {\n\t\tlogger(4, \" Database Query Error: \"+fmt.Sprintf(\"%v\", err), true)\n\t\treturn nil, false, 0\n\t}\n\tdefer rows.Close()\n\t//Build map full of calls to import\n\tintCallCount := 0\n\tfor rows.Next() {\n\t\tcounters.found++\n\t\tresults := make(map[string]interface{})\n\t\terr = rows.MapScan(results)\n\n\t\tif results[mapGenericConf.RequestReferenceColumn] == nil {\n\t\t\tlogger(4, \"Record contains nil value in Reference Column, or Reference Column does not exist in resultset: \"+mapGenericConf.RequestReferenceColumn, false)\n\t\t\tcounters.createdSkipped++\n\t\t\tcontinue\n\t\t}\n\t\tvar s string\n\t\tif valField, ok := results[mapGenericConf.RequestReferenceColumn].(int64); ok {\n\t\t\ts = strconv.FormatInt(valField, 10)\n\t\t} else if valField, ok := results[mapGenericConf.RequestReferenceColumn].(int32); ok {\n\t\t\ts = strconv.FormatInt(int64(valField), 10)\n\t\t} else if valField, ok := results[mapGenericConf.RequestReferenceColumn].(float64); ok {\n\t\t\ts = strconv.FormatFloat(valField, 'f', -1, 64)\n\t\t} else {\n\t\t\ts = fmt.Sprintf(\"%s\", results[mapGenericConf.RequestReferenceColumn])\n\t\t}\n\n\t\trequestIsInCache, _, _ := recordInCache(s, \"Request\")\n\t\tif requestIsInCache {\n\t\t\tcontinue\n\t\t}\n\t\tmutexRequests.Lock()\n\t\tvar r requestListStruct\n\t\tr.RequestID = s\n\t\trequests = append(requests, r)\n\t\tmutexRequests.Unlock()\n\t\tintCallCount++\n\n\t\tif err != nil {\n\t\t\t//something is wrong with this row just log then skip it\n\t\t\tlogger(4, \" Database Result error: \"+err.Error(), true)\n\t\t\tcontinue\n\t\t}\n\t\t//Stick marshalled data map in to parent slice\n\t\tarrCallDetailsMaps = append(arrCallDetailsMaps, results)\n\t}\n\treturn arrCallDetailsMaps, true, intCallCount\n}", "title": "" }, { "docid": "9283ab7adc8fc3f6fa227874cb2aab03", "score": "0.5726538", "text": "func (h *Handler) Query(ctx context.Context, stmt string, args ...interface{}) (repository.Row, error) {\n\trows, err := h.Conn.QueryContext(ctx, stmt, args...)\n\treturn Row{rows}, err\n}", "title": "" }, { "docid": "a219048827e6b1cf1dac6a8c8d0a1e54", "score": "0.57254964", "text": "func QueryDB(str string) *sql.Rows {\n\trows, err := db.Query(str)\n\tCheckErr(err)\n\treturn rows\n}", "title": "" }, { "docid": "60404e83ec663c0214f0ee1e74c10083", "score": "0.5725263", "text": "func Query(id int) {\n\n\tvar name string\n\terr := pool.QueryRow(\"select m.id from mytable m where m.id = :id\", sql.Named(\"id\", id)).Scan(&name)\n\tif err != nil {\n\t\tlog.Fatal(\"unable to execute search query\", err)\n\t}\n\tlog.Println(\"id=\", name)\n\n\treturn\n}", "title": "" }, { "docid": "b4df92980c274d44b45ce515dda85dc1", "score": "0.57252", "text": "func (this *DbBaseDao) Query(sqlorArgs ...interface{}) (resultsSlice []map[string][]byte, err error) {\n\tsession := this.Engine.NewSession()\n\tdefer session.Close()\n\treturn session.Query(sqlorArgs...)\n}", "title": "" }, { "docid": "4e53b436408f54e41435a5c5e4c77687", "score": "0.5722282", "text": "func (D DBO) QueryAll(table string) *sql.Rows {\n\tif D.inited {\n\t\tq := fmt.Sprintf(\"SELECT * FROM %s\", table)\n\t\trows, err := D.con.Query(q)\n\t\tif err != nil {\n\t\t\tlog.Println(\"SQL Error: \", err)\n\t\t\treturn &sql.Rows{}\n\t\t} else {\n\t\t\treturn rows\n\t\t}\n\t} else {\n\t\treturn &sql.Rows{}\n\t}\n}", "title": "" }, { "docid": "03f0255798fb94035db70fa02155b647", "score": "0.5712605", "text": "func TestGetRowsWrongQuery(t *testing.T) {\n\trq, mock, db := initRequest(t)\n\tdefer db.Close()\n\n\trq.Query = select_query\n\tmock.ExpectPrepare(rq.Query).WillReturnError(sql_error)\n\n\trows, err := rq.GetRows()\n\tassert.Error(t, err)\n\tif !assert.Nil(t, rows) {\n\t\trows.Close()\n\t}\n\tcheckResults(t, mock)\n}", "title": "" }, { "docid": "c4a7fa736df9a95dd15293b9a8249159", "score": "0.5707135", "text": "func (e StubExecer) Query(ctx context.Context, query string, args ...interface{}) (pgxapi.SqlRows, error) {\n\te.Lgr.Log(ctx, tracelog.LogLevelInfo, query, argMap(args...))\n\treturn e.Rows, e.Err\n}", "title": "" }, { "docid": "db0a7215d29cd271a487705a0c8807fa", "score": "0.5706338", "text": "func (s *store) query(ctx context.Context, query *sqlf.Query) (*sql.Rows, error) {\n\treturn s.Store.Query(ctx, query)\n}", "title": "" }, { "docid": "66679c65ce616a3fd95d6fd87079c601", "score": "0.5704796", "text": "func TestQueriesSameTransaction(t *testing.T, builder Builder) {\n\tt.Run(\"SELECT\", func(t *testing.T) {\n\t\tng, cleanup := builder()\n\t\tdefer cleanup()\n\t\tdefer func() {\n\t\t\tassert.NoError(t, ng.Close())\n\t\t}()\n\n\t\tdb, err := genji.New(context.Background(), ng)\n\t\tassert.NoError(t, err)\n\n\t\terr = db.Update(func(tx *genji.Tx) error {\n\t\t\td, err := tx.QueryDocument(`\n\t\t\t\tCREATE TABLE test;\n\t\t\t\tINSERT INTO test (a) VALUES (1), (2), (3), (4);\n\t\t\t\tSELECT COUNT(*) FROM test;\n\t\t\t`)\n\t\t\tassert.NoError(t, err)\n\t\t\tvar count int\n\t\t\terr = document.Scan(d, &count)\n\t\t\tassert.NoError(t, err)\n\t\t\trequire.Equal(t, 4, count)\n\t\t\treturn nil\n\t\t})\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"INSERT\", func(t *testing.T) {\n\t\tng, cleanup := builder()\n\t\tdefer cleanup()\n\t\tdefer func() {\n\t\t\tassert.NoError(t, ng.Close())\n\t\t}()\n\n\t\tdb, err := genji.New(context.Background(), ng)\n\t\tassert.NoError(t, err)\n\n\t\terr = db.Update(func(tx *genji.Tx) error {\n\t\t\terr = tx.Exec(`\n\t\t\tCREATE TABLE test;\n\t\t\tINSERT INTO test (a) VALUES (1), (2), (3), (4);\n\t\t`)\n\t\t\tassert.NoError(t, err)\n\t\t\treturn nil\n\t\t})\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"UPDATE\", func(t *testing.T) {\n\t\tng, cleanup := builder()\n\t\tdefer cleanup()\n\t\tdefer func() {\n\t\t\tassert.NoError(t, ng.Close())\n\t\t}()\n\n\t\tdb, err := genji.New(context.Background(), ng)\n\t\tassert.NoError(t, err)\n\n\t\terr = db.Update(func(tx *genji.Tx) error {\n\t\t\tst, err := tx.Query(`\n\t\t\t\tCREATE TABLE test;\n\t\t\t\tINSERT INTO test (a) VALUES (1), (2), (3), (4);\n\t\t\t\tUPDATE test SET a = 5;\n\t\t\t\tSELECT * FROM test;\n\t\t\t`)\n\t\t\tassert.NoError(t, err)\n\t\t\tdefer st.Close()\n\t\t\tvar buf bytes.Buffer\n\t\t\terr = testutil.IteratorToJSONArray(&buf, st)\n\t\t\tassert.NoError(t, err)\n\t\t\trequire.JSONEq(t, `[{\"a\": 5},{\"a\": 5},{\"a\": 5},{\"a\": 5}]`, buf.String())\n\t\t\treturn nil\n\t\t})\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"DELETE\", func(t *testing.T) {\n\t\tng, cleanup := builder()\n\t\tdefer cleanup()\n\t\tdefer func() {\n\t\t\tassert.NoError(t, ng.Close())\n\t\t}()\n\n\t\tdb, err := genji.New(context.Background(), ng)\n\t\tassert.NoError(t, err)\n\n\t\terr = db.Update(func(tx *genji.Tx) error {\n\t\t\td, err := tx.QueryDocument(`\n\t\t\tCREATE TABLE test;\n\t\t\tINSERT INTO test (a) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);\n\t\t\tDELETE FROM test WHERE a > 2;\n\t\t\tSELECT COUNT(*) FROM test;\n\t\t`)\n\t\t\tassert.NoError(t, err)\n\t\t\tvar count int\n\t\t\tdocument.Scan(d, &count)\n\t\t\tassert.NoError(t, err)\n\t\t\trequire.Equal(t, 2, count)\n\t\t\treturn nil\n\t\t})\n\t\tassert.NoError(t, err)\n\t})\n}", "title": "" }, { "docid": "9d4813a57dda33be5b43c61d3d5dada2", "score": "0.57023764", "text": "func (s Sql) Query(query string, args ...interface{}) (*sql.Rows, error) {\n\ts.Log(query, args...)\n\tr, err := s.DB.Query(query, args...)\n\tlogger.CheckError(err)\n\treturn r, err\n}", "title": "" }, { "docid": "137a6af82dcc647d5543a676c20d49a6", "score": "0.56996614", "text": "func Query(c *gin.Context) {\n\tquery := inputQuery{}\n\terr := c.BindJSON(&query)\n\n\tif err != nil {\n\t\trestErr := GetBadRequestError(\"invalid input json format\")\n\t\tc.JSON(restErr.Status, restErr)\n\t} else {\n\t\trows, err := model.Query(query.Sql)\n\t\tif err != nil {\n\t\t\trestErr := GetBadRequestError(err.Error())\n\t\t\tc.JSON(restErr.Status, restErr)\n\t\t} else {\n\t\t\t//resultSet := model.Iterate(rows, targetType)\n\t\t\tresult := []resultSet{}\n\t\t\tfor (*rows).Next() {\n\t\t\t\trs := resultSet{}\n\t\t\t\terr := (*rows).Scan(&rs)\n\t\t\t\tif err != nil {\n\t\t\t\t\trestErr := GetBadRequestError(err.Error())\n\t\t\t\t\tc.JSON(restErr.Status, restErr)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tresult = append(result, rs)\n\t\t\t}\n\t\t\tc.JSON(http.StatusOK, result)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e34e8a087e136ecf1793cea018794a86", "score": "0.5697331", "text": "func PrintAllQueries() {\n\to := order{\n\t\tordID: 5,\n\t\tcustomerID: 6,\n\t}\n\n\te := employee{\n\t\tname: \"Mikhail Gorhgn\",\n\t\tid: 5,\n\t\taddress: \"Moscow, Kremlin\",\n\t\tcountry: \"RU\",\n\t\tsalary: 5000,\n\t}\n\tcreateQuery(o)\n\tcreateQueryPrintFields(o)\n\tcreateQueryPrintQuery(o)\n\n\tcreateQuery(e)\n\tcreateQueryPrintFields(e)\n\tcreateQueryPrintQuery(e)\n}", "title": "" }, { "docid": "dc04333433750e2dcee333d82019ca8a", "score": "0.56837577", "text": "func queryGoals(query string) []*models.Goal {\n\tgoals := []*models.Goal{}\n\tif cursor, err := db.Query(nil, query, make(map[string]interface{})); err != nil {\n\t\tlog.Println(err)\n\t} else {\n\t\tdefer cursor.Close()\n\t\tfor cursor.HasMore() {\n\t\t\tg := &models.Goal{}\n\t\t\tif _, err = cursor.ReadDocument(nil, g); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tgoals = append(goals, g)\n\t\t}\n\t}\n\treturn goals\n}", "title": "" }, { "docid": "3b9bca99baffac28393dcbd7bba2406e", "score": "0.5682891", "text": "func testQuery(t *testing.T, q *Query, models []*indexedPrimativesModel) {\n\texpected, err := expectedResultsForQuery(q, models)\n\tif err != nil {\n\t\tt.Error(err)\n\t\tt.FailNow()\n\t}\n\tstable := !modelsContainDuplicatesForField(models, q.order.fieldName)\n\ttestQueryScan(t, q, expected, stable)\n\ttestQueryIdsOnly(t, q, expected, stable)\n\ttestQueryCount(t, q, expected)\n}", "title": "" } ]
0c1f8895b6b10ce7cfecdf91df92e50e
WriteFile writes file to disk.
[ { "docid": "138fe3136c9d30d0b1f606f792c260a2", "score": "0.6490344", "text": "func WriteFile(filePath, contents string) error {\n\treturn ioutil.WriteFile(filePath, []byte(contents), 0644)\n}", "title": "" } ]
[ { "docid": "d84a8efe18010ba5893117a1e1aa5872", "score": "0.7252334", "text": "func (handler *OSioHandler) WriteFile(filename string, data []byte, perm os.FileMode) error {\n\treturn os.WriteFile(filename, data, perm)\n}", "title": "" }, { "docid": "8e40d188f320e06c5423e1149ab9e821", "score": "0.7223753", "text": "func (OS) WriteFile(filename string, data []byte) error {\n\treturn ioutil.WriteFile(filename, data, 0644)\n}", "title": "" }, { "docid": "1ee43dc4361967fb0ab0a497daf3aec5", "score": "0.71754193", "text": "func (f FileUtils) WriteFile(filename string, data []byte, perm os.FileMode) error {\n\treturn afero.WriteFile(f.Fs, filename, data, perm)\n}", "title": "" }, { "docid": "80f9c24db53e6213f5d153042c50adb0", "score": "0.71630263", "text": "func (d *DefaultOS) WriteFile(name string, data []byte, perm os.FileMode) error {\n\treturn os.WriteFile(name, data, perm)\n}", "title": "" }, { "docid": "2248319c335f48f67c7a2e7767677bc9", "score": "0.7162044", "text": "func (o *OS) WriteFile(ctx context.Context, filename string, data []byte, perm os.FileMode) error {\n\treturn ioutil.WriteFile(filename, data, perm)\n}", "title": "" }, { "docid": "890c6e3cf02853491e5a7771d5fb41a9", "score": "0.70215297", "text": "func (OSDriver) WriteFile(filename string, data []byte, perm os.FileMode) error {\n\treturn ioutil.WriteFile(filename, data, perm)\n}", "title": "" }, { "docid": "792bfded26427a8b236ec298d92c3acd", "score": "0.701916", "text": "func (osFS) WriteFile(filename string, data []byte, perm os.FileMode) error {\n\treturn ioutil.WriteFile(filename, data, perm)\n}", "title": "" }, { "docid": "9d852ca5c34e8927b2770cb7fdaafa45", "score": "0.7017187", "text": "func (t *RPC) WriteFile(filename string, data []byte, perm os.FileMode) error {\n\targuments := &args.WriteFileArgs{\n\t\tFilename: filename,\n\t\tData: data,\n\t\tPerm: perm,\n\t}\n\treturn t.Client.Call(t.Name+\".WriteFile\", arguments, nil)\n}", "title": "" }, { "docid": "4a270961ba1eb9083f9d78448e519fe0", "score": "0.6973957", "text": "func WriteFile(filepath string, b []byte) error {\n\treturn ioutil.WriteFile(filepath, b, 0660)\n}", "title": "" }, { "docid": "c12c088ea6ed51a2bd80cc31b17f66ca", "score": "0.6940629", "text": "func (o *DefaultOS) IOUtilWriteFile(filename string, data []byte, perm os.FileMode) error {\r\n\treturn ioutil.WriteFile(filename, data, perm)\r\n}", "title": "" }, { "docid": "f902c3ce2642a834aa7df28baa837342", "score": "0.6928506", "text": "func WriteFile(filename string, data []byte, perm fs.FileMode) error {\n\treturn os.WriteFile(filename, data, perm)\n}", "title": "" }, { "docid": "de2bd9fc7c3c66d888e257c21bd2cb31", "score": "0.68478584", "text": "func (s *FileScope) IOUtilWriteFile(filename string, data []byte, perm os.FileMode) error {\r\n\tif s.verbose {\r\n\t\tlog.Println(\"ioutil.WriteFile \", filename, \" data \", string(data), \" perm \", perm)\r\n\t}\r\n\r\n\tfilename, err := s.validate(filename, true)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn ioutil.WriteFile(filename, data, perm)\r\n}", "title": "" }, { "docid": "492821b8bcc8384e01f7999d23735f22", "score": "0.67998475", "text": "func write(t *testing.T, filename string, content []byte) {\n\terr := os.WriteFile(filename, content, 0600)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "7f94b5a6d61f0b4563a834f6ff9abc4d", "score": "0.6778713", "text": "func WriteFile(filename, content string) error {\n\tfmt.Printf(\"writing %q\\n\", filename)\n\terr := ioutil.WriteFile(filename, []byte(content), 0600)\n\treturn err\n}", "title": "" }, { "docid": "4eaa1e58e35bc150bf390bd64ae5b26c", "score": "0.67697877", "text": "func WriteFile(filePath string, data string) {\n\tioutil.WriteFile(filePath, []byte(data), 0666)\n}", "title": "" }, { "docid": "ae16d1c18db0dfe1de30b168ad06ac41", "score": "0.6748727", "text": "func WriteFile(filename string, data []byte) error {\n\tos.MkdirAll(filepath.Dir(filename), os.ModePerm)\n\treturn ioutil.WriteFile(filename, data, 0655)\n}", "title": "" }, { "docid": "ac4dce05c205382cd3da815835acae36", "score": "0.6743891", "text": "func (o *ReadOnlyOS) IOUtilWriteFile(filename string, data []byte, perm os.FileMode) error {\r\n\treturn ErrReadOnly\r\n}", "title": "" }, { "docid": "d2af6ee9fad5f04f1db8c4404d79c20e", "score": "0.6737186", "text": "func (path Path) WriteFile(data []byte, perm os.FileMode) error {\n\treturn os.WriteFile(string(path), data, perm)\n}", "title": "" }, { "docid": "1c500e156e64288c6aef12f63c1b93fd", "score": "0.67087203", "text": "func (d Driver) WriteFile(path string, buf []byte) error {\n\treturn ioutil.WriteFile(path, buf, DefaultPerm)\n}", "title": "" }, { "docid": "a0856bef7ebaae2e951fe22d3306feb2", "score": "0.6701997", "text": "func (c *fetchX509Command) writeFile(filename string, data []byte) error {\n\treturn ioutil.WriteFile(filename, data, 0644)\n}", "title": "" }, { "docid": "7ff2f12fd2cf3dfdcc413e4c77681491", "score": "0.66995436", "text": "func (f FetchCLI) writeFile(filename string, data []byte) error {\n\tp := path.Join(f.config.writePath, filename)\n\treturn ioutil.WriteFile(p, data, os.ModePerm)\n}", "title": "" }, { "docid": "fcea97dae42effe59c708ca22606e1f1", "score": "0.6674886", "text": "func (s *Scamper) WriteFile(uuid string, t time.Time, data []byte) error {\n\tfilename, err := generateFilename(s.outputPath, uuid, t)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn os.WriteFile(filename, data, 0644)\n}", "title": "" }, { "docid": "49d58b7a5a80faf326ffa12d202d356d", "score": "0.66626203", "text": "func (fs *FS) SWriteFile(path, contents string) {\n\tfs.WriteFile(path, []byte(contents))\n}", "title": "" }, { "docid": "1820b70b7d510e68ed67ef3d02e6c453", "score": "0.6649937", "text": "func (inv *Invasion)WriteFile(outFile string) {\n\tvar output = \"\";\n\tfor k, v := range inv.cityMap {\n\t\toutput += k + \" \";\n\t\tfor dir, cityTo := range v.roads {\n\t\t\toutput += dir + \"=\" + cityTo + \" \";\n\t\t}\n\t\toutput += \"\\n\";\n\t}\n\n //f, err := os.OpenFile(\"myfile.data\", os.O_APPEND|os.O_WRONLY, 0600)\n f, err := os.Create(outFile)\n defer f.Close()\n if err != nil {\n \tlogger.Println(\"Error opening output file\", err);\n panic(err)\n }\n\n if _, err = f.WriteString(output); err != nil {\n \tlogger.Println(\"Error writing to output file\", err);\n panic(err)\n }\n}", "title": "" }, { "docid": "4e5084b85853df6ad7fe56561c3daff3", "score": "0.6627526", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\terr := os.WriteFile(filename, data, perm)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to write file %q\", filename)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2a444e69a91a9bd51ca506044e8f7cd9", "score": "0.66093725", "text": "func writeFile(path string, c []byte) error {\n\tos.MkdirAll(filepath.Dir(path), 0755)\n\treturn ioutil.WriteFile(path, c, 0644)\n}", "title": "" }, { "docid": "4eb22eed0243aef8dad2dcf4b6b9bcb2", "score": "0.66077316", "text": "func (lines *Buffer) WriteFile(filepath string) error {\n\t// # TODO: add a twin method that uses fs.FS\n\tf, err := os.OpenFile(filepath, os.O_CREATE|os.O_EXCL|os.O_WRONLY, fs.FileMode(0644))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\t_, err = f.Write(lines.buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlines.buf.Truncate(0)\n\n\treturn err\n}", "title": "" }, { "docid": "61af0ee9430c06b122f70b92513a1b7b", "score": "0.6602915", "text": "func WriteFile(filespec string, contents []byte, perms os.FileMode) error {\n\treturn ioutil.WriteFile(filespec, contents, perms)\n}", "title": "" }, { "docid": "2aaf504c2ce0b6c5f082ebfa0a195bdd", "score": "0.659756", "text": "func (w *Writer) WriteFile(filename string, data []byte) error {\n\treturn ioutil.WriteFile(filename, data, 0666)\n}", "title": "" }, { "docid": "fadd92836a6a6680bfe5637c093d2cc3", "score": "0.6589118", "text": "func WriteFile(file string, data []byte) error {\n\treturn ioutil.WriteFile(file, data, 0644)\n}", "title": "" }, { "docid": "08ee060c02de094c1333b6e66e385f85", "score": "0.6585285", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tif err := os.WriteFile(filename, data, perm); err != nil {\n\t\treturn errors.Wrapf(maybeUnwrap(err), \"error writing %s\", filename)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f670539bce1d1e86464266ac069a8c99", "score": "0.6579978", "text": "func Test_Write_File(t *testing.T) {\n\t// Open File for Writing\n\tfile, err := os.Create(tmpRoot + \"hello.txt\")\n\tif err != nil {\n\t\tt.Error(\"Can't open file: \", err)\n\t}\n\tdefer file.Close()\n\n\t// Write File\n\tbytes := []byte(\"Hello 😀\")\n\tcount, err2 := file.Write(bytes) // WriteString() also available\n\tif err2 != nil {\n\t\tt.Error(\"Can't write to file: \", err2)\n\t}\n\n\t// Flush changes!\n\tfile.Sync()\n\n\t// Assertions\n\tassert.Equal(t, 10, count) // bytes written!\n}", "title": "" }, { "docid": "cfbc591775e7810dfc9196769e720e5b", "score": "0.6579899", "text": "func WriteFile(fs afero.Fs, path string, perm os.FileMode) error {\n\treturn Default.WriteFile(fs, path, perm)\n}", "title": "" }, { "docid": "e948565a7d6fb967f3bf5d0bafdafbf7", "score": "0.6568693", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := Create(filename, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tn, err := f.Write(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t\treturn err\n\t}\n\treturn f.Commit()\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2a4a09796e5b9fd88ddd8cbf83700e39", "score": "0.6555325", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "126aca5b4da681d964042a9858d4d51c", "score": "0.65468585", "text": "func (d *Directory) WriteFile(conversationID int64, b []byte) error {\n\tfilePath := d.getPath(conversationID)\n\tif _, err := os.Stat(filePath); err != nil {\n\t\treturn err\n\t}\n\n\terr := ioutil.WriteFile(filePath, b, 0)\n\treturn err\n}", "title": "" }, { "docid": "5b00c25e819e71636307f80f4e0fefcd", "score": "0.65352184", "text": "func (f APIFetch) writeFile(filename string, data []byte) error {\n\tp := path.Join(f.config.writePath, filename)\n\treturn ioutil.WriteFile(p, data, os.ModePerm)\n}", "title": "" }, { "docid": "d7677f87f490aec99b0178d155b2568f", "score": "0.652676", "text": "func (c *command) writeFile() {\n\tpath, err := c.readString()\n\tif err != nil {\n\t\tlog.Fatalf(\"ERROR: Couldn't read string from buffer. %v\", err)\n\t}\n\tpath = fsUtil.DenormalizePath(path)\n\n\tbLenght, err := c.readInt64()\n\tif err != nil {\n\t\tlog.Fatalf(\"ERROR: Couldn't read int32 from buffer. %v\", err)\n\t}\n\n\tbuffer := make([]byte, bLenght)\n\t_, err = c.usb.Read(buffer)\n\tif err != nil {\n\t\tlog.Fatalf(\"ERROR: Couldn't read directly from buffer. %v\", err)\n\t}\n\n\tif fileWriter != nil {\n\t\t_, err := fileWriter.Write(buffer)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"ERROR: Couldn't write %v to disk. %v\", path, err)\n\t\t\tc.respondFailure(0xDEAD)\n\t\t\treturn\n\t\t}\n\t\tc.respondEmpty()\n\t\treturn\n\t}\n\terr = os.WriteFile(path, buffer, os.ModeAppend)\n\tif err != nil {\n\t\tc.respondFailure(0xDEAD)\n\t\treturn\n\t}\n\tc.respondEmpty()\n}", "title": "" }, { "docid": "c18e9c068d6fb65cf6433e90d6082b82", "score": "0.6496969", "text": "func WriteFile(filePath string, data string) error {\n\treturn ioutil.WriteFile(filePath, []byte(data), os.ModePerm)\n}", "title": "" }, { "docid": "8ff3a62059548765f55951a3d99e35ba", "score": "0.649599", "text": "func WriteFile(filename, contents string) (string, error) {\n\tfullFilePath := filepath.Join(Path(), filename)\n\n\terr := os.WriteFile(fullFilePath, []byte(contents), 0644)\n\tif err != nil {\n\t\treturn fullFilePath, err\n\t}\n\treturn fullFilePath, nil\n}", "title": "" }, { "docid": "f52f7f80f96b77e37365ed339d3fc484", "score": "0.6494593", "text": "func WriteFile(fileName string, data []byte) error {\n\terr := os.MkdirAll(path.Dir(fileName), os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn os.WriteFile(fileName, data, 0655)\n}", "title": "" }, { "docid": "ae7f4325a02011c9d3e15515d4c434c3", "score": "0.64916897", "text": "func (f *GoFile) WriteFile(path string) error {\n\tfile, err := os.OpenFile(path, os.O_CREATE|os.O_RDWR, 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn f.Fprint(file)\n}", "title": "" }, { "docid": "cfed4a059cd47e787a9d9adab070f5f4", "score": "0.64900696", "text": "func WriteFile(t *testing.T, file string, content string, perm os.FileMode) {\n\terr := ioutil.WriteFile(file, []byte(content), perm)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to write file %s. Reason: %s\", file, err)\n\t}\n}", "title": "" }, { "docid": "fdcdb4d2a11c97a92ce242ccbe1f06e3", "score": "0.6489218", "text": "func renderWriteFile(filePath string, fileLoc string, fileTmpl string, info tmplData) error {\n\tbuf := &bytes.Buffer{}\n\n\tif err := renderFile(buf, fileLoc, fileTmpl, info); err != nil {\n\t\treturn err\n\t}\n\n\tif err := writeFileAndPrint(filePath, buf.Bytes(), defaultFileMode); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b3c629f290376acab2c62ea92e5d1881", "score": "0.64822006", "text": "func (fs *FileSystemService) WriteFile(ctx context.Context, req *baserpc.WriteFileRequest) (*baserpc.WriteFileResponse, error) {\n\tvar res baserpc.WriteFileResponse\n\tres.Error = encodeErr(func() error {\n\t\tif err := ioutil.WriteFile(req.Name, req.Content, os.FileMode(req.Mode)); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}())\n\treturn &res, nil\n}", "title": "" }, { "docid": "aaf13524084fbfafa705d0b4928417f0", "score": "0.64764374", "text": "func WriteToFile(filename string, data string) error {\n\tfile, err := os.Create(filename)\n\tCheck(err)\n\tdefer file.Close()\n\t_, err = io.WriteString(file, data)\n\tCheck(err)\n\treturn file.Sync()\n}", "title": "" }, { "docid": "a3aefd566d8592d8eda5a7c8c104c34b", "score": "0.64748245", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tif command.IsForce() {\n\t\treturn ioutil.WriteFile(filename, data, perm)\n\t}\n\n\tst, err := os.Stat(filename)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn ioutil.WriteFile(filename, data, perm)\n\t\t}\n\t\treturn errors.Wrapf(err, \"error reading information for %s\", filename)\n\t}\n\n\tif st.IsDir() {\n\t\treturn ErrIsDir\n\t}\n\n\tstr, err := ui.Prompt(fmt.Sprintf(\"Would you like to overwrite %s [y/n]\", filename), ui.WithValidateYesNo())\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch strings.ToLower(strings.TrimSpace(str)) {\n\tcase \"y\", \"yes\":\n\tcase \"n\", \"no\":\n\t\treturn ErrFileExists\n\t}\n\n\treturn ioutil.WriteFile(filename, data, perm)\n}", "title": "" }, { "docid": "954763f70eeb9a36776b4fd4e09fd7c1", "score": "0.6460947", "text": "func WriteFile(path, msg string, flag int, perm os.FileMode) error {\n\tf, err := os.OpenFile(path, flag, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tif _, err = f.Write([]byte(msg)); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c74268014cc160e3a0ce49b4264c986e", "score": "0.6456506", "text": "func (p *Pebble) WriteFile(filename string, data []byte) error {\n\tfile, err := p.fs.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\t_, err = io.Copy(file, bytes.NewReader(data))\n\treturn err\n}", "title": "" }, { "docid": "20e7a7933f2958f7a40c7248dc5b720f", "score": "0.6447447", "text": "func WriteFile(dir string, name string, text string) error {\n\terr := os.MkdirAll(dir, 0775)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(filepath.Join(dir, name), []byte(text), 0644)\n}", "title": "" }, { "docid": "7a7fe03d72aaaad97e0bc5ab8c955c73", "score": "0.6442542", "text": "func WriteFile(filePath string, data any, perm os.FileMode, fileFlag ...int) error {\n\tflag := basefn.FirstOr(fileFlag, FsCWTFlags)\n\tf, err := OpenFile(filePath, flag, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = WriteOSFile(f, data)\n\treturn err\n}", "title": "" }, { "docid": "4994829c08594033587d4a6472741a8b", "score": "0.6437449", "text": "func WriteFile(filename string, data string, perm os.FileMode, wrapper int) error {\n\tf, err := os.OpenFile(filename, wrapper, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.WriteString(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "6f46a6c95a691c89d04b7602840b866e", "score": "0.6430318", "text": "func Write(file string, data []byte) error {\n\terr := ioutil.WriteFile(file, data, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f35c761d32176782f16d6b718d83ee97", "score": "0.6425069", "text": "func WriteFile(path string, context string) {\n\ttrueOrfalse := IsExist(path)\n\tif trueOrfalse {\n\t\tfile := doWrite(path, context)\n\t\tdefer file.Close()\n\t} else {\n\t\tfile, errorCreate := os.Create(path)\n\t\tif errorCreate != nil {\n\t\t\treturn\n\t\t}\n\t\t// 查找文件末尾的偏移量\n\t\t// 从末尾的偏移量开始写入内容\n\t\t//n, _ := file.Seek(0, os.SEEK_END)\n\t\t//_, _ = file.WriteAt([]byte(context), n)\n\t\tdoWrite(path, context)\n\t\tdefer file.Close()\n\t}\n}", "title": "" }, { "docid": "309b43852a7b13f04e8552e4821dc0e9", "score": "0.64239097", "text": "func SafeWriteFile(filename string, fileContent []byte) error {\n\tif _, err := os.Stat(filename); os.IsNotExist(err) {\n\t\terr := ioutil.WriteFile(filename, fileContent, 0777)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tfmt.Printf(\"file %s already exists\\n\", filename)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e3dc940087cae19b6954ecb33f5aaf29", "score": "0.6422856", "text": "func WriteFile(dir, file, data string) error {\n\tfd, err := OpenFile(dir, file, unix.O_WRONLY)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fd.Close()\n\tif err := retryingWriteFile(fd, data); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to write %q\", data)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9aa2fa658b963bc7de40aa93e44dc25d", "score": "0.6422802", "text": "func writeFile(path, text string) {\n\tfile, err := os.Create(path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\n\tfile.WriteString(text)\n}", "title": "" }, { "docid": "b1391e6e90d0e64c7035154afdb68f69", "score": "0.6417659", "text": "func Write(fileName, writeStr string) error {\n\terr := os.MkdirAll(path.Dir(fileName), os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfout, err := os.Create(fileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fout.Close()\n\n\t_, err = fout.WriteString(writeStr)\n\treturn err\n}", "title": "" }, { "docid": "d8c46e5dc6225d2e8ad50ba7ccc60ed4", "score": "0.6414445", "text": "func (r *renderer) WriteFile(file string, content string) (string, error) {\n\troot, err := r.root()\n\tif err != nil {\n\t\treturn file, err\n\t}\n\tabsPath, err := files.ToAbsPath(file, root)\n\tif err != nil {\n\t\treturn file, err\n\t}\n\terr = os.MkdirAll(filepath.Dir(absPath), 0755)\n\tif err != nil {\n\t\treturn file, err\n\t}\n\treturn file, ioutil.WriteFile(absPath, []byte(content), 0644)\n}", "title": "" }, { "docid": "12eb1da487ddc1c7aab91eaa9975fbfd", "score": "0.64032865", "text": "func (h *CmdHelper) WriteFile(ctx context.Context, filename string, data []byte) error {\n\t// Because we may pass NULL('\\0') byte in data, using base64 to encode the data could resolve the escape character issue.\n\t// Using \"echo\" or \"printf\" would require a complex escaping rule to let it work correctly.\n\tb64String := base64.StdEncoding.EncodeToString(data)\n\techoStrCmd := fmt.Sprintf(\"echo %s\", shutil.Escape(b64String))\n\tb64DecCmd := fmt.Sprintf(\"base64 -d > %s\", shutil.Escape(filename))\n\tcmd := fmt.Sprintf(\"%s | %s\", echoStrCmd, b64DecCmd)\n\tif _, err := h.cmdRunner.Run(ctx, \"sh\", \"-c\", cmd); err != nil {\n\t\treturn errors.Wrap(err, \"failed to echo string\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "714d9b1c965bad9813455734f0571c80", "score": "0.64013535", "text": "func writeFile(file string, content string) {\n\terr := os.WriteFile(file, []byte(content), 0644)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "8acdc720dc854a2deefae729f533cd92", "score": "0.6397841", "text": "func (fileAccessor LocalStorage) WriteFile(filename string, data []byte, perm os.FileMode) error {\n\treturn ioutil.WriteFile(filename, data, perm)\n}", "title": "" }, { "docid": "9691d6630ef70d295bf1e2a35f63890d", "score": "0.639714", "text": "func WriteToFile(filename string, data string) error {\n\tfile, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\t_, err = io.WriteString(file, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn file.Sync()\n}", "title": "" }, { "docid": "9691d6630ef70d295bf1e2a35f63890d", "score": "0.639714", "text": "func WriteToFile(filename string, data string) error {\n\tfile, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\t_, err = io.WriteString(file, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn file.Sync()\n}", "title": "" }, { "docid": "c8da84630edb94f158e9b08b4c235aac", "score": "0.63900054", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "531b67b1ed6c2222a112b016104f1ab5", "score": "0.6389152", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n f, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n if err != nil {\n return err\n }\n n, err := f.Write(data)\n if err == nil && n < len(data) {\n err = io.ErrShortWrite\n }\n if err1 := f.Close(); err == nil {\n err = err1\n }\n return err\n}", "title": "" }, { "docid": "531b67b1ed6c2222a112b016104f1ab5", "score": "0.6389152", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n f, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n if err != nil {\n return err\n }\n n, err := f.Write(data)\n if err == nil && n < len(data) {\n err = io.ErrShortWrite\n }\n if err1 := f.Close(); err == nil {\n err = err1\n }\n return err\n}", "title": "" }, { "docid": "65e00407bf351ebe96820e8cbc076847", "score": "0.6379735", "text": "func WriteFile(content []byte, file string) error {\n\tdst := filepath.Join(env.Config().GetString(\"WorkDir\"), file)\n\tos.MkdirAll(path.Dir(dst), 0750)\n\treturn ioutil.WriteFile(dst, content, 0640)\n}", "title": "" }, { "docid": "c6c774c275a9a5093d867f53788f5b52", "score": "0.6377817", "text": "func WriteFile(fileName, directory string, content []byte) error {\n\tif _, err := os.Stat(directory); os.IsNotExist(err) {\n\t\terr := os.MkdirAll(directory, os.ModePerm)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tlog.Infof(\"Writing %s in %s\", fileName, directory)\n\terr := ioutil.WriteFile(filepath.Join(directory, fileName), content, DefaultPermission)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "102ed8215f0e1bffeeebf57e39586516", "score": "0.63769156", "text": "func WriteFile(data string, file string) {\n\tbyteData := []byte(data)\n\terr := ioutil.WriteFile(file, byteData, 0644)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tlog.Println(\"Operation successful. File : \", file)\n}", "title": "" }, { "docid": "e41fd3b0fa6e078355acc637a2aadffb", "score": "0.63718367", "text": "func (fs *FileSystem) WriteFile(ctx context.Context, op *fuseops.WriteFileOp) error {\n\tw := fs.writer(op.Handle)\n\t_, err := w.WriteAt(op.Data, op.Offset)\n\treturn err\n}", "title": "" }, { "docid": "0c042f078b624761e76c3cb0f5c436c6", "score": "0.6362426", "text": "func WriteFile(name string, contents interface{}) error {\n\tvar c []byte\n\n\tswitch contents.(type) {\n\tdefault:\n\t\treturn errors.New(\"unexpected type when writing a file\")\n\tcase string:\n\t\tc = []byte(contents.(string))\n\tcase []byte:\n\t\tc = []byte(contents.([]byte))\n\t}\n\n\treturn ioutil.WriteFile(name, c, 0755)\n}", "title": "" }, { "docid": "91231046a0a201733c397ccb9c96cbb0", "score": "0.63548607", "text": "func (c Linux) WriteFile(h Host, path string, data string, permissions string) error {\n\tif data == \"\" {\n\t\treturn fmt.Errorf(\"empty content in WriteFile to %s\", path)\n\t}\n\n\tif path == \"\" {\n\t\treturn fmt.Errorf(\"empty path in WriteFile\")\n\t}\n\n\ttempFile, err := h.ExecOutput(\"mktemp 2> /dev/null\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := h.Execf(`cat > %s`, tempFile, exec.Stdin(data), exec.RedactString(data)); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.InstallFile(h, tempFile, path, permissions); err != nil {\n\t\t_ = c.DeleteFile(h, tempFile)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6daaa7d4855309f21e7acdc95b675977", "score": "0.63537437", "text": "func WriteFile(name string, data []byte, perm os.FileMode) error {\n\tf, err := os.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err = f.Write(data); err == nil {\n\t\terr = f.Sync()\n\t}\n\tif err1 := f.Close(); err1 != nil && err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f8e40a7ea1308f4095a036f709849a7e", "score": "0.635228", "text": "func WriteFile(path string, data []byte) error {\n\tf, err := os.Create(path)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer f.Close()\n\n\tn1, err := f.Write(data)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif n1 != len(data) {\n\t\treturn errors.New(\"Could not write all data\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "189acadf30671bbdb75af838c0532857", "score": "0.6346783", "text": "func writeFile(fn string, s string) {\n\tb := []byte(s)\n\terr := ioutil.WriteFile(fn, b, 0600)\n\tif err != nil {\n\t\tpanic(\"Error creating file: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "7bd2e2aa27d914403d54c80829b3444d", "score": "0.6343072", "text": "func writeFile(path string, content string) error {\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\t_, err = f.WriteString(content)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b62fb847a7f7206544a2291d7ab69856", "score": "0.63363546", "text": "func writeFile(fileName string, data string) {\r\n\tf, openerr := os.Create(fileName)\r\n\r\n\tif openerr != nil {\r\n\t\tlog.Fatal(openerr)\r\n\t}\r\n\r\n\tdefer f.Close()\r\n\r\n\t_, err2 := f.WriteString(data)\r\n\r\n\tif err2 != nil {\r\n\t\tlog.Fatal(err2)\r\n\t}\r\n\r\n\tfmt.Println(\"Writing file:\", fileName)\r\n}", "title": "" }, { "docid": "d948821551f2161e7f7c4b6413373891", "score": "0.6335286", "text": "func writeFile(t *testing.T, baseDir, path, contents string) {\n\tt.Helper()\n\tpath = filepath.FromSlash(path)\n\tfullPath := filepath.Join(baseDir, path)\n\terr := os.MkdirAll(filepath.Dir(fullPath), 0755)\n\tif err != nil {\n\t\tt.Fatal(\"Failed to create file's base directory:\", err)\n\t}\n\terr = os.WriteFile(fullPath, []byte(contents), 0600)\n\tif err != nil {\n\t\tt.Fatal(\"Failed to create file:\", err)\n\t}\n}", "title": "" }, { "docid": "c7e72b0ad093232c112f8b14a26d4827", "score": "0.63320565", "text": "func Write(file string, data []byte) error {\n\tbasePath := filepath.Dir(file)\n\tif !Exists(basePath) {\n\t\tif err := os.MkdirAll(basePath, DefaultPermissionOctal); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn os.WriteFile(file, data, DefaultPermissionOctal)\n}", "title": "" }, { "docid": "b141036a74d58e794063c6498bfd20cd", "score": "0.63311493", "text": "func (t EmptyFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error) {\n\treturn len(bs), nil\n}", "title": "" }, { "docid": "82d3e4bef1c1a5b244902fc70de1bb22", "score": "0.63307625", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\tspec := PathMutexSpec(filename)\n\tklog.Infof(\"WriteFile acquiring %s: %+v\", filename, spec)\n\treleaser, err := mutex.Acquire(spec)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to acquire lock for %s: %+v\", filename, spec)\n\t}\n\n\tdefer releaser.Release()\n\n\treturn os.WriteFile(filename, data, perm)\n}", "title": "" }, { "docid": "bbb85dd343d5ae1c9c14f78ba5d9540c", "score": "0.6329966", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n\ttemp := fmt.Sprintf(\"%s.%s\", filename, RandomBase64String(8))\n\n\t// write to a unique temp file first before performing an atomic move to the actual file name\n\t// this prevents a race condition between multiple CLIs reading/writing the same file\n\tLogDebug(fmt.Sprintf(\"Writing to temp file %s\", temp))\n\tif err := ioutil.WriteFile(temp, data, os.FileMode(perm)); err != nil {\n\t\treturn err\n\t}\n\n\tLogDebug(fmt.Sprintf(\"Renaming temp file to %s\", filename))\n\tif err := os.Rename(temp, filename); err != nil {\n\t\t// clean up temp file\n\t\t_ = os.Remove(temp)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "32cba3fc8f986483e9826ca1a70420da", "score": "0.6327216", "text": "func WriteFile(fname, text string) (err error) {\n\tds, _ := filepath.Split(fname)\n\tif ds != \"\" && !FileExists(ds) {\n\t\terr = os.MkdirAll(ds, 0755)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn ioutil.WriteFile(fname, []byte(text), 0644)\n}", "title": "" } ]
adf468d6e193cc095ac840fd6db6085a
PeerInfoSnapshot returns a snapshot of information of a peer with given id. If the peer is not known to the Manager, result is nil.
[ { "docid": "31c2f92f7304f34a0114b481bee46f79", "score": "0.72481775", "text": "func (m *Manager) PeerInfoSnapshot(id peer.ID) *PeerInfoSnapshot {\n\tvar info *PeerInfoSnapshot\n\tm.Call(id, func(p *Peer) {\n\t\tinfo = p.InfoSnapshot()\n\t\tinfo.Connected = m.host.Network().Connectedness(p.ID) == network.Connected\n\t})\n\treturn info\n}", "title": "" } ]
[ { "docid": "dbba3c6026c3d794be0a74cf21aa04bc", "score": "0.591034", "text": "func (api *PublicRelayAPI) GetPeerInfo(verbose *bool, network *string) (interface{}, error) {\n\tvb := false\n\tif verbose != nil {\n\t\tvb = *verbose\n\t}\n\tnetworkName := \"\"\n\tif network != nil {\n\t\tnetworkName = *network\n\t}\n\tif len(networkName) <= 0 {\n\t\tnetworkName = params.ActiveNetParams.Name\n\t}\n\tpeers := api.node.peerStatus.StatsSnapshots()\n\tinfos := make([]*json.GetPeerInfoResult, 0, len(peers))\n\tfor _, p := range peers {\n\n\t\tif len(networkName) != 0 && networkName != \"all\" {\n\t\t\tif p.Network != networkName {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif !vb {\n\t\t\tif !p.State.IsConnected() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tinfo := &json.GetPeerInfoResult{\n\t\t\tID: p.PeerID,\n\t\t\tName: p.Name,\n\t\t\tAddress: p.Address,\n\t\t\tBytesSent: p.BytesSent,\n\t\t\tBytesRecv: p.BytesRecv,\n\t\t}\n\t\tinfo.Protocol = p.Protocol\n\t\tinfo.Services = p.Services.String()\n\t\tif p.Genesis != nil {\n\t\t\tinfo.Genesis = p.Genesis.String()\n\t\t}\n\t\tif p.IsTheSameNetwork() {\n\t\t\tinfo.State = p.State.String()\n\t\t}\n\t\tif len(p.Version) > 0 {\n\t\t\tinfo.Version = p.Version\n\t\t}\n\t\tif len(p.Network) > 0 {\n\t\t\tinfo.Network = p.Network\n\t\t}\n\n\t\tif p.State.IsConnected() {\n\t\t\tinfo.TimeOffset = p.TimeOffset\n\t\t\tif p.Genesis != nil {\n\t\t\t\tinfo.Genesis = p.Genesis.String()\n\t\t\t}\n\t\t\tinfo.Direction = p.Direction.String()\n\t\t\tif p.GraphState != nil {\n\t\t\t\tinfo.GraphState = node.GetGraphStateResult(p.GraphState)\n\t\t\t}\n\t\t\tinfo.ConnTime = p.ConnTime.Truncate(time.Second).String()\n\n\t\t\tinfo.GSUpdate = p.GraphStateDur.Truncate(time.Second).String()\n\t\t}\n\t\tif !p.LastSend.IsZero() {\n\t\t\tinfo.LastSend = p.LastSend.String()\n\t\t}\n\t\tif !p.LastRecv.IsZero() {\n\t\t\tinfo.LastRecv = p.LastRecv.String()\n\t\t}\n\t\tif len(p.QNR) > 0 {\n\t\t\tinfo.QNR = p.QNR\n\t\t}\n\t\tinfos = append(infos, info)\n\t}\n\treturn infos, nil\n}", "title": "" }, { "docid": "22f88ff57e24168a8d42c8d00e5ab895", "score": "0.5806971", "text": "func (h *qlightServerHandler) PeerInfo(id enode.ID) interface{} {\n\tif p := h.peers.peer(id.String()); p != nil {\n\t\treturn p.info()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d2d0801f5ef7b8e2c9b12aff976b7a8", "score": "0.57172596", "text": "func (m *Manager) PeerInfoSnapshots() []*PeerInfoSnapshot {\n\tinfos := make([]*PeerInfoSnapshot, 0)\n\tm.ForEach(func(p *Peer) bool {\n\t\tinfo := p.InfoSnapshot()\n\t\tinfo.Connected = m.host.Network().Connectedness(p.ID) == network.Connected\n\t\tinfos = append(infos, info)\n\t\treturn true\n\t})\n\treturn infos\n}", "title": "" }, { "docid": "a2810637ff9c31e2438444c807d56a8e", "score": "0.53018737", "text": "func (in *PeerInfo) DeepCopy() *PeerInfo {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PeerInfo)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "38e66bb779ab9dea47713f2cafee8649", "score": "0.50829", "text": "func (o GetImageCachesResultOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GetImageCachesResult) *string { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c83a4c63a152b01d410f533c4c8c489b", "score": "0.50435126", "text": "func (c *Client) GetPrinterSnapshot(id string) (*[]byte, error) {\n\treq, err := http.NewRequest(\"GET\", c.url(fmt.Sprintf(\"/api/v1/printers/%s/snapshot.jpg?%d\", id, time.Now().Unix())), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := c.http.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tdata, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &data, nil\n}", "title": "" }, { "docid": "cd5b1344bc6ac859bd50a554e77bc125", "score": "0.504271", "text": "func (p *peer) Info() *PeerInfo {\n\thash, seqId := p.Head()\n\n\treturn &PeerInfo{\n\t\tVersion: p.version,\n\t\tHead: hash.Hex(),\n\t\tSequencerId: seqId,\n\t\tShortId: p.id,\n\t\tLink: p.outPath,\n\t\tAddrs: p.RemoteAddr().String(),\n\t\tInBound: p.inBound,\n\t}\n}", "title": "" }, { "docid": "b3d8a53eaa9297180287a749317d3171", "score": "0.49478465", "text": "func (v *DeviceMapperVolume) SnapshotInfo(label string) (*volume.SnapshotInfo, error) {\n\tif v.isInvalidSnapshot(label) {\n\t\treturn nil, volume.ErrInvalidSnapshot\n\t}\n\treader, err := v.ReadMetadata(label, \".SNAPSHOTINFO\")\n\tif err != nil {\n\t\tglog.Errorf(\"Could not get info for snapshot %s: %s\", label, err)\n\t\treturn nil, err\n\t}\n\tdefer reader.Close()\n\tdecoder := json.NewDecoder(reader)\n\tvar info volume.SnapshotInfo\n\tif err := decoder.Decode(&info); err != nil {\n\t\tglog.Errorf(\"Could not decode snapshot info for %s: %s\", label, err)\n\t\treturn nil, err\n\t}\n\treturn &info, err\n}", "title": "" }, { "docid": "aa5c6a17e307a504d4d1b15cb70c26c9", "score": "0.4943234", "text": "func (s *EventDrivenServer) GetPeer(id int) Peer {\n\tif p, ok := s.peers[id]; ok {\n\t\treturn p\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e71e965277305b5c5e302e08de13d46", "score": "0.49189767", "text": "func (o GetDisksResultOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GetDisksResult) *string { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6c532099672fd67643f811d92614b0a6", "score": "0.4907102", "text": "func (d *driver) SnapshotInspect(\n\tctx types.Context,\n\tsnapshotID string,\n\topts types.Store) (*types.Snapshot, error) {\n\t// TODO Snapshots are not implemented yet\n\treturn nil, types.ErrNotImplemented\n}", "title": "" }, { "docid": "e46798c06a90c3e84e8428ea8a180468", "score": "0.49069816", "text": "func (n *Node) PeerInfo() []*btcjson.GetPeerInfoResult {\n\treplyChan := make(chan []*btcjson.GetPeerInfoResult)\n\n\tn.query <- getPeerInfoMsg{reply: replyChan}\n\n\treturn <-replyChan\n}", "title": "" }, { "docid": "a1856b3e91fa9e7d6cc4cb088e3199e1", "score": "0.48732454", "text": "func (o LookupShareResultOutput) SnapshotId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupShareResult) string { return v.SnapshotId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0554438c1241c038589ecb0319a5595e", "score": "0.48670802", "text": "func (p *peer) Info() *PeerInfo {\n\treturn &PeerInfo{\n\t\tVersion: p.version,\n\t\tEpoch: p.progress.Epoch,\n\t\tNumOfBlocks: p.progress.NumOfBlocks,\n\t}\n}", "title": "" }, { "docid": "764739e3d3ce575725eabd8721391a4d", "score": "0.4841403", "text": "func (ps *peerSet) Peer(id string) *peer {\n\tps.lock.RLock()\n\tdefer ps.lock.RUnlock()\n\n\treturn ps.peers[id]\n}", "title": "" }, { "docid": "764739e3d3ce575725eabd8721391a4d", "score": "0.4841403", "text": "func (ps *peerSet) Peer(id string) *peer {\n\tps.lock.RLock()\n\tdefer ps.lock.RUnlock()\n\n\treturn ps.peers[id]\n}", "title": "" }, { "docid": "764739e3d3ce575725eabd8721391a4d", "score": "0.4841403", "text": "func (ps *peerSet) Peer(id string) *peer {\n\tps.lock.RLock()\n\tdefer ps.lock.RUnlock()\n\n\treturn ps.peers[id]\n}", "title": "" }, { "docid": "d87b1f85e41d441de3bb39f8e221ecb2", "score": "0.48399928", "text": "func (p *peer) Info() *PeerInfo {\n\thash, td := p.Head()\n\n\treturn &PeerInfo{\n\t\tVersion: p.version,\n\t\tDifficulty: td,\n\t\tHead: hash.Hex(),\n\t}\n}", "title": "" }, { "docid": "2939744c59c628c199b35695765e45f9", "score": "0.48386502", "text": "func GetSnapshot(id string, name string) (*xmsv3.Snapshot, error) {\n\tinitiator, err := xms.GetSnapshot(id, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn initiator.Content, nil\n}", "title": "" }, { "docid": "130e0527b64a644d70d587ecc87a440c", "score": "0.48188385", "text": "func (v *DeviceMapperVolume) SnapshotInfo(label string) (*volume.SnapshotInfo, error) {\n\treader, err := v.ReadMetadata(label, \".SNAPSHOTINFO\")\n\tif err != nil {\n\t\tglog.Errorf(\"Could not get info for snapshot %s: %s\", label, err)\n\t\treturn nil, err\n\t}\n\tdefer reader.Close()\n\tdecoder := json.NewDecoder(reader)\n\tvar info volume.SnapshotInfo\n\tif err := decoder.Decode(&info); err != nil {\n\t\tglog.Errorf(\"Could not decode snapshot info for %s: %s\", label, err)\n\t\treturn nil, err\n\t}\n\treturn &info, err\n}", "title": "" }, { "docid": "ec776ee3163004582e2859e40ecf9649", "score": "0.48174486", "text": "func (d *peerMsgHandler) checkSnapshot(msg *rspb.RaftMessage) (*snap.SnapKey, error) {\n\tif msg.Message.Snapshot == nil {\n\t\treturn nil, nil\n\t}\n\tregionID := msg.RegionId\n\tsnapshot := msg.Message.Snapshot\n\tkey := snap.SnapKeyFromRegionSnap(regionID, snapshot)\n\tsnapData := new(rspb.RaftSnapshotData)\n\terr := snapData.Unmarshal(snapshot.Data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsnapRegion := snapData.Region\n\tpeerID := msg.ToPeer.Id\n\tvar contains bool\n\tfor _, peer := range snapRegion.Peers {\n\t\tif peer.Id == peerID {\n\t\t\tcontains = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !contains {\n\t\tlog.Infof(\"%s %s doesn't contains peer %d, skip\", d.Tag, snapRegion, peerID)\n\t\treturn &key, nil\n\t}\n\tmeta := d.ctx.storeMeta\n\tmeta.Lock()\n\tdefer meta.Unlock()\n\tif !util.RegionEqual(meta.regions[d.regionId], d.Region()) {\n\t\tif !d.isInitialized() {\n\t\t\tlog.Infof(\"%s stale delegate detected, skip\", d.Tag)\n\t\t\treturn &key, nil\n\t\t} else {\n\t\t\tpanic(fmt.Sprintf(\"%s meta corrupted %s != %s\", d.Tag, meta.regions[d.regionId], d.Region()))\n\t\t}\n\t}\n\n\texistRegions := meta.getOverlapRegions(snapRegion)\n\tfor _, existRegion := range existRegions {\n\t\tif existRegion.GetId() == snapRegion.GetId() {\n\t\t\tcontinue\n\t\t}\n\t\tlog.Infof(\"%s region overlapped %s %s\", d.Tag, existRegion, snapRegion)\n\t\treturn &key, nil\n\t}\n\n\t// check if snapshot file exists.\n\t_, err = d.ctx.snapMgr.GetSnapshotForApplying(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "4aa45ea7fce97a101086fc162275ef56", "score": "0.475859", "text": "func (o InstanceDataDiskOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InstanceDataDisk) *string { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2ec14f045fca1bf04d44ee845806861b", "score": "0.4749053", "text": "func (o GetSnapshotsSnapshotOutput) SnapshotId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetSnapshotsSnapshot) string { return v.SnapshotId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "754f7ca1575748c4ef639a0e14db398f", "score": "0.4748986", "text": "func (cli *Client) SnapshotInspect(ctx context.Context, snapshotID string) (types.Snapshot, error) {\n\tvar snapshot types.Snapshot\n\tresp, err := cli.get(ctx, \"/snapshots/\"+snapshotID, nil, nil)\n\tif err != nil {\n\t\tif resp.statusCode == http.StatusNotFound {\n\t\t\treturn snapshot, snapshotNotFoundError{snapshotID}\n\t\t}\n\t\treturn snapshot, err\n\t}\n\terr = json.NewDecoder(resp.body).Decode(&snapshot)\n\tensureReaderClosed(resp)\n\treturn snapshot, err\n}", "title": "" }, { "docid": "1c8d1310db62b585910abb9051529998", "score": "0.47461924", "text": "func (ps *peerSet) Peer(id string) *peerConnection {\n\tps.lock.RLock()\n\tdefer ps.lock.RUnlock()\n\n\treturn ps.peers[id]\n}", "title": "" }, { "docid": "26dadd76c3b7b3dc3598826377a0d47b", "score": "0.4742444", "text": "func (p *peer) Info() *eth.PeerInfo {\n\treturn &eth.PeerInfo{\n\t\tVersion: p.version,\n\t\tDifficulty: p.Td(),\n\t\tHead: fmt.Sprintf(\"%x\", p.Head()),\n\t}\n}", "title": "" }, { "docid": "bdc4bd3b72c4b5d0920b5f7692d79e86", "score": "0.47413677", "text": "func (apiPtr *apiPtr) GetSnapshot(number *rpcPtr.number) (*Snapshot, error) {\n\t// Retrieve the requested block number (or current if none requested)\n\tvar HeaderPtr *types.Header\n\tif number == nil || *number == rpcPtr.Latestnumber {\n\t\tHeader = apiPtr.chain.CurrentHeader()\n\t} else {\n\t\tHeader = apiPtr.chain.GetHeaderByNumber(Uint64(number.Int64()))\n\t}\n\t// Ensure we have an actually valid block and return its snapshot\n\tif Header == nil {\n\t\treturn nil, errUnknownBlock\n\t}\n\treturn apiPtr.clique.snapshot(apiPtr.chain, HeaderPtr.Number.Uint64(), HeaderPtr.Hash(), nil)\n}", "title": "" }, { "docid": "496412f50ff93f95549c3d295b915fcd", "score": "0.47289485", "text": "func (client *Client) GetPeerInfo() (Response, error) {\n\n\tmsg := client.Command(\n\t\t\"getpeerinfo\",\n\t\t[]interface{}{},\n\t)\n\n\treturn client.Post(msg)\n}", "title": "" }, { "docid": "534b496ab0027b5f3287d3429d8b1f82", "score": "0.47283635", "text": "func (store Store) GetPeerStat(pubkey *[ed25519.PublicKeySize]byte) *structs.PeerStruct {\n\tst, err := store.db.SelectPeer(pubkey)\n\tif err != nil {\n\t\tlog.Errorf(\"GetPeerStat: %s, %s\\n\", err, utils.B58encode(pubkey[:]))\n\t\treturn nil\n\t}\n\treturn st\n}", "title": "" }, { "docid": "40e22323e0ce8ae69bad0486b4da0381", "score": "0.47243187", "text": "func (o GetImageCachesCachOutput) SnapshotId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetImageCachesCach) string { return v.SnapshotId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "283a6ffff7c488e616110a058bd62652", "score": "0.47221693", "text": "func (bundle *peerBundle) knownPeer(ip, id string) (*knownPeer, []*peerEvent) {\n\tvar events []*peerEvent\n\tif _, ok := bundle.KnownPeers[id]; !ok {\n\t\tnow := time.Now()\n\t\tingress := emptyChartEntries(now, sampleLimit)\n\t\tegress := emptyChartEntries(now, sampleLimit)\n\t\tevents = append(events, &peerEvent{\n\t\t\tIP: ip,\n\t\t\tID: id,\n\t\t\tIngress: append([]*ChartEntry{}, ingress...),\n\t\t\tEgress: append([]*ChartEntry{}, egress...),\n\t\t})\n\t\tbundle.KnownPeers[id] = &knownPeer{\n\t\t\tip: ip,\n\t\t\tid: id,\n\t\t\tIngress: ingress,\n\t\t\tEgress: egress,\n\t\t}\n\t}\n\treturn bundle.KnownPeers[id], events\n}", "title": "" }, { "docid": "aaf1a1a6518cee9588433902080d9630", "score": "0.47192317", "text": "func (h *Host) PeerInfo() peerstore.Peerstore {\n\treturn h.host.Peerstore()\n}", "title": "" }, { "docid": "1b735186ab4b47c4873736366c8f638f", "score": "0.4691443", "text": "func (o *SnapshotGetIterRequestDesiredAttributes) SnapshotInfo() SnapshotInfoType {\n\tvar r SnapshotInfoType\n\tif o.SnapshotInfoPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.SnapshotInfoPtr\n\treturn r\n}", "title": "" }, { "docid": "55b1fe9c50df3d629eb1e6457c1b5619", "score": "0.4686121", "text": "func (d *Driver) getSnapshotInfo(snapshotID string) (snapshotName, resourceGroup, subsID string, err error) {\n\tif snapshotName, err = azureutils.GetSnapshotNameFromURI(snapshotID); err != nil {\n\t\treturn \"\", \"\", \"\", err\n\t}\n\tif resourceGroup, err = azureutils.GetResourceGroupFromURI(snapshotID); err != nil {\n\t\treturn \"\", \"\", \"\", err\n\t}\n\tif subsID = azureutils.GetSubscriptionIDFromURI(snapshotID); subsID == \"\" {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"cannot get SubscriptionID from %s\", snapshotID)\n\t}\n\treturn snapshotName, resourceGroup, subsID, err\n}", "title": "" }, { "docid": "8dde3f8172b718ac5a5cfe3576f390d0", "score": "0.46749532", "text": "func (d *driver) Snapshot(volumeID string, readonly bool, locator *api.VolumeLocator, noRetry bool) (string, error) {\n\tvols, err := d.Inspect([]string{volumeID})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(vols) != 1 {\n\t\treturn \"\", fmt.Errorf(\"Failed to inspect %v len %v\", volumeID, len(vols))\n\t}\n\tsnapID := uuid.New()\n\tvols[0].Id = snapID\n\tvols[0].Source = &api.Source{Parent: volumeID}\n\tvols[0].Locator = locator\n\tvols[0].Ctime = prototime.Now()\n\n\tif err := d.CreateVol(vols[0]); err != nil {\n\t\treturn \"\", err\n\t}\n\tchaos.Now(koStrayCreate)\n\terr = d.btrfs.Create(snapID, volumeID, \"\", nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn vols[0].Id, nil\n}", "title": "" }, { "docid": "bfcf9f3c33a4c2195145766d6fa2e9b5", "score": "0.46633476", "text": "func (o EcsInstanceSetDataDiskOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EcsInstanceSetDataDisk) *string { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f28696d79a3ca505477a44364ae2f4cd", "score": "0.46494418", "text": "func (ps *PeerSet) Peer(id string) PeerConnection {\n\tps.lock.RLock()\n\tdefer ps.lock.RUnlock()\n\n\treturn ps.peers[id]\n}", "title": "" }, { "docid": "b35eeee298ae0fab3bb3a5d9951ad965", "score": "0.46278346", "text": "func (s *Server) GetPeer(id string) *Peer {\n\tif peer, ok := s.peers[id]; ok {\n\t\treturn peer\n\t}\n\n\tpeer, err := s.discoverPeer(id)\n\tif err == nil {\n\t\treturn peer\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1f7f44d1f00123a4eb51a228c3e2df5f", "score": "0.4624761", "text": "func SnapshotBySnapshotID(db XODB, snapshotID string) (*Snapshot, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlStr = `SELECT ` +\n\t\t`id, snapshot_id, status, disk_id, name, region, zone, category, size, description, ` +\n\t\t`user_id, cluster_id, storage_type, snapshot_type, created_at, updated_at, deleted_at, deleted, expire_at ` +\n\t\t`FROM snapshot WHERE snapshot_id = ? AND deleted = 0`\n\n\t// run query\n\tXOLog(sqlStr, snapshotID)\n\ts := Snapshot{\n\t\t_exists: true,\n\t}\n\n\terr = db.QueryRow(sqlStr, snapshotID).Scan(&s.Id, &s.SnapshotID, &s.Status, &s.DiskID, &s.Name, &s.Region, &s.Zone, &s.Category,\n\t\t&s.Size, &s.Description, &s.UserID, &s.ClusterID, &s.StorageType, &s.SnapshotType,\n\t\t&s.CreatedAt, &s.UpdatedAt, &s.DeletedAt, &s.Deleted, &s.ExpireAt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &s, nil\n}", "title": "" }, { "docid": "6877457472afe43c267865d1f89a6320", "score": "0.45982218", "text": "func (o ImageDiskDeviceMappingOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ImageDiskDeviceMapping) *string { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "358c6ad5f12a8791f3262a9ba345f28c", "score": "0.45952126", "text": "func (_Contract *ContractCallerSession) GetEpochSnapshot(arg0 *big.Int) (struct {\n\tEndTime *big.Int\n\tEpochFee *big.Int\n\tTotalBaseRewardWeight *big.Int\n\tTotalTxRewardWeight *big.Int\n\tBaseRewardPerSecond *big.Int\n\tTotalStake *big.Int\n\tTotalSupply *big.Int\n}, error) {\n\treturn _Contract.Contract.GetEpochSnapshot(&_Contract.CallOpts, arg0)\n}", "title": "" }, { "docid": "dbee1241b4916feb371c29d85f40be1d", "score": "0.45934495", "text": "func (o EcsLaunchTemplateDataDiskOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EcsLaunchTemplateDataDisk) *string { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7fe7e625d54559a03680b4cd8bb3a797", "score": "0.45890808", "text": "func (o *SnapshotGetIterRequestQuery) SnapshotInfo() SnapshotInfoType {\n\tvar r SnapshotInfoType\n\tif o.SnapshotInfoPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.SnapshotInfoPtr\n\treturn r\n}", "title": "" }, { "docid": "cf9b3d87026bbe02a5cd14896ca97166", "score": "0.45889997", "text": "func (o GetImagesImageDiskDeviceMappingOutput) SnapshotId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetImagesImageDiskDeviceMapping) string { return v.SnapshotId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "27bf45e645b2e920cdf637c211011a75", "score": "0.45880356", "text": "func (o *SnapshotGetIterRequestDesiredAttributes) SetSnapshotInfo(newValue SnapshotInfoType) *SnapshotGetIterRequestDesiredAttributes {\n\to.SnapshotInfoPtr = &newValue\n\treturn o\n}", "title": "" }, { "docid": "5602ef22786736c452f0edd0f57b7b51", "score": "0.45790085", "text": "func (o LaunchTemplateDataDiskOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LaunchTemplateDataDisk) *string { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5c46485794bded92923b29bfdcab582f", "score": "0.45740795", "text": "func (cli *NopClient) SnapshotInspect(ctx context.Context, snapshotID string) (types.Snapshot, error) {\n\treturn types.Snapshot{}, errNoEngine\n}", "title": "" }, { "docid": "a63dc6680c74ef22337c207852c8b7bf", "score": "0.45733747", "text": "func (o *SnapshotExportTask) GetSnapshotId() string {\n\tif o == nil || o.SnapshotId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SnapshotId\n}", "title": "" }, { "docid": "32af17e1a3960be12a2ae5f5e56de474", "score": "0.45688775", "text": "func (o *WebRTCAuthenticateResult) GetPeerId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.PeerId\n}", "title": "" }, { "docid": "714c485ab8b12f0ba477533c0f83d6c8", "score": "0.45645967", "text": "func (o EcsDiskOutput) SnapshotId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *EcsDisk) pulumi.StringPtrOutput { return v.SnapshotId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d809a666fd998da0381ec4c600a7f0fe", "score": "0.45617718", "text": "func (o *Snapshot) GetSnapshotIdOk() (*string, bool) {\n\tif o == nil || o.SnapshotId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SnapshotId, true\n}", "title": "" }, { "docid": "4e05857c6a099fbdd36739c9abf2b5c9", "score": "0.45511654", "text": "func (c *fakeProviderSession) GetSnapshotWithVolumeID(volumeID string, snapshotID string) (*provider.Snapshot, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "6cbf0f2a87d0e9b760fb4fe2c7ba4a7f", "score": "0.4546601", "text": "func NewGetPeerInfoCmd(id interface{}) (*GetPeerInfoCmd, error) {\n\treturn &GetPeerInfoCmd{\n\t\tid: id,\n\t}, nil\n}", "title": "" }, { "docid": "28cb343d4c424afdfb843ee537f39db4", "score": "0.45465657", "text": "func handleGetPeerInfo(s *rpcServer, cmd btcjson.Cmd, walletNotification chan []byte) (interface{}, error) {\n\treturn s.server.PeerInfo(), nil\n}", "title": "" }, { "docid": "25617cff1224256d87da57b2c1ad33c9", "score": "0.45462823", "text": "func getSnapshot(id string) (string, error) {\n\tsegments := strings.Split(id, separator)\n\tif len(segments) < 5 {\n\t\treturn \"\", fmt.Errorf(\"error parsing volume id: %q, should at least contain four #\", id)\n\t}\n\treturn segments[len(segments)-1], nil\n}", "title": "" }, { "docid": "af51485cfea031be9ae090d41556092e", "score": "0.45442212", "text": "func (s *Server) PeerID() metainfo.Hash {\n\tid := s.client.DhtServers()[0].ID()\n\treturn metainfo.HashBytes(id[:])\n}", "title": "" }, { "docid": "ddc0c063b695ac160bae3ef4af8ea2fe", "score": "0.45432192", "text": "func (r *Router) FindPeer(ctx context.Context, peerID peer.ID) (peer.AddrInfo, error) {\n\treturn r.routing.FindPeer(ctx, peerID)\n}", "title": "" }, { "docid": "d5166aed5c3cd1a5f7da7b0b7cb2c178", "score": "0.45261136", "text": "func (m *MonitorMgr) GetInfo() (*api.Peer, error) {\n\treturn m.ctrl.PeerInfo()\n}", "title": "" }, { "docid": "396bd7695c72ca537b617daf4619a747", "score": "0.45102745", "text": "func (s *ListSnapshotBlocksInput) SetSnapshotId(v string) *ListSnapshotBlocksInput {\n\ts.SnapshotId = &v\n\treturn s\n}", "title": "" }, { "docid": "396bd7695c72ca537b617daf4619a747", "score": "0.45102745", "text": "func (s *ListSnapshotBlocksInput) SetSnapshotId(v string) *ListSnapshotBlocksInput {\n\ts.SnapshotId = &v\n\treturn s\n}", "title": "" }, { "docid": "7b19f6e0fc5f081fd6eb23682feab9b3", "score": "0.4506305", "text": "func LookupSnapshot(ctx *pulumi.Context, args *GetSnapshotArgs) (*GetSnapshotResult, error) {\n\tinputs := make(map[string]interface{})\n\tif args != nil {\n\t\tinputs[\"filters\"] = args.Filters\n\t\tinputs[\"mostRecent\"] = args.MostRecent\n\t\tinputs[\"owners\"] = args.Owners\n\t\tinputs[\"restorableByUserIds\"] = args.RestorableByUserIds\n\t\tinputs[\"snapshotIds\"] = args.SnapshotIds\n\t\tinputs[\"tags\"] = args.Tags\n\t}\n\toutputs, err := ctx.Invoke(\"aws:ebs/getSnapshot:getSnapshot\", inputs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &GetSnapshotResult{\n\t\tDataEncryptionKeyId: outputs[\"dataEncryptionKeyId\"],\n\t\tDescription: outputs[\"description\"],\n\t\tEncrypted: outputs[\"encrypted\"],\n\t\tFilters: outputs[\"filters\"],\n\t\tKmsKeyId: outputs[\"kmsKeyId\"],\n\t\tMostRecent: outputs[\"mostRecent\"],\n\t\tOwnerAlias: outputs[\"ownerAlias\"],\n\t\tOwnerId: outputs[\"ownerId\"],\n\t\tOwners: outputs[\"owners\"],\n\t\tRestorableByUserIds: outputs[\"restorableByUserIds\"],\n\t\tSnapshotId: outputs[\"snapshotId\"],\n\t\tSnapshotIds: outputs[\"snapshotIds\"],\n\t\tState: outputs[\"state\"],\n\t\tTags: outputs[\"tags\"],\n\t\tVolumeId: outputs[\"volumeId\"],\n\t\tVolumeSize: outputs[\"volumeSize\"],\n\t\tId: outputs[\"id\"],\n\t}, nil\n}", "title": "" }, { "docid": "b3d7aa11822134f0b6e4c709e1e2c1b3", "score": "0.4505994", "text": "func (r *RegionInfo) GetPeer(peerID uint64) *metapb.Peer {\n\tfor _, peer := range r.meta.GetPeers() {\n\t\tif peer.GetId() == peerID {\n\t\t\treturn peer\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "649fc9c84402a8b55687450ef0f272ee", "score": "0.45024732", "text": "func (s *server) findPeer(peerKey *btcec.PublicKey) (*peer, error) {\n\tserializedIDKey := string(peerKey.SerializeCompressed())\n\n\ts.peersMtx.RLock()\n\tpeer := s.peersByPub[serializedIDKey]\n\ts.peersMtx.RUnlock()\n\n\tif peer == nil {\n\t\treturn nil, errors.New(\"Peer not found. Pubkey: \" +\n\t\t\tstring(peerKey.SerializeCompressed()))\n\t}\n\n\treturn peer, nil\n}", "title": "" }, { "docid": "5bf135b7ffa2174cb6bab3a764431520", "score": "0.45022744", "text": "func (pm *PeersMap) Peer(db XODB) (*Peer, error) {\n\treturn PeerByID(db, pm.PeerID)\n}", "title": "" }, { "docid": "2455df6851fc4e627244027cbeb7aca1", "score": "0.44954047", "text": "func simplePeer(id string) *p2pmocks.Peer {\n\tpeer := &p2pmocks.Peer{}\n\tpeer.On(\"ID\").Return(p2p.ID(id))\n\treturn peer\n}", "title": "" }, { "docid": "5d3e8315dcc9ea8accca6f537de99222", "score": "0.4493618", "text": "func (_Contract *ContractSession) GetEpochSnapshot(arg0 *big.Int) (struct {\n\tEndTime *big.Int\n\tEpochFee *big.Int\n\tTotalBaseRewardWeight *big.Int\n\tTotalTxRewardWeight *big.Int\n\tBaseRewardPerSecond *big.Int\n\tTotalStake *big.Int\n\tTotalSupply *big.Int\n}, error) {\n\treturn _Contract.Contract.GetEpochSnapshot(&_Contract.CallOpts, arg0)\n}", "title": "" }, { "docid": "d55e7c70c1dad1e6701cd9506146edcf", "score": "0.44926605", "text": "func (store *Store) GetSnapshot(id uint64) (*Snapshot, error) {\n\tfl, err := store.backend.getSnapshotFiles(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadata := store.metadata[id]\n\tif metadata == nil {\n\t\treturn nil, errors.New(fmt.Sprintf(\"No snapshot metadata with id %d\", id))\n\t}\n\n\tsnapshot := &Snapshot{\n\t\tMetadata: metadata,\n\t\tFiles: fl,\n\t}\n\n\treturn snapshot, nil\n}", "title": "" }, { "docid": "729ef6622c9af2bb8b99a35d4c8a5541", "score": "0.44923902", "text": "func (s *Ebs) SetSnapshotId(v string) *Ebs {\n\ts.SnapshotId = &v\n\treturn s\n}", "title": "" }, { "docid": "d0e879c2b54ef685029ee362cebfab09", "score": "0.4491259", "text": "func (o *Snapshot) GetSnapshotId() string {\n\tif o == nil || o.SnapshotId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SnapshotId\n}", "title": "" }, { "docid": "8d1b276bf1fb5943f83e50c3e493c0e3", "score": "0.4478958", "text": "func (o *SnapshotExportTask) SetSnapshotId(v string) {\n\to.SnapshotId = &v\n}", "title": "" }, { "docid": "ab919cea8af2c6180568586bbc58ee31", "score": "0.44644174", "text": "func (r *DroidRemote) Snapshot() *DroidRemote {\n\tss := NewDroidRemote()\n\tss.Program = r.Program.Snapshot()\n\treturn ss\n}", "title": "" }, { "docid": "2033a663347efcab10f9b89b6224f822", "score": "0.4457524", "text": "func (o *SnapshotExportTask) GetSnapshotIdOk() (string, bool) {\n\tif o == nil || o.SnapshotId == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.SnapshotId, true\n}", "title": "" }, { "docid": "c04843532c27a36a0cad893d54822751", "score": "0.44561034", "text": "func (peer PeerInfo) String() string {\n\tid := hex.EncodeToString(peer.ID[:])\n\tif len(id) >= 7 {\n\t\tid = id[0:7]\n\t}\n\n\treturn fmt.Sprintf(\"%s, %s\", peer.Address(), id)\n}", "title": "" }, { "docid": "4da604a312994538ccd61f6b721cd9db", "score": "0.44537923", "text": "func (f *Filecoin) DHTFindPeer(ctx context.Context, pid peer.ID) ([]multiaddr.Multiaddr, error) {\n\tdecoder, err := f.RunCmdLDJSONWithStdin(ctx, nil, \"go-filecoin\", \"dht\", \"findpeer\", pid.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar out []multiaddr.Multiaddr\n\tfor {\n\t\tvar addr string\n\t\tif err := decoder.Decode(&addr); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\treturn []multiaddr.Multiaddr{}, err\n\t\t}\n\n\t\tma, err := multiaddr.NewMultiaddr(addr)\n\t\tif err != nil {\n\t\t\treturn []multiaddr.Multiaddr{}, err\n\t\t}\n\n\t\tout = append(out, ma)\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "2fbc55df003f732ff413d2b6d1444979", "score": "0.4453057", "text": "func (o *SnapshotGetIterResponseResultAttributesList) SnapshotInfo() []SnapshotInfoType {\n\tr := o.SnapshotInfoPtr\n\treturn r\n}", "title": "" }, { "docid": "f4b1b405c6c8abc70932b17d82916628", "score": "0.44299737", "text": "func (s *GetSnapshotBlockInput) SetSnapshotId(v string) *GetSnapshotBlockInput {\n\ts.SnapshotId = &v\n\treturn s\n}", "title": "" }, { "docid": "f4b1b405c6c8abc70932b17d82916628", "score": "0.44299737", "text": "func (s *GetSnapshotBlockInput) SetSnapshotId(v string) *GetSnapshotBlockInput {\n\ts.SnapshotId = &v\n\treturn s\n}", "title": "" }, { "docid": "34960fda7bdf1b84d332b5f2c0e4c433", "score": "0.44279504", "text": "func FindPeer(exec boil.Executor, iP string, port int, selectCols ...string) (*Peer, error) {\n\tpeerObj := &Peer{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from \\\"peers\\\" where \\\"ip\\\"=$1 AND \\\"port\\\"=$2\", sel,\n\t)\n\n\tq := queries.Raw(query, iP, port)\n\n\terr := q.Bind(nil, exec, peerObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"stellarcore: unable to select from peers\")\n\t}\n\n\treturn peerObj, nil\n}", "title": "" }, { "docid": "f87c85f6ed7e490450637ee2df93ce94", "score": "0.4425886", "text": "func (d Ploop) Snapshot() (string, error) {\n\tuuid, err := UUID()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn uuid, ploop(\"snapshot\", \"-u\", uuid, d.dd)\n}", "title": "" }, { "docid": "5eb3f174be0b75e6615b8826b9823e99", "score": "0.44218683", "text": "func (o GetEcsLaunchTemplatesTemplateDataDiskOutput) SnapshotId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetEcsLaunchTemplatesTemplateDataDisk) string { return v.SnapshotId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ff8270ec3c131b9c9239bc834c3869d7", "score": "0.44137114", "text": "func (o GetEcsDisksDiskOutput) SnapshotId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetEcsDisksDisk) string { return v.SnapshotId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7b72ec0f4b290e45c4616f36ccba42a2", "score": "0.44102058", "text": "func (o *PostWebRTCAuthenticateRequest) GetPeerId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.PeerId\n}", "title": "" }, { "docid": "9bc34e4bd7f61044de5a2f095e525384", "score": "0.44005024", "text": "func (cmd *GetPeerInfoCmd) Id() interface{} {\n\treturn cmd.id\n}", "title": "" }, { "docid": "315a08887f8e036782d96262870b2200", "score": "0.43968844", "text": "func (o GetDisksDiskOutput) SnapshotId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetDisksDisk) string { return v.SnapshotId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8f4166b8188fca64746d7affac5db478", "score": "0.4395095", "text": "func (n *Node) Peer(pid uint64) (string, bool) {\n\tn.RLock()\n\tdefer n.RUnlock()\n\taddr, ok := n.peers[pid]\n\treturn addr, ok\n}", "title": "" }, { "docid": "304c66ca9624518785c209c882b25255", "score": "0.4385847", "text": "func (_Contract *ContractCaller) GetEpochSnapshot(opts *bind.CallOpts, arg0 *big.Int) (struct {\n\tEndTime *big.Int\n\tEpochFee *big.Int\n\tTotalBaseRewardWeight *big.Int\n\tTotalTxRewardWeight *big.Int\n\tBaseRewardPerSecond *big.Int\n\tTotalStake *big.Int\n\tTotalSupply *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _Contract.contract.Call(opts, &out, \"getEpochSnapshot\", arg0)\n\n\toutstruct := new(struct {\n\t\tEndTime *big.Int\n\t\tEpochFee *big.Int\n\t\tTotalBaseRewardWeight *big.Int\n\t\tTotalTxRewardWeight *big.Int\n\t\tBaseRewardPerSecond *big.Int\n\t\tTotalStake *big.Int\n\t\tTotalSupply *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.EndTime = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\toutstruct.EpochFee = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\toutstruct.TotalBaseRewardWeight = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\toutstruct.TotalTxRewardWeight = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)\n\toutstruct.BaseRewardPerSecond = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int)\n\toutstruct.TotalStake = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int)\n\toutstruct.TotalSupply = *abi.ConvertType(out[6], new(*big.Int)).(**big.Int)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "af2d24a051c34ebd4f4b949c83de9d61", "score": "0.4383441", "text": "func FindSnapshot(ctx context.Context, be Lister, loader LoaderUnpacked, s string) (*Snapshot, error) {\n\t// no need to list snapshots if `s` is already a full id\n\tid, err := ParseID(s)\n\tif err != nil {\n\t\t// find snapshot id with prefix\n\t\tid, err = Find(ctx, be, SnapshotFile, s)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn LoadSnapshot(ctx, loader, id)\n}", "title": "" }, { "docid": "a8e60f477c765069252759d9670f9acb", "score": "0.43744376", "text": "func (_m *Peerstore) PeerInfo(_a0 peer.ID) peer.AddrInfo {\n\tret := _m.Called(_a0)\n\n\tvar r0 peer.AddrInfo\n\tif rf, ok := ret.Get(0).(func(peer.ID) peer.AddrInfo); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Get(0).(peer.AddrInfo)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "ecad1e9b90b3ad3c1b5e7e8cb0562e9c", "score": "0.4372958", "text": "func (o GetSnapshotsSnapshotOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetSnapshotsSnapshot) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ecad1e9b90b3ad3c1b5e7e8cb0562e9c", "score": "0.4372958", "text": "func (o GetSnapshotsSnapshotOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetSnapshotsSnapshot) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "44eddfee0311920eaba3b83fb6c4748f", "score": "0.43692356", "text": "func (o *BsuToCreate) SetSnapshotId(v string) {\n\to.SnapshotId = &v\n}", "title": "" }, { "docid": "14989fd3d0188bb72685ac59117f55c0", "score": "0.4353421", "text": "func (o GetEcsSnapshotsSnapshotOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetEcsSnapshotsSnapshot) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d2bcf49ba6bd78e1fb952daea5db8d55", "score": "0.43431994", "text": "func GetSnapshotInfo(bkt *bolt.Bucket, name string) (snapshots.Info, error) {\n\tvar info snapshots.Info\n\n\ttbkt := bkt.Bucket([]byte(name))\n\tinfo.Name = name\n\tinfo.Parent = string(tbkt.Get(BucketKeyParent))\n\n\tkind, _ := binary.Uvarint(tbkt.Get([]byte(\"kind\")))\n\tinfo.Kind = snapshots.Kind(uint8(kind))\n\tboltutil.ReadTimestamps(tbkt, &info.Created, &info.Updated)\n\tinfo.Labels, _ = boltutil.ReadLabels(tbkt)\n\n\treturn info, nil\n}", "title": "" }, { "docid": "7d9eb1985bc1844f7b6a45864a3b0073", "score": "0.43376568", "text": "func (r *Ami) RootSnapshotId() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"rootSnapshotId\"])\n}", "title": "" }, { "docid": "10b035f37c7a8dfb548103e700375f94", "score": "0.4336509", "text": "func (f *Fetch) PeerEpochInfo(ctx context.Context, peer p2p.Peer, epoch types.EpochID) (*EpochData, error) {\n\tf.logger.WithContext(ctx).With().Debug(\"requesting epoch info from peer\",\n\t\tlog.Stringer(\"peer\", peer),\n\t\tlog.Stringer(\"epoch\", epoch))\n\n\tvar (\n\t\tdone = make(chan error, 1)\n\t\ted EpochData\n\t)\n\tokCB := func(data []byte) {\n\t\tdone <- codec.Decode(data, &ed)\n\t}\n\terrCB := func(perr error) {\n\t\tdone <- perr\n\t}\n\tepochBytes, err := codec.Encode(epoch)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := f.servers[atxProtocol].Request(ctx, peer, epochBytes, okCB, errCB); err != nil {\n\t\treturn nil, err\n\t}\n\tselect {\n\tcase err := <-done:\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tf.RegisterPeerHashes(peer, types.ATXIDsToHashes(ed.AtxIDs))\n\t\treturn &ed, nil\n\tcase <-ctx.Done():\n\t\tf.logger.WithContext(ctx).With().Debug(\"context done\")\n\t\treturn nil, ctx.Err()\n\t}\n}", "title": "" }, { "docid": "6b3c9340287e8d7e4269ee0c253fc2ce", "score": "0.43336475", "text": "func (p *PeerInfoManager) GetPeerInfoInMin(key string) *types.Peer {\n\tv, ok := p.peerInfo.Load(key)\n\tif !ok {\n\t\treturn nil\n\t}\n\tinfo := v.(*peerStoreInfo)\n\n\tif time.Duration(time.Now().Unix())-info.storeTime > 60 {\n\t\tp.peerInfo.Delete(key)\n\t\treturn nil\n\t}\n\treturn info.peer\n}", "title": "" }, { "docid": "3dd9406455a69f8dc480300c191c8cb4", "score": "0.4331207", "text": "func (o *SnapshotGetIterRequestQuery) SetSnapshotInfo(newValue SnapshotInfoType) *SnapshotGetIterRequestQuery {\n\to.SnapshotInfoPtr = &newValue\n\treturn o\n}", "title": "" }, { "docid": "70513b07c7a369c73df684f907bd7623", "score": "0.43223575", "text": "func (rm *HostCommandResultMap) GetSnapshot() map[string]*HostCommandResult {\n\trm.RLock()\n\tdefer rm.RUnlock()\n\treturn rm.Results\n}", "title": "" }, { "docid": "faab50ba3d1b739d92539a5effaec1a4", "score": "0.43213317", "text": "func (o *BsuToCreate) GetSnapshotId() string {\n\tif o == nil || o.SnapshotId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SnapshotId\n}", "title": "" }, { "docid": "3b93f74abb88544c2d449ca15120fa29", "score": "0.4317523", "text": "func (bm *BlobManipulator) TakeSnapshot(dir string) (snapID, stdout string, err error) {\n\terr = bm.KopiaCommandRunner.ConnectRepo(\"filesystem\", \"--path=\"+bm.DataRepoPath)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tmsg, stdout, err := bm.KopiaCommandRunner.Run(\"snapshot\", \"create\", dir, \"--json\")\n\tif err != nil {\n\t\treturn msg, stdout, err\n\t}\n\n\tvar m snapshot.Manifest\n\n\terr = json.Unmarshal([]byte(msg), &m)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tsnapID = string(m.ID)\n\n\treturn snapID, stdout, nil\n}", "title": "" } ]
60dc2c9d0aa9c8d5496d5487669f7592
ENotificationRequired provides a mock function with given fields:
[ { "docid": "74d0ad1e839a1198799fa656961a52c0", "score": "0.7432231", "text": "func (_m *MockEResource) ENotificationRequired() bool {\n\tret := _m.Called()\n\n\tvar r0 bool\n\tif rf, ok := ret.Get(0).(func() bool); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(bool)\n\t}\n\n\treturn r0\n}", "title": "" } ]
[ { "docid": "fd192ab01d7f8c4806e47e01bee2dcd8", "score": "0.7284516", "text": "func (_m *MockETypeParameter) ENotificationRequired() bool {\n\tret := _m.Called()\n\n\tvar r0 bool\n\tif rf, ok := ret.Get(0).(func() bool); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(bool)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f505de754c77ff5158b3edbf312f078f", "score": "0.6122744", "text": "func TestMockETypedElementIsRequired(t *testing.T) {\n\to := &MockETypedElement{}\n\tr := bool(true)\n\to.On(\"IsRequired\").Once().Return(r)\n\to.On(\"IsRequired\").Once().Return(func() bool {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.IsRequired())\n\tassert.Equal(t, r, o.IsRequired())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "9dbf20a974ef6f3380e5cae025b727e4", "score": "0.6072767", "text": "func (_m *MockSlackNotifier) Notify(_a0 *SlackMessage, _a1 string) error {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*SlackMessage, string) error); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "aec5d72fc3e6a28372e3f158f9f6b225", "score": "0.59454", "text": "func (_m *DBClient) AddNotification(n models.Notification) (models.Notification, errors.EdgeX) {\n\tret := _m.Called(n)\n\n\tvar r0 models.Notification\n\tif rf, ok := ret.Get(0).(func(models.Notification) models.Notification); ok {\n\t\tr0 = rf(n)\n\t} else {\n\t\tr0 = ret.Get(0).(models.Notification)\n\t}\n\n\tvar r1 errors.EdgeX\n\tif rf, ok := ret.Get(1).(func(models.Notification) errors.EdgeX); ok {\n\t\tr1 = rf(n)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(errors.EdgeX)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "cca75faadcec5c54016613e683a890d1", "score": "0.5838678", "text": "func (_m *MockEResource) ENotify(_a0 ENotification) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "d3dd4130eef1e1f9a88d1b8bf4ede45d", "score": "0.5822363", "text": "func (_m *MockETypeParameter) ENotify(_a0 ENotification) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "4481785946819f456b134750b7ed2a90", "score": "0.57671016", "text": "func (_m *DBClient) NotificationById(id string) (models.Notification, errors.EdgeX) {\n\tret := _m.Called(id)\n\n\tvar r0 models.Notification\n\tif rf, ok := ret.Get(0).(func(string) models.Notification); ok {\n\t\tr0 = rf(id)\n\t} else {\n\t\tr0 = ret.Get(0).(models.Notification)\n\t}\n\n\tvar r1 errors.EdgeX\n\tif rf, ok := ret.Get(1).(func(string) errors.EdgeX); ok {\n\t\tr1 = rf(id)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(errors.EdgeX)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "d654aef5f6f8af4c4d4cd25b121c113d", "score": "0.575512", "text": "func (m *MockConsumerWorker) OnNotification(f func(*sarama_cluster.Notification)) {\n\tm.ctrl.Call(m, \"OnNotification\", f)\n}", "title": "" }, { "docid": "26b54990be41a35864f7665b04e034da", "score": "0.57316923", "text": "func TestMockEClassGetFeatureCount(t *testing.T) {\n\to := &MockEClass{}\n\tr := int(45)\n\to.On(\"GetFeatureCount\").Return(r).Once()\n\to.On(\"GetFeatureCount\").Return(func() int {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.GetFeatureCount())\n\tassert.Equal(t, r, o.GetFeatureCount())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "51f2dd48a633e33a78af3afc81713a45", "score": "0.57174754", "text": "func mockFIAdditionalFIToFI() *FIAdditionalFIToFI {\n\tfifi := NewFIAdditionalFIToFI()\n\tfifi.AdditionalFIToFI.LineOne = \"Line One\"\n\tfifi.AdditionalFIToFI.LineTwo = \"Line Two\"\n\tfifi.AdditionalFIToFI.LineThree = \"Line Three\"\n\tfifi.AdditionalFIToFI.LineFour = \"Line Four\"\n\tfifi.AdditionalFIToFI.LineFive = \"Line Five\"\n\tfifi.AdditionalFIToFI.LineSix = \"Line Six\"\n\treturn fifi\n}", "title": "" }, { "docid": "15f863e03646f7849f410ea7d4a9273c", "score": "0.5669105", "text": "func TestMockEClassIsInterface(t *testing.T) {\n\to := &MockEClass{}\n\tr := bool(true)\n\to.On(\"IsInterface\").Once().Return(r)\n\to.On(\"IsInterface\").Once().Return(func() bool {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.IsInterface())\n\tassert.Equal(t, r, o.IsInterface())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "1af76339cd773c0a7e4e0dbd4c0ebbc8", "score": "0.562197", "text": "func TestMockEClassGetEContainmentFeatures(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEContainmentFeatures\").Once().Return(l)\n\to.On(\"GetEContainmentFeatures\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEContainmentFeatures())\n\tassert.Equal(t, l, o.GetEContainmentFeatures())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "89480e7ec82a16a302258988b5e63ccc", "score": "0.55966103", "text": "func (_m *DBClient) UpdateNotification(s models.Notification) errors.EdgeX {\n\tret := _m.Called(s)\n\n\tvar r0 errors.EdgeX\n\tif rf, ok := ret.Get(0).(func(models.Notification) errors.EdgeX); ok {\n\t\tr0 = rf(s)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(errors.EdgeX)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "3c41f833d0457c3a85542647f77be56d", "score": "0.55953646", "text": "func TestMockEClassSetInterface(t *testing.T) {\n\to := &MockEClass{}\n\tv := bool(true)\n\to.On(\"SetInterface\", v).Once()\n\to.SetInterface(v)\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "852a170028853b7d1fa2f0a5ba12e4aa", "score": "0.559155", "text": "func TestMockEReferenceIsContainment(t *testing.T) {\n\to := &MockEReference{}\n\tr := bool(true)\n\to.On(\"IsContainment\").Once().Return(r)\n\to.On(\"IsContainment\").Once().Return(func() bool {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.IsContainment())\n\tassert.Equal(t, r, o.IsContainment())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "2f24629f155660908b9f629a09e1bddb", "score": "0.55619377", "text": "func mockPaymentNotification() *PaymentNotification {\n\tpn := NewPaymentNotification()\n\tpn.PaymentNotificationIndicator = \"1\"\n\tpn.ContactNotificationElectronicAddress = \"http://moov.io\"\n\tpn.ContactName = \"Contact Name\"\n\tpn.ContactPhoneNumber = \"5555551212\"\n\tpn.ContactMobileNumber = \"5551231212\"\n\tpn.ContactFaxNumber = \"5554561212\"\n\tpn.EndToEndIdentification = \"End To End Identification\"\n\treturn pn\n}", "title": "" }, { "docid": "58a9b606051e9f6de650a96ead45172c", "score": "0.55346054", "text": "func TestMockEClassGetFeatureID(t *testing.T) {\n\to := &MockEClass{}\n\tfeature := new(MockEStructuralFeature)\n\tr := int(45)\n\to.On(\"GetFeatureID\", feature).Return(r).Once()\n\to.On(\"GetFeatureID\", feature).Return(func() int {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.GetFeatureID(feature))\n\tassert.Equal(t, r, o.GetFeatureID(feature))\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "f91e68b2869672b5ebf7aacc5fe4754c", "score": "0.545076", "text": "func (mc *MockClient) SendNotification(_ string) error {\n\treturn nil\n}", "title": "" }, { "docid": "19008a10a154928a430580aa182350c0", "score": "0.54341656", "text": "func TestMockEReferenceGetEReferenceType(t *testing.T) {\n\to := &MockEReference{}\n\tr := new(MockEClass)\n\to.On(\"GetEReferenceType\").Once().Return(r)\n\to.On(\"GetEReferenceType\").Once().Return(func() EClass {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.GetEReferenceType())\n\tassert.Equal(t, r, o.GetEReferenceType())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "13908e016481f65b02f6a63ca1082813", "score": "0.542986", "text": "func TestMockEClassGetEStructuralFeatures(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEStructuralFeatures\").Once().Return(l)\n\to.On(\"GetEStructuralFeatures\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEStructuralFeatures())\n\tassert.Equal(t, l, o.GetEStructuralFeatures())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "6b683f3ffc4bbcdac5c1325059e09233", "score": "0.54029405", "text": "func TestMockEClassGetOperationCount(t *testing.T) {\n\to := &MockEClass{}\n\tr := int(45)\n\to.On(\"GetOperationCount\").Return(r).Once()\n\to.On(\"GetOperationCount\").Return(func() int {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.GetOperationCount())\n\tassert.Equal(t, r, o.GetOperationCount())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "9e7c2d6c54e1b289448f38802ff26cb4", "score": "0.53788245", "text": "func TestMockEStructuralFeatureGetEContainingClass(t *testing.T) {\n\to := &MockEStructuralFeature{}\n\tr := new(MockEClass)\n\to.On(\"GetEContainingClass\").Once().Return(r)\n\to.On(\"GetEContainingClass\").Once().Return(func() EClass {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.GetEContainingClass())\n\tassert.Equal(t, r, o.GetEContainingClass())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "49703b15c8bcf737aeacf9b9e69c4cb3", "score": "0.5377387", "text": "func TestMockEClassGetEAttributes(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEAttributes\").Once().Return(l)\n\to.On(\"GetEAttributes\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEAttributes())\n\tassert.Equal(t, l, o.GetEAttributes())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "f815fe3a4d1dae67897e6dd6211647e7", "score": "0.5367281", "text": "func TestMockEStructuralFeatureGetFeatureID(t *testing.T) {\n\to := &MockEStructuralFeature{}\n\tr := int(45)\n\to.On(\"GetFeatureID\").Once().Return(r)\n\to.On(\"GetFeatureID\").Once().Return(func() int {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.GetFeatureID())\n\tassert.Equal(t, r, o.GetFeatureID())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "b964e07e816a93da1c11ae08eba77f12", "score": "0.53657645", "text": "func TestMockEClassGetOperationID(t *testing.T) {\n\to := &MockEClass{}\n\toperation := new(MockEOperation)\n\tr := int(45)\n\to.On(\"GetOperationID\", operation).Return(r).Once()\n\to.On(\"GetOperationID\", operation).Return(func() int {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.GetOperationID(operation))\n\tassert.Equal(t, r, o.GetOperationID(operation))\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "38ded1d7d885d29b0674c0b23a37cd5c", "score": "0.53261465", "text": "func TestMockEClassGetEOperation(t *testing.T) {\n\to := &MockEClass{}\n\toperationID := int(45)\n\tr := new(MockEOperation)\n\to.On(\"GetEOperation\", operationID).Return(r).Once()\n\to.On(\"GetEOperation\", operationID).Return(func() EOperation {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.GetEOperation(operationID))\n\tassert.Equal(t, r, o.GetEOperation(operationID))\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "1cf5dc41c1ab96366742c3bdf918c4df", "score": "0.53260654", "text": "func TestMockEReferenceSetContainment(t *testing.T) {\n\to := &MockEReference{}\n\tv := bool(true)\n\to.On(\"SetContainment\", v).Once()\n\to.SetContainment(v)\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "83453a770588033f1e5538502a7b60ab", "score": "0.5311116", "text": "func (mn MockNotifier) Notify(err interface{}) error {\n\tmn <- MockNotification{Err: err}\n\treturn nil\n}", "title": "" }, { "docid": "c3f82c1b42758c4b65b2eb19a1e6fcdc", "score": "0.5307368", "text": "func TestMockEClassGetEStructuralFeature(t *testing.T) {\n\to := &MockEClass{}\n\tfeatureID := int(45)\n\tr := new(MockEStructuralFeature)\n\to.On(\"GetEStructuralFeature\", featureID).Return(r).Once()\n\to.On(\"GetEStructuralFeature\", featureID).Return(func() EStructuralFeature {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.GetEStructuralFeature(featureID))\n\tassert.Equal(t, r, o.GetEStructuralFeature(featureID))\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "c7e15e4c6f99fd08a127c7e39be830d5", "score": "0.52961475", "text": "func TestMockEClassGetEAllContainments(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEAllContainments\").Once().Return(l)\n\to.On(\"GetEAllContainments\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEAllContainments())\n\tassert.Equal(t, l, o.GetEAllContainments())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "aef177bd44cbcebd08151bac9d532c64", "score": "0.5258265", "text": "func (_m *NuclioFunctionEventInterface) Get(name string, options v1.GetOptions) (*v1beta1.NuclioFunctionEvent, error) {\n\tret := _m.Called(name, options)\n\n\tvar r0 *v1beta1.NuclioFunctionEvent\n\tif rf, ok := ret.Get(0).(func(string, v1.GetOptions) *v1beta1.NuclioFunctionEvent); ok {\n\t\tr0 = rf(name, options)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*v1beta1.NuclioFunctionEvent)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string, v1.GetOptions) error); ok {\n\t\tr1 = rf(name, options)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "27281472304e9335161458b584354c1a", "score": "0.5254132", "text": "func TestMockEClassGetEOperations(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEOperations\").Once().Return(l)\n\to.On(\"GetEOperations\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEOperations())\n\tassert.Equal(t, l, o.GetEOperations())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "8c68faee918c0ef7981882263d29c15d", "score": "0.52529114", "text": "func TestMockEClassGetEIDAttribute(t *testing.T) {\n\to := &MockEClass{}\n\tr := new(MockEAttribute)\n\to.On(\"GetEIDAttribute\").Once().Return(r)\n\to.On(\"GetEIDAttribute\").Once().Return(func() EAttribute {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.GetEIDAttribute())\n\tassert.Equal(t, r, o.GetEIDAttribute())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "cc4c3cf8a6665934d3d85a3da80b196b", "score": "0.52512014", "text": "func (c *MockClient) Notify(p minitel.Payload) (result minitel.Result, err error) {\n\tc.m.Lock()\n\tdefer c.m.Unlock()\n\tif len(c.notifyExpectations) > 0 {\n\t\tnext := c.notifyExpectations[0]\n\t\tc.notifyExpectations = c.notifyExpectations[1:]\n\t\treturn next.result, next.err\n\t}\n\tc.t.Errorf(\"no more notify expectations\")\n\treturn minitel.Result{}, errNoMoreExpectations\n}", "title": "" }, { "docid": "1e4f6b4cd8d00d8a4fd458f583cca506", "score": "0.5242527", "text": "func (m *MockHelmInstallation) EXPECT() *MockHelmInstallationMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "fc28980bffce461ef67a83d7298d0a70", "score": "0.5232739", "text": "func TestMockEClassIsSuperTypeOf(t *testing.T) {\n\to := &MockEClass{}\n\tsomeClass := new(MockEClass)\n\tr := bool(true)\n\to.On(\"IsSuperTypeOf\", someClass).Return(r).Once()\n\to.On(\"IsSuperTypeOf\", someClass).Return(func() bool {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.IsSuperTypeOf(someClass))\n\tassert.Equal(t, r, o.IsSuperTypeOf(someClass))\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "02d773dfeaa8ec7b52a191d8d82aaf05", "score": "0.52321506", "text": "func (mmPurgeUserLegacy *mInterfaceMockPurgeUserLegacy) Expect(username string) *mInterfaceMockPurgeUserLegacy {\n\tif mmPurgeUserLegacy.mock.funcPurgeUserLegacy != nil {\n\t\tmmPurgeUserLegacy.mock.t.Fatalf(\"InterfaceMock.PurgeUserLegacy mock is already set by Set\")\n\t}\n\n\tif mmPurgeUserLegacy.defaultExpectation == nil {\n\t\tmmPurgeUserLegacy.defaultExpectation = &InterfaceMockPurgeUserLegacyExpectation{}\n\t}\n\n\tmmPurgeUserLegacy.defaultExpectation.params = &InterfaceMockPurgeUserLegacyParams{username}\n\tfor _, e := range mmPurgeUserLegacy.expectations {\n\t\tif minimock.Equal(e.params, mmPurgeUserLegacy.defaultExpectation.params) {\n\t\t\tmmPurgeUserLegacy.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmPurgeUserLegacy.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmPurgeUserLegacy\n}", "title": "" }, { "docid": "60e1387ca9b3b3acea5628abe4790252", "score": "0.5231182", "text": "func TestMockEClassGetEAllAttributes(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEAllAttributes\").Once().Return(l)\n\to.On(\"GetEAllAttributes\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEAllAttributes())\n\tassert.Equal(t, l, o.GetEAllAttributes())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "675c0cfaf24e420851fe08f2ac012532", "score": "0.5223191", "text": "func TestMockEClassGetEReferences(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEReferences\").Once().Return(l)\n\to.On(\"GetEReferences\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEReferences())\n\tassert.Equal(t, l, o.GetEReferences())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "7141c41c6779c69022bd1f2c9edf8cc6", "score": "0.520992", "text": "func TestMockEStructuralFeatureIsChangeable(t *testing.T) {\n\to := &MockEStructuralFeature{}\n\tr := bool(true)\n\to.On(\"IsChangeable\").Once().Return(r)\n\to.On(\"IsChangeable\").Once().Return(func() bool {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.IsChangeable())\n\tassert.Equal(t, r, o.IsChangeable())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "b1e0dae091edbc29a5645141f617248d", "score": "0.51892596", "text": "func TestMockEReferenceGetEKeys(t *testing.T) {\n\to := &MockEReference{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEKeys\").Once().Return(l)\n\to.On(\"GetEKeys\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEKeys())\n\tassert.Equal(t, l, o.GetEKeys())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "a77c1bca67a44ea5c3502b066807cb88", "score": "0.51715964", "text": "func (eTypedElement *MockETypedElement) IsRequired() bool {\n\tret := eTypedElement.Called()\n\n\tvar r bool\n\tif rf, ok := ret.Get(0).(func() bool); ok {\n\t\tr = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr = ret.Get(0).(bool)\n\t\t}\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "c7b3ed2e4dba253cc7270c1e28fddce0", "score": "0.5169733", "text": "func TestMockEClassGetFeatureType(t *testing.T) {\n\to := &MockEClass{}\n\tfeature := new(MockEStructuralFeature)\n\tr := new(MockEClassifier)\n\to.On(\"GetFeatureType\", feature).Return(r).Once()\n\to.On(\"GetFeatureType\", feature).Return(func() EClassifier {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.GetFeatureType(feature))\n\tassert.Equal(t, r, o.GetFeatureType(feature))\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "8f1b795dd951d080bbcf96f27714cf54", "score": "0.5158966", "text": "func (_m *MockSlackCaller) SendMessage(_a0 string, _a1 ...slack.MsgOption) (string, string, string, error) {\n\t_va := make([]interface{}, len(_a1))\n\tfor _i := range _a1 {\n\t\t_va[_i] = _a1[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, _a0)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func(string, ...slack.MsgOption) string); ok {\n\t\tr0 = rf(_a0, _a1...)\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\tvar r1 string\n\tif rf, ok := ret.Get(1).(func(string, ...slack.MsgOption) string); ok {\n\t\tr1 = rf(_a0, _a1...)\n\t} else {\n\t\tr1 = ret.Get(1).(string)\n\t}\n\n\tvar r2 string\n\tif rf, ok := ret.Get(2).(func(string, ...slack.MsgOption) string); ok {\n\t\tr2 = rf(_a0, _a1...)\n\t} else {\n\t\tr2 = ret.Get(2).(string)\n\t}\n\n\tvar r3 error\n\tif rf, ok := ret.Get(3).(func(string, ...slack.MsgOption) error); ok {\n\t\tr3 = rf(_a0, _a1...)\n\t} else {\n\t\tr3 = ret.Error(3)\n\t}\n\n\treturn r0, r1, r2, r3\n}", "title": "" }, { "docid": "36ffb83e2b9d1c19dbe3a2beec7122ee", "score": "0.51508534", "text": "func (mmSendMessage *mRPCControllerMockSendMessage) When(nodeID insolar.Reference, name string, msg insolar.Parcel) *RPCControllerMockSendMessageExpectation {\n\tif mmSendMessage.mock.funcSendMessage != nil {\n\t\tmmSendMessage.mock.t.Fatalf(\"RPCControllerMock.SendMessage mock is already set by Set\")\n\t}\n\n\texpectation := &RPCControllerMockSendMessageExpectation{\n\t\tmock: mmSendMessage.mock,\n\t\tparams: &RPCControllerMockSendMessageParams{nodeID, name, msg},\n\t}\n\tmmSendMessage.expectations = append(mmSendMessage.expectations, expectation)\n\treturn expectation\n}", "title": "" }, { "docid": "52895be85233fcee00471fdf81e04cf1", "score": "0.51498175", "text": "func (mn MockNotifier) NotifyWithRequest(err interface{}, req *http.Request) error {\n\tmn <- MockNotification{Err: err, Req: req}\n\treturn nil\n}", "title": "" }, { "docid": "d1b1f857fd18bd9668e44cbe13f86025", "score": "0.51460665", "text": "func TestMockEClassGetEStructuralFeatureFromName(t *testing.T) {\n\to := &MockEClass{}\n\tfeatureName := string(\"Test String\")\n\tr := new(MockEStructuralFeature)\n\to.On(\"GetEStructuralFeatureFromName\", featureName).Return(r).Once()\n\to.On(\"GetEStructuralFeatureFromName\", featureName).Return(func() EStructuralFeature {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.GetEStructuralFeatureFromName(featureName))\n\tassert.Equal(t, r, o.GetEStructuralFeatureFromName(featureName))\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "6a46b9063f50ba2285442953edef50e4", "score": "0.5144906", "text": "func (m *mStorageMockGetLastUpdateInfo) When(ctx context.Context) *StorageMockGetLastUpdateInfoExpectation {\n\tif m.mock.funcGetLastUpdateInfo != nil {\n\t\tm.mock.t.Fatalf(\"StorageMock.GetLastUpdateInfo mock is already set by Set\")\n\t}\n\n\texpectation := &StorageMockGetLastUpdateInfoExpectation{\n\t\tmock: m.mock,\n\t\tparams: &StorageMockGetLastUpdateInfoParams{ctx},\n\t}\n\tm.expectations = append(m.expectations, expectation)\n\treturn expectation\n}", "title": "" }, { "docid": "d8372d38d60f6b2ff954320e9c2fa292", "score": "0.51429105", "text": "func TestMockEClassGetOverride(t *testing.T) {\n\to := &MockEClass{}\n\toperation := new(MockEOperation)\n\tr := new(MockEOperation)\n\to.On(\"GetOverride\", operation).Return(r).Once()\n\to.On(\"GetOverride\", operation).Return(func() EOperation {\n\t\treturn r\n\t}).Once()\n\tassert.Equal(t, r, o.GetOverride(operation))\n\tassert.Equal(t, r, o.GetOverride(operation))\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "00db34ca41d69812e9035b8cf2d4da1f", "score": "0.5133655", "text": "func (mmPurgeUserLegacy *mInterfaceMockPurgeUserLegacy) When(username string) *InterfaceMockPurgeUserLegacyExpectation {\n\tif mmPurgeUserLegacy.mock.funcPurgeUserLegacy != nil {\n\t\tmmPurgeUserLegacy.mock.t.Fatalf(\"InterfaceMock.PurgeUserLegacy mock is already set by Set\")\n\t}\n\n\texpectation := &InterfaceMockPurgeUserLegacyExpectation{\n\t\tmock: mmPurgeUserLegacy.mock,\n\t\tparams: &InterfaceMockPurgeUserLegacyParams{username},\n\t}\n\tmmPurgeUserLegacy.expectations = append(mmPurgeUserLegacy.expectations, expectation)\n\treturn expectation\n}", "title": "" }, { "docid": "543ddd1f3a08f7c2ee064b4959a2b88e", "score": "0.5120989", "text": "func (d SubscriptionDriverListenForDeliveriesMockDescriptorWithReturn) Mock() (m SubscriptionDriverMock, assert func(t interface{ Errorf(string, ...interface{}) }) (ok bool)) {\n\td.methodDesc.done()\n\treturn d.methodDesc.mockDesc.Mock()\n}", "title": "" }, { "docid": "8d3d6492855fdb5f7fe4bfb23db47350", "score": "0.51070863", "text": "func TestMockEStructuralFeatureSetChangeable(t *testing.T) {\n\to := &MockEStructuralFeature{}\n\tv := bool(true)\n\to.On(\"SetChangeable\", v).Once()\n\to.SetChangeable(v)\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "edfa7f5d0b152e580e076e37193ecdb9", "score": "0.51021355", "text": "func TestMockEReferenceGetEOpposite(t *testing.T) {\n\to := &MockEReference{}\n\tr := new(MockEReference)\n\to.On(\"GetEOpposite\").Once().Return(r)\n\to.On(\"GetEOpposite\").Once().Return(func() EReference {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.GetEOpposite())\n\tassert.Equal(t, r, o.GetEOpposite())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "6c1b10e2eb864a863279a9ac79583bd6", "score": "0.509815", "text": "func (_m *DBClient) NotificationsByTimeRange(start int, end int, offset int, limit int) ([]models.Notification, errors.EdgeX) {\n\tret := _m.Called(start, end, offset, limit)\n\n\tvar r0 []models.Notification\n\tif rf, ok := ret.Get(0).(func(int, int, int, int) []models.Notification); ok {\n\t\tr0 = rf(start, end, offset, limit)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]models.Notification)\n\t\t}\n\t}\n\n\tvar r1 errors.EdgeX\n\tif rf, ok := ret.Get(1).(func(int, int, int, int) errors.EdgeX); ok {\n\t\tr1 = rf(start, end, offset, limit)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(errors.EdgeX)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "30cfcd70e24f6337af82f9fa1282bbac", "score": "0.50980204", "text": "func (suite *AlarmsTestSuite) mockIncidentsResolvedSlackMessage(user *accounts.User) {\n\tmsg := \"Some mock message...\"\n\tsuite.slackFactoryMock.On(\n\t\t\"NewIncidentsResolvedMessage\",\n\t\tmock.AnythingOfType(\"*alarms.Alarm\"),\n\t).Return(msg)\n\tslackAdapterMock := new(slack.AdapterMock)\n\tslackAdapterMock.On(\n\t\t\"SendMessage\",\n\t\tuser.SlackChannel.String,\n\t\tsuite.cnf.Slack.Username,\n\t\tmsg,\n\t\tsuite.cnf.Slack.Emoji,\n\t).Return(nil)\n\tsuite.accountsServiceMock.On(\n\t\t\"GetSlackAdapter\",\n\t\tmock.AnythingOfType(\"*accounts.User\"),\n\t).Return(slackAdapterMock)\n}", "title": "" }, { "docid": "26455c9fdb47d40c9991f68c80ec5c60", "score": "0.5095838", "text": "func (m *MockNotifierInterface) EXPECT() *MockNotifierInterfaceMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "b67aa828f4e868660d83a2b9fd54ba0a", "score": "0.50915015", "text": "func (_m *Clienter) UpdateEvent(_a0 string, _a1 func(map[string][]string, url.Values), _a2 map[string][]string) (*models.Event, error) {\n\tret := _m.Called(_a0, _a1, _a2)\n\n\tvar r0 *models.Event\n\tif rf, ok := ret.Get(0).(func(string, func(map[string][]string, url.Values), map[string][]string) *models.Event); ok {\n\t\tr0 = rf(_a0, _a1, _a2)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*models.Event)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string, func(map[string][]string, url.Values), map[string][]string) error); ok {\n\t\tr1 = rf(_a0, _a1, _a2)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "8194eac5cb21e03fb370793295995d4b", "score": "0.509036", "text": "func TestMockEStructuralFeatureGetDefaultValue(t *testing.T) {\n\to := &MockEStructuralFeature{}\n\tr := interface{}(nil)\n\to.On(\"GetDefaultValue\").Once().Return(r)\n\to.On(\"GetDefaultValue\").Once().Return(func() interface{} {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.GetDefaultValue())\n\tassert.Equal(t, r, o.GetDefaultValue())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "2d8dca782f8d287959409cbfae1f4a29", "score": "0.5088169", "text": "func (m *MockPort) NotifyAvailable(arg0 sim.VTimeInSec) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"NotifyAvailable\", arg0)\n}", "title": "" }, { "docid": "20b6e6e4aba7fb1443e3373e691941bb", "score": "0.5086479", "text": "func (suite *AlarmsTestSuite) mockIncidentsResolvedEmail() {\n\temailMock := new(email.Email)\n\tsuite.emailFactoryMock.On(\n\t\t\"NewIncidentsResolvedEmail\",\n\t\tmock.AnythingOfType(\"*alarms.Alarm\"),\n\t).Return(emailMock)\n\tsuite.emailServiceMock.On(\"Send\", emailMock).Return(nil)\n}", "title": "" }, { "docid": "2c2030d949dfefee0426f5284c5ff68b", "score": "0.50858575", "text": "func TestMockEClassGetEAllOperations(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEAllOperations\").Once().Return(l)\n\to.On(\"GetEAllOperations\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEAllOperations())\n\tassert.Equal(t, l, o.GetEAllOperations())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "1917536ee18322e76a851a709d0d10d2", "score": "0.50617856", "text": "func TestSenderSuppliedUserRequestCorrelationRequired(t *testing.T) {\n\tss := mockSenderSupplied()\n\tss.UserRequestCorrelation = \"\"\n\tif err := ss.Validate(); err != nil {\n\t\tif !base.Match(err, ErrFieldRequired) {\n\t\t\tt.Errorf(\"%T: %s\", err, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4748097385d74309be95227b62c52001", "score": "0.50555277", "text": "func (_m *MockEResource) EDeliver() bool {\n\tret := _m.Called()\n\n\tvar r0 bool\n\tif rf, ok := ret.Get(0).(func() bool); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(bool)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "c4d99af617fce574d082140416860f15", "score": "0.5050217", "text": "func TestMockEClassGetECrossReferenceFeatures(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetECrossReferenceFeatures\").Once().Return(l)\n\to.On(\"GetECrossReferenceFeatures\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetECrossReferenceFeatures())\n\tassert.Equal(t, l, o.GetECrossReferenceFeatures())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "29d447a506a47d992c39a0211fb0b233", "score": "0.5046852", "text": "func TestMockEStructuralFeatureIsTransient(t *testing.T) {\n\to := &MockEStructuralFeature{}\n\tr := bool(true)\n\to.On(\"IsTransient\").Once().Return(r)\n\to.On(\"IsTransient\").Once().Return(func() bool {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.IsTransient())\n\tassert.Equal(t, r, o.IsTransient())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "394471e725f03ce7f21cbc8b2e6446bf", "score": "0.5046754", "text": "func (m *MockNotifierInterface) Notify() chan struct{} {\n\tret := m.ctrl.Call(m, \"Notify\")\n\tret0, _ := ret[0].(chan struct{})\n\treturn ret0\n}", "title": "" }, { "docid": "1db22eb4ef57d636556b235d0271493b", "score": "0.5044179", "text": "func (_m *DBClient) DeleteNotificationById(id string) errors.EdgeX {\n\tret := _m.Called(id)\n\n\tvar r0 errors.EdgeX\n\tif rf, ok := ret.Get(0).(func(string) errors.EdgeX); ok {\n\t\tr0 = rf(id)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(errors.EdgeX)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "30f54b00fe29d4624759e45511c2381c", "score": "0.5042383", "text": "func (_m *API) UpdateChannelMemberNotifications(channelId string, userId string, notifications map[string]string) (*model.ChannelMember, *model.AppError) {\n\tret := _m.Called(channelId, userId, notifications)\n\n\tvar r0 *model.ChannelMember\n\tif rf, ok := ret.Get(0).(func(string, string, map[string]string) *model.ChannelMember); ok {\n\t\tr0 = rf(channelId, userId, notifications)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*model.ChannelMember)\n\t\t}\n\t}\n\n\tvar r1 *model.AppError\n\tif rf, ok := ret.Get(1).(func(string, string, map[string]string) *model.AppError); ok {\n\t\tr1 = rf(channelId, userId, notifications)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(*model.AppError)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "1a462f96dc565fb4cd8bd225de028b0c", "score": "0.50344485", "text": "func TestMockEClassGetEAllReferences(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEAllReferences\").Once().Return(l)\n\to.On(\"GetEAllReferences\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEAllReferences())\n\tassert.Equal(t, l, o.GetEAllReferences())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "2d162985e5136abe06097310e041cc12", "score": "0.5034079", "text": "func assertEvents(t *testing.T) func() {\n\teventMock = mock.Mock{}\n\treturn func() {\n\t\tif !t.Failed() {\n\t\t\teventMock.AssertExpectations(t)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "59f9f68445ff6349cec7247b14ac3851", "score": "0.5032413", "text": "func (_m *Clienter) CommentOnEvent(_a0 func(map[string][]string, url.Values), _a1 map[string][]string) (*models.Comment, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 *models.Comment\n\tif rf, ok := ret.Get(0).(func(func(map[string][]string, url.Values), map[string][]string) *models.Comment); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*models.Comment)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(func(map[string][]string, url.Values), map[string][]string) error); ok {\n\t\tr1 = rf(_a0, _a1)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "be34126ce32eae5f48d8389158731a6d", "score": "0.503215", "text": "func (_m *Subscriber) SubscribeNotification(ctx context.Context, wg *sync.WaitGroup, ch chan<- interface{}) error {\n\tret := _m.Called(ctx, wg, ch)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *sync.WaitGroup, chan<- interface{}) error); ok {\n\t\tr0 = rf(ctx, wg, ch)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "40c2a11918d66e1583923d049c4c5d3c", "score": "0.50316024", "text": "func (_m *GqlFieldsProvider) ForEventDefinition() string {\n\tret := _m.Called()\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func() string); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "9906fd2b372d020efc5f4b5cb29cf827", "score": "0.5023462", "text": "func TestMockEClassGetEAllStructuralFeatures(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetEAllStructuralFeatures\").Once().Return(l)\n\to.On(\"GetEAllStructuralFeatures\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetEAllStructuralFeatures())\n\tassert.Equal(t, l, o.GetEAllStructuralFeatures())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "dcfbdee47a6d1e54083af4810b6b31da", "score": "0.5009867", "text": "func TestMockEReferenceIsResolveProxies(t *testing.T) {\n\to := &MockEReference{}\n\tr := bool(true)\n\to.On(\"IsResolveProxies\").Once().Return(r)\n\to.On(\"IsResolveProxies\").Once().Return(func() bool {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.IsResolveProxies())\n\tassert.Equal(t, r, o.IsResolveProxies())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "d6c70094d41acf51e350ba703b442b4c", "score": "0.5004294", "text": "func (m *MockICommunicationMethodRepository) AnyReference(arg0 context.Context, arg1 string) (bool, message.IMessage) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AnyReference\", arg0, arg1)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(message.IMessage)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ca8cf959fd760e72bfdf6abdb5fa70de", "score": "0.5003189", "text": "func mockFIIntermediaryFIAdvice() *FIIntermediaryFIAdvice {\n\tfiifia := NewFIIntermediaryFIAdvice()\n\tfiifia.Advice.AdviceCode = AdviceCodeLetter\n\tfiifia.Advice.LineOne = \"Line One\"\n\tfiifia.Advice.LineTwo = \"Line Two\"\n\tfiifia.Advice.LineThree = \"Line Three\"\n\tfiifia.Advice.LineFour = \"Line Four\"\n\tfiifia.Advice.LineFive = \"Line Five\"\n\tfiifia.Advice.LineSix = \"Line Six\"\n\treturn fiifia\n}", "title": "" }, { "docid": "ca8cf959fd760e72bfdf6abdb5fa70de", "score": "0.5003189", "text": "func mockFIIntermediaryFIAdvice() *FIIntermediaryFIAdvice {\n\tfiifia := NewFIIntermediaryFIAdvice()\n\tfiifia.Advice.AdviceCode = AdviceCodeLetter\n\tfiifia.Advice.LineOne = \"Line One\"\n\tfiifia.Advice.LineTwo = \"Line Two\"\n\tfiifia.Advice.LineThree = \"Line Three\"\n\tfiifia.Advice.LineFour = \"Line Four\"\n\tfiifia.Advice.LineFive = \"Line Five\"\n\tfiifia.Advice.LineSix = \"Line Six\"\n\treturn fiifia\n}", "title": "" }, { "docid": "d5cc1e00ea71948005ed0e46a6e75d8b", "score": "0.5001498", "text": "func (m *LeaderSessionMock) MinimockAbdicateInspect() {\n\tfor _, e := range m.AbdicateMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\tm.t.Errorf(\"Expected call to LeaderSessionMock.Abdicate with params: %#v\", *e.params)\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.AbdicateMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAbdicateCounter) < 1 {\n\t\tif m.AbdicateMock.defaultExpectation.params == nil {\n\t\t\tm.t.Error(\"Expected call to LeaderSessionMock.Abdicate\")\n\t\t} else {\n\t\t\tm.t.Errorf(\"Expected call to LeaderSessionMock.Abdicate with params: %#v\", *m.AbdicateMock.defaultExpectation.params)\n\t\t}\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcAbdicate != nil && mm_atomic.LoadUint64(&m.afterAbdicateCounter) < 1 {\n\t\tm.t.Error(\"Expected call to LeaderSessionMock.Abdicate\")\n\t}\n}", "title": "" }, { "docid": "4ee4bd2ee99be200936d76d404d83538", "score": "0.4999789", "text": "func (suite *AlarmsTestSuite) mockNewIncidentEmail() {\n\temailMock := new(email.Email)\n\tsuite.emailFactoryMock.On(\n\t\t\"NewIncidentEmail\",\n\t\tmock.AnythingOfType(\"*alarms.Incident\"),\n\t).Return(emailMock)\n\tsuite.emailServiceMock.On(\"Send\", emailMock).Return(nil)\n}", "title": "" }, { "docid": "fb5b25ed5aa0126ab52d1a04f73accb7", "score": "0.49994838", "text": "func mockSenderSupplied() *SenderSupplied {\n\tss := NewSenderSupplied()\n\tss.UserRequestCorrelation = \"User Req\"\n\tss.MessageDuplicationCode = MessageDuplicationOriginal\n\treturn ss\n}", "title": "" }, { "docid": "35cd5fe1f392d147d22004dbeeb214cf", "score": "0.4996232", "text": "func (_m *MockETypeParameter) EDeliver() bool {\n\tret := _m.Called()\n\n\tvar r0 bool\n\tif rf, ok := ret.Get(0).(func() bool); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(bool)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "9e27ec0130d67adcc552f9c7592d3b7a", "score": "0.49873212", "text": "func (_m *DBClient) NotificationsByLabel(offset int, limit int, label string) ([]models.Notification, errors.EdgeX) {\n\tret := _m.Called(offset, limit, label)\n\n\tvar r0 []models.Notification\n\tif rf, ok := ret.Get(0).(func(int, int, string) []models.Notification); ok {\n\t\tr0 = rf(offset, limit, label)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]models.Notification)\n\t\t}\n\t}\n\n\tvar r1 errors.EdgeX\n\tif rf, ok := ret.Get(1).(func(int, int, string) errors.EdgeX); ok {\n\t\tr1 = rf(offset, limit, label)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(errors.EdgeX)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "eb0002f6c889c8c2c563e99f6baf8a92", "score": "0.4982244", "text": "func (m *MockNotifier) EXPECT() *MockNotifierMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "eb0002f6c889c8c2c563e99f6baf8a92", "score": "0.4982244", "text": "func (m *MockNotifier) EXPECT() *MockNotifierMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "c9251477254a02ca9bf89de604022e51", "score": "0.49774113", "text": "func (_m *EmailNotifier) StockChanged(oldStock int, newStock int, email string) string {\n\tret := _m.Called(oldStock, newStock, email)\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func(int, int, string) string); ok {\n\t\tr0 = rf(oldStock, newStock, email)\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "4c6d0f3e941c55f8b5ffb59d486d7d76", "score": "0.49756032", "text": "func (m *MockNotifier) NotifyInflightAdded(delta int) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"NotifyInflightAdded\", delta)\n}", "title": "" }, { "docid": "d8b9bf77f7412c16821d56e183d3d5a2", "score": "0.4966818", "text": "func TestMockEClassGetESuperTypes(t *testing.T) {\n\to := &MockEClass{}\n\tl := &MockEList{}\n\t// return a value\n\to.On(\"GetESuperTypes\").Once().Return(l)\n\to.On(\"GetESuperTypes\").Once().Return(func() EList {\n\t\treturn l\n\t})\n\tassert.Equal(t, l, o.GetESuperTypes())\n\tassert.Equal(t, l, o.GetESuperTypes())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "22fb6d1a0a44f97228afc67719b07e27", "score": "0.49658507", "text": "func (mmMessage *mUpdateMockMessage) Set(f func() (i1 IncomingMessage)) *UpdateMock {\n\tif mmMessage.defaultExpectation != nil {\n\t\tmmMessage.mock.t.Fatalf(\"Default expectation is already set for the Update.Message method\")\n\t}\n\n\tif len(mmMessage.expectations) > 0 {\n\t\tmmMessage.mock.t.Fatalf(\"Some expectations are already set for the Update.Message method\")\n\t}\n\n\tmmMessage.mock.funcMessage = f\n\treturn mmMessage.mock\n}", "title": "" }, { "docid": "325d8a81e9e0edf4c7eefb65431f25fd", "score": "0.49641037", "text": "func (m *MockAnalyticsClient) Event(arg0 string, arg1 ...map[string]interface{}) error {\n\tvarargs := []interface{}{arg0}\n\tfor _, a := range arg1 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Event\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "4f788a96a7ad6ebd52568f9151f3586f", "score": "0.49574447", "text": "func (d SubscriptionDriverFetchPendingDeliveriesMockDescriptorWithReturn) Mock() (m SubscriptionDriverMock, assert func(t interface{ Errorf(string, ...interface{}) }) (ok bool)) {\n\td.methodDesc.done()\n\treturn d.methodDesc.mockDesc.Mock()\n}", "title": "" }, { "docid": "4c8d49db7e96888b76ae085ae35da806", "score": "0.49565122", "text": "func (m *mMessageBusMockRegister) Expect(p core.MessageType, p1 core.MessageHandler) *mMessageBusMockRegister {\n\tm.mockExpectations = &MessageBusMockRegisterParams{p, p1}\n\treturn m\n}", "title": "" }, { "docid": "2ae0359367a6d616b19a63235963a31c", "score": "0.49513823", "text": "func AssertOrderInfoRequired(obj OrderInfo) error {\n\treturn nil\n}", "title": "" }, { "docid": "6d0926a4f5f0826c0bcbc21b2093b936", "score": "0.49440858", "text": "func mockFIBeneficiaryFI() *FIBeneficiaryFI {\n\tfibfi := NewFIBeneficiaryFI()\n\tfibfi.FIToFI.LineOne = \"Line One\"\n\tfibfi.FIToFI.LineTwo = \"Line Two\"\n\tfibfi.FIToFI.LineThree = \"Line Three\"\n\tfibfi.FIToFI.LineFour = \"Line Four\"\n\tfibfi.FIToFI.LineFive = \"Line Five\"\n\tfibfi.FIToFI.LineSix = \"Line Six\"\n\treturn fibfi\n}", "title": "" }, { "docid": "e486bbf0d2c98d7ad65b2a0869ba2812", "score": "0.49402907", "text": "func (m *Mocknotifier) EXPECT() *MocknotifierMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "a9fa9f3d5e01e7ba10afe6d4a624533d", "score": "0.4938636", "text": "func (m *MessageBusMock) MinimockWait(timeout time.Duration) {\n\ttimeoutCh := time.After(timeout)\n\tfor {\n\t\tok := true\n\t\tok = ok && (m.MustRegisterFunc == nil || atomic.LoadUint64(&m.MustRegisterCounter) > 0)\n\t\tok = ok && (m.NewPlayerFunc == nil || atomic.LoadUint64(&m.NewPlayerCounter) > 0)\n\t\tok = ok && (m.NewRecorderFunc == nil || atomic.LoadUint64(&m.NewRecorderCounter) > 0)\n\t\tok = ok && (m.RegisterFunc == nil || atomic.LoadUint64(&m.RegisterCounter) > 0)\n\t\tok = ok && (m.SendFunc == nil || atomic.LoadUint64(&m.SendCounter) > 0)\n\t\tok = ok && (m.WriteTapeFunc == nil || atomic.LoadUint64(&m.WriteTapeCounter) > 0)\n\n\t\tif ok {\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-timeoutCh:\n\n\t\t\tif m.MustRegisterFunc != nil && atomic.LoadUint64(&m.MustRegisterCounter) == 0 {\n\t\t\t\tm.t.Error(\"Expected call to MessageBusMock.MustRegister\")\n\t\t\t}\n\n\t\t\tif m.NewPlayerFunc != nil && atomic.LoadUint64(&m.NewPlayerCounter) == 0 {\n\t\t\t\tm.t.Error(\"Expected call to MessageBusMock.NewPlayer\")\n\t\t\t}\n\n\t\t\tif m.NewRecorderFunc != nil && atomic.LoadUint64(&m.NewRecorderCounter) == 0 {\n\t\t\t\tm.t.Error(\"Expected call to MessageBusMock.NewRecorder\")\n\t\t\t}\n\n\t\t\tif m.RegisterFunc != nil && atomic.LoadUint64(&m.RegisterCounter) == 0 {\n\t\t\t\tm.t.Error(\"Expected call to MessageBusMock.Register\")\n\t\t\t}\n\n\t\t\tif m.SendFunc != nil && atomic.LoadUint64(&m.SendCounter) == 0 {\n\t\t\t\tm.t.Error(\"Expected call to MessageBusMock.Send\")\n\t\t\t}\n\n\t\t\tif m.WriteTapeFunc != nil && atomic.LoadUint64(&m.WriteTapeCounter) == 0 {\n\t\t\t\tm.t.Error(\"Expected call to MessageBusMock.WriteTape\")\n\t\t\t}\n\n\t\t\tm.t.Fatalf(\"Some mocks were not called on time: %s\", timeout)\n\t\t\treturn\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "90ffdc60861f14549d946f783ab3104f", "score": "0.4938459", "text": "func (_m *Device) Publish(event interface{}) error {\n\tret := _m.Called(event)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(interface{}) error); ok {\n\t\tr0 = rf(event)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "a34708d7f1e7ca2bc7e51890252052a3", "score": "0.49230632", "text": "func (m *MockWatcherConstructor) UnmarshalNotification(n []byte) (interface{}, error) {\n\tret := m.ctrl.Call(m, \"UnmarshalNotification\", n)\n\tret0, _ := ret[0].(interface{})\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "69df084f2d65390a85dd61e7ea34a3e7", "score": "0.49223316", "text": "func TestMockEClassIsAbstract(t *testing.T) {\n\to := &MockEClass{}\n\tr := bool(true)\n\to.On(\"IsAbstract\").Once().Return(r)\n\to.On(\"IsAbstract\").Once().Return(func() bool {\n\t\treturn r\n\t})\n\tassert.Equal(t, r, o.IsAbstract())\n\tassert.Equal(t, r, o.IsAbstract())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "bb0bb7d1bef1fb6fc33d79691573cf3f", "score": "0.4918957", "text": "func (m *mMessageBusMockMustRegister) Expect(p core.MessageType, p1 core.MessageHandler) *mMessageBusMockMustRegister {\n\tm.mockExpectations = &MessageBusMockMustRegisterParams{p, p1}\n\treturn m\n}", "title": "" } ]
6c4b5e65d6ab2533651f27d7c2c5bf2e
encrypts a given message with a provided RSA public key. the label must be the same for the encryption and decryption for it to work.
[ { "docid": "d8bccbf6cd1717d5a7bd4f286d056b1f", "score": "0.7167509", "text": "func encryptRSA(pub *rsa.PublicKey, message []byte) []byte {\n\tlabel := make([]byte, 10)\n\tencMessage, err := rsa.EncryptOAEP(sha512.New(), rand.Reader, pub, message, label)\n\tfmt.Println(encMessage)\n\tif err != nil {\n\t\tfmt.Println(\"encryption failed!: \", err)\n\t}\n\treturn encMessage\n}", "title": "" } ]
[ { "docid": "c276a2944460b17cfa9f520a9a5de5aa", "score": "0.66376936", "text": "func encryptWithPublicKey(msg []byte, pub *rsa.PublicKey) []byte {\n\thash := sha1.New()\n\tciphertext, err := rsa.EncryptOAEP(hash, rand.Reader, pub, msg, nil)\n\tif err != nil {\n\t\tlog.Panicln(err)\n\t}\n\treturn ciphertext\n}", "title": "" }, { "docid": "79904bd899dc91563cc5aa70c4ddf12d", "score": "0.65934813", "text": "func EncryptRSA(msg []byte, publicKey *rsa.PublicKey) ([]byte, error) {\n\tlabel := []byte(\"\")\n\thash := sha256.New()\n\tciphertext, err := rsa.EncryptOAEP(hash, rand.Reader, publicKey, msg, label)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to encrypt the message: %v\", err)\n\t}\n\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "c65a1aa3f25f45a6d82e3b7a94c8a23f", "score": "0.6539473", "text": "func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) []byte {\n\thash := sha256.New()\n\n\tciphertext, err := rsa.EncryptOAEP(hash, rand.Reader, pub, msg, nil)\n\tif err != nil {\n\t\tlog.Error(\"Unable to encrypt with public key %s\", err)\n\t}\n\treturn ciphertext\n}", "title": "" }, { "docid": "e33a6a2e0cd49a40bac8dcbac924ffdc", "score": "0.6537764", "text": "func EncryptWithPublicKey(message []byte, publicKey *rsa.PublicKey) []byte {\n\thash := sha1.New()\n\tcipherMessage, err := rsa.EncryptOAEP(hash, rand.Reader, publicKey, message, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn cipherMessage\n}", "title": "" }, { "docid": "d26e3c1261361357e32e816fdd56fb1a", "score": "0.6519667", "text": "func encrypt(plaintext []byte, pubKey *rsa.PublicKey) (string, error) {\n\tvar encrypted string\n\n\t// Creates a new encrypter using defaults\n\tencrypter, err := jose.NewEncrypter(jose.RSA_OAEP, jose.A128GCM, pubKey)\n\tif err != nil {\n\t\treturn encrypted, err\n\t}\n\t// Encrypts the plaintext value and serializes\n\t// as a JOSE string.\n\tobject, err := encrypter.Encrypt(plaintext)\n\tif err != nil {\n\t\treturn encrypted, err\n\t}\n\treturn object.CompactSerialize()\n}", "title": "" }, { "docid": "fa068cf059a901a554c95eda1993737a", "score": "0.6508217", "text": "func encryptRSA(name string, plaintext []byte) ([]byte, error) {\n\t// name: \"projects/PROJECT_ID/locations/global/keyRings/RING_ID/cryptoKeys/KEY_ID/cryptoKeyVersions/1\"\n\t// plaintext := []byte(\"Sample message\")\n\tctx := context.Background()\n\tclient, err := cloudkms.NewKeyManagementClient(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cloudkms.NewKeyManagementClient: %v\", err)\n\t}\n\n\t// Retrieve the public key from KMS.\n\tresponse, err := client.GetPublicKey(ctx, &kmspb.GetPublicKeyRequest{Name: name})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GetPublicKey: %v\", err)\n\t}\n\t// Parse the key.\n\tblock, _ := pem.Decode([]byte(response.Pem))\n\tabstractKey, err := x509.ParsePKIXPublicKey(block.Bytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"x509.ParsePKIXPublicKey: %+v\", err)\n\t}\n\trsaKey, ok := abstractKey.(*rsa.PublicKey)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"key %q is not RSA\", name)\n\t}\n\t// Encrypt data using the RSA public key.\n\tciphertext, err := rsa.EncryptOAEP(sha256.New(), rand.Reader, rsaKey, plaintext, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"rsa.EncryptOAEP: %v\", err)\n\t}\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "770c26f936dbd05aafe915b9a3e9a25d", "score": "0.6291142", "text": "func (r *RSA) PubEncrypt(b []byte) []byte {\n\tt := RSA{\n\t\tPubkey: r.Pubkey,\n\t}\n\n\treturn t.Encrypt(b)\n}", "title": "" }, { "docid": "46b055f9630d9ddbbfb603be0903c545", "score": "0.6242305", "text": "func EncryptWithPublicKey(message []byte, publicKey string) ([]byte, error) {\n\tkey, err := publicKeyStringToKey(publicKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tencrypted, err := rsa.EncryptPKCS1v15(rand.Reader, key, message)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"encrypt failed [%s]\", err)\n\t}\n\treturn encrypted, nil\n}", "title": "" }, { "docid": "0721c1052aa8b2d9164dc014f3c3bf64", "score": "0.61279404", "text": "func RSAEncrypt(pub *RSAPublicKey, buf []byte) ([]byte, error) {\n\tz := new(big.Int).SetBytes(buf)\n\tif z.Cmp(pub.n) > 0 {\n\t\treturn nil, errors.New(\"RSAEncrypt: too much data\")\n\t}\n\tz.Exp(z, pub.e, pub.n)\n\n\tres := make([]byte, size(pub.n))\n\tCopyRight(res, z.Bytes())\n\n\treturn res, nil\n}", "title": "" }, { "docid": "0721c1052aa8b2d9164dc014f3c3bf64", "score": "0.61279404", "text": "func RSAEncrypt(pub *RSAPublicKey, buf []byte) ([]byte, error) {\n\tz := new(big.Int).SetBytes(buf)\n\tif z.Cmp(pub.n) > 0 {\n\t\treturn nil, errors.New(\"RSAEncrypt: too much data\")\n\t}\n\tz.Exp(z, pub.e, pub.n)\n\n\tres := make([]byte, size(pub.n))\n\tCopyRight(res, z.Bytes())\n\n\treturn res, nil\n}", "title": "" }, { "docid": "bdd1988d4833525ed996f30daffaadc7", "score": "0.60963917", "text": "func (pgp *ArmoredKeyPair) Encrypt(plainBytes []byte) (string, error) {\n\treturn helper.EncryptBinaryMessageArmored(pgp.PublicKey, plainBytes)\n}", "title": "" }, { "docid": "4a62c9f5c0054571122ed615111abcf3", "score": "0.6066051", "text": "func EncryptRSA(pub *rsa.PublicKey, message []byte) ([]byte, error) {\n\tif pub == nil {\n\t\treturn nil, errors.New(ErrDontHavePublicKey)\n\t}\n\tencryptedMsg, err := rsa.EncryptOAEP(sha256.New(),\n\t\trand.Reader, pub, message, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn encryptedMsg, nil\n}", "title": "" }, { "docid": "f1c8e45a9bbd776166dd3ee0c79bc109", "score": "0.6031122", "text": "func RSAEncrypt(c, m, e, N *big.Int) {\n\treturn c.Exp(m, e, N)\n}", "title": "" }, { "docid": "123641129642e8e284d5d3e411edee2e", "score": "0.60273427", "text": "func Encrypt(msg []byte, pubKey *rsa.PublicKey) ([]byte, error) {\n\treturn rsa.EncryptOAEP(sha256.New(), rand.Reader, pubKey, msg, nil)\n}", "title": "" }, { "docid": "7da4d1b20e840330d42fa82a26d7c43f", "score": "0.60231656", "text": "func EncryptWithPublicKey(ciphertext []byte, pub *rsapk.PublicKey) ([]byte, error) {\n\thash := sha256.New()\n\tplaintext, err := rsapk.EncryptOAEP(hash, rand.Reader, pub, ciphertext, nil)\n\tif err != nil {\n\t\t//log.Error(err)\n\t\tlog.Fatalln(err)\n\t}\n\treturn plaintext, err\n}", "title": "" }, { "docid": "3ce253399262891a0c637343ff0ced1b", "score": "0.60090196", "text": "func EncryptRSA(pub *PublicKey, m []byte) ([]byte, error) {\n\t// Compute length of key in bytes, rounding up.\n\tkeyLen := (pub.N.BitLen() + 7) / 8\n\tif len(m) > keyLen-11 {\n\t\treturn nil, fmt.Errorf(\"len(m)=%v, too long\", len(m))\n\t}\n\n\t// Following RFC 2313, using block type 02 as recommended for encryption:\n\t// EB = 00 || 02 || PS || 00 || D\n\tpsLen := keyLen - len(m) - 3\n\teb := make([]byte, keyLen)\n\teb[0] = 0x00\n\teb[1] = 0x02\n\n\t// Fill PS with random non-zero bytes.\n\tfor i := 2; i < 2+psLen; {\n\t\t_, err := rand.Read(eb[i : i+1])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif eb[i] != 0x00 {\n\t\t\ti++\n\t\t}\n\t}\n\teb[2+psLen] = 0x00\n\n\t// Copy the message m into the rest of the encryption block.\n\tcopy(eb[3+psLen:], m)\n\n\t// Now the encryption block is complete; we take it as a m-byte big.Int and\n\t// RSA-encrypt it with the public key.\n\tmnum := new(big.Int).SetBytes(eb)\n\tc := encrypt(pub, mnum)\n\n\t// The result is a big.Int, which we want to convert to a byte slice of\n\t// length keyLen. It's highly likely that the size of c in bytes is keyLen,\n\t// but in rare cases we may need to pad it on the left with zeros (this only\n\t// happens if the whole MSB of c is zeros, meaning that it's more than 256\n\t// times smaller than the modulus).\n\tpadLen := keyLen - len(c.Bytes())\n\tfor i := 0; i < padLen; i++ {\n\t\teb[i] = 0x00\n\t}\n\tcopy(eb[padLen:], c.Bytes())\n\treturn eb, nil\n}", "title": "" }, { "docid": "96a303bcd01de78bdf62ac5ab4edb048", "score": "0.59828854", "text": "func (self *Message) encrypt(key *ecdsa.PublicKey) (err error) {\n\tself.Payload, err = ecies.Encrypt(crand.Reader, ecies.ImportECDSAPublic(key), self.Payload, nil, nil)\n\treturn\n}", "title": "" }, { "docid": "9c4a204aeb2b77fa622dd356240dbb06", "score": "0.5967514", "text": "func Encrypt(message []byte, publicKey *rsa.PublicKey) ([]byte, error) {\n\trnd := rand.Reader\n\treturn rsa.EncryptPKCS1v15(rnd, publicKey, message)\n}", "title": "" }, { "docid": "f2f6690d167b59ebe66a6688d313fd79", "score": "0.57941324", "text": "func EncryptOAEP(hash hash.Hash, random io.Reader, pub *PublicKey, msg []byte, label []byte) ([]byte, error) {}", "title": "" }, { "docid": "00d77c7e51e38761cfcfcf02ff819e70", "score": "0.57792413", "text": "func Encrypt(pubKey *PublicKey, msg []byte) big.Int {\n\tmsgBits := new(big.Int).SetBytes(msg)\n\n\tvar encrypted big.Int\n\tencrypted.Exp(msgBits, pubKey.E, pubKey.N)\n\n\treturn encrypted\n}", "title": "" }, { "docid": "812811ae4edd26df2eef448bc8b08033", "score": "0.5754036", "text": "func (e *EncryptedMessage) Encrypt(pubKey *rsa.PublicKey, data []byte) error {\n\thf, _, err := LookupHashFunction(e.HashType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tencData, err := rsa.EncryptOAEP(hf, rand.Reader, pubKey, data, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.CipherText = encData\n\treturn nil\n}", "title": "" }, { "docid": "bc8f2d90ccb2b914fecac5cccc60d098", "score": "0.5746182", "text": "func Encrypt(public abstract.Point, message []byte) (abstract.Point, abstract.Point) {\n\tM, _ := Suite.Point().Pick(message, Stream)\n\n\tk := Suite.Scalar().Pick(Stream)\n\talpha := Suite.Point().Mul(nil, k)\n\tS := Suite.Point().Mul(public, k)\n\tbeta := S.Add(S, M)\n\treturn alpha, beta\n}", "title": "" }, { "docid": "48c2196b59d5a94e1854df0c9dc9d034", "score": "0.5731743", "text": "func (swc *SWClient) encryptPO(random io.Reader, namespace string, hd *starwave.HierarchyDescriptor, perm *starwave.Permission, po bw2bind.PayloadObject) (bw2bind.PayloadObject, error) {\n\tcontents := po.GetContents()\n\tbuf := make([]byte, 4+len(contents))\n\tbinary.LittleEndian.PutUint32(buf[:4], uint32(po.GetPONum()))\n\tcopy(buf[4:], contents)\n\n\tcachekey := string(perm.Marshal(MarshalCompressed))\n\tvar entry *pubentry\n\tvar hit bool\n\tvar err error\n\tvar sk *starwave.DecryptionKey\n\tswc.pubmutex.RLock()\n\tif entry, hit = swc.pubcache[cachekey]; swc.cachedisabled || !hit {\n\t\tdisabled := swc.cachedisabled\n\t\tswc.pubmutex.RUnlock()\n\t\tentry = new(pubentry)\n\t\tif SignMessages {\n\t\t\tsk, err = swc.ObtainKey(namespace, perm, starwave.KeyTypeSignature)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t} else if sk == nil {\n\t\t\t\treturn nil, errors.New(\"Cannot obtain signing key for this URI\")\n\t\t\t}\n\t\t}\n\t\tentry.esymm, err = starwave.GenerateEncryptedSymmetricKey(random, hd, perm, sk, entry.symm[:])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif !disabled {\n\t\t\tswc.pubmutex.Lock()\n\t\t\tswc.pubcache[cachekey] = entry\n\t\t\tswc.pubmutex.Unlock()\n\t\t}\n\t} else {\n\t\tswc.pubmutex.RUnlock()\n\t}\n\n\tmessage, err := starwave.EncryptWithSymmetricKey(random, entry.esymm, entry.symm[:], buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tencrypted := new(bw2bind.PayloadObjectImpl)\n\tencrypted.SetPONum(bw2bind.PONumPOEncryptedSTARWAVE)\n\tencrypted.SetContents(message.Marshal(MarshalCompressed))\n\treturn encrypted, nil\n}", "title": "" }, { "docid": "adbcf7e8ab37e54de0b06cae9770721b", "score": "0.5690828", "text": "func (h MiMC) encrypt(circuit *cs.CS, message *cs.Constraint, key *cs.Constraint) *cs.Constraint {\n\tres := message\n\tfor i := 0; i < len(h.Params); i++ {\n\t\ttmp := circuit.ADD(res, h.Params[i], key)\n\t\t// res = (res+key+c)**-1\n\t\tres = circuit.INV(tmp)\n\t}\n\tres = circuit.ADD(res, key)\n\treturn res\n\n}", "title": "" }, { "docid": "b255cc5f95cd5c991d3fc3a4e7949122", "score": "0.56734896", "text": "func (keyPair *KeyPair) EncryptWithAlienPubKey(message string) (string, error) {\n\n\tif keyPair.alienPublicKey == nil {\n\t\treturn \"\", errors.New(ErrorPublicKey)\n\t}\n\n\tvar hash = sha256.New()\n\n\tcipherText, err := rsa.EncryptOAEP(\n\t\thash,\n\t\trand.Reader,\n\t\tkeyPair.alienPublicKey,\n\t\t[]byte(message),\n\t\t[]byte(DefaultMessageLabel),\n\t)\n\n\tkeyPair.secretMessage = cipherText\n\n\treturn hex.EncodeToString(cipherText), err\n}", "title": "" }, { "docid": "e24d644aac0c058c77e7b443162ce1c0", "score": "0.5663483", "text": "func (client *Client) RSAEncrypt(in []byte) ([]byte, error) {\n\t//return error for empty or nil input\n\tif in == nil || len(in) == 0 {\n\t\treturn nil, errors.New(\"Input cannot be empty or nil\")\n\t}\n\t//make sure the client has private keys\n\tif client.PrivateKey == \"\" {\n\t\treturn nil, errors.New(\"Client is missing private key\")\n\t}\n\n\t// Extract the PEM-encoded data block\n\tblock, _ := pem.Decode([]byte(client.PrivateKey))\n\tif block == nil {\n\t\treturn nil, errors.New(\"Bad key data: not PEM-encoded\")\n\t}\n\tif got, want := block.Type, \"RSA PRIVATE KEY\"; got != want {\n\t\treturn nil, errors.New(\"Unknown key type\")\n\t}\n\n\t//Decode the RSA private key\n\tpriv, err := x509.ParsePKCS1PrivateKey(block.Bytes)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Bad private key: \" + err.Error())\n\t}\n\n\tout, err := rsa.EncryptOAEP(sha256.New(), rand.Reader, &priv.PublicKey, in, nil)\n\n\treturn out, err\n}", "title": "" }, { "docid": "9aa8ac85083f077a4e8b88b99c17f970", "score": "0.56630355", "text": "func EncryptPKCS1v15(rand io.Reader, pub *PublicKey, msg []byte) ([]byte, error) {}", "title": "" }, { "docid": "35ef9589bfcf1f92f69df32cbf099adc", "score": "0.56601965", "text": "func EncryptRSA(data interface{}, cryptType string) (string, error) {\n\n\tpubkey, err := GetPubKey()\n\tif err != nil {\n\t\trevel.ERROR.Print(err)\n\t\treturn \"\", err\n\t}\n\n\tdataStr := \"\"\n\n\tswitch data.(type) {\n\tcase string:\n\t\tdataStr = data.(string)\n\tcase int16:\n\t\tdataStr = strconv.FormatInt(int64(data.(int16)), 10)\n\tcase int32:\n\t\tdataStr = strconv.FormatInt(int64(data.(int32)), 10)\n\tcase int64:\n\t\tdataStr = strconv.FormatInt(int64(data.(int64)), 10)\n\tcase float32:\n\t\tdataStr = strconv.FormatFloat(float64(data.(float32)), 'f', 6, 32)\n\tcase float64:\n\t\tdataStr = strconv.FormatFloat(data.(float64), 'f', 6, 64)\n\tcase bool:\n\t\tdataStr = strconv.FormatBool(data.(bool))\n\tdefault:\n\t\treturn \"\", errors.New(\"Unsupported type\")\n\t}\n\n\tvar bytesMsg = []byte(dataStr)\n\n\tif cryptType == \"oaep\" {\n\t\t/*\n\t\t\tvar label = []byte(\"test\")\n\t\t\tvar sha1hash = sha1.New()\n\n\t\t\tlog.Print(pubkey)\n\t\t\tencryptedmsg, err := rsa.EncryptOAEP(sha1hash, rand.Reader, &publicKey, bytesMsg, label)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tfmt.Printf(\"OAEP encrypted [%s] to \\n[%x]\\n\", string(bytesMsg), encryptedmsg)\n\t\t\t//responseMsg = string(encryptedmsg)\n\t\t*/\n\t}\n\tif cryptType == \"pkcs\" {\n\t}\n\n\t// EncryptPKCS1v15\n\tencryptedPKCS1v15, errPKCS1v15 := rsa.EncryptPKCS1v15(rand.Reader, pubkey, bytesMsg)\n\tif errPKCS1v15 != nil {\n\t\trevel.ERROR.Print(errPKCS1v15)\n\t\treturn \"\", errPKCS1v15\n\t}\n\n\treturn base64.URLEncoding.EncodeToString(encryptedPKCS1v15), nil\n}", "title": "" }, { "docid": "566bc4d3a3f7294b3e7148d77fef123d", "score": "0.5628445", "text": "func encryptSingle(username, plaintext string) (string, error) {\t\n\tvar result UserEntry\n\tfilter := bson.M{\"name\": username}\n\terr := collection.FindOne(context.Background(), filter).Decode(&result)\n\tif err != nil {\n\t\tlog.Printf(\"User does not exist or there was another problem: %v\", err)\n\t\treturn \"\", err\n\t}\n\t\n\tpublicKey := result.Public_key\n\ttrueN, _ := big.NewInt(0).SetString(publicKey.N, 0)\n\ttruePublicKey := &rsa.PublicKey{\n\t\tE: publicKey.E,\n\t\tN: trueN,\n\t}\n\tciphertextBytes, err := rsa.EncryptPKCS1v15(rand.Reader, truePublicKey, []byte(plaintext))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t//convert to hext for more readable encoding\n\tciphertext := hex.EncodeToString(ciphertextBytes)\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "fa36686b9fd5a5b52d9c809b10191cb8", "score": "0.562457", "text": "func (c *Client) encrypt(round int, ri *RoundInfo, me int, encryptKey PrivateKey) {\n\tif !ri.Encrypted[me] {\n\t\tprev := 0\n\t\tfor _, encrypted := range ri.Encrypted {\n\t\t\tif encrypted {\n\t\t\t\tprev++\n\t\t\t}\n\t\t}\n\t\tvar encryptedMessages []Msg\n\t\tfor i, m := range ri.Messages {\n\t\t\tif i == me {\n\t\t\t\tencryptedMessages = append(encryptedMessages, m.DeepCopy())\n\t\t\t} else {\n\t\t\t\tencryptedMessages = append(encryptedMessages, ri.Crypto.Encrypt(encryptKey, m))\n\t\t\t}\n\t\t}\n\t\top := EncryptedOp{\n\t\t\tId: c.Id,\n\t\t\tR: round,\n\t\t\tMessages: encryptedMessages,\n\t\t\tPrev: prev,\n\t\t}\n\t\tc.pending.add(op)\n\t}\n}", "title": "" }, { "docid": "84c3e79dcb975a9b776c076fa023251c", "score": "0.5621306", "text": "func EncryptMessage(pubKey *ecdsa.PublicKey, message []byte) ([]byte, error) {\n\t//TODO should a shared key be generated\n\t//TODO further research about ecies\n\t//TODO this might be further improved if the requester adds a different publicKey to the contract\n\n\t// prvKey, err := ecies.GenerateKey(rand.Reader, ethCrypto.S256(), nil)\n\t// if err != nil {\n\t// \treturn nil, errors.Wrap(err, \"could not generate ecies privateKey\")\n\t// }\n\n\t//\n\t// skLen := ecies.MaxSharedKeyLength(eciesPub) / 2\n\n\t// sharedKey, err := prvKey.GenerateShared(eciesPub, skLen, skLen)\n\t// if err != nil {\n\t// \treturn nil, errors.Wrap(err, \"could not generate ecies sharedKey\")\n\t// }\n\n\teciesPub := ecies.ImportECDSAPublic(pubKey)\n\tencryptedKey, err := ecies.Encrypt(rand.Reader, eciesPub, message, nil, nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not encrypt message\")\n\t}\n\n\treturn encryptedKey, nil\n}", "title": "" }, { "docid": "532f9240ac501303cab8b1f94e86880f", "score": "0.5619074", "text": "func Encrypt(publicKey *ecdsa.PublicKey, msg []byte) (cypherText []byte, err error) {\n\tif publicKey.Curve.Params().Name != \"P-256\" {\n\t\terr = fmt.Errorf(\"curve [%v] is not supported yet\", publicKey.Curve.Params().Name)\n\t\treturn nil, err\n\t}\n\n\tpub := libecies.ImportECDSAPublic(publicKey)\n\n\tct, err := libecies.Encrypt(rand.Reader, pub, msg, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ct, nil\n}", "title": "" }, { "docid": "114b327d59f6bb447bee4eb12fe14b91", "score": "0.5614137", "text": "func (client *Client) Encrypt(receiver *rsa.PublicKey, pack *Package, pow uint) *Package {\n\tvar (\n\t\tsession = GenerateBytes(uint(settings.SKEY_SIZE))\n\t\trand = GenerateBytes(uint(settings.RAND_SIZE))\n\t\thash = HashSum(bytes.Join(\n\t\t\t[][]byte{\n\t\t\t\trand,\n\t\t\t\tPublicKeyToBytes(client.PublicKey()),\n\t\t\t\tPublicKeyToBytes(receiver),\n\t\t\t\t[]byte(pack.Head.Title),\n\t\t\t\tpack.Body.Data,\n\t\t\t},\n\t\t\t[]byte{},\n\t\t))\n\t\tsign = Sign(client.PrivateKey(), hash)\n\t)\n\treturn &Package{\n\t\tHead: HeadPackage{\n\t\t\tRand: EncryptAES(session, rand),\n\t\t\tTitle: Base64Encode(EncryptAES(session, []byte(pack.Head.Title))),\n\t\t\tSender: EncryptAES(session, PublicKeyToBytes(client.PublicKey())),\n\t\t\tSession: EncryptRSA(receiver, session),\n\t\t},\n\t\tBody: BodyPackage{\n\t\t\tData: EncryptAES(session, pack.Body.Data),\n\t\t\tHash: hash,\n\t\t\tSign: EncryptAES(session, sign),\n\t\t\tNpow: ProofOfWork(hash, pow),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c18e656ee252bf09ba58b7c4b34883d6", "score": "0.56059587", "text": "func main() {\n\t// Generate a 2048-bits key pair\n\tprivateKey, publicKey := encryption.GenerateKeyPair(2048)\n\n\tfmt.Printf(\"Private Key: %v\\n\", privateKey)\n\tfmt.Printf(\"Public Key: %v\\n\", publicKey)\n\n\t// Create PEM string\n\tprivKeyStr := encryption.ExportPrivateKeyAsPEMStr(privateKey)\n\tpubKeyStr := encryption.ExportPubKeyAsPEMStr(publicKey)\n\n\tfmt.Println(privKeyStr)\n\tfmt.Println(pubKeyStr)\n\n\t// Save PEM string to a file.\n\tencryption.SaveKeyToFile(privKeyStr, \"privkey.pem\")\n\tencryption.SaveKeyToFile(pubKeyStr, \"pubkey.pem\")\n\n\tprivKeyFile := encryption.ExportPEMFileToPrivKey(\"privkey.pem\")\n\tfmt.Printf(\"Private Key: %v\\n\", privKeyFile)\n\n\t// This function uses the method OAEP to ensure that encrypting the same message twice does not result in the same ciphertext.\n\t// The message we want to encrypt. It must be shorter than the public modulus (2048 bits, in our case) minus twice the hash length (32 bytes) minus 2. For our case, the message must be 190 bytes at maximum.\n\tmessage := []byte(\"super secret message\")\n\tcipherText, err := rsa.EncryptOAEP(\n\t\tsha256.New(),\n\t\trand.Reader,\n\t\tpublicKey,\n\t\tmessage,\n\t\tnil,\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Encrypted message: \", cipherText)\n\n\t// Dectrypt the message using ras.DecryptOAEP function.\n\tdecMessage, err := rsa.DecryptOAEP(sha256.New(), rand.Reader, privateKey, cipherText, nil)\n\tfmt.Printf(\"Original: %s\\n\", decMessage)\n\n\t// Sign the message using rsa.SignPSS\n\tmsgHash := sha256.New()\n\tmsgHash.Write(message)\n\tmsgHashSum := msgHash.Sum(nil)\n\t// We have to provide a random reader, so every time we sign, we have a different signature.\n\tsignature, _ := rsa.SignPSS(rand.Reader, privateKey, crypto.SHA256, msgHashSum, nil)\n\n\t// Verify the signature\n\terr = rsa.VerifyPSS(publicKey, crypto.SHA256, msgHashSum, signature, nil)\n\tif err != nil {\n\t\tfmt.Println(\"Verification failed: \", err)\n\t} else {\n\t\tfmt.Println(\"Message verified.\")\n\t}\n}", "title": "" }, { "docid": "2ad96e94c3b5141a3a8b273ffcb5deb6", "score": "0.55698466", "text": "func (publicKey *PublicKey) Encrypt(data []byte) ([]byte, error) {\n\t// Pick r in {0, ..., A-1} randomly\n\tr, err := utils.RandomInt(publicKey.a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Compute c1 = g^r\n\tc1, err := publicKey.g.Exp(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Compute c2 = f^m*h^r\n\tmessage := new(big.Int).SetBytes(data)\n\t// Check message in [0,p-1]\n\terr = utils.InRange(message, big0, publicKey.p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc2, err := publicKey.f.Exp(message)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// h^r\n\thPower, err := publicKey.h.Exp(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc2, err = c2.Composition(hPower)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// build proof\n\tproof, err := publicKey.buildProof(message, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmsg := &EncryptedMessage{\n\t\tM1: c1.ToMessage(),\n\t\tM2: c2.ToMessage(),\n\t\tProof: proof,\n\t}\n\treturn proto.Marshal(msg)\n}", "title": "" }, { "docid": "b626c84336e9ea3882de33ae46a12c31", "score": "0.55425453", "text": "func Encrypt(rng io.Reader, pub *PublicKey, msg []byte) (Y, R, A, s *big.Int, err error) {\n\tpLen := (pub.P.BitLen() + 7) / 8\n\tif len(msg) > pLen-11 {\n\t\terr = errors.New(\"message too long\")\n\t\treturn\n\t}\n\n\t// EM = 0x02 || PS || 0x00 || M\n\tem := make([]byte, pLen-1)\n\tem[0] = 2\n\tps, mm := em[1:len(em)-len(msg)-1], em[len(em)-len(msg):]\n\terr = nonZeroRandomBytes(ps, rng)\n\tif err != nil {\n\t\treturn\n\t}\n\tem[len(em)-len(msg)-1] = 0\n\tcopy(mm, msg)\n\n\tM := new(big.Int).SetBytes(em)\n\n\t// r ← $ℤp*\n\tr, err := rand.Int(rng, pub.P)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// a ← $ℤp*\n\ta, err := rand.Int(rng, pub.P)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// R = G^r\n\tR = new(big.Int).Exp(pub.G, r, pub.P)\n\n\t// R′ = X^r\n\tRprime := new(big.Int).Exp(pub.H, r, pub.P)\n\n\t// Y = MR′\n\tY = new(big.Int).Mul(M, Rprime)\n\n\t// A = G^a\n\tA = new(big.Int).Exp(pub.G, a, pub.P)\n\n\t// A′ = X^a\n\tAprime := new(big.Int).Exp(pub.H, a, pub.P)\n\n\t// c = h(Y, R, R′, A, A′)\n\tc := hc(pub.Hash, Y, R, Rprime, A, Aprime)\n\n\t// s = a + cr\n\ts = new(big.Int).Mul(c, r) // NOT ACTUALLY MOD P DESPITE WHAT THE PAPER SAYS\n\ts.Add(s, a)\n\n\treturn\n}", "title": "" }, { "docid": "dad3fcd8e3cc5c7e176e1bc09629a1a2", "score": "0.55274355", "text": "func encodePublicKey(key []byte) string {\n blk := &pem.Block{\n Type: \"PUBLIC KEY\",\n Bytes: key,\n }\n\n return string(pem.EncodeToMemory(blk))\n}", "title": "" }, { "docid": "3f1b22f528e87279874d70766f678837", "score": "0.5506023", "text": "func Encrypt(pubKey []byte, policy string, message []byte) ([]byte, []byte, error) {\n\tvar (\n\t\tpub *C.bswabe_pub_t\n\t\tpubArr *C.GByteArray\n\t)\n\n\t//parse policy\n\tcPolicy := C.parse_policy_lang(C.CString(policy))\n\tdefer C.free(unsafe.Pointer(cPolicy))\n\n\t//parse public key\n\tpubArr = C.g_byte_array_new()\n\tC.g_byte_array_set_size(pubArr, C.uint(len(pubKey)))\n\tmemcpy(pubArr.data, pubKey)\n\tpub = C.bswabe_pub_unserialize(pubArr, 1)\n\tdefer C.bswabe_pub_free(pub)\n\n\tm := C.newArr()\n\n\t//encrypt key with policy\n\tcph := C.bswabe_enc(pub, &m, cPolicy)\n\tif cph == nil {\n\t\terr := C.bswabe_error()\n\t\treturn nil, nil, fmt.Errorf(\"could not encrypt: %v\", C.GoString(err))\n\t}\n\tdefer C.element_clear(&m)\n\tdefer C.bswabe_cph_free(cph)\n\n\t//serialize encrypted key\n\tcphBuf := C.bswabe_cph_serialize(cph)\n\tdefer C.g_byte_array_free(cphBuf, 1)\n\tcphData := C.GoBytes(unsafe.Pointer(cphBuf.data), C.int(cphBuf.len))\n\n\t//convert plain text\n\tplt := C.g_byte_array_new()\n\tmsgBytes := []byte(message)\n\tC.g_byte_array_set_size(plt, C.uint(len(msgBytes)))\n\tmemcpy(plt.data, msgBytes)\n\tdefer C.g_byte_array_free(plt, 1)\n\n\t//encrypt plain text\n\taesBuf := C.aes_128_cbc_encrypt(plt, &m)\n\tdefer C.g_byte_array_free(aesBuf, 1)\n\taesData := C.GoBytes(unsafe.Pointer(aesBuf.data), C.int(aesBuf.len))\n\n\treturn cphData, aesData, nil\n}", "title": "" }, { "docid": "3630594d96670e13985c2ac44efde7c2", "score": "0.549076", "text": "func encrypt(pub *PublicKey, m *big.Int) *big.Int {\n\tc := new(big.Int)\n\tc.Exp(m, pub.E, pub.N)\n\treturn c\n}", "title": "" }, { "docid": "379557baf0b58fbb96a3d1e5b89da275", "score": "0.54575306", "text": "func AsymmetricEncrypt(input []byte, key *rsa.PublicKey) ([]byte, error) {\n\toutput, err := rsa.EncryptOAEP(sha256.New(), rand.Reader, key, input, nil)\n\treturn output, err\n}", "title": "" }, { "docid": "5056fb8cafb3bb01d29443e061613a7d", "score": "0.54140216", "text": "func (u *User) Encrypt(message string) string {\n\tencBuf := bytes.NewBuffer(nil)\n\n // Once the data has been encrypted, stream to the armorer\n armorer, err := armor.Encode(encBuf, \"PGP MESSAGE\", map[string]string{\n \"Sent-By\": \"slackbot\",\n \"To-Slack-User\": u.Username,\n })\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n // Encrypt data from plaintext\n entityList, err := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(u.PublicKey))\n\tencrypter, err := openpgp.Encrypt(armorer, entityList, nil, nil, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_, err = encrypter.Write([]byte(message))\n\n\tencrypter.Close()\n\tarmorer.Close()\n\n return string(encBuf.Bytes())\n}", "title": "" }, { "docid": "a17781309bc1845d7aca3464f677c29f", "score": "0.539781", "text": "func encrypt(plaintext []byte, key []byte) (string, error) {\n\tc, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tgcm, err := cipher.NewGCM(c)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn \"\", err\n\t}\n\tciphertext := gcm.Seal(nonce, nonce, plaintext, nil)\n\treturn base64.URLEncoding.EncodeToString(ciphertext),nil\n}", "title": "" }, { "docid": "bcee123ae36da6b4b0c33fb0a5a8e6ea", "score": "0.53714794", "text": "func (p Crypto) RsaEncrypt(plainText []byte, N string) string {\n\tpubN := parse2bigInt(N)\n\tpub := &rsa.PublicKey{\n\t\tN: pubN,\n\t\tE: 65537,\n\t}\n\tcipherText, err := rsa.EncryptPKCS1v15(rand.Reader, pub, plainText)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn hex.EncodeToString(cipherText)\n}", "title": "" }, { "docid": "28c60f87e6b55fe1b686b0b3ede797ab", "score": "0.5370668", "text": "func (c *Crypto) Encrypt(message []byte) ([]byte, error) {\n\tencrypted, err := rsa.EncryptPKCS1v15(rand.Reader, &c.PrivateKey.PublicKey, message)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn encrypted, nil\n}", "title": "" }, { "docid": "c8d922796703ccf8862e63ee9683b938", "score": "0.5350779", "text": "func Encrypt(pubkey *PublicKey, msg []byte) ([]byte, error) {\n\tvar ct bytes.Buffer\n\n\t// Generate ephemeral key\n\tek, err := GenerateKey()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tct.Write(ek.PublicKey.Bytes(false))\n\n\t// Derive shared secret\n\tss, err := ek.Encapsulate(pubkey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// AES encryption\n\tblock, err := aes.NewCipher(ss)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create new aes block: %w\", err)\n\t}\n\n\tnonce := make([]byte, 16)\n\tif _, err := rand.Read(nonce); err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot read random bytes for nonce: %w\", err)\n\t}\n\n\tct.Write(nonce)\n\n\taesgcm, err := cipher.NewGCMWithNonceSize(block, 16)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create aes gcm: %w\", err)\n\t}\n\n\tciphertext := aesgcm.Seal(nil, nonce, msg, nil)\n\n\ttag := ciphertext[len(ciphertext)-aesgcm.NonceSize():]\n\tct.Write(tag)\n\tciphertext = ciphertext[:len(ciphertext)-len(tag)]\n\tct.Write(ciphertext)\n\n\treturn ct.Bytes(), nil\n}", "title": "" }, { "docid": "41438d8e657bb058019af7e284a7598d", "score": "0.5342278", "text": "func (g Gentry) Encrypt(params, message []byte, id [][]byte) (c1, c2 []byte, err error) {\n\tvar p gentryParams\n\tif err = p.GobDecode(params); err != nil {\n\t\treturn\n\t}\n\n\tP := make([]*pbc.Element, len(id))\n\tfor i := 0; i < len(id); i++ {\n\t\tP[i] = pairing.NewG1().SetFromStringHash(string(bytes.Join(id[:i+1], nil)), sha256.New())\n\t}\n\n\tr := pairing.NewZr().Rand()\n\n\t// TODO: Hash pairing result (H_2 oracle in the paper).\n\tpaired := pairing.NewGT().Pair(p.Q0, P[0])\n\th := pairing.NewGT().MulZn(paired, r).Bytes()\n\tc1 = primitives.Xor(message, h)\n\n\tct := gentryCiphertext{}\n\tct.U = make([]*pbc.Element, len(id)+1)\n\tct.U[0] = pairing.NewG1().MulZn(p.P0, r)\n\tct.U[1] = nil\n\tfor i := 2; i <= len(id); i++ {\n\t\tct.U[i] = pairing.NewG1().MulZn(P[i-1], r)\n\t}\n\n\tc2, err = ct.GobEncode()\n\treturn\n}", "title": "" }, { "docid": "8a4345727249722ff108d86a365e0630", "score": "0.5330042", "text": "func publicRSAKeyEqual(a, b *rsa.PublicKey) bool {\n\treturn bigIntEq(a.N, b.N) && a.E == b.E\n}", "title": "" }, { "docid": "060be2ee2bf1a889f1612efe6e98a9fb", "score": "0.53297955", "text": "func rsaPublicEncryptOAEP(pubKey *rsa.PublicKey, plaintext []byte) ([]byte, string, error) {\n\tvar hashfunc hash.Hash\n\thashalg := OAEPDefaultHash\n\n\t// for SoftHSM support we allow the user to choose sha1 as the hash algorithm\n\tswitch strings.ToLower(os.Getenv(\"OCICRYPT_OAEP_HASHALG\")) {\n\tcase \"sha1\":\n\t\thashfunc = sha1.New()\n\t\thashalg = \"sha1\"\n\tdefault:\n\t\thashfunc = sha256.New()\n\t}\n\tciphertext, err := rsa.EncryptOAEP(hashfunc, rand.Reader, pubKey, plaintext, OAEPLabel)\n\tif err != nil {\n\t\treturn nil, \"\", errors.Wrapf(err, \"rss.EncryptOAEP failed\")\n\t}\n\n\treturn ciphertext, hashalg, nil\n}", "title": "" }, { "docid": "39adf304b7866234719fdebe1d04d6cb", "score": "0.53120536", "text": "func (k NaclSigningKeyPair) EncryptToString(plaintext []byte, sender GenericKey) (ciphertext string, err error) {\n\terr = KeyCannotEncryptError{}\n\treturn\n}", "title": "" }, { "docid": "316936e23cc461968dbf551e6f76881e", "score": "0.5310971", "text": "func EncryptPKCS1v15(rand io.Reader, pub *PublicKey, msg []byte) (out []byte, err error) {\n\tif err := checkPub(pub); err != nil {\n\t\treturn nil, err\n\t}\n\tk := (pub.N.BitLen() + 7) / 8\n\tif len(msg) > k-11 {\n\t\terr = ErrMessageTooLong\n\t\treturn\n\t}\n\n\t// EM = 0x00 || 0x02 || PS || 0x00 || M\n\tem := make([]byte, k)\n\tem[1] = 2\n\tps, mm := em[2:len(em)-len(msg)-1], em[len(em)-len(msg):]\n\terr = nonZeroRandomBytes(ps, rand)\n\tif err != nil {\n\t\treturn\n\t}\n\tem[len(em)-len(msg)-1] = 0\n\tcopy(mm, msg)\n\n\tm := new(big.Int).SetBytes(em)\n\tc := encrypt(new(big.Int), pub, m)\n\n\tcopyWithLeftPad(em, c.Bytes())\n\tout = em\n\treturn\n}", "title": "" }, { "docid": "1df349cc2ab0435d0f3583a2e229eb1d", "score": "0.52845466", "text": "func (pk *PublicKey) EncryptWithR(m *big.Int, r *big.Int) *Ciphertext {\n\n\tnSquare := pk.GetNSquare()\n\n\t// g is _always_ equal n+1\n\t// Threshold encryption is safe only for g=n+1 choice.\n\t// See [DJN 10], section 5.1\n\tg := new(big.Int).Add(pk.N, big.NewInt(1))\n\tgmpG := gmp.NewInt(0).SetBytes(g.Bytes())\n\tgmpM := gmp.NewInt(0).SetBytes(m.Bytes())\n\tgmpN := gmp.NewInt(0).SetBytes(pk.N.Bytes())\n\tgmpN2 := gmp.NewInt(0).SetBytes(nSquare.Bytes())\n\tgmpR := gmp.NewInt(0).SetBytes(r.Bytes())\n\tgm := new(gmp.Int).Exp(gmpG, gmpM, gmpN2)\n\trn := new(gmp.Int).Exp(gmpR, gmpN, gmpN2)\n\tc := new(gmp.Int).Mod(new(gmp.Int).Mul(rn, gm), gmpN2)\n\treturn &Ciphertext{new(big.Int).SetBytes(c.Bytes())}\n}", "title": "" }, { "docid": "9b82a5b53c505d260e0f27b17ab83328", "score": "0.52415055", "text": "func (pk *PublicKey) Encrypt(m *big.Int) *Ciphertext {\n\n\tvar r *big.Int\n\tvar err error\n\tfor {\n\t\tr, err = GetRandomNumberInMultiplicativeGroup(pk.N, rand.Reader)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn pk.EncryptWithR(m, r)\n}", "title": "" }, { "docid": "d7f59bbc450bef7cb29fba6761dc6c8c", "score": "0.52231884", "text": "func (sk *SymKey) Encrypt(src []byte) (*Message, error) {\n\trawKey, err := sk.rawKey()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblock, err := aes.NewCipher(rawKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taead, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tiv := make([]byte, aead.NonceSize())\n\tif _, err := rand.Read(iv); err != nil {\n\t\treturn nil, err\n\t}\n\n\tivString := Base64URLEncode(iv)\n\n\tencData := aead.Seal(nil, iv, src, nil)\n\n\tm := &Message{\n\t\tData: encData,\n\t\tKID: sk.KID,\n\t\tKeyType: KeyTypeSymmetric,\n\t\tIV: ivString,\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "0340f455aae3012dd6980584b6b2f889", "score": "0.5217853", "text": "func MarshalPKCS1PublicKey(key *rsa.PublicKey) []byte {}", "title": "" }, { "docid": "d664f1d49713c72b94dbe16eb012e285", "score": "0.52038217", "text": "func encrypt(stringToEncrypt string, key []byte) (string, error) {\n\tplaintext := []byte(stringToEncrypt)\n\n\t//Create a new Cipher Block from the key\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t//Create a new GCM - https://en.wikipedia.org/wiki/Galois/Counter_Mode\n\t//https://golang.org/pkg/crypto/cipher/#NewGCM\n\taesGCM, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t//Create a nonce. Nonce should be from GCM\n\tnonce := make([]byte, aesGCM.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn \"\", err\n\t}\n\n\t//Encrypt the data using aesGCM.Seal\n\t//Since we don't want to save the nonce somewhere else in this case, we add it as a prefix to the encrypted data. The first nonce argument in Seal is the prefix.\n\tciphertext := aesGCM.Seal(nonce, nonce, plaintext, nil)\n\treturn fmt.Sprintf(\"%x\", ciphertext), nil\n}", "title": "" }, { "docid": "4ebb5ff703191faa0144118d3fa67a54", "score": "0.5203106", "text": "func (c *DMCFEClient) Encrypt(x *big.Int, label string) (*bn256.G1, error) {\n\tu := hash([]byte(label))\n\tct, err := u.Dot(c.s)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error computing inner product\")\n\t}\n\tct.Add(ct, x)\n\tct.Mod(ct, bn256.Order)\n\n\treturn new(bn256.G1).ScalarBaseMult(ct), nil\n}", "title": "" }, { "docid": "ce83588371fad7c5220def287e417ed0", "score": "0.5201888", "text": "func (pk *RsaPublicKey) Encrypt(b []byte) ([]byte, error) {\n\treturn rsa.EncryptPKCS1v15(rand.Reader, pk.k, b)\n}", "title": "" }, { "docid": "321b27d78e56fea7e752bd9cc6efee16", "score": "0.5175252", "text": "func EncryptPKCS1v15(rand io.Reader, priv *rsa.PrivateKey, msg []byte) ([]byte, error) {\n\tmaybeReadByte(rand)\n\n\tif err := checkPub(&priv.PublicKey); err != nil {\n\t\treturn nil, err\n\t}\n\tk := priv.PublicKey.Size()\n\tif len(msg) > k-11 {\n\t\treturn nil, rsa.ErrMessageTooLong\n\t}\n\n\t// EM = 0x00 || 0x02 || PS || 0x00 || M\n\tem := make([]byte, k)\n\tem[1] = 2\n\tps, mm := em[2:len(em)-len(msg)-1], em[len(em)-len(msg):]\n\terr := nonZeroRandomBytes(ps, rand)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tem[len(em)-len(msg)-1] = 0\n\tcopy(mm, msg)\n\n\tm := new(big.Int).SetBytes(em)\n\tc := RsaEncrypt(m, priv.D, priv.N)\n\n\tcopyWithLeftPad(em, c.Bytes())\n\treturn em, nil\n}", "title": "" }, { "docid": "60a0d4b481efd74aa67f8652b0ad5cdf", "score": "0.5167972", "text": "func (symmetricKey *SymmetricKey) Encrypt(message *PlainMessage) (*PGPMessage, error) {\n\tencrypted, err := symmetricEncrypt(message.GetBinary(), symmetricKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewPGPMessage(encrypted), nil\n}", "title": "" }, { "docid": "8dce6660108e68bd845c21958deaa7bf", "score": "0.5154694", "text": "func (s *session) RatchetEncrypt(plaintext, ad []byte) Message {\n\tvar (\n\t\th = MessageHeader{\n\t\t\tDH: s.DHs.PublicKey(),\n\t\t\tN: s.SendCh.N,\n\t\t\tPN: s.PN,\n\t\t}\n\t\tmk = s.SendCh.step()\n\t)\n\tct := s.Crypto.Encrypt(mk, plaintext, append(ad, h.Encode()...))\n\treturn Message{h, ct}\n}", "title": "" }, { "docid": "388bec43ae00763667c3f622659b71d9", "score": "0.51435167", "text": "func PacketEncrypt(senderPrivateKey *btcec.PrivateKey, receiverPublicKey *btcec.PublicKey, packet *PacketRaw) (raw []byte, err error) {\r\n\tgarbage := packetGarbage(packetLengthMin + len(packet.Payload))\r\n\traw = make([]byte, packetLengthMin+len(packet.Payload)+len(garbage))\r\n\r\n\tnonceC := rand.Uint32()\r\n\tnonce := make([]byte, 8)\r\n\tbinary.LittleEndian.PutUint32(nonce[0:4], nonceC)\r\n\tbinary.LittleEndian.PutUint32(nonce[4:8], nonceC)\r\n\tcopy(raw[0:4], nonce[0:4])\r\n\r\n\traw[4] = packet.Protocol\r\n\traw[5] = packet.Command\r\n\r\n\tbinary.LittleEndian.PutUint16(raw[6:8], uint16(len(packet.Payload)))\r\n\tcopy(raw[8:], packet.Payload)\r\n\tcopy(raw[8+len(packet.Payload):8+len(packet.Payload)+len(garbage)], garbage)\r\n\r\n\t// encrypt it using Salsa20\r\n\tkeySalsa := publicKeyToSalsa20Key(receiverPublicKey)\r\n\tsalsa20.XORKeyStream(raw[4:8+len(packet.Payload)+len(garbage)], raw[4:8+len(packet.Payload)+len(garbage)], nonce, keySalsa)\r\n\r\n\t// add signature\r\n\tsignature, err := btcec.SignCompact(btcec.S256(), senderPrivateKey, hashData(raw[:len(raw)-signatureSize]), true)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tsalsa20.XORKeyStream(signature[:], signature[:], nonce, keySalsa)\r\n\tcopy(raw[len(raw)-signatureSize:], signature)\r\n\r\n\treturn raw, nil\r\n}", "title": "" }, { "docid": "eec26d85863bc53436f425be74324802", "score": "0.51385164", "text": "func (e2e encryptionState) encryptMessage(strobeState []byte, msg *plaintextMsg) (*s.Request_Message, []byte, error) {\n\t// check for arbitrary 1000 bytes of room for headers and protobuff structure\n\tif len(msg.Content) > 65535-1000 {\n\t\treturn nil, nil, errors.New(\"ssyk: message to send is too large\")\n\t}\n\n\t// recover strobe state\n\ts1 := strobe.RecoverState(strobeState)\n\t// data to authenticate [convoId(8), sendPubKey(32), recvPubKey(32)]\n\t// TODO: what else should we authenticate here?\n\ttoAuthenticate := make([]byte, 16+32+32)\n\tconvoId, err := hex.DecodeString(msg.ConvoId)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tbobPubKey, err := hex.DecodeString(msg.ToAddress)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// TODO: authenticate the date so that server cannot re-order\n\tcopy(toAuthenticate[0:16], convoId)\n\tcopy(toAuthenticate[16:16+32], e2e.keyPair.PublicKey[:])\n\tcopy(toAuthenticate[16+32:16+32+32], bobPubKey)\n\t// TODO: use disco.symmetric encrypt with nonce-based (so no need to update the state after)\n\t// encrypt message\n\tciphertext := s1.Send_AEAD([]byte(msg.Content), toAuthenticate)\n\t// create return value\n\tencryptedMessage := &s.Request_Message{\n\t\tToAddress: msg.ToAddress,\n\t\tConvoId: msg.ConvoId,\n\t\tContent: ciphertext,\n\t}\n\t// return ciphertext\n\treturn encryptedMessage, s1.Serialize(), nil\n}", "title": "" }, { "docid": "0e74382c5c606d652290d12c02871b4f", "score": "0.512325", "text": "func encryptTheMessage(req Request) (Response, error) {\n\tusername := req.User\n\tpassword := req.Password\n\tfmt.Println(req.Message)\n\tvar result UserEntry\n\tfilter := bson.M{\"name\": username, \"password\": password}\n\terr := collection.FindOne(context.Background(), filter).Decode(&result)\n\tif err != nil {\n\t\tlog.Printf(\"User does not exist or there was another problem: %v\", err)\n\t\treturn Response{}, err\n\t}\n\trecipients := req.Recipients\n\tvar ciphertext string\n\tfor _, recipient := range recipients {\n\t\tencryptedMessage, err := encryptSingle(recipient, req.Message)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Problem encrypting the message: %v\", err)\n\t\t\treturn Response{}, err\n\t\t}\n\t\tciphertext = ciphertext+ \" \"+recipient+\":\"+encryptedMessage\t\n\t}\n\tresponse := Response{\n\t\tMessage: ciphertext,\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "865a3bc85d46f2ec268c51a41c9fe40c", "score": "0.511523", "text": "func TestCrypto() {\n\tkey := createRSA(2048)\n\tmessage := []byte(\"this is a test message\")\n\tfmt.Println(len(message))\n\tencMessage := encryptRSA(&key.PublicKey, message)\n\tdecMessage := decryptRSA(key, encMessage)\n\tfmt.Println(\"message is: {\", string(message[:]), \"}\\ndecrypted message is: {\", string(decMessage[:]), \"}\")\n\tif len(message) == len(decMessage) {\n\t\tfmt.Printf(\"It worked!\\n\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "3eb7dac2d3937cd58e4fe1034179031a", "score": "0.50983596", "text": "func (t *RSA) PackGivenP(p *fmp.Fmpz) {\n\tq := new(fmp.Fmpz).Div(t.Key.N, p)\n\tt.Key.Primes = []*fmp.Fmpz{p, q}\n\tt.Key.D = ln.SolveforD(p, q, t.Key.PublicKey.E)\n\n\tif t.Verbose {\n\t\tfor i, prime := range t.Key.Primes {\n\t\t\tfmt.Printf(\"Prime %d: %v\\n\", i, prime)\n\t\t}\n\t}\n\n\t// Pack the Plaintext if a Ciphertext was provided.\n\tif t.CipherText != nil && t.PlainText == nil {\n\t\tt.PlainText = ln.NumberToBytes(new(fmp.Fmpz).Exp(ln.BytesToNumber(t.CipherText), t.Key.D, t.Key.PublicKey.N))\n\t}\n}", "title": "" }, { "docid": "2c37af2175b47e390a79b0272b5148fc", "score": "0.5092485", "text": "func EncryptWithID(key, message []byte, sender uint32) ([]byte, error) {\n\tbuf := make([]byte, 4)\n\tbinary.BigEndian.PutUint32(buf, sender)\n\n\t// 代码是需要重构的\n\tc, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, ErrEncrypt\n\t}\n\tgcm, err := cipher.NewGCM(c)\n\tif err != nil {\n\t\treturn nil, ErrEncrypt\n\t}\n\tnonce, err := GenerateNonce()\n\tif err != nil {\n\t\treturn nil, ErrEncrypt\n\t}\n/*\n\tfor n := range nonce{\n\t\t// 待测试\n\t\tbuf = append(buf, byte(n))\n\t}\n*/\n\tbuf = append(buf, nonce...)\n\tout := gcm.Seal(buf, nonce, message, message[:4])\n\treturn out, nil\n}", "title": "" }, { "docid": "1b1b22882a4cd70248313dff87139edd", "score": "0.5082393", "text": "func (wallet *HDWallet) EncryptMessage(body []byte, recipientUncompressedPubkey string) ([]byte, error) {\n\tpubkeyBytes, err := hex.DecodeString(recipientUncompressedPubkey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpublicKey, err := btcec.ParsePubKey(pubkeyBytes, btcec.S256())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsigningKey, err := wallet.signingPrivateKey()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn encrypt(body, signingKey, publicKey)\n}", "title": "" }, { "docid": "75af1014c4f705c093281d9b4c08602a", "score": "0.5081599", "text": "func (p *EncryptedPayload) Encrypt(data interface{}, pubKey *rsa.PublicKey) error {\n\trawData, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsymmetricKey := make([]byte, 32)\n\t_, err = rand.Read(symmetricKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tblock, err := aes.NewCipher(symmetricKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tiv := make([]byte, block.BlockSize())\n\t_, err = rand.Read(iv)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tencryptedData := make([]byte, len(rawData))\n\n\tencryptionStream := cipher.NewCFBEncrypter(block, iv)\n\tencryptionStream.XORKeyStream(encryptedData, rawData)\n\n\tasymmetricKey, err := rsa.EncryptOAEP(crypto.SHA256.New(), rand.Reader, pubKey, symmetricKey, []byte(EncryptedPayloadKeyLabel))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.Algorithm = \"aes256\"\n\tp.Data = encryptedData\n\tp.IV = iv\n\tp.Key = asymmetricKey\n\treturn nil\n}", "title": "" }, { "docid": "be9b522af4e63db615381b7b3b1dcb0f", "score": "0.5057674", "text": "func (this *PublicIdentity) Encrypt(key *SymmetricKey) (ek *EncryptedKey) {\n\tout, err := rsa.EncryptOAEP(sha256.New224(), rand.Reader, this.key, key.key, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &EncryptedKey{impl: out}\n}", "title": "" }, { "docid": "46141fac6a5983fc655bc7cb1e9d434a", "score": "0.5043506", "text": "func publicKey(privateKey string) (string, error) {\n\tdecoded, _ := pem.Decode([]byte(privateKey))\n\tif decoded == nil {\n\t\treturn \"\", errors.New(\"no PEM data found\")\n\t}\n\n\tprivKey, err := x509.ParsePKCS1PrivateKey(decoded.Bytes)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tder, err := x509.MarshalPKIXPublicKey(privKey.Public())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tblock := pem.Block{\n\t\tType: \"PUBLIC KEY\",\n\t\tBytes: der,\n\t}\n\treturn string(pem.EncodeToMemory(&block)), nil\n}", "title": "" }, { "docid": "20d399fa0865fa0747397e6580ccf8a9", "score": "0.5042621", "text": "func testPKEKeyGeneration(t *testing.T, id uint8) {\n\t// Message to be encrypted\n\tvar params = Params(id)\n\tvar msg = make([]byte, params.MsgLen)\n\tvar err error\n\tfor i, _ := range msg {\n\t\tmsg[i] = byte(i)\n\t}\n\n\tsk := NewPrivateKey(id, KeyVariant_SIKE)\n\terr = sk.Generate(rand.Reader)\n\tcheckErr(t, err, \"PEK key generation\")\n\tpk := sk.GeneratePublicKey()\n\n\t// Try to encrypt\n\tct, err := Encrypt(rand.Reader, pk, msg[:])\n\tcheckErr(t, err, \"PEK encryption\")\n\tpt, err := Decrypt(sk, ct)\n\tcheckErr(t, err, \"PEK key decryption\")\n\n\tif !bytes.Equal(pt[:], msg[:]) {\n\t\tt.Fatalf(\"Decryption failed \\n got : %X\\n exp : %X\", pt, msg)\n\t}\n}", "title": "" }, { "docid": "8130953a1c6e8ed61a8633d72ebb3a46", "score": "0.50345755", "text": "func (r *RemoteCrypto) Encrypt(msg, aad []byte, keyURL interface{}) ([]byte, []byte, error) {\n\tstartEncrypt := time.Now()\n\tdestination := fmt.Sprintf(\"%s\", keyURL) + encryptURI\n\n\teReq := encryptReq{\n\t\tMessage: base64.URLEncoding.EncodeToString(msg),\n\t\tAdditionalData: base64.URLEncoding.EncodeToString(aad),\n\t}\n\n\thttpReqBytes, err := r.marshalFunc(eReq)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"marshal encryption request for Encrypt failed [%s, %w]\", destination, err)\n\t}\n\n\tresp, err := r.postHTTPRequest(destination, httpReqBytes)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"posting Encrypt plaintext failed [%s, %w]\", destination, err)\n\t}\n\n\t// handle response\n\tdefer closeResponseBody(resp.Body, logger, \"Encrypt\")\n\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"read encryption response for Encrypt failed [%s, %w]\", destination, err)\n\t}\n\n\thttpResp := &encryptResp{}\n\n\terr = r.unmarshalFunc(respBody, httpResp)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unmarshal encryption for Encrypt failed [%s, %w]\", destination, err)\n\t}\n\n\tkeyBytes, err := base64.URLEncoding.DecodeString(httpResp.CipherText)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tnonceBytes, err := base64.URLEncoding.DecodeString(httpResp.Nonce)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// TODO switch to Debug once perf testing with remote server is done.\n\tlogger.Infof(\"overall Encrypt duration: %s\", time.Since(startEncrypt))\n\n\treturn keyBytes, nonceBytes, nil\n}", "title": "" }, { "docid": "dc8d434dac4c0923129a6f6e274a714f", "score": "0.50337857", "text": "func (s *Service) RSAKey(c context.Context) *model.RSAKey {\n\treturn &model.RSAKey{\n\t\tHash: TsSeconds2Hash(time.Now().Unix()),\n\t\tKey: publicKey,\n\t}\n}", "title": "" }, { "docid": "d90967a6b38c2548b7b9b95068007d21", "score": "0.5031277", "text": "func (recv *PublicKey) EncryptOAEP(inBytes []byte) ([]byte, error) {\n\tkey := rsa.PublicKey(*recv)\n\treturn rsa.EncryptOAEP(sha1.New(), rand.Reader, &key, inBytes, []byte(\"\"))\n}", "title": "" }, { "docid": "f652813b926519a4bf0d1eac0c9a345f", "score": "0.50230604", "text": "func (cr *Curve) Encrypt(plainText []byte) ([]byte, error) {\n\tvar r, R, S, K_B [PubPriKeySize]byte\n\n\tif _, err := rand.Read(r[:]); err != nil {\n\t\treturn nil, err\n\t}\n\tr[0] &= 248\n\tr[31] &= 127\n\tr[31] |= 64\n\n\tcopy(K_B[:], cr._public[:])\n\n\tcurve25519.ScalarBaseMult(&R, &r)\n\tcurve25519.ScalarMult(&S, &r, &K_B)\n\tk_E := sha512.Sum512(S[:])\n\n\tsrclen := len(plainText)\n\tif srclen > FullKeySize {\n\t\treturn nil, errors.New(\"source data is exceed 64 bytes\")\n\t}\n\tcipherText := make([]byte, PubPriKeySize+srclen)\n\tcopy(cipherText[:PubPriKeySize], R[:])\n\tfor i := 0; i < srclen; i++ {\n\t\tcipherText[PubPriKeySize+i] = plainText[i] ^ k_E[i]\n\t}\n\n\treturn cipherText, nil\n}", "title": "" }, { "docid": "b600e1aea0ebeff93e43d052467f82ce", "score": "0.50143903", "text": "func printRSA(in io.Reader, priv *RSAPrivateKey) error {\n\tinput := bufio.NewScanner(in)\n\tfor input.Scan() {\n\t\tciphertext, err := RSAEncrypt(priv.Public(), input.Bytes())\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t\tcontinue\n\t\t}\n\t\tplaintext, err := RSADecrypt(priv, ciphertext)\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Printf(\"ciphertext: %x\\nplaintext: %s\\n\",\n\t\t\tciphertext, plaintext)\n\t}\n\treturn input.Err()\n}", "title": "" }, { "docid": "db3fdd6d36b275a6604c019e394bd2a0", "score": "0.50140256", "text": "func ExampleKeyRegister_LoadPEM_encrypted() {\n\tconst pem = `Keep it private! ✨\n\n-----BEGIN RSA PRIVATE KEY-----\nProc-Type: 4,ENCRYPTED\nDEK-Info: AES-128-CBC,65789712555A3E9FECD1D5E235B97B0C\n\no0Dz8S6QjGVq59yQdlakuKkoO0jKDN0PDu2L05ZLXwBQSGdIbRXtAOBRCNEME0V1\nIF9pM6uRU7tqFoVneNTHD3XySJG8AHrTPSKC3Xw31pjEolMfoNDBAu1bYR6XxM2X\noDu2UNVB9vd/3b4bwTH9q5ISWdCVhS/ky0lC9lHXman/F/7MsemiVVCQ4XTIi9CR\nnitMxJuXvkNBMtsyv+inmFMegKU6dj1DU93B9JpsFRRvy3TCfj9kRjhKWEpyindo\nyaZMH3EGOA3ALW5kWyr+XegyYznQbVdDlo/ikO9BAywBOx+DdRG4xYxRdxYt8/HH\nqXwPAGQe2veMlR7Iq3GjwHLebyuVc+iHbC7feRmNBpAT1RR7J+RIGlDPOBMUpuDT\nA8HbNzPkoXPGh9vMsREXtR5aPCaZISdcm8DTlNiZCPaX5VHL4SRJ5XjI2rnahaOE\nrhCFy0mxqQaKnEI9kCWWFmhX/MqzzfiW3yg0qFIAVLDQZZMFJr3jMHIvkxPk09rP\nnQIjMRBalFXmSiksx8UEhAzyriqiXwwgEI0gJVHcs3EIQGD5jNqvIYTX67/rqSF2\nOXoYuq0MHrAJgEfDncXvZFFMuAS/5KMvzSXfWr5/L0ncCU9UykjdPrFvetG/7IXQ\nBT1TX4pOeW15a6fg6KwSZ5KPrt3o8qtRfW4Ov49hPD2EhnCTMbkCRBbW8F13+9YF\nxzvC4Vm1r/Oa4TTUbf5tVto7ua/lZvwnu5DIWn2zy5ZUPrtn22r1ymVui7Iuhl0b\nSRcADdHh3NgrjDjalhLDB95ho5omG39l7qBKBTlBAYJhDuAk9rIk1FCfCB8upztt\n-----END RSA PRIVATE KEY-----`\n\n\tvar keys jwt.KeyRegister\n\tn, err := keys.LoadPEM([]byte(pem), []byte(\"dangerzone\"))\n\tif err != nil {\n\t\tfmt.Println(\"load error:\", err)\n\t}\n\tfmt.Println(n, \"keys added\")\n\t// Output: 1 keys added\n}", "title": "" }, { "docid": "cd257f38e4f122aed8005c81102d6f91", "score": "0.50110006", "text": "func encryptPlaintextByChunks(plainTextByte []byte, rsaKey *rsa.PublicKey, hash hash.Hash) ([]byte, error) {\n\tlimit := getRSALimit(rsaKey, &hash)\n\tdekChunks := splitChunk(plainTextByte, limit)\n\tdekMap := make(map[int][]byte)\n\tfor i, chunk := range dekChunks {\n\t\tvar chunkedDek []byte\n\t\tchunkedDek, err := rsa.EncryptOAEP(hash, rand.Reader, rsaKey, chunk, nil)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"encryption for secret failed: %v\", err)\n\t\t}\n\t\tdekMap[i] = chunkedDek\n\t}\n\n\treturn json.Marshal(dekMap)\n}", "title": "" }, { "docid": "3639bd2cde65c9ae63d7f0020c3ac342", "score": "0.4998777", "text": "func publicRSAKey(priv *rsa.PrivateKey) (public *rsa.PublicKey, pemPublic []byte, err error) {\n\n\t// get the public-key from the private-key\n\tpublic = &priv.PublicKey\n\n\t// marshal the public key into DER format\n\tderBytes, err := x509.MarshalPKIXPublicKey(public)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// create a pem-block using the public key in DER format\n\tblock := &pem.Block{\n\t\tType: \"PUBLIC KEY\",\n\t\tBytes: derBytes,\n\t}\n\n\t// encode the public pem-block to memory (you could encode directly to an io.Writer here...)\n\tpemPublic = pem.EncodeToMemory(block)\n\treturn public, pemPublic, nil\n}", "title": "" }, { "docid": "537b27cf4d6778590e361e46560054a9", "score": "0.49919054", "text": "func RsaEncrypt(publicKey []byte, orignal []byte) ([]byte, error) {\n\tblock, _ := pem.Decode(publicKey)\n\tif block == nil {\n\t\treturn nil, ErrInvalidEncryptKey\n\t}\n\tpubInterface, err := x509.ParsePKIXPublicKey(block.Bytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpub := pubInterface.(*rsa.PublicKey)\n\treturn rsa.EncryptPKCS1v15(rand.Reader, pub, orignal)\n}", "title": "" }, { "docid": "371eb280854aaa9265300b53b45b68a4", "score": "0.4985608", "text": "func (k NaclDHKeyPair) Encrypt(msg []byte, sender *NaclDHKeyPair) (*NaclEncryptionInfo, error) {\n\tif sender == nil {\n\t\tif tmp, err := GenerateNaclDHKeyPair(); err == nil {\n\t\t\tsender = &tmp\n\t\t} else {\n\t\t\treturn nil, err\n\t\t}\n\t} else if sender.Private == nil {\n\t\treturn nil, NoSecretKeyError{}\n\t}\n\n\tvar nonce [NaclDHNonceSize]byte\n\tif nRead, err := rand.Read(nonce[:]); err != nil {\n\t\treturn nil, err\n\t} else if nRead != NaclDHNonceSize {\n\t\treturn nil, fmt.Errorf(\"Short random read: %d\", nRead)\n\t}\n\n\tvar ctext []byte\n\tctext = box.Seal(ctext, msg, &nonce, ((*[32]byte)(&k.Public)), ((*[32]byte)(sender.Private)))\n\tret := &NaclEncryptionInfo{\n\t\tCiphertext: ctext,\n\t\tEncryptionType: kbcrypto.KIDNaclDH,\n\t\tNonce: nonce[:],\n\t\tReceiver: k.GetKID().ToBytes(),\n\t\tSender: sender.GetKID().ToBytes(),\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "5ad50c2237dce4ceb9f77505a9c961e1", "score": "0.4983821", "text": "func Encrypt(msg, e, n uint) uint {\n\treturn math.Exp(msg, e, n)\n}", "title": "" }, { "docid": "b32c49e6df34fbf444c97a38b659bb63", "score": "0.49835977", "text": "func EncryptedString(key KeyPair, s string, pad int, encoding int) string {\n\tvar result string // Cypthertext result\n\tvar i, j, k int // The usual Fortran index stuff\n\tsl := len(s) // Plaintext string length\n\ta := make([]int, key.ChunkSize(), key.ChunkSize()) // The usual Alice and Bob stuff\n\n\t// Figure out the padding type.\n\tpadtype := 0\n\tif pad == RSAAPP[\"NoPadding\"] {\n\t\tpadtype = 1\n\t} else if pad == RSAAPP[\"PKCS1Padding\"] {\n\t\tpadtype = 2\n\t}\n\n\t// Determine encoding type.\n\tencodingtype := 0\n\tif encoding == RSAAPP[\"RawEncoding\"] {\n\t\tencodingtype = 1\n\t}\n\n\t// If we're not using Dave's padding method, we need to truncate long\n\t// plaintext blocks to the correct length for the padding method used:\n\tif padtype == 1 {\n\t\tif sl > key.ChunkSize() {\n\t\t\tsl = key.ChunkSize()\n\t\t}\n\t} else if padtype == 2 {\n\t\tif sl > key.ChunkSize()-11 {\n\t\t\tsl = key.ChunkSize() - 11\n\t\t}\n\t}\n\n\t// * Convert the plaintext string to an array of characters so that we can work\n\t// * with individual characters.\n\tif padtype == 2 {\n\t\tj = sl - 1\n\t} else {\n\t\tj = key.ChunkSize() - 1\n\t}\n\n\tfor i < sl {\n\t\tif padtype > 0 {\n\t\t\ta[j] = int(s[i])\n\t\t} else {\n\t\t\ta[i] = int(s[i])\n\t\t}\n\t\ti++\n\t\tj--\n\t}\n\n\t// Now is the time to add the padding.\n\t// The padding is either a zero byte or a randomly-generated non-zero byte.\n\n\tif padtype == 1 {\n\t\ti = 0\n\t}\n\n\tj = key.ChunkSize() - (sl % key.ChunkSize())\n\n\tfor j > 0 {\n\t\tif padtype == 2 {\n\t\t\trpad := rand.Intn(256)\n\t\t\ta[i] = rpad\n\t\t} else {\n\t\t\ta[i] = 0\n\t\t}\n\n\t\ti++\n\t\tj--\n\t}\n\n\t// For PKCS1v1.5 padding, we need to fill in the block header.\n\t//\n\t// According to RFC 2313, a block type, a padding string, and the data shall\n\t// be formatted into the encryption block:\n\t//\n\t// EncrBlock = 00 || BlockType || PadString || 00 || Data\n\tif padtype == 2 {\n\t\ta[sl] = 0\n\t\ta[key.ChunkSize()-2] = 2\n\t\ta[key.ChunkSize()-1] = 0\n\t}\n\n\t// Initialize Barrett here (different from JavaScript)\n\tbarrett := key.Barrett()\n\n\t// Carve up the plaintext and encrypt each of the resultant blocks.\n\tal := len(a)\n\n\tfor i = 0; i < al; i += key.ChunkSize() {\n\t\t// Get a block.\n\t\tblock := bigint.New(false)\n\n\t\tj = 0\n\n\t\tfor k = i; k < i+key.ChunkSize(); j++ {\n\t\t\tblock.Digits[j] = a[k]\n\t\t\tk++\n\t\t\tblock.Digits[j] += a[k] << 8\n\t\t\tk++\n\t\t}\n\n\t\tvar text string\n\t\t// Encrypt it, convert it to text, and append it to the result.\n\t\tcrypt := barrett.PowMod(block, key.E())\n\t\tif encodingtype == 1 {\n\t\t\ttext = bigint.BiToBytes(crypt)\n\t\t} else {\n\t\t\ttext = bigint.BiToHex(crypt)\n\t\t}\n\t\tresult += text\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "ff5a88e3fe7a395cbf27d5685b5901e3", "score": "0.49729925", "text": "func (c BasicClient) PsaCipherEncrypt(keyName string, alg *algorithm.Cipher, plaintext []byte) ([]byte, error) {\n\topalg, err := algCipherAlgToWire(alg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.opclient.PsaCipherEncrypt(keyName, opalg, plaintext)\n}", "title": "" }, { "docid": "7fa0c40f656d6b82c2d47cdfd14afe8d", "score": "0.4972527", "text": "func encryptSymmetric(w io.Writer, name string, message string) error {\n\t// name := \"projects/my-project/locations/us-east1/keyRings/my-key-ring/cryptoKeys/my-key\"\n\t// message := \"Sample message\"\n\n\t// Create the client.\n\tctx := context.Background()\n\tclient, err := kms.NewKeyManagementClient(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create kms client: %w\", err)\n\t}\n\tdefer client.Close()\n\n\t// Convert the message into bytes. Cryptographic plaintexts and\n\t// ciphertexts are always byte arrays.\n\tplaintext := []byte(message)\n\n\t// Optional but recommended: Compute plaintext's CRC32C.\n\tcrc32c := func(data []byte) uint32 {\n\t\tt := crc32.MakeTable(crc32.Castagnoli)\n\t\treturn crc32.Checksum(data, t)\n\t}\n\tplaintextCRC32C := crc32c(plaintext)\n\n\t// Build the request.\n\treq := &kmspb.EncryptRequest{\n\t\tName: name,\n\t\tPlaintext: plaintext,\n\t\tPlaintextCrc32C: wrapperspb.Int64(int64(plaintextCRC32C)),\n\t}\n\n\t// Call the API.\n\tresult, err := client.Encrypt(ctx, req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to encrypt: %w\", err)\n\t}\n\n\t// Optional, but recommended: perform integrity verification on result.\n\t// For more details on ensuring E2E in-transit integrity to and from Cloud KMS visit:\n\t// https://cloud.google.com/kms/docs/data-integrity-guidelines\n\tif result.VerifiedPlaintextCrc32C == false {\n\t\treturn fmt.Errorf(\"Encrypt: request corrupted in-transit\")\n\t}\n\tif int64(crc32c(result.Ciphertext)) != result.CiphertextCrc32C.Value {\n\t\treturn fmt.Errorf(\"Encrypt: response corrupted in-transit\")\n\t}\n\n\tfmt.Fprintf(w, \"Encrypted ciphertext: %s\", result.Ciphertext)\n\treturn nil\n}", "title": "" }, { "docid": "d38b7c9fd48426eccd3369d5d56b82d0", "score": "0.49581546", "text": "func (k *PublicKey) Encoded() ([]byte, error) {\n\treturn k.pub, nil\n}", "title": "" }, { "docid": "075ef2dee2f66ab12525dc6175588f7a", "score": "0.49466273", "text": "func publicEncryptOAEP(pubKey *pkcs11uri.Pkcs11URI, plaintext []byte) ([]byte, string, error) {\n\toldenv := setEnvVars(pubKey.GetEnvMap())\n\tdefer restoreEnv(oldenv)\n\n\tp11ctx, session, err := pkcs11UriLogin(pubKey)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tdefer pkcs11Logout(p11ctx, session)\n\n\tlabel, err := pkcs11UriGetKeyLabel(pubKey)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tp11PubKey, err := findObject(p11ctx, session, pkcs11.CKO_PUBLIC_KEY, label)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\thashalg := OAEPDefaultHash\n\n\t// SoftHSM only accepts sha1 for OAEP; nevertheless we try sha256 first, and fall back to sha1 otherwise\n\tfor _, oaep := range OAEPParams {\n\t\terr = p11ctx.EncryptInit(session, []*pkcs11.Mechanism{pkcs11.NewMechanism(pkcs11.CKM_RSA_PKCS_OAEP, oaep)}, p11PubKey)\n\t\tif err == nil {\n\t\t\tif oaep.HashAlg == pkcs11.CKM_SHA_1 {\n\t\t\t\thashalg = \"sha1\"\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, \"\", errors.Wrap(err, \"EncryptInit error\")\n\t}\n\n\tciphertext, err := p11ctx.Encrypt(session, plaintext)\n\tif err != nil {\n\t\treturn nil, \"\", errors.Wrap(err, \"Encrypt failed\")\n\t}\n\treturn ciphertext, hashalg, nil\n}", "title": "" }, { "docid": "3eeaf2e6842e58733c88da1eb94b9a89", "score": "0.49402002", "text": "func (priv *PrivateKey) Public() crypto.PublicKey {}", "title": "" }, { "docid": "a6398ef0b274e45a17bb95be4d1f49d7", "score": "0.4929049", "text": "func EncryptWithKey(message []byte, key []byte) ([]byte, error) {\n\t//convert plain text\n\tvar plt = C.g_byte_array_new()\n\tC.g_byte_array_set_size(plt, C.uint(len(message)))\n\tmemcpy(plt.data, message)\n\tdefer C.g_byte_array_free(plt, 1)\n\n\t//encrypt plain text\n\tcKey := (*C.uchar)(unsafe.Pointer(&key))\n\tvar aesBuf = C.encrypt(plt, cKey)\n\tdefer C.g_byte_array_free(aesBuf, 1)\n\n\taesData := C.GoBytes(unsafe.Pointer(aesBuf.data), C.int(aesBuf.len))\n\tfmt.Printf(\"%v\\n\", string(aesData))\n\treturn aesData, nil\n}", "title": "" }, { "docid": "2d407b3cd4ded5756245c8bfc3a26936", "score": "0.49264914", "text": "func Encrypt(s *big.Int, params *Params, attrs AttributeSet, message *bn256.GT) (*Ciphertext, error) {\n\tciphertext := new(Ciphertext)\n\n\tif s == nil {\n\t\tvar err error\n\t\ts, err = RandomInZp(rand.Reader)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tparams.Precache()\n\n\tciphertext.E1 = new(bn256.GT).ScalarMult(params.Pairing, s)\n\tciphertext.E1.Add(message, ciphertext.E1)\n\n\tciphertext.E2 = new(bn256.G2).ScalarBaseMult(s)\n\n\tciphertext.Es = make([]*bn256.G1, len(attrs))\n\tfor index, i := range attrs {\n\t\tti := params.T(i)\n\t\tciphertext.Es[index] = ti.ScalarMult(ti, s)\n\t}\n\n\tciphertext.Gamma = attrs\n\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "65cc6335b373498fdebdf4a607e668e2", "score": "0.49251303", "text": "func (b Boneh) Encrypt(params, message []byte, id [][]byte) (c1, c2 []byte, err error) {\n\tvar p bonehParams\n\tif err := p.UnmarshalJSON(params); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ts := pairing.NewZr().Rand()\n\th := pairing.NewGT().MulZn(pairing.NewGT().Pair(p.G1, p.G2), s).Bytes()\n\tc1 = primitives.Xor(message, h)\n\n\tV := pairing.NewG1().MulZn(p.G, s)\n\n\tW := pairing.NewG1().Set1()\n\tfor i := 0; i < len(id); i++ {\n\t\tj := pairing.NewZr().SetFromStringHash(string(id[i]), sha256.New())\n\t\tW = pairing.NewG1().Add(W, pairing.NewG1().MulZn(p.H[i], j))\n\t}\n\tW = pairing.NewG1().Add(W, p.G3)\n\tW = pairing.NewG1().MulZn(W, s)\n\n\tct := bonehCiphertext{V: V, W: W}\n\tc2, err = ct.MarshalJSON()\n\treturn\n}", "title": "" }, { "docid": "061a2518e6bc7d2da3d86edb1339d615", "score": "0.49128821", "text": "func marshalPublicKey(pubkey *rsa.PublicKey) string {\n\tpk, err := ssh.NewPublicKey(pubkey)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\treturn string(ssh.MarshalAuthorizedKey(pk))\n}", "title": "" }, { "docid": "3cf915f870904b6110926369f0c3cd8e", "score": "0.49104306", "text": "func (s *Secret) RSAKey(bits int, skipIfExists bool) error {\n\tprivate, public, err := rsakey(bits)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn s.keypair(private, public, \"\", skipIfExists)\n}", "title": "" }, { "docid": "3e8ba7d9b384fa2326614c59b1113410", "score": "0.489964", "text": "func newCryptoSignerRSAPublicKey(creationTime time.Time, pub *rsa.PublicKey) *packet.PublicKey {\n\tpk := &packet.PublicKey{\n\t\tCreationTime: creationTime,\n\t\tPubKeyAlgo: packet.PubKeyAlgoRSA,\n\t\tPublicKey: pub,\n\t\tn: fromBig(pub.N),\n\t\te: fromBig(big.NewInt(int64(pub.E))),\n\t}\n\n\tpk.setFingerPrintAndKeyId()\n\treturn pk\n}", "title": "" }, { "docid": "1202da9b017cbde6ce1ac43429bdfaba", "score": "0.48952535", "text": "func encryptMailMessage(pk keys.PublicKey, encodedMsg []byte) ([]byte, error) {\n\t// TODO: encryptMailMessage hard coded to aes256cbc\n\tencryptedData, err := aes256cbc.Encrypt(pk, encodedMsg)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could not encrypt message\")\n\t}\n\n\treturn encryptedData, nil\n}", "title": "" }, { "docid": "6161980e7ff376c388617fb436f612f4", "score": "0.48906767", "text": "func (symmetricKey *SymmetricKey) EncryptToKeyPacket(password string) ([]byte, error) {\n\toutbuf := &bytes.Buffer{}\n\n\tcf := symmetricKey.GetCipherFunc()\n\n\tif len(password) <= 0 {\n\t\treturn nil, errors.New(\"gopenpgp: password can't be empty\")\n\t}\n\n\tpwdRaw := []byte(password)\n\n\tconfig := &packet.Config{\n\t\tDefaultCipher: cf,\n\t}\n\n\terr := packet.SerializeSymmetricKeyEncryptedReuseKey(outbuf, symmetricKey.Key, pwdRaw, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn outbuf.Bytes(), nil\n}", "title": "" }, { "docid": "386865380e4728d7048bb34bd49d5b23", "score": "0.4886545", "text": "func (j *jsonKey) RSA() (publicKey *rsa.PublicKey, err error) {\n\n\t// Check if the key has already been computed.\n\tj.precomputedMux.RLock()\n\tif j.precomputed != nil {\n\t\tvar ok bool\n\t\tif publicKey, ok = j.precomputed.(*rsa.PublicKey); ok {\n\t\t\tj.precomputedMux.RUnlock()\n\t\t\treturn publicKey, nil\n\t\t}\n\t}\n\tj.precomputedMux.RUnlock()\n\n\t// Confirm everything needed is present.\n\tif j.Exponent == \"\" || j.Modulus == \"\" {\n\t\treturn nil, fmt.Errorf(\"%w: rsa\", ErrMissingAssets)\n\t}\n\n\t// Decode the exponent from Base64.\n\t//\n\t// According to RFC 7518, this is a Base64 URL unsigned integer.\n\t// https://tools.ietf.org/html/rfc7518#section-6.3\n\tvar exponent []byte\n\tif exponent, err = base64.RawURLEncoding.DecodeString(j.Exponent); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Decode the modulus from Base64.\n\tvar modulus []byte\n\tif modulus, err = base64.RawURLEncoding.DecodeString(j.Modulus); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create the RSA public key.\n\tpublicKey = &rsa.PublicKey{}\n\n\t// Turn the exponent into an integer.\n\t//\n\t// According to RFC 7517, these numbers are in big-endian format.\n\t// https://tools.ietf.org/html/rfc7517#appendix-A.1\n\tpublicKey.E = int(big.NewInt(0).SetBytes(exponent).Uint64())\n\n\t// Turn the modulus into a *big.Int.\n\tpublicKey.N = big.NewInt(0).SetBytes(modulus)\n\n\t// Keep the public key so it won't have to be computed every time.\n\tj.precomputedMux.Lock()\n\tj.precomputed = publicKey\n\tj.precomputedMux.Unlock()\n\n\treturn publicKey, nil\n}", "title": "" }, { "docid": "420941ebe5c5550622a2fe9361a91937", "score": "0.48794627", "text": "func TestPGPEncrypt(t *testing.T) {\n\ttc := SetupTest(t, \"pgp_encrypt\", 1)\n\tdefer tc.Cleanup()\n\tbundleSrc, err := tc.MakePGPKey(\"src@keybase.io\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tbundleDst, err := tc.MakePGPKey(\"dst@keybase.io\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tmsg := \"59 seconds\"\n\tsink := NewBufferCloser()\n\trecipients := []*PGPKeyBundle{bundleSrc, bundleDst}\n\tif err := PGPEncrypt(strings.NewReader(msg), sink, bundleSrc, recipients); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tout := sink.Bytes()\n\tif len(out) == 0 {\n\t\tt.Fatal(\"no output\")\n\t}\n\n\t// check that each recipient can read the message\n\tfor _, recip := range recipients {\n\t\tkr := openpgp.EntityList{recip.Entity}\n\t\temsg := bytes.NewBuffer(out)\n\t\tmd, err := openpgp.ReadMessage(emsg, kr, nil, nil)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\ttext, err := io.ReadAll(md.UnverifiedBody)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif string(text) != msg {\n\t\t\tt.Errorf(\"message: %q, expected %q\", string(text), msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c75b3e440340adf8b832374894e95fdd", "score": "0.4874518", "text": "func encrypt(in io.Reader, stream cipher.Stream) error {\n\tbuf, err := ioutil.ReadAll(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstream.XORKeyStream(buf, buf)\n\tfmt.Println(base64.StdEncoding.EncodeToString(buf))\n\n\treturn nil\n}", "title": "" }, { "docid": "28a4a7c6e28f28d80c0a6801705554c7", "score": "0.4867502", "text": "func (g GCM) Encrypt(key, msg, ad []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar nonce [nonceSize]byte\n\tif _, err := rand.Read(nonce[:]); err != nil {\n\t\treturn nil, err\n\t}\n\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tct := gcm.Seal(nil, nonce[:], msg, ad)\n\tct = append(nonce[:], ct...)\n\treturn ct, nil\n}", "title": "" } ]
2664109673976dc74d364775250b62ce
GetX is like Get, but panics if an error occurs.
[ { "docid": "f82a63750620f0062fc4ecce53260c64", "score": "0.62408704", "text": "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" } ]
[ { "docid": "8dee2c2e4af46e9352ffacfaaf4d2e33", "score": "0.6903841", "text": "func (_EthCallTester *EthCallTesterTransactor) GetX(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _EthCallTester.contract.Transact(opts, \"getX\")\n}", "title": "" }, { "docid": "3001d6820ddfdd9647c0c680bf3051a5", "score": "0.67122996", "text": "func (c *BengkelClient) GetX(ctx context.Context, id int) *Bengkel {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "d68a8e02d8f03067de5691c04ef7b417", "score": "0.66686934", "text": "func (c *KqiClient) GetX(ctx context.Context, id int) *Kqi {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d6e26c3caa09ab4705f01622492b35f2", "score": "0.6664118", "text": "func (c *KqiSourceClient) GetX(ctx context.Context, id int) *KqiSource {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "c56fa2352da0b8ae7a57b586d7bde64e", "score": "0.6662557", "text": "func (c *ServiceClient) GetX(ctx context.Context, id int) *Service {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "9b955c70a01a226c4eb174ffe6d86aee", "score": "0.6653883", "text": "func (c *BookreturnClient) GetX(ctx context.Context, id int) *Bookreturn {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "6c297afffaf847bd13bddd22a0da9620", "score": "0.6591118", "text": "func (c *KqiTargetClient) GetX(ctx context.Context, id int) *KqiTarget {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "b896ddb69b9bf84ded023c1f8d5680ed", "score": "0.65555227", "text": "func (c *ProblemClient) GetX(ctx context.Context, id int) *Problem {\n\tpr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pr\n}", "title": "" }, { "docid": "35be7ac8ee6583b4e89e1d2400235266", "score": "0.6553177", "text": "func (c *ServiceEndpointClient) GetX(ctx context.Context, id int) *ServiceEndpoint {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "38ce368f81f054f0310a8be60db9cf9d", "score": "0.6540207", "text": "func (c *MinerClient) GetX(ctx context.Context, id int) *Miner {\n\tm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "20ce82a5438813de75a7bb1c84559e60", "score": "0.65249914", "text": "func (c *ResourceClient) GetX(ctx context.Context, id int) *Resource {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "c96bc3bbc02548cfdb8c32a13c79223a", "score": "0.64980984", "text": "func (c *WithoutFieldsClient) GetX(ctx context.Context, id int) *WithoutFields {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "808f04874eabb6d32c9b55130e6c0012", "score": "0.6497955", "text": "func (c *KpiClient) GetX(ctx context.Context, id int) *Kpi {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "ea05ba5a3d5980395968764d82b4342e", "score": "0.64939225", "text": "func (c *RentClient) GetX(ctx context.Context, id int) *Rent {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "d83bb1ff9d51edefff582018e081606b", "score": "0.64786243", "text": "func (c *TechClient) GetX(ctx context.Context, id int) *Tech {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d7e6bda5cdc7d727f83dc4061f5a8182", "score": "0.6468434", "text": "func (c *WithNilFieldsClient) GetX(ctx context.Context, id int) *WithNilFields {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "b47b224cd2ae47cd3d42c7cca2564e0e", "score": "0.6451131", "text": "func (c *MmedicineClient) GetX(ctx context.Context, id int) *Mmedicine {\n\tm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "edfa008454d5801467dc1e536e9bb1b0", "score": "0.6432405", "text": "func (c *InstructionClient) GetX(ctx context.Context, id int) *Instruction {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "57c08d31b42b897501b816cae4a26d2e", "score": "0.6416927", "text": "func (c *GoodsClassifyClient) GetX(ctx context.Context, id int) *GoodsClassify {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "1b31de9784de850be365ce38519036b9", "score": "0.64021796", "text": "func (c *DiseaseClient) GetX(ctx context.Context, id int) *Disease {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "b44a4371ae988ec9888ab8173f482be9", "score": "0.6399097", "text": "func (c *LinkClient) GetX(ctx context.Context, id int) *Link {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "2b02fd8a8b28b7ff84b66252c5a1d0be", "score": "0.6398505", "text": "func (c *DomainClient) GetX(ctx context.Context, id int) *Domain {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "434005ab2e3b873b45d97f3045428ff3", "score": "0.6387779", "text": "func (c *ResearchtypeClient) GetX(ctx context.Context, id int) *Researchtype {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "22923c4493701230b972d092f114e8b8", "score": "0.6379981", "text": "func (c *DrugClient) GetX(ctx context.Context, id int) *Drug {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "b491caece27c6c65255aa3b2a5961c1c", "score": "0.6373125", "text": "func (c *ClasstimeClient) GetX(ctx context.Context, id int) *Classtime {\n\tcl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn cl\n}", "title": "" }, { "docid": "842aa4cd34a87a6c18c5e8070025bf83", "score": "0.63707817", "text": "func (c *ServicePointClient) GetX(ctx context.Context, id int) *ServicePoint {\n\tsp, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn sp\n}", "title": "" }, { "docid": "1c11c79c0db4415d1b896c9bab1ed181", "score": "0.636942", "text": "func (c *GoodsSpuClient) GetX(ctx context.Context, id int) *GoodsSpu {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "521f3b3e2b4bdb07b0291f3409f43193", "score": "0.6354509", "text": "func (c *CheckoutClient) GetX(ctx context.Context, id int) *Checkout {\n\tch, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ch\n}", "title": "" }, { "docid": "0f77f57a46b6d5e5028719422772e03f", "score": "0.63508874", "text": "func (c *EntryPointClient) GetX(ctx context.Context, id int) *EntryPoint {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "aeaa3db030e0a9e652b3081296cc7a0e", "score": "0.6349101", "text": "func (c *HyperlinkClient) GetX(ctx context.Context, id int) *Hyperlink {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "c17c8dd863aaf911a7a9c610814ad737", "score": "0.6347754", "text": "func (c *WeChatPayClient) GetX(ctx context.Context, id int) *WeChatPay {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "beaa456df557eba4b5f15b8b704fb8da", "score": "0.6338682", "text": "func (c *LikeClient) GetX(ctx context.Context, id int) *Like {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d42e17a4efe7700ba23d8853a1ab6996", "score": "0.63351166", "text": "func (c *FlowClient) GetX(ctx context.Context, id int) *Flow {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "4467a4103e80f5992d7f71d22315b136", "score": "0.63214505", "text": "func (c *TransactionClient) GetX(ctx context.Context, id int) *Transaction {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "title": "" }, { "docid": "36d6d0c1bb8f65b978d47d8fba7bab0d", "score": "0.6320915", "text": "func (c *PropertyClient) GetX(ctx context.Context, id int) *Property {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "14dacc18a559ce118fdcd69d355ca750", "score": "0.63203555", "text": "func (c *ResearchClient) GetX(ctx context.Context, id int) *Research {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "36d6d0c1bb8f65b978d47d8fba7bab0d", "score": "0.6320014", "text": "func (c *PropertyClient) GetX(ctx context.Context, id int) *Property {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "52ad8489af23f44025f8e41d39b37c6a", "score": "0.63145167", "text": "func (c *ResolutionClient) GetX(ctx context.Context, id int) *Resolution {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "db258311fd6647061ce6a629fdfba637", "score": "0.63140064", "text": "func (c *UnitClient) GetX(ctx context.Context, id int) *Unit {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "title": "" }, { "docid": "8a1ab42f85daf01bfd556fafbd67348b", "score": "0.6309459", "text": "func (c *BasicLinkClient) GetX(ctx context.Context, id int) *BasicLink {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "baa2da513ee3729bebcb2ce4cd1121f2", "score": "0.62941366", "text": "func (c *BookClient) GetX(ctx context.Context, id int) *Book {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "a3d6a0b9f2a7d1c3c87e4b3505928747", "score": "0.62879896", "text": "func (c *BuildingClient) GetX(ctx context.Context, id int) *Building {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "85040bfda1af0ecfd72f4d87ec374bd5", "score": "0.6282298", "text": "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "title": "" }, { "docid": "85040bfda1af0ecfd72f4d87ec374bd5", "score": "0.6282298", "text": "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "title": "" }, { "docid": "4922c6c31048103a2ccd7da5ad0e75d2", "score": "0.6280418", "text": "func (c *UserClient) GetX(ctx context.Context, id string) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "4922c6c31048103a2ccd7da5ad0e75d2", "score": "0.6280418", "text": "func (c *UserClient) GetX(ctx context.Context, id string) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "5b90ddd54b4aeb290cb2c8fc62ad8fbe", "score": "0.62781435", "text": "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "title": "" }, { "docid": "5b90ddd54b4aeb290cb2c8fc62ad8fbe", "score": "0.62781435", "text": "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "title": "" }, { "docid": "5b90ddd54b4aeb290cb2c8fc62ad8fbe", "score": "0.62781435", "text": "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "title": "" }, { "docid": "5b90ddd54b4aeb290cb2c8fc62ad8fbe", "score": "0.62781435", "text": "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "title": "" }, { "docid": "5b90ddd54b4aeb290cb2c8fc62ad8fbe", "score": "0.62781435", "text": "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "title": "" }, { "docid": "5b90ddd54b4aeb290cb2c8fc62ad8fbe", "score": "0.62781435", "text": "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "title": "" }, { "docid": "5b90ddd54b4aeb290cb2c8fc62ad8fbe", "score": "0.62781435", "text": "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "title": "" }, { "docid": "b5309423ce479955c78f5aa081d3e3a9", "score": "0.627633", "text": "func (c *SystemmemberClient) GetX(ctx context.Context, id int) *Systemmember {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "0398ac0834688b3d65fcc502d82f9384", "score": "0.6273759", "text": "func (c *BookClient) GetX(ctx context.Context, id int) *Book {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "fb33cee35e48aadba057c525c671ae7a", "score": "0.62737304", "text": "func (c *VolumeClient) GetX(ctx context.Context, id int) *Volume {\n\tv, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "92efa407df8c02f4f96a622cebb08aa0", "score": "0.62728155", "text": "func (c *DiseasetypeClient) GetX(ctx context.Context, id int) *Diseasetype {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "1402425152731d502980152802624872", "score": "0.6271453", "text": "func (c *FlowExecutionTemplateClient) GetX(ctx context.Context, id int) *FlowExecutionTemplate {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "1368d5fb7e7d69c307478c9703903e9f", "score": "0.6271354", "text": "func (c *WithModifiedFieldClient) GetX(ctx context.Context, id int) *WithModifiedField {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "3080a7433036310070b0cc2d6ab1e9ce", "score": "0.6260202", "text": "func (c *PreemptionClient) GetX(ctx context.Context, id int) *Preemption {\n\tpr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pr\n}", "title": "" }, { "docid": "c0e7f35ffcd638a61edd86581a046856", "score": "0.625699", "text": "func (c *AgentClient) GetX(ctx context.Context, id int) *Agent {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "e4b7bbdca614645f84f8a672c870d012", "score": "0.6251691", "text": "func (c *BookborrowClient) GetX(ctx context.Context, id int) *Bookborrow {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "a12348ef202fd454f9b554a90ff0e40a", "score": "0.6243883", "text": "func (c *PurposeClient) GetX(ctx context.Context, id int) *Purpose {\n\tpu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "821825fa5e842faff99f1059514e9e88", "score": "0.6240866", "text": "func (c *NametitleClient) GetX(ctx context.Context, id int) *Nametitle {\n\tn, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "7ba8fb2256dc6aaf50540c3e24fbc761", "score": "0.6238047", "text": "func (c *EquipmentClient) GetX(ctx context.Context, id int) *Equipment {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "1c0ac8a029ee586553130779464206b7", "score": "0.62378746", "text": "func (c *PrescriptionClient) GetX(ctx context.Context, id int) *Prescription {\n\tpr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pr\n}", "title": "" }, { "docid": "3628eceb706eb2127d565a88d81a15ab", "score": "0.6227041", "text": "func (c *InsuranceClient) GetX(ctx context.Context, id int) *Insurance {\n\ti, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn i\n}", "title": "" }, { "docid": "4b089b52e347ebb28f9e5a86b5fb65cc", "score": "0.6219831", "text": "func (c *OrderInfoClient) GetX(ctx context.Context, id int) *OrderInfo {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d9c4586d365b236dccba48362136e252", "score": "0.62183416", "text": "func (c *ClientEntityClient) GetX(ctx context.Context, id int) *ClientEntity {\n\tce, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ce\n}", "title": "" }, { "docid": "7a19c6e4dbe4a4d70e741a3154385159", "score": "0.6209606", "text": "func (c *EmployeeClient) GetX(ctx context.Context, id int64) *Employee {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "38e07b55631e948bcc2f892836c9d7fc", "score": "0.62090045", "text": "func (c *TokenClient) GetX(ctx context.Context, id int) *Token {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "title": "" }, { "docid": "086ae3cb811780a97d6abb77390ba9d5", "score": "0.62037", "text": "func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "eb7eacd384ca1d60087a4411de03bc4d", "score": "0.61984533", "text": "func (c *DoctorClient) GetX(ctx context.Context, id int) *Doctor {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "eb7eacd384ca1d60087a4411de03bc4d", "score": "0.61984533", "text": "func (c *DoctorClient) GetX(ctx context.Context, id int) *Doctor {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "1a822bbdddf8e1fbaa2bc36b7b0f2d9f", "score": "0.61882085", "text": "func (c *TagClient) GetX(ctx context.Context, id int) *Tag {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "887eacdc51e68ee1d5225c0222965c41", "score": "0.6185987", "text": "func (c *TourProductClient) GetX(ctx context.Context, id int) *TourProduct {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "98f5b2d119ccdd17104011082b707f55", "score": "0.6185912", "text": "func (c *WithFieldsClient) GetX(ctx context.Context, id int) *WithFields {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "a8afe5de0c523324eb7e115abb99f439", "score": "0.61857206", "text": "func (c *VendorClient) GetX(ctx context.Context, id int) *Vendor {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "3978cb4bafa06784ff10c53a6734c269", "score": "0.6184947", "text": "func (c *ClassdateClient) GetX(ctx context.Context, id int) *Classdate {\n\tcl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn cl\n}", "title": "" }, { "docid": "162aa2841518804e39bf402edc7bc908", "score": "0.61800903", "text": "func (c *Config) Get(key string) interface{} {\n\treturn c.x.Get(key)\n}", "title": "" }, { "docid": "c9a79f14f22eacec96d092835322f37b", "score": "0.6171012", "text": "func (c *PoolPropertiesClient) GetX(ctx context.Context, id int) *PoolProperties {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "791da17d07cd0249b27be078e045426a", "score": "0.6170122", "text": "func (c *FormulaClient) GetX(ctx context.Context, id int) *Formula {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "367d3a3eb7737705b0d73bac7880b0c5", "score": "0.6161917", "text": "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "title": "" }, { "docid": "367d3a3eb7737705b0d73bac7880b0c5", "score": "0.6161917", "text": "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "title": "" }, { "docid": "9e59d864b4f1d847a2e74889f20ec93d", "score": "0.6156322", "text": "func (c *WorkOrderTemplateClient) GetX(ctx context.Context, id int) *WorkOrderTemplate {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "9c0b286f4cc9eb093a0f711026935a33", "score": "0.61561006", "text": "func (c *YearClient) GetX(ctx context.Context, id int) *Year {\n\ty, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn y\n}", "title": "" }, { "docid": "e93ea0be8ae6cc8aee9ad3bbea547897", "score": "0.61525977", "text": "func (c *GoodsSpecsClient) GetX(ctx context.Context, id int) *GoodsSpecs {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "54dbfda6de1585e301627723388c0c70", "score": "0.61516154", "text": "func (c *ServiceTypeClient) GetX(ctx context.Context, id int) *ServiceType {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "ac30923709e5322241f1aeb03ca18100", "score": "0.61492944", "text": "func (c *CustomerClient) GetX(ctx context.Context, id int) *Customer {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "ac30923709e5322241f1aeb03ca18100", "score": "0.61492944", "text": "func (c *CustomerClient) GetX(ctx context.Context, id int) *Customer {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "f419427f9288b2b3821d3a2bfe5dd1ea", "score": "0.614871", "text": "func (c *LocationClient) GetX(ctx context.Context, id int) *Location {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "f28469376fd3121abd2761ecd046b87a", "score": "0.61413956", "text": "func (c *EquipmentTypeClient) GetX(ctx context.Context, id int) *EquipmentType {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "715a749e3130687fbfe0995534479591", "score": "0.6138288", "text": "func (c *GoodsSpuImgsClient) GetX(ctx context.Context, id int) *GoodsSpuImgs {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "bb2c6b73060e76abd3ea17d4f819e269", "score": "0.6125373", "text": "func (c *FlowInstanceClient) GetX(ctx context.Context, id int) *FlowInstance {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d39c3c4edd3d10c7425853064af34292", "score": "0.6121418", "text": "func (c *RecommendationsSourcesClient) GetX(ctx context.Context, id int) *RecommendationsSources {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "07b95f1270ac23548ced421a26675c37", "score": "0.6118387", "text": "func (c *ExitPointClient) GetX(ctx context.Context, id int) *ExitPoint {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "a65c5def388b139943f4c77011ee0e64", "score": "0.61140084", "text": "func (c *TermClient) GetX(ctx context.Context, id int) *Term {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "title": "" }, { "docid": "ac9746631e72a683e7c96ea7c0eebea8", "score": "0.6113389", "text": "func (c *TitleClient) GetX(ctx context.Context, id int) *Title {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "title": "" }, { "docid": "fd129951f01ef3587f8208fac9d101fb", "score": "0.61124706", "text": "func (c *RuleClient) GetX(ctx context.Context, id int) *Rule {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" } ]
e324cda92d890e275b2729d6328cb364
CreateDeployment mocks base method
[ { "docid": "adcd737264424aff335bc13a3d43be91", "score": "0.71892905", "text": "func (m *MockDeploymentEventHandler) CreateDeployment(obj *v1.Deployment) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateDeployment\", obj)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" } ]
[ { "docid": "3abca4199614a08c76b45866596aca9d", "score": "0.69824004", "text": "func newMockDeployment(responses ...bson.D) *mockDeployment {\n\treturn &mockDeployment{\n\t\tconn: &connection{\n\t\t\tresponses: responses,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "fc580765d6370be2eda830808b481130", "score": "0.68951744", "text": "func DeploymentMock(ns, name string, matchLabels map[string]string) appsv1.Deployment {\n\treturn appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Deployment\",\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: ns,\n\t\t\tName: name,\n\t\t\tLabels: matchLabels,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: matchLabels,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tNamespace: ns,\n\t\t\t\t\tName: name,\n\t\t\t\t\tLabels: matchLabels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{{\n\t\t\t\t\t\tName: \"busybox\",\n\t\t\t\t\t\tImage: \"busybox:latest\",\n\t\t\t\t\t\tCommand: []string{\"sleep\", \"3600\"},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b0dddc9eb14d40d945cdf6b0cbe4e31a", "score": "0.68866", "text": "func (m *MockAPI) Deployment(arg0, arg1 string) (*scalingo.Deployment, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Deployment\", arg0, arg1)\n\tret0, _ := ret[0].(*scalingo.Deployment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "06c41e65e9cf2fc7c09fcdeed9d3be46", "score": "0.6775908", "text": "func (m *DeploymentsClientMock) CreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters resources.Deployment) (resp *http.Response, err error) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tdeploy, ok := m.FakeStore[deploymentName]\n\tif !ok {\n\t\tdeploy = resources.DeploymentExtended{\n\t\t\tProperties: &resources.DeploymentPropertiesExtended{},\n\t\t}\n\t\tm.FakeStore[deploymentName] = deploy\n\t}\n\n\tdeploy.Properties.Parameters = parameters.Properties.Parameters\n\tdeploy.Properties.Template = parameters.Properties.Template\n\treturn &http.Response{StatusCode: 200}, nil\n}", "title": "" }, { "docid": "f0d013c0bb683f6f98b1ff83d8e60c3c", "score": "0.6715987", "text": "func (m *MockDeploymentWriter) CreateDeployment(ctx context.Context, obj *v10.Deployment, opts ...client.CreateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CreateDeployment\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8fc6b697b62f392a1b2aa4d2e682d7ac", "score": "0.6668791", "text": "func (m *MockDeploymentClient) CreateDeployment(ctx context.Context, obj *v10.Deployment, opts ...client.CreateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CreateDeployment\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6890350b80c7448a1ca6990eae268d25", "score": "0.6659778", "text": "func (m *MockBackend) CreateDeploy(arg0 string, arg1 []byte) (*models.Deploy, error) {\n\tret := m.ctrl.Call(m, \"CreateDeploy\", arg0, arg1)\n\tret0, _ := ret[0].(*models.Deploy)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9f9c2498d54a6b99810e037e6e75c5ea", "score": "0.64560205", "text": "func (m *MockYAMLApplication) Deploy(arg0 *latest.ToolsetSpec) bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Deploy\", arg0)\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "02fbca9d15a77a424737ae91dd3d220d", "score": "0.64390546", "text": "func testCreateDeployment(ns string) {\n\tklog.Infof(\"create deployment in namespace %s\", ns)\n}", "title": "" }, { "docid": "51bfdcaab8b66c649db64f5fccc2622e", "score": "0.64007854", "text": "func (m *MockAPI) DeploymentsCreate(arg0 string, arg1 *scalingo.DeploymentsCreateParams) (*scalingo.Deployment, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeploymentsCreate\", arg0, arg1)\n\tret0, _ := ret[0].(*scalingo.Deployment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3683acc8ea3ad8db184ba1f9e0a0f106", "score": "0.6390051", "text": "func (m *MockDryadJobRunner) Deploy() error {\n\tret := m.ctrl.Call(m, \"Deploy\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6da321d82b82f24c74c55f736d20e68f", "score": "0.6362258", "text": "func (m *MockContextManager) Deploy(contextName string, showProgress bool) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Deploy\", contextName, showProgress)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "63f2e2a3800aaea19f8ce9abd5fe6bc8", "score": "0.6341851", "text": "func SetupDeploymentTest(ctx2 context.Context) *corev1.Namespace {\n\tvar ctx context.Context\n\tvar cancel func()\n\tns := &corev1.Namespace{}\n\n\tBeforeEach(func() {\n\t\tctx, cancel = context.WithCancel(ctx2)\n\t\t*ns = corev1.Namespace{\n\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"testns-\" + randStringRunes(5)},\n\t\t}\n\n\t\terr := k8sClient.Create(ctx, ns)\n\t\tExpect(err).NotTo(HaveOccurred(), \"failed to create test namespace\")\n\n\t\tmgr, err := ctrl.NewManager(cfg, ctrl.Options{\n\t\t\tNamespace: ns.Name,\n\t\t\tMetricsBindAddress: \"0\",\n\t\t})\n\t\tExpect(err).NotTo(HaveOccurred(), \"failed to create manager\")\n\n\t\tcontroller := &RunnerDeploymentReconciler{\n\t\t\tClient: mgr.GetClient(),\n\t\t\tScheme: scheme.Scheme,\n\t\t\tLog: logf.Log,\n\t\t\tRecorder: mgr.GetEventRecorderFor(\"runnerreplicaset-controller\"),\n\t\t\tName: \"runnerdeployment-\" + ns.Name,\n\t\t}\n\t\terr = controller.SetupWithManager(mgr)\n\t\tExpect(err).NotTo(HaveOccurred(), \"failed to setup controller\")\n\n\t\tgo func() {\n\t\t\tdefer GinkgoRecover()\n\n\t\t\terr := mgr.Start(ctx)\n\t\t\tExpect(err).NotTo(HaveOccurred(), \"failed to start manager\")\n\t\t}()\n\t})\n\n\tAfterEach(func() {\n\t\tdefer cancel()\n\n\t\terr := k8sClient.Delete(ctx, ns)\n\t\tExpect(err).NotTo(HaveOccurred(), \"failed to delete test namespace\")\n\t})\n\n\treturn ns\n}", "title": "" }, { "docid": "7f75c6f7f83845b70f069eab390197c9", "score": "0.63410455", "text": "func (m *MockApplication) Deploy(arg0 *latest.ToolsetSpec) bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Deploy\", arg0)\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "f0185ad4eb54bbc74f5dd4eb16091117", "score": "0.63118386", "text": "func (m *MockDeploymentsClient) CreateOrUpdate(arg0 context.Context, arg1, arg2 string, arg3 resources.Deployment) (resources.DeploymentsCreateOrUpdateFuture, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateOrUpdate\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(resources.DeploymentsCreateOrUpdateFuture)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f09bdeb80737ff22b8ab14ee4504ceb5", "score": "0.6263486", "text": "func (m *MockHelmApplication) Deploy(arg0 *latest.ToolsetSpec) bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Deploy\", arg0)\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "46d85a8d07366c7caa37a92ca3595cb3", "score": "0.625814", "text": "func TestDeployment(t *testing.T) {\n\tGiven(t).\n\t\tPath(\"deployment\").\n\t\tWhen().\n\t\tCreate().\n\t\tSync().\n\t\tThen().\n\t\tExpect(OperationPhaseIs(OperationSucceeded)).\n\t\tExpect(SyncStatusIs(SyncStatusCodeSynced)).\n\t\tExpect(HealthIs(HealthStatusHealthy)).\n\t\tWhen().\n\t\tPatchFile(\"deployment.yaml\", `[\n {\n \"op\": \"replace\",\n \"path\": \"/spec/template/spec/containers/0/image\",\n \"value\": \"nginx:1.17.4-alpine\"\n }\n]`).\n\t\tSync()\n}", "title": "" }, { "docid": "60623ea65621d842669993bcbcdb3bd3", "score": "0.6196729", "text": "func mockDeploymentCall(deployments []apps_v1.Deployment, mixerDisabled bool) *kubetest.K8SClientMock {\n\tk8s := new(kubetest.K8SClientMock)\n\tk8s.On(\"GetDeployments\", mock.AnythingOfType(\"string\"), mock.AnythingOfType(\"string\")).Return(deployments, nil)\n\tk8s.On(\"IsMixerDisabled\").Return(mixerDisabled)\n\n\treturn k8s\n}", "title": "" }, { "docid": "18d7c9e2715423e3dc3f2e48fb2dd7f8", "score": "0.6192275", "text": "func (test *Test) createDeployment(namespace string, d *appsv1.Deployment) error {\n\ttest.Debugf(\"creating deployment %s\", d.Name)\n\n\td.Namespace = namespace\n\t_, err := test.harness.kubeClient.AppsV1().Deployments(namespace).Create(context.TODO(), d, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create deployment %s: %w\", d.Name, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db5f0cafffdd6dffc81608bfbb72c4e2", "score": "0.61887735", "text": "func (m *MockWasmDeploymentWriter) CreateWasmDeployment(ctx context.Context, obj *v1beta1.WasmDeployment, opts ...client.CreateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CreateWasmDeployment\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "db5f0cafffdd6dffc81608bfbb72c4e2", "score": "0.61887735", "text": "func (m *MockWasmDeploymentWriter) CreateWasmDeployment(ctx context.Context, obj *v1beta1.WasmDeployment, opts ...client.CreateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CreateWasmDeployment\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3f9ec68c269d2141c5586ffd111bf047", "score": "0.6185823", "text": "func (m *MockSecrets) Deploy(arg0 kubernetes0.Interface, arg1 kubernetes.Interface, arg2 string) (map[string]*v1.Secret, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Deploy\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(map[string]*v1.Secret)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7ce66ce0b2769755ae1f7df4be1f4b31", "score": "0.6166835", "text": "func (m *MockDeploymentEventHandler) GenericDeployment(obj *v1.Deployment) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GenericDeployment\", obj)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "7436510a557d47e8c4bde8f3573db3b0", "score": "0.61640906", "text": "func newDeployForCR(cr *dronev1alpha1.DroneFederatedDeployment) *appsv1.Deployment {\n\n\tlog.Info(\"New deploy create.....\")\n\n\treturn &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: cr.Namespace,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": cr.Spec.Template.Spec.Selector.MatchLabels[\"app\"],\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": cr.Spec.Template.Spec.Template.Labels[\"app\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: cr.Spec.Template.Spec.Template.Spec.Containers[0].Name,\n\t\t\t\t\t\t\tImage: cr.Spec.Template.Spec.Template.Spec.Containers[0].Image,\n\t\t\t\t\t\t\tResources: cr.Spec.Template.Spec.Template.Spec.Containers[0].Resources,\n\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"http\",\n\t\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\tContainerPort: 80,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "d0fbd0d442e17f7f1c94d50f57a5f7e4", "score": "0.6151109", "text": "func (m *MockWasmDeploymentClient) CreateWasmDeployment(ctx context.Context, obj *v1beta1.WasmDeployment, opts ...client.CreateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CreateWasmDeployment\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d0fbd0d442e17f7f1c94d50f57a5f7e4", "score": "0.6151109", "text": "func (m *MockWasmDeploymentClient) CreateWasmDeployment(ctx context.Context, obj *v1beta1.WasmDeployment, opts ...client.CreateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CreateWasmDeployment\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b1eba9403ecd317a4f4b4954c3616ab2", "score": "0.61465174", "text": "func createDeployment(w http.ResponseWriter, r *http.Request) {\n\tpathVars := mux.Vars(r)\n\n\tif os.Getenv(\"DEPLOY_STATE\") == \"PROD\" {\n\t\tif !helper.ValidAdmin(pathVars[\"org\"], w, r) {\n\t\t\treturn\n\t\t}\n\t}\n\n\t//Decode passed JSON body\n\tvar tempJSON deploymentPost\n\terr := json.NewDecoder(r.Body).Decode(&tempJSON)\n\tif err != nil {\n\t\terrorMessage := fmt.Sprintf(\"Error decoding JSON Body: %s\\n\", err)\n\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\thelper.LogError.Printf(errorMessage)\n\t\treturn\n\t}\n\n\tif tempJSON.PublicHosts == nil && tempJSON.PrivateHosts == nil {\n\t\terrorMessage := fmt.Sprintf(\"No privateHosts or publicHosts given\\n\")\n\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\thelper.LogError.Printf(errorMessage)\n\t\treturn\n\t}\n\n\ttempPTS := api.PodTemplateSpec{}\n\n\t//Check if we got a URL\n\tif tempJSON.PtsURL == \"\" {\n\t\t//No URL so error\n\t\terrorMessage := fmt.Sprintf(\"No ptsURL given\\n\")\n\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\thelper.LogError.Printf(errorMessage)\n\t\treturn\n\t}\n\n\ttempPTS, err = helper.GetPTSFromURL(tempJSON.PtsURL, r)\n\tif err != nil {\n\t\thelper.LogError.Printf(err.Error())\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\n\tif allowPrivilegedContainers == false {\n\t\tfor _, val := range tempPTS.Spec.Containers {\n\t\t\tif val.SecurityContext != nil {\n\t\t\t\tval.SecurityContext.Privileged = func() *bool { b := false; return &b }()\n\t\t\t}\n\t\t}\n\t}\n\n\ttempPTS.Spec.Containers[0].Env = helper.CacheEnvVars(tempPTS.Spec.Containers[0].Env, tempJSON.EnvVars)\n\n\t//If map is empty then we need to make it\n\tif len(tempPTS.Annotations) == 0 {\n\t\ttempPTS.Annotations = make(map[string]string)\n\t}\n\n\tif tempJSON.PrivateHosts != nil {\n\t\ttempPTS.Annotations[\"privateHosts\"] = *tempJSON.PrivateHosts\n\t}\n\n\tif tempJSON.PublicHosts != nil {\n\t\ttempPTS.Annotations[\"publicHosts\"] = *tempJSON.PublicHosts\n\t}\n\n\t//If map is empty then we need to make it\n\tif len(tempPTS.Labels) == 0 {\n\t\ttempPTS.Labels = make(map[string]string)\n\t}\n\n\t//Add routable label\n\ttempPTS.Labels[\"routable\"] = \"true\"\n\ttempPTS.Labels[\"runtime\"] = \"shipyard\"\n\n\t//Could also use proto package\n\ttempInt := int32(5)\n\n\ttemplate := extensions.Deployment{\n\t\tObjectMeta: api.ObjectMeta{\n\t\t\tName: tempJSON.DeploymentName,\n\t\t},\n\t\tSpec: extensions.DeploymentSpec{\n\t\t\tRevisionHistoryLimit: &tempInt,\n\t\t\tReplicas: *tempJSON.Replicas,\n\t\t\tSelector: &unversioned.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"component\": tempPTS.Labels[\"component\"],\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: tempPTS,\n\t\t},\n\t}\n\n\tlabelSelector, err := labels.Parse(\"component=\" + tempPTS.Labels[\"component\"])\n\t//Get list of all deployments in namespace with MatchLabels[\"app\"] = tempPTS.Labels[\"app\"]\n\tdepList, err := client.Deployments(pathVars[\"org\"] + \"-\" + pathVars[\"env\"]).List(api.ListOptions{\n\t\tLabelSelector: labelSelector,\n\t})\n\tif len(depList.Items) != 0 {\n\t\terrorMessage := fmt.Sprintf(\"LabelSelector \" + labelSelector.String() + \" already exists\")\n\t\thelper.LogError.Printf(errorMessage)\n\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t//Create Deployment\n\tdep, err := client.Deployments(pathVars[\"org\"] + \"-\" + pathVars[\"env\"]).Create(&template)\n\tif err != nil {\n\t\terrorMessage := fmt.Sprintf(\"Error creating deployment: %s\\n\", err)\n\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\thelper.LogError.Printf(errorMessage)\n\t\treturn\n\t}\n\tjs, err := json.Marshal(dep)\n\tif err != nil {\n\t\terrorMessage := fmt.Sprintf(\"Error marshalling deployment: %s\\n\", err)\n\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\thelper.LogError.Printf(errorMessage)\n\t}\n\n\t//Create absolute path for Location header\n\turl := \"/environments/\" + pathVars[\"org\"] + \"-\" + pathVars[\"env\"] + \"/deployments/\" + tempJSON.DeploymentName\n\tw.Header().Add(\"Location\", url)\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(201)\n\tw.Write(js)\n\n\thelper.LogInfo.Printf(\"Created Deployment: %s\\n\", dep.GetName())\n}", "title": "" }, { "docid": "d6b81f4cc8a94f18564055fb3484bd04", "score": "0.61384964", "text": "func (m *MockClient) Deployment(ctx context.Context, name string) (*appsv1.Deployment, error) {\n\treturn m.MockDeployment, nil\n}", "title": "" }, { "docid": "c4db458a6789100a3631bcfd4940f9ef", "score": "0.613448", "text": "func NewDeployment() *Deployment { return &Deployment{dp: &v1.Deployment{}} }", "title": "" }, { "docid": "99920e89e74362fbe6ad63dd31192f54", "score": "0.6064868", "text": "func (k *KubeClient) CreateOrUpdateDeployment(\n\tname string,\n\tnamespace string,\n\treplicas int32,\n\tlabels map[string]string,\n\timage string,\n\tcontainerName string,\n\tcommand []string,\n\targs []string,\n\tports []corev1.ContainerPort,\n\tvolumeMounts []corev1.VolumeMount,\n\tenvs []corev1.EnvVar,\n\tsc corev1.SecurityContext,\n\tipp corev1.PullPolicy,\n\tsecrets []corev1.LocalObjectReference,\n\tvolumes []corev1.Volume,\n\tstrategy appsv1.DeploymentStrategy,\n\towner metav1.Object,\n) (operationResult controllerutil.OperationResult, err error) {\n\thttpGetAction := corev1.HTTPGetAction{\n\t\tPath: HealthPath,\n\t\tPort: intstr.IntOrString{\n\t\t\tType: Int,\n\t\t\tIntVal: HealthPort,\n\t\t},\n\t}\n\treadyProbe := corev1.Probe{\n\t\tHandler: corev1.Handler{\n\t\t\tHTTPGet: &httpGetAction,\n\t\t},\n\t\tPeriodSeconds: ReadyPrPeriodSeconds,\n\t\tInitialDelaySeconds: ReadyPrInitialDelaySeconds,\n\t}\n\tliveProbe := corev1.Probe{\n\t\tHandler: corev1.Handler{\n\t\t\tHTTPGet: &httpGetAction,\n\t\t},\n\t\tPeriodSeconds: LivePrPeriodSeconds,\n\t\tInitialDelaySeconds: LivePrInitialDelaySeconds,\n\t}\n\tdefaultPort := corev1.ContainerPort{\n\t\tName: HealthPortName,\n\t\tContainerPort: HealthPort,\n\t\tProtocol: corev1.ProtocolTCP,\n\t}\n\tports = append(ports, defaultPort)\n\tdeployment := &appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: appsv1.SchemeGroupVersion.String(),\n\t\t\tKind: \"Deployment\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\tcorev1.Container{\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tName: containerName,\n\t\t\t\t\t\t\tCommand: command,\n\t\t\t\t\t\t\tArgs: args,\n\t\t\t\t\t\t\tPorts: ports,\n\t\t\t\t\t\t\tVolumeMounts: volumeMounts,\n\t\t\t\t\t\t\tEnv: envs,\n\t\t\t\t\t\t\tSecurityContext: &sc,\n\t\t\t\t\t\t\tImagePullPolicy: ipp,\n\t\t\t\t\t\t\tReadinessProbe: &readyProbe,\n\t\t\t\t\t\t\tLivenessProbe: &liveProbe,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tImagePullSecrets: secrets,\n\t\t\t\t\tVolumes: volumes,\n\t\t\t\t},\n\t\t\t},\n\t\t\tStrategy: strategy,\n\t\t},\n\t}\n\tcontrollerutil.SetControllerReference(owner, deployment, k.Scheme)\n\toperationResult, err = controllerutil.CreateOrUpdate(\n\t\tcontext.TODO(),\n\t\tk.Client,\n\t\tdeployment,\n\t\tDeploymentMutateFunc(\n\t\t\treplicas,\n\t\t\tlabels,\n\t\t\timage,\n\t\t\tcontainerName,\n\t\t\tcommand,\n\t\t\targs,\n\t\t\tports,\n\t\t\tvolumeMounts,\n\t\t\tenvs,\n\t\t\tsc,\n\t\t\tipp,\n\t\t\tsecrets,\n\t\t\tvolumes,\n\t\t\treadyProbe,\n\t\t\tliveProbe,\n\t\t\tstrategy,\n\t\t),\n\t)\n\treturn\n}", "title": "" }, { "docid": "c4b861f6a4f3f7dc7d7d1ccaf6bfeaf1", "score": "0.60498893", "text": "func (m *MockMachineDeployer) Deploy(arg0 context.Context) (maasclient.Machine, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Deploy\", arg0)\n\tret0, _ := ret[0].(maasclient.Machine)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8fc94d27b2be7e2c7eceac118c714c51", "score": "0.60344964", "text": "func newMockClientForTest(t *testing.T, replicas int32, deploymentSize int) *clientsetfake.Clientset {\n\tclient := clientsetfake.NewSimpleClientset()\n\tfor i := 0; i < deploymentSize; i++ {\n\t\t_, err := client.AppsV1().Deployments(metav1.NamespaceSystem).Create(context.TODO(), &apps.Deployment{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tKind: \"Deployment\",\n\t\t\t\tAPIVersion: \"apps/v1\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: fmt.Sprintf(\"coredns-%d\", i),\n\t\t\t\tNamespace: metav1.NamespaceSystem,\n\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\"k8s-app\": \"kube-dns\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tSpec: apps.DeploymentSpec{\n\t\t\t\tReplicas: &replicas,\n\t\t\t\tTemplate: v1.PodTemplateSpec{},\n\t\t\t},\n\t\t}, metav1.CreateOptions{})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error creating deployment: %v\", err)\n\t\t}\n\t}\n\treturn client\n}", "title": "" }, { "docid": "237d06f48088c6d7f56fd734273ee08a", "score": "0.6022731", "text": "func (m *MockWebApp) Create(projectID string, request WebRequest) (applications.WebApp, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", projectID, request)\n\tret0, _ := ret[0].(applications.WebApp)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1a86f1ff7d0b2282b63e9efbe905e886", "score": "0.60174143", "text": "func (f *fixture) simulateDeployment(namespace k8s.Namespace, name string) (*appsv1.Deployment, *appsv1.ReplicaSet) {\n\td := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tUID: types.UID(name + \"-uid\"),\n\t\t\tNamespace: namespace.String(),\n\t\t\tName: name,\n\t\t},\n\t}\n\trsName := name + \"-rs\"\n\trs := &appsv1.ReplicaSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tUID: types.UID(rsName + \"-uid\"),\n\t\t\tNamespace: namespace.String(),\n\t\t\tName: rsName,\n\t\t\tOwnerReferences: []metav1.OwnerReference{k8s.RuntimeObjToOwnerRef(d)},\n\t\t},\n\t}\n\n\t// inject these so that their metadata can be found later for owner reference matching\n\tf.kClient.Inject(k8s.NewK8sEntity(d), k8s.NewK8sEntity(rs))\n\n\treturn d, rs\n}", "title": "" }, { "docid": "99ddb7831054e58b45d175cae22f18b1", "score": "0.59670866", "text": "func createDeployment(e Expose, client kubernetes.Interface) error {\n\tdeployment := getDeployment(e)\n\t_, err := client.AppsV1().Deployments(e.NameSpace).Create(context.TODO(), deployment, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thpa := getHortizontalAutoScale(e)\n\t_, err = client.AutoscalingV1().HorizontalPodAutoscalers(e.NameSpace).Create(context.TODO(), hpa, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "91cae78cb65150be4c89d6d8f4abc307", "score": "0.59592366", "text": "func createDeployment(clientset *kubernetes.Clientset , path string){\n\tmapjson := readConfigFile(path)\n\tvar dep appsv1.Deployment\n\tstringjson , _ := json.Marshal(mapjson)\n\tjson.Unmarshal(stringjson , &dep)\n\n\tdeploymentClient := clientset.AppsV1().Deployments(apiv1.NamespaceDefault)\n\tfmt.Printf(\"Created dep client !\\n\")\n\tres , err := deploymentClient.Create(context.TODO() , &dep , metav1.CreateOptions{})\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"Created deployment %q.\\n\", res.GetObjectMeta().GetName())\n}", "title": "" }, { "docid": "ac421c2dd5c30d8dc6e5eb6d037ec76e", "score": "0.5928267", "text": "func (m *MockNamespaceableResourceInterface) Create(obj *unstructured.Unstructured, options v1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{obj, options}\n\tfor _, a := range subresources {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Create\", varargs...)\n\tret0, _ := ret[0].(*unstructured.Unstructured)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "80dd040cc844a6a9098a475f41ddfdeb", "score": "0.5926484", "text": "func (m *MockPortForwarder) Create(ctx context.Context, gvk schema.GroupVersionKind, name, namespace string, remotePort uint16) (portforward.CreateResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", ctx, gvk, name, namespace, remotePort)\n\tret0, _ := ret[0].(portforward.CreateResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8ed8a061276dbb819f46d40227c5961b", "score": "0.5925391", "text": "func buildDeployment(loadTest loadtestsv1.LocustLoadTest) *apps.Deployment {\n\tdeployment := apps.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: loadTest.Spec.DeploymentName,\n\t\t\tNamespace: loadTest.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(&loadTest, loadtestsv1.GroupVersion.WithKind(\"LocustLoadTest\"))},\n\t\t},\n\t\tSpec: apps.DeploymentSpec{\n\t\t\tReplicas: loadTest.Spec.Workers,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"loadtest-controller.cndev.io/deployment-name\": loadTest.Spec.DeploymentName,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: core.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"loadtest-controller.cndev.io/deployment-name\": loadTest.Spec.DeploymentName,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: core.PodSpec{\n\t\t\t\t\tContainers: []core.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"locust\",\n\t\t\t\t\t\t\tImage: \"locustio/locust:latest\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn &deployment\n}", "title": "" }, { "docid": "23da70ceb91578dd3d2bca6b13eaf07b", "score": "0.5922807", "text": "func generateDeployment(buildtask BuildTask, name string, image string, volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, envVars []corev1.EnvVar, labels map[string]string) appsv1.Deployment {\n\t// blockOwnerDeletion := true\n\t// controller := true\n\treplicas := int32(1)\n\tlabels2 := map[string]string{\n\t\t\"app\": \"javamicroprofiletemplate-selector\",\n\t\t\"version\": \"current\",\n\t\t\"release\": buildtask.Name,\n\t}\n\tdeployment := appsv1.Deployment{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Deployment\",\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: buildtask.Name,\n\t\t\tNamespace: buildtask.Namespace,\n\t\t\tLabels: labels,\n\t\t\t// OwnerReferences: []metav1.OwnerReference{\n\t\t\t// \t{\n\t\t\t// \t\tAPIVersion: \"apps/v1\",\n\t\t\t// \t\tBlockOwnerDeletion: &blockOwnerDeletion,\n\t\t\t// \t\tController: &controller,\n\t\t\t// \t\tKind: \"ReplicaSet\",\n\t\t\t// \t\tName: codewind.OwnerReferenceName,\n\t\t\t// \t\tUID: codewind.OwnerReferenceUID,\n\t\t\t// \t},\n\t\t\t// },\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels2,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labels2,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tServiceAccountName: buildtask.ServiceAccountName,\n\t\t\t\t\tVolumes: volumes,\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: name,\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tImagePullPolicy: corev1.PullAlways,\n\t\t\t\t\t\t\tSecurityContext: &corev1.SecurityContext{\n\t\t\t\t\t\t\t\tPrivileged: &buildtask.Privileged,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tVolumeMounts: volumeMounts,\n\t\t\t\t\t\t\tEnv: envVars,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn deployment\n}", "title": "" }, { "docid": "7f6ddf8df0a0453f95ef549e8a54bc78", "score": "0.59207386", "text": "func (m *MockServiceMonitorHandler) HypershiftUpdateServiceMonitorDeployment(template v10.ServiceMonitor) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"HypershiftUpdateServiceMonitorDeployment\", template)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ad0d9626e82f4f2e09b675a707ac629b", "score": "0.591849", "text": "func EnsureDeployment(deploymentName string) *Deployment {\n\tdeployment, err := Parse(deploymentName)\n\tif err != nil {\n\t\tframework.Failf(\"internal error while parsing %s: %v\", deploymentName, err)\n\t}\n\n\tf := framework.NewDefaultFramework(\"cluster\")\n\tf.SkipNamespaceCreation = true\n\n\tginkgo.BeforeEach(func() {\n\t\tginkgo.By(fmt.Sprintf(\"preparing for test %q\", ginkgo.CurrentGinkgoTestDescription().FullTestText))\n\t\tc, err := NewCluster(f.ClientSet)\n\t\tframework.ExpectNoError(err, \"get cluster information\")\n\t\trunning, err := FindPMEMDriver(c)\n\t\tframework.ExpectNoError(err, \"check for PMEM-CSI driver\")\n\t\tif running != nil {\n\t\t\tif reflect.DeepEqual(deployment, running) {\n\t\t\t\tframework.Logf(\"reusing existing %s PMEM-CSI deployment\", deployment.Name)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tframework.Logf(\"have %s PMEM-CSI deployment, want %s -> delete existing deployment\", running.Name, deployment.Name)\n\t\t\t// Currently all deployments share the same driver name.\n\t\t\terr := RemovePMEMDriver(c, running.Name)\n\t\t\tframework.ExpectNoError(err, \"remove PMEM-CSI deployment\")\n\t\t}\n\n\t\t// At the moment, the only supported deployment method is via test/setup-deployment.sh.\n\t\tcmd := exec.Command(\"test/setup-deployment.sh\")\n\t\tcmd.Dir = os.Getenv(\"REPO_ROOT\")\n\t\tcmd.Env = os.Environ()\n\t\tcmd.Env = append(cmd.Env,\n\t\t\t\"TEST_DEPLOYMENTMODE=\"+deployment.DeploymentMode(),\n\t\t\t\"TEST_DEVICEMODE=\"+string(deployment.Mode))\n\t\tcmd.Stdout = ginkgo.GinkgoWriter\n\t\tcmd.Stderr = ginkgo.GinkgoWriter\n\t\terr = cmd.Run()\n\t\tframework.ExpectNoError(err, \"create %s PMEM-CSI deployment\", deployment.Name)\n\n\t\tWaitForPMEMDriver(c, deployment.Namespace)\n\t\tfor _, h := range installHooks {\n\t\t\th(deployment)\n\t\t}\n\t})\n\n\treturn deployment\n}", "title": "" }, { "docid": "381fbc2aac255b17ed9762f2591d9b9b", "score": "0.59073114", "text": "func TestHelmReleaseReconcileCreate(t *testing.T) {\n\tlogf.SetLogger(logf.ZapLogger(true))\n\ttempDir, _ := ioutil.TempDir(\"/tmp\", \"charts\")\n\tvar (\n\t\tname = \"multicloud-operators-subscription-release\"\n\t\tnamespace = \"default\"\n\t\treleaseName = \"nginx-ingress\"\n\t\tchartName = \"nginx-ingress\"\n\t\tchartsDir = filepath.Join(tempDir, \"test\")\n\t)\n\tsr := &v1alpha1.HelmRelease{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"app.ibm.com/v1alpha1\",\n\t\t\tKind: \"HelmRelease\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tUID: types.UID(\"89e6052a-d566-11e9-b55f-fa163e0cb658\"),\n\t\t},\n\t\tSpec: v1alpha1.HelmReleaseSpec{\n\t\t\tSource: &v1alpha1.Source{\n\t\t\t\tSourceType: v1alpha1.HelmRepoSourceType,\n\t\t\t\tHelmRepo: &v1alpha1.HelmRepo{\n\t\t\t\t\tUrls: []string{\"https://helm.nginx.com/stable/nginx-ingress-0.3.5.tgz\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\tChartName: chartName,\n\t\t\tReleaseName: releaseName,\n\t\t\t//\t\t\tVersion: \"\",\n\t\t},\n\t}\n\n\t// Check if deployment has been created and has the correct size.\n\tdep := &appsv1.Deployment{}\n\tt.Log(\"sr.GetUID() \" + sr.GetUID())\n\tshorthenUID := shortenUID(sr.GetUID())\n\tt.Log(\"shorthenUID \" + shorthenUID)\n\tdeploymentName := releaseName[0:4] + \"-\" + shorthenUID + \"-\" + chartName\n\tnamespacedName := types.NamespacedName{\n\t\tNamespace: namespace,\n\t\tName: deploymentName,\n\t}\n\n\tos.Setenv(\"CHARTS_DIR\", chartsDir)\n\t// Objects to track in the fake client.\n\tobjs := []runtime.Object{sr}\n\n\t// Register operator types with the runtime scheme.\n\ts := scheme.Scheme\n\ts.AddKnownTypes(v1alpha1.SchemeGroupVersion, sr)\n\tapis.AddToScheme(scheme.Scheme)\n\n\t// Create a fake client to mock API calls.\n\tcl := fake.NewFakeClient(objs...)\n\t// cfg, err := config.GetConfig()\n\t// if err != nil {\n\t// \tt.Error(err.Error())\n\t// }\n\t// cl, err := client.New(cfg, client.Options{\n\t// \tScheme: s,\n\t// })\n\t// if err != nil {\n\t// \tt.Error(err.Error())\n\t// }\n\t// Create a ReconcileMemcached object with the scheme and fake client.\n\tr := &ReconcileHelmRelease{client: cl, scheme: s}\n\n\t// Mock request to simulate Reconcile() being called on an event for a\n\t// watched resource .\n\treq := reconcile.Request{\n\t\tNamespacedName: types.NamespacedName{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t}\n\tres, err := r.Reconcile(req)\n\tif err != nil {\n\t\tt.Fatalf(\"reconcile: (%v)\", err)\n\t}\n\t// Check the result of reconciliation to make sure it has the desired state.\n\tif res.Requeue {\n\t\tt.Error(\"reconcile did not requeue request as expected\")\n\t}\n\terr = r.client.Get(context.TODO(), namespacedName, dep)\n\tif err != nil {\n\t\tt.Fatalf(\"get deployment: (%v)\", err)\n\t}\n}", "title": "" }, { "docid": "2c2c15357ae837f86fc8e74d4183fb43", "score": "0.58936065", "text": "func (cc *Chaincode) CreateDeployment() {\n\tname := cc.GetName()\n\n\tmatchlabels := map[string]string{\n\t\t\"app\": \"mictract\",\n\t\t\"net\": strconv.Itoa(cc.NetworkID),\n\t\t\"channel\": strconv.Itoa(cc.ChannelID),\n\t\t\"chaincode\": strconv.Itoa(cc.ChaincodeID),\n\t\t\"tier\": \"chaincode\",\n\t}\n\n\tdeployment := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: matchlabels,\n\t\t\t},\n\t\t\tTemplate: apiv1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: name,\n\t\t\t\t\tLabels: matchlabels,\n\t\t\t\t},\n\t\t\t\tSpec: apiv1.PodSpec{\n\t\t\t\t\tContainers: []apiv1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"chaincode\",\n\t\t\t\t\t\t\tImage: \"alpine:3.11\",\n\t\t\t\t\t\t\tCommand: []string{\"/host/var/run/chaincode\"},\n\t\t\t\t\t\t\tEnvFrom: []apiv1.EnvFromSource{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tConfigMapRef: &apiv1.ConfigMapEnvSource{\n\t\t\t\t\t\t\t\t\t\tLocalObjectReference: apiv1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\tName: name + \"-env\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPorts: []apiv1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"chaincode\",\n\t\t\t\t\t\t\t\t\tProtocol: apiv1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\tContainerPort: 9999,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tVolumeMounts: []apiv1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"cc\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/host/var/run/chaincode\",\n\t\t\t\t\t\t\t\t\tSubPath: filepath.Join(\n\t\t\t\t\t\t\t\t\t\t\"chaincodes\",\n\t\t\t\t\t\t\t\t\t\tfmt.Sprintf(\"chaincode%d\", cc.ChaincodeID),\n\t\t\t\t\t\t\t\t\t\t\"chaincode\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tVolumes: []apiv1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"cc\",\n\t\t\t\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &apiv1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: config.NFS_SERVER_URL,\n\t\t\t\t\t\t\t\t\tPath: config.NFS_EXPOSED_PATH,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t_, err := global.K8sClientset.AppsV1().\n\t\tDeployments(apiv1.NamespaceDefault).\n\t\tCreate(context.TODO(), deployment, metav1.CreateOptions{})\n\n\tif err != nil {\n\t\tglobal.Logger.Error(\"Create chaincode deployment error\", zap.Error(err))\n\t}\n}", "title": "" }, { "docid": "f9fad6984ae5f2f2136dd37651e99449", "score": "0.5886282", "text": "func TestHelmDeployPipelineRun(t *testing.T) {\n\trepo := ensureDockerRepo(t)\n\tctx := context.Background()\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\tc, namespace := setup(ctx, t)\n\tsetupClusterBindingForHelm(ctx, c, t, namespace)\n\n\tvar (\n\t\tsourceResourceName = helpers.ObjectNameForTest(t)\n\t\tsourceImageName = helpers.ObjectNameForTest(t)\n\t\tcreateImageTaskName = helpers.ObjectNameForTest(t)\n\t\thelmDeployTaskName = helpers.ObjectNameForTest(t)\n\t\tcheckServiceTaskName = helpers.ObjectNameForTest(t)\n\t\thelmDeployPipelineName = helpers.ObjectNameForTest(t)\n\t\thelmDeployPipelineRunName = helpers.ObjectNameForTest(t)\n\t)\n\n\tknativetest.CleanupOnInterrupt(func() { tearDown(ctx, t, c, namespace) }, t.Logf)\n\tdefer tearDown(ctx, t, c, namespace)\n\n\tt.Logf(\"Creating Git PipelineResource %s\", sourceResourceName)\n\tif _, err := c.PipelineResourceClient.Create(ctx, getGoHelloworldGitResource(sourceResourceName), metav1.CreateOptions{}); err != nil {\n\t\tt.Fatalf(\"Failed to create Pipeline Resource `%s`: %s\", sourceResourceName, err)\n\t}\n\n\tt.Logf(\"Creating Image PipelineResource %s\", sourceImageName)\n\tif _, err := c.PipelineResourceClient.Create(ctx, getHelmImageResource(repo, sourceImageName), metav1.CreateOptions{}); err != nil {\n\t\tt.Fatalf(\"Failed to create Pipeline Resource `%s`: %s\", sourceImageName, err)\n\t}\n\n\tt.Logf(\"Creating Task %s\", createImageTaskName)\n\tif _, err := c.TaskClient.Create(ctx, getCreateImageTask(namespace, createImageTaskName), metav1.CreateOptions{}); err != nil {\n\t\tt.Fatalf(\"Failed to create Task `%s`: %s\", createImageTaskName, err)\n\t}\n\n\tt.Logf(\"Creating Task %s\", helmDeployTaskName)\n\tif _, err := c.TaskClient.Create(ctx, getHelmDeployTask(namespace, helmDeployTaskName), metav1.CreateOptions{}); err != nil {\n\t\tt.Fatalf(\"Failed to create Task `%s`: %s\", helmDeployTaskName, err)\n\t}\n\n\tt.Logf(\"Creating Task %s\", checkServiceTaskName)\n\tif _, err := c.TaskClient.Create(ctx, getCheckServiceTask(namespace, checkServiceTaskName), metav1.CreateOptions{}); err != nil {\n\t\tt.Fatalf(\"Failed to create Task `%s`: %s\", checkServiceTaskName, err)\n\t}\n\n\tt.Logf(\"Creating Pipeline %s\", helmDeployPipelineName)\n\tif _, err := c.PipelineClient.Create(ctx, getHelmDeployPipeline(namespace, createImageTaskName, helmDeployTaskName, checkServiceTaskName, helmDeployPipelineName), metav1.CreateOptions{}); err != nil {\n\t\tt.Fatalf(\"Failed to create Pipeline `%s`: %s\", helmDeployPipelineName, err)\n\t}\n\n\tt.Logf(\"Creating PipelineRun %s\", helmDeployPipelineRunName)\n\tif _, err := c.PipelineRunClient.Create(ctx, getHelmDeployPipelineRun(namespace, sourceResourceName, sourceImageName, helmDeployPipelineRunName, helmDeployPipelineName), metav1.CreateOptions{}); err != nil {\n\t\tt.Fatalf(\"Failed to create Pipeline `%s`: %s\", helmDeployPipelineRunName, err)\n\t}\n\n\t// Verify status of PipelineRun (wait for it)\n\tif err := WaitForPipelineRunState(ctx, c, helmDeployPipelineRunName, timeout, PipelineRunSucceed(helmDeployPipelineRunName), \"PipelineRunCompleted\"); err != nil {\n\t\tt.Errorf(\"Error waiting for PipelineRun %s to finish: %s\", helmDeployPipelineRunName, err)\n\t\tt.Fatalf(\"PipelineRun execution failed; helm may or may not have been installed :(\")\n\t}\n\n\t// cleanup task to remove helm releases from cluster and cluster role bindings, will not fail the test if it fails, just log\n\tknativetest.CleanupOnInterrupt(func() { helmCleanup(ctx, c, t, namespace) }, t.Logf)\n\tdefer helmCleanup(ctx, c, t, namespace)\n}", "title": "" }, { "docid": "b6c1e9417772fc41f4566917667631aa", "score": "0.58830225", "text": "func createDeployment(ctx context.Context, cli client.Client, deploy *appsv1.Deployment) error {\n\tif err := cli.Create(ctx, deploy); err != nil {\n\t\treturn fmt.Errorf(\"failed to create deployment %s/%s: %w\", deploy.Namespace, deploy.Name, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "361d270bb5c955f66083297977162bb0", "score": "0.58808243", "text": "func (p *Peer) CreateDeployment() {\n\tsubPath := p.GetSubPath()\n\tname := p.GetName()\n\n\tmatchlabels := map[string]string{\n\t\t\"app\": \"mictract\",\n\t\t\"net\": strconv.Itoa(p.NetworkID),\n\t\t\"org\": strconv.Itoa(p.OrganizationID),\n\t\t\"peer\": strconv.Itoa(p.PeerID),\n\t\t\"tier\": \"peer\",\n\t}\n\n\tdeployment := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: matchlabels,\n\t\t\t},\n\t\t\tTemplate: apiv1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: name,\n\t\t\t\t\tLabels: matchlabels,\n\t\t\t\t},\n\t\t\t\tSpec: apiv1.PodSpec{\n\t\t\t\t\tContainers: []apiv1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"peer\",\n\t\t\t\t\t\t\tImage: \"hyperledger/fabric-peer:2.2.1\",\n\t\t\t\t\t\t\tCommand: []string{ \"sh\", \"-c\",\n\t\t\t\t\t\t\t\t\"GOPROXY=https://goproxy.io,direct peer node start --peer-chaincodedev\" },\n\t\t\t\t\t\t\tEnvFrom: []apiv1.EnvFromSource{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tConfigMapRef: &apiv1.ConfigMapEnvSource{\n\t\t\t\t\t\t\t\t\t\tLocalObjectReference: apiv1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\tName: name + \"-env\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPorts: []apiv1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"peer\",\n\t\t\t\t\t\t\t\t\tProtocol: apiv1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\tContainerPort: 7051,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"peer-cc\",\n\t\t\t\t\t\t\t\t\tProtocol: apiv1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\tContainerPort: 7052,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tVolumeMounts: []apiv1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"host\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/host/var/run\",\n\t\t\t\t\t\t\t\t\tSubPath: filepath.Join(subPath, \"run\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"msp\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/etc/hyperledger/fabric/msp\",\n\t\t\t\t\t\t\t\t\tSubPath: filepath.Join(subPath, \"msp\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"tls\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/etc/hyperledger/fabric/tls\",\n\t\t\t\t\t\t\t\t\tSubPath: filepath.Join(subPath, \"tls\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"production\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/var/hyperledger/production\",\n\t\t\t\t\t\t\t\t\tSubPath: filepath.Join(subPath, \"prod\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// core.yaml:/etc/hyperledger/fabric/core.yaml\n\t\t\t\t\t\t\t\t\tName:\t\t\t \"core\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/etc/hyperledger/fabric/core.yaml\",\n\t\t\t\t\t\t\t\t\tSubPath: filepath.Join(\"scripts\", \"external\", \"core.yaml\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// external:/opt/gopath/src/github.com/hyperledger/fabric/peer/external\n\t\t\t\t\t\t\t\t\tName: \"external\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/opt/gopath/src/github.com/hyperledger/fabric/peer/external\",\n\t\t\t\t\t\t\t\t\tSubPath: filepath.Join(\"scripts\", \"external\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tVolumes: []apiv1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"host\",\n\t\t\t\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &apiv1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: config.NFS_SERVER_URL,\n\t\t\t\t\t\t\t\t\tPath: config.NFS_EXPOSED_PATH,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"msp\",\n\t\t\t\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &apiv1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: config.NFS_SERVER_URL,\n\t\t\t\t\t\t\t\t\tPath: config.NFS_EXPOSED_PATH,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"tls\",\n\t\t\t\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &apiv1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: config.NFS_SERVER_URL,\n\t\t\t\t\t\t\t\t\tPath: config.NFS_EXPOSED_PATH,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"production\",\n\t\t\t\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &apiv1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: config.NFS_SERVER_URL,\n\t\t\t\t\t\t\t\t\tPath: config.NFS_EXPOSED_PATH,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"core\",\n\t\t\t\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &apiv1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: config.NFS_SERVER_URL,\n\t\t\t\t\t\t\t\t\tPath: config.NFS_EXPOSED_PATH,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"external\",\n\t\t\t\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\t\t\t\tNFS: &apiv1.NFSVolumeSource{\n\t\t\t\t\t\t\t\t\tServer: config.NFS_SERVER_URL,\n\t\t\t\t\t\t\t\t\tPath: config.NFS_EXPOSED_PATH,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t_, err := global.K8sClientset.AppsV1().\n\t\tDeployments(apiv1.NamespaceDefault).\n\t\tCreate(context.TODO(), deployment, metav1.CreateOptions{})\n\n\tif err != nil {\n\t\tglobal.Logger.Error(\"Create peer deployment error\", zap.Error(err))\n\t}\n}", "title": "" }, { "docid": "604ddacfff23ec2bfe0caaf8e9c0c670", "score": "0.58785367", "text": "func (test *Test) CreateDeployment(namespace string, d *appsv1.Deployment) {\n\terr := test.createDeployment(namespace, d)\n\ttest.err(err)\n}", "title": "" }, { "docid": "55767f00e7c6f07428d4ccd8e501c412", "score": "0.5871964", "text": "func createDeployment(app *App) (*ext_v1beta1.Deployment, error) {\n\n\t// We need to error out if both, app.PodSpec and app.DeploymentSpec are empty\n\tif reflect.DeepEqual(app.PodSpec, api_v1.PodSpec{}) && reflect.DeepEqual(app.DeploymentSpec, ext_v1beta1.DeploymentSpec{}) {\n\t\tlog.Debug(\"Both, app.PodSpec and app.DeploymentSpec are empty, not enough data to create a deployment.\")\n\t\treturn nil, nil\n\t}\n\n\t// We are merging whole DeploymentSpec with PodSpec.\n\t// This means that someone could specify containers in template.spec and also in top level PodSpec.\n\t// This stupid check is supposed to make sure that only one of them set.\n\t// TODO: merge DeploymentSpec.Template.Spec and top level PodSpec\n\tif !(reflect.DeepEqual(app.DeploymentSpec.Template.Spec, api_v1.PodSpec{}) || reflect.DeepEqual(app.PodSpec, api_v1.PodSpec{})) {\n\t\treturn nil, fmt.Errorf(\"Pod can't be specfied in two places. Use top level PodSpec or template.spec (DeploymentSpec.Template.Spec) not both\")\n\t}\n\n\tdeploymentSpec := app.DeploymentSpec\n\n\t// top level PodSpec is not empty, use it for deployment template\n\t// we already know that if app.PodSpec is not empty app.DeploymentSpec.Template.Spec is empty\n\tif !reflect.DeepEqual(app.PodSpec, api_v1.PodSpec{}) {\n\t\tdeploymentSpec.Template.Spec = app.PodSpec\n\t}\n\n\t// TODO: check if this wasn't set by user, in that case we shouldn't ovewrite it\n\tdeploymentSpec.Template.ObjectMeta.Name = app.Name\n\n\t// TODO: merge with already existing labels and avoid duplication\n\tdeploymentSpec.Template.ObjectMeta.Labels = app.Labels\n\n\tdeployment := ext_v1beta1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: app.Name,\n\t\t\tLabels: app.Labels,\n\t\t},\n\t\tSpec: deploymentSpec,\n\t}\n\n\treturn &deployment, nil\n}", "title": "" }, { "docid": "468f0448675e41edec1f46ecfebe142c", "score": "0.5860438", "text": "func CreateDeployment() error {\n\t// Get kubernetes client\n\tc, err := getKubeClient(kubeLocalPath)\n\tif err != nil {\n\t\tlog.Printf(\"Error: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\t// Load image version from file\n\tv, err := ioutil.ReadFile(appVersionLocalPath)\n\tif err != nil {\n\t\tlog.Printf(\"Error: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\t// Create deployment object\n\td := &v1beta1.Deployment{}\n\td.ObjectMeta = metav1.ObjectMeta{\n\t\tName: appName,\n\t\tLabels: map[string]string{\n\t\t\t\"app\": appName,\n\t\t},\n\t}\n\td.Spec = v1beta1.DeploymentSpec{\n\t\tReplicas: &replicas,\n\t\tSelector: &metav1.LabelSelector{\n\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\"app\": appName,\n\t\t\t},\n\t\t},\n\t\tTemplate: v1.PodTemplateSpec{\n\t\t\tObjectMeta: d.ObjectMeta,\n\t\t\tSpec: v1.PodSpec{\n\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\tv1.Container{\n\t\t\t\t\t\tName: appName,\n\t\t\t\t\t\tImage: fmt.Sprintf(\"%s:%s\", appName, v),\n\t\t\t\t\t\tImagePullPolicy: v1.PullAlways,\n\t\t\t\t\t\tPorts: []v1.ContainerPort{\n\t\t\t\t\t\t\tv1.ContainerPort{\n\t\t\t\t\t\t\t\tContainerPort: int32(80),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// Lookup existing deployments\n\tdeployClient := c.ExtensionsV1beta1().Deployments(appName)\n\t_, err = deployClient.Get(appName, metav1.GetOptions{})\n\n\t// Deployment already exists\n\tif err == nil {\n\t\t_, err = deployClient.Update(d)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error: %s\\n\", err.Error())\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"Deployment '%s' has been updated!\\n\", appName)\n\t\treturn nil\n\t}\n\n\t// Create deployment object in kubernetes\n\t_, err = deployClient.Create(d)\n\tif err != nil {\n\t\tlog.Printf(\"Error: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\tlog.Printf(\"Deployment '%s' has been created!\\n\", appName)\n\treturn nil\n}", "title": "" }, { "docid": "da841d855bf3ed781f60e7f80e88f821", "score": "0.5854873", "text": "func (m *MockAPI) DeploymentList(arg0 string) ([]*scalingo.Deployment, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeploymentList\", arg0)\n\tret0, _ := ret[0].([]*scalingo.Deployment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2ac9e5131a58131303ba4d172b5116b6", "score": "0.5850068", "text": "func (m *MockServiceMonitorHandler) TemplateAndUpdateServiceMonitorDeployment(url, blackBoxExporterNamespace string, namespacedName types.NamespacedName, clusterID string, hcp bool) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"TemplateAndUpdateServiceMonitorDeployment\", url, blackBoxExporterNamespace, namespacedName, clusterID, hcp)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "9e4564a8da8f23adfb832e3ab23b1026", "score": "0.58411777", "text": "func testDeploymentRollback(c *testContext) {\n\tdeploymentGVR := gvr(\"apps\", \"v1\", \"deployments\")\n\tobj, err := createOrGetResource(c.client, deploymentGVR, c.resources[deploymentGVR])\n\tif err != nil {\n\t\tc.t.Error(err)\n\t\treturn\n\t}\n\n\tgvrWithoutSubresources := c.gvr\n\tgvrWithoutSubresources.Resource = strings.Split(gvrWithoutSubresources.Resource, \"/\")[0]\n\tsubresources := strings.Split(c.gvr.Resource, \"/\")[1:]\n\n\tc.admissionHolder.expect(c.gvr, gvk(c.resource.Group, c.resource.Version, c.resource.Kind), gvkCreateOptions, v1beta1.Create, obj.GetName(), obj.GetNamespace(), true, false, true)\n\n\tvar rollbackObj runtime.Object\n\tswitch c.gvr {\n\tcase gvr(\"apps\", \"v1beta1\", \"deployments/rollback\"):\n\t\trollbackObj = &appsv1beta1.DeploymentRollback{\n\t\t\tTypeMeta: metav1.TypeMeta{APIVersion: \"apps/v1beta1\", Kind: \"DeploymentRollback\"},\n\t\t\tName: obj.GetName(),\n\t\t\tRollbackTo: appsv1beta1.RollbackConfig{Revision: 0},\n\t\t}\n\tcase gvr(\"extensions\", \"v1beta1\", \"deployments/rollback\"):\n\t\trollbackObj = &extensionsv1beta1.DeploymentRollback{\n\t\t\tTypeMeta: metav1.TypeMeta{APIVersion: \"extensions/v1beta1\", Kind: \"DeploymentRollback\"},\n\t\t\tName: obj.GetName(),\n\t\t\tRollbackTo: extensionsv1beta1.RollbackConfig{Revision: 0},\n\t\t}\n\tdefault:\n\t\tc.t.Errorf(\"unknown rollback resource %#v\", c.gvr)\n\t\treturn\n\t}\n\n\trollbackUnstructuredBody, err := runtime.DefaultUnstructuredConverter.ToUnstructured(rollbackObj)\n\tif err != nil {\n\t\tc.t.Errorf(\"ToUnstructured failed: %v\", err)\n\t\treturn\n\t}\n\trollbackUnstructuredObj := &unstructured.Unstructured{Object: rollbackUnstructuredBody}\n\trollbackUnstructuredObj.SetName(obj.GetName())\n\n\t_, err = c.client.Resource(gvrWithoutSubresources).Namespace(obj.GetNamespace()).Create(context.TODO(), rollbackUnstructuredObj, metav1.CreateOptions{}, subresources...)\n\tif err != nil {\n\t\tc.t.Error(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "caf7ba83106a13258b5f1f10c38688fe", "score": "0.5826114", "text": "func (c *KfctlClient) CreateDeployment(ctx context.Context, req kfdefs.KfDef) (*kfdefs.KfDef, error) {\n\tvar resp interface{}\n\tvar err error\n\tbo := backoff.NewExponentialBackOff()\n\tbo.InitialInterval = 3 * time.Second\n\n\tif d, ok := ctx.Deadline(); ok {\n\t\tbo.MaxElapsedTime = d.Sub(time.Now())\n\t} else {\n\t\t// TODO(https://github.com/kubeflow/kubeflow/issues/4131) we should be able to set a more reasonable O(minute)\n\t\t// timeout if we move alerting and monitoring from the router into kfctl server.\n\t\tbo.MaxElapsedTime = 30 * time.Minute\n\t}\n\t// Add retry logic\n\tpermErr := backoff.Retry(func() error {\n\t\tresp, err = c.createEndpoint(ctx, req)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"createEndpoint call failed with: %v\", err)\n\t\t\treturn err\n\t\t}\n\t\tlog.Errorf(\"createEndpoint call succeeded!\")\n\t\treturn nil\n\t}, bo)\n\n\tif permErr != nil {\n\t\tdeployReqCounter.WithLabelValues(\"INTERNAL\").Inc()\n\t\treturn nil, permErr\n\t}\n\tresponse, ok := resp.(*kfdefs.KfDef)\n\n\tif !ok {\n\t\tlog.Info(\"Response is not type *KfDef\")\n\t\tdeployReqCounter.WithLabelValues(\"INTERNAL\").Inc()\n\t\tresErr, ok := resp.(*httpError)\n\t\tif ok {\n\t\t\treturn nil, resErr\n\t\t}\n\n\t\tlog.Info(\"Response is not type *httpError\")\n\t\tpRes, _ := Pformat(resp)\n\t\tlog.Errorf(\"Received unexpected response; %v\", pRes)\n\t\treturn nil, resErr\n\t}\n\n\t// Watch deployment status, update monitor signal as needed.\n\tlog.Infof(\"Watching deployment status\")\n\n\tif d, ok := ctx.Deadline(); ok {\n\t\tbo.MaxElapsedTime = d.Sub(time.Now())\n\t} else {\n\t\t// TODO(https://github.com/kubeflow/kubeflow/issues/4131) we should be able to set a more reasonable O(minute)\n\t\t// timeout if we move alerting and monitoring from the router into kfctl server.\n\t\tbo.MaxElapsedTime = 30 * time.Minute\n\t}\n\tbo.Reset()\n\tpermErr = backoff.Retry(func() error {\n\t\tlatestKfdef, err := c.GetLatestKfdef(req)\n\t\tif err != nil {\n\t\t\treturn backoff.Permanent(err)\n\t\t}\n\t\tresponse = latestKfdef\n\t\tif len(response.Status.Conditions) == 0 {\n\t\t\treturn fmt.Errorf(\"deployment condition not available\")\n\t\t} else {\n\t\t\tif response.Status.Conditions[0].Type == kfdefs.KfFailed {\n\t\t\t\treturn backoff.Permanent(fmt.Errorf(response.Status.Conditions[0].Message))\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}, bo)\n\tif permErr != nil {\n\t\tdeployReqCounter.WithLabelValues(\"INTERNAL\").Inc()\n\t\treturn nil, permErr\n\t}\n\tlog.Infof(\"Deployment succeeded\")\n\tdeployReqCounter.WithLabelValues(\"OK\").Inc()\n\tkfDeploymentLatencies.Observe(timeSinceStart(ctx).Seconds())\n\tif req.Spec.Project != \"kubeflow-prober-deploy\" {\n\t\tkfDeploymentsDoneRaw.Inc()\n\t\tkfDeploymentsDoneUser.Inc()\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "6abf953b19be46f8977907d28a02b1ff", "score": "0.58132327", "text": "func newDeployment(ctx *Context, info *deploymentContext, opts deploymentOptions,\n\tdryRun bool,\n) (*deployment, error) {\n\tcontract.Assertf(info != nil, \"a deployment context must be provided\")\n\tcontract.Assertf(info.Update != nil, \"update info cannot be nil\")\n\tcontract.Assertf(opts.SourceFunc != nil, \"a source factory must be provided\")\n\n\t// First, load the package metadata and the deployment target in preparation for executing the package's program\n\t// and creating resources. This includes fetching its pwd and main overrides.\n\tproj, target := info.Update.GetProject(), info.Update.GetTarget()\n\tcontract.Assertf(proj != nil, \"update project cannot be nil\")\n\tcontract.Assertf(target != nil, \"update target cannot be nil\")\n\tprojinfo := &Projinfo{Proj: proj, Root: info.Update.GetRoot()}\n\n\t// Decrypt the configuration.\n\tconfig, err := target.Config.Decrypt(target.Decrypter)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to decrypt config: %w\", err)\n\t}\n\n\tpwd, main, plugctx, err := ProjectInfoContext(projinfo, opts.Host,\n\t\topts.Diag, opts.StatusDiag, opts.DisableProviderPreview, info.TracingSpan, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tplugctx = plugctx.WithCancelChannel(ctx.Cancel.Canceled())\n\n\topts.trustDependencies = proj.TrustResourceDependencies()\n\t// Now create the state source. This may issue an error if it can't create the source. This entails,\n\t// for example, loading any plugins which will be required to execute a program, among other things.\n\tsource, err := opts.SourceFunc(ctx.BackendClient, opts, proj, pwd, main, projinfo.Root, target, plugctx, dryRun)\n\tif err != nil {\n\t\tcontract.IgnoreClose(plugctx)\n\t\treturn nil, err\n\t}\n\n\tlocalPolicyPackPaths := ConvertLocalPolicyPacksToPaths(opts.LocalPolicyPacks)\n\n\tvar depl *deploy.Deployment\n\tif !opts.isImport {\n\t\tdepl, err = deploy.NewDeployment(\n\t\t\tplugctx, target, target.Snapshot, opts.Plan, source,\n\t\t\tlocalPolicyPackPaths, dryRun, ctx.BackendClient)\n\t} else {\n\t\t_, defaultProviderInfo, pluginErr := installPlugins(proj, pwd, main, target, plugctx,\n\t\t\tfalse /*returnInstallErrors*/)\n\t\tif pluginErr != nil {\n\t\t\treturn nil, pluginErr\n\t\t}\n\t\tfor i := range opts.imports {\n\t\t\timp := &opts.imports[i]\n\t\t\t_, err := tokens.ParseTypeToken(imp.Type.String())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"import type %q is not a valid resource type token. \"+\n\t\t\t\t\t\"Type tokens must be of the format <package>:<module>:<type> - \"+\n\t\t\t\t\t\"refer to the import section of the provider resource documentation.\", imp.Type.String())\n\t\t\t}\n\t\t\tif imp.Provider == \"\" {\n\t\t\t\tif imp.Version == nil {\n\t\t\t\t\timp.Version = defaultProviderInfo[imp.Type.Package()].Version\n\t\t\t\t}\n\t\t\t\tif imp.PluginDownloadURL == \"\" {\n\t\t\t\t\timp.PluginDownloadURL = defaultProviderInfo[imp.Type.Package()].PluginDownloadURL\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdepl, err = deploy.NewImportDeployment(plugctx, target, proj.Name, opts.imports, dryRun)\n\t}\n\n\tif err != nil {\n\t\tcontract.IgnoreClose(plugctx)\n\t\treturn nil, err\n\t}\n\treturn &deployment{\n\t\tCtx: info,\n\t\tPlugctx: plugctx,\n\t\tDeployment: depl,\n\t\tOptions: opts,\n\t}, nil\n}", "title": "" }, { "docid": "5e049bea744a2697e6544f6a98bfdb34", "score": "0.5810912", "text": "func fakeDeploymentConfig(name string, image string, envVars []corev1.EnvVar, envfrom []corev1.EnvFromSource, t *testing.T) *appsv1.DeploymentConfig {\n\n\t// save component type as label\n\tlabels := componentlabels.GetLabels(name, name, true)\n\tlabels[componentlabels.ComponentTypeLabel] = image\n\tlabels[componentlabels.ComponentTypeVersion] = \"latest\"\n\tlabels[applabels.ApplicationLabel] = name\n\n\t// save source path as annotation\n\tannotations := map[string]string{\n\t\t\"app.kubernetes.io/component-source-type\": \"local\",\n\t}\n\n\t// Create CommonObjectMeta to be passed in\n\tcommonObjectMeta := metav1.ObjectMeta{\n\t\tName: name,\n\t\tLabels: labels,\n\t\tAnnotations: annotations,\n\t}\n\n\tcommonImageMeta := CommonImageMeta{\n\t\tName: name,\n\t\tTag: \"latest\",\n\t\tNamespace: \"openshift\",\n\t\tPorts: []corev1.ContainerPort{{Name: \"foo\", HostPort: 80, ContainerPort: 80}},\n\t}\n\n\t// Generate the DeploymentConfig that will be used.\n\tdc := generateSupervisordDeploymentConfig(\n\t\tcommonObjectMeta,\n\t\tcommonImageMeta,\n\t\tenvVars,\n\t\tenvfrom,\n\t\tfakeResourceRequirements(),\n\t)\n\n\t// Add the appropriate bootstrap volumes for SupervisorD\n\taddBootstrapVolumeCopyInitContainer(&dc, commonObjectMeta.Name)\n\taddBootstrapSupervisordInitContainer(&dc, commonObjectMeta.Name)\n\taddBootstrapVolume(&dc, commonObjectMeta.Name)\n\taddBootstrapVolumeMount(&dc, commonObjectMeta.Name)\n\n\treturn &dc\n}", "title": "" }, { "docid": "d67c09c2b4aaa528e5acf3f9abcaea4a", "score": "0.5802209", "text": "func (m *MockBackend) CreateEnvironment(arg0, arg1, arg2, arg3 string, arg4 int, arg5 []byte) (*models.Environment, error) {\n\tret := m.ctrl.Call(m, \"CreateEnvironment\", arg0, arg1, arg2, arg3, arg4, arg5)\n\tret0, _ := ret[0].(*models.Environment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "a32e1e670949fdb9ef771cd078a3a7d6", "score": "0.5800904", "text": "func newDeployForCR(cr *wordpressv1alpha1.Wordpress) *appsv1.Deployment {\n labels := map[string]string{\n \"app\": cr.Name,\n }\n\n version := cr.Spec.WordpressVersion\n replicas := cr.Spec.Size\n\n return &appsv1.Deployment{\n TypeMeta: metav1.TypeMeta{\n APIVersion: \"apps/v1\",\n Kind: \"Deployment\",\n },\n ObjectMeta: metav1.ObjectMeta{\n Name: cr.Name,\n Namespace: cr.Namespace,\n },\n Spec: appsv1.DeploymentSpec{\n Replicas: &replicas,\n Selector: &metav1.LabelSelector{\n MatchLabels: labels,\n },\n Template: corev1.PodTemplateSpec{\n ObjectMeta: metav1.ObjectMeta{\n Labels: labels,\n },\n Spec: corev1.PodSpec{\n Containers: []corev1.Container{\n {\n Name: \"wordpress\",\n Image: \"wordpress:\" + version,\n Ports: []corev1.ContainerPort{{\n ContainerPort: 80,\n Name: \"wordpress-http\",\n }},\n Env: []corev1.EnvVar{\n {\n Name: \"WORDPRESS_DB_HOST\",\n Value: cr.Name + \"-db\",\n },\n {\n Name: \"WORDPRESS_DB_PASSWORD\",\n Value: cr.Spec.DBPassword,\n },\n {\n Name: \"WORDPRESS_DB_USER\",\n Value: cr.Spec.DBUsername,\n },\n {\n Name: \"WORDPRESS_DB_NAME\",\n Value: cr.Spec.DBName,\n },\n },\n },\n },\n },\n },\n },\n }\n}", "title": "" }, { "docid": "aea63b59b1eb14d566666f303f1e2dca", "score": "0.5790516", "text": "func (r *registry) ensureDeployment(appRegistries []string, needServiceAccount bool) error {\n\tregistryCommand := getCommand(r.packages, appRegistries)\n\tdeployment := new(builders.DeploymentBuilder).WithTypeMeta().Deployment()\n\tif err := r.client.Get(context.TODO(), r.key, deployment); err != nil {\n\t\tdeployment = r.newDeployment(registryCommand, needServiceAccount)\n\t\terr = r.client.Create(context.TODO(), deployment)\n\t\tif err != nil && !errors.IsAlreadyExists(err) {\n\t\t\tr.log.Errorf(\"Failed to create Deployment %s: %v\", deployment.GetName(), err)\n\t\t\treturn err\n\t\t}\n\t\tr.log.Infof(\"Created Deployment %s with registry command: %s\", deployment.GetName(), registryCommand)\n\t} else {\n\t\t// Scale down the deployment. This is required so that we get updates\n\t\t// from Quay during the sync cycle when packages have not been added or\n\t\t// removed from the spec.\n\t\tvar replicas int32\n\t\tdeployment.Spec.Replicas = &replicas\n\t\tif err = r.client.Update(context.TODO(), deployment); err != nil {\n\t\t\tr.log.Errorf(\"Failed to update Deployment %s for scale down: %v\", deployment.GetName(), err)\n\t\t\treturn err\n\t\t}\n\n\t\t// Wait for the deployment to scale down. We need to get the latest version of the object after\n\t\t// the update, so we use the object returned here for scaling up.\n\t\tif deployment, err = r.waitForDeploymentScaleDown(2*time.Second, 1*time.Minute); err != nil {\n\t\t\tr.log.Errorf(\"Failed to scale down Deployment %s : %v\", deployment.GetName(), err)\n\t\t\treturn err\n\t\t}\n\n\t\treplicas = 1\n\t\tdeployment.Spec.Replicas = &replicas\n\t\tdeployment.Spec.Template = r.newPodTemplateSpec(registryCommand, needServiceAccount)\n\t\tif err = r.client.Update(context.TODO(), deployment); err != nil {\n\t\t\tr.log.Errorf(\"Failed to update Deployment %s : %v\", deployment.GetName(), err)\n\t\t\treturn err\n\t\t}\n\t\tr.log.Infof(\"Updated Deployment %s with registry command: %s\", deployment.GetName(), registryCommand)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d28eb9ce66ae1bcac634dc63d356ba3a", "score": "0.5789736", "text": "func makeDeployment(t *testing.T, name, artifactName string) *model.Deployment {\n\td, err := model.NewDeploymentFromConstructor(\n\t\t&model.DeploymentConstructor{\n\t\t\tName: sptr(name),\n\t\t\tArtifactName: sptr(artifactName)})\n\n\tassert.NoError(t, err)\n\treturn d\n}", "title": "" }, { "docid": "43119c8d7335424b33f12220797ac1e7", "score": "0.57815915", "text": "func (client AppsClient) CreateDeploymentResponder(resp *http.Response) (result Deployment, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "68afe3ddc782cce96e82127c45535956", "score": "0.57759297", "text": "func MakeDeployment(replicas int32, podLabels map[string]string, nodeSelector map[string]string, namespace string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) *apps.Deployment {\n\tif len(command) == 0 {\n\t\tcommand = \"trap exit TERM; while true; do sleep 1; done\"\n\t}\n\tzero := int64(0)\n\tdeploymentName := \"deployment-\" + string(uuid.NewUUID())\n\tdeploymentSpec := &apps.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: deploymentName,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSpec: apps.DeploymentSpec{\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: podLabels,\n\t\t\t},\n\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: podLabels,\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tTerminationGracePeriodSeconds: &zero,\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"write-pod\",\n\t\t\t\t\t\t\tImage: imageutils.GetE2EImage(imageutils.BusyBox),\n\t\t\t\t\t\t\tCommand: []string{\"/bin/sh\"},\n\t\t\t\t\t\t\tArgs: []string{\"-c\", command},\n\t\t\t\t\t\t\tSecurityContext: &v1.SecurityContext{\n\t\t\t\t\t\t\t\tPrivileged: &isPrivileged,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tRestartPolicy: v1.RestartPolicyAlways,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tvar volumeMounts = make([]v1.VolumeMount, len(pvclaims))\n\tvar volumes = make([]v1.Volume, len(pvclaims))\n\tfor index, pvclaim := range pvclaims {\n\t\tvolumename := fmt.Sprintf(\"volume%v\", index+1)\n\t\tvolumeMounts[index] = v1.VolumeMount{Name: volumename, MountPath: \"/mnt/\" + volumename}\n\t\tvolumes[index] = v1.Volume{Name: volumename, VolumeSource: v1.VolumeSource{PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{ClaimName: pvclaim.Name, ReadOnly: false}}}\n\t}\n\tdeploymentSpec.Spec.Template.Spec.Containers[0].VolumeMounts = volumeMounts\n\tdeploymentSpec.Spec.Template.Spec.Volumes = volumes\n\tif nodeSelector != nil {\n\t\tdeploymentSpec.Spec.Template.Spec.NodeSelector = nodeSelector\n\t}\n\treturn deploymentSpec\n}", "title": "" }, { "docid": "ba681ee0da7f9fb90c3de31e82ff3491", "score": "0.57732105", "text": "func (m *MockAndroidApp) Create(projectID string, request AndroidRequest) (applications.AndroidApp, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", projectID, request)\n\tret0, _ := ret[0].(applications.AndroidApp)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9d80c60d1040eeda9b36659e649bf89f", "score": "0.5765486", "text": "func (m *MockServicePlanRepository) Create(arg0 *models.DBServicePlan) error {\n\tret := m.ctrl.Call(m, \"Create\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "1158d061d48f786547e8cdd46b1103bc", "score": "0.57616454", "text": "func CreateDeployment(dm agent.Manager, w http.ResponseWriter, r *http.Request) {\n\tdepB := &agent.DeploymentBlueprint{}\n\tjd := json.NewDecoder(r.Body)\n\tif err := jd.Decode(depB); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdr, err := dm.CreateDeployment(*depB)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdrj, errr := json.Marshal(dr)\n\tif errr != nil {\n\t\tlog.Fatal(errr)\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n\t_, err = w.Write(drj)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "27be3ff83fee8f6da3d6ba0171f4288b", "score": "0.5739068", "text": "func (m *MockIncarnations) deployed() []*Incarnation {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"deployed\")\n\tret0, _ := ret[0].([]*Incarnation)\n\treturn ret0\n}", "title": "" }, { "docid": "9f94962a37ea8d5c8675fc40df0e192a", "score": "0.57273775", "text": "func (c *deployments) Create(deployment *v1.Deployment) (result *v1.Deployment, err error) {\n\tresult = &v1.Deployment{}\n\tresult, err = c.deploymentInterface.Create(deployment)\n\tif c.clientMetrics != nil {\n\t\tc.clientMetrics.Inc(\"deployments\", \"create\", name, c.ns, err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b6450d1ba6a1cdf66553501dde1f9bcb", "score": "0.57268965", "text": "func deploymentRecreation(t *testing.T, clients *test.Clients, names test.ResourceNames) {\n\tdpList, err := clients.KubeClient.Kube.AppsV1().Deployments(names.Namespace).List(metav1.ListOptions{})\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to get any deployment under the namespace %q: %v\",\n\t\t\ttest.ServingOperatorNamespace, err)\n\t}\n\tif len(dpList.Items) == 0 {\n\t\tt.Fatalf(\"No deployment under the namespace %q was found\",\n\t\t\ttest.ServingOperatorNamespace)\n\t}\n\t// Delete the first deployment and verify the operator recreates it\n\tdeployment := dpList.Items[0]\n\tif err := clients.KubeClient.Kube.AppsV1().Deployments(deployment.Namespace).Delete(deployment.Name,\n\t\t&metav1.DeleteOptions{}); err != nil {\n\t\tt.Fatalf(\"Failed to delete deployment %s/%s: %v\", deployment.Namespace, deployment.Name, err)\n\t}\n\n\twaitErr := wait.PollImmediate(resources.Interval, resources.Timeout, func() (bool, error) {\n\t\tdep, err := clients.KubeClient.Kube.AppsV1().Deployments(deployment.Namespace).Get(deployment.Name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\t// If the deployment is not found, we continue to wait for the availability.\n\t\t\tif apierrs.IsNotFound(err) {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\t\treturn resources.IsDeploymentAvailable(dep)\n\t})\n\n\tif waitErr != nil {\n\t\tt.Fatalf(\"The deployment %s/%s failed to reach the desired state: %v\", deployment.Namespace, deployment.Name, err)\n\t}\n\n\tif _, err := resources.WaitForKnativeServingState(clients.KnativeServing(), test.ServingOperatorName,\n\t\tresources.IsKnativeServingReady); err != nil {\n\t\tt.Fatalf(\"KnativeService %q failed to reach the desired state: %v\", test.ServingOperatorName, err)\n\t}\n\tt.Logf(\"The deployment %s/%s reached the desired state.\", deployment.Namespace, deployment.Name)\n}", "title": "" }, { "docid": "244ac5726c9b0f142c1c99a9cebcb3aa", "score": "0.57238114", "text": "func (tc *testContext) createWindowsServerDeployment(name string, command []string, affinity *v1.Affinity,\n\tpvcToMount *v1.PersistentVolumeClaimVolumeSource) (*appsv1.Deployment, error) {\n\tdeploymentsClient := tc.client.K8s.AppsV1().Deployments(tc.workloadNamespace)\n\treplicaCount := int32(1)\n\t// affinity being nil is a hint that the caller does not care which nodes the pods are deployed to\n\tif affinity == nil {\n\t\treplicaCount = int32(3)\n\t}\n\tvar volumes []v1.Volume\n\tvar volumeMounts []v1.VolumeMount\n\tif pvcToMount != nil {\n\t\tvolumes = append(volumes, v1.Volume{\n\t\t\tName: pvcToMount.ClaimName,\n\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\tPersistentVolumeClaim: pvcToMount,\n\t\t\t},\n\t\t})\n\t\tvolumeMounts = append(volumeMounts, v1.VolumeMount{\n\t\t\tName: pvcToMount.ClaimName,\n\t\t\tMountPath: \"C:\\\\mnt\\\\storage\",\n\t\t})\n\t}\n\twindowsServerImage := tc.getWindowsServerContainerImage()\n\tcontainerUserName := \"ContainerAdministrator\"\n\trunAsNonRoot := false\n\tdeployment := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tGenerateName: name + \"-deployment-\",\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicaCount,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": name,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": name,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tAffinity: affinity,\n\t\t\t\t\tOS: &v1.PodOS{\n\t\t\t\t\t\tName: v1.Windows,\n\t\t\t\t\t},\n\t\t\t\t\tTolerations: []v1.Toleration{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: \"os\",\n\t\t\t\t\t\t\tValue: \"Windows\",\n\t\t\t\t\t\t\tEffect: v1.TaintEffectNoSchedule,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t// Windows web server\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: name,\n\t\t\t\t\t\t\tImage: windowsServerImage,\n\t\t\t\t\t\t\tImagePullPolicy: v1.PullIfNotPresent,\n\t\t\t\t\t\t\t// The default user for nanoserver image is ContainerUser.\n\t\t\t\t\t\t\t// Change user to ContainerAdministrator to run HttpListener in admin mode.\n\t\t\t\t\t\t\tSecurityContext: &v1.SecurityContext{\n\t\t\t\t\t\t\t\tRunAsNonRoot: &runAsNonRoot,\n\t\t\t\t\t\t\t\tWindowsOptions: &v1.WindowsSecurityContextOptions{\n\t\t\t\t\t\t\t\t\tRunAsUserName: &containerUserName,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tCommand: command,\n\t\t\t\t\t\t\tPorts: []v1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tProtocol: v1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\tContainerPort: 80,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tVolumeMounts: volumeMounts,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tNodeSelector: map[string]string{\"kubernetes.io/os\": \"windows\"},\n\t\t\t\t\tVolumes: volumes,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// Create Deployment\n\tdeploy, err := deploymentsClient.Create(context.TODO(), deployment, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create deployment: %w\", err)\n\t}\n\treturn deploy, err\n}", "title": "" }, { "docid": "976774ba0d0a67af1ab66aeddb8e21f2", "score": "0.5721044", "text": "func TestJenkinsDeploymentExists(t *testing.T) {\n\tk8sfuncs.DeploymentExists(t, ClientSet, \"jenkins-deployment\", \"jenkins\")\n}", "title": "" }, { "docid": "f405ea239d049ad094ce8bf584b6107a", "score": "0.569224", "text": "func (h *HTTPHandler) createDeployment(c echo.Context) error {\n\t//body structure\n\ttype body struct {\n\t\tName string `json:\"name\"`\n\t\tReplicas int `json:\"replicas\"`\n\t\tImage string `json:\"image\"`\n\t\tContainerPort int `json:\"port\"`\n\t}\n\n\tdata := new(body)\n\n\tif err := c.Bind(data); err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]string{\"message\": \"Error binding json\"})\n\t}\n\n\t//checking data for empty values\n\tif data.Name == \"\" || data.Replicas < 1 || data.Replicas > 6 || data.Image == \"\" || !(data.ContainerPort > 0 && data.ContainerPort < 65536) {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]string{\"message\": \"Invalid json request\"})\n\t}\n\n\tnameRegex := regexp.MustCompile(\"[a-zA-Z0-9]{1,24}\")\n\n\tif !nameRegex.Match([]byte(data.Name)) {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]string{\"message\": \"Invalid application name\"})\n\t}\n\n\t//get the token's claims\n\tuser := c.Get(\"user\").(*jwt.Token)\n\tclaims := user.Claims.(jwt.MapClaims)\n\tid := claims[\"id\"].(string)\n\trole := claims[\"role\"].(string)\n\n\t//parse replicas to int32\n\treplicasI32 := int32(data.Replicas)\n\n\t//call driver adapter responsible for creating the deployment in the kubernetes cluster\n\tresponse, err := h.kubernetesServices.CreateDeployment(id, role, data.Name, &replicasI32, data.Image, int32(data.ContainerPort))\n\tif err != nil {\n\t\t//type assertion of custom Error to default error\n\t\tkubernetesError := err.(*pkg.Error)\n\n\t\t//return the error sent by the service\n\t\treturn c.JSON(kubernetesError.Code, kubernetesError)\n\t}\n\n\treturn c.JSONPretty(http.StatusCreated, response, \" \")\n}", "title": "" }, { "docid": "1eca165837c61ffd1d7e8a17f2ea5893", "score": "0.5688569", "text": "func (m *MockServiceRepository) Create(arg0 *models.DBService) error {\n\tret := m.ctrl.Call(m, \"Create\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "0f0df7380b38bcd2ab0877993e7197fa", "score": "0.568717", "text": "func (m *MockServiceInstanceRepository) Create(arg0 *models.DBServiceInstance) error {\n\tret := m.ctrl.Call(m, \"Create\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "7319e184a21645a20404f3d12d211bf8", "score": "0.56836563", "text": "func (m *MockResourceInterface) Create(obj *unstructured.Unstructured, options v1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{obj, options}\n\tfor _, a := range subresources {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Create\", varargs...)\n\tret0, _ := ret[0].(*unstructured.Unstructured)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "a18a344ad87bfb81677d484972783610", "score": "0.56809443", "text": "func (t *DeploymentUpgradeTest) Setup(f *framework.Framework) {\n\tdeploymentName := \"deployment-hash-test\"\n\tc := f.ClientSet\n\tnginxImage := \"gcr.io/google_containers/nginx-slim:0.8\"\n\n\tns := f.Namespace.Name\n\n\tBy(fmt.Sprintf(\"Creating a deployment %q in namespace %q\", deploymentName, ns))\n\td := framework.NewDeployment(deploymentName, int32(1), map[string]string{\"test\": \"upgrade\"}, \"nginx\", nginxImage, extensions.RollingUpdateDeploymentStrategyType)\n\tdeployment, err := c.Extensions().Deployments(ns).Create(d)\n\tframework.ExpectNoError(err)\n\n\t// Wait for it to be updated to revision 1\n\tBy(fmt.Sprintf(\"Waiting deployment %q to be updated to revision 1\", deploymentName))\n\terr = framework.WaitForDeploymentRevisionAndImage(c, ns, deploymentName, \"1\", nginxImage)\n\tframework.ExpectNoError(err)\n\n\tBy(fmt.Sprintf(\"Waiting deployment %q to complete\", deploymentName))\n\tframework.ExpectNoError(framework.WaitForDeploymentStatusValid(c, deployment))\n\n\trs, err := deploymentutil.GetNewReplicaSet(deployment, c)\n\tframework.ExpectNoError(err)\n\tif rs == nil {\n\t\tframework.ExpectNoError(fmt.Errorf(\"expected a new replica set for deployment %q, found none\", deployment.Name))\n\t}\n\n\t// Store the old replica set - should be the same after the upgrade.\n\tt.oldRS = rs\n\n\t// Trigger a new rollout so that we have some history.\n\tBy(fmt.Sprintf(\"Triggering a new rollout for deployment %q\", deploymentName))\n\tdeployment, err = framework.UpdateDeploymentWithRetries(c, ns, deploymentName, func(update *extensions.Deployment) {\n\t\tupdate.Spec.Template.Spec.Containers[0].Name = \"updated-name\"\n\t})\n\tframework.ExpectNoError(err)\n\n\t// Use observedGeneration to determine if the controller noticed the pod template update.\n\tframework.Logf(\"Wait deployment %q to be observed by the deployment controller\", deploymentName)\n\tframework.ExpectNoError(framework.WaitForObservedDeployment(c, ns, deploymentName, deployment.Generation))\n\n\t// Wait for it to be updated to revision 2\n\tBy(fmt.Sprintf(\"Waiting deployment %q to be updated to revision 2\", deploymentName))\n\tframework.ExpectNoError(framework.WaitForDeploymentRevisionAndImage(c, ns, deploymentName, \"2\", nginxImage))\n\n\tBy(fmt.Sprintf(\"Waiting deployment %q to complete\", deploymentName))\n\tframework.ExpectNoError(framework.WaitForDeploymentStatus(c, deployment))\n\n\trs, err = deploymentutil.GetNewReplicaSet(deployment, c)\n\tframework.ExpectNoError(err)\n\tif rs == nil {\n\t\tframework.ExpectNoError(fmt.Errorf(\"expected a new replica set for deployment %q\", deployment.Name))\n\t}\n\n\tif rs.UID == t.oldRS.UID {\n\t\tframework.ExpectNoError(fmt.Errorf(\"expected a new replica set different from the previous one\"))\n\t}\n\n\t// Store new replica set - should be the same after the upgrade.\n\tt.newRS = rs\n\tdeployment, err = c.Extensions().Deployments(ns).Get(deployment.Name, metav1.GetOptions{})\n\tframework.ExpectNoError(err)\n\tt.oldD = deployment\n}", "title": "" }, { "docid": "329b40dd67f9e3e402656e7a349fb601", "score": "0.56743884", "text": "func (m *MockTenantRepository) Create(arg0 system.Tenant) (system.Tenant, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", arg0)\n\tret0, _ := ret[0].(system.Tenant)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2775ee7ac3e11407ec71cae07e608cb1", "score": "0.5671856", "text": "func (m *MockDeploymentWriter) UpsertDeployment(ctx context.Context, obj *v10.Deployment, transitionFuncs ...v1.DeploymentTransitionFunction) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range transitionFuncs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertDeployment\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2b5c32332844b211673643b2ac3af210", "score": "0.56686825", "text": "func TestSyncDeploy(t *testing.T) {\n\tclusterManager := newClusterManager(\"testhub\")\n\tcontroller := newTestController(clusterManager).withCRDObject().withKubeObject().withAPIServiceObject()\n\tsyncContext := testinghelper.NewFakeSyncContext(t, \"testhub\")\n\n\terr := controller.controller.sync(nil, syncContext)\n\tif err != nil {\n\t\tt.Errorf(\"Expected non error when sync, %v\", err)\n\t}\n\n\tcreateKubeObjects := []runtime.Object{}\n\tkubeActions := controller.kubeClient.Actions()\n\tfor _, action := range kubeActions {\n\t\tif action.GetVerb() == \"create\" {\n\t\t\tobject := action.(clienttesting.CreateActionImpl).Object\n\t\t\tcreateKubeObjects = append(createKubeObjects, object)\n\t\t}\n\t}\n\n\t// Check if resources are created as expected\n\ttestinghelper.AssertEqualNumber(t, len(createKubeObjects), 23)\n\tfor _, object := range createKubeObjects {\n\t\tensureObject(t, object, clusterManager)\n\t}\n\n\tcreateCRDObjects := []runtime.Object{}\n\tcrdActions := controller.apiExtensionClient.Actions()\n\tfor _, action := range crdActions {\n\t\tif action.GetVerb() == \"create\" {\n\t\t\tobject := action.(clienttesting.CreateActionImpl).Object\n\t\t\tcreateCRDObjects = append(createCRDObjects, object)\n\t\t}\n\t}\n\t// Check if resources are created as expected\n\ttestinghelper.AssertEqualNumber(t, len(createCRDObjects), 8)\n\n\tcreateAPIServiceObjects := []runtime.Object{}\n\tapiServiceActions := controller.apiRegistrationClient.Actions()\n\tfor _, action := range apiServiceActions {\n\t\tif action.GetVerb() == \"create\" {\n\t\t\tobject := action.(clienttesting.CreateActionImpl).Object\n\t\t\tcreateAPIServiceObjects = append(createAPIServiceObjects, object)\n\t\t}\n\t}\n\t// Check if resources are created as expected\n\ttestinghelper.AssertEqualNumber(t, len(createAPIServiceObjects), 2)\n\n\tclusterManagerAction := controller.operatorClient.Actions()\n\ttestinghelper.AssertEqualNumber(t, len(clusterManagerAction), 2)\n\ttestinghelper.AssertAction(t, clusterManagerAction[1], \"update\")\n\ttestinghelper.AssertOnlyConditions(\n\t\tt, clusterManagerAction[1].(clienttesting.UpdateActionImpl).Object,\n\t\ttestinghelper.NamedCondition(clusterManagerApplied, \"ClusterManagerApplied\", metav1.ConditionTrue))\n}", "title": "" }, { "docid": "c0cad73de8a5a874e3866507d77e6a7e", "score": "0.5665984", "text": "func (r *WebsiteReconciler) CreateDeployment(ctx context.Context, req ctrl.Request, website batchv1.Website, log logr.Logger) (ctrl.Result, error) {\n\tvar websiteDeployment *kv2.Deployment\n\twebsiteDeployment = &kv2.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tLabels: website.ObjectMeta.Labels,\n\t\t\tName: req.Name,\n\t\t\tNamespace: req.Namespace,\n\t\t},\n\t\tSpec: kv2.DeploymentSpec{\n\t\t\tReplicas: website.Spec.MinReplica,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: website.ObjectMeta.Labels,\n\t\t\t},\n\t\t\tTemplate: kv1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: website.ObjectMeta.Labels,\n\t\t\t\t\tName: req.Name,\n\t\t\t\t\tNamespace: req.Namespace,\n\t\t\t\t},\n\t\t\t\tSpec: kv1.PodSpec{\n\t\t\t\t\tContainers: []kv1.Container{\n\t\t\t\t\t\tkv1.Container{\n\t\t\t\t\t\t\tName: website.Name,\n\t\t\t\t\t\t\tImage: website.Spec.Image,\n\t\t\t\t\t\t\tPorts: []kv1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tContainerPort: website.Spec.Port,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tImagePullPolicy: kv1.PullIfNotPresent,\n\t\t\t\t\t\t\tResources: kv1.ResourceRequirements{\n\t\t\t\t\t\t\t\tRequests: kv1.ResourceList{\n\t\t\t\t\t\t\t\t\tkv1.ResourceCPU: website.Spec.CPURequest,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tif err := r.Create(ctx, websiteDeployment); err != nil {\n\t\tlog.Error(err, \"unable to create website deployment for Website\", \"website\", websiteDeployment)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tlog.V(1).Info(\"created website deployment for Website run\", \"websitePod\", websiteDeployment)\n\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, nil\n}", "title": "" }, { "docid": "844e414c968e94822fb39b18d2fda21c", "score": "0.5665948", "text": "func (c *restClient) CreateDeployment(ctx context.Context, req *configpb.CreateDeploymentRequest, opts ...gax.CallOption) (*CreateDeploymentOperation, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tbody := req.GetDeployment()\n\tjsonReq, err := m.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v/deployments\", req.GetParent())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\tparams.Add(\"deploymentId\", fmt.Sprintf(\"%v\", req.GetDeploymentId()))\n\tif req.GetRequestId() != \"\" {\n\t\tparams.Add(\"requestId\", fmt.Sprintf(\"%v\", req.GetRequestId()))\n\t}\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"parent\", url.QueryEscape(req.GetParent()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &longrunningpb.Operation{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"POST\", baseUrl.String(), bytes.NewReader(jsonReq))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\toverride := fmt.Sprintf(\"/v1/%s\", resp.GetName())\n\treturn &CreateDeploymentOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, resp),\n\t\tpollPath: override,\n\t}, nil\n}", "title": "" }, { "docid": "c3ef64bac28a0f0e504f8b58101eb606", "score": "0.5662152", "text": "func (d *Demodeployment) getDeploymentDef() {\n\td.Deployment = &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: d.Name,\n\t\t\tNamespace: d.Namespace,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: int32Ptr(2),\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": \"demo\",\n\t\t\t\t\t\"name\": d.Name,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: apiv1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": \"demo\",\n\t\t\t\t\t\t\"name\": d.Name,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: apiv1.PodSpec{\n\t\t\t\t\tContainers: []apiv1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"web\",\n\t\t\t\t\t\t\tImage: \"microk8s:32000/simpleapp:latest\",\n\t\t\t\t\t\t\tEnv: []apiv1.EnvVar{},\n\t\t\t\t\t\t\tResources: apiv1.ResourceRequirements{\n\t\t\t\t\t\t\t\tLimits: apiv1.ResourceList{\n\t\t\t\t\t\t\t\t\t\"cpu\": resource.MustParse(\"50m\"),\n\t\t\t\t\t\t\t\t\t\"memory\": resource.MustParse(\"50M\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tRequests: apiv1.ResourceList{\n\t\t\t\t\t\t\t\t\t\"cpu\": resource.MustParse(\"25m\"),\n\t\t\t\t\t\t\t\t\t\"memory\": resource.MustParse(\"25M\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tReadinessProbe: &apiv1.Probe{\n\t\t\t\t\t\t\t\tHandler: apiv1.Handler{HTTPGet: &apiv1.HTTPGetAction{Path: \"/status/readyz\", Port: intstr.FromInt(8080), Scheme: \"HTTP\"}},\n\t\t\t\t\t\t\t\tInitialDelaySeconds: 5,\n\t\t\t\t\t\t\t\tTimeoutSeconds: 5,\n\t\t\t\t\t\t\t\tPeriodSeconds: 5,\n\t\t\t\t\t\t\t\tSuccessThreshold: 5,\n\t\t\t\t\t\t\t\tFailureThreshold: 5,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a72b4fcc370dfd5c3c8d7a1e1047b5fd", "score": "0.56614107", "text": "func (s *PackagingIntegrationRouteSuite) TestCreatePackagingIntegrationModifiable() {\n\tnewResource := newPackagingIntegration()\n\n\tnewResourceBody, err := json.Marshal(newResource)\n\ts.g.Expect(err).NotTo(HaveOccurred())\n\n\treqTime := routes.GetTimeNowTruncatedToSeconds()\n\tw := httptest.NewRecorder()\n\treq, err := http.NewRequest(\n\t\thttp.MethodPost, pack_route.CreatePackagingIntegrationURL, bytes.NewReader(newResourceBody),\n\t)\n\ts.g.Expect(err).NotTo(HaveOccurred())\n\ts.server.ServeHTTP(w, req)\n\n\tvar resp packaging.ModelPackaging\n\terr = json.Unmarshal(w.Body.Bytes(), &resp)\n\ts.g.Expect(err).NotTo(HaveOccurred())\n\n\ts.g.Expect(w.Code).Should(Equal(http.StatusCreated))\n\ts.g.Expect(resp.Status.CreatedAt).NotTo(BeNil())\n\tcreatedAtWasNotUpdated := reqTime.Before(resp.Status.CreatedAt) || reqTime.Equal(resp.Status.CreatedAt)\n\ts.g.Expect(createdAtWasNotUpdated).Should(Equal(true))\n\ts.g.Expect(resp.Status.UpdatedAt).NotTo(BeNil())\n\tupdatedAtWasUpdated := reqTime.Before(resp.Status.CreatedAt) || reqTime.Equal(resp.Status.CreatedAt)\n\ts.g.Expect(updatedAtWasUpdated).Should(Equal(true))\n}", "title": "" }, { "docid": "b7f8cc4ae1f5dde535abe18be39b9d9f", "score": "0.565201", "text": "func (m *MockImpl) Create(arg0 context.Context, arg1, arg2 string, arg3 []byte) (topo.Version, error) {\n\tret := m.ctrl.Call(m, \"Create\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(topo.Version)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b7f8cc4ae1f5dde535abe18be39b9d9f", "score": "0.565201", "text": "func (m *MockImpl) Create(arg0 context.Context, arg1, arg2 string, arg3 []byte) (topo.Version, error) {\n\tret := m.ctrl.Call(m, \"Create\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(topo.Version)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "40f9542fae88184ce5e4ce638be7e517", "score": "0.56385493", "text": "func (r *HelloReconciler) createDeployment(h *examplecomv1alpha1.Hello) *appsv1.Deployment {\n\tls := map[string]string{\"app\": \"hello\", \"hello_cr\": h.Name}\n\treplicas := h.Spec.Instances\n\n\tdep := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: h.Name,\n\t\t\tNamespace: h.Namespace,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: ls,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: ls,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{{\n\t\t\t\t\t\tImage: \"tutum/hello-world\",\n\t\t\t\t\t\tName: \"hello\",\n\t\t\t\t\t\tPorts: []corev1.ContainerPort{{\n\t\t\t\t\t\t\tContainerPort: 80,\n\t\t\t\t\t\t\tName: \"hello\",\n\t\t\t\t\t\t}},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\t_ = ctrl.SetControllerReference(h, dep, r.Scheme)\n\treturn dep\n}", "title": "" }, { "docid": "7d5203d409ab2cb4042025f9707c2d23", "score": "0.5635469", "text": "func (m *MockRuntimeRepo) Create(ctx context.Context, runtime *entity.Runtime) (*entity.Runtime, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", ctx, runtime)\n\tret0, _ := ret[0].(*entity.Runtime)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "12914546e12624d4874e6400539ed0c2", "score": "0.5634499", "text": "func TestCheckDeploymentChanged(t *testing.T) {\n\tlogger := logtesting.TestLogger(t).Desugar()\n\ttests := []struct {\n\t\tname string\n\t\texistingDeployment *appsv1.Deployment\n\t\tnewDeployment *appsv1.Deployment\n\t\texpectUpdated bool\n\t}{\n\t\t{\n\t\t\tname: \"Different Image\",\n\t\t\texistingDeployment: getBasicDeployment(),\n\t\t\tnewDeployment: getBasicDeployment(withDifferentImage),\n\t\t\texpectUpdated: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Missing Required Deployment Label\",\n\t\t\texistingDeployment: getBasicDeployment(),\n\t\t\tnewDeployment: getBasicDeployment(withDeploymentLabel),\n\t\t\texpectUpdated: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Missing Required Template Label\",\n\t\t\texistingDeployment: getBasicDeployment(),\n\t\t\tnewDeployment: getBasicDeployment(withTemplateLabel),\n\t\t\texpectUpdated: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Missing Required Deployment Annotation\",\n\t\t\texistingDeployment: getBasicDeployment(),\n\t\t\tnewDeployment: getBasicDeployment(withDeploymentAnnotation),\n\t\t\texpectUpdated: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Missing Required Template Annotation\",\n\t\t\texistingDeployment: getBasicDeployment(),\n\t\t\tnewDeployment: getBasicDeployment(withTemplateAnnotation),\n\t\t\texpectUpdated: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Missing Existing Container\",\n\t\t\texistingDeployment: getBasicDeployment(withoutContainer),\n\t\t\tnewDeployment: getBasicDeployment(),\n\t\t\texpectUpdated: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Extra Existing Deployment Label\",\n\t\t\texistingDeployment: getBasicDeployment(withDeploymentLabel),\n\t\t\tnewDeployment: getBasicDeployment(),\n\t\t},\n\t\t{\n\t\t\tname: \"Extra Existing Template Label\",\n\t\t\texistingDeployment: getBasicDeployment(withTemplateLabel),\n\t\t\tnewDeployment: getBasicDeployment(),\n\t\t},\n\t\t{\n\t\t\tname: \"Extra Existing Deployment Annotation\",\n\t\t\texistingDeployment: getBasicDeployment(withDeploymentAnnotation),\n\t\t\tnewDeployment: getBasicDeployment(),\n\t\t},\n\t\t{\n\t\t\tname: \"Extra Existing Template Annotation\",\n\t\t\texistingDeployment: getBasicDeployment(withTemplateAnnotation),\n\t\t\tnewDeployment: getBasicDeployment(),\n\t\t},\n\t\t{\n\t\t\tname: \"Missing New Container\",\n\t\t\texistingDeployment: getBasicDeployment(),\n\t\t\tnewDeployment: getBasicDeployment(withoutContainer),\n\t\t},\n\t\t{\n\t\t\tname: \"Multiple Existing Containers\",\n\t\t\texistingDeployment: getBasicDeployment(withExtraContainer),\n\t\t\tnewDeployment: getBasicDeployment(),\n\t\t},\n\t\t{\n\t\t\tname: \"Multiple Existing Containers, Incorrect First\",\n\t\t\texistingDeployment: getBasicDeployment(withExtraContainerFirst),\n\t\t\tnewDeployment: getBasicDeployment(),\n\t\t},\n\t\t{\n\t\t\tname: \"Multiple Existing Containers, Missing Required Deployment Annotation\",\n\t\t\texistingDeployment: getBasicDeployment(withExtraContainer),\n\t\t\tnewDeployment: getBasicDeployment(withDeploymentAnnotation),\n\t\t\texpectUpdated: true,\n\t\t}, {\n\t\t\tname: \"Multiple Existing Containers, Missing Required Template Annotation\",\n\t\t\texistingDeployment: getBasicDeployment(withExtraContainer),\n\t\t\tnewDeployment: getBasicDeployment(withTemplateAnnotation),\n\t\t\texpectUpdated: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Multiple Existing Containers, Incorrect First, Missing Required Deployment Annotation\",\n\t\t\texistingDeployment: getBasicDeployment(withExtraContainerFirst),\n\t\t\tnewDeployment: getBasicDeployment(withDeploymentAnnotation),\n\t\t\texpectUpdated: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Multiple Existing Containers, Incorrect First, Missing Required Template Annotation\",\n\t\t\texistingDeployment: getBasicDeployment(withExtraContainerFirst),\n\t\t\tnewDeployment: getBasicDeployment(withTemplateAnnotation),\n\t\t\texpectUpdated: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Container With Incorrect Name\",\n\t\t\texistingDeployment: getBasicDeployment(withDifferentContainer),\n\t\t\tnewDeployment: getBasicDeployment(),\n\t\t\texpectUpdated: true,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tnewDeployment := tt.newDeployment\n\t\t\tif newDeployment == nil {\n\t\t\t\tnewDeployment = getBasicDeployment()\n\t\t\t}\n\t\t\tupdatedDeployment, isUpdated := CheckDeploymentChanged(logger, tt.existingDeployment, newDeployment)\n\t\t\tassert.NotNil(t, updatedDeployment)\n\t\t\tassert.Equal(t, tt.expectUpdated, isUpdated)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "817d0ed0ed3f3fab53669d2c2e4bce5f", "score": "0.5630079", "text": "func (k *K8sutil) CreateKongDeployment(baseImage string, replicas *int32, namespace string) error {\n\n\t// Check if deployment exists\n\tdeployment, err := k.KubernetesInterface.AppsV1beta2().Deployments(namespace).Get(kongDeploymentName, metav1.GetOptions{})\n\n\tif len(deployment.Name) == 0 {\n\t\tlogrus.Infof(\"%s not found, creating...\", kongDeploymentName)\n\n\t\tdeployment := &v1beta2.Deployment{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: kongDeploymentName,\n\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\"app\": \"kong\",\n\t\t\t\t\t\"name\": kongDeploymentName,\n\t\t\t\t},\n\t\t\t},\n\t\t\tSpec: v1beta2.DeploymentSpec{\n\t\t\t\tReplicas: replicas,\n\t\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\t\"app\": \"kong\",\n\t\t\t\t\t\t\"name\": kongDeploymentName,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\t\"app\": \"kong\",\n\t\t\t\t\t\t\t\"name\": kongDeploymentName,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t\tcorev1.Container{\n\t\t\t\t\t\t\t\tName: kongDeploymentName,\n\t\t\t\t\t\t\t\tImage: baseImage,\n\t\t\t\t\t\t\t\tEnv: []corev1.EnvVar{\n\t\t\t\t\t\t\t\t\tcorev1.EnvVar{\n\t\t\t\t\t\t\t\t\t\tName: \"NAMESPACE\",\n\t\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"metadata.namespace\",\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcorev1.EnvVar{\n\t\t\t\t\t\t\t\t\t\tName: \"KONG_PG_USER\",\n\t\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\t\tSecretKeyRef: &corev1.SecretKeySelector{\n\t\t\t\t\t\t\t\t\t\t\t\tKey: \"KONG_PG_USER\",\n\t\t\t\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\t\t\tName: kongPostgresSecretName,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcorev1.EnvVar{\n\t\t\t\t\t\t\t\t\t\tName: \"KONG_PG_PASSWORD\",\n\t\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\t\tSecretKeyRef: &corev1.SecretKeySelector{\n\t\t\t\t\t\t\t\t\t\t\t\tKey: \"KONG_PG_PASSWORD\",\n\t\t\t\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\t\t\tName: kongPostgresSecretName,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcorev1.EnvVar{\n\t\t\t\t\t\t\t\t\t\tName: \"KONG_PG_HOST\",\n\t\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\t\tSecretKeyRef: &corev1.SecretKeySelector{\n\t\t\t\t\t\t\t\t\t\t\t\tKey: \"KONG_PG_HOST\",\n\t\t\t\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\t\t\tName: kongPostgresSecretName,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcorev1.EnvVar{\n\t\t\t\t\t\t\t\t\t\tName: \"KONG_PG_DATABASE\",\n\t\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\t\tSecretKeyRef: &corev1.SecretKeySelector{\n\t\t\t\t\t\t\t\t\t\t\t\tKey: \"KONG_PG_DATABASE\",\n\t\t\t\t\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\t\t\tName: kongPostgresSecretName,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcorev1.EnvVar{\n\t\t\t\t\t\t\t\t\t\tName: \"KONG_HOST_IP\",\n\t\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"status.podIP\",\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcorev1.EnvVar{\n\t\t\t\t\t\t\t\t\t\tName: \"KONG_ADMIN_LISTEN\", // Disable non-tls\n\t\t\t\t\t\t\t\t\t\tValue: \"127.0.0.1:8001\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tCommand: []string{\n\t\t\t\t\t\t\t\t\t\"/bin/sh\", \"-c\",\n\t\t\t\t\t\t\t\t\t\"KONG_CLUSTER_ADVERTISE=$(KONG_HOST_IP):7946 KONG_NGINX_DAEMON='off' kong start\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\t\tcorev1.ContainerPort{\n\t\t\t\t\t\t\t\t\t\tName: \"proxy\",\n\t\t\t\t\t\t\t\t\t\tContainerPort: 8000,\n\t\t\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcorev1.ContainerPort{\n\t\t\t\t\t\t\t\t\t\tName: \"proxy-ssl\",\n\t\t\t\t\t\t\t\t\t\tContainerPort: 8443,\n\t\t\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcorev1.ContainerPort{\n\t\t\t\t\t\t\t\t\t\tName: \"surf-tcp\",\n\t\t\t\t\t\t\t\t\t\tContainerPort: 7946,\n\t\t\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcorev1.ContainerPort{\n\t\t\t\t\t\t\t\t\t\tName: \"surf-udp\",\n\t\t\t\t\t\t\t\t\t\tContainerPort: 7946,\n\t\t\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolUDP,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\t_, err := k.KubernetesInterface.AppsV1beta2().Deployments(namespace).Create(deployment)\n\n\t\tif err != nil {\n\t\t\tlogrus.Error(\"Could not create kong deployment: \", err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif err != nil {\n\t\t\tlogrus.Error(\"Could not get kong deployment! \", err)\n\t\t\treturn err\n\t\t}\n\n\t\t//scale replicas?\n\t\tif deployment.Spec.Replicas != replicas {\n\t\t\tdeployment.Spec.Replicas = replicas\n\n\t\t\t_, err := k.KubernetesInterface.AppsV1beta2().Deployments(namespace).Update(deployment)\n\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Error(\"Could not scale deployment: \", err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1aab9b89d9db5f3fb8a882ad8dc47606", "score": "0.56263083", "text": "func mustGetDeployment(g *gomega.WithT, objs *objectSet, deploymentName string) *object.K8sObject {\n\tobj := objs.kind(name2.DeploymentStr).nameEquals(deploymentName)\n\tg.Expect(obj).Should(gomega.Not(gomega.BeNil()))\n\treturn obj\n}", "title": "" }, { "docid": "7de8c5f4a509b1ea333f907f147894ca", "score": "0.56154805", "text": "func newDeploymentForCR(cr *appv1alpha1.AppSet) *appsv1.Deployment {\n\treturn \t&appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name + \"-deployment\",\n\t\t\tNamespace: cr.Namespace,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: int32Ptr(cr.Spec.Replicas),\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": cr.Name,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": cr.Name,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: cr.Name + \"-pod\",\n\t\t\t\t\t\t\tImage: cr.Spec.Image,\n\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"http\",\n\t\t\t\t\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\tContainerPort: 8080,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n}", "title": "" }, { "docid": "1d525b1a383325d6c92e031fb90321d4", "score": "0.56152135", "text": "func (s *Deployment) Deploy() error {\n\tif err := s.createNamespace(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createServiceAccountForDaemonSet(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createServiceAccountForAPIManager(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleForSchedulerExtenderVolumeChecker(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleBindingForSchedulerExtenderVolumeChecker(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleForKeyMgmt(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleBindingForKeyMgmt(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleForNFS(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleBindingForNFS(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleForInit(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createClusterRoleBindingForInit(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createInitSecret(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createTLSEtcdSecret(); err != nil {\n\t\treturn err\n\t}\n\n\t// ConfigMap is mutable - apply updates.\n\tif err := s.ensureConfigMap(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createDaemonSet(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createService(); err != nil {\n\t\treturn err\n\t}\n\n\tif s.stos.Spec.Ingress.Enable {\n\t\tif s.stos.Spec.Ingress.TLS {\n\t\t\tif err := s.createTLSSecret(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := s.createIngress(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif s.stos.Spec.CSI.Enable {\n\t\t// Create CSIDriver if supported.\n\t\tsupportsCSIDriver, err := HasCSIDriverKind(s.discoveryClient)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif supportsCSIDriver {\n\t\t\tif err := s.createCSIDriver(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Create CSI exclusive resources.\n\t\tif err := s.createCSISecrets(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleForDriverRegistrar(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForDriverRegistrar(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForK8SDriverRegistrar(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createServiceAccountForCSIHelper(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleForProvisioner(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleForAttacher(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleForResizer(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForProvisioner(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForAttacher(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForResizer(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createCSIHelper(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := s.createAPIManager(); err != nil {\n\t\treturn err\n\t}\n\n\tif !s.stos.Spec.DisableScheduler {\n\t\tif err := s.createSchedulerExtender(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Add openshift security context constraints.\n\tif strings.Contains(s.stos.Spec.K8sDistro, K8SDistroOpenShift) {\n\t\tif err := s.createClusterRoleForSCC(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.createClusterRoleBindingForSCC(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Create role for Pod Fencing.\n\tif !s.stos.Spec.DisableFencing {\n\t\tif err := s.createClusterRoleForFencing(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := s.createClusterRoleBindingForFencing(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := s.createStorageClass(); err != nil {\n\t\treturn err\n\t}\n\n\tstatus, err := s.getStorageOSStatus()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get storageos status: %v\", err)\n\t}\n\treturn s.updateStorageOSStatus(status)\n}", "title": "" }, { "docid": "743679e35c6f3517f09af4359af67820", "score": "0.5613785", "text": "func (c *KubeCli) CreateDeployment(projName, envName, codeBranch string, podNum int32) error {\n\t//envName = projName + \"-\" + envName\n\tenv := &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: envName,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: int32Ptr(podNum),\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": envName,\n\t\t\t\t\t\"branch\": codeBranch,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": envName,\n\t\t\t\t\t\t\"branch\": codeBranch,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: envName,\n\t\t\t\t\t\t\tImage: \"nginx\", // for default image\n\t\t\t\t\t\t\tPorts: []v1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"http\",\n\t\t\t\t\t\t\t\t\tProtocol: v1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\tContainerPort: 80,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tResources: v1.ResourceRequirements{\n\t\t\t\t\t\t\t\tLimits: v1.ResourceList{},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\t_, err := c.cliSet.AppsV1().Deployments(projName).Create(context.TODO(), env, metav1.CreateOptions{})\n\treturn err\n}", "title": "" }, { "docid": "58092afe18b9ed7f618de19d6bd481af", "score": "0.5601176", "text": "func (m *MockTransaction) Create(arg0 *schema.Resource) error {\n\tret := m.ctrl.Call(m, \"Create\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "21f1408aef560d6dc283197ae032907c", "score": "0.55982375", "text": "func (m *MockDeploymentClient) Write(resource *kubernetes.Deployment, opts clients.WriteOpts) (*kubernetes.Deployment, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Write\", resource, opts)\n\tret0, _ := ret[0].(*kubernetes.Deployment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fe6e099d3c0e2ef0d11274f87ec123c2", "score": "0.5595853", "text": "func (m *MockAPI) DeploymentStream(arg0 string) (*websocket.Conn, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeploymentStream\", arg0)\n\tret0, _ := ret[0].(*websocket.Conn)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "aca42f0193212e69c90c68b52d427d25", "score": "0.55917084", "text": "func (m *MockRepository) CreateShortUrl(ctx context.Context, originalUrl, slug string, accountID uint64) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateShortUrl\", ctx, originalUrl, slug, accountID)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "56b088df567d6b9c031eb4a974d73c45", "score": "0.55843204", "text": "func SetupTest(ctx context.Context) *corev1.Namespace {\n\tfmt.Println(\"SetupTest start\")\n\tvar stopCh chan struct{}\n\tns := &corev1.Namespace{}\n\tdeploy := &appsv1.Deployment{}\n\tpodlist := &corev1.PodList{}\n\tdeployLabel := map[string]string{\"deploy\": \"test-deploy\"}\n\tpds := &pdov1.PodDisposalSchedule{ObjectMeta: metav1.ObjectMeta{\n\t\tName: \"test-pds\",\n\t\tNamespace: ns.Name,\n\t}}\n\n\tBeforeEach(func() {\n\t\tfmt.Println(\"BeforeEach start\")\n\t\tstopCh = make(chan struct{})\n\n\t\t// create test namespace\n\t\t*ns = corev1.Namespace{\n\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"testns-\" + randStringRunes(5)},\n\t\t}\n\t\terr := k8sClient.Create(ctx, ns)\n\t\tExpect(err).NotTo(HaveOccurred(), \"failed to create test namespace\")\n\n\t\tpodspec := corev1.PodSpec{\n\t\t\tContainers: []corev1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: \"test-container\",\n\t\t\t\t\tImage: \"nginx:alpine\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\t// create test deployment\n\t\treplica := int32(3)\n\t\t*deploy = appsv1.Deployment{\n\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"test-deploy\", Namespace: ns.Name},\n\t\t\tSpec: appsv1.DeploymentSpec{\n\t\t\t\tReplicas: &replica,\n\t\t\t\tSelector: &metav1.LabelSelector{MatchLabels: deployLabel},\n\t\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\t\tObjectMeta: metav1.ObjectMeta{Labels: deployLabel},\n\t\t\t\t\tSpec: podspec,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\terr = k8sClient.Create(ctx, deploy)\n\t\tExpect(err).NotTo(HaveOccurred(), \"failed to create test deploy\")\n\n\t\t// create test pods\n\t\tfor i := 0; i < 3; i++ {\n\t\t\tpod := corev1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: fmt.Sprintf(\"test-deploy-pod-%d\", i), Namespace: ns.Name, Labels: deployLabel},\n\t\t\t\tSpec: podspec,\n\t\t\t}\n\t\t\tpodlist.Items = append(podlist.Items, pod)\n\t\t\terr = k8sClient.Create(ctx, &pod)\n\t\t\tExpect(err).NotTo(HaveOccurred(), \"failed to create test pod\")\n\t\t\terr = updatePodStatusRunning(ctx, &pod)\n\t\t\tExpect(err).NotTo(HaveOccurred(), \"failed to update pod running\")\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\n\t\t// PodDisposalScheduleReconciler manager start\n\t\tmgr, err := ctrl.NewManager(cfg, ctrl.Options{})\n\t\tExpect(err).NotTo(HaveOccurred(), \"failed to create manager\")\n\n\t\terr = (&PodDisposalScheduleReconciler{\n\t\t\tClient: mgr.GetClient(),\n\t\t\tLog: ctrl.Log.WithName(\"controllers\").WithName(\"PodDisposalSchedule\"),\n\t\t\tScheme: mgr.GetScheme(),\n\t\t}).SetupWithManager(mgr)\n\n\t\tExpect(err).NotTo(HaveOccurred(), \"failed to setup controller\")\n\n\t\tgo func() {\n\t\t\terr := mgr.Start(stopCh)\n\t\t\tExpect(err).NotTo(HaveOccurred(), \"failed to start manager\")\n\t\t}()\n\n\t\tfmt.Println(\"BeforeEach end\")\n\t})\n\n\tAfterEach(func() {\n\t\tfmt.Println(\"AfterEach start\")\n\t\tclose(stopCh)\n\n\t\t_ = k8sClient.Delete(ctx, pds)\n\n\t\tfor _, pod := range podlist.Items {\n\t\t\t_ = k8sClient.Delete(ctx, &pod)\n\t\t}\n\t\t_ = k8sClient.Delete(ctx, deploy)\n\n\t\terr := k8sClient.Delete(ctx, ns)\n\t\tExpect(err).NotTo(HaveOccurred(), \"failed to delete test namespace\")\n\n\t\tfmt.Println(\"AfterEach end\")\n\t})\n\n\tfmt.Println(\"SetupTest end\")\n\treturn ns\n}", "title": "" }, { "docid": "6c9cc2ef73a13469226ac5ba43096010", "score": "0.55838233", "text": "func (m *MockNamespaceInterface) Create(arg0 context.Context, arg1 *v1.Namespace, arg2 v11.CreateOptions) (*v1.Namespace, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Create\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(*v1.Namespace)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2cd70976744c5ea8c4d22bf211315bd4", "score": "0.5576518", "text": "func (client SitesClient) CreateDeploymentResponder(resp *http.Response) (result Deployment, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "b1d91d804643061530359e93c153c85f", "score": "0.556883", "text": "func (deployer *K8SDeployer) CreateDeployment(uploadedFiles map[string]string) (interface{}, error) {\n\tif err := deployCluster(deployer, uploadedFiles); err != nil {\n\t\treturn nil, errors.New(\"Unable to deploy kubernetes: \" + err.Error())\n\t}\n\n\tresponse := &CreateDeploymentResponse{\n\t\tName: deployer.Deployment.Name,\n\t\tServices: deployer.Services,\n\t\tBastionIp: deployer.BastionIp,\n\t\tMasterIp: deployer.MasterIp,\n\t}\n\n\treturn response, nil\n}", "title": "" } ]
aea0fd04a728910f3d7fcf5cb9a4a6f9
Submit a work item to the worker pool
[ { "docid": "3adf51a8ce02b995f6d5a75dcc6cdab3", "score": "0.6332099", "text": "func (w *Worker) Submit(ctx context.Context, wi func(wid, jid int)) {\n\tid := atomic.AddInt64(&jobID, 1)\n\tw.logger.Debug().Printf(\"[WORKER] Job %d is waiting...\", id)\n\tselect {\n\tcase <-w.stop:\n\t\tw.logger.Debug().Printf(\"[WORKER] Stopped, job %d discared\", id)\n\t\treturn\n\tcase <-ctx.Done():\n\t\tw.logger.Debug().Printf(\"[WORKER] Cancled, job %d discared\", id)\n\t\treturn\n\tcase wid := <-w.tokens:\n\t\tw.wg.Add(1)\n\t\tfn := func(wid, id int) {\n\t\t\tw.logger.Debug().Printf(\"[WORKER %d] Job %d is started\", wid, id)\n\t\t\twi(wid, id)\n\t\t\tw.logger.Debug().Printf(\"[WORKER %d] Job %d is done\", wid, id)\n\t\t\tw.tokens <- wid\n\t\t\tw.wg.Done()\n\t\t}\n\t\tgo fn(wid, int(id))\n\t}\n}", "title": "" } ]
[ { "docid": "80bda8948ae9bdea340a60a1034dfef0", "score": "0.7151295", "text": "func (p *Pool) Submit(task Task) {\n\tp.taskWg.Add(1)\n\n\t// Wait for an available worker\n\tw := <-p.availableWorker\n\n\t// Submit the task to the worker\n\tw.Submit(task)\n}", "title": "" }, { "docid": "fb0a2a5205513628036da09cc61a87a4", "score": "0.7117851", "text": "func (ws *Workers) Submit(c *conn, id uint64, data []byte) {\n\tt := task{c: c, id: id, data: data}\n\tselect {\n\t// try to use an existing worker goroutine\n\tcase ws.ch <- t:\n\tdefault:\n\t\t// otherwise start a new one\n\t\tgo ws.worker(t)\n\t}\n}", "title": "" }, { "docid": "085f36b208c0a54755d512b864263b3c", "score": "0.6950975", "text": "func (m Manager) Submit(log log.T, jobID string, job task.Job) error {\n\treturn m.executionPool.Submit(log, jobID, job)\n}", "title": "" }, { "docid": "e16075797478d1459e778f317107dd5a", "score": "0.68276125", "text": "func (p *pool) submit(req *http.Request) {\n\tp.jobs <- req\n}", "title": "" }, { "docid": "923d2d48f01ba70285c5ac63900b34da", "score": "0.6758945", "text": "func (p *Pool) Submit(task func()) error {\n\tif p.IsClosed() {\n\t\treturn ErrPoolClosed\n\t}\n\tif w := p.retrieveWorker(); w != nil {\n\t\tw.inputFunc(task)\n\t\treturn nil\n\t}\n\treturn ErrPoolOverload\n}", "title": "" }, { "docid": "b4a6edf89c9bf6392b3b2a551bbceb89", "score": "0.6682243", "text": "func (p *BlameWorkerPool) Submit(job *Commit) {\n\tp.commitjobs <- job\n}", "title": "" }, { "docid": "d8064a180fb9f8c03c1f8e1d8090d243", "score": "0.6538692", "text": "func (m *Manager) Submit(hps mnist.CrossvalList) string {\n\t// extract current id from manager and increase counter by 1\n\tid := strconv.Itoa(m.counter)\n\tm.counter++\n\n\t// fill channel with a new Job with the current input and the id\n\tm.jobs <- Job{\n\t\tID: id,\n\t\tInput: hps,\n\t}\n\treturn id\n}", "title": "" }, { "docid": "64fde6990ab69070dab6efb896c92166", "score": "0.64713156", "text": "func (workPool *WorkPool) PostWork(goRoutine string, work PoolWorker) (err error) {\n\tdefer catchPanic(&err, goRoutine, \"PostWork\")\n\n\tpoolWork := poolWork{work, make(chan error)}\n\n\tdefer close(poolWork.resultChannel)\n\n\tworkPool.queueChannel <- poolWork\n\terr = <-poolWork.resultChannel\n\n\treturn err\n}", "title": "" }, { "docid": "deb8a03038d7905d0717a87a78f6b9d9", "score": "0.64469504", "text": "func (e *Executor) Submit(task worker.Task) error {\n\tif e.state != STARTED {\n\t\treturn fmt.Errorf(\"executor [%s] is not started\", e.name)\n\n\t}\n\n\t// Submit the task to the dispatcher\n\te.wg.Add(1)\n\te.tasks <- task\n\n\treturn nil\n}", "title": "" }, { "docid": "373a8c837c1eaaa9242de0660c3457b1", "score": "0.6319498", "text": "func (executor *WorkerPoolExecutor) Submit(task Task) (TaskHandle, error) {\n\t// Create task handle for the task.\n\thandle := newWorkerPoolTask(task, executor)\n\n\t// Wrap input task into a workerPoolTask.\n\ttask = handle\n\n\t// Load config into local stack.\n\tconfig := executor.config\n\n\t// Load state.\n\tstate := executor.loadState()\n\n\t// Ensure minimum number of workers.\n\tif state.WorkerCount() < config.MinPoolSize {\n\t\tif err := executor.addWorker(task, config.MinPoolSize); err == nil {\n\t\t\treturn handle, nil\n\t\t}\n\t\t// Ignore errors and reload state.\n\t\tstate = executor.loadState()\n\t}\n\n\tif state.IsRunning() {\n\t\t// Try to give the task to existing worker by putting it to the queue. Note that this assumes\n\t\t// that there's always a worker in the pool to process it.\n\t\tif err := executor.addTask(task); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn handle, nil\n\t}\n\n\t// Final try by directly requesting a worker to perform the task.\n\tif err := executor.addWorker(task, config.MaxPoolSize); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn handle, nil\n}", "title": "" }, { "docid": "ce02743d2257cf0af8ef8e45863f53b3", "score": "0.63031167", "text": "func (s *SimpleScheduler) Submit(r engine.Request) {\n\tgo func() { s.workerChan <- r }()\n}", "title": "" }, { "docid": "c12b3fb32b6bc51fc9720a63c1a982ab", "score": "0.6286561", "text": "func (c *Operator) worker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "c12b3fb32b6bc51fc9720a63c1a982ab", "score": "0.6286561", "text": "func (c *Operator) worker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "b1fcd3035774a9c35e883f2704c7459e", "score": "0.6273464", "text": "func (grp *GRPool) Submit(job func()) error {\n if !grp.pipeOpen {\n return errors.New(\"job pipe is not open, Stop() has been called on this pool already\")\n }\n grp.pipe <- job\n return nil\n}", "title": "" }, { "docid": "3f5e4cf9ea077e5aecbaed819eec359a", "score": "0.61941004", "text": "func (ctrl *Controller) worker() {\n\tfor ctrl.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "be6b9333fca0450c6cabc4e787966a2e", "score": "0.61924493", "text": "func (wp *WorkerPoolXT) SubmitXT(job Job) {\n\twp.Submit(wp.wrap(job))\n}", "title": "" }, { "docid": "80c7995c1a597a47a48748c25d2b2d90", "score": "0.6098795", "text": "func (w *Workflow) Submit(ctx context.Context, req *pb.WorkReq) (*pb.WorkResp, error) {\n\tvalidateCtx, cancel := context.WithTimeout(ctx, 30*time.Second)\n\tdefer cancel()\n\n\tif err := executor.Validate(validateCtx, req); err != nil {\n\t\tif errors.Is(err, context.Canceled) {\n\t\t\treturn nil, status.Error(codes.DeadlineExceeded, err.Error())\n\t\t}\n\t\treturn nil, status.Error(codes.InvalidArgument, err.Error())\n\t}\n\n\t// Generate a unique ID.\n\tu, err := uuid.NewUUID()\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"problem getting UUIDv1; %s\", err.Error())\n\t}\n\tid := u.String()\n\tp := filepath.Join(w.storageDir, id)\n\n\tresp := &pb.WorkResp{Id: u.String()}\n\n\tb, err := proto.Marshal(req)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"could not marshal the request: %s\", err)\n\t}\n\n\tf, err := os.OpenFile(p, os.O_CREATE+os.O_WRONLY, 0600)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"could not open file at(%s): %s\", w.storageDir, err)\n\t}\n\tdefer f.Close()\n\n\tif _, err := f.Write(b); err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"problem writing request to storage: %s\", err)\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "46dff130d8bd3574c6fad13b2715d7d3", "score": "0.6095478", "text": "func (b *Backend) Submit(task *tes.Task) error {\n\treturn nil\n}", "title": "" }, { "docid": "8da2b9a40df35feb5642e944f8db1ec4", "score": "0.6078273", "text": "func (wp *workerPool[T]) enqueueSpawn(ctx context.Context, it *contextualItem[T]) error {\n\t// select is fair, and as such if two possible communication paths are possible\n\t// (both fastQueue, and mainQueue) the one which will proceed is chosen based\n\t// on a uniform pseudo-random selection. As such, we initially attempt to submit\n\t// the work directly via the fast queue, and only if that fails we attempt to use\n\t// the main buffered queue.\n\tselect {\n\tcase <-wp.Done():\n\t\treturn wp.Err()\n\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\n\tcase wp.fastQueue <- it:\n\t\treturn nil\n\n\tdefault:\n\t}\n\n\tselect {\n\tcase <-wp.Done():\n\t\treturn wp.Err()\n\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\n\tcase wp.fastQueue <- it:\n\t\treturn nil\n\n\tcase wp.mainQueue <- it:\n\t\tregisterWorkEnqueued(wp.Name)\n\t\tit = nil\n\n\tdefault:\n\t}\n\n\tif spawned := wp.spawnWorker(it); spawned || it == nil {\n\t\treturn nil\n\t}\n\n\tregisterWorkDropped(it.ctx, wp.Name)\n\treturn errPoolFull.New()\n}", "title": "" }, { "docid": "f1befdd3c285795e67cb2e81446b872a", "score": "0.607551", "text": "func (c *Controller) worker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "f1befdd3c285795e67cb2e81446b872a", "score": "0.607551", "text": "func (c *Controller) worker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "394a3de4a358a4ff386e68dad1c31124", "score": "0.6044613", "text": "func (s *QueueScheduler) Submit(r engine.Request) {\n\ts.requestChan <- r\n}", "title": "" }, { "docid": "56625c85c358e129a003b2d18e1d8126", "score": "0.60313237", "text": "func (p *PovApi) SubmitWork(work *PovApiSubmitWork) error {\n\terr := p.client.getClient().Call(nil, \"pov_submitWork\", work)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14008eb7cdab6a40cebe37a2a94c36d2", "score": "0.6030512", "text": "func (b *Balancer) dispatch(req Request) {\n\t// Grab the least loaded worker...\n\tw := heap.Pop(&b.pool).(*Worker)\n\t// ...send it the task.\n\tw.requests <- req\n\t// One more in its work queue.\n\tw.pending++\n\t// Put it into its place on the heap.\n\theap.Push(&b.pool, w)\n}", "title": "" }, { "docid": "6d7ed5d7b2d6072ab7e6ebf7b5a1b7c1", "score": "0.5967208", "text": "func (p *Pool) Submit(action interface{}, args ...interface{}) {\n\tp.submit(reflect.ValueOf(action), args)\n}", "title": "" }, { "docid": "eef1ed5a40f7640c3da028824768235b", "score": "0.5936189", "text": "func (mathClient *MathClient) worker(task chan Task, wg *sync.WaitGroup, reqs []*protobuf.Request, pub []byte) {\n\n\tfor {\n\t\ttask, ok := <-task\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tb, err := cryptoutil.IntToBytes(task.Number)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tr, s, err := cryptoutil.Sign(mathClient.PrivKey, b)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Can not sign number %d: %v\", task.Number, err)\n\t\t\treturn\n\t\t}\n\n\t\treq := &protobuf.Request{Number: task.Number, R: r, S: s, PublicKey: pub}\n\t\treqs[task.Id] = req\n\t\ttime.Sleep(50 * time.Millisecond)\n\t\twg.Done()\n\t}\n}", "title": "" }, { "docid": "4f15734c35cd65da4557c0415ef7860e", "score": "0.5934901", "text": "func (o *operator) worker(ctx context.Context, loop *QueueInformer) {\n\tfor o.processNextWorkItem(ctx, loop) {\n\t}\n}", "title": "" }, { "docid": "f5ca6a47b5784905ff103cace7442ba8", "score": "0.5912803", "text": "func (c *ExternalNodeController) worker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "4f081c514d647d9d8650bddc910e88bf", "score": "0.5883697", "text": "func (t *TimeWindowedStore) Submit(item interface{}) {\n\tt.itemsMutex.Lock()\n\tdefer t.itemsMutex.Unlock()\n\n\tt.pruneExpiredEntries()\n\tt.items = append(t.items, ItemWithTimestamp{\n\t\tTime: time.Now(),\n\t\tItem: item,\n\t})\n}", "title": "" }, { "docid": "418b96aab57640b4977ac17855949bad", "score": "0.5881116", "text": "func (w *worker) execute(task Task) {\n\tw.tasks <- task\n}", "title": "" }, { "docid": "29c7ea88e4998f9e55299e2b6037f14e", "score": "0.5877231", "text": "func (c *Controller) processNextWorkItem() bool {\n\tobj, shutdown := c.workQueue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\n\t// We wrap this block in a func so we can defer c.workQueue.Done.\n\terr := func(obj interface{}) error {\n\t\t// We call Done here so the workQueue knows we have finished\n\t\t// processing this item. We also must remember to call Forget if we\n\t\t// do not want this work item being re-queued. For example, we do\n\t\t// not call Forget if a transient error occurs, instead the item is\n\t\t// put back on the workQueue and attempted again after a back-off\n\t\t// period.\n\t\tdefer c.workQueue.Done(obj)\n\t\tvar key string\n\t\tvar ok bool\n\t\t// We expect strings to come off the workQueue. These are of the\n\t\t// form namespace/name. We do this as the delayed nature of the\n\t\t// workQueue means the items in the informer cache may actually be\n\t\t// more up to date that when the item was initially put onto the\n\t\t// workQueue.\n\t\tif key, ok = obj.(string); !ok {\n\t\t\t// As the item in the workQueue is actually invalid, we call\n\t\t\t// Forget here else we'd go into a loop of attempting to\n\t\t\t// process a work item that is invalid.\n\t\t\tc.workQueue.Forget(obj)\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"expected string in workQueue but got %#v\", obj))\n\t\t\treturn nil\n\t\t}\n\t\t// Start the syncHandler, passing it the namespace/name string of the\n\t\t// HelmRequest resource to be synced.\n\t\tif err := c.syncHandler(key); err != nil {\n\t\t\t// Put the item back on the workQueue to handle any transient errors.\n\t\t\tc.workQueue.AddRateLimited(key)\n\t\t\treturn fmt.Errorf(\"error syncing '%s': %s, requeuing\", key, err.Error())\n\t\t}\n\t\t// Finally, if no error occurs we Forget this item so it does not\n\t\t// get queued again until another change happens.\n\t\tc.workQueue.Forget(obj)\n\t\tklog.Infof(\"Successfully synced '%s'\", key)\n\t\treturn nil\n\t}(obj)\n\n\tif err != nil {\n\t\tutilruntime.HandleError(err)\n\t\treturn true\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "752843c646080864bfff15b90107f018", "score": "0.5870079", "text": "func (c *Config) SubmitTask(queueName string, identifier string) {\n\tclient := c.RedisClient()\n\tsubmissionQueue := getSubmissionQueue(queueName)\n\tc.Logger.Debugf(\"Submitting task to %v with identifier %v\", submissionQueue, identifier)\n\tresult := client.LPush(submissionQueue, identifier)\n\tc.Logger.Debugf(\"Submitted with return value %v\", result)\n}", "title": "" }, { "docid": "46f94b2bf37dbb0468f8a8fb4ae36797", "score": "0.58575606", "text": "func TestQueueOne(t *testing.T) {\n\tt.Parallel()\n\tnoOfWorkers := runtime.NumCPU()\n\tbufferSize := 50\n\tpool := NewWorkerPool(noOfWorkers, bufferSize, true)\n\tassert.EqualValues(t, noOfWorkers, pool.workersRunning)\n\tjob := &WorkPackage{\n\t\tjobID: 1,\n\t\tf: 10000000.0,\n\t\tdiv: 1.0000001,\n\t\tresult: 0,\n\t}\n\terr := pool.QueueJob(job)\n\tif err != nil {\n\t\tlog.Println(\"could not add job\")\n\t}\n\t_ = pool.Close()\n\tassert.EqualValues(t, 1, pool.Jobs())\n\tpool.waitGroup.Wait()\n\tassert.EqualValues(t, 1, pool.FinishedJobs())\n}", "title": "" }, { "docid": "b9bde564f6a7ce7549c828519fa5526b", "score": "0.5849168", "text": "func (d *Dispatcher) Dispatch(t ITask) {\n\tglog.V(4).Infof(\"Waiting for a free worker\")\n\t// Pick a free worker from the worker pool, when its channel frees up\n\ttaskChannel := <-d.workerPool\n\t// Assign a task to the worker\n\ttaskChannel <- t\n}", "title": "" }, { "docid": "65c990a00575de57f21bb23a59720f6a", "score": "0.5842519", "text": "func (p *Pool) Send(job interface{}) error {\n\tif p.Ready() {\n\t\tgo func(pool *Pool, data *interface{}) {\n\t\t\tselect {\n\t\t\tcase pool.dispatch <- *data:\n\t\t\t\tbreak\n\t\t\t}\n\t\t}(p, &job)\n\t\tatomic.AddUint64(&p.pending, 1)\n\t\treturn nil\n\t}\n\treturn ErrClosed\n}", "title": "" }, { "docid": "83190ae8fc365112dc7a07fd20bc4468", "score": "0.58091503", "text": "func (h *Hub) submitWork(ctx context.Context, data *string) (bool, error) {\n\tif h.nodeConn == nil {\n\t\treturn false, MakeError(ErrOther, \"node connection unset\", nil)\n\t}\n\n\treturn h.nodeConn.GetWorkSubmit(ctx, *data)\n}", "title": "" }, { "docid": "8892368c2c05b15681eba32622f5f423", "score": "0.57916576", "text": "func (p *Pool) Run(w Worker) {\n\tp.work <- w\n}", "title": "" }, { "docid": "a000c9b940b9a2ece624e8c3d4977bcb", "score": "0.5765767", "text": "func (jc *IncrementalJobController) worker() {\n\tfor jc.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "8d12a3dbdd3b5cd1f410ecf851a81186", "score": "0.5758604", "text": "func poolExec(num int, t *Task) error {\n\tworkReq := make(chan workRequest)\n\tworkers := make([]*worker, num)\n\tfor i := 0; i < num; i++ {\n\t\tworkers[i] = newWorker(t, workReq)\n\t\tgo workers[i].run()\n\t\trequest, _ := <-workReq\n\t\trequest.jobChan <- *t\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7b9df3b092ec791239dde54a6074de45", "score": "0.5743721", "text": "func (w *Worker) sendTask(task f) {\n\tw.task <- task\n}", "title": "" }, { "docid": "99a6f3dbba068a79b1e3556feaf1a20d", "score": "0.5714138", "text": "func (client *RegisteredClient) Submit(cmd *Cmd) {\n\tclient.mux.Lock()\n\n\t// Command in pending list, this will be polled of within milliseconds\n\tclient.Cmds[cmd.Id] = cmd\n\n\t// Keep track of command status\n\tclient.DispatchedCmds[cmd.Id] = cmd\n\n\tclient.mux.Unlock()\n\n\t// Log\n\taudit.Log(nil, \"Execute\", fmt.Sprintf(\"Command '%s' on client %s with id %s\", cmd.Command, client.ClientId, cmd.Id))\n\n\t// Signal for work\n\tclient.CmdChan <- true\n}", "title": "" }, { "docid": "c2ac4ed32ae1a869364f437a49a9db93", "score": "0.570275", "text": "func (isc *ImageSetController) worker() {\n\tfor isc.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ee166accf3274c9131c6e383a6ad0a9c", "score": "0.5700705", "text": "func (c *client) scheduleSubmit(r *Request) {\n\tc.requests = append(c.requests, r)\n}", "title": "" }, { "docid": "c7183494328e33fbac130acb12a5316b", "score": "0.570024", "text": "func (cc *CertificateController) worker() {\n\tfor cc.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "6764822cb7c85ce772faced28815f464", "score": "0.5693515", "text": "func (t *task) Worker() {\n\t// create context with timeout via t.Context as a parent context\n\tctx, cancel := context.WithTimeout(t.Context, t.Timeout)\n\tdefer cancel()\n\n\tresult, err := t.Fetcher.Fetch(ctx, t.Request)\n\tif err != nil {\n\t\tt.Errors[t.Index] = err\n\t\tt.Cancel() // cancel for parent context\n\n\t\treturn\n\t}\n\n\traw, err := json.Marshal(result)\n\tif err != nil {\n\t\tt.Errors[t.Index] = err\n\t\tt.Cancel() // cancel for parent context\n\n\t\treturn\n\t}\n\n\tt.Results[t.Index] = raw\n}", "title": "" }, { "docid": "4e5d58f3066fafed2b38df22c79ffb3d", "score": "0.5690614", "text": "func (wp *WorkerPool) Push(fn func()) error {\n\t_, ok := <-wp.acquireWorker\n\tif ok == false {\n\t\treturn context.Canceled\n\t}\n\twp.jobChan <- fn\n\treturn nil\n}", "title": "" }, { "docid": "9b26d245f9e40bfdf3f2625f4b1109a0", "score": "0.5689921", "text": "func (t *WorkOrder) workOrderSubmit(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tlogger.Info(\"workOrderSubmit\")\n\tif len(args) != 4 {\n\t\tlogger.Errorf(\"Too many parameters, expect 4, received %d\", len(args))\n\t\treturn shim.Error(\"workOrderSubmit must include 4 arguments, workOrderID, workerId, requestId and workOrderRequest\")\n\t}\n\n\tvar param WorkOrder\n\tparam.WorkOrderId = args[0]\n\tparam.WorkerId = args[1]\n\tparam.RequesterId = args[2]\n\tparam.WorkOrderRequest = args[3]\n\tparam.WorkOrderStatus = ORDERSUBMITTED\n\tparam.WorkOrderResponse = \"\"\n\n\t//Serialize the value\n\tvalue, err := json.Marshal(param)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tlogger.Infof(\"The work order ID: %s\", param.WorkOrderId)\n\terr = stub.PutState(param.WorkOrderId, value)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// Handling payload for the event\n\tvar eventData WorkOrderSubmittedEvent\n\teventData.WorkOrderId = param.WorkOrderId\n\teventData.WorkerId = param.WorkerId\n\teventData.RequesterId = param.RequesterId\n\teventData.WorkOrderRequest = param.WorkOrderRequest\n\teventData.ErrorCode = 0\n\teventData.SenderAddress = t.getCallerID(stub)\n\teventData.Version = APIVERSION\n\n\teventPayload, err := json.Marshal(eventData)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\terr = stub.SetEvent(\"workOrderSubmitted\", eventPayload)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tlogger.Info(\"Finished workOrderSubmit\")\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "79dfb138a85bf598cf97131d1f497158", "score": "0.5657361", "text": "func (gf *Gofherd) SendWork(work Work) {\n\tgf.input.increment()\n\tgf.input.hose <- work\n\tgf.logger.Printf(\"Pushed to input, work: %s\\n\", work.ID)\n}", "title": "" }, { "docid": "0cf2ec801b55303a22ac28b49eccb610", "score": "0.5651779", "text": "func (e *engine) SubmitTask(task async.Task) error {\n\ttaskJSON, err := task.ToJSON()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error encoding task %#v: %s\", task, err)\n\t}\n\n\tvar queueName string\n\tif task.GetExecuteTime() != nil {\n\t\tqueueName = deferredTaskQueueName\n\t} else {\n\t\tqueueName = pendingTaskQueueName\n\t}\n\n\terr = e.redisClient.LPush(queueName, taskJSON).Err()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error encoding task %#v: %s\", task, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c6108fee90118ad874bb06194fc61f98", "score": "0.5650336", "text": "func worker(data interface{}) bool {\n\t// cast the interface{} back to our custom JobData\n\tif job, ok := data.(JobData); ok {\n\t\tfmt.Printf(\"processing %v\\npicture: %v\\n\\n\", job.Name, job.PictureFilePath)\n\t\t// process the job here\n\t\ttime.Sleep(1 * time.Second)\n\t\tfmt.Printf(\"\\n'%v' was processed\\n\", job.Name)\n\n\t\t// let the pool know that this job was successfully processed\n\t\treturn true\n\t}\n\n\t// the job was not successfully processed\n\treturn false\n}", "title": "" }, { "docid": "98a93f49838962e69f12ff8fb2d504e1", "score": "0.56431264", "text": "func (self *worker) push(work *Work) {\n\tif atomic.LoadInt32(&self.mining) != 1 {\n\t\treturn\n\t}\n\tatomic.AddInt32(&self.atWork, 1)\n\tif ch := self.agent.Work(); ch != nil {\n\t\tch <- work\n\t} else {\n\t\tlog.Info(\"worker push no work\", \"work\", work)\n\t}\n}", "title": "" }, { "docid": "b79c6cca8ab6c0c230e6af6c8b6d4462", "score": "0.5642006", "text": "func (pool *Pool) worker(num int) {\n\tjob_pipe := make(chan *Job)\nWORKER_LOOP:\n\tfor {\n\t\tpool.job_wanted_pipe <- job_pipe\n\t\tjob := <-job_pipe\n\t\tif job == nil {\n\t\t\ttime.Sleep(pool.interval * time.Millisecond)\n\t\t} else {\n\t\t\tpool.subworker(job)\n\t\t\tpool.done_pipe <- job\n\t\t}\n\t\tselect {\n\t\tcase <-pool.worker_kill_pipe:\n\t\t\tbreak WORKER_LOOP\n\t\tdefault:\n\t\t}\n\t}\n\tpool.worker_wg.Done()\n}", "title": "" }, { "docid": "15c016859f989b1a3d10f6c608c4927a", "score": "0.56335026", "text": "func (d *dispatcher) dispatch() {\n\tdefer func() {\n\t\td.shutdown()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase job := <-d.jobPool:\n\t\t\t// New job added, assign worker\n\t\t\t// from the pool and send the job\n\t\t\tgo func(job Job) {\n\t\t\t\tworkerQueue := <-d.workerPool\n\t\t\t\tworkerQueue <- job\n\t\t\t}(job)\n\t\t\t// we've been asked to stop!\n\t\tcase <-d.quitChan:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9ccf240b05dfe59e4ea60328786d689f", "score": "0.5626607", "text": "func (queue WorkQueue) worker() {\n\tfor !queue.StopRequests {\n\t\ttasks := <-queue.Jobs\n\t\tqueue.Results <- tasks.Run()\n\t}\n}", "title": "" }, { "docid": "036ccd2c4bcfedb4042a190365762bef", "score": "0.56169814", "text": "func (wp *WorkerPool) StoreTask(task Task) {\n\twp.taskQueue <- task\n}", "title": "" }, { "docid": "3fb235b394091298eba850ab620a4ae4", "score": "0.56079435", "text": "func (wp *WorkerPoolXT) work(ctx context.Context, done context.CancelFunc, j Job, ts time.Time, bo backoff.BackOff) {\n\tjobtask := func() error {\n\t\to := wp.getOptions(j)\n\t\t// Run job provided by caller\n\t\tf := j.Task(o)\n\t\t// We only want to return an error (or nil if no error)\n\t\t// if the job is using Retry (which ultimately calls `backoff`).\n\t\t// This is how `backoff` knows the job failed, but if we are\n\t\t// not using Retry it will cause errors without this check.\n\t\tif f.Error != nil && bo != nil {\n\t\t\treturn f.Error\n\t\t}\n\n\t\tf.runtimeDuration = time.Since(ts)\n\t\tf.name = j.Name\n\n\t\t// This check is important as it keeps\n\t\t// from sending duplicate responses on our responses chan\n\t\t// ** See `./doc.go`, section `Response Channel` for more info **\n\t\tif ctx.Err() == nil {\n\t\t\twp.responsesChan <- f\n\t\t}\n\t\treturn nil\n\t}\n\n\tif bo != nil {\n\t\t// If the job is using Retry\n\t\tjobErr := backoff.Retry(jobtask, bo)\n\t\tif jobErr != nil {\n\t\t\t// Send a Response, with our error, to our response chan.\n\t\t\twp.responsesChan <- Response{name: j.Name, Error: jobErr}\n\t\t}\n\t} else {\n\t\t// If job is not using Retry,\n\t\t// simply call the job we were given\n\t\tjobtask()\n\t}\n\t// context.CancelFunc\n\tdone()\n}", "title": "" }, { "docid": "540470d189fc40c0c65c576e9cd278e3", "score": "0.56078124", "text": "func (s *WorkerService) RunTask(task Task) {\n\ts.taskQueue <- task\n}", "title": "" }, { "docid": "881b0313dfce0ce9b64bcd87e5303cb1", "score": "0.5598065", "text": "func (b Balancer) dispatch(r GranuleRequest) {\n\tw := heap.Pop(&b.pool).(*GranuleWorker)\n\tw.pending++\n\tw.requests <- r\n\theap.Push(&b.pool, w)\n}", "title": "" }, { "docid": "d1af13a6cfe70a16bc6f13a6e1b5c7d3", "score": "0.5597147", "text": "func (c *baseController) runWorker(queueCtx context.Context) {\n\tvar workerWaitGroup sync.WaitGroup\n\tworkerWaitGroup.Add(1)\n\tgo func() {\n\t\tdefer workerWaitGroup.Done()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-queueCtx.Done():\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tc.processNextWorkItem(queueCtx)\n\t\t\t}\n\t\t}\n\t}()\n\tworkerWaitGroup.Wait()\n}", "title": "" }, { "docid": "15b6d185c7ec726dc87afcae4bd72e6e", "score": "0.5594626", "text": "func (p *workerPool) Enqueue(task func() error) {\n\tp.ongoing.Add(1)\n\tp.tasks <- task\n}", "title": "" }, { "docid": "17d08b0afcf3f78a58a100cdbcc31fb4", "score": "0.55786765", "text": "func (p *ParallelManager) worker(task <-chan task, quit <-chan struct{}, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tfor {\n\t\tselect {\n\t\tcase t := <-task:\n\t\t\tout, err := p.execute(t.ctx, t.cfg, t.ab)\n\t\t\tt.done <- result{t.cfg.Builder.Name, out, err}\n\t\tcase <-quit:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3beba273dd1b9d7262d6bc35da519b30", "score": "0.55777425", "text": "func Submit(job Job) chan bool {\n\twg := make(chan bool, 1)\n\texej := execJob{Ejob: job, Done: wg}\n\tjobQueue <- exej\n\n\treturn wg\n}", "title": "" }, { "docid": "2d4ee40fd25bd282af76365a2f97af77", "score": "0.55701", "text": "func worker(taskQueue <-chan *Task, workerId int) {\n\t// Schedule the call to Done method of WaitGroup.\n\tdefer wg.Done()\n\t/*\n\t\tfor {\n\t\t// Read the value from channel\n\t\t v, exists := <-taskQueue\n\t\t\tif !exists {\n\t\t\t return // channel was closed and that exit from goroutine\n\t\t\t}\n\t\t // Else execute task of v\n\t\t}\n\t\t// Three behaviors\n\t\t v, exists := <-taskQueue\n\t\t 1: exists==true\n\t\t\tData received from the channel.\n\t\t 2: exists==false\n\t\t\tChannel was closed, no more data left in the channel\n\t\t\tReceive default value\n\t\t 3: Blocking code because send is not happened\n\t\t\t No data available in the channel\n\t\t\t Waiting for send operation\n\t*/\n\tfor v := range taskQueue {\n\t\tfmt.Printf(\"Worker%d: received request for Task:%d - Job:%d\\n\", workerId, v.Id, v.JobId)\n\t\tv.Run()\n\t\t// Display we finished the work.\n\t\tfmt.Printf(\"Worker%d: Status:%s for Task:%d - Job:%d\\n\", workerId, v.Status, v.Id, v.JobId)\n\t}\n}", "title": "" }, { "docid": "d1ff12b50a50f8a152b041cbab7c094e", "score": "0.556207", "text": "func (p *Pool) Queue(fn WorkerFunc, fnParams ...interface{}) {\n\tt := &Task{\n\t\tfn: fn,\n\t\tParams: fnParams,\n\t}\n\tp.tasks <- t\n}", "title": "" }, { "docid": "7b82f3a2fdd2cee8887ab65e0f5648a5", "score": "0.5561413", "text": "func (c *controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "1e8405550450a92fff222d7de9307872", "score": "0.55597943", "text": "func (hasher *ParallelWalkHasher) dispatchWork(ctx context.Context, work []pathedData, workChan chan<- pathedData) {\n\tfor i, job := range work {\n\t\t// Send some work, but we may need to bail out early if the context has been cancelled.\n\t\tselect {\n\t\tcase workChan <- job:\n\t\t\t// Not the _MOST_ accurate, since we're really just reporting when work has been sent, but it's good enough.\n\t\t\thasher.progressReporter.ReportProgress(Progress(i * 100 / len(work)))\n\t\tcase <-ctx.Done():\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b525335d5d464643d927bfa1cb8777ee", "score": "0.5557768", "text": "func submitRequest(w http.ResponseWriter, req *http.Request) {\n\tjob, err := decodeRequest(req)\n\tif err != nil {\n http.Error(w, err.Error(), 400)\n return\n\t}\n\tok := changeStatus(true, job.Worker_id)\n\n\tif !ok {\n\t\t// Reply to client that you're busy\n \tio.WriteString(w, \"Master is currently busy with a request, please try again later...\\n\")\n\t\treturn \n\t}\n io.WriteString(w, \"Request submitted successfully, processing...\\n\")\n\tfinalTotal = 0 \n\tdownload_err := downloadFile( job.Filename, job.Url)\n\tif download_err != nil {\n\t\tio.WriteString(w, fmt.Sprintf(\"Error %v with downloading file, please try again\\n\", download_err))\n\t\treturn\n\t}\n\tfiles := splitFile(job.Filename, fileSize)\n\tworkers := getAvailWorkers()\n\tnextWorker = make(chan int)\n\tnextJob = make(chan FileEntry)\n\tfinishedAll = make(chan int)\n\tsubmitterFailure = make(chan int)\n\n\tprintl(\"Got request %v from worker %v\", job, job.Worker_id)\n\tprintl(\"There are %v files\", totalFiles)\n\n\t// Handout jobs accordingly \n\tgo func(nextWorker <-chan int, nextJob <- chan FileEntry, finishedAll <-chan int, job JobRequest ) {\n\t\tprintl(\"Starting thread to hand out file chunks to workers\")\n\t\tsuccess := false \n\t\tLoop:\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase file := <-nextJob:\n\t\t\t\t\tprintl(\"Waiting to send %v\", file.Filename)\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <- submitterFailure:\n\t\t\t\t\t\t// TODO: delete files on system \n\t\t\t\t\t\tprintl(\"submitted failed, killing job distribution\")\n\t\t\t\t\t\tfinishedFiles = 0\n\t\t\t\t\t\tmuJobs.Lock()\n\t\t\t\t\t\tif len(currentJobs) > 0 {\n\t\t\t\t\t\t\tprintl(\"deleting current jobs\")\n\t\t\t\t\t\t\tfor k := range currentJobs {\n\t\t\t\t\t\t\t\tdelete(currentJobs, k)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmuJobs.Unlock()\n\t\t\t\t\t\tchangeStatus(false, -1)\n\t\t\t\t\t\tbreak Loop\n\t\t\t\t\tcase worker_id := <- nextWorker:\n\t\t\t\t\t\tprintl(\"Worker %v became available\", worker_id)\n\t\t\t\t\t\tsendChunk(worker_id, file)\n\t\t\t\t\t\tprintl(\"Sent file %v to worker %v\", file.Filename, worker_id)\n\t\t\t\t\t}\n\t\t\t\tcase <- finishedAll:\n\t\t\t\t\tprintl(\"Finished job, final total: %v\", finalTotal)\n\t\t\t\t\tos.Remove(job.Filename) \n\t\t\t\t\tsuccess = true\n\t\t\t\t\tbreak Loop \n\t\t\t\t}\n\t\t\t}\n\t\tif success {\n\t\t\tprintl(\"Finished handing out file chunks\")\n\t\t\tsendNotif(job, finalTotal)\n\t\t} else{\n\t\t\tprintl(\"submitter failed\")\n\t\t}\t\n\t}(nextWorker, nextJob, finishedAll, job)\n\n\t// Treating channel as a queue to put jobs and workers available \n\tgo func() {\n\t\tfor _, job := range files {\n\t\t\tnextJob <- job\n\t\t}\n\t} () \n\tgo func() {\n\t\tfor _, worker := range workers {\n\t\t\tnextWorker <- worker\n\t\t}\n\t} ()\n}", "title": "" }, { "docid": "0b28744fd08accdf9d8cdb5800843279", "score": "0.5553946", "text": "func (p *Pool) Dispatch(job Job) <-chan struct{} {\n\tw := p.getFreeWorker()\n\n\tw.dispatch(job)\n\n\treturn w.done\n}", "title": "" }, { "docid": "77ac32deb370342eeb9db5a018b915ff", "score": "0.5552825", "text": "func Worker(mapf func(string, string) []KeyValue,\n\treducef func(string, []string) string) {\n\n\t// Your worker implementation here.\n\tendFlag := false\n\tendFlagLock := sync.Mutex{}\n\tworkerId := Register()\n\tfmt.Println(\"Currently in the Worker \", workerId)\n\n\tgo func() { // 每一秒打一次乒乓\n\t\tfor {\n\t\t\tendFlagLock.Lock()\n\t\t\tif endFlag == true {\n\t\t\t\tendFlagLock.Unlock()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tendFlagLock.Unlock()\n\t\t\tPing(workerId)\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\t}()\n\tdone := false\n\tlastTask := 0 // 0 no task; 1 map; 2 reduce\n\tfor !done {\n\t\ttime.Sleep(1 * time.Second)\n\t\tdone = AskForTask(mapf, reducef, workerId, &lastTask)\n\t\tfmt.Println(\"lastTask: \", lastTask)\n\t}\n\tendFlagLock.Lock()\n\tendFlag = true\n\tendFlagLock.Unlock()\n}", "title": "" }, { "docid": "35f44b1a7a18ad6b80cad89299513ffd", "score": "0.5546722", "text": "func (c *KubectlDeliveryController) processNextWorkItem() bool {\n\tobj, shutdown := c.queue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\n\t// We wrap this block in a func so we can defer c.queue.Done.\n\terr := func(obj interface{}) error {\n\t\t// We call Done here so the work queue knows we have finished\n\t\t// processing this item. We also must remember to call Forget if we\n\t\t// do not want this work item being re-queued. For example, we do\n\t\t// not call Forget if a transient error occurs, instead the item is\n\t\t// put back on the work queue and attempted again after a back-off\n\t\t// period.\n\t\tdefer c.queue.Done(obj)\n\t\tvar key string\n\t\tvar ok bool\n\t\t// We expect strings to come off the work queue. These are of the\n\t\t// form namespace/name. We do this as the delayed nature of the\n\t\t// work queue means the items in the informer cache may actually be\n\t\t// more up to date that when the item was initially put onto the\n\t\t// work queue.\n\t\tif key, ok = obj.(string); !ok {\n\t\t\t// As the item in the work queue is actually invalid, we call\n\t\t\t// Forget here else we'd go into a loop of attempting to\n\t\t\t// process a work item that is invalid.\n\t\t\tc.queue.Forget(obj)\n\t\t\truntime.HandleError(fmt.Errorf(\"expected string in workqueue but got %#v\", obj))\n\t\t\treturn nil\n\t\t}\n\t\t// Run the syncHandler, passing it the namespace/name string of the\n\t\t// MPIJob resource to be synced.\n\t\tif err := c.syncHandler(key); err != nil {\n\t\t\tc.queue.AddRateLimited(key)\n\t\t\treturn fmt.Errorf(\"error syncing '%s': %s\", key, err.Error())\n\t\t}\n\t\t// Finally, if no error occurs we Forget this item so it does not\n\t\t// get queued again until another change happens.\n\t\tc.queue.Forget(obj)\n\t\tklog.Infof(\"Successfully synced '%s'\", key)\n\t\treturn nil\n\t}(obj)\n\n\tif err != nil {\n\t\truntime.HandleError(err)\n\t\treturn true\n\t}\n\treturn true\n}", "title": "" }, { "docid": "303adae2212d757a556e1a23b5f4339a", "score": "0.5536384", "text": "func requester(work chan<- Request) {\n\tc := make(chan int)\n\tfor {\n\t\t// Kill some time (fake load).\n\t\tSleep(rand.Int63n(nWorker * 2 * Second))\n\t\twork <- Request{workFn, c} // send request\n\t\tresult := <-c // wait for answer\n\t\tfurtherProcess(result)\n\t}\n}", "title": "" }, { "docid": "c277ceecf760e1146aaecfba15ac9bad", "score": "0.5536089", "text": "func (db *Database) submitPoolUpdate(op raftOp, ps *PoolService) error {\n\tps.LastUpdate = time.Now()\n\tdata, err := createRaftUpdate(op, ps)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdb.log.Debugf(\"pool %s updated @ %s\", ps.PoolUUID, ps.LastUpdate)\n\treturn db.submitRaftUpdate(data)\n}", "title": "" }, { "docid": "d3a94b66e01f147f9e7318a7e4e2ed8a", "score": "0.5531053", "text": "func Work(shutdown context.Context, controller Interface) {\n\tklog.V(1).Infof(\"[controller] name=%s starting to process work item(s)\", controller.Name())\n\n\tfor processNextWorkItem(shutdown, controller) {\n\t}\n\n\tklog.V(1).Infof(\"[controller] name=%s shutting down\", controller.Name())\n}", "title": "" }, { "docid": "c8db31d432550ed246bf37e064607e1f", "score": "0.55213255", "text": "func (w *Workpool) AddTask(worker Worker) {\n\tw.Tasks <- worker\n}", "title": "" }, { "docid": "f81ad103932ae4065d8e5a23df785b9b", "score": "0.5519569", "text": "func (w *worker) Dispatch(ctx context.Context, f JobFunc) error {\n\tctx, span := trace.StartSpan(ctx, \"vald/internal/worker/Worker.Dispatch\")\n\tdefer func() {\n\t\tif span != nil {\n\t\t\tspan.End()\n\t\t}\n\t}()\n\n\tif !w.IsRunning() {\n\t\terr := errors.ErrWorkerIsNotRunning(w.Name())\n\t\tif span != nil {\n\t\t\tspan.RecordError(err)\n\t\t\tspan.SetAttributes(trace.StatusCodeUnavailable(err.Error())...)\n\t\t\tspan.SetStatus(trace.StatusError, err.Error())\n\t\t}\n\n\t\treturn err\n\t}\n\n\tif f != nil {\n\t\terr := w.queue.Push(ctx, f)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tatomic.AddUint64(&w.requestedCount, 1)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ba90dd9296dedb1c249b17528b0a2c84", "score": "0.5514804", "text": "func (c *Controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ba90dd9296dedb1c249b17528b0a2c84", "score": "0.5514804", "text": "func (c *Controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ba90dd9296dedb1c249b17528b0a2c84", "score": "0.5514804", "text": "func (c *Controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ba90dd9296dedb1c249b17528b0a2c84", "score": "0.5514804", "text": "func (c *Controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ba90dd9296dedb1c249b17528b0a2c84", "score": "0.5514804", "text": "func (c *Controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ba90dd9296dedb1c249b17528b0a2c84", "score": "0.5514804", "text": "func (c *Controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ba90dd9296dedb1c249b17528b0a2c84", "score": "0.5514804", "text": "func (c *Controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ba90dd9296dedb1c249b17528b0a2c84", "score": "0.5514804", "text": "func (c *Controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ba90dd9296dedb1c249b17528b0a2c84", "score": "0.5514804", "text": "func (c *Controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ba90dd9296dedb1c249b17528b0a2c84", "score": "0.5514804", "text": "func (c *Controller) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "6439f1a3883fc5a548647356372389d0", "score": "0.5513427", "text": "func (pool *WorkerPool) AddWork(work *Work) {\n\tvar workerObj worker\n\tif len(pool.workers) < pool.MaxWorkers {\n\t\tworkerObj = worker{\n\t\t\tQueue: pool.jobs,\n\t\t\tFn: pool.Fn,\n\t\t\tWg: &pool.Wg,\n\t\t\tEnd: make(chan bool),\n\t\t}\n\t\tworkerObj.Start()\n\t\tpool.workers = append(pool.workers, workerObj)\n\t}\n\tpool.Wg.Add(1)\n\t// This allocates data to goroutine randomly\n\t// hence unequal distribution.\n\tpool.jobs <- *work\n}", "title": "" }, { "docid": "e84a0eba225d09a2d44e92eccba82542", "score": "0.5509008", "text": "func (d *Director) do(c context.Context, work *worker.Work) {\n\td.markPending(work)\n\tvar pool = pool.FromContext(c)\n\tvar worker = <-pool.Reserve()\n\n\t//\tvar worker worker.Worker\n\t//\n\t//\t// waits for an available worker. This is a blocking\n\t//\t// operation and will reject any nil workers to avoid\n\t//\t// a potential panic.\n\t//\tselect {\n\t//\tcase worker = <-pool.Reserve():\n\t//\t\tif worker != nil {\n\t//\t\t\tbreak\n\t//\t\t}\n\t//\t}\n\n\td.markStarted(work, worker)\n\tworker.Do(c, work)\n\td.markComplete(work)\n\tpool.Release(worker)\n}", "title": "" }, { "docid": "ec61dcd2f70a94bac84a890ee4aa6dba", "score": "0.5508942", "text": "func (c *MPIJobController) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "510a37e29f1e11855e0ba0bab7a8972d", "score": "0.55083567", "text": "func (w *Worker) work(done chan *Worker) {\n\tfor {\n\t\treq := <-w.requests // get Request from balancer\n\t\treq.c <- req.fn() // call fn and send result\n\t\tdone <- w // we've finished this request\n\t}\n}", "title": "" }, { "docid": "2641f908dd224c7d112d93d397015c28", "score": "0.5493745", "text": "func Worker(ctx context.Context, id int, in chan WorkRequest, out chan WorkResponse) {\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase wr := <-in:\n\t\t\tfmt.Printf(\"worker id: %d, performing %s work\\n\", id, wr.Op)\n\t\t\tout <- Process(wr)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "67cbc84768da2ff0829b50737a43b99c", "score": "0.549294", "text": "func (c *BrucoProjectController) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "3cb6085083487b2cddc804609d4f0015", "score": "0.5491438", "text": "func (dsc *DaemonSetsController) processNextWorkItem(ctx context.Context) bool {\n\tdsKey, quit := dsc.queue.Get()\n\tif quit {\n\t\treturn false\n\t}\n\tdefer dsc.queue.Done(dsKey)\n\n\terr := dsc.syncHandler(ctx, dsKey.(string))\n\tif err == nil {\n\t\tdsc.queue.Forget(dsKey)\n\t\treturn true\n\t}\n\n\tutilruntime.HandleError(fmt.Errorf(\"%v failed with : %v\", dsKey, err))\n\tdsc.queue.AddRateLimited(dsKey)\n\n\treturn true\n}", "title": "" }, { "docid": "9b04129f6f75ba8256b055aa4dbf7d44", "score": "0.54772246", "text": "func worker (req chan Work, res chan Work, i int){\n for w := range req {\n w.out = w.in * 10\n w.id = i\n runOper()\n res <- w\n }\n}", "title": "" }, { "docid": "eda152d0aab221829cfeeae3044f69fd", "score": "0.54641366", "text": "func (m *Master) SubmitTask(args *SubmitTaskRequest, reply *SubmitTaskResponse) error {\n\tfmt.Printf(\"Got task submit request %s %s\\n\", args.TaskId, args.Files)\n\tmapTask, ok := m.MapTasks[args.TaskId]\n\tif ok {\n\t\tfmt.Printf(\"Submit map task %s\\n\", args.TaskId)\n\t\tfor _, fname := range args.Files {\n\t\t\tt := strings.Split(fname, \"-\")\n\t\t\treduceTaskId := t[2]\n\t\t\treduceTask := m.ReduceTasks[reduceTaskId]\n\t\t\treduceTask.Content = append(reduceTask.Content, fname)\n\t\t}\n\t\tm.mux.Lock()\n\t\tmapTask.Status = completed\n\t\tm.mux.Unlock()\n\t}\n\treduceTask, ok := m.ReduceTasks[args.TaskId]\n\tif ok {\n\t\tfmt.Printf(\"Submit reduce task %s\\n\", args.TaskId)\n\t\tm.mux.Lock()\n\t\treduceTask.Status = completed\n\t\tm.mux.Unlock()\n\t}\n\n\treply.Msg = \"ok\"\n\treturn nil\n}", "title": "" }, { "docid": "a0f7ce2a55cfc2787ae0bfe4af013c91", "score": "0.5460537", "text": "func (pool *WorkerPool) Execute(someWork func(thread int)) {\n\tcount := cap(pool.work)\n\tfor i := 0; i < count; i++ {\n\t\tpool.work <- someWork\n\t}\n\tfor i := 0; i < count; i++ {\n\t\t<-pool.syn\n\t\tpool.ack <- struct{}{}\n\t}\n}", "title": "" }, { "docid": "b081f2ef9f61bec86d9776b609e5bcfa", "score": "0.545909", "text": "func (c *Controller) processNextWorkItem() bool {\n\tobj, shutdown := c.workqueue.Get()\n\tif shutdown {\n\t\treturn false\n\t}\n\n\tnumRequeues := c.workqueue.NumRequeues(obj)\n\tif numRequeues > 0 {\n\t\tklog.V(4).Infof(\"Requeued %v times '%s'\", numRequeues, obj.(string))\n\t}\n\n\t// We wrap this block in a func so we can defer c.workqueue.Done.\n\terr := func(obj interface{}) error {\n\t\t// We call Done here so the workqueue knows we have finished\n\t\t// processing this item. We also must remember to call Forget if we\n\t\t// do not want this work item being re-queued. For example, we do\n\t\t// not call Forget if a transient error occurs, instead the item is\n\t\t// put back on the workqueue and attempted again after a back-off\n\t\t// period.\n\t\tdefer c.workqueue.Done(obj)\n\t\tvar key string\n\t\tvar ok bool\n\t\t// We expect strings to come off the workqueue. These are of the\n\t\t// form namespace/name. We do this as the delayed nature of the\n\t\t// workqueue means the items in the informer cache may actually be\n\t\t// more up to date that when the item was initially put onto the\n\t\t// workqueue.\n\t\tif key, ok = obj.(string); !ok {\n\t\t\t// As the item in the workqueue is actually invalid, we call\n\t\t\t// Forget here else we'd go into a loop of attempting to\n\t\t\t// process a work item that is invalid.\n\t\t\tc.workqueue.Forget(obj)\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"expected string in workqueue but got %#v\", obj))\n\t\t\treturn nil\n\t\t}\n\t\t// Run the syncHandler, passing it the namespace/name string of the\n\t\t// Foo resource to be synced.\n\t\tif err := c.syncHandler(key); err != nil {\n\t\t\t// Put the item back on the workqueue to handle any transient errors.\n\t\t\t// (The delay in case of multiple retries will increase exponentially)\n\t\t\tc.workqueue.AddRateLimited(obj)\n\t\t\treturn fmt.Errorf(\"error syncing '%s': %s, requeuing\", key, err.Error())\n\t\t}\n\t\t// Finally, if no error occurs we Forget this item so it does not\n\t\t// get queued again until another change happens.\n\t\tc.workqueue.Forget(obj)\n\t\tklog.V(5).Infof(\"Finished syncing '%s'\", key)\n\t\treturn nil\n\t}(obj)\n\n\tif err != nil {\n\t\tutilruntime.HandleError(err)\n\t\treturn true\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "87c54467eda134562187d9fc6026417d", "score": "0.54582465", "text": "func (workPool *WorkPool) QueuedWork() int32 {\n\treturn atomic.AddInt32(&workPool.queuedWork, 0)\n}", "title": "" }, { "docid": "5e6914d42094d4b48b2464d3ca45334a", "score": "0.54554313", "text": "func (c *NodeController) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "5e6914d42094d4b48b2464d3ca45334a", "score": "0.54554313", "text": "func (c *NodeController) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" }, { "docid": "ce70500d678e1711e88ae7563c2833cd", "score": "0.54527426", "text": "func (c *BrucoController) runWorker() {\n\tfor c.processNextWorkItem() {\n\t}\n}", "title": "" } ]
00410598bacaf9316b2c6b889aa96480
GoString returns the string representation. API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".
[ { "docid": "52cd86ae700a5ac8f8d3cc0127979e45", "score": "0.0", "text": "func (s ListSchemasInput) GoString() string {\n\treturn s.String()\n}", "title": "" } ]
[ { "docid": "2e110f24163468aae67d3b2ae207c5b6", "score": "0.6041701", "text": "func (s Member) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "2e110f24163468aae67d3b2ae207c5b6", "score": "0.6041701", "text": "func (s Member) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "b538341c1706e7dfd33e6481ab328909", "score": "0.5963593", "text": "func (p *Params) String() string {\n\treturn p.Call(\"toString\").String()\n}", "title": "" }, { "docid": "97e2a8539da67867d77e01e6adce44df", "score": "0.5957417", "text": "func StringStruct(d interface{}) string {\n\tdv := reflect.ValueOf(d)\n\tl := dv.NumField()\n\tvar s string\n\tif TraceLevel >= VVVV {\n\t\ts = fmt.Sprintf(\"%T\", d)\n\t}\n\ts += \"{\"\n\tif false && reflect.DeepEqual(reflect.Zero(reflect.TypeOf(d)).Interface(), d) {\n\t\ts += \"}\"\n\t\treturn s\n\t}\n\tif s, ok := d.(fmt.Stringer); ok {\n\t\treturn s.String()\n\t}\n\tflg := false\n\tfor i := 0; i < l; i++ {\n\t\tft := dv.Type().Field(i)\n\t\tif ft.Name[0] >= 'A' && ft.Name[0] <= 'Z' {\n\t\t\tif isShadowSlice(d, i) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif flg {\n\t\t\t\ts += \" \"\n\t\t\t} else {\n\t\t\t\tflg = true\n\t\t\t}\n\t\t\ts += ft.Name\n\t\t\ts += \":\"\n\t\t\tj := shadowSlice(d, i)\n\t\t\tif j < 0 {\n\t\t\t\ts += String(dv.Field(i).Interface())\n\t\t\t} else {\n\t\t\t\ts += shadowString(d, i, j)\n\t\t\t}\n\t\t}\n\t}\n\ts += \"}\"\n\treturn s\n}", "title": "" }, { "docid": "e25c579deb5766c76d2a372d64e7bb7f", "score": "0.5921183", "text": "func (s RequestBypassInterfaceStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "41112ccec69ed7e5695800fb71ff6fea", "score": "0.5921025", "text": "func (rp RequestParam) String() string {\n\treturn rp.name + \":\" + rp.value\n}", "title": "" }, { "docid": "accd4137f896762440eab638351d91b7", "score": "0.59001756", "text": "func (s ExtraParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "accd4137f896762440eab638351d91b7", "score": "0.59001756", "text": "func (s ExtraParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "44e83e2c1157bd592352a539950093d4", "score": "0.589693", "text": "func (p *Param) String() string {\n\treturn fmt.Sprintf(\"%v %v\", p.Type(), p.Ident())\n}", "title": "" }, { "docid": "f5f9b6bf3726723096efbd005f1b0303", "score": "0.5865787", "text": "func (s BypassInterfaceStruct) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "12b68c78571789c03959549236e53eff", "score": "0.58656347", "text": "func (v *ZapOptOutStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Optout: %v\", v.Optout)\n\ti++\n\n\treturn fmt.Sprintf(\"ZapOptOutStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "0283ad9a395e675fe0a9ec712bceb034", "score": "0.5865326", "text": "func (s RequestParametersStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "7c43d133c7fec2733ca31c8c73387a52", "score": "0.58596814", "text": "func String(name string, optional bool) Parameter {\n\treturn stringParam{name, optional}\n}", "title": "" }, { "docid": "a8ef79c10105d6c72243a45eca75e70c", "score": "0.57913685", "text": "func (s ProtectedQuerySingleMemberOutput_) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "db46495338ceb36924c9a961792081f1", "score": "0.5765541", "text": "func (s Parameter) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "38456e3a48979bbab5f5103284b26c4e", "score": "0.57504857", "text": "func (s BypassInterface) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "f120f3356ee0a3af204124deb254f080", "score": "0.5731191", "text": "func (o NvmeModifyRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "2ce29d2c405fefa5672180d3d62b7ac2", "score": "0.5702716", "text": "func (s RequestTranslationStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "87ab51636a597ba6e1e567cad7e82f0d", "score": "0.5694194", "text": "func (s RequestVpnGatewayStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "8b5c479f87ab906ee4f577f68e63c39c", "score": "0.5692102", "text": "func (s RecoveryPointMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6e10b8a3b02b1e10165c5f90ede54d38", "score": "0.5669901", "text": "func (s ExpectationMemberItem) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "7060ed145790931c6fc5fad3f90f4a7e", "score": "0.56465167", "text": "func (pstruct Struct) String() string {\n\tname := pstruct.Type.Name\n\tlist := make([]string, len(pstruct.Values))\n\tfor i, v := range pstruct.Values {\n\t\tlist[i] = fmt.Sprintf(`%s:%v`, pstruct.Type.Keys[i], fmt.Sprint(v))\n\t}\n\treturn name + `[` + strings.Join(list, ` `) + `]`\n}", "title": "" }, { "docid": "fe2010ab0c02c8d57795a8dd989bced4", "score": "0.56378335", "text": "func (s *BaseStill) String() string {\n\treturn paramString(s)\n}", "title": "" }, { "docid": "ac25f3f6aea8da056068a0cf09489b4d", "score": "0.5612193", "text": "func (s DBParameterGroup) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "9d53a81fca8a505cf3bcd3cd59ee19e5", "score": "0.5608794", "text": "func (s RequestOptionStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "9312c46ad1110dcc35f1b7df0a19980a", "score": "0.5588943", "text": "func (v *PrimitiveRequiredStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [8]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"BoolField: %v\", v.BoolField)\n\ti++\n\tfields[i] = fmt.Sprintf(\"ByteField: %v\", v.ByteField)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Int16Field: %v\", v.Int16Field)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Int32Field: %v\", v.Int32Field)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Int64Field: %v\", v.Int64Field)\n\ti++\n\tfields[i] = fmt.Sprintf(\"DoubleField: %v\", v.DoubleField)\n\ti++\n\tfields[i] = fmt.Sprintf(\"StringField: %v\", v.StringField)\n\ti++\n\tfields[i] = fmt.Sprintf(\"BinaryField: %v\", v.BinaryField)\n\ti++\n\n\treturn fmt.Sprintf(\"PrimitiveRequiredStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "aac925659d9c89e6d5d4ea1feca8e02d", "score": "0.558663", "text": "func (s RequestAdditionalAttributesStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "1a52018cafdd26810ce204850faa961e", "score": "0.5581786", "text": "func (b *Base) SerializeString(v reflect.Value) (interface{}, error) {\n\treturn v.Interface(), nil\n}", "title": "" }, { "docid": "50dac471dddfd875126b94a864fe54aa", "score": "0.5581249", "text": "func (s ModifyDBParameterGroupOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "a9d6b30e25441bf1da07b35c437c93e7", "score": "0.5578832", "text": "func (pp PrettyParams) String() string {\n\treturn fmt.Sprintf(`Distribution Params:\n Withdraw Addr Enabled: %s`, pp.WithdrawAddrEnabled)\n}", "title": "" }, { "docid": "7ec4415aa15089bbf6dc71361f9d03b2", "score": "0.55739635", "text": "func (params *Params) String() string {\n\treturn fmt.Sprint(*params)\n}", "title": "" }, { "docid": "4ea99e5f543caa713d54ba0cba74e6c1", "score": "0.5573808", "text": "func (p *pprofFlags) String(o, d, c string) *string {\n\treturn p.s.String(o, d, c)\n}", "title": "" }, { "docid": "d16ea333c80bd3c8cff2174f0c8e4d5c", "score": "0.5573732", "text": "func (s GraphqlApi) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "69f68331ec22082cc130cbd5c6274b9c", "score": "0.5572976", "text": "func (i IDParameter) String() string {\n\tswitch i {\n\t/**** root ****/\n\n\tcase PM__root_rp_page:\n\t\treturn \"root.rp.$page\"\n\n\t/**** struct B ****/\n\n\tcase PM__B_bo_o1:\n\t\treturn \"B.bo.$o1\"\n\tcase PM__B_bo_o2:\n\t\treturn \"B.bo.$o2\"\n\tcase PM__B_bx_x1:\n\t\treturn \"B.bx.$x1\"\n\tcase PM__B_bx_x2:\n\t\treturn \"B.bx.$x2\"\n\tcase PM__B_bx_x3:\n\t\treturn \"B.bx.$x3\"\n\tcase PM__B_by_y:\n\t\treturn \"B.by.$y\"\n\tcase PM__B_bz_z:\n\t\treturn \"B.bz.$z\"\n\t}\n\n\treturn \"<undefined>\"\n}", "title": "" }, { "docid": "d9508c7da3435545c727f34b49abd5ce", "score": "0.5533067", "text": "func (s RequestFilterStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "4039a7529822df0c9338110f99a8d8d3", "score": "0.5530614", "text": "func (s ProcessorParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ff1605563d9bbd38e17257ff46aa29d9", "score": "0.55261415", "text": "func (v *ThriftTest_TestStruct_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tif v.Thing != nil {\n\t\tfields[i] = fmt.Sprintf(\"Thing: %v\", v.Thing)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"ThriftTest_TestStruct_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5522052", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5522052", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "95521b2b2bb26c3b3039f6ba6da80309", "score": "0.5521593", "text": "func String() string {\n\tdata, err := json.Marshal(GetInfo())\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"failed to marshal info into json: %q\", err)\n\t}\n\n\treturn string(data)\n}", "title": "" }, { "docid": "22e6b75d4caabd7515ea4b7a6d047fd0", "score": "0.5512748", "text": "func (a AdmissionPluginArg) String() string {\n\treturn string(a)\n}", "title": "" }, { "docid": "1fc7be125648c218f16c96443de5ac5a", "score": "0.550183", "text": "func (s VirtualServiceProvider) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fb1c18998723ea72d704ea6bc0d1807d", "score": "0.54913974", "text": "func (s ModifyDBParameterGroupInput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "bd1e7beec8983f6ca0f6c014fe87334b", "score": "0.5485374", "text": "func (tp TemplateParam) String() string {\n\tdata, err := json.Marshal(tp)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(data)\n}", "title": "" }, { "docid": "16ebf20c7c6abbd05126652738d11eb1", "score": "0.54714006", "text": "func (s RequestSourceStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "d4b2d1752651c430f389fb8fdb8d0625", "score": "0.5467047", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unbonding Time: %s\n Max Validators: %d\n Max Entries: %d\n Bonded Coin Denom: %s`, p.UnbondingTime,\n\t\tp.MaxValidators, p.MaxEntries, p.BondDenom)\n}", "title": "" }, { "docid": "861fe5340af950f0f2c46e6a452e6060", "score": "0.5462427", "text": "func (s *MyStruct) String() string {\n\treturn s.Name\n}", "title": "" }, { "docid": "a04552a6499f465e224a684a70a63531", "score": "0.54620963", "text": "func (k Kparam) String() string {\n\tif k.Value == nil {\n\t\treturn \"\"\n\t}\n\tswitch k.Type {\n\tcase kparams.UnicodeString, kparams.AnsiString, kparams.SID, kparams.WbemSID:\n\t\treturn k.Value.(string)\n\tcase kparams.HexInt32, kparams.HexInt64, kparams.HexInt16, kparams.HexInt8:\n\t\treturn string(k.Value.(kparams.Hex))\n\tcase kparams.Int8:\n\t\treturn strconv.Itoa(int(k.Value.(int8)))\n\tcase kparams.Uint8:\n\t\treturn strconv.Itoa(int(k.Value.(uint8)))\n\tcase kparams.Int16:\n\t\treturn strconv.Itoa(int(k.Value.(int16)))\n\tcase kparams.Uint16, kparams.Port:\n\t\treturn strconv.Itoa(int(k.Value.(uint16)))\n\tcase kparams.Uint32, kparams.PID, kparams.TID:\n\t\treturn strconv.Itoa(int(k.Value.(uint32)))\n\tcase kparams.Int32:\n\t\treturn strconv.Itoa(int(k.Value.(int32)))\n\tcase kparams.Uint64:\n\t\treturn strconv.FormatUint(k.Value.(uint64), 10)\n\tcase kparams.Int64:\n\t\treturn strconv.Itoa(int(k.Value.(int64)))\n\tcase kparams.IPv4, kparams.IPv6:\n\t\treturn k.Value.(net.IP).String()\n\tcase kparams.Bool:\n\t\treturn strconv.FormatBool(k.Value.(bool))\n\tcase kparams.Float:\n\t\treturn strconv.FormatFloat(float64(k.Value.(float32)), 'f', 6, 32)\n\tcase kparams.Double:\n\t\treturn strconv.FormatFloat(k.Value.(float64), 'f', 6, 64)\n\tcase kparams.Time:\n\t\treturn k.Value.(time.Time).String()\n\tcase kparams.Enum:\n\t\tswitch typ := k.Value.(type) {\n\t\tcase fs.FileShareMode:\n\t\t\treturn typ.String()\n\t\tcase network.L4Proto:\n\t\t\treturn typ.String()\n\t\tcase fs.FileDisposition:\n\t\t\treturn typ.String()\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%v\", k.Value)\n\t\t}\n\tcase kparams.Slice:\n\t\tswitch slice := k.Value.(type) {\n\t\tcase []string:\n\t\t\treturn strings.Join(slice, \",\")\n\t\tcase []fs.FileAttr:\n\t\t\tattrs := make([]string, 0, len(slice))\n\t\t\tfor _, s := range slice {\n\t\t\t\tattrs = append(attrs, s.String())\n\t\t\t}\n\t\t\treturn strings.Join(attrs, \",\")\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%v\", slice)\n\t\t}\n\tdefault:\n\t\treturn fmt.Sprintf(\"%v\", k.Value)\n\t}\n}", "title": "" }, { "docid": "64398c6eed3f49936dbd9aade80b76a9", "score": "0.5461902", "text": "func (s MemberDetail) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d777c46b6e854c7c38e5e0de726c20e9", "score": "0.54523176", "text": "func (s RequestOutboundInterfaceStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "3604a1d12813ce519872a998508d98c7", "score": "0.5449386", "text": "func (s GetMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9bf874e7be83785b56e6e99c3df5ae67", "score": "0.5447877", "text": "func (s AnalysisParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "deae03a92e56761ab5c59334eefd7861", "score": "0.5446052", "text": "func (a *Api) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Api(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", a.ID))\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "f8112ed1eb632953c86298711d55f6e2", "score": "0.5437466", "text": "func (v Via) String() string {\n\treturn v.SIPVersion + \"/\" + v.Transport + \" \" + v.Client +\n\t\tv.Arguments.SemicolonString()\n}", "title": "" }, { "docid": "13a7627d253470f80df7e3b18c59a35c", "score": "0.54372185", "text": "func (p Plan) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "2f491f67c409577879c28eba6b290827", "score": "0.543369", "text": "func (s PropagatingVgwType) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "19379f248c85a2fae15ce984a1500ee0", "score": "0.5425606", "text": "func (o NvmeInterfaceGetIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "f2b9df58844307a519361a063497832f", "score": "0.5417796", "text": "func (m FilterGroupMembershipDetails) String() string {\n\treturn common.PointerString(m)\n}", "title": "" }, { "docid": "a070b7d0bb45583eb67fdf6eef7beed1", "score": "0.5413947", "text": "func (gs *GameServer) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"GameServer(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", gs.ID))\n\tbuilder.WriteString(\", created_at=\")\n\tbuilder.WriteString(gs.CreatedAt.Format(time.ANSIC))\n\tbuilder.WriteString(\", created_by=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", gs.CreatedBy))\n\tbuilder.WriteString(\", created_with=\")\n\tbuilder.WriteString(gs.CreatedWith)\n\tbuilder.WriteString(\", updated_at=\")\n\tbuilder.WriteString(gs.UpdatedAt.Format(time.ANSIC))\n\tbuilder.WriteString(\", updated_by=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", gs.UpdatedBy))\n\tbuilder.WriteString(\", updated_with=\")\n\tbuilder.WriteString(gs.UpdatedWith)\n\tbuilder.WriteString(\", name=\")\n\tbuilder.WriteString(gs.Name)\n\tbuilder.WriteString(\", description=\")\n\tbuilder.WriteString(gs.Description)\n\tif v := gs.Secret; v != nil {\n\t\tbuilder.WriteString(\", secret=\")\n\t\tbuilder.WriteString(*v)\n\t}\n\tbuilder.WriteString(\", ip_address=\")\n\tbuilder.WriteString(gs.IPAddress)\n\tbuilder.WriteString(\", monitoring=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", gs.Monitoring))\n\tif v := gs.DisabledAt; v != nil {\n\t\tbuilder.WriteString(\", disabled_at=\")\n\t\tbuilder.WriteString(v.Format(time.ANSIC))\n\t}\n\tif v := gs.LastContactAt; v != nil {\n\t\tbuilder.WriteString(\", last_contact_at=\")\n\t\tbuilder.WriteString(v.Format(time.ANSIC))\n\t}\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "110a1c520a3bc36dd85748868509450c", "score": "0.5409895", "text": "func (ps SearchParams) String() string {\n\tss := []string{}\n\tif len(ps.ItemTypes) > 0 {\n\t\titemTypes := []string{}\n\t\tfor _, item := range ps.ItemTypes {\n\t\t\titemTypes = append(itemTypes, item.String())\n\t\t}\n\t\tss = append(ss, \"type=\"+strings.Join(itemTypes, \",\"))\n\t}\n\tif ps.Q != nil {\n\t\tss = append(ss, \"q=\"+*ps.Q)\n\t}\n\tss = append(ss, \"format=\"+string(ps.Format))\n\tif ps.Geo != nil {\n\t\tss = append(ss, fmt.Sprintf(\"geo=[%f,%f]\", (*ps.Geo)[0], (*ps.Geo)[1]))\n\t}\n\tif ps.Dist != nil {\n\t\tss = append(ss, fmt.Sprintf(\"dist=%f\", *ps.Dist))\n\t}\n\tif ps.Pagination.Page != 0 {\n\t\tss = append(ss, fmt.Sprintf(\"page=%d\", ps.Pagination.Page))\n\t}\n\tif ps.Pagination.PerPage != 0 {\n\t\tss = append(ss, fmt.Sprintf(\"per_page=%d\", ps.Pagination.PerPage))\n\t}\n\tif ps.Approval != nil {\n\t\tapps := []string{}\n\t\tfor _, app := range *ps.Approval {\n\t\t\tapps = append(apps, app.String())\n\t\t}\n\t\tss = append(ss, \"approval=\"+strings.Join(apps, \",\"))\n\t}\n\tif ps.Owner != nil {\n\t\tss = append(ss, \"user=\"+*ps.Owner)\n\t}\n\tif ps.Links != nil {\n\t\tss = append(ss, \"links=\"+ps.Links.String())\n\t}\n\treturn strings.Join(ss, \" \")\n}", "title": "" }, { "docid": "e1026cc33cb8f43447eea3a7d0a26686", "score": "0.54073066", "text": "func (v *GuessProtocolStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tif v.MapField != nil {\n\t\tfields[i] = fmt.Sprintf(\"MapField: %v\", v.MapField)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"GuessProtocolStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "b09c49d422f61e9129da7177ef187e07", "score": "0.5406929", "text": "func (s BaiduChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c0e9bd551f9b16d95c27055e063cc7c2", "score": "0.5406435", "text": "func (s RequestGroupsStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "4dcc9450611bb0d25eb02762078246a1", "score": "0.54030573", "text": "func (userUtil UserMemberUtil) String() string {\n\treturn \"<UserUtil user_id='\" + *userUtil.UserId + \"' user_email='\" + *userUtil.UserEmail + \"'/>\"\n}", "title": "" }, { "docid": "a76c8b5c6067d809b44584993c2e540e", "score": "0.54012436", "text": "func (s *Still) String() string {\n\treturn paramString(s)\n}", "title": "" }, { "docid": "bc1f7a2c017e2f15927d43d1b95bc612", "score": "0.5400319", "text": "func (s VaultListMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3df82697915de6fd32fef20e18f11552", "score": "0.5400268", "text": "func (s SSLPolicySetMemberItem) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "e7847f33e4d1d7a24590c684af7420f8", "score": "0.538622", "text": "func (s APNSVoipChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fa9ae680372df047f172b65f4ed06b4", "score": "0.53827846", "text": "func (s ApiKey) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "177d7359ab39319d905a9dded3abdf97", "score": "0.5381848", "text": "func (p *PageToken) String() string {\n\tb, _ := json.Marshal(p)\n\treturn string(b)\n}", "title": "" }, { "docid": "68a221d8260afc4ec8826690255f2b2d", "score": "0.5373675", "text": "func (s MemberSpecification) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "00c246c87ba3fa4bf4dfcf7e9c00969e", "score": "0.53679556", "text": "func (o SystemGetOntapiVersionRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "d4d9f28e12d7397b64eb761e9872cc6d", "score": "0.5364018", "text": "func (v *PrimitiveOptionalStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [8]string\n\ti := 0\n\tif v.BoolField != nil {\n\t\tfields[i] = fmt.Sprintf(\"BoolField: %v\", *(v.BoolField))\n\t\ti++\n\t}\n\tif v.ByteField != nil {\n\t\tfields[i] = fmt.Sprintf(\"ByteField: %v\", *(v.ByteField))\n\t\ti++\n\t}\n\tif v.Int16Field != nil {\n\t\tfields[i] = fmt.Sprintf(\"Int16Field: %v\", *(v.Int16Field))\n\t\ti++\n\t}\n\tif v.Int32Field != nil {\n\t\tfields[i] = fmt.Sprintf(\"Int32Field: %v\", *(v.Int32Field))\n\t\ti++\n\t}\n\tif v.Int64Field != nil {\n\t\tfields[i] = fmt.Sprintf(\"Int64Field: %v\", *(v.Int64Field))\n\t\ti++\n\t}\n\tif v.DoubleField != nil {\n\t\tfields[i] = fmt.Sprintf(\"DoubleField: %v\", *(v.DoubleField))\n\t\ti++\n\t}\n\tif v.StringField != nil {\n\t\tfields[i] = fmt.Sprintf(\"StringField: %v\", *(v.StringField))\n\t\ti++\n\t}\n\tif v.BinaryField != nil {\n\t\tfields[i] = fmt.Sprintf(\"BinaryField: %v\", v.BinaryField)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"PrimitiveOptionalStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "d7f44fd5d8a4877e8cb88d194df9992e", "score": "0.53636086", "text": "func (s DBParameterGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "11a4e7851f5e03cc5470dce5aef81d39", "score": "0.53605855", "text": "func (s GetMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.535813", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cc960b69484075f7d705c86497200ee5", "score": "0.5356544", "text": "func (s VoiceChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0329cbed1999e7922f5b07560fcf19f4", "score": "0.53555393", "text": "func (s PlanTemplatesListMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "63cd8c26d4af778871d8606b3be0b361", "score": "0.53538364", "text": "func (s NiftyModifyWebProxyAttributeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cb3e3d3dd111a4cf8fe2dc4da088f686", "score": "0.53494024", "text": "func (s SageMakerPipelineParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cb3e3d3dd111a4cf8fe2dc4da088f686", "score": "0.53494024", "text": "func (s SageMakerPipelineParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ea3d57b049b0b3b2861e263d7782f5f0", "score": "0.53446144", "text": "func (s VpcInterfaceRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "449c908d6187180cb5410f659d81a5de", "score": "0.53416735", "text": "func (s PlansListMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "36b197d4e5977fd4ccd3bcf5e213b5c9", "score": "0.5339559", "text": "func (s RequestIpPermissionsStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "b8502c4bf6107da9d44dd54cf48dfaa2", "score": "0.53371984", "text": "func (s NiftyModifyWebProxyAttributeInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "11c90d6ee574cda9903fc75bee8832a0", "score": "0.53370744", "text": "func (s DBClusterMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ecb2b8d2d35038266c47a6c30b80ab8d", "score": "0.53333896", "text": "func (g Groups) String() string {\n\tjg, _ := json.Marshal(g)\n\treturn string(jg)\n}", "title": "" }, { "docid": "d781113a09d52719e74f33c2cccbc25e", "score": "0.53241533", "text": "func (o NvmeSubsystemGetIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "c065009cde78f5e49b0ead4c599d6dd2", "score": "0.532326", "text": "func (p MergedParams) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"MaxMemoCharacters: %d\\n\", p.MaxMemoCharacters))\n\tsb.WriteString(fmt.Sprintf(\"TxSigLimit: %d\\n\", p.TxSigLimit))\n\tsb.WriteString(fmt.Sprintf(\"TxSizeCostPerByte: %d\\n\", p.TxSizeCostPerByte))\n\tsb.WriteString(fmt.Sprintf(\"SigVerifyCostED25519: %d\\n\", p.SigVerifyCostED25519))\n\tsb.WriteString(fmt.Sprintf(\"SigVerifyCostSecp256k1: %d\\n\", p.SigVerifyCostSecp256k1))\n\tsb.WriteString(fmt.Sprintf(\"MinGasPriceLimit: %s\\n\", p.MinGasPriceLimit))\n\tsb.WriteString(fmt.Sprintf(\"RefereeChangeMinInterval: %d\\n\", p.RefereeChangeMinInterval))\n\tsb.WriteString(fmt.Sprintf(\"RebateRatio: %d\\n\", p.RebateRatio))\n\treturn sb.String()\n}", "title": "" }, { "docid": "f07b541673ffb9dad4c02451ef22cb37", "score": "0.5319294", "text": "func String(v interface{}) string {\n\treturn fmt.Sprintf(\"%v\", v)\n}", "title": "" }, { "docid": "30f795b7330bf1e6dab852ebdba31f40", "score": "0.53167254", "text": "func (s UsersMemberItem) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "d570756b9c8bcdd8e9fe12ce4ea571a1", "score": "0.5316035", "text": "func (v *TransStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [3]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Message: %v\", v.Message)\n\ti++\n\tif v.Driver != nil {\n\t\tfields[i] = fmt.Sprintf(\"Driver: %v\", v.Driver)\n\t\ti++\n\t}\n\tfields[i] = fmt.Sprintf(\"Rider: %v\", v.Rider)\n\ti++\n\n\treturn fmt.Sprintf(\"TransStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "839edde690a4ea842120af061d0ec071", "score": "0.5315823", "text": "func (a Method) String() (value string) {\n\tvalue = string(a)\n\treturn\n}", "title": "" }, { "docid": "ba1a3db85f41c3d3101899ab2dc68e32", "score": "0.53156245", "text": "func (f Friendship) String() string {\n\tjf, _ := json.Marshal(f)\n\treturn string(jf)\n}", "title": "" }, { "docid": "1db4ef4c721e176c728a4050ed80d3a7", "score": "0.5312873", "text": "func (s InstancesMemberItem) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "fa17b75bb200e89a5ceb5ba0d75ba166", "score": "0.53116536", "text": "func (p ProtoPoint) String() string {\n\tswitch p {\n\tcase Key:\n\t\treturn \"<key>\"\n\tcase Add:\n\t\treturn \"<add>\"\n\tcase Assume:\n\t\treturn \"<assume>\"\n\tcase Solve:\n\t\treturn \"<solve>\"\n\tcase Continue:\n\t\treturn \"<continue>\"\n\tcase End:\n\t\treturn \"<end>\"\n\tcase Error:\n\t\treturn \"<error>\"\n\tcase Failed:\n\t\treturn \"<failed>\"\n\tcase FailedFor:\n\t\treturn \"<failedfor>\"\n\tcase Model:\n\t\treturn \"<model>\"\n\tcase ModelFor:\n\t\treturn \"<modelfor>\"\n\tcase Sat:\n\t\treturn \"<sat>\"\n\tcase Unsat:\n\t\treturn \"<unsat>\"\n\tcase Unknown:\n\t\treturn \"<unknown>\"\n\tcase Quit:\n\t\treturn \"<quit>\"\n\tcase Reset:\n\t\treturn \"<reset>\"\n\tcase Ext:\n\t\treturn \"<ext>\"\n\tdefault:\n\t\tif p >= MinProto {\n\t\t\treturn fmt.Sprintf(\"<ext-%d>\", p-MinProto)\n\t\t}\n\t\treturn fmt.Sprintf(\"<!data(%d)!>\", uint32(p))\n\t}\n}", "title": "" }, { "docid": "9824ef3b2e8e6340547ff979c3fe82ea", "score": "0.5310707", "text": "func (v VersionStruct) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "title": "" }, { "docid": "3c6ea52c31fecb017c6fe640de94e2bc", "score": "0.5309984", "text": "func (P ConnectionParams) String() string {\n\treturn P.string(true, false)\n}", "title": "" }, { "docid": "eeb7093db8cb12512ccdcea61956f0e6", "score": "0.5302228", "text": "func String(k, v string) Field {\n\tf := Field{}\n\ts := zap.String(k, v)\n\tf.field = s\n\n\treturn f\n}", "title": "" }, { "docid": "d2dedaf54ce114bf49126de8b61dca4d", "score": "0.52986187", "text": "func (s VpcInterface) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "660b6219c36433957afa564a2fd989f0", "score": "0.5298023", "text": "func (s OptionGroupMembership) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" } ]
637023567ee3c287fddbc8036bf4083d
Register registers a plugin
[ { "docid": "0825d98b3f7bbe83322fe78fb2fc8355", "score": "0.0", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\t// the pods/status endpoint is ignored by this plugin since old kubelets\n\t\t// corrupt them. the pod status strategy ensures status updates cannot mutate\n\t\t// ownerRef.\n\t\twhiteList := []whiteListItem{\n\t\t\t{\n\t\t\t\tgroupResource: schema.GroupResource{Resource: \"pods\"},\n\t\t\t\tsubresource: \"status\",\n\t\t\t},\n\t\t}\n\t\treturn &gcPermissionsEnforcement{\n\t\t\tHandler: admission.NewHandler(admission.Create, admission.Update),\n\t\t\twhiteList: whiteList,\n\t\t}, nil\n\t})\n}", "title": "" } ]
[ { "docid": "56c0c5dafed4cb0aef238c9e8f47c531", "score": "0.77628857", "text": "func RegisterPlugin(name string, factory func() interface{}) {\n\tAvailablePlugins[name] = factory\n}", "title": "" }, { "docid": "cedda7b80f77269074cf1585db617e7b", "score": "0.761366", "text": "func Register(plugin Plugin) {\n\tplugins.Register(plugin)\n}", "title": "" }, { "docid": "2df4b5b5da71c91367d2f755ea27a19a", "score": "0.75291437", "text": "func (p *Plugins) Register(plugin Plugin) {\n\tp.registered[plugin.Command()] = plugin\n\tp.log.Info(\"registered plugin\", \"name\", plugin.Command())\n}", "title": "" }, { "docid": "d47e995d63591eef8e6e144237d0e3e1", "score": "0.7420402", "text": "func Register(name string, plugin Plugin) {\n\tPlugins[name] = plugin\n}", "title": "" }, { "docid": "75400cecd1a2fd151f898b908fb8754b", "score": "0.7285494", "text": "func RegisterPlugin(name string, plugin Plugin) {\n\tplugins[name] = plugin\n}", "title": "" }, { "docid": "279b2869a6c84d16b2b8afa45db2e787", "score": "0.72620165", "text": "func Register(namespace, key string, plugin interface{}, opts ...PluginOption) {\n\treg.Register(namespace, key, plugin, opts...)\n}", "title": "" }, { "docid": "1a225980fd20dd55cc6cf7133f28dd31", "score": "0.7210775", "text": "func Register(key string, pi Plugin) error {\n\treturn p.Register(key, pi)\n}", "title": "" }, { "docid": "f509843ecc6af69ac63349e20dff4f64", "score": "0.7163462", "text": "func (s *Slackscot) RegisterPlugin(p *Plugin) {\n\ts.plugins = append(s.plugins, p)\n}", "title": "" }, { "docid": "f509843ecc6af69ac63349e20dff4f64", "score": "0.7163462", "text": "func (s *Slackscot) RegisterPlugin(p *Plugin) {\n\ts.plugins = append(s.plugins, p)\n}", "title": "" }, { "docid": "3041c9ed90ada5c303a0d7d477fd62db", "score": "0.7160555", "text": "func (this *Basket) PluginRegister(plugin Plugin, t PluginWorkTime) {\n\tlogger.Debug(\"[plugin register][\", plugin.Prefix(), \"]\", t)\n\tlist, ok := this.plugins[t]\n\tif !ok {\n\t\tlist = pluginList{}\n\t}\n\tlist = append(list, plugin)\n\tthis.plugins[t] = list\n}", "title": "" }, { "docid": "a38979e2e2533b71b72474bc24e355d8", "score": "0.7087796", "text": "func (ps *Plugins) Register(name string, plugin Factory) {\n\tps.lock.Lock()\n\tdefer ps.lock.Unlock()\n\tif ps.registry != nil {\n\t\t_, found := ps.registry[name]\n\t\tif found {\n\t\t\tklog.Fatalf(\"Admission plugin %q was registered twice\", name)\n\t\t}\n\t} else {\n\t\tps.registry = map[string]Factory{}\n\t}\n\n\tklog.V(1).InfoS(\"Registered admission plugin\", \"plugin\", name)\n\tps.registry[name] = plugin\n}", "title": "" }, { "docid": "0128343cb4d3a798bcf00d3ceddc7560", "score": "0.7049394", "text": "func (sr *SimpleRegistry) Register(p CommandPlugin) error {\n\tif _, hasKey := sr.pluginsMapping[p.Name()]; hasKey {\n\t\treturn errors.Errorf(\"Plugin with name '%v' has already been registered\", p.Name())\n\t}\n\tsr.pluginsMapping[p.Name()] = p\n\treturn nil\n}", "title": "" }, { "docid": "0efe3acd6bd8f5154cddbe6898e556a6", "score": "0.7024512", "text": "func (ps *KMSPlugins) Register(name string, plugin Factory) {\n\tps.lock.Lock()\n\tdefer ps.lock.Unlock()\n\t_, found := ps.registry[name]\n\tif ps.registry == nil {\n\t\tps.registry = map[string]Factory{}\n\t}\n\tif found {\n\t\tglog.Fatalf(\"KMS plugin %q was registered twice\", name)\n\t} else {\n\t\tps.registry[name] = plugin\n\t\tglog.V(1).Infof(\"Registered KMS plugin %q\", name)\n\t}\n}", "title": "" }, { "docid": "2e92a6e88209de260238d4e8709f74f6", "score": "0.69710135", "text": "func RegisterPlugin(pluginName string, newBuilder func() Builder) {\n\tDefaultRegistry.RegisterPlugin(pluginName, newBuilder)\n}", "title": "" }, { "docid": "2e92a6e88209de260238d4e8709f74f6", "score": "0.69710135", "text": "func RegisterPlugin(pluginName string, newBuilder func() Builder) {\n\tDefaultRegistry.RegisterPlugin(pluginName, newBuilder)\n}", "title": "" }, { "docid": "25cf9122f87ee4e071ebaba97d95e33f", "score": "0.6956056", "text": "func registerPlugin(constructor interface{}, options ...interface{}) {\n\tvar path, limit string\n\tvc := reflect.ValueOf(constructor)\n\n\t// Pre-processing options to make it work with reflect\n\tvo := []reflect.Value{}\n\tfor _, oi := range options {\n\t\tvo = append(vo, reflect.ValueOf(oi))\n\t}\n\n\tif len(vo) > 0 {\n\t\t// Removing limit options from path\n\t\tpath, limit = extractLimitOptions(vo[0].String())\n\n\t\t// Writing value back without limiter \"|\" options\n\t\tvo[0] = reflect.ValueOf(path)\n\t}\n\n\t// Calling our constructor with list of given options\n\tplugin := vc.Call(vo)[0].Interface()\n\n\tif limit != \"\" {\n\t\tplugin = NewLimiter(plugin, limit)\n\t}\n\n\t_, isR := plugin.(io.Reader)\n\t_, isW := plugin.(io.Writer)\n\n\t// Some of the output can be Readers as well because return responses\n\tif isR && !isW {\n\t\tPlugins.Inputs = append(Plugins.Inputs, plugin.(io.Reader))\n\t}\n\n\tif isW {\n\t\tPlugins.Outputs = append(Plugins.Outputs, plugin.(io.Writer))\n\t}\n\n\tPlugins.All = append(Plugins.All, plugin)\n}", "title": "" }, { "docid": "7bd461a5c56c85f3f58b2e163d7e9c66", "score": "0.6936236", "text": "func FLBPluginRegister(ctx unsafe.Pointer, name string, desc string) int {\n\tp := (*FLBPlugin)(unsafe.Pointer(ctx))\n\tp._type = FLB_PROXY_OUTPUT_PLUGIN\n\tp.proxy = FLB_PROXY_GOLANG\n\tp.flags = 0\n\tp.name = C.CString(name)\n\tp.description = C.CString(desc)\n\treturn 0\n}", "title": "" }, { "docid": "ef7aa7ba6ffefb2aec05c2e6de1f8d38", "score": "0.68765634", "text": "func registerPlugin(name string, plug plugin) {\n\tif _, found := plugins[name]; found {\n\t\tfmt.Fprintf(os.Stderr, \"plugin %q was registered twice\", name)\n\t\tos.Exit(1)\n\t}\n\tplugins[name] = plug\n}", "title": "" }, { "docid": "c0cc63816ee00d6243f421e145806bb3", "score": "0.68547654", "text": "func (app *Application) Register(plugin func() PluginImpl) Plugin {\n\tplug := newPluginObj(plugin())\n\tif app.FindByName(plug.Name()) != nil {\n\t\treturn nil\n\t}\n\n\tapp.plugins[plug.Name()] = plug\n\treturn plug\n}", "title": "" }, { "docid": "db4e902e1e22fc920724228c21cff1d6", "score": "0.683436", "text": "func (m *manager) Register(descriptor PluginDescriptor) error {\n\tm.logger.Debug(\"Registering backend plugin\", \"pluginId\", descriptor.pluginID, \"executablePath\", descriptor.executablePath)\n\tm.pluginsMu.Lock()\n\tdefer m.pluginsMu.Unlock()\n\n\tif _, exists := m.plugins[descriptor.pluginID]; exists {\n\t\treturn errors.New(\"Backend plugin already registered\")\n\t}\n\n\tpluginLogger := m.logger.New(\"pluginId\", descriptor.pluginID)\n\tplugin := &BackendPlugin{\n\t\tid: descriptor.pluginID,\n\t\texecutablePath: descriptor.executablePath,\n\t\tmanaged: descriptor.managed,\n\t\tclientFactory: func() *plugin.Client {\n\t\t\treturn plugin.NewClient(newClientConfig(descriptor.executablePath, pluginLogger, descriptor.versionedPlugins))\n\t\t},\n\t\tstartFns: descriptor.startFns,\n\t\tlogger: pluginLogger,\n\t}\n\n\tm.plugins[descriptor.pluginID] = plugin\n\tm.logger.Debug(\"Backend plugin registered\", \"pluginId\", descriptor.pluginID, \"executablePath\", descriptor.executablePath)\n\treturn nil\n}", "title": "" }, { "docid": "05b6027399ab783d2a57e6598e100251", "score": "0.68328", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn NewPlugin(config)\n\t})\n}", "title": "" }, { "docid": "5963a2d867aa53d3ea3dac1f9be552c3", "score": "0.6799588", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn NewPlugin(), nil\n\t})\n}", "title": "" }, { "docid": "7d5a88ecf6258808763c3dacb86201b2", "score": "0.6793277", "text": "func FLBPluginRegister(def unsafe.Pointer, name, desc string) int {\n\tp := (*FLBPluginProxyDef)(def)\n\tp._type = FLB_PROXY_INPUT_PLUGIN\n\tp.proxy = FLB_PROXY_GOLANG\n\tp.flags = 0\n\tp.name = C.CString(name)\n\tp.description = C.CString(desc)\n\treturn 0\n}", "title": "" }, { "docid": "dcffd1adda027591755c25cdca6fe0a8", "score": "0.6788951", "text": "func Register(name string, description string) (*service.Plugin, error) {\n\ta := NewArgoPlugin()\n\n\tcapabilities := &plugin.Capabilities{\n\t\tIsModule: true,\n\t}\n\n\t// Set up what should happen when Octant calls this plugin.\n\toptions := []service.PluginOption{\n\t\tservice.WithNavigation(a.handleNavigation, a.initRoutes),\n\t}\n\n\t// Use the plugin service helper to register this plugin.\n\treturn service.Register(name, description, capabilities, options...)\n}", "title": "" }, { "docid": "918ff943f227be1ad3cb9c063e399dfb", "score": "0.67706317", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn New()\n\t})\n}", "title": "" }, { "docid": "918ff943f227be1ad3cb9c063e399dfb", "score": "0.67706317", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn New()\n\t})\n}", "title": "" }, { "docid": "c1b4f4f062a9a705fbb51b83d9d5e9c8", "score": "0.6764501", "text": "func RegisterPlugin(p Plugin) error {\n\treturn plugin.RegisterPlugin(p.Name(), p.ParseConf, p.Filter)\n}", "title": "" }, { "docid": "291b30f955729d59c8d0c4ada9e4be18", "score": "0.674807", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, NewFactory)\n}", "title": "" }, { "docid": "291b30f955729d59c8d0c4ada9e4be18", "score": "0.674807", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, NewFactory)\n}", "title": "" }, { "docid": "5dcf151735f4caa6fff6df0a121f13e2", "score": "0.6747848", "text": "func (s *ExtensionManagerServer) RegisterPlugin(plugins ...OsqueryPlugin) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\tfor _, plugin := range plugins {\n\t\tif !validRegistryNames[plugin.RegistryName()] {\n\t\t\tpanic(\"invalid registry name: \" + plugin.RegistryName())\n\t\t}\n\t\ts.registry[plugin.RegistryName()][plugin.Name()] = plugin\n\t}\n}", "title": "" }, { "docid": "bb3693ba0f95ce12f84798191457b668", "score": "0.6735635", "text": "func (r *Registry) RegisterPlugin(pluginName string, newBuilder func() Builder) {\n\tr.plugins[pluginName] = newBuilder\n}", "title": "" }, { "docid": "bb3693ba0f95ce12f84798191457b668", "score": "0.6735635", "text": "func (r *Registry) RegisterPlugin(pluginName string, newBuilder func() Builder) {\n\tr.plugins[pluginName] = newBuilder\n}", "title": "" }, { "docid": "001ea10b733f7de160a9392bc47a56af", "score": "0.67230046", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn New(), nil\n\t})\n}", "title": "" }, { "docid": "02df4a579704a56c99d264680558c878", "score": "0.6704506", "text": "func (r Registry) Register(name string, factory PluginFactory) error {\n\tif _, ok := r[name]; ok {\n\t\treturn fmt.Errorf(\"a plugin named %v already exists\", name)\n\t}\n\tr[name] = factory\n\treturn nil\n}", "title": "" }, { "docid": "a9c98d250a754ac81ee23b9490862044", "score": "0.66930294", "text": "func Register(name string, p Interface) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tif _, ok := plugs[name]; ok {\n\t\tlog.Panic(\"plugin with the same name is already registered\")\n\t}\n\n\tplugs[name] = p\n}", "title": "" }, { "docid": "941f50d1a9382bce15231df48bea5b27", "score": "0.667373", "text": "func FLBPluginRegister(ctx unsafe.Pointer) int {\n\t// roll call for the specifics of the plugin\n\treturn output.FLBPluginRegister(ctx, \"redis\", \"Redis\")\n}", "title": "" }, { "docid": "29b7d40135e070e88fe03d5508b77f84", "score": "0.65876555", "text": "func (r *Registry) Register(factory PluginFactory) {\n\t*r = append(*r, factory)\n}", "title": "" }, { "docid": "bd75f9dcdbe5972433a591c251c2374f", "score": "0.65869546", "text": "func (r *Register) Register(p Plugin) error {\n\tx, err := p.Lookup(REGISTRABLE_VAR)\n\tif err != nil {\n\t\tfmt.Println(\"unable to find the registrable symbol:\", err.Error())\n\t\treturn err\n\t}\n\n\ttotalRegistrations := 0\n\n\tif registrable, ok := x.(RegistrableDecoder); ok {\n\t\terr = registrable.RegisterDecoder(r.Decoder.Register)\n\t\ttotalRegistrations++\n\t}\n\n\tif registrable, ok := x.(RegistrableExternal); ok {\n\t\terr = registrable.RegisterExternal(r.External.Register)\n\t\ttotalRegistrations++\n\t}\n\n\tif totalRegistrations == 0 {\n\t\tfmt.Println(\"unknown registrable interface\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d921f2d2f7067d92a6b510c7cf8dab4e", "score": "0.6550365", "text": "func (r *registry) register(id framework.PluginIdentifier) error {\n\tkey := KindAndName{Kind: id.Kind, Name: id.Name}\n\tif existing, found := r.pluginsByID[key]; found {\n\t\treturn newDuplicatePluginRegistrationError(existing, id)\n\t}\n\n\t// no need to pass list of existing plugins since the check if this exists was done above\n\tif err := common.ValidatePluginName(id.Name, nil); err != nil {\n\t\treturn errors.Errorf(\"invalid plugin name %q: %s\", id.Name, err)\n\t}\n\n\tr.pluginsByID[key] = id\n\tr.pluginsByKind[id.Kind] = append(r.pluginsByKind[id.Kind], id)\n\n\t// if id.Kind is adaptable to newer plugin versions, list it under the other versions as well\n\t// If BackupItemAction is adaptable to BackupItemActionV2, then it would be listed under both\n\t// kinds\n\tif kinds, ok := common.PluginKindsAdaptableTo[id.Kind]; ok {\n\t\tfor _, kind := range kinds {\n\t\t\tr.pluginsByKind[kind] = append(r.pluginsByKind[kind], id)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cec6d3a6c0cb277dd1ae435516959f49", "score": "0.6542937", "text": "func NewWithPlugin(name string) P { return P{\"plugin/\" + name + \": \"} }", "title": "" }, { "docid": "7eb7505e015456f1189eab2137c50823", "score": "0.6479148", "text": "func (m *MockBot) AddPlugin(plugin noye.Plugin) {}", "title": "" }, { "docid": "605ad1dc6c4f5c2268f2a805271ae5ab", "score": "0.64551246", "text": "func Register(name string, p DeploymentConfigPlugin) {\n\tDeploymentConfigPlugins[name] = p\n}", "title": "" }, { "docid": "84c955bc785afaea494912fde612a2c0", "score": "0.6428324", "text": "func RegisterPlugin(spec *PluginSpec) {\n\tif spec.Name == \"\" {\n\t\tpanic(\"cannot register plugin with an empty name\")\n\t}\n\tif _, ok := registeredPlugins[spec.Name]; ok {\n\t\tpanic(\"plugin already registered: \" + spec.Name)\n\t}\n\tregisteredPlugins[spec.Name] = spec\n}", "title": "" }, { "docid": "c7194f5339234a0096957a574d530e88", "score": "0.637272", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(pluginName, func(io.Reader) (admission.Interface, error) {\n\t\treturn NewSARCheck()\n\t})\n}", "title": "" }, { "docid": "429dbc617a5537620640496abd798b61", "score": "0.6369936", "text": "func InstallPlugin(t string, f func() Codec) {\n\tcodecs[t] = f\n\tlager.Logger.Debugf(\"Install Codec Plugin,codec_name:%s\", t)\n}", "title": "" }, { "docid": "95ef3daede89ba8d26315e98206ea51b", "score": "0.6356709", "text": "func RegisterPlugin(registrar func([]byte) (interface{}, error)) (*SingularityPluginImpl, error) {\n\n\tpluginConf := PluginImplConf{PluginLoc: runtimeConf, Activator: pluginStarter, Stopper: pluginStopper}\n\t// Implement the Plugin\n\tregPlugin, pluginInitError := PluginInit(pluginConf)\n\tif pluginInitError != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to initialize the plugin: %v\", pluginInitError)\n\t}\n\n\tsingularityPluginImpl := &SingularityPluginImpl{}\n\tsingularityPluginImpl.pluginReg = regPlugin\n\tsingularityPluginImpl.controllerInstanceRegisterer = registrar\n\tsingularityPluginImpl.controllerInstanceMap = make(map[string]interface{})\n\n\tsingularityPlugin = singularityPluginImpl\n\n\treturn singularityPluginImpl, nil\n}", "title": "" }, { "docid": "ad0ebbfe02954d5eb838b2347594b756", "score": "0.6350881", "text": "func WithPlugin(name string, factory runtime.PluginFactory) Option {\n\treturn func(registry runtime.Registry) error {\n\t\treturn registry.Register(name, factory)\n\t}\n}", "title": "" }, { "docid": "ad0ebbfe02954d5eb838b2347594b756", "score": "0.6350881", "text": "func WithPlugin(name string, factory runtime.PluginFactory) Option {\n\treturn func(registry runtime.Registry) error {\n\t\treturn registry.Register(name, factory)\n\t}\n}", "title": "" }, { "docid": "90018833b2d2d6d2d1e22142921c79c7", "score": "0.63415116", "text": "func (pl *PluginList) Register(p Plugin) {\n\tif !pl.Contains(p) {\n\t\t*pl = append(*pl, p)\n\t}\n}", "title": "" }, { "docid": "88e03799f0a3ba04992d2e4f09a8bb22", "score": "0.6314872", "text": "func WithPlugin(name string, factory runtime.PluginFactory) Option {\n\treturn func(r runtime.Registry) error {\n\t\treturn r.Register(name, factory)\n\t}\n}", "title": "" }, { "docid": "cbf29328d67efd155e05a1e7ae2ab116", "score": "0.63017815", "text": "func (cs *ConsensusSet) RegisterPlugin(ctx context.Context, name string, plugin modules.ConsensusSetPlugin) error {\n\tcs.log.Debugln(\"Registering plugin \", name)\n\tif name == \"\" {\n\t\treturn ErrPluginNameEmpty\n\t}\n\tfor _, reservedName := range reservedPluginNames {\n\t\tif reservedName == name {\n\t\t\treturn ErrPluginNameReserved\n\t\t}\n\t}\n\terr := cs.tg.Add()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer cs.tg.Done()\n\tcs.mu.Lock()\n\tdefer cs.mu.Unlock()\n\n\t// ensure the plugin doesn't exist yet\n\tif _, ok := cs.plugins[name]; ok {\n\t\treturn ErrPluginExists\n\t}\n\n\t// init the plugin\n\tvar consensusChangeID modules.ConsensusChangeID\n\terr = cs.db.Update(func(tx *bolt.Tx) (err error) {\n\t\tconsensusChangeID, err = cs.initConsensusSetPlugin(tx, name, plugin)\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// init sync the plugin\n\tinitialSyncCtx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\tnewConsensusChangeID, err := cs.initPluginSync(initialSyncCtx, name, plugin, consensusChangeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif newConsensusChangeID != consensusChangeID {\n\t\terr = cs.db.Update(func(tx *bolt.Tx) error {\n\t\t\trootbucket := tx.Bucket(BucketPlugins)\n\t\t\t// get the metadata bucket from the rootbucket\n\t\t\tmetadataBucket := rootbucket.Bucket(bucketPluginsMetadata)\n\t\t\tif metadataBucket == nil {\n\t\t\t\treturn ErrPluginGhostMetadata\n\t\t\t}\n\t\t\t// get the plugin metadata as-is\n\t\t\tpluginMetadataBytes := metadataBucket.Get([]byte(name))\n\t\t\tif len(pluginMetadataBytes) == 0 {\n\t\t\t\treturn ErrMissingPluginMetadata\n\t\t\t}\n\t\t\tvar pluginMetadata pluginMetadata\n\t\t\terr := rivbin.Unmarshal(pluginMetadataBytes, &pluginMetadata)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// save the new metadata\n\t\t\tpluginMetadata.ConsensusChangeID = newConsensusChangeID\n\t\t\tmetadataBytes, err := rivbin.Marshal(pluginMetadata)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to (rivbin) marshal plugin metadata: %v\", err)\n\t\t\t}\n\t\t\treturn metadataBucket.Put([]byte(name), metadataBytes)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Check if map is nil, if nil make one\n\tif cs.plugins == nil {\n\t\tcs.plugins = make(map[string]modules.ConsensusSetPlugin)\n\t}\n\t// Add plugin to cs plugins map\n\tcs.plugins[name] = plugin\n\t// return without errors\n\treturn nil\n}", "title": "" }, { "docid": "38428c2a96b5824bd567960e86c363f5", "score": "0.63010496", "text": "func Register(name string, p ChainingPlugin) error {\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\n\tif name == DefaultConfigName {\n\t\treturn fmt.Errorf(\"invalid chain name. '%s' is reserved\", DefaultConfigName)\n\t}\n\n\tif _, ok := chainingPlugins[name]; ok {\n\t\treturn fmt.Errorf(\"chaining plugin with name %s already exists\", name)\n\t}\n\n\tchainingPlugins[name] = p\n\n\treturn nil\n}", "title": "" }, { "docid": "84e51fddf8295b02e8855e68b12e0b21", "score": "0.63008475", "text": "func Register(corpus Plugin) {\n\tif err := corpus.Preload(); err != nil {\n\t\tlog.Panicln(\" > error preload:\", err)\n\t\treturn\n\t}\n\n\tplugins[corpus.Name] = corpus\n}", "title": "" }, { "docid": "87965ed88b1c2d95ee6d54e0034db1bb", "score": "0.6295644", "text": "func (l *localdb) RegisterPlugin(p user.Plugin) error {\n\tlog.Tracef(\"RegisterPlugin: %v %v\", p.ID, p.Version)\n\n\tvar err error\n\tswitch p.ID {\n\tcase user.CMSPluginID:\n\t\t// This is an acceptable plugin ID\n\tdefault:\n\t\treturn user.ErrInvalidPlugin\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Save plugin settings\n\tl.Lock()\n\tdefer l.Unlock()\n\n\tl.pluginSettings[p.ID] = p.Settings\n\n\treturn nil\n}", "title": "" }, { "docid": "aea6e9d78a2f04ee97b76e6db90a7430", "score": "0.62597036", "text": "func Register(resyncName string) resyncevent.Registration {\n\treturn plugin().Register(resyncName)\n}", "title": "" }, { "docid": "d045e805c1bf2934854f95a661df02f4", "score": "0.62569153", "text": "func (m *PluginManager) RegisterPlugin(plugin Plugin) {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\tfor _, p := range m.plugins {\n\t\tif p.Name() == plugin.Name() {\n\t\t\treturn\n\t\t}\n\t}\n\n\tm.plugins = append(m.plugins, plugin)\n}", "title": "" }, { "docid": "1bfcfe9ac973da6764522c0a8448f23c", "score": "0.62544084", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName,\n\t\tfunc(config io.Reader) (admission.Interface, error) {\n\t\t\t// load the configuration provided (if any)\n\t\t\tconfiguration, err := LoadConfiguration(config)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t// validate the configuration (if any)\n\t\t\tif configuration != nil {\n\t\t\t\tif errs := validation.ValidateConfiguration(configuration); len(errs) != 0 {\n\t\t\t\t\treturn nil, errs.ToAggregate()\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn newEventRateLimit(configuration, clock.RealClock{})\n\t\t})\n}", "title": "" }, { "docid": "58c5c4af2cd7631d9b38a2540fb4cf52", "score": "0.62524676", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn NewLifecycle(sets.NewString(metav1.NamespaceDefault, metav1.NamespaceSystem, metav1.NamespacePublic))\n\t})\n}", "title": "" }, { "docid": "cc5c31f2a2120581d87593fa837abdca", "score": "0.625127", "text": "func (m *EniDevicePlugin) Register(kubeletEndpoint, resourceName string) error {\n\tconn, err := dial(kubeletEndpoint, 5*time.Second)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(m.socket),\n\t\tResourceName: resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f9efea213ce282ed4257ac20cbd85f7", "score": "0.6240035", "text": "func RegisterPlugin(name string, plug robot.PluginHandler) {\n\ttask := registerTask(name)\n\tif task == nil {\n\t\treturn\n\t}\n\tplugin := &Plugin{\n\t\tTask: task,\n\t}\n\tcurrentCfg.addTask(plugin)\n\tpluginHandlers[name] = plug\n}", "title": "" }, { "docid": "7d041011126067b58fef3525f395472b", "score": "0.62307847", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn NewValidateAPIServer()\n\t})\n}", "title": "" }, { "docid": "cd3502afa747113313c5df5e403ff856", "score": "0.6227752", "text": "func RegisterPlugin(nvim *nvim.Nvim) {\n\tnvim.Subscribe(\"GonvimFuzzy\")\n\tshim := &Fuzzy{\n\t\tnvim: nvim,\n\t\tslab: util.MakeSlab(slab16Size, slab32Size),\n\t\tscoreMutext: &sync.Mutex{},\n\t\tmax: 20,\n\t}\n\tnvim.RegisterHandler(\"GonvimFuzzy\", func(args ...interface{}) {\n\t\tgo shim.handle(args...)\n\t})\n}", "title": "" }, { "docid": "0115ee472538c2c485d82b24627a172f", "score": "0.6208167", "text": "func RegisterMachinePlugin(plugin model.MachineConstructor) error {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\n\tif plugins == nil {\n\t\tplugins = make(map[string]model.MachineConstructor)\n\t}\n\n\t_, exist := plugins[plugin.Name()]\n\tif exist {\n\t\treturn fmt.Errorf(\"plugin %q already exist\", plugin.Name())\n\t}\n\n\tplugins[plugin.Name()] = plugin\n\n\tutil.BuildInfo().RegisterMachine(plugin.PluginName())\n\n\treturn nil\n}", "title": "" }, { "docid": "f92b5e8694fe107e1feb86381380723f", "score": "0.6206587", "text": "func addPlugin(cmd *cobra.Command, args []string) error {\n\tvar err error\n\tname := args[0]\n\tif description == \"\" {\n\t\tdescription, err = askDescription()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tdata := struct {\n\t\tPluginName string\n\t\tDescription string\n\t}{\n\t\tPluginName: name,\n\t\tDescription: description,\n\t}\n\ttargets := template.DefaultPluginTargets\n\tfor _, target := range targets {\n\t\terr := target.Run(\"\", data, dryRun)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tcmd.Print(\"successfully created plugin\")\n\n\treturn nil\n}", "title": "" }, { "docid": "ce59413200ce2a9fe0997a0d6cdfa075", "score": "0.61916745", "text": "func (db *Database) RegisterPlugin (plugin DatabasePlugin) error {\n\tfor _, rplugin := range db.plugins {\n\t\tif plugin.Name == rplugin.Name {\n\t\t\treturn ErrDBPluginNameTaken\n\t\t}\n\t}\n\tdb.plugins = append (db.plugins, plugin)\n\tres, err := db.Query (\"SELECT `version` FROM `plugin_versions` WHERE `name` = ?\", plugin.Name)\n\tif err != nil {\n\t\treturn db.upgradePlugin (plugin, 0)\n\t}\n\tres.Next ()\n\tvar plugin_version int\n\tres.Scan (&plugin_version)\n\tif plugin_version < plugin.Version {\n\t\treturn db.upgradePlugin (plugin, plugin_version)\n\t}\n\treturn nil;\n}", "title": "" }, { "docid": "c26da6d4c44d1bdb5382d433d3fb4507", "score": "0.61821747", "text": "func (m *manager) Register(ctx context.Context, info *remote.PluginInfo) (*remote.Context, error) {\n\tif info != nil && info.Name != \"\" {\n\t\tklog.Infof(\"Registering plugin %s\", info.Name)\n\n\t\tm.pluginMutex.Lock()\n\t\tdefer m.pluginMutex.Unlock()\n\n\t\tm.pluginVersions[info.Name] = &remote.RegisterPluginRequest{\n\t\t\tName: info.Name,\n\t\t}\n\t}\n\n\treturn &remote.Context{\n\t\tVirtualClusterConfig: m.virtualKubeConfig,\n\t\tPhysicalClusterConfig: m.physicalKubeConfig,\n\t\tSyncerConfig: m.syncerKubeConfig,\n\t\tTargetNamespace: m.targetNamespace,\n\t\tCurrentNamespace: m.currentNamespace,\n\t\tOptions: m.options,\n\t}, nil\n}", "title": "" }, { "docid": "7cc4051bc68964e6f28d50e1cef24062", "score": "0.6161094", "text": "func (m *AsakaVgpuDevicePlugin) Register(kubeletEndpoint, resourceName string) error {\n\tconn, err := dial(kubeletEndpoint, 5*time.Second)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(m.socket),\n\t\tResourceName: resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca27b173a1e5135f1f17db636e55638d", "score": "0.6154462", "text": "func init() { plugin.Register(\"wolverine\", setup) }", "title": "" }, { "docid": "f033ff9d69b52a4783c03d7dab0770c2", "score": "0.61374915", "text": "func RegisterImagePlugin(p ImagePlugin) {\n\timagePlugin = p\n}", "title": "" }, { "docid": "1a933bdeb59dd7c2c6d6c933b61f9e75", "score": "0.61319", "text": "func Register(name string, pluginCreator func() DBMigratorPlugin) {\n\tmigratorPluginsMu.Lock()\n\tdefer migratorPluginsMu.Unlock()\n\tif pluginCreator == nil {\n\t\tpanic(\"plugin creator is nil\")\n\t}\n\tif _, dup := migratorPlugins[name]; dup {\n\t\tpanic(\"register called twice for migrator plugin \" + name)\n\t}\n\tmigratorPlugins[name] = pluginCreator\n}", "title": "" }, { "docid": "247f2a522a43747c94a775e6aceaddb7", "score": "0.60706425", "text": "func (p *NacosRegisterPlugin) Register(name string, rcvr interface{}, metadata string) (err error) {\n\tif strings.TrimSpace(name) == \"\" {\n\t\treturn errors.New(\"Register service `name` can't be empty\")\n\t}\n\n\tnetwork, ip, port, err := util.ParseRpcxAddress(p.ServiceAddress)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to parse rpcx addr in Register: %v\", err)\n\t\treturn err\n\t}\n\n\tmeta := util.ConvertMeta2Map(metadata)\n\tmeta[\"network\"] = network\n\n\tinst := vo2.RegisterInstanceParam{\n\t\tIp: ip,\n\t\tPort: uint64(port),\n\t\tServiceName: name,\n\t\tMetadata: meta,\n\t\tClusterName: p.Cluster,\n\t\tGroupName: p.Group,\n\t\tWeight: p.Weight,\n\t\tEnable: true,\n\t\tHealthy: true,\n\t\tEphemeral: true,\n\t}\n\n\t_, err = p.namingClient.RegisterInstance(inst)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to register %s: %v\", name, err)\n\t\treturn err\n\t}\n\n\tp.Services = append(p.Services, name)\n\n\treturn\n}", "title": "" }, { "docid": "14dd3147db86c5ac8d84d4ad50fd6317", "score": "0.6058683", "text": "func (m *ManagerImpl) Register(ctx context.Context,\n\tr *pluginapi.RegisterRequest) (*pluginapi.Empty, error) {\n\tglog.V(2).Infof(\"Got request for Device Plugin %s\", r.ResourceName)\n\tif r.Version != pluginapi.Version {\n\t\treturn &pluginapi.Empty{}, fmt.Errorf(errUnsuportedVersion)\n\t}\n\n\tif err := IsResourceNameValid(r.ResourceName); err != nil {\n\t\treturn &pluginapi.Empty{}, err\n\t}\n\n\t// TODO: for now, always accepts newest device plugin. Later may consider to\n\t// add some policies here, e.g., verify whether an old device plugin with the\n\t// same resource name is still alive to determine whether we want to accept\n\t// the new registration.\n\tgo m.addEndpoint(r)\n\n\treturn &pluginapi.Empty{}, nil\n}", "title": "" }, { "docid": "902c44ea1306814333b6b198d8579913", "score": "0.604159", "text": "func RegisterPlugin(plugin *Plugin) error {\n\tif plugin == nil {\n\t\treturn errors.New(\"cannot register nil plugin\")\n\t}\n\tlog.Printf(\"Registering plugin '%s'\", plugin.Name)\n\tif _, ok := RegisteredPlugins[plugin.Name]; ok {\n\t\t// TODO this highlights that asking the plugins to register themselves\n\t\t// is not the right approach. Need to register them in the main program.\n\t\tlog.Panicf(\"Plugin '%s' is already registered\", plugin.Name)\n\t}\n\tRegisteredPlugins[plugin.Name] = plugin\n\treturn nil\n}", "title": "" }, { "docid": "984426dc73d47727f3a3204421d16199", "score": "0.60323167", "text": "func Register(name string, p presetFactory) {\n\tregistry[name] = p\n}", "title": "" }, { "docid": "cfb990d624eed2f850cda8009d939f77", "score": "0.60133845", "text": "func InstallPlugin(protocol string, f NewFunc) {\n\tlog.Printf(\"Install client plugin, protocol=%s\", protocol)\n\trpcClientPlugins[protocol] = f\n}", "title": "" }, { "docid": "9f8aa36f676fe3438548e40c49d45fdb", "score": "0.6008941", "text": "func (p *RedisRegisterPlugin) Register(name string, rcvr interface{}, metadata string) (err error) {\n\tif strings.TrimSpace(name) == \"\" {\n\t\terr = errors.New(\"Register service `name` can't be empty\")\n\t\treturn\n\t}\n\n\tif p.kv == nil {\n\t\tredis.Register()\n\t\tkv, err := libkv.NewStore(store.REDIS, p.RedisServers, p.Options)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"cannot create redis registry: %v\", err)\n\t\t\treturn err\n\t\t}\n\t\tp.kv = kv\n\t}\n\n\terr = p.kv.Put(p.BasePath, []byte(\"rpcx_path\"), &store.WriteOptions{IsDir: true})\n\tif err != nil && !strings.Contains(err.Error(), \"Not a file\") {\n\t\tlog.Errorf(\"cannot create redis path %s: %v\", p.BasePath, err)\n\t\treturn err\n\t}\n\n\tnodePath := fmt.Sprintf(\"%s/%s\", p.BasePath, name)\n\terr = p.kv.Put(nodePath, []byte(name), &store.WriteOptions{IsDir: true})\n\tif err != nil && !strings.Contains(err.Error(), \"Not a file\") {\n\t\tlog.Errorf(\"cannot create redis path %s: %v\", nodePath, err)\n\t\treturn err\n\t}\n\n\tnodePath = fmt.Sprintf(\"%s/%s/%s\", p.BasePath, name, p.ServiceAddress)\n\terr = p.kv.Put(nodePath, []byte(metadata), &store.WriteOptions{TTL: p.UpdateInterval * 2})\n\tif err != nil {\n\t\tlog.Errorf(\"cannot create redis path %s: %v\", nodePath, err)\n\t\treturn err\n\t}\n\n\tp.Services = append(p.Services, name)\n\n\tp.metasLock.Lock()\n\tif p.metas == nil {\n\t\tp.metas = make(map[string]string)\n\t}\n\tp.metas[name] = metadata\n\tp.metasLock.Unlock()\n\treturn\n}", "title": "" }, { "docid": "908ebe3e4e5d17a4768d129789d8d728", "score": "0.600871", "text": "func (p *Plugin) RegisterForTests() error {\n\tspecs := make(map[string][]*pluginSpec)\n\tfor _, spec := range p.pluginSpecs {\n\t\tspecs[spec.path()] = append(specs[spec.path()], spec)\n\t}\n\n\tconst host = \"nvim-go-test\"\n\tfor path, specs := range specs {\n\t\tif err := p.Nvim.Call(\"remote#host#RegisterPlugin\", nil, host, path, specs); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\terr := p.Nvim.Call(\"remote#host#Register\", nil, host, \"x\", p.Nvim.ChannelID())\n\n\treturn err\n}", "title": "" }, { "docid": "694f6c03f8dbdf4c1fec7824ad027997", "score": "0.60000217", "text": "func RegisterPlugin() volume.Plugin {\n\treturn &glusterfsPlugin{}\n}", "title": "" }, { "docid": "db614a5bbbb9215a238067f59977eee8", "score": "0.5963055", "text": "func (m *NvidiaDevicePlugin) Register(kubeletEndpoint, resourceName string) error {\n\tconn, err := dial(kubeletEndpoint, 5*time.Second)\n\tif err != nil {\n\t\tlog.Printf(\"endpoint %s, Dial conn error: %s\", kubeletEndpoint, err)\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(m.socket),\n\t\tResourceName: resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\tlog.Printf(\"client register: %s\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a0d0f00756aeb03fc359719c24de87c2", "score": "0.5932958", "text": "func Register(kubeletEndpoint, pluginEndpoint, resourceName string) error {\n\tglog.Infof(\"NUMA Test DP Registering with Kubelet..\")\n\tconn, err := grpc.Dial(kubeletEndpoint, grpc.WithInsecure(),\n\t\tgrpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {\n\t\t\treturn net.DialTimeout(\"unix\", addr, timeout)\n\t\t}))\n\tif err != nil {\n\t\tglog.Errorf(\"NUMA Test Device Plugin cannot connect to Kubelet service: %v\", err)\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\tclient := pluginapi.NewRegistrationClient(conn)\n\n\trequest := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: pluginEndpoint,\n\t\tResourceName: resourceName,\n\t}\n\n\tif _, err = client.Register(context.Background(), request); err != nil {\n\t\tglog.Errorf(\"NUMA Test Device Plugin cannot register to Kubelet service: %v\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d8ffe03b25c9b7850854002812ed5aea", "score": "0.5923813", "text": "func (p *ConsulRegisterPlugin) Register(name string, rcvr interface{}, metadata string) (err error) {\r\n\tif strings.TrimSpace(name) == \"\" {\r\n\t\treturn errors.New(\"serviceEmpty\")\r\n\t}\r\n\r\n\tnetwork, ip, port, err := util.ParseRpcxAddress(p.ServiceAddress)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tmeta := util.ConvertMeta2Map(metadata)\r\n\tmeta[\"network\"] = network\r\n\tmeta[\"env\"] = p.ENV\r\n\r\n\thealthCheck := api.AgentServiceCheck{\r\n\t\tTimeout: fmt.Sprintf(\"%vs\", p.Timeout),\r\n\t\tInterval: fmt.Sprintf(\"%vs\", p.BeatIntervalMs),\r\n\t\tDeregisterCriticalServiceAfter: fmt.Sprintf(\"%vs\", p.ListenIntervalMs),\r\n\t}\r\n\tif p.HealthType == \"tcp\" {\r\n\t\thealthCheck.TCP = fmt.Sprintf(\"%s:%v\", ip, port)\r\n\t}\r\n\tif p.HealthType == \"http\" {\r\n\t\thealthCheck.HTTP = fmt.Sprintf(\"http://%s:%v/health?service=%s\", ip, port, name)\r\n\t\theaderVal := []string{\"serviceCheck\"}\r\n\t\thealthCheck.Header = map[string][]string{\r\n\t\t\t\"Consul-Health-Check\": headerVal,\r\n\t\t}\r\n\t\thealthCheck.Method = \"POST\"\r\n\t\thealthCheck.Body = metadata\r\n\t}\r\n\r\n\tinst := &api.AgentServiceRegistration{\r\n\t\tName: name,\r\n\t\tID: fmt.Sprintf(\"%s_%s_%v\", name, ip, port),\r\n\t\tPort: port,\r\n\t\tTags: p.Tags,\r\n\t\tAddress: ip,\r\n\t\tMeta: meta,\r\n\t\tCheck: &healthCheck,\r\n\t}\r\n\tdone := false\r\n\tfor _, nc := range p.namingClients {\r\n\t\terr = nc.ServiceRegister(inst)\r\n\t\tncn, _ := nc.NodeName()\r\n\t\tif err == nil {\r\n\t\t\tlog.Debugf(\"ConsulRegisterPlugin:Register:ServiceRegister: %s:service:%s\", ncn, inst.Name)\r\n\t\t\tdone = true\r\n\t\t} else {\r\n\t\t\tlog.Errorf(\"ConsulRegisterPlugin:Register:ServiceRegister: %s:service:%s:err:%v\", ncn, inst.Name, err)\r\n\t\t}\r\n\t}\r\n\tif err != nil && !done {\r\n\t\treturn err\r\n\t}\r\n\r\n\tp.Services = append(p.Services, name)\r\n\r\n\treturn\r\n}", "title": "" }, { "docid": "a1025019d9446dfb988c2e31bc0a4059", "score": "0.5923486", "text": "func AddPlugin(plugin Plugin) {\n\tif plugin == nil {\n\t\tpanic(\"xray: plugin should not be nil\")\n\t}\n\tmuPlugins.Lock()\n\tdefer muPlugins.Unlock()\n\tplugins = append(plugins, plugin)\n}", "title": "" }, { "docid": "ab2bb42807eaf33a321fec8daa6ae330", "score": "0.5921719", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn customresourcevalidation.NewValidator(\n\t\t\tmap[schema.GroupResource]bool{\n\t\t\t\tconfigv1.Resource(\"featuregates\"): true,\n\t\t\t},\n\t\t\tmap[schema.GroupVersionKind]customresourcevalidation.ObjectValidator{\n\t\t\t\tconfigv1.GroupVersion.WithKind(\"FeatureGate\"): featureGateV1{},\n\t\t\t})\n\t})\n}", "title": "" }, { "docid": "1a7433b8c777fdf5f6dfca174207af3b", "score": "0.5911476", "text": "func Register(f string, p xdebugproxy.XDebugProcessorPlugin) {\n\tpathMapperRegistry[f] = p\n}", "title": "" }, { "docid": "2d13a6fbc497b87407446de1fa3aeb35", "score": "0.58914495", "text": "func (pluginHost *LivePluginHost) Register(ctx context.Context, registerRequest Command) error {\n\tlogger := log.From(ctx)\n\n\tfor actionName, action := range registerRequest.Actions {\n\t\tname := fmt.Sprintf(\"%s.%s\", registerRequest.Name, actionName)\n\t\tlogger.Info(\"registering command\", \"name\", name)\n\n\t\tapplicationCommand := action.ToApplicationCommand(registerRequest.Name)\n\n\t\tif err := pluginHost.brain.CreateCommand(ctx, applicationCommand); err != nil {\n\t\t\treturn fmt.Errorf(\"create command '%s': %w\", name, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b4aa7967539e19ea174aeb7371f1d8d8", "score": "0.5876676", "text": "func Register(p Provider) {\n\tproviders[p.Name()] = p\n}", "title": "" }, { "docid": "955cc91cd700639c8252a8cf3f54b7a7", "score": "0.5871428", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(\"Sidecars\", func(config io.Reader) (admission.Interface, error) {\n\t\treturn New()\n\t})\n}", "title": "" }, { "docid": "6e8644b6f76cbd5a0c8641a4c1a99d84", "score": "0.5855968", "text": "func RegisterFactory(name string, f Factory) {\n\tif _, ok := pluginFactory.Load(name); ok {\n\t\tlog.L().Info(\"plugin already exists, skip\", log.Any(\"plugin\", name))\n\t\treturn\n\t}\n\tpluginFactory.Store(name, f)\n\tlog.L().Info(\"plugin is registered\", log.Any(\"plugin\", name))\n}", "title": "" }, { "docid": "b1fac94710f4cfc253adc6e74af380bf", "score": "0.5792528", "text": "func (p *Plugin) Register(s *grpc.Server) {\n\tzap.L().Info(\"registering the kms plugin with grpc server\")\n\tpb.RegisterKeyManagementServiceServer(s, p)\n}", "title": "" }, { "docid": "a6bf763a623c33d4b69b30193f298ae5", "score": "0.577337", "text": "func (provider *HadeSSHProvider) Register(c framework.Container) framework.NewInstance {\n\treturn NewHadeSSH\n}", "title": "" }, { "docid": "0150608c14b333cf9aabdc9f096b60b0", "score": "0.5772701", "text": "func init() {\n\tpluginArgs = &factory.PluginFactoryArgs{}\n}", "title": "" }, { "docid": "fbadb5d0d5bf4b522d9aa8d163b56b57", "score": "0.57682043", "text": "func Register() *cobra.Command {\n\treturn app.NewSchedulerCommand(\n\t\tapp.WithPlugin(demoplugin.Name, demoplugin.New),\n\t\tapp.WithPlugin(nodelabel.Name, nodelabel.New),\n\t\tapp.WithPlugin(scoreplugin.Name, scoreplugin.New),\n\t)\n}", "title": "" }, { "docid": "c43a88483a1c56c49a058a0fd85d53ee", "score": "0.5745854", "text": "func RegisterByCommand(c string, f func(args string) error) {\n\tRegister(&emptyPlugin{\n\t\tcommand: c,\n\t\texec: f,\n\t})\n}", "title": "" }, { "docid": "f4b9066c4898c3d0c3aeef1d0292f056", "score": "0.5714767", "text": "func (r *ScriptRegistry) Register(d *ScriptDescriptor) {\n\tr.descriptors[d.Name] = *d\n}", "title": "" }, { "docid": "6b6ffc2c64b502454ac327ece2e44934", "score": "0.57090575", "text": "func (ps *Store) Add(p *v2.Plugin) error {\n\tps.Lock()\n\tdefer ps.Unlock()\n\n\tif v, exist := ps.plugins[p.GetID()]; exist {\n\t\treturn fmt.Errorf(\"plugin %q has the same ID %s as %q\", p.Name(), p.GetID(), v.Name())\n\t}\n\n\tps.setSpecOpts(p)\n\n\tps.plugins[p.GetID()] = p\n\treturn nil\n}", "title": "" }, { "docid": "fee424545ef4150dbcfb7a40dc298aa6", "score": "0.56877273", "text": "func (m *Manager) Register(name string, proto Prototype) {\n\tm.showcase[name] = proto\n}", "title": "" }, { "docid": "2bb8e11cced1b29c03de76e908334c1a", "score": "0.5675247", "text": "func AddPlugin(plugin Plugin) int {\n\tbytePlugin, err := json.Marshal(plugin)\n\tif err != nil {\n\t\treturn 0\n\t}\n\n\tres, err := http.Post(\"http://\"+ServerIP+\":\"+os.Getenv(\"CASA_SERVER_PORT\")+\"/v1/gateway/\"+utils.GetIDFile()+\"/plugins\", \"application/json\", bytes.NewReader(bytePlugin))\n\tif err != nil {\n\t\tlogger.WithFields(logger.Fields{\"code\": \"CGGGAP001\"}).Errorf(\"%s\", err.Error())\n\t}\n\tdefer res.Body.Close()\n\n\treturn res.StatusCode\n}", "title": "" }, { "docid": "26a9e9d54e688f6d0276d61ee3de76e3", "score": "0.5672546", "text": "func Register(root *cobra.Command, cfg config.Config) {\n\tvar input, moss, baseFile string\n\tvar pathLayers int\n\n\tlanguages := []string{}\n\n\tdetectCmd := &cobra.Command{\n\t\tUse: \"detect\",\n\t\tShort: \"detect software similarity\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tmain(input, moss, baseFile, pathLayers, languages, cfg)\n\t\t},\n\t}\n\n\tdetectCmd.Flags().StringVarP(&baseFile, \"base\", \"b\", \"\", \"To define common code file\")\n\tdetectCmd.Flags().StringVarP(&input, \"input\", \"i\", cfg.InputDir, \"To define input zip file\")\n\tdetectCmd.Flags().StringVarP(&moss, \"moss\", \"m\", cfg.MossDir, \"To define path to moss\")\n\tdetectCmd.Flags().IntVarP(&pathLayers, \"pathlayers\", \"p\", cfg.PathLayers, \"To define path layers\")\n\tdetectCmd.Flags().StringSliceVarP(&languages, \"languages\", \"l\",\n\t\tcfg.Supported, \"To define supported languages\")\n\n\troot.AddCommand(detectCmd)\n}", "title": "" }, { "docid": "3aeda4a50e5ae547898236e60e773054", "score": "0.56621116", "text": "func (pm *PluginManager) RegisterInterface(cfg PluginInterfaceConfig) error {\n\t// ensure the identifier is unique and hasn't been registered\n\t// before\n\tif _, exists := pm.interfaces[cfg.Identifier]; exists {\n\t\treturn errors.New(\"Plugin interface already defined\")\n\t}\n\n\tif reflect.TypeOf(cfg.Factory).Kind() != reflect.Struct {\n\t\treturn errors.New(\"Factory is not a struct\")\n\t}\n\n\t// ensure the Factory implements the interface\n\tif !implements(reflect.TypeOf(cfg.Factory), reflect.TypeOf(cfg.Interface)) {\n\t\treturn errors.New(\"Given factory does not implement the registered plugin interface\")\n\t}\n\n\t// ensure the Factory implements the goplugin.Plugin interface,\n\t// which means by extension means the Registered Interface\n\t// implements the goplugin.Plugin interface\n\tif _, ok := (cfg.Factory).(Plugin); !ok {\n\t\treturn errors.New(\"Defined plugin interface does not implement the goplugin.Plugin interface\")\n\t}\n\n\t// load all the method signatures of the interface\n\t// config\n\tfactory := reflect.TypeOf(cfg.Factory)\n\tfor i := 0; i < factory.NumMethod(); i++ {\n\t\tmethod := factory.Method(i)\n\t\tcfg.methods = append(cfg.methods, method.Name)\n\t}\n\n\t// save the plugin interface definition\n\tpm.interfaces[cfg.Identifier] = cfg\n\treturn nil\n}", "title": "" }, { "docid": "c92e4ddd478460ab50547a37072552a2", "score": "0.5653928", "text": "func (p *CliPlugin) RegisterEvent(cb bot.Callback) {}", "title": "" }, { "docid": "9c77a03efdbeab2d747cb1822b14914a", "score": "0.56443614", "text": "func Register(cmd *cobra.Command) {\n\troot.AddCommand(cmd)\n}", "title": "" } ]
b53d99872784a4ae719fddb78ceb6659
StreamExecute executes the query and streams the result. The first QueryResult will have Fields set (and Rows nil). The subsequent QueryResult will have Rows set (and Fields nil).
[ { "docid": "630a7e5c8e2deb71a4736aecdae71614", "score": "0.76582056", "text": "func (sq *SqlQuery) StreamExecute(ctx context.Context, target *pb.Target, query *proto.Query, sendReply func(*mproto.QueryResult) error) (err error) {\n\t// check cases we don't handle yet\n\tif query.TransactionId != 0 {\n\t\treturn NewTabletError(ErrFail, vtrpc.ErrorCode_BAD_INPUT, \"Transactions not supported with streaming\")\n\t}\n\n\tlogStats := newSqlQueryStats(\"StreamExecute\", ctx)\n\tdefer sq.handleExecError(query, &err, logStats)\n\n\tif err = sq.startRequest(target, query.SessionId, false); err != nil {\n\t\treturn err\n\t}\n\tdefer sq.endRequest()\n\n\tif query.BindVariables == nil {\n\t\tquery.BindVariables = make(map[string]interface{})\n\t}\n\tstripTrailing(query)\n\tqre := &QueryExecutor{\n\t\tquery: query.Sql,\n\t\tbindVars: query.BindVariables,\n\t\ttransactionID: query.TransactionId,\n\t\tplan: sq.qe.schemaInfo.GetStreamPlan(query.Sql),\n\t\tctx: ctx,\n\t\tlogStats: logStats,\n\t\tqe: sq.qe,\n\t}\n\terr = qre.Stream(sendReply)\n\tif err != nil {\n\t\treturn sq.handleExecErrorNoPanic(query, err, logStats)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "16d83eee5ba4503666097459c86077ca", "score": "0.7258135", "text": "func (conn *gRPCQueryClient) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, transactionID int64, reservedID int64, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error) error {\n\t// All streaming clients should follow the code pattern below.\n\t// The first part of the function starts the stream while holding\n\t// a lock on conn.mu. The second part receives the data and calls\n\t// callback.\n\t// A new cancelable context is needed because there's currently\n\t// no direct API to end a stream from the client side. If callback\n\t// returns an error, we return from the function. The deferred\n\t// cancel will then cause the stream to be terminated.\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tstream, err := func() (queryservicepb.Query_StreamExecuteClient, error) {\n\t\tconn.mu.RLock()\n\t\tdefer conn.mu.RUnlock()\n\t\tif conn.cc == nil {\n\t\t\treturn nil, tabletconn.ConnClosed\n\t\t}\n\n\t\treq := &querypb.StreamExecuteRequest{\n\t\t\tTarget: target,\n\t\t\tEffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),\n\t\t\tImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),\n\t\t\tQuery: &querypb.BoundQuery{\n\t\t\t\tSql: query,\n\t\t\t\tBindVariables: bindVars,\n\t\t\t},\n\t\t\tOptions: options,\n\t\t\tTransactionId: transactionID,\n\t\t\tReservedId: reservedID,\n\t\t}\n\t\tstream, err := conn.c.StreamExecute(ctx, req)\n\t\tif err != nil {\n\t\t\treturn nil, tabletconn.ErrorFromGRPC(err)\n\t\t}\n\t\treturn stream, nil\n\t}()\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar fields []*querypb.Field\n\tfor {\n\t\tser, err := stream.Recv()\n\t\tif err != nil {\n\t\t\treturn tabletconn.ErrorFromGRPC(err)\n\t\t}\n\t\tif fields == nil {\n\t\t\tfields = ser.Result.Fields\n\t\t}\n\t\tif err := callback(sqltypes.CustomProto3ToResult(fields, ser.Result)); err != nil {\n\t\t\tif err == nil || err == io.EOF {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "45732e0d9a421075046951c663743761", "score": "0.7011381", "text": "func (vtg *VTGate) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {\n\tstartTime := time.Now()\n\tstatsKey := []string{\"StreamExecute\", \"Any\", strings.ToLower(tabletType.String())}\n\tdefer vtg.timings.Record(statsKey, startTime)\n\n\tx := vtg.inFlight.Add(1)\n\tdefer vtg.inFlight.Add(-1)\n\tif 0 < vtg.maxInFlight && vtg.maxInFlight < x {\n\t\treturn errTooManyInFlight\n\t}\n\n\tvar rowCount int64\n\terr := vtg.router.StreamExecute(\n\t\tctx,\n\t\tsql,\n\t\tbindVariables,\n\t\ttabletType,\n\t\tfunc(reply *sqltypes.Result) error {\n\t\t\trowCount += int64(len(reply.Rows))\n\t\t\tvtg.rowsReturned.Add(statsKey, int64(len(reply.Rows)))\n\t\t\treturn sendReply(reply)\n\t\t})\n\n\tif err != nil {\n\t\tnormalErrors.Add(statsKey, 1)\n\t\tquery := map[string]interface{}{\n\t\t\t\"Sql\": sql,\n\t\t\t\"BindVariables\": bindVariables,\n\t\t\t\"TabletType\": strings.ToLower(tabletType.String()),\n\t\t}\n\t\tlogError(err, query, vtg.logStreamExecute)\n\t}\n\treturn formatError(err)\n}", "title": "" }, { "docid": "bc65334a0f888f7d0eac3a6b522a0f81", "score": "0.69798166", "text": "func (sn *VTGateSession) StreamExecute(ctx context.Context, query string, bindVars map[string]*querypb.BindVariable) (sqltypes.ResultStream, error) {\n\t// passing in the function that will update the session when received on the stream.\n\treturn sn.impl.StreamExecute(ctx, sn.session, query, bindVars, func(response *vtgatepb.StreamExecuteResponse) {\n\t\tif response.Session != nil {\n\t\t\tsn.session = response.Session\n\t\t}\n\t})\n}", "title": "" }, { "docid": "b5b6d872fc56294b4d266f5c41b5d0ba", "score": "0.6804592", "text": "func (vtg *VTGate) StreamExecute(ctx context.Context, request *gorpcvtgatecommon.Query, sendReply func(interface{}) error) (err error) {\n\tdefer vtg.server.HandlePanic(&err)\n\tctx = callerid.NewContext(ctx,\n\t\tgorpccallerid.GoRPCEffectiveCallerID(request.CallerID),\n\t\tcallerid.NewImmediateCallerID(\"gorpc client\"))\n\treturn vtg.server.StreamExecute(ctx,\n\t\trequest.Sql,\n\t\trequest.BindVariables,\n\t\trequest.TabletType,\n\t\tfunc(value *sqltypes.Result) error {\n\t\t\treturn sendReply(&gorpcvtgatecommon.QueryResult{\n\t\t\t\tResult: value,\n\t\t\t})\n\t\t})\n}", "title": "" }, { "docid": "32e137582cd4fd0f3aafdd9c0d38000d", "score": "0.6675741", "text": "func (vc *vcursorImpl) StreamExecuteMulti(ctx context.Context, primitive engine.Primitive, query string, rss []*srvtopo.ResolvedShard, bindVars []map[string]*querypb.BindVariable, rollbackOnError bool, autocommit bool, callback func(reply *sqltypes.Result) error) []error {\n\tnoOfShards := len(rss)\n\tatomic.AddUint64(&vc.logStats.ShardQueries, uint64(noOfShards))\n\terr := vc.markSavepoint(ctx, rollbackOnError && (noOfShards > 1), map[string]*querypb.BindVariable{})\n\tif err != nil {\n\t\treturn []error{err}\n\t}\n\n\terrs := vc.executor.StreamExecuteMulti(ctx, primitive, vc.marginComments.Leading+query+vc.marginComments.Trailing, rss, bindVars, vc.safeSession, autocommit, callback)\n\tvc.setRollbackOnPartialExecIfRequired(len(errs) != len(rss), rollbackOnError)\n\n\treturn errs\n}", "title": "" }, { "docid": "ed0966b1c9fe4ce6585abb9a24efe085", "score": "0.6654533", "text": "func (c *Concatenate) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {\n\tvar seenFields []*querypb.Field\n\tvar fieldset sync.WaitGroup\n\tfieldsSent := false\n\n\tg := vcursor.ErrorGroupCancellableContext()\n\tfieldset.Add(1)\n\tvar mu sync.Mutex\n\tfor i, source := range c.Sources {\n\t\ti, source := i, source\n\t\tg.Go(func() error {\n\t\t\terr := source.StreamExecute(vcursor, bindVars, wantfields, func(resultChunk *sqltypes.Result) error {\n\t\t\t\t// if we have fields to compare, make sure all the fields are all the same\n\t\t\t\tif i == 0 && !fieldsSent {\n\t\t\t\t\tdefer fieldset.Done()\n\t\t\t\t\tseenFields = resultChunk.Fields\n\t\t\t\t\tfieldsSent = true\n\t\t\t\t\t// No other call can happen before this call.\n\t\t\t\t\treturn callback(resultChunk)\n\t\t\t\t}\n\t\t\t\tfieldset.Wait()\n\t\t\t\tif resultChunk.Fields != nil {\n\t\t\t\t\terr := compareFields(seenFields, resultChunk.Fields)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// This to ensure only one send happens back to the client.\n\t\t\t\tmu.Lock()\n\t\t\t\tdefer mu.Unlock()\n\t\t\t\tselect {\n\t\t\t\tcase <-vcursor.Context().Done():\n\t\t\t\t\treturn nil\n\t\t\t\tdefault:\n\t\t\t\t\treturn callback(resultChunk)\n\t\t\t\t}\n\t\t\t})\n\t\t\t// This is to ensure other streams complete if the first stream failed to unlock the wait.\n\t\t\tif i == 0 && !fieldsSent {\n\t\t\t\tfieldset.Done()\n\t\t\t}\n\t\t\treturn err\n\t\t})\n\n\t}\n\tif err := g.Wait(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3d8915daedd7e7a17b7b9ecac2efcda2", "score": "0.6594121", "text": "func (c *Concatenate) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {\n\tvar seenFields []*querypb.Field\n\tvar fieldset sync.WaitGroup\n\tvar cbMu sync.Mutex\n\n\tg, restoreCtx := vcursor.ErrorGroupCancellableContext()\n\tdefer restoreCtx()\n\tfieldsSent := false\n\tfieldset.Add(1)\n\n\tfor i, source := range c.Sources {\n\t\tcurrIndex, currSource := i, source\n\n\t\tg.Go(func() error {\n\t\t\terr := currSource.StreamExecute(vcursor, bindVars, wantfields, func(resultChunk *sqltypes.Result) error {\n\t\t\t\t// if we have fields to compare, make sure all the fields are all the same\n\t\t\t\tif currIndex == 0 && !fieldsSent {\n\t\t\t\t\tdefer fieldset.Done()\n\t\t\t\t\tseenFields = resultChunk.Fields\n\t\t\t\t\tfieldsSent = true\n\t\t\t\t\t// No other call can happen before this call.\n\t\t\t\t\treturn callback(resultChunk)\n\t\t\t\t}\n\t\t\t\tfieldset.Wait()\n\t\t\t\tif resultChunk.Fields != nil {\n\t\t\t\t\terr := compareFields(seenFields, resultChunk.Fields)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// This to ensure only one send happens back to the client.\n\t\t\t\tcbMu.Lock()\n\t\t\t\tdefer cbMu.Unlock()\n\t\t\t\tselect {\n\t\t\t\tcase <-vcursor.Context().Done():\n\t\t\t\t\treturn nil\n\t\t\t\tdefault:\n\t\t\t\t\treturn callback(resultChunk)\n\t\t\t\t}\n\t\t\t})\n\t\t\t// This is to ensure other streams complete if the first stream failed to unlock the wait.\n\t\t\tif currIndex == 0 && !fieldsSent {\n\t\t\t\tfieldset.Done()\n\t\t\t}\n\t\t\treturn err\n\t\t})\n\n\t}\n\tif err := g.Wait(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "98d7792bf83fa78bf1af72a017bc4b35", "score": "0.6592839", "text": "func (f *fakeVTGateService) StreamExecute(ctx context.Context, mysqlCtx vtgateservice.MySQLConnection, session *vtgatepb.Session, sql string, bindVariables map[string]*querypb.BindVariable, callback func(*sqltypes.Result) error) (*vtgatepb.Session, error) {\n\tif f.panics {\n\t\tpanic(fmt.Errorf(\"test forced panic\"))\n\t}\n\texecCase, ok := execMap[sql]\n\tif !ok {\n\t\treturn session, fmt.Errorf(\"no match for: %s\", sql)\n\t}\n\tf.checkCallerID(ctx, \"StreamExecute\")\n\tquery := &queryExecute{\n\t\tSQL: sql,\n\t\tBindVariables: bindVariables,\n\t\tSession: session,\n\t}\n\tif !query.equal(execCase.execQuery) {\n\t\tf.t.Errorf(\"StreamExecute:\\n%+v, want\\n%+v\", query, execCase.execQuery)\n\t\treturn session, nil\n\t}\n\tif execCase.result != nil {\n\t\tresult := &sqltypes.Result{\n\t\t\tFields: execCase.result.Fields,\n\t\t}\n\t\tif err := callback(result); err != nil {\n\t\t\treturn execCase.outSession, err\n\t\t}\n\t\tif f.hasError {\n\t\t\t// wait until the client has the response, since all streaming implementation may not\n\t\t\t// send previous messages if an error has been triggered.\n\t\t\t<-f.errorWait\n\t\t\tf.errorWait = make(chan struct{}) // for next test\n\t\t\treturn execCase.outSession, errTestVtGateError\n\t\t}\n\t\tfor _, row := range execCase.result.Rows {\n\t\t\tresult := &sqltypes.Result{\n\t\t\t\tRows: [][]sqltypes.Value{row},\n\t\t\t}\n\t\t\tif err := callback(result); err != nil {\n\t\t\t\treturn execCase.outSession, err\n\t\t\t}\n\t\t}\n\t}\n\treturn execCase.outSession, nil\n}", "title": "" }, { "docid": "4c66357bd279cf642c950fbee375698b", "score": "0.6372948", "text": "func (conn *gRPCQueryClient) BeginStreamExecute(ctx context.Context, target *querypb.Target, preQueries []string, query string, bindVars map[string]*querypb.BindVariable, reservedID int64, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error) (state queryservice.TransactionState, err error) {\n\tconn.mu.RLock()\n\tdefer conn.mu.RUnlock()\n\tif conn.cc == nil {\n\t\treturn state, tabletconn.ConnClosed\n\t}\n\n\tstream, err := func() (queryservicepb.Query_BeginStreamExecuteClient, error) {\n\t\tconn.mu.RLock()\n\t\tdefer conn.mu.RUnlock()\n\t\tif conn.cc == nil {\n\t\t\treturn nil, tabletconn.ConnClosed\n\t\t}\n\n\t\treq := &querypb.BeginStreamExecuteRequest{\n\t\t\tTarget: target,\n\t\t\tEffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),\n\t\t\tImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),\n\t\t\tPreQueries: preQueries,\n\t\t\tQuery: &querypb.BoundQuery{\n\t\t\t\tSql: query,\n\t\t\t\tBindVariables: bindVars,\n\t\t\t},\n\t\t\tReservedId: reservedID,\n\t\t\tOptions: options,\n\t\t}\n\t\tstream, err := conn.c.BeginStreamExecute(ctx, req)\n\t\tif err != nil {\n\t\t\treturn nil, tabletconn.ErrorFromGRPC(err)\n\t\t}\n\t\treturn stream, nil\n\t}()\n\tif err != nil {\n\t\treturn state, err\n\t}\n\tvar fields []*querypb.Field\n\tfor {\n\t\tser, err := stream.Recv()\n\t\tif state.TransactionID == 0 && ser.GetTransactionId() != 0 {\n\t\t\tstate.TransactionID = ser.GetTransactionId()\n\t\t}\n\t\tif state.TabletAlias == nil && ser.GetTabletAlias() != nil {\n\t\t\tstate.TabletAlias = ser.GetTabletAlias()\n\t\t}\n\t\tif state.SessionStateChanges == \"\" && ser.GetSessionStateChanges() != \"\" {\n\t\t\tstate.SessionStateChanges = ser.GetSessionStateChanges()\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn state, tabletconn.ErrorFromGRPC(err)\n\t\t}\n\n\t\tif ser.Error != nil {\n\t\t\treturn state, tabletconn.ErrorFromVTRPC(ser.Error)\n\t\t}\n\n\t\t// The last stream receive will not have a result, so callback will not be called for it.\n\t\tif ser.Result == nil {\n\t\t\treturn state, nil\n\t\t}\n\n\t\tif fields == nil {\n\t\t\tfields = ser.Result.Fields\n\t\t}\n\t\tif err := callback(sqltypes.CustomProto3ToResult(fields, ser.Result)); err != nil {\n\t\t\tif err == nil || err == io.EOF {\n\t\t\t\treturn state, nil\n\t\t\t}\n\t\t\treturn state, err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "13a56b616f6739045cc6e27ea0272988", "score": "0.62633145", "text": "func (q *StreamHealthQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]*querypb.BindVariable, transactionID, reservedID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {\n\treturn &sqltypes.Result{}, nil\n}", "title": "" }, { "docid": "18b3c8148f90386c6562e33b45d6744e", "score": "0.6200962", "text": "func (q Query) Execute() (*QueryResult, error) {\n\tquery := convertToCharStar(q.query)\n\tdefer releaseCharStar(query)\n\tvar r QueryResult\n\terr := C.qdb_query(q.handle, query, &r.result)\n\tif r.result == nil {\n\t\treturn nil, makeErrorOrNil(err)\n\t}\n\treturn &r, makeErrorOrNil(err)\n}", "title": "" }, { "docid": "6b924edf644aa623a5e205d29ee39f56", "score": "0.61425424", "text": "func (vtg *VTGate) StreamExecute2(ctx context.Context, request *gorpcvtgatecommon.Query, sendReply func(interface{}) error) (err error) {\n\tdefer vtg.server.HandlePanic(&err)\n\tctx = callerid.NewContext(ctx,\n\t\tgorpccallerid.GoRPCEffectiveCallerID(request.CallerID),\n\t\tcallerid.NewImmediateCallerID(\"gorpc client\"))\n\tvtgErr := vtg.server.StreamExecute(ctx,\n\t\trequest.Sql,\n\t\trequest.BindVariables,\n\t\trequest.TabletType,\n\t\tfunc(value *sqltypes.Result) error {\n\t\t\treturn sendReply(&gorpcvtgatecommon.QueryResult{\n\t\t\t\tResult: value,\n\t\t\t})\n\t\t})\n\tif vtgErr == nil {\n\t\treturn nil\n\t}\n\n\t// If there was an app error, send a QueryResult back with it.\n\treturn sendReply(&gorpcvtgatecommon.QueryResult{\n\t\tErr: vterrors.RPCErrFromVtError(vtgErr),\n\t})\n}", "title": "" }, { "docid": "92e7ff3c8b2a896cbb1bc43bb9bcc64c", "score": "0.61275697", "text": "func (sc *SimpleProjection) TryStreamExecute(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {\n\treturn vcursor.StreamExecutePrimitive(ctx, sc.Input, bindVars, wantfields, func(inner *sqltypes.Result) error {\n\t\treturn callback(sc.buildResult(inner))\n\t})\n}", "title": "" }, { "docid": "9e296496d37e0307b5fa29c8987dd126", "score": "0.6060236", "text": "func (q *Query) Execute(result interface{}) error {\n\tvar fields []*bigquery.TableFieldSchema\n\tvar rows []*bigquery.TableRow\n\tvar err error\n\tif q.JobConfig != nil {\n\t\tfields, rows, err = q.retrieveRowsWithJobConfig(nil)\n\t} else {\n\t\tfields, rows, err = q.retrieveRows(nil)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = Convert(fields, rows, result)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "976fa107cd8a19ba852038d55a6a4e31", "score": "0.60292053", "text": "func (sq *SqlQuery) Execute(ctx context.Context, target *pb.Target, query *proto.Query, reply *mproto.QueryResult) (err error) {\n\tlogStats := newSqlQueryStats(\"Execute\", ctx)\n\tdefer sq.handleExecError(query, &err, logStats)\n\n\tallowShutdown := (query.TransactionId != 0)\n\tif err = sq.startRequest(target, query.SessionId, allowShutdown); err != nil {\n\t\treturn err\n\t}\n\tctx, cancel := withTimeout(ctx, sq.qe.queryTimeout.Get())\n\tdefer func() {\n\t\tcancel()\n\t\tsq.endRequest()\n\t}()\n\n\tif query.BindVariables == nil {\n\t\tquery.BindVariables = make(map[string]interface{})\n\t}\n\tstripTrailing(query)\n\tqre := &QueryExecutor{\n\t\tquery: query.Sql,\n\t\tbindVars: query.BindVariables,\n\t\ttransactionID: query.TransactionId,\n\t\tplan: sq.qe.schemaInfo.GetPlan(ctx, logStats, query.Sql),\n\t\tctx: ctx,\n\t\tlogStats: logStats,\n\t\tqe: sq.qe,\n\t}\n\tresult, err := qre.Execute()\n\tif err != nil {\n\t\treturn sq.handleExecErrorNoPanic(query, err, logStats)\n\t}\n\t*reply = *result\n\treturn nil\n}", "title": "" }, { "docid": "82137c83f32fa227d3b62afae46de266", "score": "0.59717524", "text": "func (vtg *VTGate) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {\n\tstartTime := time.Now()\n\tstatsKey := []string{\"StreamExecuteShards\", keyspace, strings.ToLower(tabletType.String())}\n\tdefer vtg.timings.Record(statsKey, startTime)\n\n\tx := vtg.inFlight.Add(1)\n\tdefer vtg.inFlight.Add(-1)\n\tif 0 < vtg.maxInFlight && vtg.maxInFlight < x {\n\t\treturn errTooManyInFlight\n\t}\n\n\tvar rowCount int64\n\terr := vtg.resolver.StreamExecute(\n\t\tctx,\n\t\tsql,\n\t\tbindVariables,\n\t\tkeyspace,\n\t\ttabletType,\n\t\tfunc(keyspace string) (string, []string, error) {\n\t\t\treturn keyspace, shards, nil\n\t\t},\n\t\tfunc(reply *sqltypes.Result) error {\n\t\t\trowCount += int64(len(reply.Rows))\n\t\t\tvtg.rowsReturned.Add(statsKey, int64(len(reply.Rows)))\n\t\t\treturn sendReply(reply)\n\t\t})\n\n\tif err != nil {\n\t\tnormalErrors.Add(statsKey, 1)\n\t\tquery := map[string]interface{}{\n\t\t\t\"Sql\": sql,\n\t\t\t\"BindVariables\": bindVariables,\n\t\t\t\"Keyspace\": keyspace,\n\t\t\t\"Shards\": shards,\n\t\t\t\"TabletType\": strings.ToLower(tabletType.String()),\n\t\t}\n\t\tlogError(err, query, vtg.logStreamExecuteShards)\n\t}\n\treturn formatError(err)\n}", "title": "" }, { "docid": "054a9f246ed9cafa0b7926fecb986d15", "score": "0.5945204", "text": "func (qe *QueryExecutor) ExecuteQuery(query *Query) <-chan *QueryResult {\n\tresults := make(chan *QueryResult)\n\tgo qe.executeQuery(query, results)\n\treturn results\n}", "title": "" }, { "docid": "9c8cf6a88da2858f41da845184954053", "score": "0.59297574", "text": "func (qs *queryResponseStream) Stream(resp *serf.QueryResponse) {\n\t// Setup a timer for the query ending\n\tremaining := resp.Deadline().Sub(time.Now())\n\tdone := time.After(remaining)\n\n\tackCh := resp.AckCh()\n\trespCh := resp.ResponseCh()\n\tfor {\n\t\tselect {\n\t\tcase a := <-ackCh:\n\t\t\tif err := qs.sendAck(a); err != nil {\n\t\t\t\tqs.logger.Printf(\"[ERR] agent.ipc: Failed to stream ack to %v: %v\", qs.client, err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase r := <-respCh:\n\t\t\tif err := qs.sendResponse(r.From, r.Payload); err != nil {\n\t\t\t\tqs.logger.Printf(\"[ERR] agent.ipc: Failed to stream response to %v: %v\", qs.client, err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-done:\n\t\t\tif err := qs.sendDone(); err != nil {\n\t\t\t\tqs.logger.Printf(\"[ERR] agent.ipc: Failed to stream query end to %v: %v\", qs.client, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2885b25b8a64be3e1c25cb29c64f771f", "score": "0.58400536", "text": "func (s *Store) Execute(ctx context.Context, stmt api.Statement) (api.ResultSet, error) {\n\texecutor, err := s.createExecutor(stmt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// query execution\n\tvar rs api.ResultSet\n\tf := func() error {\n\t\tvar err error\n\t\trs, err = executor.Execute(ctx, stmt)\n\t\treturn err\n\t}\n\terr = f()\n\tif err == nil {\n\t\ts.metrics.ExecuteSuccess.Inc(1)\n\t} else {\n\t\ts.metrics.ExecuteFail.Inc(1)\n\t}\n\n\treturn rs, err\n}", "title": "" }, { "docid": "0756acb518df68dbfe6e93101c9c52df", "score": "0.58298403", "text": "func (oa *OrderedAggregate) TryStreamExecute(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable, _ bool, callback func(*sqltypes.Result) error) error {\n\tvar current []sqltypes.Value\n\tvar curDistincts []sqltypes.Value\n\tvar fields []*querypb.Field\n\n\tcb := func(qr *sqltypes.Result) error {\n\t\treturn callback(qr.Truncate(oa.TruncateColumnCount))\n\t}\n\n\tvisitor := func(qr *sqltypes.Result) error {\n\t\tif len(qr.Fields) != 0 {\n\t\t\tfields = convertFields(qr.Fields, oa.Aggregates)\n\t\t\tif err := cb(&sqltypes.Result{Fields: fields}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t// This code is similar to the one in Execute.\n\t\tfor _, row := range qr.Rows {\n\t\t\t// this is the first row. set up everything\n\t\t\tif current == nil {\n\t\t\t\tcurrent, curDistincts = convertRow(fields, row, oa.Aggregates)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// not the first row. are we still in the old group, or is this a new grouping?\n\t\t\tequal, err := oa.keysEqual(current, row)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif equal {\n\t\t\t\t// we are continuing to add values to the current grouping\n\t\t\t\tcurrent, curDistincts, err = merge(fields, current, row, curDistincts, oa.Aggregates)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// this is a new grouping. let's yield the old one, and start a new\n\t\t\tif err := cb(&sqltypes.Result{Rows: [][]sqltypes.Value{current}}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcurrent, curDistincts = convertRow(fields, row, oa.Aggregates)\n\t\t\tcontinue\n\t\t}\n\t\treturn nil\n\t}\n\n\terr := vcursor.StreamExecutePrimitive(ctx,\n\t\toa.Input,\n\t\tbindVars,\n\t\ttrue, /* we need the input fields types to correctly calculate the output types */\n\t\tvisitor)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif current != nil {\n\t\tif err := cb(&sqltypes.Result{Rows: [][]sqltypes.Value{current}}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf0936e339b51aa65ece70d654e5bf22", "score": "0.5761207", "text": "func (d *Influxdb) ExecuteQuery(query string, dbname string) (*client.Response, error) {\n\n\tq := client.Query{\n\t\tCommand: query,\n\t\tDatabase: dbname,\n\t\tChunked: false,\n\t}\n\n\tresponse, err := d.httpClient.Query(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "b3bc242ca9a047a59f041bd221a8f3f2", "score": "0.5735804", "text": "func (v *VExplain) TryStreamExecute(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {\n\tvcursor.Session().VExplainLogging()\n\terr := vcursor.StreamExecutePrimitive(ctx, v.Input, bindVars, wantfields, func(result *sqltypes.Result) error {\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tresult, err := v.convertToResult(ctx, vcursor)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn callback(result)\n}", "title": "" }, { "docid": "c3acc013505a86c4f3659f04901c9e69", "score": "0.5721409", "text": "func (q *Query) Execute() (rows *sql.Rows, err error) {\n\tdefer func() { err = q.finish(recover(), err) }()\n\trows, err = q.query()\n\treturn\n}", "title": "" }, { "docid": "c3acc013505a86c4f3659f04901c9e69", "score": "0.5721409", "text": "func (q *Query) Execute() (rows *sql.Rows, err error) {\n\tdefer func() { err = q.finish(recover(), err) }()\n\trows, err = q.query()\n\treturn\n}", "title": "" }, { "docid": "0444be62eca8daf07aa07081f55f8c13", "score": "0.56483203", "text": "func (dc *DirectConnection) Execute(sql string, maxRows int) (*mysql.Result, error) {\n\treturn dc.exec(sql, maxRows)\n}", "title": "" }, { "docid": "f2490ed4502a422d4abdee12ac9f9c6a", "score": "0.563823", "text": "func (conn *BaseConn) StreamRows(sql string) (ds Datastream, err error) {\n\treturn conn.StreamRowsContext(conn.context.ctx, sql)\n}", "title": "" }, { "docid": "3289cef586a27c508aabacbc24a1aef3", "score": "0.561663", "text": "func (s showtableStmt)Execute(query string, args []interface{}) (*mysql.Result, error) {\n\ttableName := uint8SliceTostring(args[0].([]uint8))\n\trows, err := s.stmt.Query(tableName)\n\tif err != nil {\n\t\tlogger.Error(\"error while query statement\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\treturn rowsToResult(rows, true)\n}", "title": "" }, { "docid": "58b6c790f752bb908be98225b36b8803", "score": "0.55991745", "text": "func (vtg *VTGate) StreamExecuteShard(ctx context.Context, request *gorpcvtgatecommon.QueryShard, sendReply func(interface{}) error) (err error) {\n\tdefer vtg.server.HandlePanic(&err)\n\tctx = callerid.NewContext(ctx,\n\t\tgorpccallerid.GoRPCEffectiveCallerID(request.CallerID),\n\t\tcallerid.NewImmediateCallerID(\"gorpc client\"))\n\treturn vtg.server.StreamExecuteShards(ctx,\n\t\trequest.Sql,\n\t\trequest.BindVariables,\n\t\trequest.Keyspace,\n\t\trequest.Shards,\n\t\trequest.TabletType,\n\t\tfunc(value *sqltypes.Result) error {\n\t\t\treturn sendReply(&gorpcvtgatecommon.QueryResult{\n\t\t\t\tResult: value,\n\t\t\t})\n\t\t})\n}", "title": "" }, { "docid": "e0e4d5e2a31b0bd634f81fd316578053", "score": "0.55573446", "text": "func (m *MockCloudSpanner) ExecuteStreamingSql(r *sppb.ExecuteSqlRequest, s sppb.Spanner_ExecuteStreamingSqlServer) error {\n\tswitch r.Sql {\n\tcase \"SELECT * from t_unavailable\":\n\t\treturn status.Errorf(codes.Unavailable, \"mock table unavailable\")\n\tcase \"SELECT t.key key, t.value value FROM t_mock t\":\n\t\tif r.ResumeToken != nil {\n\t\t\ts, err := DecodeResumeToken(r.ResumeToken)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tm.mu.Lock()\n\t\t\tm.next = int(s) + 1\n\t\t\tm.mu.Unlock()\n\t\t}\n\t\tfor {\n\t\t\tmsg, more := <-m.msgs\n\t\t\tif !more {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif msg.Err == nil {\n\t\t\t\tvar rt []byte\n\t\t\t\tif msg.ResumeToken {\n\t\t\t\t\tm.mu.Lock()\n\t\t\t\t\trt = EncodeResumeToken(uint64(m.next))\n\t\t\t\t\tm.mu.Unlock()\n\t\t\t\t}\n\t\t\t\tmeta := KvMeta\n\t\t\t\tmeta.Transaction = &sppb.Transaction{\n\t\t\t\t\tReadTimestamp: &pbt.Timestamp{\n\t\t\t\t\t\tSeconds: m.readTs.Unix(),\n\t\t\t\t\t\tNanos: int32(m.readTs.Nanosecond()),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tm.mu.Lock()\n\t\t\t\tnext := m.next\n\t\t\t\tm.next++\n\t\t\t\tm.mu.Unlock()\n\t\t\t\terr := s.Send(&sppb.PartialResultSet{\n\t\t\t\t\tMetadata: &meta,\n\t\t\t\t\tValues: []*proto3.Value{\n\t\t\t\t\t\t{Kind: &proto3.Value_StringValue{StringValue: fmt.Sprintf(\"foo-%02d\", next)}},\n\t\t\t\t\t\t{Kind: &proto3.Value_StringValue{StringValue: fmt.Sprintf(\"bar-%02d\", next)}},\n\t\t\t\t\t},\n\t\t\t\t\tResumeToken: rt,\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn msg.Err\n\t\t}\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported SQL: %v\", r.Sql)\n\t}\n}", "title": "" }, { "docid": "df903c8301b1f2bcdf80a7e9f9f5203c", "score": "0.555457", "text": "func (c *Client) Execute(q interface{}, opts ...QueryOption) error {\n\tquerier := Querier{c: c}\n\treturn querier.Execute(q, opts...)\n}", "title": "" }, { "docid": "141ec2231a66034438f3010e4490be49", "score": "0.5544207", "text": "func (q *SQLTest) Execute() (int64, error) {\n\tvar count int64\n\n\tfor _, s := range q.Query.Statements {\n\t\trows, err := q.db.Query(s)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\tfor rows.Next() {\n\t\t\tcount++\n\t\t}\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "b7e43d527f917837c413baa158bb8582", "score": "0.5539112", "text": "func (m *MySQLHandler) Execute(query string, args ...interface{}) (repository.Result, error) {\n\tres, err := m.conn.Exec(query, args...)\n\tif err != nil {\n\t\treturn new(Result), err\n\t}\n\treturn &Result{Result: res}, nil\n}", "title": "" }, { "docid": "e44ade36ac9dc9a071635a7413432c26", "score": "0.5532338", "text": "func (e *executor) Execute(ctx context.Context, tableKeyer dax.TableKeyer, q *pql.Query, shards []uint64, opt *ExecOptions) (QueryResponse, error) {\n\tindex := string(tableKeyer.Key())\n\n\tspan, ctx := tracing.StartSpanFromContext(ctx, \"executor.Execute\")\n\tspan.LogKV(\"pql\", q.String())\n\tdefer span.Finish()\n\n\tresp := QueryResponse{}\n\n\t// Check for query cancellation.\n\tif err := validateQueryContext(ctx); err != nil {\n\t\treturn resp, err\n\t}\n\n\t// Verify that an index is set.\n\tif index == \"\" {\n\t\treturn resp, ErrIndexRequired\n\t}\n\n\tidx := e.Holder.Index(index)\n\tif idx == nil {\n\t\treturn resp, newNotFoundError(ErrIndexNotFound, index)\n\t}\n\n\tneedWriteTxn := false\n\tnw := q.WriteCallN()\n\tif nw > 0 {\n\t\tneedWriteTxn = true\n\t}\n\n\t// Verify that the number of writes do not exceed the maximum.\n\tif e.MaxWritesPerRequest > 0 && nw > e.MaxWritesPerRequest {\n\t\treturn resp, ErrTooManyWrites\n\t}\n\n\t// Default options.\n\tif opt == nil {\n\t\topt = &ExecOptions{}\n\t}\n\t// Default maximum memory, if not passed in.\n\tif opt.MaxMemory == 0 && q.HasCall(\"Extract\") {\n\t\topt.MaxMemory = e.maxMemory\n\t}\n\n\tif opt.Profile {\n\t\tvar prof tracing.ProfiledSpan\n\t\tprof, ctx = tracing.StartProfiledSpanFromContext(ctx, \"Execute\")\n\t\tdefer prof.Finish()\n\t\tvar ok bool\n\t\tresp.Profile, ok = prof.(*tracing.Profile)\n\t\tif !ok {\n\t\t\treturn resp, fmt.Errorf(\"profiling execution failed: %T is not tracing.Profile\", prof)\n\t\t}\n\t}\n\n\t// Can't do NewTx() this high up, because we need a specific shard.\n\t// So start a qcx with a TxGroup and pass it down.\n\tvar qcx *Qcx\n\tif needWriteTxn {\n\t\tqcx = idx.holder.txf.NewWritableQcx()\n\t} else {\n\t\tqcx = idx.holder.txf.NewQcx()\n\t}\n\tdefer qcx.Abort()\n\n\tresults, err := e.execute(ctx, qcx, index, q, shards, opt)\n\tif err != nil {\n\t\treturn resp, err\n\t} else if err := validateQueryContext(ctx); err != nil {\n\t\treturn resp, err\n\t}\n\tresp.Results = results\n\n\t// Translate response objects from ids to keys, if necessary.\n\t// No need to translate a remote call.\n\tif !opt.Remote {\n\t\t// only translateResults if this local node is the final destination. only string/column keys.\n\t\tif err := e.translateResults(ctx, index, idx, q.Calls, results, opt.MaxMemory); err != nil {\n\t\t\tif errors.Cause(err) == ErrTranslatingKeyNotFound {\n\t\t\t\t// No error - return empty result\n\t\t\t\tresp.Results = make([]interface{}, len(q.Calls))\n\t\t\t\tfor i, c := range q.Calls {\n\t\t\t\t\tresp.Results[i] = emptyResult(c)\n\t\t\t\t}\n\t\t\t\treturn resp, nil\n\t\t\t}\n\t\t\treturn resp, err\n\t\t} else if err := validateQueryContext(ctx); err != nil {\n\t\t\treturn resp, err\n\t\t}\n\t}\n\t// Must copy out of Tx data before Commiting, because it will become invalid afterwards.\n\trespSafeNoTxData := safeCopy(resp)\n\n\t// Commit transactions if writing; else let the defer grp.Abort do the rollbacks.\n\tif needWriteTxn {\n\t\tif err := qcx.Finish(); err != nil {\n\t\t\treturn respSafeNoTxData, err\n\t\t}\n\t}\n\treturn respSafeNoTxData, nil\n}", "title": "" }, { "docid": "b2e04606e018c774f4167cf9b84b0770", "score": "0.5530325", "text": "func (conn *BaseConn) StreamRecords(sql string) (<-chan map[string]interface{}, error) {\n\n\tstart := time.Now()\n\n\tif sql == \"\" {\n\t\treturn nil, errors.New(\"Empty Query\")\n\t}\n\n\tresult, err := conn.db.Queryx(sql)\n\tif err != nil {\n\t\treturn nil, Error(err, \"SQL Error for:\\n\"+sql)\n\t}\n\n\tfields, err := result.Columns()\n\tif err != nil {\n\t\treturn nil, Error(err, \"result.Columns()\")\n\t}\n\n\tconn.Data.Result = result\n\tconn.Data.SQL = sql\n\tconn.Data.Duration = time.Since(start).Seconds()\n\tconn.Data.Rows = [][]interface{}{}\n\tconn.Data.setFields(fields)\n\n\tchnl := make(chan map[string]interface{})\n\tgo func() {\n\t\tfor result.Next() {\n\t\t\t// get records\n\t\t\trec := map[string]interface{}{}\n\t\t\terr := result.MapScan(rec)\n\t\t\tif err != nil {\n\t\t\t\tLogError(err)\n\t\t\t\tclose(chnl)\n\t\t\t}\n\n\t\t\trec = processRec(rec)\n\t\t\tchnl <- rec\n\n\t\t}\n\t\t// Ensure that at the end of the loop we close the channel!\n\t\tclose(chnl)\n\t}()\n\n\treturn chnl, nil\n}", "title": "" }, { "docid": "1914ccea4d00f93fd8d386d3d5bcdda6", "score": "0.54843485", "text": "func (q *QueryPackage) Execute() (chan QueryResponse, chan bool) {\n\tresponseChan := make(chan QueryResponse, 1)\n\tstopChan := make(chan bool)\n\n\tgo func() {\n\t\tdefer close(responseChan)\n\t\turl := url.URL{Scheme: \"wss\", Host: q.Ip + \":\" + q.Port, Path: \"/api/v1\"}\n\t\tvar dialer = &websocket.Dialer{\n\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\tHandshakeTimeout: 5 * time.Second,\n\t\t\tTLSClientConfig: q.tls,\n\t\t\tJar: q.jar,\n\t\t}\n\n\t\tconn, _, err := dialer.Dial(url.String(), nil)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Execute dial error:\", err)\n\t\t\treturn\n\t\t}\n\t\tdefer conn.Close()\n\n\t\t//TODO: set conn read/write timeout?\n\t\treadWriteTimeout := time.Duration(20)\n\t\tconn.SetReadDeadline(time.Now().Add(time.Second * readWriteTimeout))\n\t\tconn.SetWriteDeadline(time.Now().Add(time.Second * readWriteTimeout))\n\n\t\tstreaming := false\n\t\tfor _, v := range q.Queries {\n\t\t\tif v.Type == StartStream {\n\t\t\t\tstreaming = true\n\t\t\t}\n\t\t}\n\t\tpacket, err := json.Marshal(q.Queries)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error marshaling query:\", err)\n\t\t\treturn\n\t\t}\n\n\t\terr = conn.WriteMessage(websocket.BinaryMessage, packet)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error writing to socket:\", err)\n\t\t\treturn\n\t\t}\n\n\t\t_, message, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error reading from socket:\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tresponse := QueryResponse{}\n\t\terr = json.Unmarshal(message, &response.Responses)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error parsing response:\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif streaming {\n\t\tLoop:\n\t\t\tfor {\n\t\t\t\tconn.SetReadDeadline(time.Now().Add(time.Second * readWriteTimeout))\n\t\t\t\t_, message, err := conn.ReadMessage()\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"Error reading from socket:\", err)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tresponse := QueryResponse{}\n\t\t\t\terr = json.Unmarshal(message, &response.Responses)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"Error parsing response:\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tresponseChan <- response\n\n\t\t\t\tselect {\n\t\t\t\tcase <-stopChan:\n\t\t\t\t\tbreak Loop\n\t\t\t\tdefault:\n\t\t\t\t}\n\n\t\t\t}\n\t\t} else {\n\t\t\tconn.SetWriteDeadline(time.Now().Add(time.Second * readWriteTimeout))\n\t\t\terr = conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(1000, \"Query Complete\"))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error closing socket:\", err)\n\t\t\t}\n\n\t\t\tresponseChan <- response\n\t\t\treturn\n\t\t}\n\t\tconn.SetWriteDeadline(time.Now().Add(time.Second * readWriteTimeout))\n\t\terr = conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(1000, \"Query Complete\"))\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error closing socket:\", err)\n\t\t}\n\t\treturn\n\t}()\n\treturn responseChan, stopChan\n}", "title": "" }, { "docid": "09f6cfcd2e0cbdc77ee140df7c0d223c", "score": "0.5473486", "text": "func (conn *BaseConn) StreamRowsContext(ctx context.Context, sql string) (ds Datastream, err error) {\n\tstart := time.Now()\n\tif strings.TrimSpace(sql) == \"\" {\n\t\treturn ds, errors.New(\"Empty Query\")\n\t}\n\n\tqueryCtx, queryCancel := context.WithCancel(ctx)\n\tresult, err := conn.db.QueryxContext(queryCtx, sql)\n\tif err != nil {\n\t\tqueryCancel()\n\t\treturn ds, Error(err, \"SQL Error for:\\n\"+sql)\n\t}\n\n\tcolTypes, err := result.ColumnTypes()\n\tif err != nil {\n\t\tqueryCancel()\n\t\treturn ds, Error(err, \"result.ColumnTypes()\")\n\t}\n\n\tconn.Data.Result = result\n\tconn.Data.SQL = sql\n\tconn.Data.Duration = time.Since(start).Seconds()\n\tconn.Data.Rows = [][]interface{}{}\n\tconn.Data.setColumns(colTypes, conn.template.NativeTypeMap)\n\n\tds = Datastream{\n\t\tColumns: conn.Data.Columns,\n\t\tRows: make(chan []interface{}),\n\t\tcontext: Context{queryCtx, queryCancel},\n\t}\n\n\tgo func() {\n\t\tfor result.Next() {\n\t\t\t// add row\n\t\t\trow, err := result.SliceScan()\n\t\t\tif err != nil {\n\t\t\t\tLogError(err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\trow = processRow(row)\n\n\t\t\tselect {\n\t\t\tcase <-ds.context.ctx.Done():\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tds.Rows <- row\n\t\t\t}\n\n\t\t}\n\t\t// Ensure that at the end of the loop we close the channel!\n\t\tclose(ds.Rows)\n\t}()\n\n\treturn ds, nil\n\n}", "title": "" }, { "docid": "42036b60e8796327a743d87d2d37cb15", "score": "0.54559785", "text": "func (s Service) Execute(ctx context.Context, query string, params ...interface{}) (sql.Result, error) {\n\treturn s.ExecuteStatement(ctx, sql.NewStatement(query, params...))\n}", "title": "" }, { "docid": "d7bfca121291b6836192d5b1a82c5ac4", "score": "0.54226816", "text": "func (serviceStub *SCQueryServiceStub) ExecuteQuery(query *data.SCQuery) (*vmcommon.VMOutput, error) {\n\treturn serviceStub.ExecuteQueryCalled(query)\n}", "title": "" }, { "docid": "fb6509665a404b53c807dad547e1f105", "score": "0.5393089", "text": "func (conn *gRPCQueryClient) ReserveStreamExecute(ctx context.Context, target *querypb.Target, preQueries []string, sql string, bindVariables map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error) (state queryservice.ReservedState, err error) {\n\tconn.mu.RLock()\n\tdefer conn.mu.RUnlock()\n\tif conn.cc == nil {\n\t\treturn state, tabletconn.ConnClosed\n\t}\n\n\tstream, err := func() (queryservicepb.Query_ReserveStreamExecuteClient, error) {\n\t\tconn.mu.RLock()\n\t\tdefer conn.mu.RUnlock()\n\t\tif conn.cc == nil {\n\t\t\treturn nil, tabletconn.ConnClosed\n\t\t}\n\n\t\treq := &querypb.ReserveStreamExecuteRequest{\n\t\t\tTarget: target,\n\t\t\tEffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),\n\t\t\tImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),\n\t\t\tOptions: options,\n\t\t\tPreQueries: preQueries,\n\t\t\tQuery: &querypb.BoundQuery{\n\t\t\t\tSql: sql,\n\t\t\t\tBindVariables: bindVariables,\n\t\t\t},\n\t\t\tTransactionId: transactionID,\n\t\t}\n\t\tstream, err := conn.c.ReserveStreamExecute(ctx, req)\n\t\tif err != nil {\n\t\t\treturn nil, tabletconn.ErrorFromGRPC(err)\n\t\t}\n\t\treturn stream, nil\n\t}()\n\tif err != nil {\n\t\treturn state, tabletconn.ErrorFromGRPC(err)\n\t}\n\n\tvar fields []*querypb.Field\n\tfor {\n\t\tser, err := stream.Recv()\n\t\tif state.ReservedID == 0 && ser.GetReservedId() != 0 {\n\t\t\tstate.ReservedID = ser.GetReservedId()\n\t\t}\n\t\tif state.TabletAlias == nil && ser.GetTabletAlias() != nil {\n\t\t\tstate.TabletAlias = ser.GetTabletAlias()\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn state, tabletconn.ErrorFromGRPC(err)\n\t\t}\n\n\t\tif ser.Error != nil {\n\t\t\treturn state, tabletconn.ErrorFromVTRPC(ser.Error)\n\t\t}\n\n\t\t// The last stream receive will not have a result, so callback will not be called for it.\n\t\tif ser.Result == nil {\n\t\t\treturn state, nil\n\t\t}\n\n\t\tif fields == nil {\n\t\t\tfields = ser.Result.Fields\n\t\t}\n\t\tif err := callback(sqltypes.CustomProto3ToResult(fields, ser.Result)); err != nil {\n\t\t\tif err == nil || err == io.EOF {\n\t\t\t\treturn state, nil\n\t\t\t}\n\t\t\treturn state, err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "20c4df13ca8cc45d7fb1024f0f8cbdf2", "score": "0.5367841", "text": "func (c *ApiService) StreamExecution(FlowSid string, params *ListExecutionParams) (chan StudioV2Execution, chan error) {\n\tif params == nil {\n\t\tparams = &ListExecutionParams{}\n\t}\n\tparams.SetPageSize(client.ReadLimits(params.PageSize, params.Limit))\n\n\trecordChannel := make(chan StudioV2Execution, 1)\n\terrorChannel := make(chan error, 1)\n\n\tresponse, err := c.PageExecution(FlowSid, params, \"\", \"\")\n\tif err != nil {\n\t\terrorChannel <- err\n\t\tclose(recordChannel)\n\t\tclose(errorChannel)\n\t} else {\n\t\tgo c.streamExecution(response, params, recordChannel, errorChannel)\n\t}\n\n\treturn recordChannel, errorChannel\n}", "title": "" }, { "docid": "26867e782393469c0060c081d288137b", "score": "0.53670645", "text": "func (l *ResultListener) Execute(serviceID, task string) (*Stream, error) {\n\tl.taskServiceID = serviceID\n\tl.task = task\n\tstream := &Stream{\n\t\tExecutions: make(chan *Execution, 0),\n\t\tErr: make(chan error, 0),\n\t}\n\tcancel, err := l.listen(stream)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstream.cancel = cancel\n\treturn stream, nil\n}", "title": "" }, { "docid": "fe79146a1533e6172145a9280eaf9b08", "score": "0.53553677", "text": "func (p *Provider) HandleQueryStream(stream RetrievalQueryStream) {\n\tdefer stream.Close()\n\tquery, err := stream.ReadQuery()\n\tif err != nil {\n\t\treturn\n\t}\n\n\task := p.GetAsk()\n\n\tanswer := QueryResponse{\n\t\tStatus: QueryResponseUnavailable,\n\t\tPaymentAddress: p.minerAddress,\n\t\tMinPricePerByte: ask.PricePerByte,\n\t\tMaxPaymentInterval: ask.PaymentInterval,\n\t\tMaxPaymentIntervalIncrease: ask.PaymentIntervalIncrease,\n\t}\n\tsize, err := p.store.GetSize(query.PayloadCID)\n\tif err == nil && size > 0 {\n\t\tanswer.Status = QueryResponseAvailable\n\t\tanswer.Size = uint64(size)\n\t}\n\n\tif err := stream.WriteQueryResponse(answer); err != nil {\n\t\tfmt.Printf(\"Retrieval query: WriteCborRPC: %s\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "61e7b310e9f8002c9cf1d0eb49781d6a", "score": "0.5348563", "text": "func (reader *Input) Execute(writer io.Writer) error {\n\tmyRow := make(chan *Row)\n\tcurBuf := bytes.NewBuffer(make([]byte, 1000000))\n\tcurBuf.Reset()\n\tprogressTicker := time.NewTicker(progressTime)\n\tcontinuationTimer := time.NewTimer(continuationTime)\n\tdefer progressTicker.Stop()\n\tdefer continuationTimer.Stop()\n\tgo reader.runSelectParser(convertMySQL(reader.options.Expression), myRow)\n\tfor {\n\t\tselect {\n\t\tcase row, ok := <-myRow:\n\t\t\tif ok && row.err != nil {\n\t\t\t\terrorMessage := reader.writeErrorMessage(row.err, curBuf)\n\t\t\t\t_, err := errorMessage.WriteTo(writer)\n\t\t\t\tflusher, okFlush := writer.(http.Flusher)\n\t\t\t\tif okFlush {\n\t\t\t\t\tflusher.Flush()\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcurBuf.Reset()\n\t\t\t\tclose(myRow)\n\t\t\t\treturn nil\n\t\t\t} else if ok {\n\t\t\t\tmessage := reader.writeRecordMessage(row.record, curBuf)\n\t\t\t\t_, err := message.WriteTo(writer)\n\t\t\t\tflusher, okFlush := writer.(http.Flusher)\n\t\t\t\tif okFlush {\n\t\t\t\t\tflusher.Flush()\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcurBuf.Reset()\n\t\t\t\treader.stats.BytesReturned += int64(len(row.record))\n\t\t\t\tif !continuationTimer.Stop() {\n\t\t\t\t\t<-continuationTimer.C\n\t\t\t\t}\n\t\t\t\tcontinuationTimer.Reset(continuationTime)\n\t\t\t} else if !ok {\n\t\t\t\tstatPayload, err := reader.createStatXML()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tstatMessage := reader.writeStatMessage(statPayload, curBuf)\n\t\t\t\t_, err = statMessage.WriteTo(writer)\n\t\t\t\tflusher, ok := writer.(http.Flusher)\n\t\t\t\tif ok {\n\t\t\t\t\tflusher.Flush()\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcurBuf.Reset()\n\t\t\t\tmessage := reader.writeEndMessage(curBuf)\n\t\t\t\t_, err = message.WriteTo(writer)\n\t\t\t\tflusher, ok = writer.(http.Flusher)\n\t\t\t\tif ok {\n\t\t\t\t\tflusher.Flush()\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\tcase <-progressTicker.C:\n\t\t\t// Send progress messages only if requested by client.\n\t\t\tif reader.options.Progress {\n\t\t\t\tprogressPayload, err := reader.createProgressXML()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tprogressMessage := reader.writeProgressMessage(progressPayload, curBuf)\n\t\t\t\t_, err = progressMessage.WriteTo(writer)\n\t\t\t\tflusher, ok := writer.(http.Flusher)\n\t\t\t\tif ok {\n\t\t\t\t\tflusher.Flush()\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcurBuf.Reset()\n\t\t\t}\n\t\tcase <-continuationTimer.C:\n\t\t\tmessage := reader.writeContinuationMessage(curBuf)\n\t\t\t_, err := message.WriteTo(writer)\n\t\t\tflusher, ok := writer.(http.Flusher)\n\t\t\tif ok {\n\t\t\t\tflusher.Flush()\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcurBuf.Reset()\n\t\t\tcontinuationTimer.Reset(continuationTime)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1c9a3dd376adc047098b6a084dd58e74", "score": "0.5340303", "text": "func (q *FQPU) Query(streamOut pbQPU.QPU_QueryServer, requestRec *pbQPU.RequestStream) error {\n\trequest := requestRec.GetRequest()\n\tlog.WithFields(log.Fields{\"request\": request}).Debug(\"query request received\")\n\tmaxResponseCount, err := utils.MaxResponseCount(request.GetMetadata())\n\tif err != nil {\n\t\treturn nil\n\t}\n\tstreamIn, cancel, err := q.qpu.Conns[0].Client.Query(request.GetPredicate(), request.GetClock(), nil, request.GetSync())\n\tseqID := int64(0)\n\tfor {\n\t\tstreamRec, err := streamIn.Recv()\n\t\tif err == io.EOF {\n\t\t\treturn streamOut.Send(\n\t\t\t\tprotoutils.ResponseStreamRecord(\n\t\t\t\t\tseqID,\n\t\t\t\t\tpbQPU.ResponseStreamRecord_END_OF_STREAM,\n\t\t\t\t\t&pbUtils.LogOperation{},\n\t\t\t\t),\n\t\t\t)\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = filterAndForward(request.GetPredicate(), streamRec, streamOut, &seqID); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif maxResponseCount > 0 && seqID >= maxResponseCount {\n\t\t\tcancel()\n\t\t\treturn streamOut.Send(\n\t\t\t\tprotoutils.ResponseStreamRecord(\n\t\t\t\t\tseqID,\n\t\t\t\t\tpbQPU.ResponseStreamRecord_END_OF_STREAM,\n\t\t\t\t\t&pbUtils.LogOperation{},\n\t\t\t\t))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d94f5b3a4e3abf105c12e0a103e8498e", "score": "0.53396887", "text": "func (serviceStub *SCQueryServiceStub) ExecuteQuery(query *data.SCQuery) (*vm.VMOutputApi, error) {\n\treturn serviceStub.ExecuteQueryCalled(query)\n}", "title": "" }, { "docid": "92dc900b8ed49e1cd8ce0fe63a51da47", "score": "0.53184724", "text": "func (qp *QueryPlanWithoutServerAggregation) Execute(session *gocql.Session, debug int) ([]CQLResult, error) {\n\t// for each query, execute it, then put each result row into the\n\t// client-side aggregator that matches its time bucket:\n\tfor _, q := range qp.CQLQueries {\n\t\tcq := session.Query(q.PreparableQueryString, q.Args...)\n\t\tif debug == 1 {\n\t\t\tfmt.Printf(\"[qp] Query: %s\\n\", cq)\n\t\t}\n\t\titer := cq.Iter()\n\n\t\tvar timestamp_ns int64\n\t\tvar value float64\n\n\t\tfor iter.Scan(&timestamp_ns, &value) {\n\t\t\tts := time.Unix(0, timestamp_ns).UTC()\n\t\t\ttsTruncated := ts.Truncate(qp.GroupByDuration)\n\t\t\tbucketKey := TimeInterval{\n\t\t\t\tStart: tsTruncated,\n\t\t\t\tEnd: tsTruncated.Add(qp.GroupByDuration),\n\t\t\t}\n\n\t\t\tqp.Aggregators[bucketKey].Put(value)\n\t\t}\n\t\tif err := iter.Close(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// perform client-side aggregation across all buckets:\n\tresults := make([]CQLResult, 0, len(qp.TimeBuckets))\n\tfor _, ti := range qp.TimeBuckets {\n\t\tacc := qp.Aggregators[ti].Get()\n\t\tresults = append(results, CQLResult{TimeInterval: ti, Value: acc})\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "f93fbdbcf5f1d44f61ce20abbf226af0", "score": "0.531259", "text": "func (e *sqlQueryEndpoint) Query(ctx context.Context, dsInfo *models.DataSource, tsdbQuery *pkg.TsdbQuery) (*pkg.Response, error) {\n\tresult := &pkg.Response{\n\t\tResults: make(map[string]*pkg.QueryResult),\n\t}\n\n\tvar wg sync.WaitGroup\n\n\tfor _, query := range tsdbQuery.Queries {\n\t\trawSQL := query.Model.Get(\"rawSql\").MustString()\n\t\tif rawSQL == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tqueryResult := &pkg.QueryResult{Meta: simplejson.New(), RefId: query.RefId}\n\t\tresult.Results[query.RefId] = queryResult\n\n\t\tqueryResult.Meta.Set(\"sql\", rawSQL)\n\n\t\twg.Add(1)\n\n\t\tgo func(rawSQL string, query *pkg.Query, queryResult *pkg.QueryResult) {\n\t\t\tdefer wg.Done()\n\t\t\tsession := e.engine.NewSession()\n\t\t\tdefer session.Close()\n\t\t\tdb := session.DB()\n\n\t\t\tvar rows *core.Rows\n\t\t\tvar err error\n\t\t\tparams := query.Params\n\t\t\tif len(params) > 0 {\n\t\t\t\trows, err = db.QueryMap(rawSQL, &params)\n\t\t\t} else {\n\t\t\t\trows, err = db.Query(rawSQL)\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\tqueryResult.Error = e.queryResultTransformer.TransformQueryError(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdefer rows.Close()\n\n\t\t\terr = e.transformToTable(query, rows, queryResult, tsdbQuery)\n\t\t\tif err != nil {\n\t\t\t\tqueryResult.Error = err\n\t\t\t\treturn\n\t\t\t}\n\t\t}(rawSQL, query, queryResult)\n\t}\n\twg.Wait()\n\n\treturn result, nil\n}", "title": "" }, { "docid": "10f9506a34337a33e0f12ab348b7001d", "score": "0.5292084", "text": "func (c Client) Execute(q storage.Query) (storage.Fetcher, error) {\n\tp, err := c.Prepare(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn p.Run()\n}", "title": "" }, { "docid": "a444af90cefa23affea511d9c65a6039", "score": "0.52911955", "text": "func (executor *ParallelExecutor) Execute(ctx *ExecutionContext) (map[string]interface{}, error) {\n\t// a place to store the result\n\tresult := map[string]interface{}{}\n\n\t// a channel to receive query results\n\tconst maxResultBuffer = 10\n\tresultCh := make(chan *queryExecutionResult, maxResultBuffer)\n\tdefer close(resultCh)\n\n\t// a wait group so we know when we're done with all of the steps\n\tstepWg := &sync.WaitGroup{}\n\n\t// and a channel for errors\n\terrMutex := &sync.Mutex{}\n\terrCh := make(chan error, maxResultBuffer)\n\tdefer close(errCh)\n\n\t// a channel to close the goroutine\n\tcloseCh := make(chan bool)\n\tdefer close(closeCh)\n\n\t// a lock for reading and writing to the result\n\tresultLock := &sync.Mutex{}\n\n\t// if there are no steps after the root step, there is a problem\n\tif len(ctx.Plan.RootStep.Then) == 0 {\n\t\treturn nil, errors.New(\"was given empty plan\")\n\t}\n\n\t// the root step could have multiple steps that have to happen\n\tfor _, step := range ctx.Plan.RootStep.Then {\n\t\tstepWg.Add(1)\n\t\tgo executeStep(ctx, ctx.Plan, step, []string{}, resultLock, ctx.Variables, resultCh, errCh, stepWg)\n\t}\n\n\t// the list of errors we have encountered while executing the plan\n\terrs := graphql.ErrorList{}\n\n\t// start a goroutine to add results to the list\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\t// we have a new result\n\t\t\tcase payload := <-resultCh:\n\t\t\t\tif payload == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tctx.logger.Debug(\"Inserting result into \", payload.InsertionPoint)\n\t\t\t\tctx.logger.Debug(\"Result: \", payload.Result)\n\n\t\t\t\t// we have to grab the value in the result and write it to the appropriate spot in the\n\t\t\t\t// acumulator.\n\t\t\t\terr := executorInsertObject(ctx, result, resultLock, payload.InsertionPoint, payload.Result)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrCh <- err\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tctx.logger.Debug(\"Done. \", result)\n\t\t\t\t// one of the queries is done\n\t\t\t\tstepWg.Done()\n\n\t\t\tcase err := <-errCh:\n\t\t\t\tif err != nil {\n\t\t\t\t\terrMutex.Lock()\n\t\t\t\t\t// if the error was a list\n\t\t\t\t\tvar errList graphql.ErrorList\n\t\t\t\t\tif errors.As(err, &errList) {\n\t\t\t\t\t\terrs = append(errs, errList...)\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrs = append(errs, err)\n\t\t\t\t\t}\n\t\t\t\t\terrMutex.Unlock()\n\t\t\t\t\tstepWg.Done()\n\t\t\t\t}\n\t\t\t// we're done\n\t\t\tcase <-closeCh:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// when the wait group is finished\n\tstepWg.Wait()\n\n\t// if we encountered any errors\n\terrMutex.Lock()\n\tnErrs := len(errs)\n\tdefer errMutex.Unlock()\n\n\tif nErrs > 0 {\n\t\treturn result, errs\n\t}\n\n\t// we didn't encounter any errors\n\treturn result, nil\n}", "title": "" }, { "docid": "e3c73ea048c5bbc4ed50955a76751130", "score": "0.5287313", "text": "func (q *Query) ExecuteWithChannel(resChan chan ResponseData) {\n\tif q.JobConfig != nil {\n\t\tgo q.retrieveRowsWithJobConfig(resChan)\n\t} else {\n\t\tgo q.retrieveRows(resChan)\n\t}\n}", "title": "" }, { "docid": "98f234e74b0da8db4be86a4fa18d0095", "score": "0.5271626", "text": "func ExecuteQuery(query string) *graphql.Result {\n\n\trootQuery := NewRoot()\n\tvar schema, _ = graphql.NewSchema(\n\t\tgraphql.SchemaConfig{Query: rootQuery.Query},\n\t)\n\tresult := graphql.Do(graphql.Params{\n\t\tSchema: schema,\n\t\tRequestString: query,\n\t})\n\n\t// Error check\n\tif len(result.Errors) > 0 {\n\t\tfmt.Printf(\"Unexpected errors inside ExecuteQuery: %v\", result.Errors)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "54fcce325081aad280fee1b4a2a4b5a5", "score": "0.52701366", "text": "func (stmt *Stmt) Execute() (Result, error) {\n\tres := &stmtResult{}\n\tres.s = stmt.s\n\n\tif err := stmt.execute(res, C.MY_MODE_NONE); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "84c910b8ce2f20718f9a9b73ea6e644d", "score": "0.5253858", "text": "func (s Service) ExecuteStatement(ctx context.Context, stmt sql.Statement) (sql.Result, error) {\n\tvar err error\n\tif ctx, err = updateContextWithOptions(ctx, stmt); err != nil {\n\t\treturn &Result{}, nil\n\t}\n\tstmtParams := stmt.Parameters()\n\tparams := *(*[]driver.Value)(unsafe.Pointer(&stmtParams))\n\tresp, err := s.service.Execute(ctx, stmt.SQL(), params, stmt.ExpectedResultType())\n\tif err != nil {\n\t\treturn &Result{}, err\n\t}\n\tvar result Result\n\tswitch r := resp.(type) {\n\tcase *idriver.QueryResult:\n\t\tresult.qr = r\n\tcase *idriver.ExecResult:\n\t\tresult.er = r\n\tdefault:\n\t\treturn &Result{}, fmt.Errorf(\"unknown result type\")\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "32f1f58ed89388cbdfbf85c907dacb5f", "score": "0.5250022", "text": "func (db *DB) Execute(req *command.Request, xTime bool) ([]*command.ExecuteResult, error) {\n\tstats.Add(numExecutions, int64(len(req.Statements)))\n\tconn, err := db.rwDB.Conn(context.Background())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer conn.Close()\n\treturn db.executeWithConn(req, xTime, conn)\n}", "title": "" }, { "docid": "cbd70591ac740002aecf9f361eb75c1b", "score": "0.5242938", "text": "func (client *FakeTabletManagerClient) ExecuteQuery(ctx context.Context, tablet *topodatapb.Tablet, req *tabletmanagerdatapb.ExecuteQueryRequest) (*querypb.QueryResult, error) {\n\treturn &querypb.QueryResult{}, nil\n}", "title": "" }, { "docid": "8815633bf4659a8dd8fd4f2f5ace62a5", "score": "0.524284", "text": "func ExecuteQuery(w *Workspace, q Query, dryRun bool, verbose int) error {\n\tmatches := q.search(w)\n\tif len(matches) == 0 {\n\t\treturn errors.New(\"no task matched: \" + q.Raw)\n\t}\n\tfor _, match := range matches {\n\t\te := Execution{\n\t\t\tWorkspace: w,\n\t\t\tQuery: &q,\n\t\t\tProject: &match.Project,\n\t\t\tTask: &match.Task,\n\t\t\tDryRun: dryRun,\n\t\t\tVerbose: verbose,\n\t\t}\n\t\terr := e.Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1a7d8733030c474a9f104b77a02db9f8", "score": "0.5236457", "text": "func (vc *vcursorImpl) ExecuteStandalone(ctx context.Context, primitive engine.Primitive, query string, bindVars map[string]*querypb.BindVariable, rs *srvtopo.ResolvedShard) (*sqltypes.Result, error) {\n\trss := []*srvtopo.ResolvedShard{rs}\n\tbqs := []*querypb.BoundQuery{\n\t\t{\n\t\t\tSql: vc.marginComments.Leading + query + vc.marginComments.Trailing,\n\t\t\tBindVariables: bindVars,\n\t\t},\n\t}\n\t// The autocommit flag is always set to false because we currently don't\n\t// execute DMLs through ExecuteStandalone.\n\tqr, errs := vc.executor.ExecuteMultiShard(ctx, primitive, rss, bqs, NewAutocommitSession(vc.safeSession.Session), false /* autocommit */, vc.ignoreMaxMemoryRows)\n\treturn qr, vterrors.Aggregate(errs)\n}", "title": "" }, { "docid": "b6f98401bc7b2ee38c0ee430ee9a31b8", "score": "0.5220691", "text": "func (p *Plugin) Stream(in driver.StreamInput) driver.StreamOutput {\n\tresp, err := p.do(in)\n\tif err != nil {\n\t\treturn driver.StreamOutput{\n\t\t\tError: &driver.Error{\n\t\t\t\tMessage: err.Error(),\n\t\t\t},\n\t\t}\n\t}\n\treturn resp.(driver.StreamOutput)\n}", "title": "" }, { "docid": "f74315f9b395f7cff69c5bd528d52edf", "score": "0.5203755", "text": "func (e *ShowQueryExecutor) Query() ([]*sql.Rows, error) {\n\tquery, ok := e.query.(*sqlparser.QueryBase)\n\tif !ok {\n\t\treturn nil, errors.New(\"cannot convert to sqlparser.Query to *sqlparser.QueryBase\")\n\t}\n\n\tfor _, shardConn := range e.conn.ShardConnections.AllShard() {\n\t\trows, err := e.execQuery(shardConn, query.Text, query.Args...)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\t\treturn []*sql.Rows{rows}, nil\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "69fc9134fd125cb2600f7d964e5e99d0", "score": "0.52034694", "text": "func (gql *GraphQLQuery) Execute(respData interface{}, opts ...GraphQLOption) error {\n\tvar body bytes.Buffer\n\n\trequestObj := GraphQLRequest{\n\t\tQuery: gql.query,\n\t\tVariables: &gql.vars,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(gql)\n\t}\n\n\tif err := json.NewEncoder(&body).Encode(requestObj); err != nil {\n\t\treturn errors.Wrap(err, \"encode body\")\n\t}\n\tctx := context.TODO()\n\tresp, err := gql.client.getResponse(ctx, \"POST\", gql.endpoint, nil, &body, gql.headers)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn gql.processResponse(resp, respData)\n}", "title": "" }, { "docid": "08eb7caebe2a969821fbada3e78491c0", "score": "0.5197238", "text": "func (q *Query) Run() (interface{}, error) {\n\tif q.err != nil {\n\t\treturn nil, q.err\n\t}\n\tq.trans = newTransaction()\n\tif err := q.sendIdData(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// create a slice in which to store results using reflection the\n\t// type of the slice whill match the type of the model being queried\n\tresultsVal := reflect.New(reflect.SliceOf(q.modelSpec.modelType))\n\tresultsVal.Elem().Set(reflect.MakeSlice(reflect.SliceOf(q.modelSpec.modelType), 0, 0))\n\n\tif err := q.executeAndScan(resultsVal); err != nil {\n\t\treturn resultsVal.Elem().Interface(), err\n\t} else {\n\t\treturn resultsVal.Elem().Interface(), nil\n\t}\n}", "title": "" }, { "docid": "761b890af9328a61a38c23d6907e34ed", "score": "0.51686496", "text": "func (vtg *VTGate) StreamExecuteKeyspaceIds(ctx context.Context, request *gorpcvtgatecommon.KeyspaceIdQuery, sendReply func(interface{}) error) (err error) {\n\tdefer vtg.server.HandlePanic(&err)\n\tctx = callerid.NewContext(ctx,\n\t\tgorpccallerid.GoRPCEffectiveCallerID(request.CallerID),\n\t\tcallerid.NewImmediateCallerID(\"gorpc client\"))\n\treturn vtg.server.StreamExecuteKeyspaceIds(ctx,\n\t\trequest.Sql,\n\t\trequest.BindVariables,\n\t\trequest.Keyspace,\n\t\trequest.KeyspaceIds,\n\t\trequest.TabletType,\n\t\tfunc(value *sqltypes.Result) error {\n\t\t\treturn sendReply(&gorpcvtgatecommon.QueryResult{\n\t\t\t\tResult: value,\n\t\t\t})\n\t\t})\n}", "title": "" }, { "docid": "3bfffdc185cfcf6672d5f08a4c9a11a2", "score": "0.51669765", "text": "func (e *MysqlQueryEndpoint) Query(ctx context.Context, dsInfo *models.DataSource, tsdbQuery *tsdb.TsdbQuery) (*tsdb.Response, error) {\n\treturn e.sqlEngine.Query(ctx, dsInfo, tsdbQuery, e.transformToTimeSeries, e.transformToTable)\n}", "title": "" }, { "docid": "056596cd668ac5127c1750d1c56e1704", "score": "0.5166509", "text": "func (vtg *VTGate) StreamExecuteShard2(ctx context.Context, request *gorpcvtgatecommon.QueryShard, sendReply func(interface{}) error) (err error) {\n\tdefer vtg.server.HandlePanic(&err)\n\tctx = callerid.NewContext(ctx,\n\t\tgorpccallerid.GoRPCEffectiveCallerID(request.CallerID),\n\t\tcallerid.NewImmediateCallerID(\"gorpc client\"))\n\tvtgErr := vtg.server.StreamExecuteShards(ctx,\n\t\trequest.Sql,\n\t\trequest.BindVariables,\n\t\trequest.Keyspace,\n\t\trequest.Shards,\n\t\trequest.TabletType,\n\t\tfunc(value *sqltypes.Result) error {\n\t\t\treturn sendReply(&gorpcvtgatecommon.QueryResult{\n\t\t\t\tResult: value,\n\t\t\t})\n\t\t})\n\tif vtgErr == nil {\n\t\treturn nil\n\t}\n\n\t// If there was an app error, send a QueryResult back with it.\n\treturn sendReply(&gorpcvtgatecommon.QueryResult{\n\t\tErr: vterrors.RPCErrFromVtError(vtgErr),\n\t})\n}", "title": "" }, { "docid": "91815782fdce39ae3328d279b3487455", "score": "0.51657087", "text": "func (conn *gRPCQueryClient) ReserveBeginStreamExecute(ctx context.Context, target *querypb.Target, preQueries []string, postBeginQueries []string, sql string, bindVariables map[string]*querypb.BindVariable, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error) (state queryservice.ReservedTransactionState, err error) {\n\tconn.mu.RLock()\n\tdefer conn.mu.RUnlock()\n\tif conn.cc == nil {\n\t\treturn state, tabletconn.ConnClosed\n\t}\n\n\tstream, err := func() (queryservicepb.Query_ReserveBeginStreamExecuteClient, error) {\n\t\tconn.mu.RLock()\n\t\tdefer conn.mu.RUnlock()\n\t\tif conn.cc == nil {\n\t\t\treturn nil, tabletconn.ConnClosed\n\t\t}\n\n\t\treq := &querypb.ReserveBeginStreamExecuteRequest{\n\t\t\tTarget: target,\n\t\t\tEffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),\n\t\t\tImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),\n\t\t\tOptions: options,\n\t\t\tPreQueries: preQueries,\n\t\t\tPostBeginQueries: postBeginQueries,\n\t\t\tQuery: &querypb.BoundQuery{\n\t\t\t\tSql: sql,\n\t\t\t\tBindVariables: bindVariables,\n\t\t\t},\n\t\t}\n\t\tstream, err := conn.c.ReserveBeginStreamExecute(ctx, req)\n\t\tif err != nil {\n\t\t\treturn nil, tabletconn.ErrorFromGRPC(err)\n\t\t}\n\t\treturn stream, nil\n\t}()\n\tif err != nil {\n\t\treturn state, tabletconn.ErrorFromGRPC(err)\n\t}\n\n\tvar fields []*querypb.Field\n\tfor {\n\t\tser, err := stream.Recv()\n\t\tif state.TransactionID == 0 && ser.GetTransactionId() != 0 {\n\t\t\tstate.TransactionID = ser.GetTransactionId()\n\t\t}\n\t\tif state.ReservedID == 0 && ser.GetReservedId() != 0 {\n\t\t\tstate.ReservedID = ser.GetReservedId()\n\t\t}\n\t\tif state.TabletAlias == nil && ser.GetTabletAlias() != nil {\n\t\t\tstate.TabletAlias = ser.GetTabletAlias()\n\t\t}\n\t\tif state.SessionStateChanges == \"\" && ser.GetSessionStateChanges() != \"\" {\n\t\t\tstate.SessionStateChanges = ser.GetSessionStateChanges()\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn state, tabletconn.ErrorFromGRPC(err)\n\t\t}\n\n\t\tif ser.Error != nil {\n\t\t\treturn state, tabletconn.ErrorFromVTRPC(ser.Error)\n\t\t}\n\n\t\t// The last stream receive will not have a result, so callback will not be called for it.\n\t\tif ser.Result == nil {\n\t\t\treturn state, nil\n\t\t}\n\n\t\tif fields == nil {\n\t\t\tfields = ser.Result.Fields\n\t\t}\n\t\tif err := callback(sqltypes.CustomProto3ToResult(fields, ser.Result)); err != nil {\n\t\t\tif err == nil || err == io.EOF {\n\t\t\t\treturn state, nil\n\t\t\t}\n\t\t\treturn state, err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1ea12125f8444301df7d83ff7d8de93f", "score": "0.5140927", "text": "func (r *showAllPostsInteractor) Execute(ctx context.Context, req InportRequest) (*InportResponse, error) {\n\n\tres := &InportResponse{}\n\n\terr := repository.ReadOnly(ctx, r.outport, func(ctx context.Context) error {\n\n\t\tpostObj, err := r.outport.FetchPosts(ctx, &req.PaginateRequest)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, v := range postObj {\n\t\t\tvar vCategories []CategoryResponse\n\t\t\tfor _, w := range v.Categories {\n\t\t\t\tvCategories = append(vCategories, CategoryResponse{\n\t\t\t\t\tID: w.ID,\n\t\t\t\t\tCategory: w.Category,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tvar vTags []TagResponse\n\t\t\tfor _, w := range v.Tags {\n\t\t\t\tvTags = append(vTags, TagResponse{\n\t\t\t\t\tID: w.ID,\n\t\t\t\t\tTag: w.Tag,\n\t\t\t\t})\n\t\t\t}\n\t\t\tres.Posts = append(res.Posts, PostResponse{\n\t\t\t\tID: v.ID,\n\t\t\t\tTitle: v.Title,\n\t\t\t\tDescription: v.Description,\n\t\t\t\tCover: v.Cover,\n\t\t\t\tSlug: v.Slug,\n\t\t\t\tViewCount: v.ViewCount,\n\t\t\t\tCategories: vCategories,\n\t\t\t\tTags: vTags,\n\t\t\t\tUserID: v.UserID,\n\t\t\t\tAuthorName: v.User.Name,\n\t\t\t\tCreatedAt: v.CreatedAt,\n\t\t\t\tUpdatedAt: v.UpdatedAt,\n\t\t\t})\n\t\t}\n\t\tres.PaginateRequest = req.PaginateRequest\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "f6b8c2dc51fb52fd6d2e68c92f408679", "score": "0.5125054", "text": "func (conn *gRPCQueryClient) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, transactionID, reservedID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {\n\tconn.mu.RLock()\n\tdefer conn.mu.RUnlock()\n\tif conn.cc == nil {\n\t\treturn nil, tabletconn.ConnClosed\n\t}\n\n\treq := &querypb.ExecuteRequest{\n\t\tEffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),\n\t\tImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),\n\t\tTarget: target,\n\t\tQuery: &querypb.BoundQuery{\n\t\t\tSql: query,\n\t\t\tBindVariables: bindVars,\n\t\t},\n\t\tTransactionId: transactionID,\n\t\tOptions: options,\n\t\tReservedId: reservedID,\n\t}\n\ter, err := conn.c.Execute(ctx, req)\n\tif err != nil {\n\t\treturn nil, tabletconn.ErrorFromGRPC(err)\n\t}\n\treturn sqltypes.Proto3ToResult(er.Result), nil\n}", "title": "" }, { "docid": "eda377bee85669081f8be2f23d25df96", "score": "0.51081884", "text": "func (conn *BaseConn) InsertStream(tableFName string, ds Datastream) (count uint64, err error) {\n\n\tinsertTemplate := conn.GenerateInsertStatement(tableFName, ds.GetFields())\n\n\ttx := conn.db.MustBegin()\n\tfor row := range ds.Rows {\n\t\tcount++\n\t\t// Do insert\n\t\t_, err := tx.Exec(insertTemplate, row...)\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn count, Error(\n\t\t\t\terr,\n\t\t\t\tF(\"Insert: %s\\nFor Row: %#v\", insertTemplate, row),\n\t\t\t)\n\t\t}\n\t}\n\ttx.Commit()\n\n\treturn count, nil\n}", "title": "" }, { "docid": "c73f64936af3dbbe45cca89221e913ec", "score": "0.51009214", "text": "func (q *Query) Exec() *Result {\n\treturn exec(q, false)\n}", "title": "" }, { "docid": "e7c56eba49b7bd503efff4570b39958d", "score": "0.50927395", "text": "func (conn *BaseConn) Query(sql string) (Dataset, error) {\n\n\tds, err := conn.StreamRows(sql)\n\tif err != nil {\n\t\treturn Dataset{SQL:sql}, err\n\t}\n\n\tdata := ds.Collect()\n\tdata.SQL = sql\n\tdata.Duration = conn.Data.Duration // Collect does not time duration\n\n\treturn data, nil\n}", "title": "" }, { "docid": "81246b4f56d442d43ddb991dd9ac77da", "score": "0.5092084", "text": "func (vtg *VTGate) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {\n\tstartTime := time.Now()\n\tstatsKey := []string{\"StreamExecuteKeyspaceIds\", keyspace, strings.ToLower(tabletType.String())}\n\tdefer vtg.timings.Record(statsKey, startTime)\n\n\tx := vtg.inFlight.Add(1)\n\tdefer vtg.inFlight.Add(-1)\n\tif 0 < vtg.maxInFlight && vtg.maxInFlight < x {\n\t\treturn errTooManyInFlight\n\t}\n\n\tvar rowCount int64\n\terr := vtg.resolver.StreamExecuteKeyspaceIds(\n\t\tctx,\n\t\tsql,\n\t\tbindVariables,\n\t\tkeyspace,\n\t\tkeyspaceIds,\n\t\ttabletType,\n\t\tfunc(reply *sqltypes.Result) error {\n\t\t\trowCount += int64(len(reply.Rows))\n\t\t\tvtg.rowsReturned.Add(statsKey, int64(len(reply.Rows)))\n\t\t\treturn sendReply(reply)\n\t\t})\n\n\tif err != nil {\n\t\tnormalErrors.Add(statsKey, 1)\n\t\tquery := map[string]interface{}{\n\t\t\t\"Sql\": sql,\n\t\t\t\"BindVariables\": bindVariables,\n\t\t\t\"Keyspace\": keyspace,\n\t\t\t\"KeyspaceIds\": keyspaceIds,\n\t\t\t\"TabletType\": strings.ToLower(tabletType.String()),\n\t\t}\n\t\tlogError(err, query, vtg.logStreamExecuteKeyspaceIds)\n\t}\n\treturn formatError(err)\n}", "title": "" }, { "docid": "7fd29f3260be480401346803b42d5f66", "score": "0.5079601", "text": "func (s *serfQueries) stream() {\n\tfor {\n\t\tselect {\n\t\tcase e := <-s.inCh:\n\t\t\t// Check if this is a query we should process\n\t\t\tif q, ok := e.(*Query); ok && strings.HasPrefix(q.Name, InternalQueryPrefix) {\n\t\t\t\tgo s.handleQuery(q)\n\n\t\t\t} else if s.outCh != nil {\n\t\t\t\ts.outCh <- e\n\t\t\t}\n\n\t\tcase <-s.shutdownCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c4f54692b52fb91f37cb329fd84c0ec", "score": "0.5077978", "text": "func (c Pp) Execute(s types.Session) error {\n\tfmt.Println(s.RootQuery().Path())\n\treturn nil\n}", "title": "" }, { "docid": "0d292af56215d572ba1025d2e66d0eb9", "score": "0.5062159", "text": "func (c *Conn) ReadQueryResult(maxrows int, wantfields bool) (result *sqltypes.Result, more bool, warnings uint16, err error) {\n\t// Get the result.\n\taffectedRows, lastInsertID, colNumber, more, warnings, err := c.readComQueryResponse()\n\tif err != nil {\n\t\treturn nil, false, 0, err\n\t}\n\n\tif colNumber == 0 {\n\t\t// OK packet, means no results. Just use the numbers.\n\t\treturn &sqltypes.Result{\n\t\t\tRowsAffected: affectedRows,\n\t\t\tInsertID: lastInsertID,\n\t\t}, more, warnings, nil\n\t}\n\n\tfields := make([]querypb.Field, colNumber)\n\tresult = &sqltypes.Result{\n\t\tFields: make([]*querypb.Field, colNumber),\n\t}\n\n\t// Read column headers. One packet per column.\n\t// Build the fields.\n\tfor i := 0; i < colNumber; i++ {\n\t\tresult.Fields[i] = &fields[i]\n\n\t\tif wantfields {\n\t\t\tif err := c.readColumnDefinition(result.Fields[i], i); err != nil {\n\t\t\t\treturn nil, false, 0, err\n\t\t\t}\n\t\t} else {\n\t\t\tif err := c.readColumnDefinitionType(result.Fields[i], i); err != nil {\n\t\t\t\treturn nil, false, 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif c.Capabilities&CapabilityClientDeprecateEOF == 0 {\n\t\t// EOF is only present here if it's not deprecated.\n\t\tdata, err := c.readEphemeralPacket()\n\t\tif err != nil {\n\t\t\treturn nil, false, 0, NewSQLError(CRServerLost, SSUnknownSQLState, \"%v\", err)\n\t\t}\n\t\tif isEOFPacket(data) {\n\n\t\t\t// This is what we expect.\n\t\t\t// Warnings and status flags are ignored.\n\t\t\tc.recycleReadPacket()\n\t\t\t// goto: read row loop\n\n\t\t} else if isErrorPacket(data) {\n\t\t\tdefer c.recycleReadPacket()\n\t\t\treturn nil, false, 0, ParseErrorPacket(data)\n\t\t} else {\n\t\t\tdefer c.recycleReadPacket()\n\t\t\treturn nil, false, 0, fmt.Errorf(\"unexpected packet after fields: %v\", data)\n\t\t}\n\t}\n\n\t// read each row until EOF or OK packet.\n\tfor {\n\t\tdata, err := c.ReadPacket()\n\t\tif err != nil {\n\t\t\treturn nil, false, 0, err\n\t\t}\n\n\t\tif isEOFPacket(data) {\n\t\t\t// Strip the partial Fields before returning.\n\t\t\tif !wantfields {\n\t\t\t\tresult.Fields = nil\n\t\t\t}\n\t\t\tresult.RowsAffected = uint64(len(result.Rows))\n\n\t\t\t// The deprecated EOF packets change means that this is either an\n\t\t\t// EOF packet or an OK packet with the EOF type code.\n\t\t\tif c.Capabilities&CapabilityClientDeprecateEOF == 0 {\n\t\t\t\twarnings, more, err = parseEOFPacket(data)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, false, 0, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar statusFlags uint16\n\t\t\t\t_, _, statusFlags, warnings, err = parseOKPacket(data)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, false, 0, err\n\t\t\t\t}\n\t\t\t\tmore = (statusFlags & ServerMoreResultsExists) != 0\n\t\t\t}\n\t\t\treturn result, more, warnings, nil\n\n\t\t} else if isErrorPacket(data) {\n\t\t\t// Error packet.\n\t\t\treturn nil, false, 0, ParseErrorPacket(data)\n\t\t}\n\n\t\t// Check we're not over the limit before we add more.\n\t\tif len(result.Rows) == maxrows {\n\t\t\tif err := c.drainResults(); err != nil {\n\t\t\t\treturn nil, false, 0, err\n\t\t\t}\n\t\t\treturn nil, false, 0, NewSQLError(ERVitessMaxRowsExceeded, SSUnknownSQLState, \"Row count exceeded %d\", maxrows)\n\t\t}\n\n\t\t// Regular row.\n\t\trow, err := c.parseRow(data, result.Fields)\n\t\tif err != nil {\n\t\t\treturn nil, false, 0, err\n\t\t}\n\t\tresult.Rows = append(result.Rows, row)\n\t}\n}", "title": "" }, { "docid": "297f772fc7e4334f21e8b89a8b682861", "score": "0.50546074", "text": "func (db *DB) Execute(req *command.Request, xTime bool) ([]*command.ExecuteResult, error) {\n\tstats.Add(numExecutions, int64(len(req.Statements)))\n\n\tconn, err := db.rwDB.Conn(context.Background())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer conn.Close()\n\n\ttype Execer interface {\n\t\tExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)\n\t}\n\n\tvar execer Execer\n\tvar tx *sql.Tx\n\tif req.Transaction {\n\t\tstats.Add(numETx, 1)\n\t\ttx, err = conn.BeginTx(context.Background(), nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer func() {\n\t\t\tif tx != nil {\n\t\t\t\ttx.Rollback() // Will be ignored if tx is committed\n\t\t\t}\n\t\t}()\n\t\texecer = tx\n\t} else {\n\t\texecer = conn\n\t}\n\n\tvar allResults []*command.ExecuteResult\n\n\t// handleError sets the error field on the given result. It returns\n\t// whether the caller should continue processing or break.\n\thandleError := func(result *command.ExecuteResult, err error) bool {\n\t\tstats.Add(numExecutionErrors, 1)\n\t\tresult.Error = err.Error()\n\t\tallResults = append(allResults, result)\n\t\tif tx != nil {\n\t\t\ttx.Rollback()\n\t\t\ttx = nil\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\t// Execute each statement.\n\tfor _, stmt := range req.Statements {\n\t\tss := stmt.Sql\n\t\tif ss == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tresult := &command.ExecuteResult{}\n\t\tstart := time.Now()\n\n\t\tparameters, err := parametersToValues(stmt.Parameters)\n\t\tif err != nil {\n\t\t\tif handleError(result, err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tr, err := execer.ExecContext(context.Background(), ss, parameters...)\n\t\tif err != nil {\n\t\t\tif handleError(result, err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tif r == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tlid, err := r.LastInsertId()\n\t\tif err != nil {\n\t\t\tif handleError(result, err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tresult.LastInsertId = lid\n\n\t\tra, err := r.RowsAffected()\n\t\tif err != nil {\n\t\t\tif handleError(result, err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tresult.RowsAffected = ra\n\t\tif xTime {\n\t\t\tresult.Time = time.Now().Sub(start).Seconds()\n\t\t}\n\t\tallResults = append(allResults, result)\n\t}\n\n\tif tx != nil {\n\t\terr = tx.Commit()\n\t}\n\treturn allResults, err\n}", "title": "" }, { "docid": "abb9b431537514ec1b4642fdc8188c86", "score": "0.50404066", "text": "func ExecQuery(query string, schema *graphql.Schema) {\n\n\tctx := context.Background()\n\tvar params map[string]interface{}\n\tr := schema.Exec(ctx, query, \"\", params)\n\tif r.Errors != nil {\n\t\tlog.Println(r.Errors)\n\t}\n\tlog.Println(string(r.Data))\n\n}", "title": "" }, { "docid": "1813f12d540cdc1d18807159ac04ae29", "score": "0.5026025", "text": "func (s *sqlHandler) Execute() {\n\t// do something...\n}", "title": "" }, { "docid": "b496a9a166f32c9fab40fd0648939b26", "score": "0.50175416", "text": "func (m *Miniredis) Stream(k string) ([]StreamEntry, error) {\n\treturn m.DB(m.selectedDB).Stream(k)\n}", "title": "" }, { "docid": "3a5ddf32a4731b978ca35cbe3100c30f", "score": "0.50026464", "text": "func (a *TimeseriesApiService) ReadTimeseriesDataExecute(r ApiReadTimeseriesDataRequest) (TimeseriesQueryResult, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue TimeseriesQueryResult\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"TimeseriesApiService.ReadTimeseriesData\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/timeseries/{timeseriesIdentifier}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"timeseriesIdentifier\"+\"}\", _neturl.PathEscape(parameterToString(r.timeseriesIdentifier, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.includeData != nil {\n\t\tlocalVarQueryParams.Add(\"includeData\", parameterToString(*r.includeData, \"\"))\n\t}\n\tif r.aggregationType != nil {\n\t\tlocalVarQueryParams.Add(\"aggregationType\", parameterToString(*r.aggregationType, \"\"))\n\t}\n\tif r.startTimestamp != nil {\n\t\tlocalVarQueryParams.Add(\"startTimestamp\", parameterToString(*r.startTimestamp, \"\"))\n\t}\n\tif r.endTimestamp != nil {\n\t\tlocalVarQueryParams.Add(\"endTimestamp\", parameterToString(*r.endTimestamp, \"\"))\n\t}\n\tif r.predict != nil {\n\t\tlocalVarQueryParams.Add(\"predict\", parameterToString(*r.predict, \"\"))\n\t}\n\tif r.relativeTime != nil {\n\t\tlocalVarQueryParams.Add(\"relativeTime\", parameterToString(*r.relativeTime, \"\"))\n\t}\n\tif r.queryMode != nil {\n\t\tlocalVarQueryParams.Add(\"queryMode\", parameterToString(*r.queryMode, \"\"))\n\t}\n\tif r.entity != nil {\n\t\tt := *r.entity\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entity\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entity\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif r.tag != nil {\n\t\tt := *r.tag\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"tag\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"tag\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif r.percentile != nil {\n\t\tlocalVarQueryParams.Add(\"percentile\", parameterToString(*r.percentile, \"\"))\n\t}\n\tif r.includeParentIds != nil {\n\t\tlocalVarQueryParams.Add(\"includeParentIds\", parameterToString(*r.includeParentIds, \"\"))\n\t}\n\tif r.considerMaintenanceWindowsForAvailability != nil {\n\t\tlocalVarQueryParams.Add(\"considerMaintenanceWindowsForAvailability\", parameterToString(*r.considerMaintenanceWindowsForAvailability, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json; charset=utf-8\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"Api-Token\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "86ecbfa74bf1af06b494b1434c64e1eb", "score": "0.49965492", "text": "func (r *showAllUserInteractor) Execute(ctx context.Context, _ InportRequest) (*InportResponse, error) {\n\n\tres := &InportResponse{}\n\n\terr := repository.WithoutTrx(ctx, r.outport, func(ctx context.Context) error {\n\n\t\tuserObjs, err := r.outport.FindAllUser(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tres.Users = userObjs\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "2758ea9801678d385f5584c5a6c1dc19", "score": "0.4980425", "text": "func (e *ShowTagValuesExecutor) Execute() <-chan *models.Row {\n\t// Create output channel and stream data in a separate goroutine.\n\tout := make(chan *models.Row, 0)\n\n\t// It's important that all resources are released when execution completes.\n\tdefer e.close()\n\n\tgo func() {\n\t\tdefer close(out)\n\t\t// Open the mappers.\n\t\tfor _, m := range e.mappers {\n\t\t\tif err := m.Open(); err != nil {\n\t\t\t\tout <- &models.Row{Err: err}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// Create a map of tag keys to tag values.\n\t\tset := map[string]map[string]struct{}{}\n\t\t// Iterate through mappers collecting tag values.\n\t\tfor _, m := range e.mappers {\n\t\t\t// Read all data from the mapper.\n\t\t\tfor {\n\t\t\t\tc, err := m.NextChunk()\n\t\t\t\tif err != nil {\n\t\t\t\t\tout <- &models.Row{Err: err}\n\t\t\t\t\treturn\n\t\t\t\t} else if c == nil {\n\t\t\t\t\t// Mapper has been drained.\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\t// Convert the mapper chunk to measurements with tag key and values.\n\t\t\t\ttsvs, ok := c.(TagsValues)\n\t\t\t\tif !ok {\n\t\t\t\t\tout <- &models.Row{Err: fmt.Errorf(\"show tag values mapper returned invalid type: %T\", c)}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Merge mapper chunk with previous mapper outputs.\n\t\t\t\tfor _, tvs := range tsvs {\n\t\t\t\t\t// Add the tag key to the set if not already there.\n\t\t\t\t\tif set[tvs.Key] == nil {\n\t\t\t\t\t\tset[tvs.Key] = map[string]struct{}{}\n\t\t\t\t\t}\n\t\t\t\t\t// Add the tag values to the tag key's set.\n\t\t\t\t\tfor _, value := range tvs.Values {\n\t\t\t\t\t\tset[tvs.Key][value] = struct{}{}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// All mappers are drained.\n\n\t\t// Convert the set into an array of tag keys and values.\n\t\ttsvs := make(TagsValues, 0)\n\t\tfor key, values := range set {\n\t\t\ttvs := &TagValues{\n\t\t\t\tKey: key,\n\t\t\t\tValues: make([]string, 0, len(values)),\n\t\t\t}\n\t\t\tfor value := range values {\n\t\t\t\ttvs.Values = append(tvs.Values, value)\n\t\t\t}\n\t\t\tsort.Strings(tvs.Values)\n\t\t\ttsvs = append(tsvs, tvs)\n\t\t}\n\t\t// Sort by tag key.\n\t\tsort.Sort(tsvs)\n\n\t\t// Calculate series offset and limit.\n\t\tslim, soff := limitAndOffset(e.stmt.SLimit, e.stmt.SOffset, len(tsvs))\n\n\t\t// Send results.\n\t\tfor _, tvs := range tsvs[soff:slim] {\n\t\t\tlim, off := limitAndOffset(e.stmt.Limit, e.stmt.Offset, len(tvs.Values))\n\n\t\t\trow := &models.Row{\n\t\t\t\tName: tvs.Key,\n\t\t\t\tColumns: []string{\"tagKey\"},\n\t\t\t\tValues: make([][]interface{}, 0, lim-off),\n\t\t\t}\n\n\t\t\tfor _, tv := range tvs.Values[off:lim] {\n\t\t\t\tv := []interface{}{tv}\n\t\t\t\trow.Values = append(row.Values, v)\n\t\t\t}\n\n\t\t\tout <- row\n\t\t}\n\t}()\n\treturn out\n}", "title": "" }, { "docid": "d305b62d796d26995e2a0c4ecee8d6e6", "score": "0.49682614", "text": "func (conn *gRPCQueryClient) VStreamRows(ctx context.Context, request *binlogdatapb.VStreamRowsRequest, send func(*binlogdatapb.VStreamRowsResponse) error) error {\n\tstream, err := func() (queryservicepb.Query_VStreamRowsClient, error) {\n\t\tconn.mu.RLock()\n\t\tdefer conn.mu.RUnlock()\n\t\tif conn.cc == nil {\n\t\t\treturn nil, tabletconn.ConnClosed\n\t\t}\n\n\t\treq := &binlogdatapb.VStreamRowsRequest{\n\t\t\tTarget: request.Target,\n\t\t\tEffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),\n\t\t\tImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),\n\t\t\tQuery: request.Query,\n\t\t\tLastpk: request.Lastpk,\n\t\t}\n\t\tstream, err := conn.c.VStreamRows(ctx, req)\n\t\tif err != nil {\n\t\t\treturn nil, tabletconn.ErrorFromGRPC(err)\n\t\t}\n\t\treturn stream, nil\n\t}()\n\tif err != nil {\n\t\treturn err\n\t}\n\tr := binlogdatapb.VStreamRowsResponseFromVTPool()\n\tdefer r.ReturnToVTPool()\n\tfor {\n\t\terr := stream.RecvMsg(r)\n\t\tif err != nil {\n\t\t\treturn tabletconn.ErrorFromGRPC(err)\n\t\t}\n\t\tif ctx.Err() != nil {\n\t\t\treturn ctx.Err()\n\t\t}\n\t\tif err := send(r); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.ResetVT()\n\t}\n}", "title": "" }, { "docid": "f3b9b5c36c26dff6f1fbf1a109d813a7", "score": "0.49637112", "text": "func (s *MySpannerImpl) ServerStream(req *test.Name, stream pb.MySpanner_ServerStreamServer) error {\n\tvar (\n\t\tId int64\n\t\tName string\n\t\tStartTime mytime.MyTime\n\t)\n\n\tparams := make(map[string]interface{})\n\tstmt := spanner.Statement{SQL: \"SELECT * FROM example_table\", Params: params}\n\ttx := s.SpannerDB.Single()\n\tdefer tx.Close()\n\titer := tx.Query(context.Background(), stmt)\n\tdefer iter.Stop()\n\tfor {\n\t\trow, err := iter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn grpc.Errorf(codes.Unknown, err.Error())\n\t\t}\n\t\t// scan our values out of the row\n\n\t\terr = row.ColumnByName(\"id\", &Id)\n\t\tif err != nil {\n\t\t\treturn grpc.Errorf(codes.Unknown, err.Error())\n\t\t}\n\n\t\tgcv1 := new(spanner.GenericColumnValue)\n\t\terr = row.ColumnByName(\"start_time\", gcv1)\n\t\tif err != nil {\n\t\t\treturn grpc.Errorf(codes.Unknown, err.Error())\n\t\t}\n\t\terr = StartTime.SpannerScan(gcv1)\n\t\tif err != nil {\n\t\t\treturn grpc.Errorf(codes.Unknown, err.Error())\n\t\t}\n\n\t\terr = row.ColumnByName(\"name\", &Name)\n\t\tif err != nil {\n\t\t\treturn grpc.Errorf(codes.Unknown, err.Error())\n\t\t}\n\n\t\tres := test.ExampleTable{\n\n\t\t\tId: Id,\n\t\t\tName: Name,\n\t\t\tStartTime: StartTime.ToProto(),\n\t\t}\n\n\t\tstream.Send(&res)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f8d32129e6006a2276e245a4ad5edae4", "score": "0.4957756", "text": "func (s *Stmt) Query(args ...interface{}) (*Rows, error) {\n\tstart := time.Now()\n\trows, err := s.Stmt.Queryx(args...)\n\ts.logger.Info(formatQuery(s.query+formatStmtParams(args...), time.Since(start)))\n\n\treturn &Rows{rows}, err\n}", "title": "" }, { "docid": "a2ed2b2335c99774e81802958a0463ca", "score": "0.49549365", "text": "func (qs QueriesS) PostQueryResult(query string, maxAge, dataSourceId int) (r io.Reader, err error) {\n\tresp, err := PostInter(qs.Client, \"/api/query_results\", []byte(fmt.Sprintf(`{\"query\":\"%s\",\"max_age\":%d,\"data_sourece_id\":%d}`, query, maxAge, dataSourceId)))\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn resp.Body, nil\n\t}\n}", "title": "" }, { "docid": "33591df6a94fc153531594c3bd6057fb", "score": "0.49535736", "text": "func (c *Client) executeQuery(ctx context.Context, qry interface{}, params map[string]interface{}) error {\n\tif err := c.client.Query(ctx, qry, params); err != nil {\n\t\treturn errors.Wrap(err, \"error in executing query\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "62e6b9ab539685a3203b0f87e65a03e2", "score": "0.4953406", "text": "func (vtg *VTGate) StreamExecuteKeyspaceIds2(ctx context.Context, request *gorpcvtgatecommon.KeyspaceIdQuery, sendReply func(interface{}) error) (err error) {\n\tdefer vtg.server.HandlePanic(&err)\n\tctx = callerid.NewContext(ctx,\n\t\tgorpccallerid.GoRPCEffectiveCallerID(request.CallerID),\n\t\tcallerid.NewImmediateCallerID(\"gorpc client\"))\n\tvtgErr := vtg.server.StreamExecuteKeyspaceIds(ctx,\n\t\trequest.Sql,\n\t\trequest.BindVariables,\n\t\trequest.Keyspace,\n\t\trequest.KeyspaceIds,\n\t\trequest.TabletType,\n\t\tfunc(value *sqltypes.Result) error {\n\t\t\treturn sendReply(&gorpcvtgatecommon.QueryResult{\n\t\t\t\tResult: value,\n\t\t\t})\n\t\t})\n\tif vtgErr == nil {\n\t\treturn nil\n\t}\n\n\t// If there was an app error, send a QueryResult back with it.\n\treturn sendReply(&gorpcvtgatecommon.QueryResult{\n\t\tErr: vterrors.RPCErrFromVtError(vtgErr),\n\t})\n}", "title": "" }, { "docid": "53b49d4cf82c4c97b01f487997b3d72d", "score": "0.49512306", "text": "func (vc *vcursorImpl) Execute(ctx context.Context, method string, query string, bindVars map[string]*querypb.BindVariable, rollbackOnError bool, co vtgatepb.CommitOrder) (*sqltypes.Result, error) {\n\tsession := vc.safeSession\n\tif co == vtgatepb.CommitOrder_AUTOCOMMIT {\n\t\t// For autocommit, we have to create an independent session.\n\t\tsession = NewAutocommitSession(vc.safeSession.Session)\n\t\tsession.logging = vc.safeSession.logging\n\t\trollbackOnError = false\n\t} else {\n\t\tsession.SetCommitOrder(co)\n\t\tdefer session.SetCommitOrder(vtgatepb.CommitOrder_NORMAL)\n\t}\n\n\terr := vc.markSavepoint(ctx, rollbackOnError, map[string]*querypb.BindVariable{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqr, err := vc.executor.Execute(ctx, nil, method, session, vc.marginComments.Leading+query+vc.marginComments.Trailing, bindVars)\n\tvc.setRollbackOnPartialExecIfRequired(err != nil, rollbackOnError)\n\n\treturn qr, err\n}", "title": "" }, { "docid": "648314646505ea1aa711f67c4acd489b", "score": "0.4947864", "text": "func (q *Query) Result() (sql.Result, error) {\n\tresults, err := Exec(q.QueryString(), q.args...)\n\treturn results, err\n}", "title": "" }, { "docid": "e5785268f178ebd53896ecafd7962af8", "score": "0.49460545", "text": "func (ddl *DDLStatement) Execute() error {\n\tif ddl.shellOut != nil {\n\t\treturn ddl.shellOut.Run()\n\t}\n\tdb, err := ddl.instance.CachedConnectionPool(ddl.schemaName, ddl.connectParams)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = db.Exec(ddl.stmt)\n\treturn err\n}", "title": "" }, { "docid": "39fbde353ab50b2cb79899e435f64231", "score": "0.49459764", "text": "func (ss *SumService) GetStreamingSumResult(r *files.SumRequest, stream files.SumService_GetStreamingSumResultServer) error {\n\tlst := r.GetList()\n\tvar number int32 = 0\n\tfor _, value := range lst {\n\t\tnumber += value\n\t\tresp := &files.SumResponse{Result: number}\n\t\terr := stream.Send(resp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttime.Sleep(time.Millisecond * 300)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "213df32fea71cbd02773e77c68972537", "score": "0.4930824", "text": "func (m *MySQLHandler) Query(query string, args ...interface{}) (repository.Rows, error) {\n\tres, err := m.conn.Query(query, args...)\n\tif err != nil {\n\t\treturn new(Rows), err\n\t}\n\treturn &Rows{Rows: res}, nil\n}", "title": "" }, { "docid": "24c27c3e1616bcc3c288f4c0460758fc", "score": "0.49264523", "text": "func Query(host string, cxn Sqlcxn, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\n\tdsn := cxn.Dsn(host)\n\n\tdb, err := sql.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\tlog.Println(host, \"\\t\", err.Error())\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\t// Execute the query\n\trows, err := db.Query(cxn.Query)\n\tif err != nil {\n\t\tlog.Println(\"WARNING: Could not connect to '\" + host + \"': Unknown MySQL server host '\" + host + \"'\")\n\t\treturn\n\t}\n\n\t// Get column names\n\tcolumns, err := rows.Columns()\n\tif err != nil {\n\t\tlog.Println(host, \"\\t\", err.Error())\n\t\treturn\n\t}\n\n\t// Make a slice for the values\n\tvalues := make([]sql.RawBytes, len(columns))\n\n\t// rows.Scan wants '[]interface{}' as an argument, so we must copy the\n\t// references into such a slice\n\t// See http://code.google.com/p/go-wiki/wiki/InterfaceSlice for details\n\tscanArgs := make([]interface{}, len(values))\n\tfor i := range values {\n\t\tscanArgs[i] = &values[i]\n\t}\n\n\t// Fetch rows\n\tfor rows.Next() {\n\t\tvar res string\n\t\tres += host\n\t\t// get RawBytes from data\n\t\terr = rows.Scan(scanArgs...)\n\t\tif err != nil {\n\t\t\tlog.Println(host, \"\\t\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Now do something with the data.\n\t\t// Here we just print each column as a string.\n\t\tfor _, col := range values {\n\t\t\t// Here we can check if the value is nil (NULL value)\n\t\t\tif col == nil {\n\t\t\t\tres += \"\\tNULL\"\n\t\t\t} else {\n\t\t\t\tres += \"\\t\"\n\t\t\t\tres += string(col)\n\t\t\t}\n\t\t}\n\t\tfmt.Println(res)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\tlog.Println(host, \"\\t\", err.Error())\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "ef801b77f933e97ffd891f7d35ad6bd4", "score": "0.4916035", "text": "func (sq *SqlQuery) ExecuteBatch(ctx context.Context, target *pb.Target, queryList *proto.QueryList, reply *proto.QueryResultList) (err error) {\n\tif len(queryList.Queries) == 0 {\n\t\treturn NewTabletError(ErrFail, vtrpc.ErrorCode_BAD_INPUT, \"Empty query list\")\n\t}\n\tif queryList.AsTransaction && queryList.TransactionId != 0 {\n\t\treturn NewTabletError(ErrFail, vtrpc.ErrorCode_BAD_INPUT, \"cannot start a new transaction in the scope of an existing one\")\n\t}\n\n\tallowShutdown := (queryList.TransactionId != 0)\n\tif err = sq.startRequest(target, queryList.SessionId, allowShutdown); err != nil {\n\t\treturn err\n\t}\n\tdefer sq.endRequest()\n\tdefer handleError(&err, nil, sq.qe.queryServiceStats)\n\n\tsession := proto.Session{\n\t\tTransactionId: queryList.TransactionId,\n\t\tSessionId: queryList.SessionId,\n\t}\n\tif queryList.AsTransaction {\n\t\tvar txInfo proto.TransactionInfo\n\t\tif err = sq.Begin(ctx, target, &session, &txInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsession.TransactionId = txInfo.TransactionId\n\t\t// If transaction was not committed by the end, it means\n\t\t// that there was an error, roll it back.\n\t\tdefer func() {\n\t\t\tif session.TransactionId != 0 {\n\t\t\t\tsq.Rollback(ctx, target, &session)\n\t\t\t}\n\t\t}()\n\t}\n\treply.List = make([]mproto.QueryResult, 0, len(queryList.Queries))\n\tfor _, bound := range queryList.Queries {\n\t\tquery := proto.Query{\n\t\t\tSql: bound.Sql,\n\t\t\tBindVariables: bound.BindVariables,\n\t\t\tTransactionId: session.TransactionId,\n\t\t\tSessionId: session.SessionId,\n\t\t}\n\t\tvar localReply mproto.QueryResult\n\t\tif err = sq.Execute(ctx, target, &query, &localReply); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treply.List = append(reply.List, localReply)\n\t}\n\tif queryList.AsTransaction {\n\t\tif err = sq.Commit(ctx, target, &session); err != nil {\n\t\t\tsession.TransactionId = 0\n\t\t\treturn err\n\t\t}\n\t\tsession.TransactionId = 0\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ec2d14210d8962868f6543226a679597", "score": "0.49136928", "text": "func (ts *TimeseriesDB) Query(q *Query) (DatapointIterator, error) {\n\tit, err := ts.rawQuery(q)\n\tif err != nil {\n\t\treturn it, err\n\t}\n\tif q.Transform != nil && *q.Transform != \"\" {\n\t\tit2 := it\n\t\tit, err = NewTransformIterator(*q.Transform, it2)\n\t\tif err != nil {\n\t\t\tit2.Close()\n\t\t}\n\t}\n\tif q.Limit != nil && *q.Limit > 0 {\n\t\tit = NewNumIterator(it, *q.Limit)\n\t}\n\n\treturn it, err\n}", "title": "" }, { "docid": "c74f5d601a6b0c22b31f26a7d0b11797", "score": "0.4912653", "text": "func (c *Client) ExecuteStatement(ctx context.Context, params *ExecuteStatementInput, optFns ...func(*Options)) (*ExecuteStatementOutput, error) {\n\tif params == nil {\n\t\tparams = &ExecuteStatementInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ExecuteStatement\", params, optFns, addOperationExecuteStatementMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ExecuteStatementOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "d071ac1af0fe991c9f8a83e7c34e97e7", "score": "0.48944828", "text": "func (accessor *DbAccessor) Execute(ctx context.Context, command string, args ...interface{}) (sql.Result, error) {\n\tvar r sql.Result\n\tvar err error\n\tLogOperation(ctx, \"ExecuteCommand\", func() error {\n\t\tr, err = accessor.db.ExecContext(ctx, command, args...)\n\t\treturn err\n\t})\n\n\treturn r, err\n}", "title": "" }, { "docid": "bc4f5d161731b0dc879ea7dbd6a48f02", "score": "0.48853132", "text": "func (ms *MappingStep) Execute(tableName string, object map[string]interface{}) (*BatchHeader, map[string]interface{}, error) {\n\tmappedObject, err := ms.fieldMapper.Map(object)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"Error mapping object: %v\", err)\n\t}\n\n\tflatObject, err := ms.flattener.FlattenObject(mappedObject)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tfields, err := ms.typeResolver.Resolve(flatObject)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &BatchHeader{TableName: tableName, Fields: fields}, flatObject, nil\n}", "title": "" }, { "docid": "8d3e7d3c398904ddaf56d5ae5c544421", "score": "0.48841655", "text": "func (c *ReplicaConnector) VStreamRows(ctx context.Context, query string, lastpk *querypb.QueryResult, send func(*binlogdatapb.VStreamRowsResponse) error) error {\n\tvar row []sqltypes.Value\n\tif lastpk != nil {\n\t\tr := sqltypes.Proto3ToResult(lastpk)\n\t\tif len(r.Rows) != 1 {\n\t\t\treturn vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, \"unexpected lastpk input: %v\", lastpk)\n\t\t}\n\t\trow = r.Rows[0]\n\t}\n\treturn c.vstreamer.StreamRows(ctx, query, row, send)\n}", "title": "" }, { "docid": "ca77b252a8befe2bf44598d4f611aad1", "score": "0.4879781", "text": "func (db DB) Exec(q string, args ...interface{}) error {\n\tres, err := db.Query(q, args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn res.Close()\n}", "title": "" } ]
fd8ec1900a84203f65fb9c9831f0a1a6
WithPostOnly adds the postOnly to the get private buy params
[ { "docid": "09489230181d43c388c67b842787444c", "score": "0.74405235", "text": "func (o *GetPrivateBuyParams) WithPostOnly(postOnly *bool) *GetPrivateBuyParams {\n\to.SetPostOnly(postOnly)\n\treturn o\n}", "title": "" } ]
[ { "docid": "abf17b7532aa800a043badb2b80381ab", "score": "0.73486936", "text": "func (o *GetPrivateBuyParams) SetPostOnly(postOnly *bool) {\n\to.PostOnly = postOnly\n}", "title": "" }, { "docid": "a44fb0ea0816ff3372d17d79fb459f9b", "score": "0.70153147", "text": "func (o *GetPrivateSellParams) SetPostOnly(postOnly *bool) {\n\to.PostOnly = postOnly\n}", "title": "" }, { "docid": "43b3860baa44cafcb9cfb973fcc39616", "score": "0.6870721", "text": "func (o *GetPrivateSellParams) WithPostOnly(postOnly *bool) *GetPrivateSellParams {\n\to.SetPostOnly(postOnly)\n\treturn o\n}", "title": "" }, { "docid": "7814e34d357254743fb0e2295e8b38a4", "score": "0.6676091", "text": "func (p *Poloniex) BuyPostOnly(pair string, rate, amount float64) (buy Buy, err error) {\r\n\tparams := url.Values{}\r\n\tparams.Add(\"currencyPair\", pair)\r\n\tparams.Add(\"rate\", fmt.Sprintf(\"%.8f\", rate))\r\n\tparams.Add(\"amount\", fmt.Sprintf(\"%.8f\", amount))\r\n\tparams.Add(\"postOnly\", \"1\")\r\n\terr = p.private(\"buy\", params, &buy)\r\n\treturn\r\n}", "title": "" }, { "docid": "54d89e900768256f743f68fb54f22a37", "score": "0.6209406", "text": "func (p *Poloniex) SellPostOnly(pair string, rate, amount float64) (sell Sell, err error) {\r\n\tparams := url.Values{}\r\n\tparams.Add(\"currencyPair\", pair)\r\n\tparams.Add(\"rate\", fmt.Sprintf(\"%.8f\", rate))\r\n\tparams.Add(\"amount\", fmt.Sprintf(\"%.8f\", amount))\r\n\tparams.Add(\"postOnly\", \"1\")\r\n\terr = p.private(\"sell\", params, &sell)\r\n\treturn\r\n}", "title": "" }, { "docid": "2720253a753b1b1c27152afd09d89431", "score": "0.5839457", "text": "func NewGetPrivateBuyParams() *GetPrivateBuyParams {\n\tvar (\n\t\tmaxShowDefault = float64(1)\n\t\tpostOnlyDefault = bool(true)\n\t\treduceOnlyDefault = bool(false)\n\t\ttimeInForceDefault = string(\"good_til_cancelled\")\n\t)\n\treturn &GetPrivateBuyParams{\n\t\tMaxShow: &maxShowDefault,\n\t\tPostOnly: &postOnlyDefault,\n\t\tReduceOnly: &reduceOnlyDefault,\n\t\tTimeInForce: &timeInForceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "5febd0113918558061afb8200ef89c21", "score": "0.57329524", "text": "func NewGetPrivateBuyParamsWithHTTPClient(client *http.Client) *GetPrivateBuyParams {\n\tvar (\n\t\tmaxShowDefault = float64(1)\n\t\tpostOnlyDefault = bool(true)\n\t\treduceOnlyDefault = bool(false)\n\t\ttimeInForceDefault = string(\"good_til_cancelled\")\n\t)\n\treturn &GetPrivateBuyParams{\n\t\tMaxShow: &maxShowDefault,\n\t\tPostOnly: &postOnlyDefault,\n\t\tReduceOnly: &reduceOnlyDefault,\n\t\tTimeInForce: &timeInForceDefault,\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "8297ec101d76c8382282464f33c1cd35", "score": "0.54121774", "text": "func (o *GetPrivateBuyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Advanced != nil {\n\n\t\t// query param advanced\n\t\tvar qrAdvanced string\n\t\tif o.Advanced != nil {\n\t\t\tqrAdvanced = *o.Advanced\n\t\t}\n\t\tqAdvanced := qrAdvanced\n\t\tif qAdvanced != \"\" {\n\t\t\tif err := r.SetQueryParam(\"advanced\", qAdvanced); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param amount\n\tqrAmount := o.Amount\n\tqAmount := swag.FormatFloat64(qrAmount)\n\tif qAmount != \"\" {\n\t\tif err := r.SetQueryParam(\"amount\", qAmount); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param instrument_name\n\tqrInstrumentName := o.InstrumentName\n\tqInstrumentName := qrInstrumentName\n\tif qInstrumentName != \"\" {\n\t\tif err := r.SetQueryParam(\"instrument_name\", qInstrumentName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Label != nil {\n\n\t\t// query param label\n\t\tvar qrLabel string\n\t\tif o.Label != nil {\n\t\t\tqrLabel = *o.Label\n\t\t}\n\t\tqLabel := qrLabel\n\t\tif qLabel != \"\" {\n\t\t\tif err := r.SetQueryParam(\"label\", qLabel); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaxShow != nil {\n\n\t\t// query param max_show\n\t\tvar qrMaxShow float64\n\t\tif o.MaxShow != nil {\n\t\t\tqrMaxShow = *o.MaxShow\n\t\t}\n\t\tqMaxShow := swag.FormatFloat64(qrMaxShow)\n\t\tif qMaxShow != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max_show\", qMaxShow); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PostOnly != nil {\n\n\t\t// query param post_only\n\t\tvar qrPostOnly bool\n\t\tif o.PostOnly != nil {\n\t\t\tqrPostOnly = *o.PostOnly\n\t\t}\n\t\tqPostOnly := swag.FormatBool(qrPostOnly)\n\t\tif qPostOnly != \"\" {\n\t\t\tif err := r.SetQueryParam(\"post_only\", qPostOnly); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Price != nil {\n\n\t\t// query param price\n\t\tvar qrPrice float64\n\t\tif o.Price != nil {\n\t\t\tqrPrice = *o.Price\n\t\t}\n\t\tqPrice := swag.FormatFloat64(qrPrice)\n\t\tif qPrice != \"\" {\n\t\t\tif err := r.SetQueryParam(\"price\", qPrice); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ReduceOnly != nil {\n\n\t\t// query param reduce_only\n\t\tvar qrReduceOnly bool\n\t\tif o.ReduceOnly != nil {\n\t\t\tqrReduceOnly = *o.ReduceOnly\n\t\t}\n\t\tqReduceOnly := swag.FormatBool(qrReduceOnly)\n\t\tif qReduceOnly != \"\" {\n\t\t\tif err := r.SetQueryParam(\"reduce_only\", qReduceOnly); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.StopPrice != nil {\n\n\t\t// query param stop_price\n\t\tvar qrStopPrice float64\n\t\tif o.StopPrice != nil {\n\t\t\tqrStopPrice = *o.StopPrice\n\t\t}\n\t\tqStopPrice := swag.FormatFloat64(qrStopPrice)\n\t\tif qStopPrice != \"\" {\n\t\t\tif err := r.SetQueryParam(\"stop_price\", qStopPrice); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.TimeInForce != nil {\n\n\t\t// query param time_in_force\n\t\tvar qrTimeInForce string\n\t\tif o.TimeInForce != nil {\n\t\t\tqrTimeInForce = *o.TimeInForce\n\t\t}\n\t\tqTimeInForce := qrTimeInForce\n\t\tif qTimeInForce != \"\" {\n\t\t\tif err := r.SetQueryParam(\"time_in_force\", qTimeInForce); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Trigger != nil {\n\n\t\t// query param trigger\n\t\tvar qrTrigger string\n\t\tif o.Trigger != nil {\n\t\t\tqrTrigger = *o.Trigger\n\t\t}\n\t\tqTrigger := qrTrigger\n\t\tif qTrigger != \"\" {\n\t\t\tif err := r.SetQueryParam(\"trigger\", qTrigger); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f2ee5780235adf239096b6a3dc6205f5", "score": "0.5269395", "text": "func NewGetPrivateBuyParamsWithTimeout(timeout time.Duration) *GetPrivateBuyParams {\n\tvar (\n\t\tmaxShowDefault = float64(1)\n\t\tpostOnlyDefault = bool(true)\n\t\treduceOnlyDefault = bool(false)\n\t\ttimeInForceDefault = string(\"good_til_cancelled\")\n\t)\n\treturn &GetPrivateBuyParams{\n\t\tMaxShow: &maxShowDefault,\n\t\tPostOnly: &postOnlyDefault,\n\t\tReduceOnly: &reduceOnlyDefault,\n\t\tTimeInForce: &timeInForceDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "b9fe3892ed1caa9d3525bb5d2ee2cd10", "score": "0.5202559", "text": "func (o *GetPrivateBuyParams) WithReduceOnly(reduceOnly *bool) *GetPrivateBuyParams {\n\to.SetReduceOnly(reduceOnly)\n\treturn o\n}", "title": "" }, { "docid": "96ed7b478bf5e2e4153c3d56bfc03af5", "score": "0.5201451", "text": "func NewGetPrivateSellParamsWithHTTPClient(client *http.Client) *GetPrivateSellParams {\n\tvar (\n\t\tmaxShowDefault = float64(1)\n\t\tpostOnlyDefault = bool(true)\n\t\treduceOnlyDefault = bool(false)\n\t\ttimeInForceDefault = string(\"good_til_cancelled\")\n\t)\n\treturn &GetPrivateSellParams{\n\t\tMaxShow: &maxShowDefault,\n\t\tPostOnly: &postOnlyDefault,\n\t\tReduceOnly: &reduceOnlyDefault,\n\t\tTimeInForce: &timeInForceDefault,\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "02a3c8dddaf54b0143a057a1793ccaea", "score": "0.5171237", "text": "func NewGetPrivateSellParams() *GetPrivateSellParams {\n\tvar (\n\t\tmaxShowDefault = float64(1)\n\t\tpostOnlyDefault = bool(true)\n\t\treduceOnlyDefault = bool(false)\n\t\ttimeInForceDefault = string(\"good_til_cancelled\")\n\t)\n\treturn &GetPrivateSellParams{\n\t\tMaxShow: &maxShowDefault,\n\t\tPostOnly: &postOnlyDefault,\n\t\tReduceOnly: &reduceOnlyDefault,\n\t\tTimeInForce: &timeInForceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "e39055ad64877dcbbe92d65fcc18fc6d", "score": "0.50474095", "text": "func (m *GetMemberObjectsPostRequestBody) GetSecurityEnabledOnly()(*bool) {\n return m.securityEnabledOnly\n}", "title": "" }, { "docid": "a4c5139c2fd94e4806b3f307b361eefc", "score": "0.50053585", "text": "func (p *Poloniex) MovePostOnly(orderNumber int64, rate float64) (moveOrder MoveOrder, err error) {\r\n\tparams := url.Values{}\r\n\tparams.Add(\"orderNumber\", fmt.Sprintf(\"%d\", orderNumber))\r\n\tparams.Add(\"rate\", fmt.Sprintf(\"%.8f\", rate))\r\n\tparams.Add(\"postOnly\", \"1\")\r\n\terr = p.private(\"moveOrder\", params, &moveOrder)\r\n\treturn\r\n}", "title": "" }, { "docid": "bdf213b537646d19383444a61d5c2075", "score": "0.49923337", "text": "func PublishBodyOnly(b bool) PublishOption {\n\treturn func(o *PublishOptions) {\n\t\to.BodyOnly = b\n\t}\n}", "title": "" }, { "docid": "89fb8d482ef8e4a5988b3ebe5f61703d", "score": "0.49538493", "text": "func (o *GetPrivateSellParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Advanced != nil {\n\n\t\t// query param advanced\n\t\tvar qrAdvanced string\n\t\tif o.Advanced != nil {\n\t\t\tqrAdvanced = *o.Advanced\n\t\t}\n\t\tqAdvanced := qrAdvanced\n\t\tif qAdvanced != \"\" {\n\t\t\tif err := r.SetQueryParam(\"advanced\", qAdvanced); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param amount\n\tqrAmount := o.Amount\n\tqAmount := swag.FormatFloat64(qrAmount)\n\tif qAmount != \"\" {\n\t\tif err := r.SetQueryParam(\"amount\", qAmount); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param instrument_name\n\tqrInstrumentName := o.InstrumentName\n\tqInstrumentName := qrInstrumentName\n\tif qInstrumentName != \"\" {\n\t\tif err := r.SetQueryParam(\"instrument_name\", qInstrumentName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Label != nil {\n\n\t\t// query param label\n\t\tvar qrLabel string\n\t\tif o.Label != nil {\n\t\t\tqrLabel = *o.Label\n\t\t}\n\t\tqLabel := qrLabel\n\t\tif qLabel != \"\" {\n\t\t\tif err := r.SetQueryParam(\"label\", qLabel); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaxShow != nil {\n\n\t\t// query param max_show\n\t\tvar qrMaxShow float64\n\t\tif o.MaxShow != nil {\n\t\t\tqrMaxShow = *o.MaxShow\n\t\t}\n\t\tqMaxShow := swag.FormatFloat64(qrMaxShow)\n\t\tif qMaxShow != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max_show\", qMaxShow); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PostOnly != nil {\n\n\t\t// query param post_only\n\t\tvar qrPostOnly bool\n\t\tif o.PostOnly != nil {\n\t\t\tqrPostOnly = *o.PostOnly\n\t\t}\n\t\tqPostOnly := swag.FormatBool(qrPostOnly)\n\t\tif qPostOnly != \"\" {\n\t\t\tif err := r.SetQueryParam(\"post_only\", qPostOnly); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Price != nil {\n\n\t\t// query param price\n\t\tvar qrPrice float64\n\t\tif o.Price != nil {\n\t\t\tqrPrice = *o.Price\n\t\t}\n\t\tqPrice := swag.FormatFloat64(qrPrice)\n\t\tif qPrice != \"\" {\n\t\t\tif err := r.SetQueryParam(\"price\", qPrice); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ReduceOnly != nil {\n\n\t\t// query param reduce_only\n\t\tvar qrReduceOnly bool\n\t\tif o.ReduceOnly != nil {\n\t\t\tqrReduceOnly = *o.ReduceOnly\n\t\t}\n\t\tqReduceOnly := swag.FormatBool(qrReduceOnly)\n\t\tif qReduceOnly != \"\" {\n\t\t\tif err := r.SetQueryParam(\"reduce_only\", qReduceOnly); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.StopPrice != nil {\n\n\t\t// query param stop_price\n\t\tvar qrStopPrice float64\n\t\tif o.StopPrice != nil {\n\t\t\tqrStopPrice = *o.StopPrice\n\t\t}\n\t\tqStopPrice := swag.FormatFloat64(qrStopPrice)\n\t\tif qStopPrice != \"\" {\n\t\t\tif err := r.SetQueryParam(\"stop_price\", qStopPrice); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.TimeInForce != nil {\n\n\t\t// query param time_in_force\n\t\tvar qrTimeInForce string\n\t\tif o.TimeInForce != nil {\n\t\t\tqrTimeInForce = *o.TimeInForce\n\t\t}\n\t\tqTimeInForce := qrTimeInForce\n\t\tif qTimeInForce != \"\" {\n\t\t\tif err := r.SetQueryParam(\"time_in_force\", qTimeInForce); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Trigger != nil {\n\n\t\t// query param trigger\n\t\tvar qrTrigger string\n\t\tif o.Trigger != nil {\n\t\t\tqrTrigger = *o.Trigger\n\t\t}\n\t\tqTrigger := qrTrigger\n\t\tif qTrigger != \"\" {\n\t\t\tif err := r.SetQueryParam(\"trigger\", qTrigger); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a578ce2c8c47089d18e5489b6fc4507d", "score": "0.4908686", "text": "func optIdOnly(value bool) RequestOpt {\n\treturn func(r *http.Request) error {\n\t\tparams := r.URL.Query()\n\t\tparams.Set(\"IdOnly\", fmt.Sprint(value))\n\t\tr.URL.RawQuery = params.Encode()\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "cdc8be54480e1c6203dc0a5d34437b0d", "score": "0.4873843", "text": "func (pRA *Restapi) JsonOnly(){\n pRA.bJsonOnly = true\n}", "title": "" }, { "docid": "0ba8131895f05e01671d29e19393a734", "score": "0.4865324", "text": "func FilterGetOnly(c *fiber.Ctx) bool {\n\treturn c.Method() == \"GET\"\n}", "title": "" }, { "docid": "b4faebee742ebd0dca13655ff1a3b915", "score": "0.48341388", "text": "func getOnly(h handler) handler {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method == \"GET\" {\n\t\t\th(w, r)\n\t\t\treturn\n\t\t}\n\t\thttp.Error(w, \"Get Only\", http.StatusMethodNotAllowed)\n\t}\n}", "title": "" }, { "docid": "7d8407ab72bd58a2713705b6e8c3ae44", "score": "0.482391", "text": "func (m *GetMemberObjectsPostRequestBody) SetSecurityEnabledOnly(value *bool)() {\n m.securityEnabledOnly = value\n}", "title": "" }, { "docid": "7e85645402bb3dfabe171a544648c6c9", "score": "0.47810772", "text": "func (o *GetPrivateSellParams) WithReduceOnly(reduceOnly *bool) *GetPrivateSellParams {\n\to.SetReduceOnly(reduceOnly)\n\treturn o\n}", "title": "" }, { "docid": "5e04a4240bc2ea90c1334cac25412834", "score": "0.47097173", "text": "func NewGetPrivateSellParamsWithTimeout(timeout time.Duration) *GetPrivateSellParams {\n\tvar (\n\t\tmaxShowDefault = float64(1)\n\t\tpostOnlyDefault = bool(true)\n\t\treduceOnlyDefault = bool(false)\n\t\ttimeInForceDefault = string(\"good_til_cancelled\")\n\t)\n\treturn &GetPrivateSellParams{\n\t\tMaxShow: &maxShowDefault,\n\t\tPostOnly: &postOnlyDefault,\n\t\tReduceOnly: &reduceOnlyDefault,\n\t\tTimeInForce: &timeInForceDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "6bc3e39cd7d57ee2015d5d2bd885b48c", "score": "0.4489352", "text": "func (m *ItemOnlineMeetingsCreateOrGetPostRequestBody) GetAdditionalData()(map[string]any) {\n val , err := m.backingStore.Get(\"additionalData\")\n if err != nil {\n panic(err)\n }\n if val == nil {\n var value = make(map[string]any);\n m.SetAdditionalData(value);\n }\n return val.(map[string]any)\n}", "title": "" }, { "docid": "b63fa0152dead5a0f9d191fcec0531c5", "score": "0.4425396", "text": "func (o *GetPrivateBuyParams) SetReduceOnly(reduceOnly *bool) {\n\to.ReduceOnly = reduceOnly\n}", "title": "" }, { "docid": "15cceed4aa87520f1f0b0d2900b162b1", "score": "0.4417923", "text": "func NewGetSopPaymentRequestDetailsUsingGETForbidden() *GetSopPaymentRequestDetailsUsingGETForbidden {\n\treturn &GetSopPaymentRequestDetailsUsingGETForbidden{}\n}", "title": "" }, { "docid": "30ea206e9bf0f36ea564860e0d50c00b", "score": "0.4417815", "text": "func NewExportUsingGETForbidden() *ExportUsingGETForbidden {\n\treturn &ExportUsingGETForbidden{}\n}", "title": "" }, { "docid": "7ec9f42233153faa16049e59d33eaf26", "score": "0.43491626", "text": "func (o Options) NoPost() Options {\n\treturn o.NoMethod(http.MethodPost)\n}", "title": "" }, { "docid": "b4a9de234cc503df607a7a40121d1aec", "score": "0.42972627", "text": "func NewPostRequestParams(p ...interface{}) *PostRequestParams {\n\treturn &PostRequestParams{\n\t\tArgs: parseParams(p),\n\t\tTransfer: isc.NewEmptyAssets(),\n\t\tAllowance: isc.NewEmptyAssets(),\n\t}\n}", "title": "" }, { "docid": "8c46e5b826a357b81e8b9f03048f2ee9", "score": "0.42955807", "text": "func (c *TagKeysPatchCall) ValidateOnly(validateOnly bool) *TagKeysPatchCall {\n\tc.urlParams_.Set(\"validateOnly\", fmt.Sprint(validateOnly))\n\treturn c\n}", "title": "" }, { "docid": "5682df6581fb136fe87c8bab435716e5", "score": "0.4282894", "text": "func NewPostUIOpenwindowMarketdetailsForbidden() *PostUIOpenwindowMarketdetailsForbidden {\n\treturn &PostUIOpenwindowMarketdetailsForbidden{}\n}", "title": "" }, { "docid": "a59a0fe7de57862a0ade9f8f6e323831", "score": "0.42822948", "text": "func (c *TagKeysCreateCall) ValidateOnly(validateOnly bool) *TagKeysCreateCall {\n\tc.urlParams_.Set(\"validateOnly\", fmt.Sprint(validateOnly))\n\treturn c\n}", "title": "" }, { "docid": "7b421da9490fc371eff941f0f5901e7e", "score": "0.42605728", "text": "func (q *Query) KeysOnly() *Query {\n\tq = q.clone()\n\tq.keysOnly = true\n\treturn q\n}", "title": "" }, { "docid": "facca2b4317459aa36990c9ebd2295d4", "score": "0.42434385", "text": "func NewGetPrivateBuyParamsWithContext(ctx context.Context) *GetPrivateBuyParams {\n\tvar (\n\t\tmaxShowDefault = float64(1)\n\t\tpostOnlyDefault = bool(true)\n\t\treduceOnlyDefault = bool(false)\n\t\ttimeInForceDefault = string(\"good_til_cancelled\")\n\t)\n\treturn &GetPrivateBuyParams{\n\t\tMaxShow: &maxShowDefault,\n\t\tPostOnly: &postOnlyDefault,\n\t\tReduceOnly: &reduceOnlyDefault,\n\t\tTimeInForce: &timeInForceDefault,\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "46b890c07e930b875ec4f9cd8150119b", "score": "0.42407402", "text": "func (o *GetDealsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.All != nil {\n\n\t\t// query param all\n\t\tvar qrAll bool\n\t\tif o.All != nil {\n\t\t\tqrAll = *o.All\n\t\t}\n\t\tqAll := swag.FormatBool(qrAll)\n\t\tif qAll != \"\" {\n\t\t\tif err := r.SetQueryParam(\"all\", qAll); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.CampaignCode != nil {\n\n\t\t// query param campaign_code\n\t\tvar qrCampaignCode string\n\t\tif o.CampaignCode != nil {\n\t\t\tqrCampaignCode = *o.CampaignCode\n\t\t}\n\t\tqCampaignCode := qrCampaignCode\n\t\tif qCampaignCode != \"\" {\n\t\t\tif err := r.SetQueryParam(\"campaign_code\", qCampaignCode); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.CampaignID != nil {\n\n\t\t// query param campaign_id\n\t\tvar qrCampaignID int64\n\t\tif o.CampaignID != nil {\n\t\t\tqrCampaignID = *o.CampaignID\n\t\t}\n\t\tqCampaignID := swag.FormatInt64(qrCampaignID)\n\t\tif qCampaignID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"campaign_id\", qCampaignID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.CentreID != nil {\n\n\t\t// query param centre_id\n\t\tvar qrCentreID string\n\t\tif o.CentreID != nil {\n\t\t\tqrCentreID = *o.CentreID\n\t\t}\n\t\tqCentreID := qrCentreID\n\t\tif qCentreID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"centre_id\", qCentreID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Country != nil {\n\n\t\t// query param country\n\t\tvar qrCountry string\n\t\tif o.Country != nil {\n\t\t\tqrCountry = *o.Country\n\t\t}\n\t\tqCountry := qrCountry\n\t\tif qCountry != \"\" {\n\t\t\tif err := r.SetQueryParam(\"country\", qCountry); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvar valuesDealIds []string\n\tfor _, v := range o.DealIds {\n\t\tvaluesDealIds = append(valuesDealIds, swag.FormatInt64(v))\n\t}\n\n\tjoinedDealIds := swag.JoinByFormat(valuesDealIds, \"csv\")\n\t// query array param deal_ids\n\tif err := r.SetQueryParam(\"deal_ids\", joinedDealIds...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Deleted != nil {\n\n\t\t// query param deleted\n\t\tvar qrDeleted bool\n\t\tif o.Deleted != nil {\n\t\t\tqrDeleted = *o.Deleted\n\t\t}\n\t\tqDeleted := swag.FormatBool(qrDeleted)\n\t\tif qDeleted != \"\" {\n\t\t\tif err := r.SetQueryParam(\"deleted\", qDeleted); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Featured != nil {\n\n\t\t// query param featured\n\t\tvar qrFeatured bool\n\t\tif o.Featured != nil {\n\t\t\tqrFeatured = *o.Featured\n\t\t}\n\t\tqFeatured := swag.FormatBool(qrFeatured)\n\t\tif qFeatured != \"\" {\n\t\t\tif err := r.SetQueryParam(\"featured\", qFeatured); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesFields := o.Fields\n\n\tjoinedFields := swag.JoinByFormat(valuesFields, \"csv\")\n\t// query array param fields\n\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int64\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt64(qrPerPage)\n\t\tif qPerPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RetailerID != nil {\n\n\t\t// query param retailer_id\n\t\tvar qrRetailerID int64\n\t\tif o.RetailerID != nil {\n\t\t\tqrRetailerID = *o.RetailerID\n\t\t}\n\t\tqRetailerID := swag.FormatInt64(qrRetailerID)\n\t\tif qRetailerID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"retailer_id\", qRetailerID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesSort := o.Sort\n\n\tjoinedSort := swag.JoinByFormat(valuesSort, \"csv\")\n\t// query array param sort\n\tif err := r.SetQueryParam(\"sort\", joinedSort...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.State != nil {\n\n\t\t// query param state\n\t\tvar qrState string\n\t\tif o.State != nil {\n\t\t\tqrState = *o.State\n\t\t}\n\t\tqState := qrState\n\t\tif qState != \"\" {\n\t\t\tif err := r.SetQueryParam(\"state\", qState); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesStatuses := o.Statuses\n\n\tjoinedStatuses := swag.JoinByFormat(valuesStatuses, \"csv\")\n\t// query array param statuses\n\tif err := r.SetQueryParam(\"statuses\", joinedStatuses...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.StoreID != nil {\n\n\t\t// query param store_id\n\t\tvar qrStoreID int64\n\t\tif o.StoreID != nil {\n\t\t\tqrStoreID = *o.StoreID\n\t\t}\n\t\tqStoreID := swag.FormatInt64(qrStoreID)\n\t\tif qStoreID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"store_id\", qStoreID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.UpdatedSince != nil {\n\n\t\t// query param updated_since\n\t\tvar qrUpdatedSince strfmt.DateTime\n\t\tif o.UpdatedSince != nil {\n\t\t\tqrUpdatedSince = *o.UpdatedSince\n\t\t}\n\t\tqUpdatedSince := qrUpdatedSince.String()\n\t\tif qUpdatedSince != \"\" {\n\t\t\tif err := r.SetQueryParam(\"updated_since\", qUpdatedSince); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8f708287d2fa2a7a330e43ce127a3eb", "score": "0.42236006", "text": "func (o *GetPrivateBuyParams) WithAdvanced(advanced *string) *GetPrivateBuyParams {\n\to.SetAdvanced(advanced)\n\treturn o\n}", "title": "" }, { "docid": "5765c5acaec6b78d36d5f54ab2b716bf", "score": "0.42120224", "text": "func (a Ascan) ExcludedParams() (map[string]interface{}, error) {\n\treturn a.c.Request(\"ascan/view/excludedParams/\", nil)\n}", "title": "" }, { "docid": "3234b6d8d923bb35c70f7f827bbe13d5", "score": "0.42105567", "text": "func NewPostTransactionFundingrequestsForbidden() *PostTransactionFundingrequestsForbidden {\n\treturn &PostTransactionFundingrequestsForbidden{}\n}", "title": "" }, { "docid": "3a558b56a61b3440091a14d2a4dc7a44", "score": "0.4193568", "text": "func NewGetDraftByIDUsingGETForbidden() *GetDraftByIDUsingGETForbidden {\n\treturn &GetDraftByIDUsingGETForbidden{}\n}", "title": "" }, { "docid": "1c4920ee117de63b3c9d72613b2ccdc0", "score": "0.41826966", "text": "func (a *UserApiService) PostPrivateUserMalpedia(ctx _context.Context) ApiPostPrivateUserMalpediaRequest {\n\treturn ApiPostPrivateUserMalpediaRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "979a87422714d6ec727e99d2455bdb38", "score": "0.4180193", "text": "func WithGetDisableWriteAuthAccess(opt *options.DisableWriteOption) Cmd {\n\tcmd := &writeCmd{\n\t\topt: opt,\n\t\tcmd: &Command{\n\t\t\tName: \"get-write-auth-access\",\n\t\t\tUsage: \"get write operations config\",\n\t\t\tFromURL: true,\n\t\t\tRun: func(kt *kit.Kit, params map[string]interface{}) (interface{}, error) {\n\t\t\t\tvar err error\n\t\t\t\tbizIDs := make([]uint32, 0)\n\n\t\t\t\topt.BizIDMap.Range(func(key, value interface{}) bool {\n\t\t\t\t\tbizID, ok := key.(uint32)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\terr = fmt.Errorf(\"biz id %+v is not integer\", key)\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tbizIDs = append(bizIDs, bizID)\n\t\t\t\t\treturn true\n\t\t\t\t})\n\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\treturn map[string]interface{}{\n\t\t\t\t\t\"is_disabled\": opt.IsDisabled,\n\t\t\t\t\t\"is_all\": opt.IsAll,\n\t\t\t\t\t\"biz_ids\": bizIDs,\n\t\t\t\t}, nil\n\t\t\t},\n\t\t},\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "d0f3989a28c0054f33320ac506b96636", "score": "0.41797698", "text": "func (c Cookie) HttpOnly() Cookie {\r\n\tc.c.HttpOnly = true\r\n\treturn c\r\n}", "title": "" }, { "docid": "109e75bfab4e2cbf56104322d1783d64", "score": "0.4178909", "text": "func NewPlaceOrderUsingPOSTForbidden() *PlaceOrderUsingPOSTForbidden {\n\treturn &PlaceOrderUsingPOSTForbidden{}\n}", "title": "" }, { "docid": "f196168f21a527f8f683f86c9957dd53", "score": "0.41631985", "text": "func (p *Poloniex) private(method string, params url.Values, retval interface{}) error {\r\n\tif p.debug {\r\n\t\tdefer un(trace(\"private: \" + method))\r\n\t}\r\n\r\n\tp.mutex.Lock()\r\n\tdefer p.mutex.Unlock()\r\n\tif params == nil {\r\n\t\tparams = url.Values{}\r\n\t}\r\n\tparams.Set(\"nonce\", p.getNonce())\r\n\tparams.Set(\"command\", method)\r\n\tpostData := params.Encode()\r\n\r\n\treq := goreq.Request{\r\n\t\tMethod: \"POST\",\r\n\t\tUri: PRIVATEURI,\r\n\t\tBody: postData,\r\n\t\tContentType: \"application/x-www-form-urlencoded\",\r\n\t\tAccept: \"application/json\",\r\n\t\tTimeout: 130 * time.Second,\r\n\t}\r\n\r\n\treq.AddHeader(\"Sign\", p.sign(postData))\r\n\treq.AddHeader(\"Key\", p.Key)\r\n\treq.AddHeader(\"Content-Length\", strconv.Itoa(len(postData)))\r\n\r\n\tres, err := req.Do()\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tdefer res.Body.Close()\r\n\r\n\ts, err := res.Body.ToString()\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tif p.debug {\r\n\t\tfmt.Println(s)\r\n\t}\r\n\r\n\tif strings.HasPrefix(s, \"[\") {\r\n\t\t// TODO: fix this shit\r\n\t\t// poloniex only ever returns an array type when there is no real data\r\n\t\t// e.g. no data in a time range\r\n\t\t// if this ever changes then this breaks badly\r\n\t\treturn nil\r\n\t}\r\n\r\n\t// do we have an error message from the server?\r\n\tperr := Error{}\r\n\terr = json.Unmarshal([]byte(s), &perr)\r\n\tif err == nil && perr.Error != \"\" {\r\n\t\t// looks like we have an error from poloniex\r\n\t\treturn fmt.Errorf(perr.Error)\r\n\t}\r\n\r\n\terr = json.Unmarshal([]byte(s), retval)\r\n\tif err != nil && retval == nil {\r\n\t\tlog.Println(err)\r\n\t\treturn err\r\n\t}\r\n\treturn err\r\n}", "title": "" }, { "docid": "aebff9c229a0e581c8bd28e17a0381f0", "score": "0.41628104", "text": "func NewItemOnlineMeetingsCreateOrGetPostRequestBody()(*ItemOnlineMeetingsCreateOrGetPostRequestBody) {\n m := &ItemOnlineMeetingsCreateOrGetPostRequestBody{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "b3b5f7f5dca28663ed4ee62a08722721", "score": "0.41627553", "text": "func (m *ItemItemsItemWorkbookFunctionsBinom_DistPostRequestBody) GetAdditionalData()(map[string]any) {\n val , err := m.backingStore.Get(\"additionalData\")\n if err != nil {\n panic(err)\n }\n if val == nil {\n var value = make(map[string]any);\n m.SetAdditionalData(value);\n }\n return val.(map[string]any)\n}", "title": "" }, { "docid": "ec361e93c78e306c05ff18c15af9f957", "score": "0.41479948", "text": "func (op *SignaturesCreateAccountSignaturesOp) DecodeOnly(val string) *SignaturesCreateAccountSignaturesOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"decode_only\", val)\n\t}\n\treturn op\n}", "title": "" }, { "docid": "e29f2fa820ebfe309a5940afb9bbd12e", "score": "0.4134936", "text": "func (ck *MaintenanceWindow) PostParams() map[string]string {\n\tparams := ck.PutParams()\n\n\tfor k, v := range params {\n\t\tif v == \"\" {\n\t\t\tdelete(params, k)\n\t\t}\n\t}\n\n\treturn params\n}", "title": "" }, { "docid": "3049747561e40589304ca42fd3decca3", "score": "0.41146326", "text": "func (o *GetPrivateSellParams) WithAdvanced(advanced *string) *GetPrivateSellParams {\n\to.SetAdvanced(advanced)\n\treturn o\n}", "title": "" }, { "docid": "e0b1d96496f29e70bfb022b6c557b75e", "score": "0.41056055", "text": "func (o *GetPrivateSellParams) SetReduceOnly(reduceOnly *bool) {\n\to.ReduceOnly = reduceOnly\n}", "title": "" }, { "docid": "d670871f3f51f21c28fc569344ea1223", "score": "0.41047132", "text": "func (m *ItemItemsItemWorkbookFunctionsAtan2PostRequestBody) GetAdditionalData()(map[string]any) {\n val , err := m.backingStore.Get(\"additionalData\")\n if err != nil {\n panic(err)\n }\n if val == nil {\n var value = make(map[string]any);\n m.SetAdditionalData(value);\n }\n return val.(map[string]any)\n}", "title": "" }, { "docid": "39c22949d714ae9348f4c1de9c058fa8", "score": "0.41022667", "text": "func NewPostSpendTxParams() *PostSpendTxParams {\n\tvar ()\n\treturn &PostSpendTxParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "0b3fd5b202b24ee1520cf7bda4e9266d", "score": "0.40902063", "text": "func (q *OperationsQ) OnlyPayments() *OperationsQ {\n\tq.sql = q.sql.Where(sq.Eq{\"hop.type\": []xdr.OperationType{\n\t\txdr.OperationTypeCreateAccount,\n\t\txdr.OperationTypePayment,\n\t\txdr.OperationTypePathPayment,\n\t\txdr.OperationTypeAccountMerge,\n\t}})\n\treturn q\n}", "title": "" }, { "docid": "e1cc9ae6579f4b27a4ffde49e806ab1b", "score": "0.40816256", "text": "func (c *BuyersGetCall) Fields(s ...googleapi.Field) *BuyersGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "ed5a98a8471d8a6045a25770f5c09542", "score": "0.4076944", "text": "func NewPublicGetUnpaidPaymentOrderParams() *PublicGetUnpaidPaymentOrderParams {\n\tvar ()\n\treturn &PublicGetUnpaidPaymentOrderParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "6c1c8cbdb2f169e3acc02b1e104ed9e9", "score": "0.4074568", "text": "func (r ApiGetSoftwarerepositoryAuthorizationListRequest) Skip(skip int32) ApiGetSoftwarerepositoryAuthorizationListRequest {\n\tr.skip = &skip\n\treturn r\n}", "title": "" }, { "docid": "e5fe1f770aef9715eb57676e3e482227", "score": "0.406564", "text": "func (rb *ByProjectKeyInStoreKeyByStoreKeyMeShoppingListsRequestBuilder) Post(body MyShoppingListDraft) *ByProjectKeyInStoreKeyByStoreKeyMeShoppingListsRequestMethodPost {\n\treturn &ByProjectKeyInStoreKeyByStoreKeyMeShoppingListsRequestMethodPost{\n\t\tbody: body,\n\t\turl: fmt.Sprintf(\"/%s/in-store/key=%s/me/shopping-lists\", rb.projectKey, rb.storeKey),\n\t\tclient: rb.client,\n\t}\n}", "title": "" }, { "docid": "22353ff56036856c59a7bc97c42a7914", "score": "0.4065031", "text": "func (api *APIClient) queryPrivate(method string, values url.Values) (interface{}, error) {\n\turlPath := fmt.Sprintf(\"/%s/private/%s\", Version, method)\n\treqURL := fmt.Sprintf(\"%s%s\", URL, urlPath)\n\tsecret, _ := base64.StdEncoding.DecodeString(api.secret)\n\tvalues.Set(\"nonce\", fmt.Sprintf(\"%d\", time.Now().UnixNano()))\n\tsignature := createSignature(urlPath, values, secret)\n\theaders := map[string]string{\n\t\t\"API-Key\": api.key,\n\t\t\"API-Sign\": signature,\n\t}\n\tresp, err := api.doRequest(reqURL, values, headers)\n\treturn resp, err\n}", "title": "" }, { "docid": "7645e6896b4be073c234ae37ea07992d", "score": "0.40636858", "text": "func NewGetOrderUsingGETForbidden() *GetOrderUsingGETForbidden {\n\treturn &GetOrderUsingGETForbidden{}\n}", "title": "" }, { "docid": "5194c8a275902dbb5e57e8bbbe220a21", "score": "0.40553826", "text": "func (c *Client) postWithoutCert(url string, params Params) (string, error) {\n\th := &http.Client{Timeout: c.httpTimeout}\n\tp := c.fillRequestData(params)\n\n\tlog.Printf(\"[Debug] Print all UnifiedOrder params: %v\\n\", p)\n\n\tresponse, err := h.Post(url, bodyType, strings.NewReader(MapToXml(p)))\n\tif err != nil {\n\t\tlog.Printf(\"Post to %s failed: %s\\n\", url, err.Error())\n\t\treturn \"\", errors.New(\"http.post failed.\")\n\t}\n\n\tdefer response.Body.Close()\n\n\tres, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Read response failed: %s\\n\", err.Error())\n\t\treturn \"\", errors.New(\"Read http response failed.\")\n\t}\n\n\treturn string(res), nil\n}", "title": "" }, { "docid": "0e7254b24f3c0f01a0611e656a40c13f", "score": "0.40532634", "text": "func (s *server) adminOnly(h http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tqs := r.URL.Query()\n\n\t\tif qs.Get(\"admin\") != \"true\" {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\n\t\th(w, r)\n\t}\n}", "title": "" }, { "docid": "552e00f07c9fbdf2c42566d529ab1c13", "score": "0.40529567", "text": "func NewGetDealsParams() *GetDealsParams {\n\tvar (\n\t\tallDefault bool = bool(false)\n\t\tdeletedDefault bool = bool(false)\n\t\tpageDefault int64 = int64(1)\n\t\tperPageDefault int64 = int64(25)\n\t\tsortDefault []string = []string{ \"featured desc\" }\n\t)\n\treturn &GetDealsParams{\n\t\tAll: &allDefault,\n\t\tDeleted: &deletedDefault,\n\t\tPage: &pageDefault,\n\t\tPerPage: &perPageDefault,\n\t\tSort: sortDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "0c13abf84d67f74330cf42e7505487d0", "score": "0.40421498", "text": "func NewGetSellerServicesUsingGETForbidden() *GetSellerServicesUsingGETForbidden {\n\treturn &GetSellerServicesUsingGETForbidden{}\n}", "title": "" }, { "docid": "a8110eb290be31006e6eda3d7fd3d8a0", "score": "0.40378365", "text": "func BumpGasPriceOnly(config Config, originalGasPrice *big.Int, originalGasLimit uint64) (gasPrice *big.Int, chainSpecificGasLimit uint64, err error) {\n\tgasPrice, err = bumpGasPrice(config, originalGasPrice)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\tchainSpecificGasLimit = applyMultiplier(originalGasLimit, config.EvmGasLimitMultiplier())\n\treturn\n}", "title": "" }, { "docid": "886c42e028abcd9e7c9ed9cc30bf924c", "score": "0.40276483", "text": "func (rb *ByProjectKeyInStoreKeyByStoreKeyMeShoppingListsKeyByKeyRequestBuilder) Post(body MyShoppingListUpdate) *ByProjectKeyInStoreKeyByStoreKeyMeShoppingListsKeyByKeyRequestMethodPost {\n\treturn &ByProjectKeyInStoreKeyByStoreKeyMeShoppingListsKeyByKeyRequestMethodPost{\n\t\tbody: body,\n\t\turl: fmt.Sprintf(\"/%s/in-store/key=%s/me/shopping-lists/key=%s\", rb.projectKey, rb.storeKey, rb.key),\n\t\tclient: rb.client,\n\t}\n}", "title": "" }, { "docid": "4e55fd4314860e52597a929e4e2fb8d2", "score": "0.40213466", "text": "func (c *MarketplaceprivateauctionUpdateproposalCall) Fields(s ...googleapi.Field) *MarketplaceprivateauctionUpdateproposalCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "97cf7c1dec1e068f496e05748e4efc95", "score": "0.40174803", "text": "func (m *ItemItemsItemWorkbookFunctionsDdbPostRequestBody) GetAdditionalData()(map[string]any) {\n val , err := m.backingStore.Get(\"additionalData\")\n if err != nil {\n panic(err)\n }\n if val == nil {\n var value = make(map[string]any);\n m.SetAdditionalData(value);\n }\n return val.(map[string]any)\n}", "title": "" }, { "docid": "2c64a91105eab18a059d285c88df7ffb", "score": "0.4011511", "text": "func NewSendOnlyNode(lggr logger.Logger, httpuri url.URL, name string, chainID *big.Int) SendOnlyNode {\n\ts := new(sendOnlyNode)\n\ts.name = name\n\ts.log = lggr.Named(\"SendOnlyNode\").Named(name).With(\n\t\t\"nodeTier\", \"sendonly\",\n\t)\n\ts.uri = httpuri\n\ts.chainID = chainID\n\ts.chStop = make(chan struct{})\n\treturn s\n}", "title": "" }, { "docid": "4694c4b8fe5c80db1f6e1789a6bb0ec4", "score": "0.4010297", "text": "func (e *Fcoin) ApiKeyPost(mapParams map[string]string, strRequestPath string) string {\n\tstrMethod := \"POST\"\n\ttimestamp := strconv.FormatInt(time.Now().UnixNano()/1e6, 10) //time.Now().UTC().Format(\"2006-01-02T15:04:05\")\n\n\t//Signature Request Params\n\tstrUrl := API_URL + strRequestPath\n\n\tjsonParams := \"\"\n\tbytesParams, err := json.Marshal(mapParams)\n\tif nil != mapParams {\n\t\tjsonParams = string(bytesParams)\n\t}\n\n\tvar strParams, strRequestUrl string\n\tif nil == mapParams {\n\t\tstrRequestUrl = strUrl\n\t} else {\n\t\tstrParams = Map2UrlQuery(mapParams)\n\t\tstrRequestUrl = strUrl //+ \"?\" + strParams\n\t}\n\n\t// signMessage + POST request data\n\tsignMessage := strMethod + strRequestUrl + timestamp + strParams //jsonParams\n\t//log.Printf(\"signMessage: %s\", signMessage) //====================================\n\tSignature := base64.StdEncoding.EncodeToString([]byte(signMessage))\n\tSignature1 := ComputeHmac1(Signature, e.API_SECRET)\n\n\t// -todo-\n\n\thttpClient := &http.Client{}\n\trequest, err := http.NewRequest(\"POST\", strUrl, strings.NewReader(jsonParams))\n\tif nil != err {\n\t\treturn err.Error()\n\t}\n\trequest.Header.Add(\"FC-ACCESS-KEY\", e.API_KEY)\n\trequest.Header.Add(\"FC-ACCESS-SIGNATURE\", Signature1)\n\trequest.Header.Add(\"FC-ACCESS-TIMESTAMP\", timestamp)\n\trequest.Header.Add(\"content-type\", \"application/json;charset=UTF-8\")\n\n\tresponse, err := httpClient.Do(request)\n\tif nil != err {\n\t\treturn err.Error()\n\t}\n\tdefer response.Body.Close()\n\n\tbody, err := ioutil.ReadAll(response.Body)\n\tif nil != err {\n\t\treturn err.Error()\n\t}\n\n\treturn string(body)\n}", "title": "" }, { "docid": "b5ba6cf6cb2f7c02a3101b284ccf6f0d", "score": "0.39939222", "text": "func (o *RetrieveLatestPoliciesByNamespaceAndCountryPublicParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param countryCode\n\tif err := r.SetPathParam(\"countryCode\", o.CountryCode); err != nil {\n\t\treturn err\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif o.AlwaysIncludeDefault != nil {\n\n\t\t// query param alwaysIncludeDefault\n\t\tvar qrAlwaysIncludeDefault bool\n\t\tif o.AlwaysIncludeDefault != nil {\n\t\t\tqrAlwaysIncludeDefault = *o.AlwaysIncludeDefault\n\t\t}\n\t\tqAlwaysIncludeDefault := swag.FormatBool(qrAlwaysIncludeDefault)\n\t\tif qAlwaysIncludeDefault != \"\" {\n\t\t\tif err := r.SetQueryParam(\"alwaysIncludeDefault\", qAlwaysIncludeDefault); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.DefaultOnEmpty != nil {\n\n\t\t// query param defaultOnEmpty\n\t\tvar qrDefaultOnEmpty bool\n\t\tif o.DefaultOnEmpty != nil {\n\t\t\tqrDefaultOnEmpty = *o.DefaultOnEmpty\n\t\t}\n\t\tqDefaultOnEmpty := swag.FormatBool(qrDefaultOnEmpty)\n\t\tif qDefaultOnEmpty != \"\" {\n\t\t\tif err := r.SetQueryParam(\"defaultOnEmpty\", qDefaultOnEmpty); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PolicyType != nil {\n\n\t\t// query param policyType\n\t\tvar qrPolicyType string\n\t\tif o.PolicyType != nil {\n\t\t\tqrPolicyType = *o.PolicyType\n\t\t}\n\t\tqPolicyType := qrPolicyType\n\t\tif qPolicyType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"policyType\", qPolicyType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Tags != nil {\n\n\t\t// query param tags\n\t\tvar qrTags string\n\t\tif o.Tags != nil {\n\t\t\tqrTags = *o.Tags\n\t\t}\n\t\tqTags := qrTags\n\t\tif qTags != \"\" {\n\t\t\tif err := r.SetQueryParam(\"tags\", qTags); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "318250f5d9ad8ddea61baaa61994a85d", "score": "0.3993316", "text": "func (c *TagBindingsCreateCall) ValidateOnly(validateOnly bool) *TagBindingsCreateCall {\n\tc.urlParams_.Set(\"validateOnly\", fmt.Sprint(validateOnly))\n\treturn c\n}", "title": "" }, { "docid": "0dea78b38d3d494af18e60c834683e41", "score": "0.39933133", "text": "func clientPost() *url.Values {\n\tq := &url.Values{\n\t\t\"id\": []string{\"23\"},\n\t\t\"holdthedoor\": []string{\"Submit\"},\n\t}\n\treturn q\n}", "title": "" }, { "docid": "8444a0916c12107d4c4e02d8e583c99f", "score": "0.3990785", "text": "func SubscriberBodyOnly(b bool) SubscriberOption {\n\treturn func(o *SubscriberOptions) {\n\t\to.BodyOnly = b\n\t}\n}", "title": "" }, { "docid": "9e24cfd461dd409a69dd964d353caa50", "score": "0.39901975", "text": "func (b UpdateBuilder) IfOnly(pred interface{}, rest ...interface{}) UpdateBuilder {\n\treturn builder.Append(b, \"IfOnlyParts\", newWherePart(pred, rest...)).(UpdateBuilder)\n}", "title": "" }, { "docid": "1837944dd0e39d706fae1d5be4e17c50", "score": "0.39855006", "text": "func Without(full, drop Postings) Postings {\n\tif full == EmptyPostings() {\n\t\treturn EmptyPostings()\n\t}\n\n\tif drop == EmptyPostings() {\n\t\treturn full\n\t}\n\treturn newRemovedPostings(full, drop)\n}", "title": "" }, { "docid": "cba99d91f5665c6bd4417cd7f35bc7f1", "score": "0.39831546", "text": "func (r ApiGetSoftwarerepositoryReleaseListRequest) Skip(skip int32) ApiGetSoftwarerepositoryReleaseListRequest {\n\tr.skip = &skip\n\treturn r\n}", "title": "" }, { "docid": "11d370f9d68d34b2216e395f833781f8", "score": "0.3978081", "text": "func (o *GetPrivateBuyParams) WithTimeout(timeout time.Duration) *GetPrivateBuyParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "ed9a16ea6e52b1f9d685c985a9710e71", "score": "0.39764878", "text": "func (o *GetPrivateBuyParams) WithHTTPClient(client *http.Client) *GetPrivateBuyParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "52e31422c2ad97b3b711cd3707c18a52", "score": "0.39752555", "text": "func (m *ItemItemsItemWorkbookFunctionsVdbPostRequestBody) GetAdditionalData()(map[string]any) {\n val , err := m.backingStore.Get(\"additionalData\")\n if err != nil {\n panic(err)\n }\n if val == nil {\n var value = make(map[string]any);\n m.SetAdditionalData(value);\n }\n return val.(map[string]any)\n}", "title": "" }, { "docid": "71bb55d59bd6ebc2403ff07a2a5ce5e2", "score": "0.39748687", "text": "func (o *CreatePolicyUsingPOSTParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Policy != nil {\n\t\tif err := r.SetBodyParam(o.Policy); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ValidationOnly != nil {\n\n\t\t// query param validationOnly\n\t\tvar qrValidationOnly bool\n\t\tif o.ValidationOnly != nil {\n\t\t\tqrValidationOnly = *o.ValidationOnly\n\t\t}\n\t\tqValidationOnly := swag.FormatBool(qrValidationOnly)\n\t\tif qValidationOnly != \"\" {\n\t\t\tif err := r.SetQueryParam(\"validationOnly\", qValidationOnly); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "31a937516ed04a8137216f4d98b3388c", "score": "0.39729872", "text": "func (o *GetSellerConnectionsUsingGETParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.MetroCode != nil {\n\n\t\t// query param metroCode\n\t\tvar qrMetroCode string\n\t\tif o.MetroCode != nil {\n\t\t\tqrMetroCode = *o.MetroCode\n\t\t}\n\t\tqMetroCode := qrMetroCode\n\t\tif qMetroCode != \"\" {\n\t\t\tif err := r.SetQueryParam(\"metroCode\", qMetroCode); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageNumber != nil {\n\n\t\t// query param pageNumber\n\t\tvar qrPageNumber int32\n\t\tif o.PageNumber != nil {\n\t\t\tqrPageNumber = *o.PageNumber\n\t\t}\n\t\tqPageNumber := swag.FormatInt32(qrPageNumber)\n\t\tif qPageNumber != \"\" {\n\t\t\tif err := r.SetQueryParam(\"pageNumber\", qPageNumber); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param pageSize\n\t\tvar qrPageSize int32\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt32(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"pageSize\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PortName != nil {\n\n\t\t// query param portName\n\t\tvar qrPortName string\n\t\tif o.PortName != nil {\n\t\t\tqrPortName = *o.PortName\n\t\t}\n\t\tqPortName := qrPortName\n\t\tif qPortName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"portName\", qPortName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ProfileID != nil {\n\n\t\t// query param profileId\n\t\tvar qrProfileID string\n\t\tif o.ProfileID != nil {\n\t\t\tqrProfileID = *o.ProfileID\n\t\t}\n\t\tqProfileID := qrProfileID\n\t\tif qProfileID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"profileId\", qProfileID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.State != nil {\n\n\t\t// query param state\n\t\tvar qrState string\n\t\tif o.State != nil {\n\t\t\tqrState = *o.State\n\t\t}\n\t\tqState := qrState\n\t\tif qState != \"\" {\n\t\t\tif err := r.SetQueryParam(\"state\", qState); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesStatus := o.Status\n\n\tjoinedStatus := swag.JoinByFormat(valuesStatus, \"multi\")\n\t// query array param status\n\tif err := r.SetQueryParam(\"status\", joinedStatus...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "edcccb20ca6af462a67ba9240fd103d2", "score": "0.3958294", "text": "func (p *Payment) GetParams() map[string]interface{} {\n\treturn p.params\n}", "title": "" }, { "docid": "4d0e23285ea76e909db892e6578f2501", "score": "0.39527315", "text": "func NewGetAllUsingGETForbidden() *GetAllUsingGETForbidden {\n\treturn &GetAllUsingGETForbidden{}\n}", "title": "" }, { "docid": "135e1cb93b70235453184b4df2089167", "score": "0.39510188", "text": "func NewGetPaymentMethodForbidden() *GetPaymentMethodForbidden {\n\treturn &GetPaymentMethodForbidden{}\n}", "title": "" }, { "docid": "3c4ffb8cc926889bed00f9ad2fa4964a", "score": "0.39507607", "text": "func (a *UniswapV2Pair) Permit(owner web3.Address, spender web3.Address, value *big.Int, deadline *big.Int, v uint8, r [32]byte, s [32]byte) *contract.Txn {\n\treturn a.c.Txn(\"permit\", owner, spender, value, deadline, v, r, s)\n}", "title": "" }, { "docid": "c2a40f3dcd14418a04761195c8275b09", "score": "0.394555", "text": "func LeaveOnly[M ~map[K]V, K comparable, V any](items M, keys ...K) {\n\tskip := make(map[K]struct{})\n\tfor _, key := range keys {\n\t\tskip[key] = struct{}{}\n\t}\n\tfor key := range items {\n\t\t_, contains := skip[key]\n\t\tif !contains {\n\t\t\tdelete(items, key)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f5b0f80f3d578f8a65c398e3e29afa4a", "score": "0.39235544", "text": "func Test_walletService_PostPayment(t *testing.T) {\n\ttype fields struct {\n\t\tmodel ModelMock\n\t}\n\ttype args struct {\n\t\tctx context.Context\n\t\tp Payment\n\t}\n\n\ttests := []struct {\n\t\tname string\n\t\tfields fields\n\t\targs args\n\t\twantErr bool\n\t}{\n\t\t{\"check valid\", fields{model: ModelMock{}}, args{p: Payment{FromAccount: \"bob123\", Amount: 0.05, ToAccount: \"alice456\"}}, false},\n\t\t{\"check valid\", fields{model: ModelMock{}}, args{p: Payment{FromAccount: \"\", Amount: 0.05, ToAccount: \"alice456\"}}, true},\n\t\t{\"check valid\", fields{model: ModelMock{}}, args{p: Payment{FromAccount: \"John789\", Amount: -5, ToAccount: \"alice456\"}}, true},\n\t\t{\"check valid\", fields{model: ModelMock{}}, args{p: Payment{FromAccount: \"John789\", Amount: 50, ToAccount: \"\"}}, true},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ts := &walletService{\n\t\t\t\tmodel: tt.fields.model,\n\t\t\t}\n\t\t\tif err := s.PostPayment(tt.args.ctx, tt.args.p); (err != nil) != tt.wantErr {\n\t\t\t\tt.Errorf(\"walletService.PostPayment() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "464f7a0e815bdf5f3e4de543ef203fe8", "score": "0.39228243", "text": "func formpostRandomParams(t *testing.T) url.Values {\n\tt.Helper()\n\tgenerator := &hmac.HMACStrategy{Config: newTestHMACStrategyConfigurator(testlib.RandBytes(t, 32), 32)}\n\tauthCode, _, err := generator.Generate(context.Background())\n\trequire.NoError(t, err)\n\treturn url.Values{\n\t\t\"code\": []string{authCode},\n\t\t\"scope\": []string{\"openid offline_access pinniped:request-audience\"},\n\t\t\"state\": []string{testlib.RandHex(t, 16)},\n\t}\n}", "title": "" }, { "docid": "222ff9b6b9a87e1a9c460af8d03454a6", "score": "0.39196685", "text": "func (r ApiCreateSoftwarerepositoryReleaseRequest) IfNoneMatch(ifNoneMatch string) ApiCreateSoftwarerepositoryReleaseRequest {\n\tr.ifNoneMatch = &ifNoneMatch\n\treturn r\n}", "title": "" }, { "docid": "721564462781b9893fb05268eb8055ca", "score": "0.3916857", "text": "func NewGetAllDirectoriesUsingPOSTForbidden() *GetAllDirectoriesUsingPOSTForbidden {\n\treturn &GetAllDirectoriesUsingPOSTForbidden{}\n}", "title": "" }, { "docid": "931036106d3d72b9d0eda6a9b759e437", "score": "0.39162663", "text": "func NewPurgeDataPostRequestBody()(*PurgeDataPostRequestBody) {\n m := &PurgeDataPostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "title": "" }, { "docid": "df1a6ec777e632f73272b2357a507c45", "score": "0.3913911", "text": "func WithDirect(p bool) Option {\n\treturn func(o *opts) {\n\t\to.direct = p\n\t}\n}", "title": "" }, { "docid": "e7467cde34882089ec652b74cd0e0c48", "score": "0.39105022", "text": "func (o SpringCloudAppOutput) HttpsOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *SpringCloudApp) pulumi.BoolPtrOutput { return v.HttpsOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "eefb5e984e0ca1ef5a2aadd68b7e131b", "score": "0.3909302", "text": "func (gateway *PddGateway) FullParams() map[string]string {\n\tallParams := make(map[string]string, len(gateway.RequestParam))\n\tfor key, val := range gateway.RequestParam {\n\t\tif len(val) != 0 && val[0] != \"\" {\n\t\t\tallParams[key] = val[0]\n\t\t}\n\t}\n\tdelete(allParams, fieldSign)\n\treturn allParams\n}", "title": "" }, { "docid": "3111308c153d179df4ad80ec7fee3a1b", "score": "0.39092505", "text": "func WithSkipper(skipper clevergo.Skipper) Option {\n\treturn func(a *authorization) {\n\t\ta.skipper = skipper\n\t}\n}", "title": "" }, { "docid": "afe13adab28a723db4af60194a60589a", "score": "0.3907893", "text": "func (self *Client) post(endpoint string, getParams url.Values, postParams url.Values, data interface{}) error {\n\treturn self.request(\"POST\", endpoint, getParams, postParams, nil, data)\n}", "title": "" }, { "docid": "306c8ede26185cef0615d7d4699ebd71", "score": "0.38963786", "text": "func (m *ItemItemsItemWorkbookFunctionsMatchPostRequestBody) GetAdditionalData()(map[string]any) {\n val , err := m.backingStore.Get(\"additionalData\")\n if err != nil {\n panic(err)\n }\n if val == nil {\n var value = make(map[string]any);\n m.SetAdditionalData(value);\n }\n return val.(map[string]any)\n}", "title": "" }, { "docid": "b0b466eccb073da0672784ae2e0c9e91", "score": "0.3893695", "text": "func NewAddCopyPostRequestBody()(*AddCopyPostRequestBody) {\n m := &AddCopyPostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "title": "" }, { "docid": "c8bed5d6495b94eb2a4ab7ed2337b6a3", "score": "0.38896078", "text": "func Post(c *gin.Context) {\n\t// get the use key id\n\tvar kid string\n\tif tmp, ok := c.Get(\"kid\"); ok {\n\t\tkid = fmt.Sprintf(\"%s\", tmp)\n\t}\n\t// call to order must be identified\n\tif len(kid) == 0 {\n\t\tlog.Errorf(\"recieved an order from an unidentified user\")\n\t\tproblem.Unauthorized(c)\n\t\treturn\n\t}\n\turl := location.Get(c).String()\n\tstore, err := objectstore.Get(c)\n\tif err != nil {\n\t\tlog.Errorf(\"cannot rretrieve store: %s\", err)\n\t\tproblem.ServerInternal(c)\n\t\treturn\n\t}\n\t// check the id of the request\n\tid := strings.Trim(c.Param(\"id\"), \"/\")\n\tif len(id) > 0 {\n\t\t// post as get\n\t\torder, err := store.GetOrder(id, fmt.Sprintf(\"%s/%s\", url, ep.AuthzPath))\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"cannot retrieve order: %s\", err)\n\t\t\tproblem.ServerInternal(c)\n\t\t\treturn\n\t\t}\n\t\tif order != nil {\n\t\t\t// send the response\n\t\t\tlog.Infof(\"returning order from id\")\n\t\t\tlog.Infof(\"order: %s\", order.String())\n\t\t\tc.Header(\"Link\", fmt.Sprintf(\"<%s%s>;rel=\\\"index\\\"\", url, ep.DirectoryPath))\n\t\t\tc.JSON(http.StatusOK, order)\n\t\t\treturn\n\t\t}\n\t\torders, err := store.GetOrderByAccount(id)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"cannot retrieve store: %s\", err)\n\t\t\tproblem.ServerInternal(c)\n\t\t\treturn\n\t\t}\n\t\tif orders != nil {\n\t\t\t// send the response\n\t\t\tlog.Infof(\"returning order from account\")\n\t\t\tc.Header(\"Link\", fmt.Sprintf(\"<%s%s>;rel=\\\"index\\\"\", url, ep.DirectoryPath))\n\t\t\tc.JSON(http.StatusOK, orders)\n\t\t\treturn\n\t\t}\n\t\tlog.Info(\"no order found for user or order %s\", id)\n\t\tc.Status(http.StatusNotFound)\n\t\treturn\n\t}\n\t// create a new order\n\tvar payload string\n\tif tmp, ok := c.Get(\"payload\"); ok {\n\t\tpayload = fmt.Sprintf(\"%s\", tmp)\n\t}\n\tif len(payload) == 0 {\n\t\tlog.Errorf(\"recieved an empty order request\")\n\t\tproblem.Malformed(c)\n\t\treturn\n\t}\n\torder := &objects.Order{}\n\terr = json.Unmarshal([]byte(payload), order)\n\tif err != nil {\n\t\tlog.Errorf(\"cannot unmarshal order\")\n\t\tproblem.Malformed(c)\n\t\treturn\n\t}\n\torder.ID = utils.ID()\n\torder.KeyID = kid\n\tlog.Infof(\"recieved order %s from %s: %s\", order.ID, order.KeyID, payload)\n\t// set basic properties\n\torder.Status = \"pending\"\n\texpires := time.Now().Add(time.Minute * DefaultDurationMinutes)\n\torder.Expires = &expires\n\trejected, unsupported, err := store.CreateOrder(order, fmt.Sprintf(\"%s%s\", url, ep.AuthzPath), fmt.Sprintf(\"%s%s\", url, ep.ChallengePath), fmt.Sprintf(\"%s%s\", url, ep.CsrPath))\n\tif unsupported != nil {\n\t\tlog.Errorf(\"unsupported order: %s\", unsupported)\n\t\tproblem.UnsupportedIdentifier(c)\n\t\treturn\n\t}\n\tif rejected != nil {\n\t\tlog.Errorf(\"rejected order: %s\", rejected)\n\t\tproblem.RejectedIdentifier(c)\n\t\treturn\n\t}\n\tif err != nil {\n\t\tlog.Errorf(\"error creating order: %s\", err)\n\t\tproblem.ServerInternal(c)\n\t\treturn\n\t}\n\tjsonorder, _ := json.Marshal(order)\n\tlog.Infof(\"created order: %s\", jsonorder)\n\t//set headers\n\tc.Header(\"Link\", fmt.Sprintf(\"<%s%s>;rel=\\\"index\\\"\", url, ep.DirectoryPath))\n\tc.Header(\"Location\", fmt.Sprintf(\"%s%s/%s\", url, ep.OrderPath, order.ID))\n\tc.JSON(http.StatusCreated, order)\n\treturn\n}", "title": "" }, { "docid": "14d15e9c35279107fd759b83499c2c1d", "score": "0.3888678", "text": "func KeysOnly(keysOnly bool) Option {\n\treturn objectstorage.KeysOnly(keysOnly)\n}", "title": "" } ]
7eb2e8a543171df7039a74f762f812b6
IsNotNull checks if the current condition field is not null
[ { "docid": "e0b1a9e41487cf9f9d39b290a331971e", "score": "0.636264", "text": "func (c pBoolConditionField) IsNotNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNotNull(),\n\t}\n}", "title": "" } ]
[ { "docid": "6bf249e3405b6975375619947e60d1ea", "score": "0.6920657", "text": "func (c pMCurrencyRateSetConditionField) IsNotNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNotNull(),\n\t}\n}", "title": "" }, { "docid": "e0f5f84026f6052a6158c5facb3bb5eb", "score": "0.673946", "text": "func (c pDatesDateTimeConditionField) IsNotNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNotNull(),\n\t}\n}", "title": "" }, { "docid": "3a4d18e589713032b9a5490a783d7c03", "score": "0.669004", "text": "func (c pIntConditionField) IsNotNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNotNull(),\n\t}\n}", "title": "" }, { "docid": "fca3359845a290f8cf2040f01e4ca55f", "score": "0.6600545", "text": "func (c pFloat64ConditionField) IsNotNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNotNull(),\n\t}\n}", "title": "" }, { "docid": "efd3dd01b81b5e3c7ea587c99f30fa2a", "score": "0.6589166", "text": "func (c pDatesDateConditionField) IsNotNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNotNull(),\n\t}\n}", "title": "" }, { "docid": "e051a3e3dc03f573e15b75892a7e67d6", "score": "0.6440684", "text": "func (c pStringConditionField) IsNotNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNotNull(),\n\t}\n}", "title": "" }, { "docid": "0a401a8bda8234a6fee587c91b61511c", "score": "0.63819087", "text": "func (c pInt64ConditionField) IsNotNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNotNull(),\n\t}\n}", "title": "" }, { "docid": "3e65736fdafbc370bc7966e36e01b517", "score": "0.6051016", "text": "func (c pMCurrencyRateSetConditionField) IsNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNull(),\n\t}\n}", "title": "" }, { "docid": "e55205d97005ae6e05b2b35315ddc6a6", "score": "0.5929122", "text": "func (c pDatesDateTimeConditionField) IsNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNull(),\n\t}\n}", "title": "" }, { "docid": "ee0094da086996b104901f2f00b619f8", "score": "0.5903544", "text": "func (c pFloat64ConditionField) IsNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNull(),\n\t}\n}", "title": "" }, { "docid": "5cd0890ea547676a896067e8f6ade97c", "score": "0.589679", "text": "func (c pIntConditionField) IsNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNull(),\n\t}\n}", "title": "" }, { "docid": "2a832e8f7ea1969d636d5f4c8262221d", "score": "0.57806605", "text": "func IsNotNull(name string) Clause {\n\tif name == \"\" {\n\t\treturn nil\n\t}\n\treturn &SingleClause{Name: name, Op: OpIsNotNull}\n}", "title": "" }, { "docid": "634b918d83ea844f9a175a700e64a6cd", "score": "0.57197696", "text": "func (c pDatesDateConditionField) IsNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNull(),\n\t}\n}", "title": "" }, { "docid": "6bf6dfde141a08d6049a5a3b134c9be3", "score": "0.56830055", "text": "func (c pBoolConditionField) IsNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNull(),\n\t}\n}", "title": "" }, { "docid": "81d4878dbc0a4fb11a1f2de5f076347a", "score": "0.56512773", "text": "func (c pStringConditionField) IsNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNull(),\n\t}\n}", "title": "" }, { "docid": "55d6adbbf24aedae6f796abf344de2de", "score": "0.56383467", "text": "func (c pInt64ConditionField) IsNull() Condition {\n\treturn Condition{\n\t\tCondition: c.ConditionField.IsNull(),\n\t}\n}", "title": "" }, { "docid": "f73ad93f421e58d1f49108c0a4fe895a", "score": "0.5572908", "text": "func (v *LogMessageParams) IsNil() bool { return v == nil }", "title": "" }, { "docid": "1c94821a20a42dba040b334167bcb08f", "score": "0.5535742", "text": "func (q *QueryFilter) IsNil() bool {\n\tif q == nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "310467305310313c4961e7cce83067d5", "score": "0.55271226", "text": "func (f JSONField) IsNotNull() Predicate {\n\treturn CustomPredicate{\n\t\tFormat: \"? IS NOT NULL\",\n\t\tValues: []interface{}{f},\n\t}\n}", "title": "" }, { "docid": "a6a977a3da571706d6e71812e47e9909", "score": "0.54370695", "text": "func isCondition(v interface{}) bool {\n\tswitch v.(type) {\n\tcase Condition:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c4071722e2215331cc31b6cb567ffea0", "score": "0.5432798", "text": "func (f UUIDField) IsNotNull() Predicate {\n\treturn CustomPredicate{\n\t\tFormat: \"? IS NOT NULL\",\n\t\tValues: []interface{}{f},\n\t}\n}", "title": "" }, { "docid": "fa1ed60dd9177951077a7c933cfae8b7", "score": "0.5362587", "text": "func (v *ShowMessageRequestParams) IsNil() bool { return v == nil }", "title": "" }, { "docid": "8e9aeec0b78ef5e4580865f9566780b0", "score": "0.53268516", "text": "func (p Products) RequiredNotNull() bool {\n\tif p.Nama == \"\" ||\n\t\t p.Stok < 0 ||\n\t\t p.Harga < 0 ||\n\t\t p.CategoriesID < 0 {\n\t\t\t return false\n\t\t }\n\treturn true\n}", "title": "" }, { "docid": "2af2d29b12c987bba903ee2e727b426e", "score": "0.5307923", "text": "func (not CondNot) IsValid() bool {\n\treturn not[0] != nil && not[0].IsValid()\n}", "title": "" }, { "docid": "89b886239077638df5328580d68c7553", "score": "0.52840805", "text": "func (o EnterpriseCrmEventbusProtoTriggerCriteriaPtrOutput) Condition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *EnterpriseCrmEventbusProtoTriggerCriteria) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Condition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "977954bf0776f0d5b45177161d9a3f80", "score": "0.5231745", "text": "func IsNotNull(operand *api.Expression) *api.Expression {\n\treturn &api.Expression{\n\t\tType: api.Expression_IS_NOT_NULL,\n\t\tExpr: &api.Expression_UnaryOp{\n\t\t\tUnaryOp: operand,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "138c45106e14abe8a60d4505ff66ed0f", "score": "0.5218964", "text": "func (v *ShowMessageParams) IsNil() bool { return v == nil }", "title": "" }, { "docid": "ebf289159a0007ddd3a10ec75a129e7c", "score": "0.5200438", "text": "func checkCondition(vmctx exec.VMContext, channel *PaymentChannel) error {\n\tif channel.Condition == nil {\n\t\treturn nil\n\t}\n\n\t_, _, err := vmctx.Send(channel.Condition.To, channel.Condition.Method, types.ZeroAttoFIL, channel.Condition.Params)\n\tif err != nil {\n\t\tif errors.IsFault(err) {\n\t\t\treturn err\n\t\t}\n\t\treturn errors.NewCodedRevertErrorf(ErrConditionInvalid, \"failed to validate voucher condition: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6984350bd5b68762ab42d03721e79ecc", "score": "0.5179308", "text": "func IsNotNull(column string) string {\n\treturn column + \" IS NOT NULL\"\n}", "title": "" }, { "docid": "9380e795d91a277867e3b97267233457", "score": "0.5167869", "text": "func IsNotNull(operand *api.Expression) *api.Expression {\n\treturn newUnaryExpr(api.Expression_IS_NOT_NULL, operand)\n}", "title": "" }, { "docid": "efaf5b076d1f9d33fe67e1b4cfac12d2", "score": "0.515905", "text": "func (e Evaluator) Condition(c query.Condition) bool {\n\tif c == nil {\n\t\treturn false\n\t}\n\n\tlogic := c.Type()\n\trules := c.Rules()\n\tconditions := c.Conditions()\n\n\tif len(rules) == 0 && len(conditions) == 0 {\n\t\treturn true\n\t}\n\n\tfor _, rule := range rules {\n\t\tif e.Rule(rule) {\n\t\t\t// TRUE\n\t\t\tif logic == query.Or {\n\t\t\t\t// At least one rule is true\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else {\n\t\t\t// FALSE\n\t\t\tif logic == query.And {\n\t\t\t\t// At least one rule is false\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, condition := range conditions {\n\t\tif e.Condition(condition) {\n\t\t\t// TRUE\n\t\t\tif logic == query.Or {\n\t\t\t\t// At least one condition is true\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else {\n\t\t\t// FALSE\n\t\t\tif logic == query.And {\n\t\t\t\t// At least one condition is false\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\treturn logic != query.Or\n}", "title": "" }, { "docid": "f002570c50d40aada786000b5bbc5aa3", "score": "0.50832987", "text": "func (e BooleanElement) IsNil() bool {\n\treturn e.v == nil\n}", "title": "" }, { "docid": "6cdabfbbc9000a526b172a0e83dd4ffb", "score": "0.50358444", "text": "func (v *Var) IsNil() bool {\n\treturn v.Val() == nil\n}", "title": "" }, { "docid": "33ae1a957c1e00006299c3b674453ec7", "score": "0.5027581", "text": "func (t *ComparisonType) NeedsRHS() bool {\n\tif t == nil {\n\t\treturn false\n\t}\n\n\tif t == nil {\n\t\treturn true\n\t}\n\n\treturn (*t) != IsNotNull || *t != IsNull\n}", "title": "" }, { "docid": "8382a57e32d0748ba97ad31a3edba56c", "score": "0.49926776", "text": "func CtimeIsNil() predicate.Logger {\n\treturn predicate.Logger(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldCtime)))\n\t})\n}", "title": "" }, { "docid": "e91b3cf71d1c8917351fdc8f0b979baa", "score": "0.49871972", "text": "func (e DayTimeIntervalElement) IsNil() bool {\n\treturn e.v == nil\n}", "title": "" }, { "docid": "0744ffe09603e38a6704007080afaad9", "score": "0.49784982", "text": "func IsValidCondition(condition string) bool {\n\tswitch condition {\n\tcase greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, isEqual:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b532310e3cf2e843c921c9b1f747e114", "score": "0.4963046", "text": "func (v Value) IsNil() bool {\n\treturn v.v == nil\n}", "title": "" }, { "docid": "691e175e16c4f0dbf2cf220afe293eb0", "score": "0.49624917", "text": "func (c *compiledStatement) validateCondition(expr influxql.Expr) error {\n\tswitch expr := expr.(type) {\n\tcase *influxql.BinaryExpr:\n\t\t// Verify each side of the binary expression. We do not need to\n\t\t// verify the binary expression itself since that should have been\n\t\t// done by influxql.ConditionExpr.\n\t\tif err := c.validateCondition(expr.LHS); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := c.validateCondition(expr.RHS); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\tcase *influxql.Call:\n\t\tif !isMathFunction(expr) {\n\t\t\treturn fmt.Errorf(\"invalid function call in condition: %s\", expr)\n\t\t}\n\t\tif exp, got := 1, len(expr.Args); exp != got {\n\t\t\treturn fmt.Errorf(\"invalid number of arguments for %s, expected %d, got %d\", expr.Name, exp, got)\n\t\t}\n\t\treturn c.validateCondition(expr.Args[0])\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "bac3ef17d53f45138e1668803c448d37", "score": "0.49527493", "text": "func IsNotNull(column string) dbr.Builder {\n\treturn dbr.BuildFunc(func(d dbr.Dialect, buf dbr.Buffer) error {\n\t\tbuf.WriteString(d.QuoteIdent(column))\n\t\tbuf.WriteString(\" \")\n\t\tbuf.WriteString(\"IS NOT NULL\")\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "3953a09c3d34d276b10c7a9bd416fdcb", "score": "0.49416244", "text": "func IsNotNull() *Comparison {\n\treturn &Comparison{adapter.NewComparisonOperator(adapter.ComparisonOperatorIsNot, nil)}\n}", "title": "" }, { "docid": "a21ce8021a02c5a39afb49e055710dff", "score": "0.4928279", "text": "func IsNull(t querypb.Type) bool {\n\treturn t == Null\n}", "title": "" }, { "docid": "7781e57147976c80c24d11112c3893a5", "score": "0.49205053", "text": "func IsNil() Predicate {\n\treturn func(snap *ZFSSnapshot) bool {\n\t\treturn snap.IsNil()\n\t}\n}", "title": "" }, { "docid": "09732bc88863e35166e17209dfba2db3", "score": "0.4899229", "text": "func (o GoogleIamV1BindingOutput) Condition() GoogleTypeExprPtrOutput {\n\treturn o.ApplyT(func(v GoogleIamV1Binding) *GoogleTypeExpr { return v.Condition }).(GoogleTypeExprPtrOutput)\n}", "title": "" }, { "docid": "3c79b03d308fd3c789e5c26a2155775d", "score": "0.48849586", "text": "func (plan *QueryPlan) NotNull(fieldPtr interface{}) interfaces.WhereQuery {\n\treturn plan.Filter(filters.NotNull(fieldPtr))\n}", "title": "" }, { "docid": "42db870b212195d9d81932382c06f1ea", "score": "0.48779407", "text": "func checkCondition(children []*Node, arity int) error {\n\tif len(children) != arity {\n\t\treturn fmt.Errorf(\"bad arity for operation (have %v, want %v)\", len(children), arity)\n\t}\n\n\treturn checkForNil(children)\n}", "title": "" }, { "docid": "fe4df3ce14d8e26556536fa1929236ed", "score": "0.48666543", "text": "func impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:106159:12: */\n\n\tif ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0) {\n\t\treturn WRC_Prune\n\t}\n\tswitch int32((*Expr)(unsafe.Pointer(pExpr)).Fop) {\n\tcase TK_ISNOT:\n\t\tfallthrough\n\tcase TK_ISNULL:\n\t\tfallthrough\n\tcase TK_NOTNULL:\n\t\tfallthrough\n\tcase TK_IS:\n\t\tfallthrough\n\tcase TK_OR:\n\t\tfallthrough\n\tcase TK_VECTOR:\n\t\tfallthrough\n\tcase TK_CASE:\n\t\tfallthrough\n\tcase TK_IN:\n\t\tfallthrough\n\tcase TK_FUNCTION:\n\t\tfallthrough\n\tcase TK_TRUTH:\n\n\t\treturn WRC_Prune\n\tcase TK_COLUMN:\n\t\tif *(*int32)(unsafe.Pointer(pWalker + 40 /* &.u */)) == (*Expr)(unsafe.Pointer(pExpr)).FiTable {\n\t\t\t(*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(1)\n\t\t\treturn WRC_Abort\n\t\t}\n\t\treturn WRC_Prune\n\n\tcase TK_AND:\n\t\tif int32((*Walker)(unsafe.Pointer(pWalker)).FeCode) == 0 {\n\t\t\tXsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)\n\t\t\tif (*Walker)(unsafe.Pointer(pWalker)).FeCode != 0 {\n\t\t\t\t(*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(0)\n\t\t\t\tXsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpRight)\n\t\t\t}\n\t\t}\n\t\treturn WRC_Prune\n\n\tcase TK_BETWEEN:\n\t\tif Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) == WRC_Abort {\n\n\t\t\treturn WRC_Abort\n\t\t}\n\t\treturn WRC_Prune\n\n\t// Virtual tables are allowed to use constraints like x=NULL. So\n\t// a term of the form x=y does not prove that y is not null if x\n\t// is the column of a virtual table\n\tcase TK_EQ:\n\t\tfallthrough\n\tcase TK_NE:\n\t\tfallthrough\n\tcase TK_LT:\n\t\tfallthrough\n\tcase TK_LE:\n\t\tfallthrough\n\tcase TK_GT:\n\t\tfallthrough\n\tcase TK_GE:\n\t\t{\n\t\t\tvar pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft\n\t\t\tvar pRight uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpRight\n\n\t\t\t// The y.pTab=0 assignment in wherecode.c always happens after the\n\t\t\t// impliesNotNullRow() test\n\t\t\tif (((int32((*Expr)(unsafe.Pointer(pLeft)).Fop) == TK_COLUMN) && (*(*uintptr)(unsafe.Pointer(pLeft + 64 /* &.y */)) != uintptr(0))) &&\n\t\t\t\t((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 64 /* &.y */)))).FnModuleArg != 0)) ||\n\t\t\t\t(((int32((*Expr)(unsafe.Pointer(pRight)).Fop) == TK_COLUMN) && (*(*uintptr)(unsafe.Pointer(pRight + 64 /* &.y */)) != uintptr(0))) &&\n\t\t\t\t\t((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRight + 64 /* &.y */)))).FnModuleArg != 0)) {\n\t\t\t\treturn WRC_Prune\n\t\t\t}\n\n\t\t}\n\t\tfallthrough\n\tdefault:\n\t\treturn WRC_Continue\n\t}\n\treturn int32(0)\n}", "title": "" }, { "docid": "f262259b495e3435eba221b12ecaff4d", "score": "0.48571923", "text": "func (wnfq *WithNilFieldsQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := wnfq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn wnfq.sqlExist(ctx)\n}", "title": "" }, { "docid": "0662d41aad9ada46fa09851420e8aac8", "score": "0.48543924", "text": "func (s *BaseDart2Listener) EnterIfNullExpression(ctx *IfNullExpressionContext) {}", "title": "" }, { "docid": "9bcf4ea8b37c3fd27ea4cc0da2188a77", "score": "0.48399064", "text": "func CtimeNotNil() predicate.Logger {\n\treturn predicate.Logger(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldCtime)))\n\t})\n}", "title": "" }, { "docid": "660b5ae788487c91451a1025ba5f876e", "score": "0.48354524", "text": "func IsValidCondition(condition string) bool {\n\tswitch condition {\n\tcase ConditionGreaterThan, ConditionGreaterThanOrEqual, ConditionLessThan, ConditionLessThanOrEqual, ConditionIsEqual:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0f1155e888d09cbe45124e618d1adcc9", "score": "0.48269874", "text": "func (s *VitessKeyspaceStatus) getCondition(ty VitessKeyspaceConditionType) (value *VitessKeyspaceCondition, exists bool) {\n\tfor i := range s.Conditions {\n\t\tcondition := &s.Conditions[i]\n\t\tif condition.Type == ty {\n\t\t\treturn condition, true\n\t\t}\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "0364fa54c2826e27728a4e077fb6a935", "score": "0.48244613", "text": "func IsNil(val interface{}) bool {\n\treturn val == nil\n}", "title": "" }, { "docid": "ac4aa697025fcf05eb1786a3a10e2514", "score": "0.4821751", "text": "func (f JSONField) IsNull() Predicate {\n\treturn CustomPredicate{\n\t\tFormat: \"? IS NULL\",\n\t\tValues: []interface{}{f},\n\t}\n}", "title": "" }, { "docid": "763e6bf379402d6369426b13e678c48f", "score": "0.4818547", "text": "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "title": "" }, { "docid": "763e6bf379402d6369426b13e678c48f", "score": "0.4818547", "text": "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "title": "" }, { "docid": "763e6bf379402d6369426b13e678c48f", "score": "0.4818547", "text": "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "title": "" }, { "docid": "763e6bf379402d6369426b13e678c48f", "score": "0.4818547", "text": "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "title": "" }, { "docid": "763e6bf379402d6369426b13e678c48f", "score": "0.4818547", "text": "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "title": "" }, { "docid": "763e6bf379402d6369426b13e678c48f", "score": "0.4818547", "text": "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "title": "" }, { "docid": "763e6bf379402d6369426b13e678c48f", "score": "0.4818547", "text": "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "title": "" }, { "docid": "4d451f3531dbeee8c48620068c6fa204", "score": "0.48157373", "text": "func setConditionField(call reflect.Value, name string, value interface{}) bool {\n\tm := call.MethodByName(name)\n\tif !m.IsValid() {\n\t\treturn false\n\t}\n\tm.Call([]reflect.Value{reflect.ValueOf(value)})\n\treturn true\n}", "title": "" }, { "docid": "3c5450cc9b5ed6c628c1fc40a8680c84", "score": "0.48144847", "text": "func (m *ProjectModel) Condition(builder query.SQLBuilder) *ProjectModel {\n\tmm := m.clone()\n\tmm.query = mm.query.Merge(builder)\n\n\treturn mm\n}", "title": "" }, { "docid": "956cddddf10d2d70af740317ac83bb3b", "score": "0.47915414", "text": "func (q *Q) Condition(condition bool, m matrix.Matrix, qb ...Qubit) *Q {\n\tif condition {\n\t\treturn q.Apply(m, qb...)\n\t}\n\n\treturn q\n}", "title": "" }, { "docid": "e30998c62398050bae6172703b1183d7", "score": "0.4783246", "text": "func (e TimestampElement) IsNil() bool {\n\treturn e.v == nil\n}", "title": "" }, { "docid": "248cad5367fb23653e6958873d25cf81", "score": "0.47677281", "text": "func isSetNullAction(tls *libc.TLS, pParse uintptr, pFKey uintptr) int32 { /* sqlite3.c:121551:12: */\n\tvar pTop uintptr = func() uintptr {\n\t\tif (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 {\n\t\t\treturn (*Parse)(unsafe.Pointer(pParse)).FpToplevel\n\t\t}\n\t\treturn pParse\n\t}()\n\tif (*Parse)(unsafe.Pointer(pTop)).FpTriggerPrg != 0 {\n\t\tvar p uintptr = (*TriggerPrg)(unsafe.Pointer((*Parse)(unsafe.Pointer(pTop)).FpTriggerPrg)).FpTrigger\n\t\tif ((p == *(*uintptr)(unsafe.Pointer((pFKey + 48 /* &.apTrigger */)))) && (int32(*(*U8)(unsafe.Pointer((pFKey + 45 /* &.aAction */)))) == OE_SetNull)) ||\n\t\t\t((p == *(*uintptr)(unsafe.Pointer((pFKey + 48 /* &.apTrigger */) + 1*8))) && (int32(*(*U8)(unsafe.Pointer((pFKey + 45 /* &.aAction */) + 1))) == OE_SetNull)) {\n\t\t\treturn 1\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "8507285d25e853ec1cfdc4c2694144d2", "score": "0.47649416", "text": "func StatusGenIsNil() predicate.Pointkycrv {\n\treturn predicate.Pointkycrv(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldStatusGen)))\n\t})\n}", "title": "" }, { "docid": "4c217d82acae2ef3bcdf9f99111b6625", "score": "0.47643077", "text": "func (ab *ActiveBranchFunc) IsNullable() bool {\n\treturn false\n}", "title": "" }, { "docid": "2bdf164dea8ac0749ba6de2c83c8a581", "score": "0.47515255", "text": "func nilIsNil(msg *rt.AsyncMsg) {\n\treturnTrue(msg)\n}", "title": "" }, { "docid": "ef693dbcf0b6be919828c2469cbcff69", "score": "0.47500774", "text": "func NewCondition() *Condition {\n\tvar condition Condition\n\treturn &condition\n}", "title": "" }, { "docid": "b6d022e0d6a7fa1cf4e3bfb5a8c91dd5", "score": "0.47443134", "text": "func (ss *InferenceServiceStatus) IsConditionReady(t apis.ConditionType) bool {\n\treturn conditionSet.Manage(ss).GetCondition(t) != nil && conditionSet.Manage(ss).GetCondition(t).Status == v1.ConditionTrue\n}", "title": "" }, { "docid": "1085acb96df131400b39e5190f08987c", "score": "0.47370175", "text": "func (r *GetEvalRuleResponse) IsEmptyConditionException() bool {\n\treturn r.ConditionException == nil\n}", "title": "" }, { "docid": "c623bfe08dcb659e9cc34fa94a4443c2", "score": "0.47337693", "text": "func assertIsNil(err error) {\n\tif AssertionsAreFatal && err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "21a035dd79ba2a150c05c8c42dce0d91", "score": "0.47323263", "text": "func (s *Statement) Condition(operator string, property string, value ...string) *Statement {\n\ts.filters = append(s.filters, func(v interface{}) bool {\n\t\tstatement := convert(v)\n\t\tif statement == nil {\n\t\t\treturn false\n\t\t}\n\t\tfor _, c := range statement.Condition {\n\t\t\tshared.Debugf(\"operator: %s == %s -> %t\\nproperty: %s == %s -> %t\\nvalue: %v == %v\\n\",\n\t\t\t\toperator, c.Operator, operator == c.Operator,\n\t\t\t\tproperty, c.Property, property == c.Property,\n\t\t\t\tvalue, c.Value)\n\n\t\t\tif operator == c.Operator &&\n\t\t\t\tproperty == c.Property &&\n\t\t\t\tshared.StringSliceEqual(value, c.Value) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n\treturn s\n}", "title": "" }, { "docid": "6d99e48e781d4cba91b035b0c5f45633", "score": "0.4728899", "text": "func (p *provider) IsNull() bool {\n\treturn p == nil || p.Stack == nil\n}", "title": "" }, { "docid": "6d99e48e781d4cba91b035b0c5f45633", "score": "0.4728899", "text": "func (p *provider) IsNull() bool {\n\treturn p == nil || p.Stack == nil\n}", "title": "" }, { "docid": "d2643f591bc9aee8660c01676a332ea5", "score": "0.47282687", "text": "func (this *assertion) IsBlank() {\n\tthis.t.Helper()\n\tthis.so(this.actual, should.BeBlank)\n}", "title": "" }, { "docid": "232ca369c8f840da7b43a63f1a550c6f", "score": "0.47278783", "text": "func NullBoolValue(n sql.NullBool,) (driver.Value, error)", "title": "" }, { "docid": "988bf889bdba4a534d6c33fa2ac54966", "score": "0.47257078", "text": "func (pm *PrimeMeridian) HandleIsNil () bool {\n return (*pm).pj == (*C.PJ)(nil)\n}", "title": "" }, { "docid": "2bb4acf2f76a2804acf48a2f1287ab55", "score": "0.47186813", "text": "func (x *fastReflection_MsgUpdateDateCriteria) IsValid() bool {\n\treturn x != nil\n}", "title": "" }, { "docid": "0d4309eab5a5d483352d6b1474f77590", "score": "0.47054347", "text": "func (s *ClusterState) IsNull() bool {\n\treturn s == nil || (s.StateCollectInterval <= 0)\n}", "title": "" }, { "docid": "302a2c8ff06433e2ddfee588c027c360", "score": "0.47033116", "text": "func (ba *BasicObject) SetConditionNew() {\n\tba.Condition = 0\n}", "title": "" }, { "docid": "077202a8351aa497f347522eea7db062", "score": "0.47031218", "text": "func ConditionExpr(cond Expr, valuer Valuer) (Expr, TimeRange, error) {\n\texpr, tr, err := conditionExpr(cond, valuer)\n\tif e, ok := expr.(*BooleanLiteral); ok && e.Val {\n\t\t// If the condition is true, return nil instead to indicate there\n\t\t// is no condition.\n\t\texpr = nil\n\t}\n\treturn expr, tr, err\n}", "title": "" }, { "docid": "f9875178c95e4616031dfee3d093e2dc", "score": "0.4699639", "text": "func IsNil(i interface{}) bool {\n\treturn i == nil || reflect.ValueOf(i).IsNil()\n}", "title": "" }, { "docid": "88403a107ec53770099109b09dc0d8c8", "score": "0.46971104", "text": "func (e MonthIntervalElement) IsNil() bool {\n\treturn e.v == nil\n}", "title": "" }, { "docid": "892f29287848eeabd7fbbf98c43619d5", "score": "0.46967757", "text": "func (o EnterpriseCrmEventbusProtoNextTaskOutput) Condition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmEventbusProtoNextTask) *string { return v.Condition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "93d06c12aea5ba42f439f49af2da59b9", "score": "0.46955988", "text": "func TypeIsNil() predicate.Pointkycrv {\n\treturn predicate.Pointkycrv(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldType)))\n\t})\n}", "title": "" }, { "docid": "3c691adb85b316608e7a22563e873b70", "score": "0.4674769", "text": "func (f UUIDField) IsNull() Predicate {\n\treturn CustomPredicate{\n\t\tFormat: \"? IS NULL\",\n\t\tValues: []interface{}{f},\n\t}\n}", "title": "" }, { "docid": "2216c4b036287615f02bb3a9f14e8bb1", "score": "0.46707332", "text": "func (r *Result) IsNil() bool {\n\t// ideally this should be implemented like this\n\t// emptyResult := Result{}\n\t// return reflect.DeepEqual(r, &emptyResult)\n\t//\n\t// but unfortunately, the empty Result coming from the explorer already have some fields set\n\t// (like the type)\n\t// so instead we gonna check the Data and the Created filed\n\n\treturn r.State == \"\" && r.Created == 0 && (len(r.Data) == 0 || bytes.Equal(r.Data, nullRaw))\n}", "title": "" }, { "docid": "f171e2fa4056717aa9961dc0b459f78f", "score": "0.46635395", "text": "func (v Variables) IsNull() bool {\n\treturn v == nil\n}", "title": "" }, { "docid": "1e68f3b8c67fa1fa907d7ef2fd1c77ee", "score": "0.46621755", "text": "func (d *Dynamic) IsBlank() bool {\n\treturn d.Schema.IsBlank() && d.Object.IsBlank()\n}", "title": "" }, { "docid": "b85911654d1641bee4e083ad7b349822", "score": "0.4659136", "text": "func (o EnterpriseCrmEventbusProtoTriggerCriteriaOutput) Condition() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmEventbusProtoTriggerCriteria) string { return v.Condition }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2ef6a4b7f85f139d03ba718654273db4", "score": "0.46582073", "text": "func ProvinceNameTHIsNil() predicate.Configarea {\n\treturn predicate.Configarea(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldProvinceNameTH)))\n\t})\n}", "title": "" }, { "docid": "4f76df60617fdec63965db748a8f4d70", "score": "0.46556222", "text": "func (o GoogleCloudIntegrationsV1alphaNextTaskOutput) Condition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudIntegrationsV1alphaNextTask) *string { return v.Condition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e7dc6c59716060548771b810e7612211", "score": "0.4655414", "text": "func (e Time32Element) IsNil() bool {\n\treturn e.v == nil\n}", "title": "" }, { "docid": "9cc63c64b00a1046d6271bd939ec766a", "score": "0.46544293", "text": "func (e DurationElement) IsNil() bool {\n\treturn e.v == nil\n}", "title": "" }, { "docid": "1cb2e0a366a638008f4a2b6d37a9d7e0", "score": "0.46441764", "text": "func PointIsNil() predicate.Pointkycrv {\n\treturn predicate.Pointkycrv(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldPoint)))\n\t})\n}", "title": "" }, { "docid": "fb1627bcc7f990af1d5c92e9f892e86d", "score": "0.46337384", "text": "func StatusGenNotNil() predicate.Pointkycrv {\n\treturn predicate.Pointkycrv(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldStatusGen)))\n\t})\n}", "title": "" }, { "docid": "894b48ec004c66e45fc9bf57068a509e", "score": "0.46297783", "text": "func (o CaPoolIamMemberOutput) Condition() CaPoolIamMemberConditionPtrOutput {\n\treturn o.ApplyT(func(v *CaPoolIamMember) CaPoolIamMemberConditionPtrOutput { return v.Condition }).(CaPoolIamMemberConditionPtrOutput)\n}", "title": "" }, { "docid": "a4695b38e74e7109f1805c4b9be8d916", "score": "0.46291447", "text": "func (ss *PaddleServiceStatus) GetCondition(t apis.ConditionType) *apis.Condition {\n\treturn conditionSet.Manage(ss).GetCondition(t)\n}", "title": "" } ]
699873f0ffcc73c021cd1b090b27b1b6
DecipherStream decrypts a stream of data with XTEA.
[ { "docid": "7a508f84adc75df134db87d8f959c896", "score": "0.6745764", "text": "func DecipherStream(key Key, r io.Reader, w io.Writer) error {\n\tbuf := [8]byte{}\n\n\tfor {\n\t\tn, err := r.Read(buf[:])\n\t\tif err == io.EOF {\n\t\t\tif n != 0 {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t} else if n != 8 {\n\t\t\treturn io.ErrUnexpectedEOF\n\t\t}\n\n\t\tDecryptBlock(key, buf[:])\n\t\tn, err = w.Write(buf[:])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t} else if n != 8 {\n\t\t\treturn io.ErrShortWrite\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "c329248e0791ebd620e7035c5f0e74b5", "score": "0.72253567", "text": "func decryptStream(input io.Reader, output io.Writer, crypto DecryptionStrategy) {\n\tpayload, err := ioutil.ReadAll(input)\n\tcheck(err, \"Failed to read encrypted data from standard input\")\n\tresult := string(payload)\n\n\tenvelopes := extractEnvelopes(string(payload))\n\tif len(envelopes) > 0 {\n\t\tfor _, envelope := range envelopes {\n\t\t\tplaintext, err := crypto.Decrypt(stripWhitespace(envelope))\n\t\t\tcheck(err)\n\n\t\t\tresult = strings.Replace(result, envelope, string(plaintext), 1)\n\t\t}\n\t}\n\n\toutput.Write([]byte(result))\n}", "title": "" }, { "docid": "2db3d6d50ba8585328a34af24367d4e1", "score": "0.6855526", "text": "func decryptStream(key string, iv []byte) (cipher.Stream, error) {\n\tblock, err := newCipherBlock(key)\n\tif err != nil {\n\t\tlog.Println(\"Failed to generate cipher block:\", err)\n\t\treturn nil, err\n\t}\n\treturn cipher.NewCFBDecrypter(block, iv), nil\n}", "title": "" }, { "docid": "dfa1345ab897d416280e333cecb08f2a", "score": "0.67844075", "text": "func NewDecryptStream(versionValidator VersionValidator, r io.Reader, keyring Keyring) (mki *MessageKeyInfo, plaintext io.Reader, err error) {\n\tds := &decryptStream{\n\t\tversionValidator: versionValidator,\n\t\tring: keyring,\n\t\tmps: newMsgpackStream(r),\n\t}\n\n\terr = ds.readHeader(r)\n\tif err != nil {\n\t\treturn &ds.mki, nil, err\n\t}\n\n\treturn &ds.mki, newChunkReader(ds), nil\n}", "title": "" }, { "docid": "2b8641f53bfdb13b4abb38291e233178", "score": "0.5943453", "text": "func NewDearmor62VerifyStream(versionValidator VersionValidator, r io.Reader, keyring SigKeyring) (skey SigningPublicKey, vs io.Reader, frame Frame, err error) {\n\tdearmored, frame, err := NewArmor62DecoderStream(r)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\tskey, vs, err = NewVerifyStream(versionValidator, dearmored, keyring)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\treturn skey, vs, frame, nil\n}", "title": "" }, { "docid": "7ccff0f41e2db70f277b30ab1d7f7a0a", "score": "0.5826135", "text": "func (cs *ChaChaStream) Decrypt(data []byte) []byte {\n\tret := make([]byte, len(data))\n\tcs.cipher.XORKeyStream(ret, data)\n\treturn ret\n}", "title": "" }, { "docid": "07d5de127248dc96437b42e4047c13b2", "score": "0.5484723", "text": "func decodeStream(sd *StreamDict) error {\n\n\tlog.Trace.Printf(\"decodeStream begin \\n%s\\n\", sd)\n\n\tif sd.Content != nil {\n\t\t// This stream has already been decoded.\n\t\treturn nil\n\t}\n\n\t// No filter specified, nothing to decode.\n\tif sd.FilterPipeline == nil {\n\t\tsd.Content = sd.Raw\n\t\tlog.Trace.Printf(\"decodedStream returning %d(#%02x)bytes: \\n%s\\n\", len(sd.Content), len(sd.Content), hex.Dump(sd.Content))\n\t\treturn nil\n\t}\n\n\tvar b io.Reader\n\tb = bytes.NewReader(sd.Raw)\n\n\t//fmt.Printf(\"decodedStream before:\\n%s\\n\", hex.Dump(sd.Raw))\n\n\tvar c *bytes.Buffer\n\n\t// Apply each filter in the pipeline to result of preceding filter.\n\tfor _, f := range sd.FilterPipeline {\n\n\t\tif f.DecodeParms != nil {\n\t\t\tlog.Trace.Printf(\"decodeStream: decoding filter:%s\\ndecodeParms:%s\\n\", f.Name, f.DecodeParms)\n\t\t} else {\n\t\t\tlog.Trace.Printf(\"decodeStream: decoding filter:%s\\n\", f.Name)\n\t\t}\n\n\t\t// make parms map[string]int\n\t\tparms := parmsForFilter(f.DecodeParms)\n\n\t\tif f.Name == filter.CCITTFax {\n\t\t\t// x/image/ccitt needs the optional decode parameter \"Rows\"\n\t\t\t// if not available we supply the image \"Height\".\n\t\t\t_, ok := parms[\"Rows\"]\n\t\t\tif !ok {\n\t\t\t\tip := sd.IntEntry(\"Height\")\n\t\t\t\tif ip == nil {\n\t\t\t\t\treturn errors.New(\"pdfcpu: ccitt: \\\"Height\\\" required\")\n\t\t\t\t}\n\t\t\t\tparms[\"Rows\"] = *ip\n\t\t\t}\n\t\t}\n\n\t\tfi, err := filter.NewFilter(f.Name, parms)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc, err = fi.Decode(b)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t//fmt.Printf(\"decodedStream after:%s\\n%s\\n\", f.Name, hex.Dump(c.Bytes()))\n\n\t\tb = c\n\t}\n\n\tsd.Content = c.Bytes()\n\n\tlog.Trace.Printf(\"decodedStream returning %d(#%02x)bytes: \\n%s\\n\", len(sd.Content), len(sd.Content), hex.Dump(c.Bytes()))\n\n\t//log.Trace.Printf(\"decodeStream end\")\n\n\treturn nil\n}", "title": "" }, { "docid": "751347bef595654b99c0236884a05e30", "score": "0.53800356", "text": "func DesDecryption(key, iv, cipherText []byte) ([]byte, error) {\n\n\tblock, err := des.NewCipher(key)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblockMode := cipher.NewCBCDecrypter(block, iv)\n\torigData := make([]byte, len(cipherText))\n\tblockMode.CryptBlocks(origData, cipherText)\n\torigData = PKCS5UnPadding(origData)\n\treturn origData, nil\n}", "title": "" }, { "docid": "b0cf442b015d6e97a59eabde10443e04", "score": "0.5356177", "text": "func Decrypt(input []byte, keystring string) ([]byte, error) {\n\tif input == nil {\n\t\treturn nil, errors.New(\"error while decrypt info: input is nil\")\n\t}\n\n\tif keystring == \"\" {\n\t\treturn nil, errors.New(\"error while decrypt info: keystring is empty\")\n\t}\n\n\t// Key\n\tkey := []byte(keystring)\n\n\t// Create the AES cipher\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, errors.New(\"error while encrypt file: can't crate AES cipher - \" + err.Error())\n\t}\n\n\t// Before even testing the decryption,\n\t// if the text is too small, then it is incorrect\n\tif len(input) < aes.BlockSize {\n\t\treturn nil, errors.New(\"error while encrypt data: data is too short\")\n\t}\n\n\t// Get the 16 byte IV\n\tiv := input[:aes.BlockSize]\n\n\t// Remove the IV from the ciphertext\n\tinput = input[aes.BlockSize:]\n\n\t// Return a decrypted stream\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\t// Decrypt bytes from ciphertext\n\tstream.XORKeyStream(input, input)\n\n\treturn input, nil\n}", "title": "" }, { "docid": "38a89fbeb35072b655de16997ad07997", "score": "0.5353107", "text": "func Decrypt(block cipher.Block, value []byte) []byte {\n\tsize := block.BlockSize()\n\tif len(value) > size {\n\t\t// Extract iv.\n\t\tiv := value[:size]\n\t\t// Extract ciphertext.\n\t\tvalue = value[size:]\n\t\t// Decrypt it.\n\t\tstream := cipher.NewCTR(block, iv)\n\t\tstream.XORKeyStream(value, value)\n\t\treturn value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b882d4c4fc07fa74fc34c99519af67c6", "score": "0.530282", "text": "func NewStreamDecryptor(alg string, key, nonce []byte) (*StreamDecryptor, error) {\n\taead, err := NewAEAD(alg, key, streamExtendedNonceSize)\n\tif err != nil {\n\t\treturn nil, err\n\n\t}\n\n\tnonceEncoder, err := newNonceEncoder32(nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &StreamDecryptor{a: aead, n: nonceEncoder}, nil\n}", "title": "" }, { "docid": "72c56b95a0aa2e49324659c4167672ee", "score": "0.52784127", "text": "func Decrypt(reader io.Reader, secertKeyring openpgp.EntityList) (io.ReadCloser, error) {\n\tmd, err := openpgp.ReadMessage(reader, secertKeyring, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gzip.NewReader(md.UnverifiedBody)\n}", "title": "" }, { "docid": "6bd98dc2eb4c3502b3ea8ecc14b0cb55", "score": "0.5272921", "text": "func DecodeBytesStream(input io.Reader, key []byte) (*io.PipeReader, error) {\n\treturn decodeStream(\n\t\tinput, bytesKey(key), 2, getByteDefs)\n}", "title": "" }, { "docid": "ad6216caf45564ea4b0165a9d5767ae1", "score": "0.5260621", "text": "func (c *Crypter) Decrypt(dst io.Writer, src io.Reader) (err error) {\n\tkeySize := c.Key.Size()\n\theaderSize := 1 + keySize + blockSize + c.HashSize\n\n\theader := make([]byte, headerSize)\n\tif _, err = src.Read(header); err != nil {\n\t\treturn err\n\t}\n\n\tsalt, iv, err := c.decHeader(header)\n\tif err != nil {\n\t\treturn err\n\t}\n\taesKey, hmacKey := c.Key.Derive(salt)\n\n\tmac := hmac.New(c.HashFunc, hmacKey)\n\tmac.Write(header[:1+keySize+blockSize])\n\n\tif !bytes.Equal(header[1+keySize+blockSize:], mac.Sum(nil)) {\n\t\treturn errors.New(\"cannot authenticate header\")\n\t}\n\tmac.Write(header[1+keySize+blockSize:])\n\n\tblock, err := aes.NewCipher(aesKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstream := cipher.NewCTR(block, iv)\n\tbuf := make([]byte, c.bufSize()+c.HashSize)\n\tn := 0\n\tfor {\n\t\tn, err = src.Read(buf)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\tstream.XORKeyStream(buf[:n-c.HashSize], buf[:n-c.HashSize])\n\t\tmac.Write(buf[:n-c.HashSize])\n\t\tif !bytes.Equal(buf[n-c.HashSize:n], mac.Sum(nil)) {\n\t\t\treturn errors.New(\"cannot authenticate packet\")\n\t\t}\n\t\tif _, err = dst.Write(buf[:n-c.HashSize]); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d7f4c70300ac6a7f115e4769ee67407", "score": "0.52318364", "text": "func (session *encryptionSession) decrypt(data []byte) {\n\tfor i, b := range data {\n\t\tcipherFeedback := cipher.NewCFBDecrypter(session.cipherBlock, session.decryptIV)\n\t\tcipherFeedback.XORKeyStream(data[i:i+1], data[i:i+1])\n\t\tsession.decryptIV = append(session.decryptIV[1:], b)\n\t}\n}", "title": "" }, { "docid": "b67a812c7628624e440ec9516c108930", "score": "0.5213249", "text": "func (o FlowSourceOutput) Decryption() FlowSourceEncryptionPtrOutput {\n\treturn o.ApplyT(func(v *FlowSource) FlowSourceEncryptionPtrOutput { return v.Decryption }).(FlowSourceEncryptionPtrOutput)\n}", "title": "" }, { "docid": "5a92d66512f46bfd71a13b58a8f438f5", "score": "0.51458466", "text": "func Decrypt(a cipher.AEAD, data, ad []byte) ([]byte, error) {\n\tif len(data) <= a.NonceSize() {\n\t\treturn nil, fmt.Errorf(\"cryptutil: invalid input size: %d\", len(data))\n\t}\n\tsize := len(data) - a.NonceSize()\n\tciphertext := data[:size]\n\tnonce := data[size:]\n\tplaintext, err := a.Open(nil, nonce, ciphertext, ad)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cryptutil: decryption failed (mismatched keys?): %w\", err)\n\t}\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "70e434e5bd0acaf15a888acf36118510", "score": "0.51385915", "text": "func DecryptData(password string, data io.Reader) ([]byte, error) {\n\tvar (\n\t\tsalt [32]byte\n\t\tid [1]byte\n\t\tnonce [8]byte // This depends on the AEAD but both used ciphers have the same nonce length.\n\t)\n\n\tif _, err := io.ReadFull(data, salt[:]); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := io.ReadFull(data, id[:]); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := io.ReadFull(data, nonce[:]); err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey := argon2.IDKey([]byte(password), salt[:], 1, 64*1024, 4, 32)\n\tcipher, err := parseAEAD(id[0], key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstream := sio.NewStream(cipher, sio.BufSize)\n\treturn ioutil.ReadAll(stream.DecryptReader(data, nonce[:], nil))\n}", "title": "" }, { "docid": "5b61740ac14ed9ba177a7f21c540ddf4", "score": "0.5122829", "text": "func Decrypt(crypted []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(aeskey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblockSize := block.BlockSize()\n\tblockMode := cipher.NewCBCDecrypter(block, aeskey[:blockSize])\n\torigData := make([]byte, len(crypted))\n\tblockMode.CryptBlocks(origData, crypted)\n\torigData = _PKCS5UnPadding(origData)\n\treturn origData, nil\n}", "title": "" }, { "docid": "2d65d879ecf2f8b5cfe7a4961e72c040", "score": "0.51209277", "text": "func Decrypt(key, cipherHex string) (string, error) {\n\tblock, err := newCipherBlock(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tciphertext, err := hex.DecodeString(cipherHex)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(ciphertext) < aes.BlockSize {\n\t\treturn \"\", errors.New(\"encrypt: cipher too short\")\n\t}\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := getNewCFBDecrypter(block, iv)\n\n\t// XORKeyStream can work in-place if the two arguments are the same.\n\txorKeyStream(stream, ciphertext, ciphertext)\n\treturn string(ciphertext), nil\n}", "title": "" }, { "docid": "5fe25838a646cc7bff72a6b5beaa8e0b", "score": "0.50792456", "text": "func Decrypt(key, cipherHex string) (string, error){\n\tcipherText, err := hex.DecodeString(cipherHex)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(cipherText) < aes.BlockSize {\n\t\treturn \"\", errors.New(\"cipher: cipher too short\")\n\t}\n\tiv := cipherText[:aes.BlockSize]\n\tcipherText = cipherText[aes.BlockSize:]\n\n\tstream, err := decryptStream(key, iv)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tstream.XORKeyStream(cipherText, cipherText)\n\n\treturn string(cipherText), nil\n}", "title": "" }, { "docid": "a1b0dde4c48c9ad674f693351994bb1b", "score": "0.50714403", "text": "func Decrypt(keybytes []byte, infile string, inkeyfile string, outfile string) error {\n\n\t// decode PEM encoding to ANS.1 PKCS1 DER\n\tblock, _ := pem.Decode(keybytes)\n\tif block == nil {\n\t\treturn errors.New(\"Private key file not PEM-encoded\")\n\t}\n\tif block.Type != \"RSA PRIVATE KEY\" {\n\t\treturn errors.New(\"Unsupported key type\")\n\t}\n\n\t// decode the RSA private key\n\tprivkey, err := x509.ParsePKCS1PrivateKey(block.Bytes)\n\n\t// read the encrypted input key file\n\tinkeybytes, err := ioutil.ReadFile(inkeyfile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to read input key file. %s\", err)\n\t}\n\n\t// decrypt the input AES key\n\tlabel := []byte(\"\")\n\tinkey, err := rsa.DecryptOAEP(sha1.New(), rand.Reader, privkey, inkeybytes, label)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to decrypt AES key. %s\", err)\n\t}\n\n\t// read the encrypted input file\n\tinfilebytes, err := ioutil.ReadFile(infile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to read input file. %s\", err)\n\t}\n\n\t// decrypt\n\tdecipher, err := decrypt(infilebytes, inkey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to decrypt. %s\", err)\n\t}\n\n\t// write to output file\n\terr = ioutil.WriteFile(outfile, decipher, 0600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to write to output file. %s\", err)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "65fd51b5e2749d70f3b2da0cb441d9bb", "score": "0.5065535", "text": "func DecodeStream(reader io.Reader, dispatcher MsgDispatcher) error {\n\tfor {\n\t\tmsg, err := Decode(reader)\n\t\tif err == io.EOF {\n\t\t\treturn nil\n\t\t}\n\t\tif err == nil {\n\t\t\terr = dispatcher.DispatchMsg(&msg)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn IgnoreClosingErr(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f7c77dafc006aee64acd86e20b55c8bf", "score": "0.50621104", "text": "func Decrypter(key, data, encType string) (string, error) {\n\tc1 := exec.Command(\"echo\", data)\n\tc2 := exec.Command(\"openssl\", encType, \"-a\", \"-d\", \"-salt\", \"-k\", key)\n\treturn pipingExec(c1, c2)\n}", "title": "" }, { "docid": "0cea2bd77a33f81b34062c1257db0a31", "score": "0.5061069", "text": "func (symmetric *Symmetric) Decrypt(data []byte) ([]byte, error) {\n\tplaintext, err := symmetric.aead.Open(nil, symmetric.Nonce[:], data, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error decrypting message %v\", err)\n\t}\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "5945d1014a57bf7682f056f440bc77ed", "score": "0.5054217", "text": "func (AESEncryptor) Decode(sd *SourceData) error {\n\tsd.Data = aesDecrypt(sd.Data, sd.Secret)\n\treturn nil\n}", "title": "" }, { "docid": "df67509d36ed7c5fae453269fdb71411", "score": "0.50367993", "text": "func aesDecryptData(key string, ciphertext []byte) ([]byte, error) {\n\tcipherkey := []byte(key)\n\n\tblock, err := aes.NewCipher(cipherkey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsrc := make([]byte, hex.DecodedLen(len(ciphertext)))\n\t_, err = hex.Decode(src, ciphertext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbs := block.BlockSize()\n\tr := make([]byte, len(src))\n\tdst := r\n\tfor len(src) > 0 {\n\t\tblock.Decrypt(dst, src)\n\t\tsrc = src[bs:]\n\t\tdst = dst[bs:]\n\t}\n\treturn removePad(r)\n}", "title": "" }, { "docid": "67a18ff8e9e77d77750a09b352e9a586", "score": "0.5035194", "text": "func (c *Cipher) decrypt(data []byte) {\n\tkey := &c.key\n\tfor i := 0; i < 24; i += 8 {\n\t\ty := uint32(data[i])<<24 | uint32(data[i+1])<<16 | uint32(data[i+2])<<8 | uint32(data[i+3])\n\t\tz := uint32(data[i+4])<<24 | uint32(data[i+5])<<16 | uint32(data[i+6])<<8 | uint32(data[i+7])\n\n\t\t// Decipher the block\n\t\tsum := xteaSum\n\t\tfor r := 0; r < xteaRounds; r++ {\n\t\t\tz -= (((y << 4) ^ (y >> 5)) + y) ^ (sum + key[(sum>>11)&3])\n\t\t\tsum -= xteaDelta\n\t\t\ty -= (((z << 4) ^ (z >> 5)) + z) ^ (sum + key[sum&3])\n\t\t}\n\n\t\t// Set to the current block\n\t\tdata[i] = (byte)(y >> 24)\n\t\tdata[i+1] = (byte)(y >> 16)\n\t\tdata[i+2] = (byte)(y >> 8)\n\t\tdata[i+3] = (byte)(y)\n\t\tdata[i+4] = (byte)(z >> 24)\n\t\tdata[i+5] = (byte)(z >> 16)\n\t\tdata[i+6] = (byte)(z >> 8)\n\t\tdata[i+7] = (byte)(z)\n\t}\n}", "title": "" }, { "docid": "5707dc8aedc768b18965b0edc4372ad7", "score": "0.50150776", "text": "func (a *AESEncoder) Decode(src []byte) ([]byte, error) {\n\t// First things first decode hex text to ciphertext\n\tciphertext := make([]byte, hex.DecodedLen(len(src)))\n\thex.Decode(ciphertext, src)\n\n\tblock, err := aes.NewCipher(LQ_CIPHER_KEY)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tif len(ciphertext) < aes.BlockSize {\n\t\treturn nil, errors.New(\"ciphertext too short\")\n\t}\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\t// XORKeyStream can work in-place if the two arguments are the same.\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "b2aee2df9dfe0e8ae9ec5fcab5d3865d", "score": "0.50029", "text": "func (s *pwSession) Decrypt(_ []byte) error { return nil }", "title": "" }, { "docid": "52b1e3eb571565ce613ebe5b86e562db", "score": "0.49648482", "text": "func Decrypt(key, id string, r io.Reader) (er io.Reader, err error) {\n\t// Get encrypt key via HMAC-SHA-256 based PBKDF2 algo.\n\tdk := pbkdf2.Key([]byte(key), []byte(id), 4096, 32, sha256.New)\n\t// Get IV via HMAC-SHA-1 based PBKDF2 algo.\n\tiv := pbkdf2.Key([]byte(key), []byte(id), 4096, aes.BlockSize, sha1.New)\n\n\tblock, err := aes.NewCipher(dk)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"decrypt: %w\", err)\n\t}\n\n\ter = cipher.StreamReader{\n\t\tS: cipher.NewCFBDecrypter(block, iv),\n\t\tR: r,\n\t}\n\treturn er, nil\n}", "title": "" }, { "docid": "220c5beeaecace497c1eff193d47de16", "score": "0.49644384", "text": "func DecryptData(password string, data io.Reader) ([]byte, error) {\n\tvar (\n\t\tsalt [32]byte\n\t\tid [1]byte\n\t\tnonce [8]byte // This depends on the AEAD but both used ciphers have the same nonce length.\n\t)\n\n\tif _, err := io.ReadFull(data, salt[:]); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := io.ReadFull(data, id[:]); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := io.ReadFull(data, nonce[:]); err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey := argon2.IDKey([]byte(password), salt[:], 1, 64*1024, 4, 32)\n\tvar (\n\t\terr error\n\t\tstream *sio.Stream\n\t)\n\tswitch id[0] {\n\tcase aesGcm:\n\t\tstream, err = sio.AES_256_GCM.Stream(key)\n\tcase c20p1305:\n\t\tstream, err = sio.ChaCha20Poly1305.Stream(key)\n\tdefault:\n\t\terr = errors.New(\"madmin: invalid AEAD algorithm ID\")\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tenBytes, err := ioutil.ReadAll(stream.DecryptReader(data, nonce[:], nil))\n\tif err != nil {\n\t\tif err == sio.NotAuthentic {\n\t\t\treturn enBytes, ErrMaliciousData\n\t\t}\n\t}\n\treturn enBytes, err\n}", "title": "" }, { "docid": "7afc795a1a10e0f96548f7c562b6114c", "score": "0.49631366", "text": "func (l *ZstdComp) Decompress(data []byte) ([]byte, error) {\n\tdecoder, err := zstd.NewReader(nil)\n\tbuffer, err := decoder.DecodeAll(data, nil)\n\tdecoder.Close()\n\treturn buffer, err\n}", "title": "" }, { "docid": "02981a1596500f1952143c2eaab01e40", "score": "0.49504417", "text": "func (cs *ChaChaStream) Unpack(payload string) []byte {\n\tdecoded, _ := base64.StdEncoding.DecodeString(payload)\n\n\tdata := make([]byte, len(decoded))\n\tcs.cipher.XORKeyStream(data, decoded)\n\treturn data\n}", "title": "" }, { "docid": "84fa1d138421e8e6fb13e7b31624f544", "score": "0.49494588", "text": "func DesEncryption(key, iv, plainText []byte) ([]byte, error) {\n\n\tblock, err := des.NewCipher(key)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblockSize := block.BlockSize()\n\torigData := PKCS5Padding(plainText, blockSize)\n\tblockMode := cipher.NewCBCEncrypter(block, iv)\n\tcryted := make([]byte, len(origData))\n\tblockMode.CryptBlocks(cryted, origData)\n\treturn cryted, nil\n}", "title": "" }, { "docid": "70854daaf4ddc0f02b00474edcc05e4e", "score": "0.49275842", "text": "func (r *ColumnarTransposition) Decrypt(text []byte) []byte {\n\treturn decrypt(text, r.psk)\n}", "title": "" }, { "docid": "75552849f67cbc6585e8d074b3ad390f", "score": "0.49224925", "text": "func TripleDESDecrypt(src []byte, key []byte, padding paddingMode) ([]byte, error) {\n\tblock, err := des.NewTripleDESCipher(key)\n\tif err != nil {\n\t\treturn make([]byte, 0), err\n\t}\n\tvar blockMode = cipher.NewCBCDecrypter(block, key[:block.BlockSize()])\n\tvar result = make([]byte, len(src))\n\tblockMode.CryptBlocks(result, src)\n\tunpaddingFunc, err := GetUnpadding(padding)\n\tif err != nil {\n\t\treturn make([]byte, 0), err\n\t}\n\treturn unpaddingFunc(result), nil\n}", "title": "" }, { "docid": "449f3b822235629235b9b2ace29aaf75", "score": "0.49121863", "text": "func (o FlowSourceTypeOutput) Decryption() FlowEncryptionPtrOutput {\n\treturn o.ApplyT(func(v FlowSourceType) *FlowEncryption { return v.Decryption }).(FlowEncryptionPtrOutput)\n}", "title": "" }, { "docid": "eba9c8e0982c140abd5bd733d0212096", "score": "0.4898457", "text": "func (wxCrypt *WxBizDataCrypt) Decrypt(encryptedData string, iv string, isJSON bool) (interface{}, error) {\n\tif len(wxCrypt.SessionKey) != 24 {\n\t\treturn nil, illegalAesKey\n\t}\n\taesKey, err := base64.StdEncoding.DecodeString(wxCrypt.SessionKey)\n\tif err != nil {\n\t\treturn nil, errmsg.GetError(errDecodeBase64, err.Error())\n\t}\n\n\tif len(iv) != 24 {\n\t\treturn nil, illegalIv\n\t}\n\taesIV, err := base64.StdEncoding.DecodeString(iv)\n\tif err != nil {\n\t\treturn nil, errmsg.GetError(errDecodeBase64, err.Error())\n\t}\n\n\taesCipherText, err := base64.StdEncoding.DecodeString(encryptedData)\n\tif err != nil {\n\t\treturn nil, errmsg.GetError(errDecodeBase64, err.Error())\n\t}\n\taesPlantText := make([]byte, len(aesCipherText))\n\n\taesBlock, err := aes.NewCipher(aesKey)\n\tif err != nil {\n\t\treturn nil, errmsg.GetError(illegalBuffer, err.Error())\n\t}\n\n\tmode := cipher.NewCBCDecrypter(aesBlock, aesIV)\n\tmode.CryptBlocks(aesPlantText, aesCipherText)\n\taesPlantText = PKCS7UnPadding(aesPlantText)\n\n\tvar decrypted map[string]interface{}\n\taesPlantText = []byte(strings.Replace(string(aesPlantText), \"\\a\", \"\", -1))\n\terr = json.Unmarshal([]byte(aesPlantText), &decrypted)\n\tif err != nil {\n\t\treturn nil, errmsg.GetError(illegalBuffer, err.Error())\n\t}\n\n\tif decrypted[\"watermark\"].(map[string]interface{})[\"appid\"] != wxCrypt.AppID {\n\t\treturn nil, errmsg.GetError(illegalBuffer, \"appId is not match\")\n\t}\n\n\tif isJSON == true {\n\t\treturn string(aesPlantText), nil\n\t}\n\n\treturn decrypted, nil\n}", "title": "" }, { "docid": "dd21f8d6d84805190b8d147d4756a6a1", "score": "0.48964405", "text": "func (s *hmacSession) Decrypt(parameter []byte) error {\n\tif !s.IsEncryption() {\n\t\treturn nil\n\t}\n\t// Only AES-CFB is supported.\n\tbits, err := s.symmetric.KeyBits.AES()\n\tif err != nil {\n\t\treturn err\n\t}\n\tkeyBytes := *bits / 8\n\tkeyIVBytes := int(keyBytes) + 16\n\t// Part 1, 21.1\n\tvar sessionValue []byte\n\tsessionValue = append(sessionValue, s.sessionKey...)\n\tsessionValue = append(sessionValue, s.auth...)\n\tha, err := s.hash.Hash()\n\tif err != nil {\n\t\treturn err\n\t}\n\tkeyIV := KDFa(ha, sessionValue, \"CFB\", s.nonceTPM.Buffer, s.nonceCaller.Buffer, keyIVBytes*8)\n\tkey, err := aes.NewCipher(keyIV[:keyBytes])\n\tif err != nil {\n\t\treturn err\n\t}\n\tstream := cipher.NewCFBDecrypter(key, keyIV[keyBytes:])\n\tstream.XORKeyStream(parameter, parameter)\n\treturn nil\n}", "title": "" }, { "docid": "55d2a6d5cc9f172d194b98b88d594896", "score": "0.48764807", "text": "func decrypt(in io.Reader, x *unpaddedRSABreaker) error {\n\tinput := bufio.NewScanner(in)\n\tfor input.Scan() {\n\t\tciphertext, err := RSAEncrypt(x.RSAPublicKey, input.Bytes())\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t\tcontinue\n\t\t}\n\t\tplaintext, err := x.breakOracle(ciphertext)\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Printf(\"ciphertext: %x\\nplaintext: %s\\n\",\n\t\t\tciphertext, plaintext)\n\t}\n\treturn input.Err()\n}", "title": "" }, { "docid": "c9d023ee495c3fe974e4f806fc7198e7", "score": "0.4854495", "text": "func (f *FlateTransform) DecompressTransform(buf []byte) ([]byte, error) {\n\tif f.passthrough {\n\t\treturn buf, nil\n\t}\n\t// Guess the size of the decompressed buffer.\n\tsize := len(buf) * 2\n\tout := bytes.NewBuffer(make([]byte, 0, size))\n\tfrd := flate.NewReader(bytes.NewBuffer(buf))\n\tif _, err := io.Copy(out, frd); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := frd.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn out.Bytes(), nil\n}", "title": "" }, { "docid": "c974ea8ac9192025aa0a87309c02a166", "score": "0.48527613", "text": "func (s *policySession) Decrypt(parameter []byte) error {\n\tif !s.IsEncryption() {\n\t\treturn nil\n\t}\n\t// Only AES-CFB is supported.\n\tbits, err := s.symmetric.KeyBits.AES()\n\tif err != nil {\n\t\treturn err\n\t}\n\tkeyBytes := *bits / 8\n\tkeyIVBytes := int(keyBytes) + 16\n\t// Part 1, 21.1\n\tvar sessionValue []byte\n\tsessionValue = append(sessionValue, s.sessionKey...)\n\tsessionValue = append(sessionValue, s.auth...)\n\tha, err := s.hash.Hash()\n\tif err != nil {\n\t\treturn err\n\t}\n\tkeyIV := KDFa(ha, sessionValue, \"CFB\", s.nonceTPM.Buffer, s.nonceCaller.Buffer, keyIVBytes*8)\n\tkey, err := aes.NewCipher(keyIV[:keyBytes])\n\tif err != nil {\n\t\treturn err\n\t}\n\tstream := cipher.NewCFBDecrypter(key, keyIV[keyBytes:])\n\tstream.XORKeyStream(parameter, parameter)\n\treturn nil\n}", "title": "" }, { "docid": "330827a8df9b3debffc51a38d31f8bf4", "score": "0.48473644", "text": "func DeriveStream(r io.Reader, w io.Writer, filename string, sink Sink) error {\n\tinput, err := io.ReadAll(r)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read input: %s\", err)\n\t}\n\n\to := NewDeriveOperator(sink)\n\toutput, err := o.Apply(input, filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := w.Write(output); err != nil {\n\t\treturn fmt.Errorf(\"failed to write output: %s\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a64bd43f6ed2692d0f18268820641375", "score": "0.48419678", "text": "func Decrypt(data, key []byte) (out []byte) {\n\tout = make([]byte, len(data)-16)\n\tblk, err := aes.NewCipher(key)\n\tCheckError(err)\n\tctr := cipher.NewCTR(blk, data[:16])\n\tctr.XORKeyStream(out, data[16:])\n\treturn\n}", "title": "" }, { "docid": "1d919a4c57969bda19b02357157ce8ff", "score": "0.48419207", "text": "func Decrypt(encrypted []byte, key []byte) ([]byte, error) {\n\tdst := make([]byte, len(encrypted))\n\tn, err := hex.Decode(dst, encrypted)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdst = dst[:n]\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(dst) < aes.BlockSize {\n\t\treturn nil, errors.New(\"ciphertext too short\")\n\t}\n\n\tiv := dst[:aes.BlockSize]\n\tciphertext := dst[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "f2a9b6cf1fe74fe6ca68922d111d494a", "score": "0.48292735", "text": "func decryptECB(in io.Reader) ([]byte, error) {\n\tin = base64.NewDecoder(base64.StdEncoding, in)\n\tbuf, err := ioutil.ReadAll(in)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc, err := aes.NewCipher([]byte(secret))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tNewECBDecrypter(c).CryptBlocks(buf, buf)\n\tbuf, err = PKCS7Unpad(buf, c.BlockSize())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf, nil\n}", "title": "" }, { "docid": "cb403b8c0e851763b35505e37ea78ef9", "score": "0.4819475", "text": "func ClassifyEncryptedStreamAndMakeDecoder(source io.Reader, decryptionKeyring SigncryptKeyring, keyResolver SymmetricKeyResolver) (\n\tplainsource io.Reader, msgType MessageType, mki *MessageKeyInfo, senderPublic SigningPublicKey, isArmored bool, brand string, ver Version, err error) {\n\tstream := bufio.NewReader(source)\n\n\tisArmored, _, msgType, ver, err = ClassifyStream(stream)\n\tif err == ErrShortSliceOrBuffer {\n\t\treturn nil, MessageTypeUnknown, nil, nil, false, \"\", Version{}, ErrShortSliceOrBuffer\n\t}\n\tif err != nil {\n\t\treturn nil, MessageTypeUnknown, nil, nil, false, \"\", Version{}, ErrNotASaltpackMessage\n\t}\n\n\tswitch msgType {\n\tcase MessageTypeEncryption:\n\t\tif isArmored {\n\t\t\tmki, plainsource, brand, err = NewDearmor62DecryptStream(CheckKnownMajorVersion, stream, decryptionKeyring)\n\t\t} else {\n\t\t\tmki, plainsource, err = NewDecryptStream(CheckKnownMajorVersion, stream, decryptionKeyring)\n\t\t}\n\t\treturn plainsource, msgType, mki, nil, isArmored, brand, ver, err\n\tcase MessageTypeSigncryption:\n\t\tif isArmored {\n\t\t\tsenderPublic, plainsource, brand, err = NewDearmor62SigncryptOpenStream(stream, decryptionKeyring, keyResolver)\n\t\t} else {\n\t\t\tsenderPublic, plainsource, err = NewSigncryptOpenStream(stream, decryptionKeyring, keyResolver)\n\t\t}\n\t\treturn plainsource, msgType, nil, senderPublic, isArmored, brand, ver, err\n\tdefault:\n\t\treturn nil, MessageTypeUnknown, nil, nil, false, \"\", Version{}, ErrWrongMessageType{MessageTypeEncryption, msgType}\n\t}\n}", "title": "" }, { "docid": "0800b942dff50a077eef78f0891b6ad8", "score": "0.48191082", "text": "func UnpackDESOneConfine(data []byte, head TUnpackDESOne, path string) (err error) {\n\t// initial, fill the name\n\tvar s []byte\n\tfor _, v := range head.Name {\n\t\tif v == byte(0) {\n\t\t\tbreak\n\t\t}\n\t\ts = append(s, v)\n\t}\n\tfile := path + string(s)\n\tkey := head.Key\n\t// first, split the data slice\n\tss, err := SplitByte(data, DESBufferSize)\n\tif err != nil {\n\t\tlog.Println(\"Error split bytes:\", err)\n\t\treturn err\n\t}\n\t// second, we can call DESDecrypt function\n\twg := &sync.WaitGroup{}\n\tch := make(chan interface{}, ConfineBuffers)\n\trr := make([][]byte, len(ss))\n\tfor k, v := range ss {\n\t\twg.Add(1)\n\t\tch <- struct{}{}\n\t\tgo DESDecryptConfineGo(v, key, &rr[k], wg, ch)\n\t}\n\twg.Wait()\n\tdest := bytes.Join(rr, []byte(\"\"))\n\t// third, delete the more data\n\tsize := BytesToInt(head.OriginSize)\n\tdest = append(dest[:0], dest[:size]...)\n\t// fourth, create the origin file\n\terr = ioutil.WriteFile(file, dest, 0644)\n\tif err != nil {\n\t\tlog.Println(\"Error write to dest file:\", err)\n\t\treturn err\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f8da9d6b22068e997a29f3b2946bbdcf", "score": "0.48183426", "text": "func Decrypt(data []byte, passphrase []byte) (plaintext []byte, err error) {\n\tkey, _ := deriveKey(passphrase, data[12:20])\n\tb, _ := aes.NewCipher(key)\n\taesgcm, _ := cipher.NewGCM(b)\n\tplaintext, err = aesgcm.Open(nil, data[0:12], data[20:], nil)\n\treturn\n}", "title": "" }, { "docid": "4b3441d084df5d0a62956542fb28d9dd", "score": "0.481593", "text": "func TripleEcbDesDecrypt(crypted, key []byte) ([]byte, error) {\n\ttkey := make([]byte, 24, 24)\n\tcopy(tkey, key)\n\tk1 := tkey[:8]\n\tk2 := tkey[8:16]\n\tk3 := tkey[16:]\n\tbuf1, err := ECBDecrypt(crypted, k3)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuf2, err := ECBEncrypt(buf1, k2)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout, err := ECBDecrypt(buf2, k1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout = PKCS5UnPadding(out)\n\treturn out, nil\n}", "title": "" }, { "docid": "076005fdeceeba99280a8bd9dfa1032c", "score": "0.4808689", "text": "func DecodeInterleavedFSEStreams(decodingTables []*FSETable, src []byte, target io.Writer) (int, error) {\n\tbitsRead := 0\n\tbitsrc := bitstream.NewReversebitstream(src)\n\tvar err error\n\n\t//need to read bits from the stream (the back of the data...) until the first 1 arrives\n\tx := uint64(0)\n\tfor x == 0 {\n\t\tx, err = bitsrc.Read(1)\n\t\tif err != nil {\n\t\t\treturn bitsRead, err\n\t\t}\n\t\tbitsRead++\n\t}\n\n\tif bitsRead > 8 {\n\t\treturn bitsRead, ErrBadPadding\n\t}\n\n\t//print(\"Padding: \")\n\t//println(bitsRead)\n\n\tfor _, dt := range decodingTables {\n\t\tread, err := dt.InitState(bitsrc)\n\t\tbitsRead += read\n\t\tif err != nil {\n\t\t\treturn bitsRead, err\n\t\t}\n\t}\n\n\tvar buf [1]byte\n\n\tshouldFinish := false\n\t//loop until the end of the stream is reached\n\tfor !shouldFinish {\n\t\tfor idx, dt := range decodingTables {\n\t\t\tsymbol, read, err := dt.DecodeSymbol(bitsrc)\n\t\t\tif err != nil {\n\t\t\t\treturn bitsRead, err\n\t\t\t}\n\t\t\tbitsRead += read\n\t\t\tbuf[0] = byte(symbol)\n\n\t\t\tw := 0\n\t\t\tfor w == 0 {\n\t\t\t\tw, err = target.Write(buf[:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn bitsRead, err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//print(symbol)\n\t\t\t//print(\", \")\n\t\t\t//println(bitsrc.BitsStillInStream() + 1)\n\n\t\t\tif bitsrc.BitsStillInStream() < -1 {\n\t\t\t\t//collect all streams last symbol and exit outer loop\n\t\t\t\tfor i := 1; i < len(decodingTables); i++ {\n\t\t\t\t\tpeekIdx := (i + idx) % len(decodingTables)\n\t\t\t\t\tsymbol, err := decodingTables[peekIdx].PeekSymbol()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn bitsRead, err\n\t\t\t\t\t}\n\t\t\t\t\tbuf[0] = byte(symbol)\n\n\t\t\t\t\t//print(symbol)\n\t\t\t\t\t//print(\", \")\n\t\t\t\t\t//println(bitsrc.BitsStillInStream() + 1)\n\n\t\t\t\t\tw := 0\n\t\t\t\t\tfor w == 0 {\n\t\t\t\t\t\tw, err = target.Write(buf[:])\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn bitsRead, err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldFinish = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn bitsRead, nil\n}", "title": "" }, { "docid": "6a1f579b7a5e8871e4d8068c2b494471", "score": "0.4800618", "text": "func decipherChunk(chunk []byte) ([]byte, error) {\n\tblockLen := *config.blockLen\n\n\t// create buffer to store the deciphered block of plaintext\n\tplainText := make([]byte, blockLen)\n\n\t// we start with the last byte of first block\n\t// and repeat the same procedure for every byte in that block, moving backwards\n\tfor pos := blockLen - 1; pos >= 0; pos-- {\n\t\toriginalByte := chunk[pos]\n\t\tvar foundByte *byte\n\n\t\tif pos == blockLen-1 {\n\t\t\t/* logic for the last byte is slightly different\n\t\t\tthis is because we can (very unlikely, but still) run into a situation where valid padding is misleading\n\t\t\te.g. we assume that plaintext byte of valid padding is \\x01, but it can be \\x02 if original plaintext ends with \\x02\\x01\n\t\t\tanyway, if you curious, check this answer:\n\t\t\thttps://crypto.stackexchange.com/questions/37608/clarification-on-the-origin-of-01-in-this-oracle-padding-attack?rq=1#comment86828_37609\n\t\t\t*/\n\t\t\tfound, err := findGoodBytes(chunk, pos, 2)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t/* for reasons described above, we must ensure that valid padding is indeed \\x01\n\t\t\twe can modify second-last byte, and if padding oracle still doesn't show up, then we're good */\n\t\t\tsecondLast := chunk[pos-1] // backup second-last byte\n\n\t\t\tfor _, b := range found {\n\t\t\t\tchunk[pos] = b // the candidate byte goes to last position\n\t\t\t\tchunk[pos-1]-- // randomly modify second-last byte\n\n\t\t\t\te, err := isPaddingError(chunk, nil) // and check for padding error\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\t// if padding error did not happen, it's a good byte we found!\n\t\t\t\tif !e {\n\t\t\t\t\tfoundByte = &b\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* if loop above did not exit because of confirming a good byte,\n\t\t\twell, something is wrong\n\t\t\ti mean we just got those bytes without padding errors */\n\t\t\tif foundByte == nil {\n\t\t\t\treturn nil, errors.New(\"Unexpected server behaviour. Aborting\")\n\t\t\t}\n\n\t\t\t// restore second-to-last byte, remember?\n\t\t\tchunk[pos-1] = secondLast\n\t\t} else {\n\t\t\t/* the logic for other positions is way simpler */\n\t\t\tfound, err := findGoodBytes(chunk, pos, 1)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfoundByte = &found[0]\n\t\t}\n\n\t\t// okay, now that we found the byte that fits, we can reveal the plaintext byte with some XOR magic\n\t\tcurrPaddingValue := byte(blockLen - pos)\n\t\tplainText[pos] = *foundByte ^ originalByte ^ currPaddingValue\n\n\t\t// report to current status about deciphered plain byte\n\t\tcurrentStatus.reportPlainByte(plainText[pos])\n\n\t\t/* we need to repair the padding for the next shot\n\t\te.g. we need to adjust the already tampered bytes block*/\n\t\tchunk[pos] = *foundByte\n\t\tnextPaddingValue := currPaddingValue + 1\n\t\tadjustingValue := currPaddingValue ^ nextPaddingValue\n\t\tfor i := pos; i < blockLen; i++ {\n\t\t\tchunk[i] ^= adjustingValue\n\t\t}\n\t}\n\n\treturn plainText, nil\n}", "title": "" }, { "docid": "b304cbe3f3aebe59e3737918af87950c", "score": "0.47850302", "text": "func UnpackDESOne(data []byte, head TUnpackDESOne, path string) (err error) {\n\t// initial, fill the name\n\tvar s []byte\n\tfor _, v := range head.Name {\n\t\tif v == byte(0) {\n\t\t\tbreak\n\t\t}\n\t\ts = append(s, v)\n\t}\n\tfile := path + string(s)\n\tkey := head.Key\n\t// first, split the data slice\n\tss, err := SplitByte(data, DESBufferSize)\n\tif err != nil {\n\t\tlog.Println(\"Error split bytes:\", err)\n\t\treturn err\n\t}\n\t// second, we can call DESDecrypt function\n\twg := &sync.WaitGroup{}\n\trr := make([][]byte, len(ss))\n\tfor k, v := range ss {\n\t\twg.Add(1)\n\t\tgo DESDecryptGo(v, key, &rr[k], wg)\n\t}\n\twg.Wait()\n\tdest := bytes.Join(rr, []byte(\"\"))\n\t// third, delete the more data\n\tsize := BytesToInt(head.OriginSize)\n\tdest = append(dest[:0], dest[:size]...)\n\t// fourth, create the origin file\n\terr = ioutil.WriteFile(file, dest, 0644)\n\tif err != nil {\n\t\tlog.Println(\"Error write to dest file:\", err)\n\t\treturn err\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c6772317fad60ae723e2a8478d4ccd45", "score": "0.47792342", "text": "func (p *AesCrypt) Decrypt(enc []byte) ([]byte, error) {\n\tif err := p.Init(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif p.Encoder != nil {\n\t\tvar err error\n\t\tenc, err = p.Encoder.Decode(enc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// TODO 优化: 在 Init() 创建好 block 和 blockMode\n\tblock, err := aes.NewCipher(p.key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblockMode := cipher.NewCBCDecrypter(block, p.iv)\n\n\tsrcBytes := make([]byte, len(enc))\n\tblockMode.CryptBlocks(srcBytes, enc)\n\n\treturn PKCS5UnPadding(srcBytes)\n}", "title": "" }, { "docid": "773a1d19e4f5a455a4ee260b3aaf20bf", "score": "0.47744498", "text": "func Decrypt(password string, data []byte) ([]byte, error) {\n\t// Try to get a version number from the given data.\n\tversionNumber, err := parseBlobVersionBytes(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Delegate decryption based on the indicated version.\n\tcryptRecord, ok := CryptVersions.Find(versionNumber)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Unable to read files of version %d\", versionNumber)\n\t}\n\n\t// Decrypt the data using the given version's decryption function.\n\treturn cryptRecord.Decrypt(password, data)\n}", "title": "" }, { "docid": "af1d91dec933bd54e651edad292c3c77", "score": "0.47717303", "text": "func Decipher(key Key, buf []byte) error {\n\tfor {\n\t\tDecryptBlock(key, buf[0:8])\n\t\tbuf = buf[8:]\n\t\tif len(buf) == 0 {\n\t\t\treturn nil\n\t\t} else if len(buf) < 8 {\n\t\t\treturn io.ErrUnexpectedEOF\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7e268a4337f088ba0f228da00a3c9868", "score": "0.47706684", "text": "func (dataStorePersistenceTarget *DataStorePersistenceTarget) ExtractFromStream(stream *nex.StreamIn) error {\n\texpectedDataSize := 9 // base size not including Structure header\n\n\tif len(stream.Bytes()[stream.ByteOffset():]) < expectedDataSize {\n\t\treturn errors.New(\"[DataStorePersistenceTarget::ExtractFromStream] Data size too small\")\n\t}\n\n\tdataStorePersistenceTarget.OwnerID = stream.ReadUInt32LE()\n\tdataStorePersistenceTarget.PersistenceSlotID = stream.ReadUInt16LE()\n\n\treturn nil\n}", "title": "" }, { "docid": "0e883f19a0384983e21dbf5c142d3d70", "score": "0.47665426", "text": "func (e *ECBCipher) Decrypt(ct []byte) []byte {\n\tif len(ct)%e.b.BlockSize() != 0 {\n\t\tpanic(\"invalid ECB ciphertext\")\n\t}\n\tpt := make([]byte, len(ct))\n\tfor i := 0; i < len(ct); i += e.b.BlockSize() {\n\t\te.b.Decrypt(pt[i:], ct[i:])\n\t}\n\treturn pt\n}", "title": "" }, { "docid": "a78dbe1c395442468ca90550cdb241f1", "score": "0.4763558", "text": "func (d *StreamDecryptor) Open(dst, ciphertext, aData []byte, lastBlock bool) ([]byte, error) {\n\treturn d.a.Open(dst, d.n.Next(lastBlock), ciphertext, aData)\n}", "title": "" }, { "docid": "e9053564a457a77cf8c6a3806cedd1b2", "score": "0.47577095", "text": "func (c *Cipher) Decrypt(dst, src []byte) {\n\n uintLen := c.stateSize / 64\n\n // This saves a make because tmpin and tmpout are of variable length\n tmpin, tmpout := c.getTempData()\n\n for i := 0; i < uintLen; i++ {\n tmpin[i] = binary.LittleEndian.Uint64(src[i*8 : i*8+8])\n }\n c.decrypt(tmpin, tmpout)\n\n for i := 0; i < uintLen; i++ {\n binary.LittleEndian.PutUint64(dst[i*8:i*8+8], tmpout[i])\n }\n}", "title": "" }, { "docid": "81483a9a3fdca16bd2f19820c0823d94", "score": "0.47477803", "text": "func UnpackDESOneToMemory(data []byte, head TUnpackDESOne, dest *[]byte) (err error) {\n\t// initial, fill the key\n\tkey := head.Key\n\t// first, split the data slice\n\tss, err := SplitByte(data, DESBufferSize)\n\tif err != nil {\n\t\tlog.Println(\"Error split bytes:\", err)\n\t\treturn err\n\t}\n\t// second, we can call DESDecrypt function\n\twg := &sync.WaitGroup{}\n\trr := make([][]byte, len(ss))\n\tfor k, v := range ss {\n\t\twg.Add(1)\n\t\tgo DESDecryptGo(v, key, &rr[k], wg)\n\t}\n\twg.Wait()\n\tr := bytes.Join(rr, []byte(\"\"))\n\t// third, delete the more data\n\tsize := BytesToInt(head.OriginSize)\n\t*dest = append(r[:0], r[:size]...)\n\treturn err\n}", "title": "" }, { "docid": "2d53f7ea711f742cd7f30a2f1da8f6da", "score": "0.47462058", "text": "func encryptStream(key string, iv []byte) (cipher.Stream, error) {\n\tblock, err := newCipherBlock(key)\n\tif err != nil {\n\t\tlog.Println(\"Failed to generate cipher block:\", err)\n\t\treturn nil, err\n\t}\n\treturn cipher.NewCFBEncrypter(block, iv), nil\n}", "title": "" }, { "docid": "57c39028dd79316b6eff9eab2e4d6413", "score": "0.47437385", "text": "func Decrypt(w io.Writer, r io.Reader, header []byte, key *SymmetricKey) error {\n\tnonce := newCounter()\n\tbuf := make([]byte, 0, chunksize+overhead)\n\taead, err := chacha20poly1305.New(key[:])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Read sealed version\n\tbuf = buf[:4+overhead]\n\t_, err = io.ReadFull(r, buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf, err = aead.Open(buf[:0], nonce.bytes, buf, header)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif binary.LittleEndian.Uint32(buf) != streamVersion {\n\t\treturn fmt.Errorf(\"unknown protocol version %x\", buf)\n\t}\n\n\tfor {\n\t\tchunk := buf[:chunksize+overhead]\n\t\tl, err := io.ReadFull(r, chunk)\n\t\tif l > 0 {\n\t\t\tvar err error\n\t\t\tnonce.inc()\n\t\t\tchunk, err = aead.Open(chunk[:0], nonce.bytes, chunk[:l], nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, err = w.Write(chunk)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif err == io.EOF || err == io.ErrUnexpectedEOF {\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "40995f44e3b5d4a53e59804ed8b58db7", "score": "0.47351897", "text": "func DecryptReader(key string, r io.Reader) (*cipher.StreamReader, error) {\n\tiv := make([]byte, aes.BlockSize)\n\tn, err := r.Read(iv)\n\tif n < len(iv) || err != nil {\n\t\tlog.Println(\"Unable to read full iv: \", err)\n\t\treturn nil, errors.New(\"Unable to read full iv\")\n\t}\n\tstream, err := decryptStream(key, iv)\n\tif err != nil {\n\t\tlog.Println(\"Decrypt stream failed:\", err)\n\t\treturn nil, err\n\t}\n\treturn &cipher.StreamReader{S: stream, R: r}, nil\n}", "title": "" }, { "docid": "7bce1f75c91dd98806400a90f065df0f", "score": "0.47338963", "text": "func (dataStoreDeleteParam *DataStoreDeleteParam) ExtractFromStream(stream *nex.StreamIn) error {\n\tdataStoreDeleteParam.DataID = stream.ReadUInt64LE()\n\tdataStoreDeleteParam.UpdatePassword = stream.ReadUInt64LE()\n\n\treturn nil\n}", "title": "" }, { "docid": "4e810d07e0280078e4595e2981c70fd7", "score": "0.47189167", "text": "func decrypt(ciphertext []byte, key []byte) ([]byte, error) {\n\n\t// create the AES cipher\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Unable to create AES cipher block\")\n\t}\n\n\t// check size of ciphertext\n\tif len(ciphertext) < aes.BlockSize {\n\t\treturn nil, errors.New(\"ciphertext too short to decrypt\")\n\t}\n\n\t// get the 16 byte IV\n\tiv := ciphertext[:aes.BlockSize]\n\n\t// remove the IV from the ciphertext\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\t// return a decrypted stream\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\t// decrypt bytes from ciphertext\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\treturn ciphertext, err\n}", "title": "" }, { "docid": "536c67a7efc6b9e87893b742057fb80b", "score": "0.4715128", "text": "func (c *Client) Decipher(value string) (string, error) {\n\tlog.Debugf(\"Deciphering '%s' using Vault transit key\", value)\n\n\tpayload := make(map[string]interface{})\n\tpayload[\"ciphertext\"] = fmt.Sprintf(\"vault:v1:%s\", value)\n\n\td, err := c.Logical().Write(\"transit/decrypt/\"+c.Config.Key, payload)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"vault client\")\n\t}\n\n\toutput, err := base64.StdEncoding.DecodeString(d.Data[\"plaintext\"].(string))\n\n\treturn string(output), err\n}", "title": "" }, { "docid": "b978522360f77adeecc1266e753cbab8", "score": "0.4711704", "text": "func DesencripAES(key string, text string) (string, error) {\n\ttextByte := StrtoByteHex(text)\n\tkeyHash := []byte(GeneredHashMd5(key))\n\tbloque, err := aes.NewCipher(keyHash)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error generating phisher\")\n\t}\n\tgcm, err := cipher.NewGCM(bloque)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error generating block\")\n\t}\n\tnonceSize := gcm.NonceSize()\n\tif nonceSize > len(textByte) {\n\t\treturn \"\", fmt.Errorf(\"failed to open the block\")\n\t}\n\tnonce, ciphertext := textByte[:nonceSize], textByte[nonceSize:]\n\ttextoDesencrip, err := gcm.Open(nil, nonce, ciphertext, nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to open the block\")\n\t}\n\n\treturn BytetoStr(textoDesencrip), nil\n}", "title": "" }, { "docid": "28652ccf79cb6498c0de894dce29d88f", "score": "0.47090495", "text": "func (e *ECB) Decrypt(ciphertext []byte) []byte {\n\tb, err := aes.NewCipher(e.Key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdecrypted := make([]byte, len(ciphertext))\n\tfor i := 0; i < len(ciphertext)/len(e.Key); i++ {\n\t\tstart := i * len(e.Key)\n\t\tend := start + len(e.Key)\n\t\tb.Decrypt(decrypted[start:end], ciphertext[start:end])\n\t}\n\n\tmsg := padding.UnPKCS7(decrypted, len(e.Key))\n\n\treturn msg\n}", "title": "" }, { "docid": "733e815fae32d0cf0439e0d8a574212c", "score": "0.46897438", "text": "func (sr *SecureReader) decrypt(message []byte) ([]byte, error) {\n\tvar nonce [24]byte\n\tcopy(nonce[:], message)\n\topened, ok := box.OpenAfterPrecomputation(nil, message[24:], &nonce, &sr.sKey)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"decrypt: error opening box\")\n\t}\n\treturn opened, nil\n}", "title": "" }, { "docid": "19542e6b43be995754093eaacd959b21", "score": "0.4678479", "text": "func Decompress(data []byte) (decompressedData []byte, err error) {\n\tbuff := make([]byte, 100*len(data))\n\tn, err := lz4.UncompressBlock(data, buff)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif n == 0 {\n\t\terr = errors.New(\"Failed to decompress data\")\n\t\treturn nil, err\n\t}\n\n\tdecompressedData = buff[:n]\n\treturn decompressedData, nil\n}", "title": "" }, { "docid": "282c19c6388107ebecb16dc3e7586a01", "score": "0.46759617", "text": "func (ctx *HttpsIpcContext) StopStream() {\n\tclose(ctx.done)\n\tctx.wg.Wait()\n}", "title": "" }, { "docid": "044de4a6d18a6a21d146642c5a2283d8", "score": "0.46753982", "text": "func decrypt(data, key []byte) (out []byte) {\n\tout = make([]byte, len(data)-16) // la salida no va a tener el IV\n\tblk, err := aes.NewCipher(key) // cifrador en bloque (AES), usa key\n\tChk(err) // comprobamos el error\n\tctr := cipher.NewCTR(blk, data[:16]) // cifrador en flujo: modo CTR, usa IV\n\tctr.XORKeyStream(out, data[16:]) // desciframos (doble cifrado) los datos\n\treturn\n}", "title": "" }, { "docid": "20798d66dda86742536db79965855f28", "score": "0.46667004", "text": "func Decrypt(plaintext, key []byte, block cipher.Block) (ciphertext []byte, err error) {\n\tblockSize := block.BlockSize()\n\n\tblockMode := cipher.NewCBCDecrypter(block, key[:blockSize])\n\tciphertext = make([]byte, len(plaintext))\n\n\tblockMode.CryptBlocks(ciphertext, plaintext)\n\treturn PKCS5UnPadding(ciphertext)\n}", "title": "" }, { "docid": "a50286f76103b7f9d51752e2fca9bc3a", "score": "0.4664764", "text": "func (dataStorePasswordInfo *DataStorePasswordInfo) ExtractFromStream(stream *nex.StreamIn) error {\n\tdataStorePasswordInfo.DataID = stream.ReadUInt64LE()\n\tdataStorePasswordInfo.AccessPassword = stream.ReadUInt64LE()\n\tdataStorePasswordInfo.UpdatePassword = stream.ReadUInt64LE()\n\n\treturn nil\n}", "title": "" }, { "docid": "5412db4f60ab2c1a20dde8dd447413ac", "score": "0.46633765", "text": "func softDecrypt(rawData []byte) ([]byte, error) {\n\tdecryptedData, err := decrypt.Data(rawData, \"yaml\")\n\tif err == sops.MetadataNotFound {\n\t\treturn rawData, nil\n\t} else if err != nil {\n\t\treturn rawData, errors.Wrap(err, \"failed to decrypt file\")\n\t}\n\treturn decryptedData, nil\n}", "title": "" }, { "docid": "d906eeb8aed62e174203a2c6a7ff7660", "score": "0.46551248", "text": "func (pt *ProtoTcp) ReadStreamToData(r *bufio.Reader) error {\n\tvar err error\n\n\t// alloc temp slot\n\tslot := sr.NewStreamSlot()\n\n\tfor {\n\t\terr = pt.ReadFrameToSlot(r, slot)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\">4\", slot)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "1cd9d8e063dee78ad156c50eb34f6127", "score": "0.46494168", "text": "func Decrypt(passphrase, salt, ciphertext []byte, space, time int) ([]byte, error) {\n\tpbenc := initProtocol(passphrase, salt, space, time)\n\n\tplaintext := pbenc.RecvENC(nil, ciphertext[:len(ciphertext)-internal.MACSize])\n\n\tif err := pbenc.RecvMAC(ciphertext[len(ciphertext)-internal.MACSize:]); err != nil {\n\t\treturn nil, internal.ErrInvalidCiphertext\n\t}\n\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "5a9d49d64084b9ec6a179ad2e67e231e", "score": "0.46460608", "text": "func Decrypt(ciphertext []byte, password []byte, packetConfig *packet.Config) (plaintext []byte, err error) {\n\tdecbuf := bytes.NewBuffer(ciphertext)\n\tarmorBlock, _ := armor.Decode(decbuf)\n\tfailed := false\n\tprompt := func(keys []openpgp.Key, symmetric bool) ([]byte, error) {\n\t\tif failed {\n\t\t\treturn nil, errors.New(\"decryption failed\")\n\t\t}\n\t\tfailed = true\n\t\treturn password, nil\n\t}\n\tmd, err := openpgp.ReadMessage(armorBlock.Body, nil, prompt, packetConfig)\n\tif err != nil {\n\t\treturn\n\t}\n\tplaintext, err = ioutil.ReadAll(md.UnverifiedBody)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "9f54f699a8341d2b6d748b49c233c94c", "score": "0.46431446", "text": "func Decrypt(content []byte, cipher *backuppb.CipherInfo, iv []byte) ([]byte, error) {\n\tif len(content) == 0 || cipher == nil {\n\t\treturn content, nil\n\t}\n\n\tswitch cipher.CipherType {\n\tcase encryptionpb.EncryptionMethod_PLAINTEXT:\n\t\treturn content, nil\n\tcase encryptionpb.EncryptionMethod_AES128_CTR,\n\t\tencryptionpb.EncryptionMethod_AES192_CTR,\n\t\tencryptionpb.EncryptionMethod_AES256_CTR:\n\t\treturn encrypt.AESDecryptWithCTR(content, cipher.CipherKey, iv)\n\tdefault:\n\t\treturn content, errors.Annotate(berrors.ErrInvalidArgument, \"cipher type invalid\")\n\t}\n}", "title": "" }, { "docid": "e684277c86b3c13c4e7ced40722c15dd", "score": "0.46408278", "text": "func decrypt(p []byte, sr *SecureReader) (int, error) {\n\n\t// Read the nonce.\n\tvar nonce [24]byte\n\tn, err := io.ReadFull(sr.Reader, nonce[:])\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Overhead is the number of bytes of overhead when\n\t// encrypting a message therefore we need to create a\n\t// buffer larger than just the encrypted message.\n\tmsg := make([]byte, len(p)+box.Overhead)\n\n\t// Read the encrypted message.\n\tn, err = sr.Reader.Read(msg)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// The len and capacity of p will be set by the caller. On the call to\n\t// box.Open the length value of p must be set to 0 since box. Open will\n\t// append values to the slice. So by using p[:0] we are passing a slice\n\t// value who's length is 0 but capacity represents the full size of the\n\t// backing array. This will allow box.Open to use append to add the data\n\t// during the decryption.\n\n\t// box.Open will decypt the message and place just the decypted bytes back\n\t// to the p slice. It will also return just those decypted bytes in the\n\t// returned slice. We need the returned slice to get the length of bytes\n\t// for this message. Because p will still have a larger length than what\n\t// was appended from index 0.\n\tdec, ok := box.Open(p[:0], msg[:n], &nonce, &sr.publicKey, &sr.privateKey)\n\tif !ok {\n\t\treturn 0, err\n\t}\n\n\treturn len(dec), nil\n}", "title": "" }, { "docid": "80b5fc14ad4b4594ace84e3957271d55", "score": "0.46377146", "text": "func AESDecrypt(key, text string) (string, error) {\n\tiv := []byte(text[:aes.BlockSize])\n\tkey, err := hash.MD5Hash(key)\n\tif err != nil {\n\t\tlogger.LogWarning(\"error when getting md5 hash for key. error: \", err)\n\t\treturn \"\", err\n\t}\n\ttxt := []byte(text[aes.BlockSize:])\n block, err := aes.NewCipher([]byte(key))\n if err != nil {\n logger.LogWarning(\"error when aes.NewCipher. error: \", err)\n return \"\", err\n }\n if len(txt) < aes.BlockSize {\n logger.LogWarning(\"error, cipher txt < aes.BlockSize.\")\n return \"\", errors.New(\"error, cipher txt < aes.BlockSize.\")\n }\n cfb := cipher.NewCFBDecrypter(block, iv)\n cfb.XORKeyStream(txt, txt)\n s, err := decodeBase64(string(txt))\n if err != nil {\n \tlogger.LogWarning(\"error when base64 decoding string. error: \", err)\n \treturn \"\", err\n }\n return string(s), nil\n}", "title": "" }, { "docid": "e4ea67e2ca95b28e3ca5b34aaf0c621b", "score": "0.4636323", "text": "func decryptData(edata []byte, creds ...auth.Credentials) ([]byte, error) {\n\tvar err error\n\tvar data []byte\n\tfor _, cred := range creds {\n\t\tdata, err = madmin.DecryptData(cred.String(), bytes.NewReader(edata))\n\t\tif err != nil {\n\t\t\tif err == madmin.ErrMaliciousData {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tbreak\n\t}\n\treturn data, err\n}", "title": "" }, { "docid": "8e14c94e99f15e7f043df6d75c71b0d0", "score": "0.4634122", "text": "func (enc *Encryptor) DecryptPipe(inputReader *io.ReadCloser, outputWriter *io.WriteCloser) error {\n\tbuff := make([]byte, 256)\n\tvar err error\n\tfor err == nil {\n\t\t_, err = (*inputReader).Read(buff)\n\t\tif err == nil {\n\t\t\tbuff, err = enc.Decrypt(buff)\n\t\t\tif err != nil {\n\t\t\t\t(*outputWriter).Close()\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, err = (*outputWriter).Write(buff)\n\t\t}\n\t}\n\t(*outputWriter).Close()\n\treturn err\n}", "title": "" }, { "docid": "6ad06e03460bf70caf50debd41f6d895", "score": "0.4633525", "text": "func DecryptPinBlock(pinBlock []byte, key []byte) (result []byte, err error) {\n\n\tif len(key) == 8 {\n\t\tresult, err = _crypt.DecryptDes(pinBlock, key)\n\t} else {\n\t\tresult, err = _crypt.DecryptTripleDes(pinBlock, key)\n\t}\n\n\treturn\n\n}", "title": "" }, { "docid": "8384c97be3cb3f10422d51013e4aaa1f", "score": "0.46325612", "text": "func desl(key, data []byte) []byte {\n\tout := make([]byte, 24)\n\n\tdkey := make([]byte, 7)\n\tcopy(dkey, key)\n\tblock, _ := des.NewCipher(deskey(dkey))\n\tblock.Encrypt(out, data)\n\n\tcopy(dkey, key[7:])\n\tblock, _ = des.NewCipher(deskey(dkey))\n\tblock.Encrypt(out[8:], data)\n\n\tdkey = make([]byte, 7)\n\tcopy(dkey, key[14:])\n\tblock, _ = des.NewCipher(deskey(dkey))\n\tblock.Encrypt(out[16:], data)\n\n\treturn out\n}", "title": "" }, { "docid": "01b9f49d4e3adbf80adf7e92d33df807", "score": "0.46265346", "text": "func Decrypt(data []byte, key *rsa.PrivateKey) []byte {\n\tdec := gob.NewDecoder(bytes.NewReader(data))\n\tvar ed encryptedData\n\terr := dec.Decode(&ed)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsymmetricKey := decryptAsymmetric(ed.EncryptedKey, key)\n\tdecryptedPlaintext := decryptSymmetric(ed.Data, ed.NonceSize, symmetricKey)\n\treturn decryptedPlaintext\n}", "title": "" }, { "docid": "db49762cb5a88beff6cb28a6f0daf738", "score": "0.46165013", "text": "func (digester *Digester) Decrypt(encryptedText []byte, username, password string) (originText string, err error) {\n\tdecryptionKey := digester.GenerateSalt([]byte(username + password))\n\tvar cipherBlock cipher.Block\n\tcipherBlock, err = aes.NewCipher(decryptionKey)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvar gcm cipher.AEAD\n\tgcm, err = cipher.NewGCM(cipherBlock)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tnonceSize := gcm.NonceSize()\n\n\tnonce, cipherText := encryptedText[:nonceSize], encryptedText[nonceSize:]\n\tvar decryptedPlaintext []byte\n\tdecryptedPlaintext, err = gcm.Open(nil, nonce, cipherText, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\toriginText = string(decryptedPlaintext)\n\n\treturn originText, nil\n}", "title": "" }, { "docid": "12cec55ffdda9f5c98d3e66d2f287eec", "score": "0.4607961", "text": "func (ac *AesCipher) Decrypt(encryptedText string) (string, error) {\n\tdecoded, _ := hex.DecodeString(encryptedText)\n\n\tblock, err := aes.NewCipher(ac.key)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(decoded) < aes.BlockSize {\n\t\treturn \"\", errors.New(errorCipherTextTooShort)\n\t}\n\n\tdecrypted := make([]byte, len(decoded))\n\n\tmode := cipher.NewCBCDecrypter(block, ac.iv)\n\tmode.CryptBlocks(decrypted, decoded)\n\n\tunpadded := ac.padding.Undo(decrypted)\n\n\tif len(unpadded) == 0 {\n\t\treturn \"\", errors.New(errorInvalidPadding)\n\t}\n\n\treturn string(unpadded), nil\n}", "title": "" }, { "docid": "95c229eb8370626ae18e1ea7a070f73b", "score": "0.46055585", "text": "func DESEncrypt(src, key []byte) (dest []byte, err error) {\n\t// key length should be 8\n\tblock, err := des.NewCipher(key)\n\tif err != nil {\n\t\tlog.Println(\"Error key length:\", err)\n\t\treturn dest, err\n\t}\n\t// calculate block size\n\tblockSize := block.BlockSize()\n\t// fill block data\n\tsrc = PKCS5Padding(src, blockSize)\n\t// encrypt mode\n\tblockMode := cipher.NewCBCEncrypter(block, key[:blockSize])\n\t// create slice\n\tdest = make([]byte, len(src))\n\t// encrypt\n\tblockMode.CryptBlocks(dest, src)\n\treturn dest, err\n}", "title": "" }, { "docid": "3306ee9257edd5b1bd7b32b3fc155178", "score": "0.4602994", "text": "func (a *api) cryptoProcessStream(stream grpc.ServerStream, reqProto runtimev1pb.CryptoRequests, opts any) (err error) {\n\t// Create a pipe to send the data to encrypt\n\tinReader, inWriter := io.Pipe()\n\n\tctx, cancel := context.WithCancel(stream.Context())\n\tdefer cancel()\n\n\ta.wg.Add(1)\n\tgo func() {\n\t\tdefer a.wg.Done()\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\tcase <-a.closeCh:\n\t\t\tcancel()\n\t\t}\n\t}()\n\n\t// Process the data coming from the stream\n\ta.wg.Add(1)\n\tgo func() {\n\t\tdefer a.wg.Done()\n\t\tvar (\n\t\t\treadSeq uint64\n\t\t\texpectSeq uint64\n\t\t\tpayload *commonv1pb.StreamPayload\n\t\t\treadErr error\n\t\t)\n\n\t\t// Process all chunks until EOF\n\t\tfor {\n\t\t\tif ctx.Err() != nil {\n\t\t\t\tinWriter.CloseWithError(ctx.Err())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Get the payload from the chunk that was previously read\n\t\t\tpayload = reqProto.GetPayload()\n\t\t\tif payload != nil {\n\t\t\t\treadSeq, readErr = messaging.ReadChunk(payload, inWriter)\n\t\t\t\tif readErr != nil {\n\t\t\t\t\tinWriter.CloseWithError(readErr)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Check if the sequence number is greater than the previous\n\t\t\t\tif readSeq != expectSeq {\n\t\t\t\t\tinWriter.CloseWithError(fmt.Errorf(\"invalid sequence number received: %d (expected: %d)\", readSeq, expectSeq))\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\texpectSeq++\n\t\t\t}\n\n\t\t\t// Read the next chunk\n\t\t\treqProto.Reset()\n\t\t\treadErr = stream.RecvMsg(reqProto)\n\t\t\tif errors.Is(readErr, io.EOF) {\n\t\t\t\t// Receiving an io.EOF signifies that the client has stopped sending data over the pipe, so we can stop reading\n\t\t\t\tinWriter.Close()\n\t\t\t\tbreak\n\t\t\t} else if readErr != nil {\n\t\t\t\tinWriter.CloseWithError(fmt.Errorf(\"error receiving message: %w\", readErr))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif reqProto.HasOptions() {\n\t\t\t\tinWriter.CloseWithError(errors.New(\"options found in non-leading message\"))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Start the encryption or decryption\n\t// Errors here are synchronous and can be returned to the user right away\n\tvar (\n\t\tout io.Reader\n\t\tresProto runtimev1pb.CryptoResponses\n\t)\n\tswitch o := opts.(type) {\n\tcase encv1.EncryptOptions:\n\t\tout, err = encv1.Encrypt(inReader, o)\n\t\tresProto = &runtimev1pb.EncryptResponse{}\n\tcase encv1.DecryptOptions:\n\t\tout, err = encv1.Decrypt(inReader, o)\n\t\tresProto = &runtimev1pb.DecryptResponse{}\n\tdefault:\n\t\t// It's ok to panic here since this indicates a development-time error.\n\t\ta.Logger.Fatal(\"Invalid type for opts argument\")\n\t}\n\tif err != nil {\n\t\terr = messages.ErrCryptoOperation.WithFormat(err)\n\t\ta.Logger.Debug(err)\n\t\treturn err\n\t}\n\n\t// Get a buffer from the pool\n\tbuf := encv1.BufPool.Get().(*[]byte)\n\tdefer func() {\n\t\tencv1.BufPool.Put(buf)\n\t}()\n\n\t// Send the response to the client\n\tvar (\n\t\tsendSeq uint64\n\t\tdone bool\n\t)\n\tfor {\n\t\tif ctx.Err() != nil {\n\t\t\terr = messages.ErrCryptoOperation.WithFormat(ctx.Err())\n\t\t\ta.Logger.Debug(err)\n\t\t\treturn err\n\t\t}\n\n\t\t// Read the next chunk of data\n\t\tn, err := out.Read(*buf)\n\t\tif err == io.EOF {\n\t\t\tdone = true\n\t\t} else if err != nil {\n\t\t\terr = messages.ErrCryptoOperation.WithFormat(err)\n\t\t\ta.Logger.Debug(err)\n\t\t\treturn err\n\t\t}\n\n\t\t// Send the message if there's any data\n\t\tif n > 0 {\n\t\t\tresProto.SetPayload(&commonv1pb.StreamPayload{\n\t\t\t\tData: (*buf)[:n],\n\t\t\t\tSeq: sendSeq,\n\t\t\t})\n\t\t\tsendSeq++\n\n\t\t\terr = stream.SendMsg(resProto)\n\t\t\tif err != nil {\n\t\t\t\terr = messages.ErrCryptoOperation.WithFormat(fmt.Errorf(\"error sending message: %w\", err))\n\t\t\t\ta.Logger.Debug(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Stop with the last chunk\n\t\t// This will make the method return and close the stream\n\t\tif done {\n\t\t\tbreak\n\t\t}\n\n\t\t// Reset the object so we can re-use it\n\t\t// Use `resProto.Reset()` if more properties are added besides Payload to the proto\n\t\tresProto.SetPayload(nil)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d47b0041e7b573fed0529d4878ed51ab", "score": "0.45953256", "text": "func (dataStoreReplayPlayer *DataStoreReplayPlayer) ExtractFromStream(stream *nex.StreamIn) error {\n\tdataStoreReplayPlayer.Fighter = stream.ReadUInt8()\n\tdataStoreReplayPlayer.Health = stream.ReadUInt8()\n\tdataStoreReplayPlayer.WinningRate = stream.ReadUInt16LE()\n\tdataStoreReplayPlayer.Color = stream.ReadUInt8()\n\tdataStoreReplayPlayer.Color2 = stream.ReadUInt8()\n\tdataStoreReplayPlayer.PrincipalID = stream.ReadUInt32LE()\n\tdataStoreReplayPlayer.Country = stream.ReadUInt32LE()\n\tdataStoreReplayPlayer.Region = stream.ReadUInt8()\n\tdataStoreReplayPlayer.Number = stream.ReadUInt8()\n\n\treturn nil\n}", "title": "" }, { "docid": "c2dd724c7160f28bc9bb9433356028ed", "score": "0.45950663", "text": "func (dataStorePersistenceInfo *DataStorePersistenceInfo) ExtractFromStream(stream *nex.StreamIn) error {\n\tdataStorePersistenceInfo.OwnerID = stream.ReadUInt32LE()\n\tdataStorePersistenceInfo.PersistenceSlotID = stream.ReadUInt16LE()\n\tdataStorePersistenceInfo.DataID = stream.ReadUInt64LE()\n\n\treturn nil\n}", "title": "" }, { "docid": "6dc2341b018859182f759c7fa546f749", "score": "0.45945203", "text": "func Decrypt(cipherText, key []byte) (plainText []byte, err error) {\n\t// code is taken from here https://golang.org/pkg/crypto/cipher/#NewCFBDecrypter\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(cipherText) < aes.BlockSize {\n\t\treturn nil, ErrCipherTooShort\n\t}\n\tiv := cipherText[:aes.BlockSize]\n\tcipherText = cipherText[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\t//nolint: makezero // this is a legit use of a slice with a predefined length\n\tplainText = make([]byte, len(cipherText))\n\tstream.XORKeyStream(plainText, cipherText)\n\n\treturn plainText, nil\n}", "title": "" }, { "docid": "c91d001df33e079095f53ef5481e382b", "score": "0.4594334", "text": "func AESDecrypt(ct, key []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmode := ecb.NewECBDecrypter(block)\n\tpt := make([]byte, len(ct))\n\tmode.CryptBlocks(pt, ct)\n\tpadder := padding.NewPkcs7Padding(mode.BlockSize()) //兼容php\n\tpt, err = padder.Unpad(pt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pt, nil\n}", "title": "" }, { "docid": "c6e6dab9a91782f8b99e41d5ede42a1d", "score": "0.45927334", "text": "func decryptData(ciphertext string, secretKey *[32]byte) (string, error) {\n\n\tif \"\" == ciphertext {\n\t\treturn \"\", fault.CryptoFailed\n\t}\n\n\tencrypted, err := hex.DecodeString(ciphertext)\n\tif nil != err {\n\t\treturn \"\", err\n\t}\n\tif len(encrypted) <= 24 {\n\t\treturn \"\", fault.CryptoFailed\n\t}\n\n\t// When you decrypt, you must use the same nonce and key you used to\n\t// encrypt the message. A way to achieve this is to store the nonce\n\t// alongside the encrypted message\n\tvar nonce [24]byte\n\tcopy(nonce[:], encrypted[:24])\n\n\tdecrypted, ok := secretbox.Open(nil, encrypted[24:], &nonce, secretKey)\n\tif !ok {\n\t\treturn \"\", fault.CryptoFailed\n\t}\n\n\treturn string(decrypted), nil\n}", "title": "" }, { "docid": "d66041487e20bbec4d17d57c403dc08f", "score": "0.45898443", "text": "func Decrypt(secring *bufio.Reader, passphrase []byte, input *bufio.Reader, output *bufio.Writer) (string, string, error) {\n\tvar entity *openpgp.Entity\n\tvar entityList openpgp.EntityList\n\n\t// Open the secret key file\n\tentityList, err := openpgp.ReadKeyRing(secring)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tentity = entityList[0]\n\n\tentity.PrivateKey.Decrypt(passphrase)\n\tfor _, subkey := range entity.Subkeys {\n\t\tsubkey.PrivateKey.Decrypt(passphrase)\n\t}\n\n\t// Calculate input file hash\n\tinput_hasher := sha256.New()\n\t_input := io.TeeReader(input, input_hasher)\n\n\t// Base64 decoder\n\tdecoder := base64.NewDecoder(base64.StdEncoding, _input)\n\n\t// Data decrypter\n\tdecrypter, err := openpgp.ReadMessage(decoder, entityList, nil, nil)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// Calculate output file hash\n\toutput_hasher := sha256.New()\n\t_output := io.MultiWriter(output, output_hasher)\n\n\t// Create a buffer\n\tbuf := make([]byte, 1024)\n\tfor {\n\t\t// Read a chunk\n\t\tn, err := decrypter.UnverifiedBody.Read(buf)\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\tif n == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\t// Write a chunk\n\t\tif _, err = _output.Write(buf[:n]); err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\t// Close and flush files\n\tif err = output.Flush(); err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\treturn hex.EncodeToString(input_hasher.Sum(nil)), hex.EncodeToString(output_hasher.Sum(nil)), nil\n}", "title": "" }, { "docid": "e08f025f00d28525516d98e540cfc0c1", "score": "0.4586153", "text": "func DearchiveData(filename string, src io.Reader) interface{} {\n\tvar err error\n\tglog.Infof(\"DearchiveData: checking if %q is an archive file\\n\", filename)\n\text := filepath.Ext(prepareString(filename))\n\t//TODO: strip .gz ext prior to this call, if present, then check for just .tar\n\tvar r io.Reader\n\tswitch ext {\n\tcase ExtTar:\n\t\tglog.Infof(\"DearchiveData: detected %v archive format\\n\", ext)\n\t\tr, err = tarPrep(filename, src)\n\t\tif err != nil {\n\t\t\tglog.Infof(\"DearchiveData: error: %v\\n\", err)\n\t\t\treturn src // return passed-in reader\n\t\t}\n\tdefault:\n\t\tr = src\n\t}\n\treturn r\n}", "title": "" }, { "docid": "af0a9a0c5665b4011ca36835302fe2fa", "score": "0.45852998", "text": "func decrypt(key, text []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(text) < aes.BlockSize {\n\t\treturn nil, errors.New(\"cipher text too short\")\n\t}\n\n\tiv := text[:aes.BlockSize]\n\ttext = text[aes.BlockSize:]\n\tcfb := cipher.NewCFBDecrypter(block, iv)\n\tcfb.XORKeyStream(text, text)\n\tdata, err := base64.StdEncoding.DecodeString(string(text))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "4b1ba03cca15338d08ab0a8e77607407", "score": "0.45830202", "text": "func EciesDecrypt(cipher []byte, pri *ecies.PrivateKey) (msg []byte, err error) {\n\tmsg, err = pri.Decrypt(cipher, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn\n}", "title": "" } ]
140dcc91d4185e88396b795f43db2484
Exchange provides a mock function with given fields: ctx, code
[ { "docid": "96039bfcaeac355de02eddb3f84e3bd4", "score": "0.67772186", "text": "func (_m *IOAuthProvider) Exchange(ctx context.Context, code string) (*mockery.Employee, error) {\n\tret := _m.Called(ctx, code)\n\n\tvar r0 *mockery.Employee\n\tif rf, ok := ret.Get(0).(func(context.Context, string) *mockery.Employee); ok {\n\t\tr0 = rf(ctx, code)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*mockery.Employee)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, string) error); ok {\n\t\tr1 = rf(ctx, code)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" } ]
[ { "docid": "6d5145c0ec4578130fa73e3801676b1b", "score": "0.6250007", "text": "func (o *Fake) Exchange(code string) (*oauth2.Token, error) {\n\trand, err := util.GenerateRandomString(32)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &oauth2.Token{\n\t\tAccessToken: rand,\n\t\tTokenType: \"\",\n\t\tRefreshToken: \"\",\n\t\tExpiry: time.Time{},\n\t}, nil\n}", "title": "" }, { "docid": "3bf39f2fbce172835f31cf2b95fea58f", "score": "0.5704988", "text": "func CodeExchange(w http.ResponseWriter, r *http.Request, exchanger Exchanger) {\n\ttokenReq, err := ParseAccessTokenRequest(r, exchanger.Decoder())\n\tif err != nil {\n\t\tRequestError(w, r, err)\n\t}\n\tif tokenReq.Code == \"\" {\n\t\tRequestError(w, r, oidc.ErrInvalidRequest().WithDescription(\"code missing\"))\n\t\treturn\n\t}\n\tauthReq, client, err := ValidateAccessTokenRequest(r.Context(), tokenReq, exchanger)\n\tif err != nil {\n\t\tRequestError(w, r, err)\n\t\treturn\n\t}\n\tresp, err := CreateTokenResponse(r.Context(), authReq, client, exchanger, true, tokenReq.Code, \"\")\n\tif err != nil {\n\t\tRequestError(w, r, err)\n\t\treturn\n\t}\n\thttphelper.MarshalJSON(w, resp)\n}", "title": "" }, { "docid": "d59d1dea2cf077eca7ac7ab8440109b0", "score": "0.55493253", "text": "func TestProcessResponse(t *testing.T) {\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\tormerMock := beego.NewMockOrmer(mockCtrl)\n\trawSetterMock := beego.NewMockRawSeter(mockCtrl)\n\tdbm.DBAccess = ormerMock\n\tmeta := newMetaManager(true)\n\tcore.Register(meta)\n\n\tadd := &common.ModuleInfo{\n\t\tModuleName: meta.Name(),\n\t\tModuleType: common.MsgCtxTypeChannel,\n\t}\n\tbeehiveContext.AddModule(add)\n\tbeehiveContext.AddModuleGroup(meta.Name(), meta.Group())\n\tedgeHub := &common.ModuleInfo{\n\t\tModuleName: ModuleNameEdgeHub,\n\t\tModuleType: common.MsgCtxTypeChannel,\n\t}\n\tbeehiveContext.AddModule(edgeHub)\n\tbeehiveContext.AddModuleGroup(ModuleNameEdgeHub, modules.HubGroup)\n\taddEdged := &common.ModuleInfo{\n\t\tModuleName: ModuleNameEdged,\n\t\tModuleType: common.MsgCtxTypeChannel,\n\t}\n\tbeehiveContext.AddModule(addEdged)\n\n\t//jsonMarshall fail\n\tmsg := model.NewMessage(\"\").BuildRouter(ModuleNameEdged, GroupResource, model.ResourceTypeLease, model.ResponseOperation).FillBody(make(chan int))\n\tbeehiveContext.Send(modules.MetaManagerModuleName, *msg)\n\tmeta.processResponse(*msg)\n\tmessage, _ := beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"MarshallFail\", func(t *testing.T) {\n\t\tif message.GetContent() != marshalError {\n\t\t\tt.Errorf(\"Wrong Error message received : Wanted %v and Got %v\", marshalError, message.GetContent())\n\t\t}\n\t})\n\n\t//Database save error\n\tormerMock.EXPECT().Raw(gomock.Any(), gomock.Any()).Return(rawSetterMock).Times(1)\n\trawSetterMock.EXPECT().Exec().Return(nil, errFailedDBOperation).Times(1)\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdged, GroupResource, model.ResourceTypeLease, model.ResponseOperation)\n\tmeta.processResponse(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"DatabaseSaveError\", func(t *testing.T) {\n\t\twant := \"insert or update meta failed, \" + FailedDBOperation\n\t\tif message.GetContent() != want {\n\t\t\tt.Errorf(\"Wrong Error message received : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t})\n\n\t//Success Case Source EdgeD\n\tormerMock.EXPECT().Raw(gomock.Any(), gomock.Any()).Return(rawSetterMock).Times(1)\n\trawSetterMock.EXPECT().Exec().Return(nil, nil).Times(1)\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdged, GroupResource, model.ResourceTypeLease, model.ResponseOperation)\n\tmeta.processResponse(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdgeHub)\n\tt.Run(\"SuccessSourceEdged\", func(t *testing.T) {\n\t\twant := ModuleNameEdged\n\t\tif message.GetSource() != want {\n\t\t\tt.Errorf(\"Wrong message received : Wanted from source %v and Got from source %v\", want, message.GetSource())\n\t\t}\n\t})\n\n\t//Success Case Source EdgeHub\n\tormerMock.EXPECT().Raw(gomock.Any(), gomock.Any()).Return(rawSetterMock).Times(1)\n\trawSetterMock.EXPECT().Exec().Return(nil, nil).Times(1)\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameController, GroupResource, model.ResourceTypeLease, model.ResponseOperation)\n\tmeta.processResponse(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"SuccessSourceEdgeHub\", func(t *testing.T) {\n\t\twant := ModuleNameController\n\t\tif message.GetSource() != want {\n\t\t\tt.Errorf(\"Wrong message received : Wanted from source %v and Got from source %v\", want, message.GetSource())\n\t\t}\n\t})\n}", "title": "" }, { "docid": "f798c2172f6fad0e25f2452a21b5ac08", "score": "0.5464405", "text": "func ExchangeCode(w http.ResponseWriter, r *http.Request, code string, state string) (err error) {\n\tstatePtr := getState(state)\n\tif statePtr == nil {\n\t\terr = errors.New(\"state Key not found\")\n\t\treturn\n\t}\n\ttoken, err := getToken(w, r, statePtr.Service, AUTHORIZE, code, statePtr.AuthType, statePtr.PkceVerifier)\n\tif err != nil {\n\t\treturn\n\t}\n\tSetCookie(w, token, cookieName(statePtr.Service)) //note: must set cookie before writing to responsewriter\n\treturn\n}", "title": "" }, { "docid": "a0e3eecbc954825570c8ac1c8686e57e", "score": "0.54510933", "text": "func (_m *InvitationRepository) ConsumeInvitationCode(ctx context.Context, code string) (int32, error) {\n\tret := _m.Called(ctx, code)\n\n\tvar r0 int32\n\tif rf, ok := ret.Get(0).(func(context.Context, string) int32); ok {\n\t\tr0 = rf(ctx, code)\n\t} else {\n\t\tr0 = ret.Get(0).(int32)\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, string) error); ok {\n\t\tr1 = rf(ctx, code)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "a6d966a4553455be0397ad0f0a0f8341", "score": "0.5441421", "text": "func (_m *Mock) ResendChangePhoneNumberCode() (*tdlib.AuthenticationCodeInfo, error) {\n\tret := _m.Called()\n\n\tvar r0 *tdlib.AuthenticationCodeInfo\n\tif rf, ok := ret.Get(0).(func() *tdlib.AuthenticationCodeInfo); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*tdlib.AuthenticationCodeInfo)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "e3cc399d6ab3ad0792947c2bc26bbf0f", "score": "0.54019725", "text": "func (j *JwtVerifier) Exchange(ctx context.Context, code string) (*Token, error) {\n\tt, err := j.oauth2.Exchange(ctx, code)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Token{t}, nil\n}", "title": "" }, { "docid": "94c30b72a6302dcbbacde3b8337dfb58", "score": "0.538421", "text": "func (o *IssuerVerifier) Exchange(ctx context.Context, code string) (auth.OIDCToken, error) {\n\tif code != AuthorizationCode {\n\t\treturn auth.OIDCToken{}, errors.New(\"incorrect code\")\n\t}\n\n\treturn auth.OIDCToken{\n\t\tIDToken: IDToken,\n\t\tRefreshToken: refreshToken,\n\t}, nil\n}", "title": "" }, { "docid": "b179562ad97c48165e8a1868c24050aa", "score": "0.53713137", "text": "func (_m *Mock) SendAuthCode(code string) (tdlib.AuthorizationState, error) {\n\tret := _m.Called(code)\n\n\tvar r0 tdlib.AuthorizationState\n\tif rf, ok := ret.Get(0).(func(string) tdlib.AuthorizationState); ok {\n\t\tr0 = rf(code)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(tdlib.AuthorizationState)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(code)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "15c5f130832dfc4d50be7b2917d88643", "score": "0.5370043", "text": "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n function, args := stub.GetFunctionAndParameters()\n fmt.Println(\"invoke is running \" + function)\n\n // Handle different functions\n switch function {\n case \"initMember\":\n //create a new Member by adding info, also inits contacts\n return t.initMember(stub, args)\n case \"readMember\":\n //read a member's info\n return t.readMember(stub, args)\n\n case \"initTask\":\n //create a new Member by adding info, also inits contacts\n return t.initTask(stub, args)\n case \"readTask\":\n //read a member's info\n return t.readTask(stub, args)\n\n case \"initContact\":\n //create a new Member by adding info, also inits contacts\n return t.initContact(stub, args)\n case \"readContact\":\n //read a member's info\n return t.readContact(stub, args)\n\n case \"initMeeting\":\n //create a new Member by adding info, also inits contacts\n return t.initMeeting(stub, args)\n case \"readMeeting\":\n //provide list of members by location\n return t.readMeeting(stub, args)\n \n case \"queryMembersByLocation\":\n\t\t// read members by locations`\n return t.queryMembersByLocation(stub, args)\n \n \tcase \"queryTasksByReceivingMemberID\":\n\t\t// Query Tasks by ReceivingMemberID\n return t.queryTasksByReceivingMemberID(stub, args) \n\n case \"queryContactsByContactMemberID\":\n\t\t// Query Active Contacts by ReceivingMemberID\n return t.queryContactsByContactMemberID(stub, args)\n\n case \"queryMeetingsByContactMemberID\":\n\t\t// Query Active Contacts by ReceivingMemberID\n return t.queryMeetingsByContactMemberID(stub, args)\n\n case \"queryAllMembers\":\n\t\t// Query Active Contacts by ReceivingMemberID\n return t.queryAllMembers(stub)\n\n //queryContactsByRequestingMemberID\n case \"queryContactsByRequestingMemberID\":\n\t\t// Query Active Contacts by ReceivingMemberID\n return t.queryContactsByRequestingMemberID(stub, args) \n\n default:\n //error\n fmt.Println(\"invoke did not find func: \" + function)\n\t\treturn shim.Error(\"Received unknown function invocation: \" + function + \":concl\")\n }\n}", "title": "" }, { "docid": "8d60af422f9520db198e4ce8d05531f8", "score": "0.5347374", "text": "func mockBusinessFunctionCode() *BusinessFunctionCode {\n\tbfc := NewBusinessFunctionCode()\n\tbfc.BusinessFunctionCode = CustomerTransfer\n\tbfc.TransactionTypeCode = \" \"\n\treturn bfc\n}", "title": "" }, { "docid": "2d15e23bbecda2faa5dd3f5b43ba6731", "score": "0.52686495", "text": "func TestChaincode_Invoke(t *testing.T) {\n\ttcc := new(main.SimpleChaincode)\n\tstub := shim.NewMockStub(\"test\", tcc);\n\n\t// Init Alice=100 Bob=200\n\tcheckInit(t, stub, [][]byte{[]byte(\"init\"), []byte(\"Alice\"), []byte(\"100\"), []byte(\"Bob\"), []byte(\"200\")})\n\n\n\t// Invoke Alice -> Bob for 50\n\tcheckInvoke(t, stub, [][]byte{[]byte(\"invoke\"), []byte(\"pay\"), []byte(\"Alice\"), []byte(\"Bob\"), []byte(\"50\")})\n\tcheckQuery(t, stub, [][]byte{[]byte(\"invoke\"), []byte(\"query\"), []byte(\"Alice\")}, \"50\")\n\tcheckQuery(t, stub, [][]byte{[]byte(\"invoke\"), []byte(\"query\"), []byte(\"Bob\")}, \"250\")\n\n\tcheckInvoke(t, stub, [][]byte{[]byte(\"invoke\"), []byte(\"pay\"), []byte(\"Bob\"), []byte(\"Alice\"), []byte(\"125\")})\n\tcheckQuery(t, stub, [][]byte{[]byte(\"invoke\"), []byte(\"query\"), []byte(\"Alice\")}, \"175\")\n\tcheckQuery(t, stub, [][]byte{[]byte(\"invoke\"), []byte(\"query\"), []byte(\"Bob\")}, \"125\")\n}", "title": "" }, { "docid": "4dc1af9fabab03eb22c125ee31d678f6", "score": "0.5252927", "text": "func (_m *Mock) CheckRecoveryEmailAddressCode(code string) (*tdlib.PasswordState, error) {\n\tret := _m.Called(code)\n\n\tvar r0 *tdlib.PasswordState\n\tif rf, ok := ret.Get(0).(func(string) *tdlib.PasswordState); ok {\n\t\tr0 = rf(code)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*tdlib.PasswordState)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(code)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "bf77bbfdf6c9afaa974a4319eb5ba980", "score": "0.52237606", "text": "func MockInvoke(cc *testcc.MockStub, encKey []byte, args ...interface{}) peer.Response {\n\tencArgs, err := encryption.EncryptArgs(encKey, args...)\n\tif err != nil {\n\t\treturn response.Error(`unable to encrypt input args`)\n\t}\n\treturn cc.AddTransient(encryption.TransientMapWithKey(encKey)).InvokeBytes(encArgs...)\n}", "title": "" }, { "docid": "2d6498e706d9e6fe3f2c484b298d4cad", "score": "0.52185845", "text": "func TestProcessQuery(t *testing.T) {\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\tormerMock := beego.NewMockOrmer(mockCtrl)\n\tquerySetterMock := beego.NewMockQuerySeter(mockCtrl)\n\tdbm.DBAccess = ormerMock\n\tmeta := newMetaManager(true)\n\tcore.Register(meta)\n\n\tadd := &common.ModuleInfo{\n\t\tModuleName: meta.Name(),\n\t\tModuleType: common.MsgCtxTypeChannel,\n\t}\n\tbeehiveContext.AddModule(add)\n\tbeehiveContext.AddModuleGroup(meta.Name(), meta.Group())\n\tedgeHub := &common.ModuleInfo{\n\t\tModuleName: ModuleNameEdgeHub,\n\t\tModuleType: common.MsgCtxTypeChannel,\n\t}\n\tbeehiveContext.AddModule(edgeHub)\n\tbeehiveContext.AddModuleGroup(ModuleNameEdgeHub, modules.HubGroup)\n\tedged := &common.ModuleInfo{\n\t\tModuleName: ModuleNameEdged,\n\t\tModuleType: common.MsgCtxTypeChannel,\n\t}\n\tbeehiveContext.AddModule(edged)\n\n\tconnect.SetConnected(true)\n\n\t//process remote query jsonMarshall error\n\tmsg := model.NewMessage(\"\").BuildRouter(ModuleNameEdgeHub, GroupResource, \"test/\"+model.ResourceTypeConfigmap, model.QueryOperation).FillBody(make(chan int))\n\tmeta.processQuery(*msg)\n\tmessage, _ := beehiveContext.Receive(ModuleNameEdgeHub)\n\tmessage.Header.ParentID = message.GetID()\n\tmessage.SetResourceOperation(\"test/\"+model.ResourceTypeConfigmap, model.ResponseOperation)\n\tbeehiveContext.SendResp(message)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdgeHub)\n\tt.Run(\"ProcessRemoteQueryMarshallFail\", func(t *testing.T) {\n\t\tif message.GetContent() != marshalError {\n\t\t\tt.Errorf(\"Wrong Error message received : Wanted %v and Got %v\", marshalError, message.GetContent())\n\t\t}\n\t})\n\n\t//process remote query response error content\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdged, GroupResource, \"test/\"+model.ResourceTypeConfigmap, model.QueryOperation)\n\tmeta.processQuery(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdgeHub)\n\tmsg = model.NewMessage(message.GetID()).BuildRouter(ModuleNameEdgeHub, GroupResource, \"test/\"+model.ResourceTypeConfigmap, model.QueryOperation).FillBody(fmt.Errorf(\"test\"))\n\tbeehiveContext.SendResp(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdgeHub)\n\tmsgEdged, _ := beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"ProcessRemoteQueryResponseErrorContent\", func(t *testing.T) {\n\t\twant := OK\n\t\tif message.GetContent().(string) != want {\n\t\t\tt.Errorf(\"Wrong Error message received : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t\twantEdged := fmt.Errorf(\"test\").Error()\n\t\tif msgEdged.GetContent().(error).Error() != wantEdged {\n\t\t\tt.Errorf(\"Wrong Error message received : Wanted %v and Got %v\", wantEdged, msgEdged.GetContent().(error).Error())\n\t\t}\n\t})\n\n\t//process remote query db fail\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdgeHub, GroupResource, \"test/\"+model.ResourceTypeConfigmap, model.QueryOperation)\n\tmeta.processQuery(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdgeHub)\n\tmsg = model.NewMessage(message.GetID()).BuildRouter(ModuleNameEdged, GroupResource, \"test/\"+model.ResourceTypeConfigmap, model.QueryOperation).FillBody(\"TestMessage\")\n\tbeehiveContext.SendResp(*msg)\n\tbeehiveContext.Receive(ModuleNameEdgeHub)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"ProcessRemoteQueryDbFail\", func(t *testing.T) {\n\t\twant := \"TestMessage\"\n\t\tif message.GetContent() != want {\n\t\t\tt.Errorf(\"Wrong message received : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t})\n\n\t// No error and connected true\n\tfakeDao := new([]dao.Meta)\n\tfakeDaoArray := make([]dao.Meta, 1)\n\tfakeDaoArray[0] = dao.Meta{Key: \"Test\", Value: MessageTest}\n\tfakeDao = &fakeDaoArray\n\tquerySetterMock.EXPECT().All(gomock.Any()).SetArg(0, *fakeDao).Return(int64(1), nil).Times(1)\n\tquerySetterMock.EXPECT().Filter(gomock.Any(), gomock.Any()).Return(querySetterMock).Times(1)\n\tormerMock.EXPECT().QueryTable(gomock.Any()).Return(querySetterMock).Times(1)\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdgeHub, GroupResource, \"test/\"+model.ResourceTypeRule, model.QueryOperation)\n\tmeta.processQuery(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"LocalDatabaseNoErrorAndMetaFound\", func(t *testing.T) {\n\t\twant := make([]string, 1)\n\t\twant[0] = MessageTest\n\t\tbytesWant, _ := json.Marshal(want)\n\t\tbytesGot, _ := json.Marshal(message.GetContent())\n\t\tif string(bytesGot) != string(bytesWant) {\n\t\t\tt.Errorf(\"Wrong message receive : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t})\n\n\t//ResId Nil database error\n\tquerySetterMock.EXPECT().All(gomock.Any()).Return(int64(1), errFailedDBOperation).Times(1)\n\tquerySetterMock.EXPECT().Filter(gomock.Any(), gomock.Any()).Return(querySetterMock).Times(1)\n\tormerMock.EXPECT().QueryTable(gomock.Any()).Return(querySetterMock).Times(1)\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdgeHub, GroupResource, \"test/\"+model.ResourceTypeRule, model.QueryOperation)\n\tmeta.processQuery(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdgeHub)\n\tt.Run(\"ResIDNilDatabaseError\", func(t *testing.T) {\n\t\twant := \"failed to query meta in DB: \" + FailedDBOperation\n\t\tif message.GetContent() != want {\n\t\t\tt.Errorf(\"Wrong message receive : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t})\n\n\t//ResID not nil database error\n\tquerySetterMock.EXPECT().All(gomock.Any()).Return(int64(1), errFailedDBOperation).Times(1)\n\tquerySetterMock.EXPECT().Filter(gomock.Any(), gomock.Any()).Return(querySetterMock).Times(1)\n\tormerMock.EXPECT().QueryTable(gomock.Any()).Return(querySetterMock).Times(1)\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdgeHub, GroupResource, \"test/\"+model.ResourceTypeRule+\"/test\", model.QueryOperation)\n\tmeta.processQuery(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdgeHub)\n\tt.Run(\"ResIDNotNilDatabaseError\", func(t *testing.T) {\n\t\twant := \"failed to query meta in DB: \" + FailedDBOperation\n\t\tif message.GetContent() != want {\n\t\t\tt.Errorf(\"Wrong message receive : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t})\n\n\t//ResID not nil Success Case\n\tquerySetterMock.EXPECT().All(gomock.Any()).SetArg(0, *fakeDao).Return(int64(1), nil).Times(1)\n\tquerySetterMock.EXPECT().Filter(gomock.Any(), gomock.Any()).Return(querySetterMock).Times(1)\n\tormerMock.EXPECT().QueryTable(gomock.Any()).Return(querySetterMock).Times(1)\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdgeHub, GroupResource, \"test/\"+model.ResourceTypeRule+\"/test\", model.QueryOperation)\n\t//beehiveContext.Send(MetaManagerModuleName, *msg)\n\tmeta.processQuery(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"DatabaseNoErrorAndMetaFound\", func(t *testing.T) {\n\t\twant := make([]string, 1)\n\t\twant[0] = MessageTest\n\t\tbytesWant, _ := json.Marshal(want)\n\t\tbytesGot, _ := json.Marshal(message.GetContent())\n\t\tif string(bytesGot) != string(bytesWant) {\n\t\t\tt.Errorf(\"Wrong message receive : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t})\n}", "title": "" }, { "docid": "680af522a809106fe05d8a19b3824336", "score": "0.5201836", "text": "func TestMockEDiagnosticGetMessage(t *testing.T) {\n\to := &MockEDiagnostic{}\n\tv := \"message\"\n\to.On(\"GetMessage\").Once().Return(v)\n\tassert.Equal(t, v, o.GetMessage())\n\n\to.On(\"GetMessage\").Once().Return(func() string {\n\t\treturn v\n\t})\n\tassert.Equal(t, v, o.GetMessage())\n\to.AssertExpectations(t)\n}", "title": "" }, { "docid": "7f3465696aa32d8b49bd1f073a11adea", "score": "0.51987964", "text": "func mockPluginClient(url, method, token string, odataID string, body interface{}, basicAuth map[string]string) (*http.Response, error) {\n\n\tif url == \"http://localhost:9091/ODIM/v1/systems/1/bios/settings\" {\n\t\tbody := `{\"MessageId\": \"` + response.Failure + `\"}`\n\t\treturn &http.Response{\n\t\t\tStatusCode: http.StatusInternalServerError,\n\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t}, nil\n\t}\n\tif url == \"http://localhost:9091/ODIM/v1/Systems/1\" {\n\t\tbody := `{\"MessageId\": \"` + response.Failure + `\"}`\n\t\treturn &http.Response{\n\t\t\tStatusCode: http.StatusInternalServerError,\n\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t}, nil\n\t}\n\treturn nil, fmt.Errorf(\"InvalidRequest\")\n}", "title": "" }, { "docid": "abfb9338ca8a898d3a41bef2cea6d863", "score": "0.51879776", "text": "func TestTriggerDelivery(t *testing.T) {\n\n\tcredentialmanager.MockAuthCreds = true\n\n\treceivedEvent := make(chan *apimodels.KeptnContextExtendedCE)\n\tts := httptest.NewServer(\n\t\thttp.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(200)\n\t\t\tif strings.Contains(r.RequestURI, \"v1/event\") {\n\t\t\t\tdefer r.Body.Close()\n\t\t\t\tbytes, err := ioutil.ReadAll(r.Body)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"could not read received event payload: %s\", err.Error())\n\t\t\t\t}\n\t\t\t\tevent := &apimodels.KeptnContextExtendedCE{}\n\t\t\t\tif err := json.Unmarshal(bytes, event); err != nil {\n\t\t\t\t\tt.Errorf(\"could not decode received event: %s\", err.Error())\n\t\t\t\t}\n\t\t\t\tif *event.Type != keptnv2.GetTriggeredEventType(\"dev.artifact-delivery\") {\n\t\t\t\t\tt.Errorf(\"did not receive correct event: %s\", err.Error())\n\t\t\t\t}\n\t\t\t\tw.Write([]byte(eventContextMockResponse))\n\t\t\t\tgo func() {\n\t\t\t\t\treceivedEvent <- event\n\t\t\t\t}()\n\t\t\t\treturn\n\t\t\t} else if strings.Contains(r.RequestURI, \"/v1/metadata\") {\n\t\t\t\tdefer r.Body.Close()\n\t\t\t\tw.Write([]byte(metadataMockResponse))\n\t\t\t\treturn\n\t\t\t} else if strings.Contains(r.RequestURI, \"service\") {\n\t\t\t\tres := fmt.Sprintf(getSvcMockResponse, \"carts\")\n\t\t\t\tw.Write([]byte(res))\n\t\t\t\treturn\n\t\t\t} else if strings.Contains(r.RequestURI, \"/controlPlane/v1/project/\") {\n\t\t\t\tres := fmt.Sprintf(getProjectMockResponse, \"sockshop\", \"carts\", \"dev\")\n\t\t\t\tw.Write([]byte(res))\n\t\t\t\treturn\n\t\t\t}\n\t\t}),\n\t)\n\tdefer ts.Close()\n\n\tt.Setenv(\"MOCK_SERVER\", ts.URL)\n\n\tcmd := fmt.Sprintf(\"trigger delivery --project=%s --service=%s --stage=%s --sequence=%s \"+\n\t\t\"--image=%s --values=a.b.c=d --mock --values=c.d=e\", \"sockshop\", \"carts\", \"dev\", \"artifact-delivery\", \"docker-registry:5000/keptnexamples/carts:0.9.1\")\n\t_, err := executeActionCommandC(cmd)\n\n\tif err != nil {\n\t\tt.Errorf(unexpectedErrMsg, err)\n\t}\n\n\tselect {\n\tcase event := <-receivedEvent:\n\t\tdata, err := json.Marshal(event.Data)\n\t\trequire.Nil(t, err)\n\t\tdeplyomentTriggeredData := &keptnv2.DeploymentTriggeredEventData{}\n\t\trequire.Nil(t, json.Unmarshal(data, deplyomentTriggeredData))\n\n\t\trequire.Equal(t, \"docker-registry:5000/keptnexamples/carts:0.9.1\", deplyomentTriggeredData.ConfigurationChange.Values[\"image\"])\n\t\trequire.Equal(t, \"sockshop\", deplyomentTriggeredData.Project)\n\t\trequire.Equal(t, \"carts\", deplyomentTriggeredData.Service)\n\t\trequire.Equal(t, \"dev\", deplyomentTriggeredData.Stage)\n\t\tbreak\n\tcase <-time.After(5 * time.Second):\n\t\tt.Error(\"event was not sent\")\n\t}\n}", "title": "" }, { "docid": "925d060ff4a4bfcc8045e90e44dd0bb1", "score": "0.5121151", "text": "func (_m *Mock) ResendRecoveryEmailAddressCode() (*tdlib.PasswordState, error) {\n\tret := _m.Called()\n\n\tvar r0 *tdlib.PasswordState\n\tif rf, ok := ret.Get(0).(func() *tdlib.PasswordState); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*tdlib.PasswordState)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "2dbe87b6f89bcda42613d8478d8b7d81", "score": "0.51179403", "text": "func (_m *Mock) ResendAuthenticationCode() (*tdlib.Ok, error) {\n\tret := _m.Called()\n\n\tvar r0 *tdlib.Ok\n\tif rf, ok := ret.Get(0).(func() *tdlib.Ok); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*tdlib.Ok)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "388cd499a7af343f7b852b90051579f7", "score": "0.5117117", "text": "func (_m *ClientIface) Set(vb uint16, key string, flags int, exp int, body []byte, context ...*memcached.ClientContext) (*gomemcached.MCResponse, error) {\n\t_va := make([]interface{}, len(context))\n\tfor _i := range context {\n\t\t_va[_i] = context[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, vb, key, flags, exp, body)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 *gomemcached.MCResponse\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(uint16, string, int, int, []byte, ...*memcached.ClientContext) (*gomemcached.MCResponse, error)); ok {\n\t\treturn rf(vb, key, flags, exp, body, context...)\n\t}\n\tif rf, ok := ret.Get(0).(func(uint16, string, int, int, []byte, ...*memcached.ClientContext) *gomemcached.MCResponse); ok {\n\t\tr0 = rf(vb, key, flags, exp, body, context...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*gomemcached.MCResponse)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(uint16, string, int, int, []byte, ...*memcached.ClientContext) error); ok {\n\t\tr1 = rf(vb, key, flags, exp, body, context...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "6f644fc2e9a472024cb6a7b2c5ad1d77", "score": "0.5111701", "text": "func TestQuoteService_Create(t *testing.T) {\n\tctx := context.Background()\n\tquoteID := \"1234\"\n\n\trequest := &types.CreateQuoteRequestData{\n\t\tSourceCurrency: \"BYN\",\n\t\tTargetCurrency: \"EUR\",\n\t\tAmount: \"2021\",\n\t\tAccountID: 42,\n\t}\n\n\tres := &types.CreateQuoteResponseData{\n\t\tQuoteID: \"quote_id_from_external_provider\",\n\t\tTransactionFee: fmt.Sprint(123 * 0.07),\n\t\tEDT: 120,\n\t}\n\n\tfqd := &types.FullQuoteData{\"\", *request, *res}\n\n\ttests := []struct {\n\t\tname string\n\t\treq *types.CreateQuoteRequestData\n\t\tprepare func(xs *mock.MockExternalSvcClient, qr *mock.MockQuoteRepo)\n\t\twant *types.CreateQuoteResponseData\n\t\twantErr bool\n\t}{\n\t\t{\n\t\t\t\"1. Error empty request\",\n\t\t\tnil,\n\t\t\tfunc(xs *mock.MockExternalSvcClient, qr *mock.MockQuoteRepo) {},\n\t\t\tnil,\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\t\"2. Error on create quote\",\n\t\t\trequest,\n\t\t\tfunc(xs *mock.MockExternalSvcClient, qr *mock.MockQuoteRepo) {\n\t\t\t\txs.EXPECT().CreateQuote(ctx, request).Return(nil, errors.New(\"some error\"))\n\t\t\t},\n\t\t\tnil,\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\t\"3. Error on save quote\",\n\t\t\trequest,\n\t\t\tfunc(xs *mock.MockExternalSvcClient, qr *mock.MockQuoteRepo) {\n\t\t\t\txs.EXPECT().CreateQuote(ctx, request).Return(res, nil)\n\t\t\t\tqr.EXPECT().Save(ctx, fqd).Return(\"\", errors.New(\"some error\"))\n\t\t\t},\n\t\t\tnil,\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\t\"4. Success\",\n\t\t\trequest,\n\t\t\tfunc(xs *mock.MockExternalSvcClient, qr *mock.MockQuoteRepo) {\n\t\t\t\txs.EXPECT().CreateQuote(ctx, request).Return(res, nil)\n\t\t\t\tqr.EXPECT().Save(ctx, fqd).Return(quoteID, nil)\n\t\t\t},\n\t\t\t&types.CreateQuoteResponseData{\n\t\t\t\tQuoteID: quoteID,\n\t\t\t\tTransactionFee: fmt.Sprint(123 * 0.07),\n\t\t\t\tEDT: 120,\n\t\t\t},\n\t\t\tfalse,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tctrl := gomock.NewController(t)\n\t\t\tdefer ctrl.Finish()\n\n\t\t\txSvcMock := mock.NewMockExternalSvcClient(ctrl)\n\t\t\tquoteRepoMock := mock.NewMockQuoteRepo(ctrl)\n\n\t\t\ttt.prepare(xSvcMock, quoteRepoMock)\n\n\t\t\ts := &QuoteService{\n\t\t\t\txSvc: xSvcMock,\n\t\t\t\tquoteRepo: quoteRepoMock,\n\t\t\t}\n\t\t\tgot, err := s.Create(ctx, tt.req)\n\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\tt.Errorf(\"Create() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(got, tt.want) {\n\t\t\t\tt.Errorf(\"Create() got = %v, want %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "8aadc89f54411c6ae02d9b1324e1dcf0", "score": "0.50973004", "text": "func (t *Grower) Invoke(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n fmt.Println(\"********************************Invoke****************************************\")\n\n // Handle different functions\n if function == \"receiveOrder\" {\n // Receive Order from Dispensary\n return t.receiveOrder(stub, args)\n } else if function == \"shipOrder\" {\n // Transfer product to Dispensary\n return t.shipOrder(stub,args)\n }else if function == \"dispensaryPlacedOrder\" {\n // Order Placed from Dispensary\n return t.dispensaryPlacedOrder(stub, args)\n }else if function == \"shipmentReceivedByDispensary\" {\n // Grower shippment to Dispensary\n return t.shipmentReceivedByDispensary(stub, args)\n }else if function == \"customerPurchase\" {\n // Purchased by Customer\n return t.customerPurchase(stub,args)\n }\n return nil, errors.New(\"Received unknown function invocation\")\n}", "title": "" }, { "docid": "919c5c84eaa9f50678d408699acf1203", "score": "0.50905967", "text": "func (c *Config) Exchange(ctx context.Context, code string, opts ...AuthCodeOption) (*Token, error) {\n\tv := url.Values{\n\t\t\"grant_type\": {\"authorization_code\"},\n\t\t\"code\": {code},\n\t}\n\tif c.RedirectURL != \"\" {\n\t\tv.Set(\"redirect_uri\", c.RedirectURL)\n\t}\n\tfor _, opt := range opts {\n\t\topt.setValue(v)\n\t}\n\treturn retrieveToken(ctx, c, v)\n}", "title": "" }, { "docid": "cd37f0d49a2f571261bbf2e8394ca426", "score": "0.50684285", "text": "func CodeTest(t *testing.T, method string, url string, body interface{}, expectedCode int) *httptest.ResponseRecorder {\n\treturn responseTest(t, method, url, body, expectedCode)\n}", "title": "" }, { "docid": "c723eb577b1aab54801a8ae2b3168508", "score": "0.50638956", "text": "func (_m *TriggerMessageProcessor) Execute(ctx interfaces.AppFunctionContext, envelope types.MessageEnvelope) error {\n\tret := _m.Called(ctx, envelope)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(interfaces.AppFunctionContext, types.MessageEnvelope) error); ok {\n\t\tr0 = rf(ctx, envelope)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "fe536755612705572c14e6150669643c", "score": "0.5062864", "text": "func ticket_exchange(stub shim.ChaincodeStubInterface, args []string) (pb.Response) {\n\tvar err error\n\tfmt.Println(\"starting exchange\")\n\n\tif len(args) != 3 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 3\")\n\t}\n\n\t// input sanitation\n\terr = sanitize_arguments(args)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tvar ticketid = args[0]\n\tvar ownerid = args[1]\n\tvar account = args[2]\n\n\tfmt.Println(ticketid + \"/\" + ownerid + \"/\" + account )\n\n\tlotteryid, err := get_ticket(stub, ticketid)\n\tif err != nil {\n\t\treturn shim.Error(\"This ticket does not exist - \" + ticketid)\n\t}\n\n\t// get ticket's current state\n\tticketAsBytes, err := stub.GetState(ticketid)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get ticket\")\n\t}\n\tres := Ticket{}\n\tjson.Unmarshal(TicketAsBytes, &res) //un stringify it aka JSON.parse()\n\n\tif res.ownerid = hash(ownerid){\n\t\terr := exchange_award() // unfinish need bank\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"This ticket can't exchange - \" + ticketid)\n\t\t}else {\n\t\t\tres.isExchange = 1\n\t\t}\n\t}\n\n\tfmt.Println(\"- end exchange\")\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "e206672cca53e885cb070a0b1d6e75bd", "score": "0.5055617", "text": "func TestTokenReqCtxModifier(t *testing.T) {\n\n}", "title": "" }, { "docid": "d1bd8b402314ca8315968893a976bd2e", "score": "0.5050468", "text": "func TestExchangeKO(t *testing.T) {\n\tclient := NewMyDNSClient()\n\n\t_, _, err := client.Exchange(\"failedtest.example\", \"192.168.1.1\")\n\n\tif err == nil {\n\t\tt.Error(\"Exchange() should have returned and error\")\n\t}\n}", "title": "" }, { "docid": "498b531639068562a7ba67a5f97f87cf", "score": "0.5045379", "text": "func MockContext() context.Context {\n\tctx := context.Background()\n\tctx = context.WithValue(ctx, common.TransactionID, \"xyz\")\n\tctx = context.WithValue(ctx, common.ActionID, \"001\")\n\tctx = context.WithValue(ctx, common.ActionName, \"xyz\")\n\tctx = context.WithValue(ctx, common.ThreadID, \"0\")\n\tctx = context.WithValue(ctx, common.ThreadName, \"xyz\")\n\tctx = context.WithValue(ctx, common.ProcessName, \"xyz\")\n\treturn ctx\n}", "title": "" }, { "docid": "011be330a22cb39cbbef26aaf8a92711", "score": "0.5032834", "text": "func exchangeToken(code *oauthv1.OAuthAuthorizeToken, h *helper.H) (token string) {\n\tExpect(http.PostForm((&url.URL{\n\t\tScheme: \"https\",\n\t\tUser: url.UserPassword(code.ClientName, \"\"),\n\t\tHost: oauthRoute(h).Spec.Host,\n\t\tPath: \"/oauth/token\",\n\t}).String(), url.Values{\n\t\t\"code\": []string{code.Name},\n\t\t\"grant_type\": []string{\"authorization_code\"},\n\t\t\"code_verifier\": []string{code.CodeChallenge},\n\t\t\"redirect_uri\": []string{code.RedirectURI},\n\t})).Should(And(HaveHTTPStatus(http.StatusOK), WithTransform(func(r *http.Response) bool {\n\t\ttype T map[string]interface{}\n\t\treturn Expect(ioutil.ReadAll(r.Body)).To(WithTransform(func(b []byte) (t T) {\n\t\t\tExpect(json.Unmarshal(b, &t)).To(Succeed())\n\t\t\treturn t\n\t\t}, And(HaveKey(\"access_token\"), WithTransform(func(t T) string {\n\t\t\tExpect(t[\"access_token\"]).To(BeAssignableToTypeOf(\"string\"))\n\t\t\ttoken = t[\"access_token\"].(string)\n\t\t\treturn token\n\t\t}, Not(BeEmpty())))))\n\t}, BeTrue())))\n\treturn token\n}", "title": "" }, { "docid": "e32a778ff6ec4b9bc93c18c002ef2d66", "score": "0.5025915", "text": "func (t *SupplychainChaincode) Invoke(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n fmt.Println(\"invoke is running \" + function)\n\n callerDetails, err := GetCallerDetails(stub)\n if err != nil { fmt.Println(\"An error occured whilst obtaining the caller details\"); return nil, err}\n\n // Handle different functions\n if function == \"init\" {\n return t.Init(stub, \"init\", args)\n } else if function == \"clearData\" {\n return t.processClearData(stub, callerDetails, args)\n } else if function == \"addOrder\" {\n return t.processAddOrder(stub, callerDetails, args)\n } else if function == \"updateOrderStatus\" {\n return t.processUpdateOrderStatus(stub, callerDetails, args)\n }\n fmt.Println(\"invoke did not find func: \" + function)\n\n return nil, errors.New(\"Received unknown function invocation: \" + function)\n}", "title": "" }, { "docid": "aa7c386bd8f2aeac14b467136b2b6067", "score": "0.50173265", "text": "func (_m *EncryptionProvider) Modify(ctx context.Context, passphrase client.Passphrase) error {\n\tret := _m.Called(ctx, passphrase)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, client.Passphrase) error); ok {\n\t\tr0 = rf(ctx, passphrase)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "b532e0d37241f4633102031d50e96c5b", "score": "0.5012692", "text": "func (_m *MockServerTransport) IncrMsgSent() {\n\t_m.Called()\n}", "title": "" }, { "docid": "387683eceb9539589e89ca1dbe77dd43", "score": "0.50030005", "text": "func expectCode(t *testing.T, expected int, w *httptest.ResponseRecorder) {\n\tif expected != w.Code {\n\t\tt.Errorf(\"Expected code %v, got %v\", expected, w.Code)\n\t}\n}", "title": "" }, { "docid": "40b03aa8ebe76cbcdb8197e15c7d267b", "score": "0.5002431", "text": "func (_m *ProxyStorage) Get(ctx context.Context, code string) (map[string]string, error) {\n\tret := _m.Called(ctx, code)\n\n\tvar r0 map[string]string\n\tif rf, ok := ret.Get(0).(func(context.Context, string) map[string]string); ok {\n\t\tr0 = rf(ctx, code)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(map[string]string)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, string) error); ok {\n\t\tr1 = rf(ctx, code)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "67b126911ae4c57ef9dd082493783ab1", "score": "0.5000902", "text": "func (_m *Mock) ResendEmailAddressVerificationCode() (*tdlib.EmailAddressAuthenticationCodeInfo, error) {\n\tret := _m.Called()\n\n\tvar r0 *tdlib.EmailAddressAuthenticationCodeInfo\n\tif rf, ok := ret.Get(0).(func() *tdlib.EmailAddressAuthenticationCodeInfo); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*tdlib.EmailAddressAuthenticationCodeInfo)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "34f676cc533191af229169c06c128703", "score": "0.49987873", "text": "func (_m *Mock) RequestPasswordRecovery() (*tdlib.EmailAddressAuthenticationCodeInfo, error) {\n\tret := _m.Called()\n\n\tvar r0 *tdlib.EmailAddressAuthenticationCodeInfo\n\tif rf, ok := ret.Get(0).(func() *tdlib.EmailAddressAuthenticationCodeInfo); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*tdlib.EmailAddressAuthenticationCodeInfo)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "24abe0bb8762f1a90f53c3e05d544d60", "score": "0.4991648", "text": "func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar event string // Event entity\n\tvar eventVal int // State of event\n\tvar err error\n\n\tif len(args) != 3 && len(args) != 4 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 3 or 4\")\n\t}\n\n\tchainCodeToCall := args[0]\n\tevent = args[1]\n\teventVal, err = strconv.Atoi(args[2])\n\tif err != nil {\n\t\treturn shim.Error(\"Expected integer value for event state change\")\n\t}\n\tchannelID := \"\"\n\tif len(args) == 4 {\n\t\tchannelID = args[3]\n\t}\n\n\tif eventVal != 1 {\n\t\tfmt.Printf(\"Unexpected event. Doing nothing\\n\")\n\t\treturn shim.Success(nil)\n\t}\n\n\tf := \"invoke\"\n\tinvokeArgs := toChaincodeArgs(f, \"a\", \"b\", \"10\")\n\tresponse := stub.InvokeChaincode(chainCodeToCall, invokeArgs, channelID)\n\tif response.Status != shim.OK {\n\t\terrStr := fmt.Sprintf(\"Failed to invoke chaincode. Got error: %s\", string(response.Payload))\n\t\tfmt.Printf(errStr)\n\t\treturn shim.Error(errStr)\n\t}\n\n\tfmt.Printf(\"Invoke chaincode successful. Got response %s\", string(response.Payload))\n\n\t// Write the event state back to the ledger\n\terr = stub.PutState(event, []byte(strconv.Itoa(eventVal)))\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn response\n}", "title": "" }, { "docid": "85aa9455c51a6e6d1143fc02acd5681e", "score": "0.4991646", "text": "func (_m *MockServerTransport) IncrMsgRecv() {\n\t_m.Called()\n}", "title": "" }, { "docid": "e1f6c99bd20617d6f3d06ed075a97568", "score": "0.49841946", "text": "func (o *OIDCClient) Exchange(code string, options map[string]string) (*Tokens, error) {\n\tvar opts []oauth2.AuthCodeOption\n\tfor key, value := range options {\n\t\topts = append(opts, oauth2.SetAuthURLParam(key, value))\n\t}\n\toauth2Token, err := o.oauth2Config.Exchange(o.ctx, code, opts...)\n\tif err != nil {\n\t\treturn nil, errors.New(\"unable to exchange code for token\")\n\t}\n\trawIDToken, ok := oauth2Token.Extra(\"id_token\").(string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"no id_token field in oauth2 token\")\n\t}\n\n\tidToken, err := o.Verify(rawIDToken)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to verify signature\")\n\t}\n\treturn &Tokens{\n\t\tOauth2Token: oauth2Token,\n\t\tIdToken: idToken,\n\t}, nil\n}", "title": "" }, { "docid": "20f8f260bcb70e30049f69ec77573ae6", "score": "0.49700722", "text": "func (_m *Mock) SendEmailAddressVerificationCode(emailAddress string) (*tdlib.EmailAddressAuthenticationCodeInfo, error) {\n\tret := _m.Called(emailAddress)\n\n\tvar r0 *tdlib.EmailAddressAuthenticationCodeInfo\n\tif rf, ok := ret.Get(0).(func(string) *tdlib.EmailAddressAuthenticationCodeInfo); ok {\n\t\tr0 = rf(emailAddress)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*tdlib.EmailAddressAuthenticationCodeInfo)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(emailAddress)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "796d3b5a754d8d7ab0a7f50184f7d8f7", "score": "0.49665377", "text": "func TestProcessInvAndObjectExchange(t *testing.T) {\n\t// Send an inv and receive an inv.\n\t// Process a request for an object.\n\t// Send a request and receive an object.\n\t// Ignore addr messages.\n\n\ttooLongInvVect := make([]*wire.InvVect, wire.MaxInvPerMsg+1)\n\tfor i := 0; i < wire.MaxInvPerMsg+1; i++ {\n\t\ttooLongInvVect[i] = &wire.InvVect{Hash: *randomShaHash()}\n\t}\n\tTooLongInv := &wire.MsgInv{InvList: tooLongInvVect}\n\n\ttests := []struct {\n\t\tpeerDB []*wire.MsgObject // The messages already in the peer's db.\n\t\tmockDB []*wire.MsgObject // The messages that are already in the\n\t\tinvAction *PeerAction // Action for the mock peer to take upon receiving an inv.\n\t}{\n\t\t{ // Nobody has any inv in this test case!\n\t\t\t[]*wire.MsgObject{},\n\t\t\t[]*wire.MsgObject{},\n\t\t\t&PeerAction{\n\t\t\t\tMessages: []wire.Message{&wire.MsgVerAck{}},\n\t\t\t\tInteractionComplete: true},\n\t\t},\n\t\t{ // Send empty inv and should be disconnected.\n\t\t\t[]*wire.MsgObject{},\n\t\t\t[]*wire.MsgObject{},\n\t\t\t&PeerAction{\n\t\t\t\tMessages: []wire.Message{&wire.MsgVerAck{}, wire.NewMsgInv()},\n\t\t\t\tInteractionComplete: true,\n\t\t\t\tDisconnectExpected: true},\n\t\t},\n\t\t{ // Only the real peer should request data.\n\t\t\t[]*wire.MsgObject{},\n\t\t\t[]*wire.MsgObject{testObj[0], testObj[2], testObj[4], testObj[6], testObj[8]},\n\t\t\tnil,\n\t\t},\n\t\t{ // Neither peer should request data.\n\t\t\t[]*wire.MsgObject{testObj[0], testObj[2], testObj[4], testObj[6], testObj[8]},\n\t\t\t[]*wire.MsgObject{testObj[0], testObj[2], testObj[4], testObj[6], testObj[8]},\n\t\t\tnil,\n\t\t},\n\t\t{ // Only the mock peer should request data.\n\t\t\t[]*wire.MsgObject{testObj[0], testObj[2], testObj[4], testObj[6], testObj[8]},\n\t\t\t[]*wire.MsgObject{},\n\t\t\tnil,\n\t\t},\n\t\t{ // The peers have no data in common, so they should both ask for everything of the other.\n\t\t\t[]*wire.MsgObject{testObj[1], testObj[3], testObj[5], testObj[7], testObj[9]},\n\t\t\t[]*wire.MsgObject{testObj[0], testObj[2], testObj[4], testObj[6], testObj[8]},\n\t\t\tnil,\n\t\t},\n\t\t{ // The peers have some data in common.\n\t\t\t[]*wire.MsgObject{testObj[0], testObj[3], testObj[5], testObj[7], testObj[9]},\n\t\t\t[]*wire.MsgObject{testObj[0], testObj[2], testObj[4], testObj[6], testObj[8]},\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t[]*wire.MsgObject{},\n\t\t\t[]*wire.MsgObject{},\n\t\t\t&PeerAction{\n\t\t\t\tMessages: []wire.Message{&wire.MsgVerAck{}, TooLongInv},\n\t\t\t\tDisconnectExpected: true,\n\t\t\t\tInteractionComplete: true},\n\t\t},\n\t}\n\n\t// A channel for the mock peer to communicate with the test.\n\treport := make(chan TestReport)\n\t// A channel to make the fake incomming connection.\n\tincoming := make(chan peer.Connection)\n\n\t// Some parameters for the test sequence.\n\tlocalAddr := &net.TCPAddr{IP: net.ParseIP(\"127.0.0.1\"), Port: 8333}\n\tremoteAddr := &net.TCPAddr{IP: net.ParseIP(\"192.168.0.1\"), Port: 8333}\n\n\t// Load config.\n\tvar err error\n\tcfg, _, err = loadConfig(true)\n\tif err != nil {\n\t\tt.Fatalf(\"Config failed to load.\")\n\t}\n\tcfg.MaxPeers = 1\n\tdefer backendLog.Flush()\n\n\tfor testCase, test := range tests {\n\t\t// Define the objects that will go in the database.\n\t\t// Create server and start it.\n\t\tlisteners := []string{net.JoinHostPort(\"\", \"8445\")}\n\t\tdb := getMemDb(test.peerDB)\n\t\tserv, err := newServer(listeners, db,\n\t\t\tMockListen([]*MockListener{\n\t\t\t\tNewMockListener(localAddr, incoming, make(chan struct{}))}))\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Server failed to start.\")\n\t\t}\n\n\t\tserv.start([]*DefaultPeer{})\n\n\t\tmockConn := NewMockConnection(localAddr, remoteAddr, report,\n\t\t\tNewDataExchangePeerTester(test.mockDB, test.peerDB, test.invAction))\n\t\tmockSend := NewMockSendQueue(mockConn)\n\t\tinventory := peer.NewInventory()\n\t\tna, _ := wire.NewNetAddress(remoteAddr, 1, 0)\n\t\tserv.handleAddPeerMsg(tstNewPeerHandshakeComplete(serv, mockConn, inventory, mockSend, na))\n\n\t\tvar msg TestReport\n\t\tgo func() {\n\t\t\tmsg = <-report\n\t\t\tif msg.Err != nil {\n\t\t\t\tt.Errorf(\"error case %d: %s\", testCase, msg)\n\t\t\t}\n\t\t\tserv.Stop()\n\t\t}()\n\n\t\tserv.WaitForShutdown()\n\t\t// Check if the data sent is actually in the peer's database.\n\t\tif msg.DataSent != nil {\n\t\t\tfor _, hash := range msg.DataSent {\n\t\t\t\tif ok, _ := db.ExistsObject(hash); !ok {\n\t\t\t\t\tt.Error(\"test case \", testCase, \": Object\", *hash, \"not found in database.\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1dc7684fc6a61a4f6db2b90a6ac7457b", "score": "0.49646747", "text": "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n\tfunction, args := stub.GetFunctionAndParameters()\n\t//fmt.Println(\"invoke is running \" + function)\n\n\t// Check for health\n\t//if function == \"Ping\" {\n\t//\treturn t.Ping(stub)\n\t//}\n\n\t// PO operations\n\tif function == ADD_PO {\n\t\treturn t.initPurchaseOrders(stub, args)\n\t} else if function == GET_PO {\n\t\treturn t.readPurchaseOrder(stub, args)\n\t} else if function == UPDATE_PO {\n\t\treturn t.updatePurchaseOrders(stub, args)\n\t}\n\n\t// Entity operations\n\tif function == ADD_ENTITYMASTER {\n\t\treturn t.addEntity(stub, args)\n\t}else if function == GET_ENTITYMASTER {\n\t\treturn t.getEntity(stub, args)\n\t}else if function == UPDATE_ENTITYMASTER {\n\t\treturn t.updateEntities(stub, args)\n\t}\n\t// Document operations\n\tif function == ADD_DOCUMENTS {\n\t\treturn t.initDocuments(stub, args)\n\t} else if function == GET_DOCUMENTS {\n\t\treturn t.readDocument(stub, args)\n\t} else if function == UPDATE_DOCUMENTS {\n\t\treturn t.updateDocuments(stub, args)\n\t}\n\n\t// Invoice operations\n\tif function == ADD_INVOICES {\n\t\treturn t.addInvoices(stub, args)\n\t} else if function == GET_INVOICES {\n\t\treturn t.getInvoice(stub, args)\n\t} else if function == UPDATE_INVOICES {\n\t\treturn t.updateInvoices(stub, args)\n\t}\n\t// Unmatched Ops\n\tif function == GET_UNMATCHED {\n\t\treturn t.getUnmatched(stub, args)\n\t}\n\n\tfmt.Println(\"invoke did not find func: \" + function) //error\n\treturn shim.Error(\"Received unknown function invocation\")\n}", "title": "" }, { "docid": "cb26b532527cdc9cf744c7390df4dea3", "score": "0.49643984", "text": "func (_m *Mock) CheckChangePhoneNumberCode(code string) (*tdlib.Ok, error) {\n\tret := _m.Called(code)\n\n\tvar r0 *tdlib.Ok\n\tif rf, ok := ret.Get(0).(func(string) *tdlib.Ok); ok {\n\t\tr0 = rf(code)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*tdlib.Ok)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(code)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "bf0b4a61688b4038105dab9134413e48", "score": "0.4946093", "text": "func (tctx *TestContext) invoke(funcName string, iargs ...interface{}) Rmap {\n\t//var bytes []byte\n\t//data := expectcc.PayloadIs(tctx.Cc.From(tctx.GetCurrentActor()).Invoke(funcName, iargs...), &bytes).([]byte)\n\tresponse := expectcc.ResponseOk(tctx.cc.From(tctx.GetCurrentActor()).Invoke(funcName, iargs...))\n\trm, err := NewFromBytes(response.Payload)\n\tExpect(err).To(BeNil())\n\treturn rm\n}", "title": "" }, { "docid": "fafa23b1389ddf5ba3ff72e7d3518d67", "score": "0.49420527", "text": "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n\tfunction, args := stub.GetFunctionAndParameters()\n\tfmt.Println(\" \")\n\tfmt.Println(\"starting invoke, for - \" + function)\n\n\t// Handle different functions\n\tif function == \"init\" { //initialize the chaincode state, used as reset\n\t\treturn t.Init(stub)\n\t} else if function == \"read\" { //generic read ledger\n\t\treturn read(stub, args)\n\t} else if function == \"write\" { //generic writes to ledger\n\t\treturn write(stub, args)\n\t} else if function == \"delete_employee\" { //deletes a employee from state\n\t\treturn delete_employee(stub, args)\n\t} else if function == \"init_employee\" { //create a new employee\n\t\treturn init_employee(stub, args)\n\t} else if function == \"set_domain\" { //change domain of a employee\n\t\treturn set_domain(stub, args)\n\t} else if function == \"set_company\" { //change company of a employee\n\t\treturn set_company(stub, args)\n\t} else if function == \"init_domain\" { //create a new domain\n\t\treturn init_domain(stub, args)\n\t} else if function == \"init_company\" { //create a new company\n\t\treturn init_company(stub, args)\n\t} else if function == \"read_all_data\" { //read everything, (employee + domain + company)\n\t\treturn read_all_data(stub)\n\t} else if function == \"getHistory\" { //read history of a employee (audit)\n\t\treturn getHistory(stub, args)\n\t} else if function == \"getAllEmployee\" { //read a all employees by start and stop id\n\t\treturn getAllEmployee(stub, args)\n\t} else if function == \"getEmployeeById\" { //read a employee by id\n\t\treturn getEmployeeById(stub, args)\n\t} else if function == \"disable_domain\" { //disable a domain\n\t\treturn disable_domain(stub, args)\n\t} else if function == \"disable_company\" { //disable a company\n\t\treturn disable_company(stub, args)\n\t}\n\n\t// error out\n\tfmt.Println(\"Received unknown invoke function name - \" + function)\n\treturn shim.Error(\"Received unknown invoke function name - '\" + function + \"'\")\n}", "title": "" }, { "docid": "f1f8c0236fe367fa9bfc854be1deab8f", "score": "0.4934067", "text": "func TestExchangeOK(t *testing.T) {\n\tclient := NewMyDNSClient()\n\n\t_, _, err := client.Exchange(\"google.co.uk\", \"8.8.8.8\")\n\n\tif err != nil {\n\t\tt.Error(\"Exchange() should not have returned and error\")\n\t}\n}", "title": "" }, { "docid": "39fbe0b08809fa37a845628fde11c576", "score": "0.4924498", "text": "func (o OAuth2Service) ExchangeEmailCode(ctx context.Context, code string) (OAuth2Response, error) {\n\tif code == \"\" {\n\t\treturn OAuth2Response{}, ErrOAuth2RequestMissingCode\n\t}\n\tv := url.Values{}\n\tv.Set(\"grant_type\", \"email\")\n\tv.Set(\"code\", code)\n\tbuf := bytes.NewBuffer([]byte(v.Encode()))\n\treq, err := o.client.NewRequest(ctx, http.MethodPost, o.buildURL(\"/token\"), buf)\n\tif err != nil {\n\t\treturn OAuth2Response{}, fmt.Errorf(\"error constructing request: %w\", err)\n\t}\n\terr = o.client.AddClientCredentials(req)\n\tif err != nil {\n\t\treturn OAuth2Response{}, err\n\t}\n\tres, err := o.client.Do(req)\n\tif err != nil {\n\t\treturn OAuth2Response{}, fmt.Errorf(\"error making request: %w\", err)\n\t}\n\n\t// if we get any other response, we need to decode the response\n\t// and figure out what went wrong so we can surface a useful error\n\tresp, err := oauthResponse(res)\n\tif err != nil {\n\t\treturn OAuth2Response{}, err\n\t}\n\n\tif res.StatusCode == http.StatusInternalServerError &&\n\t\tresp.Error == oauth2ServerError {\n\t\treturn resp, ErrServerError\n\t}\n\tif res.StatusCode == http.StatusUnauthorized &&\n\t\tresp.Error == oauth2InvalidClientError {\n\t\treturn resp, ErrInvalidClientCredentialsError\n\t}\n\tif res.StatusCode == http.StatusBadRequest &&\n\t\tresp.Error == oauth2InvalidRequestError {\n\t\treturn resp, ErrInvalidRequestError\n\t}\n\tif res.StatusCode == http.StatusBadRequest &&\n\t\tresp.Error == oauth2InvalidGrantError {\n\t\treturn resp, ErrInvalidGrantError\n\t}\n\tif res.StatusCode == http.StatusBadRequest &&\n\t\tresp.Error == oauth2UnsupportedResponseTypeError {\n\t\treturn resp, ErrUnsupportedResponseTypeError\n\t}\n\tif resp.Error != \"\" {\n\t\treturn resp, ErrUnexpectedError\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "eb8bf690d49cf3b7b1dd9a211ac352f3", "score": "0.4913006", "text": "func (_e *ClientIface_Expecter) Set(vb interface{}, key interface{}, flags interface{}, exp interface{}, body interface{}, context ...interface{}) *ClientIface_Set_Call {\n\treturn &ClientIface_Set_Call{Call: _e.mock.On(\"Set\",\n\t\tappend([]interface{}{vb, key, flags, exp, body}, context...)...)}\n}", "title": "" }, { "docid": "dc461fe2b8390cee473ace8e214ed460", "score": "0.4901132", "text": "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n\tfunction, args := stub.GetFunctionAndParameters()\n\t//fmt.Println(\"invoke is running \" + function)\n\n\t//// Handle different functions\n\t//if function == \"initMarble\" { //create a new Marble\n\t//\treturn t.initMarble(stub, args)\n\t//} else if function == \"transferMarble\" { //change owner of a specific Marble\n\t//\treturn t.transferMarble(stub, args)\n\t//} else if function == \"transferMarblesBasedOnColor\" { //transfer all Marbles of a certain color\n\t//\treturn t.transferMarblesBasedOnColor(stub, args)\n\t//} else if function == \"delete\" { //delete a Marble\n\t//\treturn t.delete(stub, args)\n\t//} else if function == \"readMarble\" { //read a Marble\n\t//\treturn t.readMarble(stub, args)\n\t//} else if function == \"queryMarblesByOwner\" { //find Marbles for owner X using rich query\n\t//\treturn t.queryMarblesByOwner(stub, args)\n\t//} else if function == \"queryMarbles\" { //find Marbles based on an ad hoc rich query\n\t//\treturn t.queryMarbles(stub, args)\n\t//} else if function == \"getHistoryForMarble\" { //get history of values for a Marble\n\t//\treturn t.getHistoryForMarble(stub, args)\n\t//} else if function == \"getMarblesByRange\" { //get Marbles based on range query\n\t//\treturn t.getMarblesByRange(stub, args)\n\t//}\n\n\t// Check for health\n\tif function == \"Ping\" {\n\t\treturn t.Ping(stub)\n\t}\n\n\t// PO operations\n\tif function == ADD_PO {\n\t\treturn t.initPurchaseOrders(stub, args)\n\t} else if function == GET_PO {\n\t\treturn t.readPurchaseOrder(stub, args)\n\t} else if function == UPDATE_PO {\n\t\treturn t.updatePurchaseOrders(stub, args)\n\t}\n\n\t// User operations\n\tif function == \"initUser\" {\n\t\treturn t.initUser(stub, args)\n\t} else if function == \"readUser\" {\n\t\treturn t.readUser(stub, args)\n\t} else if function == \"updateUser\" {\n\t\treturn t.updateUser(stub, args)\n\t}\n\n\t// Document operations\n\tif function == ADD_DOCUMENTS {\n\t\treturn t.initDocuments(stub, args)\n\t} else if function == GET_DOCUMENTS {\n\t\treturn t.readDocument(stub, args)\n\t} else if function == UPDATE_DOCUMENTS {\n\t\treturn t.updateDocuments(stub, args)\n\t}\n\n\t// Invoice operations\n\tif function == ADD_INVOICES {\n\t\treturn t.addInvoices(stub, args)\n\t} else if function == GET_INVOICES {\n\t\treturn t.getInvoice(stub, args)\n\t} else if function == UPDATE_INVOICES {\n\t\treturn t.updateInvoices(stub, args)\n\t}\n\t// Unmatched Ops\n\tif function == GET_UNMATCHED {\n\t\treturn t.getUnmatched(stub, args)\n\t}\n\n\tfmt.Println(\"invoke did not find func: \" + function) //error\n\treturn shim.Error(\"Received unknown function invocation\")\n}", "title": "" }, { "docid": "3961cd36de2859bdb6974362d1d8f64e", "score": "0.48964664", "text": "func (t *food_supplychain) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n\tfunction, args := stub.GetFunctionAndParameters()\n\tfmt.Println(\"invoke is running \" + function)\n\n\t// Handle different functions\n\tif function == \"initLedger\" {\n\t\t//init ledger\n\t\treturn t.initLedger(stub, args)\n\t} else if function == \"signIn\" {\n\t\t//login user\n\t\treturn t.signIn(stub, args)\n\t} else if function == \"createUser\" {\n\t\t//create a new user\n\t\treturn t.createUser(stub, args)\n\t} else if function == \"createProduct\" {\n\t\t//create a new product\n\t\treturn t.createProduct(stub, args)\n\t} else if function == \"updateProduct\" {\n\t\t// update a product\n\t\treturn t.updateProduct(stub, args)\n\t} else if function == \"orderProduct\" {\n\t\t// order a product\n\t\treturn t.orderProduct(stub, args)\n\t} else if function == \"deliveredProduct\" {\n\t\t// order a product\n\t\treturn t.deliveredProduct(stub, args)\n\t} else if function == \"sendToWholesaler\" {\n\t\t// send to wholesaler\n\t\treturn t.sendToWholesaler(stub, args)\n\t} else if function == \"sendToDistributer\" {\n\t\t// send to Distributer\n\t\treturn t.sendToDistributer(stub, args)\n\t} else if function == \"sendToRetailer\" {\n\t\t// send to Retailer\n\t\treturn t.sendToRetailer(stub, args)\n\t} else if function == \"sellToConsumer\" {\n\t\t// send to Consumer\n\t\treturn t.sellToConsumer(stub, args)\n\t} else if function == \"queryAsset\" {\n\t\t// query any using asset-id\n\t\treturn t.queryAsset(stub, args)\n\t} else if function == \"queryAll\" {\n\t\t// query all assests of a type\n\t\treturn t.queryAll(stub, args)\n\t}\n\tfmt.Println(\"invoke did not find func: \" + function)\n\t//error\n\treturn shim.Error(\"Received unknown function invocation\")\n}", "title": "" }, { "docid": "439b02d7903d766c7e3bfa6e4d1d1cb7", "score": "0.48920295", "text": "func (f Func) Exchange(m *dns.Msg, addr string) (*dns.Msg, time.Duration, error) {\n\treturn f(m, addr)\n}", "title": "" }, { "docid": "2e24936152ad3cfd24c53a3d3b75e35e", "score": "0.48919815", "text": "func TestProcessUpdate(t *testing.T) {\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\tormerMock := beego.NewMockOrmer(mockCtrl)\n\trawSetterMock := beego.NewMockRawSeter(mockCtrl)\n\tdbm.DBAccess = ormerMock\n\tmeta := newMetaManager(true)\n\tcore.Register(meta)\n\n\tadd := &common.ModuleInfo{\n\t\tModuleName: meta.Name(),\n\t\tModuleType: common.MsgCtxTypeChannel,\n\t}\n\tbeehiveContext.AddModule(add)\n\tbeehiveContext.AddModuleGroup(meta.Name(), meta.Group())\n\tedgeHub := &common.ModuleInfo{\n\t\tModuleName: ModuleNameEdgeHub,\n\t\tModuleType: common.MsgCtxTypeChannel,\n\t}\n\tbeehiveContext.AddModule(edgeHub)\n\tbeehiveContext.AddModuleGroup(ModuleNameEdgeHub, modules.HubGroup)\n\tedged := &common.ModuleInfo{\n\t\tModuleName: ModuleNameEdged,\n\t\tModuleType: common.MsgCtxTypeChannel,\n\t}\n\tbeehiveContext.AddModule(edged)\n\tconnect.SetConnected(true)\n\n\t//jsonMarshall fail\n\tmsg := model.NewMessage(\"\").BuildRouter(ModuleNameEdged, GroupResource, \"namespace/\"+model.ResourceTypeLease+\"/id\", model.UpdateOperation).FillBody(make(chan int))\n\tmeta.processUpdate(*msg)\n\tmessage, _ := beehiveContext.Receive(ModuleNameEdgeHub)\n\tmessage.Header.ParentID = message.GetID()\n\tbeehiveContext.SendResp(message)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"MarshallFail\", func(t *testing.T) {\n\t\tif message.GetContent() != marshalError {\n\t\t\tt.Errorf(\"Wrong Error message received : Wanted %v and Got %v\", marshalError, message.GetContent())\n\t\t}\n\t})\n\n\t//Database save error\n\trawSetterMock.EXPECT().Exec().Return(nil, errFailedDBOperation).Times(1)\n\tormerMock.EXPECT().Raw(gomock.Any(), gomock.Any()).Return(rawSetterMock).Times(1)\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdged, GroupResource, model.ResourceTypeNode, model.UpdateOperation)\n\tmeta.processUpdate(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"DatabaseSaveError\", func(t *testing.T) {\n\t\twant := \"insert or update meta failed, \" + FailedDBOperation\n\t\tif message.GetContent() != want {\n\t\t\tt.Errorf(\"Wrong Error message received : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t})\n\n\t//Success Case Source Edged, sync = true\n\tormerMock.EXPECT().Raw(gomock.Any(), gomock.Any()).Return(rawSetterMock).Times(1)\n\trawSetterMock.EXPECT().Exec().Return(nil, nil).Times(1)\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdged, GroupResource, model.ResourceTypeLease, model.UpdateOperation)\n\tmeta.processUpdate(*msg)\n\tedgehubMsg, _ := beehiveContext.Receive(ModuleNameEdgeHub)\n\tt.Run(\"SuccessSourceEdgedReceiveEdgehub\", func(t *testing.T) {\n\t\twant := model.UpdateOperation\n\t\tif edgehubMsg.GetOperation() != want {\n\t\t\tt.Errorf(\"Wrong message received : Wanted operation %v and Got operation %v\", want, edgehubMsg.GetOperation())\n\t\t}\n\t})\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"SuccessSourceEdgedReceiveEdged\", func(t *testing.T) {\n\t\twant := OK\n\t\tif message.GetContent() != want {\n\t\t\tt.Errorf(\"Wrong message received : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t})\n\n\t//Success Case Source CloudControllerModel\n\tormerMock.EXPECT().Raw(gomock.Any(), gomock.Any()).Return(rawSetterMock).Times(1)\n\trawSetterMock.EXPECT().Exec().Return(nil, nil).Times(1)\n\tmsg = model.NewMessage(\"\").BuildRouter(CloudControllerModel, GroupResource, model.ResourceTypeLease, model.UpdateOperation)\n\tmeta.processUpdate(*msg)\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"SuccessSend[CloudController->Edged]\", func(t *testing.T) {\n\t\twant := CloudControllerModel\n\t\tif message.GetSource() != want {\n\t\t\tt.Errorf(\"Wrong message received : Wanted from source %v and Got from source %v\", want, message.GetSource())\n\t\t}\n\t})\n\tmessage, _ = beehiveContext.Receive(ModuleNameEdgeHub)\n\tt.Run(\"SuccessSendCloud[CloudController->EdgeHub]\", func(t *testing.T) {\n\t\twant := OK\n\t\tif message.GetContent() != want {\n\t\t\tt.Errorf(\"Wrong message received : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t})\n\n\tormerMock.EXPECT().Raw(gomock.Any(), gomock.Any()).Return(rawSetterMock).Times(1)\n\trawSetterMock.EXPECT().Exec().Return(nil, errFailedDBOperation).Times(1)\n\tresource := fmt.Sprintf(\"%s/%s/%s\", \"default\", model.ResourceTypeLease, \"leaseName2\")\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdged, GroupResource, resource, model.UpdateOperation)\n\tmeta.processUpdate(*msg)\n\tmessage, err := beehiveContext.Receive(ModuleNameEdgeHub)\n\tif err != nil {\n\t\tt.Errorf(\"EdgeHub Channel not found: %v\", err)\n\t\treturn\n\t}\n\tmessage.Header.ParentID = message.GetID()\n\tholderIdentity := testHolderIdentity\n\tmessage.Content = &coordinationv1.Lease{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"leaseName2\",\n\t\t\tNamespace: \"default\",\n\t\t},\n\t\tSpec: coordinationv1.LeaseSpec{\n\t\t\tHolderIdentity: &holderIdentity,\n\t\t},\n\t}\n\tbeehiveContext.SendResp(message)\n\tmessage, err = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"Update failed\", func(t *testing.T) {\n\t\tif err != nil {\n\t\t\tt.Errorf(\"EdgeD Channel not found: %v\", err)\n\t\t\treturn\n\t\t}\n\t\twant := \"insert or update meta failed, \" + FailedDBOperation\n\t\tif message.GetContent() != want {\n\t\t\tt.Errorf(\"Wrong Error message received : Wanted %v and Got %v\", want, message.GetContent())\n\t\t}\n\t})\n\n\tormerMock.EXPECT().Raw(gomock.Any(), gomock.Any()).Return(rawSetterMock).Times(1)\n\trawSetterMock.EXPECT().Exec().Return(nil, nil).Times(1)\n\tresource = fmt.Sprintf(\"%s/%s/%s\", \"default\", model.ResourceTypeLease, \"leaseName2\")\n\tmsg = model.NewMessage(\"\").BuildRouter(ModuleNameEdged, GroupResource, resource, model.UpdateOperation)\n\tmeta.processUpdate(*msg)\n\tmessage, err = beehiveContext.Receive(ModuleNameEdgeHub)\n\tif err != nil {\n\t\tt.Errorf(\"EdgeHub Channel not found: %v\", err)\n\t\treturn\n\t}\n\tmessage.Header.ParentID = message.GetID()\n\tholderIdentity = testHolderIdentity\n\tmessage.Content = &coordinationv1.Lease{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"leaseName2\",\n\t\t\tNamespace: \"default\",\n\t\t},\n\t\tSpec: coordinationv1.LeaseSpec{\n\t\t\tHolderIdentity: &holderIdentity,\n\t\t},\n\t}\n\tbeehiveContext.SendResp(message)\n\tmessage, err = beehiveContext.Receive(ModuleNameEdged)\n\tt.Run(\"Update successfully\", func(t *testing.T) {\n\t\tif err != nil {\n\t\t\tt.Errorf(\"EdgeD Channel not found: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tleBytes, err := message.GetContentData()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Error getting lease data: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tvar le = &coordinationv1.Lease{}\n\t\terr = json.Unmarshal(leBytes, le)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Error unmarshal lease: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif le.Spec.HolderIdentity == nil {\n\t\t\tt.Errorf(\"Error getting lease holderIdentity\")\n\t\t\treturn\n\t\t}\n\t\tif *le.Spec.HolderIdentity != testHolderIdentity {\n\t\t\tt.Errorf(\"Error getting lease holderIdentity, expected edgehub, got %s\", *le.Spec.HolderIdentity)\n\t\t\treturn\n\t\t}\n\t})\n}", "title": "" }, { "docid": "2166ebe36381acbe83bcddec9e6da851", "score": "0.48917463", "text": "func ecsCredentialsApiMock() func() {\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Header().Add(\"Server\", \"MockECS\")\n\t\tlog.Printf(\"[DEBUG] Mock ECS credentials server received request: %s\", r.RequestURI)\n\t\tif r.RequestURI == \"/creds\" {\n\t\t\t_ = json.NewEncoder(w).Encode(map[string]string{\n\t\t\t\t\"AccessKeyId\": MockEcsCredentialsAccessKey,\n\t\t\t\t\"Expiration\": time.Now().UTC().Format(time.RFC3339),\n\t\t\t\t\"RoleArn\": \"arn:aws:iam::000000000000:role/EcsCredentials\",\n\t\t\t\t\"SecretAccessKey\": MockEcsCredentialsSecretKey,\n\t\t\t\t\"Token\": MockEcsCredentialsSessionToken,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t}))\n\n\tos.Setenv(\"AWS_CONTAINER_CREDENTIALS_FULL_URI\", ts.URL+\"/creds\")\n\treturn ts.Close\n}", "title": "" }, { "docid": "75a3ea2d22534fd1da85c01d909667b7", "score": "0.48912314", "text": "func (m *MockServer) call(method string, url string, content *string) error {\n\n\tclient := &http.Client{}\n\tvar req *http.Request\n\tvar err error\n\n\tif method == \"POST\" && content != nil {\n\t\treq, err = http.NewRequest(method, url, bytes.NewReader([]byte(*content)))\n\t} else {\n\t\treq, err = http.NewRequest(method, url, nil)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Set(\"X-Pact-Mock-Service\", \"true\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresponseBody, err := ioutil.ReadAll(res.Body)\n\tres.Body.Close()\n\tif res.StatusCode < 200 || res.StatusCode >= 300 {\n\t\treturn errors.New(string(responseBody))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "1590d2d79deee186663c19170c566100", "score": "0.48847294", "text": "func TestInvoke(t *testing.T) {\n\tstreamGetter = mockChaincodeStreamGetter\n\tcc := &shimTestCC{}\n\t//viper.Set(\"chaincode.logging.shim\", \"debug\")\n\tccname := \"shimTestCC\"\n\tpeerSide := setupcc(ccname)\n\tdefer mockPeerCCSupport.RemoveCC(ccname)\n\t//start the shim+chaincode\n\tgo Start(cc)\n\n\tdone := setuperror()\n\n\terrorFunc := func(ind int, err error) {\n\t\tdone <- err\n\t}\n\n\tpeerDone := make(chan struct{})\n\tdefer close(peerDone)\n\n\t//start the mock peer\n\tgo func() {\n\t\trespSet := &mockpeer.MockResponseSet{\n\t\t\tDoneFunc: errorFunc,\n\t\t\tErrorFunc: nil,\n\t\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_REGISTER}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_REGISTERED}},\n\t\t\t},\n\t\t}\n\t\tpeerSide.SetResponses(respSet)\n\t\tpeerSide.SetKeepAlive(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_KEEPALIVE})\n\t\terr := peerSide.Run(peerDone)\n\t\tassert.NoError(t, err, \"peer side run failed\")\n\t}()\n\n\t//wait for init\n\tprocessDone(t, done, false)\n\n\tchannelId := \"testchannel\"\n\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_READY, Txid: \"1\", ChannelId: channelId})\n\n\tci := &pb.ChaincodeInput{Args: [][]byte{[]byte(\"init\"), []byte(\"A\"), []byte(\"100\"), []byte(\"B\"), []byte(\"200\")}, Decorations: nil}\n\tpayload := utils.MarshalOrPanic(ci)\n\trespSet := &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_PUT_STATE, Txid: \"2\"}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: \"2\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_PUT_STATE, Txid: \"2\"}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: \"2\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"2\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\t//use the payload computed from prev init\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_INIT, Payload: payload, Txid: \"2\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//good invoke\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_STATE, Txid: \"3\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: []byte(\"100\"), Txid: \"3\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_STATE, Txid: \"3\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: []byte(\"200\"), Txid: \"3\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_PUT_STATE, Txid: \"3\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: \"3\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_PUT_STATE, Txid: \"3\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: \"3\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"3\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"invoke\"), []byte(\"A\"), []byte(\"B\"), []byte(\"10\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"3\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//bad put\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_STATE, Txid: \"3a\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: []byte(\"100\"), Txid: \"3a\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_STATE, Txid: \"3a\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: []byte(\"200\"), Txid: \"3a\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_PUT_STATE, Txid: \"3a\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Txid: \"3a\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"3a\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"invoke\"), []byte(\"A\"), []byte(\"B\"), []byte(\"10\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"3a\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//bad get\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_STATE, Txid: \"3b\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Txid: \"3b\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"3b\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"invoke\"), []byte(\"A\"), []byte(\"B\"), []byte(\"10\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"3b\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//bad delete\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_DEL_STATE, Txid: \"4\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Txid: \"4\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"4\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"delete\"), []byte(\"A\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"4\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//good delete\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_DEL_STATE, Txid: \"4a\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: \"4a\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"4a\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"delete\"), []byte(\"A\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"4a\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//bad invoke\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"5\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"badinvoke\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"5\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//range query\n\n\t//create the response\n\trangeQueryResponse := &pb.QueryResponse{Results: []*pb.QueryResultBytes{\n\t\t{ResultBytes: utils.MarshalOrPanic(&lproto.KV{Namespace: \"getputcc\", Key: \"A\", Value: []byte(\"100\")})},\n\t\t{ResultBytes: utils.MarshalOrPanic(&lproto.KV{Namespace: \"getputcc\", Key: \"B\", Value: []byte(\"200\")})}},\n\t\tHasMore: true}\n\trangeQPayload := utils.MarshalOrPanic(rangeQueryResponse)\n\n\t//create the next response\n\trangeQueryNext := &pb.QueryResponse{Results: nil, HasMore: false}\n\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_STATE_BY_RANGE, Txid: \"6\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: rangeQPayload, Txid: \"6\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_QUERY_STATE_NEXT, Txid: \"6\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: utils.MarshalOrPanic(rangeQueryNext), Txid: \"6\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_QUERY_STATE_CLOSE, Txid: \"6\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: \"6\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"6\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"rangeq\"), []byte(\"A\"), []byte(\"B\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"6\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//error range query\n\n\t//create the response\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_STATE_BY_RANGE, Txid: \"6a\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Payload: payload, Txid: \"6a\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"6a\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"rangeq\"), []byte(\"A\"), []byte(\"B\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"6a\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//error range query next\n\n\t//create the response\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_STATE_BY_RANGE, Txid: \"6b\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: rangeQPayload, Txid: \"6b\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_QUERY_STATE_NEXT, Txid: \"6b\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Txid: \"6b\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_QUERY_STATE_CLOSE, Txid: \"6b\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: \"6b\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"6b\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"rangeq\"), []byte(\"A\"), []byte(\"B\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"6b\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//error range query close\n\n\t//create the response\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_STATE_BY_RANGE, Txid: \"6c\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: rangeQPayload, Txid: \"6c\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_QUERY_STATE_NEXT, Txid: \"6c\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Txid: \"6c\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_QUERY_STATE_CLOSE, Txid: \"6c\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Txid: \"6c\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"6c\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"rangeq\"), []byte(\"A\"), []byte(\"B\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"6c\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//history query\n\n\t//create the response\n\thistoryQueryResponse := &pb.QueryResponse{Results: []*pb.QueryResultBytes{\n\t\t{ResultBytes: utils.MarshalOrPanic(&lproto.KeyModification{TxId: \"6\", Value: []byte(\"100\")})}},\n\t\tHasMore: true}\n\tpayload = utils.MarshalOrPanic(historyQueryResponse)\n\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_HISTORY_FOR_KEY, Txid: \"7\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: payload, Txid: \"7\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_QUERY_STATE_NEXT, Txid: \"7\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: utils.MarshalOrPanic(rangeQueryNext), Txid: \"7\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_QUERY_STATE_CLOSE, Txid: \"7\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: \"7\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"7\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"historyq\"), []byte(\"A\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"7\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//error history query\n\n\t//create the response\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_HISTORY_FOR_KEY, Txid: \"7a\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Payload: payload, Txid: \"7a\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"7a\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"historyq\"), []byte(\"A\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"7a\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//query result\n\n\t//create the response\n\tgetQRResp := &pb.QueryResponse{Results: []*pb.QueryResultBytes{\n\t\t{ResultBytes: utils.MarshalOrPanic(&lproto.KV{Namespace: \"getputcc\", Key: \"A\", Value: []byte(\"100\")})},\n\t\t{ResultBytes: utils.MarshalOrPanic(&lproto.KV{Namespace: \"getputcc\", Key: \"B\", Value: []byte(\"200\")})}},\n\t\tHasMore: true}\n\tgetQRRespPayload := utils.MarshalOrPanic(getQRResp)\n\n\t//create the next response\n\trangeQueryNext = &pb.QueryResponse{Results: nil, HasMore: false}\n\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_QUERY_RESULT, Txid: \"8\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: getQRRespPayload, Txid: \"8\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_QUERY_STATE_NEXT, Txid: \"8\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: utils.MarshalOrPanic(rangeQueryNext), Txid: \"8\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_QUERY_STATE_CLOSE, Txid: \"8\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: \"8\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"8\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"richq\"), []byte(\"A\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"8\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n\n\t//query result error\n\n\trespSet = &mockpeer.MockResponseSet{\n\t\tDoneFunc: errorFunc,\n\t\tErrorFunc: errorFunc,\n\t\tResponses: []*mockpeer.MockResponse{\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_GET_QUERY_RESULT, Txid: \"8a\", ChannelId: channelId}, RespMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Payload: nil, Txid: \"8a\", ChannelId: channelId}},\n\t\t\t{RecvMsg: &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_COMPLETED, Txid: \"8a\", ChannelId: channelId}, RespMsg: nil},\n\t\t},\n\t}\n\tpeerSide.SetResponses(respSet)\n\n\tci = &pb.ChaincodeInput{Args: [][]byte{[]byte(\"richq\"), []byte(\"A\")}, Decorations: nil}\n\tpayload = utils.MarshalOrPanic(ci)\n\tpeerSide.Send(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_TRANSACTION, Payload: payload, Txid: \"8a\", ChannelId: channelId})\n\n\t//wait for done\n\tprocessDone(t, done, false)\n}", "title": "" }, { "docid": "e7c20ec596b13113680594fad135b7d9", "score": "0.48820898", "text": "func MockChatContext() (sdk.Context, *keeper.Keeper) {\n\t// Codec\n\tinterfaceRegistry := codectypes.NewInterfaceRegistry()\n\tcdc := codec.NewProtoCodec(interfaceRegistry)\n\n\t// Store keys\n\tkeys := sdk.NewKVStoreKeys(types.StoreKey, identitytypes.StoreKey)\n\n\t// Create a identity keeper\n\tidentityKeeper := identitykeeper.NewKeeper(cdc, keys[identitytypes.StoreKey], keys[identitytypes.MemStoreKey])\n\n\t// Create a chat keeper\n\tchatKeeper := keeper.NewKeeper(cdc, keys[types.StoreKey], keys[types.MemStoreKey], identityKeeper)\n\n\t// Create multiStore in memory\n\tdb := dbm.NewMemDB()\n\tcms := store.NewCommitMultiStore(db)\n\n\t// Mount stores\n\tcms.MountStoreWithDB(keys[types.StoreKey], sdk.StoreTypeIAVL, db)\n\tcms.LoadLatestVersion()\n\n\t// Create context\n\tctx := sdk.NewContext(cms, tmproto.Header{}, false, log.NewNopLogger())\n\n\treturn ctx, chatKeeper\n}", "title": "" }, { "docid": "f83900690f335931dbc7eb7dbc10039e", "score": "0.48759243", "text": "func (m *ContractRequesterMock) Call(p context.Context, p1 insolar.Message) (r insolar.Reply, r1 error) {\n\tcounter := atomic.AddUint64(&m.CallPreCounter, 1)\n\tdefer atomic.AddUint64(&m.CallCounter, 1)\n\n\tif len(m.CallMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.CallMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to ContractRequesterMock.Call. %v %v\", p, p1)\n\t\t\treturn\n\t\t}\n\n\t\tinput := m.CallMock.expectationSeries[counter-1].input\n\t\ttestify_assert.Equal(m.t, *input, ContractRequesterMockCallInput{p, p1}, \"ContractRequester.Call got unexpected parameters\")\n\n\t\tresult := m.CallMock.expectationSeries[counter-1].result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the ContractRequesterMock.Call\")\n\t\t\treturn\n\t\t}\n\n\t\tr = result.r\n\t\tr1 = result.r1\n\n\t\treturn\n\t}\n\n\tif m.CallMock.mainExpectation != nil {\n\n\t\tinput := m.CallMock.mainExpectation.input\n\t\tif input != nil {\n\t\t\ttestify_assert.Equal(m.t, *input, ContractRequesterMockCallInput{p, p1}, \"ContractRequester.Call got unexpected parameters\")\n\t\t}\n\n\t\tresult := m.CallMock.mainExpectation.result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the ContractRequesterMock.Call\")\n\t\t}\n\n\t\tr = result.r\n\t\tr1 = result.r1\n\n\t\treturn\n\t}\n\n\tif m.CallFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to ContractRequesterMock.Call. %v %v\", p, p1)\n\t\treturn\n\t}\n\n\treturn m.CallFunc(p, p1)\n}", "title": "" }, { "docid": "a23fb7085cb94979bfe83d64f32ef0da", "score": "0.4872436", "text": "func (t AdminChaincode) Invoke(stub shim.ChaincodeStubInterface) (response peer.Response) {\n\tdefer Deferred(DeferHandlerPeerResponse, &response)\n\tt.Prepare(stub)\n\tvar fcn, params = stub.GetFunctionAndParameters()\n\tt.Logger.Info(\" Invoke fcn:\" + fcn)\n\tswitch fcn {\n\tcase \"panic\":\n\t\tPanicString(\"test panic\")\n\tcase \"richQuery\":\n\t\tvar query = params[0]\n\t\tt.Logger.Debug(\"Query string:\" + query)\n\t\tvar queryIter = t.GetQueryResult(query)\n\t\tvar states = ParseStates(queryIter)\n\t\tfor i, v := range states.States {\n\t\t\tt.Logger.Info(i, \":\", v)\n\t\t}\n\tcase \"set\":\n\t\tvar txId = t.CCAPI.GetTxID()\n\t\tvar txTime = UnixMilliSecond(t.GetTxTime())\n\t\tt.PutStateObj(txId, couchDBValue{txTime})\n\t}\n\t{\n\t\ttransientMap, _ := stub.GetTransient()\n\t\tt.Logger.Info(\"==transientMap\")\n\t\tfor k, v := range transientMap {\n\t\t\tt.Logger.Info(k, \":\", string(v))\n\t\t}\n\t}\n\tvar txID = t.CCAPI.GetTxID()\n\tvar txTime = UnixMilliSecond(t.GetTxTime())\n\n\tt.PutStateObj(txID, couchDBValue{txTime})\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "03f88a324110bd6d458a8f317029837d", "score": "0.48711336", "text": "func (_m *Mock) CheckEmailAddressVerificationCode(code string) (*tdlib.Ok, error) {\n\tret := _m.Called(code)\n\n\tvar r0 *tdlib.Ok\n\tif rf, ok := ret.Get(0).(func(string) *tdlib.Ok); ok {\n\t\tr0 = rf(code)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*tdlib.Ok)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(code)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "3f59aef96b4784fe287b829ab043ce1c", "score": "0.48671615", "text": "func bindExchange(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ExchangeABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "fe8938c0c9fe77fc56f5dbcbe133158e", "score": "0.4862676", "text": "func TestHandler(ctx *fasthttp.RequestCtx) {\n\tres := &ctx.Response\n\tres.AppendBodyString(\"Hello MIRRO\")\n\tres.SetStatusCode(200)\n}", "title": "" }, { "docid": "e3f0a058317381bb034f0caa0620b7a2", "score": "0.48626572", "text": "func (t *ReadTest) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n\tfunction, args := stub.GetFunctionAndParameters()\n\tlogger.Infof(\"ReadTest Args=%s\", args)\n\n\tif function == \"concat\" {\n\t\tif len(args) < 5 {\n\t\t\treturn shim.Error(\"Required args are: concat, channelID, ccID, key1, key2, key3\")\n\t\t}\n\t\tchannelID := string(args[0])\n\t\tccID := string(args[1])\n\t\tkey1 := string(args[2])\n\t\tkey2 := string(args[3])\n\t\tkey3 := string(args[4])\n\n\t\t// The unsafeGetState on the transaction snap can be invoked with or without a channel.\n\t\tresp1 := stub.InvokeChaincode(TransactionSnap, [][]byte{[]byte(QueryFunc), []byte(channelID), []byte(ccID), []byte(key1)}, channelID)\n\t\tresp2 := stub.InvokeChaincode(TransactionSnap, [][]byte{[]byte(QueryFunc), []byte(channelID), []byte(ccID), []byte(key2)}, \"\")\n\t\tresp3 := stub.InvokeChaincode(TransactionSnap, [][]byte{[]byte(QueryFunc), []byte(channelID), []byte(ccID), []byte(\"invalidKey\")}, \"\")\n\n\t\tif resp1.GetStatus() != 200 {\n\t\t\treturn shim.Error(\"Query on key1 failed: \" + resp1.GetMessage())\n\t\t}\n\t\tif resp2.GetStatus() != 200 {\n\t\t\treturn shim.Error(\"Query on key2 failed: \" + resp2.GetMessage())\n\t\t}\n\t\tif resp3.GetStatus() != 200 {\n\t\t\treturn shim.Error(\"Query on invalid key failed: \" + resp2.GetMessage())\n\t\t}\n\n\t\tlogger.Infof(\"Response from %s for key1 : %s \", TransactionSnap, string(resp1.Payload))\n\t\tlogger.Infof(\"Response from %s for key2 : %s \", TransactionSnap, string(resp2.Payload))\n\n\t\tv3 := strings.Join([]string{string(resp1.Payload), string(resp2.Payload)}, \"\")\n\t\terr := stub.PutState(key3, []byte(v3))\n\t\tif err != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"PutState failed: key %s, value %s, error: %s\", key3, v3, err.Error()))\n\t\t}\n\n\t\treturn shim.Success([]byte(v3))\n\t}\n\n\tif function == \"put\" {\n\t\tif len(args) < 2 {\n\t\t\treturn shim.Error(\"Required args are: key,value\")\n\t\t}\n\t\tkey := string(args[0])\n\t\tvalue := []byte(args[1])\n\t\tstub.PutState(key, value)\n\t\treturn shim.Success([]byte(\"\"))\n\t}\n\tif function == \"checkGetStateAndUnsafeGetState\" {\n\t\tif len(args) < 1 {\n\t\t\treturn shim.Error(\"Required args are: channelID, ccID, key\")\n\t\t}\n\t\tchannelID := string(args[0])\n\t\tccID := string(args[1])\n\t\tkey := string(args[2])\n\t\tvalue, err := stub.GetState(key)\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\tresp1 := stub.InvokeChaincode(TransactionSnap, [][]byte{[]byte(QueryFunc), []byte(channelID), []byte(ccID), []byte(key)}, channelID)\n\t\tif resp1.GetStatus() != 200 {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Query on %s failed: %s\", key, resp1.GetMessage()))\n\t\t}\n\t\tif string(value) != string(resp1.Payload) {\n\t\t\treturn shim.Error(fmt.Sprintf(\"unsafeGetState return different value from GetState %s %s\", value, resp1.Payload))\n\t\t}\n\t\treturn shim.Success([]byte(\"\"))\n\t}\n\n\treturn shim.Error(\"Only three functions is supported: concat, put, get\")\n\n}", "title": "" }, { "docid": "a907b2629fe72d67ce221e7065d32c90", "score": "0.48576227", "text": "func (_m *ClientIface) Add(vb uint16, key string, flags int, exp int, body []byte, context ...*memcached.ClientContext) (*gomemcached.MCResponse, error) {\n\t_va := make([]interface{}, len(context))\n\tfor _i := range context {\n\t\t_va[_i] = context[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, vb, key, flags, exp, body)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 *gomemcached.MCResponse\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(uint16, string, int, int, []byte, ...*memcached.ClientContext) (*gomemcached.MCResponse, error)); ok {\n\t\treturn rf(vb, key, flags, exp, body, context...)\n\t}\n\tif rf, ok := ret.Get(0).(func(uint16, string, int, int, []byte, ...*memcached.ClientContext) *gomemcached.MCResponse); ok {\n\t\tr0 = rf(vb, key, flags, exp, body, context...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*gomemcached.MCResponse)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(uint16, string, int, int, []byte, ...*memcached.ClientContext) error); ok {\n\t\tr1 = rf(vb, key, flags, exp, body, context...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "8d71d66f748a324da2d93a5e783b0f61", "score": "0.4857033", "text": "func stubMessage(mailbox string, ageHours int) storage.Message {\n\treturn &message.Delivery{\n\t\tMeta: event.MessageMetadata{\n\t\t\tMailbox: mailbox,\n\t\t\tID: fmt.Sprintf(\"MSG[age=%vh]\", ageHours),\n\t\t\tDate: time.Now().Add(time.Duration(ageHours*-1) * time.Hour),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "aa08b3acc7f6ebcd46f2194a91681d8d", "score": "0.48561677", "text": "func (t *Twitch) Exchange(ctx context.Context, code string) (*oauth2.Token, error) {\n\tctx = context.WithValue(ctx, oauth2.HTTPClient, t.cli)\n\treturn t.forUser.Exchange(ctx, code)\n}", "title": "" }, { "docid": "962f7e709c0dcacce52099c45f283e1e", "score": "0.48547655", "text": "func testCheckRightsStub() {\n}", "title": "" }, { "docid": "0e5c3798d4f027f4883fb44b5ba647f9", "score": "0.48512167", "text": "func (_m *ClientIface) GetAndTouch(vb uint16, key string, exp int, context ...*memcached.ClientContext) (*gomemcached.MCResponse, error) {\n\t_va := make([]interface{}, len(context))\n\tfor _i := range context {\n\t\t_va[_i] = context[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, vb, key, exp)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 *gomemcached.MCResponse\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(uint16, string, int, ...*memcached.ClientContext) (*gomemcached.MCResponse, error)); ok {\n\t\treturn rf(vb, key, exp, context...)\n\t}\n\tif rf, ok := ret.Get(0).(func(uint16, string, int, ...*memcached.ClientContext) *gomemcached.MCResponse); ok {\n\t\tr0 = rf(vb, key, exp, context...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*gomemcached.MCResponse)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(uint16, string, int, ...*memcached.ClientContext) error); ok {\n\t\tr1 = rf(vb, key, exp, context...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "66d706126c16bf5c72ea862f28172e18", "score": "0.48499838", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\r\n\t\r\n function, args := APIstub.GetFunctionAndParameters()\r\n fmt.Println(\"invoke is running \" + function)\r\n \r\n // Ledger Initiation \r\n //==================\r\n \r\n if function == \"initLedger\"{\r\n return s.initLedger(APIstub)\r\n }\r\n \r\n // Add new Employee to the db\r\n // ==========================\r\n \r\n if function == \"newEmployee\"{\r\n return s.newEmployee(APIstub,args)\r\n }\r\n\r\n // Get all Employees Info\r\n // ======================\r\n \r\n if function == \"queryAllEmployees\"{\r\n return s.queryAllEmployees(APIstub)\r\n } \r\n \r\n // Get Employee Info by ID\r\n // =======================\r\n \r\n if function == \"queryByID\"{\r\n return s.queryByID(APIstub,args)\r\n }\r\n\r\n // Delete EMPLOYEE data from db\r\n // ============================\r\n \r\n if function == \"DeleteEmployee\"{\r\n return s.DeleteEmployee(APIstub,args)\r\n }\r\n \r\n // Update Employee Phone Number\r\n // ============================\r\n \r\n if function == \"UpdateEmployeePhone\"{\r\n return s.UpdateEmployeePhone(APIstub,args)\r\n }\r\n \r\n // History of Employee\r\n // ===================\r\n \r\n if function == \"HistoryOfEmployees\"{\r\n return s.HistoryOfEmployees(APIstub,args)\r\n }\r\n\r\n // Get Info by range\r\n // =================\r\n \r\n if function == \"GetInfobyRange\"{\r\n return s.GetInfobyRange(APIstub,args)\r\n }\r\n\r\n fmt.Println(\"invoke did not find func: \" + function) //error\r\n\treturn shim.Error(\"Received unknown function invocation\")\r\n}", "title": "" }, { "docid": "5b424073673bb95584fa117f89c8af82", "score": "0.48397475", "text": "func (c *Config) Exchange(ctx context.Context, code string) (*oauth2.Token, error) {\n\ttoken, err := c.Config.Exchange(ctx, code)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := c.StoreToken(ctx, token); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn token, nil\n}", "title": "" }, { "docid": "02b2e6254362d308c719ff935bd92db7", "score": "0.483783", "text": "func TestRequestMagicCodeUserInDB(t *testing.T) {\n\tsetup()\n\t//Flag the email server as enabled\n\tecomail.MailServer.Working = true\n\terr := RequestMagicCode(\"user@isindb\")\n\tif err.Error() == \"Email address not in user database\" {\n\t\tt.Error(err.Error())\n\t}\n\tteardown()\n}", "title": "" }, { "docid": "99ffae00a6002e95e218339c58667360", "score": "0.48360336", "text": "func (mmCode *mCodeDescriptorMockCode) Expect() *mCodeDescriptorMockCode {\n\tif mmCode.mock.funcCode != nil {\n\t\tmmCode.mock.t.Fatalf(\"CodeDescriptorMock.Code mock is already set by Set\")\n\t}\n\n\tif mmCode.defaultExpectation == nil {\n\t\tmmCode.defaultExpectation = &CodeDescriptorMockCodeExpectation{}\n\t}\n\n\treturn mmCode\n}", "title": "" }, { "docid": "74e7eb4c5756e0ec26bd7c7d24503e60", "score": "0.48311427", "text": "func stubNextHandler(rcode int, err error) test.Handler {\n\treturn test.HandlerFunc(func(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\t\treturnCode := rcode\n\t\tif r == nil {\n\t\t\tr = &dns.Msg{}\n\t\t}\n\t\tr.SetEdns0(4096, false)\n\t\tif rcode != dns.RcodeServerFailure {\n\t\t\tr.MsgHdr.Rcode = rcode\n\t\t\treturnCode = dns.RcodeSuccess\n\t\t\tw.WriteMsg(r)\n\t\t} else {\n\t\t\tw.WriteMsg(nil)\n\t\t}\n\t\treturn returnCode, err\n\t})\n}", "title": "" }, { "docid": "eb56e2e5190d5000137d7091d1f14274", "score": "0.48305362", "text": "func (t *FabricChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n function, args := stub.GetFunctionAndParameters()\n fmt.Println(\"invoke is running \" + function)\n \n if function == \"createDiamond\" { //create a new diamond\n return t.createDiamond(stub, args)\n } else if function == \"transferDiamond\" { //change owner of a specific diamond\n return t.transferDiamond(stub, args)\n } else if function == \"transferdiamondsBasedOnOrigin\" { //transfer all diamonds of a certain origin\n return t.transferdiamondsBasedOnOrigin(stub, args)\n else if function == \"delete\" { //delete a diamond\n return t.delete(stub, args)\n } else if function == \"queryDiamond\" { //read a diamond\n return t.queryDiamond(stub, args)\n } \n \n else if function == \"getHistoryFordiamond\" { //get history of values for a diamond\n return t.getHistoryFordiamond(stub, args)\n } \n \n fmt.Println(\"invoke did not find func: \" + function) //error\n return shim.Error(\"Received unknown function invocation\")\n }\n}", "title": "" }, { "docid": "76fb1d7f6c3769586bab73e27e1cbe8b", "score": "0.48292285", "text": "func TestMockEResourceGetEObject(t *testing.T) {\n\tr := &MockEResource{}\n\to := &MockEObject{}\n\tr.On(\"GetEObject\", \"test\").Return(o).Once()\n\tr.On(\"GetEObject\", \"test\").Return(func(string) EObject {\n\t\treturn o\n\t}).Once()\n\tassert.Equal(t, o, r.GetEObject(\"test\"))\n\tassert.Equal(t, o, r.GetEObject(\"test\"))\n\tr.AssertExpectations(t)\n}", "title": "" }, { "docid": "8ebcc439b5228b6118e3cb895c57ad5b", "score": "0.4826381", "text": "func (t *Twitch) Exchange(ctx context.Context, code string) (*oauth2.Token, error) {\n\tctx = t.cli.AsOAuth2Client(ctx)\n\treturn t.forUser.Exchange(ctx, code)\n}", "title": "" }, { "docid": "fd8a227b40f4f6e0b8f6f303d1630390", "score": "0.4825177", "text": "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n logger.Info(\"########### example_cc0 Invoke ###########\")\n\n function, args := stub.GetFunctionAndParameters()\n \n if function == \"delete\" {\n // Deletes an entity from its state\n return t.delete(stub, args)\n }\n\n if function == \"query\" {\n // queries an entity state\n return t.query(stub, args)\n }\n if function == \"createRecord\" {\n // Deletes an entity from its state\n return t.createRecord(stub, args)\n }\n\n logger.Errorf(\"Unknown action, check the first argument, must be one of 'delete', 'query', or 'move'. But got: %v\", args[0])\n return shim.Error(fmt.Sprintf(\"Unknown action, check the first argument, must be one of 'delete', 'query', or 'move'. But got: %v\", args[0]))\n}", "title": "" }, { "docid": "8e9f847a9885a2a03267965de4279798", "score": "0.48234823", "text": "func (_m *ClientIface) Set(vb uint16, key string, flags int, exp int, body []byte) (*gomemcached.MCResponse, error) {\n\tret := _m.Called(vb, key, flags, exp, body)\n\n\tvar r0 *gomemcached.MCResponse\n\tif rf, ok := ret.Get(0).(func(uint16, string, int, int, []byte) *gomemcached.MCResponse); ok {\n\t\tr0 = rf(vb, key, flags, exp, body)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*gomemcached.MCResponse)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(uint16, string, int, int, []byte) error); ok {\n\t\tr1 = rf(vb, key, flags, exp, body)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "947d32304502a14554965d1905b31c90", "score": "0.48220792", "text": "func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response {\r\n\tvar age, name string // VARIABLE (ENTITY) NAMES\r\n\tvar ageVal int\t\t//AGE\r\n\tvar nameVal string\t//NAME\r\n\tvar X int \t\t//New AGE value\r\n\tvar N string \t\t//New NAME value\r\n\tvar err error\r\n\r\n\t//Ensure 4 arguments are passed into function\r\n\tif len(args) != 4 {\r\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 4. Did you include age and name?\")\r\n\t}\r\n\r\n\t//Define new names for \"age\" and \"name\" variables\r\n\tage = args[0]\r\n\tname = args[1]\r\n\r\n\t// Get the state from the ledger (ensure not in \"err\" state)\r\n\tageValbytes, err := stub.GetState(age)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif ageValbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\tageVal, _ = strconv.Atoi(string(ageValbytes))\r\n\r\n\tnameValbytes, err := stub.GetState(name)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif nameValbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\tnameVal = string(nameValbytes)\r\n\r\n\t// Set new values passed into function\r\n\tX, err = strconv.Atoi(args[2])\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Expecting an integer value...\")\r\n\t}\r\n\tN = args[3]\r\n\tageVal = X\r\n\tnameVal = N\r\n\tfmt.Printf(\"ageVal = %d, nameVal = %s\\n\", ageVal, nameVal)\r\n\r\n\t// Write the state back to the ledger\r\n\terr = stub.PutState(age, []byte(strconv.Itoa(ageVal)))\r\n\tif err != nil {\r\n\t\treturn shim.Error(err.Error())\r\n\t}\r\n\r\n\tstub.PutState(name, []byte(nameVal))\r\n\tif err != nil {\r\n\t\treturn shim.Error(err.Error())\r\n\t}\r\n\r\n\treturn shim.Success(nil)\r\n}", "title": "" }, { "docid": "a6f0e1d8d101da5cf3cd4a0e366fe831", "score": "0.48179454", "text": "func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response {\r\n\r\n\t// var Tval, Pval, Tsval string\r\n\tvar err error\r\n\r\n\tif len(args) != 3 {\r\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 3\")\r\n\t}\r\n\r\n\tACert := ACertInfo{}\r\n\tACert.Token = args[0]\r\n\tACert.Proof = args[1]\r\n\tACert.PInputs, err = strconv.Atoi(args[2])\r\n\r\n\tTvalbytes, err := stub.GetState(ACert.Token)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif Tvalbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\r\n\tPvalbytes, err := stub.GetState(ACert.Proof)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif Pvalbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\r\n\tPIsvalbytes, err := stub.GetState(string(ACert.PInputs))\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif PIsvalbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\r\n\tTSvalbytes, err := stub.GetState(ACert.Timestamp)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif TSvalbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\r\n\tChvalbytes, err := stub.GetState(ACert.ChID)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif Chvalbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\r\n\treturn shim.Success(nil)\r\n}", "title": "" }, { "docid": "2c7a006ab28aec511e7711f18e379439", "score": "0.48153082", "text": "func mock(expectKey string, value interface{}) ticket.Getter {\n\treturn func(_ *context.T, gotKey string) (ticket.Ticket, error) {\n\t\tif gotKey == expectKey {\n\t\t\treturn value.(ticket.Ticket), nil\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"ticket not found\")\n\t}\n}", "title": "" }, { "docid": "71afa9295bafaeb20e140a3487a5c49f", "score": "0.48114702", "text": "func (cc *ClientCommander) Exchange(m Message) (Message, error) {\n\treturn cc.ExchangeWithContext(context.Background(), m)\n}", "title": "" }, { "docid": "8c7babb400ede56016725998a5826c26", "score": "0.48082936", "text": "func httpMock(code int,\n\tbody string) (*httptest.Server, *Client) {\n\n\tserver := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(code)\n\t\tfmt.Fprintln(w, body)\n\t}))\n\n\ttransport := &http.Transport{\n\t\tProxy: func(req *http.Request) (*url.URL, error) {\n\t\t\treturn url.Parse(server.URL)\n\t\t},\n\t}\n\n\thttpClient := &http.Client{Transport: transport, Timeout: 5 * time.Second}\n\n\t// setting the host in the Client so I don't need to totally fake out\n\t// the TLS config\n\tclient := &Client{\n\t\tHost: \"http://api.bitfinex.com\",\n\t\tHTTPClient: httpClient,\n\t}\n\n\treturn server, client\n}", "title": "" }, { "docid": "3a89048626942c51e2458f45af928aff", "score": "0.4806277", "text": "func TestPaychGetCreateChannelMsg(t *testing.T) {\n\t//stm: @TOKEN_PAYCH_CREATE_001\n\tctx := context.Background()\n\tstore := NewStore(ds_sync.MutexWrap(ds.NewMapDatastore()))\n\n\tfrom := tutils.NewIDAddr(t, 101)\n\tto := tutils.NewIDAddr(t, 102)\n\n\tmock := newMockManagerAPI()\n\tdefer mock.close()\n\n\tmgr, err := newManager(store, mock)\n\trequire.NoError(t, err)\n\n\tamt := big.NewInt(10)\n\tch, mcid, err := mgr.GetPaych(ctx, from, to, amt, onChainReserve)\n\trequire.NoError(t, err)\n\trequire.Equal(t, address.Undef, ch)\n\n\tpushedMsg := mock.pushedMessages(mcid)\n\trequire.Equal(t, from, pushedMsg.Message.From)\n\trequire.Equal(t, lotusinit.Address, pushedMsg.Message.To)\n\trequire.Equal(t, amt, pushedMsg.Message.Value)\n}", "title": "" }, { "docid": "184665c6fc6f224dcfbb6a5ef1d2c932", "score": "0.48057097", "text": "func SetCode(ctx Context, code int) Context {\n\treturn context.WithValue(ctx, ContextKeyResponseCode, code)\n}", "title": "" }, { "docid": "aaf1c488d3e356cb1fc4a5eec3b1d200", "score": "0.48026195", "text": "func (t *Demo) Invoke(stub shim.ChaincodeStubInterface) peer.Response {\n\n\t//logger.Info(\"Invoke recu\")\n\n\t// Verification des arguments\n\tvar args = stub.GetArgs()\n\n\tvar n, present = params[string(args[0])]\n\n\t//logger.Info(\"Function: \",string(args[0]))\n\tif present == false {\n\t\treturn shim.Error(\"unkwnon function\")\n\t}\n\n\t//logger.Info(\"Args length: \",len(args))\n\tif len(args)-1 != n {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting \" + string(n))\n\t}\n\n\t// traitement de la function\n\tswitch string(args[0]) {\n\tcase \"hello\":\n\t\treturn shim.Success([]byte(\"Hello World \" + string(args[1])))\n\tcase \"read\":\n\t\tid, _ := cid.GetID(stub)\n\t\tmspid, _ := cid.GetMSPID(stub)\n\t\tdecodedid, _ := base64.StdEncoding.DecodeString(id)\n\n\t\troleid, ok, err := cid.GetAttributeValue(stub, \"role\")\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"Error retrieving the role attribute\")\n\t\t\t// There was an error trying to retrieve the attribute\n\t\t}\n\t\tAvalbytes, err := stub.GetState(string(args[1]))\n\t\tlogger.Info(\" read function, Key: \", string(args[1]), \" Value: \", string(Avalbytes), \" Value bytes: \", Avalbytes)\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"Failed to get state\")\n\t\t}\n\t\t//err = stub.SetEvent(\"READKEY\", []byte(`{\"key\":\"`+string(args[1])+`\",\"value\":\"`+string(Avalbytes)+`\"}`))\n\t\terr = stub.SetEvent(\"READKEY\", []byte(`{\"key\":\"`+string(args[1])+`\",\"value\":\"NOT SHOWN\"}`))\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\tif !ok {\n\t\t\t// The client identity does not possess the role attribute\n\t\t\treturn shim.Success([]byte(`{\"key\":\"` + string(args[1]) + `\",\"value\":\"` + string(Avalbytes) + `\",\"userid\":\"` + string(decodedid) + `\",\"orgid\":\"` + mspid + `\",\"role\":\"unknown\"}`))\n\t\t}\n\t\treturn shim.Success([]byte(`{\"key\":\"` + string(args[1]) + `\",\"value\":\"` + string(Avalbytes) + `\",\"userid\":\"` + string(decodedid) + `\",\"orgid\":\"` + mspid + `\",\"role\":\"` + roleid + `\"}`))\n\n\tcase \"write\":\n\t\tlogger.Info(\" write function, Key: \", string(args[1]), \" Value: \", string(args[2]))\n\n\t\tid, _ := cid.GetID(stub)\n\t\tmspid, _ := cid.GetMSPID(stub)\n\n\t\troleid, ok, err := cid.GetAttributeValue(stub, \"role\")\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"Error retrieving the role attribute\")\n\t\t\t// There was an error trying to retrieve the attribute\n\t\t}\n\n\t\terr = stub.PutState(string(args[1]), args[2])\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"Failed to write attribytes\")\n\t\t}\n\t\t//err = stub.SetEvent(\"WRITEKEY\", []byte(`{\"key\":\"`+string(args[1])+`\",\"value\":\"`+string(args[2])+`\"}`))\n\t\terr = stub.SetEvent(\"WRITEKEY\", []byte(`{\"key\":\"`+string(args[1])+`\",\"value\":\"NOT SHOWN\"}`))\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\tif !ok {\n\t\t\t// The client identity does not possess the role attribute\n\t\t\treturn shim.Success([]byte(`{\"key\":\"` + string(args[1]) + `\",\"value\":\"` + string(args[2]) + `\",\"userid\":\"` + id + `\",\"orgid\":\"` + mspid + `\",\"role\":\"unknown\"}`))\n\t\t}\n\t\treturn shim.Success([]byte(`{\"key\":\"` + string(args[1]) + `\",\"value\":\"` + string(args[2]) + `\",\"userid\":\"` + id + `\",\"orgid\":\"` + mspid + `\",\"role\":\"` + roleid + `\"}`))\n\n\tdefault:\n\t\treturn shim.Success([]byte(\"Hello World \"))\n\t}\n}", "title": "" }, { "docid": "3a6498c25b9686ff891ce19d2653bd6f", "score": "0.4799333", "text": "func TestCachingCalls(t *testing.T) {\n\ttestutils.MediumTest(t)\n\n\ttpath, cleanup := testutils.TempDir(t)\n\tdefer cleanup()\n\n\tctx := context.Background()\n\tmg := mockgcsclient.New()\n\tdefer mg.AssertExpectations(t)\n\n\tmcc := &db.MockCoverageCache{}\n\tmcc.On(\"CheckCache\", \"Some-Config:abcdefgh\").Return(common.CoverageSummary{MissedLines: 7, TotalLines: 77}, true)\n\tmcc.On(\"CheckCache\", mock.Anything).Return(common.CoverageSummary{}, false).Twice()\n\tmcc.On(\"StoreToCache\", mock.Anything, common.CoverageSummary{MissedLines: 12, TotalLines: 17}).Return(nil).Twice()\n\tdefer mcc.AssertExpectations(t)\n\n\tmockProcessingSteps()\n\n\tcalled := 0\n\tcalculateCoverage = func(ri renderInfo, folders ...string) (common.CoverageSummary, error) {\n\t\tcalled++\n\t\treturn common.CoverageSummary{MissedLines: 12, TotalLines: 17}, nil\n\t}\n\n\t// Assume they've been downloaded\n\tif _, err := fileutil.EnsureDirExists(path.Join(tpath, \"abcdefgh\")); err != nil {\n\t\tassert.Fail(t, \"Could not make dir abcdefgh\", err)\n\t}\n\ttestutils.WriteFile(t, path.Join(tpath, \"abcdefgh\", \"Some-Config.text.tar\"), FILE_CONTENT)\n\ttestutils.WriteFile(t, path.Join(tpath, \"abcdefgh\", \"Other-Config.text.tar\"), FILE_CONTENT)\n\n\tmg.On(\"AllFilesInDirectory\", mockctx, \"commit/abcdefgh/\", callback).Run(func(args mock.Arguments) {\n\t\tf := args.Get(2).(func(item *storage.ObjectAttrs))\n\t\tf(&storage.ObjectAttrs{Name: \"commit/abcdefgh/Some-Config.text.tar\"})\n\t\tf(&storage.ObjectAttrs{Name: \"commit/abcdefgh/Other-Config.text.tar\"})\n\t}).Return(nil).Once()\n\n\ti := New(tpath, mg, mcc)\n\ti.IngestCommits(ctx, mockLongCommits(\"abcdefgh\"))\n\tassert.Equal(t, 2, called)\n\tir := []IngestedResults{\n\t\t{\n\t\t\tCommit: &vcsinfo.ShortCommit{\n\t\t\t\tHash: \"abcdefgh\",\n\t\t\t\tAuthor: \"nobody\",\n\t\t\t},\n\t\t\tJobs: []common.CoverageSummary{\n\t\t\t\t{Name: \"Other-Config\", TotalLines: 17, MissedLines: 12},\n\t\t\t\t{Name: \"Some-Config\", TotalLines: 77, MissedLines: 7},\n\t\t\t},\n\t\t\tTotalCoverage: common.CoverageSummary{TotalLines: 17, MissedLines: 12},\n\t\t},\n\t}\n\n\ttestutils.AssertDeepEqual(t, ir, i.GetResults())\n}", "title": "" }, { "docid": "bfb55a3f81c174254607b8c580b5579d", "score": "0.47975758", "text": "func MockContactClient(ctx context.Context, url, method, token string, odataID string, body interface{}, credentials map[string]string) (*http.Response, error) {\n\tif url == \"https://localhost:1234/ODIM/v1/Subscriptions\" {\n\t\tif method == http.MethodDelete {\n\t\t\tbody := `{\"MessageId\": \"` + response.Success + `\"}`\n\t\t\tresponse := &http.Response{\n\t\t\t\tStatusCode: http.StatusNoContent,\n\t\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t\t}\n\t\t\treturn response, nil\n\t\t}\n\t\tb := body.(*common.Target)\n\t\tif b.DeviceUUID == \"d72dade0-c35a-984c-4859-1108132d72da\" {\n\t\t\tbody := `{\"MessageId\": \"` + response.Failure + `\"}`\n\t\t\treturn &http.Response{\n\t\t\t\tStatusCode: http.StatusBadRequest,\n\t\t\t\tHeader: map[string][]string{\n\t\t\t\t\t\"location\": {\"/ODIM/v1/Subscriptions/12\"},\n\t\t\t\t},\n\t\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t\t}, nil\n\t\t}\n\t\tbody := `{\"MessageId\": \"` + response.Success + `\"}`\n\t\tresponse := &http.Response{\n\t\t\tStatusCode: http.StatusCreated,\n\t\t\tHeader: map[string][]string{\n\t\t\t\t\"location\": {\"/ODIM/v1/Subscriptions/12\"},\n\t\t\t},\n\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t}\n\t\tresponse.Header.Set(\"location\", \"/ODIM/v1/Subscriptions/12\")\n\t\treturn response, nil\n\t} else if url == \"https://localhost:1234/ODIM/v1/Sessions\" {\n\t\tbody := `{\"MessageId\": \"` + response.Success + `\"}`\n\n\t\tr := &http.Response{\n\t\t\tStatusCode: http.StatusCreated,\n\t\t\tHeader: map[string][]string{\n\t\t\t\t\"X-Auth-Token\": {\"token\"},\n\t\t\t},\n\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t}\n\t\treturn r, nil\n\t} else if url == \"https://10.10.10.23:4321/ODIM/v1/Sessions\" || url == \"https://10.10.1.6:4321/ODIM/v1/Sessions\" {\n\t\tbody := `{\"MessageId\": \"` + response.Success + `\"}`\n\n\t\tr := &http.Response{\n\t\t\tStatusCode: http.StatusCreated,\n\t\t\tHeader: map[string][]string{\n\t\t\t\t\"X-Auth-Token\": {\"token\"},\n\t\t\t},\n\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t}\n\t\treturn r, nil\n\t} else if url == \"https://10.10.10.23:4321/ODIM/v1/Subscriptions\" {\n\t\tbody := `{\"MessageId\": \"` + response.Failure + `\"}`\n\t\treturn &http.Response{\n\t\t\tStatusCode: http.StatusUnauthorized,\n\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t}, nil\n\t} else if url == \"https://odim.controller.com:1234/ODIM/v1/Subscriptions/123\" {\n\t\tbody := `{\"MessageId\": \"` + response.Success + `\"}`\n\t\tresponse := &http.Response{\n\t\t\tStatusCode: http.StatusOK,\n\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t}\n\t\treturn response, nil\n\t} else if url == \"https://localhost:1234/ODIM/v1/Subscriptions/12345\" {\n\t\tbody := `{\"MessageId\": \"` + response.Success + `\"}`\n\t\tresponse := &http.Response{\n\t\t\tStatusCode: http.StatusOK,\n\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t}\n\t\treturn response, nil\n\t} else if url == \"https://10.10.1.6:4321/ODIM/v1/Subscriptions\" {\n\t\tbody := `{\"MessageId\": \"` + response.Success + `\"}`\n\t\tresponse := &http.Response{\n\t\t\tStatusCode: http.StatusCreated,\n\t\t\tHeader: map[string][]string{\n\t\t\t\t\"location\": {\"/ODIM/v1/Subscriptions/12345\"},\n\t\t\t},\n\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t}\n\t\tresponse.Header.Set(\"location\", \"/ODIM/v1/Subscriptions/12345\")\n\t\treturn response, nil\n\t} else if url == \"https://10.10.1.6:4321/ODIM/v1/Subscriptions/12345\" {\n\t\tbody := `{\"MessageId\": \"` + response.Success + `\"}`\n\t\tresponse := &http.Response{\n\t\t\tStatusCode: http.StatusOK,\n\t\t\tBody: ioutil.NopCloser(bytes.NewBufferString(body)),\n\t\t}\n\t\treturn response, nil\n\t}\n\n\treturn &http.Response{StatusCode: 0}, fmt.Errorf(\"InvalidRequest\")\n}", "title": "" }, { "docid": "8d8f68a058d47954d5d63aa41e708d63", "score": "0.47973737", "text": "func Test_Handler_Update(t *testing.T) {\n\ttype check func(*testing.T, *DBMock, *EmailSenderMock, *httptest.ResponseRecorder)\n\n\tchecks := func(cc ...check) []check { return cc }\n\n\thasResp := func(err bool) check {\n\t\treturn func(t *testing.T, _ *DBMock, _ *EmailSenderMock, rec *httptest.ResponseRecorder) {\n\t\t\tif err {\n\t\t\t\tassert.GreaterOrEqual(t, rec.Code, 400)\n\t\t\t\tassert.NotZero(t, rec.Body.Len())\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tassert.Equal(t, http.StatusNoContent, rec.Code)\n\t\t\tassert.Zero(t, rec.Body.Len())\n\t\t}\n\t}\n\n\twasFetchUserByIDCalled := func(count int, id xid.ID) check {\n\t\treturn func(t *testing.T, db *DBMock, _ *EmailSenderMock, _ *httptest.ResponseRecorder) {\n\t\t\tff := db.FetchUserByIDCalls()\n\t\t\trequire.Len(t, ff, count)\n\n\t\t\tif count == 0 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tassert.NotNil(t, ff[0].Ctx)\n\t\t\tassert.Equal(t, id, ff[0].ID)\n\t\t}\n\t}\n\n\twasUpdateUserCalled := func(count int, eml string, verif bool) check {\n\t\treturn func(t *testing.T, db *DBMock, _ *EmailSenderMock, _ *httptest.ResponseRecorder) {\n\t\t\tff := db.UpdateUserCalls()\n\t\t\trequire.Len(t, ff, count)\n\n\t\t\tif count == 0 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tassert.NotNil(t, ff[0].Ctx)\n\t\t\trequire.NotNil(t, ff[0].Usr)\n\t\t\tassert.Equal(t, eml, ff[0].Usr.ExposeCore().UnverifiedEmail.String)\n\t\t\tassert.NotZero(t, ff[0].Usr.ExposeCore().PasswordHash)\n\n\t\t\tif verif {\n\t\t\t\tassert.NotZero(t, ff[0].Usr.ExposeCore().Verification)\n\t\t\t}\n\t\t}\n\t}\n\n\twasSendEmailVerificationCalled := func(count int, eml string) check {\n\t\treturn func(t *testing.T, _ *DBMock, es *EmailSenderMock, _ *httptest.ResponseRecorder) {\n\t\t\tff := es.SendEmailVerificationCalls()\n\t\t\trequire.Len(t, ff, count)\n\n\t\t\tif count == 0 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tassert.NotNil(t, ff[0].Ctx)\n\t\t\tassert.Equal(t, eml, ff[0].Eml)\n\t\t\tassert.NotZero(t, ff[0].Tok)\n\t\t}\n\t}\n\n\twasSendPasswordChangedCalled := func(count int, eml string) check {\n\t\treturn func(t *testing.T, _ *DBMock, es *EmailSenderMock, _ *httptest.ResponseRecorder) {\n\t\t\tff := es.SendPasswordChangedCalls()\n\t\t\trequire.Len(t, ff, count)\n\n\t\t\tif count == 0 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tassert.NotNil(t, ff[0].Ctx)\n\t\t\tassert.Equal(t, eml, ff[0].Eml)\n\t\t\tassert.False(t, ff[0].Recov)\n\t\t}\n\t}\n\n\tdbStub := func(err1, err2 error, usr User) *DBMock {\n\t\treturn &DBMock{\n\t\t\tFetchUserByIDFunc: func(_ context.Context, _ xid.ID) (User, error) {\n\t\t\t\treturn usr, err1\n\t\t\t},\n\t\t\tUpdateUserFunc: func(_ context.Context, _ User) error {\n\t\t\t\treturn err2\n\t\t\t},\n\t\t}\n\t}\n\n\temailStub := func() *EmailSenderMock {\n\t\treturn &EmailSenderMock{\n\t\t\tSendEmailVerificationFunc: func(_ context.Context, _, _ string) {},\n\t\t\tSendPasswordChangedFunc: func(_ context.Context, _ string, _ bool) {},\n\t\t}\n\t}\n\n\tsessionStoreStub := func(err error) *depMock.SessionStore {\n\t\treturn &depMock.SessionStore{\n\t\t\tDeleteByUserKeyFunc: func(_ context.Context, _ string, _ ...string) error {\n\t\t\t\treturn err\n\t\t\t},\n\t\t}\n\t}\n\n\tinpUsr := Core{\n\t\tID: xid.New(),\n\t\tEmail: _email,\n\t}\n\tinpOldPass := \"password1\"\n\n\t_, err := inpUsr.SetPassword(inpOldPass)\n\trequire.NoError(t, err)\n\n\tinpNewEml := \"user123@email.com\"\n\tinpNewPass := \"password@1\"\n\n\tcc := map[string]struct {\n\t\tDB *DBMock\n\t\tEmail *EmailSenderMock\n\t\tSessionStore *depMock.SessionStore\n\t\tBody string\n\t\tSession bool\n\t\tChecks []check\n\t}{\n\t\t\"No active session\": {\n\t\t\tDB: dbStub(nil, nil, toPointer(inpUsr)),\n\t\t\tEmail: emailStub(),\n\t\t\tSessionStore: sessionStoreStub(nil),\n\t\t\tBody: toJSON(inpNewEml, inpNewPass, inpOldPass, false),\n\t\t\tChecks: checks(\n\t\t\t\thasResp(true),\n\t\t\t\twasFetchUserByIDCalled(0, xid.ID{}),\n\t\t\t\twasUpdateUserCalled(0, \"\", false),\n\t\t\t\twasSendEmailVerificationCalled(0, \"\"),\n\t\t\t\twasSendPasswordChangedCalled(0, \"\"),\n\t\t\t),\n\t\t},\n\t\t\"Invalid JSON body\": {\n\t\t\tDB: dbStub(nil, nil, toPointer(inpUsr)),\n\t\t\tEmail: emailStub(),\n\t\t\tSessionStore: sessionStoreStub(nil),\n\t\t\tBody: \"{\",\n\t\t\tSession: true,\n\t\t\tChecks: checks(\n\t\t\t\thasResp(true),\n\t\t\t\twasFetchUserByIDCalled(0, xid.ID{}),\n\t\t\t\twasUpdateUserCalled(0, \"\", false),\n\t\t\t\twasSendEmailVerificationCalled(0, \"\"),\n\t\t\t\twasSendPasswordChangedCalled(0, \"\"),\n\t\t\t),\n\t\t},\n\t\t\"Error returned by DB.FetchUserByID\": {\n\t\t\tDB: dbStub(assert.AnError, nil, nil),\n\t\t\tEmail: emailStub(),\n\t\t\tSessionStore: sessionStoreStub(nil),\n\t\t\tBody: toJSON(inpNewEml, inpNewPass, inpOldPass, false),\n\t\t\tSession: true,\n\t\t\tChecks: checks(\n\t\t\t\thasResp(true),\n\t\t\t\twasFetchUserByIDCalled(1, inpUsr.ID),\n\t\t\t\twasUpdateUserCalled(0, \"\", false),\n\t\t\t\twasSendEmailVerificationCalled(0, \"\"),\n\t\t\t\twasSendPasswordChangedCalled(0, \"\"),\n\t\t\t),\n\t\t},\n\t\t\"Error returned by User.ApplyInput\": {\n\t\t\tDB: dbStub(nil, nil, toPointer(inpUsr)),\n\t\t\tEmail: emailStub(),\n\t\t\tSessionStore: sessionStoreStub(nil),\n\t\t\tBody: toJSON(inpNewEml, \"pass\", inpOldPass, false),\n\t\t\tSession: true,\n\t\t\tChecks: checks(\n\t\t\t\thasResp(true),\n\t\t\t\twasFetchUserByIDCalled(1, inpUsr.ID),\n\t\t\t\twasUpdateUserCalled(0, \"\", false),\n\t\t\t\twasSendEmailVerificationCalled(0, \"\"),\n\t\t\t\twasSendPasswordChangedCalled(0, \"\"),\n\t\t\t),\n\t\t},\n\t\t\"Error returned by Core.InitVerification\": {\n\t\t\tDB: dbStub(nil, nil, toPointer(func() Core {\n\t\t\t\ttmp := inpUsr\n\t\t\t\ttmp.Verification.NextAt = null.TimeFrom(timeutil.Now().Add(time.Hour))\n\t\t\t\treturn tmp\n\t\t\t}())),\n\t\t\tEmail: emailStub(),\n\t\t\tSessionStore: sessionStoreStub(nil),\n\t\t\tBody: toJSON(inpNewEml, inpNewPass, inpOldPass, false),\n\t\t\tSession: true,\n\t\t\tChecks: checks(\n\t\t\t\thasResp(true),\n\t\t\t\twasFetchUserByIDCalled(1, inpUsr.ID),\n\t\t\t\twasUpdateUserCalled(0, \"\", false),\n\t\t\t\twasSendEmailVerificationCalled(0, \"\"),\n\t\t\t\twasSendPasswordChangedCalled(0, \"\"),\n\t\t\t),\n\t\t},\n\t\t\"Other sessions revokation error\": {\n\t\t\tDB: dbStub(nil, nil, toPointer(inpUsr)),\n\t\t\tEmail: emailStub(),\n\t\t\tSessionStore: sessionStoreStub(assert.AnError),\n\t\t\tBody: toJSON(inpNewEml, inpNewPass, inpOldPass, false),\n\t\t\tSession: true,\n\t\t\tChecks: checks(\n\t\t\t\thasResp(true),\n\t\t\t\twasFetchUserByIDCalled(1, inpUsr.ID),\n\t\t\t\twasUpdateUserCalled(0, \"\", false),\n\t\t\t\twasSendEmailVerificationCalled(0, \"\"),\n\t\t\t\twasSendPasswordChangedCalled(0, \"\"),\n\t\t\t),\n\t\t},\n\t\t\"Error returned by DB.UpdateUser\": {\n\t\t\tDB: dbStub(nil, assert.AnError, toPointer(inpUsr)),\n\t\t\tEmail: emailStub(),\n\t\t\tSessionStore: sessionStoreStub(nil),\n\t\t\tBody: toJSON(inpNewEml, inpNewPass, inpOldPass, false),\n\t\t\tSession: true,\n\t\t\tChecks: checks(\n\t\t\t\thasResp(true),\n\t\t\t\twasFetchUserByIDCalled(1, inpUsr.ID),\n\t\t\t\twasUpdateUserCalled(1, inpNewEml, true),\n\t\t\t\twasSendEmailVerificationCalled(0, \"\"),\n\t\t\t\twasSendPasswordChangedCalled(0, \"\"),\n\t\t\t),\n\t\t},\n\t\t\"Successful user update with only password change\": {\n\t\t\tDB: dbStub(nil, nil, toPointer(inpUsr)),\n\t\t\tEmail: emailStub(),\n\t\t\tSessionStore: sessionStoreStub(nil),\n\t\t\tBody: toJSON(\"\", inpNewPass, inpOldPass, false),\n\t\t\tSession: true,\n\t\t\tChecks: checks(\n\t\t\t\thasResp(false),\n\t\t\t\twasFetchUserByIDCalled(1, inpUsr.ID),\n\t\t\t\twasUpdateUserCalled(1, \"\", false),\n\t\t\t\twasSendEmailVerificationCalled(0, \"\"),\n\t\t\t\twasSendPasswordChangedCalled(1, inpUsr.Email),\n\t\t\t),\n\t\t},\n\t\t\"Successful user update with only email change\": {\n\t\t\tDB: dbStub(nil, nil, toPointer(inpUsr)),\n\t\t\tEmail: emailStub(),\n\t\t\tSessionStore: sessionStoreStub(nil),\n\t\t\tBody: toJSON(inpNewEml, \"\", inpOldPass, false),\n\t\t\tSession: true,\n\t\t\tChecks: checks(\n\t\t\t\thasResp(false),\n\t\t\t\twasFetchUserByIDCalled(1, inpUsr.ID),\n\t\t\t\twasUpdateUserCalled(1, inpNewEml, true),\n\t\t\t\twasSendEmailVerificationCalled(1, inpNewEml),\n\t\t\t\twasSendPasswordChangedCalled(0, \"\"),\n\t\t\t),\n\t\t},\n\t\t\"Successful user update with email and password changes\": {\n\t\t\tDB: dbStub(nil, nil, toPointer(inpUsr)),\n\t\t\tEmail: emailStub(),\n\t\t\tSessionStore: sessionStoreStub(nil),\n\t\t\tBody: toJSON(inpNewEml, inpNewPass, inpOldPass, false),\n\t\t\tSession: true,\n\t\t\tChecks: checks(\n\t\t\t\thasResp(false),\n\t\t\t\twasFetchUserByIDCalled(1, inpUsr.ID),\n\t\t\t\twasUpdateUserCalled(1, inpNewEml, true),\n\t\t\t\twasSendEmailVerificationCalled(1, inpNewEml),\n\t\t\t\twasSendPasswordChangedCalled(1, inpUsr.Email),\n\t\t\t),\n\t\t},\n\t}\n\n\tfor cn, c := range cc {\n\t\tc := c\n\n\t\tt.Run(cn, func(t *testing.T) {\n\t\t\tt.Parallel()\n\n\t\t\treq := httptest.NewRequest(\"GET\", \"http://test.com/\",\n\t\t\t\tstrings.NewReader(c.Body))\n\t\t\trec := httptest.NewRecorder()\n\t\t\thdl := newHandler()\n\t\t\thdl.session.manager = sessionup.NewManager(c.SessionStore,\n\t\t\t\tsessionup.ExpiresIn(time.Hour))\n\t\t\thdl.db = c.DB\n\t\t\thdl.email = c.Email\n\n\t\t\tif c.Session {\n\t\t\t\treq = req.WithContext(sessionup.NewContext(\n\t\t\t\t\tcontext.Background(),\n\t\t\t\t\tsessionup.Session{UserKey: inpUsr.ID.String()}))\n\t\t\t}\n\n\t\t\thdl.Update(rec, req)\n\t\t\ttime.Sleep(time.Millisecond) // to record goroutine func call\n\n\t\t\tfor _, ch := range c.Checks {\n\t\t\t\tch(t, c.DB, c.Email, rec)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "5aac02911bbc96c4e999cb04e137891e", "score": "0.47958794", "text": "func (s *EarlyAccessCodeService) emailCode(code string, email string) error {\r\n\tnewMessage := helpers.NewEmailMessage(`Welcome to Early Access!`,\r\n\t\tfmt.Sprintf(`Congratulations, you have been selected to participate in Hapr's Early Access program!\r\n\t\t<br><br>\r\n\t\tWe have been working hard the last few months to make Hapr the perfect happiness tracking service, but now we need feedback from actual users. \r\n\t\tWe need <b>YOU</b> to tell us what you love, and what you hate about the current interface and functionality.\r\n\t\t<br><br>\r\n\t\tYour early access code is <b>%s</b>\r\n\t\t<br><br>\r\n\t\tYou can visit the website <a href='app.hapr.io/signup'>HERE</a> and sign-up using your code!\r\n\t\t<br><br>\r\n\t\tAn introductory video can be found <a href='hapr.io/tutorial'>HERE</a>.\r\n\t\t<br><br>\r\n\t\tWe look forward to hearing about your experience, and thank you for helping us build something great!\r\n\t\t<br><br>\r\n\t\t- The Hapr Team`, code),\r\n\t\t[]string{email})\r\n\r\n\treturn helpers.SendEmailMessage(newMessage)\r\n}", "title": "" }, { "docid": "6efb5611502393c906eb4864f006458b", "score": "0.4795873", "text": "func mockVerifyPubKey(statusCode int) {\r\n\thttpmock.Reset()\r\n\thttpmock.RegisterResponder(\r\n\t\thttp.MethodGet,\r\n\t\ttestServerURL+\"verifypubkey/\"+testAlias+\"@\"+testDomain+\"/02ead23149a1e33df17325ec7a7ba9e0b20c674c57c630f527d69b866aa9b65b10\",\r\n\t\thttpmock.NewStringResponder(\r\n\t\t\tstatusCode,\r\n\t\t\t`{\"`+DefaultServiceName+`\": \"`+DefaultBsvAliasVersion+`\",\r\n\"handle\": \"`+testAlias+`@`+testDomain+`\",\r\n\"pubkey\": \"02ead23149a1e33df17325ec7a7ba9e0b20c674c57c630f527d69b866aa9b65b10\",\"match\": true}`,\r\n\t\t),\r\n\t)\r\n}", "title": "" }, { "docid": "9d26668cd509573365958c98acd059ff", "score": "0.47918585", "text": "func TestFuncWithAppContext(appCtx AppContext) {}", "title": "" }, { "docid": "eba7d81613dfed196838cd56a0dbdd09", "score": "0.4788752", "text": "func TestMockMock(t *testing.T) {\n\tstub := NewMockStub(\"MOCKMOCK\", &mock.Chaincode{})\n\tstub.args = [][]byte{[]byte(\"a\"), []byte(\"b\")}\n\tstub.MockInit(\"id\", nil)\n\tstub.GetArgs()\n\tstub.GetStringArgs()\n\tstub.GetFunctionAndParameters()\n\tstub.GetTxID()\n\tstub.GetChannelID()\n\tstub.MockInvoke(\"id\", nil)\n\tstub.MockInvokeWithSignedProposal(\"id\", nil, nil)\n\tstub.DelState(\"dummy\")\n\tstub.GetStateByRange(\"start\", \"end\")\n\tstub.GetQueryResult(\"q\")\n\n\tstub2 := NewMockStub(\"othercc\", &mock.Chaincode{})\n\tstub2.MockPeerChaincode(\"othercc\", stub2, \"mychan\")\n\tstub2.InvokeChaincode(\"othercc\", nil, \"mychan\")\n\tstub2.GetCreator()\n\tstub2.GetTransient()\n\tstub2.GetBinding()\n\tstub2.GetSignedProposal()\n\tstub2.GetArgsSlice()\n\tstub2.SetEvent(\"e\", nil)\n\tstub2.GetHistoryForKey(\"k\")\n\titer := &MockStateRangeQueryIterator{}\n\titer.HasNext()\n\titer.Close()\n\tgetBytes(\"f\", []string{\"a\", \"b\"})\n\tgetFuncArgs([][]byte{[]byte(\"a\")})\n}", "title": "" }, { "docid": "f2d9a840948ec5f7482de5c1e9648b72", "score": "0.47836846", "text": "func aMockedReceiver(arg string) (*Receiver, chan []byte, *MockPubSubSource, *MockMessageStore, error) {\n\tpubSubSource := NewMockPubSubSource(ctrl)\n\tmessageStore := NewMockMessageStore(ctrl)\n\tsendChannel := make(chan []byte)\n\tcmd := &guble.Cmd{\n\t\tName: guble.CmdReceive,\n\t\tArg: arg,\n\t}\n\trec, err := NewReceiverFromCmd(\"any-appId\", cmd, sendChannel, pubSubSource, messageStore, \"userId\")\n\treturn rec, sendChannel, pubSubSource, messageStore, err\n}", "title": "" }, { "docid": "77763faeebe7cf61a08491f894a320e7", "score": "0.47806096", "text": "func (_e *Module_Expecter) Run(ctx interface{}) *Module_Run_Call {\n\treturn &Module_Run_Call{Call: _e.mock.On(\"Run\", ctx)}\n}", "title": "" }, { "docid": "9b5bd25a112b42deba098234279071a2", "score": "0.47754577", "text": "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n\tfunction, args := stub.GetFunctionAndParameters()\n\tfmt.Println(\"invoke is running \" + function)\n\n\t// Handle different functions\n\tif function == \"initMarble\" { //create a new marble\n\t\treturn t.initMarble(stub, args)\n\t} else if function == \"transferMarble\" { //change owner of a specific marble\n\t\treturn t.transferMarble(stub, args)\n\t} else if function == \"transferMarblesBasedOnColor\" { //transfer all marbles of a certain color\n\t\treturn t.transferMarblesBasedOnColor(stub, args)\n\t} else if function == \"delete\" { //delete a marble\n\t\treturn t.delete(stub, args)\n\t} else if function == \"readMarble\" { //read a marble\n\t\treturn t.readMarble(stub, args)\n\t} else if function == \"queryMarblesByOwner\" { //find marbles for owner X using rich query\n\t\treturn t.queryMarblesByOwner(stub, args)\n\t} else if function == \"queryMarbles\" { //find marbles based on an ad hoc rich query\n\t\treturn t.queryMarbles(stub, args)\n\t} else if function == \"getHistoryForMarble\" { //get history of values for a marble\n\t\treturn t.getHistoryForMarble(stub, args)\n\t} else if function == \"getMarblesByRange\" { //get marbles based on range query\n\t\treturn t.getMarblesByRange(stub, args)\n\t} else if function == \"openTrade\" { //open a new marble trade\n\t\treturn t.openTrade(stub, args)\n\t} else if function == \"initOpenTrade\" { //open a new marble trade\n\t\treturn t.initOpenTrade(stub, args)\n\t} else if function == \"getOpenTradesByRange\" { //open a new marble trade\n\t\treturn t.getOpenTradesByRange(stub, args)\n\t} else if function == \"readOpenTrade\" { //read marble trades\n\t\treturn t.readOpenTrade(stub, args)\n\t} else if function == \"removeOpenTrade\" { //remove marble trade\n\t\treturn t.removeOpenTrade(stub, args)\n\t} else if function == \"swapMarble\" { // swap two marbles between owner\n\t\treturn t.swapMarble(stub, args)\n\t} else if function == \"swapMarbleTri\" { // swap two marbles between owner\n\t\treturn t.swapMarbleTri(stub, args)\n\t} else if function == \"matchTrade\" { // match the open trades\n\t\treturn t.matchTrade(stub, args)\n\t} else if function == \"matchTrade2\" { // match the open trades\n\t\treturn t.matchTrade2(stub, args)\n\t} else if function == \"matchTriTrade\" { // match the open trades\n\t\treturn t.matchTriTrade(stub, args)\n\t} else if function == \"clearOpenTrades\" { // match the open trades\n\t\treturn t.clearOpenTrades(stub, args)\n\t}\n\t\n\tfmt.Println(\"invoke did not find func: \" + function) //error\n\treturn shim.Error(\"Received unknown function invocation\")\n}", "title": "" }, { "docid": "6d1a4b11704643590986f9277c5cf145", "score": "0.47675055", "text": "func (m *mContractRequesterMockCall) Expect(p context.Context, p1 insolar.Message) *mContractRequesterMockCall {\n\tm.mock.CallFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &ContractRequesterMockCallExpectation{}\n\t}\n\tm.mainExpectation.input = &ContractRequesterMockCallInput{p, p1}\n\treturn m\n}", "title": "" }, { "docid": "2c74f5691a8e9d64abd5e94069002241", "score": "0.47664726", "text": "func (_e *SendFunc_Expecter) Execute(ctx interface{}, data interface{}) *SendFunc_Execute_Call {\n\treturn &SendFunc_Execute_Call{Call: _e.mock.On(\"Execute\", ctx, data)}\n}", "title": "" }, { "docid": "fb8548aa80ec6fb7c01ec143d55a237b", "score": "0.47633174", "text": "func (s *EntryPoint) Invoke(stub shim.ChaincodeStubInterface) peer.Response {\n\tfunction, args := stub.GetFunctionAndParameters()\n\tswitch function {\n\tcase \"addAccount\":\n\t\treturn accountContract.AddAccount(stub, args)\n\tcase \"getAccount\":\n\t\treturn accountContract.GetAccount(stub, args)\n\tcase \"getBalance\":\n\t\treturn accountContract.GetBalance(stub, args)\n\tcase \"changePayer\":\n\t\treturn accountContract.ChangePayer(stub, args)\n\tcase \"subAccountKeys\":\n\t\treturn accountContract.SubAccountKeys(stub, args)\n\tcase \"issueSubCxt\":\n\t\treturn scheduleContract.IssueSubCxt(stub, args)\n\tcase \"getIssueSubCxt\":\n\t\treturn scheduleContract.GetIssueSubCxt(stub, args)\n\tcase \"resetSubCodeQuotaData\":\n\t\treturn scheduleContract.ResetSubCodeQuotaData(stub, args)\n\tcase \"getSubCodeQuotaData\":\n\t\treturn scheduleContract.GetSubCodeQuotaData(stub, args)\n\tcase \"issueScheduling\":\n\t\treturn scheduleContract.IssueScheduling(stub, args)\n\tcase \"getSchedulingCxt\":\n\t\treturn scheduleContract.GetSchedulingCxt(stub, args)\n\tcase \"setSubCodeQuotaData\":\n\t\treturn scheduleContract.SetSubCodeQuotaData(stub, args)\n\tcase \"getOneLedgerCxt\":\n\t\treturn accountBookContract.GetOneLedgerCxt(stub, args)\n\tcase \"getLedgerSubAddrs\":\n\t\treturn accountBookContract.GetLedgerSubAddrs(stub, args)\n\tcase \"updateCalulateLedger\":\n\t\treturn accountBookContract.UpdateCalulateLedger(stub, args)\n\t}\n\tmsg := fmt.Sprintf(\"No such function. function = %s, args = %s\", function, args)\n\tlogger.Error(msg)\n\treturn shim.Error(msg)\n}", "title": "" } ]
84a573b1b0ef11f9ce37d5e5e81c2859
Owner is a free data retrieval call binding the contract method 0x8da5cb5b. Solidity: function owner() constant returns(address)
[ { "docid": "6103582672ae145697dfe885f37f9890", "score": "0.81183743", "text": "func (_Ownable *OwnableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Ownable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" } ]
[ { "docid": "ac9e8438cae086069bdf9d6f4b06ce0b", "score": "0.8352303", "text": "func (_DebtEngine *DebtEngineCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _DebtEngine.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "840afbbbb54a0141e1f4be1a8bd17d9b", "score": "0.8318824", "text": "func (_ReserveDollarEternalStorage *ReserveDollarEternalStorageCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ReserveDollarEternalStorage.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "20bea1b77147583db468d55cd3948e54", "score": "0.83109874", "text": "func (_Swapper *SwapperCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Swapper.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "27a92481531a30457d3a63a2dbf9b275", "score": "0.83068466", "text": "func (_Main *MainCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Main.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "b24f92136949d95eb41d757cb9404cfb", "score": "0.8303041", "text": "func (_BirrContract *BirrContractCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BirrContract.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a7e34827c6bb753b2fa4737578b4f984", "score": "0.82758534", "text": "func (_HorseDex *HorseDexCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _HorseDex.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d8ccf0583a24fe40aebac5fc399b9698", "score": "0.82741797", "text": "func (_Crowdsale *CrowdsaleCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Crowdsale.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "42b4f16d5e0a52ce402ea194c3455ee7", "score": "0.827252", "text": "func (_Mkr *Mkr) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Mkr.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "740468c8daa8875ae33abe9435325d98", "score": "0.8269362", "text": "func (_Mortgage *MortgageCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Mortgage.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "5a129ac7f729a06d330401c915281821", "score": "0.8263744", "text": "func (_Store *StoreCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Store.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "84fdc880ff8df29b4a48b3f05d65e5d9", "score": "0.82584", "text": "func (_Lighthouse *LighthouseCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Lighthouse.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "936da1998b8004248e5903392c2daa0d", "score": "0.8256383", "text": "func (_QLCChain *QLCChainCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _QLCChain.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "baf63700bf3058b05d27275a693cd2fd", "score": "0.8254557", "text": "func (_SignedDataVersion01 *SignedDataVersion01Caller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SignedDataVersion01.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "66230700edcd752394888629a7131844", "score": "0.8238449", "text": "func (_Registry *RegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Registry.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d2327e077bcdfc49aacb76af9e13e195", "score": "0.8232728", "text": "func (_Heritable *HeritableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Heritable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "febfb8939eb4889a5c702f376d7400fd", "score": "0.8231002", "text": "func (_BaasROI *BaasROICaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BaasROI.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6d322a95edb47c185b51d00968641644", "score": "0.8230318", "text": "func (_ReserveDollarV2 *ReserveDollarV2Caller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ReserveDollarV2.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "991687dc2e8bb4d563b3a6294df57de2", "score": "0.82248443", "text": "func (_Bnb *BnbCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Bnb.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4c3b8c98b952b95d4e5d71b4a4e3f5d0", "score": "0.82031107", "text": "func (_Vesting *VestingCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Vesting.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "86295e0e609f7bd86bebf342002e81fd", "score": "0.8201464", "text": "func (_SUSD *SUSDCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _SUSD.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "76d6fe8ce61c2d1546b2b9d554cdcc80", "score": "0.8197396", "text": "func (_GatewayRegistry *GatewayRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _GatewayRegistry.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "21960c95ff1d1af6cfbed7819c796911", "score": "0.8192141", "text": "func (_Vault *VaultCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Vault.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "7d260b16be0254fc0906ffdebe7f23d4", "score": "0.8182158", "text": "func (_Raffle *RaffleCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Raffle.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "51250d4021d02da9a744732366aeb22f", "score": "0.8177185", "text": "func (_ProxyAdmin *ProxyAdminCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ProxyAdmin.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "500f957e4ba82cc68bf04ac88c829ab5", "score": "0.816486", "text": "func (_WETH *WETHCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _WETH.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "f58912ded420fb64347d1a9352c3a83d", "score": "0.8159029", "text": "func (_SortedOracles *SortedOraclesCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SortedOracles.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "5b1f737f89ec08027800f246dc6c6d3c", "score": "0.8158265", "text": "func (_OffchainAggregator *OffchainAggregatorCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _OffchainAggregator.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "0254679e4f4347d1792570dee5807bff", "score": "0.81492823", "text": "func (_SendData *SendDataCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _SendData.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "7411dc90db838749a4f9821abacc933b", "score": "0.8140349", "text": "func (_Owned *OwnedCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Owned.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "38bf89058f9b4b56e9bc343b55b1a606", "score": "0.8131615", "text": "func (_ERC1155Proxy *ERC1155ProxyCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ERC1155Proxy.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "258ca6359332ba306ceee7406c60c7b1", "score": "0.81295186", "text": "func (_ProxyAdmin *ProxyAdminCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _ProxyAdmin.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "258ca6359332ba306ceee7406c60c7b1", "score": "0.81295186", "text": "func (_ProxyAdmin *ProxyAdminCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _ProxyAdmin.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "3581f4d82bcf5c3882a2b23f06b561b9", "score": "0.8127206", "text": "func (_TeleportrDeposit *TeleportrDepositCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _TeleportrDeposit.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "11fad46438f0059b50796f3e0c67060d", "score": "0.8121406", "text": "func (_Migrations *MigrationsCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Migrations.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "03beaa5fa36e786195e8598089ddb01b", "score": "0.811898", "text": "func (_StakingContract *StakingContractCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _StakingContract.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "ef0cc9f22fffb494bdecc8c45ac7c58e", "score": "0.8115213", "text": "func (_BCB *BCBCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BCB.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "7b4f0102db6ba680db7ee29a5e34765b", "score": "0.8105803", "text": "func (_Auto *AutoCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Auto.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "f99c1a393f6fba896016c5012702e8b7", "score": "0.8093755", "text": "func (_UsingFiatPrice *UsingFiatPriceCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _UsingFiatPrice.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "2ad95d3717e037d2c75fe4f2da716ce7", "score": "0.80923176", "text": "func (_SushiStaking *SushiStakingCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SushiStaking.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e93fc5260a4510948c05bade32b450bc", "score": "0.80898285", "text": "func (_APIConsumer *APIConsumerCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _APIConsumer.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "e9b711642e19a52b1d4b21e25404ae62", "score": "0.8085336", "text": "func (_ERC20AtlasManager *ERC20AtlasManagerCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ERC20AtlasManager.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ef9039590c26f12d4612a8e22ae4a5f8", "score": "0.80812293", "text": "func (_WindMineToken *WindMineTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _WindMineToken.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "feb06f58f0f7da67e97df9a178d9546b", "score": "0.8080145", "text": "func (_Token *TokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "feb06f58f0f7da67e97df9a178d9546b", "score": "0.8080145", "text": "func (_Token *TokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "5ef40c32f0c4fb5de013be8e31b0b396", "score": "0.8073539", "text": "func (_Betting022 *Betting022Caller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Betting022.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4985377869d861637f6746860c6d5aae", "score": "0.8071806", "text": "func (_Staking *StakingCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Staking.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "1ba59ed7c3c299848c3b8879075eca30", "score": "0.8059408", "text": "func (_Erc721 *Erc721Caller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Erc721.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "cd27c604cf455e574e1c91d23337d339", "score": "0.80561596", "text": "func (_Chainlink *ChainlinkCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Chainlink.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "8e75df70149fb8f7b33ad05dd8ea3970", "score": "0.8041668", "text": "func (_NbcToken *NbcTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _NbcToken.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "db2261aa35e7a215a59bbd250129bd67", "score": "0.80382866", "text": "func (_SwapExchange *SwapExchangeCaller) Owner(opts *bind.CallOpts) (common.ContractAddress, error) {\n\tvar (\n\t\tret0 = new(common.ContractAddress)\n\t)\n\tout := ret0\n\terr := _SwapExchange.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3e956f062e8f12dc2af711dfdc22e3da", "score": "0.8033958", "text": "func (_RenProxyAdmin *RenProxyAdminCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _RenProxyAdmin.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "2c09568293abf5a13db51ec693a767fe", "score": "0.8028199", "text": "func (_TokenProvider *TokenProviderCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _TokenProvider.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4d7177399e6a9c4683b08605b9d4de4e", "score": "0.80258656", "text": "func (_AskMeAnything *AskMeAnythingCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _AskMeAnything.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1fe6945f3f00b681282631263a4c33a8", "score": "0.8020102", "text": "func (_Exchange *ExchangeCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Exchange.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4c425d0619046f03b4d2d1a6950ceb20", "score": "0.8016727", "text": "func (_TokenManager *TokenManagerCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _TokenManager.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "627a675d22f4d064983661fefd2bae2e", "score": "0.8012192", "text": "func (_BikeRental *BikeRentalCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BikeRental.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f182d981122ca2c2da3cbb5f33660aca", "score": "0.801191", "text": "func (_Jifen *JifenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Jifen.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "596711a36bdaceef82ec821209c9f60d", "score": "0.79939795", "text": "func (_CappedToken *CappedTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _CappedToken.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ca232bd80b5a2026974fb123fd1709eb", "score": "0.7987144", "text": "func (_HasNoEtherTest *HasNoEtherTestCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _HasNoEtherTest.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "c236426193206263af2c7081848031d0", "score": "0.7984705", "text": "func (_SubdomainRegistrar *SubdomainRegistrarCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SubdomainRegistrar.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "085bbbd3d807629de4b992c5720d74f6", "score": "0.7981703", "text": "func (_MintGatewayLogicV1 *MintGatewayLogicV1Caller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _MintGatewayLogicV1.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "9ddbfe2318451cec4dfcc78ca372164b", "score": "0.796997", "text": "func (_Rollup *RollupCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Rollup.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "01b6ace9b872611fd123c46c3292327d", "score": "0.7966497", "text": "func (_PausableToken *PausableTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _PausableToken.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "7bbf84dd7eecb65d1e4868af82d69ef2", "score": "0.7963335", "text": "func (_Committee *CommitteeCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Committee.contract.Call(opts, out, \"_owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "c1d2809f06b85591e3b8a49e1ba45e5e", "score": "0.79568684", "text": "func (_OToken *OTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _OToken.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "d510f7b6be6a19ebda7c6ea82c41b8cc", "score": "0.7954869", "text": "func (_NeutralToken *NeutralTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _NeutralToken.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "75ad24bbb66e365a3802c8e8de69e42c", "score": "0.79344624", "text": "func (_Room *RoomCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Room.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "26f45035211ad328ef909a361eea35a6", "score": "0.7915174", "text": "func (_SimpleGatekeeperWithLimitLive *SimpleGatekeeperWithLimitLiveCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SimpleGatekeeperWithLimitLive.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "26983dd410c86be7e6871c86c575aeba", "score": "0.79023767", "text": "func (_Main *MainSession) Owner() (common.Address, error) {\n\treturn _Main.Contract.Owner(&_Main.CallOpts)\n}", "title": "" }, { "docid": "7061c01d7da5218d7b4505a641d2cff5", "score": "0.7900305", "text": "func (_SimpleWriteAccessController *SimpleWriteAccessControllerCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _SimpleWriteAccessController.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "b44e34c405f35ae53a5f073b106f847d", "score": "0.78996414", "text": "func (_Claimable *ClaimableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Claimable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "27d305ad0ad98cf623dc33cceca2cd51", "score": "0.78978133", "text": "func (_OpenZeppelinUpgradesOwnable *OpenZeppelinUpgradesOwnableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _OpenZeppelinUpgradesOwnable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "2eebc2f322e6763dc5c2a9c5c0b3f8a1", "score": "0.78774667", "text": "func (_AggregateUpdater *AggregateUpdaterCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _AggregateUpdater.contract.Call(opts, &out, \"_owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "d7a229c278370ee4766988e831a02f6e", "score": "0.78700775", "text": "func (_LockGatewayLogicV1 *LockGatewayLogicV1Caller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _LockGatewayLogicV1.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a571f82d28d7f9a5880b50eb98abb47e", "score": "0.785665", "text": "func (_DebtEngine *DebtEngineCallerSession) Owner() (common.Address, error) {\n\treturn _DebtEngine.Contract.Owner(&_DebtEngine.CallOpts)\n}", "title": "" }, { "docid": "22cc25ae8a70be31a14c8d38cf59237f", "score": "0.7853117", "text": "func (_Produce *ProduceCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Produce.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "781a3ab1b4d980be5efd2ee04b6e69dc", "score": "0.7850475", "text": "func (_Signer *SignerCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Signer.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "385302b5e80078c6a7cce3fa47ce12d2", "score": "0.7850083", "text": "func (_BirrContract *BirrContractSession) Owner() (common.Address, error) {\n\treturn _BirrContract.Contract.Owner(&_BirrContract.CallOpts)\n}", "title": "" }, { "docid": "6f16325126e2f02db3aea180c4905ad5", "score": "0.7850036", "text": "func (_ReserveDollarV2 *ReserveDollarV2CallerSession) Owner() (common.Address, error) {\n\treturn _ReserveDollarV2.Contract.Owner(&_ReserveDollarV2.CallOpts)\n}", "title": "" }, { "docid": "04fde7990cb971b5b3946fb248295185", "score": "0.7836842", "text": "func (_Greeter *GreeterCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Greeter.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "977027d009d4438280f5005f87dd32cd", "score": "0.78349036", "text": "func (_RenERC20LogicV1 *RenERC20LogicV1Caller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _RenERC20LogicV1.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "2eb6dd57cff3982a10e31a8e7a363907", "score": "0.78260916", "text": "func (_IndividuallyCappedCrowdsale *IndividuallyCappedCrowdsaleCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _IndividuallyCappedCrowdsale.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d7452e015d967bbfa42526c82febf425", "score": "0.78257155", "text": "func (_DebtEngine *DebtEngineSession) Owner() (common.Address, error) {\n\treturn _DebtEngine.Contract.Owner(&_DebtEngine.CallOpts)\n}", "title": "" }, { "docid": "1cafd61f5a9107d7815b3adbcab1af27", "score": "0.7824026", "text": "func (_SampleCrowdsaleToken *SampleCrowdsaleTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SampleCrowdsaleToken.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "8c2d9ae79157f2fa3e67a9c847e3a7f8", "score": "0.7820462", "text": "func (_PausableTokenMock *PausableTokenMockCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _PausableTokenMock.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "0d78ed8e43e092560f4380d908416de6", "score": "0.7800124", "text": "func (_Main *MainCallerSession) Owner() (common.Address, error) {\n\treturn _Main.Contract.Owner(&_Main.CallOpts)\n}", "title": "" }, { "docid": "bd1aaf13a5e26d16e5b399061d41e162", "score": "0.7764514", "text": "func (_BirrContract *BirrContractCallerSession) Owner() (common.Address, error) {\n\treturn _BirrContract.Contract.Owner(&_BirrContract.CallOpts)\n}", "title": "" }, { "docid": "26b4811cf76c0727797a30b1e6251be6", "score": "0.77629524", "text": "func (_Store *StoreSession) Owner() (common.Address, error) {\n\treturn _Store.Contract.Owner(&_Store.CallOpts)\n}", "title": "" }, { "docid": "11558237ff2478d7398b60d031c4b658", "score": "0.7756336", "text": "func (_CanReclaimTokens *CanReclaimTokensCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _CanReclaimTokens.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "76b5861c35c7fe109fc522a6668b8da4", "score": "0.77516204", "text": "func (_Mortgage *MortgageSession) Owner() (common.Address, error) {\n\treturn _Mortgage.Contract.Owner(&_Mortgage.CallOpts)\n}", "title": "" }, { "docid": "02b37b887ca0749e5dc58167a1c6258d", "score": "0.77448595", "text": "func (_SignedDataVersion01 *SignedDataVersion01Session) Owner() (common.Address, error) {\n\treturn _SignedDataVersion01.Contract.Owner(&_SignedDataVersion01.CallOpts)\n}", "title": "" }, { "docid": "29d0ce0a7dbdab2d4d943771bb496baf", "score": "0.77345", "text": "func (_ReserveDollarV2 *ReserveDollarV2Session) Owner() (common.Address, error) {\n\treturn _ReserveDollarV2.Contract.Owner(&_ReserveDollarV2.CallOpts)\n}", "title": "" }, { "docid": "6e18b5e1ff87adcd3a99041dd4f29ce0", "score": "0.77209264", "text": "func (_StakingContract *StakingContractSession) Owner() (common.Address, error) {\n\treturn _StakingContract.Contract.Owner(&_StakingContract.CallOpts)\n}", "title": "" }, { "docid": "810f962745ff7a670704f3ed0fb4161c", "score": "0.7712803", "text": "func (_Lighthouse *LighthouseSession) Owner() (common.Address, error) {\n\treturn _Lighthouse.Contract.Owner(&_Lighthouse.CallOpts)\n}", "title": "" }, { "docid": "0690e0a36d0e0fa3ca5dc448ca60b686", "score": "0.77107817", "text": "func (_Lighthouse *LighthouseCallerSession) Owner() (common.Address, error) {\n\treturn _Lighthouse.Contract.Owner(&_Lighthouse.CallOpts)\n}", "title": "" }, { "docid": "0c5a5c85998bc005248b8b021efa1576", "score": "0.77092314", "text": "func (_DebtEngine *DebtEngineCallerSession) OwnerOf(_assetId *big.Int) (common.Address, error) {\n\treturn _DebtEngine.Contract.OwnerOf(&_DebtEngine.CallOpts, _assetId)\n}", "title": "" } ]
4464f5447bbfa8fee7079dbd6c59f786
isMoreRecent checks if sequence a is newer than sequence b, while taking integer overflow into account.
[ { "docid": "4be52d0f919a5c74b0d481949e7b5d7f", "score": "0.8794279", "text": "func isMoreRecent(a, b uint32) bool {\n\tconst max = MaxSequence >> 1\n\treturn (a > b) && (a-b <= max) || (b > a) && (b-a > max)\n}", "title": "" } ]
[ { "docid": "848a466156c1e0046d198228e02913b7", "score": "0.6479411", "text": "func rawIsMoreRecent(v1, v2 string) bool {\n\treturn version.Later(v1, v2) || (version.IsIncompatible(v2) && !version.IsIncompatible(v1))\n}", "title": "" }, { "docid": "53c4dea67539677753e0987d98d3c652", "score": "0.6056035", "text": "func IsLaterThan(incoming gethTypes.Log, existing gethTypes.Log) bool {\n\treturn incoming.BlockNumber > existing.BlockNumber ||\n\t\t(incoming.BlockNumber == existing.BlockNumber && incoming.TxIndex > existing.TxIndex) ||\n\t\t(incoming.BlockNumber == existing.BlockNumber && incoming.TxIndex == existing.TxIndex && incoming.Index > existing.Index)\n}", "title": "" }, { "docid": "015ac3f9ffc5b74048e9090924af79aa", "score": "0.5976949", "text": "func (ts *TsVbuuid) AsRecentTs(other *TsVbuuid) bool {\n\tif ts == nil || other == nil {\n\t\treturn false\n\t}\n\tif ts.Bucket != other.Bucket {\n\t\treturn false\n\t}\n\tif len(ts.Seqnos) > len(other.Seqnos) {\n\t\treturn false\n\t}\n\tfor i, seqno := range ts.Seqnos {\n\t\tif seqno < other.Seqnos[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0f87599f7fd31568b5546790907f415f", "score": "0.59699965", "text": "func (ts *TsVbuuid) AsRecent(other *TsVbuuid) bool {\n\tif ts == nil || other == nil {\n\t\treturn false\n\t}\n\tif ts.Bucket != other.Bucket {\n\t\treturn false\n\t}\n\n\tif len(ts.Vbuuids) > len(other.Vbuuids) {\n\t\treturn false\n\t}\n\tfor i, vbuuid := range ts.Vbuuids {\n\t\t//skip comparing the vbucket if \"other\" ts has vbuuid 0\n\t\tif other.Vbuuids[i] == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif vbuuid != other.Vbuuids[i] || ts.Seqnos[i] < other.Seqnos[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "8dd57873207d3080ad9de7ad19c71ffb", "score": "0.5838528", "text": "func (info *ThreadInfo) LaterThan(otherID string) bool {\n\t// info other result\n\t// \"\" \"5\" false\n\t// \"100\" \"0\" true\n\t// \"150\" \"100\" true\n\tlenDiff := len(info.LastCheckedID) - len(otherID)\n\tif lenDiff != 0 {\n\t\treturn lenDiff < 0\n\t}\n\treturn info.LastCheckedID < otherID\n}", "title": "" }, { "docid": "faf6345b56bc261b6e78848b336d2cfb", "score": "0.58183086", "text": "func isTriggerOlder(t1, t2 *internal.Trigger) bool {\n\tts1 := t1.Created.AsTime()\n\tts2 := t2.Created.AsTime()\n\tswitch {\n\tcase ts1.After(ts2):\n\t\treturn false\n\tcase ts2.After(ts1):\n\t\treturn true\n\tdefault: // equal timestamps\n\t\tif t1.OrderInBatch != t2.OrderInBatch {\n\t\t\treturn t1.OrderInBatch < t2.OrderInBatch\n\t\t}\n\t\treturn t1.Id < t2.Id\n\t}\n}", "title": "" }, { "docid": "e0f6f15c99fa5ab1268b0f3a3fd7adea", "score": "0.56055003", "text": "func (v *Build) IsOlder(b *Build) (bool, error) {\n\tif v.Equal(b) {\n\t\treturn false, nil\n\t}\n\n\tif v.BuildNumber == \"\" || b.BuildNumber == \"\" {\n\t\treturn false, fmt.Errorf(\"invalid BuildNumber - comparing %q to %q\", v.BuildNumber, b.BuildNumber)\n\t}\n\n\tvi, errv := strconv.Atoi(v.BuildNumber)\n\tbi, errb := strconv.Atoi(b.BuildNumber)\n\tif errv != nil {\n\t\treturn false, fmt.Errorf(\"invalid BuildNumber format %s: %s\", v, errv)\n\t}\n\tif errb != nil {\n\t\treturn false, fmt.Errorf(\"invalid BuildNumber format %s: %s\", b, errb)\n\t}\n\n\tbuildBefore := vi < bi\n\treturn buildBefore, nil\n}", "title": "" }, { "docid": "3147d6077f727d4d7c6ee9fc5f236c36", "score": "0.5498685", "text": "func (c CurationRemark) OlderThan(t time.Time) bool {\n\treturn c.LastCompletionTimestamp.Before(t)\n}", "title": "" }, { "docid": "b2163f8ee5a51c7d63452ab39fd099d5", "score": "0.54323894", "text": "func (a *Assembly) CloseOlderThan(t time.Time) int {\n\tcount := 0\n\tpacketNum := 0\n\tcacheItemNum := 0\n\tfor k, v := range a.streamMap {\n\t\tif v.lastSeen.Before(t) {\n\t\t\tcount++\n\t\t\tv.close()\n\t\t\tdelete(a.streamMap, k)\n\t\t\tpacketNum += len(v.in)\n\t\t\tcacheItemNum += v.cache.Len()\n\t\t}\n\t}\n\tglog.V(3).Infof(\"[%v] packets: %d, cache items: %d\", a.wname, packetNum, cacheItemNum)\n\treturn count\n}", "title": "" }, { "docid": "aea684729f8cdf4fc1c0eb7fca100fd1", "score": "0.54009223", "text": "func (ss seqCounts) Less(i, j int) bool {\n if ss[i].count == ss[j].count {\n return ss[i].seq > ss[j].seq\n }\n return ss[i].count > ss[j].count\n}", "title": "" }, { "docid": "46b0baa2e41b907b1eff09360209064a", "score": "0.53584623", "text": "func (c *curationRemark) OlderThan(t time.Time) bool {\n\treturn c.LastCompletionTimestamp.Before(t)\n}", "title": "" }, { "docid": "0dad8ff5b4bfb015f46acf189e92716c", "score": "0.510729", "text": "func less(a, b uint32) bool {\n\tif a < b {\n\t\treturn (b - a) <= MaxSerialIncrement\n\t}\n\treturn (a - b) > MaxSerialIncrement\n}", "title": "" }, { "docid": "cb7895a4bcde8438341a6adc3a76d011", "score": "0.5087602", "text": "func (i Int24) More(j Int24) bool {\n\tif i.c != j.c {\n\t\treturn i.c > j.c\n\t}\n\tif i.b != j.b {\n\t\treturn i.b > j.b\n\t}\n\n\treturn i.a > j.a\n}", "title": "" }, { "docid": "aaae5e22938e26c2fa4bb916e4208ce2", "score": "0.5080556", "text": "func (pos BinlogPos) After(another BinlogPos) bool {\n\tu := pos.Uint64()\n\tif u == 0 {\n\t\treturn false\n\t}\n\treturn u > another.Uint64()\n}", "title": "" }, { "docid": "2d29d1989ec8c4c88d133aa3c79f0c1e", "score": "0.5038654", "text": "func mostRecentTag(repo *git.Repository, ref plumbing.Hash, isPrerelease bool) (bool, *plumbing.Reference, error) {\n\tcommit, err := repo.CommitObject(ref)\n\tif err != nil {\n\t\treturn false, nil, fmt.Errorf(\"no commit for ref %q: %w\", ref, err)\n\t}\n\n\tvar mostRecentTag *plumbing.Reference\n\twalker := object.NewCommitPreorderIter(commit, nil, nil)\n\terr = walker.ForEach(func(commit *object.Commit) error {\n\t\tisExact, exact, err := isExactTag(repo, commit.Hash, isPrerelease)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !isExact {\n\t\t\treturn nil\n\t\t}\n\n\t\tmostRecentTag = exact\n\t\treturn storer.ErrStop\n\t})\n\n\treturn mostRecentTag != nil, mostRecentTag, err\n}", "title": "" }, { "docid": "7f4d0dc9ca15bb8414b54e1610a9ca2e", "score": "0.49621922", "text": "func IsRecentSubmit(ctx context.Context, change *gerritpb.ChangeInfo, maxAge time.Duration) bool {\n\tearliest := clock.Now(ctx).Add(-maxAge)\n\tsubmitted := change.Submitted.AsTime()\n\treturn submitted.Equal(earliest) || submitted.After(earliest)\n}", "title": "" }, { "docid": "c8a15bc6ae26fcedc66991bab062a0c4", "score": "0.49609932", "text": "func isGreater(b1 Bid, b2 Bid) bool {\n\treturn b1.score() > b2.score()\n}", "title": "" }, { "docid": "a6a37e8c0bc9a7fbdc71a4bca586e413", "score": "0.49150398", "text": "func (query *SearchQuery) SequenceGreater(sequence uint64) *SearchQuery {\n\tquery.eventSequenceGreater = sequence\n\treturn query\n}", "title": "" }, { "docid": "a17db291928d941642c120378f6b99c0", "score": "0.48988256", "text": "func lessThreads(x, y Threads) bool { return seq.Compare(x, y) < 0 }", "title": "" }, { "docid": "03c1f4a090332bdf6bf51d31a95e73ee", "score": "0.48745066", "text": "func (ts *threadSpan) less(other *threadSpan) bool {\n\tswitch {\n\tcase ts.startTimestamp < other.startTimestamp:\n\t\treturn true\n\tcase ts.startTimestamp > other.startTimestamp:\n\t\treturn false\n\t}\n\treturn ts.duration() < other.duration()\n}", "title": "" }, { "docid": "08a4e3c5eae1f56ef5d26be3e25b8c3c", "score": "0.48726487", "text": "func GreaterThan(sourceHash [HashSize]byte, destHash [HashSize]byte) bool {\n\ta := new(big.Int)\n\tb := new(big.Int)\n\ta.SetBytes(sourceHash[:HashSize])\n\tb.SetBytes(destHash[:HashSize])\n\t// a > b\n\tif a.Cmp(b) == 1 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "9c805d225fbd2c0a8a8f5827e5d4eed0", "score": "0.4860056", "text": "func checkStamp(newstamp []int, stamp []int, n int) bool {\n\tfromWhichP := newstamp[n]\n\tfor i := range newstamp {\n\t\tif i == n {\n\t\t\tbreak\n\t\t}\n\t\tif i != fromWhichP {\n\t\t\tif newstamp[i] > stamp[i] {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t} else {\n\t\t\tif newstamp[i] != stamp[i]+1 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true\n\n}", "title": "" }, { "docid": "3335044b4a99b0ecc63fbfcf06d34c23", "score": "0.48524925", "text": "func (v GoVersion) LaterThan(target GoVersion) bool {\n\tif v.Devel {\n\t\treturn true\n\t}\n\n\tif v.MajorVersion > target.MajorVersion {\n\t\treturn true\n\t} else if v.MajorVersion < target.MajorVersion {\n\t\treturn false\n\t}\n\n\tif v.MinorVersion > target.MinorVersion {\n\t\treturn true\n\t} else if v.MinorVersion < target.MinorVersion {\n\t\treturn false\n\t}\n\n\treturn v.PatchVersion >= target.PatchVersion\n}", "title": "" }, { "docid": "503e0d0cc7e00902fc5b14a755ad4021", "score": "0.48001418", "text": "func (v Values) LastTimeBefore(t time.Time) bool {\n\treturn v[len(v)-1].Timestamp.Before(t)\n}", "title": "" }, { "docid": "8b9785cf5eb4da9165cf1fde3fa43a6e", "score": "0.4789159", "text": "func ProposalNumGT(a ProposalNum, b ProposalNum) bool {\n if a.Hi > b.Hi {\n return true\n } else if a.Hi < b.Hi {\n return false\n } else {\n return a.Low > b.Low\n }\n}", "title": "" }, { "docid": "7681321f3b048ac4d7f484d8dcbecb83", "score": "0.47657776", "text": "func (sc *snapshotContainer) GetSnapshotRecentThanTS(ts Timestamp) Snapshot {\n\tsc.lock.RLock()\n\tdefer sc.lock.RUnlock()\n\n\tfor e := sc.snapshotList.Front(); e != nil; e = e.Next() {\n\t\tsnapshot := e.Value.(Snapshot)\n\t\tsnapTS := snapshot.Timestamp()\n\t\tif snapTS.GreaterThanEqual(ts) {\n\t\t\treturn snapshot\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a705013739b368824f05fc091edafd09", "score": "0.47656298", "text": "func (p *GetExecutionHistoryPaginator) HasMorePages() bool {\n\treturn p.firstPage || p.nextToken != nil\n}", "title": "" }, { "docid": "9191148fe1597a4f7bea14457c188a4b", "score": "0.47492242", "text": "func (v *Vector) More(v0 *Vector) bool {\n if v.Len() < v0.Len() {\n return false\n }\n if v.Len() > v0.Len() {\n return true\n }\n if v.Len() != 0 {\n for i, b := range v.body {\n switch {\n case b < v0.body[i]:\n return false\n case b > v0.body[i]:\n return true\n default:\n continue\n }\n }\n }\n return false\n}", "title": "" }, { "docid": "e5171c6bbf40734f8edcc7600e543ca0", "score": "0.47473127", "text": "func (i *Iterator) More() bool {\n\tif i.err != nil {\n\t\treturn false\n\t}\n\n\treturn i.s.More() || i.s.Pos()+1 < i.b.NumSections() || i.b.Pos()+1 < i.r.NumBlocks()\n}", "title": "" }, { "docid": "4bacefe34e8e1437b8de4022293286a0", "score": "0.47427037", "text": "func less(a, b *interval) bool {\n\tif a == nil {\n\t\treturn false\n\t}\n\tif b == nil {\n\t\treturn true\n\t}\n\treturn a.To < b.From\n}", "title": "" }, { "docid": "423317ca03617b38508e3bb5ca35523a", "score": "0.47370392", "text": "func (m *Map) More() bool {\n\treturn m.current <= len(m.index)-1\n}", "title": "" }, { "docid": "f9f5c2b6bd35f8eb4e3e0494f3900352", "score": "0.47341442", "text": "func (f *Float) isLesser() bool {\n\treturn f.a < f.b\n}", "title": "" }, { "docid": "c27a618db43fca04b7de6289d308fb5d", "score": "0.47266337", "text": "func (it *Iterator) More() bool {\n\treturn it.start < it.end\n}", "title": "" }, { "docid": "a0bad4333d65e65c75cafaa5e4fb6030", "score": "0.47130445", "text": "func (t TopKResult) Less(i, j int) bool { return t[i].Count > t[j].Count }", "title": "" }, { "docid": "160b7fe21af7e9a2a9f9fd4cb70382ff", "score": "0.47088116", "text": "func (events *Events) More() bool {\n\treturn events.more\n}", "title": "" }, { "docid": "60a079dc281e7d5d97fbce7ff9316b79", "score": "0.4707036", "text": "func (pq *PriorityQueue) PopOlderThan(t time.Time) []*observerpb.GetFlowsResponse {\n\t// pre-allocate enough memory for the slice to hold every element in the\n\t// queue as flushing the entire queue is a common pattern\n\tret := make([]*observerpb.GetFlowsResponse, 0, pq.Len())\n\tfor {\n\t\tresp := pq.Pop()\n\t\tif resp == nil {\n\t\t\treturn ret\n\t\t}\n\t\tif t.Before(resp.GetTime().AsTime()) {\n\t\t\tpq.Push(resp)\n\t\t\treturn ret\n\t\t}\n\t\tret = append(ret, resp)\n\t}\n}", "title": "" }, { "docid": "76998600ff10e685e2d7832ce10e1cc4", "score": "0.4702254", "text": "func findMaxLag(sortedIns []*fetchedInput) (maxLag int64, maxLagIdx, maxLagCount int) {\n\tmaxLag = -1\n\tmaxLagIdx = -1\n\tfor i, input := range sortedIns {\n\t\tif input.nextMsg == nil {\n\t\t\tcontinue\n\t\t}\n\t\tinputLag := input.nextMsg.HighWaterMark - input.nextMsg.Offset\n\t\tif inputLag > maxLag {\n\t\t\tmaxLagIdx = i\n\t\t\tmaxLag = inputLag\n\t\t\tmaxLagCount = 1\n\t\t} else if inputLag == maxLag {\n\t\t\tmaxLagCount += 1\n\t\t}\n\t}\n\treturn maxLag, maxLagIdx, maxLagCount\n}", "title": "" }, { "docid": "84d1328b1764105b9f6dcce6a59c6ac6", "score": "0.46980944", "text": "func TestLast(t *testing.T) {\n\ta := newOrSkip(t)\n\tmessage := arbor.ChatMessage{\n\t\tUUID: \"whatever\",\n\t\tParent: \"something\",\n\t\tContent: \"a lame test\",\n\t\tTimestamp: 500000,\n\t\tUsername: \"Socrates\",\n\t}\n\tmessage2 := message\n\tmessage2.UUID += \"2\"\n\tmessage2.Timestamp += 6\n\tmessage3 := message\n\tmessage3.UUID += \"3\"\n\tmessage3.Timestamp -= 30\n\tconst (\n\t\thistLen = 5\n\t\tshortLen = 2\n\t\tmaliciousLen = -1\n\t)\n\tif last := a.Last(histLen); len(last) != 0 {\n\t\tt.Errorf(\"Empty archive returned non-empty slice when length was %d\", histLen)\n\t}\n\tif last := a.Last(maliciousLen); len(last) != 0 {\n\t\tt.Errorf(\"Empty archive returned non-empty slice when length was %d\", maliciousLen)\n\t}\n\tfor index, m := range []*arbor.ChatMessage{&message, &message2, &message3} {\n\t\taddOrSkip(t, a, m)\n\t\tif last := a.Last(histLen); len(last) != index+1 {\n\t\t\tt.Errorf(\"archive with %d element(s) returned slice with length %d\", index+1, len(last))\n\t\t} else {\n\t\t\tordered := true\n\t\t\tfor i, k := range last {\n\t\t\t\tif i == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif k.Timestamp < last[i-1].Timestamp {\n\t\t\t\t\tordered = false\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !ordered {\n\t\t\t\tt.Error(\"Slice from Last() not sorted\", last)\n\t\t\t}\n\t\t}\n\t}\n\tif last := a.Last(shortLen); len(last) != shortLen {\n\t\tt.Errorf(\"Requested Last of len %d, got %d\", shortLen, len(last))\n\t}\n\tif last := a.Last(maliciousLen); len(last) != 0 {\n\t\tt.Errorf(\"non-Empty archive returned non-empty slice when length was %d\", maliciousLen)\n\t}\n\tif messagePointer := a.Get(message.UUID); messagePointer == &message {\n\t\tt.Errorf(\"Add should copy provided data to prevent internal structures from unexpected modification\")\n\t}\n}", "title": "" }, { "docid": "9d4fa38dd73fe2af132775fc789180db", "score": "0.46913198", "text": "func isTimePast(t time.Time) bool {\n\tdelta := time.Since(t)\n\treturn delta > 0\n}", "title": "" }, { "docid": "66364fe795b7bf9cf827177b3c2f37dd", "score": "0.46894574", "text": "func (b byFormatTime) Less(i, j int) bool {\n\treturn b[i].timestamp.After(b[j].timestamp)\n}", "title": "" }, { "docid": "0a03b43a2133eb00822826b050450571", "score": "0.46865985", "text": "func TestOldestValue(t *testing.T) {\n\tm := NewRolling(5)\n\n\t// Insert a first element and check identical averages.\n\tm.Observe(17.0)\n\tassert.Equal(t, 17.0, m.OldestValue())\n\n\t// Check again after many observations.\n\tfor i := 500; i < 517; i++ {\n\t\tm.Observe(float64(i))\n\t}\n\tassert.Equal(t, 512.0, m.OldestValue())\n}", "title": "" }, { "docid": "1417d5ff1415a7d42b4df5bcdb89ca1b", "score": "0.46682158", "text": "func (rr recordsByActivity) Less(i, j int) bool {\n\treturn rr[i].lastActive.Before(rr[j].lastActive)\n}", "title": "" }, { "docid": "7c2cd698e0cd5992848628e72ecf29e4", "score": "0.4664579", "text": "func (s Sequence) less(o Sequence) bool {\n\toLen := o.Length()\n\tfor i := 0; i < s.Length(); i++ {\n\t\tif i >= oLen {\n\t\t\treturn true\n\t\t}\n\t\tsxy, oxy := s.GetXY(i), o.GetXY(i)\n\t\tif sxy != oxy {\n\t\t\treturn sxy.Less(oxy)\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2c978aad5063a41a08ec1b0f51fb42b2", "score": "0.46533668", "text": "func (p *Paginator) HasPrevious() bool {\n\treturn p.current > 1\n}", "title": "" }, { "docid": "0c22117cfc5ec85add7350e0d63eed8f", "score": "0.46394983", "text": "func gt(a, b float64) bool {\n\treturn a > b\n}", "title": "" }, { "docid": "5462d790f226a861b9e68912ed59fe86", "score": "0.4636089", "text": "func recentRows(in []*statepb.Row, recent int) []*statepb.Row {\n\tvar rows []*statepb.Row\n\tfor _, r := range in {\n\t\tif r.Results == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif statuspb.TestStatus(r.Results[0]) == statuspb.TestStatus_NO_RESULT && int(r.Results[1]) >= recent {\n\t\t\tcontinue\n\t\t}\n\t\trows = append(rows, r)\n\t}\n\treturn rows\n}", "title": "" }, { "docid": "65cd8f3b9c1448a5a6341e4e5b03dc08", "score": "0.4629668", "text": "func newerThanMatch(threshold string, createTime time.Time) bool {\n\tt, err := parseTime(threshold)\n\tfatalIf(err.Trace(threshold), \"Unable to parse input threshold value into time.Time\")\n\treturn createTime.After(t) || createTime.Equal(t)\n}", "title": "" }, { "docid": "4c9fc3ee4d35dea04a8664e0912a68db", "score": "0.46285212", "text": "func (val1 LPBCoeff) Lesser(val2 LPBCoeff) bool {\n\treturn val1.Compare(val2) < 0\n}", "title": "" }, { "docid": "99de0936ed4d51a970016b0af7bdad07", "score": "0.46220344", "text": "func (s *Sentinel) isLagBelowMax(cd *cluster.ClusterData, curMasterDB, db *cluster.DB) bool {\n\tlog.Debugf(\"curMasterDB.Status.XLogPos: %d, db.Status.XLogPos: %d, lag: %d\", curMasterDB.Status.XLogPos, db.Status.XLogPos, int64(curMasterDB.Status.XLogPos-db.Status.XLogPos))\n\tif int64(curMasterDB.Status.XLogPos-db.Status.XLogPos) > int64(*cd.Cluster.DefSpec().MaxStandbyLag) {\n\t\tlog.Infow(\"ignoring keeper since its behind that maximum xlog position\", \"db\", db.UID, \"dbXLogPos\", db.Status.XLogPos, \"masterXLogPos\", curMasterDB.Status.XLogPos)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4aff26748983aab4e297eec4678b8cf3", "score": "0.46171492", "text": "func GreaterByPriceThenTime(bi, bj *order.LimitOrder) bool {\n\tif bi.Price() == bj.Price() {\n\t\tti, tj := bi.Time(), bj.Time()\n\t\tif ti == tj {\n\t\t\t// Lexicographical comparison of the OrderIDs requires a slice. This\n\t\t\t// comparison should be exceedingly rare, so the required memory\n\t\t\t// allocations are acceptable.\n\t\t\tidi, idj := bi.ID(), bj.ID()\n\t\t\treturn bytes.Compare(idi[:], idj[:]) < 0 // idi < idj\n\t\t}\n\t\treturn ti < tj\n\t}\n\treturn GreaterByPrice(bi, bj)\n}", "title": "" }, { "docid": "c6328e0dfbe7fbacff9ed3df6d4c993c", "score": "0.4616921", "text": "func (rm *afdoRepoManager) RolledPast(ctx context.Context, ver string) (bool, error) {\n\tverIsNewer, err := strategy.AFDOVersionGreater(ver, rm.LastRollRev())\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn !verIsNewer, nil\n}", "title": "" }, { "docid": "1c8200e844bf03c5fc254d3d52765f58", "score": "0.46112546", "text": "func (c *Cursor) prev() bool {\n\tref := &c.stack[len(c.stack)-1]\n\tref.index--\n\tif ref.count() == 0 || ref.index < 0 {\n\t\tif len(c.stack) <= 1 {\n\t\t\treturn true\n\t\t}\n\t\tc.stack = c.stack[:len(c.stack)-1]\n\t\tref = &c.stack[len(c.stack)-1]\n\n\t\treturn c.prev()\n\t}\n\n\tif !ref.node.isLeaf && ref.node.level < c.level>>1 {\n\t\tc.last()\n\t}\n\treturn false\n}", "title": "" }, { "docid": "66fca15fbbeafed85387c6abee94840f", "score": "0.46094278", "text": "func (r *rtts) Last() (time.Duration, bool) {\n\tr.mu.RLock()\n\tdefer r.mu.RUnlock()\n\tif len(r.items) == 0 {\n\t\treturn 0, false\n\t}\n\treturn r.items[len(r.items)-1], true\n}", "title": "" }, { "docid": "7f926383a36d636ffce17895abb3b48d", "score": "0.46083125", "text": "func (d *Date) LaterThan(x *Date) bool {\n\treturn !d.EarlyThanOrEqual(x)\n}", "title": "" }, { "docid": "d83949487d284fdcdd112977c61a63d2", "score": "0.46040043", "text": "func (h LogIteratorHeap) Less(i, j int) bool {\n\tif h.min {\n\t\treturn h.its[i].Item().Timestamp.Before(h.its[j].Item().Timestamp)\n\t} else {\n\t\treturn h.its[i].Item().Timestamp.After(h.its[j].Item().Timestamp)\n\t}\n}", "title": "" }, { "docid": "3df2b64f294a0bcc367e2554c495e127", "score": "0.45877063", "text": "func (sp *PaginationToken) IsAfter(other PaginationToken) bool {\n\treturn sp.PDUPosition > other.PDUPosition ||\n\t\tsp.EDUTypingPosition > other.EDUTypingPosition\n}", "title": "" }, { "docid": "a1269546fc54acf5fe00a8ca2ebb53a4", "score": "0.4578386", "text": "func (m *DummyMailstore) RecentMessages(mbox int64) (int64, error) {\n\treturn 4, nil\n}", "title": "" }, { "docid": "030dc1a2edd9ec3e4a0c77bcf85f9c17", "score": "0.45753893", "text": "func (r *raft) pastElectionTimeout() bool {\n\treturn r.electionElapsed >= r.randomElectionTimeout\n}", "title": "" }, { "docid": "15d08d0360d9ddc9eeddae2f403f5611", "score": "0.45740712", "text": "func (t *StreamingToken) IsAfter(other StreamingToken) bool {\n\tswitch {\n\tcase t.PDUPosition > other.PDUPosition:\n\t\treturn true\n\tcase t.TypingPosition > other.TypingPosition:\n\t\treturn true\n\tcase t.ReceiptPosition > other.ReceiptPosition:\n\t\treturn true\n\tcase t.SendToDevicePosition > other.SendToDevicePosition:\n\t\treturn true\n\tcase t.InvitePosition > other.InvitePosition:\n\t\treturn true\n\tcase t.AccountDataPosition > other.AccountDataPosition:\n\t\treturn true\n\tcase t.DeviceListPosition > other.DeviceListPosition:\n\t\treturn true\n\tcase t.NotificationDataPosition > other.NotificationDataPosition:\n\t\treturn true\n\tcase t.PresencePosition > other.PresencePosition:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4674b4e33188c5106891ef693fa1b958", "score": "0.4573192", "text": "func (l *clog) inSequence(name upspin.PathName, seq int64) bool {\n\tif v, ok := l.sequenceLRU.Get(name); ok {\n\t\tif v.(int64) >= seq {\n\t\t\treturn false\n\t\t}\n\t}\n\tl.sequenceLRU.Add(name, seq)\n\treturn true\n}", "title": "" }, { "docid": "991afa3c08528f1c9ffb3491b8f9cdb7", "score": "0.45715472", "text": "func (t *triggerSettings) currentTriggerExceedsMaxTriggerCount() bool {\n\treturn t.triggerCount.Add(1) > t.maxTriggerCount && t.maxTriggerCount != 0\n}", "title": "" }, { "docid": "1d8177391874b7b8eb2b148e350d78fa", "score": "0.4563368", "text": "func (eventTime EventTime) Less(thatEventTime EventTime) bool {\n\treturn eventTime.t.Unix() < thatEventTime.t.Unix()\n}", "title": "" }, { "docid": "f82837c13a13a7a01d30e96fc081e272", "score": "0.45587444", "text": "func ObjectGreater(vm *VM, target, locals Interface, msg *Message) Interface {\n\tx, ok := CheckStop(msg.EvalArgAt(vm, locals, 0), LoopStops)\n\tif !ok {\n\t\treturn x\n\t}\n\tc, ok := CheckStop(vm.Compare(target, x), LoopStops)\n\tif !ok {\n\t\treturn x\n\t}\n\tif n, ok := c.(*Number); ok {\n\t\treturn vm.IoBool(n.Value > 0)\n\t}\n\treturn vm.IoBool(ptrCompare(target, c) > 0)\n}", "title": "" }, { "docid": "ae5ae44b83e2ec0c7f3cf767a407bd3d", "score": "0.45510063", "text": "func (n *node) WasContactedRecently(infoHash InfoHash, searchRetryPeriod time.Duration) bool {\n\tt, ok := n.PastQueries[infoHash]\n\treturn ok && time.Since(t) < searchRetryPeriod\n}", "title": "" }, { "docid": "be0af63bebb8f2b1f7c089b8e485f0dd", "score": "0.45483154", "text": "func (s *UpdatesDifferenceTooLongArray) Pop() (v UpdatesDifferenceTooLong, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "6ff33e58d785a3a1cea9ce6fb7701c24", "score": "0.45381293", "text": "func (s *UpdatesChannelDifferenceTooLongArray) Pop() (v UpdatesChannelDifferenceTooLong, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[len(a)-1]\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "title": "" }, { "docid": "7c2a75ab0bee7703acb8e063f0e7ca5d", "score": "0.45342094", "text": "func TestMostRecentObservation(t *testing.T) {\n\tm := NewRolling(5)\n\n\t// Insert a first element and check identical averages.\n\tm.Observe(17.0)\n\tassert.Equal(t, 17.0, m.MostRecentObservation())\n\tm.Observe(15.0)\n\tassert.Equal(t, 15.0, m.MostRecentObservation())\n\n\t// Check again after many observations.\n\tfor i := 500; i < 517; i++ {\n\t\tm.Observe(float64(i))\n\t}\n\tassert.Equal(t, 516.0, m.MostRecentObservation())\n}", "title": "" }, { "docid": "a9a695a69a79104ae31f28d76510cbc7", "score": "0.45302236", "text": "func (s *Stream) Latest(i int) (int, bool) {\n\tif s.pos == 0 || i >= s.k || i < 0 || i >= s.pos {\n\t\treturn -1, false\n\t}\n\tidx := (s.pos-1)%s.k - i\n\tif idx < 0 {\n\t\tidx += s.k\n\t}\n\treturn s.arr[idx], true\n}", "title": "" }, { "docid": "f182fcbbfd02d7e20d90bd755868946d", "score": "0.45121795", "text": "func StrictlyIncreasingInt64(seq []int64) bool {\n\tfor i := 1; i < len(seq); i++ {\n\t\tif seq[i-1] >= seq[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7a888d3207e3d2206322930346b50ab7", "score": "0.45103717", "text": "func (a byCount) Less(i, j int) bool {\n\treturn a[i].count < a[j].count\n}", "title": "" }, { "docid": "96608fccf51258867488a07d9a4ec999", "score": "0.45056576", "text": "func (b *Blockchain) IsLonger(c *Blockchain) (bool, bool) {\n\tb.mutex.Lock()\n\tdefer b.mutex.Unlock()\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tbCompleted := len(b.CompletedBlocks)\n\tcCompleted := len(c.CompletedBlocks)\n\tbPartial := b.PartialBlock.GetNumberOfRecords()\n\tcPartial := c.PartialBlock.GetNumberOfRecords()\n\tif bCompleted > cCompleted {\n\t\treturn true, false\n\t}\n\tif bCompleted == cCompleted {\n\t\tif bCompleted > 0 {\n\t\t\tbBestBlockID := b.CompletedBlocks[bCompleted-1].ID\n\t\t\tcBestBlockID := c.CompletedBlocks[cCompleted-1].ID\n\t\t\tif bBestBlockID > cBestBlockID {\n\t\t\t\treturn true, false\n\t\t\t}\n\t\t\tif bBestBlockID < cBestBlockID {\n\t\t\t\treturn false, false\n\t\t\t}\n\t\t}\n\t\tif bPartial > 0 && bPartial >= cPartial {\n\t\t\t//we use >= instead of >, because it will be a deadlock situation\n\t\t\t//when every peer has the blockchain of the same length or 0 length\n\t\t\treturn false, true\n\t\t}\n\t}\n\treturn false, false\n}", "title": "" }, { "docid": "ac45d15bea0cc592b77537e4d68e96f0", "score": "0.45030287", "text": "func (h *HUEsystemBuilder) IsMoreThan(value int16) *HUEsystemBuilder {\n\th.brightnessValue = value\n\treturn h\n}", "title": "" }, { "docid": "b7eb9f79462f02757398b4053962b302", "score": "0.44895065", "text": "func (p *GetTraceSummariesPaginator) HasMorePages() bool {\n\treturn p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)\n}", "title": "" }, { "docid": "7fcb79d6f570a598370454a6214d64df", "score": "0.44821903", "text": "func (i *Info) isFresh(highWaterStamp int64) bool {\n\treturn i.OrigStamp > highWaterStamp\n}", "title": "" }, { "docid": "2d74b98a12bb6f87f4ef46cb20bed968", "score": "0.4480264", "text": "func olderThanMatch(threshold string, createTime time.Time) bool {\n\tt, err := parseTime(threshold)\n\tfatalIf(err.Trace(threshold), \"Unable to parse input threshold value into time.Time\")\n\treturn createTime.Before(t)\n}", "title": "" }, { "docid": "dba637bb57aeafbd2f103d7fc83ba527", "score": "0.44797647", "text": "func (f1 Fragments) better(f2 Fragments) bool {\n\treturn len(f1.Frags) >= len(f2.Frags)\n}", "title": "" }, { "docid": "1e433dae191d27930c056bb1d8fc2a88", "score": "0.44755685", "text": "func (e *Event) Less(o *Event) bool {\n\treturn e.expire.Before(o.expire)\n}", "title": "" }, { "docid": "9e9c76ff757de4bb48f01ecc8edbf164", "score": "0.44701296", "text": "func (f *Float) isGreater() bool {\n\treturn f.a > f.b\n}", "title": "" }, { "docid": "21a6ad0b53ed06d2249254d093b6b82b", "score": "0.44675353", "text": "func (c Uint64Compare) IsLess(lhs, rhs uint64) bool { return c(lhs, rhs) }", "title": "" }, { "docid": "cfdc5b0d61b884f0b1cbf3154e49b5e3", "score": "0.44645372", "text": "func (l *IndexableBlockNumber) GreaterThan(r *IndexableBlockNumber) bool {\n\tif l == nil {\n\t\treturn false\n\t}\n\tif l != nil && r == nil {\n\t\treturn true\n\t}\n\treturn l.ToInt().Cmp(r.ToInt()) > 0\n}", "title": "" }, { "docid": "30e244a5df01715443f85d701c72fce2", "score": "0.44610444", "text": "func (o Offset) After(b Offset) bool {\n\treturn time.Unix(0, int64(o)).Before(time.Unix(0, int64(b)))\n}", "title": "" }, { "docid": "779114271709a14e10f1136b37aea279", "score": "0.4460798", "text": "func less(value1, value2 int) bool {\n\treturn value1 < value2\n}", "title": "" }, { "docid": "89542d97b8428d31e6c4bb1ba50fc663", "score": "0.44564995", "text": "func AssertTimestampsCloseEnough(t *testing.T, blobID blob.ID, got, want time.Time) {\n\tt.Helper()\n\n\ttimeDiff := got.Sub(want)\n\tif timeDiff < 0 {\n\t\ttimeDiff = -timeDiff\n\t}\n\n\tif timeDiff > maxTimeDiffBetweenGetAndList {\n\t\tt.Fatalf(\"invalid timestamp on %v: got %v, want %v\", blobID, got, want)\n\t}\n}", "title": "" }, { "docid": "d6c343c59673da600f214e8bbec83fcb", "score": "0.44507018", "text": "func (v *Version) GreaterThan(o *Version) bool {\n\treturn v.Compare(o) > 0\n}", "title": "" }, { "docid": "a861d3dde5fb922051c2f63bec70a56e", "score": "0.44432697", "text": "func latest(vals []time.Time, isNull []bool, index []int) (time.Time, bool) {\n\tmax := time.Time{}\n\tvar atLeastOneValid bool\n\tfor _, i := range index {\n\t\tif !isNull[i] {\n\t\t\tif vals[i].After(max) {\n\t\t\t\tmax = vals[i]\n\t\t\t}\n\t\t\tatLeastOneValid = true\n\t\t}\n\t}\n\tif !atLeastOneValid {\n\t\treturn time.Time{}, true\n\t}\n\treturn max, false\n}", "title": "" }, { "docid": "69fd0b6423f632584f29615b4194cbfa", "score": "0.4442935", "text": "func (bg *Bg) thisIsInPast(correctedDate string) bool {\n\tcorrected, err := time.ParseInLocation(bgTaskStdTimeDay, correctedDate, bg.location)\n\tif err != nil {\n\t\t// there shouldn't be any errors here since this was pulled from the storage, but just in case\n\t\tbg.Errors = append(bg.Errors, err)\n\t\treturn false\n\t}\n\tif bg.now().Sub(corrected) > 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "43e6cce6fc16f43f6cc82e636a0e2c73", "score": "0.4442008", "text": "func (pkg *Package) Older(alt *Package) bool {\n\tif alt == nil {\n\t\treturn false\n\t}\n\treturn alpm.VerCmp(pkg.Version, alt.Version) == -1\n}", "title": "" }, { "docid": "65b57bd014c9459ec1285896054d5c9c", "score": "0.4441994", "text": "func TestCountLimitNonUnique(t *testing.T) {\n\tlg := MakeHistory(time.Duration(1) * time.Millisecond)\n\n\ttm := time.Now()\n\tstopAdd := tm.Add(time.Duration(300) * time.Millisecond)\n\titer := uint32(0)\n\tfor time.Now().Before(stopAdd) {\n\t\tlg.Add(time.Now(), time.Now())\n\t\t<-time.After(time.Duration(2) * time.Millisecond)\n\t\titer++\n\t}\n\n\tif lg.Len() < 100 {\n\t\tspan := lg.times[len(lg.times)-1].Sub(lg.times[0])\n\t\tt.Error(\"length incorrect:\", lg.Len(), span)\n\t}\n}", "title": "" }, { "docid": "7e23f45397e310194fc3611a0da5a376", "score": "0.4436227", "text": "func (a Bigint) Gop_LE(b Bigint) bool {\n\treturn a.Cmp(b.Int) <= 0\n}", "title": "" }, { "docid": "23d047a3e4e1bd2ececaee28c6b943f2", "score": "0.44323882", "text": "func (a *Artifact) GreaterThan(b Artifact) bool {\n\treturn a.v.GreaterThan(b.v)\n}", "title": "" }, { "docid": "ed966e9163b4af327a45179cfc3f0207", "score": "0.44318643", "text": "func (h *delPendingHeap) Less(i, j int) bool {\n\treturn h.l[i].lastUpd.Before(h.l[j].lastUpd)\n}", "title": "" }, { "docid": "da65d921b0640d3b71265791cb667167", "score": "0.443001", "text": "func (j JobSet) Less(a, b int) bool {\n\treturn j[a].Timing.Queued.Before(j[b].Timing.Queued)\n}", "title": "" }, { "docid": "cc278f7842a6727b7cef10e08eabd923", "score": "0.44244418", "text": "func (eventTime DateTime) Less(thatEventTime DateTime) bool {\n\treturn eventTime.t.Unix() < thatEventTime.t.Unix()\n}", "title": "" }, { "docid": "1d5aad4a54f95b663177e1341bd9c6c5", "score": "0.4418444", "text": "func (o Offset) Before(b Offset) bool {\n\treturn time.Unix(0, int64(o)).Before(time.Unix(0, int64(b)))\n}", "title": "" }, { "docid": "933e93667917b501d3d043462948ee5a", "score": "0.44161996", "text": "func hasMoreSuitableManager(size int32, current int32, available []int32) bool {\n\t//pp.Println(current)\n\thasAmatch := false\n\tfor _, a := range available {\n\t\tif current == a {\n\t\t\tcontinue\n\t\t}\n\t\tif current < size {\n\t\t\t// Already not the best\n\t\t\tpp.Println(size)\n\t\t\tpp.Println(a)\n\t\t}\n\n\t\tif size > current && size < a {\n\t\t\treturn true\n\t\t}\n\t\tif size <= a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "82d4dd63f73da633f7bc4b3ca2b0dacd", "score": "0.4415756", "text": "func isNotAfter(a, b Date) bool {\n\t// switch b.year - a.year {\n\tswitch {\n\tcase b.year > a.year:\n\t\treturn true\n\tcase b.year < a.year:\n\t\treturn false\n\t}\n\tswitch {\n\tcase b.month > a.month:\n\t\treturn true\n\tcase b.month < a.month:\n\t\treturn false\n\t}\n\treturn b.day >= a.day\n}", "title": "" }, { "docid": "402abbbb9d1a2ca555aa3f15772b4ebb", "score": "0.44093773", "text": "func older(p1, p2 persona) (persona, int) {\n\tif p1.edad > p2.edad {\n\t\treturn p1, (p1.edad - p2.edad)\n\t}\n\n\treturn p2, (p2.edad - p1.edad)\n}", "title": "" }, { "docid": "4897c5f4fd855ce3cc3d4f59349241b3", "score": "0.44083092", "text": "func getRecentProcess(pids sort.IntSlice) int {\n\tif len(pids) == 0 {\n\t\treturn 0\n\t}\n\ttmax := uint64(0)\n\tpid := 0\n\tfor _, p := range pids {\n\t\tt, zombie := getProcessStartTime(p)\n\t\tif zombie {\n\t\t\tcontinue\n\t\t}\n\t\tif t > tmax {\n\t\t\tpid = p\n\t\t\ttmax = t\n\t\t}\n\t}\n\treturn pid\n}", "title": "" }, { "docid": "4646f794dfdf64bdfce26254113719b2", "score": "0.44051248", "text": "func (c *TypedCache[K, V]) LeastRecent() *V {\n\tif c.Len() == 0 {\n\t\treturn nil\n\t}\n\treturn &c.ll.Back().value.value\n}", "title": "" }, { "docid": "4ea92b731971bd60128c4429b327196a", "score": "0.44035065", "text": "func SortRecent(messages []*events.LogMessage) []*events.LogMessage {\n\tsort.Stable(logMessageSlice(messages))\n\treturn messages\n}", "title": "" } ]
babae98091348b511a56e78a6387c442
Root returns the krew root directory for this test.
[ { "docid": "d49b6bd7993f0100c31d75e501496171", "score": "0.7751973", "text": "func (it *ITest) Root() string {\n\treturn it.tempDir.Root()\n}", "title": "" } ]
[ { "docid": "b0b60325d4db7ef236de823e40c1e942", "score": "0.79064006", "text": "func (c *testClient) Root() fs.RootDir {\n\t// Todo need a TestRootDir\n\treturn fs.RootDir{}\n}", "title": "" }, { "docid": "43c63c12bc78684e2c1f3ea8d1845c68", "score": "0.7460407", "text": "func (cfg *Config) Root() string {\n\treturn filepath.Join(cfg.Home, rootName)\n}", "title": "" }, { "docid": "c4634c3918da9df8adcf6cc83224e4f5", "score": "0.7298473", "text": "func RootDir() string {\n\t// Get path to the base for code\n\t_, b, _, _ := runtime.Caller(0)\n\tdir := path.Join(path.Dir(b))\n\t// fmt.Printf(\"dir: %s\", dir)\n\treturn filepath.Dir(dir)\n}", "title": "" }, { "docid": "4d11fb67c0cb80249c57dbc43e05d200", "score": "0.72751033", "text": "func (reg *idlRegistry) RootDir() string {\n\treturn reg.repo.LocalDir()\n}", "title": "" }, { "docid": "d82f3b5053d1388a57c70e810e9b4a4f", "score": "0.72643965", "text": "func getRootPath() string {\n\tvar root string\n \troot, err := bazel.RunfilesPath()\n \tif err != nil {\n\t\t// Fall back to the non-bazel way to get to the root directory.\n\t\troot = callerRoot + \"/../../\"\n\t}\n\treturn root\n}", "title": "" }, { "docid": "666d319c86b1ad54dcaae715e4546644", "score": "0.7228666", "text": "func (c Context) RootDir() string { return c.root }", "title": "" }, { "docid": "fc9a5ed3107faf99c9f6192683b41bc3", "score": "0.7173895", "text": "func (se *SSEnv) GetRootDir() string {\n\treturn se.rootDir\n}", "title": "" }, { "docid": "7c144e4090386502540a0d6903992e34", "score": "0.7137296", "text": "func (fs *FS) Root() string {\n\treturn path.Join(fs.h.GetCanonicalPath(), fs.subdir)\n}", "title": "" }, { "docid": "36b4f395cb2b0792456667e402266490", "score": "0.709297", "text": "func (o *Output) RootDir() string {\n\treturn o.root\n}", "title": "" }, { "docid": "97dd162191772f890de27914f03150e5", "score": "0.7076173", "text": "func RootPath() string {\n\treturn configRootPath\n}", "title": "" }, { "docid": "ef69cba59dca917155ad3be5ff35386b", "score": "0.70162827", "text": "func (s PackageSpec) rootDir() string {\n\tif s.OutputFile != \"\" {\n\t\treturn filepath.Base(s.OutputFile)\n\t}\n\n\t// NOTE: This uses .BeatName instead of .Name because we wanted the internal\n\t// directory to not include \"-oss\".\n\treturn s.MustExpand(\"{{.BeatName}}-{{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}}{{if .OS}}-{{.OS}}{{end}}{{if .Arch}}-{{.Arch}}{{end}}\")\n}", "title": "" }, { "docid": "6a6442dfc0619478f04cff442dda62c0", "score": "0.70117974", "text": "func PathRoot() (string, error) {\n\tdir := os.Getenv(EnvDir)\n\tvar err error\n\tif len(dir) == 0 {\n\t\tdir, err = homedir.Expand(KeysPathRoot)\n\t}\n\treturn dir, err\n}", "title": "" }, { "docid": "cf115c19b961a45e1bece504ba99c1ba", "score": "0.6951425", "text": "func (e *Env) Root() Path {\n\treturn Path{root: e.root}\n}", "title": "" }, { "docid": "3da1ad57b04545e44bd70992603161d5", "score": "0.69184196", "text": "func GetRootDir() (string, error) {\n\treturn filepath.Abs(filepath.Dir(os.Args[0]))\n}", "title": "" }, { "docid": "329e6d3504c8c369b76c60cb66da69ba", "score": "0.6796513", "text": "func RootDir(dir string) { rootDir = dir }", "title": "" }, { "docid": "d61e4fa3b680745e41d5d969a58f8e8a", "score": "0.67770016", "text": "func (c *Config) rootPath() string {\n\tif c.Path.Root == \"\" {\n\t\tif path := os.Getenv(RootVarName); path != \"\" {\n\t\t\treturn path\n\t\t}\n\t\treturn defaultRootPath()\n\t}\n\treturn c.Path.Root\n}", "title": "" }, { "docid": "62a036c3802e8f0ec6e47717a45f4bfa", "score": "0.6729969", "text": "func (s *AmberEngine) RootDir(root string) *AmberEngine {\n\ts.rootDir = filepath.ToSlash(root)\n\treturn s\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.6712886", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.6712886", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.6712886", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.6712886", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.6712886", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.6712886", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.6712886", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "4b99b44ec26515313c772c9ed85e426e", "score": "0.6712886", "text": "func (f *Fs) Root() string {\n\treturn f.root\n}", "title": "" }, { "docid": "64fca2fe59f05d6ea858591eb084e232", "score": "0.6698033", "text": "func (f *Fs) Root() string {\n\tif f.root == \"\" {\n\t\treturn f.bucket\n\t}\n\treturn f.bucket + \"/\" + f.root\n}", "title": "" }, { "docid": "abcd884ea3b7969d3cafa55094437006", "score": "0.6664705", "text": "func GetRoot() string {\n\treturn \"/sys/devices/w1_bus_master1/\"\n}", "title": "" }, { "docid": "c2653e64395bae8e6046f58d5dae8172", "score": "0.66492295", "text": "func GetRootPath() string {\n\tp, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn p\n}", "title": "" }, { "docid": "99ee794a096a503cca02769e929de0be", "score": "0.6648701", "text": "func getRepositoryRoot(t *testing.T) string {\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error getting working directory: %s\", err)\n\t}\n\n\troot, err := filepath.Abs(filepath.Join(wd, \"../../internal/testdata\"))\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error getting absolute directory: %s\", err)\n\t}\n\n\treturn root\n}", "title": "" }, { "docid": "0160457544c1c84dbadeed4eeba6497f", "score": "0.66197985", "text": "func WorkspaceRoot() string {\n\tvar _, file, _, _ = runtime.Caller(0)\n\treturn path.Dir(path.Dir(path.Dir(file)))\n}", "title": "" }, { "docid": "a7fc15ff879c3e81fbdd3a78d1a0fb29", "score": "0.657434", "text": "func GetRootDir() string {\n\trootDir, _ := exec.Command(\"git\", \"rev-parse\", \"--show-toplevel\").Output()\n\treturn strings.ReplaceAll(string(rootDir), \"\\n\", \"\")\n}", "title": "" }, { "docid": "2339d54a59f6db95e90685da552db65b", "score": "0.65726715", "text": "func (c *Config) RootPath() string {\n\tif c.Path.Root == \"\" {\n\t\tc.Path.Root = c.rootPath()\n\t}\n\treturn c.Path.Root\n}", "title": "" }, { "docid": "821c74f8777e9698f534b6a15d3d2b53", "score": "0.6568513", "text": "func rootDir() (dir string) {\n\tgolist := exec.Command(\"go\", \"list\", \"-f\", \"{{.Dir}}\", \"github.com/pangine/disasm-eval-sources/disasm-eval-generate\")\n\tres, errin := golist.Output()\n\tif errin != nil {\n\t\tfmt.Println(\"ERROR: Cannot find the go project, please install this project using `go get` or specify the location of the project using \\\"-pth\\\" argument.\")\n\t\tpanic(errin)\n\t}\n\tdir = string(res)\n\treturn filepath.Join(dir, \"..\")\n}", "title": "" }, { "docid": "4a213805b51fd70c133b0e86427c963e", "score": "0.6533172", "text": "func (fsdc *FileSystemDynamicConfiguration) RootPath() string {\n\treturn fsdc.rootPath\n}", "title": "" }, { "docid": "b0565e3356ec282942e617dc3b5e8406", "score": "0.64914805", "text": "func (o *Object) rootPath() string {\n\treturn o.fs.rootPath(o.remote)\n}", "title": "" }, { "docid": "6b870e17c480fef51ec9ff55a10d51eb", "score": "0.6489161", "text": "func (c *OfflineCA) Root() string {\n\treturn c.config.Root.First()\n}", "title": "" }, { "docid": "dee89575e0647274468e0ffbf1ce17a3", "score": "0.6392971", "text": "func (o TaskDefinitionVolumeFsxWindowsFileServerVolumeConfigurationOutput) RootDirectory() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TaskDefinitionVolumeFsxWindowsFileServerVolumeConfiguration) string { return v.RootDirectory }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5556134148b229232b12a0d4d3fd6100", "score": "0.63398945", "text": "func Root() string {\n\treturn root\n}", "title": "" }, { "docid": "760aa027fc064ae9934bb3d7c807f94b", "score": "0.63036364", "text": "func (_ CornellEngine) RootURL() string {\n\treturn cornellRootURL\n}", "title": "" }, { "docid": "ef190a750023043540b6f906aa9afc7f", "score": "0.6295901", "text": "func (o PosixFilesystemOutput) RootDirectory() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PosixFilesystem) *string { return v.RootDirectory }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ef190a750023043540b6f906aa9afc7f", "score": "0.6295901", "text": "func (o PosixFilesystemOutput) RootDirectory() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PosixFilesystem) *string { return v.RootDirectory }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3c114c0f7f95453c923958c312e43dbf", "score": "0.6288965", "text": "func (d *Dir) RootModuleDir() string {\n\t// The root module configuration is just directly inside the main directory.\n\treturn d.mainDir\n}", "title": "" }, { "docid": "072fd7bf23364fec2e6a84c1429f9b1a", "score": "0.6277933", "text": "func rootDir(path string) string {\n\tif runtime.GOOS == \"windows\" {\n\t\treturn filepath.Join(`c:\\`, path)\n\t}\n\treturn filepath.Join(\"/\", path)\n}", "title": "" }, { "docid": "f893776629406b1f652033880714e2b6", "score": "0.62631905", "text": "func (o TaskDefinitionVolumeEfsVolumeConfigurationOutput) RootDirectory() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TaskDefinitionVolumeEfsVolumeConfiguration) *string { return v.RootDirectory }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7b590299013a9feaca25595e3ef64ddf", "score": "0.6261656", "text": "func (g *gitHubRepository) RootPath() string {\n\treturn g.rootPath\n}", "title": "" }, { "docid": "23c651c8264ce40b563fd3662ba43ee9", "score": "0.6240841", "text": "func (x *TestEnvController) ObjectRoot() string {\n\treturn filepath.Join(\n\t\tx.xdgConfigHome, pgmconfig.PgmName, plugin.PluginRoot)\n}", "title": "" }, { "docid": "407cb2af43931b496bbe40beb8f7b0ab", "score": "0.6231126", "text": "func (r *Repository) Root() string { return r.root }", "title": "" }, { "docid": "2829fe75930a610fe45ea5cb10941b28", "score": "0.6184851", "text": "func (em *ExerciseMetadata) root(workspace string) string {\n\tif em.Team != \"\" {\n\t\treturn filepath.Join(workspace, \"teams\", em.Team)\n\t}\n\tif !em.IsRequester {\n\t\treturn filepath.Join(workspace, \"users\", em.Handle)\n\t}\n\treturn workspace\n}", "title": "" }, { "docid": "8b63d3a4cc1a04c76c823de1ffac3973", "score": "0.61751926", "text": "func RootConfigPath() string {\n\treturn rootConfigPath\n}", "title": "" }, { "docid": "9051702b2f6d5ba90796060b56a94add", "score": "0.6147396", "text": "func RepositoryRoot() (string, error) {\n\tonce.Do(func() { repositoryRootValue, repositoryRootError = findRootFromCwd() })\n\treturn repositoryRootValue, repositoryRootError\n}", "title": "" }, { "docid": "7066ee947a707e6dde4f9ffbce9c5856", "score": "0.61413735", "text": "func (o TaskDefinitionVolumeFsxWindowsFileServerVolumeConfigurationPtrOutput) RootDirectory() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TaskDefinitionVolumeFsxWindowsFileServerVolumeConfiguration) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RootDirectory\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "eff4af611c2e7280b88b382f92e76505", "score": "0.612613", "text": "func (o PosixFilesystemResponseOutput) RootDirectory() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PosixFilesystemResponse) string { return v.RootDirectory }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "eff4af611c2e7280b88b382f92e76505", "score": "0.612613", "text": "func (o PosixFilesystemResponseOutput) RootDirectory() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PosixFilesystemResponse) string { return v.RootDirectory }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b0d5245f464424a5058299a49652618e", "score": "0.6102257", "text": "func (l *fileLoader) Root() string {\n\treturn l.roots[len(l.roots)-1]\n}", "title": "" }, { "docid": "9faabf56b0f1314291fba6d9d88e8e97", "score": "0.6098336", "text": "func (r *Receipt) GetRoot() string {\n\treturn r.Root\n}", "title": "" }, { "docid": "c97906c3388444aab21a1547d4eb2d87", "score": "0.60910845", "text": "func (o TaskDefinitionVolumeEfsVolumeConfigurationPtrOutput) RootDirectory() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TaskDefinitionVolumeEfsVolumeConfiguration) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.RootDirectory\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ac9fa093fc2b9cd850ba8f2052e3db54", "score": "0.6084753", "text": "func GetRootAppDir() string {\n\n\tvalue := os.Getenv(envVarName)\n\n\tvar dir string\n\tif len(value) == 0 {\n\t\tuser, _ := user.Current()\n\t\tdir = path.Join(user.HomeDir, \".sliver\")\n\t} else {\n\t\tdir = value\n\t}\n\n\tif _, err := os.Stat(dir); os.IsNotExist(err) {\n\t\terr = os.MkdirAll(dir, 0700)\n\t\tif err != nil {\n\t\t\tsetupLog.Fatalf(\"Cannot write to sliver root dir %s\", err)\n\t\t}\n\t}\n\treturn dir\n}", "title": "" }, { "docid": "bb137c18f655fe90b29a7a04a64d0921", "score": "0.60583675", "text": "func (s *HandlebarsEngine) RootDir(root string) *HandlebarsEngine {\n\tif s.fs != nil && root != \"\" && root != \"/\" && root != \".\" && root != s.rootDir {\n\t\tsub, err := fs.Sub(s.fs, s.rootDir)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\ts.fs = sub // here so the \"middleware\" can work.\n\t}\n\n\ts.rootDir = filepath.ToSlash(root)\n\treturn s\n}", "title": "" }, { "docid": "a3757fc26ffcf64ad1e011a7cf563f87", "score": "0.60501695", "text": "func (c *Client) RootURL() string { return c.rootURL }", "title": "" }, { "docid": "0cfff98885a1e11618140a9a22b5ac79", "score": "0.60356224", "text": "func (p *Package) Root() string {\n\treturn p.Source.Root()\n}", "title": "" }, { "docid": "70c08f5f95eb1ee9ea8cee5273b4576b", "score": "0.6034799", "text": "func (ts *testServerImpl) BaseDir() string {\n\treturn ts.baseDir\n}", "title": "" }, { "docid": "f9736b189282536dc4fcb53614ca57fe", "score": "0.60327244", "text": "func GetModuleRootPath() string {\n\tp, err := build.Default.Import(\n\t\t\"github.com/dsoprea/go-exif-knife\",\n\t\tbuild.Default.GOPATH,\n\t\tbuild.FindOnly)\n\n\tlog.PanicIf(err)\n\n\tpackagePath := p.Dir\n\treturn packagePath\n}", "title": "" }, { "docid": "01912a822309ff8888c20aa2ae9bbb42", "score": "0.6026929", "text": "func (p *Profile) Root() string {\n\treturn p.root\n}", "title": "" }, { "docid": "8fd17caf1713aa241c05a94136cbb9d7", "score": "0.6023967", "text": "func rootDir(dir string) string {\n\tpkgIndex := -1\n\tparts := strings.Split(dir, string(filepath.Separator))\n\tfor i, d := range parts {\n\t\tif d == \"pkg\" {\n\t\t\tpkgIndex = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif pkgIndex == -1 {\n\t\treturn dir\n\t}\n\treturn strings.Join(parts[:pkgIndex], string(filepath.Separator))\n}", "title": "" }, { "docid": "74240a90b274ba8a9b4fbeb06c6dc72e", "score": "0.6017165", "text": "func (o PosixFilesystemPtrOutput) RootDirectory() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PosixFilesystem) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.RootDirectory\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "74240a90b274ba8a9b4fbeb06c6dc72e", "score": "0.6017165", "text": "func (o PosixFilesystemPtrOutput) RootDirectory() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PosixFilesystem) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.RootDirectory\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d640644a0b9cee8cb316e33ed5d89fd7", "score": "0.60125047", "text": "func projectRoot() (string, error) {\n\troot, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Could not get the current working directory: %v\", err)\n\t}\n\tfor isDir(root) {\n\t\tif isFile(filepath.Join(root, \"WORKSPACE\")) {\n\t\t\treturn root, nil\n\t\t}\n\t\troot, _ = filepath.Split(root)\n\t}\n\treturn \"\", fmt.Errorf(\"Couldn't find project root from CWD\")\n}", "title": "" }, { "docid": "f952a006dc8ec065376b5cc25e2fa329", "score": "0.6002595", "text": "func (t *T) RootTempDir() string {\n\ttestLibRootDirOnce.Do(func() {\n\t\tvar err error\n\t\tvar reader *os.File\n\t\tmode := os.FileMode(0777)\n\t\ttestLibRootDir, err = ioutilTempDir(\"\", \"golang-testlib\")\n\t\tt.NotEqual(testLibRootDir, \"\")\n\t\tt.ExpectSuccess(err)\n\t\tt.ExpectSuccess(osChmod(testLibRootDir, mode))\n\t\treader, testLibRootDirStdin, err = os.Pipe()\n\t\tt.ExpectSuccess(err)\n\t\tcmd := exec.Command(os.Args[0], testInterceptorArg,\n\t\t\ttestLibRootDir)\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\t\tcmd.Stdin = reader\n\t\tt.ExpectSuccess(cmd.Start())\n\t\tt.ExpectSuccess(reader.Close())\n\t})\n\treturn testLibRootDir\n\n}", "title": "" }, { "docid": "745bbe71edbdc62033e12be3bad56f89", "score": "0.59978163", "text": "func (fs *FS) Root() (fs.Node, error) {\n\tn := newDir(fs, 0, nil, \"\")\n\treturn n, nil\n}", "title": "" }, { "docid": "e106b877cd4e3031c814eaeb35705de1", "score": "0.59963083", "text": "func GetProjectRoot() string {\n\tdir, err := os.Getwd()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn strings.Split(dir, \"lazynpm\")[0] + \"lazynpm\"\n}", "title": "" }, { "docid": "41ba91f4193e1169fe6899a98ebcc176", "score": "0.5978324", "text": "func (_m *MockManifest) RootDir() string {\n\tret := _m.ctrl.Call(_m, \"RootDir\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "af8429a3d8e298180943e7281b0f147b", "score": "0.59768075", "text": "func (s *fuseServer) Root() (fs.Node, error) {\n\n\treturn s.root, nil\n}", "title": "" }, { "docid": "fc0823c271164059c91600cf9545d1d7", "score": "0.59697974", "text": "func getModuleRootPath() string {\n\tmoduleRootPath := os.Getenv(\"EXIF_KNIFE_MODULE_ROOT_PATH\")\n\tif moduleRootPath != \"\" {\n\t\treturn moduleRootPath\n\t}\n\n\tcurrentWd, err := os.Getwd()\n\tlog.PanicIf(err)\n\n\tcurrentPath := currentWd\n\tvisited := make([]string, 0)\n\n\tfor {\n\t\ttryStampFilepath := path.Join(currentPath, \".MODULE_ROOT\")\n\n\t\t_, err := os.Stat(tryStampFilepath)\n\t\tif err != nil && os.IsNotExist(err) != true {\n\t\t\tlog.Panic(err)\n\t\t} else if err == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tvisited = append(visited, tryStampFilepath)\n\n\t\tcurrentPath = path.Dir(currentPath)\n\t\tif currentPath == \"/\" {\n\t\t\tlog.Panicf(\"could not find module-root: %v\", visited)\n\t\t}\n\t}\n\n\treturn currentPath\n}", "title": "" }, { "docid": "8f7def346ac12633e87ce4779db11c30", "score": "0.59472305", "text": "func getRepoRoot() string {\n\t// /foo/bar/linkerd-smi/pkg/charts/static/templates.go\n\t_, filename, _, _ := runtime.Caller(0)\n\n\t// /foo/bar/linkerd-smi/pkg/charts/static\n\tdir := filepath.Dir(filename)\n\n\t// filepath.Dir returns the parent directory, so that combined with joining\n\t// \"..\" walks 1 level up the tree:\n\t// /foo/linkerd-smi\n\treturn filepath.Dir(path.Join(dir, \"..\"))\n}", "title": "" }, { "docid": "46e8fbc0892758f270b8ad3554dea986", "score": "0.5938234", "text": "func getSandboxRootDir(rootDir, id string) string {\n\treturn filepath.Join(rootDir, sandboxesDir, id)\n}", "title": "" }, { "docid": "44f4659a435598a798974a9440bb1a30", "score": "0.5925367", "text": "func GetGoRootDir(appDir string) string {\n\treturn path.Join(appDir, goDirName)\n}", "title": "" }, { "docid": "6745d2fcf741dc61fddfa2a7a1770c32", "score": "0.5911757", "text": "func (c *AppConfig) GetDBRootDir() string {\n\treturn filepath.Join(c.NetDataDir(), \"data\")\n}", "title": "" }, { "docid": "d3ad162ee2698572acff109ac435cdaa", "score": "0.59040886", "text": "func ProjectRoot() (string, error) {\n\tpath, err := filepath.Abs(os.Args[0])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn path[0:strings.LastIndex(path, RuneToAscii(os.PathSeparator))], nil\n}", "title": "" }, { "docid": "41e6c3c7648ab40641ad019d8489496d", "score": "0.58999777", "text": "func (f *FS) Root() (fusefs.Node, error) {\n\tfs.Debug(f.f, \"Root()\")\n\tfsDir := &fs.Dir{\n\t\tName: \"\",\n\t\tWhen: time.Now(),\n\t}\n\treturn newDir(f.f, fsDir), nil\n}", "title": "" }, { "docid": "88076a92aa5f8d6f771fe72c793aa93b", "score": "0.5899915", "text": "func (x *TestEnvController) SrcRoot() string {\n\tdir := filepath.Join(\n\t\tos.Getenv(\"GOPATH\"), \"src\",\n\t\tpgmconfig.Repo, pgmconfig.PgmName, plugin.PluginRoot)\n\tif _, err := os.Stat(dir); err != nil {\n\t\tx.t.Errorf(\"plugin source objRoot '%s' not found\", dir)\n\t}\n\treturn dir\n}", "title": "" }, { "docid": "95c98492fb1c37d3b089ae48a0d4a4b4", "score": "0.58973444", "text": "func (r *Rootfs) Path() string {\n\treturn r.root\n}", "title": "" }, { "docid": "67156b1246d7053143d4f9d0a1b365e9", "score": "0.58892393", "text": "func GetTestFolder() string {\n\treturn filepath.Join(getRootPath(), \"test_files\")\n}", "title": "" }, { "docid": "72cee769eb8f75131a3eed1046d12231", "score": "0.5882287", "text": "func (site *Site) RootURL() *url.URL {\n\trootURL := url.URL{Scheme: config.Scheme, Host: site.Domain, Path: config.RootPath}\n\treturn &rootURL\n}", "title": "" }, { "docid": "9bcd191256a2650bd4c653e6aaa7eccd", "score": "0.5873815", "text": "func GetProjectRoot() string {\n\tvar (\n\t\tpath string\n\t\terr error\n\t)\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"GetProjectRoot error :%+v\", err))\n\t\t}\n\t}()\n\tpath, err = filepath.Abs(filepath.Dir(os.Args[0]))\n\treturn path\n}", "title": "" }, { "docid": "7da6b8f8ac4b26373e9745543566db67", "score": "0.5865004", "text": "func (c *Context) LogRootDir() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "8a4f49b3c19574f931bfba61d0801ca2", "score": "0.58625287", "text": "func GetRootCAPath() string {\n\treturn filepath.Join(step.Path(), publicPath, \"root_ca.crt\")\n}", "title": "" }, { "docid": "0673d00e5f053046b17236161e03243f", "score": "0.5853685", "text": "func TestBaseDir() string {\n\t// Get base of code part of this executable\n\t// fmt.Printf(\"project dir: %s\\n\", ProjectDir())\n\tdir := path.Join(ProjectDir(), \"/bin/test/\")\n\t// fmt.Printf(\"dir: %s\", dir)\n\treturn dir\n}", "title": "" }, { "docid": "d6ba8108d9b91b354b9ac1285a47645b", "score": "0.58481705", "text": "func (f *Fs) rootPath(remote string) string {\n\treturn f.rootSlash() + remote\n}", "title": "" }, { "docid": "2771d4869b179484827976852e4b0288", "score": "0.58452624", "text": "func findKubeRoot() (root string, err error) {\n\tgoroot := os.Getenv(\"GOPATH\")\n\tif goroot == \"\" {\n\t\tcmd := exec.NewHostCmd(\"go\", \"env\", \"GOPATH\")\n\t\tlines, err := cmd.RunAndCapture()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tgoroot = lines[0]\n\t\tif goroot == \"\" {\n\t\t\treturn \"\", errors.New(\"unable to get GOPATH env variable. Please provide Kubernetes path source using the --kube-root flag\")\n\t\t}\n\t}\n\n\tkubeRoot := filepath.Join(goroot, \"src\", \"k8s.io\", \"kubernetes\")\n\tif _, err := os.Stat(kubeRoot); os.IsNotExist(err) {\n\t\treturn \"\", errors.New(\"$GOPATH/src/k8s.io/kubernetes does not exists. Please provide Kubernetes path source using the --kube-root flag\")\n\t}\n\n\tif !maybeKubeRoot(kubeRoot) {\n\t\treturn \"\", errors.New(\"$GOPATH/src/k8s.io/kubernetes does not seems a valid Kubernetes source folder. Please provide Kubernetes source path using the --kube-root flag\")\n\t}\n\treturn kubeRoot, nil\n}", "title": "" }, { "docid": "6a1719a630caff97bb3b8cbb664bb502", "score": "0.5834206", "text": "func (s *SVFS) Root() (fs.Node, error) {\n\t// Mount a specific container\n\tif TargetContainer != \"\" {\n\t\treturn s.rootContainer(TargetContainer)\n\t}\n\t// Mount all containers within an account\n\treturn &Root{\n\t\tDirectory: &Directory{\n\t\t\tapex: true,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "dde431ff892cf2e95c42ef6a885c58ab", "score": "0.5815285", "text": "func (o PosixFilesystemResponsePtrOutput) RootDirectory() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PosixFilesystemResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RootDirectory\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0cbb43680b6e7054a1f8d6855f107ee9", "score": "0.58127576", "text": "func root(a app.App) string {\n\treturn filepath.Join(a.Root(), \".ksonnet\", \"registries\")\n}", "title": "" }, { "docid": "cb8762ea6ca1eb8fe55b5166c06d4136", "score": "0.5809027", "text": "func (reg *idlRegistry) ThriftRootDir() string {\n\treturn reg.idlDir\n}", "title": "" }, { "docid": "34dd0f7674793e261288befa3152640a", "score": "0.58024234", "text": "func (x *NsJailConfig) GetChrootDir() string {\n\tif x != nil && x.ChrootDir != nil {\n\t\treturn *x.ChrootDir\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "396660fa722c4e217630ed514e940551", "score": "0.5786781", "text": "func initRoot() {\n\tdir, err := os.Getwd()\n\tif err != nil {\n\t\tpanic(\"get pwd error, \" + err.Error())\n\t}\n\troot = dir\n}", "title": "" }, { "docid": "3e24511aa2e1f6a07fd7479fe365926a", "score": "0.5755054", "text": "func (mt *MerkleTree) GetRoot() string {\n\treturn mt.tree[len(mt.tree)-1]\n}", "title": "" }, { "docid": "0bafb7eed99fa75102c972f06b9ae18a", "score": "0.5754627", "text": "func (k *LibKBFS) GetRootDir(\n\tu User, tlfName string, t tlf.Type, expectedCanonicalTlfName string) (\n\tdir Node, err error) {\n\treturn k.getRootDir(\n\t\tu, tlfName, t, data.MasterBranch, expectedCanonicalTlfName)\n}", "title": "" }, { "docid": "001c8034033b043568499046948444bd", "score": "0.57541597", "text": "func findRootDir() (string, error) {\n\tif path := os.Getenv(\"GITLAB_SHELL_DIR\"); path != \"\" {\n\t\treturn path, nil\n\t}\n\n\tpath, err := os.Executable()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Start: /opt/.../gitlab-shell/bin/gitlab-shell\n\t// Ends: /opt/.../gitlab-shell\n\treturn filepath.Dir(filepath.Dir(path)), nil\n}", "title": "" }, { "docid": "903e1a547d55f185f220fd90f2975229", "score": "0.5736096", "text": "func GetBaseDir() string {\n\treturn cmdutil.Env(\"BASETMPDIR\", path.Join(os.TempDir(), \"openshift-\"+Namespace()))\n}", "title": "" }, { "docid": "fc1189490cf4310fb96676521eefb3a1", "score": "0.5724627", "text": "func rootPackage() (string, error) {\n\tpwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"failed to read current directory\")\n\t}\n\n\tgopath := os.Getenv(\"GOPATH\")\n\tif gopath == \"\" {\n\t\treturn \"\", errNoGOPATH\n\t}\n\n\tif !strings.HasPrefix(pwd, gopath) {\n\t\treturn \"\", errOutsideGOPATH\n\t}\n\n\tpwd = strings.TrimPrefix(pwd, filepath.Join(gopath, \"src\", \"\"))\n\tpwd = strings.TrimPrefix(pwd, string(filepath.Separator))\n\n\tparts := strings.SplitN(pwd, string(filepath.Separator), 3)\n\tif len(parts) < 1 {\n\t\treturn \"\", errTooShallow\n\t}\n\n\treturn strings.Join(parts[:2], string(filepath.Separator)), nil\n}", "title": "" } ]
fbf2bd2c42c2da2faaec3392e6003ffc
ParseAndEvaluateYAML accepts a byte array that looks like YAML and evaluates it against itself
[ { "docid": "eea3f2f340b109ead309483d4a92efed", "score": "0.6151648", "text": "func ParseAndEvaluateYAML(b []byte, context map[string]interface{}, withFuncs ...WithFunc) ([]byte, error) {\n\tvar decoded map[string]interface{}\n\terr := yaml.Unmarshal(b, &decoded)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treplaced := string(b)\n\t// ORDER MATTERS HERE!!!!\n\treplaced = selfReferentalRegex.ReplaceAllString(replaced, \"${ .context.$1 }\")\n\treplaced = environmentVariableRegex.ReplaceAllString(replaced, `${ .Env.$1 }`)\n\treplaced = selfReferentalWithDefaultRegex.ReplaceAllString(replaced, `${ or .context.$1 \"$2\"}`)\n\treplaced = environmentVariableWithDefaultRegex.ReplaceAllString(replaced, `${ or .Env.$1 \"$2\" }`)\n\n\t// if we pass some context along, merge it with the decoded file\n\t// this handles parent evaluations\n\tif context != nil {\n\t\tif err := mergo.Merge(&decoded, context, mergo.WithOverride); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tparsed, err := template.New(\"config\").Delims(\"${\", \"}\").Parse(replaced)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata := map[string]interface{}{\"context\": decoded}\n\n\tfor _, f := range withFuncs {\n\t\tk, v := f()\n\t\tdata[k] = v\n\t}\n\n\tvar buf bytes.Buffer\n\terr = parsed.Execute(&buf, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbufToString := buf.String()\n\n\tif strings.Contains(bufToString, \"${\") {\n\t\treturn ParseAndEvaluateYAML([]byte(bufToString), decoded, withFuncs...)\n\t}\n\n\treturn []byte(buf.String()), nil\n}", "title": "" } ]
[ { "docid": "b58524db6cbd66eae72aa4bc3b4861dc", "score": "0.63484365", "text": "func unmarsharlYaml(byteArray []byte) types.EngineConfig {\n var cfg types.EngineConfig\n err := yaml.Unmarshal([]byte(byteArray), &cfg)\n if err != nil {\n log.Fatalf(\"error: %v\", err)\n }\n return cfg\n}", "title": "" }, { "docid": "161ced495b923c51ce061521fb91d16c", "score": "0.60421455", "text": "func parseStackFromBytes(data []byte) (stack *v1alpha1.Stack, err error) {\n\terr = yaml.Unmarshal(data, &stack)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9f4af873d4fee1ebd8375bcf16ae2770", "score": "0.6005813", "text": "func ParseYAML(yamlBytes []byte) ([]Pair, error) {\n\tvar pairs []Pair\n\n\terr := yaml.Unmarshal(yamlBytes, &pairs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pairs, nil\n}", "title": "" }, { "docid": "c157ac7d450761978d2522a80d1403a3", "score": "0.59568244", "text": "func unmarsharlYaml(byteArray []byte) types.EngineConfig {\n\tvar cfg types.EngineConfig\n\terr := yaml.Unmarshal([]byte(byteArray), &cfg)\n\tif err != nil {\n\t\tlog.Fatalf(\"error: %v\", err)\n\t}\n\treturn cfg\n}", "title": "" }, { "docid": "3e265868eb3886ca77bb8d35e0f8e4d2", "score": "0.5939787", "text": "func (e *Expect) UnmarshalYAML(bytes []byte) error {\n\te.bytes = bytes\n\treturn nil\n}", "title": "" }, { "docid": "50d6423109d90785083f978d20018585", "score": "0.5933881", "text": "func newYamlFromBytes(bytes []byte) (*YamlAgentConfig, error) {\n\tvar yamlConf YamlAgentConfig\n\n\tif err := yaml.Unmarshal(bytes, &yamlConf); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse yaml configuration: %s\", err)\n\t}\n\treturn &yamlConf, nil\n}", "title": "" }, { "docid": "3b9a07b3d93996e4a2eb88796a282a8d", "score": "0.5853132", "text": "func LoadUnstructuredFromBytes(yamlBytes []byte) *unstructured.Unstructured {\n\tvar un unstructured.Unstructured\n\terr := yaml.Unmarshal(yamlBytes, &un)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &un\n}", "title": "" }, { "docid": "92130593c234091864efbc79770a1e4e", "score": "0.5845114", "text": "func LoadWorkflowFromBytes(yamlBytes []byte) *wfv1.Workflow {\n\tvar wf wfv1.Workflow\n\terr := yaml.Unmarshal(yamlBytes, &wf)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &wf\n}", "title": "" }, { "docid": "2377596269aa7089cf95cb52339ab211", "score": "0.58308107", "text": "func ParseBytes(b []byte) (*Config, error) {\n\tout := new(Config)\n\terr := yaml.Unmarshal(b, out)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "4068ffa3484aba6febb6669dac07d334", "score": "0.5823385", "text": "func loadConfigFromBytes(data []byte) (cd *Configuration, err error) {\n\n\t// unmarshall yaml data to struct\n\terr = yaml.Unmarshal(data, &cd)\n\tif err != nil {\n\t\treturn cd, err\n\t}\n\n\treturn cd, nil\n}", "title": "" }, { "docid": "41f5c406120a16e2c9306f16f401c183", "score": "0.5789972", "text": "func alertmanagerConfigFromBytes(b []byte) (*alertmanagerConfig, error) {\n\t// Run upstream Load function to get any validation checks that it runs.\n\t_, err := config.Load(string(b))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg := &alertmanagerConfig{}\n\terr = yaml.UnmarshalStrict(b, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := checkAlertmanagerConfigRootRoute(cfg.Route); err != nil {\n\t\treturn nil, errors.Wrap(err, \"check AlertmanagerConfig root route failed\")\n\t}\n\n\treturn cfg, nil\n}", "title": "" }, { "docid": "41d7d5fd209df7def1cf2e82f7d2dc2f", "score": "0.5789821", "text": "func parseConfig(bytes []byte) (Config, error) {\n\tconfig := Config{}\n\terr := yaml.Unmarshal(bytes, &config)\n\n\treturn config, err\n}", "title": "" }, { "docid": "029db901c905a1a8fed224ea30f04433", "score": "0.5765656", "text": "func FormYAMLFromBytes(def *ClientConfigDefault, bytes []byte, stateType string) (*models.FormYAML, error) {\n\tform, err := unqueriedFormYAMLFromBytes(bytes)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlookup := formToLookupTable(def, form, stateType)\n\n\t// merge data from lookup\n\tdata := make(map[string]interface{})\n\n\tfor _, lookupVal := range lookup {\n\t\tif lookupVal != nil {\n\t\t\tqueryRes, err := lookupVal.TemplateReader.Read()\n\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor queryResKey, queryResVal := range queryRes {\n\t\t\t\tdata[queryResKey] = queryResVal\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i, tab := range form.Tabs {\n\t\tfor j, section := range tab.Sections {\n\t\t\tfor k, content := range section.Contents {\n\t\t\t\tkey := fmt.Sprintf(\"tabs[%d].sections[%d].contents[%d]\", i, j, k)\n\n\t\t\t\tif val, ok := data[key]; ok {\n\t\t\t\t\tcontent.Value = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn form, nil\n}", "title": "" }, { "docid": "1220dc06b94fb94e30a6b6675eead63f", "score": "0.5760464", "text": "func parseYAML(r io.Reader, str interface{}) error {\n\treturn yaml.NewDecoder(r).Decode(str)\n}", "title": "" }, { "docid": "0b89787109ccae5b20e3b0d9d63dd48a", "score": "0.5669753", "text": "func parseYaml(yml []byte) ([]yamlStuff, error) {\n\tvar y []yamlStuff\n\n\t// Decodes the yaml into the array above\n\terr := yaml.Unmarshal(yml, &y)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn y, nil\n}", "title": "" }, { "docid": "638696e76a016d476aea431a5409f4a3", "score": "0.5664419", "text": "func UnmarsharlYaml(byteArray []byte) types.EngineConfig {\n\tvar cfg types.EngineConfig\n\tyaml.Unmarshal([]byte(byteArray), &cfg)\n\treturn cfg\n}", "title": "" }, { "docid": "40b460fa3b3c21fc38223d0ada8f090d", "score": "0.5623704", "text": "func fromYaml(b []byte, i interface{}) {\n\terr := yaml.Unmarshal(b, i)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "464a4433d16b7baae559a92d1ebf707b", "score": "0.56170577", "text": "func decodeYAML(input io.Reader, target interface{}) error {\n\tdata, err := ioutil.ReadAll(input)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn yaml.Unmarshal(data, target)\n}", "title": "" }, { "docid": "4a69f266e4cda9a53131d3d1f5f10888", "score": "0.560646", "text": "func ApplyYAML(yml string, pb proto.Message) error {\n\tjs, err := yaml.YAMLToJSON([]byte(yml))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ApplyJSON(string(js), pb)\n}", "title": "" }, { "docid": "74074841787d91becb1824f855e628d4", "score": "0.55918527", "text": "func TestValidateYAML(t *testing.T) {\n\tschema := newSchema(t)\n\tyamlBytes := []byte(`\nfirstName: John\nlastName: Doe\nage: 21`)\n\n\terr := schema.ValidateYAML(yamlBytes)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "0b653a6e5ccff93a32da81366cc52be8", "score": "0.5561036", "text": "func applyYAML(yml string, pb proto.Message) error {\n\tjs, err := yaml.YAMLToJSON([]byte(yml))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn applyJSON(string(js), pb)\n}", "title": "" }, { "docid": "e78e8ce194ab4ea8c4fd7be1ee21c163", "score": "0.5545954", "text": "func (this *App) UnmarshalYAML(unmarshal func(interface{}) error) (err error) {\n\n\t// First attempt: just treat value as a single string - that is executable w/o any\n\t// arguments\n\tvar line string\n\tif err = unmarshal(&line); err == nil {\n\n\t\t// Try to split string into executable and optional args...\n\t\tthis.Executable = strings.TrimSpace(line)\n\t\tthis.Args = []string{}\n\t\treturn err\n\t}\n\n\t// Attempt: treat as array value, first being the executable all others arguments\n\tvar array []string\n\tif err = unmarshal(&array); err == nil {\n\t\tthis.Executable = array[0]\n\t\tthis.Args = array[1:]\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "1da40fb1ee1ed5b11f056a6cbb82feff", "score": "0.55276453", "text": "func (s *MaporEqualSlice) UnmarshalYAML(tag string, value interface{}) error {\n\tswitch value := value.(type) {\n\tcase []interface{}:\n\t\tparts, err := toStrings(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.parts = parts\n\tcase map[interface{}]interface{}:\n\t\tparts, err := toSepMapParts(value, \"=\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.parts = parts\n\tdefault:\n\t\treturn fmt.Errorf(\"Failed to unmarshal MaporEqualSlice: %#v\", value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "38d75820834a728f7f6ef1d33032fd7f", "score": "0.5517937", "text": "func FromYAML(unmarshallable string) (interface{}, error) {\n\tlogrus.Debug(\"unmarshallable: \", unmarshallable)\n\tresult, err := yaml2.ToInterface(strings.NewReader(unmarshallable))\n\tlogrus.Debugf(\"result: %s (type: %s)\", result, reflect.TypeOf(result))\n\treturn result, err\n}", "title": "" }, { "docid": "ab8a24f38c6cf5823f83fc99ce1596b7", "score": "0.55094147", "text": "func TestYamlDecodeRegressions(t *testing.T) {\n\tt.Parallel()\n\n\tcleanupTerraformFolder(t, TEST_FIXTURE_REGRESSIONS)\n\ttmpEnvPath := copyEnvironment(t, TEST_FIXTURE_REGRESSIONS)\n\trootPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_REGRESSIONS, \"yamldecode\")\n\n\trunTerragrunt(t, fmt.Sprintf(\"terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s\", rootPath))\n\n\t// Check the output of yamldecode and make sure it doesn't parse the string incorrectly\n\tstdout := bytes.Buffer{}\n\tstderr := bytes.Buffer{}\n\n\trequire.NoError(\n\t\tt,\n\t\trunTerragruntCommand(t, fmt.Sprintf(\"terragrunt output -no-color -json --terragrunt-non-interactive --terragrunt-working-dir %s\", rootPath), &stdout, &stderr),\n\t)\n\n\toutputs := map[string]TerraformOutput{}\n\trequire.NoError(t, json.Unmarshal([]byte(stdout.String()), &outputs))\n\tassert.Equal(t, outputs[\"test1\"].Value, \"003\")\n\tassert.Equal(t, outputs[\"test2\"].Value, \"1.00\")\n\tassert.Equal(t, outputs[\"test3\"].Value, \"0ba\")\n}", "title": "" }, { "docid": "93e550ec0291cae99641a5adacbeff10", "score": "0.54957545", "text": "func TestUnmarshalYAML03(t *testing.T) {\n\tt.Parallel()\n\n\ttestFile, err := os.Open(\"testdata/config-0.3.yaml\")\n\tassert.NoError(t, err)\n\tunmarshaller := yaml.NewDecoder(testFile)\n\tunmarshaller.KnownFields(true)\n\t//goland:noinspection GoDeprecation\n\tconfig := docker.DockerRunConfig{}\n\tassert.NoError(t, unmarshaller.Decode(&config))\n\tassert.Equal(t, false, config.Config.DisableCommand)\n\tassert.Equal(t, \"/usr/lib/openssh/sftp-server\", config.Config.Subsystems[\"sftp\"])\n\tassert.Equal(t, 60*time.Second, config.Config.Timeout)\n}", "title": "" }, { "docid": "6c7f2b6ebd146edb22b67ae653659e7b", "score": "0.54944783", "text": "func ByteIsValidYaml(data []byte) bool {\n\treturn StringIsValidYaml(string(data))\n}", "title": "" }, { "docid": "06a521de60e42ff5a67546d7148e647d", "score": "0.54943043", "text": "func (s *PreBuildStep) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tprebuild := PreBuild{}\n\terr := unmarshal(&prebuild)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !IsPrebuildArray(prebuild) {\n\t\ts.parts = append(s.parts, prebuild)\n\t\treturn nil\n\t}\n\n\t// unmarshal the yaml into the generic\n\t// mapSlice type to preserve ordering.\n\tobj := yaml.MapSlice{}\n\tif err := unmarshal(&obj); err != nil {\n\t\treturn err\n\t}\n\n\t// unarmshals each item in the mapSlice,\n\t// unmarshal and append to the slice.\n\treturn unmarshalYaml(obj, func(key string, val []byte) error {\n\t\tprebuild := PreBuild{}\n\t\terr := yaml.Unmarshal(val, &prebuild)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.parts = append(s.parts, prebuild)\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "801b64dfe24e4fd81ad55daa121362f5", "score": "0.54936683", "text": "func parse(raw []byte, conf *Playbook) error {\n\treturn yaml.Unmarshal(raw, conf)\n}", "title": "" }, { "docid": "4aa5ac1098d6b409e2d405fa5d04150f", "score": "0.5490194", "text": "func (pss *parserStringSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar single string\n\tif err := unmarshal(&single); err == nil {\n\t\t*pss = []string{single}\n\t\treturn nil\n\t}\n\tvar slice []string\n\tif err := unmarshal(&slice); err != nil {\n\t\treturn err\n\t}\n\t*pss = slice\n\treturn nil\n}", "title": "" }, { "docid": "4bde53badc5f89e3ed832b36050652e8", "score": "0.5471693", "text": "func TestLoadYAML(t *testing.T) {\n\t// expects\n\taddress := \":2018\"\n\treadTimeout := 5 * time.Second\n\twriteTimeout := 5 * time.Second\n\tshutdownTimeout := 20 * time.Second\n\t//routes := 2\n\t//routeOnePath := \"/one\"\n\t// sut\n\tc, err := loadYAML(yamlContent)\n\t// assertions\n\tif err != nil {\n\t\tt.Fatalf(\"error: %v\", err)\n\t}\n\tif c.Address() != address {\n\t\tt.Fatalf(\"error parsing address: Expected: [%v], Returned: [%v]\\n\", address, c.Address())\n\t}\n\tif c.ReadTimeout() != readTimeout {\n\t\tt.Fatalf(\"error parsing read timeout: Expected: [%v], Returned: [%v]\\n\", readTimeout, c.ReadTimeout())\n\t}\n\tif c.WriteTimeout() != writeTimeout {\n\t\tt.Fatalf(\"error parsing read timeout: Expected: [%v], Returned: [%v]\\n\", writeTimeout, c.WriteTimeout())\n\t}\n\tif c.ShutdownTimeout() != shutdownTimeout {\n\t\tt.Fatalf(\"error parsing read timeout: Expected: [%v], Returned: [%v]\\n\", shutdownTimeout, c.ShutdownTimeout())\n\t}\n\t// TODO fix this assertions\n\t//if len(c.Routes()) != routes {\n\t//\tt.Fatalf(\"error parsing routes: Expected: [%v] routes, Returned: [%v] routes\\n\", routes, len(c.Routes))\n\t//}\n\t//if c.Routes()[0].Path != routeOnePath {\n\t//\tt.Fatalf(\"error parsing routes: Expected: [%v] routes, Returned: [%v] routes\\n\", routeOnePath, c.Routes[0].Path)\n\t//}\n}", "title": "" }, { "docid": "b8e65fe4da996be7cc9ed1c240a1d5de", "score": "0.54702216", "text": "func splitYAML(yamlData []byte) ([]*unstructured.Unstructured, error) {\n\t// Similar way to what kubectl does\n\t// https://github.com/kubernetes/cli-runtime/blob/master/pkg/resource/visitor.go#L573-L600\n\t// Ideally k8s.io/cli-runtime/pkg/resource.Builder should be used instead of this method.\n\t// E.g. Builder does list unpacking and flattening and this code does not.\n\td := kubeyaml.NewYAMLOrJSONDecoder(bytes.NewReader(yamlData), 4096)\n\tvar objs []*unstructured.Unstructured\n\tfor {\n\t\text := runtime.RawExtension{}\n\t\tif err := d.Decode(&ext); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn objs, fmt.Errorf(\"failed to unmarshal manifest: %v\", err)\n\t\t}\n\t\text.Raw = bytes.TrimSpace(ext.Raw)\n\t\tif len(ext.Raw) == 0 || bytes.Equal(ext.Raw, []byte(\"null\")) {\n\t\t\tcontinue\n\t\t}\n\t\tu := &unstructured.Unstructured{}\n\t\tif err := yaml.Unmarshal(ext.Raw, u); err != nil {\n\t\t\treturn objs, fmt.Errorf(\"failed to unmarshal manifest: %v\", err)\n\t\t}\n\t\tobjs = append(objs, u)\n\t}\n\treturn objs, nil\n}", "title": "" }, { "docid": "828e0b94beecce18d1002f2d143909c6", "score": "0.54620624", "text": "func (p *Pipeline) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t// inner struct for accepting map of strings\n\tvar pipeline []map[string]interface{}\n\n\tif err := unmarshal(&pipeline); err != nil {\n\t\treturn fmt.Errorf(\"base/pipeline: %s\", err)\n\t}\n\n\t// sequece successfully translated, create layers from data\n\tfor _, layer := range pipeline {\n\t\t// get required 'type' key\n\t\tswitch t := layer[\"type\"]; t {\n\t\tcase \"tcp\":\n\t\t\t*p = append(*p, NewTCPSocket(layer[\"address\"].(string)))\n\n\t\tcase \"process\":\n\t\t\t*p = append(*p, NewProcess(layer[\"cmd\"].(string)))\n\n\t\tcase \"plugin\":\n\t\t\t*p = append(*p, NewPlugin(layer[\"path\"].(string), layer[\"name\"].(string)))\n\n\t\tdefault:\n\t\t\treturn ErrUnknownLayer\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a4776b6fb77aa892b3af36743f3e5d7e", "score": "0.5459075", "text": "func IsYAML(b []byte) bool {\n\tvar yml map[string]interface{}\n\tret := yaml.Unmarshal(b, &yml)\n\treturn ret == nil\n}", "title": "" }, { "docid": "673ebcc25a1ba10ba86d1bb70d2fa4dd", "score": "0.54331714", "text": "func ParseYAML(content []byte) Suite {\n\tyamlConfig := YAMLConfig{}\n\n\terr := yaml.UnmarshalStrict(content, &yamlConfig)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\treturn YAMLSuite{\n\t\tTestCases: convertYAMLConfToTestCases(yamlConfig),\n\t\tConfig: runtime.TestConfig{\n\t\t\tEnv: yamlConfig.Config.Env,\n\t\t\tDir: yamlConfig.Config.Dir,\n\t\t\tTimeout: yamlConfig.Config.Timeout,\n\t\t\tRetries: yamlConfig.Config.Retries,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "32f4f3605fc070c4559ff888d066e765", "score": "0.54249316", "text": "func ParseYAML(r io.Reader, str interface{}) error {\n\treturn yaml.NewDecoder(r).Decode(str)\n}", "title": "" }, { "docid": "0aee44cb3ec46ddcf4f2550bcc1ac12f", "score": "0.5415039", "text": "func (s *MaporEqualSlice) UnmarshalYAML(tag string, value interface{}) error {\n\tparts, err := unmarshalToStringOrSepMapParts(value, \"=\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*s = parts\n\treturn nil\n}", "title": "" }, { "docid": "0aee44cb3ec46ddcf4f2550bcc1ac12f", "score": "0.5415039", "text": "func (s *MaporEqualSlice) UnmarshalYAML(tag string, value interface{}) error {\n\tparts, err := unmarshalToStringOrSepMapParts(value, \"=\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*s = parts\n\treturn nil\n}", "title": "" }, { "docid": "ad6a63393890699b9692788d4b5cb947", "score": "0.5357222", "text": "func parse(raw []byte, conf *Playbook) error {\n\treturn yaml.UnmarshalStrict(raw, conf)\n}", "title": "" }, { "docid": "5bc6d82b666f8a38e2f4ef80ad8cfd90", "score": "0.53472215", "text": "func FormYAMLFromBytes(def *ClientConfigDefault, bytes []byte, stateType, contextType string) (*types.FormYAML, error) {\n\tform, err := unqueriedFormYAMLFromBytes(bytes, contextType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlookup := formToLookupTable(def, form, stateType)\n\n\t// merge data from lookup\n\tdata := make(map[string]interface{})\n\n\tfor _, lookupVal := range lookup {\n\t\tif lookupVal != nil {\n\t\t\tqueryRes, err := lookupVal.TemplateReader.Read()\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor queryResKey, queryResVal := range queryRes {\n\t\t\t\tdata[queryResKey] = queryResVal\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i, tab := range form.Tabs {\n\t\tfor j, section := range tab.Sections {\n\t\t\tfor k, content := range section.Contents {\n\t\t\t\tkey := fmt.Sprintf(\"tabs[%d].sections[%d].contents[%d]\", i, j, k)\n\n\t\t\t\tif val, ok := data[key]; ok {\n\t\t\t\t\tcontent.Value = val\n\t\t\t\t}\n\n\t\t\t\tif content.Value == nil && content.Settings.Default != nil {\n\t\t\t\t\tcontent.Value = []interface{}{content.Settings.Default}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// if the client config defaults are Helm-related, this is a cluster-scoped resource\n\tif def.HelmAgent != nil || def.HelmChart != nil || def.HelmRelease != nil {\n\t\tform.IsClusterScoped = true\n\t}\n\n\treturn form, nil\n}", "title": "" }, { "docid": "dfaa91dad6fb56eeace61dc41525b842", "score": "0.53347653", "text": "func TestConfigModelFromYAMLBytesReferenceCycle(t *testing.T) {\n\tconfigStr := `\nformat_version: 1.3.0\ndefault_step_lib_source: \"https://github.com/bitrise-io/bitrise-steplib.git\"\n\nworkflows:\n before1:\n before_run:\n - before2\n\n before2:\n before_run:\n - before1\n\n target:\n before_run:\n - before1\n - before2\n `\n\t_, warnings, err := ConfigModelFromYAMLBytes([]byte(configStr))\n\trequire.Error(t, err)\n\trequire.Equal(t, 0, len(warnings))\n}", "title": "" }, { "docid": "c6462a8ac4291141d4294b2fc5379886", "score": "0.5318739", "text": "func (i *BooleanOperator) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\n\tvar err error\n\t*i, err = BooleanOperatorString(s)\n\treturn err\n}", "title": "" }, { "docid": "3045eab411e60f21b3c30d3708cf4f7b", "score": "0.53133684", "text": "func decodeWithYAML(types ...reflect.Type) mapstructure.DecodeHookFunc {\n\treturn func(f, t reflect.Type, data interface{}) (interface{}, error) {\n\t\tfor _, typ := range types {\n\t\t\tif t == typ {\n\t\t\t\tb, _ := yaml.Marshal(data)\n\t\t\t\tv := reflect.New(t)\n\t\t\t\treturn v.Interface(), yaml.Unmarshal(b, v.Interface())\n\t\t\t}\n\t\t}\n\t\treturn data, nil\n\t}\n}", "title": "" }, { "docid": "3045eab411e60f21b3c30d3708cf4f7b", "score": "0.53133684", "text": "func decodeWithYAML(types ...reflect.Type) mapstructure.DecodeHookFunc {\n\treturn func(f, t reflect.Type, data interface{}) (interface{}, error) {\n\t\tfor _, typ := range types {\n\t\t\tif t == typ {\n\t\t\t\tb, _ := yaml.Marshal(data)\n\t\t\t\tv := reflect.New(t)\n\t\t\t\treturn v.Interface(), yaml.Unmarshal(b, v.Interface())\n\t\t\t}\n\t\t}\n\t\treturn data, nil\n\t}\n}", "title": "" }, { "docid": "cc9bf0bac8747d5db2d1826e2e03ba02", "score": "0.53069365", "text": "func YAMLArray(in string) ([]interface{}, error) {\n\tobj := make([]interface{}, 1)\n\ts := strings.NewReader(in)\n\td := yaml.NewDecoder(s)\n\tfor {\n\t\terr := d.Decode(&obj)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif obj != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\terr := stringifyYAMLArrayMapKeys(obj)\n\treturn obj, err\n}", "title": "" }, { "docid": "6fc601152476fe05012426d7496380d8", "score": "0.53018385", "text": "func loadFromYaml[T any](file io.Reader) ([]T, error) {\n\tvar res []T\n\n\tbytes, err := io.ReadAll(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = yaml.Unmarshal(bytes, &res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "733b6986b20e0a7230d75e511c988807", "score": "0.53015155", "text": "func ParseYaml(input io.Reader) (interface{}, error) {\n\tvar result interface{}\n\tb, err := readFile(input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := yaml.Unmarshal(b, &result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "1af72431694cdacf3cb7c1b9c0dbeb52", "score": "0.5289506", "text": "func (a anchors) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\treturn nil\n}", "title": "" }, { "docid": "b1c8c6b0e273967f3d0bd9427aa371a7", "score": "0.52887166", "text": "func configFromYAML(rawYAML string) (c config.Config) {\n\trawYAML = dedent.Dedent(rawYAML)\n\tvar out interface{}\n\t_ = yaml.Unmarshal([]byte(rawYAML), &out)\n\t_ = c.DecodeYaml(out)\n\treturn\n}", "title": "" }, { "docid": "569d20e8342d3bcf7de133528a669f8c", "score": "0.52878314", "text": "func (a *PubKey) UnmarshalYAML(data []byte) error {\n\tvar s string\n\terr := yaml.Unmarshal(data, &s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*a = common.FromHex(s)\n\treturn nil\n}", "title": "" }, { "docid": "538ad8c970296594888dd10ea6bf3704", "score": "0.5278663", "text": "func (s *Stringorslice) UnmarshalYAML(tag string, value interface{}) error {\n\tswitch value := value.(type) {\n\tcase []interface{}:\n\t\tparts, err := toStrings(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.parts = parts\n\tcase string:\n\t\ts.parts = []string{value}\n\tdefault:\n\t\treturn fmt.Errorf(\"Failed to unmarshal Stringorslice: %#v\", value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bec1226af86e3511fdd0a74fe963e9a3", "score": "0.5273874", "text": "func (s *Command) UnmarshalYAML(tag string, value interface{}) error {\n\tswitch value := value.(type) {\n\tcase []interface{}:\n\t\tparts, err := toStrings(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.parts = parts\n\tcase string:\n\t\tparts, err := shlex.Split(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.parts = parts\n\tdefault:\n\t\treturn fmt.Errorf(\"Failed to unmarshal Command: %#v\", value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ecb72117ff8963d2c4232de1bb687c44", "score": "0.5262295", "text": "func (p *Parser) Parse(b []byte) (interface{}, error) {\n\tvar v interface{}\n\tif err := yaml.Unmarshal(b, &v); err != nil {\n\t\treturn nil, xerrors.Errorf(\"unmarshal yaml: %w\", err)\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "fbec9345e78aae973e339e76d311352e", "score": "0.52443427", "text": "func (p *Ptz) LoadFromYaml(data []byte) {\n\tyaml.Unmarshal(data, &p.c)\n\tfor i, f := range p.c.InputFormats {\n\t\tp.c.InputFormats[i] = goymd.GoStyle(f)\n\t}\n\tp.c.OutputFormat = goymd.GoStyle(p.c.OutputFormat)\n}", "title": "" }, { "docid": "d8cd75bad69311480c1aca735450dd33", "score": "0.5243747", "text": "func Parse(raw []byte, conf *Config) error {\n\terr := yaml.Unmarshal(raw, conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f373f35c02c4419a0df43beec7c9cc80", "score": "0.5242995", "text": "func Parse(raw []byte) (*Tree, error) {\n\tconf, err := yaml.Parse(raw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Load(conf)\n}", "title": "" }, { "docid": "c3172d30c501346841ea466ab56f43d9", "score": "0.5235088", "text": "func Parse(raw string, rules []RuleFunc) (*Tree, error) {\n\tconf, err := yaml.ParseString(raw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Load(conf, rules)\n}", "title": "" }, { "docid": "882c32518c758132a1a8bcc0c5abf552", "score": "0.5233561", "text": "func (s *Step) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tif err := unmarshal((*stepUnmarshaller)(s)); err != nil {\n\t\treturn err\n\t}\n\n\tp := protocol.Get(s.Protocol)\n\tif p == nil {\n\t\tif s.Request.bytes != nil || s.Expect.bytes != nil {\n\t\t\treturn errors.Errorf(\"unknown protocol: %s\", s.Protocol)\n\t\t}\n\t\treturn nil\n\t}\n\tif s.Request.bytes != nil {\n\t\tinvoker, err := p.UnmarshalRequest(s.Request.bytes)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.Request.Invoker = invoker\n\t}\n\tbuilder, err := p.UnmarshalExpect(s.Expect.bytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.Expect.AssertionBuilder = builder\n\n\treturn nil\n}", "title": "" }, { "docid": "016b6b5a42535ee027370af16e82a01b", "score": "0.52334344", "text": "func (v *Variable) UnmarshalYAML(value *yaml.Node) error {\n\tif err := v.StringOrFromCFN.UnmarshalYAML(value); err != nil {\n\t\treturn fmt.Errorf(`unmarshal \"variables\": %w`, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bc33c5fd63529ff419fe23cc700397d1", "score": "0.5227495", "text": "func (bot *EstafetteBot) UnmarshalYAML(unmarshal func(interface{}) error) (err error) {\n\n\tvar aux struct {\n\t\tName string `yaml:\"-\"`\n\t\tBuilder *EstafetteBuilder `yaml:\"builder\"`\n\t\tCloneRepository *bool `yaml:\"clone\"`\n\t\tTriggers []*EstafetteTrigger `yaml:\"triggers\"`\n\t\tStages yaml.MapSlice `yaml:\"stages\"`\n\t}\n\n\t// unmarshal to auxiliary type\n\tif err := unmarshal(&aux); err != nil {\n\t\treturn err\n\t}\n\n\t// map auxiliary properties\n\tbot.Name = aux.Name\n\tbot.Builder = aux.Builder\n\tbot.CloneRepository = aux.CloneRepository\n\tbot.Triggers = aux.Triggers\n\n\tfor _, mi := range aux.Stages {\n\n\t\tbytes, err := yaml.Marshal(mi.Value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar stage *EstafetteStage\n\t\tif err := yaml.Unmarshal(bytes, &stage); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif stage == nil {\n\t\t\tstage = &EstafetteStage{}\n\t\t}\n\n\t\tstage.Name = mi.Key.(string)\n\t\tbot.Stages = append(bot.Stages, stage)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e05280712b86b462ff3288eae7a63569", "score": "0.5226427", "text": "func (bc *BitCount) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar u64 uint64\n\tif unmarshal(&u64) == nil {\n\t\tAtomicStoreBitCount(bc, BitCount(u64))\n\n\t\treturn nil\n\t}\n\n\tvar s string\n\tif unmarshal(&s) == nil {\n\t\tv, err := ParseBitCount(s)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"%q: %w: %v\", s, ErrMalformedRepresentation, err)\n\t\t}\n\t\tAtomicStoreBitCount(bc, v)\n\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"%w: unexpected type\", ErrMalformedRepresentation)\n}", "title": "" }, { "docid": "33cea854c2cf082f36f8554b331ce8d3", "score": "0.5221309", "text": "func parseYAMLBlock(tokens *tokenizer.TokenStream, doc *Document) (state, error) {\n\trtokens := tokens.Raw()\n\tif len(doc.TestLines) == 0 {\n\t\treturn discardLine, parserError(\"found YAML with no parent test line\")\n\t}\n\ttestLine := &doc.TestLines[len(doc.TestLines)-1]\n\tif len(testLine.YAML) > 0 {\n\t\treturn discardLine, parserError(\"found YAML with no parent test line\")\n\t}\n\n\t// Expect the header to match /\\s+---/\n\theader := rtokens.ConcatUntil(tokenizer.TypeNewline)\n\tif len(header) < 4 || !strings.HasPrefix(strings.TrimSpace(header), \"---\") {\n\t\treturn discardLine, fmt.Errorf(\"expected line matching /^\\\\s+---/ but got %q\", header)\n\t}\n\tif err := rtokens.Eat(tokenizer.TypeNewline); err != nil {\n\t\treturn discardLine, unexpectedTokenError(\"a newline\", rtokens.Peek())\n\t}\n\n\tvar body string\n\tfor {\n\t\tline := rtokens.ConcatUntil(tokenizer.TypeNewline)\n\t\t// Expect the footer to match /\\s+.../\n\t\tif len(line) >= 4 && strings.HasPrefix(strings.TrimSpace(line), \"...\") {\n\t\t\tbreak\n\t\t}\n\n\t\tbody += strings.TrimSpace(line) + \"\\n\"\n\t\tif rtokens.Peek().Type == tokenizer.TypeEOF {\n\t\t\tbreak\n\t\t}\n\t\trtokens.Eat(tokenizer.TypeNewline)\n\t}\n\n\ttestLine.YAML = body\n\treturn parseNextLine, nil\n}", "title": "" }, { "docid": "80f356927037f94f081f642508c8a36c", "score": "0.52178097", "text": "func (aa *HeimdallHash) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\terr := unmarshal(&s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\n\t*aa = HexToHeimdallHash(s)\n\treturn nil\n}", "title": "" }, { "docid": "f72cf48d3902abff258c2408d5f227c5", "score": "0.52168447", "text": "func (pbvts *parserBVTaskUnits) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t// first, attempt to unmarshal just a selector string\n\tvar single parserBVTaskUnit\n\tif err := unmarshal(&single); err == nil {\n\t\t*pbvts = parserBVTaskUnits([]parserBVTaskUnit{single})\n\t\treturn nil\n\t}\n\tvar slice []parserBVTaskUnit\n\tif err := unmarshal(&slice); err != nil {\n\t\treturn err\n\t}\n\t*pbvts = parserBVTaskUnits(slice)\n\treturn nil\n}", "title": "" }, { "docid": "d23480f94ea04d71d397352628760cb0", "score": "0.52168167", "text": "func TestParseRandom(t *testing.T) {\n\trawYamlString := `---\njust: \"a\"\nrandom: \"string\"\n`\n\tp := newParser()\n\tresult, err := p.parseYaml([]byte(rawYamlString))\n\tassert.Nil(t, err)\n\tassert.Len(t, result, 0)\n}", "title": "" }, { "docid": "78bb4c6d100665cecbdf649615bea1fa", "score": "0.52107286", "text": "func loadYaml(dst interface{}, yamlPath string) error {\n\tvar (\n\t\terr error\n\t\tf *os.File\n\t\tdec *yaml.Decoder\n\t)\n\t// open yaml file\n\tif f, err = os.OpenFile(yamlPath, os.O_RDONLY, 0644); err != nil {\n\t\treturn err\n\t}\n\t//decode into our destination in strict mode\n\tdec = yaml.NewDecoder(f)\n\tdec.SetStrict(true)\n\tdefer f.Close()\n\tif err = dec.Decode(dst); err != nil {\n\t\treturn err\n\t}\n\tlog.Println(yamlPath, \"loaded from YAML\")\n\treturn nil\n}", "title": "" }, { "docid": "4d62ab3b9e65450c37689d0ff1aff95e", "score": "0.52065545", "text": "func (b *BytesSize) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar intType int64\n\tif err := unmarshal(&intType); err == nil {\n\t\t*b = BytesSize(intType)\n\t\treturn nil\n\t}\n\n\tvar stringType string\n\tif err := unmarshal(&stringType); err != nil {\n\t\treturn err\n\t}\n\n\tintType, err := units.RAMInBytes(stringType)\n\tif err == nil {\n\t\t*b = BytesSize(intType)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "8d693e2c8f4aeb8af9377e14020bab9c", "score": "0.520647", "text": "func (p *Probes) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar rawBool bool\n\terr := unmarshal(&rawBool)\n\tif err == nil {\n\t\tp.Liveness = rawBool\n\t\tp.Startup = rawBool\n\t\tp.Readiness = rawBool\n\t\treturn nil\n\t}\n\n\tvar healthCheckProbesRaw probesRaw\n\terr = unmarshal(&healthCheckProbesRaw)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.Liveness = healthCheckProbesRaw.Liveness\n\tp.Startup = healthCheckProbesRaw.Startup\n\tp.Readiness = healthCheckProbesRaw.Readiness\n\treturn nil\n}", "title": "" }, { "docid": "3068b29835a9f7da0f72e3c9e91fee69", "score": "0.5205664", "text": "func (pds *parserDependencies) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t// first check if we are handling a single dep that is not in an array.\n\tpd := parserDependency{}\n\tif err := unmarshal(&pd); err == nil {\n\t\t*pds = parserDependencies([]parserDependency{pd})\n\t\treturn nil\n\t}\n\tvar slice []parserDependency\n\tif err := unmarshal(&slice); err != nil {\n\t\treturn err\n\t}\n\t*pds = parserDependencies(slice)\n\treturn nil\n}", "title": "" }, { "docid": "851aa590acb476aaf68616bf98db0b79", "score": "0.5205419", "text": "func parseYaml(path string, yamlStr string, nms *[]*envoy_type_matcher_v3.NodeMatcher) error {\n\tif path != \"\" {\n\t\tdata, err := clientutil.ParseYamlFileToMap(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// parse each json object to proto\n\t\tfor _, n := range data[\"node_matchers\"].([]interface{}) {\n\t\t\tx := &envoy_type_matcher_v3.NodeMatcher{}\n\n\t\t\tjsonString, err := json.Marshal(n)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = protojson.Unmarshal(jsonString, x); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t*nms = append(*nms, x)\n\t\t}\n\t}\n\tif yamlStr != \"\" {\n\t\tdata, err := clientutil.ParseYamlStrToMap(yamlStr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// parse each json object to proto\n\t\tfor i, n := range data[\"node_matchers\"].([]interface{}) {\n\t\t\tx := &envoy_type_matcher_v3.NodeMatcher{}\n\n\t\t\tjsonString, err := json.Marshal(n)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = protojson.Unmarshal(jsonString, x); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// merge the proto with existing proto from request_file\n\t\t\tif i < len(*nms) {\n\t\t\t\tproto.Merge((*nms)[i], x)\n\t\t\t} else {\n\t\t\t\t*nms = append(*nms, x)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9710421b1f4ed16a91df53a0c579a7d7", "score": "0.5203304", "text": "func (e *errorBlockOrSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar blockType errorBlock\n\tif err := unmarshal(&blockType); err == nil {\n\t\t*e = errorBlockOrSlice{blockType}\n\t\treturn nil\n\t}\n\n\tvar sliceType []errorBlock\n\tif err := unmarshal(&sliceType); err == nil {\n\t\t*e = errorBlockOrSlice(sliceType)\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"Failed to unmarshal errorBlockOrSlice\")\n}", "title": "" }, { "docid": "e56a02586b183863d5f16a8470c5a0f3", "score": "0.51960284", "text": "func (p *YmlParser) Parse(data []byte, cfg interface{}) error {\n\treturn yaml.Unmarshal(data, cfg)\n}", "title": "" }, { "docid": "afc5e7fbb53d53cf0d6f655dd585f039", "score": "0.51937354", "text": "func ParseBytes(schema []byte) (rerr error) {\n\treset()\n\ts := string(schema)\n\n\tl := lex.NewLexer(s).Run(lexText)\n\n\tit := l.NewIterator()\n\tfor it.Next() {\n\t\titem := it.Item()\n\t\tif item.Typ == lex.ItemEOF {\n\t\t\tbreak\n\t\t}\n\t\tif item.Typ != itemText {\n\t\t\treturn x.Errorf(\"Expected text here but got: [%v] %v %v\", item.Val, item.Typ, lex.EOF)\n\t\t}\n\t\tswitch item.Val {\n\t\tcase \"scalar\":\n\t\t\tif rerr = processScalar(it); rerr != nil {\n\t\t\t\treturn rerr\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif rerr = processObject(it); rerr != nil {\n\t\t\t\treturn rerr\n\t\t\t}\n\t\tdefault:\n\t\t\treturn x.Errorf(\"Expected either 'scalar' or 'type' but got: %v\", item)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "98be02436aaab10cfdea8a46e8177199", "score": "0.51921535", "text": "func (s *Ports) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar stringType string\n\terr := unmarshal(&stringType)\n\tif err == nil {\n\t\ts.parts, err = shlex.Split(stringType)\n\t\treturn err\n\t}\n\n\tvar sliceType []string\n\terr = unmarshal(&sliceType)\n\tif err == nil {\n\t\ts.parts = sliceType\n\t\treturn nil\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "7307c6dae38da21523d6c1151aebe4ef", "score": "0.5191929", "text": "func Unmarshal(b []byte) (val dgo.Value, err error) {\n\tvar n y3.Node\n\tif err = y3.Unmarshal(b, &n); err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tif ye, ok := r.(yamlError); ok {\n\t\t\t\terr = ye.error\n\t\t\t} else {\n\t\t\t\tpanic(r)\n\t\t\t}\n\t\t}\n\t}()\n\tval = decodeValue(&n)\n\treturn\n}", "title": "" }, { "docid": "504fb12be692626454933f81dc008538", "score": "0.5185616", "text": "func FromYAML(file string, dist interface{}) error {\n\tfilename, _ := filepath.Abs(file)\n\n\tdata, err := ioutil.ReadFile(filename)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn yaml.Unmarshal(data, dist)\n}", "title": "" }, { "docid": "303498f30725d6d15f2339183681b954", "score": "0.51762676", "text": "func (at *AuditBench) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar res map[string]interface{}\n\tif err := unmarshal(&res); err != nil {\n\t\treturn err\n\t}\n\terr := mapstructure.Decode(res, &at)\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch at.CheckType {\n\tcase \"multi_param\":\n\t\tat.CmdExprBuilder = utils.UpdateCmdExprParam\n\t}\n\tat.CommandParams = make(map[int][]string)\n\tfor index, command := range at.AuditCommand {\n\t\tfindIndex(command, \"#\", index, at.CommandParams)\n\t}\n\tif at.TestType == common.NonApplicableTest || at.TestType == common.ManualTest {\n\t\tat.NonApplicable = true\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e49d314f3f3e73060f7fef300a6c15ee", "score": "0.51737744", "text": "func (s *SliceorMap) UnmarshalYAML(tag string, value interface{}) error {\n\tswitch value := value.(type) {\n\tcase map[interface{}]interface{}:\n\t\tparts := map[string]string{}\n\t\tfor k, v := range value {\n\t\t\tif sk, ok := k.(string); ok {\n\t\t\t\tif sv, ok := v.(string); ok {\n\t\t\t\t\tparts[sk] = sv\n\t\t\t\t} else {\n\t\t\t\t\treturn fmt.Errorf(\"Cannot unmarshal '%v' of type %T into a string value\", v, v)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Cannot unmarshal '%v' of type %T into a string value\", k, k)\n\t\t\t}\n\t\t}\n\t\ts.parts = parts\n\tcase []interface{}:\n\t\tparts := map[string]string{}\n\t\tfor _, s := range value {\n\t\t\tif str, ok := s.(string); ok {\n\t\t\t\tstr := strings.TrimSpace(str)\n\t\t\t\tkeyValueSlice := strings.SplitN(str, \"=\", 2)\n\n\t\t\t\tkey := keyValueSlice[0]\n\t\t\t\tval := \"\"\n\t\t\t\tif len(keyValueSlice) == 2 {\n\t\t\t\t\tval = keyValueSlice[1]\n\t\t\t\t}\n\t\t\t\tparts[key] = val\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Cannot unmarshal '%v' of type %T into a string value\", s, s)\n\t\t\t}\n\t\t}\n\t\ts.parts = parts\n\tdefault:\n\t\treturn fmt.Errorf(\"Failed to unmarshal SliceorMap: %#v\", value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e62f9479f1670f1d9c01b24c2a81793d", "score": "0.5173585", "text": "func YAML(stream io.Writer, body []byte) error {\n\tif len(body) == 0 {\n\t\treturn nil\n\t}\n\tdata := make(map[interface{}]interface{})\n\terr := yaml.Unmarshal(body, data)\n\tif err != nil {\n\t\treturn dumpBytes(stream, body)\n\t}\n\tif haveYQ(4) {\n\t\treturn dumpYQ(stream, body)\n\t}\n\n\treturn dumpYAML(stream, data)\n}", "title": "" }, { "docid": "055735913de98f81b2ae20a9f5f97752", "score": "0.51726", "text": "func (s *ConfigSuite) TestFromYAML(c *C) {\n\tdata := []byte(\"\" +\n\t\t\"proxies:\\n\" +\n\t\t\" bar:\\n\" +\n\t\t\" client_id: foo\\n\" +\n\t\t\" kafka:\\n\" +\n\t\t\" seed_peers:\\n\" +\n\t\t\" - 192.168.19.2:9092\\n\" +\n\t\t\" - 192.168.19.3:9092\\n\" +\n\t\t\" consumer:\\n\" +\n\t\t\" long_polling_timeout: 5s\\n\")\n\n\t// When\n\tappCfg, err := FromYAML(data)\n\n\t// Then\n\tc.Assert(err, IsNil)\n\n\texpected := DefaultApp(\"bar\")\n\texpected.Proxies[\"bar\"].ClientID = \"foo\"\n\texpected.Proxies[\"bar\"].Kafka.SeedPeers = []string{\"192.168.19.2:9092\", \"192.168.19.3:9092\"}\n\texpected.Proxies[\"bar\"].Consumer.LongPollingTimeout = 5 * time.Second\n\tc.Assert(appCfg, DeepEquals, expected)\n}", "title": "" }, { "docid": "5372daa2af6350b29bfb46911f6f944a", "score": "0.51712084", "text": "func (e *ExecuteCommand) UnmarshalYAML(value *yaml.Node) error {\n\tif err := value.Decode(&e.Config); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *yaml.TypeError:\n\t\t\tbreak\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !e.Config.IsEmpty() {\n\t\treturn nil\n\t}\n\n\tif err := value.Decode(&e.Enable); err != nil {\n\t\treturn errUnmarshalExec\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe4a1694615dca6d28c569803c8a401e", "score": "0.5170042", "text": "func (s *Command) UnmarshalYAML(tag string, value interface{}) error {\n\tswitch value := value.(type) {\n\tcase []interface{}:\n\t\tparts, err := toStrings(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*s = parts\n\tcase string:\n\t\tparts, err := shlex.Split(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*s = parts\n\tdefault:\n\t\treturn fmt.Errorf(\"Failed to unmarshal Command: %#v\", value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c818361ebf6ed679b109d01093aa225", "score": "0.5169879", "text": "func parseYaml(path string, cfg *Config) (err error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif e := file.Close(); e != nil {\n\t\t\terr = e\n\t\t}\n\t}()\n\tdecoder := yaml.NewDecoder(file)\n\tif err := decoder.Decode(cfg); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "36c93d8bd320a3107f5a629803b1aa18", "score": "0.51689976", "text": "func (s *BuildStep) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tbuild := Build{}\n\terr := unmarshal(&build)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !IsBuildArray(build) {\n\t\ts.parts = append(s.parts, build)\n\t\treturn nil\n\t}\n\n\t// unmarshal the yaml into the generic\n\t// mapSlice type to preserve ordering.\n\tobj := yaml.MapSlice{}\n\tif err := unmarshal(&obj); err != nil {\n\t\treturn err\n\t}\n\n\t// unarmshals each item in the mapSlice,\n\t// unmarshal and append to the slice.\n\treturn unmarshalYaml(obj, func(key string, val []byte) error {\n\t\tbuild := Build{}\n\t\terr := yaml.Unmarshal(val, &build)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.parts = append(s.parts, build)\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "298e15ccd250cb075de069cf7d238dec", "score": "0.5149777", "text": "func (i *IntegrationStep) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tslice := yaml.MapSlice{}\n\tif err := unmarshal(&slice); err != nil {\n\t\treturn err\n\t}\n\n\t// Ugly code. I don't know how to parse the yaml elegantly. It should parse the\n\t// yaml just like a compiler's parser.\n\tvar sliceWithoutService = slice\n\tfor index, v := range slice {\n\t\tif v.Key == \"services\" {\n\t\t\t// Parse the services block.\n\t\t\tyml, err := yaml.Marshal(&v.Value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tservicesBuf := yaml.MapSlice{}\n\t\t\tservices := Containerslice{}\n\t\t\tif err := yaml.Unmarshal(yml, &servicesBuf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, service := range servicesBuf {\n\t\t\t\tyml, err := yaml.Marshal(&service.Value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tctr := Container{}\n\t\t\t\tif err := yaml.Unmarshal(yml, &ctr); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tctr.Name = service.Key.(string)\n\t\t\t\tif len(ctr.Image) == 0 {\n\t\t\t\t\tctr.Image = service.Key.(string)\n\t\t\t\t}\n\t\t\t\tservices.parts = append(services.parts, ctr)\n\t\t\t}\n\t\t\ti.services = services\n\n\t\t\t// Remove the services block from slice.\n\t\t\t// Notice: The services block must be the first block.\n\t\t\tsliceWithoutService = slice[index+1:]\n\t\t}\n\t}\n\n\t// Parse the build block.\n\tyml, err := yaml.Marshal(sliceWithoutService)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuild := Build{}\n\tif err := yaml.Unmarshal(yml, &build); err != nil {\n\t\treturn err\n\t}\n\ti.build = build\n\treturn nil\n}", "title": "" }, { "docid": "2835df01f6d18527b53216fef5878fa2", "score": "0.51445913", "text": "func (file *EnvironmentsFile) fromYaml(bytes []byte) *EnvironmentsFile {\n\tif file.Err() != nil {\n\t\treturn file\n\t}\n\n\tfile.err = yaml.Unmarshal(bytes, &file)\n\n\treturn file\n}", "title": "" }, { "docid": "50a147d79ae045a2e5bd1d9713e6d120", "score": "0.51408416", "text": "func (p *ValueAssignment) unmarshalYAML(unmarshal func(interface{}) error) error {\n\t// Value assignment could be:\n\t// - a List\n\t// - a TOSCA function\n\t// - a map or complex type\n\t// - a literal value\n\n\t// First try with a List\n\tvar l []interface{}\n\tif err := unmarshal(&l); err == nil {\n\t\tl := cleanUpInterfaceArray(l)\n\t\tp.Value = l\n\t\tp.Type = ValueAssignmentList\n\t\treturn nil\n\t}\n\t// Not a List try a TOSCA function\n\tf := &Function{}\n\tif err := unmarshal(f); err == nil && IsOperator(string(f.Operator)) {\n\t\t// function are stored in string representation\n\t\tp.Value = f.String()\n\t\tp.Type = ValueAssignmentFunction\n\t\treturn nil\n\t}\n\n\t// Not a List nor a TOSCA function, let's try a map or complex type\n\tvar tmp map[interface{}]interface{}\n\tif err := unmarshal(&tmp); err == nil {\n\t\t// for nested map, we need to cast map[interface{}]interface{} to map[string]interface{} as JSON doesn't accept map[interface{}]interface{}\n\t\tm := cleanUpInterfaceMap(tmp)\n\t\tp.Value = m\n\t\tp.Type = ValueAssignmentMap\n\t\treturn nil\n\t}\n\n\t// JSON map unmarshaling expects a map[string]interface{}\n\tvar strMap map[string]interface{}\n\tif err := unmarshal(&strMap); err != nil {\n\t\treturn err\n\t}\n\n\tp.Value = strMap\n\tp.Type = ValueAssignmentMap\n\treturn nil\n}", "title": "" }, { "docid": "cd491939d6665e6dbc0264a4615bd4b5", "score": "0.514006", "text": "func YamlParse(r io.Reader) (node YamlNode, err error) {\n lb := &lineBuffer{\n Reader: bufio.NewReader(r),\n }\n\n defer func() {\n if r := recover(); r != nil {\n switch r := r.(type) {\n case error:\n err = r\n case string:\n err = errors.New(r)\n default:\n err = fmt.Errorf(\"%v\", r)\n }\n }\n }()\n\n node = parseNode(lb, 0, nil)\n return\n}", "title": "" }, { "docid": "b700f7e9c2aa296d2ae3ff9c4c592276", "score": "0.5139961", "text": "func (e *Entrypoint) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar multi []string\n\terr := unmarshal(&multi)\n\tif err != nil {\n\t\tvar single string\n\t\terr := unmarshal(&single)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif strings.Contains(single, \" && \") {\n\t\t\te.Values = []string{\"sh\", \"-c\", single}\n\t\t} else {\n\t\t\te.Values, err = shellquote.Split(single)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t} else {\n\t\te.Values = multi\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4eb30aebfbc942749374ea14d766f376", "score": "0.5130154", "text": "func (s *Stringorslice) UnmarshalYAML(tag string, value interface{}) error {\n\tswitch value := value.(type) {\n\tcase []interface{}:\n\t\tparts, err := toStrings(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*s = parts\n\tcase string:\n\t\t*s = []string{value}\n\tdefault:\n\t\treturn fmt.Errorf(\"Failed to unmarshal Stringorslice: %#v\", value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4eb30aebfbc942749374ea14d766f376", "score": "0.5130154", "text": "func (s *Stringorslice) UnmarshalYAML(tag string, value interface{}) error {\n\tswitch value := value.(type) {\n\tcase []interface{}:\n\t\tparts, err := toStrings(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*s = parts\n\tcase string:\n\t\t*s = []string{value}\n\tdefault:\n\t\treturn fmt.Errorf(\"Failed to unmarshal Stringorslice: %#v\", value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "13d9f05621f6cb1c8e6fc9daa7387fc7", "score": "0.51274306", "text": "func (s *MapEqualSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\terr := unmarshal(&s.parts)\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tvar mapType map[string]string\n\n\terr = unmarshal(&mapType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor k, v := range mapType {\n\t\ts.parts = append(s.parts, strings.Join([]string{k, v}, \"=\"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e08f3cae53e23c62b4cff1f5f31f29b7", "score": "0.51257634", "text": "func (s *MaporSpaceSlice) UnmarshalYAML(tag string, value interface{}) error {\n\tswitch value := value.(type) {\n\tcase []interface{}:\n\t\tparts, err := toStrings(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.parts = parts\n\tcase map[interface{}]interface{}:\n\t\tparts, err := toSepMapParts(value, \" \")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.parts = parts\n\tdefault:\n\t\treturn fmt.Errorf(\"Failed to unmarshal MaporSpaceSlice: %#v\", value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8532ce4b67f9ed22640eca1c2d85b91e", "score": "0.5124403", "text": "func (runsOn *RunsOn) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\n\tvar runsOnSingle string\n\tvar runsOnArray []string\n\tif err := unmarshal(&runsOnSingle); err == nil {\n\t\t*runsOn = RunsOn{runsOnSingle}\n\t} else if err := unmarshal(&runsOnArray); err == nil {\n\t\t*runsOn = runsOnArray\n\t} else {\n\t\treturn errors.New(\"Unable to deserialize \\\"runs-on\\\"\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a00ffdfafab328ba2c972a591f91a929", "score": "0.51200676", "text": "func (s *DockerStep) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t// Turn the yaml into a raw map so we can iterate over the values and\n\t// look for which command was used\n\tstepMap := map[string]map[string]interface{}{}\n\terr := unmarshal(&stepMap)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not unmarshal yaml into a raw docker command\")\n\t}\n\n\t// get at the values defined under \"docker\"\n\tdockerStep := stepMap[\"docker\"]\n\n\t// Turn each command into its typed data structure\n\tfor key, value := range dockerStep {\n\t\tvar cmd DockerCommand\n\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\ts.Description = value.(string)\n\t\t\tcontinue\n\t\tcase \"build\":\n\t\t\tcmd = &BuildCommand{}\n\t\tcase \"pull\":\n\t\t\tcmd = &PullCommand{}\n\t\tcase \"push\":\n\t\t\tcmd = &PushCommand{}\n\t\tcase \"login\":\n\t\t\tcmd = &LoginCommand{}\n\t\tcase \"run\":\n\t\t\tcmd = &RunCommand{}\n\t\tcase \"remove\":\n\t\t\tcmd = &RemoveCommand{}\n\t\tdefault:\n\t\t\treturn errors.Errorf(\"unsupported docker mixin command %s\", key)\n\t\t}\n\n\t\tb, err := yaml.Marshal(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = yaml.Unmarshal(b, cmd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ts.DockerCommand = cmd\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0603b5ef89089b4d9b4e2891ee126e98", "score": "0.51029915", "text": "func ParseYAML(rawjson string) (Data, error) {\n\tjsonbytes, err := yaml.YAMLToJSON([]byte(rawjson))\n\tif err != nil {\n\t\treturn Data{}, err\n\t}\n\treturn ParseJSON(string(jsonbytes))\n}", "title": "" }, { "docid": "59ff5466d7c31b73841b97286d140996", "score": "0.5092434", "text": "func (s *SliceorMap) UnmarshalYAML(tag string, value interface{}) error {\n\tswitch value := value.(type) {\n\tcase map[interface{}]interface{}:\n\t\tparts := map[string]string{}\n\t\tfor k, v := range value {\n\t\t\tif sk, ok := k.(string); ok {\n\t\t\t\tif sv, ok := v.(string); ok {\n\t\t\t\t\tparts[sk] = sv\n\t\t\t\t} else {\n\t\t\t\t\treturn fmt.Errorf(\"Cannot unmarshal '%v' of type %T into a string value\", v, v)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Cannot unmarshal '%v' of type %T into a string value\", k, k)\n\t\t\t}\n\t\t}\n\t\t*s = parts\n\tcase []interface{}:\n\t\tparts := map[string]string{}\n\t\tfor _, s := range value {\n\t\t\tif str, ok := s.(string); ok {\n\t\t\t\tstr := strings.TrimSpace(str)\n\t\t\t\tkeyValueSlice := strings.SplitN(str, \"=\", 2)\n\n\t\t\t\tkey := keyValueSlice[0]\n\t\t\t\tval := \"\"\n\t\t\t\tif len(keyValueSlice) == 2 {\n\t\t\t\t\tval = keyValueSlice[1]\n\t\t\t\t}\n\t\t\t\tparts[key] = val\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Cannot unmarshal '%v' of type %T into a string value\", s, s)\n\t\t\t}\n\t\t}\n\t\t*s = parts\n\tdefault:\n\t\treturn fmt.Errorf(\"Failed to unmarshal SliceorMap: %#v\", value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59ff5466d7c31b73841b97286d140996", "score": "0.5092434", "text": "func (s *SliceorMap) UnmarshalYAML(tag string, value interface{}) error {\n\tswitch value := value.(type) {\n\tcase map[interface{}]interface{}:\n\t\tparts := map[string]string{}\n\t\tfor k, v := range value {\n\t\t\tif sk, ok := k.(string); ok {\n\t\t\t\tif sv, ok := v.(string); ok {\n\t\t\t\t\tparts[sk] = sv\n\t\t\t\t} else {\n\t\t\t\t\treturn fmt.Errorf(\"Cannot unmarshal '%v' of type %T into a string value\", v, v)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Cannot unmarshal '%v' of type %T into a string value\", k, k)\n\t\t\t}\n\t\t}\n\t\t*s = parts\n\tcase []interface{}:\n\t\tparts := map[string]string{}\n\t\tfor _, s := range value {\n\t\t\tif str, ok := s.(string); ok {\n\t\t\t\tstr := strings.TrimSpace(str)\n\t\t\t\tkeyValueSlice := strings.SplitN(str, \"=\", 2)\n\n\t\t\t\tkey := keyValueSlice[0]\n\t\t\t\tval := \"\"\n\t\t\t\tif len(keyValueSlice) == 2 {\n\t\t\t\t\tval = keyValueSlice[1]\n\t\t\t\t}\n\t\t\t\tparts[key] = val\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Cannot unmarshal '%v' of type %T into a string value\", s, s)\n\t\t\t}\n\t\t}\n\t\t*s = parts\n\tdefault:\n\t\treturn fmt.Errorf(\"Failed to unmarshal SliceorMap: %#v\", value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4495a2406559ddac1e322007e82ba4d4", "score": "0.50918204", "text": "func (c *KubeRunPodConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tnode := map[string]yaml.Node{}\n\tif err := unmarshal(&node); err != nil {\n\t\treturn err\n\t}\n\tdata, err := yaml.Marshal(node)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := k8sYaml.Unmarshal(data, c); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fbd53c183c1fbdc06d2e0378ef558db7", "score": "0.50905937", "text": "func (dc *DockerCompose) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\n\t//unmarshal into dockerComposeVersion to detect version\n\tvar v dockerComposeVersion\n\terr := unmarshal(&v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//convert version to a number\n\tversion, err := strconv.ParseFloat(v.Version, 32)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//unmarshal into a 3.7 compatible version\n\tdc.Version = \"3.7\"\n\n\t// config command for >= v3.2 will always return the long port syntax\n\tif version < 3.2 {\n\n\t\t//unmarshal to short port syntax format\n\t\tvar short dockerComposeShortPortSyntax\n\t\terr := unmarshal(&short)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t//copy data\n\t\tdc.Services = make(map[string]*Service, len(short.Services))\n\t\tfor s, svc := range short.Services {\n\n\t\t\t//convert ports\n\t\t\tports := []Port{}\n\t\t\tfor _, p := range svc.Ports {\n\t\t\t\tportString := strings.Split(p, \":\")\n\t\t\t\tpublished, err := strconv.ParseInt(portString[0], 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttarget, err := strconv.ParseInt(strings.Split(portString[1], \"/\")[0], 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tports = append(ports, Port{\n\t\t\t\t\tPublished: published,\n\t\t\t\t\tTarget: target,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tdc.Services[s] = &Service{\n\t\t\t\tImage: svc.Image,\n\t\t\t\tEnvironment: svc.Environment,\n\t\t\t\tSecrets: svc.Secrets,\n\t\t\t\tLabels: svc.Labels,\n\t\t\t\tPorts: ports,\n\t\t\t}\n\t\t}\n\t} else { //long port syntax\n\t\tvar long dockerComposeLongPortSyntax\n\t\terr := unmarshal(&long)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\n\t\t//copy data\n\t\tdc.Services = make(map[string]*Service, len(long.Services))\n\t\tfor s, svc := range long.Services {\n\t\t\tdc.Services[s] = &Service{\n\t\t\t\tImage: svc.Image,\n\t\t\t\tEnvironment: svc.Environment,\n\t\t\t\tSecrets: svc.Secrets,\n\t\t\t\tLabels: svc.Labels,\n\t\t\t\tPorts: svc.Ports,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" } ]
61cd3749ea84cef2e3f3ee20db564a6c
resourceCommandRead retrieves command information from terraform stores.
[ { "docid": "94e81347f57157abeebfb2f90d9c6d4a", "score": "0.76500666", "text": "func resourceCommandRead(d *schema.ResourceData, m interface{}) error {\n\tclient := m.(*pkg.KrokClient)\n\tcid, err := strconv.Atoi(d.Id())\n\tif err != nil {\n\t\treturn err\n\t}\n\tcommand, err := client.CommandClient.Get(cid)\n\tif err != nil {\n\t\tlog.Println(\"Failed to find command\")\n\t\td.SetId(\"\")\n\t\treturn err\n\t}\n\n\tfor k, v := range flattenCommand(command) {\n\t\tif err := d.Set(k, v); err != nil {\n\t\t\td.SetId(\"\")\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "b5a476e06151e4f65fcac113f84ad786", "score": "0.66820675", "text": "func resourceCommandSettingRead(d *schema.ResourceData, m interface{}) error {\n\tclient := m.(*pkg.KrokClient)\n\tsid, err := strconv.Atoi(d.Id())\n\tif err != nil {\n\t\treturn err\n\t}\n\tsetting, err := client.SettingsClient.Get(sid)\n\tif err != nil {\n\t\tlog.Println(\"Failed to find command setting\")\n\t\td.SetId(\"\")\n\t\treturn err\n\t}\n\n\tfor k, v := range flattenCommandSetting(setting) {\n\t\tif err := d.Set(k, v); err != nil {\n\t\t\td.SetId(\"\")\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e4a0cdc59bf8feb058bb47c277a7aca0", "score": "0.5953048", "text": "func Resource() *cobra.Command {\n\treturn resource\n}", "title": "" }, { "docid": "b2de8d002694c1c2d574e96a3169a38d", "score": "0.58852226", "text": "func (rc *ResourcesContract) Read(ctx contractapi.TransactionContextInterface, key string) (string, error) {\n\texisting, err := ctx.GetStub().GetState(key)\n\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Unable to interact with world state\")\n\t}\n\n\tif existing == nil {\n\t\treturn \"\", fmt.Errorf(\"Cannot read world state pair with key %s. Does not exist\", key)\n\t}\n\n\treturn string(existing), nil\n}", "title": "" }, { "docid": "21abf14eee635b963e92ff8cc5698d94", "score": "0.5793432", "text": "func getCommand(r *resource.Resource) string {\n\tvar m map[string]interface{}\n\tvar c []interface{}\n\tm, _ = r.Map()[\"spec\"].(map[string]interface{})\n\tm, _ = m[\"template\"].(map[string]interface{})\n\tm, _ = m[\"spec\"].(map[string]interface{})\n\tc, _ = m[\"containers\"].([]interface{})\n\tm, _ = c[0].(map[string]interface{})\n\n\tcmd, _ := m[\"command\"].([]interface{})\n\tn := make([]string, len(cmd))\n\tfor i, v := range cmd {\n\t\tn[i] = v.(string)\n\t}\n\treturn strings.Join(n, \" \")\n}", "title": "" }, { "docid": "76322e96958a7bed9da77fbdd5113d44", "score": "0.5753145", "text": "func (s *store) Read(ctx context.Context, path string, config json.RawMessage) (string, bool, error) {\n\tc, err := s.parseConfig(config)\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"parse config: %w\", err)\n\t}\n\ttoken, err := s.app.CreateInstallationToken(ctx, c.owner, []string{c.repository}, nil)\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"create secrets access token: %w\", err)\n\t}\n\tsecret, _, err := s.actionsClientFactory(token.GetToken()).GetRepoSecret(\n\t\tctx,\n\t\tc.owner,\n\t\tc.repository,\n\t\tpath,\n\t)\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"get secret: %w\", err)\n\t}\n\treturn secret.Name, true, nil\n}", "title": "" }, { "docid": "88297f15ca914464dd9cf4c1ea7ff7d7", "score": "0.57049745", "text": "func (s *stream) readCommand() (dota.EDemoCommands, error) {\n\tc, err := s.readVarUint32()\n\treturn dota.EDemoCommands(c), err\n}", "title": "" }, { "docid": "91f120d96fe6c68e5c8315cb0f9e93b3", "score": "0.56994474", "text": "func resourceRead(d *schema.ResourceData, m interface{}) error {\t\n\t\n\t return nil\n}", "title": "" }, { "docid": "cb08ff55f02a876bf4588f723573b14e", "score": "0.56828964", "text": "func (conn *Conn) ReadCommand() (string, error) {\n\tbuffer, _, err := conn.reader.ReadLine()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.TrimSpace(string(buffer)), nil\n}", "title": "" }, { "docid": "0ed9e867a9ae9c41567926d33cb0695d", "score": "0.5649275", "text": "func resourceCommandUpdate(d *schema.ResourceData, m interface{}) error {\n\tclient := m.(*pkg.KrokClient)\n\tcid, err := strconv.Atoi(d.Id())\n\tif err != nil {\n\t\treturn err\n\t}\n\tcommand, err := client.CommandClient.Get(cid)\n\tif err != nil {\n\t\tlog.Println(\"Failed to find command\")\n\t\td.SetId(\"\")\n\t\treturn err\n\t}\n\n\tif d.HasChange(commandResourceNameFieldName) {\n\t\tcommand.Name = d.Get(commandResourceNameFieldName).(string)\n\t}\n\n\tif d.HasChange(commandResourceScheduleFieldName) {\n\t\tcommand.Schedule = d.Get(commandResourceScheduleFieldName).(string)\n\t}\n\n\tif res, err := client.CommandClient.Update(command); err != nil {\n\t\tlog.Println(\"Failed to update command\")\n\t\treturn fmt.Errorf(\"failed to update command: %w\", err)\n\t} else {\n\t\td.SetId(strconv.Itoa(res.ID))\n\t}\n\treturn resourceCommandRead(d, m)\n}", "title": "" }, { "docid": "94f98c749f98a02474361c93db1dd980", "score": "0.56069446", "text": "func expandCommandResource(d *schema.ResourceData) (*models.Command, error) {\n\tvar (\n\t\tname string\n\t\timage string\n\t\tschedule string\n\t\tenabled bool\n\t)\n\tif v, ok := d.GetOk(commandResourceNameFieldName); ok {\n\t\tname = v.(string)\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unable to find or parse field %s\", commandResourceNameFieldName)\n\t}\n\tif v, ok := d.GetOk(commandResourceImageFieldName); ok {\n\t\timage = v.(string)\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unable to find or parse field %s\", commandResourceImageFieldName)\n\t}\n\tif v, ok := d.GetOk(commandResourceEnabledFieldName); ok {\n\t\tenabled = v.(bool)\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unable to find or parse field %s\", commandResourceEnabledFieldName)\n\t}\n\tif v, ok := d.GetOk(commandResourceScheduleFieldName); ok {\n\t\tschedule = v.(string)\n\t}\n\tcommand := &models.Command{\n\t\tName: name,\n\t\tImage: image,\n\t\tSchedule: schedule,\n\t\tEnabled: enabled,\n\t}\n\treturn command, nil\n}", "title": "" }, { "docid": "261e902cf8e44f1d742a56c2cccdea60", "score": "0.5601391", "text": "func (rm *queryResmon) ReadResource(ctx context.Context,\n\treq *pulumirpc.ReadResourceRequest) (*pulumirpc.ReadResourceResponse, error) {\n\n\treturn nil, fmt.Errorf(\"Query mode does not support reading resources\")\n}", "title": "" }, { "docid": "62650ab741e0f4010e98dcee24c2e752", "score": "0.5558446", "text": "func (c *ClientConn) ReadCommand() (resp.Command, error) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tresponse, err := c.readObject()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch obj := response.(type) {\n\tcase resp.Array:\n\t\treturn resp.Command(obj), nil\n\tdefault:\n\t\treturn nil, ErrInvalidCommandFormat\n\t}\n}", "title": "" }, { "docid": "80e1fc7f670adcf1c401fc4562394e04", "score": "0.5556243", "text": "func (c *VaultClientLogical) Read(path string) (*api.Secret, error) {\n\treturn c.Result, c.ResultError\n}", "title": "" }, { "docid": "3d7a0f891d1f99eb2de8cdd862471ca1", "score": "0.55538034", "text": "func describeResourceCmd() *cobra.Command {\n\tcmd := builder.BuildCobraCommand(&resources.Describe{})\n\tcmd.Use = \"resource NAME\" //nolint:goconst\n\tcmd.Short = \"Describe resource\"\n\n\tif global.DeprecateV1Commands() {\n\t\tcmd.Deprecated = \"use `resource describe` instead\"\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "66b0773098f0fdef62b50f6bdd9d3f8d", "score": "0.54830116", "text": "func GetCommand(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *CommandState, opts ...pulumi.ResourceOption) (*Command, error) {\n\tvar resource Command\n\terr := ctx.ReadResource(\"f5bigip:index/command:Command\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "497061c26e80772a267c17293d709397", "score": "0.54661167", "text": "func (p *CLIFlagProvider) ReadBytes() ([]byte, error) {\n\treturn nil, errors.New(\"cli flag provider does not support this method\")\n}", "title": "" }, { "docid": "58a11a898250560b3aef7ad4a86f492f", "score": "0.5411224", "text": "func GetCommand(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *CommandState, opts ...pulumi.ResourceOption) (*Command, error) {\n\tvar resource Command\n\terr := ctx.ReadResource(\"command:v1:Command\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "9156fbaa6201f070168742fb1867cbd7", "score": "0.5292949", "text": "func (p *ConnPool) GetResourceDetails(key string) (string, *errors.Error) {\n\treadConn := p.ReadPool.Get()\n\tdefer readConn.Close()\n\tkeys, err := readConn.Do(\"KEYS\", \"*\"+key)\n\tif err != nil {\n\t\tif errs, aye := isDbConnectError(err); aye {\n\t\t\tlog.Error(\"Error while getting resource datails : \" + errs.Error())\n\t\t\treturn \"\", errs\n\t\t}\n\t\treturn \"\", errors.PackError(errors.UndefinedErrorType, errorCollectingData, err)\n\t}\n\tvar dkey string\n\t// keys array always 1\n\tfor _, data := range keys.([]interface{}) {\n\t\tdkey = string(data.([]uint8))\n\t}\n\tif dkey == \"\" {\n\t\treturn \"\", errors.PackError(errors.DBKeyNotFound, \"no data with the with key \", key, \" found\")\n\t}\n\n\tparams := strings.SplitN(dkey, \":\", 2)\n\treturn p.Read(params[0], params[1])\n}", "title": "" }, { "docid": "e8800d5613fe69c9231d5080b4c71821", "score": "0.5292321", "text": "func (s *Commander) Terraform(args ...string) (*CmdOutput, error) {\n\n\tvar stdoutBuf bytes.Buffer\n\tvar stderrBuf bytes.Buffer\n\tvar exitCode int\n\tvar err error\n\n\tcontextLogger := log.WithFields(log.Fields{\n\t\t\"err\": err,\n\t\t\"stdout\": stdoutBuf.String(),\n\t\t\"stderr\": stderrBuf.String(),\n\t\t\"dir\": s.cmdDir,\n\t})\n\n\tcmd := exec.Command(\"terraform\", args...)\n\n\tif s.cmdDir != \"\" {\n\t\tcmd.Dir = s.cmdDir\n\t}\n\n\tif s.cmdEnv != nil {\n\t\tcmd.Env = s.cmdEnv\n\t}\n\n\tcmd.Stdout = &stdoutBuf\n\tcmd.Stderr = &stderrBuf\n\n\terr = cmd.Run()\n\tif err != nil {\n\t\tif exitError, ok := err.(*exec.ExitError); ok {\n\t\t\tws := exitError.Sys().(syscall.WaitStatus)\n\t\t\texitCode = ws.ExitStatus()\n\t\t}\n\t\tcontextLogger.Error(\"cmd.Run() failed with:\")\n\t\tcontextLogger.Error(cmd.Stderr)\n\n\t\tcmdOutput := CmdOutput{\n\t\t\tStdout: stdoutBuf.String(),\n\t\t\tStderr: stderrBuf.String(),\n\t\t\tExitCode: exitCode,\n\t\t}\n\t\treturn &cmdOutput, err\n\t} else {\n\t\tws := cmd.ProcessState.Sys().(syscall.WaitStatus)\n\t\texitCode = ws.ExitStatus()\n\t}\n\n\tcmdOutput := CmdOutput{\n\t\tStdout: stdoutBuf.String(),\n\t\tStderr: stderrBuf.String(),\n\t\tExitCode: exitCode,\n\t}\n\n\tif cmdOutput.ExitCode != 0 {\n\t\treturn &cmdOutput, err\n\t} else {\n\t\treturn &cmdOutput, nil\n\t}\n}", "title": "" }, { "docid": "5da2d12ade89b0d11507192fee86800b", "score": "0.529194", "text": "func (p *Provider) ReadResource(providers.ReadResourceRequest) providers.ReadResourceResponse {\n\tpanic(\"unimplemented - terraform_remote_state has no resources\")\n}", "title": "" }, { "docid": "e2e3f8f12d3d6dd1c520fac1febef7ef", "score": "0.52492607", "text": "func RunRead(command string) string {\n\tcmd := exec.Command(\"sh\", \"-c\", command)\n\tstdout, _ := cmd.CombinedOutput()\n\tret := string(stdout)\n\treturn ret\n}", "title": "" }, { "docid": "a59fcab75c65f84ff1a1abf4056b3366", "score": "0.52214974", "text": "func resourceCommandCreate(d *schema.ResourceData, m interface{}) error {\n\tclient := m.(*pkg.KrokClient)\n\texpandedCommand, err := expandCommandResource(d)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcreatedCommand, err := client.CommandClient.Create(expandedCommand)\n\tif err != nil {\n\t\tlog.Println(\"Failed to create command.\")\n\t\treturn fmt.Errorf(\"failed to create command: %w\", err)\n\t}\n\n\t// add any relationships that might exist for commands.\n\tif v, ok := d.GetOk(commandResourcePlatformsFieldName); ok {\n\t\tproviders := v.([]interface{})\n\t\tfor _, pid := range providers {\n\t\t\tif err := client.CommandClient.AddRelationshipToPlatform(createdCommand.ID, pid.(int)); err != nil {\n\t\t\t\tlog.Println(\"Failed to create relationship for command and platform.\")\n\t\t\t\treturn fmt.Errorf(\"failed to add relationship between command %d and platform %d: %w\", createdCommand.ID, pid, err)\n\t\t\t}\n\t\t}\n\t}\n\td.SetId(strconv.Itoa(createdCommand.ID))\n\treturn resourceCommandRead(d, m)\n}", "title": "" }, { "docid": "5b19563c2e46b9dd6bd070ae4e98197d", "score": "0.52149355", "text": "func NewReadConfigCommand(address uint32, length uint16) Command {\n\tc := Command{\n\t\tCommand: commandReadConfig,\n\t\tAddress: address,\n\t\tLength: length,\n\t\tresponseLength: int(length),\n\t}\n\treturn c\n}", "title": "" }, { "docid": "84b4edb3d0adaf575e130368fd1676e9", "score": "0.51968944", "text": "func (conf *Config) AddReadCommand(name string,\n\tfn func(m Machine, args []string) (interface{}, error),\n) {\n\tconf.addCommand('r', name, fn)\n}", "title": "" }, { "docid": "72ef64e5d20432d9b942088980ef262b", "score": "0.5182505", "text": "func (lpr *LprConnection) ReadCommand() ([]byte, error) {\n\toffset := 0\n\n\tfor {\n\t\tlogDebugf(\"Reading next block from socket, offset: %d\", offset)\n\t\tbytesRead, err := lpr.Connection.Read(lpr.buffer[offset:])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error reading from LPR connection: %w\", err)\n\t\t}\n\n\t\tlogDebugf(\"Read %d bytes from socket\", bytesRead)\n\n\t\tendOfData := offset + bytesRead\n\n\t\tfor i, b := range lpr.buffer[:endOfData] {\n\t\t\tif b == '\\n' {\n\t\t\t\tif i != (offset+bytesRead)-1 {\n\t\t\t\t\tlogErrorf(\"Garbage at data from socket after byte %d (offset %d, bytes read: %d): %s / %+v\", i, offset, bytesRead, lpr.buffer, lpr.buffer)\n\t\t\t\t\tlogErrorf(\"Connection: %+v\", lpr)\n\t\t\t\t}\n\n\t\t\t\treturn lpr.buffer[:i], nil\n\t\t\t}\n\t\t}\n\n\t\toffset += bytesRead\n\t}\n}", "title": "" }, { "docid": "d13423d2339fc61d1a2eb8ede4220cac", "score": "0.5179892", "text": "func (c *Consul) Read(key string) {\n}", "title": "" }, { "docid": "a48102fb9220c6db747e2073e35b465e", "score": "0.5172609", "text": "func (m *LogicalClient) Read(arg0 string) (*api.Secret, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Read\", arg0)\n\tret0, _ := ret[0].(*api.Secret)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "474e15c057a593be325c006a77cc5783", "score": "0.51662165", "text": "func (a CustomerManagedKeysAPI) Read(\n\taccountID, customerManagedKeyID string) (k CustomerManagedKey, err error) {\n\terr = a.client.Get(a.context, fmt.Sprintf(\"/accounts/%s/customer-managed-keys/%s\",\n\t\taccountID, customerManagedKeyID), nil, &k)\n\treturn\n}", "title": "" }, { "docid": "dda6f9e4d90bc6b25e7816b4c0d73595", "score": "0.5160084", "text": "func (ctl *TcaCtl) CmdGetVimResourcePool() *cobra.Command {\n\n\tvar (\n\t\t_defaultPrinter = ctl.Printer\n\t\t_defaultStyler = ctl.DefaultStyle\n\t\t_outputFilter string\n\t)\n\n\t// cloud - tenants\n\tvar _cmd = &cobra.Command{\n\t\tUse: \"resources\",\n\t\tAliases: []string{\"resource\"},\n\t\tShort: \"Command retrieves a VIM's/Cloud Provider a resource pool.\",\n\t\tLong: templates.LongDesc(`\n\nCommand retrieves a VIMs resource pool. This command only works for VMware VC\nand describes resources pool defined in VMware VC.\nDuring cluster creation, spec must contains valid resource pool\nfor correct placement.`),\n\n\t\tExample: \" - tcactl get vim resource my_cloud_provider_name\\n\" +\n\t\t\t\" - tcactl get vim resource my_cloud_provider -o yaml\",\n\t\tArgs: cobra.MinimumNArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\n\t\t\tctx := context.Background()\n\n\t\t\t// global output type\n\t\t\t_defaultPrinter = ctl.RootCmd.PersistentFlags().Lookup(FlagOutput).Value.String()\n\n\t\t\t// swap filter if output filter required\n\t\t\tif len(_outputFilter) > 0 {\n\t\t\t\toutputFields := strings.Split(_outputFilter, \",\")\n\t\t\t\t_defaultPrinter = FilteredOutFilter\n\t\t\t\t_defaultStyler = ui.NewFilteredOutputStyler(outputFields)\n\t\t\t}\n\n\t\t\t_defaultStyler.SetColor(ctl.IsColorTerm)\n\t\t\t_defaultStyler.SetWide(ctl.IsWideTerm)\n\n\t\t\trps, err := ctl.tca.GetVimResourcePool(ctx, args[0])\n\t\t\tCheckErrLogError(err)\n\n\t\t\tif printer, ok := ctl.VmwareResourcePrinter[_defaultPrinter]; ok {\n\t\t\t\tprinter(rps, _defaultStyler)\n\t\t\t}\n\t\t},\n\t}\n\n\t// output filter , filter specific value from data structure\n\t_cmd.Flags().StringVar(&_outputFilter,\n\t\t\"ofilter\", \"\",\n\t\t\"Output filter.\")\n\n\treturn _cmd\n}", "title": "" }, { "docid": "8c8feafdb0465c2c2a3e26bb066f8e9b", "score": "0.5142571", "text": "func (r resourceTeleportProvisionToken) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) {\n\tvar state types.Object\n\tdiags := req.State.Get(ctx, &state)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n\n\tvar id types.String\n\tdiags = req.State.GetAttribute(ctx, path.Root(\"metadata\").AtName(\"name\"), &id)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n\n\tprovisionTokenI, err := r.p.Client.GetToken(ctx, id.Value)\n\tif trace.IsNotFound(err) {\n\t\tresp.State.RemoveResource(ctx)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tresp.Diagnostics.Append(diagFromWrappedErr(\"Error reading ProvisionToken\", trace.Wrap(err), \"token\"))\n\t\treturn\n\t}\n\n\tprovisionToken := provisionTokenI.(*apitypes.ProvisionTokenV2)\n\tdiags = tfschema.CopyProvisionTokenV2ToTerraform(ctx, provisionToken, &state)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n\n\tdiags = resp.State.Set(ctx, &state)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "d0dc76c923f1928323a790a5de1e4d42", "score": "0.5096071", "text": "func (l *Lexer) readCommand() string {\n\tposition := l.position + 2\n\tsubtract := 1\n\tfor {\n\t\tl.readChar()\n\n\t\tif l.ch == '\\n' || l.ch == '\\r' || l.ch == 0 {\n\t\t\t// TODO: for compat turn this into prevCharOtherThan\n\t\t\tif l.prevChar(2) == ';' {\n\t\t\t\tsubtract = 2\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\tret := l.input[position : l.position-subtract]\n\n\t// Let's make sure the semicolo is the next token, without\n\t// \"cutting\" it out...\n\tif subtract == 2 {\n\t\tl.position = l.position - 1\n\t\tl.readPosition = l.position\n\t}\n\n\treturn string(ret)\n}", "title": "" }, { "docid": "225a2798addef74183534282bd62b116", "score": "0.5049632", "text": "func (a CustomerManagedKeysAPI) Read(\n\tmwsAcctID, customerManagedKeyID string) (k CustomerManagedKey, err error) {\n\terr = a.client.Get(fmt.Sprintf(\"/accounts/%s/customer-managed-keys/%s\",\n\t\tmwsAcctID, customerManagedKeyID), nil, &k)\n\treturn\n}", "title": "" }, { "docid": "4a94a654c6c179f871cb35e94e982e3d", "score": "0.503324", "text": "func main() {\n\tfmt.Println(getCommandsFromFile(\"resources/not_enough_lines\"))\n\tfmt.Println(getCommandsFromFile(\"resources/version_not_a_number\"))\n\tfmt.Println(getCommandsFromFile(\"resources/invalid_json\"))\n\tfmt.Println(getCommandsFromFile(\"resources/incorrect_version\"))\n\tfmt.Println(getCommandsFromFile(\"resources/incorrect_mode\"))\n\tfmt.Println(getCommandsFromFile(\"resources/valid\"))\n}", "title": "" }, { "docid": "86276d31cb22a67b4d0ce2f5b80e91d1", "score": "0.5014061", "text": "func (c CommandExecutor) Read(p []byte) (int, error) {\n\treturn c.pipe.Read(p)\n}", "title": "" }, { "docid": "c3552ef5654624b2c950eec0c4862deb", "score": "0.5005002", "text": "func read(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\r\n\tvar key, jsonResp string\r\n\tvar err error\r\n\tfmt.Println(\"starting read\")\r\n\r\n\tif len(args) != 1 {\r\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting key of the var to query\")\r\n\t}\r\n\r\n\tkey = args[0]\r\n\tvalAsbytes, err := stub.GetState(key) //get the var from ledger\r\n\tif err != nil {\r\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + key + \"\\\"}\"\r\n\t\treturn nil, errors.New(jsonResp)\r\n\t}\r\n\r\n\tfmt.Println(\"- end read\")\r\n\treturn valAsbytes, nil\r\n}", "title": "" }, { "docid": "32fd784ef81abf6aaaa919069cf37784", "score": "0.49949205", "text": "func ReadCommand(in *goetty.ByteBuf) (bool, Command, error) {\r\n\tfor {\r\n\t\t// remember the begin read index,\r\n\t\t// if we found has no enough data, we will resume this read index,\r\n\t\t// and waiting for next.\r\n\t\tbackupReaderIndex := in.GetReaderIndex()\r\n\r\n\t\tc, err := in.ReadByte()\r\n\t\tif err != nil {\r\n\t\t\treturn false, nil, err\r\n\t\t}\r\n\r\n\t\t// 1. Read ( *<number of arguments> CR LF )\r\n\t\tif c != CMDBegin {\r\n\t\t\treturn false, nil, fmt.Errorf(\"illegal cmd char %d\", c)\r\n\t\t}\r\n\r\n\t\t// 2. Read number of arguments\r\n\t\tcount, argsCount, err := readStringInt(in)\r\n\t\tif count == 0 && err == nil {\r\n\t\t\tin.SetReaderIndex(backupReaderIndex)\r\n\t\t\treturn false, nil, nil\r\n\t\t} else if err != nil {\r\n\t\t\treturn false, nil, err\r\n\t\t}\r\n\r\n\t\tdata := make([][]byte, argsCount)\r\n\r\n\t\t// 3. Read args\r\n\t\tfor i := 0; i < argsCount; i++ {\r\n\t\t\tif 0 == in.Readable() {\r\n\t\t\t\tin.SetReaderIndex(backupReaderIndex)\r\n\t\t\t\treturn false, nil, nil\r\n\t\t\t}\r\n\r\n\t\t\t// 3.1 Read ( $<number of bytes of argument 1> CR LF )\r\n\t\t\tc, err := in.ReadByte()\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn false, nil, err\r\n\t\t\t}\r\n\r\n\t\t\t// 3.2 Read ( *<number of arguments> CR LF )\r\n\t\t\tif c != ARGBegin {\r\n\t\t\t\treturn false, nil, fmt.Errorf(\"illegal arg char %d\", c)\r\n\t\t\t}\r\n\r\n\t\t\tcount, argBytesCount, err := readStringInt(in)\r\n\t\t\tif count == 0 && err == nil {\r\n\t\t\t\tin.SetReaderIndex(backupReaderIndex)\r\n\t\t\t\treturn false, nil, nil\r\n\t\t\t} else if err != nil {\r\n\t\t\t\treturn false, nil, err\r\n\t\t\t} else if count < 2 {\r\n\t\t\t\treturn false, nil, fmt.Errorf(\"illegal arg count: %d\", count)\r\n\t\t\t}\r\n\r\n\t\t\t// 3.3 Read ( <argument data> CR LF )\r\n\t\t\tif argBytesCount+2 > in.Readable() {\r\n\t\t\t\tin.SetReaderIndex(backupReaderIndex)\r\n\t\t\t\treturn false, nil, nil\r\n\t\t\t}\r\n\t\t\tcount, value, err := in.ReadBytes(argBytesCount + 2)\r\n\t\t\tif count == 0 && err == nil {\r\n\t\t\t\tin.SetReaderIndex(backupReaderIndex)\r\n\t\t\t\treturn false, nil, nil\r\n\t\t\t} else if err != nil {\r\n\t\t\t\treturn false, nil, err\r\n\t\t\t}\r\n\r\n\t\t\tdata[i] = value[:count-2]\r\n\t\t}\r\n\r\n\t\treturn true, Command(data), nil\r\n\t}\r\n}", "title": "" }, { "docid": "65816c2c3099da408b29e887541cbadf", "score": "0.49603114", "text": "func resourceRead(url string, sfxToken string, d *schema.ResourceData) error {\n\tstatus_code, resp_body, err := sendRequest(\"GET\", url, sfxToken, nil)\n\tif status_code == 200 {\n\t\tmapped_resp := map[string]interface{}{}\n\t\terr = json.Unmarshal(resp_body, &mapped_resp)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed unmarshaling for the resource %s during read: %s\", d.Get(\"name\"), err.Error())\n\t\t}\n\t\t// This implies the resource was modified in the Signalfx UI and therefore it is not synced with Signalform\n\t\tlast_updated := mapped_resp[\"lastUpdated\"].(float64)\n\t\tif last_updated > (d.Get(\"last_updated\").(float64) + OFFSET) {\n\t\t\td.Set(\"synced\", false)\n\t\t\td.Set(\"last_updated\", last_updated)\n\t\t}\n\t\tvar resource_url string\n\t\tif val, ok := d.GetOk(\"resource_url\"); ok {\n\t\t\tresource_url = strings.Replace(fmt.Sprintf(\"%s\", val), \"<id>\", mapped_resp[\"id\"].(string), 1)\n\t\t} else {\n\t\t\tresource_url = \"DUMMY\"\n\t\t}\n\t\td.Set(\"url\", resource_url)\n\t} else {\n\t\tif status_code == 404 && strings.Contains(string(resp_body), \" not found\") {\n\t\t\t// This implies that the resouce was deleted in the Signalfx UI and therefore we need to recreate it\n\t\t\td.SetId(\"\")\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"For the resource %s SignalFx returned status %d: \\n%s\", d.Get(\"name\"), status_code, resp_body)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b246fcb86ffc0570627dcaf2b7ed3c54", "score": "0.49535415", "text": "func (g *CommandGuard) GetResourceDetails(selectedVerb, resourceType string) (Resource, error) {\n\t_, found := resourcelessVerbs[selectedVerb]\n\tif found {\n\t\treturn Resource{}, nil\n\t}\n\n\tresMap, err := g.GetServerResourceMap()\n\tif err != nil {\n\t\treturn Resource{}, err\n\t}\n\n\tres, err := g.GetResourceDetailsFromMap(selectedVerb, resourceType, resMap)\n\tif err != nil {\n\t\treturn Resource{}, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "1a4306954b04b068caeac75140fdb635", "score": "0.49491814", "text": "func scpReadCommand(src *bufio.Reader) (string, error) {\n\tbuf, err := src.ReadBytes(byte('\\n'))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.TrimSpace(string(buf)), nil\n}", "title": "" }, { "docid": "2bda8221515c969761f45d2b3fe681ff", "score": "0.4909807", "text": "func (fs *KBFSOpsStandard) Read(\n\tctx context.Context, file Node, dest []byte, off int64) (\n\tnumRead int64, err error) {\n\ttimeTrackerDone := fs.longOperationDebugDumper.Begin(ctx)\n\tdefer timeTrackerDone()\n\n\tops := fs.getOpsByNode(ctx, file)\n\treturn ops.Read(ctx, file, dest, off)\n}", "title": "" }, { "docid": "d0d63e32fda49dd3194aeb5d08607ba2", "score": "0.49053758", "text": "func (t *DomoChaincode) Read(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar key string\n\tvar err error\n\tLogMessage(\"starting read\")\n\n\tif len(args) != 1 {\n\t\treturn ErrorPbResponse(RESP_CODE_SYSTEM_ERROR, \"Incorrect number of arguments. Expecting key of the var to query\")\n\t}\n\n\tkey = args[0]\n\tvalAsbytes, err := stub.GetState(key) //get the var from ledger\n\tif err != nil {\n\t\treturn ErrorPbResponse(RESP_CODE_SYSTEM_ERROR, \"Failed to get state for \" + key + \":\" + err.Error())\n\t}\n\n\tLogMessage(\"- end read\")\n\treturn SuccessPbResponse(valAsbytes) //send it onward\n}", "title": "" }, { "docid": "61e0a5c06992a424e0a9ec324f4c96f2", "score": "0.4901674", "text": "func resourceDeploymentRead(d *schema.ResourceData, meta interface{}) error {\n\tclient, err := meta.(*Clients).GetIronicClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Ensure node exists first\n\tid := d.Get(\"node_uuid\").(string)\n\tresult, err := nodes.Get(client, id).Extract()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not find node %s: %s\", id, err)\n\t}\n\n\terr = d.Set(\"provision_state\", result.ProvisionState)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn d.Set(\"last_error\", result.LastError)\n}", "title": "" }, { "docid": "43c19736fb47683da1cbf3a3966f6077", "score": "0.4892674", "text": "func (r resourceTeleportOIDCConnector) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) {\n\tvar state types.Object\n\tdiags := req.State.Get(ctx, &state)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n\n\tvar id types.String\n\tdiags = req.State.GetAttribute(ctx, path.Root(\"metadata\").AtName(\"name\"), &id)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n\n\toidcConnectorI, err := r.p.Client.GetOIDCConnector(ctx, id.Value, true)\n\tif trace.IsNotFound(err) {\n\t\tresp.State.RemoveResource(ctx)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tresp.Diagnostics.Append(diagFromWrappedErr(\"Error reading OIDCConnector\", trace.Wrap(err), \"oidc\"))\n\t\treturn\n\t}\n\n\toidcConnector := oidcConnectorI.(*apitypes.OIDCConnectorV3)\n\tdiags = tfschema.CopyOIDCConnectorV3ToTerraform(ctx, oidcConnector, &state)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n\n\tdiags = resp.State.Set(ctx, &state)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "5040d83728525d6529719814c53c1e27", "score": "0.48905367", "text": "func ConfigRead() ([]byte, uint32) {\n\tmsg, err := ioutil.ReadFile(\"configread.json\")\n\tif err != nil {\n\t\tfmt.Println(\"config read failed\", err.Error())\n\t}\n\treturn msg, proto.CmdKV[\"config_read_resp\"]\n}", "title": "" }, { "docid": "72712e841c8a6ad8e04b793b69786492", "score": "0.4879582", "text": "func (t *SimpleChaincode) read(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\tvar key, jsonResp string\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting name of the key to query\")\n\t}\n\n\tkey = args[0]\n\tvalAsbytes, err := stub.GetState(key)\n\tif err != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + key + \"\\\"}\"\n\t\treturn nil, errors.New(jsonResp)\n\t}\n\n\treturn valAsbytes, nil\n}", "title": "" }, { "docid": "72712e841c8a6ad8e04b793b69786492", "score": "0.4879582", "text": "func (t *SimpleChaincode) read(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\tvar key, jsonResp string\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting name of the key to query\")\n\t}\n\n\tkey = args[0]\n\tvalAsbytes, err := stub.GetState(key)\n\tif err != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + key + \"\\\"}\"\n\t\treturn nil, errors.New(jsonResp)\n\t}\n\n\treturn valAsbytes, nil\n}", "title": "" }, { "docid": "38dc65917d8476d0306e05e99f36d8ea", "score": "0.48699448", "text": "func (c *Client) resourceNameCompressedRead(hash string, sizeBytes int64) string {\n\trname, _ := c.ResourceName(\"compressed-blobs\", \"zstd\", hash, strconv.FormatInt(sizeBytes, 10))\n\treturn rname\n}", "title": "" }, { "docid": "db3b49325d609be766b582cf5acc8738", "score": "0.48595932", "text": "func (config *tomlConfig) getCommandDetails(cmdName string) (commandDetails, bool) {\n\tfor _, command := range config.Command {\n\t\tif command.Name == cmdName {\n\t\t\t// need to deep copy slice\n\t\t\tcopiedCommand := command\n\t\t\tcopiedCommand.Args = make([]string, len(command.Args))\n\t\t\tcopy(copiedCommand.Args, command.Args)\n\n\t\t\treturn copiedCommand, true\n\t\t}\n\t}\n\n\t// no command found\n\tvar emptyCommand commandDetails\n\treturn emptyCommand, false\n}", "title": "" }, { "docid": "5f19267bc02dca8af9bbdbb4958a4bc4", "score": "0.4859191", "text": "func resourceRead(proc *exec.Process, fid int32, dataPtr int32, dataLen int32) int32 {\n\n\t// TODO: This function seems like it should be reading bytes from the given file (eg os.Stdin), then writing\n\t// them to the given spot in the VM's memory, up to dataLen in length\n\n\t// data := make([]byte, dataLen)\n\t// bytesRead, err := proc.ReadAt(data, int64(dataPtr)) // TODO: proc.Write() is probably the call to use here\n\t// if err != nil {\n\t// \tlog.Print(err)\n\t// \treturn 1\n\t// }\n\t//\n\t// if bytesRead != int(dataLen) {\n\t// \tlog.Printf(\"Incorrect # of bytes read. Requested %d, but read %d\\n\", dataLen, bytesRead)\n\t// \treturn 2\n\t// }\n\n\t// fmt.Printf(\"%s\", string(data))\n\treturn int32(0)\n}", "title": "" }, { "docid": "8c6057c1bf94d034e10d024df49cbd19", "score": "0.48359504", "text": "func (h Harness) Resources(ctx context.Context) ([]string, error) {\n\tcmd := exec.CommandContext(ctx, h.Path, \"state\", \"list\") //nolint:gosec\n\tcmd.Dir = h.Dir\n\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, Classify(err)\n\t}\n\n\tresources := strings.Split(string(out), \"\\n\")\n\treturn resources[:len(resources)-1], nil\n}", "title": "" }, { "docid": "c26e41336e560d78aa6e189c3292306a", "score": "0.4834125", "text": "func (d *Dage) GetCommand(tick string, params []string) []string {\n\tif len(params) != 1 {\n\t\treturn []string{\"\"}\n\t}\n\tits, ok := Default.Get(params[0])\n\tif !ok {\n\t\treturn []string{\"\"}\n\t}\n\titems := []string{}\n\tbytes := 0\n\tfor _, i := range its {\n\t\tbytes += len(i.Data)\n\t\titems = append(items, string(i.Data))\n\t}\n\tr := strings.Join(items, \"\\t\\t\")\n\td.Log.Info(fmt.Sprintf(\"From Bulk %s Get %d bytes data\", params[0], bytes))\n\treturn []string{tick, r}\n}", "title": "" }, { "docid": "432f54b68116798bd7aa74cd654f3c62", "score": "0.48213807", "text": "func (client *Client) Read(key string) (map[string]interface{}, error) {\n\tglog.V(2).Infof(\"Read secret: %s \", key)\n\tpath := fmt.Sprintf(\"/secret/alan/%s\", key)\n\tsecret, err := client.vault.Logical().Read(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif secret == nil {\n\t\treturn nil, fmt.Errorf(\"No secret for path %s\", key)\n\t}\n\treturn secret.Data, nil\n}", "title": "" }, { "docid": "532189ffedbaa6a541f88fbd00d9e433", "score": "0.48173138", "text": "func (ctx *Context) ReadResource(\n\tt, name string, id ID, props map[string]interface{}, opts ...ResourceOpt) (*ResourceState, error) {\n\tif t == \"\" {\n\t\treturn nil, errors.New(\"resource type argument cannot be empty\")\n\t} else if name == \"\" {\n\t\treturn nil, errors.New(\"resource name argument (for URN creation) cannot be empty\")\n\t} else if id == \"\" {\n\t\treturn nil, errors.New(\"resource ID is required for lookup and cannot be empty\")\n\t}\n\n\t// Note that we're about to make an outstanding RPC request, so that we can rendezvous during shutdown.\n\tif err := ctx.beginRPC(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create resolvers for the resource's outputs.\n\tres := makeResourceState(true, props)\n\n\t// Kick off the resource read operation. This will happen asynchronously and resolve the above properties.\n\tgo func() {\n\t\t// No matter the outcome, make sure all promises are resolved and that we've signaled completion of this RPC.\n\t\tvar urn, resID string\n\t\tvar state *structpb.Struct\n\t\tvar err error\n\t\tdefer func() {\n\t\t\tres.resolve(ctx.DryRun(), err, props, urn, resID, state)\n\t\t\tctx.endRPC()\n\t\t}()\n\n\t\t// Prepare the inputs for an impending operation.\n\t\tinputs, err := ctx.prepareResourceInputs(props, opts...)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tlogging.V(9).Infof(\"ReadResource(%s, %s): Goroutine spawned, RPC call being made\", t, name)\n\t\tresp, err := ctx.monitor.ReadResource(ctx.ctx, &pulumirpc.ReadResourceRequest{\n\t\t\tType: t,\n\t\t\tName: name,\n\t\t\tParent: inputs.parent,\n\t\t\tProperties: inputs.rpcProps,\n\t\t\tProvider: inputs.provider,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogging.V(9).Infof(\"RegisterResource(%s, %s): error: %v\", t, name, err)\n\t\t} else {\n\t\t\tlogging.V(9).Infof(\"RegisterResource(%s, %s): success: %s %s ...\", t, name, resp.Urn, id)\n\t\t}\n\t\tif resp != nil {\n\t\t\turn, resID = resp.Urn, string(id)\n\t\t\tstate = resp.Properties\n\t\t}\n\t}()\n\n\treturn res, nil\n}", "title": "" }, { "docid": "a94f7d16f7d16a853b99f0b500045b7f", "score": "0.481538", "text": "func (g *Proxy) GetResourceInfo(opt GetResourceInfoOption) {\n\tdata := openapi.Query(\"get_resource_info\", []string{\n\t\tfmt.Sprintf(\"type=%s\", opt.Type),\n\t\tfmt.Sprintf(\"name=%s\", opt.Name),\n\t})\n\tfmt.Println(string(stringobj.String2Json(data)))\n}", "title": "" }, { "docid": "fc53f294357b1a3d411f1500cac6be67", "score": "0.48143172", "text": "func Read(r Register) (string, error) {\n\treturn read(r, CurrentMethod)\n}", "title": "" }, { "docid": "ca626cc16f2e437324cd83e6b14ac928", "score": "0.48068222", "text": "func (b *backend) pathRoleRead(ctx context.Context, req *logical.Request, d *framework.FieldData) (*logical.Response, error) {\n\tname := d.Get(\"name\").(string)\n\tif name == \"\" {\n\t\treturn logical.ErrorResponse(\"missing name\"), nil\n\t}\n\n\trole, err := b.Role(ctx, req.Storage, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif role == nil {\n\t\treturn nil, nil\n\t}\n\n\treturn &logical.Response{\n\t\tData: structs.New(role).Map(),\n\t}, nil\n}", "title": "" }, { "docid": "40291dea09211e55b8c3020d064dea06", "score": "0.4800124", "text": "func (c *Client) Read(path string) (*api.Secret, error) {\n\t// send API call to capture the secret\n\tvault, err := c.Vault.Logical().Read(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to retrieve secret %s: %w\", path, err)\n\t}\n\n\t// return nil if secret does not exist\n\tif vault == nil {\n\t\treturn nil, fmt.Errorf(\"unable to retrieve secret %s\", path)\n\t}\n\n\treturn vault, nil\n}", "title": "" }, { "docid": "571b5f8a31127403fd4f36de36b54061", "score": "0.47947428", "text": "func (t *SimpleChaincode) read(stub *shim.ChaincodeStub, args []string) ([]byte, error) {\n\tvar name, jsonResp string\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting name of the var to query\")\n\t}\n\n\tname = args[0]\n\tvalAsbytes, err := stub.GetState(name)\n\tif err != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + name + \"\\\"}\"\n\t\treturn nil, errors.New(jsonResp)\n\t}\n\n\treturn valAsbytes, nil\n}", "title": "" }, { "docid": "45819c57829c242063b7523a6bbaf726", "score": "0.47795707", "text": "func Read(cli *client.Client, id, path string) ([]byte, error) {\n\tlog.Printf(\"Getting content of file [%s]\", path)\n\tconfig := types.ExecConfig{\n\t\tTty: true,\n\t\tAttachStderr: true,\n\t\tAttachStdout: true,\n\t\tCmd: []string{\"/bin/bash\", \"-c\", \"cat \" + path},\n\t}\n\trid, err := cli.ContainerExecCreate(context.Background(), id, config)\n\tif err != nil {\n\t\tlog.Println(\"error on creating container exec\" + err.Error())\n\t}\n\thijack, err := cli.ContainerExecAttach(context.Background(), rid.ID, config)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\toutput, err := read(hijack.Conn)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "c1e258180d0ded8c24fddc974c8e833b", "score": "0.47622833", "text": "func resourceAzureStorageServiceRead(d *schema.ResourceData, meta interface{}) error {\n\tstorageServiceClient := meta.(*Client).storageServiceClient\n\n\t// get our storage service:\n\tlog.Println(\"[INFO] Sending query about storage service to Azure.\")\n\tname := d.Get(\"name\").(string)\n\tstorsvc, err := storageServiceClient.GetStorageService(name)\n\tif err != nil {\n\t\tif !management.IsResourceNotFoundError(err) {\n\t\t\treturn fmt.Errorf(\"Failed to query about Azure about storage service: %s\", err)\n\t\t} else {\n\t\t\t// it means that the resource has been deleted from Azure\n\t\t\t// in the meantime and we must remove its associated Resource.\n\t\t\td.SetId(\"\")\n\t\t\treturn nil\n\n\t\t}\n\t}\n\n\t// read values:\n\td.Set(\"url\", storsvc.URL)\n\tlog.Println(\"[INFO] Querying keys of Azure storage service.\")\n\tkeys, err := storageServiceClient.GetStorageServiceKeys(name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed querying keys for Azure storage service: %s\", err)\n\t}\n\td.Set(\"primary_key\", keys.PrimaryKey)\n\td.Set(\"secondary_key\", keys.SecondaryKey)\n\n\treturn nil\n}", "title": "" }, { "docid": "3749feb0a9e7eeb5049d9f166eac556a", "score": "0.47593582", "text": "func NewReadEECommand(address uint32, length uint16) Command {\n\tc := Command{\n\t\tCommand: commandReadEE,\n\t\tAddress: address,\n\t\tLength: length,\n\t\tresponseLength: int(length),\n\t}\n\treturn c\n}", "title": "" }, { "docid": "af00e4ff9a89f4b09d4aab3c607e5006", "score": "0.47576678", "text": "func Read(filepath string) (*clientcmdapi.Config, error) {\n\tconfig, err := clientcmd.LoadFromFile(filepath)\n\tif err != nil {\n\t\tlog.Debug().Msgf(\"Error while reading %s: %v\", filepath, err)\n\t\treturn nil, err\n\t}\n\treturn config, nil\n}", "title": "" }, { "docid": "ccc926ec79b172122bdbbed3197a5581", "score": "0.47571084", "text": "func (r resourceTeleportDeviceV1) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) {\n\tvar state types.Object\n\tdiags := req.State.Get(ctx, &state)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n\n\tvar id types.String\n\tdiags = req.State.GetAttribute(ctx, path.Root(\"metadata\").AtName(\"name\"), &id)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n\n\ttrustedDeviceI, err := r.p.Client.GetDeviceResource(ctx, id.Value)\n\tif trace.IsNotFound(err) {\n\t\tresp.State.RemoveResource(ctx)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tresp.Diagnostics.Append(diagFromWrappedErr(\"Error reading DeviceV1\", trace.Wrap(err), \"device\"))\n\t\treturn\n\t}\n\n\ttrustedDevice := trustedDeviceI\n\tdiags = tfschema.CopyDeviceV1ToTerraform(ctx, trustedDevice, &state)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n\n\tdiags = resp.State.Set(ctx, &state)\n\tresp.Diagnostics.Append(diags...)\n\tif resp.Diagnostics.HasError() {\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "ee10ce12651d3dac3c19b66876928ebd", "score": "0.47422773", "text": "func (cr *ClusterReader) ReadResources(ctx context.Context, client *onego.Client) ([]Resource, error) {\n\tobjs, err := client.ClusterService.List(ctx)\n\n\tres := make([]Resource, len(objs))\n\tfor i, e := range objs {\n\t\tres[i] = e\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "c1ab0a019af7aac95b6c3ff50c3471da", "score": "0.47362754", "text": "func (ds *DataStore) Resource(oid string) (*ResourceObject, bool) {\n\tds.Lock()\n\tres, ok := ds.data.Resources[oid]\n\tds.Unlock()\n\treturn res, ok\n}", "title": "" }, { "docid": "d8c56833afec1cbfe8c23ed96d02dce5", "score": "0.47330484", "text": "func (s *Driver) HandleReadCommands(deviceName string, protocols map[string]contract.ProtocolProperties, reqs []dsModels.CommandRequest) (res []*dsModels.CommandValue, err error) {\n\n\ts.lc.Debug(fmt.Sprintf(\"protocols: %v resource: %v attributes: %v\", protocols, reqs[0].DeviceResourceName, reqs[0].Attributes))\n\n\tnow := time.Now().UnixNano()\n\n\tfor _, req := range reqs {\n\t\tswitch req.DeviceResourceName {\n\t\tcase \"gethex\":\n\t\t\t{\n\t\t\t\trxbuf, err := s.uartdevice.GetHex()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tcv := dsModels.NewStringValue(reqs[0].DeviceResourceName, now, rxbuf)\n\t\t\t\tres = append(res, cv)\n\t\t\t}\n\t\tcase \"getstring\":\n\t\t\t{\n\t\t\t\trxbuf, err := s.uartdevice.GetString()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tcv := dsModels.NewStringValue(reqs[0].DeviceResourceName, now, rxbuf)\n\t\t\t\tres = append(res, cv)\n\t\t\t}\n\t\tcase \"uartconfig\":\n\t\t\t{\n\t\t\t\trxbuf, err := s.uartdevice.GetUartConfig()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tcv := dsModels.NewStringValue(reqs[0].DeviceResourceName, now, rxbuf)\n\t\t\t\tres = append(res, cv)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "ad3ac46a7caa332ba8eb8378d42514f4", "score": "0.47299334", "text": "func Read() (string, error) {\n\t// check to see if xclip exists\n\terr := checkCommand(\"xclip\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// run the command \"xclip -out -selection clipboard\" to get what's in the clipboard\n\tcmd := exec.Command(\"xclip\", \"-out\", \"-selection\", \"clipboard\")\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// convert the output to a string, and return it\n\treturn string(out), nil\n}", "title": "" }, { "docid": "0f3e76ca1a58a69bfe058cf8f68db87a", "score": "0.47280565", "text": "func (r *ClusterResourceSetReconciler) getResource(ctx context.Context, resourceRef addonsv1.ResourceRef, namespace string) (*unstructured.Unstructured, error) {\n\tresourceName := types.NamespacedName{Name: resourceRef.Name, Namespace: namespace}\n\n\tvar resourceInterface interface{}\n\tswitch resourceRef.Kind {\n\tcase string(addonsv1.ConfigMapClusterResourceSetResourceKind):\n\t\tresourceConfigMap, err := getConfigMap(ctx, r.Client, resourceName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresourceInterface = resourceConfigMap.DeepCopyObject()\n\tcase string(addonsv1.SecretClusterResourceSetResourceKind):\n\t\tresourceSecret, err := getSecret(ctx, r.Client, resourceName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif resourceSecret.Type != addonsv1.ClusterResourceSetSecretType {\n\t\t\treturn nil, ErrSecretTypeNotSupported\n\t\t}\n\t\tresourceInterface = resourceSecret.DeepCopyObject()\n\t}\n\n\traw := &unstructured.Unstructured{}\n\terr := r.Client.Scheme().Convert(resourceInterface, raw, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn raw, nil\n}", "title": "" }, { "docid": "dbc226ab6d5c24eb299e51156d4238b3", "score": "0.4726582", "text": "func (client *Client) Get(cmd *cli.Cmd) {\n\taddress := addStringOpt(cmd, \"address\", addrOpt)\n\tsecretKey := addStringOpt(cmd, \"key\", secretOpt)\n\tsalt := addStringOpt(cmd, \"salt\", saltOpt)\n\n\tcmd.Action = func() {\n\t\t// If given address then try to read reference from arguments and option\n\t\tref := readReference(address)\n\t\tif ref.SecretKey == nil {\n\t\t\tif secretKey == nil || *secretKey == \"\" {\n\t\t\t\tfatalf(\"A secret key must be provided in order to decrypt\")\n\t\t\t}\n\t\t\tref = &reference.Ref{\n\t\t\t\tAddress: readBase64(address),\n\t\t\t\tSecretKey: readBase64(secretKey),\n\t\t\t\tSalt: parseSalt(salt),\n\t\t\t}\n\t\t}\n\t\tplaintext, err := client.cleartext.Get(context.Background(), ref)\n\t\tif err != nil {\n\t\t\tfatalf(\"Error retrieving data: %v\", err)\n\t\t}\n\t\tos.Stdout.Write(plaintext.Data)\n\t}\n}", "title": "" }, { "docid": "2192db22b5d171e3faf9825377f40f9f", "score": "0.4725089", "text": "func (ds *DataStore) Resource(oid string) (*ResourceObject, bool) {\n\tds.Lock()\n\tdefer ds.Unlock()\n\tres, ok := ds.resources[oid]\n\treturn res, ok\n}", "title": "" }, { "docid": "84b761947a1cdefe0b10da7d69b0cc90", "score": "0.4724245", "text": "func resourceSAMLConnectorRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {\n\tc, err := getClient(m)\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\tid := d.Id()\n\n\ts, err := c.GetSAMLConnector(ctx, id, true)\n\tif trace.IsNotFound(err) {\n\t\td.SetId(\"\")\n\t\treturn diag.Diagnostics{}\n\t}\n\n\tif err != nil {\n\t\treturn diagFromErr(describeErr(err, \"saml\"))\n\t}\n\n\ts2, ok := s.(*types.SAMLConnectorV2)\n\tif !ok {\n\t\treturn diagFromErr(fmt.Errorf(\"failed to convert created user to types.SAMLConnectorV2 from %T\", s))\n\t}\n\n\terr = tfschema.ToTerraformSAMLConnectorV2(s2, d)\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\treturn diag.Diagnostics{}\n}", "title": "" }, { "docid": "c00b30cb7e769a0e409f5d50d3edfa7b", "score": "0.4720161", "text": "func (c *Configuration) Read(ctx context.Context, arg *ReadRequest) (*State, error) {\n\treturn c.read(ctx, arg)\n}", "title": "" }, { "docid": "c00b30cb7e769a0e409f5d50d3edfa7b", "score": "0.4720161", "text": "func (c *Configuration) Read(ctx context.Context, arg *ReadRequest) (*State, error) {\n\treturn c.read(ctx, arg)\n}", "title": "" }, { "docid": "d65bc5d62b5981be8d0aa4c248cea5e9", "score": "0.4711597", "text": "func (contextReader *LocalBuildContextReader) Read() (string, error) {\n\tutil.Logger.WithField(\"contextPath\", contextReader.buildContext.ContextPath).Infoln(\"reading local build context\")\n\n\tif contextReader.buildContext.ContextPath == \"\" {\n\t\treturn \"\", errors.New(\"no contextPath specified for local build context\")\n\t}\n\n\tif err := TarBuildContext(contextReader.buildContext.ContextPath); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn contextReader.buildContext.ContextPath, nil\n}", "title": "" }, { "docid": "badc4b88dda580d4bfc0045728f7fd27", "score": "0.4708127", "text": "func (o *CreateSampleDataOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error) {\n\to.Command = NewCreateSampleDataCommand(conventions)\n\treturn o.Command, nil\n}", "title": "" }, { "docid": "6aec3028f7a1615e479c27cca083e688", "score": "0.47076944", "text": "func expandCommandSettingResource(d *schema.ResourceData) (*models.CommandSetting, error) {\n\tvar (\n\t\tkey, value string\n\t\tinVault bool\n\t\tcommandID int\n\t)\n\tif v, ok := d.GetOk(commandSettingsKeyFieldName); ok {\n\t\tkey = v.(string)\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unable to find parse field %s\", commandSettingsKeyFieldName)\n\t}\n\tif v, ok := d.GetOk(commandSettingsValueFieldName); ok {\n\t\tvalue = v.(string)\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unable to find parse field %s\", commandSettingsValueFieldName)\n\t}\n\tif v, ok := d.GetOk(commandSettingsInVaultFieldName); ok {\n\t\tinVault = v.(bool)\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unable to find parse field %s\", commandSettingsInVaultFieldName)\n\t}\n\tif v, ok := d.GetOk(commandSettingsCommandIDFieldName); ok {\n\t\tcommandID = v.(int)\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unable to find parse field %s\", commandSettingsCommandIDFieldName)\n\t}\n\treturn &models.CommandSetting{\n\t\tCommandID: commandID,\n\t\tKey: key,\n\t\tValue: value,\n\t\tInVault: inVault,\n\t}, nil\n}", "title": "" }, { "docid": "eca052e74f739ed71871fabfab2ce5af", "score": "0.46836278", "text": "func (controller *PlainController) Read(ctx context.Context) ([]string, error) {\n\treturn controller.sqls, nil\n}", "title": "" }, { "docid": "c409187f9db1ebaef928bab35f268bb4", "score": "0.46733657", "text": "func ExecuteTerraformCmd(cmd *cobra.Command, args []string) error {\n\tinfo, err := processCommandLineArgs(\"terraform\", cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ExecuteTerraform(info)\n}", "title": "" }, { "docid": "5c1ba285588737906a424f5562f66a4f", "score": "0.46723878", "text": "func ForRead(ctx context.Context, d *pluginsdk.ResourceData) (context.Context, context.CancelFunc) {\n\treturn buildWithTimeout(ctx, d.Timeout(pluginsdk.TimeoutRead))\n}", "title": "" }, { "docid": "e3c1106bc796730af1abd65f202bca2b", "score": "0.46625882", "text": "func (r *DeviceCommandsCollectionRequest) Get(ctx context.Context) ([]Command, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "d5d885b93b46c47892c36e1eebcac2fa", "score": "0.46622452", "text": "func (c *Logical) ReadRaw(path string) (*Response, error) {\n\treturn c.ReadRawWithDataWithContext(context.Background(), path, nil)\n}", "title": "" }, { "docid": "2c94a1510e7f2305425fc0ec6f76ae91", "score": "0.4660667", "text": "func (ds *DataStore) Read(txn Transaction, path ast.Ref) (interface{}, error) {\n\treturn ds.getRef(path)\n}", "title": "" }, { "docid": "5f8eb9add960300bb43a3a94278bd4aa", "score": "0.46551943", "text": "func read(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar key, jsonResp string\n\tvar err error\n\tfmt.Println(\"starting read\")\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting key of the var to query\")\n\t}\n\n\t// input sanitation\n\terr = sanitizeArguments(args)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tkey = args[0]\n\tvalAsbytes, err := stub.GetState(key) //get the var from ledger\n\tif err != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + key + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tfmt.Println(\"- end read\")\n\treturn shim.Success(valAsbytes) //send it onward\n}", "title": "" }, { "docid": "62710b9cec757d27acfe4cc3c5570b5d", "score": "0.46527788", "text": "func read(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar key, jsonResp string\n\tvar err error\n\tfmt.Println(\"starting read\")\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting key of the var to query\")\n\t}\n\n\t// input sanitation\n\terr = sanitize_arguments(args)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tkey = args[0]\n\tvalAsbytes, err := stub.GetState(key) //get the var from ledger\n\tif err != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + key + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tfmt.Println(\"- end read\")\n\treturn shim.Success(valAsbytes) //send it onward\n}", "title": "" }, { "docid": "bc1761c3f4d794e39aaf05287a7f4ee7", "score": "0.46517992", "text": "func (t *SimpleChaincode) read(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\tvar name, jsonResp string\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting name of the var to query\")\n\t}\n\n\tname = args[0]\n\tvalAsbytes, err := stub.GetState(name) //get the var from chaincode state\n\tif err != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + name + \"\\\"}\"\n\t\treturn nil, errors.New(jsonResp)\n\t}\n\n\treturn valAsbytes, nil\n}", "title": "" }, { "docid": "d2f42840d1fdc309e0cdddd9d486d257", "score": "0.46512064", "text": "func resourceAppRead(d *schema.ResourceData, meta interface{}) error {\n\tclient := meta.(*aptible.Client)\n\tappID := int64(d.Get(\"app_id\").(int))\n\n\tlog.Println(\"Getting App with ID: \" + strconv.Itoa(int(appID)))\n\n\tapp, err := client.GetApp(appID)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tif app.Deleted {\n\t\td.SetId(\"\")\n\t\treturn nil\n\t}\n\t_ = d.Set(\"app_id\", int(app.ID))\n\t_ = d.Set(\"git_repo\", app.GitRepo)\n\t_ = d.Set(\"handle\", app.Handle)\n\t_ = d.Set(\"env_id\", app.EnvironmentID)\n\t_ = d.Set(\"config\", app.Env)\n\n\tvar services = make([]map[string]interface{}, len(app.Services))\n\tfor i, s := range app.Services {\n\t\tservice := make(map[string]interface{})\n\t\tservice[\"container_count\"] = s.ContainerCount\n\t\tservice[\"container_memory_limit\"] = s.ContainerMemoryLimitMb\n\t\tservice[\"process_type\"] = s.ProcessType\n\t\tservices[i] = service\n\t}\n\tlog.Println(\"SETTING SERVICE \")\n\tlog.Println(services)\n\n\t_ = d.Set(\"service\", services)\n\n\treturn nil\n}", "title": "" }, { "docid": "d0a67a6be6b8e43dfc1d1897ef4e4b13", "score": "0.46441662", "text": "func (d *dataSourceARN) Read(ctx context.Context, request datasource.ReadRequest, response *datasource.ReadResponse) {\n\tvar data dataSourceARNData\n\n\tresponse.Diagnostics.Append(request.Config.Get(ctx, &data)...)\n\n\tif response.Diagnostics.HasError() {\n\t\treturn\n\t}\n\n\tarn := data.ARN.ValueARN()\n\n\tdata.Account = types.StringValue(arn.AccountID)\n\tdata.ID = types.StringValue(arn.String())\n\tdata.Partition = types.StringValue(arn.Partition)\n\tdata.Region = types.StringValue(arn.Region)\n\tdata.Resource = types.StringValue(arn.Resource)\n\tdata.Service = types.StringValue(arn.Service)\n\n\tresponse.Diagnostics.Append(response.State.Set(ctx, &data)...)\n}", "title": "" }, { "docid": "375c40774412a02adc21e3519b7b3a0d", "score": "0.46423593", "text": "func (m *_ListServicesRequest) GetCommand() uint16 {\n\treturn 0x0004\n}", "title": "" }, { "docid": "14aaad84332de19fa02595482cd68de6", "score": "0.46409398", "text": "func (s *adminWorkspaces) Read(ctx context.Context, workspaceID string) (*AdminWorkspace, error) {\n\tif !validStringID(&workspaceID) {\n\t\treturn nil, ErrInvalidWorkspaceValue\n\t}\n\n\tu := fmt.Sprintf(\"admin/workspaces/%s\", url.QueryEscape(workspaceID))\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taw := &AdminWorkspace{}\n\terr = req.Do(ctx, aw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn aw, nil\n}", "title": "" }, { "docid": "5a7c12345e944d566b7d02b96b0c44bf", "score": "0.46378204", "text": "func readSecret(client *api.Client, secretKey string) (string, error) {\n\t// Status Line to help with demo\n\tfmt.Println(\"### Reading Secret From Vault...\")\n\n\tkey := fmt.Sprintf(\"secret/%s\", secretKey)\n\n\tsecret, err := client.Logical().Read(key)\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\treturn fmt.Sprintf(\"Secret = %s\", secret.Data[\"value\"]), nil\n}", "title": "" }, { "docid": "a156bc9726f18c6c0612bd95a91af60d", "score": "0.46369052", "text": "func readModelForResource(resource string) Model {\n\twd := getWorkingDir()\n\n\tconfigFile, err := os.Open(filepath.Join(wd, \"functions\", resource, resource+\".json\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer configFile.Close()\n\n\tdata, err := ioutil.ReadAll(configFile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvar model Model\n\n\tjson.Unmarshal(data, &model)\n\n\treturn model\n}", "title": "" }, { "docid": "1f542d5137a1e800c2cfb4f8981bf96b", "score": "0.4627369", "text": "func (p *CLIFlagProvider) Read() (map[string]interface{}, error) {\n\tmp := make(map[string]interface{})\n\n\tsetFlags := make(map[string]bool)\n\tfor _, fn := range p.ctx.FlagNames() {\n\t\tsetFlags[fn] = true\n\t}\n\n\tfor _, flag := range p.ctx.Command.VisibleFlags() {\n\t\t// first name is the primary name\n\t\tname := flag.Names()[0]\n\n\t\t// set the flag value iff one of the two criteria are met:\n\t\t//\n\t\t// 1. The flag/config does not exist already in the config object.\n\t\t// 2. The flag/config does exist but was overridden by the CLI flag.\n\t\tif !p.konfig.Exists(name) || (p.konfig.Exists(name) && setFlags[name]) {\n\t\t\tmp[name] = p.ctx.Value(name)\n\t\t}\n\t}\n\n\treturn maps.Unflatten(mp, p.delim), nil\n}", "title": "" }, { "docid": "131b4661bc5939a5375e61eace325520", "score": "0.46239477", "text": "func (p *Parser) readCommandOutput(cmdName string, args ...string) (string, error) {\n\tcmd, err := p.processCommand(cmdName, args...)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tstdOutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", formatError(cmdName, args, err)\n\t}\n\n\treturn string(stdOutput), nil\n}", "title": "" }, { "docid": "44512dbd99879f8b25e28340bcf5db03", "score": "0.4622284", "text": "func (c *buildCtx) Read(data []byte) (n int, err error) {\n\tif c.err != nil {\n\t\treturn 0, err\n\t}\n\treturn c.r.Read(data)\n}", "title": "" }, { "docid": "de7723df74a2d36d495e1d0d997cf334", "score": "0.46210694", "text": "func getCommand(s *scope, args []pyObject) pyObject {\n\ttarget := getTargetPost(s, string(args[0].(pyString)))\n\tconfig := string(args[1].(pyString))\n\tif config != \"\" {\n\t\treturn pyString(target.GetCommandConfig(config))\n\t}\n\tif len(target.Commands) > 0 {\n\t\tcommands := pyDict{}\n\t\tfor config, cmd := range target.Commands {\n\t\t\tcommands[config] = pyString(cmd)\n\t\t}\n\t\treturn commands\n\t}\n\treturn pyString(target.Command)\n}", "title": "" }, { "docid": "abfe5eebd03252e3dd68d4affb88ea53", "score": "0.46184865", "text": "func (c *noop) Read(_ context.Context, _ *Key, _ interface{}) error {\n\tif c.isStopped() {\n\t\treturn ErrStopped\n\t}\n\treturn ErrNotFound\n}", "title": "" }, { "docid": "79191909668327b6a63eb5daad11156b", "score": "0.4616919", "text": "func (g *Generator) ReadFlags(command *cobra.Command) error {\n\tvar err error\n\n\tflags := command.Flags()\n\n\tif g.options.Output, err = flags.GetString(base.Output); err != nil {\n\t\treturn err\n\t}\n\n\tif g.options.MFDPath, err = flags.GetString(mfdFlag); err != nil {\n\t\treturn err\n\t}\n\n\tif g.options.ModelPackage, err = flags.GetString(modelPkgFlag); err != nil {\n\t\treturn err\n\t}\n\n\tif g.options.EmbedLogPackage, err = flags.GetString(embedLogFlag); err != nil {\n\t\treturn err\n\t}\n\n\tif g.options.EmbedLogPackage == \"\" {\n\t\tg.options.EmbedLogPackage = strings.TrimSuffix(g.options.ModelPackage, path.Base(g.options.ModelPackage)) + \"embedlog\"\n\t}\n\n\tif g.options.Package, err = flags.GetString(pkgFlag); err != nil {\n\t\treturn err\n\t}\n\n\tif g.options.Namespaces, err = flags.GetStringSlice(nsFlag); err != nil {\n\t\treturn err\n\t}\n\n\tif g.options.Package == \"\" {\n\t\tg.options.Package = path.Base(g.options.Output)\n\t}\n\n\tif g.options.ModelTemplatePath, err = flags.GetString(modelTemplateFlag); err != nil {\n\t\treturn err\n\t}\n\tif g.options.ConverterTemplatePath, err = flags.GetString(converterTemplateFlag); err != nil {\n\t\treturn err\n\t}\n\tif g.options.ServiceTemplatePath, err = flags.GetString(serviceTemplateFlag); err != nil {\n\t\treturn err\n\t}\n\tif g.options.ServerTemplatePath, err = flags.GetString(serverTemplateFlag); err != nil {\n\t\treturn err\n\t}\n\n\tg.options.Def()\n\n\treturn nil\n}", "title": "" }, { "docid": "440bd560d6eedbb8618d58d73ddedcbf", "score": "0.46164685", "text": "func getCommand(cmd *cobra.Command, args []string) error {\n\tif len(args) != 1 {\n\t\treturn fmt.Errorf(\"exactly one positional argument is required\")\n\t}\n\tcfg, err := getCommandConfig(cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar tmpl *template.Template\n\tif cmd.Flags().Changed(\"output\") {\n\t\tvar output string\n\t\toutput, _ = cmd.Flags().GetString(\"output\")\n\t\ttmpl, err = template.New(\"test\").Parse(output)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\tservice := cfg.Services[args[0]]\n\td, err := details.GetServiceDetails(cfg, service)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tos.Exit(1)\n\t}\n\tif tmpl != nil {\n\t\terr = tmpl.Execute(os.Stdout, d)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t} else {\n\t\toutput := util.FormatTable([][]string{\n\t\t\t{\"NAME\", \"HOSTNAME\", \"CLUSTER-IP\"},\n\t\t\t{d.Name, d.Hostname, d.ClusterIP},\n\t\t})\n\t\tfmt.Println(output)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "64640873835569593a27df064c6596b8", "score": "0.4612974", "text": "func NewResourceCmd(use, short, long string, aliases ...string) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: use,\n\t\tShort: short,\n\t\tLong: long,\n\t\tAliases: aliases,\n\t\tRun: func(cmd *cobra.Command, _ []string) {\n\t\t\tif err := cmd.Help(); err != nil {\n\t\t\t\tlogger.Debug(\"ignoring error %q\", err.Error())\n\t\t\t}\n\t\t},\n\t}\n}", "title": "" }, { "docid": "9b137f9e0a13361fa27e5a4361dc1aab", "score": "0.46102712", "text": "func getText(command, item string) string {\n\tvar path string\n\n\thome := os.Getenv(\"HOME\")\n\n\tif command == \"license\" {\n\t\tpath = home + HOMEDIR + LCNS + item\n\t}\n\n\tif command == \"header\" {\n\t\tpath = home + HOMEDIR + HDRS + item\n\t}\n\n\ttext, err := ioutil.ReadFile(path)\n\terrFatal(err)\n\n\treturn string(text)\n}", "title": "" } ]
f95a916342484ece0aefbbc2a650eb8e
GetOperationalState returns the OperationalState field value if set, zero value otherwise.
[ { "docid": "7cb566c431d1dffba82a06cc75c8c4ff", "score": "0.79685545", "text": "func (o *NiatelemetryLc) GetOperationalState() string {\n\tif o == nil || o.OperationalState == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.OperationalState\n}", "title": "" } ]
[ { "docid": "a29f4c31165bcea5b7907a4e485e0625", "score": "0.7120702", "text": "func (t *OpenconfigPlatform_Components_Component_OpticalChannel_State) GetOperationalMode() uint16 {\n\tif t == nil || t.OperationalMode == nil {\n\t\treturn 0\n\t}\n\treturn *t.OperationalMode\n}", "title": "" }, { "docid": "16a8a9df24a55777b948792622d16165", "score": "0.7104667", "text": "func (o *NiatelemetryLc) SetOperationalState(v string) {\n\to.OperationalState = &v\n}", "title": "" }, { "docid": "0e77120341306dd127a01a08698b898b", "score": "0.69167316", "text": "func (o *EquipmentPsuAllOf) GetOperState() string {\n\tif o == nil || o.OperState == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.OperState\n}", "title": "" }, { "docid": "1c952504c33c729f18252912888c6164", "score": "0.6910382", "text": "func (o *NiatelemetryLc) HasOperationalState() bool {\n\tif o != nil && o.OperationalState != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2bb0fb7d85830806179e400fc2ea16cb", "score": "0.68801016", "text": "func (o *NiatelemetryLc) GetOperationalStateOk() (*string, bool) {\n\tif o == nil || o.OperationalState == nil {\n\t\treturn nil, false\n\t}\n\treturn o.OperationalState, true\n}", "title": "" }, { "docid": "4b6d689a764a407b3207398dfeb95d51", "score": "0.6845665", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_State) GetOperStatus() E_OpenconfigInterfaces_Interfaces_Interface_State_OperStatus {\n\tif t == nil || t.OperStatus == 0 {\n\t\treturn 0\n\t}\n\treturn t.OperStatus\n}", "title": "" }, { "docid": "017d539731d04cf55808017b280ef5e4", "score": "0.67409563", "text": "func (o *ApplianceSystemInfo) GetOperationalStatus() string {\n\tif o == nil || o.OperationalStatus == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.OperationalStatus\n}", "title": "" }, { "docid": "c28c91d715a9ad3f9e46db86bda53e64", "score": "0.66777086", "text": "func (o *StorageItemAllOf) GetOperState() string {\n\tif o == nil || o.OperState == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.OperState\n}", "title": "" }, { "docid": "58118505227905e3e7a4e11572514600", "score": "0.6665107", "text": "func (t *OpenconfigPlatform_Components_Component_State) GetOperStatus() E_OpenconfigPlatformTypes_COMPONENT_OPER_STATUS {\n\tif t == nil || t.OperStatus == 0 {\n\t\treturn 0\n\t}\n\treturn t.OperStatus\n}", "title": "" }, { "docid": "a31a1218fa4b0690ef5f240afb2a48ed", "score": "0.65951145", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_State) GetOperStatus() E_OpenconfigInterfaces_Interfaces_Interface_State_OperStatus {\n\tif t == nil || t.OperStatus == 0 {\n\t\treturn 0\n\t}\n\treturn t.OperStatus\n}", "title": "" }, { "docid": "ed7badeb95eff56ed04b6f5f28b346da", "score": "0.6497854", "text": "func (o *EquipmentFan) GetOperState() string {\n\tif o == nil || o.OperState == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.OperState\n}", "title": "" }, { "docid": "14fa84ff7ffd4d3be10fe8cc085304d5", "score": "0.6202312", "text": "func (t *OpenconfigPlatform_Components_Component_OpticalChannel_Config) GetOperationalMode() uint16 {\n\tif t == nil || t.OperationalMode == nil {\n\t\treturn 0\n\t}\n\treturn *t.OperationalMode\n}", "title": "" }, { "docid": "6019ce931725aa466e6b645d1e1b4e41", "score": "0.6100926", "text": "func (o *EquipmentPsuAllOf) GetOperStateOk() (*string, bool) {\n\tif o == nil || o.OperState == nil {\n\t\treturn nil, false\n\t}\n\treturn o.OperState, true\n}", "title": "" }, { "docid": "83f999b576307f1a3125c8a70a130791", "score": "0.6045959", "text": "func (s ConnectionState) IsOperational() bool {\n\treturn strings.HasPrefix(string(s), \"Operational\")\n}", "title": "" }, { "docid": "97936c9234ec86c9f3c1ed6ae743c4b8", "score": "0.6021861", "text": "func (o *StorageItemAllOf) GetOperStateOk() (*string, bool) {\n\tif o == nil || o.OperState == nil {\n\t\treturn nil, false\n\t}\n\treturn o.OperState, true\n}", "title": "" }, { "docid": "92997a3f8e2435c90ec7cef3ec5cdb63", "score": "0.5898507", "text": "func (o *EquipmentFan) GetOperStateOk() (*string, bool) {\n\tif o == nil || o.OperState == nil {\n\t\treturn nil, false\n\t}\n\treturn o.OperState, true\n}", "title": "" }, { "docid": "feb50a7f9490819cc70ad00b460c013c", "score": "0.5875866", "text": "func (o *ApplianceSystemInfo) SetOperationalStatus(v string) {\n\to.OperationalStatus = &v\n}", "title": "" }, { "docid": "610eaf87a56bd2df050fd24d8cb22561", "score": "0.5864553", "text": "func (o *EquipmentPsuAllOf) HasOperState() bool {\n\tif o != nil && o.OperState != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d10926801c237f8b06a301f1d37f9af0", "score": "0.5829738", "text": "func (o *EquipmentPsuAllOf) SetOperState(v string) {\n\to.OperState = &v\n}", "title": "" }, { "docid": "e0893900b66de632941db7566c83533a", "score": "0.581496", "text": "func (o *StorageNetAppAggregateAllOf) GetState() string {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "a2a607fa67b112ea4f866cb26ab1c9d0", "score": "0.58117455", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_State) GetLogical() bool {\n\tif t == nil || t.Logical == nil {\n\t\treturn false\n\t}\n\treturn *t.Logical\n}", "title": "" }, { "docid": "d55a41b8d09a1773eb15bead9acb07c8", "score": "0.58000594", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_State) GetLogical() bool {\n\tif t == nil || t.Logical == nil {\n\t\treturn false\n\t}\n\treturn *t.Logical\n}", "title": "" }, { "docid": "e614ed85e407fa90dc3e19c9a6d2cd96", "score": "0.5762274", "text": "func (t *OpenconfigSystem_System) GetState() *OpenconfigSystem_System_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "38e1c73051bf8f6df5ad7865f0754775", "score": "0.5705811", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Ethernet) GetState() *OpenconfigInterfaces_Interfaces_Interface_Ethernet_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f6157279c4634d675fee0770baa464d", "score": "0.56278193", "text": "func (o *StorageItemAllOf) HasOperState() bool {\n\tif o != nil && o.OperState != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f1bead68513c96f90cb119a520b83987", "score": "0.5610716", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice) GetOperationalModes() *OpenconfigTerminalDevice_TerminalDevice_OperationalModes {\n\tif t != nil && t.OperationalModes != nil {\n\t\treturn t.OperationalModes\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70c4be79289605dd9175a73fe2e0f17f", "score": "0.56074905", "text": "func (m *DomainState) GetOperation()(*string) {\n return m.operation\n}", "title": "" }, { "docid": "069e3c263d30a8a61e227fed90f7a455", "score": "0.5605471", "text": "func (o *StorageItemAllOf) SetOperState(v string) {\n\to.OperState = &v\n}", "title": "" }, { "docid": "cd02fc90302dc024fe4a21964e1995e0", "score": "0.5596084", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice_OperationalModes_Mode) GetState() *OpenconfigTerminalDevice_TerminalDevice_OperationalModes_Mode_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b82a3b18e8b10e2ed5be975aa957af6", "score": "0.5589019", "text": "func (o *MicrosoftGraphManagedAppOperation) GetState() string {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "1abd7b47ff1947a57349c1f7e523e269", "score": "0.55608946", "text": "func (o *EquipmentFan) HasOperState() bool {\n\tif o != nil && o.OperState != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "84b6f29d9d251d6fb896a7a54d038c7b", "score": "0.5553276", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet) GetState() *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1e140d26edda2a11ae5c1cc2e928c030", "score": "0.5539276", "text": "func (o *DecommissionOperationResponse) GetState() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.State\n}", "title": "" }, { "docid": "e9b584b0f4304c8c5619b37b581bb079", "score": "0.5537741", "text": "func (t *OpenconfigSystem_System_TelnetServer) GetState() *OpenconfigSystem_System_TelnetServer_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "143c3ab2eaa5a203558cd854c73a502d", "score": "0.55183893", "text": "func (o *EquipmentFan) SetOperState(v string) {\n\to.OperState = &v\n}", "title": "" }, { "docid": "867851196c42dd0e1858d7296618c409", "score": "0.55023384", "text": "func (t *OpenconfigSystem_System_Ntp) GetState() *OpenconfigSystem_System_Ntp_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7c72ca6f5b0b1668b20e2ee959e4c92c", "score": "0.54483604", "text": "func (o *User) GetState() int32 {\n\tif o == nil || o.State == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "3a26c1312b515acbf606dd5c60e0096f", "score": "0.54382205", "text": "func (t *OpenconfigSystem_System_Cpus_Cpu) GetState() *OpenconfigSystem_System_Cpus_Cpu_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e275822c2319f75ad2d5dae60de8a0ed", "score": "0.54335046", "text": "func (t *OpenconfigSystem_System_Aaa_ServerGroups_ServerGroup_Servers_Server_Radius) GetState() *OpenconfigSystem_System_Aaa_ServerGroups_ServerGroup_Servers_Server_Radius_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f0e116af529524311041d5392d0ca78", "score": "0.539442", "text": "func (o *ApplianceSystemInfo) HasOperationalStatus() bool {\n\tif o != nil && o.OperationalStatus != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2b28bba624d24705aaaad34a50ca00be", "score": "0.53925145", "text": "func (t *OpenconfigSystem_System_Aaa_Authentication) GetState() *OpenconfigSystem_System_Aaa_Authentication_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f155ac167c0de14e380709ebafdd77c", "score": "0.5363558", "text": "func (o *MicrosoftGraphManagedAppOperation) GetStateOk() (string, bool) {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.State, true\n}", "title": "" }, { "docid": "89b683c0158abf3814b37a6ec53f3ab5", "score": "0.5357182", "text": "func (t *OpenconfigPlatform_Components_Component_OpticalChannel) GetState() *OpenconfigPlatform_Components_Component_OpticalChannel_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0df91d71a6d2c56f1a9a3f69c958b474", "score": "0.53329355", "text": "func (o *StorageNetAppAggregateAllOf) GetStateOk() (*string, bool) {\n\tif o == nil || o.State == nil {\n\t\treturn nil, false\n\t}\n\treturn o.State, true\n}", "title": "" }, { "docid": "c78ebba59bed958d32b365d0fff426b1", "score": "0.5329306", "text": "func (t *OpenconfigSystem_System_Clock) GetState() *OpenconfigSystem_System_Clock_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b932e9164e96a3ec83ee28e6395241b3", "score": "0.53227174", "text": "func (o *DecommissionOperationResponse) GetStateOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.State, true\n}", "title": "" }, { "docid": "7ec325039be4841f5ee15aec44b24f92", "score": "0.53071946", "text": "func (t *OpenconfigSystem_System_Dns) GetState() *OpenconfigSystem_System_Dns_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "73a90c3c088879e59b74866ed932a7b2", "score": "0.53060156", "text": "func (t *OpenconfigLldp_Lldp_Interfaces_Interface) GetState() *OpenconfigLldp_Lldp_Interfaces_Interface_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "64b177b708c53cd0e6cfa56bf719a5ac", "score": "0.52804434", "text": "func (g *Group) GetState() error {\n\treturn errors.New(\"Group.GetState() has not been implemented yet.\")\n}", "title": "" }, { "docid": "07064b2673f2bf1f56d922b75dbbb551", "score": "0.52487856", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Otn) GetState() *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Otn_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "193f55da7335f5f25008918af50d1fa3", "score": "0.52232856", "text": "func (t *OpenconfigPlatform_Components_Component_Cpu) GetState() *OpenconfigPlatform_Components_Component_Cpu_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6483a04999b824dcdfbd3cc7ee814fc1", "score": "0.5215453", "text": "func (t *OpenconfigPlatform_Components_Component_Properties_Property) GetState() *OpenconfigPlatform_Components_Component_Properties_Property_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "371a506b49a26221bf9bd457bd106a0e", "score": "0.5207194", "text": "func (o *UpgradeSSTablesOperationResponse) GetState() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.State\n}", "title": "" }, { "docid": "ad9498664589ef2cbd26a65bf9f933f1", "score": "0.52066547", "text": "func (o *ApplianceSystemInfo) GetOperationalStatusOk() (*string, bool) {\n\tif o == nil || o.OperationalStatus == nil {\n\t\treturn nil, false\n\t}\n\treturn o.OperationalStatus, true\n}", "title": "" }, { "docid": "bc892a6e064ab14e41d1232edca70902", "score": "0.51858675", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface) GetState() *OpenconfigInterfaces_Interfaces_Interface_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cddcb04a940632b8ce4265e0803c7c9b", "score": "0.5180444", "text": "func (t *OpenconfigSystem_System_Aaa_Accounting) GetState() *OpenconfigSystem_System_Aaa_Accounting_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "da6215bd45484cb5f371933858da8102", "score": "0.51699746", "text": "func (o *StorageNetAppLun) GetState() string {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "833f991a708cf44b87ef959ea0f30822", "score": "0.5163135", "text": "func (o *NatService) GetState() string {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "69082743d6e9409d3a66e1143a3c5f76", "score": "0.51569974", "text": "func (o *StorageNetAppVolume) GetState() string {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "7df98da1e0cee8b250e92a6125f80f0e", "score": "0.5154601", "text": "func (t *OpenconfigSystem_System_Aaa) GetState() *OpenconfigSystem_System_Aaa_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5adf13925df02d5c85cd1054486c8ff6", "score": "0.5152384", "text": "func (o *DeviceEnrollmentWindowsHelloForBusinessConfiguration) GetState() AnyOfmicrosoftGraphEnablement {\n\tif o == nil || o.State == nil {\n\t\tvar ret AnyOfmicrosoftGraphEnablement\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "f01dfac0acf32c549152a640d40347eb", "score": "0.5152292", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Ethernet) GetOrCreateState() *OpenconfigInterfaces_Interfaces_Interface_Ethernet_State {\n\tif t.State != nil {\n\t\treturn t.State\n\t}\n\tt.State = &OpenconfigInterfaces_Interfaces_Interface_Ethernet_State{}\n\treturn t.State\n}", "title": "" }, { "docid": "49c761b1dfc57a8fcb54db98f0f18416", "score": "0.5139482", "text": "func (t *OpenconfigLldp_Lldp) GetState() *OpenconfigLldp_Lldp_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "82cd165a4147e0dfa208b98d24271f54", "score": "0.5137958", "text": "func (o *NatService) GetStateOk() (string, bool) {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.State, true\n}", "title": "" }, { "docid": "71e0eec7ffe8a2ce49ebebdd1602ca60", "score": "0.51320547", "text": "func (m BaseModule) GetState() int {\n\treturn 0\n}", "title": "" }, { "docid": "64b6604cb7a02047b2a317b159ece4a7", "score": "0.512074", "text": "func (o *Organization) GetState() string {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "e440af81a39a535c19e49122910db0c5", "score": "0.5119635", "text": "func (t *OpenconfigSystem_System_GrpcServer) GetState() *OpenconfigSystem_System_GrpcServer_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c531ae7c36f6a2f1202d149cd32f0bcd", "score": "0.5106225", "text": "func (o *NetAccessPoint) GetState() string {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "8a878fa810b06b878e02cfdc7cea9383", "score": "0.5091749", "text": "func (o *ScrubOperationResponse) GetState() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.State\n}", "title": "" }, { "docid": "ce0cd99f5fcb1532e44922987089c835", "score": "0.5085905", "text": "func (t *OpenconfigSystem_System_Aaa_Authentication_Users_User) GetState() *OpenconfigSystem_System_Aaa_Authentication_Users_User_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "466c0195ce0cff77bfa9de872d864514", "score": "0.5080869", "text": "func (t *OpenconfigSystem_System_Ntp_NtpKeys_NtpKey) GetState() *OpenconfigSystem_System_Ntp_NtpKeys_NtpKey_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8314cfd3577ea374ae47223695a2fac1", "score": "0.5070409", "text": "func (c *Concierge) State() (svc.State, error) {\n\tservice, err := c.fetchService()\n\tif err != nil {\n\t\treturn svc.State(windows.SERVICE_NO_CHANGE), errors.Wrap(err, \"error opening the service\")\n\t}\n\tdefer service.Close()\n\n\tstatus, err := service.Query()\n\tif err != nil {\n\t\treturn svc.State(windows.SERVICE_NO_CHANGE), errors.Wrap(err, \"error querying the service\")\n\t}\n\treturn status.State, nil\n}", "title": "" }, { "docid": "2aba1717d5a3cbbd7a8db38bf21927b5", "score": "0.5062422", "text": "func (e *Endpoint) GetState() State {\n\te.unconditionalRLock()\n\tdefer e.runlock()\n\treturn e.getState()\n}", "title": "" }, { "docid": "3c2a22d3ddd0acd4cb947064364b2b60", "score": "0.50610137", "text": "func (t *OpenconfigSystem_System_Dns_Servers_Server) GetState() *OpenconfigSystem_System_Dns_Servers_Server_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "63b1dfad557cca4ae55da3be40020e1e", "score": "0.5054608", "text": "func (t *OpenconfigSystem_System_Ntp_Servers_Server) GetState() *OpenconfigSystem_System_Ntp_Servers_Server_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6554cae7b8095f254b0979f04a23ef6f", "score": "0.50527894", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet) GetOrCreateState() *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_State {\n\tif t.State != nil {\n\t\treturn t.State\n\t}\n\tt.State = &OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_State{}\n\treturn t.State\n}", "title": "" }, { "docid": "1ea22ebbff9ea51f2aefab802dc316a4", "score": "0.5051826", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp) GetState() *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ea754f959b1ee7a6bd9505fb80cd8f3d", "score": "0.5050903", "text": "func (o *User) GetState() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.State\n}", "title": "" }, { "docid": "7bbc6e944924927d178bceee2a8cfdfa", "score": "0.5040962", "text": "func (o *StatusDynamoDb) GetState() string {\n\tif o == nil || IsNil(o.State) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "6fa337f09679667360322ebdf27cd7a7", "score": "0.50408757", "text": "func (t *OpenconfigSystem_System_Aaa_Authorization) GetState() *OpenconfigSystem_System_Aaa_Authorization_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ddbf64e34403ddaab174214de1b4687a", "score": "0.5028909", "text": "func (t *OpenconfigSystem_System) GetOrCreateState() *OpenconfigSystem_System_State {\n\tif t.State != nil {\n\t\treturn t.State\n\t}\n\tt.State = &OpenconfigSystem_System_State{}\n\treturn t.State\n}", "title": "" }, { "docid": "44ee732d4a9828550bb85c5710ed5299", "score": "0.50267094", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice) GetOrCreateOperationalModes() *OpenconfigTerminalDevice_TerminalDevice_OperationalModes {\n\tif t.OperationalModes != nil {\n\t\treturn t.OperationalModes\n\t}\n\tt.OperationalModes = &OpenconfigTerminalDevice_TerminalDevice_OperationalModes{}\n\treturn t.OperationalModes\n}", "title": "" }, { "docid": "fb570f8840a911bd7bda119f52f789a8", "score": "0.50223285", "text": "func (t *OpenconfigSystem_System_Aaa_Authentication) GetOrCreateState() *OpenconfigSystem_System_Aaa_Authentication_State {\n\tif t.State != nil {\n\t\treturn t.State\n\t}\n\tt.State = &OpenconfigSystem_System_Aaa_Authentication_State{}\n\treturn t.State\n}", "title": "" }, { "docid": "9ff77915482034fd4461cd3b0bb59300", "score": "0.5017188", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface) GetState() *OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9c1fcce744b59073f333677db5897c8f", "score": "0.5012491", "text": "func State() (StateEnum, error) {\n\tnm, err := System()\n\tif err != nil {\n\t\treturn StateUnknown, err\n\t}\n\treturn nm.State()\n}", "title": "" }, { "docid": "c3f94554b402272466fff388ef6cfa73", "score": "0.5012431", "text": "func (t *OpenconfigSystem_System_Aaa_ServerGroups_ServerGroup_Servers_Server) GetState() *OpenconfigSystem_System_Aaa_ServerGroups_ServerGroup_Servers_Server_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a6970a03f747eefcd7f442b4dafe9cfb", "score": "0.5005087", "text": "func DataPolicyOperationStatusPRunning() *DataPolicyOperationStatus {\n\tv := DataPolicyOperationStatusVRunning\n\treturn &v\n}", "title": "" }, { "docid": "fc1e8f0119439a023e4572291b4521af", "score": "0.5001153", "text": "func (o *StatusDynamoDb) GetStateOk() (*string, bool) {\n\tif o == nil || IsNil(o.State) {\n\t\treturn nil, false\n\t}\n\treturn o.State, true\n}", "title": "" }, { "docid": "3f7ad030531e1a5fda9e4bc488743312", "score": "0.4998474", "text": "func (o *Organization) GetStateOk() (string, bool) {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.State, true\n}", "title": "" }, { "docid": "d877a7013184e84f65295a7c0af125f9", "score": "0.49941173", "text": "func (t *OpenconfigSystem_System_Aaa_Authorization_Events_Event) GetState() *OpenconfigSystem_System_Aaa_Authorization_Events_Event_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "13283b8040ec99bb064e7a40562a1305", "score": "0.49905446", "text": "func (s *UpdateOpsItemInput) SetOperationalData(v map[string]*OpsItemDataValue) *UpdateOpsItemInput {\n\ts.OperationalData = v\n\treturn s\n}", "title": "" }, { "docid": "1c57dcd10ae2c63bd71c7c5ecc059f08", "score": "0.4989192", "text": "func (t *OpenconfigPlatform_Components_Component_Storage) GetState() *OpenconfigPlatform_Components_Component_Storage_State {\n\tif t != nil && t.State != nil {\n\t\treturn t.State\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b66316dcb3d82fc833b099a7e7f6ecf", "score": "0.4976446", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice_OperationalModes_Mode) GetOrCreateState() *OpenconfigTerminalDevice_TerminalDevice_OperationalModes_Mode_State {\n\tif t.State != nil {\n\t\treturn t.State\n\t}\n\tt.State = &OpenconfigTerminalDevice_TerminalDevice_OperationalModes_Mode_State{}\n\treturn t.State\n}", "title": "" }, { "docid": "fafc68015cf63a96dc50022c53192a93", "score": "0.49675933", "text": "func (domain *NetworkDomain) GetState() string {\n\treturn domain.State\n}", "title": "" }, { "docid": "c66344f6c0c965edfc8bda890a82b114", "score": "0.49674767", "text": "func (o *MicrosoftGraphManagedAppOperation) HasState() bool {\n\tif o != nil && o.State != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "91485adb536e6e6fdeff55eec8a940cd", "score": "0.4948562", "text": "func (o *HyperflexDiskStatus) GetState() string {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.State\n}", "title": "" }, { "docid": "c6cd95343a466493b8a03dac63cafadf", "score": "0.49432987", "text": "func (b *Boomer) GetState() int32 {\n\tswitch b.mode {\n\tcase DistributedWorkerMode:\n\t\treturn b.workerRunner.getState()\n\tcase DistributedMasterMode:\n\t\treturn b.masterRunner.getState()\n\tdefault:\n\t\treturn b.localRunner.getState()\n\t}\n}", "title": "" }, { "docid": "1747401328451796747bff1071f78dd9", "score": "0.49424306", "text": "func (o *ScrubOperationResponse) GetStateOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.State, true\n}", "title": "" }, { "docid": "d6ada898a928d157de5d3e89d0d04c0b", "score": "0.49389458", "text": "func (instance *Subnet) GetState() (state subnetstate.Enum, xerr fail.Error) {\n\tdefer fail.OnPanic(&xerr)\n\n\tif instance == nil || instance.IsNull() {\n\t\treturn subnetstate.Unknown, fail.InvalidInstanceError()\n\t}\n\n\tinstance.lock.RLock()\n\tdefer instance.lock.RUnlock()\n\n\treturn instance.unsafeGetState()\n}", "title": "" }, { "docid": "e1dee75a2ab9ea9ba27f4af4f95e5ee5", "score": "0.49381927", "text": "func (b Breaker) GetState() State {\n\tswitch {\n\tcase (b.failCount >= b.Threshold) && (time.Since(b.lastFailedAt) > b.ResetTimeout):\n\t\treturn HalfOpen\n\tcase b.failCount >= b.Threshold:\n\t\treturn Open\n\tdefault:\n\t\treturn Closed\n\t}\n}", "title": "" } ]
3c37c1a055c8ae6bf2957b2310ffabfe
ContributingCellCounts returns a map of upslope TEC count for every TEC in TEM
[ { "docid": "d1c789e548ccf657a23a4c06660e20b1", "score": "0.7849206", "text": "func (t *TEM) ContributingCellCounts() map[int]int {\n\tmcnt := make(map[int]int, len(t.TEC))\n\tvar climbRecurs func(int) int\n\tfor _, rt := range t.Outlets() {\n\t\tclimbRecurs = func(cid int) int {\n\t\t\tmcnt[cid] = 1\n\t\t\tif us, ok := t.USlp[cid]; ok {\n\t\t\t\tfor _, p := range us {\n\t\t\t\t\tif _, ok := mcnt[p]; ok {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tmcnt[cid] += climbRecurs(p)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn mcnt[cid]\n\t\t}\n\t\tclimbRecurs(rt)\n\t}\n\treturn mcnt\n}", "title": "" } ]
[ { "docid": "3830233a11fc4a65d3a5ec2ad6599670", "score": "0.70354676", "text": "func (t *TEM) ContributingCellMap(cid0 int) map[int]int {\n\to, m := t.DownslopeContributingAreaIDs(cid0)\n\tmcnt := make(map[int]int, len(o))\n\tfor _, c := range o {\n\t\tmcnt[c] = 1\n\t}\n\tfor _, c := range o {\n\t\tif v, ok := m[c]; ok { // outlet/farfield cells would not be included here\n\t\t\tif v > -1 {\n\t\t\t\tmcnt[v] += mcnt[c]\n\t\t\t}\n\t\t}\n\t}\n\treturn mcnt\n}", "title": "" }, { "docid": "00ae7f14eb12690ea4a5cbd2e4d13997", "score": "0.5224472", "text": "func (s *seatMap) countOccupiedNeighbors(row, col int) int {\n\ttotal := 0\n\trFrom := max(0, row-1)\n\trTo := min(row+2, len(s.rows))\n\tcFrom := max(0, col-1)\n\tcTo := min(col+2, len(s.rows[0]))\n\tfor r := rFrom; r < rTo; r++ {\n\t\tfor c := cFrom; c < cTo; c++ {\n\t\t\tif r == row && c == col {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(s.rows[r]) == 0 {\n\t\t\t\tfmt.Printf(\"r=%d, c=%d, rows[r]:%v\\n\", r, c, s.rows[r])\n\t\t\t}\n\t\t\tif s.rows[r][c] == '#' {\n\t\t\t\ttotal++\n\t\t\t}\n\t\t}\n\t}\n\treturn total\n}", "title": "" }, { "docid": "5ae3cdae6d72cafa40735fcd50eacf0a", "score": "0.5195869", "text": "func (s *seatMap) countOccupied() int {\n\ttotal := 0\n\tfor _, row := range s.rows {\n\t\tfor _, c := range row {\n\t\t\tif c == '#' {\n\t\t\t\ttotal++\n\t\t\t}\n\t\t}\n\t}\n\treturn total\n}", "title": "" }, { "docid": "33909dc35682352053d68d46cbdb47f0", "score": "0.5194709", "text": "func (b *Block) ComputeTxnMap() {\n\tb.mutexTxns.Lock()\n\tdefer b.mutexTxns.Unlock()\n\tb.TxnsMap = make(map[string]bool, len(b.Txns))\n\tfor _, txn := range b.Txns {\n\t\tb.TxnsMap[txn.Hash] = true\n\t}\n}", "title": "" }, { "docid": "a308d2f3f7eef3abe9eae04aacc0b5aa", "score": "0.5165484", "text": "func CountUtaskPerProject(taskTraces []TaskTrace) map[string]int {\n\n\tcountMap := make(map[string]int)\n\n\t// step 1 - make a list of unique project names\n\tprojList := getUniqueProjects(taskTraces)\n\tif projList == nil {\n\t\treturn nil\n\t}\n\n\t// step 2 - get the counts\n\tfor _, proj := range projList {\n\n\t\tcount := 0\n\t\tfor _, trace := range taskTraces {\n\t\t\tif proj == trace.T.ProjectName {\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\n\t\tcountMap[proj] = count\n\n\t}\n\n\treturn countMap\n\n}", "title": "" }, { "docid": "5969e9b97d4b6cd118727271e5ab8845", "score": "0.51557136", "text": "func (m *NestedCMap) Count() int {\n\treturn m._cmap.Count()\n}", "title": "" }, { "docid": "5e70ba6276d7dd239fa3b2019beb0ed2", "score": "0.51404244", "text": "func CountOccupied(cb Chessboard) int {\n\tc := 0\n\tfor _, f := range cb {\n\t\tfor _, s := range f {\n\t\t\tif s {\n\t\t\t\tc++\n\t\t\t}\n\t\t}\n\t}\n\treturn c\n}", "title": "" }, { "docid": "d84703809df40b5bd21ede5c9180b41c", "score": "0.513792", "text": "func (e *Evaluator) GetFeatureOccurrences() map[uint]uint {\n occurrences := make(map[uint]uint)\n featureNumbers := e.GetUsedFeatureNumbers(false)\n for _, featureNumber := range featureNumbers {\n occurrences[featureNumber]++\n }\n return occurrences\n}", "title": "" }, { "docid": "b9e4efdc2bda1ed876d8c8d06dc7ecb1", "score": "0.5115687", "text": "func ComputeBranchFactors(src string) map[string]uint {\n\tfset := token.NewFileSet()\n\tf, err := parser.ParseFile(fset, \"src.go\", src, 0)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tm := make(map[string]uint)\n\tfor _, decl := range f.Decls {\n\t\tswitch fn := decl.(type) {\n\t\tcase *ast.FuncDecl:\n\t\t\tm[fn.Name.Name] = branchCount(fn)\n\t\t}\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "851ff87fb61eb4db44a82dc86669c8a0", "score": "0.51034063", "text": "func CountOccupied(cb Chessboard) (ret int) {\n\tfor _, rank := range cb {\n\t\tfor _, square := range rank {\n\t\t\tif square {\n\t\t\t\tret += 1\n\t\t\t}\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "91ed6b095fa0674c59aea908ec8fac72", "score": "0.51021755", "text": "func countAllOccupied(seatMap []string) int {\n\tvar count int\n\n\tfor _, line := range seatMap {\n\t\tfor _, token := range line {\n\t\t\tif token == '#' {\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t}\n\n\treturn count\n}", "title": "" }, { "docid": "078c6457074747d84a73625540c4fe23", "score": "0.5078663", "text": "func (c *SudokuCell) initTaken() {\n\ttaken := make(map[int]int)\n\n\tfor _, neighbour := range c.neighbours.All {\n\t\tif neighbour.value > 0 {\n\t\t\toccurrences, ok := taken[neighbour.value]\n\n\t\t\tif ok {\n\t\t\t\ttaken[neighbour.value] = occurrences + 1 // Increment occurrences\n\t\t\t} else {\n\t\t\t\ttaken[neighbour.value] = 1 // Initialize occurrences\n\t\t\t}\n\t\t}\n\t}\n\n\tc.taken = taken\n}", "title": "" }, { "docid": "231766fb9431be368eac1fa810395fc7", "score": "0.50620157", "text": "func convertCountMap(nums[] int) map[int]int {\n\tm1 := make(map[int]int)\n\tfor i := range nums {\n\t\tv := nums[i]\n\t\tm1[v] ++\n\t}\n\treturn m1\n}", "title": "" }, { "docid": "e23a98100c699e35dd324ff3772e65b6", "score": "0.5049696", "text": "func (n NUMANodes) CpusOnNUMA(cellID int) ([]int, error) {\n\tfor _, node := range n {\n\t\tif node.CellID == cellID {\n\t\t\treturn node.CPUs, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"NUMA %d not found\", cellID)\n}", "title": "" }, { "docid": "443c6015feefec1393c0db827d5e80f5", "score": "0.5026803", "text": "func (abhr *AbstHier) GetNodeCounts(gl GraphLevel) (b_nodes int, b_members int, w_nodes int, w_members int, u_nodes int, u_members int) {\n\tvar color uint16\n\tvar count int\n\tvar memCount int\n\tCountNode := func(g *Graph, nl NodeLoc) {\n\t\tif (g.Nodes[nl].lowState == color) || ((PointStatus(color) == Unocc) && (g.Nodes[nl].lowState != uint16(Black)) && (g.Nodes[nl].lowState != uint16(White))) {\n\t\t\tcount += 1\n\t\t\tabhr.EachMember(gl, nl,\n\t\t\t\tfunc(memNl NodeLoc) {\n\t\t\t\t\tmemCount += 1\n\t\t\t\t})\n\t\t}\n\t}\n\tcolor = uint16(Black)\n\tmemCount = 0\n\tabhr.EachNode(gl, CountNode)\n\tb_nodes = count\n\tb_members = memCount\n\n\tcount = 0\n\tmemCount = 0\n\tcolor = uint16(White)\n\tabhr.EachNode(gl, CountNode)\n\tw_nodes = count\n\tw_members = memCount\n\n\tcount = 0\n\tmemCount = 0\n\tcolor = uint16(Unocc)\n\tabhr.EachNode(gl, CountNode)\n\tu_nodes = count\n\tu_members = memCount\n\t//\tfmt.Println(\"Black nodes =\", b_nodes, \"Black members =\", b_members);\n\t//\tfmt.Println(\"White nodes =\", w_nodes, \"White members =\", w_members);\n\t//\tfmt.Println(\"Unocc nodes =\", u_nodes, \"Unocc members =\", u_members);\n\n\treturn\n}", "title": "" }, { "docid": "41fc085b0eaffd254814da373eb15bc4", "score": "0.5025645", "text": "func updateIngressCount(ingCount map[feature]int, features map[feature]bool) {\n\tfor feature := range features {\n\t\tingCount[feature] += 1\n\t}\n}", "title": "" }, { "docid": "54ce1aae18202b375c25656c640de988", "score": "0.50231445", "text": "func (b Board) CountAdjacentCells(x, y int, state bool) int {\n\tcount := 0\n\tfor i := x - 1; i <= x+1; i++ {\n\t\tfor j := y - 1; j <= y+1; j++ {\n\t\t\tif x == i && y == j {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif b.GetAt(Coord{i, j}) == state {\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "3adb18b0be3f040a94e7274681c3a0eb", "score": "0.50177056", "text": "func MapCountPods(n RenderableNode, _ report.Networks) RenderableNodes {\n\tif n.Pseudo {\n\t\treturn RenderableNodes{n.ID: n}\n\t}\n\n\toutput := n.Copy()\n\tpods, _ := n.Node.Counters.Lookup(podsKey)\n\tif pods == 1 {\n\t\toutput.LabelMinor = \"1 pod\"\n\t} else {\n\t\toutput.LabelMinor = fmt.Sprintf(\"%d pods\", pods)\n\t}\n\treturn RenderableNodes{output.ID: output}\n}", "title": "" }, { "docid": "f9e712aaae731aca00fa4761301453c4", "score": "0.49984947", "text": "func count(g []string) map[rune]int {\n\tm := make(map[rune]int)\n\tfor _, p := range g {\n\t\tfor _, a := range p {\n\t\t\tm[a] = m[a] + 1\n\t\t}\n\t}\n\treturn m\n}", "title": "" }, { "docid": "bd4b313dacd3000d72e3a211feafbb8d", "score": "0.49904922", "text": "func initializeCounts() (map[feature]int, map[feature]int) {\n\treturn map[feature]int{\n\t\t\tingress: 0,\n\t\t\texternalIngress: 0,\n\t\t\tinternalIngress: 0,\n\t\t\thttpEnabled: 0,\n\t\t\thostBasedRouting: 0,\n\t\t\tpathBasedRouting: 0,\n\t\t\ttlsTermination: 0,\n\t\t\tsecretBasedCertsForTLS: 0,\n\t\t\tpreSharedCertsForTLS: 0,\n\t\t\tmanagedCertsForTLS: 0,\n\t\t\tstaticGlobalIP: 0,\n\t\t\tmanagedStaticGlobalIP: 0,\n\t\t\tspecifiedStaticGlobalIP: 0,\n\t\t\tneg: 0,\n\t\t\tcloudCDN: 0,\n\t\t\tcloudArmor: 0,\n\t\t\tcloudIAP: 0,\n\t\t\tbackendTimeout: 0,\n\t\t\tbackendConnectionDraining: 0,\n\t\t\tclientIPAffinity: 0,\n\t\t\tcookieAffinity: 0,\n\t\t\tcustomRequestHeaders: 0,\n\t\t\tsslPolicy: 0,\n\t\t},\n\t\t// service port counts\n\t\tmap[feature]int{\n\t\t\tservicePort: 0,\n\t\t\texternalServicePort: 0,\n\t\t\tinternalServicePort: 0,\n\t\t\tneg: 0,\n\t\t\tcloudCDN: 0,\n\t\t\tcloudArmor: 0,\n\t\t\tcloudArmorSet: 0,\n\t\t\tcloudArmorEmpty: 0,\n\t\t\tcloudArmorNil: 0,\n\t\t\tcloudIAP: 0,\n\t\t\tbackendTimeout: 0,\n\t\t\tbackendConnectionDraining: 0,\n\t\t\tclientIPAffinity: 0,\n\t\t\tcookieAffinity: 0,\n\t\t\tcustomRequestHeaders: 0,\n\t\t\ttransparentHealthChecks: 0,\n\t\t}\n}", "title": "" }, { "docid": "37a56b953817893eb55dcef0bb050434", "score": "0.49889657", "text": "func (pnc *PerNodeCounter) Counts() map[string]NodeCount {\n\tpnc.countMutex.RLock()\n\tdefer pnc.countMutex.RUnlock()\n\n\tresult := make(map[string]NodeCount, len(pnc.counts))\n\n\t// return a copy, so it's thread safe\n\tfor k, v := range pnc.counts {\n\t\tresult[k] = *v\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "4b388dd049946ff218c591e7fd9f9c37", "score": "0.49789172", "text": "func scheduleByNeighborCount(s [][]byte) int {\n\tcountMap := make(map[int][]rcPair)\n\tmaxCol := len(s[0])\n\tmaxRow := len(s)\n\n\tfor c := 0; c < maxCol; c = c + 1 {\n\t\tcount := 0\n\t\tfor r := 0; r < maxRow; r = r + 1 {\n\t\t\tcount = neighborCount(s, r, c)\n\t\t\trc := rcPair{r, c}\n\t\t\tif countMap[count] == nil {\n\t\t\t\tcountMap[count] = make([]rcPair, 0)\n\t\t\t}\n\t\t\tcountMap[count] = append(countMap[count], rc)\n\t\t}\n\t}\n\n\tt := 0\n\tfor count := 0; count < 7; count = count + 1 {\n\t\tif countMap[count] != nil {\n\t\t\tfor _, c := range countMap[count] {\n\t\t\t\tfor r := 0; r < maxRow; r = r + 1 {\n\t\t\t\t\tif validSeat(s, c.row, c.col) {\n\t\t\t\t\t\ts[c.row][c.col] = 'x'\n\t\t\t\t\t\tt++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn t\n}", "title": "" }, { "docid": "c5c1c66b6c6398934712c5cae9a8da75", "score": "0.4974869", "text": "func CountConnectedComponentsInRows(b *Board) []int {\n\trowsCC := make([]int, b.height)\n\tfor y := 0; y < b.height; y++ {\n\t\tfor x := 0; x < b.width; x++ {\n\t\t\tif b.occupied[x][y] && (x == 0 || !b.occupied[x-1][y]) {\n\t\t\t\trowsCC[y]++\n\t\t\t}\n\t\t}\n\t}\n\treturn rowsCC\n}", "title": "" }, { "docid": "f142e367c44b3a471ba6eb4c5ca99435", "score": "0.4967521", "text": "func (b *Board) countCellNeighbors(c *Cell) int {\n\tneighbors := 0\n\n\t// Iterate through the current cell's neighbors\n\tfor dr := -1; dr <= 1; dr++ {\n\t\tfor dc := -1; dc <= 1; dc++ {\n\t\t\tif dr == 0 && dc == 0 {\n\t\t\t\t// Ignore the input cell's own state\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Increment the number of valid alive neighbors\n\t\t\tneighbors += b.validNeighbor(c.row+dr, c.col+dc)\n\t\t}\n\t}\n\n\treturn neighbors\n}", "title": "" }, { "docid": "b039b5998c7199558dfcfedebc36623e", "score": "0.49327967", "text": "func countTriplets(arr []int64, r int64) int64 {\r\n\r\n\tmB := make(map[int64]int64)\r\n\tmC := make(map[int64]int64)\r\n\tvar tot int64\r\n\r\n\tfmt.Println(arr)\r\n\r\n\tfor _, v := range arr {\r\n\r\n\t\tif val, ok := mC[v]; ok {\r\n\t\t\ttot += val\r\n\t\t}\r\n\r\n\t\tif val, ok := mB[v]; ok {\r\n\t\t\tmC[v*r] += val\r\n\t\t}\r\n\t\tmB[v*r]++\r\n\r\n\t}\r\n\tfmt.Println(tot)\r\n\treturn tot\r\n}", "title": "" }, { "docid": "cc87d3a0bc0ab0c1357326fdf337def5", "score": "0.49283695", "text": "func (s *seatMap) countOccupiedInSet(visible []coord) int {\n\tcount := 0\n\tfor _, c := range visible {\n\t\tif s.rows[c.row][c.col] == '#' {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "26d566dcaafa9135fce5eea8f97d4008", "score": "0.4918571", "text": "func (g *Game) SolutionCellCount() uint8 {\n\tcount := uint8(0)\n\tfor _, c := range g.cells {\n\t\tif c.SolutionCell() {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "e9ca22c39e0aad222035fb78d5d53e0e", "score": "0.4912608", "text": "func (c *Consumer) cppWorkerThrPartitionMap() {\n\tpartitions := make([]uint16, cppWorkerPartitionCount)\n\tfor i := 0; i < int(cppWorkerPartitionCount); i++ {\n\t\tpartitions[i] = uint16(i)\n\t}\n\n\tc.cppThrPartitionMap = util.VbucketDistribution(partitions, c.cppWorkerThrCount)\n}", "title": "" }, { "docid": "ce5f409ae68c1fdcfc9252510debbd2f", "score": "0.4885337", "text": "func (cb Chessboard) CountOccupied() (ret int) {\n\tfor _, f := range cb {\n\t\tfor _, occupied := range f {\n\t\t\tif occupied {\n\t\t\t\tret++\n\t\t\t}\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "e7b4f16ec17fcd7ba97f487caadde2ef", "score": "0.4870036", "text": "func initializeECreditMap(block *common.ECBlock) {\n\tfor _, entry := range block.Body.Entries {\n\t\t// Only process: ECIDChainCommit, ECIDEntryCommit, ECIDBalanceIncrease\n\t\tswitch entry.ECID() {\n\t\tcase common.ECIDChainCommit:\n\t\t\te := entry.(*common.CommitChain)\n\t\t\teCreditMap[string(e.ECPubKey[:])] -= int32(e.Credits)\n\t\t\tcommon.FactoidState.UpdateECBalance(fct.NewAddress(e.ECPubKey[:]), int64(e.Credits))\n\t\tcase common.ECIDEntryCommit:\n\t\t\te := entry.(*common.CommitEntry)\n\t\t\teCreditMap[string(e.ECPubKey[:])] -= int32(e.Credits)\n\t\t\tcommon.FactoidState.UpdateECBalance(fct.NewAddress(e.ECPubKey[:]), int64(e.Credits))\n\t\tcase common.ECIDBalanceIncrease:\n\t\t\te := entry.(*common.IncreaseBalance)\n\t\t\teCreditMap[string(e.ECPubKey[:])] += int32(e.NumEC)\n\t\t\t// Don't add the Increases to Factoid state, the Factoid processing will do that.\n\t\tcase common.ECIDServerIndexNumber:\n\t\tcase common.ECIDMinuteNumber:\n\t\tdefault:\n\t\t\tpanic(\"Unknow entry type:\" + string(entry.ECID()) + \" for ECBlock:\" + strconv.FormatUint(uint64(block.Header.EBHeight), 10))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8d61236d64c44c8cf5288ad531c0bf4f", "score": "0.48687917", "text": "func CountOccupied(cb Chessboard) int {\n\tcount := 0\n\tfor file := range cb {\n\t\tcount += CountInFile(cb, file)\n\t}\n\treturn count\n}", "title": "" }, { "docid": "96e963f36422920b80b8c09f398480f6", "score": "0.48304737", "text": "func freeCellsFrom(board params.Board, c params.Coord) int {\n\tfree := make(map[params.Coord]bool)\n\ttaken := make(map[params.Coord]bool)\n\tfor _, s := range board.Snakes {\n\t\tfor _, c := range s.Body {\n\t\t\ttaken[c] = true\n\t\t}\n\t}\n\tfreeCellsFrom0(c, board, free, taken)\n\treturn len(free)\n}", "title": "" }, { "docid": "357da7d68169b13b22d9a735eda5e1ab", "score": "0.48122975", "text": "func (t *typhaAutoscaler) getNodeCounts() (int, int, error) {\n\tlinuxNodes := 0\n\tschedulable := 0\n\tfor _, obj := range t.nodeIndexInformer.GetIndexer().List() {\n\t\tn := obj.(*v1.Node)\n\t\tif n.Spec.Unschedulable {\n\t\t\tcontinue\n\t\t}\n\t\tif n.GetObjectMeta().GetLabels()[\"projectcalico.org/operator-node-migration\"] == \"pre-operator\" {\n\t\t\t// This node hasn't been migrated to the operator yet. Don't include it in the number of desired Typhas.\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, ok := n.Labels[\"kubernetes.azure.com/cluster\"]; ok && n.Labels[\"type\"] == \"virtual-kubelet\" {\n\t\t\t// in AKS, there is a feature called 'virtual-nodes' which represent azure's container service as a node in the kubernetes cluster.\n\t\t\t// virtual-nodes have many limitations, and are tainted to prevent pods from running on them.\n\t\t\t// calico-node isn't run there as they don't support hostNetwork or host volume mounts.\n\t\t\t// as such, we shouldn't consider virtual-nodes in the count towards how many typha pods should be run.\n\t\t\t// furthermore, typha can't run on virtual-nodes as it is hostnetworked, so we don't want it's desired\n\t\t\t// replica count to include it.\n\t\t\tcontinue\n\t\t}\n\n\t\tschedulable++\n\t\tif n.Labels[\"kubernetes.io/os\"] == \"linux\" {\n\t\t\tlinuxNodes++\n\t\t}\n\t}\n\treturn schedulable, linuxNodes, nil\n}", "title": "" }, { "docid": "f55c6da7fc384ef119ca001e1ae7b271", "score": "0.48049694", "text": "func NumberofViewersMap(chName string) {\n\tmm.Lock()\n\tfor {\n\t\ttime.Sleep(1 * time.Second)\n\t\tchviewers := nzmapstore.ComputeViewers(chName)\n\t\tfmt.Printf(\"\\nNumber of %s viewers: %d\\n\\n\", chName, chviewers)\n\t}\n\tmm.Unlock()\n}", "title": "" }, { "docid": "49dd336819db5681eb2cc3875e5b990b", "score": "0.4795363", "text": "func ComputeCharacterFrequencies(input []byte) map[byte]float64 {\n\tfreq := make(map[byte]float64)\n\n\tfor _, byt := range input {\n\t\tfreq[byt] += 1 / float64(len(input))\n\t}\n\n\treturn freq\n}", "title": "" }, { "docid": "e51a777fe2ab806c5ef805c0c17cd569", "score": "0.47909793", "text": "func (c *cesMgr) getTotalCEPCount() int {\n\tcnt := 0\n\tfor _, ces := range c.desiredCESs.getAllCESs() {\n\t\tces.backendMutex.RLock()\n\t\tcnt += len(ces.ces.Endpoints)\n\t\tces.backendMutex.RUnlock()\n\t}\n\treturn cnt\n}", "title": "" }, { "docid": "793869992c3b51ebfc8256525a181c1e", "score": "0.47896394", "text": "func FindDiffNbr(cell *Prokaryote, r, c int, newBoard *GameBoard) map[int][2]int {\n\tnbrMap := make(map[int][2]int, 0)\n\ti := 0\n\t//Range over all neighbor\n\tfor row := r - 1; row <= r+1; row++ {\n\t\tfor col := c - 1; col <= c+1; col++ {\n\t\t\tif row == r && col == c {\n\t\t\t\tcontinue\n\t\t\t} else if WithinBoard(row, col, newBoard) == false {\n\t\t\t\tcontinue\n\t\t\t} else if (*newBoard)[row][col] == nil {\n\t\t\t\tcontinue\n\t\t\t} else if (*newBoard)[row][col].ReportType() == \"Eukaryote\" {\n\t\t\t\tnbrMap[i] = [2]int{row, col}\n\t\t\t\ti++\n\t\t\t} else {\n\t\t\t\tnbrCell := (*newBoard)[row][col].(*Prokaryote)\n\t\t\t\tif len(nbrCell.genes) != len(cell.rpcGenes) {\n\t\t\t\t\tnbrMap[i] = [2]int{row, col}\n\t\t\t\t\ti++\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcheck := false\n\t\t\t\tfor j := range nbrCell.genes {\n\t\t\t\t\tif nbrCell.genes[j] != cell.rpcGenes[j] && check == false {\n\t\t\t\t\t\tnbrMap[i] = [2]int{row, col}\n\t\t\t\t\t\ti++\n\t\t\t\t\t\tcheck = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\treturn nbrMap\n}", "title": "" }, { "docid": "58717aedba03675cd29b0eb096b6cc9f", "score": "0.47871345", "text": "func (m *ConcurrentMap) Count() int {\n\tcount := 0\n\tfor i := 0; i < len(m.shards); i++ {\n\t\tshard := m.shards[i]\n\t\tshard.RLock()\n\t\tcount += len(shard.items)\n\t\tshard.RUnlock()\n\t}\n\treturn count\n}", "title": "" }, { "docid": "6258dff980b1a98c6c82cfe90862e839", "score": "0.4777393", "text": "func TreeHashCnt(count int) int {\n\tif count < 3 {\n\t\tpanic(\"count must be >= 3\")\n\t}\n\n\tif count > 0x10000000 {\n\t\tpanic(\"count must be <= 0x10000000\")\n\t}\n\n\tpow := uint64(2)\n\tfor pow < uint64(count) {\n\t\tpow <<= 1\n\t}\n\n\treturn int(pow >> 1)\n}", "title": "" }, { "docid": "88706140358ea9a8ba0e3101cacbfbd2", "score": "0.47770452", "text": "func (t *TEM) DownslopeContributingAreaIDs(cid0 int) ([]int, map[int]int) {\n\tqueue := list.New()\n\teval := make(map[int]bool, len(t.TEC))\n\tproceed := func(cid int) bool {\n\t\tif v, ok := t.USlp[cid]; ok {\n\t\t\tfor _, u := range v { // returns true if all upslope cells have been evaluated\n\t\t\t\tif !eval[u] {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\tdsa := t.Downslopes() // from{to}\n\tc, ds, i := make([]int, len(t.TEC)), make(map[int]int), 0\n\tfor _, k := range t.Peaks(cid0) {\n\t\tqueue.PushBack(k) // initial enqueue\n\t}\n\n\tfor queue.Len() > 0 {\n\t\te := queue.Front() // first element\n\t\tc[i] = e.Value.(int)\n\t\teval[c[i]] = true\n\t\tif v, ok := dsa[c[i]]; ok {\n\t\t\tds[c[i]] = v\n\t\t\tif v != cid0 && proceed(v) {\n\t\t\t\tqueue.PushBack(v) // enqueue\n\t\t\t}\n\t\t}\n\t\tqueue.Remove(e) // dequeue\n\t\ti++\n\t}\n\tif cid0 < 0 {\n\t\treturn c, ds\n\t}\n\tc[i] = cid0\n\tds[cid0] = -1\n\tu := make([]int, i+1)\n\tcopy(u, c)\n\n\t// cktopo := make(map[int]bool, len(u))\n\t// for _, i := range u {\n\t// \tif _, ok := cktopo[i]; ok {\n\t// \t\tlog.Fatalf(\" TEM.DownslopeContributingAreaIDs error: cell %d occured more than once, possible cycle\", i)\n\t// \t}\n\t// \tif _, ok := ds[i]; !ok {\n\t// \t\tlog.Fatalf(\" TEM.DownslopeContributingAreaIDs error: cell %d not given dowslope id\", i)\n\t// \t}\n\t// \tif _, ok := cktopo[ds[i]]; ok {\n\t// \t\tlog.Fatalf(\" TEM.DownslopeContributingAreaIDs error: cell %d out of topological order\", i)\n\t// \t}\n\t// \tcktopo[i] = true\n\t// }\n\n\treturn u, ds\n}", "title": "" }, { "docid": "8cb78fd192ccc1437221cbbfaf3f3cff", "score": "0.47718748", "text": "func CountByTG (dm []*DMrec) map[string]int {\n\tm := make(map[string]int)\n\tm[\"Screened\"] = len(dm)\n\tfor _, v := range dm {\n\t\tif v.Arm != \"\" {\n\t\t\tm[v.Arm]++\n\t\t} else {\n\t\t\tm[\"SF\"]++\n\t\t}\n\t}\n\t\n\ttotal := 0\n\tfor k, v := range m{\n\t\tif k != \"SF\" && k != \"Screened\" {\n\t\t\ttotal += v\n\t\t}\n\t}\n\tm[\"Overall\"] = total\n\treturn m\n}", "title": "" }, { "docid": "b04a4dfee630a1bcc5481726616faf96", "score": "0.47658843", "text": "func countNodes(l, c int) (count int) {\n\tfor i := 0; i < l; i++ {\n\t\tcount += int(math.Pow(float64(c), float64(i)))\n\t}\n\treturn\n}", "title": "" }, { "docid": "baf3d16d8f9956e60ac615bca5b58ebf", "score": "0.4763017", "text": "func (board *Board) getNeighbourCount(c cell.Cell) int {\n\tcount := 0\n\tneighbours := make([]*cell.Cell, 8)\n\n\t// top left\n\tneighbours[0] = board.getCell(c.X+1, c.Y+1)\n\t// top middle\n\tneighbours[1] = board.getCell(c.X, c.Y+1)\n\t// top right\n\tneighbours[2] = board.getCell(c.X-1, c.Y+1)\n\t// middle left\n\tneighbours[3] = board.getCell(c.X+1, c.Y)\n\t// middle right\n\tneighbours[4] = board.getCell(c.X-1, c.Y)\n\t// bottom left\n\tneighbours[5] = board.getCell(c.X+1, c.Y-1)\n\t// bottom middle\n\tneighbours[6] = board.getCell(c.X, c.Y-1)\n\t// bottom right\n\tneighbours[7] = board.getCell(c.X-1, c.Y-1)\n\n\tfor _, neighbour := range neighbours {\n\t\tif neighbour != nil && !neighbour.Dead {\n\t\t\tcount++\n\t\t}\n\t}\n\n\treturn count\n}", "title": "" }, { "docid": "b17cde7a7ad6d5ef5cb2166ccee68f1d", "score": "0.47481415", "text": "func keyspaceCellsMapper(obj client.Object) []reconcile.Request {\n\tvtk := obj.(*planetscalev2.VitessKeyspace)\n\n\t// Request reconciliation for all the VitessCells to which this VitessKeyspace is deployed.\n\tvar requests []reconcile.Request\n\tfor _, cellName := range vtk.Spec.CellNames() {\n\t\t// Compute the full VitessCell object name from the cell name.\n\t\tclusterName := vtk.Labels[planetscalev2.ClusterLabel]\n\t\trequests = append(requests, reconcile.Request{\n\t\t\tNamespacedName: apitypes.NamespacedName{\n\t\t\t\tNamespace: vtk.Namespace,\n\t\t\t\tName: vitesscell.Name(clusterName, cellName),\n\t\t\t},\n\t\t})\n\t}\n\treturn requests\n}", "title": "" }, { "docid": "ebfbd17a6ee7c48de50a7676edf84a39", "score": "0.4747472", "text": "func (c *Cell) Count() uint64 {\n\treturn c.core.Count()\n}", "title": "" }, { "docid": "f29c58abafaa2c71d5cbcc53eb56dcf4", "score": "0.47365603", "text": "func (c *Map) Count() int64 {\n\ttotal := int64(0)\n\n\tfor _, thisShard := range c.shards {\n\t\tthisShard.RLock()\n\t\ttotal += int64(len(thisShard.items))\n\t\tthisShard.RUnlock()\n\t}\n\n\treturn total\n}", "title": "" }, { "docid": "c60fce8131f42217b45ec510fa37ba29", "score": "0.47305572", "text": "func GetRevealedCellsCount(board [][]domain.Cell, columns, rows int) int {\n\trevealedCellsCount := 0\n\tfor i := 0; i < rows; i++ {\n\t\tfor j := 0; j < rows; j++ {\n\t\t\tif board[i][j].IsRevealed {\n\t\t\t\trevealedCellsCount++\n\t\t\t}\n\t\t}\n\t}\n\treturn revealedCellsCount\n}", "title": "" }, { "docid": "710d077851c5890b09da4025868feb4a", "score": "0.47242686", "text": "func (m ConcurrentUserMap) Count() int {\n\tcount := 0\n\tfor i := 0; i < shardCountUsers; i++ {\n\t\tshard := m[i]\n\t\tshard.RLock()\n\t\tcount += len(shard.items)\n\t\tshard.RUnlock()\n\t}\n\treturn count\n}", "title": "" }, { "docid": "045c6162071b953a402f409a398e28f4", "score": "0.4722458", "text": "func (m *CMap) Count() uint32 {\n\treturn m.count\n}", "title": "" }, { "docid": "c0abc466cd263abaa6256348804d186b", "score": "0.47017115", "text": "func PopCountTableLookup(x uint64) int {\n\tvar count int\n\tfor i := 0; i < 8; i++ {\n\t\tcount += int(pc[byte(x>>uint(i))])\n\t}\n\treturn count\n}", "title": "" }, { "docid": "ad266682aaa410457ac48dafe4655e06", "score": "0.46938378", "text": "func (l *leaseTaker) computeLeaseCounts() map[string]int {\n\tm := make(map[string]int)\n\tfor _, lease := range l.allLeases {\n\t\tif lease.hasNoOwner() {\n\t\t\tcontinue\n\t\t}\n\t\tif _, ok := m[lease.Owner]; ok {\n\t\t\tm[lease.Owner]++\n\t\t} else {\n\t\t\tm[lease.Owner] = 1\n\t\t}\n\t}\n\n\t// If I have no leases, I wasn't represented in leaseCounts. Let's fix that.\n\tif _, ok := m[l.WorkerId]; !ok {\n\t\tm[l.WorkerId] = 0\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "74f89b8e33aeb234f425d54af4c1d98b", "score": "0.46820772", "text": "func (counter *Grid) count(xy int, g *Grid) *Grid {\n\tif c := g[xy]; c != Empty {\n\t\tg[xy] = Empty\n\t\tcounter[xy]++\n\t\tfor _, nxy := range neighbors(xy) {\n\t\t\tif g[nxy] == c {\n\t\t\t\tcounter.count(nxy, g)\n\t\t\t}\n\t\t}\n\t}\n\treturn counter\n}", "title": "" }, { "docid": "3ef81f11df856421bbef94ea9abf3e5b", "score": "0.46715894", "text": "func CountOccupiedSeats(seatMatrix [][]rune, occupyLimit int, rule SeatRule) int {\n\tupdated, changed := ApplySeatingRules(seatMatrix, occupyLimit, rule)\n\tfor changed {\n\t\tupdated, changed = ApplySeatingRules(updated, occupyLimit, rule)\n\t}\n\toccupied := 0\n\tfor i := 0; i < len(updated); i++ {\n\t\tfor j := 0; j < len(updated[0]); j++ {\n\t\t\tif updated[i][j] == rune('#') {\n\t\t\t\toccupied++\n\t\t\t}\n\t\t}\n\t}\n\treturn occupied\n}", "title": "" }, { "docid": "6ff7155f82cd705bac139b3df682d974", "score": "0.46684885", "text": "func (sm *SyncerMetrics) computeEndpointStateMetrics() (negtypes.StateCountMap, negtypes.StateCountMap, int, int) {\n\tsm.mu.Lock()\n\tdefer sm.mu.Unlock()\n\n\tvar epCount, epsCount int\n\tepStateCount := negtypes.StateCountMap{}\n\tepsStateCount := negtypes.StateCountMap{}\n\t// collect count from each syncer\n\tfor _, epState := range sm.syncerEndpointStateMap {\n\t\tfor _, state := range negtypes.StatesForEndpointMetrics() {\n\t\t\tepStateCount[state] += epState[state]\n\t\t\tepCount += epState[state]\n\t\t}\n\t}\n\tfor _, epsState := range sm.syncerEndpointSliceStateMap {\n\t\tfor _, state := range negtypes.StatesForEndpointMetrics() {\n\t\t\tepsStateCount[state] += epsState[state]\n\t\t\tepsCount += epsState[state]\n\t\t}\n\t}\n\treturn epStateCount, epsStateCount, epCount, epsCount\n}", "title": "" }, { "docid": "bba77369b26a09b705ea52ef722d5eeb", "score": "0.46628505", "text": "func (m *Map) NumEntries() int {\n\treturn m.numEnts\n}", "title": "" }, { "docid": "3b1eda4c945af06eed436bfeaf076a52", "score": "0.46607134", "text": "func (k *clientSet) getUsedNodeMap(spc string) (map[string]int, error) {\n\t// Get the list of storagepool\n\tspList, err := k.oecs.OpenebsV1alpha1().StoragePools().List(mach_apis_meta_v1.ListOptions{LabelSelector: string(v1alpha1.StoragePoolClaimCPK) + \"=\" + spc})\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"unable to get the list of storagepools for stragepoolclaim %s\", spc)\n\t}\n\t// Form a map that will hold all the nodes where storagepool for the spc has been already created.\n\tusedNodeMap := make(map[string]int)\n\tfor _, sp := range spList.Items {\n\t\tusedNodeMap[sp.Labels[string(v1alpha1.HostNameCPK)]]++\n\t}\n\treturn usedNodeMap, nil\n}", "title": "" }, { "docid": "c98ca3ff069ffc13a3fbbfb90edeec50", "score": "0.46605003", "text": "func PopCountTable(x uint64) int {\n\treturn int(pc[byte(x>>0)] +\n\t\tpc[byte(x>>8)] +\n\t\tpc[byte(x>>16)] +\n\t\tpc[byte(x>>24)] +\n\t\tpc[byte(x>>32)] +\n\t\tpc[byte(x>>40)] +\n\t\tpc[byte(x>>48)] +\n\t\tpc[byte(x>>56)])\n}", "title": "" }, { "docid": "dc4f65254d8bad0b155cf19a89421640", "score": "0.46581805", "text": "func (m *ConcurrentHashMap) addCount(x int64, check int32) {\n\tas := m.getCountCells()\n\tb := atomic.LoadInt64(&m.baseCount)\n\ts := b + x\n\tif as != nil || !atomic.CompareAndSwapInt64(&m.baseCount, b, s) {\n\t\tif as == nil {\n\t\t\tm.fullAddCount(x, false)\n\t\t} else {\n\t\t\ta := getRandomCountCell(as)\n\t\t\tincrementCountCell(a, x)\n\t\t}\n\t\tif check <= 1 {\n\t\t\treturn\n\t\t}\n\t\ts = m.sumCount()\n\t}\n\tif check >= 0 {\n\t\tfor {\n\t\t\tsc := atomic.LoadInt32(&m.sizeCtl)\n\t\t\tvar tab, nt *[]unsafe.Pointer\n\t\t\ttab = m.getTable()\n\t\t\tif s >= int64(sc) && tab != nil {\n\t\t\t\tn := len(*tab)\n\t\t\t\tif n > maxCapacity {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\trs := resizeStamp(int32(n))\n\t\t\t\tif sc < 0 {\n\t\t\t\t\tnt = m.getNextTable()\n\t\t\t\t\tif (sc>>resizeStampBits) != rs || sc == rs+1 ||\n\t\t\t\t\t\tsc == rs+maxResizers || nt == nil {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t} else {\n\t\t\t\t\t\tti := atomic.LoadInt32(&m.transferIndex)\n\t\t\t\t\t\tif ti <= 0 {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif atomic.CompareAndSwapInt32(&m.sizeCtl, sc, sc+1) {\n\t\t\t\t\t\tm.transfer(tab, nt)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif atomic.CompareAndSwapInt32(&m.sizeCtl, sc, (rs<<resizeStampShift)+2) {\n\t\t\t\t\t\tm.transfer(tab, nil)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts = m.sumCount()\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bc4fc9b6ac3f24139b16024d22a4f6c0", "score": "0.4651639", "text": "func CountNumUtasksPerDay(taskTraces []TaskTrace) (map[string]int, []string) {\n\n\tif taskTraces == nil {\n\t\treturn nil, nil\n\t}\n\n\t// step 1 - get unique dates\n\tvar uniqueDates []string\n\tfor _, t := range taskTraces {\n\n\t\tfound := false\n\t\tfor _, d := range uniqueDates {\n\t\t\tif d == t.SDate {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif found == false {\n\t\t\tuniqueDates = append(uniqueDates, t.SDate)\n\t\t}\n\t}\n\n\t// step 2 - convert to time\n\tvar uniqueTimes []time.Time\n\tlayout := \"02/01/2006\"\n\n\tfor _, s := range uniqueDates {\n\t\tt, err := time.Parse(layout, s)\n\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\"err\":err, \"date string\": s}).Error(\"cant parse date string\")\n\t\t\tcontinue\n\t\t}\n\n\t\tuniqueTimes = append(uniqueTimes, t)\n\t}\n\tif len(uniqueTimes) == 0 { //make sure we have valid time entries\n\t\tlog.Error(\"no unique time entries extracted, bailing\")\n\t\treturn nil, nil\n\t}\n\n\t// step 3 - get first and last dates\n\tfirstDate := uniqueTimes[0]\n\tlastDate := uniqueTimes[0]\n\tfor _, t := range uniqueTimes {\n\t\tif t.Before(firstDate) {\n\t\t\tfirstDate = t\n\t\t}\n\t\tif t.After(lastDate) {\n\t\t\tlastDate = t\n\t\t}\n\t}\n\n\t// step 4 - generate map from first to last date\n\t// mapping [ date ] = num utasks\n\tcountMap := make(map[string]int)\n\tvar orderedKeys []string\n\tfor d := firstDate; d.Before(lastDate); d=d.AddDate(0,0,1) {\n\n\t\tkey := d.Format(layout)\n\t\torderedKeys = append(orderedKeys, key)\n\t\tcountMap[key] = 0\n\t\tlog.WithFields(log.Fields{\"d\":d}).Info(\"\")\n\t}\n\n\t// step 5 - count\n\tfor d, _ := range countMap {\n\t\tfor _, t := range taskTraces {\n\t\t\tif d == t.SDate {\n\t\t\t\tcountMap[d]++\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.WithFields(log.Fields{\"count\":countMap}).Info(\"count\")\n\n\treturn countMap, orderedKeys\n}", "title": "" }, { "docid": "419b6cf31bf47770833cda3671ef2782", "score": "0.46482605", "text": "func ksgCount(epsilon float64, xy []float64, data [][]float64, indices []int) (c int) {\n\n\tfor t := 0; t < len(data); t++ {\n\t\tif continuous.Distance(xy, data[t], indices) < epsilon {\n\t\t\tc++\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c9a685ebd3317dbd0e5c006611020681", "score": "0.46482074", "text": "func (ba *BitArray) Cnt() (n int) {\n\tfor _, b := range ba.bits {\n\t\tn += bits.OnesCount64(b)\n\t}\n\treturn\n}", "title": "" }, { "docid": "dd1884448914f6ae23b12c2dbc64f3ff", "score": "0.4643342", "text": "func (oc *OperatorController) updateCounts(operators map[uint64]*operator.Operator) {\n\tfor k := range oc.counts {\n\t\tdelete(oc.counts, k)\n\t}\n\tfor _, op := range operators {\n\t\toc.counts[op.SchedulerKind()]++\n\t}\n}", "title": "" }, { "docid": "3427849b2f7d8f008483fe6e40c0d041", "score": "0.46406463", "text": "func (c *Centroid) count(image *Image) int {\n\tvar count int\n\tfor _, color := range image.Colors {\n\t\tif compareCentroid(color, c) {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "8590dbf28e7eddb3c5bb2f53c352a6c9", "score": "0.46282968", "text": "func sumWorkerCPUs(workerDetails []gsclientgen.V4NodeDefinitionResponse) int32 {\n\tsum := int32(0)\n\tfor _, item := range workerDetails {\n\t\tsum = sum + item.Cpu.Cores\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "4e295cd5d9198afe417f58b2e3aff7d5", "score": "0.46280137", "text": "func gatherRunResults(config Configuration, c <-chan float64) map[float64]int {\n\trois := make(map[float64]int)\n\n\tfor i := 0; i < runtime.GOMAXPROCS(0)*(config.Runs/runtime.GOMAXPROCS(0)); i++ {\n\t\troi := <-c\n\t\trois[roi] = rois[roi] + 1\n\t}\n\n\treturn rois\n}", "title": "" }, { "docid": "0cdf6e74f3a5a62749237d9b63a4929a", "score": "0.46242768", "text": "func NumberOfBoomerangs(points [][]int) int {\n\tnum := 0 // number of boomerangs\n\n\tfor i := range points {\n\t\tht := make(map[int]int, len(points))\n\t\tfor j := range points {\n\t\t\tif i != j {\n\t\t\t\tdist := dist(points[i], points[j])\n\t\t\t\tif cnt, ok := ht[dist]; ok {\n\t\t\t\t\tnum += cnt * 2\n\t\t\t\t}\n\t\t\t\tht[dist]++\n\t\t\t}\n\t\t}\n\t}\n\n\treturn num\n}", "title": "" }, { "docid": "0fcc8678e9d2a3645bf3680ec3fb7981", "score": "0.46058214", "text": "func Cgocalls() int64", "title": "" }, { "docid": "870bacdbcdf06e863218e98fe27fb66d", "score": "0.460251", "text": "func (sm SizeMap) CountCandidates() int {\n\tcounter := 0\n\tfor _, filenameList := range sm {\n\t\tif filenameList.Len() > 1 {\n\t\t\tcounter += filenameList.Len()\n\t\t}\n\t}\n\treturn counter\n}", "title": "" }, { "docid": "5814115192c61b98632e215df34c0093", "score": "0.45986816", "text": "func (cu *CellUnion) LeafCellsCovered() int64 {\n\tvar numLeaves int64\n\tfor _, c := range *cu {\n\t\tnumLeaves += 1 << uint64((MaxLevel-int64(c.Level()))<<1)\n\t}\n\treturn numLeaves\n}", "title": "" }, { "docid": "29eac1d40e51f358f783fcde60ba4dc1", "score": "0.4589405", "text": "func _cellSize(tls *crt.TLS, _pPage *XMemPage, _iCell int32) (r0 uint16) {\n\treturn func() func(*crt.TLS, *XMemPage, *uint8) uint16 {\n\t\tv := _pPage.XxCellSize\n\t\treturn *(*func(*crt.TLS, *XMemPage, *uint8) uint16)(unsafe.Pointer(&v))\n\t}()(tls, _pPage, (*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(_pPage.XaData))+uintptr(int32(_pPage.XmaskPage)&((int32(*elem15(elem15(_pPage.XaCellIdx, uintptr(int32(2)*_iCell)), 0))<<8)|int32(*elem15(elem15(_pPage.XaCellIdx, uintptr(int32(2)*_iCell)), uintptr(1))))))))\n}", "title": "" }, { "docid": "8188c5d54fd4ee2051d2d8dc9f3a00b2", "score": "0.45878485", "text": "func countNeighbors(key int) int {\n\ttotal := 0\n\tw := screenWidth * (-1)\n\n\t// Go through this counter 3 times.\n\t//\n\tfor c := 0; c < 3; c++ {\n\t\t// Go through all 3 neighbors on each of the 3 rows.\n\t\t//\n\t\tfor n := -1; n <= 1; n++ {\n\t\t\t// Check if neighbor is outside our window limits.\n\t\t\t//\n\t\t\tnkey := key + w + n\n\n\t\t\t// Check if nkey < 0 or > all_cells.\n\t\t\t//\n\t\t\tif nkey >= 0 && nkey < all_cells {\n\t\t\t\t// Check if neighbor is outside the window limits.\n\t\t\t\t//\n\t\t\t\tty := nkey / screenWidth\n\t\t\t\ttx := nkey - (ty * screenWidth)\n\t\t\t\tif tx >= 0 && tx < screenWidth && ty >= 0 && ty < screenHeight {\n\t\t\t\t\t// If neighbor cell is alive, then incremend total.\n\t\t\t\t\t//\n\t\t\t\t\tif cells[nkey*4] == 0xff {\n\t\t\t\t\t\ttotal++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tw += screenWidth\n\t}\n\n\t// We also counted the current live cell.\n\t// If it's alive, we'll decrement that from the equation.\n\t//\n\tif cells[key*4] == 0xff {\n\t\ttotal--\n\t}\n\n\treturn total\n}", "title": "" }, { "docid": "9e36d6ece00d9f69d58c2570185a06b7", "score": "0.45775604", "text": "func (cache *Cache) EvacuateCount() (count int64) {\n\tfor i := range cache.segments {\n\t\tcount += atomic.LoadInt64(&cache.segments[i].totalEvacuate)\n\t}\n\treturn\n}", "title": "" }, { "docid": "9e36d6ece00d9f69d58c2570185a06b7", "score": "0.45775604", "text": "func (cache *Cache) EvacuateCount() (count int64) {\n\tfor i := range cache.segments {\n\t\tcount += atomic.LoadInt64(&cache.segments[i].totalEvacuate)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bcc4b1bd4ad88dd1df2f81b4e8f05745", "score": "0.4575225", "text": "func MapCountContainers(n RenderableNode, _ report.Networks) RenderableNodes {\n\tif n.Pseudo {\n\t\treturn RenderableNodes{n.ID: n}\n\t}\n\n\toutput := n.Copy()\n\tcontainers, _ := n.Node.Counters.Lookup(ContainersKey)\n\tif containers == 1 {\n\t\toutput.LabelMinor = \"1 container\"\n\t} else {\n\t\toutput.LabelMinor = fmt.Sprintf(\"%d containers\", containers)\n\t}\n\treturn RenderableNodes{output.ID: output}\n}", "title": "" }, { "docid": "cf0522a5d11723b1799e13d011e9a821", "score": "0.45668876", "text": "func (onuTP *OnuUniTechProf) GetNumberOfConfiguredUsGemPorts(ctx context.Context) int {\n\tonuTP.mutexTPState.RLock()\n\tdefer onuTP.mutexTPState.RUnlock()\n\tusGemPorts := make([]uint16, 0)\n\tfor _, tcontGemList := range onuTP.mapPonAniConfig {\n\t\tfor gemPortID, gemPortParams := range tcontGemList.mapGemPortParams {\n\t\t\tif gemPortParams.direction == cGemDirBiDirect || gemPortParams.direction == cGemDirUniToAni {\n\t\t\t\talreadyConfigured := false\n\t\t\t\tfor _, foundUsGemPortID := range usGemPorts {\n\t\t\t\t\tif foundUsGemPortID == gemPortID {\n\t\t\t\t\t\talreadyConfigured = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !alreadyConfigured {\n\t\t\t\t\tusGemPorts = append(usGemPorts, gemPortID)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn len(usGemPorts)\n}", "title": "" }, { "docid": "a90286c53e70a22b21a9a2d783e2f4a4", "score": "0.4564304", "text": "func CountIdenticalCaracteristics(pieceList []int, gridSize int) int {\n\tpieceListWithoutEmptyBox := underscore.Select(pieceList, func(n int, _ int) bool {\n\t\treturn n != 0\n\t})\n\tif pieceListWithoutEmptyBox == nil || len(pieceListWithoutEmptyBox.([]int)) < 2 {\n\t\treturn 0\n\t}\n\n\tbitInverser := int(math.Pow(2, float64(gridSize)) - 1)\n\tpropertiesAtTrue := underscore.Reduce(pieceListWithoutEmptyBox, func(prev int, curr, _ int) int {\n\t\treturn prev & (curr - 1)\n\t}, bitInverser)\n\n\tpropertiesAtFalse := underscore.Reduce(pieceListWithoutEmptyBox, func(prev int, curr, _ int) int {\n\t\treturn prev & ((curr - 1) ^ bitInverser)\n\t}, bitInverser)\n\tstringReprensentationForPropertiesAtTrue := strconv.FormatInt(int64(propertiesAtTrue.(int)), 2)\n\tstringReprensentationForPropertiesAtFalse := strconv.FormatInt(int64(propertiesAtFalse.(int)), 2)\n\n\tnumberOfCommonPropertiesAtTrue := strings.Count(stringReprensentationForPropertiesAtTrue, \"1\")\n\tnumberOfCommonPropertiesAtFalse := strings.Count(stringReprensentationForPropertiesAtFalse, \"1\")\n\n\treturn numberOfCommonPropertiesAtTrue + numberOfCommonPropertiesAtFalse\n}", "title": "" }, { "docid": "42d191274b14493d512512f01919d750", "score": "0.45612442", "text": "func numTilePossibilities(tiles string) int {\n\tres := executor(tiles[:len(tiles)-1], tiles[len(tiles)-1])\n\tstore := make(map[string]struct{})\n\tfor i := range res {\n\t\tif _, ok := store[res[i]]; !ok {\n\t\t\tstore[res[i]] = struct{}{}\n\t\t}\n\t}\n\t//fmt.Println(store)\n\treturn len(store)-1\n}", "title": "" }, { "docid": "8ad27ebbf0c13794f358cad1c06bf74f", "score": "0.4559504", "text": "func CountAll(cb Chessboard) (ret int) {\n\tfor _, rank := range cb {\n\t\tfor range rank {\n\t\t\tret += 1\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "5f2c2cf938970f498011d56df8e518af", "score": "0.45532927", "text": "func calcUsableTiles(stemAlpha string, tileMap map[rune]bool) uint8 {\n\tn := int8(0)\n\tif len(tileMap) == 0 {\n\t\tpanic(\"stemAlpha invalid: \" + stemAlpha)\n\t}\n\tfor rn := range tileMap {\n\t\tn += int8(defaultDist.Distribution[rn]) - int8(strings.Count(stemAlpha, string(rn)))\n\t}\n\tn += 2 // The blanks\n\n\treturn uint8(n)\n}", "title": "" }, { "docid": "9596c7be21819ebdd76eea4711841d70", "score": "0.45504597", "text": "func getAirportCountPerState(db driver.Database) map[string]float64 {\n\tquery := `\nFOR a IN airports\nCOLLECT state = a.state\nWITH COUNT INTO counter\nRETURN {state, counter}\n`\n\tres, err := db.Query(context.Background(), query, nil)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer timeTaken(time.Now(), \"getAirportCountPerState\")\n\tdefer res.Close()\n\n\tretVal := map[string]float64{}\n\n\tfor res.HasMore() {\n\t\tvar queryResult struct {\n\t\t\tState string `json:\"state\"`\n\t\t\tCounter float64 `json:\"counter\"`\n\t\t}\n\n\t\t_, err := res.ReadDocument(context.Background(), &queryResult)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tretVal[queryResult.State] = queryResult.Counter\n\t}\n\n\treturn retVal\n}", "title": "" }, { "docid": "911af7d022bfd93956e130600dc7fbec", "score": "0.4549653", "text": "func sumMap(targetMap map[string]uint) uint {\n\tvar total uint = 0\n\tfor _, count := range targetMap {\n\t\ttotal += count\n\t}\n\treturn total\n}", "title": "" }, { "docid": "039818d456b630c6eeed158245851aec", "score": "0.45484704", "text": "func GetCLIPIDCountMap(apps []ListOutput) map[int]int {\n\tcliPIDCountMap := make(map[int]int, len(apps))\n\tfor _, app := range apps {\n\t\tcliPIDCountMap[app.CliPID]++\n\t}\n\treturn cliPIDCountMap\n}", "title": "" }, { "docid": "921d76b2aa1d2ec681eb1b1cd267c2e0", "score": "0.4548307", "text": "func (stats *DeviceStats) TxColls() uint64 {\n\treturn stats.TxStats[5]\n}", "title": "" }, { "docid": "7cc6c4f639c6a74c02139f428c1dea0b", "score": "0.45477197", "text": "func OnesCount(x uint) int", "title": "" }, { "docid": "c91bf7ab808191d0a63f7618a8bcbaaa", "score": "0.45470002", "text": "func (cache *Cache) EvacuateCount() (count uint64) {\n\tfor i := range cache.segments {\n\t\tcount += atomic.LoadUint64(&cache.segments[i].nEvacuateOpCount)\n\t}\n\treturn\n}", "title": "" }, { "docid": "3359080224adfadde44661352c48fa91", "score": "0.45396766", "text": "func (s *CMap) Count() int {\n\treturn len(s.m)\n}", "title": "" }, { "docid": "fa2b0a41b39215cdb464445c242b2c9a", "score": "0.45288256", "text": "func iterateMap(oMap smap) (nMap smap) {\n\n\tnMap.data = initData(oMap.wdt, oMap.hgt)\n\tnMap.wdt, nMap.hgt = oMap.wdt, oMap.hgt\n\n\tfor y := 1; y <= nMap.hgt; y++ {\n\t\tfor x := 1; x <= nMap.wdt; x++ {\n\n\t\t\t// do nothing if no seat\n\t\t\tnMap.data[y][x].seat = oMap.data[y][x].seat\n\t\t\tif !oMap.data[y][x].seat {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// not occupied and no neigbors -> occupy\n\t\t\t// occupied and less than 4 neighbours -> occupy again\n\t\t\tif (oMap.data[y][x].occN == 0 && !oMap.data[y][x].occ) ||\n\t\t\t\t(oMap.data[y][x].occN < 4 && oMap.data[y][x].occ) {\n\n\t\t\t\tnMap.data[y][x].occ = true\n\t\t\t\tnMap.numOcc += 1\n\n\t\t\t\t// add to the neighbour counter of all neighbours\n\t\t\t\tfor yy := y-1; yy < y+2; yy++ {\n\t\t\t\t\tfor xx := x-1; xx < x+2; xx++ {\n\t\t\t\t\t\tnMap.data[yy][xx].occN += 1\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\n\t\t\t\tnMap.data[y][x].occN--\n\t\t\t}\n\n\t\t\t// track whether changes have occured\n\t\t\tnMap.changed = nMap.changed || (nMap.data[y][x].occ != oMap.data[y][x].occ)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ce1710c3abc70fb043376c303f603019", "score": "0.45184425", "text": "func countRedNodesInPath(n *node) map[int]int {\n\toccurrences := make(map[int]int)\n\tcountRedWalker(n, occurrences, 0)\n\treturn occurrences\n}", "title": "" }, { "docid": "a3cd5ef3727127aba487dbd2362c6629", "score": "0.4516771", "text": "func (m *tree) subtreeCount() int {\n\tcount := 0\n\tfor _, t := range m.children {\n\t\tif t != nilMap {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "a14029871b33b69fb994dd384ebcb8fd", "score": "0.45160785", "text": "func countUnmappedColumns(mapping []int) int {\n\tcount := 0\n\tfor i := 0; i < len(mapping); i++ {\n\t\tif mapping[i] == unmappedColumn {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "108b9da14b4a4a733c363267090d3ebe", "score": "0.45138273", "text": "func (aln Alignment) Count(bases []byte) map[byte]int {\n\tcounts := make(map[byte]int)\n\tfor _, b := range bases {\n\t\tcounts[b] = 0\n\t}\n\tfor _, seq := range aln {\n\t\tfor _, char := range seq {\n\t\t\tcounts[byte(char)]++\n\t\t}\n\t}\n\treturn counts\n}", "title": "" }, { "docid": "19ea6e9bc14536a87b89fc4daefdd6d0", "score": "0.450874", "text": "func paintAndCount(ints []int, initialColor Color) (int, map[Point]Color) {\n\ttableau := make(map[Point]Color)\n\tvar painted int\n\tvar x, y int\n\n\tvar (\n\t\tpaintColor Color\n\t\tcurrentColor Color\n\t\tturnDirection Direction\n\t)\n\n\trobotDirection := Up\n\ttableau[Point{0, 0}] = initialColor\n\n\tm := intcode.NewBufferedMachine(ints, 0, 2)\n\tgo m.Run()\n\n\tfor {\n\t\tcurrentColor = tableau[Point{x, y}]\n\t\tvar colorInput int\n\t\tif currentColor == White {\n\t\t\tcolorInput = 1\n\t\t}\n\t\tok := m.AddInput(colorInput)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tpaintColor = Color(m.GetOutput() + 1)\n\t\tturnDirection = Direction(m.GetOutput())\n\n\t\tif currentColor == InitialBlack {\n\t\t\tpainted++\n\t\t}\n\t\ttableau[Point{x, y}] = paintColor\n\n\t\tswitch turnDirection {\n\t\tcase Left:\n\t\t\tswitch robotDirection {\n\t\t\tcase Up:\n\t\t\t\trobotDirection = Left\n\t\t\tcase Left:\n\t\t\t\trobotDirection = Down\n\t\t\tcase Down:\n\t\t\t\trobotDirection = Right\n\t\t\tcase Right:\n\t\t\t\trobotDirection = Up\n\t\t\t}\n\t\tcase Right:\n\t\t\tswitch robotDirection {\n\t\t\tcase Up:\n\t\t\t\trobotDirection = Right\n\t\t\tcase Left:\n\t\t\t\trobotDirection = Up\n\t\t\tcase Down:\n\t\t\t\trobotDirection = Left\n\t\t\tcase Right:\n\t\t\t\trobotDirection = Down\n\t\t\t}\n\t\t}\n\n\t\tswitch robotDirection {\n\t\tcase Up:\n\t\t\ty++\n\t\tcase Down:\n\t\t\ty--\n\t\tcase Left:\n\t\t\tx--\n\t\tcase Right:\n\t\t\tx++\n\t\t}\n\t}\n\treturn painted, tableau\n}", "title": "" }, { "docid": "833a589f34dc1d01156a10986c6d7dda", "score": "0.4506951", "text": "func CountStatistic(attempts int, amountOfCubes int) {\n\n\t//keys slice is used to sort map entries by the keys (for ordered output)\n\tvar keys []int\n\tresults := make(map[int]int)\n\n\tfor i := 0; i < attempts; i++ {\n\t\tres := ThrowCubes(amountOfCubes)\n\t\tresults[res] = results[res] + 1\n\t}\n\n\tfor k := range results {\n\t\tkeys = append(keys, k)\n\t}\n\n\tsort.Ints(keys)\n\n\tfor _, key := range keys {\n\t\tvar percent float64 = float64(results[key]) / float64(attempts)\n\t\tfmt.Printf(\"%v - %.2f%%\\n\", key, percent)\n\t}\n\n}", "title": "" }, { "docid": "7edd4852b4d3f6f96e20173e67dac017", "score": "0.4505281", "text": "func OnesCountConcept(x uint) int {\n\tsum := uint8(0)\n\tfor x != 0 {\n\t\tsum += pop8tab[x&0xff]\n\t\tx >>= 8\n\t}\n\treturn int(sum)\n}", "title": "" }, { "docid": "d9f62bb400694d123063c5a4fd468d9c", "score": "0.4503162", "text": "func CountElements(head *Node) map[int]int {\n\tm := make(map[int]int)\n\n\tl := head\n\tfor l != nil {\n\t\tm[head.value]++\n\n\t\tl = l.next\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "d141f9ed65a4ec0bbe08ca5d4c6271a9", "score": "0.45006138", "text": "func (n NUMANodes) TotalCPUs() int {\n\tvar cpus int\n\tfor _, node := range n {\n\t\tcpus += len(node.CPUs)\n\t}\n\treturn cpus\n}", "title": "" }, { "docid": "518b0fef1472b77c3107fd9ac7a235fb", "score": "0.44953853", "text": "func (m *CloudPcOverview) GetNumberOfCloudPcStatusUpgrading()(*int32) {\n val, err := m.GetBackingStore().Get(\"numberOfCloudPcStatusUpgrading\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "d99c8d4f089e7ac310ea66258065cbcb", "score": "0.4491063", "text": "func (b *Tiled) TileCount() int {\n\treturn len(b.tiles)\n}", "title": "" }, { "docid": "9878791ee08c8d724fb7bd662630e6f1", "score": "0.44846115", "text": "func countValuesFn(values []float64, bucket []int) map[float64]float64 {\n\tcountedValues := make(map[float64]float64, len(bucket))\n\tfor _, idx := range bucket {\n\t\tval := values[idx]\n\t\tif !math.IsNaN(val) {\n\t\t\tcountedValues[val]++\n\t\t}\n\t}\n\n\treturn countedValues\n}", "title": "" }, { "docid": "aa7c91c431fe1c19a2652985b18f4e00", "score": "0.44741246", "text": "func (t Table) TotalHappiness() int {\n\tvar h int\n\tfor _, g := range t {\n\t\th += g.Opinions[t.Left(g).Name]\n\t\th += g.Opinions[t.Right(g).Name]\n\t}\n\n\treturn h\n}", "title": "" } ]
485c241a15db14875649ea49bcc29ad1
Deprecated: Use ScheduledCallEditMessage.ProtoReflect.Descriptor instead.
[ { "docid": "a879907591cfc670105c4698309f7130", "score": "0.76843506", "text": "func (*ScheduledCallEditMessage) Descriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{66}\n}", "title": "" } ]
[ { "docid": "cce31413b4c48a1fe8f102f4fea39a29", "score": "0.695226", "text": "func (*ScheduledCallCreationMessage) Descriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{67}\n}", "title": "" }, { "docid": "d763a2630815071330a066e81c24940b", "score": "0.68462634", "text": "func (ScheduledCallEditMessage_EditType) EnumDescriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{66, 0}\n}", "title": "" }, { "docid": "69730ee6939acaab3e36e06a8c3a637c", "score": "0.6722512", "text": "func (x *fastReflection_MsgEditValidator) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgEditValidator\n}", "title": "" }, { "docid": "94a8e4e2e4e5bc6f6db20777baab8df6", "score": "0.67156696", "text": "func (ScheduledCallCreationMessage_CallType) EnumDescriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{67, 0}\n}", "title": "" }, { "docid": "df5187a7a50b46904deb2b27230469c0", "score": "0.6706409", "text": "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "title": "" }, { "docid": "4fdef62d91fd618b82f3de2bc9bfbc7b", "score": "0.66154706", "text": "func (*NotifyVirtualDaaScoreChangedRequestMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{84}\n}", "title": "" }, { "docid": "799f4a6be7d4b17eee3d112538815aeb", "score": "0.6473614", "text": "func (x *fastReflection_MsgEditValidatorResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgEditValidatorResponse\n}", "title": "" }, { "docid": "24d141e03fd9166327780edc7d5ce7a0", "score": "0.6456221", "text": "func (*VirtualDaaScoreChangedNotificationMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{86}\n}", "title": "" }, { "docid": "b23da3023513f4f4aa73e8265f024efe", "score": "0.6451624", "text": "func (*DeprecatedMessage) Descriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_peptide_testdata_comments_deprecated_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "37d0528d2c9641819264fbc50218f222", "score": "0.64023626", "text": "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "title": "" }, { "docid": "f3f5963a130b2db1c8faebfd81364d23", "score": "0.6343722", "text": "func (*NotifyVirtualSelectedParentBlueScoreChangedRequestMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{81}\n}", "title": "" }, { "docid": "85967133013e5a853846c5c9551c9d43", "score": "0.632299", "text": "func (*UpdateScheduleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_schedule_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "e1a50c2afe3793db318dedaea0a468d0", "score": "0.6312354", "text": "func (*NotifyActivityChange) Descriptor() ([]byte, []int) {\n\treturn file_dhs_proto_rawDescGZIP(), []int{203}\n}", "title": "" }, { "docid": "8eb7a6a01c5a319c75a933a807ce6aa2", "score": "0.63111234", "text": "func (*NotifyActivityTaskUpdate) Descriptor() ([]byte, []int) {\n\treturn file_dhs_proto_rawDescGZIP(), []int{189}\n}", "title": "" }, { "docid": "51d653c5a10e4370b53be4264e57803b", "score": "0.63001376", "text": "func (*NotifyFriendViewChange) Descriptor() ([]byte, []int) {\n\treturn file_dhs_proto_rawDescGZIP(), []int{177}\n}", "title": "" }, { "docid": "c0733b1bae68434c4ebb04f578d7d752", "score": "0.6291268", "text": "func (*NotifyUtxosChangedRequestMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{66}\n}", "title": "" }, { "docid": "3d4d30f97affbc1dac1552540c8deeeb", "score": "0.6282547", "text": "func (*NotifyVirtualDaaScoreChangedResponseMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{85}\n}", "title": "" }, { "docid": "da30e1821621587637eb639cd331d67e", "score": "0.627297", "text": "func (*NotifyActivityPeriodTaskUpdate) Descriptor() ([]byte, []int) {\n\treturn file_dhs_proto_rawDescGZIP(), []int{190}\n}", "title": "" }, { "docid": "9a2b38e97eda77a4dfcadac60d6852f0", "score": "0.6269603", "text": "func (*NotifyFriendChange) Descriptor() ([]byte, []int) {\n\treturn file_dhs_proto_rawDescGZIP(), []int{178}\n}", "title": "" }, { "docid": "1a50778a9bb2f091a7a4ea4eab068204", "score": "0.6257784", "text": "func (*PermissionChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_permission_change_proto_rawDescGZIP(), []int{0, 3}\n}", "title": "" }, { "docid": "0c3aebcc7cb903d63a6082596aef3b96", "score": "0.62563515", "text": "func (*StopNotifyingUtxosChangedRequestMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{70}\n}", "title": "" }, { "docid": "2cf397ff83ece74192cd84524c054297", "score": "0.6255882", "text": "func (*PermissionChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_permission_change_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "f895b23ffffd8569e2a7199f255c7177", "score": "0.6252618", "text": "func (*UpdateScheduleRequest) Descriptor() ([]byte, []int) {\n\treturn file_schedule_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "4895ee57ea714b40c2e7d35764e79f69", "score": "0.6245364", "text": "func (*UpdateOperationalIntentReferenceRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_api_v1_scdpb_scd_proto_rawDescGZIP(), []int{67}\n}", "title": "" }, { "docid": "a8e923311d9870655fe5d0a28b7e5580", "score": "0.62424433", "text": "func (*UpdateTriggerRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_serverless_triggers_v1_trigger_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "73df57008b7f61183a81d597cd6b2760", "score": "0.62361085", "text": "func (DeprecatedEnum) EnumDescriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_peptide_testdata_comments_deprecated_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "c433bfc8ab94e322d63ee60cafbed289", "score": "0.6230381", "text": "func (*VirtualSelectedParentBlueScoreChangedNotificationMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{83}\n}", "title": "" }, { "docid": "1c8151c688778d7e34471c8fc44cefe8", "score": "0.62256217", "text": "func (*MsgEditValidator) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_staking_v1beta1_tx_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "9ab6b163d3e28ae180d292ac4c7b3743", "score": "0.6219612", "text": "func (*UpdateTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_admin_teams_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "8002843b8f2781506be17d823045226d", "score": "0.62157977", "text": "func (*PlanResourceChange_Request) Descriptor() ([]byte, []int) {\n\treturn file_tfplugin5_proto_rawDescGZIP(), []int{13, 0}\n}", "title": "" }, { "docid": "90d289f11784b6f52648b81dd5948fe0", "score": "0.62114936", "text": "func (*PermissionChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_permission_change_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "4b3759baa3810484d491a4790fc5b509", "score": "0.6188458", "text": "func (x *fastReflection_MsgEditValidator) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"cosmos.staking.v1beta1.MsgEditValidator.description\":\n\t\tvalue := x.Description\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.staking.v1beta1.MsgEditValidator.validator_address\":\n\t\tvalue := x.ValidatorAddress\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.staking.v1beta1.MsgEditValidator.commission_rate\":\n\t\tvalue := x.CommissionRate\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.staking.v1beta1.MsgEditValidator.min_self_delegation\":\n\t\tvalue := x.MinSelfDelegation\n\t\treturn protoreflect.ValueOfString(value)\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgEditValidator\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.staking.v1beta1.MsgEditValidator does not contain field %s\", descriptor.FullName()))\n\t}\n}", "title": "" }, { "docid": "b96953a45c7677112c1111be2f264963", "score": "0.6186214", "text": "func (*MutateOperation) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_google_ads_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "dd56928269b2234ddbc7bc3551e1a214", "score": "0.6185576", "text": "func (*Expr_Call) Descriptor() ([]byte, []int) {\n\treturn file_sysl_proto_rawDescGZIP(), []int{19, 5}\n}", "title": "" }, { "docid": "7b1229da5556762d590981c19573c120", "score": "0.6178078", "text": "func (*PermissionChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_permission_change_proto_rawDescGZIP(), []int{0, 1}\n}", "title": "" }, { "docid": "f3736a40708a1083923ab459bd9e110c", "score": "0.61527485", "text": "func (*FocusChangedNotification) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{76}\n}", "title": "" }, { "docid": "8322188885c418cce382b9e4e63cc702", "score": "0.6152193", "text": "func (*CMsgDOTAEditFantasyTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_fantasy_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "3d0e8a1374302cbe6148143845a86750", "score": "0.6145267", "text": "func (*Call) Descriptor() ([]byte, []int) {\n\treturn file_sysl_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "c62f590b2e36eeec0f1dd33c51202864", "score": "0.6143948", "text": "func (*CallRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_function_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "cf6e445a13e4f40c5672b9c9a22b3879", "score": "0.61379564", "text": "func (*StopNotifyingUtxosChangedResponseMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{71}\n}", "title": "" }, { "docid": "f44156fb8db380343304a0b6b3fde79e", "score": "0.6135058", "text": "func (*CallFunctionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_functions_v1_functions_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "0e97099a30772662fd6ca74fcb021162", "score": "0.6134944", "text": "func (*InternalTransaction_CallValueInfo) Descriptor() ([]byte, []int) {\n\treturn file_core_Tron_proto_rawDescGZIP(), []int{30, 0}\n}", "title": "" }, { "docid": "b02e9ef10ca0474119a0a8f85e4bb5e1", "score": "0.6132187", "text": "func (*NotifyVirtualSelectedParentBlueScoreChangedResponseMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{82}\n}", "title": "" }, { "docid": "19d573e5717ae4dc55b280f0462fb8ea", "score": "0.6130321", "text": "func (x *fastReflection_MsgUndelegate) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUndelegate\n}", "title": "" }, { "docid": "a36011375faa5c5f61eb2ab0d0bd8add", "score": "0.61270696", "text": "func (*CDOTAUserMessage_TeamCaptainChanged) Descriptor() ([]byte, []int) {\n\treturn file_dota_usermessages_proto_rawDescGZIP(), []int{118}\n}", "title": "" }, { "docid": "185d276754b02356d89101a39cb0f1c3", "score": "0.61093444", "text": "func (*UpdateMessageReceiversRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_message_receiver_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "ede05fe4eeafea3e2a931311c5522e92", "score": "0.6108765", "text": "func (*PlanResourceChange) Descriptor() ([]byte, []int) {\n\treturn file_tfplugin5_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "2d6846a621e4ab91e57e58cf5062fb70", "score": "0.6108114", "text": "func (x *fastReflection_MsgCancelUnbondingDelegation) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCancelUnbondingDelegation\n}", "title": "" }, { "docid": "6e6f3342fff7e08cc52854e1783c93fc", "score": "0.61046", "text": "func (*ExtensionRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "c18a3fb19c87b99d4b8a08c65e477655", "score": "0.61007106", "text": "func (*UpdateTriggerMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_serverless_triggers_v1_trigger_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "8bfbcd648f49e4880835838044dc4a46", "score": "0.6099012", "text": "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_events_v1_events_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "3195386a99c07884899f4c6cf550573e", "score": "0.60871804", "text": "func (*UpdateMessageRsp) Descriptor() ([]byte, []int) {\n\treturn file_cms_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "09244f76c61cb2c0f9ee3d871f3c0c17", "score": "0.6086891", "text": "func (x *fastReflection_BatchContract) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_BatchContract\n}", "title": "" }, { "docid": "5c8e86155ca65ec635f3376b565c186a", "score": "0.6085418", "text": "func (*OnCall) Descriptor() ([]byte, []int) {\n\treturn file_core_project_v1_project_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "ff810fc4fc99d6c33351a8388a18a930", "score": "0.60833627", "text": "func (*UpdateTodoNameByIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_todo_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "779bd7707357d9ba9f141c6e8035aaf0", "score": "0.607825", "text": "func (*ChangeControlRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_changecontrol_v1_services_gen_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "a3b4ad1b103247bd69c466bab353cdc1", "score": "0.60728824", "text": "func (x *fastReflection_MsgCreateValidator) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCreateValidator\n}", "title": "" }, { "docid": "0bdc63ab16ba5d253a71c8f981868e9a", "score": "0.60724586", "text": "func (*EvtNewChatMessage) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "eca3779cc5a01e530041996b5934d5f6", "score": "0.60693705", "text": "func (x *fastReflection_MsgDelegate) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgDelegate\n}", "title": "" }, { "docid": "4f85bd4eaba60e81a5c0650e82368628", "score": "0.6069363", "text": "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_google_watcher_v1_watch_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "5aec9742a6f5a43e8c31536c37def13a", "score": "0.60676205", "text": "func (x *fastReflection_QueryDisabledListRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryDisabledListRequest\n}", "title": "" }, { "docid": "e8f6feb2510a779dcff2be87757d823c", "score": "0.6057413", "text": "func (*BotEventsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_swarming_proto_api_v2_swarming_proto_rawDescGZIP(), []int{45}\n}", "title": "" }, { "docid": "3ed2b5d0904aba7d53d1edd86e128599", "score": "0.6056408", "text": "func (*CMsgDOTAFantasyLeagueEditInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_fantasy_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "c369795657abfc878545576a4de13fed", "score": "0.60560787", "text": "func (*Call) Descriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{30}\n}", "title": "" }, { "docid": "9ba11866c8fb78cfa1e8a332eff5dd7f", "score": "0.6054437", "text": "func (*TelemetryUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_telemetry_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "e1cbdbd78ad494996309533d684b579b", "score": "0.6048988", "text": "func (*Edit) Descriptor() ([]byte, []int) {\n\treturn file_graphik_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "b45dacf73c7656718804df1160eb90aa", "score": "0.60464394", "text": "func (*ApplyResourceChange_Request) Descriptor() ([]byte, []int) {\n\treturn file_tfplugin5_proto_rawDescGZIP(), []int{14, 0}\n}", "title": "" }, { "docid": "c1496d7b44ed21b9638161cfe2ab26ea", "score": "0.60395205", "text": "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "5cef34e6deb5bd226a5b3b440cbef499", "score": "0.6036961", "text": "func (*NotifyUtxosChangedResponseMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{67}\n}", "title": "" }, { "docid": "ea224c9e37cbb9c23192f49a7359f8ec", "score": "0.603383", "text": "func (x *fastReflection_MsgBeginRedelegate) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgBeginRedelegate\n}", "title": "" }, { "docid": "b26d73fc03878f61ad1615ac5cf3189b", "score": "0.6030196", "text": "func (*DeleteScheduleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_schedule_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "be897c0af88b85e5635e4669fa4a2d51", "score": "0.6025095", "text": "func (*ChangeControlStreamRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_changecontrol_v1_services_gen_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "d0e981afa01f8bc6fa78505e05fa3546", "score": "0.6020039", "text": "func (*WatchCancelRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "163d1e83517f387ae6b1b91272e1e848", "score": "0.6019489", "text": "func (*UtxosChangedNotificationMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{68}\n}", "title": "" }, { "docid": "7a91f9cd8f49d6ed8c6e15d8dc37a1d1", "score": "0.60185397", "text": "func (*UpdateActivityTypeReply) Descriptor() ([]byte, []int) {\n\treturn file_activitytypecomm_activitytype_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "77e9bb1bab4ed483c3e833b2448e3572", "score": "0.601695", "text": "func (*ChangeBatch) Descriptor() ([]byte, []int) {\n\treturn file_google_watcher_v1_watch_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "7a7f507dac5db5fe44424083e7e65bce", "score": "0.6016921", "text": "func (*DeleteScheduleRequest) Descriptor() ([]byte, []int) {\n\treturn file_schedule_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "213c3f00684c5489da193d7b7fffce89", "score": "0.60109967", "text": "func (*UpdateTodoListNameByIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_todo_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "2efeb19df12790918889402959297988", "score": "0.6010839", "text": "func (*UpdateAccessApprovalSettingsMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_accessapproval_v1_accessapproval_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "90d906a3176ee95053a308b22fa9f8fc", "score": "0.6004752", "text": "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_arista_changecontrol_v1_changecontrol_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "7ac7052a17a87c241c7542744e6b56f7", "score": "0.60002005", "text": "func (*LabelEditAction) Descriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{135}\n}", "title": "" }, { "docid": "6d20f0d1db309fcab7f0b82542875127", "score": "0.5997106", "text": "func (*ChangeControlConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_changecontrol_v1_services_gen_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "3d25ea60561c6d1d987529eb2a213e5d", "score": "0.5991254", "text": "func (*ResumeTriggerRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_serverless_triggers_v1_trigger_service_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "cf1c5e74bdd026fafed4a473b310807e", "score": "0.5989514", "text": "func (*GetTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_admin_teams_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "76385c25cbd5f7c09a6060698dfb4106", "score": "0.59892845", "text": "func (*ProtoUpdateU) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_crud_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "7a6309663885ddee6ee279862925acfe", "score": "0.59873766", "text": "func (x *fastReflection_DisabledListResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_DisabledListResponse\n}", "title": "" }, { "docid": "f11147b8f892c790cd9787e9ba91b226", "score": "0.59870756", "text": "func (*MutateOperationResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_google_ads_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "de4b4085e58cad62d3c83a1f0be0f8fb", "score": "0.5984495", "text": "func (*EditableEnum) Descriptor() ([]byte, []int) {\n\treturn file_registry_ChecklistService_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "98b7d63f280a89316a648deabc2ec4c3", "score": "0.5984461", "text": "func (*PauseTriggerRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_serverless_triggers_v1_trigger_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "aee03c378674d603e32f14025c6cb320", "score": "0.59832704", "text": "func (*UpdateActivityTypeRequest) Descriptor() ([]byte, []int) {\n\treturn file_activitytypecomm_activitytype_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "c15a2f1b9a407b0ab3e2920d4e4df913", "score": "0.59831655", "text": "func (*MsgEditValidatorResponse) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_staking_v1beta1_tx_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "37d4b227f6cef458d13ce29dcabf6730", "score": "0.5979592", "text": "func (*ContractCallRequest) Descriptor() ([]byte, []int) {\n\treturn file_contract_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "929168c096d40b99295f1123bef7d34c", "score": "0.5978306", "text": "func (*PollUpdateMessage) Descriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{74}\n}", "title": "" }, { "docid": "36c48287add8762c18c4a01e04fa580e", "score": "0.597738", "text": "func (*PermissionChange_Current) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_permission_change_proto_rawDescGZIP(), []int{0, 2}\n}", "title": "" }, { "docid": "6dafd1846d21b4a54c8564ea7871c7f6", "score": "0.5977023", "text": "func (*RedemptionSchedule) Descriptor() ([]byte, []int) {\n\treturn file_injective_insurance_rpc_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "a952e2ea8b48b3b3c03f423eb7c19707", "score": "0.597617", "text": "func (*ServerReflectionRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "9b36313cc2fc080cb1121b40cb282bcc", "score": "0.59759295", "text": "func (*PrivacySettingRelayAllCalls) Descriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{124}\n}", "title": "" }, { "docid": "d91dd685f9a0e20576889ae8e3876d8d", "score": "0.5975342", "text": "func (*PollUpdate) Descriptor() ([]byte, []int) {\n\treturn file_pb_chat_chat_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "5ed783c297ca1b9c9d446a0064eafa0a", "score": "0.5972577", "text": "func (*EnumMessage) Descriptor() ([]byte, []int) {\n\treturn file_proto2_scalars_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "693e01e0ed46d4cd5d3eabd8d782ea10", "score": "0.5972001", "text": "func (*RefreshReply) Descriptor() ([]byte, []int) {\n\treturn file_grpc_grpc_proto_rawDescGZIP(), []int{19}\n}", "title": "" } ]
908fcbc3a838911e857586e907d48849
GetNodeIdOk returns a tuple with the NodeId field value and a boolean to check if the value has been set.
[ { "docid": "0775bb96ae64a3fc2f3364c5a4842e54", "score": "0.83319455", "text": "func (o *RequestrouterInstance1) GetNodeIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.NodeId, true\n}", "title": "" } ]
[ { "docid": "757c0eb0147422e43742c46382ed2599", "score": "0.7452404", "text": "func (o *ShardOwner) GetNodeIDOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.NodeID, true\n}", "title": "" }, { "docid": "6d6413613309809377a520124360260f", "score": "0.7406699", "text": "func (o *ProvenanceNodeDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "4e20184ea7201b67c0a1c02fa8c9107e", "score": "0.6819461", "text": "func (o *ProvenanceNodeDTO) GetClusterNodeIdentifierOk() (*string, bool) {\n\tif o == nil || o.ClusterNodeIdentifier == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ClusterNodeIdentifier, true\n}", "title": "" }, { "docid": "f4a39db183592961615b443d641b9214", "score": "0.6765566", "text": "func (o *DefaultStreamGroup) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "2d5edb4c564282649a863c8ccef90aee", "score": "0.67617685", "text": "func (o *Connect) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "b765d28a727eb707ecc88380c690ee13", "score": "0.670801", "text": "func (o *DataStoreObject) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "32fcad2c3536466a1987c7c90f169915", "score": "0.6693504", "text": "func (m *K8sEventMutation) NodeId() (r uint, exists bool) {\n\tv := m.nodeId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "3e2a52d672a527af66519fd4113684d8", "score": "0.6681001", "text": "func (o *TipoEvento) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "8c4a4d810534d40caec82452e7fdd78c", "score": "0.66768014", "text": "func (o *RemoteProcessGroupPortDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "aa6bdda80e310ed2c3a33f65be2b4084", "score": "0.6676763", "text": "func (o *PmemConfig) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "59c0d27813b75c05571a8eaf7d7c6430", "score": "0.6673475", "text": "func (o *Connector) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "7b60d468b7583bcdce2c65b6a740fd88", "score": "0.6670467", "text": "func (m *MetricMutation) NodeId() (r uint, exists bool) {\n\tv := m.nodeId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "1d096c4a4e9c0b22baa5be51ab245fe0", "score": "0.66613925", "text": "func (o *TipoNotificacao) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "ab5bc6cd19d3678c5bf897592eb75c99", "score": "0.6660251", "text": "func (m *EventMutation) NodeId() (r uint, exists bool) {\n\tv := m.nodeId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "d3c8669ec6274d073e84bb7a9f733f6e", "score": "0.6656341", "text": "func (o *ViewAppSetting) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "84b5546f317013e858f6c6b37d6a8e8a", "score": "0.6651796", "text": "func (o *ModelsTask) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "6ef133a9f10f6b28ed195b81946a3a20", "score": "0.664991", "text": "func (o *DataStoreChannel) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "17733f4fee8f5458c05d0adf2aea3098", "score": "0.6642835", "text": "func (m *ContainerMutation) NodeId() (r uint, exists bool) {\n\tv := m.nodeId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "d3b5f5e89c0de1a899c14489ade2de2a", "score": "0.6630517", "text": "func (o *RegistryDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "cb18703ec36a024b5c181dd2efb01dea", "score": "0.66302866", "text": "func (o *TipoNotificacaoUtilizador) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "bf083d207a585d1ca429481e32cfce99", "score": "0.66003513", "text": "func (o *ViewTasklist) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "39bcacb0ce0526b03647869c82e77f1e", "score": "0.65961754", "text": "func (o *ResourceMember) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "c7c0e9d4bed22c5110d9544752bd8ffb", "score": "0.65954393", "text": "func (o *VmAddDevice) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "0cf2e0765922e78cdb8c75e328264bfa", "score": "0.6591022", "text": "func (o *VirtualInstance) GetIdOk() (*string, bool) {\n\tif o == nil || IsNil(o.Id) {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "c00db8543ef1f53e3a939076d50b74cb", "score": "0.6575773", "text": "func (m *ProcesMutation) NodeId() (r string, exists bool) {\n\tv := m.nodeId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "1cae92646a986bc97fdce33793c45c6a", "score": "0.6568839", "text": "func (o *SyntheticsConfigVariable) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "473934619bb1957427d77c3ca73fce94", "score": "0.6565054", "text": "func (o *Event) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "450f9729b44475a111f85180440a6905", "score": "0.65535176", "text": "func (o *Cell) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "de62f64b80e60b9aab1b6fd54a135214", "score": "0.65513265", "text": "func (o *Plano) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "c95eb8bb0f6f75f6a98baf1f0d7d605e", "score": "0.6544407", "text": "func (o *MicrosoftGraphDomain) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "title": "" }, { "docid": "f50e1a567182433757ff9348089be923", "score": "0.6538833", "text": "func (o *Dns) GetIdOk() (*Dnsid, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "3763d251d5083c0c36985a1118644c7d", "score": "0.65336674", "text": "func (o *PatchedWorkspace) GetIdOk() (*int32, bool) {\n\tif o == nil || IsNil(o.Id) {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "89777978f6091f73485a3a41705c95b5", "score": "0.6532974", "text": "func (o *ConnectionStatusDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "2d03b6cd412ca7e370355cb7367760be", "score": "0.65151966", "text": "func (o *User) GetIdOk() (int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "title": "" }, { "docid": "9ff42fd9173b4d114e416ef9dcc10cdc", "score": "0.6501787", "text": "func (o *Session) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "0078a9cdf6614ea96ab0c22a824df069", "score": "0.6499805", "text": "func (o *MicrosoftGraphAuditLogRoot) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "title": "" }, { "docid": "07fdd62bc95a42d64f987d79f4ac63e8", "score": "0.6498233", "text": "func (o *DhcpRangeAddInput) GetServerIdOk() (*int32, bool) {\n\tif o == nil || o.ServerId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ServerId, true\n}", "title": "" }, { "docid": "aa5f7916e907a16ed7545d1ae0a018d5", "score": "0.6496251", "text": "func (o *SchemawafRequest) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "32409914a0df2536a2576c1df13179b5", "score": "0.6476513", "text": "func (m *ProcessMutation) NodeId() (r string, exists bool) {\n\tv := m.nodeId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "a04e0d9b81db64c1bbd675e594069a39", "score": "0.64637476", "text": "func (o *ProcessorStatusDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "e446267c93fe546a7aa05703c08a3340", "score": "0.6455052", "text": "func (o *CustconfOriginPersistentConnections) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "79707f690a3ac16eb1e06bd9df805a7a", "score": "0.64540714", "text": "func (o *LinkLinkinfoInfoData) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "49822ea5269de91a78f9152fbfd80ee4", "score": "0.64539814", "text": "func (o *MessageOut) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "55901fd6067b8b2855c18a1fa5c260ba", "score": "0.64471775", "text": "func (o *NormalizedProjectRevision) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "56656f3cfce950cabc567e2479a24f81", "score": "0.644428", "text": "func (o *Label) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "df9788c130e035c2e5e03ced3ce5efbf", "score": "0.64425445", "text": "func (o *SecurityMonitoringTriageUser) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "317059c3c7839fc602ab756960f01fcd", "score": "0.64321685", "text": "func (o *ViewReaction) GetObjectIdOk() (*int32, bool) {\n\tif o == nil || o.ObjectId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ObjectId, true\n}", "title": "" }, { "docid": "bb1ec9e08a6fe2586abbb30eee2cef1f", "score": "0.64296806", "text": "func (o *PageAccessUser) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "713de435545ff908b099dfc9d02c95d7", "score": "0.64196897", "text": "func (o *DowntimeResponseData) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "69bd683055d65076a510fbaeaa2b62ee", "score": "0.64183986", "text": "func (o *MatchingDowntime) GetIdOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "b096deeba6ffab1ddbe474f55b1c375d", "score": "0.64063084", "text": "func (o *ToPosition) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "c8bbeae6c4cb8f29b5639db604c1f213", "score": "0.64031106", "text": "func (o *FullWebRequestRule) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "1f0db3049920c22da1a75ffed5cec69f", "score": "0.6395665", "text": "func (o *ViewTimer) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "7e04fbd61c85f3c2c885fca3a893008d", "score": "0.63890547", "text": "func (o *Vm) GetNetIdOk() (*string, bool) {\n\tif o == nil || o.NetId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetId, true\n}", "title": "" }, { "docid": "f477f54392bad7c8b18e48f91245f5b9", "score": "0.637646", "text": "func (o *Dashboard) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "c0aed4d10db124d4021c09201fe3662d", "score": "0.6376036", "text": "func (o *OrgSimpleContentAccess) GetIdOk() (*string, bool) {\n\tif o == nil || IsNil(o.Id) {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "accc12fc0a93703a99d63773a9f74495", "score": "0.6365996", "text": "func (o *MicrosoftGraphEventMessage) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "title": "" }, { "docid": "5480c0e33191dc20eb6413986d29b21d", "score": "0.6363129", "text": "func (o *FromPosition) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "04598dfad2a0843eedc1cc355bb96d5e", "score": "0.63631266", "text": "func (o *MicrosoftGraphEducationRoot) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "title": "" }, { "docid": "8572f6e04ed922d08cb6e661629701ce", "score": "0.636209", "text": "func (o *Problem) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "51dd384fbffe8ded90e54f7150d4f993", "score": "0.6361814", "text": "func (o *VerifyUserResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "08c7f482cce013ced7630ecbcc1408f0", "score": "0.63581705", "text": "func (o *KubernetesCredentials) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "b5b6b5bc2770f1791414de3bbeeb6286", "score": "0.63581294", "text": "func (o *Organization) GetIdOk() (*string, bool) {\n\tif o == nil || IsNil(o.Id) {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "cd6c0013947b1ed7de24079683f4d3d3", "score": "0.6358099", "text": "func (o *CountryField) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "e71e560a7de804ac17c4dfe719cbd3b8", "score": "0.6340561", "text": "func (o *OpaqueAndExternalWebServiceRule) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "487f2bbbcff82931c642258175461175", "score": "0.6336247", "text": "func (m *EventMutation) AddedNodeId() (r uint, exists bool) {\n\tv := m.addnodeId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "427f5d1a36470e39833cc12a932d96fc", "score": "0.63352585", "text": "func (o *ViewAllocation) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "6c64263469f4ee058c6460d10b960662", "score": "0.6334023", "text": "func (o *LicenseUser) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "3b6a8b1fcde6252dcbb8019633af4d23", "score": "0.6331781", "text": "func (o *PiggyBankRead) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "7769aec9d4bc54bb9e28f99ab8647941", "score": "0.63178015", "text": "func (o *EventResponseEventResource) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "71a57cda4f9534131484f973fee98f58", "score": "0.6316267", "text": "func (o *Message) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "0f1812e0475ea9a7e0160d8e3a0fda58", "score": "0.63142234", "text": "func (o *SmsStatus) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "af638d43c3073f8e78a026aa8413fc44", "score": "0.63130164", "text": "func (o *MicrosoftGraphLocationConstraintItem) GetUniqueIdOk() (string, bool) {\n\tif o == nil || o.UniqueId == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.UniqueId, true\n}", "title": "" }, { "docid": "ae20c877a05b43524a1ae92b5c068dd5", "score": "0.63106275", "text": "func (o *Ga4ghRnaQuantification) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "title": "" }, { "docid": "24003bce1498725207d7be2138f977f9", "score": "0.63099444", "text": "func (o *VersionedProcessGroup) GetIdentifierOk() (*string, bool) {\n\tif o == nil || o.Identifier == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Identifier, true\n}", "title": "" }, { "docid": "48c1de2aa2a18dbb965d70631a6b56e9", "score": "0.6309275", "text": "func (m *K8sEventMutation) AddedNodeId() (r uint, exists bool) {\n\tv := m.addnodeId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "86368125cdf819814a1cd9c90fc7821a", "score": "0.630006", "text": "func (o *Account) GetIdOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "7ccae84cf554150b2234e8f4ba6af504", "score": "0.62994874", "text": "func (m *MetricMutation) AddedNodeId() (r uint, exists bool) {\n\tv := m.addnodeId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "eac5c107c0bdc971cac9ea52ca7dcc7f", "score": "0.6298179", "text": "func (o *NicLight) GetNetIdOk() (*string, bool) {\n\tif o == nil || o.NetId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetId, true\n}", "title": "" }, { "docid": "e07ad6e4b3a1e7d06e74085e8b70536e", "score": "0.6292643", "text": "func (o *Workflow) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "63a9b829a969dbbabc365b1548ebdc2b", "score": "0.6291536", "text": "func (o *PlanRequest) GetIdOk() (*string, bool) {\n\tif o == nil || IsNil(o.Id) {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "59a9473b4e80662006866df7a84350c3", "score": "0.6290111", "text": "func (o *SystemProfileRpmOstreeDeployments) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "d971f6310916ae6f3de10b42dabb7888", "score": "0.62890935", "text": "func (o *FDXNotificationPayload) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "7f8c5e0cdfd79ca85b6e1c29fef4eadc", "score": "0.62889826", "text": "func (o *MicrosoftGraphWorkbookSessionInfo) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "title": "" }, { "docid": "6214938f393bf42bc64019d96c958297", "score": "0.6283129", "text": "func (o *SecurityMonitoringRuleResponse) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "fef7547d641cc707130bc0d6b88d2326", "score": "0.62821424", "text": "func (o *IsdnList) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "871ccc285502ba9b82e3c3dbba8bb3ed", "score": "0.6277052", "text": "func (o *DhcpFailoverDataData) GetServerIdOk() (*string, bool) {\n\tif o == nil || o.ServerId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ServerId, true\n}", "title": "" }, { "docid": "024cee0d83d56a6be710f4b9db9d26f5", "score": "0.6276228", "text": "func (o *Cell) GetViewIDOk() (*string, bool) {\n\tif o == nil || o.ViewID == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ViewID, true\n}", "title": "" }, { "docid": "136610d44a2fa8eee85bbc9cddcff92a", "score": "0.6271589", "text": "func (o *Stamp) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "b90d8c1ea7d5cc74a385b66451f93b59", "score": "0.62612563", "text": "func (o *MicrosoftGraphOrganization) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "title": "" }, { "docid": "0d09cde31ad83988befb452a068ecac6", "score": "0.62611836", "text": "func (o *Ga4ghVariantSet) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "title": "" }, { "docid": "35d1064004900e22144b818b79c8a7bc", "score": "0.62580574", "text": "func (o *RequiredPermissionDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "fd3814e4d005d3382e5c954dbeac63ce", "score": "0.6257592", "text": "func (o *SettingsObjectResponse) GetObjectIdOk() (*string, bool) {\n\tif o == nil || o.ObjectId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ObjectId, true\n}", "title": "" }, { "docid": "fd3814e4d005d3382e5c954dbeac63ce", "score": "0.6257592", "text": "func (o *SettingsObjectResponse) GetObjectIdOk() (*string, bool) {\n\tif o == nil || o.ObjectId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ObjectId, true\n}", "title": "" }, { "docid": "58925c0e6e133709fa854e5fc5eb0a1e", "score": "0.62516236", "text": "func (o *EquipmentTransceiver) GetModuleIdOk() (*int64, bool) {\n\tif o == nil || o.ModuleId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ModuleId, true\n}", "title": "" }, { "docid": "f16999b635d21def519dc5f3ec70cd85", "score": "0.6251224", "text": "func (o *ProtectedItem) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "f9ab62cd3dad9bb2b200222f1fd1e355", "score": "0.62370056", "text": "func (o *TemplateSummaryTaskAllOf) GetIdOk() (*uint64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "a9e2a83ca6a407e4f27aa8653078fb1f", "score": "0.62365854", "text": "func (o *CustconfAuthUrlSignHmacTlu) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "e992105096289cd85d12fe1fffb82804", "score": "0.6235258", "text": "func (m *ContainerMutation) AddedNodeId() (r uint, exists bool) {\n\tv := m.addnodeId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "2b34e691888e2132353068cc8dc5f526", "score": "0.6223902", "text": "func (o *TfaMessage) GetMessageIdOk() (*string, bool) {\n\tif o == nil || o.MessageId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MessageId, true\n}", "title": "" } ]
743c42434fafd2cbbd783ab45bea8d27
Beware that this test flushes and fills the DB!
[ { "docid": "d80dcabd31071d200fc25ff25890a616", "score": "0.0", "text": "func TestSetAndGetOneOrder(t *testing.T) {\n\trc, err := redisclient.MakeNewClient()\n\tassert.NoErrorf(t, err, \"Failed to connect to redis\")\n\tif err != nil {\n\t\treturn\n\t}\n\t_, err = rc.FlushDB().Result()\n\tassert.NoErrorf(t, err, \"Failed to flushDb\")\n\tif err != nil {\n\t\treturn\n\t}\n\to := &Order{ID: 1, Clientid: 1, Product: \"Mashinka\", Total: *big.NewRat(1000, 100)}\n\terr = o.Save(rc)\n\tassert.NoErrorf(t, err, \"Failed to Save\")\n\tif err != nil {\n\t\treturn\n\t}\n\tvar o2 *Order\n\to2, err = GetOrderByID(rc, 1)\n\tassert.NoErrorf(t, err, \"Failed to Get\")\n\tif err != nil {\n\t\treturn\n\t}\n\tassert.True(t, ordersEqual(o, o2), \"Saved value %v does not match retrieved value %v\", o, o2)\n\n\to2, err = GetOrderByID(rc, 2)\n\tassert.Nilf(t, o2, \"Found value %v for non-existing key\", o2)\n\n\terr = rc.Close()\n\tassert.NoErrorf(t, err, \"Failed to Close\")\n\treturn\n}", "title": "" } ]
[ { "docid": "5deb3423d8bb4e294c174513653b0570", "score": "0.703878", "text": "func initTest(db *sql.DB) {\n\tif _, err := db.Exec(\"TRUNCATE table goods_list\"); err != nil {\n\t\tpanic(err)\n\t}\n\tif _, err := db.Exec(\"update test_t set value=50000 where id=1\"); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "012a5907a674455ad0c321a8c9a89352", "score": "0.6878033", "text": "func TestUnitDBBasic(t *testing.T) {\n // Open the Database\n const dbpath = \"dbbasic.db\"\n db := getDB(dbpath, true)\n defer db.Close()\n\n name := \"Fine\"\n startDate := createDate(0, 0)\n endDate := createDate(1, 5)\n startTxt := startDate.Format(\"2006-01-02 15:04\")\n endTxt := endDate.Format(\"2006-01-02 15:04\")\n\n // Execute insertion query\n query := fmt.Sprintf(`\n INSERT OR REPLACE INTO rooms(\n Name,\n StartTime,\n EndTime\n ) values(\"%s\", dateTime(\"%s\"), dateTime(\"%s\"))\n `, name, startTxt, endTxt)\n db.Execute(query)\n\n // Execute read query\n readQuery := `\n SELECT Name, StartTime, EndTime\n FROM rooms\n `\n result := db.Read(readQuery)\n\n // Ensure results are as expected\n rooms := deserializeRooms(result)\n assertEqual(t, len(rooms), 1, \"Read query returned wrong number of rooms.\")\n assertRoomsEqual(t, rooms[0], Room{name, startDate, endDate})\n\n // Execute a dependency check query\n check := fmt.Sprintf(`\n SELECT CASE WHEN EXISTS (\n SELECT *\n FROM rooms\n WHERE StartTime BETWEEN dateTime(\"%s\") AND dateTime(\"%s\")\n )\n THEN CAST(1 AS BIT)\n ELSE CAST(0 AS BIT) END\n `, startTxt, endTxt);\n assert(t, db.Check(check), \"Dependency check failed.\")\n\n // Execute a merge check query\n merge := `\n SELECT 0\n `\n assert(t, !db.Check(merge), \"Merge check failed.\")\n}", "title": "" }, { "docid": "0f6e19a752a03f17f64377d694d9e699", "score": "0.6457665", "text": "func TestDatabase() {\n\tvar ent Entity\n\tent.Name = \"htc\"\n\tent.Prod = \"hermes\"\n\tent.Price = 182.12\n\tAddNew(ent)\n}", "title": "" }, { "docid": "1b86bd1cf3bf9a5a645b607ffe40e6cf", "score": "0.6417024", "text": "func TestInsert() {\n\t// db.Connect()\t\n\n\tobjID1 := objectid.New().Hex()\n\tobjID2 := objectid.New().Hex()\n\tobjID3 := objectid.New().Hex()\n//\tvar login_attempts int32 = 4\n\ttestCTX := make( map[string]interface{} )\n\ttestCTX[\"username\"] = \"m@llory6\"\n\ttestCTX[\"first_name\"] = \"Mal\"\n\ttestCTX[\"last_name\"] = \"Allen\"\n\ttestCTX[\"region\"] = \"Wonderland\"\n\ttestCTX[\"birthdate\"] = time.Now().Round(time.Millisecond)\n\ttestCTX[\"login_attempts\"] = 1\n\ttestCTX[\"networks\"] = []string{objID1, objID2, objID3}\n\ttestCTX[\"password\"] = \"qwerty\"\n\tid := db.Write(\"brypt_usrs\", testCTX)\t// Incorrect collection name (should return nilObjectID)\n\tprint(\"\\nnil id: \")\n\tfmt.Print(id)\n\tid = db.Write(\"brypt_users\", testCTX)\n\tprint(\"\\nid: \")\n\tfmt.Print(id)\n\tid = db.Write(\"brypt_users\", testCTX)\n\tprint(\"\\nid: \")\n\tfmt.Print(id)\n\n/*\ttestCTX[\"username\"] = \"TotallyTom\"\n\ttestCTX[\"first_name\"] = \"Alice\"\n\ttestCTX[\"last_name\"] = \"Allen\"\n\ttestCTX[\"region\"] = \"Wonderland\"\n\ttestCTX[\"birthdate\"] = time.Now().Round(time.Millisecond)\n\ttestCTX[\"login_attempts\"] = 4\n\ttestCTX[\"networks\"] = []objectid.ObjectID{objID1, objID2, objID3}\n\tid2 := db.Write(w, \"brypt_users\", testCTX)\n\tprint(\"\\nid2: \")\n\tfmt.Print(id2)*/\n//\tdefer db.Disconnect()\t// Causes an internal server error for some reason...\n}", "title": "" }, { "docid": "3e3c23c74097c95256166dde531778ea", "score": "0.6393382", "text": "func prepareGatewayTestDB() error {\n\tdb, err := buntdb.Open(\"./gateway.db\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\terr = db.Update(func(tx *buntdb.Tx) error {\n\t\t// set first row\n\t\t_, _, err = tx.Set(\"dc3070c8\", \"N/A\", nil)\n\t\treturn err\n\t})\n\treturn err\n}", "title": "" }, { "docid": "a043fa93c84290864fa5ba1f205cf34b", "score": "0.63902295", "text": "func test_insertions(db *db.Backend) error {\n\t// Insert Zones\n\terr := db.InsertZones(zones)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Insert Sites\n\terr = db.InsertSites(sites)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Insert Subnets\n\terr = db.InsertSubnets(subnets)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Insert Transitions\n\terr = db.InsertTransitions(transitions)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"Insertions Done\")\n\treturn nil\n}", "title": "" }, { "docid": "91555be1c8a023cdb42a46352619914c", "score": "0.63757193", "text": "func flushDB() {\n\t//if dbPortIsListening() {\n\tExpect(dlClient.GetDB().FlushDB().Err()).NotTo(HaveOccurred())\n\t//}\n}", "title": "" }, { "docid": "c58ed0d51273e7bf16c5751e90753328", "score": "0.6308968", "text": "func prepareQTestDB() error {\n\tdb, err := buntdb.Open(\"./MICROSERVICE_READ_VALUES.db\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\terr = db.Update(func(tx *buntdb.Tx) error {\n\t\t// set first row\n\t\t_, _, err = tx.Set(\"5ae6216b415dc4b0816502bf\", `{\"type\":\"MICROSERVICE_READ_VALUES\",\"topic\":\"event/OEM/MODEL/NAME/VERSION/00000000-aaaaaaaa-11111111\",\"id\":\"00000000-aaaaaaaa-11111111\",\"attribute\":\"Type\",\"value\":\"N/A\",\"timeStamp\":1525031275}`, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// set second row\n\t\t_, _, err = tx.Set(\"5ae6216b415dc4b081650516\", `{\"type\":\"MICROSERVICE_READ_VALUES\",\"topic\":\"event/OEM/MODEL/NAME/VERSION/00000000-aaaaaaaa-11111111\",\"id\":\"00000000-aaaaaaaa-11111111\",\"attribute\":\"Revision\",\"value\":\"N/A\",\"timeStamp\":1525031275}`, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// set third row\n\t\t_, _, err = tx.Set(\"5ae6216b415dc4b08165056b\", `{\"type\":\"MICROSERVICE_READ_VALUES\",\"topic\":\"event/OEM/MODEL/NAME/VERSION/00000000-aaaaaaaa-11111111\",\"id\":\"00000000-aaaaaaaa-11111111\",\"attribute\":\"Serial Number\",\"value\":\"#FFFFFFF\",\"timeStamp\":1525031275}`, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}", "title": "" }, { "docid": "0ea6036639321419ed4d3a28b2ca2ace", "score": "0.630732", "text": "func TestRetreivingAllDatabaseData(t *testing.T) {\n\tconnectToDatabase()\n\tcountTotalDataTable()\n\ttotalData, err := db.Exec(\"SELECT COUNT(*) FROM TEST\")\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif totalData != 5 {\n\t\tt.Error(\"Numbers don't match\")\n\t}\n\n}", "title": "" }, { "docid": "0208d93905cd5056ecb8535a7e540eaf", "score": "0.6233966", "text": "func dbSetupTestData(c *cli.Context) {\n\tdb, err := dbOpenWrapper(dbTestDataInner)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n}", "title": "" }, { "docid": "017b828e66a6b0a05addc754e128dc4e", "score": "0.6195329", "text": "func TestClearDatabase(t *testing.T) {\n\t// ensure the database is empty\n\td.GetDataSourceInstance().Clear()\n\n\t// add 1 entry\n\tu.AddList(\"1\")\n\n\t// clear the database\n\td.GetDataSourceInstance().Clear()\n\n\tif len(d.GetDataSourceInstance().Database) != 0 {\n\t\tt.Error(\"Unable to clear database\")\n\t}\n}", "title": "" }, { "docid": "0dabcb95ee3ce7d1ba205165403a14b8", "score": "0.6187595", "text": "func SetupTestDB(t *testing.T) {\n\terr := db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid\",\n\t\tUsername: \"testusername\",\n\t\tEmail: \"testemail@domain.com\",\n\t}, nil)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid2\",\n\t\tUsername: \"testusername\",\n\t\tEmail: \"testemail@domain.com\",\n\t}, nil)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "d4e1fc47e305dc64ed0ed6dcce6ea4dd", "score": "0.61855537", "text": "func dbTestDataInner(db *sql.DB) (err error) {\n\terr = dbTransactionWrapper(db, func(tx *sql.Tx) (err error) {\n\t\t// TODO might be possible to prepare these only once\n\t\tvar stmt *sql.Stmt\n\t\tstmt, err = tx.Prepare(GENSENDGO_INSERT_ROW)\n\t\tdefer stmt.Close()\n\t\tvar result sql.Result\n\t\texpiresMinutes := 1 //TODO Make this configurable via CLI\n\t\texpiresTs := time.Now().Add(time.Minute * time.Duration(expiresMinutes)).UTC()\n\t\tresult, err = stmt.Exec(\"abcdefgh\", 5, expiresMinutes, time.Now().UTC(), expiresTs, \"12345678\")\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"insert success %v\\n\", result)\n\t\treturn\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\tdbDumpTableInner(db)\n\treturn\n}", "title": "" }, { "docid": "01d37b3116001babef9be8cdf523b915", "score": "0.61492574", "text": "func TestDB(t *testing.T) { TestingT(t) }", "title": "" }, { "docid": "3f988ac690b6bb055b92aa4814ce2623", "score": "0.61432916", "text": "func TestCreateDatabase(t *testing.T) {\n couch := CreateCouchClient(TestCouchHost, 5984)\n session := couch.StartSession()\n session.Login(\"admin\", \"admin\")\n\n db := session.GetDatabase(\"tohva_test\")\n\n if db.Exists() {\n db.Delete()\n }\n\n if !db.Create() {\n t.Error(\"pffffff! you didn't clean the couchdb instance fuckin' bastard\")\n } else {\n // cleaning\n log.Println(db.Delete())\n }\n}", "title": "" }, { "docid": "10c3b8c009414b89c7be31897a882117", "score": "0.6117933", "text": "func Test_IStore(t *testing.T) {\n\tcheck := CheckErrFunc(t)\n\terr := godotenv.Load(\"../.env\")\n\tcheck(err)\n\tdb, _ := NewDB(os.Getenv(\"SQL_TYPE\"), os.Getenv(\"SQL_CONNECTION\"))\n\n\tsql, _ := NewSqlBackend(db)\n\n\tvar sqlEx stores.SqlExecutor = sql\n\t_, err = sqlEx.Exec(CREATE_DEMO1_SQL)\n\tcheck(err)\n\tdefer sqlEx.Exec(DROP_DEMO1_SQL)\n\tsql.SetPKField(\"id\")\n\tsql.SetTable(\"demo1\")\n\tsql.SetFieldMapper(LowerFieldMapper)\n\tvar sqlStore stores.Store = sql\n\tr := &Demo1{\n\t\tName: \"n1\",\n\t\tContent: \"n1\",\n\t}\n\terr = sqlStore.Write(\"\", r)\n\tcheck(err)\n\tif r.ID != 1 {\n\t\tt.Fatalf(\"write new fail\")\n\t}\n\trr := []*Demo1{}\n\terr = sqlStore.ReadAll(&rr)\n\tcheck(err)\n\tif len(rr) <= 0 {\n\t\tt.Fatal(\"list fail\")\n\t}\n\tnr := &Demo1{}\n\terr = sqlStore.Read(\"1\", nr)\n\tcheck(err)\n\tif nr.ID != 1 || nr.Name != \"n1\" || nr.Content != \"n1\" {\n\t\tt.Fatal(\"get fail\")\n\t}\n\tnr.Content = \"new\"\n\tnr.Name = \"new\"\n\t_ = sqlStore.Write(strconv.FormatInt(nr.ID, 10), nr)\n\tnnr := &Demo1{}\n\terr = sqlStore.Read(\"1\", nnr)\n\tcheck(err)\n\tif nnr.ID != 1 || nnr.Name != \"new\" || nnr.Content != \"new\" {\n\t\tt.Fatal(\"update fail\")\n\t}\n\tvar sqlQueryer stores.Queryer = sql\n\tli := []*Demo1{}\n\terr = sqlQueryer.Find(\"select id,name from demo1 where name='new'\", &li)\n\tcheck(err)\n\tif len(li) != 1 {\n\t\tt.Fatal(\"find fail\")\n\t}\n\tvar d *Demo1\n\terr = sqlStore.Write(\"1\", d)\n\tcheck(err)\n\tnrr := []*Demo1{}\n\terr = sqlStore.ReadAll(&nrr)\n\tcheck(err)\n\tif len(nrr) != 0 {\n\t\tt.Fatal(\"delete fail\")\n\t}\n}", "title": "" }, { "docid": "fbb33c7a84561a748ffab5ded3cf7761", "score": "0.6084371", "text": "func setupDB() {\n\tcfg.JSONFile = \"dbtest.json\"\n\treadDBJSONFile(\"./testdata/dbtest.json\")\n\tsaveJSONFile(cfg.JSONFile, db)\n}", "title": "" }, { "docid": "408e56203f49ffa0507f378fd699f6cb", "score": "0.60375875", "text": "func Test_DbFileCreation(t *testing.T) {\n\tdir, err := ioutil.TempDir(\"\", \"rqlite-test-\")\n\tdefer os.RemoveAll(dir)\n\n\tdb, err := Open(path.Join(dir, \"test_db\"))\n\tif err != nil {\n\t\tt.Fatalf(\"failed to open new database: %s\", err.Error())\n\t}\n\tif db == nil {\n\t\tt.Fatal(\"database is nil\")\n\t}\n\terr = db.Close()\n\tif err != nil {\n\t\tt.Fatalf(\"failed to close database: %s\", err.Error())\n\t}\n}", "title": "" }, { "docid": "2c04bfee497d2932b9ff31790c41f959", "score": "0.6033067", "text": "func SetUp(db dao2.BookDAO) {\n\tdb.Connect()\n\t_ = db.Insert(b)\n\t_ = db.Insert(b1)\n\t_ = db.Insert(b2)\n\t_ = db.Insert(b3)\n\t_ = db.Insert(b4)\n}", "title": "" }, { "docid": "1de1dfe9ebc74d9f2f5e5a53f658499a", "score": "0.60293645", "text": "func TestGetTodoList(t *testing.T) {\n\t// hapus database\n\to := orm.NewOrm()\n\to.Raw(\"DELETE FROM item\").Exec()\n\to.Raw(\"DELETE FROM sales_order\").Exec()\n\to.Raw(\"DELETE FROM purchase_order\").Exec()\n\to.Raw(\"DELETE FROM workorder_shipment\").Exec()\n\t// buat dummy\n\t// sales fulfill-->2\n\t// sales inv-->2\n\t// sales cancel-->1\n\t// fulfill ship-->0\n\t// shipment-->1\n\t// need recaive-->30\n\tsales1 := model.DummySalesOrder() // so\n\tsales1.IsDeleted = int8(0)\n\tsales1.DocumentStatus = \"active\"\n\tsales1.FulfillmentStatus = \"active\"\n\tsales1.InvoiceStatus = \"active\"\n\tsales1.Save()\n\n\tsales2 := model.DummySalesOrder()\n\tsales2.IsDeleted = int8(0)\n\tsales2.DocumentStatus = \"requested_cancel\"\n\tsales2.FulfillmentStatus = \"finished\"\n\tsales2.InvoiceStatus = \"active\"\n\tsales2.Save()\n\n\tsales3 := model.DummySalesOrder()\n\tsales3.IsDeleted = int8(0)\n\tsales3.DocumentStatus = \"finished\"\n\tsales3.FulfillmentStatus = \"active\"\n\tsales3.InvoiceStatus = \"finished\"\n\tsales3.Save()\n\n\tfulfill := model.DummyWorkorderFulfillment() // fullfill gagal\n\tdelSo := fulfill.SalesOrder\n\tfulfill.IsDeleted = int8(0)\n\tfulfill.IsDelivered = int8(1)\n\tfulfill.SalesOrder = sales1\n\tfulfill.Save()\n\n\tdelSo.Delete()\n\n\tship := model.DummyWorkorderShipment() // shipment sukses\n\tship.IsDeleted = int8(0)\n\tship.DocumentStatus = \"active\"\n\tship.Save()\n\tship2 := model.DummyWorkorderShipment() // shipment gagal\n\tship2.IsDeleted = int8(0)\n\tship2.DocumentStatus = \"finished\"\n\tship2.Save()\n\n\tpo := model.DummyPurchaseOrder() // po sukses\n\tpo.Note = \"po-1\"\n\tpo.DocumentStatus = \"active\"\n\tpo.IsDeleted = int8(0)\n\tpo.ReceivingStatus = \"new\"\n\tpo.Save()\n\tpoi := model.DummyPurchaseOrderItem()\n\tdelPo := poi.PurchaseOrder\n\tpoi.PurchaseOrder = po\n\tpoi.Quantity = float32(25)\n\tpoi.Note = \"note-1\"\n\tpoi.Save()\n\tdelPo.Delete()\n\tpoi2 := model.DummyPurchaseOrderItem()\n\tdelPo2 := poi2.PurchaseOrder\n\tpoi2.PurchaseOrder = po\n\tpoi2.Quantity = float32(20)\n\tpoi2.Note = \"note-2\"\n\tpoi2.Save()\n\tdelPo2.Delete()\n\n\tpo2 := model.DummyPurchaseOrder() //po gagal\n\tpo2.DocumentStatus = \"cancelled\"\n\tpo2.IsDeleted = int8(0)\n\tpo2.ReceivingStatus = \"finished\"\n\tpo2.Note = \"note-del-1\"\n\tpo2.Save()\n\tpoi3 := model.DummyPurchaseOrderItem()\n\tdelPo3 := poi3.PurchaseOrder\n\tpoi3.PurchaseOrder = po2\n\tpoi3.Quantity = float32(20)\n\tpoi3.Note = \"note-del-2\"\n\tpoi3.Save()\n\tdelPo3.Delete()\n\n\twr := model.DummyWorkorderReceiving() //ok\n\twr.PurchaseOrder = po\n\twr.IsDeleted = int8(0)\n\twr.DocumentStatus = \"finished\"\n\twr.Note = \"note-1\"\n\twr.Save()\n\twrItem := model.DummyWorkorderReceivingItem()\n\tdelwrItem := wrItem.PurchaseOrderItem\n\tdelwrItem2 := wrItem.WorkorderReceiving\n\twrItem.PurchaseOrderItem = poi\n\twrItem.Quantity = float32(10)\n\twrItem.WorkorderReceiving = wr\n\twrItem.Save()\n\tdelwrItem.PurchaseOrder.Delete()\n\tdelwrItem2.Delete()\n\twrItem2 := model.DummyWorkorderReceivingItem()\n\tdelwrItem3 := wrItem2.PurchaseOrderItem\n\tdelwrItem4 := wrItem2.WorkorderReceiving\n\twrItem2.PurchaseOrderItem = poi2\n\twrItem2.Quantity = float32(5)\n\twrItem2.WorkorderReceiving = wr\n\twrItem2.Save()\n\tdelwrItem3.PurchaseOrder.Delete()\n\tdelwrItem4.Delete()\n\n\t// test\n\tm, e := GetTodoList()\n\tassert.NoError(t, e)\n\tassert.Equal(t, m.SalesNeedFulfilled, int64(2))\n\tassert.Equal(t, m.SalesNeedInvoiced, int64(2))\n\tassert.Equal(t, m.SalesNeedApproveCancel, int64(1))\n\tassert.Equal(t, m.FulfillmentNeedShipped, int64(0))\n\tassert.Equal(t, m.ShipmentNeedDelivered, int64(1))\n\tassert.Equal(t, m.ItemNeedReceived, float32(30))\n\n}", "title": "" }, { "docid": "296d7fba5927014d55fef3f13937f352", "score": "0.60117054", "text": "func TestDatabaseConnection(t *testing.T) {\n\tconfigs := getConfigs(\"config.txt\")\n\tdbConfigs := configs.databaseConfigs\n\tdb := openDb(dbConfigs)\n\tdb.Close()\n}", "title": "" }, { "docid": "66fdfdaa8c9471d62e1f908adf42c348", "score": "0.6009137", "text": "func TestReset(t *testing.T) {\n\tstore, db, _, _, _ := testhelpers.SetupTestDB(t)\n\tdefer db.CloseDB(t)\n\tdefer store.Close()\n\tctx := context.Background()\n\n\tcases := map[string]func(*testing.T){\n\t\t\"empty database\": func(t *testing.T) {\n\t\t\trequire.NoError(t, store.Reset(ctx))\n\t\t\tassertEmpty(t, db.QueryRow(`SELECT count(*) FROM iam_policies`))\n\t\t\tassertEmpty(t, db.QueryRow(`SELECT count(*) FROM iam_roles`))\n\t\t\tassertEmpty(t, db.QueryRow(`SELECT count(*) FROM iam_projects`))\n\t\t},\n\t\t\"empty database, run twice\": func(t *testing.T) {\n\t\t\trequire.NoError(t, store.Reset(ctx))\n\t\t\trequire.NoError(t, store.Reset(ctx))\n\t\t\tassertEmpty(t, db.QueryRow(`SELECT count(*) FROM iam_policies`))\n\t\t\tassertEmpty(t, db.QueryRow(`SELECT count(*) FROM iam_roles`))\n\t\t\tassertEmpty(t, db.QueryRow(`SELECT count(*) FROM iam_projects`))\n\t\t},\n\t\t\"non-empty database, a policy with two statements and members\": func(t *testing.T) {\n\t\t\tpolID := insertTestPolicy(t, db, \"firstpolicy\")\n\t\t\tinsertTestStatement(t, db,\n\t\t\t\tpolID, \"allow\", \"\", []string{\"iam:users:delete', 'iam:users:create\"}, []string{\"iam:users\"})\n\t\t\tinsertTestStatement(t, db,\n\t\t\t\tpolID, \"deny\", \"\", []string{\"compliance:profiles:download\", \"compliance:profiles:delete\"}, []string{\"compliance:profiles\"})\n\t\t\tinsertTestPolicyMember(t, db, polID, \"user:local:albertine\")\n\t\t\tinsertTestPolicyMember(t, db, polID, \"user:local:othermember\")\n\n\t\t\trequire.NoError(t, store.Reset(ctx))\n\t\t\tassertEmpty(t, db.QueryRow(`SELECT count(*) FROM iam_policies`))\n\t\t\tassertEmpty(t, db.QueryRow(membersCount))\n\t\t\tassertEmpty(t, db.QueryRow(`SELECT count(*) FROM iam_roles`))\n\t\t\tassertEmpty(t, db.QueryRow(`SELECT count(*) FROM iam_projects`))\n\t\t},\n\t}\n\n\tfor name, test := range cases {\n\t\tt.Run(name, test)\n\t\tdb.Flush(t)\n\t}\n}", "title": "" }, { "docid": "c2a02db3c5b4f39920aaf32457342c45", "score": "0.60037285", "text": "func TestSetupDB(t *testing.T) (DBer, func()) {\n\tdb, err := sql.Open(\"txdb\", uuid.NewV4().String())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcleanup := func() {\n\t\tdb.Close()\n\t}\n\treturn db, cleanup\n}", "title": "" }, { "docid": "632c1dee8ca789a2f3ae9cad96df8d46", "score": "0.59644157", "text": "func waitForDb() {\n\tconst SuccessCnt = 2\n\tsuccessCntRemaining := SuccessCnt\n\tfailedCntRemaining := 5\n\tfor {\n\t\tdb := newDbConnection()\n\t\tif db != nil {\n\t\t\tsuccessCntRemaining--\n\t\t\tif successCntRemaining <= 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t} else {\n\t\t\tfailedCntRemaining--\n\t\t\tif failedCntRemaining <= 0 {\n\t\t\t\tpanic(\"database is not up\")\n\t\t\t}\n\t\t\tsuccessCntRemaining = SuccessCnt\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "90c937bdbd9b1a7b2618623b54206589", "score": "0.596204", "text": "func Good(conn *sql.DB) error {\n\ttx, err := conn.Begin()\n\tdefer tx.Rollback()\n\trows, err := tx.Query(\"select id from harness_tests\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\treturn nil\n}", "title": "" }, { "docid": "0964b5e92576e3b2e3f9d750c4756fe5", "score": "0.5958887", "text": "func (db Seeddb) FillDb() {\n\n\tfile, err := os.OpenFile(\"data.json\", os.O_CREATE, os.ModePerm)\n\tcheck(err)\n\tdefer file.Close()\n\n\tvar users []struct {\n\t\tFirstName string `json:\"firstname\" validate:\"required\"`\n\t\tLastName string `json:\"lastname\" validate:\"required\"`\n\t\tPhoneNumber string `json:\"phone_number\" validate:\"required\"`\n\t\tID string `json:\"id\"`\n\t}\n\n\tjson.NewDecoder(file).Decode(&users)\n\t//fmt.Println(users)\n\n\tfor _, values := range users {\n\n\t\tstmt, err := db.Session.Prepare(`INSERT INTO phoneBook (userID, FirstName,LastName,phoneNumber)\n\tVALUES (?,?,?,?)`)\n\n\t\t_, err = stmt.Exec(values.ID, values.FirstName, values.LastName, values.PhoneNumber)\n\t\tcheck(err)\n\t}\n}", "title": "" }, { "docid": "87a63b8febad0bffa1cbdabad525ae0d", "score": "0.5958265", "text": "func configureTestDB() {\r\n\tdb.TestConnection()\r\n\tconn := db.GetDB()\r\n\tmigration.AutoMigration(conn)\r\n}", "title": "" }, { "docid": "d41184ddbf6e1787e2588409beb4457a", "score": "0.59476525", "text": "func SetupPaginationDB(t *testing.T) {\n\terr := db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid\",\n\t\tUsername: \"testusername\",\n\t\tEmail: \"testemail@domain.com\",\n\t}, nil)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid2\",\n\t\tUsername: \"testusername\",\n\t\tEmail: \"testemail@domain.com\",\n\t}, nil)\n\n\terr = db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid3\",\n\t\tUsername: \"testusername\",\n\t\tEmail: \"testemail@domain.com\",\n\t}, nil)\n\n\terr = db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid4\",\n\t\tUsername: \"testusername\",\n\t\tEmail: \"testemail@domain.com\",\n\t}, nil)\n\n\terr = db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid5\",\n\t\tUsername: \"testusername\",\n\t\tEmail: \"testemail@domain.com\",\n\t}, nil)\n}", "title": "" }, { "docid": "f8165bf8dfa2375a017fb66313172062", "score": "0.5943245", "text": "func TestTripcodeInsert(t *testing.T) {\n DBTestsSetup()\n\n id, err := createTripcode(\"Jerry\", \"pasta_sauce111\")\n if err != nil {\n //t.Logf(\"TestTripcodeInsert error: %s\", err)\n t.Errorf(\"TestTripcodeInsert error: %s\", err)\n } else {\n t.Logf(\"got id for new tripcode: %d\\n\", id)\n }\n}", "title": "" }, { "docid": "783da70ac7abd08e019a9eb2992c6f21", "score": "0.5936347", "text": "func main() {\n\tdb, err := sql.Open(\"mysql\", \"root:@tcp(127.0.0.1:3306)/test\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\t// DML\n\tresult, err := db.Exec(\"DROP TABLE IF EXISTS tbl\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tn, err := result.RowsAffected()\n\tfmt.Printf(\"%d row(s) affected.\\n\", n)\n\n\tresult, err = db.Exec(\"CREATE TABLE IF NOT EXISTS tbl (col int)\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tn, err = result.RowsAffected()\n\tfmt.Printf(\"%d row(s) affected.\\n\", n)\n\n\t// Prepared Statement\n\tstmt, err := db.Prepare(\"INSERT INTO tbl VALUES(?)\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer stmt.Close()\n\n\tresult, err = stmt.Exec(1)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tn, err = result.RowsAffected()\n\tfmt.Printf(\"%d row(s) affected.\\n\", n)\n\n\tresult, err = stmt.Exec(2)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tn, err = result.RowsAffected()\n\tfmt.Printf(\"%d row(s) affected.\\n\", n)\n\n\tvar col int\n\t// func (db *DB) Query(query string, args ...any) (*Rows, error)\n\trows, err := db.Query(\"SELECT * FROM tbl\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(&col)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(col)\n\t}\n\n\t// Transaction fail test\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tdefer tx.Rollback()\n\n\t_, err = tx.Exec(\"INSERT INTO tbl VALUES (3)\")\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\t_, err = tx.Exec(\"INSERT INTO tbl VALUES ('a')\")\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n}", "title": "" }, { "docid": "b3c9cd452f4e508b35a0e3a32deb753b", "score": "0.59322166", "text": "func TestMeeting(t *testing.T) {\n\tos.Mkdir(\"data\", 0755)\n\tInitializeDB(\"data/agenda.db\")\n\n\tm1 := &Meeting{\n\t\tTitle: \"test_meeting_title1\",\n\t\tParticipators: []string{\"Alice\", \"Bob\"},\n\t\tSponsor: \"Jack\",\n\t}\n\n\tm2 := &Meeting{\n\t\tTitle: \"test_meeting_title2\",\n\t\tParticipators: []string{\"Jack\", \"Bob\"},\n\t\tSponsor: \"Alice\",\n\t}\n\n\tu1 := &User{UserName: \"Jack\"}\n\tu2 := &User{UserName: \"Bob\"}\n\tu3 := &User{UserName: \"Alice\"}\n\tagendaDB.Insert(u1)\n\tagendaDB.Insert(u2)\n\tagendaDB.Insert(u3)\n\n\tt.Log(\"[meetingtest] creating meeting1\")\n\tNewMeeting(m1.Title, \"2017-01-01\", \"2017-01-02\", m1.Sponsor, m1.Participators)\n\tt.Log(\"[meetingtest] creating meeting2\")\n\tNewMeeting(m2.Title, \"2017-01-03\", \"2017-01-05\", m2.Sponsor, m2.Participators)\n\tt.Log(\"[meetingtest] querying meeting\")\n\tm, err := QueryMeeting(\"Alice\", \"2017-01-01\", \"2017-01-04\")\n\tif len(m) != 2 || err != nil {\n\t\tt.Fatal(\"meeting creation failure\")\n\t}\n\tt.Log(\"meeting creation success\")\n\n\tt.Log(\"[meetingtest] quiting meeting\")\n\tQuitMeeting(\"Alice\", \"test_meeting_title1\")\n\tm, err = QueryMeeting(\"Alice\", \"2017-01-02\", \"2017-01-04\")\n\tif len(m) != 1 || err != nil {\n\t\tt.Fatal(\"meeting quit failure\")\n\t}\n\tt.Log(\"meeting quit success\")\n\n\tt.Log(\"[meetingtest] clearing meeting\")\n\tClearMeeting(\"Alice\")\n\tt.Log(\"[meetingtest] querying meeting\")\n\tm, err = QueryMeeting(\"Jack\", \"2017-01-02\", \"2017-01-04\")\n\tif len(m) != 1 {\n\t\tt.Fatal(\"meeting clear failure\")\n\t}\n\tt.Log(\"meeting clear success\")\n}", "title": "" }, { "docid": "db89546827c69bb8facc34f6bb91b0af", "score": "0.59318155", "text": "func TestEmptyDB(t *testing.T) {\n\tfor _, dbType := range database.SupportedDBs() {\n\t\t// Ensure NewestSha returns expected values for a newly created\n\t\t// db.\n\t\tdb, teardown, err := createDB(dbType, \"emptydb\", false)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Failed to create test database %v\", err)\n\t\t\treturn\n\t\t}\n\t\ttestNewestShaEmpty(t, db)\n\n\t\t// Ensure NewestSha still returns expected values for an empty\n\t\t// database after reopen.\n\t\tdb.Close()\n\t\tdb, err = openDB(dbType, \"emptydb\")\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Failed to open test database %v\", err)\n\t\t\treturn\n\t\t}\n\t\ttestNewestShaEmpty(t, db)\n\t\tdb.Close()\n\n\t\t// Clean up the old db.\n\t\tteardown()\n\t}\n}", "title": "" }, { "docid": "b43a88b6d0c311f2b6263f6492f07eed", "score": "0.5925422", "text": "func TestFullCRUD(t *testing.T) {\n\ttype fakeProfile struct {\n\t\tBio string\n\t\tPicUrl string\n\t\tMeta map[string]interface{}\n\t\tSubTime time.Time\n\t}\n\n\ttype fakeAddress struct {\n\t\tStreet string\n\t\tState string\n\t\tCity string\n\t}\n\n\ttype weird struct {\n\t\tName string\n\t\tOptionalProfile *fakeProfile\n\t}\n\n\ttype fakeUser struct {\n\t\tID string\n\t\tFirstName string\n\t\tLastName string\n\t\tEmails []string\n\t\tAddresses []fakeAddress\n\t\tProfile fakeProfile\n\t\tMeta map[string]interface{}\n\t\tCreated time.Time\n\t}\n\n\tfu := &fakeUser{\n\t\tID: util.RandomString(30),\n\t\tFirstName: \"Jym\",\n\t\tLastName: \"Luast\",\n\t\tEmails: []string{\"but@butts.com\", \"second@whowhooo.com\"},\n\t\tAddresses: []fakeAddress{\n\t\t\t{\"750 N. San Vicente\", \"CA\", \"LA\"},\n\t\t\t{\"8800 Sunset BLVD\", \"CA\", \"LA\"},\n\t\t},\n\t\tProfile: fakeProfile{\"Some Lame bio\", \"http://picsrus.com/23ds34\", map[string]interface{}{\n\t\t\t\"facebookid\": \"123k1l2j34l13\", \"twitterid\": \"sdklj324lkj23\"}, time.Now()},\n\t\tMeta: map[string]interface{}{\n\t\t\t\"favcolor\": \"brown\", \"fakeage\": 42,\n\t\t},\n\t}\n\tpgc.MustCreateTable(fu)\n\tpgc.MustInsert(fu)\n\n\tfu.FirstName = util.RandomString(30)\n\tpgc.MustUpdate(fu)\n\n\tfu2 := &fakeUser{ID: fu.ID}\n\tpgc.MustGet(fu2)\n\n\tif fu2.FirstName != fu.FirstName {\n\t\tt.Errorf(\"FirstName wasnt changed after update, expected (%s) was (%s)\",\n\t\t\tfu2.FirstName, fu.FirstName)\n\t}\n}", "title": "" }, { "docid": "2c11126e2c3e4ce806f443ee1a10b6aa", "score": "0.5914847", "text": "func SetupTestDb(t *testing.T) (model *ModelDB) {\n\tdbPath := path.Join(os.TempDir(), \"test.db\")\n\terr := os.Remove(dbPath)\n\terr = os.Remove(dbPath + \".lock\")\n\tmodel, err = OpenDb(dbPath)\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\t//t.Log(model.db)\n\treturn\n}", "title": "" }, { "docid": "0e4644cb964ccf5a0db6b335fb16fe19", "score": "0.5911933", "text": "func TestDatabase(t *testing.T) {\n\t// Ensure we are starting with a clean environment.\n\tos.Remove(testDb)\n\tos.Remove(backupDb)\n\n\t// All sub-tests to run.\n\ttests := map[string]func(*testing.T){\n\t\t\"testCreateNew\": testCreateNew,\n\t\t\"testInsertNewTicket\": testInsertNewTicket,\n\t\t\"testGetTicketByHash\": testGetTicketByHash,\n\t\t\"testUpdateTicket\": testUpdateTicket,\n\t\t\"testTicketFeeExpired\": testTicketFeeExpired,\n\t\t\"testFilterTickets\": testFilterTickets,\n\t\t\"testCountTickets\": testCountTickets,\n\t\t\"testAddressIndex\": testAddressIndex,\n\t\t\"testDeleteTicket\": testDeleteTicket,\n\t\t\"testVoteChangeRecords\": testVoteChangeRecords,\n\t\t\"testHTTPBackup\": testHTTPBackup,\n\t}\n\n\tfor testName, test := range tests {\n\t\t// Create a new blank database for each sub-test.\n\t\tvar err error\n\t\tvar wg sync.WaitGroup\n\t\tctx, cancel := context.WithCancel(context.TODO())\n\t\terr = CreateNew(testDb, feeXPub)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error creating test database: %v\", err)\n\t\t}\n\t\tdb, err = Open(ctx, &wg, testDb, time.Hour, maxVoteChangeRecords)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error opening test database: %v\", err)\n\t\t}\n\n\t\t// Run the sub-test.\n\t\tt.Run(testName, test)\n\n\t\t// Request database shutdown and wait for it to complete.\n\t\tcancel()\n\t\twg.Wait()\n\n\t\tdb.Close()\n\n\t\tos.Remove(testDb)\n\t\tos.Remove(backupDb)\n\t}\n}", "title": "" }, { "docid": "b5ffd0b64d23af2d0207c9c8c4c7ac16", "score": "0.5908418", "text": "func TestQuery(t *testing.T) {\n\t//release\n\tgot, err := openTestingDB(t, &Config{\n\t\tDSN: dsn,\n\t\tDebug: false,\n\t\tMaxIdleConns: 10,\n\t\tMaxOpenConns: 100,\n\t\tConnMaxLifetime: time.Second * 300,\n\t\tOnDialError: \"panic\",\n\t\tSlowThreshold: time.Millisecond * 300,\n\t})\n\tassert.Nil(t, err)\n\tassert.Nil(t, got.WithContext(context.Background()).Create(&LzTest{\n\t\tName: \"lzfirst\",\n\t\tSex: 1,\n\t\tAge: 100,\n\t}).Error)\n\n\tassert.Nil(t, got.WithContext(context.Background()).Create(&LzTest{\n\t\tName: \"lzfirst\",\n\t\tSex: 1,\n\t\tAge: 101,\n\t}).Error)\n\n\tassert.Nil(t, got.WithContext(context.Background()).Create(&LzTest{\n\t\tName: \"lzwhere\",\n\t\tSex: 1,\n\t\tAge: 100,\n\t}).Error)\n\n\tassert.Nil(t, got.WithContext(context.Background()).Create(&Lz2_Test{\n\t\tName: \"lzfirst\",\n\t\tSex: 1,\n\t\tAge: 25,\n\t\tEmail: \"xxx\",\n\t}).Error)\n\n\tassert.Nil(t, got.WithContext(context.Background()).Create(&LzTestRealted{\n\t\tJob: \"test\",\n\t\tRealname: \"lizhou\",\n\t}).Error)\n\n\tassert.Nil(t, got.WithContext(context.Background()).Create(&LzTestRealted{\n\t\tJob: \"test\",\n\t\tRealname: \"lizhou2\",\n\t}).Error)\n\n\tvar lztestlen []LzTest\n\t//assert.Nil(t,got.WithContext(ctx).First(&lztestshadow,2).Error)\n\t//assert.Equal(t,uint(101),lztestshadow.Age)\n\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name = ?\", \"lzfirst\").First(&lztestlen).Error)\n\tassert.Equal(t, uint(100), lztestlen[0].Age)\n\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name = ?\", \"lzfirst\").Last(&lztestlen).Error)\n\tassert.Equal(t, uint(101), lztestlen[0].Age)\n\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name = ?\", \"lzfirst\").Find(&lztestlen).Error)\n\tassert.Equal(t, 2, len(lztestlen))\n\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name <> ?\", \"lzfirst\").Find(&lztestlen).Error)\n\tassert.Equal(t, 1, len(lztestlen))\n\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name in (?)\", []string{\"lzwhere\", \"lzfirst\"}).Find(&lztestlen).Error)\n\tassert.Equal(t, 3, len(lztestlen))\n\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name LIKE ?\", \"%lzwhere%\").Find(&lztestlen).Error)\n\tassert.Equal(t, 1, len(lztestlen))\n\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name = ? AND age > ?\", \"lzfirst\", 100).Find(&lztestlen).Error)\n\tassert.Equal(t, 1, len(lztestlen))\n\n\t//where 连用\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name = ? \", \"lzfirst\").Where(\"age > ?\", 100).Find(&lztestlen).Error)\n\tassert.Equal(t, 1, len(lztestlen))\n\n\t//where(struct)\n\tassert.Nil(t, got.WithContext(context.Background()).Where(&LzTest{Name: \"lzfirst\", Age: 100}).Find(&lztestlen).Error)\n\tassert.Equal(t, 1, len(lztestlen))\n\n\t//where(map)\n\tassert.Nil(t, got.WithContext(context.Background()).Where(map[string]interface{}{\"name\": \"lzfirst\", \"age\": 100}).Find(&lztestlen).Error)\n\tassert.Equal(t, 1, len(lztestlen))\n\n\t//or(struct)\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name = ?\", \"lzfirst\").Or(LzTest{Name: \"lzwhere\"}).Find(&lztestlen).Error)\n\tassert.Equal(t, 3, len(lztestlen))\n\n\t//or(map)\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name = ?\", \"lzfirst\").Or(map[string]interface{}{\"name\": \"lzwhere\"}).Find(&lztestlen).Error)\n\tassert.Equal(t, 3, len(lztestlen))\n\n\t//not\n\tassert.Nil(t, got.WithContext(context.Background()).Not(\"name\", \"lzfirst\").Find(&lztestlen).Error)\n\tassert.Equal(t, 1, len(lztestlen))\n\n\t//not(slice)\n\tassert.Nil(t, got.WithContext(context.Background()).Not(\"name\", []string{\"lzfirst\", \"lzwhere\"}).Find(&lztestlen).Error)\n\tassert.Equal(t, 0, len(lztestlen))\n\n\t//not(struct)\n\tassert.Nil(t, got.WithContext(context.Background()).Not(&LzTest{Name: \"lzfirst\"}).Find(&lztestlen).Error)\n\tassert.Equal(t, 1, len(lztestlen))\n\n\t//where or not(gorm bug)\n\t//assert.Nil(t,WithContext(context.Background(),got).Where(\"name = ?\",\"lzfirst\").Or(\"age >= ?\",\"100\").Not(\"name = ?\",\"lzwhere\").Find(&lztestlen).Error)\n\t//assert.Equal(t,2,len(lztestlen))\n\n\t//inner find\n\tassert.Nil(t, got.WithContext(context.Background()).Find(&lztestlen, \"name <> ? AND age > ?\", \"lzwhere\", 99).Error)\n\tassert.Equal(t, 2, len(lztestlen))\n\n\t//find(struct)\n\tassert.Nil(t, got.WithContext(context.Background()).Find(&lztestlen, LzTest{Age: 100}).Error)\n\tassert.Equal(t, 2, len(lztestlen))\n\n\t//find(map[])\n\tassert.Nil(t, got.WithContext(context.Background()).Find(&lztestlen, map[string]interface{}{\"age\": 101}).Error)\n\tassert.Equal(t, 1, len(lztestlen))\n\n\t//select order\n\tassert.Nil(t, got.WithContext(context.Background()).Select(\"sex,age\").Where(\"name = ?\", \"lzfirst\").Order(\"age desc\").Find(&lztestlen).Error)\n\tassert.Equal(t, uint(100), lztestlen[1].Age)\n\tassert.Equal(t, \"\", lztestlen[1].Name)\n\n\tassert.Nil(t, got.WithContext(context.Background()).Select([]string{\"sex,age\"}).Where(\"name = ?\", \"lzfirst\").Order(\"age desc\").Find(&lztestlen).Error)\n\tassert.Equal(t, uint(100), lztestlen[1].Age)\n\tassert.Equal(t, \"\", lztestlen[1].Name)\n\n\t//multi-table query\n\tgot.WithContext(context.Background()).Table(\"lztest\").Select(\"lztest.name,lz2test.name\").Joins(\"left join lz2test on lz2test.name = lztest.name\").Find(&lztestlen)\n\tassert.Equal(t, \"\", lztestlen[2].Name)\n\n\t//related query\n\tvar lztest LzTest\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"id = ?\", 2).Preload(\"LzTestRealted\").First(&lztest).Error)\n\t// assert.Nil(t, got.WithContext(context.Background()).Model(&lztest).Related(&lztest.LzTestRealted, \"ID\").Error)\n\tassert.Equal(t, \"lizhou2\", lztest.LzTestRealted.Realname)\n\n\t//limit offset count\n\tvar count int64\n\tassert.Nil(t, got.WithContext(context.Background()).Limit(1).Offset(1).Order(\"age desc\").Find(&lztestlen).Error)\n\tassert.Nil(t, got.WithContext(context.Background()).Table(\"lztest\").Limit(1).Count(&count).Error)\n\tassert.Nil(t, got.WithContext(context.Background()).Limit(2).Offset(1).Find(&lztestlen).Error)\n\tassert.Equal(t, \"lzwhere\", lztestlen[1].Name)\n\tassert.Equal(t, int64(3), count)\n\n\t//group&having\n\trows, err := got.WithContext(context.Background()).Table(\"lztest\").Select(\"name,sum(age) as totalage\").Group(\"name\").Having(\"sum(age) > ?\", 200).Rows()\n\tassert.Nil(t, err)\n\tfor rows.Next() {\n\t\tfmt.Print(rows.Columns())\n\t}\n\n\t//pluck\n\tvar names []string\n\tassert.Nil(t, got.WithContext(context.Background()).Model(&LzTest{}).Pluck(\"name\", &names).Error)\n\tassert.Equal(t, \"lzfirst\", names[1])\n\n\t//preload\n\tassert.Nil(t, got.WithContext(context.Background()).Where(\"name = ?\", \"lzfirst\").Preload(\"LzTestRealted\", \"realname NOT IN (?)\", \"lizhou2\").Find(&lztestlen).Error)\n\tassert.Equal(t, \"lizhou\", lztestlen[0].LzTestRealted.Realname)\n\n\t//stress\n\tgotshadow, err := openTestingDB(t, &Config{\n\t\tDSN: dsn,\n\t\tDebug: false,\n\t\tMaxIdleConns: 10,\n\t\tMaxOpenConns: 100,\n\t\tConnMaxLifetime: time.Second * 300,\n\t\tOnDialError: \"panic\",\n\t\tSlowThreshold: time.Millisecond * 300,\n\t\tAutoShadowTable: true,\n\t})\n\tmd := imeta.New(nil)\n\tmd[\"x-dyctx-label\"] = []string{\"1\"}\n\tctx := imeta.WithContext(context.Background(), md)\n\tassert.Nil(t, err)\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Create(&LzTest{\n\t\tName: \"lzfirst\",\n\t\tSex: 1,\n\t\tAge: 100,\n\t}).Error)\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Create(&LzTest{\n\t\tName: \"lzfirst\",\n\t\tSex: 1,\n\t\tAge: 101,\n\t}).Error)\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Create(&LzTest{\n\t\tName: \"lzwhere\",\n\t\tSex: 1,\n\t\tAge: 100,\n\t}).Error)\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Create(&Lz2_Test{\n\t\tName: \"lzfirst\",\n\t\tSex: 1,\n\t\tAge: 25,\n\t\tEmail: \"xxx\",\n\t}).Error)\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Create(&LzTestRealted{\n\t\tJob: \"test\",\n\t\tRealname: \"lizhou\",\n\t}).Error)\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Create(&LzTestRealted{\n\t\tJob: \"test\",\n\t\tRealname: \"lizhou2\",\n\t}).Error)\n\n\tvar lztestshadowlen []LzTest\n\t//assert.Nil(t,got.WithContext(ctx).First(&lztestshadow,2).Error)\n\t//assert.Equal(t,uint(101),lztestshadow.Age)\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"name = ?\", \"lzfirst\").First(&lztestshadowlen).Error)\n\tassert.Equal(t, uint(100), lztestshadowlen[0].Age)\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"name = ?\", \"lzfirst\").Last(&lztestshadowlen).Error)\n\tassert.Equal(t, uint(101), lztestshadowlen[0].Age)\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"name = ?\", \"lzfirst\").Find(&lztestshadowlen).Error)\n\tassert.Equal(t, 2, len(lztestshadowlen))\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"name <> ?\", \"lzfirst\").Find(&lztestshadowlen).Error)\n\tassert.Equal(t, 1, len(lztestshadowlen))\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"name in (?)\", []string{\"lzwhere\", \"lzfirst\"}).Find(&lztestshadowlen).Error)\n\tassert.Equal(t, 3, len(lztestshadowlen))\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"name LIKE ?\", \"%lzwhere%\").Find(&lztestshadowlen).Error)\n\tassert.Equal(t, 1, len(lztestshadowlen))\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"name = ? AND age > ?\", \"lzfirst\", 100).Find(&lztestshadowlen).Error)\n\tassert.Equal(t, 1, len(lztestshadowlen))\n\n\t//where 连用\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"name = ? \", \"lzfirst\").Where(\"age > ?\", 100).Find(&lztestshadowlen).Error)\n\tassert.Equal(t, 1, len(lztestshadowlen))\n\n\t//where(struct)--unsupport\n\t//assert.Nil(t,WithContext(ctx,gotshadow).Where(&LzTest{Name:\"lzfirst\",Age:100}).Find(&lztestshadowlen).Error)\n\t//assert.Equal(t,2,len(lztestshadowlen))\n\n\t//where(map)\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(map[string]interface{}{\"name\": \"lzfirst\", \"age\": 100}).Find(&lztestshadowlen).Error)\n\tassert.Equal(t, 1, len(lztestshadowlen))\n\n\t//or(struct)-unsupport\n\t//assert.Nil(t,WithContext(ctx,gotshadow).Where(\"name = ?\",\"lzfirst\").Or(LzTest{Name:\"lzwhere\"}).Find(&lztestshadowlen).Error)\n\t//assert.Equal(t,3,len(lztestshadowlen))\n\n\t//or(map) --unsupport\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"name = ?\", \"lzfirst\").Or(map[string]interface{}{\"name\": \"lzwhere\"}).Find(&lztestshadowlen).Error)\n\tassert.Equal(t, 3, len(lztestshadowlen))\n\n\t//not\n\tassert.Nil(t, gotshadow.WithContext(ctx).Not(\"name\", \"lzfirst\").Find(&lztestshadowlen).Error)\n\tassert.Equal(t, 1, len(lztestshadowlen))\n\n\t//not(slice)\n\tassert.Nil(t, gotshadow.WithContext(ctx).Not(\"name\", []string{\"lzfirst\", \"lzwhere\"}).Find(&lztestshadowlen).Error)\n\tassert.Equal(t, 0, len(lztestshadowlen))\n\n\t////not(struct)--unsupport\n\t//assert.Nil(t,WithContext(ctx,gotshadow).Not(&LzTest{Name:\"lzfirst\"}).Find(&lztestshadowlen).Error)\n\t//assert.Equal(t,1,len(lztestshadowlen))\n\t//\n\t////where or not--gorm bug\n\t//assert.Nil(t,WithContext(ctx,gotshadow).Where(\"name = ?\",\"lzfirst\").Or(\"age >= ?\",\"100\").Not(\"name = ?\",\"lzwhere\").Find(&lztestshadowlen).Error)\n\t//assert.Equal(t,2,len(lztestshadowlen))\n\n\t//inner find\n\tassert.Nil(t, gotshadow.WithContext(ctx).Find(&lztestshadowlen, \"name <> ? AND age > ?\", \"lzwhere\", 99).Error)\n\tassert.Equal(t, 2, len(lztestshadowlen))\n\n\t//find(struct)-unsupport\n\t//assert.Nil(t,WithContext(ctx,gotshadow).Find(&lztestshadowlen,LzTest{Age:100}).Error)\n\t//assert.Equal(t,1,len(lztestshadowlen))\n\n\t//find(map[])\n\tassert.Nil(t, gotshadow.WithContext(ctx).Find(&lztestshadowlen, map[string]interface{}{\"age\": 101}).Error)\n\tassert.Equal(t, 1, len(lztestshadowlen))\n\n\t//select order\n\tassert.Nil(t, gotshadow.WithContext(ctx).Select(\"sex,age\").Where(\"name = ?\", \"lzfirst\").Order(\"age desc\").Find(&lztestshadowlen).Error)\n\tassert.Equal(t, uint(100), lztestshadowlen[1].Age)\n\tassert.Equal(t, \"\", lztestshadowlen[1].Name)\n\n\tassert.Nil(t, gotshadow.WithContext(ctx).Select([]string{\"sex,age\"}).Where(\"name = ?\", \"lzfirst\").Order(\"age desc\").Find(&lztestshadowlen).Error)\n\tassert.Equal(t, uint(100), lztestshadowlen[1].Age)\n\tassert.Equal(t, \"\", lztestshadowlen[1].Name)\n\n\t//multi-table query--unsupport\n\t//WithContext(ctx,gotshadow).Table(\"lztest\").Select(\"lztest.name,lz2_test.name\").Joins(\"left join lz2_test on lz2_test.name = lztest.name\").Find(&lztestshadowlen)\n\t//assert.Equal(t,2,len(lztestshadowlen))\n\n\t//related query\n\tvar lztestshadow LzTest\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"id = ?\", 2).Preload(\"LzTestRealted\").First(&lztestshadow).Error)\n\t// assert.Nil(t, gotshadow.WithContext(ctx).Model(&lztestshadow).Related(&lztestshadow.LzTestRealted, \"ID\").Error)\n\tassert.Equal(t, \"lizhou2\", lztestshadow.LzTestRealted.Realname)\n\n\t//limit offset count\n\tvar countshadow int64\n\tassert.Nil(t, gotshadow.WithContext(ctx).Limit(1).Offset(1).Order(\"age desc\").Find(&lztestshadowlen).Error)\n\tassert.Nil(t, gotshadow.WithContext(ctx).Table(\"lztest\").Limit(1).Count(&countshadow).Error)\n\tassert.Nil(t, gotshadow.WithContext(ctx).Limit(2).Offset(1).Find(&lztestshadowlen).Error)\n\tassert.Equal(t, \"lzwhere\", lztestshadowlen[1].Name)\n\tassert.Equal(t, int64(3), countshadow)\n\n\t//group&having\n\trowsshadow, err := gotshadow.WithContext(ctx).Table(\"lztest\").Select(\"name,sum(age) as totalage\").Group(\"name\").Having(\"sum(age) > ?\", 200).Rows()\n\tassert.Nil(t, err)\n\tfor rowsshadow.Next() {\n\t\tfmt.Print(rowsshadow.Columns())\n\t}\n\n\t//pluck\n\tvar namesshadow []string\n\tassert.Nil(t, gotshadow.WithContext(ctx).Model(&LzTest{}).Pluck(\"name\", &namesshadow).Error)\n\tassert.Equal(t, \"lzfirst\", namesshadow[1])\n\n\t//preload\n\tassert.Nil(t, gotshadow.WithContext(ctx).Where(\"name = ?\", \"lzfirst\").Preload(\"LzTestRealted\", \"realname NOT IN (?)\", \"lizhou2\").Find(&lztestshadowlen).Error)\n\tassert.Equal(t, \"lizhou\", lztestshadowlen[0].LzTestRealted.Realname)\n}", "title": "" }, { "docid": "6dc53af54ca31f73e66bfabf1f684a18", "score": "0.59029305", "text": "func testBuildDbSerialization(t *testing.T) {\n\td := clearDB(t)\n\tdefer d.Close()\n\n\t// Load the test repo.\n\ttr := util.NewTempRepo()\n\tdefer tr.Cleanup()\n\trepo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, \"testrepo\"), false, true)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Test case: an empty build. Tests null and empty values.\n\temptyTime := 0.0\n\temptyBuild := &Build{\n\t\tSteps: []*BuildStep{},\n\t\tTimes: []float64{emptyTime, emptyTime},\n\t\tCommits: []string{},\n\t}\n\n\t// Test case: a completely filled-out build.\n\tbuildFromFullJson, err := testGetBuildFromMaster(repo)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttestCases := []*Build{emptyBuild, buildFromFullJson}\n\tfor _, b := range testCases {\n\t\tif err = dbSerializeAndCompare(b); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0445778c218952bd92a0d8d4ae4ffc4f", "score": "0.59018147", "text": "func assertDBContentsEqual(t *testing.T, lock *sync.Mutex,\n db *BayouDB, exp []Room) {\n lock.Lock()\n defer lock.Unlock()\n result := db.Read(getReadAllQuery())\n rooms := deserializeRooms(result)\n assertRoomListsEqual(t, rooms, exp, \"Database does not contain \" +\n \"expected contents\")\n}", "title": "" }, { "docid": "792f9dbc5a05318c9a2572e4f315c928", "score": "0.5895495", "text": "func BenchmarkInsetDb(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\tinsetDb()\n\t}\n\tb.Log(\"测试插入数据结束\")\n}", "title": "" }, { "docid": "30f1aaced32214e114a735dffa330212", "score": "0.58952373", "text": "func TestSetup(t *testing.T) {\n\tvar tests = []struct {\n\t\ttable string // the name for each table that should be created in Setup\n\t}{\n\t\t{\"measures\"},\n\t}\n\n\t// test that a new db can be created, panics if fails\n\ttdb := stock.DB.Setup(stock.TestLocal)\n\n\t// record the changes we make so they can be reversed\n\ttd := testhelpers.TearDown{}\n\tfor _, test := range tests {\n\t\ttd = append(td, (testhelpers.Change{Table: test.table, Action: testhelpers.CREATE}))\n\t}\n\tdefer func() {\n\t\terr := td.TearDown(tdb, t)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}()\n\n\t// and ensure it has all the tables that we expect\n\tfor _, test := range tests {\n\t\ttestQuery := strings.Join([]string{\"SELECT * FROM \", test.table}, \"\")\n\t\trows, err := tdb.Query(testQuery)\n\t\tif err != nil {\n\t\t\t// if the table does not exist we'll get an error\n\t\t\tt.Error(err)\n\t\t} else {\n\t\t\t// we'll get rows if the table exists, but won't be able to access any data\n\t\t\thasNext := rows.Next()\n\t\t\tif hasNext {\n\t\t\t\t// if we have data something is wrong\n\t\t\t\tt.Errorf(\"Expected empty table but got results with query `%s`\", testQuery)\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "b9e5f3bc9cab63815c28d136fc4747a5", "score": "0.5884943", "text": "func TestRethinkUpdateCurrentEmpty(t *testing.T) {\n\tdbStore, cleanup := rethinkDBSetup(t)\n\tdefer cleanup()\n\n\ttestUpdateCurrentEmptyStore(t, dbStore)\n}", "title": "" }, { "docid": "0fba7a1ab75d8672fac8e48ad136faa7", "score": "0.587484", "text": "func SaveTaskToDbMockSuccess() error {\n\treturn nil\n}", "title": "" }, { "docid": "864ec4e75093196c5defede1d7fe4773", "score": "0.58745706", "text": "func T_TestMailDbPush(t *testing.T) {\n\tinitDbSqlite()\n\tconf.Web.MailSaveMode = \"db\"\n\t_, err := MailDbPush()\n\tif err != nil {\n\t\tt.Error(\"TestMailDbPush fail:\" + err.Error())\n\t} else {\n\t\tt.Log(\"TestMailDbPush ok\")\n\t}\n}", "title": "" }, { "docid": "f2e7a14b60af4cb39b98ee596a3cecc9", "score": "0.58512294", "text": "func setupDatabase(db *sqlx.DB) {\n\t_, err := db.Query(\"DELETE FROM topic_stories\")\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to setup database \", errors.Wrap(err, \"Failed in delete from topic_stories\"))\n\t}\n\n\t_, err = db.Query(\"DELETE FROM stories\")\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to setup database \", errors.Wrap(err, \"Failed in delete from stories\"))\n\t}\n\t_, err = db.Query(\"DELETE FROM topics\")\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to setup database \", errors.Wrap(err, \"Failed in delete from topics\"))\n\t}\n\n\t_, err = db.Query(\n\t\t`INSERT INTO topics (name, slug, createdat, updatedat)\n\t\tVALUES ('Pemilu 2019', 'pemilu-2019', now(), now()),\n\t\t('Pilkada 2019', 'pilkada-2019', now(), now()),\n\t\t('Jokowi 2019', 'jokowi-2019', now(), now()),\n\t\t('Prabowo 2019', 'prabowo-2019', now(), now())`)\n\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to setup database \", errors.Wrap(err, \"Failed in filling topics table\"))\n\t}\n}", "title": "" }, { "docid": "855bda7a9f4298756ecafe6d0503a7eb", "score": "0.5843786", "text": "func TestDbFetchUtxoDatabaseInfo(t *testing.T) {\n\tt.Parallel()\n\n\t// Create a test database.\n\tdbPath := filepath.Join(os.TempDir(), \"test-dbfetchutxodatabaseinfo\")\n\t_ = os.RemoveAll(dbPath)\n\tdb, err := database.Create(\"ffldb\", dbPath, wire.MainNet)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating test database: %v\", err)\n\t}\n\tdefer os.RemoveAll(dbPath)\n\tdefer db.Close()\n\n\ttests := []struct {\n\t\tname string\n\t\tdbInfo *utxoDatabaseInfo\n\t}{{\n\t\tname: \"without UTXO database info (fresh database)\",\n\t\tdbInfo: nil,\n\t}, {\n\t\tname: \"with UTXO database info\",\n\t\tdbInfo: &utxoDatabaseInfo{\n\t\t\tversion: 1,\n\t\t\tcompVer: 2,\n\t\t\tutxoVer: 3,\n\t\t\tcreated: time.Unix(1584246683, 0), // 2020-03-15 04:31:23 UTC\n\t\t},\n\t}}\n\n\tfor _, test := range tests {\n\t\tif test.dbInfo != nil {\n\t\t\t// Create the UTXO database info bucket.\n\t\t\terr = db.Update(func(dbTx database.Tx) error {\n\t\t\t\t_, err := dbTx.Metadata().CreateBucketIfNotExists(utxoDbInfoBucketName)\n\t\t\t\treturn err\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"%q: error creating UTXO bucket: %v\", test.name, err)\n\t\t\t}\n\n\t\t\t// Update the UTXO database info in the database.\n\t\t\terr = db.Update(func(dbTx database.Tx) error {\n\t\t\t\treturn dbPutUtxoDatabaseInfo(dbTx, test.dbInfo)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"%q: error putting UTXO database info: %v\", test.name, err)\n\t\t\t}\n\t\t}\n\n\t\t// Fetch the UTXO database info from the database.\n\t\terr = db.View(func(dbTx database.Tx) error {\n\t\t\tgotDbInfo := dbFetchUtxoDatabaseInfo(dbTx)\n\n\t\t\t// Ensure that the fetched UTXO database info matches the expected UTXO\n\t\t\t// database info.\n\t\t\tif !reflect.DeepEqual(gotDbInfo, test.dbInfo) {\n\t\t\t\tt.Fatalf(\"%q: mismatched db info:\\nwant: %+v\\n got: %+v\\n\", test.name,\n\t\t\t\t\ttest.dbInfo, gotDbInfo)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%q: error fetching UTXO database info: %v\", test.name, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8927b3f737ce28b4154c2bad8eb4c84a", "score": "0.58414036", "text": "func storeTests(db *sql.DB, testnames []string, tableName string) (err error) {\n\ttruncateSQL := fmt.Sprintf(\"delete from %s;\", tableName)\n\tinsertSQL := fmt.Sprintf(\"insert into %s (name) values (?);\", tableName)\n\n\t// Start an atomic transaction\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tstmt, err := tx.Prepare(truncateSQL)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Truncate the table\n\t_, err = tx.Stmt(stmt).Exec()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Insert all testnames into the table\n\tstmt, err = tx.Prepare(insertSQL)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer stmt.Close()\n\n\tfor _, testname := range testnames {\n\t\t_, err = stmt.Exec(testname)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Commit the transaction\n\ttx.Commit()\n\treturn\n}", "title": "" }, { "docid": "294e28b58c1ef360326b7bcd38d69dac", "score": "0.5837365", "text": "func setup(t *testing.T) *RDB {\n\tt.Helper()\n\tr := NewRDB(redis.NewClient(&redis.Options{\n\t\tAddr: \"localhost:6379\",\n\t\tDB: 13,\n\t}))\n\t// Start each test with a clean slate.\n\th.FlushDB(t, r.client)\n\treturn r\n}", "title": "" }, { "docid": "dc8a38f7a94f040740bc0fbe1845dd69", "score": "0.5819732", "text": "func TestMakeQuery1(t *testing.T) {\n\ttestdb := initDB(t)\n\tdefer func() {\n\t\ttestdb.Db.Close()\n\t\tserver.Stop()\n\t}()\n\n\tcols, data, err := testdb.runQuery(\"SELECT name FROM people;\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\t//its important to test lengths so tests don't panic and exit early\n\tif len(cols) != 1 || len(data) != 1 || len(data[0]) != 4 {\n\t\tt.Error(\"Unexpected data returned\")\n\t}\n\tif cols[0] != \"name\" || data[0][0] != \"alice\" ||\n\t\tdata[0][1] != \"bob\" || data[0][2] != \"charlie\" || data[0][3] != \"david\" {\n\t\tt.Error(\"Unexpected data returned\")\n\t}\n}", "title": "" }, { "docid": "8a58e28da7778807e9bd5f377018b70d", "score": "0.5800697", "text": "func testInsertQuery(t *testing.T, test InsertTest) {\n\tif (test.ExpectedRows == nil) != (test.ExpectedSchema == nil) {\n\t\trequire.Fail(t, \"Incorrect test setup: schema and rows must both be provided if one is\")\n\t}\n\n\tif len(singleInsertQueryTest) > 0 && test.Name != singleInsertQueryTest {\n\t\tt.Skip(\"Skipping tests until \" + singleInsertQueryTest)\n\t}\n\n\tif len(singleInsertQueryTest) == 0 && test.SkipOnSqlEngine && skipBrokenInsert {\n\t\tt.Skip(\"Skipping test broken on SQL engine\")\n\t}\n\n\tdEnv, err := CreateEmptyTestDatabase()\n\trequire.NoError(t, err)\n\tdefer dEnv.DoltDB.Close()\n\n\tif test.AdditionalSetup != nil {\n\t\ttest.AdditionalSetup(t, dEnv)\n\t}\n\n\troot, _ := dEnv.WorkingRoot(context.Background())\n\troot, err = executeModify(t, context.Background(), dEnv, root, test.InsertQuery)\n\tif len(test.ExpectedErr) > 0 {\n\t\trequire.Error(t, err)\n\t\treturn\n\t} else {\n\t\trequire.NoError(t, err)\n\t}\n\n\tactualRows, sch, err := executeSelect(t, context.Background(), dEnv, root, test.SelectQuery)\n\trequire.NoError(t, err)\n\n\tassert.Equal(t, test.ExpectedRows, actualRows)\n\tassertSchemasEqual(t, mustSqlSchema(test.ExpectedSchema), sch)\n}", "title": "" }, { "docid": "c84167499a4a209fee4dd5895ae6a444", "score": "0.5795767", "text": "func DB_persist(top []Paper) {\n\n\topen_or_create()\n\n\tdelete_old_and_create_new_table()\n\n\tconfigure_character_set()\n\n\tinsert_rows(top)\n\n\tdb.Close()\n}", "title": "" }, { "docid": "720d852c69d8f024e23615cfbb377145", "score": "0.57729226", "text": "func (suite *MainSuite) TestSetupDB() {\n\tLog(log.InfoLevel, fmt.Sprintf(\"====== Running TestSetupDB ===========\"), true)\n\ttt := []struct {\n\t\ttestName string\n\t\tdbPath string\n\t\texpected string\n\t}{\n\t\t//Both valid and invalid test cases\n\t\t{\"Valid MMDB\", \"./test-data/test-data.mmdb\", \"\"},\n\t\t{\"Invalid MMDB\", \"./test-data/badFile.mmdb\", \"invalid argument\"},\n\t\t{\"Invalid MMDB\", \"INVALIDPATH#!\", \"open INVALIDPATH#!: no such file or directory\"},\n\t}\n\tfor _, tc := range tt {\n\n\t\terr := setupDB(tc.dbPath)\n\t\tswitch tc.testName {\n\t\tcase \"Valid MMDB\":\n\t\t\tif !suite.NoError(err, \"was expecting no Error, returned error\") {\n\t\t\t\tLog(log.InfoLevel, fmt.Sprintf(\"was expecting no Error, returned error %v\", err), true)\n\t\t\t}\n\t\tcase \"Invalid MMDB\":\n\t\t\tif !suite.Error(err, \"was expecting an error, returned ok\") {\n\t\t\t\tLog(log.InfoLevel, \"was expecting an error, returned ok\", true)\n\t\t\t}\n\t\t\tif !suite.Equal(tc.expected, err.Error(), \"was expecting %v, recieved %v\", tc.expected, err) {\n\t\t\t\tLog(log.InfoLevel, fmt.Sprintf(\"was expecting %v, recieved %v\", tc.expected, err), true)\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "252050ad3309800ec7597e8334d4b7c5", "score": "0.57509327", "text": "func setupDB() {\n\tsetup := func() {\n\t\tdbSrv := NewDBServer(TestDatabaseName, \"root\", \"password\")\n\t\tif err := dbSrv.Migrate(); err != nil {\n\t\t\tpanic(errors.Wrap(err, \"unable to migrate test db\"))\n\t\t}\n\t\tif err := dbSrv.Open(); err != nil {\n\t\t\tpanic(errors.Wrapf(err, \"unable to open test db\"))\n\t\t}\n\t\tTestDB = dbSrv.DB\n\t}\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\t// we may panic on cleanupTables if the DB doesn't exist, but it's helpful\n\t\t\t// to run it pre-tests anyway just to ensure consistency. just recover and\n\t\t\t// keep going.\n\t\t\tsetup()\n\t\t}\n\t}()\n\tif Integration {\n\t\tcleanupTables()\n\t\tsetup()\n\t}\n}", "title": "" }, { "docid": "3dbe5d59ef69fc0681fc4a986368ed9d", "score": "0.5749034", "text": "func TestC(t *testing.T) {\n\tif GetRocksDBMajorVersion() <= 0 {\n\t\tt.Errorf(\"Major version cannot be less than zero\")\n\t}\n\n\tdbname := tempDir(t)\n\tdefer deleteDBDirectory(t, dbname)\n\tenv := NewDefaultEnv()\n\tcache := NewLRUCache(1 << 20)\n\n\toptions := NewOptions()\n\t// options.SetComparator(cmp)\n\toptions.SetErrorIfExists(true)\n\toptions.SetCache(cache)\n\toptions.SetEnv(env)\n\toptions.SetInfoLog(nil)\n\toptions.SetWriteBufferSize(1 << 20)\n\toptions.SetParanoidChecks(true)\n\toptions.SetMaxOpenFiles(10)\n\toptions.SetBlockSize(1024)\n\toptions.SetBlockRestartInterval(8)\n\toptions.SetCompression(NoCompression)\n\n\troptions := NewReadOptions()\n\troptions.SetVerifyChecksums(true)\n\troptions.SetFillCache(false)\n\n\twoptions := NewWriteOptions()\n\twoptions.SetSync(true)\n\n\t_ = DestroyDatabase(dbname, options)\n\n\tdb, err := Open(dbname, options)\n\tif err == nil {\n\t\tt.Errorf(\"Open on missing db should have failed\")\n\t}\n\n\toptions.SetCreateIfMissing(true)\n\tdb, err = Open(dbname, options)\n\tif err != nil {\n\t\tt.Fatalf(\"Open failed: %v\", err)\n\t}\n\n\tputKey := []byte(\"foo\")\n\tputValue := []byte(\"hello\")\n\terr = db.Put(woptions, putKey, putValue)\n\tif err != nil {\n\t\tt.Errorf(\"Put failed: %v\", err)\n\t}\n\n\tCheckGet(t, \"after Put\", db, roptions, putKey, putValue)\n\n\twb := NewWriteBatch()\n\twb.Put([]byte(\"foo\"), []byte(\"a\"))\n\twb.Clear()\n\twb.Put([]byte(\"bar\"), []byte(\"b\"))\n\twb.Put([]byte(\"box\"), []byte(\"c\"))\n\twb.Delete([]byte(\"bar\"))\n\terr = db.Write(woptions, wb)\n\tif err != nil {\n\t\tt.Errorf(\"Write batch failed: %v\", err)\n\t}\n\tCheckGet(t, \"after WriteBatch\", db, roptions, []byte(\"foo\"), []byte(\"hello\"))\n\tCheckGet(t, \"after WriteBatch\", db, roptions, []byte(\"bar\"), nil)\n\tCheckGet(t, \"after WriteBatch\", db, roptions, []byte(\"box\"), []byte(\"c\"))\n\t// TODO: WriteBatch iteration isn't easy. Suffers same problems as\n\t// Comparator.\n\t// wbiter := &TestWBIter{t: t}\n\t// wb.Iterate(wbiter)\n\t// if wbiter.pos != 3 {\n\t// \tt.Errorf(\"After Iterate, on the wrong pos: %d\", wbiter.pos)\n\t// }\n\twb.Close()\n\n\titer := db.NewIterator(roptions)\n\tif iter.Valid() {\n\t\tt.Errorf(\"Read iterator should not be valid, yet\")\n\t}\n\titer.SeekToFirst()\n\tif !iter.Valid() {\n\t\tt.Errorf(\"Read iterator should be valid after seeking to first record\")\n\t}\n\tCheckIter(t, iter, []byte(\"box\"), []byte(\"c\"))\n\titer.Next()\n\tCheckIter(t, iter, []byte(\"foo\"), []byte(\"hello\"))\n\titer.Prev()\n\tCheckIter(t, iter, []byte(\"box\"), []byte(\"c\"))\n\titer.Prev()\n\tif iter.Valid() {\n\t\tt.Errorf(\"Read iterator should not be valid after go back past the first record\")\n\t}\n\titer.SeekToLast()\n\tCheckIter(t, iter, []byte(\"foo\"), []byte(\"hello\"))\n\titer.Seek([]byte(\"b\"))\n\tCheckIter(t, iter, []byte(\"box\"), []byte(\"c\"))\n\tif iter.GetError() != nil {\n\t\tt.Errorf(\"Read iterator has an error we didn't expect: %v\", iter.GetError())\n\t}\n\titer.Close()\n\n\t// approximate sizes\n\tn := 20000\n\tfor i := 0; i < n; i++ {\n\t\tkeybuf := []byte(fmt.Sprintf(\"k%020d\", i))\n\t\tvalbuf := []byte(fmt.Sprintf(\"v%020d\", i))\n\t\terr := db.Put(woptions, keybuf, valbuf)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Put error in approximate size test: %v\", err)\n\t\t}\n\t}\n\n\tranges := []Range{\n\t\t{[]byte(\"a\"), []byte(\"k00000000000000010000\")},\n\t\t{[]byte(\"k00000000000000010000\"), []byte(\"z\")},\n\t}\n\tsizes := db.GetApproximateSizes(ranges)\n\tif len(sizes) == 2 {\n\t\tif sizes[0] <= 0 {\n\t\t\tt.Errorf(\"First size range was %d\", sizes[0])\n\t\t}\n\t\tif sizes[1] <= 0 {\n\t\t\tt.Errorf(\"Second size range was %d\", sizes[1])\n\t\t}\n\t} else {\n\t\tt.Errorf(\"Expected 2 approx. sizes back, got %d\", len(sizes))\n\t}\n\n\t// property\n\tprop := db.PropertyValue(\"nosuchprop\")\n\tif prop != \"\" {\n\t\tt.Errorf(\"property nosuchprop should not have a value\")\n\t}\n\tprop = db.PropertyValue(\"rocksdb.stats\")\n\tif prop == \"\" {\n\t\tt.Errorf(\"property rocksdb.stats should have a value\")\n\t}\n\n\t// snapshot\n\tsnap := db.NewSnapshot()\n\terr = db.Delete(woptions, []byte(\"foo\"))\n\tif err != nil {\n\t\tt.Errorf(\"Delete during snapshot test errored: %v\", err)\n\t}\n\troptions.SetSnapshot(snap)\n\tCheckGet(t, \"from snapshot\", db, roptions, []byte(\"foo\"), []byte(\"hello\"))\n\troptions.SetSnapshot(nil)\n\tCheckGet(t, \"from snapshot\", db, roptions, []byte(\"foo\"), nil)\n\tdb.ReleaseSnapshot(snap)\n\n\t// repair\n\tdb.Close()\n\toptions.SetCreateIfMissing(false)\n\toptions.SetErrorIfExists(false)\n\terr = RepairDatabase(dbname, options)\n\tif err != nil {\n\t\tt.Errorf(\"Repairing db failed: %v\", err)\n\t}\n\tdb, err = Open(dbname, options)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to open repaired db: %v\", err)\n\t}\n\tCheckGet(t, \"repair\", db, roptions, []byte(\"foo\"), nil)\n\tCheckGet(t, \"repair\", db, roptions, []byte(\"bar\"), nil)\n\tCheckGet(t, \"repair\", db, roptions, []byte(\"box\"), []byte(\"c\"))\n\toptions.SetCreateIfMissing(true)\n\toptions.SetErrorIfExists(true)\n\n\t// filter\n\tpolicy := NewBloomFilter(10)\n\tdb.Close()\n\tDestroyDatabase(dbname, options)\n\toptions.SetFilterPolicy(policy)\n\tdb, err = Open(dbname, options)\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to recreate db for filter tests: %v\", err)\n\t}\n\terr = db.Put(woptions, []byte(\"foo\"), []byte(\"foovalue\"))\n\tif err != nil {\n\t\tt.Errorf(\"Unable to put 'foo' with filter: %v\", err)\n\t}\n\terr = db.Put(woptions, []byte(\"bar\"), []byte(\"barvalue\"))\n\tif err != nil {\n\t\tt.Errorf(\"Unable to put 'bar' with filter: %v\", err)\n\t}\n\tdb.CompactRange(Range{nil, nil})\n\tCheckGet(t, \"filter\", db, roptions, []byte(\"foo\"), []byte(\"foovalue\"))\n\tCheckGet(t, \"filter\", db, roptions, []byte(\"bar\"), []byte(\"barvalue\"))\n\toptions.SetFilterPolicy(nil)\n\tpolicy.Close()\n\n\t// cleanup\n\tdb.Close()\n\toptions.Close()\n\troptions.Close()\n\twoptions.Close()\n\tcache.Close()\n\t// DestroyComparator(cmp)\n\tenv.Close()\n}", "title": "" }, { "docid": "c89bc1c294ab7250f76febcfef732e72", "score": "0.57452697", "text": "func TestCockroach13755(t *testing.T) {\n\trs := &Rows{}\n\trs.initContextClose(context.Background())\n\t// FIX: rs.close()\n}", "title": "" }, { "docid": "e7f6d9d115e58935ee36a34f5e4af176", "score": "0.57362753", "text": "func TestSQLiteCleanUp(t *testing.T) {\n\tstorage, err := NewSQLiteStorage(\":memory:\")\n\tif err != nil {\n\t\tt.Error(\"NewSQLiteStorage(): \", err)\n\t\treturn\n\t}\n\n\tmockOuts := mockTxOuts(0, 10, 1, 0)\n\n\terr = storage.Set(mockOuts[1])\n\tif err != nil {\n\t\tt.Error(\"Set(): \", err)\n\t\treturn\n\t}\n\n\t//\n\tif err := storage.CleanUp(); err != nil {\n\t\tt.Error(\"CleanUp(): \", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e63230897cd17c0656e580b8f9aa2b69", "score": "0.5729588", "text": "func (suite *RepositoryTestSuit) SetupSuite() {\n\tsuite.ctx, suite.ctxCancel = context.WithCancel(context.Background())\n\tsuite.logger = zap.NewNop()\n\n\tdsn := fmt.Sprintf(\"postgres://%s:%s@%s:%s/%s\",\n\t\tPostgresUser,\n\t\tPostgresPassword,\n\t\tPostgresHost,\n\t\tPostgresPort,\n\t\tPostgresDB,\n\t)\n\n\tdbConn, err := sqlx.Connect(\"pgx\", dsn)\n\tassert.Nil(suite.T(), err)\n\tassert.NotNil(suite.T(), dbConn)\n\n\tsuite.db = dbConn\n\n\ta := make([]any, 0, len(DTOs))\n\tfor _, v := range DTOs {\n\t\ta = append(a, v)\n\t}\n\n\torm.InitMetaTagInfoCache(a...)\n\torm.InitMetaTagInfoCache(&dto.BaseDTO[dto.ID]{}, &dto.UsersRole[dto.ID]{})\n\n\ttables := []string{}\n\t// create table\n\tfor _, obj := range DTOs {\n\t\ttable := orm.GetTableName(obj)\n\t\tassert.NotEqual(suite.T(), \"\", table)\n\t\ttables = append(tables, table)\n\n\t\t_, err = dbConn.ExecContext(suite.ctx, dto.DSL[table])\n\t\tassert.Nil(suite.T(), err)\n\t}\n\n\t// Refresh DB\n\tfor _, table := range tables {\n\t\t_, err = dbConn.ExecContext(suite.ctx, fmt.Sprintf(\"TRUNCATE TABLE %s RESTART IDENTITY CASCADE;\", table))\n\t\tassert.Nil(suite.T(), err)\n\t}\n\n\tsuite.connector = connector.New[config.SimpleTestConfig](config.New(\n\t\tsquirrel.Dollar, false, false), zap.NewNop(), dbConn)\n\tsuite.connectorWithValidation = connector.New[config.SimpleTestConfig](\n\t\tconfig.New(squirrel.Dollar, true, false), zap.NewNop(), dbConn)\n\tsuite.connectorWithValidationAndCache = connector.New[config.SimpleTestConfig](\n\t\tconfig.New(squirrel.Dollar, true, true), zap.NewNop(), dbConn)\n\n\tassert.NotNil(suite.T(), suite.connector)\n\tassert.NotNil(suite.T(), suite.connectorWithValidation)\n\tassert.NotNil(suite.T(), suite.connectorWithValidationAndCache)\n\n\tsuite.connector.AddAllowsRepos(GetTableNames(DTOs)...) // not needed only for test not error or panic here ...\n\tsuite.connectorWithValidation.AddAllowsRepos(GetTableNames(DTOs)...)\n\tsuite.connectorWithValidationAndCache.AddAllowsRepos(GetTableNames(DTOs)...)\n\n\tassert.Nil(suite.T(), appendTestDataToTables(suite))\n}", "title": "" }, { "docid": "fd8e73f77596d9afa6ea6475299a8d4b", "score": "0.570015", "text": "func TestMigrator_data(t *testing.T) {\n\tdir := testRaftDir(t)\n\tdefer os.RemoveAll(dir)\n\n\tm, err := New(dir)\n\tif err != nil {\n\t\tt.Fatalf(\"err: %s\", err)\n\t}\n\n\tif err := m.mdbConnect(m.raftPath); err != nil {\n\t\tt.Fatalf(\"err: %s\", err)\n\t}\n\tdefer m.mdbStore.Close()\n\n\t// Ensure we have at least a few logs in the log store\n\tfirst, err := m.mdbStore.FirstIndex()\n\tif err != nil {\n\t\tt.Fatalf(\"err: %s\", err)\n\t}\n\tlast, err := m.mdbStore.LastIndex()\n\tif err != nil {\n\t\tt.Fatalf(\"err: %s\", err)\n\t}\n\tif first < 1 || last < 3 {\n\t\tt.Fatalf(\"bad index: first=%d, last=%d\", first, last)\n\t}\n\n\t// Ensure we have the stable store keys\n\tfor _, key := range stableStoreKeys {\n\t\tif _, err := m.mdbStore.Get(key); err != nil {\n\t\t\tt.Fatalf(\"missing stable store key: %s\", string(key))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a99361d4b31bc2898e95574bf0abc027", "score": "0.5698006", "text": "func testManyQueries(t *testing.T) {\n\tfor r := 0; r < (poolSize+1)*CLOSE_EVERY_N; r++ {\n\t\tfunc() {\n\t\t\tconn, err := GetCassConn(\"testing\")\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(\"Couldn't get conn from pool\")\n\t\t\t}\n\t\t\tdefer conn.Checkin()\n\n\t\t\t_, err = conn.Query(\"SELECT * FROM user;\")\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(\"Couldn't execute query\")\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "bdf4c101f2d4682008f1fe6a4b5d88af", "score": "0.5691468", "text": "func main() {\n\tdb, err := sql.Open(\"mysql\",\n\t\t\"test:test@tcp(127.0.0.1:3306)/test\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\terr = db.Ping()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvar (\n\t\tid int\n\t\tname string\n\t)\n\trows, err := db.Query(\"select id, name from users where id = ?\", 1)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor rows.Next() {\n\t\terr := rows.Scan(&id, &name)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlog.Println(id, name)\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// prepared statement\n\tstmt, err := db.Prepare(\"select id, name from users where id = ?\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer stmt.Close()\n\trows, err = stmt.Query(1)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\trows.Close()\n\trows, err = stmt.Query(2)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\trows.Close()\n\n\t// queryRow\n\terr = db.QueryRow(\"select name from users where id = ?\", 1).Scan(&name)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\tlog.Println(\"no rows in result set\")\n\t\t} else {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\t// modify data\n\tstmt, err = db.Prepare(\"INSERT INTO users(name) VALUES(?)\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tres, err := stmt.Exec(\"Dolly\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlastId, err := res.LastInsertId()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\trowCnt, err := res.RowsAffected()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"ID = %d, affected = %d\\n\", lastId, rowCnt)\n\n\t// transactions\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer tx.Rollback()\n\tstmt, err = tx.Prepare(\"INSERT INTO users(name) VALUES(?)\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer stmt.Close()\n\tfor i := 0; i < 10; i++ {\n\t\t_, err = stmt.Exec(i)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\terr = tx.Commit()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "9e5ffcbffed0cc85a19aedcc8feeec3e", "score": "0.5689972", "text": "func TestGetTotalStockIn(t *testing.T) {\n\ttm := time.Date(2012, time.November, 12, 15, 00, 00, 00, time.Local)\n\ttm2 := time.Date(time.Now().Year(), time.Now().Month(), 12, 15, 00, 00, 00, time.Local)\n\t// hapus database\n\to := orm.NewOrm()\n\to.Raw(\"DELETE FROM workorder_receiving\").Exec()\n\t// buat dummy\n\two1 := model.DummyWorkorderReceiving()\n\two1.IsDeleted = int8(0)\n\two1.RecognitionDate = time.Now()\n\two1.Save()\n\twoi1 := model.DummyWorkorderReceivingItem()\n\twoi1.Quantity = float32(50)\n\twoi1.WorkorderReceiving = wo1\n\twoi1.Save()\n\n\two2 := model.DummyWorkorderReceiving()\n\two2.IsDeleted = int8(1)\n\two2.RecognitionDate = time.Now()\n\two2.Save()\n\twoi2 := model.DummyWorkorderReceivingItem()\n\twoi2.Quantity = float32(150)\n\twoi2.WorkorderReceiving = wo2\n\twoi2.Save()\n\n\two3 := model.DummyWorkorderReceiving()\n\two3.IsDeleted = int8(0)\n\two3.RecognitionDate = tm2\n\two3.Save()\n\twoi3 := model.DummyWorkorderReceivingItem()\n\twoi3.Quantity = float32(70)\n\twoi3.WorkorderReceiving = wo3\n\twoi3.Save()\n\n\two4 := model.DummyWorkorderReceiving()\n\two4.IsDeleted = int8(0)\n\two4.RecognitionDate = tm\n\two4.Save()\n\twoi4 := model.DummyWorkorderReceivingItem()\n\twoi4.Quantity = float32(50)\n\twoi4.WorkorderReceiving = wo4\n\twoi4.Save()\n\n\t// test\n\ttotal, e := GetTotalStockIn(int(time.Now().Month()), time.Now().Year())\n\tassert.NoError(t, e)\n\tassert.Equal(t, float32(120), total)\n}", "title": "" }, { "docid": "8f4fb85e20a38564832c5acf7369114d", "score": "0.5680236", "text": "func (suite *TestQuerySuite) TestCreateOrLoadQuery(c *C) {\n\tvar md5Value db.Bytes16\n\t(&md5Value).Scan(\"810512c76a1c44ddb0d6097ef4ef156e\")\n\n\tsampleQuery := &owlModel.Query{\n\t\tNamedId: \"gp-query-1\",\n\t\tMd5Content: md5Value,\n\t\tContent: md5Value[:],\n\t}\n\n\ttestedQueryService.CreateOrLoadQuery(sampleQuery)\n\n\tc.Assert(sampleQuery.Uuid.IsNil(), Equals, false, Commentf(\"UUID is nil value\"))\n\t// Asserts the value is in cache\n\tc.Assert(\n\t\ttestedQueryService.cache.Get(KeyByDbUuid(sampleQuery.Uuid)),\n\t\tNotNil,\n\t)\n\n\t/**\n\t * Trying to loads the same query with the same md5 value\n\t */\n\tsampleQuery_2 := &owlModel.Query{\n\t\tNamedId: \"gp-query-1\",\n\t\tMd5Content: md5Value,\n\t\tContent: md5Value[:],\n\t}\n\ttestedQueryService.CreateOrLoadQuery(sampleQuery_2)\n\tc.Assert(sampleQuery_2.Uuid, DeepEquals, sampleQuery.Uuid)\n\t// :~)\n}", "title": "" }, { "docid": "492a856e0b6b816195119161bce2c664", "score": "0.56768185", "text": "func cleanDB(DB *gorm.DB) {\n\tdb, _ := DB.DB()\n\tdb.Close()\n\tprintln(\"Cleaned up DB\")\n\ttime.Sleep(time.Duration(time.Second * 5))\n}", "title": "" }, { "docid": "bde9b7688b331818318c9598a2cf202c", "score": "0.5665473", "text": "func TestSQLiteNewSQLiteWriter(t *testing.T) { makeWriter(t, false, \":memory:\", false) }", "title": "" }, { "docid": "5138f25f60bf740258160a3dbf53c50c", "score": "0.56430054", "text": "func testDbConn(db *sql.DB) bool {\n\tvar fqdn string\n\tvar reputation string\n\n\tlog.Println(\"Initializing new database connection\")\n\terr := db.QueryRow(\"SELECT * FROM fqdns LIMIT 1\").Scan(&fqdn, &reputation)\n\tfatalErr(err)\n\n\terr = db.Close()\n\tfatalErr(err)\n\n\tlog.Println(\"Selected 1 row from database: \", fqdn, \" \", reputation)\n\tif fqdn != \"\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "22ab093f2db41cfa914cadd3e66d551e", "score": "0.56418735", "text": "func TestFouledDelete(t *testing.T) {\n\tassert := assert.New(t)\n\tdatabase.Open(database.Config{\n\t\tType: \"sqlite3\",\n\t\tLogging: true,\n\t\tConnection: \":memory:\",\n\t})\n\n\tnow := time.Now().Add(-time.Hour * 48)\n\tgood := models.Good{\n\t\tFouledAt: &now,\n\t}\n\tdatabase.Write.Create(&good)\n\n\tgood = models.Good{\n\t\tFouledAt: &now,\n\t}\n\tdatabase.Write.Create(&good)\n\n\tcount := GoodFouled()\n\tassert.Equal(2, count, \"not fouled\")\n\n\tgood = models.Good{\n\t\tFouledAt: &now,\n\t}\n\tdatabase.Write.Create(&good)\n\n\tnow = time.Now().Add(time.Hour * 48)\n\tgood = models.Good{\n\t\tFouledAt: &now,\n\t}\n\tdatabase.Write.Create(&good)\n\n\tcount = GoodFouled()\n\tassert.Equal(1, count, \"fouled\")\n\n\tdatabase.Close()\n}", "title": "" }, { "docid": "42cd25f36a4f098b96189c1958a840f3", "score": "0.56409544", "text": "func TestBadConnection1(t *testing.T) {\n\ttestdb := initDB(t)\n\tdefer func() {\n\t\ttestdb.Db.Close()\n\t\tserver.Stop()\n\t}()\n\n\t_, _, err := testdb.queryDb(\"SELECT * FROM people;\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\t//close the connection to the db to ~simulate (kinda)~ a lost connection\n\ttestdb.Db.Close()\n\n\t_, _, err = testdb.queryDb(\"SELECT * FROM people;\")\n\tif err != nil {\n\t\tt.Error(\"failed to reconnect: %v\", err)\n\t}\n}", "title": "" }, { "docid": "feb193f2a33fbb9952cd1e5a0894eb1a", "score": "0.56369454", "text": "func TestConnectionDatabase(t *testing.T) {\n\tdefer gock.Off()\n\n\tgock.New(fmt.Sprintf(\"https://%s\", globalTestConnections.Version1MockHost)).\n\t\tGet(\"/test_db\").\n\t\tReply(200).\n\t\tJSON(getMockDatabaseRoot())\n\n\tcon := globalTestConnections.Version1(t, true)\n\tdb := con.Database(\"test_db\")\n\n\tst.Assert(t, db.metadata, ((*DatabaseMetadata)(nil)))\n\n\tmdata, err := db.Metadata()\n\tst.Assert(t, err, nil)\n\n\tst.Reject(t, db.metadata, ((*DatabaseMetadata)(nil)))\n\n\tst.Assert(t, mdata.Name, \"test_db\")\n\tst.Assert(t, mdata.DocCount, 639)\n\tst.Assert(t, mdata.InstanceStartTime, \"1484039376767413\")\n}", "title": "" }, { "docid": "59d70b7ecffaff558301602f1432e2c0", "score": "0.5619033", "text": "func TestRowSql(t *testing.T) {\n\n\t//release\n\tgot, err := openTestingDB(t, &Config{\n\t\tDSN: dsn,\n\t\tDebug: false,\n\t\tMaxIdleConns: 10,\n\t\tMaxOpenConns: 100,\n\t\tConnMaxLifetime: time.Second * 300,\n\t\tOnDialError: \"panic\",\n\t\tSlowThreshold: time.Millisecond * 300,\n\t})\n\tassert.Nil(t, err)\n\n\tvar sql string\n\tvar lztests []LzTest\n\tvar name string\n\tvar name_update string\n\tname = \"lzsql01\"\n\tname_update = \"lzsql123\"\n\tsql = \"INSERT INTO lztest(`name`,`sex`,`age`,`role`) values ('lzsql01','1','1','lz');\"\n\tassert.Nil(t, got.WithContext(context.Background()).Raw(sql).Scan(&lztests).Error)\n\n\tsql = fmt.Sprintf(\"select * from lztest where name = \\\"%s\\\"\", name)\n\tassert.Nil(t, got.WithContext(context.Background()).Raw(sql).Scan(&lztests).Error)\n\tassert.Equal(t, name, lztests[0].Name)\n\n\tsql = fmt.Sprintf(\"update lztest set name = \\\"%s\\\" where name = \\\"%s\\\"\", name_update, name)\n\tassert.Nil(t, got.WithContext(context.Background()).Raw(sql).Scan(&lztests).Error)\n\tsql = fmt.Sprintf(\"select * from lztest where name = \\\"%s\\\"\", name_update)\n\tassert.Nil(t, got.WithContext(context.Background()).Raw(sql).Scan(&lztests).Error)\n\tassert.Equal(t, name_update, lztests[0].Name)\n\n\tsql = fmt.Sprintf(\"delete from lztest where name = \\\"%s\\\"\", name_update)\n\tassert.Nil(t, got.WithContext(context.Background()).Raw(sql).Debug().Scan(&lztests).Error)\n\tsql = fmt.Sprintf(\"select * from lztest where name = \\\"%s\\\"\", name_update)\n\t// TODO:确认gorm scan的逻辑是否符合预期\n\tlztests = []LzTest{}\n\tassert.Nil(t, got.WithContext(context.Background()).Raw(sql).Debug().Scan(&lztests).Error)\n\tassert.Equal(t, 0, len(lztests))\n\tfmt.Println(\"=======delete:\", len(lztests))\n\n\t//stress\n\tgotshadow, err := openTestingDB(t, &Config{\n\t\tDSN: dsn,\n\t\tDebug: false,\n\t\tMaxIdleConns: 10,\n\t\tMaxOpenConns: 100,\n\t\tConnMaxLifetime: time.Second * 300,\n\t\tOnDialError: \"panic\",\n\t\tSlowThreshold: time.Millisecond * 300,\n\t\tAutoShadowTable: true,\n\t})\n\tmd := imeta.New(nil)\n\tmd[\"x-dyctx-label\"] = []string{\"1\"}\n\tctx := imeta.WithContext(context.Background(), md)\n\tassert.Nil(t, err)\n\n\tvar sqlshadow string\n\tvar lztestshadows []LzTest\n\tvar nameshadow string\n\tvar name_update_shadow string\n\tnameshadow = \"lzsql01\"\n\tname_update_shadow = \"lzsql123\"\n\tsqlshadow = \"INSERT INTO lztest(`name`,`sex`,`age`,`role`) values ('lzsql01','1','1','lz');\"\n\tassert.Nil(t, gotshadow.WithContext(ctx).Raw(sqlshadow).Scan(&lztestshadows).Error)\n\n\tsqlshadow = fmt.Sprintf(\"select * from lztest where name = \\\"%s\\\"\", nameshadow)\n\tassert.Nil(t, gotshadow.WithContext(ctx).Raw(sqlshadow).Scan(&lztestshadows).Error)\n\tassert.Equal(t, nameshadow, lztestshadows[0].Name)\n\n\tsqlshadow = fmt.Sprintf(\"update lztest set name = \\\"%s\\\" where name = \\\"%s\\\"\", name_update_shadow, nameshadow)\n\tassert.Nil(t, gotshadow.WithContext(ctx).Raw(sqlshadow).Scan(&lztestshadows).Error)\n\tsqlshadow = fmt.Sprintf(\"select * from lztest where name = \\\"%s\\\"\", name_update_shadow)\n\tassert.Nil(t, gotshadow.WithContext(ctx).Raw(sqlshadow).Scan(&lztestshadows).Error)\n\tassert.Equal(t, name_update_shadow, lztestshadows[0].Name)\n\n\tsqlshadow = fmt.Sprintf(\"delete from lztest where name = \\\"%s\\\"\", name_update_shadow)\n\tassert.Nil(t, gotshadow.WithContext(ctx).Raw(sqlshadow).Scan(&lztestshadows).Error)\n\tsqlshadow = fmt.Sprintf(\"select * from lztest where name = \\\"%s\\\"\", name_update_shadow)\n\t// TODO:确认gorm scan的逻辑是否符合预期\n\tlztestshadows = []LzTest{}\n\tassert.Nil(t, gotshadow.WithContext(ctx).Raw(sqlshadow).Scan(&lztestshadows).Error)\n\tassert.Equal(t, 0, len(lztestshadows))\n\tfmt.Println(\"=======delete:\", len(lztestshadows))\n\n}", "title": "" }, { "docid": "2a53cbb951b664d0cc2468d92adb7b21", "score": "0.56147695", "text": "func fetch_insert_delay_commit (id string, wait_second int) {\n fmt.Println (\"Insert a row, commit later\")\n testutil.RunDMLCommitLater(\"insert into test_simple_table_1 (ID, Name, Status) VALUES (\" + id + \", 'Smith', 111)\", wait_second)\n testutil.RunSelect (\"Select Name from test_simple_table_1 where ID = \" + id);\n}", "title": "" }, { "docid": "6982a8329eea68dd33c809c1e34b1fb7", "score": "0.56016713", "text": "func SetupDB() {\n\t// log.Println(\"Add lyrics to DB...\")\n\tclient := ConnectToDB()\n\tAddLyricsToDB(client)\n\tlog.Println(\"Added lyrics to DB successfully.\")\n\tAddPoemsToDB(client)\n\tlog.Println(\"Added poems to DB successfully.\")\n\t// AddMovieQuotesToDB(client)\n\t// log.Println(\"Added movie quotes to DB successfully.\")\n}", "title": "" }, { "docid": "10c4f7617081fdc2e05d53ce3984cc23", "score": "0.56011146", "text": "func SetupTestDatabase() {\n\tvar err error\n\tDB, err = gorm.Open(\"sqlite3\", \"./gorm_test.db\")\n\tif err != nil {\n\t\tfmt.Println(\"db err: \", err)\n\t}\n\tDB.DB().SetMaxIdleConns(3)\n\t// Migrate the Schema\n\tDB.AutoMigrate(&RoomModel{}, &Sensor{}, &Data{})\n}", "title": "" }, { "docid": "8cfc925ba33c007c41ec2a0efe2372ab", "score": "0.5597386", "text": "func TestTransactions(t *testing.T) {\n\tdefer clean(t)\n\n\tif err := migrate(3); err == nil {\n\t\tt.Error(\"Expected migration to fail\")\n\t}\n\n\trows, err := conn.Query(\"select name from samples where name = 'abc'\")\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to query for sample names:%s\", err)\n\t}\n\n\tfor rows.Next() {\n\t\tvar name string\n\t\tif err := rows.Scan(&name); err != nil {\n\t\t\tt.Errorf(\"Unable to scan results: %s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif name == \"abc\" {\n\t\t\tt.Error(\"Unexpected abc value\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "330fe8f37aaaedb0e6534b643b80a904", "score": "0.55908203", "text": "func TestWithRealDatabase(t *testing.T) {\n\thdl, err := vttest.LaunchVitess(\n\t\tvttest.MySQLOnly(\"vttest\"),\n\t\tvttest.Schema(\"create table a(id int, name varchar(128), primary key(id))\"))\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tdefer func() {\n\t\terr = hdl.TearDown()\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\treturn\n\t\t}\n\t}()\n\tparams, err := hdl.MySQLConnParams()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tctx := context.Background()\n\tconn, err := Connect(ctx, &params)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Try a simple error case.\n\t_, err = conn.ExecuteFetch(\"select * from aa\", 1000, true)\n\tif err == nil || !strings.Contains(err.Error(), \"Table 'vttest.aa' doesn't exist\") {\n\t\tt.Fatalf(\"expected error but got: %v\", err)\n\t}\n\n\t// Try a simple insert.\n\tresult, err := conn.ExecuteFetch(\"insert into a(id, name) values(10, 'nice name')\", 1000, true)\n\tif err != nil {\n\t\tt.Fatalf(\"insert failed: %v\", err)\n\t}\n\tif result.RowsAffected != 1 || len(result.Rows) != 0 {\n\t\tt.Errorf(\"unexpected result for insert: %v\", result)\n\t}\n\n\t// And re-read what we inserted.\n\tresult, err = conn.ExecuteFetch(\"select * from a\", 1000, true)\n\tif err != nil {\n\t\tt.Fatalf(\"insert failed: %v\", err)\n\t}\n\texpectedResult := &sqltypes.Result{\n\t\tFields: []*querypb.Field{\n\t\t\t{\n\t\t\t\tName: \"id\",\n\t\t\t\tType: querypb.Type_INT32,\n\t\t\t\tTable: \"a\",\n\t\t\t\tOrgTable: \"a\",\n\t\t\t\tDatabase: \"vttest\",\n\t\t\t\tOrgName: \"id\",\n\t\t\t\tColumnLength: 11,\n\t\t\t\tCharset: 63, // binary\n\t\t\t\tFlags: 16387, // NOT_NULL_FLAG, PRI_KEY_FLAG, PART_KEY_FLAG\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: \"name\",\n\t\t\t\tType: querypb.Type_VARCHAR,\n\t\t\t\tTable: \"a\",\n\t\t\t\tOrgTable: \"a\",\n\t\t\t\tDatabase: \"vttest\",\n\t\t\t\tOrgName: \"name\",\n\t\t\t\tColumnLength: 384,\n\t\t\t\tCharset: 33, // utf8\n\t\t\t},\n\t\t},\n\t\tRows: [][]sqltypes.Value{\n\t\t\t{\n\t\t\t\tsqltypes.MakeTrusted(querypb.Type_INT32, []byte(\"10\")),\n\t\t\t\tsqltypes.MakeTrusted(querypb.Type_VARCHAR, []byte(\"nice name\")),\n\t\t\t},\n\t\t},\n\t}\n\tif !reflect.DeepEqual(result, expectedResult) {\n\t\tt.Errorf(\"unexpected result for select, got:\\n%v\\nexpected:\\n%v\\n\", result, expectedResult)\n\t}\n\n\t// Now be serious: insert a thousand rows.\n\ttimeInserts(t, &params, 1000)\n\n\t// And use a streaming query to read them back.\n\t// Do it twice to make sure state is reset properly.\n\treadRowsUsingStream(t, &params, 1001)\n\treadRowsUsingStream(t, &params, 1001)\n\n\tif true {\n\t\t// Return early, rest is more load tests.\n\t\treturn\n\t}\n\n\t// More serious, even more. Get 1001 rows, 10000 times.\n\ttimeSelects(t, &params, 10000, 1001)\n\n\t// Use the new client, do parallel reads.\n\ttimeParallelReads(t, &params, 10, 10000)\n\n\t// Use the old client, do the same parallel query.\n\ttimeOldParallelReads(t, params, 10, 10000)\n}", "title": "" }, { "docid": "975617735be4090d33af1edbe3a0e480", "score": "0.55860853", "text": "func TestSeed(t *testing.T) {\n\tvar task Task\n\n\tDB.Where(\"name = 'Exercise'\").First(&task)\n\n\tif task.ID == 0 {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "975617735be4090d33af1edbe3a0e480", "score": "0.55860853", "text": "func TestSeed(t *testing.T) {\n\tvar task Task\n\n\tDB.Where(\"name = 'Exercise'\").First(&task)\n\n\tif task.ID == 0 {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "d112e06978f753e74aef3b877a6a6538", "score": "0.5582669", "text": "func (db *Database) PrepopulateDatabase() error {\n\t// populate users\n\terr := db.DB.CreateTable(&user.User{}, &orm.CreateTableOptions{})\n\tif err == nil {\n\t\terr := db.DB.Insert(&initialUsers)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\"Database is populated with users\")\n\t} else {\n\t\tlog.Println(err)\n\t}\n\n\t// populate todos\n\terr = db.DB.CreateTable(&todo.Todo{}, &orm.CreateTableOptions{})\n\tif err == nil {\n\t\terr := db.DB.Insert(&initialTodos)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\"Database is populated with todos\")\n\t} else {\n\t\tlog.Println(err)\n\t}\n\n\t// create table for sessions\n\terr = db.DB.CreateTable(&session.Session{}, &orm.CreateTableOptions{})\n\tif err == nil {\n\t\tfmt.Println(\"Sessions table was created\")\n\t} else {\n\t\tlog.Println(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "86b77ec9bc9c586da1d07db4f75cb898", "score": "0.55799454", "text": "func prepareTestLogDB(logID logIDAndTest, t *testing.T) *sql.DB {\n\tdb := prepareTestTreeDB(logID.logID, t)\n\n\t// Now put back the tree row for this log id\n\t_, err := db.Exec(`REPLACE INTO Trees(TreeId, KeyId, TreeType, LeafHasherType, TreeHasherType)\n\t\t\t\t\t VALUES(?, ?, \"LOG\", \"SHA256\", \"SHA256\")`, logID.logID, logID.logID)\n\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to create tree entry for test: %v\", err)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "b99b272c0b9884033cbe90a9511e2f4d", "score": "0.55775124", "text": "func Bad(conn *sql.DB) error {\n\ttx, err := conn.Begin()\n\t// Do not close the transaction\n\trows, err := tx.Query(\"select id from harness_tests\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\treturn nil\n}", "title": "" }, { "docid": "f921df25d4a405af66758e28a7d91d95", "score": "0.55745184", "text": "func (self *IntegrationSuite) TestDbDelete(c *C) {\n\terr := self.server.WriteData(`\n[\n {\n \"name\": \"test_deletetions\",\n \"columns\": [\"val1\", \"val2\"],\n \"points\":[[\"v1\", 2]]\n }\n]`, \"time_precision=s\")\n\tc.Assert(err, IsNil)\n\tbs, err := self.server.RunQuery(\"select val1 from test_deletetions\", \"m\")\n\tc.Assert(err, IsNil)\n\tdata := []*h.SerializedSeries{}\n\terr = json.Unmarshal(bs, &data)\n\tc.Assert(data, HasLen, 1)\n\n\treq, err := http.NewRequest(\"DELETE\", \"http://localhost:8086/db/db1?u=root&p=root\", nil)\n\tc.Assert(err, IsNil)\n\tresp, err := http.DefaultClient.Do(req)\n\tc.Assert(err, IsNil)\n\tc.Assert(resp.StatusCode, Equals, http.StatusNoContent)\n\t// recreate the database and the user\n\tc.Assert(self.createUser(), IsNil)\n\n\t// this shouldn't return any data\n\tbs, err = self.server.RunQuery(\"select val1 from test_deletetions\", \"m\")\n\tc.Assert(err, IsNil)\n\tdata = []*h.SerializedSeries{}\n\terr = json.Unmarshal(bs, &data)\n\tc.Assert(err, IsNil)\n\tc.Assert(data, HasLen, 1)\n\tc.Assert(data[0].Points, HasLen, 0)\n}", "title": "" }, { "docid": "c932776fa6b60b7fb8b9c423dd7d6366", "score": "0.5562002", "text": "func main() {\n\tdata := makeData(ROWS)\n\tfmt.Printf(\"rows: %d\\n\", ROWS)\n\n\tdb, err := libPQConnect(DSN)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttimerPQ := time.Now()\n\n\tif err := libPQWrite(db, data); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdurPQ := time.Since(timerPQ)\n\n\tfmt.Printf(\"libpq: %s\\n\", durPQ)\n\n\tdb.Close()\n\n\tvar prepare = false\n\n\tdbGorm, err := gormConnect(DSN, prepare)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttimerGORM := time.Now()\n\n\tif err := gormWrite(dbGorm, data); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdurGORM := time.Since(timerGORM)\n\tfmt.Printf(\"gorm (prepare: %v) %s\\n\", prepare, durGORM)\n\n\tprepare = false\n\n\tdbGorm, err = gormConnect(DSN, prepare)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttimerGORMSlice := time.Now()\n\n\tif err := gormWriteSlice(dbGorm, data); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdurGORMSlice := time.Since(timerGORMSlice)\n\tfmt.Printf(\"gorm slice (prepare: %v) %s\\n\", prepare, durGORMSlice)\n}", "title": "" }, { "docid": "174185ef64b653a686da6d782c584caf", "score": "0.5561934", "text": "func TestDB_Append(t *testing.T) {\n\tvar db DB\n\tdb.Append(&Row{Data: map[string]interface{}{\"foo\": \"bar\", \"num\": 100}})\n\tdb.Append(&Row{Data: map[string]interface{}{\"baz\": \"bat\"}})\n\tequals(t, 2, db.Length())\n\tequals(t, \"bar\", db.Row(0).Data[\"foo\"])\n\tequals(t, 100, db.Row(0).Data[\"num\"])\n\tequals(t, \"bat\", db.Row(1).Data[\"baz\"])\n}", "title": "" }, { "docid": "ccba2b638292e1112d9a74d20e958c91", "score": "0.55615366", "text": "func (connector *DbConnector) flush() {\n\tc := connector.pool.Get()\n\tdefer c.Close()\n\tc.Do(\"FLUSHDB\")\n}", "title": "" }, { "docid": "3d9c6d0aefdb0693f767a395adccb713", "score": "0.5540827", "text": "func testPrefetchRealDB(t *testing.T) {\n\trepo2 := &Repo{\n\t\tURL: mirrorURL + \"/mirror2\",\n\t}\n\tconfig.Repos[\"repo2\"] = repo2\n\tdefer delete(config.Repos, \"repo2\")\n\n\trequire.NoError(t, os.Mkdir(path.Join(mirrorDir, \"mirror2\"), os.ModePerm))\n\tdefer os.RemoveAll(path.Join(mirrorDir, \"mirror2\"))\n\n\tdbAtMirror := path.Join(mirrorDir, \"mirror2\", \"test.db\")\n\tcreateDbTarball(t, dbAtMirror, getTestTarDB())\n\tmirror, err := updateDBRequestedDB(\"repo2\", \"\", \"/test.db\")\n\trequire.NoError(t, err)\n\terr = downloadAndParseDb(mirror)\n\trequire.NoErrorf(t, err, \"This shouldn't fail at all. Error: %v\", err)\n}", "title": "" }, { "docid": "a8b445dd32bb3a66cd88647de29ba14b", "score": "0.5528688", "text": "func TestOpenDatabase(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\ttestBuckets := [][]byte{\n\t\t[]byte(\"Fake Bucket123!@#$\"),\n\t\t[]byte(\"你好好好\"),\n\t\t[]byte(\"¯|_(ツ)_|¯\"),\n\t\t[]byte(\"Powerلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ冗\"),\n\t\t[]byte(\"﷽\"),\n\t\t[]byte(\"(ノಥ益ಥ ┻━┻\"),\n\t\t[]byte(\"Ṱ̺̺o͞ ̷i̲̬n̝̗v̟̜o̶̙kè͚̮ ̖t̝͕h̼͓e͇̣ ̢̼h͚͎i̦̲v̻͍e̺̭-m̢iͅn̖̺d̵̼ ̞̥r̛̗e͙p͠r̼̞e̺̠s̘͇e͉̥ǹ̬͎t͍̬i̪̱n͠g̴͉ ͏͉c̬̟h͡a̫̻o̫̟s̗̦.̨̹\"),\n\t\t[]byte(\"0xbadidea\"),\n\t\t[]byte(\"␣\"),\n\t\t[]byte(\"你好好好\"),\n\t}\n\t// Create a folder for the database file. If a folder by that name exists\n\t// already, it will be replaced by an empty folder.\n\ttestDir := build.TempDir(persistDir, t.Name())\n\terr := os.MkdirAll(testDir, 0700)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfor i, in := range testInputs {\n\t\tdbFilename := testFilenames[i%len(testFilenames)]\n\t\tdbFilepath := filepath.Join(testDir, dbFilename)\n\t\t// Create a new database.\n\t\tdb, err := OpenDatabase(in.md, dbFilepath)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"calling OpenDatabase on a new database failed for metadata %v, filename %v; error was %v\", in.md, dbFilename, err)\n\t\t\tcontinue\n\t\t}\n\t\t// Close the newly-created, empty database.\n\t\terr = db.Close()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"closing a newly created database failed for metadata %v, filename %v; error was %v\", in.md, dbFilename, err)\n\t\t\tcontinue\n\t\t}\n\t\t// Call OpenDatabase again, this time on the existing empty database.\n\t\tdb, err = OpenDatabase(in.md, dbFilepath)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"calling OpenDatabase on an existing empty database failed for metadata %v, filename %v; error was %v\", in.md, dbFilename, err)\n\t\t\tcontinue\n\t\t}\n\t\t// Create buckets in the database.\n\t\terr = db.Update(func(tx *bolt.Tx) error {\n\t\t\tfor _, testBucket := range testBuckets {\n\t\t\t\t_, err := tx.CreateBucketIfNotExists(testBucket)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"db.Update failed on bucket name %v for metadata %v, filename %v; error was %v\", testBucket, in.md, dbFilename, err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\t// Make sure CreateBucketIfNotExists method handles invalid (nil)\n\t\t// bucket name.\n\t\terr = db.Update(func(tx *bolt.Tx) error {\n\t\t\t_, err := tx.CreateBucketIfNotExists(nil)\n\t\t\treturn err\n\t\t})\n\t\tif err != bolt.ErrBucketNameRequired {\n\t\t}\n\t\t// Fill each bucket with a random number (0-9, inclusive) of key/value\n\t\t// pairs, where each key is a length-10 random byteslice and each value\n\t\t// is a length-1000 random byteslice.\n\t\terr = db.Update(func(tx *bolt.Tx) error {\n\t\t\tfor _, testBucket := range testBuckets {\n\t\t\t\tb := tx.Bucket(testBucket)\n\t\t\t\tx := fastrand.Intn(10)\n\t\t\t\tfor i := 0; i <= x; i++ {\n\t\t\t\t\terr := b.Put(fastrand.Bytes(10), fastrand.Bytes(1e3))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tt.Errorf(\"db.Update failed to fill bucket %v for metadata %v, filename %v; error was %v\", testBucket, in.md, dbFilename, err)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\t// Close the newly-filled database.\n\t\terr = db.Close()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"closing a newly-filled database failed for metadata %v, filename %v; error was %v\", in.md, dbFilename, err)\n\t\t\tcontinue\n\t\t}\n\t\t// Call OpenDatabase on the database now that it's been filled.\n\t\tdb, err = OpenDatabase(in.md, dbFilepath)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\t// Empty every bucket in the database.\n\t\terr = db.Update(func(tx *bolt.Tx) error {\n\t\t\tfor _, testBucket := range testBuckets {\n\t\t\t\tb := tx.Bucket(testBucket)\n\t\t\t\terr := b.ForEach(func(k, v []byte) error {\n\t\t\t\t\treturn b.Delete(k)\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\t// Close and delete the newly emptied database.\n\t\terr = db.Close()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"closing a newly-emptied database for metadata %v, filename %v; error was %v\", in.md, dbFilename, err)\n\t\t\tcontinue\n\t\t}\n\t\terr = os.Remove(dbFilepath)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"removing database file failed for metadata %v, filename %v; error was %v\", in.md, dbFilename, err)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1e20a4fbdb9a7a7c392188e1be5562ed", "score": "0.552789", "text": "func (c *Client) ExpectDB() *ExpectedDB {\n\te := &ExpectedDB{\n\t\tret0: &DB{},\n\t}\n\tc.expected = append(c.expected, e)\n\treturn e\n}", "title": "" }, { "docid": "b86080279bb8dad256b829a1353d04f5", "score": "0.55262315", "text": "func seededDatabase(t *testing.T, host, name string) {\n\tt.Helper()\n\n\tdbConn, err := postgres.Connect(logf.Log, postgres.ConnectionString{\n\t\tDatabase: \"postgres\",\n\t\tHost: host,\n\t\tPassword: \"\",\n\t\tUser: \"iam_creator\",\n\t})\n\tif !assert.NoErrorf(t, err, \"failed to connect to database host to seed database '%s'\", name) {\n\t\treturn\n\t}\n\terr = postgres.Database(logf.Log, dbConn, host, postgres.Credentials{\n\t\tName: name,\n\t\tPassword: \"123456\",\n\t\tUser: name,\n\t})\n\tif !assert.NoErrorf(t, err, \"failed to created seeded database '%s'\", name) {\n\t\treturn\n\t}\n\tdb1Conn, err := postgres.Connect(logf.Log, postgres.ConnectionString{\n\t\tDatabase: name,\n\t\tHost: host,\n\t\tPassword: \"123456\",\n\t\tUser: name,\n\t})\n\tif !assert.NoErrorf(t, err, \"failed to connect to database '%s' to create a table\", name) {\n\t\treturn\n\t}\n\t_, err = db1Conn.Exec(`CREATE TABLE movies(title varchar(50));`)\n\tif !assert.NoErrorf(t, err, \"failed to create table in database '%s'\", name) {\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "a78731c11cdf096a23b7648ddea41731", "score": "0.5523506", "text": "func prepareDB(t *testing.T) {\n\tt.Helper()\n\n\tif os.Getenv(\"environment\") != \"local\" {\n\t\tt.Fatal(\"It's dangerous to wipe the database non-locally\")\n\t\treturn\n\t}\n\n\tif _, err := db.Query(`SET FOREIGN_KEY_CHECKS = 0`); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdefer func() {\n\t\tif _, err := db.Query(`SET FOREIGN_KEY_CHECKS = 0`); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\trows, err := db.Query(`SHOW TABLES`)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar tableName string\n\t\tif err := rows.Scan(&tableName); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif _, err := db.Exec(fmt.Sprintf(\"DROP TABLE %s\", tableName)); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\tif err := rows.Err(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tschema, err := ioutil.ReadFile(\"schema.sql\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tqueries := strings.Split(string(schema), \";\")\n\n\tfor _, query := range queries[:len(queries)-1] {\n\t\tif _, err := db.Exec(query); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9171bbb02c44b8d1b6b31817f6c8ea2d", "score": "0.5521872", "text": "func SetupFilterTestDB(t *testing.T) {\n\terr := db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid1\",\n\t\tFirstName: \"Alex\",\n\t\tUsername: \"testusername\",\n\t\tEmail: \"testemail@domain.com\",\n\t}, nil)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid2\",\n\t\tFirstName: \"Charlie\",\n\t\tUsername: \"testusername\",\n\t\tEmail: \"testemail@domain.com\",\n\t}, nil)\n\n\terr = db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid3\",\n\t\tFirstName: \"Bobby\",\n\t\tUsername: \"testusername\",\n\t\tEmail: \"testemail@domain.com\",\n\t}, nil)\n\n\terr = db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid4\",\n\t\tFirstName: \"Bobby\",\n\t\tLastName: \"Adamson\",\n\t\tUsername: \"test-two-parameter-filter\",\n\t}, nil)\n\n\terr = db.Insert(\"info\", &models.UserInfo{\n\t\tID: \"testid5\",\n\t\tFirstName: \"Bobby\",\n\t\tLastName: \"Zulu\",\n\t\tUsername: \"test-two-parameter-filter\",\n\t}, nil)\n}", "title": "" }, { "docid": "dafde22d9165648b9c0a5c625f4c41f3", "score": "0.55203605", "text": "func TestDbFetchUtxoSetState(t *testing.T) {\n\tt.Parallel()\n\n\t// Create a test database.\n\tdbPath := filepath.Join(os.TempDir(), \"test-dbfetchutxosetstate\")\n\t_ = os.RemoveAll(dbPath)\n\tdb, err := database.Create(\"ffldb\", dbPath, wire.MainNet)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating test database: %v\", err)\n\t}\n\tdefer os.RemoveAll(dbPath)\n\tdefer db.Close()\n\n\ttests := []struct {\n\t\tname string\n\t\tstate *utxoSetState\n\t}{{\n\t\tname: \"fresh database (no utxo set state saved)\",\n\t\tstate: nil,\n\t}, {\n\t\tname: \"last flush saved in database\",\n\t\tstate: &utxoSetState{\n\t\t\tlastFlushHeight: 432100,\n\t\t\tlastFlushHash: *mustParseHash(\"000000000000000023455b4328635d8e014dbeea\" +\n\t\t\t\t\"99c6140aa715836cc7e55981\"),\n\t\t},\n\t}}\n\n\tfor _, test := range tests {\n\t\t// Update the utxo set state in the database.\n\t\tif test.state != nil {\n\t\t\terr = db.Update(func(dbTx database.Tx) error {\n\t\t\t\treturn dbPutUtxoSetState(dbTx, test.state)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"%q: error putting utxo set state: %v\", test.name, err)\n\t\t\t}\n\t\t}\n\n\t\t// Fetch the utxo set state from the database.\n\t\terr = db.View(func(dbTx database.Tx) error {\n\t\t\tgotState, err := dbFetchUtxoSetState(dbTx)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Ensure that the fetched utxo set state matches the expected state.\n\t\t\tif !reflect.DeepEqual(gotState, test.state) {\n\t\t\t\tt.Errorf(\"%q: mismatched state:\\nwant: %+v\\n got: %+v\\n\", test.name,\n\t\t\t\t\ttest.state, gotState)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%q: error fetching utxo set state: %v\", test.name, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cd5b23f2207952db90932c01a13863c5", "score": "0.5512739", "text": "func TestErrDatabaseNotOpen(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\ttestDir := build.TempDir(persistDir, t.Name())\n\terr := os.MkdirAll(testDir, 0700)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdbFilepath := filepath.Join(testDir, \"fake_filename\")\n\tmd := Metadata{\"Fake Header\", \"Fake Version\"}\n\tdb, err := bolt.Open(dbFilepath, 0600, &bolt.Options{Timeout: 3 * time.Second})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tboltDB := &BoltDatabase{\n\t\tMetadata: md,\n\t\tDB: db,\n\t}\n\terr = boltDB.Close()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Should return an error since boltDB is closed.\n\terr = boltDB.checkMetadata(md)\n\tif err != bolt.ErrDatabaseNotOpen {\n\t\tt.Errorf(\"expected database not open, got %v\", err)\n\t}\n\terr = os.Remove(dbFilepath)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "86064c86df6921d7fe1e84733d7dc5e8", "score": "0.55062664", "text": "func TestCorruption(t *testing.T) {\n\tkey := []byte(\"hello\")\n\tvalue := []byte(\"world\")\n\ttests := map[string]func(db database.Database) error{\n\t\t\"corrupted has\": func(db database.Database) error {\n\t\t\t_, err := db.Has(key)\n\t\t\treturn err\n\t\t},\n\t\t\"corrupted get\": func(db database.Database) error {\n\t\t\t_, err := db.Get(key)\n\t\t\treturn err\n\t\t},\n\t\t\"corrupted put\": func(db database.Database) error {\n\t\t\treturn db.Put(key, value)\n\t\t},\n\t\t\"corrupted delete\": func(db database.Database) error {\n\t\t\treturn db.Delete(key)\n\t\t},\n\t\t\"corrupted batch\": func(db database.Database) error {\n\t\t\tcorruptableBatch := db.NewBatch()\n\t\t\trequire.NotNil(t, corruptableBatch)\n\n\t\t\trequire.NoError(t, corruptableBatch.Put(key, value))\n\n\t\t\treturn corruptableBatch.Write()\n\t\t},\n\t\t\"corrupted healthcheck\": func(db database.Database) error {\n\t\t\t_, err := db.HealthCheck(context.Background())\n\t\t\treturn err\n\t\t},\n\t}\n\tbaseDB := memdb.New()\n\t// wrap this db\n\tcorruptableDB := New(baseDB)\n\t_ = corruptableDB.handleError(errTest)\n\tfor name, testFn := range tests {\n\t\tt.Run(name, func(tt *testing.T) {\n\t\t\terr := testFn(corruptableDB)\n\t\t\trequire.ErrorIs(tt, err, errTest)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "30664fbef5e3643820fc1b6b4cf3cf72", "score": "0.55058485", "text": "func clearDB(t *testing.T) *testutil.MySQLTestDatabase {\n\tfailMsg := \"Database initialization failed. Do you have the test database set up properly? Details: %v\"\n\n\t// Set up the database.\n\ttestDb := testutil.SetupMySQLTestDatabase(t, migrationSteps)\n\n\tconf := testutil.LocalTestDatabaseConfig(migrationSteps)\n\tvar err error\n\tDB, err = sqlx.Open(\"mysql\", conf.MySQLString)\n\tif err != nil {\n\t\tt.Fatalf(failMsg, err)\n\t}\n\n\treturn testDb\n}", "title": "" }, { "docid": "6c6c2410e405d631073d1a2cb64bde04", "score": "0.5504165", "text": "func Test_Shard_Create_Simple(t *testing.T) {\n\tDoExecTest(t, ExecTest{\n\t\tQuery: `DROP TABLE IF EXISTS public.accounts CASCADE;`,\n\t})\n\tDoExecTest(t, ExecTest{\n\t\tQuery: `CREATE TABLE public.accounts (account_id BIGSERIAL PRIMARY KEY, account_number BIGINT) TABLESPACE \"noah.account\";`,\n\t})\n\tdefer DoExecTest(t, ExecTest{\n\t\tQuery: `DROP TABLE public.accounts CASCADE;`,\n\t})\n\n\tDoExecTest(t, ExecTest{\n\t\tQuery: `DROP TABLE IF EXISTS public.users CASCADE;`,\n\t})\n\tDoExecTest(t, ExecTest{\n\t\tQuery: `CREATE TABLE public.users (user_id BIGSERIAL PRIMARY KEY, account_id BIGINT NOT NULL REFERENCES public.accounts (account_id), user_number BIGINT) TABLESPACE \"noah.shard\";`,\n\t})\n\tdefer DoExecTest(t, ExecTest{\n\t\tQuery: `DROP TABLE public.users CASCADE;`,\n\t})\n\n\tnumberOfAccountsToMake := 10\n\tnumberOfUsersPerAccount := 20\n\n\tfor i := 0; i < numberOfAccountsToMake; i++ {\n\t\taccountResult := DoQueryTest(t, QueryTest{\n\t\t\tQuery: fmt.Sprintf(`INSERT INTO public.accounts (account_number) VALUES(%d) RETURNING account_id;`, i),\n\t\t})\n\n\t\taccountId := accountResult[0][0].(int64)\n\n\t\tgolog.Warnf(\"created new account with ID [%d]\", accountId)\n\n\t\tfor u := 0; u < numberOfUsersPerAccount; u++ {\n\t\t\tuserResult := DoQueryTest(t, QueryTest{\n\t\t\t\tQuery: fmt.Sprintf(`INSERT INTO public.users (account_id, user_number) VALUES(%d, %d) RETURNING user_id;`, accountId, i),\n\t\t\t})\n\n\t\t\tuserId := userResult[0][0].(int64)\n\n\t\t\tgolog.Warnf(\"created new user with ID [%d] for account ID [%d]\", userId, accountId)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4745f619c283f2e5d97720fbc5bc269b", "score": "0.549918", "text": "func PopulateTestDB(flag Flag) *gorm.DB {\n\ttestDB := NewTestDB()\n\tflag.Create(testDB)\n\treturn testDB\n}", "title": "" }, { "docid": "42f1ff1ebeeb332723239e03a25c085c", "score": "0.5496186", "text": "func main() {\n\tdb, err := xorm.NewEngine(\"mysql\", \"root:1234@tcp(127.0.0.1:3306)/fruit\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdb.Sync(\n\t\tnew(Fruit),\n\t)\n\t//db.ShowSQL()\n\tsession := db.NewSession()\n\tfor index := 0; index < 100; index++ {\n\t\ttotalCount, fruits, err := GetAll(session, 0, 2)\n\t\tif err != nil {\n\t\t\tfmt.Println(totalCount, fruits, err)\n\t\t}\n\t}\n\tfmt.Println(\"done\")\n}", "title": "" }, { "docid": "28d8536b5b25f4ad0a77e924083535e8", "score": "0.54951584", "text": "func MockedDB(operation string) {\n\tif CI := os.Getenv(\"CI\"); CI == \"\" {\n\t\t_, fileName, _, _ := runtime.Caller(0)\n\t\tcurrPath := filepath.Dir(fileName)\n\t\terr := godotenv.Load(currPath + \"/../../.env\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error loading env.\\n%v\", err)\n\t\t}\n\t}\n\n\tdbName := os.Getenv(\"DATABASE_NAME\")\n\tpgUser := os.Getenv(\"PSQL_USER\")\n\tpgPassword := os.Getenv(\"PSQL_PASSWORD\")\n\n\tvar command string\n\n\tif operation == CREATE {\n\t\tcommand = \"createdb\"\n\t} else {\n\t\tcommand = \"dropdb\"\n\t}\n\n\tcmd := exec.Command(command, \"-h\", \"localhost\", \"-U\", pgUser, \"-e\", dbName)\n\tcmd.Env = os.Environ()\n\tcmd.Env = append(cmd.Env, fmt.Sprintf(\"PGPASSWORD=%v\", pgPassword))\n\n\tif err := cmd.Run(); err != nil {\n\t\tlog.Fatalf(\"Error executing %v on %v.\\n%v\", command, dbName, err)\n\t}\n}", "title": "" }, { "docid": "05983c28c8edb076067233d478aac56b", "score": "0.54942274", "text": "func TestPersistance(t* testing.T) {\n\tfmt.Println(\"Running TestPersistance\")\n\tdefer fmt.Println(\"Passed!\")\n\n\tusers := registerMany(10)\n\tdefer killAll(users)\n\tusers[1].Logoff()\n\ttime.Sleep(time.Millisecond * 50)\n\tnewUser := Login(\"1\", localIp + \":8001\")\n\ttime.Sleep(time.Millisecond * 50)\n\tnewUser.Logoff()\n\ttime.Sleep(time.Millisecond * 50)\n\tnewUser = Login(\"1\", localIp + \":8001\")\n\tdefer killAll([]User{*newUser})\n\ttime.Sleep(time.Millisecond * 50)\n\tcheckLookup(t, *newUser, users[0])\n\tcheckLookup(t, *newUser, users[2])\n\tsendAndCheck(t, *newUser, users[2])\n\tsendAndCheck(t, users[2], *newUser)\n}", "title": "" }, { "docid": "5df8e8307a94489d74a442983541e430", "score": "0.54860187", "text": "func TestQueryDelete(t *testing.T) {\n\ttests.ResetLog()\n\tdefer tests.DisplayLog()\n\n\tt.Log(\"Given the need to insert and then delete a set.\")\n\t{\n\t\t//----------------------------------------------------------------------\n\t\t// Get the fixture.\n\n\t\tqs, err := qfix.Get(\"upsert.json\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"\\t%s\\tShould be able to retrieve the fixture : %v\", tests.Failed, err)\n\t\t}\n\t\tt.Logf(\"\\t%s\\tShould be able to retrieve the fixture.\", tests.Success)\n\n\t\tqsStrData, err := json.Marshal(&qs)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"\\t%s\\tShould be able to marshal the fixture : %v\", tests.Failed, err)\n\t\t}\n\t\tt.Logf(\"\\t%s\\tShould be able to marshal the fixture.\", tests.Success)\n\n\t\t//----------------------------------------------------------------------\n\t\t// Insert the Set.\n\n\t\turl := \"/1.0/query\"\n\t\tr := tests.NewRequest(\"PUT\", url, bytes.NewBuffer(qsStrData))\n\t\tw := httptest.NewRecorder()\n\n\t\ta.ServeHTTP(w, r)\n\n\t\tt.Logf(\"\\tWhen calling url to insert : %s\", url)\n\t\t{\n\t\t\tif w.Code != 204 {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould be able to insert the set : %v\", tests.Failed, w.Code)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould be able to insert the set.\", tests.Success)\n\t\t}\n\n\t\t//----------------------------------------------------------------------\n\t\t// Retrieve the Set.\n\n\t\turl = \"/1.0/query/\" + qPrefix + \"_upsert\"\n\t\tr = tests.NewRequest(\"GET\", url, nil)\n\t\tw = httptest.NewRecorder()\n\n\t\ta.ServeHTTP(w, r)\n\n\t\tt.Logf(\"\\tWhen calling url to get : %s\", url)\n\t\t{\n\t\t\tif w.Code != 200 {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould be able to retrieve the set : %v\", tests.Failed, w.Code)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould be able to retrieve the set.\", tests.Success)\n\n\t\t\trecv := w.Body.String()\n\t\t\tresp := `{\"name\":\"` + qPrefix + `_upsert\",\"desc\":\"\",\"pre_script\":\"\",\"pst_script\":\"\",\"params\":[],\"queries\":[{\"name\":\"Upsert\",\"type\":\"pipeline\",\"collection\":\"test_xenia_data\",\"commands\":[{\"$match\":{\"station.d\":\"42021\"}},{\"$project\":{\"_id\":0,\"name\":1}}],\"indexes\":[{\"key\":[\"station_id\"],\"unique\":true}],\"return\":true}],\"enabled\":true,\"explain\":false}`\n\n\t\t\tif resp != recv {\n\t\t\t\tt.Log(resp)\n\t\t\t\tt.Log(w.Body.String())\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould get the expected result.\", tests.Failed)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould get the expected result.\", tests.Success)\n\t\t}\n\n\t\t//----------------------------------------------------------------------\n\t\t// Delete the Set.\n\n\t\turl = \"/1.0/query/\" + qPrefix + \"_upsert\"\n\t\tr = tests.NewRequest(\"DELETE\", url, nil)\n\t\tw = httptest.NewRecorder()\n\n\t\ta.ServeHTTP(w, r)\n\n\t\tt.Logf(\"\\tWhen calling url to delete : %s\", url)\n\t\t{\n\t\t\tif w.Code != 204 {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould be able to delete the set : %v\", tests.Failed, w.Code)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould be able to delete the set.\", tests.Success)\n\t\t}\n\n\t\t//----------------------------------------------------------------------\n\t\t// Retrieve the Set.\n\n\t\turl = \"/1.0/query/\" + qPrefix + \"_upsert\"\n\t\tr = tests.NewRequest(\"GET\", url, nil)\n\t\tw = httptest.NewRecorder()\n\n\t\ta.ServeHTTP(w, r)\n\n\t\tt.Logf(\"\\tWhen calling url to get : %s\", url)\n\t\t{\n\t\t\tif w.Code != 404 {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould Not be able to retrieve the set : %v\", tests.Failed, w.Code)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould Not be able to retrieve the set.\", tests.Success)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e077ff19d38f7ff85a4061588b153d5", "score": "0.5485189", "text": "func TestSetResetShardID(t *testing.T) {\n twoTask := os.Getenv(\"TWO_TASK_READ_4\")\n fmt.Println (\"TWO_TASK_4: \", twoTask)\n\tfmt.Println (\"TestSetResetShardID begin +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\")\n\tlogger.GetLogger().Log(logger.Debug, \"TestSetResetShardID begin +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\\n\")\n\n\thostname := testutil.GetHostname()\n fmt.Println (\"Hostname: \", hostname);\n\tdb, err := sql.Open(\"hera\", hostname + \":31002\")\n\tif err != nil {\n\t\tt.Fatal(\"Error starting Mux:\", err)\n\t\treturn\n\t}\n\tdb.SetMaxIdleConns(0)\n\tdefer db.Close()\n\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tconn, err := db.Conn(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"Error getting connection %s\\n\", err.Error())\n\t}\n\n\tfmt.Println (\"Set Shard ID to shard 3\")\n\tmux := gosqldriver.InnerConn(conn)\n shards, err:= mux.GetNumShards()\n\tif err != nil {\n\t\tt.Fatalf(\"GetNumShards failed: %s\", err.Error())\n\t}\n\tif shards != 5 {\n\t\tt.Fatalf(\"Expected 5 shards\")\n\t}\n\t\n\tfmt.Println (\"Insert using shard 3\")\n\tmux.SetShardID(3)\n\ttx, _ := conn.BeginTx(ctx, nil)\n\tstmt, _ := tx.PrepareContext(ctx, \"/* TestSetResetShardID */insert into test_simple_table_1 (ID, Name, Status) VALUES(:ID, :Name, :Status)\")\n\t_, err = stmt.Exec(sql.Named(\"ID\", 12346), sql.Named(\"Name\", \"Steve\"), sql.Named(\"Status\", 999))\n\tif err != nil {\n\t\tt.Fatalf(\"Error preparing test (create row in table) %s\\n\", err.Error())\n\t}\n\n err = tx.Commit()\n if err != nil {\n t.Fatalf(\"Error commit %s\\n\", err.Error())\n }\n\n\ttime.Sleep (time.Duration(2) * time.Second)\n\tfmt.Println (\"Verify insert request is sent to shard 3\")\n\tcount := testutil.RegexCount (\"WORKER shd3.*Preparing.*TestSetResetShardID.*insert into test_simple_table_1\")\n if (count < 1) {\n t.Fatalf (\"Error: Insert Query does NOT go to shd3\");\n }\n\tcal_count := testutil.RegexCountFile (\"T.*API.*CLIENT_SESSION_3\", \"cal.log\")\n if (cal_count < 1) {\n t.Fatalf (\"Error: No API.*CLIENT_SESSION_3 in CAL\");\n }\n\n\tfmt.Println (\"Calling resetShardID, Verify next query without shard key will be processed using shard 0\")\n\tmux.SetShardID (-1)\n\tstmt, _ = conn.PrepareContext(ctx, \"/* TestSetResetShardID */Select name, status from test_simple_table_1 where ID=:ID\")\n\trows, _ := stmt.Query(sql.Named(\"ID\", 12346))\n\tif !rows.Next() {\n t.Fatalf(\"Expected 1 row\")\n }\n rows.Close()\n\tstmt.Close()\n\n\tcancel()\n\tconn.Close()\n\n\tcount = testutil.RegexCount (\"WORKER shd0.*Preparing.*TestSetResetShardID.*Select name, status from test_simple_table_1\")\n if (count < 1) {\n t.Fatalf (\"Error: Insert Query does NOT go to shd1\");\n }\n\ttestutil.DoDefaultValidation(t)\n\tlogger.GetLogger().Log(logger.Debug, \"TestSetResetShardID done -------------------------------------------------------------\")\n}", "title": "" }, { "docid": "3f7b4334fbe27aeb787b5e50763fb29c", "score": "0.5485076", "text": "func initDb() {\r\n\tsetEngine()\r\n\tx.Sync(new(User), new(Blog), new(Category), new(UserCategory), new(Comment), new(Tag))\r\n}", "title": "" }, { "docid": "f721f400ae7ae4b33fba6a139395d400", "score": "0.54794174", "text": "func test_reads(db *db.Backend) error {\n\n\t// Read Zones\n\tzones, err := db.GetAllZones()\n\tif err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tfmt.Println(\"GetAllZones\")\n\t\tfmt.Println(zones)\n\t}\n\n\t// Read Sites\n\tsites, err := db.GetAllSites()\n\tif err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tfmt.Println(\"GetAllSites\")\n\t\tfmt.Println(sites)\n\t}\n\n\t// Read Subnets\n\tsubnets, err := db.GetAllSubnets()\n\tif err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tfmt.Println(\"GetAllSubnets\")\n\t\tfmt.Println(subnets)\n\t}\n\n\t// Read some Subnets\n\tsubnets, err = db.GetSubnets(\"2.3.4.5\")\n\tif err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tfmt.Println(\"GetSubnets\")\n\t\tfmt.Println(subnets)\n\t}\n\n\t// Read Transitions\n\ttransitions, err := db.GetAllTransitions()\n\tif err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tfmt.Println(\"GetAllTransitions\")\n\t\tfmt.Println(transitions)\n\t}\n\n\t// Read some Transitions\n\ttransitions, err = db.GetTransitions(\"1.2.3.4\")\n\tif err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tfmt.Println(\"GetTransitions\")\n\t\tfmt.Println(transitions)\n\t}\n\tfmt.Println(\"Reads Done\")\n\treturn nil\n}", "title": "" } ]
5de19bf84159946af94cdaf0f82a18a7
EnsurePodSpecHasGitVolume ensures that there is a volume with the given name and git repo and revision
[ { "docid": "b138f88fefdb8b82bf0d8429071fa3af", "score": "0.8196279", "text": "func EnsurePodSpecHasGitVolume(podSpec *api.PodSpec, name string, gitRepo string, gitRevision string) bool {\n\tfor _, vm := range podSpec.Volumes {\n\t\tif vm.Name == name {\n\t\t\tvm.GitRepo = &api.GitRepoVolumeSource{\n\t\t\t\tRepository: gitRepo,\n\t\t\t\tRevision: gitRevision,\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t}\n\tpodSpec.Volumes = append(podSpec.Volumes, api.Volume{\n\t\tName: name,\n\t\tVolumeSource: api.VolumeSource{\n\t\t\tGitRepo: &api.GitRepoVolumeSource{\n\t\t\t\tRepository: gitRepo,\n\t\t\t\tRevision: gitRevision,\n\t\t\t},\n\t\t},\n\t})\n\treturn false\n}", "title": "" } ]
[ { "docid": "ccef1548a8636b50057da6ac84f22ed0", "score": "0.64092433", "text": "func EnsurePodSpecHasSecretVolume(podSpec *api.PodSpec, name string, secretName string) bool {\n\tfor _, vm := range podSpec.Volumes {\n\t\tif vm.Name == name {\n\t\t\tvm.Secret = &api.SecretVolumeSource{\n\t\t\t\tSecretName: secretName,\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t}\n\tpodSpec.Volumes = append(podSpec.Volumes, api.Volume{\n\t\tName: name,\n\t\tVolumeSource: api.VolumeSource{\n\t\t\tSecret: &api.SecretVolumeSource{\n\t\t\t\tSecretName: secretName,\n\t\t\t},\n\t\t},\n\t})\n\treturn false\n}", "title": "" }, { "docid": "eb3a58157ace855b32ac83e249b08189", "score": "0.53828806", "text": "func (b *Builder) CheckVolume(v string) bool {\n\t_, OCIv1Volume := b.OCIv1.Config.Volumes[v]\n\t_, DockerVolume := b.Docker.Config.Volumes[v]\n\treturn OCIv1Volume || DockerVolume\n}", "title": "" }, { "docid": "096718c5ae228b4d11430e41bbc6e1a0", "score": "0.5354666", "text": "func verifyGitAndKustomization(ctx context.Context, kubeClient client.Client, namespace, name string) error {\n\tnn := types.NamespacedName{\n\t\tName: name,\n\t\tNamespace: namespace,\n\t}\n\tsource := &sourcev1.GitRepository{}\n\terr := kubeClient.Get(ctx, nn, source)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif apimeta.IsStatusConditionPresentAndEqual(source.Status.Conditions, meta.ReadyCondition, metav1.ConditionTrue) == false {\n\t\treturn fmt.Errorf(\"source condition not ready\")\n\t}\n\tkustomization := &kustomizev1.Kustomization{}\n\terr = kubeClient.Get(ctx, nn, kustomization)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif apimeta.IsStatusConditionPresentAndEqual(kustomization.Status.Conditions, meta.ReadyCondition, metav1.ConditionTrue) == false {\n\t\treturn fmt.Errorf(\"kustomization condition not ready\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2389bffdf1ffb59a7e1002970c9591f1", "score": "0.5331751", "text": "func ensureVolumeHasMountPoint(vs []string) []string {\n\tvolumes := []string{}\n\tfor _, v := range vs {\n\t\tfragments := strings.Split(v, \":\")\n\t\tif len(fragments) < 2 {\n\t\t\tv = fmt.Sprintf(\"%s:%s\", fragments[0], fragments[0])\n\t\t}\n\t\tvolumes = append(volumes, v)\n\t}\n\treturn volumes\n}", "title": "" }, { "docid": "a93f3c5dcadfe522cb6a3d39785310cc", "score": "0.5255949", "text": "func (m *MockBackend) HasVolumes() bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"HasVolumes\")\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "7f53827f678806e28451bb8b22fe7043", "score": "0.52427477", "text": "func verifyGitAndKustomization(ctx context.Context, kubeClient client.Client, namespace, name string) error {\n\tnn := types.NamespacedName{\n\t\tName: name,\n\t\tNamespace: namespace,\n\t}\n\tsource := &sourcev1.GitRepository{}\n\tif err := kubeClient.Get(ctx, nn, source); err != nil {\n\t\treturn err\n\t}\n\tif err := checkReadyCondition(source); err != nil {\n\t\treturn err\n\t}\n\n\tkustomization := &kustomizev1.Kustomization{}\n\tif err := kubeClient.Get(ctx, nn, kustomization); err != nil {\n\t\treturn err\n\t}\n\tif err := checkReadyCondition(kustomization); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cb2ce599de6af2788a9e0298ad12ab66", "score": "0.5226865", "text": "func MocksForFindGit(ctx context.Context, cmd *exec.Command) error {\n\tif strings.Contains(cmd.Name, \"git\") && len(cmd.Args) == 1 && cmd.Args[0] == \"--version\" {\n\t\t_, err := cmd.CombinedOutput.Write([]byte(\"git version 99.99.1\"))\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84dc6b63f89457b8cf9311b8438522ab", "score": "0.51750094", "text": "func GitRepoVolumeGenerator() gopter.Gen {\n\tif gitRepoVolumeGenerator != nil {\n\t\treturn gitRepoVolumeGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tAddIndependentPropertyGeneratorsForGitRepoVolume(generators)\n\tgitRepoVolumeGenerator = gen.Struct(reflect.TypeOf(GitRepoVolume{}), generators)\n\n\treturn gitRepoVolumeGenerator\n}", "title": "" }, { "docid": "9ae5f2122e95b29abc014160d14660e8", "score": "0.51673484", "text": "func CheckVolumeInProcMounts(hostName, volName string) bool {\n\tcmd := \"grep -q \" + volName + vm.MountFile\n\t_, err := ssh.InvokeCommand(hostName, cmd)\n\n\tif err != nil {\n\t\tlog.Printf(\"No entry for volume %s in %s.\", volName, vm.MountFile)\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "704e5bc33c9d961ccf83ca094512253f", "score": "0.5155586", "text": "func isValidGitRepo(repo string) bool {\n return true\n}", "title": "" }, { "docid": "218cd2f489e2f73ef58c184a96a77390", "score": "0.5120345", "text": "func TestGit(t *testing.T) {\n\ttempDir, err := ioutil.TempDir(\"\", \"go-vcs-git-tests\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tdefer func() {\n\t\terr = os.RemoveAll(tempDir)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}()\n\n\trepo, err := NewGitRepo(\"https://github.com/Masterminds/VCSTestRepo\", tempDir+\"/VCSTestRepo\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif repo.Vcs() != Git {\n\t\tt.Error(\"Git is detecting the wrong type\")\n\t}\n\n\t// Check the basic getters.\n\tif repo.Remote() != \"https://github.com/Masterminds/VCSTestRepo\" {\n\t\tt.Error(\"Remote not set properly\")\n\t}\n\tif repo.LocalPath() != tempDir+\"/VCSTestRepo\" {\n\t\tt.Error(\"Local disk location not set properly\")\n\t}\n\n\t//Logger = log.New(os.Stdout, \"\", log.LstdFlags)\n\n\t// Do an initial clone.\n\terr = repo.Get()\n\tif err != nil {\n\t\tt.Errorf(\"Unable to clone Git repo. Err was %s\", err)\n\t}\n\n\t// Verify Git repo is a Git repo\n\tif !repo.CheckLocal() {\n\t\tt.Error(\"Problem checking out repo or Git CheckLocal is not working\")\n\t}\n\n\t// Test internal lookup mechanism used outside of Git specific functionality.\n\tltype, err := DetectVcsFromFS(tempDir + \"/VCSTestRepo\")\n\tif err != nil {\n\t\tt.Error(\"detectVcsFromFS unable to Git repo\")\n\t}\n\tif ltype != Git {\n\t\tt.Errorf(\"detectVcsFromFS detected %s instead of Git type\", ltype)\n\t}\n\n\t// Test NewRepo on existing checkout. This should simply provide a working\n\t// instance without error based on looking at the local directory.\n\tnrepo, nrerr := NewRepo(\"https://github.com/Masterminds/VCSTestRepo\", tempDir+\"/VCSTestRepo\")\n\tif nrerr != nil {\n\t\tt.Error(nrerr)\n\t}\n\t// Verify the right oject is returned. It will check the local repo type.\n\tif !nrepo.CheckLocal() {\n\t\tt.Error(\"Wrong version returned from NewRepo\")\n\t}\n\n\t// Perform an update.\n\terr = repo.Update()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tv, err := repo.Current()\n\tif err != nil {\n\t\tt.Errorf(\"Error trying Git Current: %s\", err)\n\t}\n\tif v != \"master\" {\n\t\tt.Errorf(\"Current failed to detect Git on tip of master. Got version: %s\", v)\n\t}\n\n\t// Set the version using the short hash.\n\terr = repo.UpdateVersion(\"806b07b\")\n\tif err != nil {\n\t\tt.Errorf(\"Unable to update Git repo version. Err was %s\", err)\n\t}\n\n\t// Once a ref has been checked out the repo is in a detached head state.\n\t// Trying to pull in an update in this state will cause an error. Update\n\t// should cleanly handle this. Pulling on a branch (tested elsewhere) and\n\t// skipping that here.\n\terr = repo.Update()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Use Version to verify we are on the right version.\n\tv, err = repo.Version()\n\tif v != \"806b07b08faa21cfbdae93027904f80174679402\" {\n\t\tt.Error(\"Error checking checked out Git version\")\n\t}\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tv, err = repo.Current()\n\tif err != nil {\n\t\tt.Errorf(\"Error trying Git Current for ref: %s\", err)\n\t}\n\tif v != \"806b07b08faa21cfbdae93027904f80174679402\" {\n\t\tt.Errorf(\"Current failed to detect Git on ref of branch. Got version: %s\", v)\n\t}\n\n\t// Use Date to verify we are on the right commit.\n\td, err := repo.Date()\n\tif d.Format(longForm) != \"2015-07-29 09:46:39 -0400\" {\n\t\tt.Error(\"Error checking checked out Git commit date\")\n\t}\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Verify that we can set the version something other than short hash\n\terr = repo.UpdateVersion(\"master\")\n\tif err != nil {\n\t\tt.Errorf(\"Unable to update Git repo version. Err was %s\", err)\n\t}\n\terr = repo.UpdateVersion(\"806b07b08faa21cfbdae93027904f80174679402\")\n\tif err != nil {\n\t\tt.Errorf(\"Unable to update Git repo version. Err was %s\", err)\n\t}\n\tv, err = repo.Version()\n\tif v != \"806b07b08faa21cfbdae93027904f80174679402\" {\n\t\tt.Error(\"Error checking checked out Git version\")\n\t}\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\ttags, err := repo.Tags()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tvar hasRelTag bool\n\tvar hasOffMasterTag bool\n\n\tfor _, tv := range tags {\n\t\tif tv == \"1.0.0\" {\n\t\t\thasRelTag = true\n\t\t} else if tv == \"off-master-tag\" {\n\t\t\thasOffMasterTag = true\n\t\t}\n\t}\n\n\tif !hasRelTag {\n\t\tt.Error(\"Git tags unable to find release tag on master\")\n\t}\n\tif !hasOffMasterTag {\n\t\tt.Error(\"Git tags did not fetch tags not on master\")\n\t}\n\n\ttags, err = repo.TagsFromCommit(\"74dd547545b7df4aa285bcec1b54e2b76f726395\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif len(tags) != 0 {\n\t\tt.Error(\"Git is incorrectly returning tags for a commit\")\n\t}\n\n\ttags, err = repo.TagsFromCommit(\"30605f6ac35fcb075ad0bfa9296f90a7d891523e\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif len(tags) != 1 || tags[0] != \"1.0.0\" {\n\t\tt.Error(\"Git is incorrectly returning tags for a commit\")\n\t}\n\n\tbranches, err := repo.Branches()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\t// The branches should be HEAD, master, other, and test.\n\tif branches[3] != \"test\" {\n\t\tt.Error(\"Git is incorrectly returning branches\")\n\t}\n\n\tif !repo.IsReference(\"1.0.0\") {\n\t\tt.Error(\"Git is reporting a reference is not one\")\n\t}\n\n\tif repo.IsReference(\"foo\") {\n\t\tt.Error(\"Git is reporting a non-existent reference is one\")\n\t}\n\n\tif repo.IsDirty() {\n\t\tt.Error(\"Git incorrectly reporting dirty\")\n\t}\n\n\tci, err := repo.CommitInfo(\"806b07b08faa21cfbdae93027904f80174679402\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif ci.Commit != \"806b07b08faa21cfbdae93027904f80174679402\" {\n\t\tt.Error(\"Git.CommitInfo wrong commit id\")\n\t}\n\tif ci.Author != \"Matt Farina <matt@mattfarina.com>\" {\n\t\tt.Error(\"Git.CommitInfo wrong author\")\n\t}\n\tif ci.Message != \"Update README.md\" {\n\t\tt.Error(\"Git.CommitInfo wrong message\")\n\t}\n\tti, err := time.Parse(time.RFC1123Z, \"Wed, 29 Jul 2015 09:46:39 -0400\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif !ti.Equal(ci.Date) {\n\t\tt.Error(\"Git.CommitInfo wrong date\")\n\t}\n\n\t_, err = repo.CommitInfo(\"asdfasdfasdf\")\n\tif err != ErrRevisionUnavailable {\n\t\tt.Error(\"Git didn't return expected ErrRevisionUnavailable\")\n\t}\n\n\ttempDir2, err := ioutil.TempDir(\"\", \"go-vcs-git-tests-export\")\n\tif err != nil {\n\t\tt.Fatalf(\"Error creating temp directory: %s\", err)\n\t}\n\tdefer func() {\n\t\terr = os.RemoveAll(tempDir2)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}()\n\n\texportDir := filepath.Join(tempDir2, \"src\")\n\n\terr = repo.ExportDir(exportDir)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to export Git repo. Err was %s\", err)\n\t}\n\n\t_, err = os.Stat(filepath.Join(exportDir, \"README.md\"))\n\tif err != nil {\n\t\tt.Errorf(\"Error checking exported file in Git: %s\", err)\n\t}\n\n\t_, err = os.Stat(filepath.Join(exportDir, string(repo.Vcs())))\n\tif err != nil {\n\t\tif found := os.IsNotExist(err); !found {\n\t\t\tt.Errorf(\"Error checking exported metadata in Git: %s\", err)\n\t\t}\n\t} else {\n\t\tt.Error(\"Error checking Git metadata. It exists.\")\n\t}\n}", "title": "" }, { "docid": "b2b03c4e895601ee77a6447606cd7dbf", "score": "0.5084367", "text": "func getVolumesWithHostPathForAPod(namespace string, spec v1.PodSpec, entity *lib.ViolatableEntity) {\n\tif rules.IsNotIgnoredViolation(entity.Namespace, \"pod\", entity.Name, violations.HOST_VOLUMES_TYPE) {\n\t\tfor _, v := range spec.Volumes {\n\t\t\tif v.HostPath != nil {\n\t\t\t\tentity.Violations = append(entity.Violations, violations.Violation{Source: v.Name, Type: violations.HOST_VOLUMES_TYPE})\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "11d3c9166c477a578498a3f5905faaab", "score": "0.5061113", "text": "func (m *MockAzure) VolumeExistsByCreationToken(arg0 context.Context, arg1 string) (bool, *api.FileSystem, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VolumeExistsByCreationToken\", arg0, arg1)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(*api.FileSystem)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "dd3c2a014846f48a803e3aea1a4df83f", "score": "0.5053254", "text": "func mockGitRepo(remote string) (string, error) {\n\tdir, err := ioutil.TempDir(\"\", \"dockpack_\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif err := os.Chdir(dir); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif _, err := git(\"init\"); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif err := mockRubyApp(dir); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif _, err := git(\"add\", \".\"); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif _, err := git(\"commit\", \"-m\", \"some commit\"); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif _, err := git(\"remote\", \"add\", remoteName, remote); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn dir, nil\n}", "title": "" }, { "docid": "98fcdc59312bd0aea47fae338a1cf496", "score": "0.50303245", "text": "func (z GenZshCompCmd) RequiresRepo() bool {\n\treturn false\n}", "title": "" }, { "docid": "daf2fa375d867c63091a74838a79cd10", "score": "0.5026844", "text": "func AssertQuickStartComponentsPresentInGit(branch string) {\n\tdir, err := git.GetBranch(branch)\n\tExpect(err).ShouldNot(HaveOccurred())\n\tdefer os.RemoveAll(dir)\n\tFS := afero.Afero{Fs: afero.NewOsFs()}\n\tallFiles := make([]string, 0)\n\terr = FS.Walk(dir, func(path string, info os.FileInfo, err error) error {\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tallFiles = append(allFiles, path)\n\t\treturn nil\n\t})\n\tExpect(err).NotTo(HaveOccurred())\n\tfmt.Fprintf(ginkgo.GinkgoWriter, \"\\n all files:\\n%v\", allFiles)\n}", "title": "" }, { "docid": "3a2fd600a3b4cf1fc5ea4417c7c3b0d0", "score": "0.5013838", "text": "func ensurePodTemplateSpec(modified *bool, existing *corev1.PodTemplateSpec, required corev1.PodTemplateSpec) {\n\tEnsureObjectMeta(modified, &existing.ObjectMeta, required.ObjectMeta)\n\n\tensurePodSpec(modified, &existing.Spec, required.Spec)\n}", "title": "" }, { "docid": "6995498e59767bdc25c63dff0b608e29", "score": "0.49683315", "text": "func isVolumeReady(vol *types.Volume, ref string) error {\n\n\tif vol.Status != \"active\" {\n\t\treturn fmt.Errorf(\"can only mount active volumes, current status: '%s'\", vol.Status)\n\t}\n\n\tif vol.Mounted {\n\t\treturn errors.New(\"volume is mounted, unmount it before mounting it again\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "08d8d43553036588caf8fea7b37edcd7", "score": "0.49459976", "text": "func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c *check.C) {\n\ts.d.Start(c)\n\n\tout, err := s.d.Cmd(\"volume\", \"create\", \"-d\", volumePluginName, \"abc2\", \"--opt\", \"ninja=1\")\n\tc.Assert(err, checker.IsNil, check.Commentf(out))\n\n\tout, err = s.d.Cmd(\"volume\", \"inspect\", \"abc2\")\n\tc.Assert(err, checker.NotNil, check.Commentf(out))\n\tc.Assert(out, checker.Contains, \"No such volume\")\n}", "title": "" }, { "docid": "a3d1f106e29a31f1516783d38dafed5b", "score": "0.4912603", "text": "func (ctrl *csiSnapshotCommonController) isVolumeBeingCreatedFromSnapshot(snapshot *crdv1.VolumeSnapshot) bool {\n\tpvcList, err := ctrl.pvcLister.PersistentVolumeClaims(snapshot.Namespace).List(labels.Everything())\n\tif err != nil {\n\t\tklog.Errorf(\"Failed to retrieve PVCs from the lister to check if volume snapshot %s is being used by a volume: %q\", utils.SnapshotKey(snapshot), err)\n\t\treturn false\n\t}\n\tfor _, pvc := range pvcList {\n\t\tif pvc.Spec.DataSource != nil && pvc.Spec.DataSource.Name == snapshot.Name {\n\t\t\tif pvc.Spec.DataSource.Kind == snapshotKind && *(pvc.Spec.DataSource.APIGroup) == snapshotAPIGroup {\n\t\t\t\tif pvc.Status.Phase == v1.ClaimPending {\n\t\t\t\t\t// A volume is being created from the snapshot\n\t\t\t\t\tklog.Infof(\"isVolumeBeingCreatedFromSnapshot: volume %s is being created from snapshot %s\", pvc.Name, pvc.Spec.DataSource.Name)\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tklog.V(5).Infof(\"isVolumeBeingCreatedFromSnapshot: no volume is being created from snapshot %s\", utils.SnapshotKey(snapshot))\n\treturn false\n}", "title": "" }, { "docid": "98224ea71258d5f3fdc52f581e0fd631", "score": "0.4907466", "text": "func createVolume(spec volumeSpec) error {\n\tenv := os.Environ()\n\tenv = append(env, \"PYTHONPATH=\"+path.Join(kdPath, kdScriptsDir))\n\tsize := strconv.Itoa(int(spec.Size))\n\tcmd := exec.Command(\"/usr/bin/env\", \"python2\", \"-m\", \"node_storage_manage.manage\", \"create-volume\", \"--path\", spec.Path, \"--quota\", size)\n\tcmd.Env = env\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error while create volume: %q, %q\", err, out)\n\t}\n\tif err := updatePermissions(spec.Path); err != nil {\n\t\tglog.V(4).Infof(\"Error, while chcon: %q\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3368edd659b68e221fdfb4a1bd62fb4b", "score": "0.4905623", "text": "func findPodVolumeSpec(pod *v1.Pod, name string) *v1.VolumeSource {\n\tfor _, volume := range pod.Spec.Volumes {\n\t\tif volume.Name == name {\n\t\t\treturn &volume.VolumeSource\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "372841b0c0921dcd22e019b201bede6a", "score": "0.48952553", "text": "func EnsureGitIsFromCIPD(ctx context.Context) error {\n\tgit, _, _, err := FindGit(ctx)\n\tif err != nil {\n\t\treturn skerr.Wrap(err)\n\t}\n\tif !IsFromCIPD(git) {\n\t\treturn skerr.Fmt(\"Git does not appear to be obtained via CIPD: %s\", git)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef723fa183015dade992ea4d71106da1", "score": "0.48880655", "text": "func (s *DockerCLIBuildSuite) TestBuildNullStringInAddCopyVolume(c *testing.T) {\n\tname := \"testbuildnullstringinaddcopyvolume\"\n\tvolName := \"nullvolume\"\n\tif testEnv.DaemonInfo.OSType == \"windows\" {\n\t\tvolName = `C:\\\\nullvolume`\n\t}\n\n\tbuildImageSuccessfully(c, name, build.WithBuildContext(c,\n\t\tbuild.WithFile(\"Dockerfile\", `\n\t\tFROM busybox\n\n\t\tADD null /\n\t\tCOPY nullfile /\n\t\tVOLUME `+volName+`\n\t\t`),\n\t\tbuild.WithFile(\"null\", \"test1\"),\n\t\tbuild.WithFile(\"nullfile\", \"test2\"),\n\t))\n}", "title": "" }, { "docid": "46ee68e249a741f4557b538761c46230", "score": "0.4868495", "text": "func checkVolExists(rbdVol *rbdVolume, credentials map[string]string) (found bool, err error) {\n\tvar vi util.CSIIdentifier\n\n\tif err = validateRbdVol(rbdVol); err != nil {\n\t\treturn false, err\n\t}\n\n\tkey, err := getKey(rbdVol.AdminID, credentials)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// check if request name is already part of the volumes omap\n\timageUUID, err := util.GetOMapValue(rbdVol.Monitors, rbdVol.AdminID,\n\t\tkey, rbdVol.Pool, csiVolsDirectory, csiVolNameKeyPrefix+rbdVol.RequestName)\n\tif err != nil {\n\t\t// error should specifically be not found, for image to be absent, any other error\n\t\t// is not conclusive, and we should not proceed\n\t\tif _, ok := err.(util.ErrKeyNotFound); ok {\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn false, err\n\t}\n\n\trbdVol.RbdImageName = rbdImgNamePrefix + imageUUID\n\n\t// check if the image omap is present\n\tsavedVolName, err := util.GetOMapValue(rbdVol.Monitors, rbdVol.AdminID,\n\t\tkey, rbdVol.Pool, rbdImageOMapPrefix+imageUUID, rbdImageCSIVolNameKey)\n\tif err != nil {\n\t\tif _, ok := err.(util.ErrKeyNotFound); ok {\n\t\t\terr = unreserveVol(rbdVol, credentials)\n\t\t}\n\t\treturn false, err\n\t}\n\n\t// check if image omap points back to the request name\n\tif savedVolName != rbdVol.RequestName {\n\t\t// NOTE: This should never be possible, hence no cleanup, but log error\n\t\t// and return, as cleanup may need to occur manually!\n\t\treturn false, fmt.Errorf(\"internal state inconsistent, omap volume\"+\n\t\t\t\" names disagree, request name (%s) image name (%s) image omap\"+\n\t\t\t\" volume name (%s)\", rbdVol.RequestName, rbdVol.RbdImageName, savedVolName)\n\t}\n\n\t// NOTE: Return volsize should be on-disk volsize, not request vol size, so\n\t// save it for size checks before fetching image data\n\trequestSize := rbdVol.VolSize\n\t// Fetch on-disk image attributes and compare against request\n\terr = updateVolWithImageInfo(rbdVol, credentials)\n\tif err != nil {\n\t\tif _, ok := err.(ErrImageNotFound); ok {\n\t\t\terr = unreserveVol(rbdVol, credentials)\n\t\t\treturn false, err\n\t\t}\n\n\t\treturn false, err\n\t}\n\n\t// size checks\n\tif rbdVol.VolSize < requestSize {\n\t\terr = fmt.Errorf(\"image with the same name (%s) but with different size already exists\",\n\t\t\trbdVol.RbdImageName)\n\t\treturn false, ErrVolNameConflict{rbdVol.RbdImageName, err}\n\t}\n\t// TODO: We should also ensure image features and format is the same\n\n\t// found a volume already available, process and return it!\n\tpoolID, err := util.GetPoolID(rbdVol.Monitors, rbdVol.AdminID, key, rbdVol.Pool)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvi = util.CSIIdentifier{\n\t\tPoolID: poolID,\n\t\tEncodingVersion: volIDVersion,\n\t\tClusterID: rbdVol.ClusterID,\n\t\tObjectUUID: imageUUID,\n\t}\n\trbdVol.VolID, err = vi.ComposeCSIID()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tklog.V(4).Infof(\"Found existng volume (%s) with image name (%s) for request (%s)\",\n\t\trbdVol.VolID, rbdVol.RbdImageName, rbdVol.RequestName)\n\n\treturn true, nil\n}", "title": "" }, { "docid": "a465797bdb75e5a762bcd66535510b65", "score": "0.4861119", "text": "func (ctrl *csiSnapshotController) isVolumeBeingCreatedFromSnapshot(snapshot *crdv1.VolumeSnapshot) bool {\n\tpvcList, err := ctrl.pvcLister.PersistentVolumeClaims(snapshot.Namespace).List(labels.Everything())\n\tif err != nil {\n\t\tklog.Errorf(\"Failed to retrieve PVCs from the lister to check if volume snapshot %s is being used by a volume: %q\", snapshotKey(snapshot), err)\n\t\treturn false\n\t}\n\tfor _, pvc := range pvcList {\n\t\tif pvc.Spec.DataSource != nil && len(pvc.Spec.DataSource.Name) > 0 && pvc.Spec.DataSource.Name == snapshot.Name {\n\t\t\tif pvc.Spec.DataSource.Kind == snapshotKind && *(pvc.Spec.DataSource.APIGroup) == snapshotAPIGroup {\n\t\t\t\tif pvc.Status.Phase == v1.ClaimPending {\n\t\t\t\t\t// A volume is being created from the snapshot\n\t\t\t\t\tklog.Infof(\"isVolumeBeingCreatedFromSnapshot: volume %s is being created from snapshot %s\", pvc.Name, pvc.Spec.DataSource.Name)\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tklog.V(5).Infof(\"isVolumeBeingCreatedFromSnapshot: no volume is being created from snapshot %s\", snapshotKey(snapshot))\n\treturn false\n}", "title": "" }, { "docid": "fc9b9ac529486c7405cbb78392ba1719", "score": "0.48590785", "text": "func credsInit(credsImage string, serviceAccountName, namespace string, kubeclient kubernetes.Interface, volumeMounts []corev1.VolumeMount, implicitEnvVars []corev1.EnvVar) (*corev1.Container, []corev1.Volume, error) {\n\tif serviceAccountName == \"\" {\n\t\tserviceAccountName = \"default\"\n\t}\n\n\tsa, err := kubeclient.CoreV1().ServiceAccounts(namespace).Get(serviceAccountName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tbuilders := []credentials.Builder{dockercreds.NewBuilder(), gitcreds.NewBuilder()}\n\n\tvar volumes []corev1.Volume\n\targs := []string{}\n\tfor _, secretEntry := range sa.Secrets {\n\t\tsecret, err := kubeclient.CoreV1().Secrets(namespace).Get(secretEntry.Name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tmatched := false\n\t\tfor _, b := range builders {\n\t\t\tif sa := b.MatchingAnnotations(secret); len(sa) > 0 {\n\t\t\t\tmatched = true\n\t\t\t\targs = append(args, sa...)\n\t\t\t}\n\t\t}\n\n\t\tif matched {\n\t\t\tname := names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf(\"tekton-internal-secret-volume-%s\", secret.Name))\n\t\t\tvolumeMounts = append(volumeMounts, corev1.VolumeMount{\n\t\t\t\tName: name,\n\t\t\t\tMountPath: credentials.VolumeName(secret.Name),\n\t\t\t})\n\t\t\tvolumes = append(volumes, corev1.Volume{\n\t\t\t\tName: name,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tSecret: &corev1.SecretVolumeSource{\n\t\t\t\t\t\tSecretName: secret.Name,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t}\n\n\tif len(args) == 0 {\n\t\t// There are no creds to initialize.\n\t\treturn nil, nil, nil\n\t}\n\n\tenv := ensureCredsInitHomeEnv(implicitEnvVars)\n\n\treturn &corev1.Container{\n\t\tName: \"credential-initializer\",\n\t\tImage: credsImage,\n\t\tCommand: []string{\"/ko-app/creds-init\"},\n\t\tArgs: args,\n\t\tEnv: env,\n\t\tVolumeMounts: volumeMounts,\n\t}, volumes, nil\n}", "title": "" }, { "docid": "a91592b9158e46f94e360087cbdd1e41", "score": "0.48585418", "text": "func checkVolumeMounts(container corev1.Container, pvc string) error {\n\tfor i := range container.VolumeMounts {\n\t\tif container.VolumeMounts[i].MountPath == \"/var/coredump\" {\n\t\t\treturn fmt.Errorf(\"Failed to mount the volume %q to path \\\"/var/coredump\\\" in container %q, volume %q is already mounted to the path\",\n\t\t\t\tpvc, container.Name, container.VolumeMounts[i].Name)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7c141fa1bbc82f4fb58373087f4b6fd2", "score": "0.48555192", "text": "func testWindowsNodePublishVolume(t *testing.T) {\n\tdefaultPerm := os.FileMode(0750) + os.ModeDir\n\tdefaultOsString := goOs\n\n\t// Setup mount target path\n\tbase, err := ioutil.TempDir(\"\", \"node-publish-\")\n\tif err != nil {\n\t\tt.Fatalf(\"failed to setup testdir: %v\", err)\n\t}\n\ttestTargetPath := filepath.Join(base, \"mount\")\n\tif err = os.MkdirAll(testTargetPath, defaultPerm); err != nil {\n\t\tt.Fatalf(\"failed to setup target path: %v\", err)\n\t}\n\tdefer os.RemoveAll(base)\n\n\tgoOs = \"windows\"\n\n\tcases := []struct {\n\t\tname string\n\t\tmounts []mount.MountPoint // already existing mounts\n\t\treq *csi.NodePublishVolumeRequest\n\t\tactions []mount.FakeAction\n\t\texpectedMount *mount.MountPoint\n\t\texpectErr bool\n\t}{\n\t\t// TODO: enable this test after https://github.com/kubernetes/kubernetes/issues/81609\n\n\t\t// {\n\t\t// \tname: \"windows target path does exist\",\n\t\t// \treq: &csi.NodePublishVolumeRequest{\n\t\t// \t\tVolumeId: testVolumeID,\n\t\t// \t\tTargetPath: testTargetPath,\n\t\t// \t\tVolumeCapability: testVolumeCapability,\n\t\t// \t\tVolumeAttributes: testVolumeAttributes,\n\t\t// \t\tNodePublishSecrets: testWindowsSecrets\n\t\t// \t},\n\t\t// \texpectErr: true,\n\t\t// },\n\t\t{\n\t\t\tname: \"windows target path doesn't exist\",\n\t\t\treq: &csi.NodePublishVolumeRequest{\n\t\t\t\tVolumeId: testVolumeID,\n\t\t\t\tTargetPath: testWindowsValidPath,\n\t\t\t\tVolumeCapability: testVolumeCapability,\n\t\t\t\tVolumeContext: testVolumeAttributes,\n\t\t\t\tSecrets: testWindowsSecrets,\n\t\t\t},\n\n\t\t\tactions: []mount.FakeAction{{Action: mount.FakeActionMount}},\n\t\t\texpectedMount: &mount.MountPoint{Device: testWindowsDevice, Path: testWindowsValidPath, Type: \"cifs\", Opts: []string{\"foo\", \"bar\"}},\n\t\t},\n\t\t{\n\t\t\tname: \"windows no user\",\n\t\t\treq: &csi.NodePublishVolumeRequest{\n\t\t\t\tVolumeId: testVolumeID,\n\t\t\t\tTargetPath: testWindowsValidPath,\n\t\t\t\tVolumeCapability: testVolumeCapability,\n\t\t\t\tVolumeContext: testVolumeAttributes,\n\t\t\t\tSecrets: map[string]string{\n\t\t\t\t\toptionSmbPassword: \"bar\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"windows no password\",\n\t\t\treq: &csi.NodePublishVolumeRequest{\n\t\t\t\tVolumeId: testVolumeID,\n\t\t\t\tTargetPath: testWindowsValidPath,\n\t\t\t\tVolumeCapability: testVolumeCapability,\n\t\t\t\tVolumeContext: testVolumeAttributes,\n\t\t\t\tSecrets: map[string]string{\n\t\t\t\t\toptionSmbUser: \"foo\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectErr: true,\n\t\t},\n\t}\n\n\tfor _, test := range cases {\n\t\ttestEnv := initTestNodeServer(t)\n\t\tif test.mounts != nil {\n\t\t\ttestEnv.fm.MountPoints = test.mounts\n\t\t}\n\n\t\t_, err = testEnv.ns.NodePublishVolume(context.TODO(), test.req)\n\t\tif !test.expectErr && err != nil {\n\t\t\tt.Errorf(\"test %q failed: %v\", test.name, err)\n\t\t}\n\t\tif test.expectErr && err == nil {\n\t\t\tt.Errorf(\"test %q failed: got success\", test.name)\n\t\t}\n\n\t\tvalidateMountPoint(t, test.name, testEnv.fm, test.expectedMount)\n\t\t// TODO: ValidateMountActions if possible.\n\t}\n\tgoOs = defaultOsString\n}", "title": "" }, { "docid": "07ea1649b139bb506e28fbfcba261b61", "score": "0.48443758", "text": "func needsImport(repo *api.ImageStream) bool {\n\tif len(repo.Spec.DockerImageRepository) == 0 {\n\t\treturn false\n\t}\n\tif repo.Annotations != nil && len(repo.Annotations[api.DockerImageRepositoryCheckAnnotation]) != 0 {\n\t\treturn false\n\t}\n\treturn true\n\t/*\n\t\tif len(repo.Spec.Tags) == 0 {\n\t\t\treturn true\n\t\t}\n\t\temptyTags := 0\n\t\tfor _, v := range repo.Spec.Tags {\n\t\t\tif len(v.DockerImageReference) == 0 {\n\t\t\t\temptyTags++\n\t\t\t}\n\t\t}\n\t\treturn emptyTags > 0\n\t*/\n}", "title": "" }, { "docid": "1861e3874ecc49310ad60a5572456944", "score": "0.48430064", "text": "func checkSpecArgSafety(spec string) error {\n\tif strings.HasPrefix(spec, \"-\") {\n\t\treturn errors.New(\"invalid git revision spec (begins with '-')\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1861e3874ecc49310ad60a5572456944", "score": "0.48430064", "text": "func checkSpecArgSafety(spec string) error {\n\tif strings.HasPrefix(spec, \"-\") {\n\t\treturn errors.New(\"invalid git revision spec (begins with '-')\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dfb0ec16df0e0321baa43477419ffe60", "score": "0.4842854", "text": "func TestEnsureGDMExists(t *testing.T) {\n\ttestDataDir := \"testdata/gen/test-ensure-gdm-exists\"\n\n\tif err := os.RemoveAll(testDataDir); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tgdmSourceRepo := path.Join(wd, testDataDir, \"test-repo\")\n\tnonexistentSourceLocation := path.Join(testDataDir, \"does-not-exist\")\n\temptySourceLocation := path.Join(testDataDir, \"empty-source-location\")\n\tnonemptySourceLocation := path.Join(testDataDir, \"nonempty-source-location\")\n\tsomeFile := path.Join(testDataDir, \"a-file\")\n\n\tif err := os.MkdirAll(gdmSourceRepo, 0777); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := os.MkdirAll(emptySourceLocation, 0777); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := os.MkdirAll(nonemptySourceLocation, 0777); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tnonemptyFile := path.Join(nonemptySourceLocation, \"another-file\")\n\tif err := ioutil.WriteFile(nonemptyFile, []byte(\"hi\"), 0777); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := ioutil.WriteFile(someFile, []byte(\"hi\"), 0777); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Create the empty source repo.\n\tc := exec.Command(\"git\", \"init\")\n\tc.Dir = gdmSourceRepo\n\tif err := c.Run(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := ioutil.WriteFile(path.Join(gdmSourceRepo, \"a-file\"), []byte(\"hi\"), 0777); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tc = exec.Command(\"git\", \"add\", \"-A\")\n\tc.Dir = gdmSourceRepo\n\tif err := c.Run(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tc = exec.Command(\"git\", \"commit\", \"-m\", \"a message\")\n\tc.Dir = gdmSourceRepo\n\tif err := c.Run(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// SourceLocation dir does not exist; repo does.\n\tif err := ensureGDMExists(gdmSourceRepo, nonexistentSourceLocation, t.Logf); err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// SourceLocation dir exists and is empty.\n\tif err := ensureGDMExists(gdmSourceRepo, emptySourceLocation, t.Logf); err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// SourceLocation dir exists and is not empty.\n\tif err := ensureGDMExists(gdmSourceRepo, nonemptySourceLocation, t.Logf); err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Cleanup\n\tif err := os.RemoveAll(nonexistentSourceLocation); err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// GDM source repo does not exist.\n\t{\n\t\terr := ensureGDMExists(\"this-path-does-not-exist\", \"\", t.Logf)\n\t\tif err == nil {\n\t\t\tt.Error(\"expected error when GDM repo does not exist\")\n\t\t}\n\t}\n\n\t// Cleanup.\n\tif err := os.RemoveAll(nonexistentSourceLocation); err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// GDM source repo is not a repo.\n\t{\n\t\terr := ensureGDMExists(someFile, \"\", t.Logf)\n\t\tif err == nil {\n\t\t\tt.Error(\"expected error when GDM repo does not exist\")\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "2b2b42694a6ff409126d105fb8f8fdaf", "score": "0.4841133", "text": "func (s *StatefulSetSyncer) ensurePodSpec() corev1.PodSpec {\n\tinitSidecar := container.EnsureContainer(utils.ContainerInitSidecarName, s.Cluster)\n\tinitMysql := container.EnsureContainer(utils.ContainerInitMysqlName, s.Cluster)\n\tinitContainers := []corev1.Container{initSidecar, initMysql}\n\n\tmysql := container.EnsureContainer(utils.ContainerMysqlName, s.Cluster)\n\txenon := container.EnsureContainer(utils.ContainerXenonName, s.Cluster)\n\tcontainers := []corev1.Container{mysql, xenon}\n\tif s.Spec.MetricsOpts.Enabled {\n\t\tcontainers = append(containers, container.EnsureContainer(utils.ContainerMetricsName, s.Cluster))\n\t}\n\tif s.Spec.PodSpec.SlowLogTail {\n\t\tcontainers = append(containers, container.EnsureContainer(utils.ContainerSlowLogName, s.Cluster))\n\t}\n\tif s.Spec.PodSpec.AuditLogTail {\n\t\tcontainers = append(containers, container.EnsureContainer(utils.ContainerAuditLogName, s.Cluster))\n\t}\n\n\treturn corev1.PodSpec{\n\t\tInitContainers: initContainers,\n\t\tContainers: containers,\n\t\tVolumes: s.EnsureVolumes(),\n\t\tSchedulerName: s.Spec.PodSpec.SchedulerName,\n\t\tServiceAccountName: s.GetNameForResource(utils.ServiceAccount),\n\t\tAffinity: s.Spec.PodSpec.Affinity,\n\t\tPriorityClassName: s.Spec.PodSpec.PriorityClassName,\n\t\tTolerations: s.Spec.PodSpec.Tolerations,\n\t}\n}", "title": "" }, { "docid": "f5e034a9e040a172b52bff84fcc0ffd6", "score": "0.48322022", "text": "func (m *MockAzure) VolumeByCreationToken(arg0 context.Context, arg1 string) (*api.FileSystem, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VolumeByCreationToken\", arg0, arg1)\n\tret0, _ := ret[0].(*api.FileSystem)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "392ddc68d7045a550f56aea5a4738418", "score": "0.4821733", "text": "func (ispn *Infinispan) HasDependenciesVolume() bool {\n\treturn ispn.Spec.Dependencies != nil && ispn.Spec.Dependencies.VolumeClaimName != \"\"\n}", "title": "" }, { "docid": "d1aef688222b50285f63ab622bf167de", "score": "0.48157775", "text": "func CheckConsistency() error {\n\n\t// NOTE: this function operates strictly on files in git's \"staging area\" (index).\n\t// ANY MODIFICATIONS MUST KEEP THIS INVARIANT.\n\n\t// TODO(mateuszc): check that all pkgs sharing same \"repositoryRoot\" have same \"revision\" & \"revisionTime\"\n\n\t// Make sure we're in project's root dir (with .git/, vendor.json, and _vendor/)\n\texist := Exist{}.Dir(\".git\").File(JsonPath).Dir(VendorPath)\n\tif exist.Err != nil {\n\t\treturn exist.Err\n\t}\n\n\t// Parse *vendor.json*, sort by pkg path.\n\t// (use-cases.md 6.1.2.1.2)\n\tpkgs, err := ReadStagedVendorFile(JsonPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif pkgs == nil {\n\t\treturn fmt.Errorf(\"file not found: %s\", JsonPath)\n\t}\n\n\t// Build a tree from RepositoryRoots\n\trepoRoots := Tree{}\n\tunvisitedRoots := set{}\n\tfor _, p := range pkgs.Packages {\n\t\tunvisitedRoots.Add(p.RepositoryRoot)\n\t\terr := repoRoots.Put(p.RepositoryRoot)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// We want to check that all RepositoryRoots from vendor.json (from index) are in git (index), and that there are no files in _vendor/\n\t// out of RepositoryRoots (except _vendor/.gitignore).\n\t// Note: we're not interested in files under RepositoryRoots (they will be checked by CheckPatched()).\n\t// (use-cases.md 6.1.2.1.3)\n\t// NOTE(mateuszc): we walk only dirs known to git; there may be untracked dirs, we're not interested in them\n\terr = git{}.WalkStaged(\".\", VendorPath, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif path == GitignorePath {\n\t\t\treturn nil\n\t\t}\n\t\texpected := repoRoots.Get(path)\n\t\tif expected == nil {\n\t\t\treturn fmt.Errorf(\"unexpected file/directory in git, but not in %s: %s\", JsonPath, path)\n\t\t}\n\t\tif !info.IsDir() {\n\t\t\treturn fmt.Errorf(\"unexpected file in git, not in any %s repositoryRoot: %s\", JsonPath, path)\n\t\t}\n\t\tif expected.IsEmpty() { // repository root\n\t\t\t// FIXME(mateuszc): if has *.git/.hg/.bzr* subdir, then verify revision-id match with *vendor.json*; if failed, report **error**\n\t\t\t// (see *vendo-check-patched* for error message details); (use-cases.md 6.1.2.1.3.3)\n\t\t\tdelete(unvisitedRoots, path)\n\t\t\treturn filepath.SkipDir\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// if any pkg in *vendor.json* is not visited, then report **error**;\n\t// (use-cases.md 6.1.2.1.4)\n\tif len(unvisitedRoots) > 0 {\n\t\treturn fmt.Errorf(\"following %s repositoryRoots not found in git: %s\", JsonPath, strings.Join(unvisitedRoots.ToSlice(), \" \"))\n\t}\n\n\t// TODO(mateuszc): check that any *.git/.hg/.bzr* subdirs, if present, are at locations noted in $PKG_REPO_ROOT fields;\n\treturn nil\n}", "title": "" }, { "docid": "473f2477f7f1523dc16d4400f756156a", "score": "0.48148993", "text": "func TestNewVolume(t *testing.T) {\n\tif fakeVol.Name != \"Test\" {\n\t\tt.Fatalf(\"Volume name is wrong. Expected Test, got %v\", fakeVol.Name)\n\t}\n\n\tif fakeVol.Target != \"/foo\" {\n\t\tt.Fatalf(\"Volume target is wrong. Expected /foo, got %v\", fakeVol.Target)\n\t}\n\n\tif fakeVol.BackupDir != \"/back\" {\n\t\tt.Fatalf(\"Volume backup dir is wrong. Expected /back, got %v\", fakeVol.BackupDir)\n\t}\n\n\tif fakeVol.Mount != \"/mnt\" {\n\t\tt.Fatalf(\"Volume mount dir is wrong. Expected /mnt, got %v\", fakeVol.Mount)\n\t}\n\n\tif fakeVol.FullIfOlderThan != \"3W\" {\n\t\tt.Fatalf(\"Volume FullIfOlderThan is wrong. Expected 3W, got %v\", fakeVol.FullIfOlderThan)\n\t}\n\n\tif fakeVol.RemoveOlderThan != \"1Y\" {\n\t\tt.Fatalf(\"Volume RemoveOlderThan is wrong. Expected 1Y, got %v\", fakeVol.RemoveOlderThan)\n\t}\n}", "title": "" }, { "docid": "a79deeedfbda4cc3a7839236e371ecb2", "score": "0.47912556", "text": "func Check_for_git(path string) {\n made, err := utils.Exists(path + \"/.git\")\n if err != nil {\n log.Fatal(err)\n }\n\n if made {\n // run git operations subprocess function\n // perhaps `go backup_repo(path + \"./git\")`?\n fmt.Printf(\"Git repository exists in %v\\n\", path)\n err = Run_git_ops(path)\n if err != nil {\n println(err.Error() + \"\\n\")\n }\n } else {\n // list files in the current path\n files, err := ioutil.ReadDir(path)\n if err != nil {\n log.Fatal(err)\n }\n\n // loop through files, call check for git on each directory\n for _, f := range files {\n if f.IsDir() {\n Check_for_git(path + \"/\" + f.Name())\n }\n }\n }\n}", "title": "" }, { "docid": "02dfbe75b99e4c2595d7ae12826f48e8", "score": "0.47880384", "text": "func CreateFromGit(client *occlient.Client, params occlient.CreateArgs) error {\n\n\tlabels := componentlabels.GetLabels(params.Name, params.ApplicationName, true)\n\n\t// Loading spinner\n\ts := log.Spinnerf(\"Creating component %s\", params.Name)\n\tdefer s.End(false)\n\n\t// Parse componentImageType before adding to labels\n\t_, imageName, imageTag, _, err := occlient.ParseImageName(params.ImageName)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to parse image name\")\n\t}\n\n\t// save component type as label\n\tlabels[componentlabels.ComponentTypeLabel] = imageName\n\tlabels[componentlabels.ComponentTypeVersion] = imageTag\n\n\t// save source path as annotation\n\tannotations := map[string]string{componentSourceURLAnnotation: params.SourcePath}\n\tannotations[componentSourceTypeAnnotation] = \"git\"\n\n\t// Namespace the component\n\tnamespacedOpenShiftObject, err := util.NamespaceOpenShiftObject(params.Name, params.ApplicationName)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to create namespaced name\")\n\t}\n\n\t// Create CommonObjectMeta to be passed in\n\tcommonObjectMeta := metav1.ObjectMeta{\n\t\tName: namespacedOpenShiftObject,\n\t\tLabels: labels,\n\t\tAnnotations: annotations,\n\t}\n\n\terr = client.NewAppS2I(params, commonObjectMeta)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to create git component %s\", namespacedOpenShiftObject)\n\t}\n\n\ts.End(true)\n\treturn nil\n}", "title": "" }, { "docid": "2c9f1c9e680d4c1b70519d5bcf451af8", "score": "0.47805718", "text": "func dockerVolumeNameFromRepoDir(repoDir string) string {\n\treturn filepath.Base(repoDir)\n}", "title": "" }, { "docid": "fda950bda87a768a97894b7cd8a3d085", "score": "0.4777709", "text": "func EnsureContainerHasVolumeMount(container *api.Container, name string, mountPath string) bool {\n\tfor _, vm := range container.VolumeMounts {\n\t\tif vm.Name == name {\n\t\t\tvm.MountPath = mountPath\n\t\t\treturn true\n\t\t}\n\t}\n\tcontainer.VolumeMounts = append(container.VolumeMounts, api.VolumeMount{\n\t\tName: name,\n\t\tMountPath: mountPath,\n\t})\n\treturn false\n}", "title": "" }, { "docid": "681b05b184539ebe81734f103855e00d", "score": "0.476497", "text": "func TestValidateAllowedVolumes(t *testing.T) {\n\tval := reflect.ValueOf(api.VolumeSource{})\n\n\tfor i := 0; i < val.NumField(); i++ {\n\t\t// reflectively create the volume source\n\t\tfieldVal := val.Type().Field(i)\n\n\t\tvolumeSource := api.VolumeSource{}\n\t\tvolumeSourceVolume := reflect.New(fieldVal.Type.Elem())\n\n\t\treflect.ValueOf(&volumeSource).Elem().FieldByName(fieldVal.Name).Set(volumeSourceVolume)\n\t\tvolume := api.Volume{VolumeSource: volumeSource}\n\n\t\t// sanity check before moving on\n\t\tfsType, err := sccutil.GetVolumeFSType(volume)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"error getting FSType for %s: %s\", fieldVal.Name, err.Error())\n\t\t\tcontinue\n\t\t}\n\n\t\t// add the volume to the pod\n\t\tpod := defaultPod()\n\t\tpod.Spec.Volumes = []api.Volume{volume}\n\n\t\t// create an SCC that allows no volumes\n\t\tscc := defaultSCC()\n\n\t\tprovider, err := NewSimpleProvider(scc)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"error creating provider for %s: %s\", fieldVal.Name, err.Error())\n\t\t\tcontinue\n\t\t}\n\n\t\t// expect a denial for this SCC and test the error message to ensure it's related to the volumesource\n\t\terrs := provider.ValidatePodSecurityContext(pod, field.NewPath(\"\"))\n\t\tif len(errs) != 1 {\n\t\t\tt.Errorf(\"expected exactly 1 error for %s but got %v\", fieldVal.Name, errs)\n\t\t} else {\n\t\t\tif !strings.Contains(errs.ToAggregate().Error(), fmt.Sprintf(\"%s volumes are not allowed to be used\", fsType)) {\n\t\t\t\tt.Errorf(\"did not find the expected error, received: %v\", errs)\n\t\t\t}\n\t\t}\n\n\t\t// now add the fstype directly to the scc and it should validate\n\t\tscc.Volumes = []securityv1.FSType{fsType}\n\t\terrs = provider.ValidatePodSecurityContext(pod, field.NewPath(\"\"))\n\t\tif len(errs) != 0 {\n\t\t\tt.Errorf(\"directly allowing volume expected no errors for %s but got %v\", fieldVal.Name, errs)\n\t\t}\n\n\t\t// now change the scc to allow any volumes and the pod should still validate\n\t\tscc.Volumes = []securityv1.FSType{securityv1.FSTypeAll}\n\t\terrs = provider.ValidatePodSecurityContext(pod, field.NewPath(\"\"))\n\t\tif len(errs) != 0 {\n\t\t\tt.Errorf(\"wildcard volume expected no errors for %s but got %v\", fieldVal.Name, errs)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f07e91a0ca93a2dc7a32a93e20fb6928", "score": "0.47598496", "text": "func (m *MockZapiClientInterface) VolumeExists(arg0 context.Context, arg1 string) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VolumeExists\", arg0, arg1)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "708fc65bec503403f176b8814e0cbcb3", "score": "0.47517508", "text": "func verifyVolumeExistence(volReqs template.VolumeRequirements, verifyActive bool) *axerror.AXError {\n\tfor _, volReq := range volReqs {\n\t\tif volReq.Name != \"\" {\n\t\t\tvol, axErr := volume.GetVolumeByAXRN(fmt.Sprintf(\"vol:/%s\", volReq.Name))\n\t\t\tif axErr != nil {\n\t\t\t\treturn axErr\n\t\t\t}\n\t\t\tif vol == nil {\n\t\t\t\treturn axerror.ERR_AX_ILLEGAL_ARGUMENT.NewWithMessagef(\"Volume with name '%s' does not exist\", volReq.Name)\n\t\t\t}\n\t\t\tif verifyActive && vol.Status != volume.VolumeStatusActive {\n\t\t\t\treturn axerror.ERR_AX_ILLEGAL_ARGUMENT.NewWithMessagef(\"Volume '%s' is not '%s'. Current status: %s\", volReq.Name, volume.VolumeStatusActive, vol.Status)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b1d13f2fa25117996a7dd8e38ce61d26", "score": "0.47503886", "text": "func (c *Component) CheckNuvoVolumes(ctx context.Context) error {\n\tc.Log.Debugf(\"NUVOAPI ListVols() called\")\n\tvols, err := c.App.NuvoAPI.ListVols()\n\tif err != nil {\n\t\tc.Log.Warningf(\"NUVOAPI ListVols(): %s\", err.Error())\n\t} else {\n\t\tc.Log.Debugf(\"NUVOAPI ListVols(): %v\", vols)\n\t}\n\tif err != nil || len(vols) == 0 {\n\t\tif _, err = c.NoVolumesInUse(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4beec473f6ae0d8ca422e8968230ad7", "score": "0.47474816", "text": "func RunJSONSerializationTestForGitRepoVolume(subject GitRepoVolume) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual GitRepoVolume\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "44ae59f68b8db25d6e5834cd16c95188", "score": "0.4745267", "text": "func NeedsGit(t *testing.T) {\n\tif _, err := exec.LookPath(\"git\"); err != nil {\n\t\tt.Skip(\"skipping because git binary not found\")\n\t}\n}", "title": "" }, { "docid": "d1fdf808e222fc0830153a22470c8e34", "score": "0.47426876", "text": "func Test_PackageRepoStatus_Failing(t *testing.T) {\n\tenv := BuildEnv(t)\n\tlogger := Logger{}\n\tkapp := Kapp{t, env.Namespace, logger}\n\tname := \"repo\"\n\n\trepoYaml := `apiVersion: install.package.carvel.dev/v1alpha1\nkind: PackageRepository\nmetadata:\n name: test-repo\nspec:\n fetch:\n imgpkgBundle:\n image: k8slt/i-dont-exist`\n\n\texpectedStatus := v1alpha1.PackageRepositoryStatus{\n\t\tGenericStatus: kcv1alpha1.GenericStatus{\n\t\t\tConditions: []kcv1alpha1.AppCondition{{\n\t\t\t\tType: kcv1alpha1.ReconcileFailed,\n\t\t\t\tStatus: corev1.ConditionTrue,\n\t\t\t\tMessage: \"Syncing packages: (see .status.usefulErrorMessage for details)\",\n\t\t\t}},\n\t\t\tObservedGeneration: 1,\n\t\t\tFriendlyDescription: \"Reconcile failed: Syncing packages: (see .status.usefulErrorMessage for details)\",\n\t\t\tUsefulErrorMessage: \"Error: Syncing directory '0': Syncing directory '.' with imgpkgBundle contents: Imgpkg: exit status 1 (stderr: Error: Checking if image is bundle: Collecting images: Working with index.docker.io/k8slt/i-dont-exist:latest: GET https://index.docker.io/v2/k8slt/i-dont-exist/manifests/latest: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:k8slt/i-dont-exist Type:repository]]\\n)\\n\",\n\t\t},\n\t}\n\n\t// deploy failing repo\n\tlogger.Section(\"deploy failing repo\", func() {\n\t\tkapp.RunWithOpts([]string{\"deploy\", \"-f\", \"-\", \"-a\", name},\n\t\t\tRunOpts{StdinReader: strings.NewReader(repoYaml)})\n\t})\n\n\tretry(t, 30*time.Second, func() error {\n\t\t// fetch repo\n\t\tout := kapp.Run([]string{\"inspect\", \"-a\", name, \"--raw\", \"--tty=false\", \"--filter-kind=PackageRepository\"})\n\n\t\tvar cr v1alpha1.PackageRepository\n\t\terr := yaml.Unmarshal([]byte(out), &cr)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to unmarshal: %s\", err)\n\t\t}\n\n\t\t// assert on expectedStatus\n\t\tif !reflect.DeepEqual(expectedStatus, cr.Status) {\n\t\t\treturn fmt.Errorf(\"\\nstatus is not same:\\nExpected:\\n%#v\\nGot:\\n%#v\", expectedStatus, cr.Status)\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "b2a71cd53dd80235411c9d670f1217d0", "score": "0.47322357", "text": "func getVolumeSpecs(pod *api.Pod) []volumeSpec {\n\tif va, ok := pod.Annotations[\"kuberdock-volume-annotations\"]; ok {\n\t\tvar data []volumeAnnotation\n\t\tif err := json.Unmarshal([]byte(va), &data); err != nil {\n\t\t\tglog.V(4).Infof(\"Error while try to parse json(%s): %q\", va, err)\n\t\t\treturn nil\n\t\t}\n\t\tspecs := make([]volumeSpec, 0, len(data))\n\t\tfor _, volume := range data {\n\t\t\tif volume.LocalStorage != nil && (volume.LocalStorage.Path != \"\" && volume.LocalStorage.Name != \"\") {\n\t\t\t\tif volume.LocalStorage.Size == 0 {\n\t\t\t\t\tvolume.LocalStorage.Size = 1\n\t\t\t\t}\n\t\t\t\tspec := volumeSpec{\n\t\t\t\t\tPath: volume.LocalStorage.Path,\n\t\t\t\t\tName: volume.LocalStorage.Name,\n\t\t\t\t\tSize: volume.LocalStorage.Size,\n\t\t\t\t\tBackupURL: volume.BackupURL,\n\t\t\t\t}\n\t\t\t\tspecs = append(specs, spec)\n\t\t\t}\n\t\t}\n\t\treturn specs\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d77e2ce2ec7f3d3472680c0de63d988", "score": "0.47288978", "text": "func checkGit() error {\n\t_, err := exec.Command(\"git\", \"--version\").Output()\n\tif err != nil {\n\t\treturn noGitErr\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "74349d22ff48cfd729e9e4e0894e2b50", "score": "0.4721061", "text": "func (dockerClient *Client) VolumeExists(name string) (bool, error) {\n\t_, err := dockerClient.client.VolumeInspect(context.Background(), name)\n\tif err != nil {\n\t\tif client.IsErrNotFound(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "e4020c7d15a42a0ff0552835af460354", "score": "0.4710689", "text": "func aGitRepo(ctx context.Context, t *testing.T, u *gptest.Unit, name string) string {\n\tt.Helper()\n\n\tgd := filepath.Join(u.Dir, name)\n\tassert.NoError(t, os.MkdirAll(gd, 0o700))\n\n\t_, err := git.New(gd)\n\tassert.Error(t, err)\n\n\tidf := filepath.Join(gd, \".gpg-id\")\n\tassert.NoError(t, os.WriteFile(idf, []byte(\"0xDEADBEEF\"), 0o600))\n\n\tgr, err := git.Init(ctx, gd, \"Nobody\", \"foo.bar@example.org\")\n\tassert.NoError(t, err)\n\tassert.NotNil(t, gr)\n\n\treturn gd\n}", "title": "" }, { "docid": "b3eb70902f30f83420d3bbfe05b6b67d", "score": "0.4705826", "text": "func (o StandaloneSpecVolumesOutput) GitRepo() StandaloneSpecVolumesGitRepoPtrOutput {\n\treturn o.ApplyT(func(v StandaloneSpecVolumes) *StandaloneSpecVolumesGitRepo { return v.GitRepo }).(StandaloneSpecVolumesGitRepoPtrOutput)\n}", "title": "" }, { "docid": "cdbdebb56dc81e5df32eec0d565a143a", "score": "0.4698784", "text": "func AddIndependentPropertyGeneratorsForGitRepoVolume(gens map[string]gopter.Gen) {\n\tgens[\"Directory\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Repository\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Revision\"] = gen.PtrOf(gen.AlphaString())\n}", "title": "" }, { "docid": "ce7d6553f8f582e53b35098bc1df6072", "score": "0.46891382", "text": "func volumeVmdkExists(t *testing.T, c *client.Client, vol string) *types.Volume {\n\treply, err := c.VolumeList(filters.Args{})\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to enumerate volumes: %v\", err)\n\t}\n\n\tfor _, v := range reply.Volumes {\n\t\t//\tt.Log(v.Name, v.Driver, v.Mountpoint)\n\t\tif v.Name == vol {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78f1de00331dbb48cf8ead234a943a19", "score": "0.4684282", "text": "func needsUpdate(pod *v1.Pod, tmpl v1.PodTemplateSpec) bool {\n\tc1 := pod.Spec.Containers[0]\n\tc2 := tmpl.Spec.Containers[0]\n\n\tif c1.Image != c2.Image {\n\t\treturn true\n\t}\n\tif !reflect.DeepEqual(c1.Resources, c2.Resources) {\n\t\treturn true\n\t}\n\tif !reflect.DeepEqual(c1.Args, c2.Args) {\n\t\treturn true\n\t}\n\tif !reflect.DeepEqual(c1.Env, c2.Env) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "49fb44bc1190d826298cac4b8dbc79b2", "score": "0.46748403", "text": "func (s *ControllerServer) createNewVolumeFromSnapshot(\n\tnsProvider ns.ProviderInterface,\n\tsourceSnapshotID string,\n\tvolumePath string,\n\tcapacityBytes int64,\n) error {\n\tl := s.log.WithField(\"func\", \"createNewVolumeFromSnapshot()\")\n\tl.Infof(\"snapshot: %s\", sourceSnapshotID)\n\n\tsnapshot, err := nsProvider.GetSnapshot(sourceSnapshotID)\n\tif err != nil {\n\t\tmessage := fmt.Sprintf(\"Failed to find snapshot '%s': %s\", sourceSnapshotID, err)\n\t\tif ns.IsNotExistNefError(err) || ns.IsBadArgNefError(err) {\n\t\t\treturn status.Error(codes.NotFound, message)\n\t\t}\n\t\treturn status.Error(codes.NotFound, message)\n\t}\n\n\terr = nsProvider.CloneSnapshot(snapshot.Path, ns.CloneSnapshotParams{\n\t\tTargetPath: volumePath,\n\t\tReferencedQuotaSize: capacityBytes,\n\t})\n\tif err != nil {\n\t\tif ns.IsAlreadyExistNefError(err) {\n\t\t\t//TODO validate snapshot's \"bytesReferenced\" is less than required volume size\n\n\t\t\t// existingFilesystem, err := nsProvider.GetFilesystem(volumePath)\n\t\t\t// if err != nil {\n\t\t\t// return nil, status.Errorf(\n\t\t\t// codes.Internal,\n\t\t\t// \"Volume '%s' already exists, but volume properties request failed: %s\",\n\t\t\t// volumePath,\n\t\t\t// err,\n\t\t\t// )\n\t\t\t// } else if existingFilesystem.GetReferencedQuotaSize() != capacityBytes {\n\t\t\t// return nil, status.Errorf(\n\t\t\t// codes.AlreadyExists,\n\t\t\t// \"Volume '%s' already exists, but with a different size: requested=%d, existing=%d\",\n\t\t\t// volumePath,\n\t\t\t// capacityBytes,\n\t\t\t// existingFilesystem.GetReferencedQuotaSize(),\n\t\t\t// )\n\t\t\t// }\n\n\t\t\tl.Infof(\"volume '%s' already exists and can be used\", volumePath)\n\t\t\treturn nil\n\t\t}\n\n\t\treturn status.Errorf(\n\t\t\tcodes.Internal,\n\t\t\t\"Cannot create volume '%s' using snapshot '%s': %s\",\n\t\t\tvolumePath,\n\t\t\tsnapshot.Path,\n\t\t\terr,\n\t\t)\n\t}\n\n\t//TODO resize volume after cloning from snapshot if needed\n\n\tl.Infof(\"volume '%s' has been created using snapshot '%s'\", volumePath, snapshot.Path)\n\treturn nil\n}", "title": "" }, { "docid": "899611a926e09ba7502df18c3e7af66a", "score": "0.46687368", "text": "func (s *VolumeCreateTestSuite) createVolCheck(name, option string, valid bool, c *C) {\n\tvar out string\n\tvar err error\n\n\tif option == \"\" {\n\t\tout, err = dockercli.CreateVolume(s.config.DockerHosts[0], name)\n\t} else {\n\t\tout, err = dockercli.CreateVolumeWithOptions(s.config.DockerHosts[0], name, option)\n\t}\n\n\t// if creation is successful, add it to the list so that it gets cleaned later\n\tif err == nil {\n\t\ts.volumeList = append(s.volumeList, name)\n\t}\n\n\tif valid {\n\t\t// positive test case\n\t\tc.Assert(err, IsNil, Commentf(out))\n\t} else {\n\t\t// negative test case\n\t\tc.Assert(err, Not(IsNil), Commentf(out))\n\t\tc.Assert(strings.HasPrefix(out, dockerclicon.ErrorVolumeCreate), Equals, true, Commentf(out))\n\t}\n}", "title": "" }, { "docid": "3139e1f7c879048f0989ff861092f334", "score": "0.46671826", "text": "func (c Client) VolumeExistsByCreationToken(ctx context.Context, creationToken string) (bool, *FileSystem, error) {\n\tif filesystem, err := c.VolumeByCreationToken(ctx, creationToken); err != nil {\n\t\tif errors.IsNotFoundError(err) {\n\t\t\treturn false, nil, nil\n\t\t} else {\n\t\t\treturn false, nil, err\n\t\t}\n\t} else {\n\t\treturn true, filesystem, nil\n\t}\n}", "title": "" }, { "docid": "e470bbbebe6e29a43b58f183cd5a5804", "score": "0.4655644", "text": "func (cmd ImportCmd) RequiresRepo() bool {\n\treturn false\n}", "title": "" }, { "docid": "a3552fdfec422d82b7abe0a2d5e133bf", "score": "0.46505886", "text": "func (h HelmClient) ensureRepository(url string, auth AuthSettings) (string, error) {\n\trepoFile, err := repo.LoadFile(h.settings.RepositoryConfig)\n\tif err != nil && !errors.Is(err, fs.ErrNotExist) {\n\t\treturn \"\", err\n\t}\n\n\trepoName, err := computeRepoName(url)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"can not compute repository's name for '%s': %w\", url, err)\n\t}\n\tdesiredEntry := &repo.Entry{\n\t\tName: repoName,\n\t\tURL: url,\n\t\tUsername: auth.Username,\n\t\tPassword: auth.Password,\n\t\tCAFile: h.caBundleFile,\n\t}\n\n\t// Ensure we have the last version of the index file.\n\tchartRepo, err := repo.NewChartRepository(desiredEntry, h.getterProviders)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// Constructor of the ChartRepository uses the default Helm cache. However, we have to use the cached defined in the\n\t// client settings.\n\tchartRepo.CachePath = h.settings.RepositoryCache\n\n\tif _, err := chartRepo.DownloadIndexFile(); err != nil {\n\t\treturn \"\", fmt.Errorf(\"can not download index file: %w\", err)\n\t}\n\n\tif !repoFile.Has(repoName) {\n\t\trepoFile.Add(desiredEntry)\n\t\treturn repoName, repoFile.WriteFile(h.settings.RepositoryConfig, 0644)\n\t}\n\treturn repoName, nil\n}", "title": "" }, { "docid": "f9fbe8797332309dc73b3aa329e3b995", "score": "0.46483064", "text": "func isVolumeCanBePublished(canAtMultiNode bool, attachReq *model.VolumeAttachmentSpec,\n\tvolMultiAttach bool) error {\n\n\tglog.V(5).Infof(\"start to isVolumePublished, canAtMultiNode = %v, attachReq = %v\",\n\t\tcanAtMultiNode, attachReq)\n\n\tattachments, err := client.ListVolumeAttachments()\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"listVolumeAttachments failed: %v\", err)\n\t\tglog.Error(msg)\n\t\treturn status.Error(codes.FailedPrecondition, msg)\n\t}\n\n\tmsg := fmt.Sprintf(\"the volume %s can be published.\", attachReq.VolumeId)\n\n\tfor _, attachSpec := range attachments {\n\t\tif attachSpec.VolumeId == attachReq.VolumeId {\n\t\t\tif attachSpec.Host == attachReq.Host {\n\t\t\t\tmsg := fmt.Sprintf(\"the volume %s is publishing to the current node %s and no need to publish again\", attachReq.VolumeId, attachReq.Host)\n\t\t\t\tglog.Infof(msg)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif !canAtMultiNode {\n\t\t\t\tmsg := fmt.Sprintf(\"the volume %s has been published to the node %s and kubernetes does not have MULTI_NODE volume capability\", attachReq.VolumeId, attachSpec.Host)\n\t\t\t\tglog.Error(msg)\n\t\t\t\treturn status.Error(codes.FailedPrecondition, msg)\n\t\t\t}\n\t\t\tif !volMultiAttach {\n\t\t\t\tmsg := fmt.Sprintf(\"the volume %s has been published to the node %s, but the volume does not enable multiattach\", attachReq.VolumeId, attachSpec.Host)\n\t\t\t\tglog.Error(msg)\n\t\t\t\treturn status.Error(codes.FailedPrecondition, msg)\n\t\t\t}\n\n\t\t\tglog.Info(msg)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tglog.Info(msg)\n\treturn nil\n}", "title": "" }, { "docid": "e400e0bd51e3abfb7fc4917a29b5114c", "score": "0.46447605", "text": "func gitInit() {\n\tcmd, err := start(\"git init\")\n\tExpect(err).NotTo(HaveOccurred())\n\tEventually(cmd).Should(Say(\"Initialized empty Git repository\"))\n}", "title": "" }, { "docid": "adfca68ec4e67d4497ef9556c14425ec", "score": "0.46443054", "text": "func TestGitPush(t *testing.T) {\n\n\tfor _, env := range []string{\"DOCKER_H\", \"PULL_REGISTRY_USERNAME\", \"PULL_REGISTRY_PASSWORD\", \"DOCKPACK_IMAGE\", \"IMAGE_NAMESPACE\"} {\n\t\tif os.Getenv(env) == \"\" {\n\t\t\tt.Fatalf(\"Missing %s env var\", env)\n\t\t}\n\t}\n\n\t//mock a git repository\n\tdockerHost := os.Getenv(\"DOCKER_H\")\n\tremote := fmt.Sprintf(\"ssh://%s:%s/test_app.git\", dockerHost, sshPort)\n\tdir, err := mockGitRepo(remote)\n\tdefer os.RemoveAll(dir)\n\n\t//start a http server to get back the hook\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tdecoder := json.NewDecoder(r.Body)\n\n\t\tvar payload map[string]interface{}\n\n\t\tif err := decoder.Decode(&payload); err != nil {\n\t\t\twg.Done()\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tfmt.Printf(\"payload: %#v\", payload)\n\n\t\tfor _, key := range []string{\"repo\", \"image_name\", \"image_tag\", \"procfile\"} {\n\t\t\tif payload[key] == \"\" {\n\t\t\t\twg.Done()\n\t\t\t\tt.Fatalf(\"expected key %q to exist in post build hook payload. Got %#v\", key, payload)\n\t\t\t}\n\t\t}\n\n\t\twg.Done()\n\t})\n\n\tgo func() {\n\t\tif err := http.ListenAndServe(\":9999\", nil); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\tcontID, err := startDockpack(sshPort, os.Getenv(\"PULL_REGISTRY_USERNAME\"), os.Getenv(\"PULL_REGISTRY_PASSWORD\"), os.Getenv(\"IMAGE_NAMESPACE\"), \"http://192.168.99.1:9999\", os.Getenv(\"DOCKPACK_IMAGE\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer stopDockpack(contID)\n\n\tout, err := pushDockpack(dir)\n\tif err != nil {\n\t\tt.Fatalf(\"error: %v, output: %q\", err, out)\n\t}\n\n\tfmt.Println(out)\n\n\t//wait for the hook to be sent\n\twg.Wait()\n}", "title": "" }, { "docid": "4fbf2ae88c8c6edec16ac178162bca5c", "score": "0.4637202", "text": "func TestCreateProjectCmdWithGitMissingParam(t *testing.T) {\n\tcredentialmanager.MockAuthCreds = true\n\n\tshipyardFileName := \"shipyard.yaml\"\n\tdefer testShipyard(t, shipyardFileName, \"\")()\n\n\tcmd := fmt.Sprintf(\"create project sockshop --shipyard=%s --git-user=%s --git-token=%s --mock\",\n\t\tshipyardFileName, \"user\", \"token\")\n\t_, err := executeActionCommandC(cmd)\n\n\tif !errorContains(err, gitErrMsg) {\n\t\tt.Errorf(\"missing expected error, but got %v\", err)\n\t}\n}", "title": "" }, { "docid": "90a5da092df28e58e0cf9b055bf642d0", "score": "0.4635133", "text": "func (s *BasicTestSuite) TestVolumeLifecycle(c *C) {\n\tmisc.LogTestStart(c.TestName())\n\n\tfor _, host := range s.config.DockerHosts {\n\t\tout, err := dockercli.CreateVolume(host, s.volName1)\n\t\tc.Assert(err, IsNil, Commentf(out))\n\n\t\tout, err = dockercli.CreateVolume(host, s.volName1)\n\t\tc.Assert(err, IsNil, Commentf(out))\n\n\t\taccessible := verification.CheckVolumeAvailability(host, s.volName1)\n\t\tc.Assert(accessible, Equals, true, Commentf(\"Volume %s is not available\", s.volName1))\n\n\t\tout, err = dockercli.AttachVolume(host, s.volName1, s.containerName)\n\t\tc.Assert(err, IsNil, Commentf(out))\n\n\t\tstatus := verification.VerifyAttachedStatus(s.volName1, host, s.esx)\n\t\tc.Assert(status, Equals, true, Commentf(\"Volume %s is not attached\", s.volName1))\n\n\t\tout, err = dockercli.DeleteVolume(host, s.volName1)\n\t\tc.Assert(err, Not(IsNil), Commentf(out))\n\n\t\tout, err = dockercli.RemoveContainer(host, s.containerName)\n\t\tc.Assert(err, IsNil, Commentf(out))\n\n\t\tstatus = verification.VerifyDetachedStatus(s.volName1, host, s.esx)\n\t\tc.Assert(status, Equals, true, Commentf(\"Volume %s is still attached\", s.volName1))\n\n\t\tout, err = dockercli.DeleteVolume(host, s.volName1)\n\t\tc.Assert(err, IsNil, Commentf(out))\n\n\t\taccessible = verification.CheckVolumeAvailability(host, s.volName1)\n\t\tc.Assert(accessible, Equals, false, Commentf(\"Volume %s is still available\", s.volName1))\n\t}\n\n\tmisc.LogTestEnd(c.TestName())\n}", "title": "" }, { "docid": "fba3622dd8da14265f2c08e15b04f941", "score": "0.46312287", "text": "func (volume *GitRepoVolume) Initialize_From_GitRepoVolume_STATUS(source *GitRepoVolume_STATUS) error {\n\n\t// Directory\n\tvolume.Directory = genruntime.ClonePointerToString(source.Directory)\n\n\t// Repository\n\tvolume.Repository = genruntime.ClonePointerToString(source.Repository)\n\n\t// Revision\n\tvolume.Revision = genruntime.ClonePointerToString(source.Revision)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "22dc41b19f9c794296f5536b9dd88d67", "score": "0.46296972", "text": "func initGitRepository(t testing.TB, cmds ...string) string {\n\tdir := initGitRepositoryWorkingCopy(t, cmds...)\n\tmakeGitRepositoryBare(t, dir)\n\treturn dir\n}", "title": "" }, { "docid": "a1c695f560558a1bd826c7e9057786ef", "score": "0.46255195", "text": "func (o LicenseMasterSpecVolumesOutput) GitRepo() LicenseMasterSpecVolumesGitRepoPtrOutput {\n\treturn o.ApplyT(func(v LicenseMasterSpecVolumes) *LicenseMasterSpecVolumesGitRepo { return v.GitRepo }).(LicenseMasterSpecVolumesGitRepoPtrOutput)\n}", "title": "" }, { "docid": "4a6a3f4a99312e345b22818953639f94", "score": "0.46227807", "text": "func CheckForGit(cwd string) error {\n\t// Quick failure if no .git folder.\n\tgitFolder := filepath.Join(cwd, \".git\")\n\tif _, err := os.Stat(gitFolder); os.IsNotExist(err) {\n\t\treturn errors.New(\"this does not appear to be a git repository\")\n\t}\n\n\trepo, err := git.PlainOpen(cwd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tremotes, err := repo.Remotes()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Also fail if no remotes detected.\n\tif len(remotes) == 0 {\n\t\treturn errors.New(\"there are no remotes associated with this repository\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "baf2cc0c9a627735c995e51807fffe61", "score": "0.46213457", "text": "func newPodTemplateWithSecretVolume(secretName string) corev1.PodTemplateSpec {\n\ttestContainer := newTestContainerMinimal()\n\ttestContainer.VolumeMounts = []corev1.VolumeMount{{Name: secretAsVolumeName, MountPath: volumeMountPath}}\n\tcontainers := []corev1.Container{testContainer}\n\tvolumes := []corev1.Volume{\n\t\t{\n\t\t\tName: secretAsVolumeName,\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tSecret: &corev1.SecretVolumeSource{\n\t\t\t\t\tSecretName: secretName,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\treturn workloads.NewPodTemplate(containers, volumes, nil, nil)\n}", "title": "" }, { "docid": "ed5946ff4236cb69a05099ec8158fca7", "score": "0.46069172", "text": "func (m *MockAzure) VolumeExists(arg0 context.Context, arg1 *storage.VolumeConfig) (bool, *api.FileSystem, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VolumeExists\", arg0, arg1)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(*api.FileSystem)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "f1a5e0bc14e558599ce19dbd3d04a9ea", "score": "0.4604078", "text": "func (s *DockerCLIBuildSuite) TestBuildFromGit(c *testing.T) {\n\tname := \"testbuildfromgit\"\n\tgit := fakegit.New(c, \"repo\", map[string]string{\n\t\t\"Dockerfile\": `FROM busybox\n\t\tADD first /first\n\t\tRUN [ -f /first ]\n\t\tMAINTAINER docker`,\n\t\t\"first\": \"test git data\",\n\t}, true)\n\tdefer git.Close()\n\n\tbuildImageSuccessfully(c, name, build.WithContextPath(git.RepoURL))\n\n\tres := inspectField(c, name, \"Author\")\n\tif res != \"docker\" {\n\t\tc.Fatalf(\"Maintainer should be docker, got %s\", res)\n\t}\n}", "title": "" }, { "docid": "ca843495c2e1c5c62ae7087e4d44c412", "score": "0.4602332", "text": "func createVolumeForConfigMap(name string) corev1.Volume {\n\treturn corev1.Volume{\n\t\tName: name,\n\t\tVolumeSource: corev1.VolumeSource{\n\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\tName: name,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "dcb26f05847f660e1353bda73a2dfc5e", "score": "0.45905885", "text": "func (r *CodeReadyAnalyticsReconciler) ensurePV(request reconcile.Request,\n\tinstance *f8av1alpha1.CodeReadyAnalytics,\n\tdep *corev1.PersistentVolume,\n) (*reconcile.Result, error) {\n\n\tfoundVolume := &corev1.PersistentVolume{}\n\terr := r.Client.Get(context.TODO(), types.NamespacedName{\n\t\tName: dep.Name,\n\t}, foundVolume)\n\n\tr.Log.Info(\"Instance Name\")\n\tr.Log.Info(instance.Name)\n\n\tr.Log.Info(\"Getting Persistent Volume\")\n\tif err != nil && errors.IsNotFound(err) {\n\t\tr.Log.Info(\"Vol not found\")\n\t\tpvDep := r.pvDeployment(instance)\n\n\t\t// Create the deployment\n\t\tr.Log.Info(\"Creating a new PV\", \"PV.Namespace\", pvDep.Namespace, \"PV.Name\", pvDep.Name)\n\t\terr = r.Client.Create(context.TODO(), pvDep)\n\n\t\tif err != nil {\n\t\t\t// Deployment failed\n\t\t\tr.Log.Error(err, \"Failed to create new PV\", \"PV.Namespace\", pvDep.Namespace, \"PV.Name\", pvDep.Name)\n\t\t\treturn &reconcile.Result{}, err\n\t\t}\n\t} else if err != nil {\n\t\t// Error that isn't due to the deployment not existing\n\t\tr.Log.Error(err, \"Failed to get Persistent Vol\")\n\t\treturn &reconcile.Result{}, err\n\t}\n\t// VOLUME was successful\n\treturn nil, nil\n}", "title": "" }, { "docid": "b347263b35ba6a230a9165c44b529bae", "score": "0.45898816", "text": "func (o *CreateOptions) gitCloneIfRequired(gitter gits.Gitter) (string, error) {\n\tgitURL := o.InitialGitURL\n\tif gitURL == \"\" {\n\t\tgitURL = common.DefaultBootHelmfileRepository\n\t}\n\tvar err error\n\tdir := o.Dir\n\tif dir != \"\" {\n\t\terr = os.MkdirAll(dir, util.DefaultWritePermissions)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to create directory %s\", dir)\n\t\t}\n\t} else {\n\t\tdir, err = ioutil.TempDir(\"\", \"helmboot-\")\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"failed to create temporary directory\")\n\t\t}\n\t}\n\n\tlog.Logger().Debugf(\"cloning %s to directory %s\", util.ColorInfo(gitURL), util.ColorInfo(dir))\n\n\terr = gitter.Clone(gitURL, dir)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"failed to clone repository %s to directory: %s\", gitURL, dir)\n\t}\n\treturn dir, nil\n}", "title": "" }, { "docid": "de856bcfba037f9fe161a46a63a49519", "score": "0.45894477", "text": "func (v *Volume) isVolumeCanBePublished(canAtMultiNode bool, attachReq *model.VolumeAttachmentSpec,\n\tvolMultiAttach bool) error {\n\n\tglog.V(5).Infof(\"start to check if volume can be published, canAtMultiNode = %v, attachReq = %v\",\n\t\tcanAtMultiNode, attachReq)\n\n\tattachments, err := v.Client.ListVolumeAttachments()\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"list volume attachments failed: %v\", err)\n\t\tglog.Error(msg)\n\t\treturn status.Error(codes.FailedPrecondition, msg)\n\t}\n\n\tmsg := fmt.Sprintf(\"the volume %s can be published\", attachReq.VolumeId)\n\n\tfor _, attachSpec := range attachments {\n\t\tif attachSpec.VolumeId == attachReq.VolumeId {\n\t\t\tif attachSpec.HostId == attachReq.HostId {\n\t\t\t\tmsg := fmt.Sprintf(\"the volume %s is publishing to the current node %s and no need to publish again\", attachReq.VolumeId, attachReq.HostId)\n\t\t\t\tglog.Infof(msg)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif !canAtMultiNode {\n\t\t\t\tmsg := fmt.Sprintf(\"the volume %s has been published to the node %s and kubernetes does not have MULTI_NODE volume capability\", attachReq.VolumeId, attachSpec.HostId)\n\t\t\t\tglog.Error(msg)\n\t\t\t\treturn status.Error(codes.FailedPrecondition, msg)\n\t\t\t}\n\t\t\tif !volMultiAttach {\n\t\t\t\tmsg := fmt.Sprintf(\"the volume %s has been published to the node %s, but the volume does not enable multiattach\", attachReq.VolumeId, attachSpec.HostId)\n\t\t\t\tglog.Error(msg)\n\t\t\t\treturn status.Error(codes.FailedPrecondition, msg)\n\t\t\t}\n\t\t}\n\t}\n\n\tglog.Info(msg)\n\treturn nil\n}", "title": "" }, { "docid": "fde25d59208b9789eeffac63605ad022", "score": "0.45850185", "text": "func (probe CvsProbe) IsRepositoryRoot(path string) (bool, error) {\n\texists, err := dirExists(filepath.Join(path, \"CVS\"))\n\tif !exists || err != nil {\n\t\treturn false, err\n\t}\n\n\tparentExists, parentErr := dirExists(filepath.Join(path, \"..\", \"CVS\"))\n\tif parentExists || parentErr != nil {\n\t\treturn false, parentErr\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "87327a0d2d0656067ae2691183bbb355", "score": "0.45824528", "text": "func (c *CreateConfig) GetVolumeMounts(specMounts []spec.Mount) ([]spec.Mount, error) {\n\tvar m []spec.Mount\n\tvar options []string\n\tfor _, i := range c.Volumes {\n\t\t// We need to handle SELinux options better here, specifically :Z\n\t\tspliti := strings.Split(i, \":\")\n\t\tif len(spliti) > 2 {\n\t\t\toptions = strings.Split(spliti[2], \",\")\n\t\t}\n\t\tif libpod.MountExists(specMounts, spliti[1]) {\n\t\t\tcontinue\n\t\t}\n\t\toptions = append(options, \"rbind\")\n\t\tvar foundrw, foundro, foundz, foundZ bool\n\t\tvar rootProp string\n\t\tfor _, opt := range options {\n\t\t\tswitch opt {\n\t\t\tcase \"rw\":\n\t\t\t\tfoundrw = true\n\t\t\tcase \"ro\":\n\t\t\t\tfoundro = true\n\t\t\tcase \"z\":\n\t\t\t\tfoundz = true\n\t\t\tcase \"Z\":\n\t\t\t\tfoundZ = true\n\t\t\tcase \"private\", \"rprivate\", \"slave\", \"rslave\", \"shared\", \"rshared\":\n\t\t\t\trootProp = opt\n\t\t\t}\n\t\t}\n\t\tif !foundrw && !foundro {\n\t\t\toptions = append(options, \"rw\")\n\t\t}\n\t\tif foundz {\n\t\t\tif err := label.Relabel(spliti[0], c.MountLabel, true); err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"relabel failed %q\", spliti[0])\n\t\t\t}\n\t\t}\n\t\tif foundZ {\n\t\t\tif err := label.Relabel(spliti[0], c.MountLabel, false); err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"relabel failed %q\", spliti[0])\n\t\t\t}\n\t\t}\n\t\tif rootProp == \"\" {\n\t\t\toptions = append(options, \"private\")\n\t\t}\n\n\t\tm = append(m, spec.Mount{\n\t\t\tDestination: spliti[1],\n\t\t\tType: string(TypeBind),\n\t\t\tSource: spliti[0],\n\t\t\tOptions: options,\n\t\t})\n\t}\n\n\t// volumes from image config\n\tif c.ImageVolumeType != \"tmpfs\" {\n\t\treturn m, nil\n\t}\n\tfor vol := range c.BuiltinImgVolumes {\n\t\tif libpod.MountExists(specMounts, vol) {\n\t\t\tcontinue\n\t\t}\n\t\tmount := spec.Mount{\n\t\t\tDestination: vol,\n\t\t\tType: string(TypeTmpfs),\n\t\t\tSource: string(TypeTmpfs),\n\t\t\tOptions: []string{\"rw\", \"noexec\", \"nosuid\", \"nodev\", \"tmpcopyup\"},\n\t\t}\n\t\tm = append(m, mount)\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "1020181f19f94a0f7091a4b4ad7af8a6", "score": "0.45814183", "text": "func useVolumeCloning(req *csi.CreateVolumeRequest) bool {\n\treturn req.VolumeContentSource != nil && req.VolumeContentSource.GetVolume() != nil\n}", "title": "" }, { "docid": "daa452ef3d0bfb16e77da0e7c80e83e6", "score": "0.4581001", "text": "func ensureVolumeClaimPresent(spec *fdbtypes.FoundationDBClusterSpec) {\n\tif spec.Processes == nil {\n\t\tspec.Processes = make(map[fdbtypes.ProcessClass]fdbtypes.ProcessSettings)\n\t}\n\tgeneralSettings := spec.Processes[fdbtypes.ProcessClassGeneral]\n\tif generalSettings.VolumeClaimTemplate == nil {\n\t\tgeneralSettings.VolumeClaimTemplate = &corev1.PersistentVolumeClaim{}\n\t}\n\tspec.Processes[fdbtypes.ProcessClassGeneral] = generalSettings\n}", "title": "" }, { "docid": "92c63c3acbefb9b33d7a8602702ccb5b", "score": "0.4574584", "text": "func (nds *ComponentDefinitions) validateVolumeRefs(vc VolumeConfig, containingComponentName ComponentName) error {\n\tcomponentName := vc.VolumesFrom\n\tif componentName == \"\" {\n\t\tcomponentName = vc.VolumeFrom\n\t}\n\tif componentName == \"\" {\n\t\t// No references, all ok\n\t\treturn nil\n\t}\n\n\t// Check that the component name (volume-from or volumes-from) is not the containing component\n\tif componentName == containingComponentName.String() {\n\t\treturn maskf(InvalidVolumeConfigError, \"cannot refer to own component '%s'\", componentName)\n\t}\n\t// Another component is referenced, we should be in a pod\n\t// Find the root of our pod\n\tpodRootName, _, err := nds.PodRoot(containingComponentName)\n\tif err != nil {\n\t\treturn maskf(InvalidVolumeConfigError, \"cannot refer to another component '%s' without a pod declaration\", componentName)\n\t}\n\t// Get the components that are part of the same pod\n\tpodComponents, err := nds.PodComponents(podRootName)\n\tif err != nil {\n\t\treturn mask(err)\n\t}\n\t// Find the other component name\n\tother, err := podComponents.ComponentByName(ComponentName(componentName))\n\tif err == nil {\n\t\t// Found other component\n\t\t// Check matching \"volume-path\"\n\t\tif vc.VolumePath != \"\" {\n\t\t\tif !other.Volumes.Contains(vc.VolumePath) {\n\t\t\t\treturn maskf(InvalidVolumeConfigError, \"cannot find path '%s' on component '%s'\", vc.VolumePath, componentName)\n\t\t\t}\n\t\t}\n\t\t// all ok\n\t\treturn nil\n\t}\n\n\t// Other component is not found in the same pod\n\t// Does the other component even exists?\n\tif _, err := nds.ComponentByName(ComponentName(componentName)); err == nil {\n\t\treturn maskf(InvalidVolumeConfigError, \"cannot refer to another component '%s' that is not part of the same pod\", componentName)\n\t} else {\n\t\t// Other component not found\n\t\treturn maskf(InvalidVolumeConfigError, \"cannot find referenced component '%s'\", componentName)\n\t}\n}", "title": "" }, { "docid": "a7ae14615c494d11f2dab12fc5280645", "score": "0.45637017", "text": "func gitToContainer(git *v1alpha1.GitSourceSpec) (*corev1.Container, error) {\n\tif git.Url == \"\" {\n\t\treturn nil, validation.NewError(\"MissingUrl\", \"git sources are expected to specify a Url, got: %v\", git)\n\t}\n\tif git.Revision == \"\" {\n\t\treturn nil, validation.NewError(\"MissingRevision\", \"git sources are expected to specify a Revision, got: %v\", git)\n\t}\n\treturn &corev1.Container{\n\t\tName: initContainerPrefix + gitSource,\n\t\tImage: *gitImage,\n\t\tArgs: []string{\n\t\t\t\"-url\", git.Url,\n\t\t\t\"-revision\", git.Revision,\n\t\t},\n\t\tVolumeMounts: implicitVolumeMounts,\n\t\tWorkingDir: workspaceDir,\n\t\tEnv: implicitEnvVars,\n\t}, nil\n}", "title": "" }, { "docid": "5ad1c9a42b767b47f9f54c21245e806e", "score": "0.45629582", "text": "func EnsureConfigDirIsGitRepo(cfg config.Cfg) (bool, error) {\n\tcmd := exec.Command(\"git\", \"status\")\n\tcmd.Dir = cfg.TsConfigDir\n\n\terrPipe, err := cmd.StderrPipe()\n\tif err != nil {\n\t\treturn false, errors.New(\"getting stderr pipe for command: \" + err.Error())\n\t}\n\n\tif err := cmd.Start(); err != nil {\n\t\tif _, ok := err.(*exec.ExitError); !ok {\n\t\t\t// this means Go failed to run the command, not that the command returned an error.\n\t\t\treturn false, errors.New(\"git status returned: \" + err.Error())\n\t\t}\n\t}\n\n\terrOutput, err := ioutil.ReadAll(errPipe)\n\tif err != nil {\n\t\treturn false, errors.New(\"reading stderr: \" + err.Error())\n\t}\n\n\tif err := cmd.Wait(); err != nil {\n\t\tif _, ok := err.(*exec.ExitError); !ok {\n\t\t\t// this means Go failed to run the command, not that the command returned an error.\n\t\t\treturn false, errors.New(\"waiting for git command: \" + err.Error())\n\t\t}\n\t}\n\n\tconst GitNotARepoMsgPrefix = `fatal: not a git repository`\n\n\terrOutput = bytes.ToLower(errOutput)\n\tif !bytes.Contains(errOutput, []byte(GitNotARepoMsgPrefix)) {\n\t\treturn false, nil // it's already a git repo\n\t}\n\n\tif err := makeConfigDirGitRepo(cfg); err != nil {\n\t\treturn true, errors.New(\"making config dir '\" + cfg.TsConfigDir + \"' a git repo: \" + err.Error())\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "bab0b8c3059614a2dafe29048351ce27", "score": "0.45607123", "text": "func (p *Provisioner) createInitPod(pOpts *HelperPodOptions) error {\n\tvar config podConfig\n\tconfig.pOpts, config.podName = pOpts, \"init\"\n\t//err := pOpts.validate()\n\tif err := pOpts.validate(); err != nil {\n\t\treturn err\n\t}\n\n\t// Initialize HostPath builder and validate that\n\t// volume directory is not directly under root.\n\t// Extract the base path and the volume unique path.\n\tvar vErr error\n\tconfig.parentDir, config.volumeDir, vErr = hostpath.NewBuilder().WithPath(pOpts.path).\n\t\tWithCheckf(hostpath.IsNonRoot(), \"volume directory {%v} should not be under root directory\", pOpts.path).\n\t\tExtractSubPath()\n\tif vErr != nil {\n\t\treturn vErr\n\t}\n\n\tiPod, err := p.launchPod(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := p.exitPod(iPod); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4a7173c698cd17a27af1c35058f63331", "score": "0.4560485", "text": "func IsInGitHubKubernetesVersions(ver string) (bool, error) {\n\tghc := github.NewClient(nil)\n\n\t_, resp, err := ghc.Repositories.GetReleaseByTag(context.Background(), \"kubernetes\", \"kubernetes\", ver)\n\tif err != nil {\n\t\tif resp != nil && resp.StatusCode == http.StatusNotFound {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "dc9cbed2b6b50b72bee4e155a2fe5bfd", "score": "0.4560234", "text": "func checkIfGitRepo() bool {\n\tif _, err := os.Stat(\".git\"); err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "9d635d3d223d720e0071115bcd585862", "score": "0.45502573", "text": "func TestPrivateGitRepo(t *testing.T) {\n\t// add the hack path which has the git-ask-pass.sh shell script\n\tosPath := os.Getenv(\"PATH\")\n\thackPath, err := filepath.Abs(\"../../hack\")\n\tassert.NoError(t, err)\n\terr = os.Setenv(\"PATH\", fmt.Sprintf(\"%s:%s\", osPath, hackPath))\n\tassert.NoError(t, err)\n\tdefer func() { _ = os.Setenv(\"PATH\", osPath) }()\n\n\tdirName, err := ioutil.TempDir(\"\", \"git-client-test-\")\n\tassert.NoError(t, err)\n\tdefer func() { _ = os.RemoveAll(dirName) }()\n\n\tclnt, err := NewFactory().NewClient(PrivateGitRepo, dirName, PrivateGitUsername, PrivateGitPassword, \"\", false)\n\tassert.NoError(t, err)\n\n\ttestGitClient(t, clnt)\n}", "title": "" }, { "docid": "44a4164ea4521393708249c405f94b44", "score": "0.4545802", "text": "func (o *StoragePureArrayUtilization) HasVolume() bool {\n\tif o != nil && o.Volume != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2f91a4feb8ccdeae3d7316f34cc635ea", "score": "0.45381638", "text": "func (m *MockZapiClientInterface) VolumeCreate(arg0 context.Context, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 string, arg11 api.QosPolicyGroup, arg12 *bool, arg13 int, arg14 bool) (*azgo.VolumeCreateResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VolumeCreate\", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14)\n\tret0, _ := ret[0].(*azgo.VolumeCreateResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7f9f991e5a3119c07611e5e0cd7cea71", "score": "0.45379415", "text": "func (GitRepository) Detect() (bool, error) {\n\t_, err := os.Stat(\".git\")\n\tswitch {\n\tcase err == nil:\n\t\treturn true, nil\n\tcase os.IsNotExist(err):\n\t\treturn false, nil\n\tdefault:\n\t\treturn false, errors.Wrap(err, \"could not determine if .git directory exists\")\n\t}\n}", "title": "" }, { "docid": "137d97184f6f5a3dfdd5f51b753703c1", "score": "0.45307115", "text": "func AddIndependentPropertyGeneratorsForGitRepoVolume_STATUS(gens map[string]gopter.Gen) {\n\tgens[\"Directory\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Repository\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Revision\"] = gen.PtrOf(gen.AlphaString())\n}", "title": "" }, { "docid": "5170b9db4e2e444c4a02e01a2894ef59", "score": "0.45226857", "text": "func (r *BenchmarkReconciler) volInSpec(vols []corev1.Volume, name string) bool {\n\tfor _, v := range vols {\n\t\tif v.Name == name {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c540e37dd8033d6c8fb2356af3ebc89e", "score": "0.4522028", "text": "func (ic *ContainerEngine) VolumeExists(ctx context.Context, nameOrID string) (*entities.BoolReport, error) {\n\texists, err := volumes.Exists(ic.ClientCtx, nameOrID, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &entities.BoolReport{\n\t\tValue: exists,\n\t}, nil\n}", "title": "" }, { "docid": "d79a04bbec5cc09abec541a2641937df", "score": "0.4521084", "text": "func TestNoTagsNoSnapshot(t *testing.T) {\n\tassert := assert.New(t)\n\t_, back := testlib.Mktmp(t)\n\tdefer back()\n\ttestlib.GitInit(t)\n\ttestlib.GitCommit(t, \"first\")\n\tvar ctx = &context.Context{\n\t\tConfig: config.Project{\n\t\t\tSnapshot: config.Snapshot{\n\t\t\t\tNameTemplate: defaults.SnapshotNameTemplate,\n\t\t\t},\n\t\t},\n\t\tSnapshot: false,\n\t\tPublish: false,\n\t}\n\tassert.Error(Pipe{}.Run(ctx))\n}", "title": "" }, { "docid": "4fc31cc950c3e1abdb90e3d702a48027", "score": "0.4507829", "text": "func (m *MockClient) CreateVolume(ctx context.Context, createParams *gopowerstore.VolumeCreate) (gopowerstore.CreateResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateVolume\", ctx, createParams)\n\tret0, _ := ret[0].(gopowerstore.CreateResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0dedf058e954b5bef7a3b7ce85a7d54d", "score": "0.45037374", "text": "func CreateVolumeMocked(t *testing.T, volumeIn *types.Volume) *types.Volume {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewVolumeService(cs)\n\tassert.Nil(err, \"Couldn't load volume service\")\n\tassert.NotNil(ds, \"Volume service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*volumeIn)\n\tassert.Nil(err, \"Volume test data corrupted\")\n\n\t// to json\n\tdOut, err := json.Marshal(volumeIn)\n\tassert.Nil(err, \"Volume test data corrupted\")\n\n\t// call service\n\tcs.On(\"Post\", \"/storage/volumes/\", mapIn).Return(dOut, 200, nil)\n\tvolumeOut, err := ds.CreateVolume(mapIn)\n\tassert.Nil(err, \"Error creating volume list\")\n\tassert.Equal(volumeIn, volumeOut, \"CreateVolume returned different volumes\")\n\n\treturn volumeOut\n}", "title": "" }, { "docid": "a7e9b901ee2cf26eb5c324f578420df1", "score": "0.44978014", "text": "func getVersionFromGit(repodir string) string {\n\tcmd := exec.Command(\"git\", \"describe\",\n\t\t\"--long\", \"--tags\", \"--dirty\", \"--always\")\n\tcmd.Dir = repodir\n\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"git describe returned error: %v\\n\", err))\n\t}\n\n\treturn strings.TrimSpace(string(out))\n}", "title": "" }, { "docid": "2be53f568a53ead89831568eeeea3725", "score": "0.4488381", "text": "func (in *GitRepoVolume) DeepCopy() *GitRepoVolume {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitRepoVolume)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
07a89d2ee30658015f606f990badc3a1
UpdateBlog edit uur blogs
[ { "docid": "fc31100209c9e8b1a0ca07cfaf5a60c2", "score": "0.8019947", "text": "func UpdateBlog(w http.ResponseWriter, r *http.Request) {\n\n\tvar obj models.Blog\n\n\tdb := db.DbConn()\n\tif r.Method == \"POST\" {\n\t\ttitle := r.FormValue(\"title\")\n\t\ttext := r.FormValue(\"text\")\n\t\tnID := r.FormValue(\"id\")\n\t\tid, err := strconv.Atoi(nID)\n\t\tinsForm, err := db.Prepare(\"UPDATE blogs SET title=?, text=? WHERE id=?\")\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tinsForm.Exec(title, text, id)\n\t\tobj = models.Blog{\n\t\t\tID: id,\n\t\t\tTitle: title,\n\t\t\tText: text,\n\t\t}\n\t}\n\tdefer db.Close()\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\n\td, err := json.Marshal(obj)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tw.Write(d)\n\n}", "title": "" } ]
[ { "docid": "206a065098a51f8ef3904d5765001ee7", "score": "0.82963496", "text": "func EditBlog(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPut {\n\t\twriteErr(w, 404, fmt.Errorf(\"%v request to %v not found\", r.Method, r.URL.Path))\n\t\treturn\n\t}\n\n\t// retrieving id from query string\n\tid := r.URL.Query().Get(\"id\")\n\tif len(id) == 0 {\n\t\twriteErr(w, http.StatusBadRequest, fmt.Errorf(\"no blog-id provided\"))\n\t\treturn\n\t}\n\n\t// reading request body\n\tvar body map[string]interface{} // because cannot use b (type db.Blog) as type bson.M in argument to bl.Update\n\tdecoder := json.NewDecoder(r.Body)\n\terr := decoder.Decode(&body)\n\tif err != nil {\n\t\twriteErr(w, 500, err)\n\t\treturn\n\t}\n\n\t// editing document\n\tvar b db.Blog\n\terr = b.Update(bson.M{\"_id\": bson.ObjectIdHex(id)}, body) // Update Document in Database\n\tif err != nil {\n\t\twriteErr(w, 422, err)\n\t\treturn\n\t}\n\n\twriteJSON(w, b) // Write Data\n}", "title": "" }, { "docid": "d579d598ffbb9f19782a8fbd9210cc34", "score": "0.7465253", "text": "func Edit(r *http.Request) error {\n\t// Getting the JSON sent from Frontend\n\t// And then decoding the JSON to Blog Struct\n\tvar b Blogs\n\tjson.NewDecoder(r.Body).Decode(&b)\n\t// Show the result\n\tfmt.Printf(\"%v \\n\", b)\n\n\t// Adding the JSON / Blog Struct to RethingDB\n\t// TODO Add Validation\n\tresp, err := rethink.DB(\"api\").Table(\"blogs\").Get(b.ID).Update(Blogs{\n\t\tID: b.ID,\n\t\tBlog: Blog{\n\t\t\tAuthor: b.Author,\n\t\t\tTitle: b.Title,\n\t\t\tContent: b.Content,\n\t\t}}).RunWrite(db.Session)\n\tif err != nil {\n\t\tlog.Println(\"coult NOT Edit to Database\")\n\t}\n\t// Will print 1 row replaced\n\tfmt.Printf(\"%d row replaced \\n\", resp.Replaced)\n\n\treturn err\n}", "title": "" }, { "docid": "2cb6ef49a13093c5bb8693be7eeeb6db", "score": "0.71483535", "text": "func (*Server) UpdateBlog(ctx context.Context, r *blog.UpdateBlogRequest) (*blog.UpdateBlogResponse, error) {\n\tvar newBlog models.Blog\n\tcopier.Copy(&newBlog, r)\n\tif err := models.UpdateBlog(newBlog, r.ID); err != nil {\n\t\tplugins.LogError(\"API Service\", \"Error at: UpdateBlog\", err)\n\t\treturn &blog.UpdateBlogResponse{}, err\n\t}\n\treturn &blog.UpdateBlogResponse{\n\t\tMessage: \"Blog Updated successfully\",\n\t}, nil\n}", "title": "" }, { "docid": "1b42417a3b5b66e9f75676dc96e9358c", "score": "0.7012975", "text": "func handleUpdateBlogPost(w http.ResponseWriter, req *http.Request) {\n\tif !checkBasicAuth(w, req) {\n\t\treturn\n\t}\n\n\tvars := mux.Vars(req)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\n\tif err != nil {\n\t\trenderer.JSON(w, 400, \"Invalid article request\")\n\t\treturn\n\t}\n\n\tpost, _ := getBlogPost(id)\n\n\tcontent, err := processFileUpload(w, req)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpost.Body = content\n\tupdateBlogPost(id, post)\n}", "title": "" }, { "docid": "6aef702c43410c89a2796950981fc270", "score": "0.68830454", "text": "func (s *Service) UpdateBlog(ctx context.Context, req *pb.UpdateBlogRequest) (*pb.UpdateBlogResponse, error) {\n\tfmt.Println(\"UpdateBlog rpc server\")\n\n\tblog := req.GetBlog()\n\tobjId, err := primitive.ObjectIDFromHex(blog.GetId())\n\tif err != nil {\n\t\treturn nil, status.Errorf(\n\t\t\tcodes.InvalidArgument,\n\t\t\tfmt.Sprintf(\"Cannot parse Id\"),\n\t\t)\n\t}\n\n\tdata := &blogItem{}\n\tfilter := bson.M{\"_id\": objId}\n\tcoll := s.Mongo.Database(s.Mongo.DBName).Collection(s.Mongo.Collection)\n\tres := coll.FindOne(ctx, filter)\n\tif err := res.Decode(data); err != nil {\n\t\treturn nil, status.Errorf(\n\t\t\tcodes.NotFound, // grpc not found error\n\t\t\tfmt.Sprintf(\"Cannot find blog with specified ID %v\", err),\n\t\t)\n\t} // pass value from res to data\n\n\tdata.AuthorID = blog.GetAuthorId()\n\tdata.Title = blog.GetTitle()\n\tdata.Content = blog.GetContent()\n\n\t_, errUpdt := coll.ReplaceOne(context.Background(), filter, data)\n\tif errUpdt != nil {\n\t\treturn nil, status.Errorf(\n\t\t\tcodes.Internal,\n\t\t\tfmt.Sprintf(\"Cannot replace blog with specified ID %v\", errUpdt),\n\t\t)\n\t}\n\treturn &pb.UpdateBlogResponse{\n\t\tBlog: &pb.Blog{\n\t\t\tId: data.AuthorID,\n\t\t\tAuthorId: data.AuthorID,\n\t\t\tContent: data.Content,\n\t\t\tTitle: data.Title,\n\t\t},\n\t}, nil\n\n}", "title": "" }, { "docid": "1b0fbc596f6ab843697620e66049ddc3", "score": "0.680052", "text": "func (s server) UpdateBlog(ctx context.Context, req *blogpb.UpdateBlogRequest) (*blogpb.UpdateBlogResponse, error) {\n\tfmt.Println(\"Update blog request\")\n\tblog := req.Blog\n\tfmt.Printf(\"Update blog request blog id passed is %v\\n\", blog.Id)\n\toid, err := primitive.ObjectIDFromHex(blog.Id)\n\tif err != nil {\n\t\treturn nil, status.Errorf(\n\t\t\tcodes.InvalidArgument,\n\t\t\t\"Cannot parse blog id\")\n\t}\n\n\t// find the document for which the _id field matches id and set the email to \"newemail@example.com\"\n\t// specify the Upsert option to insert a new document if a document matching the filter isn't found\n\topts := options.Update().SetUpsert(true)\n\tfilter := bson.M{\"_id\": oid}\n\n\tfmt.Println(\"Trying to use blog item directly instead of bson.M since like map and update is interface{}\")\n\tupdate := bson.M{\n\t\t\"$set\": blogItem{\n\t\t\tAuthorID: blog.AuthorId,\n\t\t\tTitle: blog.Title,\n\t\t\tContent: blog.Content,\n\t\t},\n\t}\n\t// update := bson.M{\n\t// \t\"$set\": bson.M{\"author_id\": blog.AuthorId,\n\t// \t\t\"title\": blog.Title,\n\t// \t\t\"content\": blog.Content,\n\t// \t},\n\t// }\n\n\tuResult, err := s.collection.UpdateOne(ctx, filter, update, opts)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf(\"Cannot update for blog %v due to error %v\\n\", blog, err))\n\t}\n\tif uResult.MatchedCount == 0 {\n\t\treturn nil, status.Errorf(codes.NotFound, fmt.Sprintf(\"Cannot find blog with specified ID: %v\", blog.Id))\n\t}\n\tif uResult.UpsertedCount != 0 {\n\t\tlog.Printf(\"inserted a new document with ID %v\\n\", uResult.UpsertedID)\n\t}\n\n\t// read saved document\n\tvar bi blogItem\n\tbi, err = findOneBlog(ctx, s.collection, bi, oid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Printf(\"Updateblog from reading Found bi %v\\n\", bi)\n\tue := blogpb.UpdateBlogResponse{Blog: blogItemToBlogPb(&bi)}\n\treturn &ue, nil\n}", "title": "" }, { "docid": "273127a934bd2b2448ee3723ae38c7b4", "score": "0.672668", "text": "func (co *PlatformAppContent) UpdateBlog(ID string, body BlogRequest) (BlogSchema, error) {\n var (\n rawRequest *RawRequest\n response []byte\n err error\n updateBlogResponse BlogSchema\n\t )\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n \n \n \n \n \n //Parse req body to map\n var reqBody map[string]interface{}\n reqBodyJSON, err := json.Marshal(body)\n if err != nil {\n \n return BlogSchema{}, common.NewFDKError(err.Error())\n }\n err = json.Unmarshal([]byte(reqBodyJSON), &reqBody)\n if err != nil {\n \n return BlogSchema{}, common.NewFDKError(err.Error()) \n }\n \n //API call\n rawRequest = NewRequest(\n co.config,\n \"put\",\n fmt.Sprintf(\"/service/platform/content/v1.0/company/%s/application/%s/blogs/%s\",co.CompanyID, co.ApplicationID, ID),\n nil,\n nil,\n reqBody)\n response, err = rawRequest.Execute()\n if err != nil {\n return BlogSchema{}, err\n\t }\n \n err = json.Unmarshal(response, &updateBlogResponse)\n if err != nil {\n return BlogSchema{}, common.NewFDKError(err.Error())\n }\n return updateBlogResponse, nil\n \n }", "title": "" }, { "docid": "a2a908adb0ce4956851c2b5876088cd2", "score": "0.6678367", "text": "func (b *Blog) Update(ctx echo.Context) error {\n\t// parse the ID from the URL parameter\n\tid, err := strconv.ParseUint(ctx.Param(\"id\"), 10, 64)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"could not parse blog post ID\")\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, err.Error())\n\t}\n\tvar post model.BlogPost\n\n\terr = ctx.Bind(&post)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"could not parse blog post from request body\")\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, err.Error())\n\t}\n\n\tvalidate := v.New()\n\terr = validate.Struct(post)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusUnprocessableEntity, err.Error())\n\t}\n\n\tpost.ID = uint(id)\n\terr = b.posts.Update(&post)\n\tif errors.Cause(err) == errortype.ErrNotFound {\n\t\treturn echo.NewHTTPError(http.StatusNotFound, errors.Wrapf(err, \"blog post id %d\", id).Error())\n\t}\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, err.Error())\n\t}\n\treturn ctx.NoContent(http.StatusNoContent)\n}", "title": "" }, { "docid": "72825005d245a52cbeb10e729d440e1a", "score": "0.66403", "text": "func EditPost(req *http.Request, params martini.Params, res render.Render, db *gorm.DB, s sessions.Session) {\n\tvar post Post\n\tpost.Slug = params[\"slug\"]\n\tpost, err := post.Get(db)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\treturn\n\t}\n\tres.HTML(200, \"post/edit\", Page{Session: s, Data: post})\n}", "title": "" }, { "docid": "36c65492643d313d5fe8209b2b82361c", "score": "0.6623125", "text": "func Edit(w http.ResponseWriter, r *http.Request) {\n\tdb := dbConn()\n\tvars := mux.Vars(r)\n\tnId := vars[\"id\"]\n\tselDB, err := db.Query(\"SELECT * FROM Posts WHERE id=?\", nId)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tpost := Post{}\n\tfor selDB.Next() {\n\t\tvar id, crass, pithy int\n\t\tvar title, body, tags, url, author string\n\t\terr = selDB.Scan(&id, &title, &body, &tags, &url, &crass, &pithy, &author)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tpost.Id = id\n\t\tpost.Title = title\n\t\tpost.Body = body\n\t\tpost.Tags = tags\n\t\tpost.Url = url\n\t\tpost.Crass = crass\n\t\tpost.Pithy = pithy\n\t\tpost.Author = author\n\t\tpost.Bgc = \"#eeeecc\"\n\n\t\tif _, err := os.Stat(\"./images/\" + strconv.Itoa(id) + \".jpg\"); !os.IsNotExist(err) {\n\t\t\tpost.Image = true\n\t\t}\n\t}\n\tvar splits = strings.Split(BuildTags(false), \",\")\n\tpost.Tlu = `<SELECT onchange=\"copyTag();\" NAME=\"myTags\">`\n\tfor _, value := range splits {\n\t\tpost.Tlu = post.Tlu + `<OPTION VALUE=\"` + value + `\">` + value\n\t}\n\tpost.Tlu = post.Tlu + `</SELECT>`\n\ttmpl.ExecuteTemplate(w, \"Edit\", post)\n\ttmpl.ExecuteTemplate(w, \"Footer\", BuildTags(true))\n\tdefer db.Close()\n}", "title": "" }, { "docid": "f51521c914e516238e4f2472b4151021", "score": "0.6540993", "text": "func TestUpdateBlog(t *testing.T) {\n\tif blogId != \"\" {\n\t\terr, rec := updateBlogForTest(\"\", blogId)\n\t\tif assert.NoError(t, err) {\n\t\t\tassert.Equal(t, http.StatusOK, rec.Code)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d63854bdcc9c004bb212a0d8a724d1cc", "score": "0.6498497", "text": "func UpdateBlogUsers(c *gin.Context) {\n\tlogEntry := utils.Log().WithFields(utils.Fields{\"url\": c.Request.URL,\n\t\t\"Method\": c.Request.Method})\n\tlogEntry.Debug(\"Update request received.\")\n\n\tcontentType := c.Request.Header.Get(\"Content-type\")\n\tif contentType, _, err := mime.ParseMediaType(contentType); contentType != \"application/json\" || err != nil {\n\t\tlogEntry.Errorf(\"Unsupported content type : %s\", contentType)\n\t\tc.JSON(http.StatusUnsupportedMediaType, restimpl.Error{Code: \"415\", Message: contentType})\n\t\treturn\n\t}\n\n\tid := c.Param(\"id\")\n\tif id, err := uuid.FromString(id); err != nil {\n\t\tlogEntry.Errorf(\"Invalid UUID: %s\", id.String())\n\t\tc.JSON(http.StatusBadRequest, restimpl.Error{Code: \"400\", Message: err.Error()})\n\t\treturn\n\t}\n\n\tvar blogUser restimpl.BlogUser\n\terr := c.BindJSON(&blogUser)\n\tif err != nil {\n\t\tlogEntry.Errorf(\"Json parsing error %v\", err)\n\t\tc.JSON(http.StatusBadRequest, restimpl.Error{Code: \"400\", Message: err.Error()})\n\t\treturn\n\t}\n\n\t//update the time in UTC\n\tblogUser.LastModifiedDate = time.Now().UTC()\n\tblogUser.Id = id\n\n\tblogCollection, ctx := utils.GetUserCollection()\n\tisDone, err := deleteUserById(id, logEntry)\n\tif isDone == false {\n\t\tlogEntry.Errorf(\"Delete user failed\")\n\t\tc.JSON(http.StatusInternalServerError, restimpl.Error{Code: \"500\",\n\t\t\tMessage: fmt.Sprintf(\"Delete user with id: %s failed\", id)})\n\t}\n\n\tdoc, err := blogCollection.InsertOne(ctx, blogUser)\n\tif err != nil {\n\t\tlogEntry.Errorf(\"Insert failed %v\", err)\n\t}\n\n\tlogEntry.Infof(\"Document created %v doc: %v\", doc.InsertedID, doc)\n\n\tuser, err := getBlogUserByid(blogUser.Id, logEntry)\n\tif err != nil {\n\t\tlogEntry.Errorf(\"Retrieval failed!\")\n\t\tc.JSON(http.StatusInternalServerError, restimpl.Error{Code: \"500\", Message: err.Error()})\n\t\treturn\n\t}\n\n\tlogEntry.Infof(\"blogUser with id: %s updated!\", blogUser.Id)\n\tc.JSON(http.StatusOK, user)\n\treturn\n}", "title": "" }, { "docid": "d06ea2afbf51a1e3c680d3fb30676615", "score": "0.64874125", "text": "func (s *BlogServiceOp) Update(blog Blog) (*Blog, error) {\n\tpath := fmt.Sprintf(\"%s/%d.json\", blogsBasePath, blog.ID)\n\twrappedData := BlogResource{Blog: &blog}\n\tresource := new(BlogResource)\n\terr := s.client.Put(path, wrappedData, resource)\n\treturn resource.Blog, err\n}", "title": "" }, { "docid": "1d4275daee7836ab0b645ab1b5efd042", "score": "0.64724284", "text": "func doUpdateBlog(c blogpb.BlogServiceClient) {\n\tfmt.Println(\"Updating a Blog\")\n\treq := &blogpb.UpdateBlogRequest{\n\t\tBlog: &blogpb.Blog{\n\t\t\tId: \"5eb9309c7ade23cccb8c797f\",\n\t\t\tAuthorId: \"Ronald\",\n\t\t\tContent: \"This is to test my updated blog\",\n\t\t\tTitle: \"I Updated My Blog\",\n\t\t},\n\t}\n\tres, rErr := c.UpdateBlog(context.Background(), req)\n\tif rErr != nil {\n\t\tlog.Fatalf(\"A server error has accured: %v\\n\", rErr)\n\t\treturn\n\t}\n\tfmt.Printf(\"blog %v updated\\n\", res.GetBlog())\n}", "title": "" }, { "docid": "8421351578453ac65e08c88bbfc38462", "score": "0.6409861", "text": "func Update(response http.ResponseWriter, request *http.Request) {\n\tswitch request.Method {\n\tcase \"GET\":\n\t\tuserName := blogpost.GetUserName(request)\n\t\tuser, err := model.GetUser(userName)\n\t\tif err != nil {\n\t\t\tfmt.Fprint(response, `<p>You are not Logged in, Click <a href=\"/login\">Here</a> to Log in </p>`)\n\t\t\treturn\n\t\t}\n\n\t\tif user.LoginState {\n\t\t\tpostslug := request.URL.Query().Get(\"postslug\")\n\t\t\taction := request.URL.Query().Get(\"action\")\n\t\t\tswitch action {\n\t\t\tcase \"postedit\":\n\t\t\t\tpost, err := model.GetPost(postslug)\n\t\t\t\tcategories := model.GetCategories()\n\t\t\t\tif err != nil {\n\t\t\t\t\ttmp, _ := template.ParseFiles(\"view/404.gohtml\")\n\t\t\t\t\ttmp.Execute(response, nil)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ttype detail struct {\n\t\t\t\t\tProfile model.User\n\t\t\t\t\tPost model.Post\n\t\t\t\t\tCategories []model.Category\n\t\t\t\t}\n\n\t\t\t\tdetails := detail{\n\t\t\t\t\tProfile: user,\n\t\t\t\t\tPost: post,\n\t\t\t\t\tCategories: categories,\n\t\t\t\t}\n\n\t\t\t\ttmp, err := template.ParseFiles(\n\t\t\t\t\t\"admin/template/editortemplate.gohtml\",\n\t\t\t\t\t\"admin/template/sidebar.gohtml\",\n\t\t\t\t\t\"admin/template/header.gohtml\",\n\t\t\t\t\t\"admin/template/editorfooter.gohtml\",\n\t\t\t\t\t\"admin/updatepost.gohtml\",\n\t\t\t\t)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\tfmt.Fprintln(response, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\ttmp.ExecuteTemplate(response, \"layout\", details)\n\t\t\t\treturn\n\n\t\t\tcase \"categoryedit\":\n\t\t\t\tcategory, err := model.GetCategoryBySlug(postslug)\n\t\t\t\tif err != nil {\n\t\t\t\t\ttmp, _ := template.ParseFiles(\"view/404.gohtml\")\n\t\t\t\t\ttmp.Execute(response, nil)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ttype detail struct {\n\t\t\t\t\tProfile model.User\n\t\t\t\t\tCategory model.Category\n\t\t\t\t}\n\n\t\t\t\tdetails := &detail{\n\t\t\t\t\tProfile: user,\n\t\t\t\t\tCategory: *category,\n\t\t\t\t}\n\n\t\t\t\ttmp, _ := template.ParseFiles(\n\t\t\t\t\t\"admin/template/editortemplate.gohtml\",\n\t\t\t\t\t\"admin/template/sidebar.gohtml\",\n\t\t\t\t\t\"admin/template/header.gohtml\",\n\t\t\t\t\t\"admin/template/editorfooter.gohtml\",\n\t\t\t\t\t\"admin/updatecategory.gohtml\",\n\t\t\t\t)\n\t\t\t\ttmp.ExecuteTemplate(response, \"layout\", details)\n\t\t\t\treturn\n\n\t\t\tcase \"pageedit\":\n\t\t\t\tpage, err := model.GetPage(postslug)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\ttmp, _ := template.ParseFiles(\"view/404.gohtml\")\n\t\t\t\t\ttmp.Execute(response, nil)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\ttype detail struct {\n\t\t\t\t\tProfile model.User\n\t\t\t\t\tPage model.Page\n\t\t\t\t}\n\n\t\t\t\tdetails := &detail{\n\t\t\t\t\tProfile: user,\n\t\t\t\t\tPage: page,\n\t\t\t\t}\n\n\t\t\t\ttmp, err := template.ParseFiles(\n\t\t\t\t\t\"admin/template/editortemplate.gohtml\",\n\t\t\t\t\t\"admin/template/sidebar.gohtml\",\n\t\t\t\t\t\"admin/template/header.gohtml\",\n\t\t\t\t\t\"admin/template/editorfooter.gohtml\",\n\t\t\t\t\t\"admin/updatepage.gohtml\",\n\t\t\t\t)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Print(err)\n\t\t\t\t\thttp.Error(response, \"internal server error\", http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\ttmp.ExecuteTemplate(response, \"layout\", details)\n\t\t\t\treturn\n\n\t\t\tdefault:\n\t\t\t\tfmt.Fprintln(response, \"Not found and Not recognized\")\n\t\t\t}\n\t\t} else {\n\n\t\t\thttp.Redirect(response, request, \"/login\", http.StatusContinue)\n\n\t\t}\n\n\tcase \"POST\":\n\t\tuserName := blogpost.GetUserName(request)\n\t\tuser, err := model.GetUser(userName)\n\t\tif err != nil {\n\t\t\tfmt.Fprint(response, `<p>You are not Logged in, Click <a href=\"/login\">Here</a> to Log in </p>`)\n\t\t\treturn\n\t\t}\n\t\tif user.LoginState {\n\t\t\trequest.ParseMultipartForm(100000)\n\t\t\tupdatetype := request.FormValue(\"updatetype\")\n\t\t\tswitch updatetype {\n\t\t\tcase \"postupdate\":\n\t\t\t\tTitle := request.FormValue(\"title\")\n\t\t\t\tpostID, _ := primitive.ObjectIDFromHex(request.FormValue(\"postId\"))\n\t\t\t\tRawcontent := request.FormValue(\"content\")\n\t\t\t\tAuthor := request.FormValue(\"author\")\n\t\t\t\tCategory := request.FormValue(\"category\")\n\t\t\t\tDatePublished, err := time.Parse(\"Jan 02, 2006 3:04 PM\", request.FormValue(\"datepublished\"))\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t}\n\n\t\t\t\tDateModified := time.Now()\n\t\t\t\tTags := request.FormValue(\"tags\")\n\t\t\t\tSlug := request.FormValue(\"slug\")\n\t\t\t\tPostDescription := request.FormValue(\"postdescription\")\n\t\t\t\tFeaturedImage, header, err := request.FormFile(\"featuredImage\")\n\n\t\t\t\tvar im image.Config\n\t\t\t\tvar featuredimage string\n\t\t\t\tif err != nil {\n\t\t\t\t\tfeaturedimage = request.FormValue(\"featuredimage\")\n\t\t\t\t} else {\n\t\t\t\t\tim, _ = save.SaveImage(FeaturedImage, header)\n\t\t\t\t\tfeaturedimage = header.Filename\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Println(err)\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tRawContent := template.HTML(Rawcontent)\n\t\t\t\tSlug = strings.ToLower(strings.Replace(Slug, \" \", \"-\", -1))\n\t\t\t\t//estimating read time\n\t\t\t\testimation := readingtime.Estimate(Rawcontent)\n\t\t\t\tReadTime := estimation.Text\n\n\t\t\t\tpost := model.Post{\n\t\t\t\t\tID: postID,\n\t\t\t\t\tTitle: Title,\n\t\t\t\t\tSlug: Slug,\n\t\t\t\t\tRawContent: RawContent,\n\t\t\t\t\tCategory: Category,\n\t\t\t\t\tAuthor: Author,\n\t\t\t\t\tFeaturedImage: featuredimage,\n\t\t\t\t\tImageWidth: im.Width,\n\t\t\t\t\tImageHeight: im.Height,\n\t\t\t\t\tPostDescription: PostDescription,\n\t\t\t\t\tReadTime: ReadTime,\n\t\t\t\t\tTags: Tags,\n\t\t\t\t\tDatePublished: DatePublished,\n\t\t\t\t\tDateModified: DateModified,\n\t\t\t\t}\n\n\t\t\t\tmodel.UpdatePost(postID, post)\n\n\t\t\t\thttp.Redirect(response, request, \"/admin/all-post\", http.StatusFound)\n\n\t\t\t\treturn\n\t\t\tcase \"pageupdate\":\n\t\t\t\trequest.ParseMultipartForm(100000)\n\n\t\t\t\tTitle := request.FormValue(\"title\")\n\t\t\t\tpageID, _ := primitive.ObjectIDFromHex(request.FormValue(\"pageId\"))\n\t\t\t\tRawcontent := request.FormValue(\"content\")\n\t\t\t\tAuthor := request.FormValue(\"author\")\n\t\t\t\tDatePublished, err := time.Parse(\"Jan 02, 2006 3:04 PM\", request.FormValue(\"datepublished\"))\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t}\n\n\t\t\t\tDateModified := time.Now()\n\t\t\t\tTags := request.FormValue(\"tags\")\n\t\t\t\tSlug := request.FormValue(\"slug\")\n\t\t\t\tPageDescription := request.FormValue(\"pagedescription\")\n\n\t\t\t\t//estimating read time\n\t\t\t\testimation := readingtime.Estimate(Rawcontent)\n\t\t\t\tfmt.Println(estimation.Text) // \"1 min read\"\n\t\t\t\tfmt.Println(estimation.Duration) // 1 min\n\t\t\t\tfmt.Println(estimation.Words) // amount (500)\n\t\t\t\tReadTime := estimation.Text\n\n\t\t\t\tRawContent := template.HTML(Rawcontent)\n\t\t\t\tSlug = strings.ToLower(strings.Replace(Slug, \" \", \"-\", -1))\n\n\t\t\t\tpage := model.Page{\n\t\t\t\t\tID: primitive.NewObjectID(),\n\t\t\t\t\tTitle: Title,\n\t\t\t\t\tSlug: Slug,\n\t\t\t\t\tRawContent: RawContent,\n\t\t\t\t\tAuthor: Author,\n\t\t\t\t\tPageDescription: PageDescription,\n\t\t\t\t\tTags: Tags,\n\t\t\t\t\tReadTime: ReadTime,\n\t\t\t\t\tDatePublished: DatePublished,\n\t\t\t\t\tDateModified: DateModified,\n\t\t\t\t}\n\t\t\t\tupdaterr := model.UpdatePage(pageID, page)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Fprint(response, updaterr)\n\t\t\t\t} else {\n\t\t\t\t\thttp.Redirect(response, request, \"/admin/dashboard\", http.StatusFound)\n\t\t\t\t}\n\t\t\tcase \"categoryupdate\":\n\t\t\t\trequest.ParseForm()\n\n\t\t\t\tName := strings.Title(request.FormValue(\"name\"))\n\t\t\t\tAuthor := request.FormValue(\"author\")\n\t\t\t\tDatePublished, _ := time.Parse(\"Jan 02, 2006 at 3:04PM\", request.FormValue(\"datepublished\"))\n\t\t\t\tCategoryId, _ := primitive.ObjectIDFromHex(request.FormValue(\"categoryId\"))\n\t\t\t\tDateModified := time.Now()\n\t\t\t\tSlug := strings.ToLower(strings.Replace(request.FormValue(\"slug\"), \" \", \"-\", -1))\n\t\t\t\tCategoryDescription := strings.TrimSpace(request.FormValue(\"categorydescription\"))\n\n\t\t\t\tCategorydescription := template.HTML(CategoryDescription)\n\t\t\t\tcategory := model.Category{\n\t\t\t\t\tID: CategoryId,\n\t\t\t\t\tName: Name,\n\t\t\t\t\tSlug: Slug,\n\t\t\t\t\tAuthor: Author,\n\t\t\t\t\tCategoryDescription: Categorydescription,\n\t\t\t\t\tDatePublished: DatePublished,\n\t\t\t\t\tDateModified: DateModified,\n\t\t\t\t}\n\n\t\t\t\terr := model.UpdateCategory(CategoryId, category)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Fprint(response, err)\n\t\t\t\t}\n\n\t\t\t\thttp.Redirect(response, request, \"/admin/categories\", http.StatusFound)\n\t\t\t\treturn\n\n\t\t\tdefault:\n\t\t\t\tfmt.Fprint(response, \"Update Not Accepted\")\n\n\t\t\t}\n\t\t} else {\n\t\t\thttp.Redirect(response, request, \"/login\", http.StatusFound)\n\t\t}\n\tdefault:\n\t\thttp.Redirect(response, request, \"/login\", http.StatusForbidden)\n\t}\n}", "title": "" }, { "docid": "966ecb3ec56bb64655e03561b83a690d", "score": "0.6406947", "text": "func PostEdit(c *gin.Context) {\n\tdb := models.GetDB()\n\tpost := models.Post{}\n\tdb.Preload(\"Tags\").First(&post, c.Param(\"id\"))\n\tif post.ID == 0 {\n\t\tc.HTML(http.StatusNotFound, \"errors/404\", nil)\n\t\treturn\n\t}\n\th := DefaultH(c)\n\th[\"Title\"] = \"投稿済コンテンツ編集\"\n\th[\"Post\"] = post\n\th[\"Tags\"] = post.Tags\n\tsession := sessions.Default(c)\n\th[\"Flash\"] = session.Flashes()\n\tsession.Save()\n\tc.HTML(http.StatusOK, \"posts/form\", h)\n}", "title": "" }, { "docid": "d20e91b33d47f32fbeaa6c1f3c986952", "score": "0.6191569", "text": "func Update(w http.ResponseWriter, r *http.Request) {\n\tvar data models.PostEdit // Create struct to store data.\n\terr := json.NewDecoder(r.Body).Decode(&data) // Decode response to struct.\n\tif err != nil {\n\t\thelpers.SuccessResponse(false, w, r)\n\t\thelpers.ThrowErr(w, r, \"JSON decoding error\", err)\n\t\treturn\n\t}\n\n\tif !middleware.AJAX(w, r, models.AJAXData{CsrfSecret: data.CsrfSecret}) {\n\t\t// Failed middleware (invalid credentials)\n\t\thelpers.SuccessResponse(false, w, r)\n\t\treturn\n\t}\n\n\tuuidString := context.Get(r, \"uuid\").(string)\n\tuuid, err := strconv.Atoi(uuidString)\n\tif err != nil {\n\t\thelpers.ThrowErr(w, r, \"Error converting string to int\", err)\n\t\treturn\n\t}\n\n\tuser, err := db.GetUserFromID(uuid)\n\tif err != nil {\n\t\thelpers.ThrowErr(w, r, \"Error getting user from ID\", err)\n\t\treturn\n\t}\n\n\tif user.Priv != models.PrivAdmin && user.Priv != models.PrivSuperAdmin {\n\t\treturn\n\t}\n\n\terr = db.EditPost(data.ID, data.Title, data.Description)\n\tif err != nil {\n\t\thelpers.SuccessResponse(false, w, r)\n\t\thelpers.ThrowErr(w, r, \"Editing menu item error\", err)\n\t\treturn\n\t}\n\n\thelpers.SuccessResponse(true, w, r)\n}", "title": "" }, { "docid": "db9907a7c09c3200c27bec8e51d155df", "score": "0.6078274", "text": "func DeleteBlog(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodDelete {\n\t\twriteErr(w, 404, fmt.Errorf(\"%v request to %v not found\", r.Method, r.URL.Path))\n\t\treturn\n\t}\n\n\t// retrieving id from query string\n\tid := r.URL.Query().Get(\"id\")\n\tif len(id) == 0 {\n\t\twriteErr(w, http.StatusBadRequest, fmt.Errorf(\"no blog-id provided\"))\n\t\treturn\n\t}\n\n\t// editing document to `is_deleted: true`\n\tvar b db.Blog\n\terr := b.Delete(bson.ObjectIdHex(id))\n\tif err != nil {\n\t\twriteErr(w, 422, err)\n\t\treturn\n\t}\n\n\t// writing the updated data\n\twriteJSON(w, b)\n}", "title": "" }, { "docid": "a42df546d2e2abcb461560a63eb582e8", "score": "0.59675455", "text": "func UpdatePost(req *http.Request, params martini.Params, s sessions.Session, res render.Render, db *gorm.DB, entry Post) {\n\tvar post Post\n\tpost.Slug = params[\"slug\"]\n\tpost, err := post.Get(db)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tif err.Error() == \"not found\" {\n\t\t\tres.JSON(404, NotFound())\n\t\t\treturn\n\t\t}\n\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\treturn\n\t}\n\n\tvar user User\n\tuser, err = user.Session(db, s)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\treturn\n\t}\n\n\tif post.Author == user.ID {\n\t\tpost, err = post.Update(db, entry)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tres.JSON(401, map[string]interface{}{\"error\": \"Unauthorized\"})\n\t\treturn\n\t}\n\n\tswitch root(req) {\n\tcase \"api\":\n\t\tres.JSON(200, post)\n\t\treturn\n\tcase \"post\":\n\t\tres.Redirect(\"/user\", 302)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "83ff4d4eb4fb82278782b41c820bf341", "score": "0.5823997", "text": "func (p *Posts) Edit(res http.ResponseWriter, req *http.Request) {\n\tpost, err := p.postByID(res, req)\n\tif err != nil {\n\t\t// error handled by postByID\n\t\treturn\n\t}\n\tuser := context.User(req.Context())\n\tif user.IsAdmin != true {\n\t\thttp.Error(res, \"You do not have permission to edit this post\", http.StatusForbidden)\n\t\treturn\n\t}\n\tvar vd views.Data\n\tvd.Yield = post\n\tp.EditView.Render(res, req, vd)\n}", "title": "" }, { "docid": "3590a3a92b6e84baf8f745ad8f45a3ed", "score": "0.5782128", "text": "func httpEditPost(rw http.ResponseWriter, req *http.Request) {\n\tvars := mux.Vars(req)\n\tisAdmin, _ := isAdmin(req)\n\n\t// Retreive post content\n\tthread, post, err := threadPostOrErr(rw, vars[\"thread\"], vars[\"post\"])\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif !isAdmin {\n\t\tif post.ContentType == \"deleted\" || post.ContentType == \"admin-deleted\" || len(post.Author.Nickname) < 1 {\n\t\t\tsendError(rw, 403, \"Forbidden\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tisOp := post.Id == thread.ThreadPost\n\tvar tags string\n\tif isOp {\n\t\ttags = \"#\" + strings.Join(thread.Tags, \" #\")\n\t}\n\n\tsend(rw, req, \"edit\", \"Edit post\", struct {\n\t\tThread string\n\t\tPost string\n\t\tNickname string\n\t\tContent string\n\t\tIsOP bool\n\t\tIsAdmin bool\n\t\tTags string\n\t}{\n\t\tvars[\"thread\"],\n\t\tvars[\"post\"],\n\t\tpost.Author.Nickname,\n\t\tpost.Content,\n\t\tisOp,\n\t\tisAdmin,\n\t\ttags,\n\t})\n}", "title": "" }, { "docid": "39465b44d8a3052237390bf073e08876", "score": "0.5756226", "text": "func (db DesmosDb) EditPost(postID posts.PostID, message string, editDate time.Time) error {\n\tstatement := `UPDATE post SET message = $1, last_edited = $2 WHERE id = $3`\n\t_, err := db.Sql.Exec(statement, message, editDate, postID)\n\treturn err\n}", "title": "" }, { "docid": "212e77700db1ddbf3be5282ac1fea40c", "score": "0.5716782", "text": "func BlogUnActive(blog string){\n\tfmt.Println(blog)\n\tid, _ := primitive.ObjectIDFromHex(blog)\n\tfilter := bson.M{\"_id\":id}\n\tupdate := bson.M{\"$set\":bson.M{\"status\":false}}\n\tresult, err := collection.UpdateOne(context.Background(),filter,update)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"modified count:\",result.ModifiedCount)\n}", "title": "" }, { "docid": "9fdeb45cba001b26379f6f7e2deaa8a8", "score": "0.5709292", "text": "func FeishuHooksEditPost(ctx *context.Context) {\n\teditWebhook(ctx, feishuHookParams(ctx))\n}", "title": "" }, { "docid": "f984c507a3a3aa6325286fd0d6d62036", "score": "0.57025886", "text": "func ArticleAdminUpdatePost(c *gin.Context) {\n\tsession := sessions.Default(c)\n\tdb := models.GetDB()\n\n\tarticle := &models.Article{}\n\tif c.Bind(article) == nil {\n\t\tif err := db.Save(article).Error; err != nil {\n\t\t\tsession.AddFlash(err.Error())\n\t\t\tsession.Save()\n\t\t\tc.Redirect(303, c.Request.RequestURI)\n\t\t\treturn\n\t\t}\n\t\tc.Redirect(303, \"/admin/articles\")\n\t} else {\n\t\tsession.AddFlash(\"Ошибка! Проверьте внимательно заполнение всех полей!\")\n\t\tsession.Save()\n\t\tc.Redirect(303, c.Request.RequestURI)\n\t}\n}", "title": "" }, { "docid": "23de48d5b92e5ac14d65c8eb8ed70952", "score": "0.5701676", "text": "func (t *Tweet) Edit(rw http.ResponseWriter, r *http.Request) {\n\tt.l.Println(\"Handle PUT Tweet\")\n\n\tTweet := r.Context().Value(KeyTweet{}).(*data.Tweet)\n\n\tt.l.Println(\"[DEBUG] Updating record id\", Tweet.TweetID)\n\terr := data.EditTweet(*Tweet)\n\tif err == data.ErrTweetNotFound {\n\t\tt.l.Println(\"[ERROR] tweet not found\", err)\n\t\trw.WriteHeader(http.StatusNotFound)\n\t\tdata.ToJSON(&GenericError{Message: \"Tweet not found in database\"}, rw)\n\t\treturn\n\t}\n\tif err != nil {\n\t\tt.l.Println(\"[ERROR] updating tweet\", err)\n\t\trw.WriteHeader(http.StatusUnprocessableEntity)\n\t\tdata.ToJSON(&GenericError{Message: err.Error()}, rw)\n\t\treturn\n\t}\n\n\trw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "2e2ba73b0a1ca32d1a3ebdeaf6e1100b", "score": "0.5701569", "text": "func (o *Mainblog) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tmainblogUpdateCacheMut.RLock()\n\tcache, cached := mainblogUpdateCache[key]\n\tmainblogUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tmainblogAllColumns,\n\t\t\tmainblogPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update mainblog, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `mainblog` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, mainblogPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(mainblogType, mainblogMapping, append(wl, mainblogPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update mainblog row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for mainblog\")\n\t}\n\n\tif !cached {\n\t\tmainblogUpdateCacheMut.Lock()\n\t\tmainblogUpdateCache[key] = cache\n\t\tmainblogUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "7eaadae5cb11d57fc311ac1abd70f29d", "score": "0.5700931", "text": "func (servidor *Servidor) AlterarPost(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\n\tpid, err := strconv.ParseUint(vars[\"id\"], 10, 64)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tuid, err := auth.ExtrairIDDoToken(r)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(http.StatusText(http.StatusUnauthorized)))\n\t\treturn\n\t}\n\n\tpost := models.Post{}\n\terr = servidor.DB.Debug().Model(models.Post{}).Where(\"id = ?\", pid).Take(&post).Error\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusNotFound, errors.New(\"Post não encontrado\"))\n\t\treturn\n\t}\n\n\tif uid != post.IDDoAutor {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(http.StatusText(http.StatusUnauthorized)))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tpostAlterar := models.Post{}\n\terr = json.Unmarshal(body, &postAlterar)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tif uid != postAlterar.IDDoAutor {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(http.StatusText(http.StatusUnauthorized)))\n\t\treturn\n\t}\n\n\tpostAlterar.Preparar()\n\terr = postAlterar.Validar()\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tpostAlterar.ID = post.ID //this is important to tell the model the post id to update, the other update field are set above\n\n\tpostAlterado, err := postAlterar.AtualizarPost(servidor.DB)\n\n\tif err != nil {\n\t\tformattedError := formaterror.FormatError(err.Error())\n\t\tresponses.ERROR(w, http.StatusInternalServerError, formattedError)\n\t\treturn\n\t}\n\tresponses.JSON(w, http.StatusOK, postAlterado)\n}", "title": "" }, { "docid": "0a8e243dc30d1b86e104417a430ba7a3", "score": "0.56755465", "text": "func EditLink(env *handler.Env, w http.ResponseWriter, r *http.Request) error {\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tdata := make(map[string]interface{})\n\n\tcode := chi.URLParam(r, \"code\")\n\tlink := models.Link{}\n\tresult := env.DB.Where(\"code = ?\", code).Preload(clause.Associations).Find(&link)\n\n\tif result.RowsAffected == 0 {\n\t\treturn handler.StatusError{Code: http.StatusNotFound, Err: errors.New(\"link cannot be found\")}\n\t}\n\n\tif r.Method == http.MethodPost || r.Method == http.MethodPatch {\n\t\tr.ParseForm()\n\t\tif _, ok := r.PostForm[\"delete\"]; ok {\n\t\t\tresult = env.DB.Delete(&link)\n\t\t\tif result.RowsAffected == 0 {\n\t\t\t\tflash.Set(w, r, flash.Message{Message: \"Could not delete the link. It may have already been deleted.\", Style: \"danger\"})\n\t\t\t\thttp.Redirect(w, r, r.Header.Get(\"Referer\"), http.StatusFound)\n\t\t\t} else {\n\t\t\t\tflash.Set(w, r, flash.Message{Message: \"Link deleted. <a href=\\\"\" + helpers.URL(\"admin/links/restore\") + \"\\\">Undo</a>\", Style: \"success\"})\n\t\t\t\thttp.Redirect(w, r, helpers.URL(\"admin/links\"), http.StatusFound)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tif val, ok := r.PostForm[\"title\"]; ok {\n\t\t\tlink.Title = val[0]\n\t\t}\n\t\tif val, ok := r.PostForm[\"link\"]; ok {\n\t\t\tlink.URL = val[0]\n\t\t}\n\t\tif val, ok := r.PostForm[\"author\"]; ok {\n\t\t\tlink.Author = val[0]\n\t\t}\n\t\tif _, ok := r.PostForm[\"publish\"]; ok {\n\t\t\tlink.Published = true\n\t\t} else {\n\t\t\tlink.Published = false\n\t\t}\n\t\tresult = env.DB.Save(&link)\n\t\tif result.RowsAffected == 0 {\n\t\t\tif r.Method == http.MethodPost {\n\t\t\t\tflash.Set(w, r, flash.Message{Message: \"Could not save\", Style: \"danger\"})\n\t\t\t\thttp.Redirect(w, r, r.Header.Get(\"Referer\"), http.StatusFound)\n\t\t\t}\n\t\t\thttp.Error(w, \"could not save link\", http.StatusBadGateway)\n\t\t\treturn nil\n\t\t}\n\t\tif r.Method == http.MethodPost {\n\t\t\tflash.Set(w, r, flash.Message{Message: \"Saved!\", Style: \"success\"})\n\t\t\thttp.Redirect(w, r, r.Header.Get(\"Referer\"), http.StatusFound)\n\t\t}\n\t\treturn nil\n\t}\n\n\tdata[\"page\"] = link\n\tdata[\"title\"] = \"Editing \" + link.Title\n\tdata[\"section\"] = \"links\"\n\n\tdata[\"messages\"] = flash.Get(w, r)\n\n\treturn render(w, data, \"links/edit.html\")\n\n}", "title": "" }, { "docid": "53ee70ae05d0d4da23a0ea43c24e4114", "score": "0.5674221", "text": "func Edit(w http.ResponseWriter, r *http.Request) {\n\tidDoProduto := r.URL.Query().Get(\"id\")\n\tproduto := models.EditaProduto(idDoProduto)\n\ttemp.ExecuteTemplate(w, \"Edit\", produto)\n}", "title": "" }, { "docid": "67eebf7bf1425cc014657cef80ea2e74", "score": "0.5672004", "text": "func PostUpdate(c *gin.Context) {\n\tdb := models.GetDB()\n\tpost := models.Post{}\n\tif err := c.ShouldBind(&post); err != nil {\n\t\tsession := sessions.Default(c)\n\t\tsession.AddFlash(err.Error())\n\t\tsession.Save()\n\t\tlogrus.Error(err)\n\t\tc.Redirect(http.StatusSeeOther, fmt.Sprintf(\"/admin/posts/%s/edit\", c.Param(\"id\")))\n\t\treturn\n\t}\n\ttags := make([]models.Tag, 0, len(post.FormTags))\n\tfor i := range post.FormTags {\n\t\ttags = append(tags, models.Tag{Title: post.FormTags[i]})\n\t}\n\tpost.Tags = tags\n\n\tif err := db.Save(&post).Error; err != nil {\n\t\tc.HTML(http.StatusInternalServerError, \"errors/500\", nil)\n\t\tlogrus.Error(err)\n\t\treturn\n\t}\n\tif err := db.Exec(\"DELETE FROM posts_tags WHERE post_id = ? AND tag_title NOT IN(?)\", post.ID, post.FormTags).Error; err != nil {\n\t\tc.HTML(http.StatusInternalServerError, \"errors/500\", nil)\n\t\tlogrus.Error(err)\n\t\treturn\n\t}\n\tc.Redirect(http.StatusFound, \"/admin/posts\")\n}", "title": "" }, { "docid": "55f2632bc872d4bda677142fc2717304", "score": "0.56716377", "text": "func (bpu *BlogPostUpdate) Save(ctx context.Context) (int, error) {\n\tif v, ok := bpu.mutation.Head(); ok {\n\t\tif err := blogpost.HeadValidator(v); err != nil {\n\t\t\treturn 0, &ValidationError{Name: \"head\", err: fmt.Errorf(\"ent: validator failed for field \\\"head\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := bpu.mutation.Body(); ok {\n\t\tif err := blogpost.BodyValidator(v); err != nil {\n\t\t\treturn 0, &ValidationError{Name: \"body\", err: fmt.Errorf(\"ent: validator failed for field \\\"body\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := bpu.mutation.UpdateTime(); !ok {\n\t\tv := blogpost.UpdateDefaultUpdateTime()\n\t\tbpu.mutation.SetUpdateTime(v)\n\t}\n\n\tvar (\n\t\terr error\n\t\taffected int\n\t)\n\tif len(bpu.hooks) == 0 {\n\t\taffected, err = bpu.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*BlogPostMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tbpu.mutation = mutation\n\t\t\taffected, err = bpu.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn affected, err\n\t\t})\n\t\tfor i := len(bpu.hooks) - 1; i >= 0; i-- {\n\t\t\tmut = bpu.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, bpu.mutation); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\treturn affected, err\n}", "title": "" }, { "docid": "f396d066a9d11d939e6b73611563df69", "score": "0.5615975", "text": "func (h *EntryHandler) Edit(w http.ResponseWriter, r *http.Request, id int) {\n\tif err := h.authenticate(r); err != nil {\n\t\tError(w, http.StatusUnauthorized, nil, \"failed to authorized\")\n\t\treturn\n\t}\n\n\tentry, err := h.entry.Get(id)\n\tif err != nil {\n\t\tError(w, http.StatusNotFound, err, fmt.Sprintf(\"not found entry. id:%d\", id))\n\t\treturn\n\t}\n\n\traw := struct {\n\t\tData []byte `json:\"data\"`\n\t}{}\n\terr = json.NewDecoder(r.Body).Decode(&raw)\n\tif err != nil {\n\t\tError(w, http.StatusNotFound, err, \"failed to parse request\")\n\t\treturn\n\t}\n\n\telement, err := application.NewEntryElement(raw.Data)\n\tif err != nil {\n\t\tError(w, http.StatusNotFound, err, \"failed to parse entry data\")\n\t\treturn\n\t}\n\telement.Status = entry.Status\n\terr = h.entry.Edit(id, element)\n\tif err != nil {\n\t\tError(w, http.StatusNotFound, err, \"failed to edit entry\")\n\t\treturn\n\t}\n\tJSON(w, http.StatusOK, nil)\n}", "title": "" }, { "docid": "595013d51e92c34d1725c2975eeedee5", "score": "0.5578678", "text": "func UpdatePost(c *gin.Context) {\n\t//Get informations from Request\n\ttokenClaims := jwt.ExtractClaims(c)\n\toAuthID := tokenClaims[\"id\"].(string)\n\tslug := c.Param(\"slug\")\n\t//Reset Errorfeedback\n\terrFeedback = nil\n\t//Create database connection\n\tdb, err := CreateDBConnection()\n\tif err != nil {\n\t\terrFeedback = append(errFeedback, err.Error())\n\t}\n\tdefer db.Close()\n\tvar input PostInput\n\tif err := c.ShouldBindJSON(&input); err != nil {\n\t\terrFeedback = append(errFeedback, err.Error())\n\t}\n\t//Update the title in database if title is set in request\n\tif input.Title != \"\" {\n\t\tstmtPostUpdate, err := db.Prepare(\"update post set title = ? where slug = ? and oAuthID = ?\")\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t\t_, err = stmtPostUpdate.Exec(input.Title, slug, oAuthID)\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t}\n\t//Update the category in database if category is set in request\n\tif input.Category != \"\" {\n\t\tstmtPostUpdate, err := db.Prepare(\"update post set category = (select slug from category where name = ?) where slug = ? and oAuthID = ?\")\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t\t_, err = stmtPostUpdate.Exec(input.Category, slug, oAuthID)\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t}\n\t//Update the cover image in database if cover image is set in request\n\tif input.CoverImage != \"\" {\n\t\tstmtPostUpdate, err := db.Prepare(\"update post set coverImage = ? where slug = ? and oAuthID = ?\")\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t\t_, err = stmtPostUpdate.Exec(input.CoverImage, slug, oAuthID)\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t}\n\t//Update the publication date in database if pubDate is set in request\n\tif !(input.PubDate.IsZero()) {\n\t\tstmtPostUpdate, err := db.Prepare(\"update post set pubDate = ? where slug = ? and oAuthID = ?\")\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t\t_, err = stmtPostUpdate.Exec(input.PubDate, slug, oAuthID)\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t}\n\t//Control, if body is set in request (mandatory) and update in database, else, give back error\n\tif input.Body == \"\" {\n\t\terrFeedback = append(errFeedback, \"body is empty\")\n\t} else {\n\t\tstmtPostUpdate, err := db.Prepare(\"update post set body = ? where slug = ? and oAuthID = ?\")\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t\t_, err = stmtPostUpdate.Exec(input.Body, slug, oAuthID)\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t}\n\t//Set isPrivate to current state, given in request\n\tstmtPostUpdate, err := db.Prepare(\"update post set isPrivate = ? where slug = ? and oAuthID = ?\")\n\tif err != nil {\n\t\terrFeedback = append(errFeedback, err.Error())\n\t}\n\t_, err = stmtPostUpdate.Exec(input.IsPrivate, slug, oAuthID)\n\tif err != nil {\n\t\terrFeedback = append(errFeedback, err.Error())\n\t}\n\t//Set the current time as updated at time\n\tupdatedAt := time.Now()\n\tstmtPostUpdate, err = db.Prepare(\"update post set updatedAt = ? where slug = ? and oAuthID = ?\")\n\tif err != nil {\n\t\terrFeedback = append(errFeedback, err.Error())\n\t}\n\t_, err = stmtPostUpdate.Exec(updatedAt, slug, oAuthID)\n\tif err != nil {\n\t\terrFeedback = append(errFeedback, err.Error())\n\t}\n\t//Give back cumulated error list\n\tif errFeedback != nil {\n\t\tc.JSON(422, gin.H{\n\t\t\t\"errors\": gin.H{\"body\": errFeedback},\n\t\t})\n\t} else { //Run GetPost to give back the current post\n\t\tGetPost(c)\n\t}\n}", "title": "" }, { "docid": "08080049414536087faabc02a9f7e024", "score": "0.5560665", "text": "func EditReleasePost(ctx *context.Context) {\n\tform := web.GetForm(ctx).(*forms.EditReleaseForm)\n\tctx.Data[\"Title\"] = ctx.Tr(\"repo.release.edit_release\")\n\tctx.Data[\"PageIsReleaseList\"] = true\n\tctx.Data[\"PageIsEditRelease\"] = true\n\n\ttagName := ctx.Params(\"*\")\n\trel, err := repo_model.GetRelease(ctx.Repo.Repository.ID, tagName)\n\tif err != nil {\n\t\tif repo_model.IsErrReleaseNotExist(err) {\n\t\t\tctx.NotFound(\"GetRelease\", err)\n\t\t} else {\n\t\t\tctx.ServerError(\"GetRelease\", err)\n\t\t}\n\t\treturn\n\t}\n\tif rel.IsTag {\n\t\tctx.NotFound(\"GetRelease\", err)\n\t\treturn\n\t}\n\tctx.Data[\"tag_name\"] = rel.TagName\n\tctx.Data[\"tag_target\"] = rel.Target\n\tctx.Data[\"title\"] = rel.Title\n\tctx.Data[\"content\"] = rel.Note\n\tctx.Data[\"prerelease\"] = rel.IsPrerelease\n\n\tif ctx.HasError() {\n\t\tctx.HTML(http.StatusOK, tplReleaseNew)\n\t\treturn\n\t}\n\n\tconst delPrefix = \"attachment-del-\"\n\tconst editPrefix = \"attachment-edit-\"\n\tvar addAttachmentUUIDs, delAttachmentUUIDs []string\n\teditAttachments := make(map[string]string) // uuid -> new name\n\tif setting.Attachment.Enabled {\n\t\taddAttachmentUUIDs = form.Files\n\t\tfor k, v := range ctx.Req.Form {\n\t\t\tif strings.HasPrefix(k, delPrefix) && v[0] == \"true\" {\n\t\t\t\tdelAttachmentUUIDs = append(delAttachmentUUIDs, k[len(delPrefix):])\n\t\t\t} else if strings.HasPrefix(k, editPrefix) {\n\t\t\t\teditAttachments[k[len(editPrefix):]] = v[0]\n\t\t\t}\n\t\t}\n\t}\n\n\trel.Title = form.Title\n\trel.Note = form.Content\n\trel.IsDraft = len(form.Draft) > 0\n\trel.IsPrerelease = form.Prerelease\n\tif err = releaseservice.UpdateRelease(ctx.Doer, ctx.Repo.GitRepo,\n\t\trel, addAttachmentUUIDs, delAttachmentUUIDs, editAttachments); err != nil {\n\t\tctx.ServerError(\"UpdateRelease\", err)\n\t\treturn\n\t}\n\tctx.Redirect(ctx.Repo.RepoLink + \"/releases\")\n}", "title": "" }, { "docid": "ecc561f44fcda2ed76a5112f87b8e2a1", "score": "0.5527586", "text": "func SaveBlogEntry(author, title, content string){\n\tentries := GetAllBlogEntries()\n\n\tentryData := config.BlogEntry{\n\t\tAuthor: author,\n\t\tDate: time.Now().Format(\"02.01.2006 um 15:04:05\"),\n\t\tTitle: title,\n\t\tContent: content,\n\t\tID: NewBlogID(),\n\t}\n\n\tentries = append(entries, entryData)\n\n\tfile, err := os.Create(utility.FixPath(config.DataDir) + \"blogEntries.json\")\n\tif err == nil{\n\t\tenc := json.NewEncoder(file)\n\t\tenc.Encode(entries)\n\t} else{\n\t\tutility.HandleError(\"write.SaveBlogEntry -> Blogdatei schreiben\", err)\n\t}\n\tfile.Close()\n}", "title": "" }, { "docid": "b810371c55b303ab474a4125b06d0de7", "score": "0.55192244", "text": "func Blog(rw http.ResponseWriter, request *http.Request) {\n\n\tlog.Println(\"call Blog\")\n\n\terr := parseTemplate().ExecuteTemplate(rw, \"blog.html\", \"\")\n\tif err != nil {\n\t\tlog.Println(\"HTML 描画 エラー\")\n\t\tlog.Fatalln(err)\n\t}\n}", "title": "" }, { "docid": "fab79626a582b23b763c4f34186a0926", "score": "0.5510196", "text": "func ArticleAdminUpdateGet(c *gin.Context) {\n\tsession := sessions.Default(c)\n\tflashes := session.Flashes()\n\tsession.Save()\n\tdb := models.GetDB()\n\n\tid := c.Param(\"id\")\n\tarticle := &models.Article{}\n\tdb.First(article, id)\n\tif article.ID == 0 {\n\t\tc.HTML(404, \"errors/404\", nil)\n\t\treturn\n\t}\n\n\tc.HTML(200, \"articles/admin/form\", gin.H{\n\t\t\"Title\": \"Редактировать статью\",\n\t\t\"Active\": \"articles\",\n\t\t\"Article\": article,\n\t\t\"Flash\": flashes,\n\t})\n}", "title": "" }, { "docid": "314852e975d2c9bc5982d87c5aac399a", "score": "0.5508279", "text": "func GogsHooksEditPost(ctx *context.Context) {\n\teditWebhook(ctx, gogsHookParams(ctx))\n}", "title": "" }, { "docid": "574ea412c94aeae4f7d82614ef484321", "score": "0.55060273", "text": "func ApiWebsitesEdit(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tif !lib.IsLoggedIn(r) {\n\t\tSendJsonMessage(w, http.StatusUnauthorized, false, \"Unauthorized.\")\n\t\treturn\n\t}\n\n\t// Get data from Request\n\tr.ParseForm()\n\toldUrl := ps.ByName(\"url\")\n\tname := r.Form.Get(\"name\")\n\tprotocol := r.Form.Get(\"protocol\")\n\turl := r.Form.Get(\"url\")\n\tmethod := r.Form.Get(\"checkMethod\")\n\n\t// Simple Validation\n\tif oldUrl == \"\" || name == \"\" || protocol == \"\" || url == \"\" || method == \"\" {\n\t\tSendJsonMessage(w, http.StatusBadRequest, false, \"Unable to process your Request: Submit valid values.\")\n\t\treturn\n\t}\n\tif protocol != \"http\" && protocol != \"https\" {\n\t\tSendJsonMessage(w, http.StatusBadRequest, false, \"Unable to process your Request: Submit a valid protocol.\")\n\t\treturn\n\t}\n\tif !govalidator.IsURL(protocol + \"://\" + url) {\n\t\tSendJsonMessage(w, http.StatusBadRequest, false, \"Unable to process your Request: Submit a valid url.\")\n\t\treturn\n\t}\n\tif method != \"HEAD\" && method != \"GET\" {\n\t\tSendJsonMessage(w, http.StatusBadRequest, false, \"Unable to process your Request: Submit a valid check method.\")\n\t\treturn\n\t}\n\n\t// Update Database\n\tdb := lib.GetDatabase()\n\tres, err := db.Exec(\"UPDATE websites SET name = ?, protocol = ?, url = ?, checkMethod = ? WHERE url = ?;\", name, protocol, url, method, oldUrl)\n\tif err != nil {\n\t\tlogging.MustGetLogger(\"\").Error(\"Unable to edit Website: \", err)\n\t\tSendJsonMessage(w, http.StatusInternalServerError, false, \"Unable to process your Request: \"+err.Error())\n\t\treturn\n\t}\n\n\t// Check if exactly one Website has been edited\n\trowsAffected, _ := res.RowsAffected()\n\tif rowsAffected == 1 {\n\t\tSendJsonMessage(w, http.StatusOK, true, \"\")\n\t} else {\n\t\tSendJsonMessage(w, http.StatusBadRequest, false, \"Unable to process your Request: Could not edit Website.\")\n\t}\n}", "title": "" }, { "docid": "ce97bcdab557114c520b0ab66aebd74e", "score": "0.5503956", "text": "func TestUpdateBlogValidateTitleEn(t *testing.T) {\n\tif blogId != \"\" {\n\t\terr, rec := updateBlogForTest(\"TitleEn\", blogId)\n\t\tif assert.NoError(t, err) {\n\t\t\tassert.Equal(t, http.StatusUnprocessableEntity, rec.Code)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9a44ff3eb50480379a93cdf086460ec7", "score": "0.548938", "text": "func (p Database) Edit(d interface{}) (string, error) {\n\tjsonBuf, err := json.Marshal(d)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tidRev := idAndRev{}\n\tmust(json.Unmarshal(jsonBuf, &idRev))\n\tif idRev.ID == \"\" {\n\t\treturn \"\", errNoID\n\t}\n\tif idRev.Rev == \"\" {\n\t\treturn \"\", errNoRev\n\t}\n\tu := fmt.Sprintf(\"%s/%s\", p.DBURL(), url.QueryEscape(idRev.ID))\n\tir := Response{}\n\tif err = interact(\"PUT\", u, defaultHdrs, jsonBuf, &ir); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn ir.Rev, nil\n}", "title": "" }, { "docid": "0dde533aed9a953639d289bd0a5ee944", "score": "0.5477978", "text": "func ReadBlog(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodGet {\n\t\twriteErr(w, 404, fmt.Errorf(\"%v request to %v not found\", r.Method, r.URL.Path))\n\t\treturn\n\t}\n\n\t// retrieving id from query string\n\tid := r.URL.Query().Get(\"id\")\n\tif len(id) == 0 {\n\t\twriteErr(w, http.StatusBadRequest, fmt.Errorf(\"no blog-id provided\"))\n\t\treturn\n\t}\n\n\t// reading document\n\tvar b db.Blog\n\terr := b.Read(bson.M{\"_id\": bson.ObjectIdHex(id)}, bson.M{})\n\tswitch err {\n\tcase mgo.ErrNotFound:\n\t\twriteErr(w, 404, err)\n\tcase nil:\n\t\t// everything's fine\n\tdefault:\n\t\twriteErr(w, 500, err)\n\t\treturn\n\t}\n\n\t// writing json data to the client\n\twriteJSON(w, b)\n}", "title": "" }, { "docid": "d820948190ba5da107c42e0150c33f60", "score": "0.5465953", "text": "func GiteaHooksEditPost(ctx *context.Context) {\n\teditWebhook(ctx, giteaHookParams(ctx))\n}", "title": "" }, { "docid": "68e700ef450a7908110b5b92bb785ad2", "score": "0.54656416", "text": "func BlogHandler(w http.ResponseWriter, r *http.Request) {\n\tpaths := strings.Split(r.URL.Path, \"/\")\n\n\t// if just `ritwiksaha.com/blog/`, then redirecting to `/blogs` route\n\tif paths[2] == \"\" {\n\t\thttp.Redirect(w, r, \"/blogs\", http.StatusSeeOther)\n\t\treturn\n\t}\n\n\tidstr := paths[2]\n\n\t// reading from blog document database\n\tvar b db.Blog\n\terr := b.Read(bson.M{\"id_str\": idstr, \"is_deleted\": false, \"is_public\": true}, bson.M{})\n\tswitch err {\n\tcase mgo.ErrNotFound:\n\t\trenderErr(w, 404, fmt.Sprintf(\"Blog \\\"%v\\\" Not Found\", idstr))\n\tcase nil:\n\t\t// everything's fine\n\tdefault:\n\t\t// some internal error\n\t\twriteErr(w, 500, err)\n\t\treturn\n\t}\n\n\tif b.IsSeries {\n\t\thttp.Redirect(w, r, fmt.Sprintf(\"/thread/%v\", idstr), http.StatusSeeOther)\n\t\treturn\n\t}\n\n\t// remote src string\n\tvar src string\n\tswitch b.DocType {\n\tcase db.DocTypeMD:\n\t\tsrc = b.Markdown\n\tcase db.DocTypeHTML:\n\t\tsrc = b.HTML\n\t}\n\n\t// reading the document, (`GetDocument` handles caching)\n\t// also, in raw.GetDocument arguements index will always\n\t// be \"0\" as there's just 1 document\n\tdoc, err := raw.GetDocument(b.ID.Hex(), src, b.DocType, 0)\n\tif err != nil {\n\t\trenderErr(w, 500, \"Couldn't Read Document\")\n\t\treturn\n\t}\n\n\t// parsing document data (html or markdown) into HTML (unsafe)\n\tvar unsafe []byte\n\tif b.DocType == db.DocTypeMD {\n\t\tunsafe = blackfriday.MarkdownCommon(doc) // generating HTML from Markdown\n\t} else {\n\t\tunsafe = doc\n\t}\n\n\t// Document HTML\n\thtml := bluemonday.UGCPolicy().SanitizeBytes(unsafe)\n\n\t// Parsing templates\n\tt, err := template.ParseFiles(\n\t\t\"static/pages/each-doc.html\",\n\t\t\"static/partials/header.html\",\n\t\t\"static/partials/social-btns.html\",\n\t)\n\tif err != nil {\n\t\trenderErr(w, 500, \"Internal Server Error\")\n\t\treturn\n\t}\n\n\t// Executing Template\n\terr = t.Execute(w, struct {\n\t\tData db.Blog\n\t\tHTML string\n\t}{\n\t\tData: b,\n\t\tHTML: string(html),\n\t})\n\n\tif err != nil {\n\t\twriteErr(w, 500, err)\n\t}\n\n}", "title": "" }, { "docid": "d43e1a55db81720309d4acdb722c75c5", "score": "0.54644126", "text": "func SlackHooksEditPost(ctx *context.Context) {\n\teditWebhook(ctx, slackHookParams(ctx))\n}", "title": "" }, { "docid": "4a026030e666d0145937c3f33e121544", "score": "0.54513824", "text": "func editPollView(w http.ResponseWriter, r *http.Request) {\n\t// insert stuff into fields\n\tloggedUser := model.LoggedInUser(r)\n\tif !loggedUser.LoggedIn {\n\t\terr := templates.Execute(w, \"403\", nil)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"editPollView:\", err)\n\t\t}\n\t\treturn\n\t}\n\n\tpollID := strings.Split(r.URL.Path, \"/\")[2] //ustrings.Split(u, \"/\")[2]\n\tpoll, err := model.GetPollDetails(pollID)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tpoll.LoggedInUser = loggedUser\n\tif loggedUser.Username != poll.Author {\n\t\tfmt.Println(\"Currently logged in user is not the author\")\n\t\terr := templates.Execute(w, \"403\", poll)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\treturn\n\t}\n\terr = global.Templates.ExecuteTemplate(w, \"editPoll\", poll)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "2b22b5071580b9b77da13e72660c0f9f", "score": "0.5442784", "text": "func WechatworkHooksEditPost(ctx *context.Context) {\n\teditWebhook(ctx, wechatworkHookParams(ctx))\n}", "title": "" }, { "docid": "92aaf345d20eaada4acd41e940addfe0", "score": "0.54259354", "text": "func handleViewBlogPost(w http.ResponseWriter, req *http.Request) {\n\tvars := mux.Vars(req)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\n\tif err != nil {\n\t\trenderer.JSON(w, 400, \"Invalid article request\")\n\t\treturn\n\t}\n\n\tp, _ := getBlogPost(id)\n\tcomments, _ := getCommentsForPost(id)\n\n\tpostPage := struct {\n\t\tPost post\n\t\tComments []comment\n\t}{\n\t\tp,\n\t\tcomments,\n\t}\n\n\ttemplates.ExecuteTemplate(w, \"blog\", postPage)\n}", "title": "" }, { "docid": "3943b8454052527b6313fe14581a2acf", "score": "0.5425398", "text": "func (bpuo *BlogPostUpdateOne) Save(ctx context.Context) (*BlogPost, error) {\n\tif v, ok := bpuo.mutation.Head(); ok {\n\t\tif err := blogpost.HeadValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"head\", err: fmt.Errorf(\"ent: validator failed for field \\\"head\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := bpuo.mutation.Body(); ok {\n\t\tif err := blogpost.BodyValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"body\", err: fmt.Errorf(\"ent: validator failed for field \\\"body\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := bpuo.mutation.UpdateTime(); !ok {\n\t\tv := blogpost.UpdateDefaultUpdateTime()\n\t\tbpuo.mutation.SetUpdateTime(v)\n\t}\n\n\tvar (\n\t\terr error\n\t\tnode *BlogPost\n\t)\n\tif len(bpuo.hooks) == 0 {\n\t\tnode, err = bpuo.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*BlogPostMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tbpuo.mutation = mutation\n\t\t\tnode, err = bpuo.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn node, err\n\t\t})\n\t\tfor i := len(bpuo.hooks) - 1; i >= 0; i-- {\n\t\t\tmut = bpuo.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, bpuo.mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn node, err\n}", "title": "" }, { "docid": "dc72fdcd450554e1907033bfc082cdb8", "score": "0.54177535", "text": "func EditPostHandler(w http.ResponseWriter, r *http.Request) {\n\tutils.AdminLoginRequired(w, r)\n\n\tdb := utils.GetDB()\n\tdefer db.Close()\n\t//_, flashSession := utils.GetCookieStore(r, utils.FLASH_SESSION)\n\n\tr.ParseForm()\n\temail := r.PostForm.Get(\"email\")\n\tusername := r.PostForm.Get(\"username\")\n\tfirstname := r.PostForm.Get(\"firstname\")\n\tlastname := r.PostForm.Get(\"lastname\")\n\tcontactno := r.PostForm.Get(\"contactno\")\n\tid := r.PostForm.Get(\"id\")\n\n\tif username == \"\" || email == \"\" || firstname == \"\" || lastname == \"\" || contactno == \"\" {\n\t\tutils.RedirectWithMessage(w, r, \"/user/edit/\"+id, \"message\", \"All fields are required\")\n\t}\n\n\tvar existingUsername string\n\terr := db.QueryRow(\"SELECT username FROM `user` WHERE (username='\"+username+\"' OR email = '\"+email+\"') AND id != ?\", id).Scan(&existingUsername)\n\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\t_, err := db.Exec(\"UPDATE `user` SET username = ?, email= ? WHERE id = ?\", username, email, id)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t} else {\n\t\t\t\tdb.Exec(\"UPDATE profile SET first_name = ?, last_name =?, contact_no = ? WHERE user_id = ? \", firstname, lastname, contactno, id)\n\t\t\t}\n\t\t\tutils.RedirectWithMessage(w, r, \"/user/edit/\"+id, \"message\", \"User updated successfully\")\n\t\t}\n\t}\n\tif existingUsername != \"\" {\n\t\tutils.RedirectWithMessage(w, r, \"/user/edit/\"+id, \"message\", \"Username \"+existingUsername+\" already registered, please choose another\")\n\t}\n}", "title": "" }, { "docid": "828eb49b2a4a1b2b185b6f7eee042721", "score": "0.5414972", "text": "func updatePost(w http.ResponseWriter, r *http.Request) {\n\t// Log request\n\tlogRequest(w, r)\n\n\t// Get id from path variables\n\tid, err := strconv.Atoi(mux.Vars(r)[\"id\"])\n\tif err != nil {\n\t\twriteJSONResponse(w, fmt.Sprintf(\"Invalid id: %v\\n\", mux.Vars(r)[\"id\"]), 400)\n\t\treturn\n\t}\n\n\t// Check if id is valid\n\texists, idType := checkPostID(w, id)\n\tif !exists {\n\t\twriteJSONResponse(w, fmt.Sprintf(\"No post with id %d\", id), http.StatusNotFound)\n\t\treturn\n\t}\n\tif idType == \"r\" {\n\t\twriteJSONResponse(w, \"Not authorized\", http.StatusForbidden)\n\t\treturn\n\t}\n\n\t// Decode the request's body to get update info\n\tvar updatedPost post\n\terr = json.NewDecoder(r.Body).Decode(&updatedPost)\n\n\tif err != nil {\n\t\twriteJSONResponse(w, err.Error(), 400)\n\t\treturn\n\t}\n\n\t// Build query string\n\tqueryString := `UPDATE posts SET id = id`\n\targs := []interface{}{}\n\tif updatedPost.Title != \"\" {\n\t\tqueryString += \", title = ?\"\n\t\targs = append(args, updatedPost.Title)\n\t}\n\tif updatedPost.Text != \"\" {\n\t\tqueryString += \", text = ?\"\n\t\targs = append(args, updatedPost.Text)\n\t}\n\tif updatedPost.Public != nil {\n\t\tqueryString += \", public = ?\"\n\t\targs = append(args, updatedPost.Public)\n\t}\n\tqueryString += \" WHERE write_id = ?\"\n\targs = append(args, id)\n\n\t// Execute query to update post\n\tresult, err := db.Exec(queryString, args...)\n\tif err != nil {\n\t\twriteJSONResponse(w, err.Error(), 500)\n\t\treturn\n\t}\n\trowsAffected, err := result.RowsAffected()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tfmt.Printf(\"%d row(s) updated.\\n\", rowsAffected)\n\n\t// Send the updated post back to client\n\tqueryString = `SELECT title, text, public, read_id, write_id FROM posts WHERE write_id = ?`\n\terr = db.Get(&updatedPost, queryString, id)\n\tif err != nil {\n\t\twriteJSONResponse(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tresponse := map[string]interface{}{\n\t\t\"message\": \"Post updated\",\n\t\t\"postContent\": updatedPost,\n\t\t\"adminOptions\": map[string]interface{}{\n\t\t\t\"updateLink\": \"/\",\n\t\t\t\"deleteLink\": \"/\",\n\t\t},\n\t}\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\twriteJSONResponse(w, err.Error(), 500)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "7db665bed481ab1343782ec166f5727b", "score": "0.5384313", "text": "func (c *Client) edit(endpoint, thingId, text string) {\n\tpostdata := PostData{\n\n\t\t\"thing_id\": thingId,\n\t\t\"text\": text,\n\t}\n\n\tresp, err := c.Post(endpoint, postdata)\n\n\tif err != nil {\n\t\tlog.Fatal(\"Error in posting comment\")\n\t}\n\n\tdefer resp.Body.Close()\n\tPrintHeader(resp)\n\n}", "title": "" }, { "docid": "cbca506222612ae2d415ead55f0edb4b", "score": "0.5377456", "text": "func ModifyPost(w http.ResponseWriter, r *http.Request) {\n\tid := mux.Vars(r)[\"id\"]\n\tclient := &http.Client{}\n\treq, _ := http.NewRequest(http.MethodPatch, BaseURL+\"/posts/\"+id, r.Body)\n\treq.Header.Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tresp, _ := client.Do(req)\n\tdefer resp.Body.Close()\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tfmt.Fprintf(w, \"%s\", body)\n}", "title": "" }, { "docid": "e1fea57f2a270d388ed2b072654d3ac3", "score": "0.53620076", "text": "func DiscordHooksEditPost(ctx *context.Context) {\n\teditWebhook(ctx, discordHookParams(ctx))\n}", "title": "" }, { "docid": "6611ab59eae5d2315f0f2f64d618c9d7", "score": "0.5361198", "text": "func (b BlogBucket) Save(db weave.KVStore, obj orm.Object) error {\n\tif _, ok := obj.Value().(*Blog); !ok {\n\t\treturn errors.WithType(errors.ErrModel, obj.Value())\n\t}\n\treturn b.Bucket.Save(db, obj)\n}", "title": "" }, { "docid": "5c08e3dfb69ff87a644008379adcfd34", "score": "0.5357003", "text": "func ModifyTeamPost(team *models.Team, postid string, content string) {\n\tpost := team.Forum[postid]\n\tpost.Content = content\n\tpost.ModificationDate = time.Now().Format(\"02/01/2006 à 15:04:05\")\n}", "title": "" }, { "docid": "aa60c903b3695b1f285b805f9de76f2d", "score": "0.53552926", "text": "func updateTodo(c *gin.Context) {\n\tvar todo todoModel\n\ttodoID := c.Param(\"id\")db.First(&todo, todoID)if todo.ID == 0 {\n\t c.JSON(http.StatusNotFound, gin.H{\"status\": http.StatusNotFound, \"message\": \"No todo found!\"})\n\t return\n\t}\n\tdb.Model(&todo).Update(\"title\", c.PostForm(\"title\"))\n\tcompleted, _ := strconv.Atoi(c.PostForm(\"completed\"))\n\tdb.Model(&todo).Update(\"completed\", completed)\n\tc.JSON(http.StatusOK, gin.H{\"status\": http.StatusOK, \"message\": \"Todo updated successfully!\"})\n }", "title": "" }, { "docid": "953e82f6cc81b9cb3a36b5409f72d8cf", "score": "0.534884", "text": "func BlogActive(blog string){\n\tfmt.Println(blog)\n\tid, _ := primitive.ObjectIDFromHex(blog)\n\tfilter := bson.M{\"_id\":id}\n\tupdate := bson.M{\"$set\":bson.M{\"status\":true}}\n\tresult, err := collection.UpdateOne(context.Background(),filter,update)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"modified count:\",result.ModifiedCount)\n}", "title": "" }, { "docid": "7678b822b1af8d170b1f6f2d76c8175d", "score": "0.5348326", "text": "func AdminEdit(w http.ResponseWriter, data *model.News) {\n\trender(tpAdminLEdit, w, data)\n}", "title": "" }, { "docid": "38aa8d2fd09c7fa89d82412aec11a64e", "score": "0.53339386", "text": "func (r *FirewallConfigChangeLogResource) Edit(id string, item FirewallConfigChangeLogConfig) error {\n\tif err := r.c.ModQuery(\"PUT\", BasePath+FirewallConfigChangeLogEndpoint+\"/\"+id, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b49f2dc95f61c29e2672fbc379b8bad2", "score": "0.5331509", "text": "func (bc *BlogController) Blog() {\r\n\t// Parse the RequestURI\r\n\tuParm, err := url.Parse(bc.Ctx.Request.URL.RequestURI())\r\n\tif err != nil {\r\n\t\tfmt.Println(\"Blog GET: Error parsing URL\") // TODO Error logging\r\n\t\treturn\r\n\t}\r\n\t// Get query map\r\n\tqm, _ := url.ParseQuery(uParm.RawQuery)\r\n\r\n\t// URL params indicate the requested page\r\n\t// e.g. a param of \"dest=blog\" indicates the blog home page\r\n\t// and a param of \"dest=firstblog\" indicates the article firstblog\r\n\tif page, ok := qm[\"dest\"]; ok {\r\n\t\tif page[0] == \"blog\" {\r\n\t\t\tbc.activeContent(\"blog\")\r\n\t\t\treturn\r\n\t\t} else {\r\n\t\t\tbc.Data[\"Article\"] = true\r\n\t\t\tbc.activeContent(\"articles/\" + page[0])\r\n\t\t\treturn\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "41cd14ac69a24c7c4b7efb9623a68f06", "score": "0.53295064", "text": "func PackagistHooksEditPost(ctx *context.Context) {\n\teditWebhook(ctx, packagistHookParams(ctx))\n}", "title": "" }, { "docid": "5fbd5e059c80ed4fd82973afa0913ad5", "score": "0.5324235", "text": "func (art *ArticlesWebActions) Update(w http.ResponseWriter, r *http.Request) {\n\tID := mux.Vars(r)[\"id\"]\n\tbody := r.Body\n\n\tdata, err := art.model.Update(ID, body)\n\n\tif err != nil {\n\t\tErrorWithJSON(w, r, err.Error(), 404)\n\t} else {\n\t\tResponseWithJSON(w, r, data, 200)\n\t}\n}", "title": "" }, { "docid": "0d0077d0561c5019f0daae21d7143911", "score": "0.53228617", "text": "func (*server) Update(ctx context.Context, req *model.UpdateReq) (*model.UpdateResp, error) {\n\tID := req.GetDb().GetId()\n\tblogID, err := primitive.ObjectIDFromHex(ID)\n\n\tauthor := req.GetDb().GetAuthor()\n\tappsName := req.GetDb().GetAppsname()\n\tlanguage := req.GetDb().GetLanguage()\n\n\tlog.Printf(\"Req => %v\\n\", req)\n\n\tif err != nil {\n\t\terrMsg := status.Errorf(codes.InvalidArgument, \"Failed read ID\")\n\t\treturn nil, errMsg\n\t}\n\n\tdata := &dataItem{}\n\tfilterData := bson.M{\"_id\": blogID}\n\n\tdata.ID = blogID\n\tdata.Author = author\n\tdata.AppsName = appsName\n\tdata.Language = language\n\n\tres := collections.FindOneAndReplace(context.Background(), filterData, data)\n\n\tif err := res.Decode(data); err != nil {\n\t\terrMsg := status.Errorf(codes.NotFound, \"Can't find your requests\")\n\t\treturn nil, errMsg\n\t}\n\n\tresp := &model.UpdateResp{\n\t\tDb: &model.Database{\n\t\t\tId: ID,\n\t\t\tAuthor: author,\n\t\t\tAppsname: appsName,\n\t\t\tLanguage: language,\n\t\t},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "ec2e3ae2ae9dade35b30f355253b44ae", "score": "0.530938", "text": "func (r *LinkResource) Edit(id string, item Link) error {\n\tif err := r.c.ModQuery(\"PUT\", BasePath+LinkEndpoint+\"/\"+id, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "446d6b73c41da8121d8c1ccd1106bc07", "score": "0.52995884", "text": "func (repository AdminRepository) Edit(model models.Admin, tx *sql.Tx) (res int64, err error) {\n\tstatement := `update admins set name=$1, updated_at=$2 where id=$3 and ` + model.GetAdminDeletedAtStatement()\n\tresult, err := tx.Exec(statement, model.Name, model.UpdatedAt, model.ID)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\tres, err = result.RowsAffected()\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "d5cad68858b5eeb40cd33e0a7c4f3a78", "score": "0.52953047", "text": "func (p *PostsHandler) UpdatePost(c *fiber.Ctx) error {\n\t// Retrive the id from route as an int\n\tid, err := c.ParamsInt(\"id\")\n\tif err != nil {\n\t\treturn fiber.ErrNotFound\n\t}\n\n\t// Retrieve post data from request body\n\tvar postData data.Post\n\terr = c.BodyParser(&postData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Validate request body\n\terr = postData.Validate()\n\tif err != nil {\n\t\treturn fiber.NewError(http.StatusNotAcceptable, err.Error())\n\t}\n\n\t// Update post with the given data in the database\n\tvar post data.Post\n\tp.DB.First(&post, id)\n\tpost.Title = postData.Title\n\tpost.Content = postData.Content\n\tpost.UpdatedAt = time.Now()\n\tp.DB.Save(&post)\n\n\t// Return to the client the id of the post\n\tc.JSON(post.ID)\n\n\treturn nil\n}", "title": "" }, { "docid": "801e124c694e9186b45cae3c7c0f7b5d", "score": "0.529019", "text": "func EditRepoHook(ctx *context.APIContext, form *api.EditHookOption, hookID int64) {\n\trepo := ctx.Repo\n\thook, err := GetRepoHook(ctx, repo.Repository.ID, hookID)\n\tif err != nil {\n\t\treturn\n\t}\n\tif !editHook(ctx, form, hook) {\n\t\treturn\n\t}\n\tupdated, err := GetRepoHook(ctx, repo.Repository.ID, hookID)\n\tif err != nil {\n\t\treturn\n\t}\n\tctx.JSON(http.StatusOK, convert.ToHook(repo.RepoLink, updated))\n}", "title": "" }, { "docid": "5dd49c3e981587a8ca20c0b11ed599a9", "score": "0.5283748", "text": "func (server *Server) CreateBlog(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\tw.WriteHeader(405) // method not allowed\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\t// Decode the token\n\tuserID, err := auth.ExtractTokenID(r)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to extract token from request: %v\", err)\n\t}\n\n\t// Get the user blog\n\tuserModel := repo.User{}\n\towner, err := userModel.FindUserByID(server.DB, userID)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, errors.New(\"post owner (user) does not exist: \"+err.Error()))\n\t\treturn\n\t}\n\n\t// Check if user already has a blog\n\tif owner.BlogID != 0 {\n\t\tresponses.ERROR(w, http.StatusBadRequest, errors.New(\"user already has a blog\"))\n\t\treturn\n\t}\n\n\t// Create a new blog entry\n\tfreshBlog := repo.Blog{}\n\n\terr = json.Unmarshal(body, &freshBlog)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\terr = freshBlog.Validate()\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tfreshBlog.Prepare()\n\n\tuuid, err := uuid.NewRandom()\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tfreshBlog.APIKey = uuid.String()\n\tfreshBlog.AuthorID = owner.ID\n\n\tcreatedBlog, err := freshBlog.Save(server.DB)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, errors.New(\"error saving the blog: \"+err.Error()))\n\t\treturn\n\t}\n\n\tcreatedBlog.Author = *owner\n\n\tres := presenters.SaveBlogPresenter(createdBlog)\n\n\tresponses.JSON(w, 200, res)\n}", "title": "" }, { "docid": "5b038021e0c2950380d91312610145a5", "score": "0.52801085", "text": "func (s *BlogServer) Update(ctx context.Context, r *pb.UpdateRequest) (*pb.UpdateResponse, error) {\n\tm, err := models.FromPB(r.GetArticle())\n\tif err != nil {\n\t\tlog.Printf(\"Error updating article: %v\\n\", err)\n\t\treturn nil, status.Error(codes.Internal, internalError)\n\t}\n\tres, err := s.r.UpdateArticle(ctx, m)\n\tif err != nil {\n\t\tlog.Printf(\"Error updating article: %v\\n\", err)\n\t\treturn nil, status.Error(codes.Internal, internalError)\n\t}\n\tif ctx.Err() == context.Canceled {\n\t\treturn nil, status.Error(codes.Canceled, requestCancelled)\n\t}\n\treturn &pb.UpdateResponse{Article: res.ToPB()}, status.Error(codes.OK, \"Successfully updated Article\")\n}", "title": "" }, { "docid": "576915eab60e32660ed8ab1e204e2d9e", "score": "0.5271329", "text": "func (p *Posts) BlogPost(res http.ResponseWriter, req *http.Request) {\n\tpost, err := p.postByURL(res, req)\n\tif err != nil {\n\t\t// postByYearAndTitle already renders error\n\t\treturn\n\t}\n\terr = p.ps.ParseMD(post)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tvar vd views.Data\n\tvd.Yield = post\n\tp.BlogPostView.Render(res, req, vd)\n}", "title": "" }, { "docid": "957de9a75279de0bfff080221331b7c1", "score": "0.52679425", "text": "func EditEntry(db *sql.DB, jd string, je string) {\n\tstatement, err := db.Prepare(\"UPDATE journal_entries SET entry = ? WHERE date = ?\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer statement.Close()\n\tstatement.Exec(je, jd)\n}", "title": "" }, { "docid": "e652d28fa020e8b65c9af1195d1c7a4b", "score": "0.52670896", "text": "func WebHooksEdit(ctx *context.Context) {\n\tctx.Data[\"Title\"] = ctx.Tr(\"repo.settings.update_webhook\")\n\tctx.Data[\"PageIsSettingsHooks\"] = true\n\tctx.Data[\"PageIsSettingsHooksEdit\"] = true\n\n\torCtx, w := checkWebhook(ctx)\n\tif ctx.Written() {\n\t\treturn\n\t}\n\tctx.Data[\"Webhook\"] = w\n\n\tctx.HTML(http.StatusOK, orCtx.NewTemplate)\n}", "title": "" }, { "docid": "50f516af81d6736cf1a5194a826a0605", "score": "0.5261621", "text": "func DingtalkHooksEditPost(ctx *context.Context) {\n\teditWebhook(ctx, dingtalkHookParams(ctx))\n}", "title": "" }, { "docid": "4d585e1d2ffe964fff8199688b610d10", "score": "0.52531093", "text": "func EditPost(u user.User) UserActionResponse {\n\tteam, err := u.Store().RandomTeam(store.SelectMemberOf)\n\tif err != nil {\n\t\treturn UserActionResponse{Err: NewUserError(err)}\n\t}\n\n\tchannel, err := u.Store().RandomChannel(team.Id, store.SelectMemberOf)\n\tif err != nil {\n\t\treturn UserActionResponse{Err: NewUserError(err)}\n\t}\n\n\tpost, err := u.Store().RandomPostForChannel(channel.Id)\n\tif err != nil {\n\t\treturn UserActionResponse{Err: NewUserError(err)}\n\t}\n\n\tmessage := GenerateRandomSentences(rand.Intn(10))\n\tpostId, err := u.PatchPost(post.Id, &model.PostPatch{\n\t\tMessage: &message,\n\t})\n\tif err != nil {\n\t\treturn UserActionResponse{Err: NewUserError(err)}\n\t}\n\n\treturn UserActionResponse{Info: fmt.Sprintf(\"post updated, id %v -> %v\", post.Id, postId)}\n}", "title": "" }, { "docid": "1d1db8271e8191a0eb98dc606a8dfdd6", "score": "0.52433157", "text": "func (r *PostsService) Update(blogId string, postId string, post *Post) *PostsUpdateCall {\n\tc := &PostsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.blogId = blogId\n\tc.postId = postId\n\tc.post = post\n\treturn c\n}", "title": "" }, { "docid": "6841a3b6eb54cfaef652a60ebd1f7af3", "score": "0.5242381", "text": "func (f *Fave) Edittag(id int, name string) (resp responses.Ok, err error) {\n\tparams := map[string]interface{}{}\n\n\tparams[\"id\"] = id\n\n\tparams[\"name\"] = name\n\n\terr = f.SendObjRequest(\"fave.editTag\", params, &resp)\n\n\treturn\n}", "title": "" }, { "docid": "5fb30bafdb3f71689799de6b899106eb", "score": "0.52198553", "text": "func (p *Posts) Update(res http.ResponseWriter, req *http.Request) {\n\tpost, err := p.postByID(res, req)\n\tif err != nil {\n\t\t// implemented by postByID\n\t\treturn\n\t}\n\tuser := context.User(req.Context())\n\tif user.IsAdmin != true {\n\t\thttp.Error(res, \"You do not have permission to edit this post\", http.StatusForbidden)\n\t\treturn\n\t}\n\n\tvar vd views.Data\n\tvd.Yield = post\n\tvar form PostForm\n\tif err := parseForm(req, &form); err != nil {\n\t\tvd.SetAlert(err)\n\t\tp.EditView.Render(res, req, vd)\n\t\treturn\n\t}\n\tpost.Title = form.Title\n\terr = p.ps.Update(post)\n\tif err != nil {\n\t\tvd.SetAlert(err)\n\t} else {\n\t\tvd.Alert = &views.Alert{\n\t\t\tLevel: views.AlertLvlSuccess,\n\t\t\tMessage: \"Post updated successfully!\",\n\t\t}\n\t}\n\tp.EditView.Render(res, req, vd)\n}", "title": "" }, { "docid": "e7fbb2a11d6e67f7eb204648a3743dcc", "score": "0.52077615", "text": "func UpdatePost(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tfmt.Println(params[\"id\"])\n\n\tmsg := Message{\"Post updated!\"}\n\thelpers.CreateJSONResponse(msg, http.StatusOK, w)\n}", "title": "" }, { "docid": "e0b121cbca4f7e27caef79666291585b", "score": "0.52053726", "text": "func (str *impl) EditPost(\n\tctx context.Context,\n\tpost store.ID,\n\teditor store.ID,\n\tnewTitle *string,\n\tnewContents *string,\n) (\n\tresult store.Post,\n\tchanges struct {\n\t\tTitle bool\n\t\tContents bool\n\t},\n\terr error,\n) {\n\tresult.ID = post\n\n\t// Begin transaction\n\ttxn, close := str.txn(&err)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer close()\n\n\t// Ensure post and editor exist\n\tvar qr struct {\n\t\tPost []Post `json:\"post\"`\n\t\tEditor []User `json:\"editor\"`\n\t}\n\terr = txn.QueryVars(\n\t\tctx,\n\t\t`query User(\n\t\t\t$id: string,\n\t\t\t$editorId: string\n\t\t) {\n\t\t\tpost(func: eq(Post.id, $id)) {\n\t\t\t\tuid\n\t\t\t\tPost.author {\n\t\t\t\t\tuid\n\t\t\t\t\tUser.id\n\t\t\t\t}\n\t\t\t\tPost.creation\n\t\t\t\tPost.title\n\t\t\t\tPost.contents\n\t\t\t}\n\t\t\teditor(func: eq(User.id, $editorId)) { uid }\n\t\t}`,\n\t\tmap[string]string{\n\t\t\t\"$id\": string(post),\n\t\t\t\"$editorId\": string(editor),\n\t\t},\n\t\t&qr,\n\t)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif len(qr.Post) < 1 {\n\t\terr = strerr.New(strerr.ErrInvalidInput, \"post not found\")\n\t\treturn\n\t}\n\tif len(qr.Editor) < 1 {\n\t\terr = strerr.Newf(strerr.ErrInvalidInput, \"editor not found\")\n\t\treturn\n\t}\n\n\t// Check permission\n\tif err = auth.Authorize(ctx, auth.IsOwner{\n\t\tOwner: store.ID(qr.Post[0].Author[0].ID),\n\t}); err != nil {\n\t\treturn\n\t}\n\n\tif newTitle != nil {\n\t\tresult.Title = *newTitle\n\t\tif qr.Post[0].Title == *newTitle {\n\t\t\tnewTitle = nil\n\t\t} else {\n\t\t\tchanges.Title = true\n\t\t}\n\t} else {\n\t\tresult.Title = qr.Post[0].Title\n\t}\n\tif newContents != nil {\n\t\tresult.Contents = *newContents\n\t\tif qr.Post[0].Contents == *newContents {\n\t\t\tnewContents = nil\n\t\t} else {\n\t\t\tchanges.Contents = true\n\t\t}\n\t} else {\n\t\tresult.Contents = qr.Post[0].Contents\n\t}\n\n\tresult.UID = qr.Post[0].UID\n\tresult.Creation = qr.Post[0].Creation\n\tresult.Author = &store.User{\n\t\tGraphNode: store.GraphNode{\n\t\t\tUID: qr.Post[0].Author[0].UID,\n\t\t},\n\t}\n\n\t// Edit the post\n\tvar mutatedPostJSON []byte\n\tmutatedPostJSON, err = json.Marshal(struct {\n\t\tUID string `json:\"uid\"`\n\t\tNewTitle *string `json:\"Post.title,omitempty\"`\n\t\tNewContents *string `json:\"Post.contents,omitempty\"`\n\t}{\n\t\tUID: result.UID,\n\t\tNewTitle: newTitle,\n\t\tNewContents: newContents,\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\t_, err = txn.Mutation(ctx, &api.Mutation{\n\t\tSetJson: mutatedPostJSON,\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "898d32c7ed1e62e6e3c291d071179106", "score": "0.52020854", "text": "func (c CompanyService) Edit(company domain.Company) error {\n\terr := c.CompanyRepo.Update(company)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a45c67dffa3654fe66e59146b7b3ba2a", "score": "0.51986694", "text": "func TelegramHooksEditPost(ctx *context.Context) {\n\teditWebhook(ctx, telegramHookParams(ctx))\n}", "title": "" }, { "docid": "16e6669842c3d94ab6f00bd1c2b805f6", "score": "0.5194208", "text": "func Edit(mEnv *config.Data) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\tm := []Menu{}\n\t\t//decode the json with the a slice with the menu to be modified\n\t\tjson.NewDecoder(r.Body).Decode(&m)\n\t\tobj := ModifyData(mEnv.CL, m)\n\t\t//prints the id of the modified menu\n\t\tfmt.Fprintf(w, \"modified the menu with the following id: %s\", obj.Hex())\n\n\t}\n}", "title": "" }, { "docid": "17cd2f299c4ba0fdee5e942ccbdf88c1", "score": "0.5177806", "text": "func AddBlogUsers(c *gin.Context) {\n\tlogEntry := utils.Log().WithFields(utils.Fields{\"url\": c.Request.URL,\n\t\t\"Method\": c.Request.Method})\n\tlogEntry.Debug(\"Post request received.\")\n\n\tcontentType := c.Request.Header.Get(\"Content-type\")\n\tif contentType, _, err := mime.ParseMediaType(contentType); contentType != \"application/json\" || err != nil {\n\t\tlogEntry.Errorf(\"Unsupported content type : %s\", contentType)\n\t\tc.JSON(http.StatusUnsupportedMediaType, restimpl.Error{Code: \"415\", Message: contentType})\n\t\treturn\n\t}\n\n\tvar blogUser restimpl.BlogUser\n\terr := c.BindJSON(&blogUser)\n\tif err != nil {\n\t\tlogEntry.Errorf(\"Json parsing error %v\", err)\n\t\tc.JSON(http.StatusBadRequest, restimpl.Error{Code: \"400\", Message: err.Error()})\n\t\treturn\n\t}\n\n\tisDup, err := getBlogUserByEmail(blogUser.Email, logEntry)\n\tif isDup != (restimpl.BlogUser{}) {\n\t\tlogEntry.Errorf(\"User already exists %v\", err)\n\t\tc.JSON(http.StatusConflict, restimpl.Error{Code: \"409\", Message: \"Email address is not unique\"})\n\t\treturn\n\t}\n\n\t//Set the readonly fields\n\t//Set the time in UTC\n\tblogUser.LastModifiedDate = time.Now().UTC()\n\tblogUser.Id = uuid.NewV4().String()\n\n\tblogCollection, ctx := utils.GetUserCollection()\n\tdoc, err := blogCollection.InsertOne(ctx, blogUser)\n\tif err != nil {\n\t\tlogEntry.Errorf(\"Insert failed %v\", err)\n\t}\n\n\tlogEntry.Debugf(\"Document created %v doc: %v\", doc.InsertedID)\n\n\tuser, err := getBlogUserByid(blogUser.Id, logEntry)\n\tif err != nil {\n\t\tlogEntry.Errorf(\"Retrieval failed!\")\n\t\tc.JSON(http.StatusInternalServerError, restimpl.Error{Code: \"500\", Message: err.Error()})\n\t\treturn\n\t}\n\n\tlogEntry.Infof(\"blogUser with id: %s created!\", blogUser.Id)\n\tc.JSON(http.StatusCreated, user)\n\treturn\n}", "title": "" }, { "docid": "0116a888394aa8cc0b42771be50a21b1", "score": "0.51743716", "text": "func PutPost(w http.ResponseWriter, r *http.Request) {\n\tpostID := chi.URLParam(r, \"postID\")\n\tsqlQ := \"SELECT \tid ,\" +\n\t\t\"text ,\" +\n\t\t\"fk_car, fk_user FROM public.posts WHERE id=$1\"\n\n\trow := Database.QueryRow(sqlQ, postID)\n\n\tvar post Post\n\terr := row.Scan(&post.ID, &post.Text, &post.Fkcar, &post.Fkuser)\n\n\tswitch err {\n\tcase sql.ErrNoRows:\n\t\thttp.Error(w, \"requested post no longer exists\", http.StatusNotFound)\n\t\treturn\n\tcase nil:\n\tdefault:\n\t\tpanic(err)\n\t}\n\tclaims := GetToken(jwtauth.TokenFromHeader(r))\n\tif claims[\"id\"] != post.Fkuser && claims[\"role\"] != \"admin\" {\n\t\thttp.Error(w, \"Unauthorized action\", http.StatusUnauthorized)\n\t\tpanic(err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t//read body\n\tvar newData Post\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"can't read body\", http.StatusBadRequest)\n\t\tpanic(err)\n\t}\n\n\terr = json.Unmarshal(body, &newData)\n\tif err != nil {\n\t\thttp.Error(w, \"wrong body structure\", http.StatusBadRequest)\n\t\tpanic(err)\n\t}\n\t//update\n\tsqlPut := \"UPDATE public.posts SET\"\n\tif newData.Text != \"\" {\n\t\tsqlPut += \" Text='\" + fmt.Sprint(newData.Text) + \"'\"\n\t}\n\tsqlPut += \" WHERE id=\" + fmt.Sprint(postID) + \";\"\n\n\terr = Database.QueryRow(sqlPut).Err()\n\tif err != nil {\n\t\thttp.Error(w, \"wrong body structure\", http.StatusBadRequest)\n\t\tpanic(err)\n\t}\n\tfmt.Println(sqlPut)\n}", "title": "" }, { "docid": "f7e655fb321042bf448c603c7a908e76", "score": "0.5174134", "text": "func EditRelease(ctx *context.APIContext, form api.EditReleaseOption) {\n\tif ctx.Repo.AccessMode < models.AccessModeWrite {\n\t\tctx.Status(403)\n\t\treturn\n\t}\n\tid := ctx.ParamsInt64(\":id\")\n\trel, err := models.GetReleaseByID(id)\n\tif err != nil {\n\t\tctx.Error(500, \"GetReleaseByID\", err)\n\t\treturn\n\t}\n\tif rel.RepoID != ctx.Repo.Repository.ID {\n\t\tctx.Status(404)\n\t\treturn\n\t}\n\n\tif len(form.TagName) > 0 {\n\t\trel.TagName = form.TagName\n\t}\n\tif len(form.Target) > 0 {\n\t\trel.Target = form.Target\n\t}\n\tif len(form.Title) > 0 {\n\t\trel.Title = form.Title\n\t}\n\tif len(form.Note) > 0 {\n\t\trel.Note = form.Note\n\t}\n\tif form.IsDraft != nil {\n\t\trel.IsDraft = *form.IsDraft\n\t}\n\tif form.IsPrerelease != nil {\n\t\trel.IsPrerelease = *form.IsPrerelease\n\t}\n\tif err := models.UpdateRelease(ctx.Repo.GitRepo, rel, nil); err != nil {\n\t\tctx.Error(500, \"UpdateRelease\", err)\n\t\treturn\n\t}\n\n\trel, err = models.GetReleaseByID(id)\n\tif err != nil {\n\t\tctx.Error(500, \"GetReleaseByID\", err)\n\t\treturn\n\t}\n\tif err := rel.LoadAttributes(); err != nil {\n\t\tctx.Error(500, \"LoadAttributes\", err)\n\t\treturn\n\t}\n\tctx.JSON(200, rel.APIFormat())\n}", "title": "" }, { "docid": "11e9d3a564744276124141d852b2ea43", "score": "0.5173765", "text": "func edit(id int, username string, timestamp time.Time, newComment string) error {\n\tcomm := tables.Comment{}\n\tcomm.ID = id\n\tcomm.Username = username\n\tcomm.Timestamp = timestamp\n\n\treturn update.ModifyComment(comm, newComment)\n\n}", "title": "" }, { "docid": "3ca477c73581a99bfc126a7afec1f0bb", "score": "0.5171998", "text": "func (p *PostController) UpdatePost(id int, post *models.Post) {\n\t// Applying validation\n\t// Validation is upcoming feature in aah framework\n\tif id == 0 {\n\t\tp.Reply().BadRequest().JSON(aah.Data{\n\t\t\t\"message\": \"bad request\",\n\t\t})\n\t\treturn\n\t}\n\n\tpost.ID = id\n\tupdatedPost := models.UpdatePost(post)\n\n\tp.Reply().Ok().JSON(aah.Data{\n\t\t\"data\": updatedPost,\n\t})\n}", "title": "" }, { "docid": "4cc2eb218c2958eb5841ba8fa3bd7d37", "score": "0.51595604", "text": "func (r *LogStorageFieldResource) Edit(id string, item LogStorageFieldConfig) error {\n\tif err := r.c.ModQuery(\"PUT\", BasePath+LogStorageFieldEndpoint+\"/\"+id, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aeb137bb12942107015cc4ac0100166a", "score": "0.5149963", "text": "func (bpu *BlogPostUpdate) Exec(ctx context.Context) error {\n\t_, err := bpu.Save(ctx)\n\treturn err\n}", "title": "" }, { "docid": "bc48f3ee72f660a52c9d4db1c2912869", "score": "0.5146456", "text": "func (this *UserAdminRouter) Edit() {\n\tform := models.UserAdminForm{}\n\tform.SetFromUser(&this.object)\n\tthis.SetFormSets(&form)\n}", "title": "" }, { "docid": "3c155af912923f9efde230a23c122eb6", "score": "0.5110262", "text": "func (z *PostManager) UpdatePost(tx Querier, post *Post) error {\n\tvar err error\n\n\tif has, err := z.Has(tx, post.ID); true {\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn err\n\t\t}\n\t\tif !has {\n\t\t\treturn fmt.Errorf(\"没有这篇文章\")\n\t\t}\n\t}\n\n\tif err = post.Update(tx); err != nil {\n\t\treturn err\n\t}\n\tif err = tagmgr.UpdateObjectTags(tx, post.ID, post.Tags); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fc3c15318f980a4c9fe019526c58e8d2", "score": "0.5107981", "text": "func handlePut(w http.ResponseWriter, r *http.Request) (err error) {\n\n\tvar id int\n\tvar post Post\n\tvar comment Comment\n\tvar author Author\n\tfor key, value := range r.URL.Query() {\n\t\tfor _, v := range value {\n\t\t\tif id, err = strconv.Atoi(v); err != nil {\n\t\t\t\tfmt.Println(\"Error cast string to int :\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tswitch key {\n\t\t\tcase \"post\":\n\t\t\t\tif post, err = decodePostJson(r); err != nil && err != io.EOF {\n\t\t\t\t\tfmt.Println(\"Error decode post Json :\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terr = (&post).updatePost(id)\n\t\t\tcase \"comment\":\n\t\t\t\tif comment, err = decodeCommentJson(r); err != nil && err != io.EOF {\n\t\t\t\t\tfmt.Println(\"Error decode comment Json :\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terr = (&comment).updateComment(id)\n\t\t\tcase \"author\":\n\t\t\t\tif author, err = decodeAuthorJson(r); err != nil && err != io.EOF {\n\t\t\t\t\tfmt.Println(\"Error decode author Json :\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terr = (&author).updateAuthor(id)\n\t\t\t}\n\t\t}\n\t}\n\tif err != nil {\n\t\tfmt.Println(\"Error update data :\", err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "25e051b21b1404f665fa387b2599c490", "score": "0.50981975", "text": "func AdvantageEdit(c *gin.Context) {\r\n\tdb := models.GetDB()\r\n\tadvantage := models.Advantage{}\r\n\tdb.First(&advantage, c.Param(\"id\"))\r\n\tif advantage.ID == 0 {\r\n\t\tc.HTML(http.StatusNotFound, \"errors/404\", nil)\r\n\t\treturn\r\n\t}\r\n\th := DefaultH(c)\r\n\th[\"Title\"] = \"Редактирование преимущества\"\r\n\th[\"Advantage\"] = advantage\r\n\tsession := sessions.Default(c)\r\n\th[\"Flash\"] = session.Flashes()\r\n\tsession.Save()\r\n\tc.HTML(http.StatusOK, \"advantages/form\", h)\r\n}", "title": "" }, { "docid": "672a3e216cc58db41294aef44ab98e3a", "score": "0.5098072", "text": "func AdminSiteEditPostHandler(ctx *middleware.AppContext, w http.ResponseWriter, r *http.Request) *middleware.Template {\n\tu, _ := middleware.User(r)\n\n\tsiteID, err := parseInt(getVar(r, \"siteID\"))\n\n\tif err != nil {\n\t\treturn &middleware.Template{\n\t\t\tName: tplAdminSites,\n\t\t\tActive: \"sites\",\n\t\t\tErr: err,\n\t\t}\n\t}\n\n\ts := &models.Site{\n\t\tID: siteID,\n\t\tTitle: r.FormValue(\"title\"),\n\t\tLink: r.FormValue(\"link\"),\n\t\tContent: r.FormValue(\"content\"),\n\t\tSection: r.FormValue(\"section\"),\n\t\tAuthor: u,\n\t}\n\n\tif r.FormValue(\"action\") == \"preview\" {\n\t\treturn previewSite(s)\n\t}\n\n\tif err := ctx.SiteService.Update(s); err != nil {\n\t\treturn &middleware.Template{\n\t\t\tName: tplAdminSites,\n\t\t\tErr: err,\n\t\t\tActive: \"sites\",\n\t\t\tData: map[string]interface{}{\n\t\t\t\t\"site\": s,\n\t\t\t},\n\t\t}\n\t}\n\n\treturn &middleware.Template{\n\t\tRedirectPath: \"admin/sites\",\n\t\tActive: \"sites\",\n\t\tSuccessMsg: fmt.Sprintf(\"%s %s.\", \"Successfully edited site\", s.Title),\n\t}\n}", "title": "" }, { "docid": "ce393bb333fec4f3efa7578e4e7c8e19", "score": "0.50975704", "text": "func (p PostService) UpdatePost(post *models.PostModel) (*models.PostModel, map[string]*revel.ValidationError, error) {\n\tvar err error\n\n\t//validate\n\tv := p.Validate(post)\n\n\t//update db\n\tif v == nil {\n\t\tm, err := p.PostRepository.Update(post)\n\t\tif err != nil {\n\t\t\treturn post, v, err\n\t\t}\n\t\treturn m, v, err\n\t}\n\treturn post, v, err\n\n}", "title": "" }, { "docid": "35a6e3db0f7384e74ec8eda307bbacb3", "score": "0.5096446", "text": "func (p PostAPI) UpdatePost(ctx *gin.Context) {\n\tauthUsername := ctx.MustGet(AuthUserKey)\n\tvar post models.Post\n\tif err := ctx.ShouldBindJSON(&post); err != nil {\n\t\tctx.JSON(http.StatusBadRequest, models.ApiResponse{\n\t\t\tMessage: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\t// user can only update their posts\n\tif post.Username != authUsername {\n\t\tctx.JSON(http.StatusForbidden, models.ApiResponse{\n\t\t\tMessage: \"invalid id or username\",\n\t\t})\n\t\treturn\n\t}\n\tif err := p.DB.FindOneAndReplace(ctx, post); err != nil {\n\t\tctx.JSON(http.StatusInternalServerError, models.ApiResponse{\n\t\t\tMessage: \"database error: \" + err.Error(),\n\t\t})\n\t}\n\tctx.JSON(http.StatusOK, models.ApiResponse{Message: \"post updated\"})\n}", "title": "" }, { "docid": "ee0cd7d060ba2e540d903b65dad91927", "score": "0.50937355", "text": "func UpdatePostHandle(db interface{}) func(server.Request) (handler.Response, error) {\n\n\treturn func(req server.Request) (handler.Response, error) {\n\n\t\t// Create the model object\n\t\tvar model models.PostModel\n\t\tif err := json.Unmarshal(req.Body, &model); err != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError}, err\n\t\t}\n\n\t\t// Create service\n\t\tpostService, serviceErr := service.NewPostService(db)\n\t\tif serviceErr != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError}, serviceErr\n\t\t}\n\t\tvar updatedAlbum *domain.PostAlbum = nil\n\t\tif model.PostTypeId == constants.PostConstAlbum.Parse() || model.PostTypeId == constants.PostConstPhotoGallery.Parse() {\n\t\t\tupdatedAlbum = &domain.PostAlbum{\n\t\t\t\tCount: model.Album.Count,\n\t\t\t\tCover: model.Album.Cover,\n\t\t\t\tCoverId: model.Album.CoverId,\n\t\t\t\tPhotos: model.Album.Photos,\n\t\t\t\tTitle: model.Album.Title,\n\t\t\t}\n\t\t}\n\t\tupdatedPost := &domain.Post{\n\t\t\tObjectId: model.ObjectId,\n\t\t\tPostTypeId: model.PostTypeId,\n\t\t\tOwnerUserId: req.UserID,\n\t\t\tScore: model.Score,\n\t\t\tVotes: model.Votes,\n\t\t\tViewCount: model.ViewCount,\n\t\t\tBody: model.Body,\n\t\t\tOwnerDisplayName: req.DisplayName,\n\t\t\tOwnerAvatar: req.Avatar,\n\t\t\tTags: model.Tags,\n\t\t\tCommentCounter: model.CommentCounter,\n\t\t\tImage: model.Image,\n\t\t\tImageFullPath: model.ImageFullPath,\n\t\t\tVideo: model.Video,\n\t\t\tThumbnail: model.Thumbnail,\n\t\t\tAlbum: updatedAlbum,\n\t\t\tDisableComments: model.DisableComments,\n\t\t\tDisableSharing: model.DisableSharing,\n\t\t\tDeleted: model.Deleted,\n\t\t\tDeletedDate: model.DeletedDate,\n\t\t\tCreatedDate: model.CreatedDate,\n\t\t\tLastUpdated: utils.UTCNowUnix(),\n\t\t\tAccessUserList: model.AccessUserList,\n\t\t\tPermission: model.Permission,\n\t\t\tVersion: model.Version,\n\t\t}\n\n\t\tif err := postService.UpdatePostById(updatedPost); err != nil {\n\t\t\terrorMessage := fmt.Sprintf(\"Update Post Error %s\", err.Error())\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError, Body: utils.MarshalError(\"updatePostError\", errorMessage)}, nil\n\t\t}\n\t\treturn handler.Response{\n\t\t\tBody: []byte(`{\"success\": true}`),\n\t\t\tStatusCode: http.StatusOK,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "1b8e2dc3f1c4897fdab3a139097a6e0c", "score": "0.50858307", "text": "func Update(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tbk, err := OneBook(r)\n\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\thttp.NotFound(w, r)\n\t\treturn\n\tcase err != nil:\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError)+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tconfig.TPL.ExecuteTemplate(w, \"update.gohtml\", bk)\n}", "title": "" } ]
2aaa31d6119ade92e4049a50cd645466
ExampleFpdf_SetPageBox demonstrates the use of a page box
[ { "docid": "62b3fa15a12d778b841641c158b17f3c", "score": "0.81539255", "text": "func ExampleFpdf_SetPageBox() {\n\t// pdfinfo (from http://www.xpdfreader.com) reports the following for this example:\n\t// ~ pdfinfo -box pdf/Fpdf_PageBox.pdf\n\t// Producer: FPDF 1.7\n\t// CreationDate: Sat Jan 1 00:00:00 2000\n\t// ModDate: \t Sat Jan 1 00:00:00 2000\n\t// Tagged: no\n\t// Form: none\n\t// Pages: 1\n\t// Encrypted: no\n\t// Page size: 493.23 x 739.85 pts (rotated 0 degrees)\n\t// MediaBox: 0.00 0.00 595.28 841.89\n\t// CropBox: 51.02 51.02 544.25 790.87\n\t// BleedBox: 51.02 51.02 544.25 790.87\n\t// TrimBox: 51.02 51.02 544.25 790.87\n\t// ArtBox: 51.02 51.02 544.25 790.87\n\t// File size: 1053 bytes\n\t// Optimized: no\n\t// PDF version: 1.3\n\tconst (\n\t\twd = 210\n\t\tht = 297\n\t\tfontsize = 6\n\t\tboxmargin = 3 * fontsize\n\t)\n\tpdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\") // 210mm x 297mm\n\tpdf.SetPageBox(\"crop\", boxmargin, boxmargin, wd-2*boxmargin, ht-2*boxmargin)\n\tpdf.SetFont(\"Arial\", \"\", pdf.UnitToPointConvert(fontsize))\n\tpdf.AddPage()\n\tpdf.MoveTo(fontsize, fontsize)\n\tpdf.Write(fontsize, \"This will be cropped from printed output\")\n\tpdf.MoveTo(boxmargin+fontsize, boxmargin+fontsize)\n\tpdf.Write(fontsize, \"This will be displayed in cropped output\")\n\tfileStr := example.Filename(\"Fpdf_PageBox\")\n\terr := pdf.OutputFileAndClose(fileStr)\n\texample.Summary(err, fileStr)\n\t// Output:\n\t// Successfully generated pdf/Fpdf_PageBox.pdf\n}", "title": "" } ]
[ { "docid": "41568d4ad0f6b35eb9a3557003e4b383", "score": "0.5616416", "text": "func ExampleFpdf_AddPage() {\n\t pdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\t pdf.SetHeaderFunc(func() {\n\t\t pdf.Image(ImageFile(\"logo.png\"), 10, 6, 30, 0, false, \"\", 0, \"\")\n\t\t pdf.SetY(5)\n\t\t pdf.SetFont(\"Arial\", \"B\", 15)\n\t\t pdf.Cell(80, 0, \"\")\n\t\t pdf.CellFormat(30, 10, \"Title\", \"1\", 0, \"C\", false, 0, \"\")\n\t\t pdf.Ln(20)\n\t })\n\t pdf.SetFooterFunc(func() {\n\t\t pdf.SetY(-15)\n\t\t pdf.SetFont(\"Arial\", \"I\", 8)\n\t\t pdf.CellFormat(0, 10, fmt.Sprintf(\"Page %d/{nb}\", pdf.PageNo()),\n\t\t\t \"\", 0, \"C\", false, 0, \"\")\n\t })\n\t pdf.AliasNbPages(\"\")\n\t pdf.AddPage()\n\t pdf.SetFont(\"Times\", \"\", 12)\n\t for j := 1; j <= 40; j++ {\n\t\t pdf.CellFormat(0, 10, fmt.Sprintf(\"Printing line number %d\", j),\n\t\t\t \"\", 1, \"\", false, 0, \"\")\n\t }\n\t fileStr := Filename(\"Fpdf_AddPage\")\n\t err := pdf.OutputFileAndClose(fileStr)\n\t Summary(err, fileStr)\n\t // Output:\n\t // Successfully generated pdf/Fpdf_AddPage.pdf\n }", "title": "" }, { "docid": "28f91359f620ced9ec03f6d2e5478317", "score": "0.54219264", "text": "func ExampleFpdf_SetAcceptPageBreakFunc() {\n\t var y0 float64\n\t var crrntCol int\n\t loremStr := lorem()\n\t pdf := gofpdf.New(\"L\", \"mm\", \"A4\", \"\")\n\t const (\n\t\t pageWd = 297.0 // A4 210.0 x 297.0\n\t\t margin = 10.0\n\t\t gutter = 4\n\t\t colNum = 3\n\t\t colWd = (pageWd - 2*margin - (colNum-1)*gutter) / colNum\n\t )\n\t setCol := func(col int) {\n\t\t crrntCol = col\n\t\t x := margin + float64(col)*(colWd+gutter)\n\t\t pdf.SetLeftMargin(x)\n\t\t pdf.SetX(x)\n\t }\n\t pdf.SetHeaderFunc(func() {\n\t\t titleStr := \"gofpdf\"\n\t\t pdf.SetFont(\"Helvetica\", \"B\", 48)\n\t\t wd := pdf.GetStringWidth(titleStr) + 6\n\t\t pdf.SetX((pageWd - wd) / 2)\n\t\t pdf.SetTextColor(128, 128, 160)\n\t\t pdf.Write(12, titleStr[:2])\n\t\t pdf.SetTextColor(128, 128, 128)\n\t\t pdf.Write(12, titleStr[2:])\n\t\t pdf.Ln(20)\n\t\t y0 = pdf.GetY()\n\t })\n\t pdf.SetAcceptPageBreakFunc(func() bool {\n\t\t if crrntCol < colNum-1 {\n\t\t\t setCol(crrntCol + 1)\n\t\t\t pdf.SetY(y0)\n\t\t\t // Start new column, not new page\n\t\t\t return false\n\t\t }\n\t\t setCol(0)\n\t\t return true\n\t })\n\t pdf.AddPage()\n\t pdf.SetFont(\"Times\", \"\", 12)\n\t for j := 0; j < 20; j++ {\n\t\t if j == 1 {\n\t\t\t pdf.Image(ImageFile(\"fpdf.png\"), -1, 0, colWd, 0, true, \"\", 0, \"\")\n\t\t } else if j == 5 {\n\t\t\t pdf.Image(ImageFile(\"golang-gopher.png\"),\n\t\t\t\t -1, 0, colWd, 0, true, \"\", 0, \"\")\n\t\t }\n\t\t pdf.MultiCell(colWd, 5, loremStr, \"\", \"\", false)\n\t\t pdf.Ln(-1)\n\t }\n\t fileStr := Filename(\"Fpdf_SetAcceptPageBreakFunc_landscape\")\n\t err := pdf.OutputFileAndClose(fileStr)\n\t Summary(err, fileStr)\n\t // Output:\n\t // Successfully generated pdf/Fpdf_SetAcceptPageBreakFunc_landscape.pdf\n }", "title": "" }, { "docid": "36be7a15f4eaaef4224ff08fb6eb7ed2", "score": "0.5394035", "text": "func (b *Builder) AddPageWithBox(mb, cb *Box) Page {\n\treturn b.dc.pages.newPage(mb, cb, nil)\n}", "title": "" }, { "docid": "de884672211ee5c4c53ee497af737471", "score": "0.5381139", "text": "func ExampleFpdf_SetLeftMargin() {\n\t var y0 float64\n\t var crrntCol int\n\t pdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\t pdf.SetDisplayMode(\"fullpage\", \"TwoColumnLeft\")\n\t titleStr := \"20000 Leagues Under the Seas\"\n\t pdf.SetTitle(titleStr, false)\n\t pdf.SetAuthor(\"Jules Verne\", false)\n\t setCol := func(col int) {\n\t\t // Set position at a given column\n\t\t crrntCol = col\n\t\t x := 10.0 + float64(col)*65.0\n\t\t pdf.SetLeftMargin(x)\n\t\t pdf.SetX(x)\n\t }\n\t chapterTitle := func(chapNum int, titleStr string) {\n\t\t // Arial 12\n\t\t pdf.SetFont(\"Arial\", \"\", 12)\n\t\t // Background color\n\t\t pdf.SetFillColor(200, 220, 255)\n\t\t // Title\n\t\t pdf.CellFormat(0, 6, fmt.Sprintf(\"Chapter %d : %s\", chapNum, titleStr),\n\t\t\t \"\", 1, \"L\", true, 0, \"\")\n\t\t // Line break\n\t\t pdf.Ln(4)\n\t\t y0 = pdf.GetY()\n\t }\n\t chapterBody := func(fileStr string) {\n\t\t // Read text file\n\t\t txtStr, err := ioutil.ReadFile(fileStr)\n\t\t if err != nil {\n\t\t\t pdf.SetError(err)\n\t\t }\n\t\t // Font\n\t\t pdf.SetFont(\"Times\", \"\", 12)\n\t\t // Output text in a 6 cm width column\n\t\t pdf.MultiCell(60, 5, string(txtStr), \"\", \"\", false)\n\t\t pdf.Ln(-1)\n\t\t // Mention\n\t\t pdf.SetFont(\"\", \"I\", 0)\n\t\t pdf.Cell(0, 5, \"(end of excerpt)\")\n\t\t // Go back to first column\n\t\t setCol(0)\n\t }\n\t printChapter := func(num int, titleStr, fileStr string) {\n\t\t // Add chapter\n\t\t pdf.AddPage()\n\t\t chapterTitle(num, titleStr)\n\t\t chapterBody(fileStr)\n\t }\n\t pdf.SetAcceptPageBreakFunc(func() bool {\n\t\t // Method accepting or not automatic page break\n\t\t if crrntCol < 2 {\n\t\t\t // Go to next column\n\t\t\t setCol(crrntCol + 1)\n\t\t\t // Set ordinate to top\n\t\t\t pdf.SetY(y0)\n\t\t\t // Keep on page\n\t\t\t return false\n\t\t }\n\t\t // Go back to first column\n\t\t setCol(0)\n\t\t // Page break\n\t\t return true\n\t })\n\t pdf.SetHeaderFunc(func() {\n\t\t // Arial bold 15\n\t\t pdf.SetFont(\"Arial\", \"B\", 15)\n\t\t // Calculate width of title and position\n\t\t wd := pdf.GetStringWidth(titleStr) + 6\n\t\t pdf.SetX((210 - wd) / 2)\n\t\t // Colors of frame, background and text\n\t\t pdf.SetDrawColor(0, 80, 180)\n\t\t pdf.SetFillColor(230, 230, 0)\n\t\t pdf.SetTextColor(220, 50, 50)\n\t\t // Thickness of frame (1 mm)\n\t\t pdf.SetLineWidth(1)\n\t\t // Title\n\t\t pdf.CellFormat(wd, 9, titleStr, \"1\", 1, \"C\", true, 0, \"\")\n\t\t // Line break\n\t\t pdf.Ln(10)\n\t\t // Save ordinate\n\t\t y0 = pdf.GetY()\n\t })\n\t pdf.SetFooterFunc(func() {\n\t\t // Position at 1.5 cm from bottom\n\t\t pdf.SetY(-15)\n\t\t // Arial italic 8\n\t\t pdf.SetFont(\"Arial\", \"I\", 8)\n\t\t // Text color in gray\n\t\t pdf.SetTextColor(128, 128, 128)\n\t\t // Page number\n\t\t pdf.CellFormat(0, 10, fmt.Sprintf(\"Page %d\", pdf.PageNo()),\n\t\t\t \"\", 0, \"C\", false, 0, \"\")\n\t })\n\t printChapter(1, \"A RUNAWAY REEF\", TextFile(\"20k_c1.txt\"))\n\t printChapter(2, \"THE PROS AND CONS\", TextFile(\"20k_c2.txt\"))\n\t fileStr := Filename(\"Fpdf_SetLeftMargin_multicolumn\")\n\t err := pdf.OutputFileAndClose(fileStr)\n\t Summary(err, fileStr)\n\t // Output:\n\t // Successfully generated pdf/Fpdf_SetLeftMargin_multicolumn.pdf\n }", "title": "" }, { "docid": "21d2dd46d2d810bc8fd57b0f02530730", "score": "0.53761816", "text": "func (rb *PDFBuilder) Page(f string) *PDFBuilder {\n\treturn rb.set(\"page\", f)\n}", "title": "" }, { "docid": "0d591351d4ded155cf2c7eb48483fe4e", "score": "0.53482276", "text": "func (p pager) draw() error {\n\ttermbox.Clear(termbox.ColorDefault, termbox.ColorDefault)\n\n\twidth, height := termbox.Size()\n\tvar centerOffset int\n\tfor y := 0; y < height; y++ {\n\t\tfor x := 0; x < p.doc.width; x++ {\n\t\t\tindex := (y+p.scrollY)*p.doc.width + x\n\t\t\tif index >= len(p.doc.cells) || index <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcell := p.doc.cells[index]\n\t\t\tif width > p.doc.width {\n\t\t\t\tcenterOffset = (width - p.doc.width) / 2\n\t\t\t}\n\n\t\t\t// Calling SetCell with coordinates outside of the terminal viewport\n\t\t\t// results in a no-op.\n\t\t\ttermbox.SetCell(x+p.scrollX+centerOffset, y, cell.Ch, cell.Fg, cell.Bg)\n\t\t}\n\t}\n\n\treturn termbox.Flush()\n}", "title": "" }, { "docid": "03031fa99866a77d9bb6d27eb4cca41d", "score": "0.534477", "text": "func (svg *Tag) Box(x, y, w, h int, color string) *Tag {\n\treturn svg.Rect2(&Pos{float64(x), float64(y)}, &Size{float64(w), float64(h)}, ColorByName(color))\n}", "title": "" }, { "docid": "716e3f952d57a983e0204653e0395c7d", "score": "0.5299973", "text": "func ExampleFpdf_PageSize() {\n\t pdf := gofpdf.NewCustom(&gofpdf.InitType{\n\t\t UnitStr: \"in\",\n\t\t Size: gofpdf.SizeType{Wd: 6, Ht: 6},\n\t\t FontDirStr: FontDir(),\n\t })\n\t pdf.SetMargins(0.5, 1, 0.5)\n\t pdf.SetFont(\"Times\", \"\", 14)\n\t pdf.AddPageFormat(\"L\", gofpdf.SizeType{Wd: 3, Ht: 12})\n\t pdf.SetXY(0.5, 1.5)\n\t pdf.CellFormat(11, 0.2, \"12 in x 3 in\", \"\", 0, \"C\", false, 0, \"\")\n\t pdf.AddPage() // Default size established in NewCustom()\n\t pdf.SetXY(0.5, 3)\n\t pdf.CellFormat(5, 0.2, \"6 in x 6 in\", \"\", 0, \"C\", false, 0, \"\")\n\t pdf.AddPageFormat(\"P\", gofpdf.SizeType{Wd: 3, Ht: 12})\n\t pdf.SetXY(0.5, 6)\n\t pdf.CellFormat(2, 0.2, \"3 in x 12 in\", \"\", 0, \"C\", false, 0, \"\")\n\t for j := 0; j <= 3; j++ {\n\t\t wd, ht, u := pdf.PageSize(j)\n\t\t fmt.Printf(\"%d: %6.2f %s, %6.2f %s\\n\", j, wd, u, ht, u)\n\t }\n\t fileStr := Filename(\"Fpdf_PageSize\")\n\t err := pdf.OutputFileAndClose(fileStr)\n\t Summary(err, fileStr)\n\t // Output:\n\t // 0: 6.00 in, 6.00 in\n\t // 1: 12.00 in, 3.00 in\n\t // 2: 6.00 in, 6.00 in\n\t // 3: 3.00 in, 12.00 in\n\t // Successfully generated pdf/Fpdf_PageSize.pdf\n }", "title": "" }, { "docid": "7cadefc1c23b0f1f2062324c893b3e7e", "score": "0.51520896", "text": "func ExampleFpdf_Rect() {\n\t marginCell := 2. // margin of top/bottom of cell\n\t pdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\t pdf.SetFont(\"Arial\", \"\", 12)\n\t pdf.AddPage()\n\t pagew, pageh := pdf.GetPageSize()\n\t mleft, mright, _, mbottom := pdf.GetMargins()\n \n\t cols := []float64{60, 100, pagew - mleft - mright - 100 - 60}\n\t rows := [][]string{}\n\t for i := 1; i <= 30; i++ {\n\t\t word := fmt.Sprintf(\"%d:%s\", i, strings.Repeat(\"A\", i%100))\n\t\t rows = append(rows, []string{word, word, word})\n\t }\n \n\t for _, row := range rows {\n\t\t curx, y := pdf.GetXY()\n\t\t x := curx\n \n\t\t height := 0.\n\t\t _, lineHt := pdf.GetFontSize()\n \n\t\t for i, txt := range row {\n\t\t\t lines := pdf.SplitLines([]byte(txt), cols[i])\n\t\t\t h := float64(len(lines))*lineHt + marginCell*float64(len(lines))\n\t\t\t if h > height {\n\t\t\t\t height = h\n\t\t\t }\n\t\t }\n\t\t // add a new page if the height of the row doesn't fit on the page\n\t\t if pdf.GetY()+height > pageh-mbottom {\n\t\t\t pdf.AddPage()\n\t\t\t y = pdf.GetY()\n\t\t }\n\t\t for i, txt := range row {\n\t\t\t width := cols[i]\n\t\t\t pdf.Rect(x, y, width, height, \"\")\n\t\t\t pdf.MultiCell(width, lineHt+marginCell, txt, \"\", \"\", false)\n\t\t\t x += width\n\t\t\t pdf.SetXY(x, y)\n\t\t }\n\t\t pdf.SetXY(curx, y+height)\n\t }\n\t fileStr := Filename(\"Fpdf_WrappedTableCells\")\n\t err := pdf.OutputFileAndClose(fileStr)\n\t Summary(err, fileStr)\n\t // Output:\n\t // Successfully generated pdf/Fpdf_WrappedTableCells.pdf\n }", "title": "" }, { "docid": "f0c116f6a6990a1f72a1e682130f8521", "score": "0.5136573", "text": "func drawBox(s tcell.Screen, lx, ly, lw, lh int, st tcell.Style) {\n\tx1 := lx\n\tx2 := lx + lw - 1\n\ty1 := ly\n\ty2 := ly + lh - 1\n\n\tfor col := x1; col <= x2; col++ {\n\t\ts.SetContent(col, y1, tcell.RuneHLine, nil, st)\n\t\ts.SetContent(col, y2, tcell.RuneHLine, nil, st)\n\t}\n\tfor row := y1 + 1; row < y2; row++ {\n\t\ts.SetContent(x1, row, tcell.RuneVLine, nil, st)\n\t\ts.SetContent(x2, row, tcell.RuneVLine, nil, st)\n\t}\n\ts.SetContent(x1, y1, tcell.RuneULCorner, nil, st)\n\ts.SetContent(x2, y1, tcell.RuneURCorner, nil, st)\n\ts.SetContent(x1, y2, tcell.RuneLLCorner, nil, st)\n\ts.SetContent(x2, y2, tcell.RuneLRCorner, nil, st)\n\n\ts.Show()\n}", "title": "" }, { "docid": "447c7b6f12b2b288936bf579c40e26d0", "score": "0.5096985", "text": "func NewBox(params *keygen.LocalPreParams) *ParamBox {\n\treturn &ParamBox{params}\n}", "title": "" }, { "docid": "b07a686b1bce152de34e81c81a4fda67", "score": "0.5071961", "text": "func ExampleFpdf_SetAcceptPageBreakFunc() {\n\tvar y0 float64\n\tvar crrntCol int\n\tloremStr := lorem()\n\tpdf := gofpdf.New(\"L\", \"mm\", \"A4\", \"\")\n\tconst (\n\t\tpageWd = 297.0 // A4 210.0 x 297.0\n\t\tmargin = 10.0\n\t\tgutter = 4\n\t\tcolNum = 3\n\t\tcolWd = (pageWd - 2*margin - (colNum-1)*gutter) / colNum\n\t)\n\tsetCol := func(col int) {\n\t\tcrrntCol = col\n\t\tx := margin + float64(col)*(colWd+gutter)\n\t\tpdf.SetLeftMargin(x)\n\t\tpdf.SetX(x)\n\t}\n\tpdf.SetHeaderFunc(func() {\n\t\ttitleStr := \"gofpdf\"\n\t\tpdf.SetFont(\"Helvetica\", \"B\", 48)\n\t\twd := pdf.GetStringWidth(titleStr) + 6\n\t\tpdf.SetX((pageWd - wd) / 2)\n\t\tpdf.SetTextColor(128, 128, 160)\n\t\tpdf.Write(12, titleStr[:2])\n\t\tpdf.SetTextColor(128, 128, 128)\n\t\tpdf.Write(12, titleStr[2:])\n\t\tpdf.Ln(20)\n\t\ty0 = pdf.GetY()\n\t})\n\tpdf.SetAcceptPageBreakFunc(func() bool {\n\t\tif crrntCol < colNum-1 {\n\t\t\tsetCol(crrntCol + 1)\n\t\t\tpdf.SetY(y0)\n\t\t\t// Start new column, not new page\n\t\t\treturn false\n\t\t}\n\t\tsetCol(0)\n\t\treturn true\n\t})\n\tpdf.AddPage()\n\tpdf.SetFont(\"Times\", \"\", 12)\n\tfor j := 0; j < 20; j++ {\n\t\tif j == 1 {\n\t\t\tpdf.Image(example.ImageFile(\"fpdf.png\"), -1, 0, colWd, 0, true, \"\", 0, \"\")\n\t\t} else if j == 5 {\n\t\t\tpdf.Image(example.ImageFile(\"golang-gopher.png\"),\n\t\t\t\t-1, 0, colWd, 0, true, \"\", 0, \"\")\n\t\t}\n\t\tpdf.MultiCell(colWd, 5, loremStr, \"\", \"\", false)\n\t\tpdf.Ln(-1)\n\t}\n\tfileStr := example.Filename(\"Fpdf_SetAcceptPageBreakFunc_landscape\")\n\terr := pdf.OutputFileAndClose(fileStr)\n\texample.Summary(err, fileStr)\n\t// Output:\n\t// Successfully generated pdf/Fpdf_SetAcceptPageBreakFunc_landscape.pdf\n}", "title": "" }, { "docid": "a0b767f9c7a801f093731cfa75150a0b", "score": "0.5044888", "text": "func ImportPageFromStream(f gofpdiPdf, rs *io.ReadSeeker, pageno int, box string) int {\n\treturn fpdi.ImportPageFromStream(f, rs, pageno, box)\n}", "title": "" }, { "docid": "55a7221a9a5b6ac7686ea4d1c4ccfccf", "score": "0.50085074", "text": "func (w World) setBox(x uint64, y uint64, element uint8) {\n\tw.Ground[y][x] = element\n}", "title": "" }, { "docid": "a4ba4fffb41a1fb657f11e9b4cdf7787", "score": "0.4945209", "text": "func (sc *Scene) SelectBox() {\n\tif sc.CurSel == nil {\n\t\treturn\n\t}\n\tupdt := sc.UpdateStart()\n\tdefer sc.UpdateEnd(updt)\n\n\tnb := sc.CurSel.AsNode3D()\n\tsc.DeleteChildByName(SelBoxName, ki.DestroyKids) // get rid of existing\n\tclr, _ := gist.ColorFromName(string(sc.SelParams.Color))\n\tAddNewLineBox(sc, sc, SelBoxName, SelBoxName, nb.WorldBBox.BBox, sc.SelParams.Width, clr, Inactive)\n\n\tsc.ReconfigMeshes()\n\tsc.Render()\n}", "title": "" }, { "docid": "d3d2f1d05c08ab11d080423970dc7937", "score": "0.4943576", "text": "func drawBox(x, y, width, height int) {\n\tfg, bg := termbox.ColorWhite, termbox.ColorDefault\n\twidth, height = width-1, height-1\n\n\t// Corners\n\ttermbox.SetCell(x, y, '┌', fg, bg)\n\ttermbox.SetCell(x+width, y, '┐', fg, bg)\n\ttermbox.SetCell(x+width, y+height, '┘', fg, bg)\n\ttermbox.SetCell(x, y+height, '└', fg, bg)\n\n\t// Top & Bottom Lines\n\tfor i := 1; i < width; i++ {\n\t\ttermbox.SetCell(x+i, y, '─', fg, bg)\n\t\ttermbox.SetCell(x+i, y+height, '─', fg, bg)\n\t}\n\n\t// Right & Left Lines\n\tfor i := 1; i < height; i++ {\n\t\ttermbox.SetCell(x, y+i, '│', fg, bg)\n\t\ttermbox.SetCell(x+width, y+i, '│', fg, bg)\n\t}\n\n\ttermbox.Flush()\n}", "title": "" }, { "docid": "ad8c3e3eaf3d0ca997f9ba27b61c83f3", "score": "0.4927551", "text": "func beginPage(canvas *gc.Canvas, bgcolor string) {\n\tcanvas.Rect(50, 50, 100, 100, gc.ColorLookup(bgcolor))\n}", "title": "" }, { "docid": "4577bb0411adffc56e58b2aa3678c44c", "score": "0.49193752", "text": "func NewBox() *Box {\n\tb := &Box{\n\t\twidth: 15,\n\t\theight: 10,\n\t\tvisible: true,\n\t\tbackgroundColor: Styles.PrimitiveBackgroundColor,\n\t\tborderColor: Styles.BorderColor,\n\t\ttitleColor: Styles.TitleColor,\n\t\tborderColorFocused: ColorUnset,\n\t\ttitleAlign: AlignCenter,\n\t\tshowFocus: true,\n\t}\n\tb.focus = b\n\tb.updateInnerRect()\n\treturn b\n}", "title": "" }, { "docid": "a0de4f3f7b1c0212565dee0869921697", "score": "0.49015635", "text": "func ImportPage(f gofpdiPdf, sourceFile string, pageno int, box string) int {\n\treturn fpdi.ImportPage(f, sourceFile, pageno, box)\n}", "title": "" }, { "docid": "5a3fbba087613bad5c6addb24faac97f", "score": "0.48965868", "text": "func (p *JSONGOFPDF) AddPage(pdf *gofpdf.Fpdf, logic string) (opdf *gofpdf.Fpdf) {\n\tpdf.AddPage()\n\treturn pdf\n}", "title": "" }, { "docid": "3010acc2fd3d037c3b126897f1d894e2", "score": "0.4871281", "text": "func (s * Surface) Box(x1, y1, w, h int, color uint32) {\n s.HLine(x1\t , y1 , w, color)\n s.HLine(x1\t , y1 + h, w, color)\n s.VLine(x1\t , y1 , h, color)\n s.VLine(x1 + w , y1 , h, color)\n}", "title": "" }, { "docid": "161bbbeb780e5579ed4d0074bf87174e", "score": "0.48656696", "text": "func Box(state *State, x, y int, title string, elems ...Elem) {\n\n\t// Make the mouse click visible only to clicked elements\n\tpendingMouseClick := state.MouseClick\n\tstate.MouseClick = false\n\n\n\tbgColor := state.Colors.Default\n\tfgColor := state.Colors.Default\n\n\t// Calculate box size\n\tmaxWidth := len(title)\n\tselectableElems := 0\n\tfor _, e := range elems {\n\t\twidth := e.MaxWidth()\n\t\tif width > maxWidth {\n\t\t\tmaxWidth = width\n\t\t}\n\t\tif e.CanBeSelected() {\n\t\t\tselectableElems++\n\t\t}\n\t}\n\n\tif state.Cursor.X == state.boxesCnt {\n\t\tif state.KeyState[termbox.KeyArrowUp] && state.Cursor.Y > 0 {\n\t\t\tstate.Cursor.Y--\n\t\t}\n\n\t\tif state.KeyState[termbox.KeyArrowDown] {\n\t\t\tstate.Cursor.Y++\n\t\t}\n\n\t\tif state.Cursor.Y >= selectableElems {\n\t\t\tstate.Cursor.Y = selectableElems - 1\n\t\t}\n\n\t\tif state.KeyState[termbox.KeyArrowLeft] && state.Cursor.X > 0 {\n\t\t\tstate.Cursor.X--\n\t\t\tstate.KeyState[termbox.KeyArrowLeft] = false\n\t\t\tstate.NeedsRedraw = true\n\t\t}\n\n\t\tif state.KeyState[termbox.KeyArrowRight] {\n\t\t\tstate.Cursor.X++\n\t\t\tstate.KeyState[termbox.KeyArrowRight] = false\n\t\t\tstate.NeedsRedraw = true\n\t\t}\n\t}\n\n\tselected := state.Cursor.X == state.boxesCnt\n\tif selected {\n\t\tfgColor = state.Colors.Selected\n\t}\n\n\t// Draw box\n\tboxWidth := maxWidth + 4\n\tboxHeight := len(elems) + 2\n\n\tDrawBox(x, y, boxWidth, boxHeight, title, fgColor, bgColor)\n\n\t// Draw elements\n\telem := -1\n\tfor i, e := range elems {\n\t\tif e.CanBeSelected() {\n\t\t\telem++\n\t\t}\n\t\telemSelected := (selected && state.Cursor.Y == elem)\n\t\telemScreenPos := Coords{x + 2, y + 1 + i}\n\t\tif pendingMouseClick {\n\t\t\tif checkMouseClick(state, elemScreenPos, maxWidth) {\n\t\t\t\telemSelected = true\n\t\t\t\tstate.Cursor = Coords{state.boxesCnt, elem}\n\t\t\t\tstate.NeedsRedraw = true\n\t\t\t\tstate.MouseClick = true\n\t\t\t\tpendingMouseClick = false\n\t\t\t}\n\t\t}\n\t\te.Draw(state, elemScreenPos, maxWidth, selected, elemSelected)\n\t\tstate.MouseClick = false\n\t}\n\n\tstate.boxesCnt++\n\tstate.MouseClick = pendingMouseClick\n}", "title": "" }, { "docid": "0b44b772b60122253dd831f53e19bc76", "score": "0.48654297", "text": "func ExampleFpdf_SetPage() {\n\trnd := rand.New(rand.NewSource(0)) // Make reproducible documents\n\tpdf := gofpdf.New(\"L\", \"cm\", \"A4\", \"\")\n\tpdf.SetFont(\"Times\", \"\", 12)\n\n\tvar time []float64\n\ttemperaturesFromSensors := make([][]float64, 5)\n\tmaxs := []float64{25, 41, 89, 62, 11}\n\tfor i := range temperaturesFromSensors {\n\t\ttemperaturesFromSensors[i] = make([]float64, 0)\n\t}\n\n\tfor i := 0.0; i < 100; i += 0.5 {\n\t\ttime = append(time, i)\n\t\tfor j, sensor := range temperaturesFromSensors {\n\t\t\tdataValue := rnd.Float64() * maxs[j]\n\t\t\tsensor = append(sensor, dataValue)\n\t\t\ttemperaturesFromSensors[j] = sensor\n\t\t}\n\t}\n\tvar graphs []gofpdf.GridType\n\tvar pageNums []int\n\txMax := time[len(time)-1]\n\tfor i := range temperaturesFromSensors {\n\t\t//Create a new page and graph for each sensor we want to graph.\n\t\tpdf.AddPage()\n\t\tpdf.Ln(1)\n\t\t//Custom label per sensor\n\t\tpdf.WriteAligned(0, 0, \"Temperature Sensor \"+strconv.Itoa(i+1)+\" (C) vs Time (min)\", \"C\")\n\t\tpdf.Ln(0.5)\n\t\tgraph := gofpdf.NewGrid(pdf.GetX(), pdf.GetY(), 20, 10)\n\t\tgraph.TickmarksContainX(0, xMax)\n\t\t//Custom Y axis\n\t\tgraph.TickmarksContainY(0, maxs[i])\n\t\tgraph.Grid(pdf)\n\t\t//Save references and locations.\n\t\tgraphs = append(graphs, graph)\n\t\tpageNums = append(pageNums, pdf.PageNo())\n\t}\n\t// For each X, graph the Y in each sensor.\n\tfor i, currTime := range time {\n\t\tfor j, sensor := range temperaturesFromSensors {\n\t\t\tpdf.SetPage(pageNums[j])\n\t\t\tgraph := graphs[j]\n\t\t\ttemperature := sensor[i]\n\t\t\tpdf.Circle(graph.X(currTime), graph.Y(temperature), 0.04, \"D\")\n\t\t}\n\t}\n\n\tfileStr := example.Filename(\"Fpdf_SetPage\")\n\terr := pdf.OutputFileAndClose(fileStr)\n\texample.Summary(err, fileStr)\n\t// Output:\n\t// Successfully generated pdf/Fpdf_SetPage.pdf\n}", "title": "" }, { "docid": "2470c90072e403d297f71d576d449759", "score": "0.48447835", "text": "func BoxByPoint(ctx context.Context, db DB, p0 pgtypes.Point) (pgtypes.Box, error) {\n\t// call pg_catalog.box\n\tconst sqlstr = `SELECT * FROM pg_catalog.box($1)`\n\t// run\n\tvar r0 pgtypes.Box\n\tlogf(sqlstr, p0)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0).Scan(&r0); err != nil {\n\t\treturn pgtypes.Box{}, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "b805cbd6e8965d563554c20b51a6d9e4", "score": "0.4843469", "text": "func (wb *WidgetBase) RenderBoxImpl(pos mat32.Vec2, sz mat32.Vec2, bs gist.Border) {\n\trs := &wb.Viewport.Render\n\tpc := &rs.Paint\n\tpc.DrawBorder(rs, pos.X, pos.Y, sz.X, sz.Y, bs)\n}", "title": "" }, { "docid": "74813a2cef0d20ad8e09c6a091b24417", "score": "0.48341984", "text": "func ExampleFpdf_SetLeftMargin() {\n\tvar y0 float64\n\tvar crrntCol int\n\tpdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\tpdf.SetDisplayMode(\"fullpage\", \"TwoColumnLeft\")\n\ttitleStr := \"20000 Leagues Under the Seas\"\n\tpdf.SetTitle(titleStr, false)\n\tpdf.SetAuthor(\"Jules Verne\", false)\n\tsetCol := func(col int) {\n\t\t// Set position at a given column\n\t\tcrrntCol = col\n\t\tx := 10.0 + float64(col)*65.0\n\t\tpdf.SetLeftMargin(x)\n\t\tpdf.SetX(x)\n\t}\n\tchapterTitle := func(chapNum int, titleStr string) {\n\t\t// Arial 12\n\t\tpdf.SetFont(\"Arial\", \"\", 12)\n\t\t// Background color\n\t\tpdf.SetFillColor(200, 220, 255)\n\t\t// Title\n\t\tpdf.CellFormat(0, 6, fmt.Sprintf(\"Chapter %d : %s\", chapNum, titleStr),\n\t\t\t\"\", 1, \"L\", true, 0, \"\")\n\t\t// Line break\n\t\tpdf.Ln(4)\n\t\ty0 = pdf.GetY()\n\t}\n\tchapterBody := func(fileStr string) {\n\t\t// Read text file\n\t\ttxtStr, err := ioutil.ReadFile(fileStr)\n\t\tif err != nil {\n\t\t\tpdf.SetError(err)\n\t\t}\n\t\t// Font\n\t\tpdf.SetFont(\"Times\", \"\", 12)\n\t\t// Output text in a 6 cm width column\n\t\tpdf.MultiCell(60, 5, string(txtStr), \"\", \"\", false)\n\t\tpdf.Ln(-1)\n\t\t// Mention\n\t\tpdf.SetFont(\"\", \"I\", 0)\n\t\tpdf.Cell(0, 5, \"(end of excerpt)\")\n\t\t// Go back to first column\n\t\tsetCol(0)\n\t}\n\tprintChapter := func(num int, titleStr, fileStr string) {\n\t\t// Add chapter\n\t\tpdf.AddPage()\n\t\tchapterTitle(num, titleStr)\n\t\tchapterBody(fileStr)\n\t}\n\tpdf.SetAcceptPageBreakFunc(func() bool {\n\t\t// Method accepting or not automatic page break\n\t\tif crrntCol < 2 {\n\t\t\t// Go to next column\n\t\t\tsetCol(crrntCol + 1)\n\t\t\t// Set ordinate to top\n\t\t\tpdf.SetY(y0)\n\t\t\t// Keep on page\n\t\t\treturn false\n\t\t}\n\t\t// Go back to first column\n\t\tsetCol(0)\n\t\t// Page break\n\t\treturn true\n\t})\n\tpdf.SetHeaderFunc(func() {\n\t\t// Arial bold 15\n\t\tpdf.SetFont(\"Arial\", \"B\", 15)\n\t\t// Calculate width of title and position\n\t\twd := pdf.GetStringWidth(titleStr) + 6\n\t\tpdf.SetX((210 - wd) / 2)\n\t\t// Colors of frame, background and text\n\t\tpdf.SetDrawColor(0, 80, 180)\n\t\tpdf.SetFillColor(230, 230, 0)\n\t\tpdf.SetTextColor(220, 50, 50)\n\t\t// Thickness of frame (1 mm)\n\t\tpdf.SetLineWidth(1)\n\t\t// Title\n\t\tpdf.CellFormat(wd, 9, titleStr, \"1\", 1, \"C\", true, 0, \"\")\n\t\t// Line break\n\t\tpdf.Ln(10)\n\t\t// Save ordinate\n\t\ty0 = pdf.GetY()\n\t})\n\tpdf.SetFooterFunc(func() {\n\t\t// Position at 1.5 cm from bottom\n\t\tpdf.SetY(-15)\n\t\t// Arial italic 8\n\t\tpdf.SetFont(\"Arial\", \"I\", 8)\n\t\t// Text color in gray\n\t\tpdf.SetTextColor(128, 128, 128)\n\t\t// Page number\n\t\tpdf.CellFormat(0, 10, fmt.Sprintf(\"Page %d\", pdf.PageNo()),\n\t\t\t\"\", 0, \"C\", false, 0, \"\")\n\t})\n\tprintChapter(1, \"A RUNAWAY REEF\", example.TextFile(\"20k_c1.txt\"))\n\tprintChapter(2, \"THE PROS AND CONS\", example.TextFile(\"20k_c2.txt\"))\n\tfileStr := example.Filename(\"Fpdf_SetLeftMargin_multicolumn\")\n\terr := pdf.OutputFileAndClose(fileStr)\n\texample.Summary(err, fileStr)\n\t// Output:\n\t// Successfully generated pdf/Fpdf_SetLeftMargin_multicolumn.pdf\n}", "title": "" }, { "docid": "c09c33cada0efb88d55881664d87b6f1", "score": "0.48286054", "text": "func NewBox() *Box {\n\tb := &Box{\n\t\twidth: 15,\n\t\theight: 10,\n\t\tinnerX: -1, // Mark as uninitialized.\n\t\tbackgroundColor: tcell.ColorBlack,\n\t\ttitleColor: tcell.ColorYellow,\n\t}\n\treturn b\n}", "title": "" }, { "docid": "bad8f04567c9c8fe094d2203b46b6fe1", "score": "0.48079452", "text": "func BoundBox(ctx context.Context, db DB, p0, p1 pgtypes.Box) (pgtypes.Box, error) {\n\t// call pg_catalog.bound_box\n\tconst sqlstr = `SELECT * FROM pg_catalog.bound_box($1, $2)`\n\t// run\n\tvar r0 pgtypes.Box\n\tlogf(sqlstr, p0, p1)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0, p1).Scan(&r0); err != nil {\n\t\treturn pgtypes.Box{}, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "8861722cbb266215ea9185a14381580e", "score": "0.47814175", "text": "func DrawBox(x, y, w, h int, title string, fgColor, bgColor termbox.Attribute) {\n\ttermbox.SetCell(x, y, '╭', fgColor, bgColor)\n\ttermbox.SetCell(x+w-1, y, '╮', fgColor, bgColor)\n\ttermbox.SetCell(x, y+h-1, '╰', fgColor, bgColor)\n\ttermbox.SetCell(x+w-1, y+h-1, '╯', fgColor, bgColor)\n\tfor dx := 1; dx < w-1; dx++ {\n\t\ttermbox.SetCell(x+dx, y, '─', fgColor, bgColor)\n\t\ttermbox.SetCell(x+dx, y+h-1, '─', fgColor, bgColor)\n\t}\n\n\tfor dy := 0; dy < h-2; dy++ {\n\t\ttermbox.SetCell(x, y+dy+1, '│', fgColor, bgColor)\n\t\ttermbox.SetCell(x+w-1, y+dy+1, '│', fgColor, bgColor)\n\t}\n\n\ttitlePos := (w - len(title)) / 2\n\tWriteText(x+titlePos, y, title, fgColor, bgColor)\n}", "title": "" }, { "docid": "505c0426ee5b6470ec256320ebddcfae", "score": "0.4773482", "text": "func BoxAdd(ctx context.Context, db DB, p0 pgtypes.Box, p1 pgtypes.Point) (pgtypes.Box, error) {\n\t// call pg_catalog.box_add\n\tconst sqlstr = `SELECT * FROM pg_catalog.box_add($1, $2)`\n\t// run\n\tvar r0 pgtypes.Box\n\tlogf(sqlstr, p0, p1)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0, p1).Scan(&r0); err != nil {\n\t\treturn pgtypes.Box{}, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "3da2807b61d2a1a3b657eef5aa5e2252", "score": "0.47706908", "text": "func (this *DefaultFigureDecorator) setBasicDisplayBox(topLeft *Point, bottomRight *Point) {\n\tthis.figure.setBasicDisplayBox(topLeft , bottomRight)\n}", "title": "" }, { "docid": "b30063fc57163bc61172db55136b1c86", "score": "0.47622526", "text": "func ExampleFpdf_AddPage() {\n\tpdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\tpdf.SetTopMargin(30)\n\tpdf.SetHeaderFuncMode(func() {\n\t\tpdf.Image(example.ImageFile(\"logo.png\"), 10, 6, 30, 0, false, \"\", 0, \"\")\n\t\tpdf.SetY(5)\n\t\tpdf.SetFont(\"Arial\", \"B\", 15)\n\t\tpdf.Cell(80, 0, \"\")\n\t\tpdf.CellFormat(30, 10, \"Title\", \"1\", 0, \"C\", false, 0, \"\")\n\t\tpdf.Ln(20)\n\t}, true)\n\tpdf.SetFooterFunc(func() {\n\t\tpdf.SetY(-15)\n\t\tpdf.SetFont(\"Arial\", \"I\", 8)\n\t\tpdf.CellFormat(0, 10, fmt.Sprintf(\"Page %d/{nb}\", pdf.PageNo()),\n\t\t\t\"\", 0, \"C\", false, 0, \"\")\n\t})\n\tpdf.AliasNbPages(\"\")\n\tpdf.AddPage()\n\tpdf.SetFont(\"Times\", \"\", 12)\n\tfor j := 1; j <= 40; j++ {\n\t\tpdf.CellFormat(0, 10, fmt.Sprintf(\"Printing line number %d\", j),\n\t\t\t\"\", 1, \"\", false, 0, \"\")\n\t}\n\tfileStr := example.Filename(\"Fpdf_AddPage\")\n\terr := pdf.OutputFileAndClose(fileStr)\n\texample.Summary(err, fileStr)\n\t// Output:\n\t// Successfully generated pdf/Fpdf_AddPage.pdf\n}", "title": "" }, { "docid": "e3fbc0bce8c789685fe7bd8c22fb3e66", "score": "0.47564197", "text": "func BoxByPointAndPoint(ctx context.Context, db DB, p0, p1 pgtypes.Point) (pgtypes.Box, error) {\n\t// call pg_catalog.box\n\tconst sqlstr = `SELECT * FROM pg_catalog.box($1, $2)`\n\t// run\n\tvar r0 pgtypes.Box\n\tlogf(sqlstr, p0, p1)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0, p1).Scan(&r0); err != nil {\n\t\treturn pgtypes.Box{}, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "3a4423fba09ee9a3f09243acb918c740", "score": "0.47551224", "text": "func Setup(f *gofpdf.Fpdf) {\n\tf.AddPage()\n\tf.SetFont(\"helvetica\", \"\", 16)\n\tf.SetMargins(10, 13, 10)\n\tf.SetFillColor(255, 255, 255)\n\tf.SetTextColor(36, 41, 46)\n}", "title": "" }, { "docid": "03a1eb77b71b258f1629eb9ae8c5db3a", "score": "0.47431496", "text": "func NewStppBox(namespace, schemaLocation, auxiliaryMimeTypes string) *StppBox {\n\treturn &StppBox{\n\t\tNamespace: namespace,\n\t\tSchemaLocation: schemaLocation,\n\t\tAuxiliaryMimeTypes: auxiliaryMimeTypes,\n\t\tDataReferenceIndex: 1,\n\t}\n}", "title": "" }, { "docid": "89cb9c828afd2b8dbe529a87ba36ace9", "score": "0.47332957", "text": "func addBox(mp4 map[string][]interface{}, boxPath string, box interface{}) {\n\tif mp4[boxPath] == nil {\n\t\tmp4[boxPath] = make([]interface{}, 1)\n\t\tmp4[boxPath][0] = box\n\t} else {\n\t\tmp4[boxPath] = append(mp4[boxPath], box)\n\t}\n}", "title": "" }, { "docid": "6152df08529a9052e2866d186ab1a153", "score": "0.47099456", "text": "func (f *FlipBook) SetPage(page PreferredSizeLocateableWidget) {\n\tf.init.Do()\n\n\tif f.removeCurrent != nil {\n\t\tf.removeCurrent()\n\t}\n\n\tf.removeCurrent = f.container.AddChild(page)\n}", "title": "" }, { "docid": "356e204dcb555bbf6007fdcc174e5e5f", "score": "0.46996632", "text": "func BoxSub(ctx context.Context, db DB, p0 pgtypes.Box, p1 pgtypes.Point) (pgtypes.Box, error) {\n\t// call pg_catalog.box_sub\n\tconst sqlstr = `SELECT * FROM pg_catalog.box_sub($1, $2)`\n\t// run\n\tvar r0 pgtypes.Box\n\tlogf(sqlstr, p0, p1)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0, p1).Scan(&r0); err != nil {\n\t\treturn pgtypes.Box{}, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "414ce98ddba3e9f682893987d555d87d", "score": "0.46831888", "text": "func renderBlock(pdf *gofpdf.Fpdf, s *Section, page *Page) {\n\t// adjust x/y\n\tcomputeCoordinates(s, &page.Margins)\n\t// copy the x,y values\n\tx, y := s.X, s.Y\n\t// this is necessary to handle unicode string\n\ttr := pdf.UnicodeTranslatorFromDescriptor(\"\")\n\t//\n\tpdf.SetXY(x, y)\n\tif len(s.Title) > 0 {\n\t\t// write title\n\t\tpdf.SetFont(page.Font.Family, fontStyleNormal, page.Font.SizeH2)\n\t\tpdf.MultiCell(boxFullWidth, page.Font.LineHeightH2, tr(s.Title), borderNone, textAlignLeft, noFill)\n\t\t// update x,y\n\t\tx, y = s.X, s.Y+page.Font.LineHeightH2\n\t}\n\t// reset the font to normal\n\tpdf.SetFont(page.Font.Family, fontStyleNormal, page.Font.SizeNormal)\n\n\tif len(s.Content) > 0 {\n\t\t// write content\n\t\tpdf.SetXY(x, y)\n\t\tpdf.MultiCell(boxFullWidth, page.Font.LineHeightNormal, tr(s.Content), borderNone, textAlignLeft, noFill)\n\t}\n}", "title": "" }, { "docid": "9cb0b739b0532ebd3c8bd4c7f02199d3", "score": "0.4680935", "text": "func (wb *WidgetBase) RenderStdBox(st *gist.Style) {\n\t// SidesTODO: this is a pretty critical function, so a good place to look if things aren't working\n\twb.StyMu.RLock()\n\tdefer wb.StyMu.RUnlock()\n\n\trs := &wb.Viewport.Render\n\tpc := &rs.Paint\n\n\t// TODO: maybe implement some version of this to render background color\n\t// in margin if the parent element doesn't render for us\n\t// if pwb, ok := wb.Parent().(*WidgetBase); ok {\n\t// \tif pwb.Embed(TypeLayout) != nil && pwb.Embed(TypeFrame) == nil {\n\t// \t\tpc.FillBox(rs, wb.LayState.Alloc.Pos, wb.LayState.Alloc.Size, &st.BackgroundColor)\n\t// \t}\n\t// }\n\n\tpos := wb.LayState.Alloc.Pos.Add(st.EffMargin().Pos())\n\tsz := wb.LayState.Alloc.Size.Sub(st.EffMargin().Size())\n\trad := st.Border.Radius.Dots()\n\n\t// the background color we actually use\n\tbg := st.BackgroundColor\n\t// the surrounding background color\n\tsbg := wb.ParentBackgroundColor()\n\tif bg.IsNil() {\n\t\t// we need to do this to prevent\n\t\t// elements from rendering over themselves\n\t\t// (see https://github.com/goki/gi/issues/565)\n\t\tbg = sbg\n\t}\n\n\t// We need to fill the whole box where the\n\t// box shadows / element can go to prevent growing\n\t// box shadows and borders. We couldn't just\n\t// do this when there are box shadows, as they\n\t// may be removed and then need to be covered up.\n\t// This also fixes https://github.com/goki/gi/issues/579.\n\t// This isn't an ideal solution because of performance,\n\t// so TODO: maybe come up with a better solution for this.\n\t// We need to use raw LayState data because we need to clear\n\t// any box shadow that may have gone in margin.\n\tmspos, mssz := st.BoxShadowPosSize(wb.LayState.Alloc.Pos, wb.LayState.Alloc.Size)\n\tpc.FillBox(rs, mspos, mssz, &sbg)\n\n\t// first do any shadow\n\tif st.HasBoxShadow() {\n\t\tfor _, shadow := range st.BoxShadow {\n\t\t\tpc.StrokeStyle.SetColor(nil)\n\t\t\tpc.FillStyle.SetColor(shadow.Color)\n\n\t\t\t// TODO: better handling of opacity?\n\t\t\tprevOpacity := pc.FillStyle.Opacity\n\t\t\tpc.FillStyle.Opacity = gist.RGBAf32Model.Convert(shadow.Color).(gist.RGBAf32).A\n\t\t\t// we only want radius for border, no actual border\n\t\t\twb.RenderBoxImpl(shadow.BasePos(pos), shadow.BaseSize(sz), gist.Border{Radius: st.Border.Radius})\n\t\t\t// pc.FillStyle.Opacity = 1.0\n\t\t\tif shadow.Blur.Dots != 0 {\n\t\t\t\t// must divide by 2 like CSS\n\t\t\t\tpc.BlurBox(rs, shadow.Pos(pos), shadow.Size(sz), shadow.Blur.Dots/2)\n\t\t\t}\n\t\t\tpc.FillStyle.Opacity = prevOpacity\n\t\t}\n\t}\n\n\t// then draw the box over top of that.\n\t// need to set clipping to box first.. (?)\n\t// we need to draw things twice here because we need to clear\n\t// the whole area with the background color first so the border\n\t// doesn't render weirdly\n\tif rad.IsZero() {\n\t\tpc.FillBox(rs, pos, sz, &bg)\n\t} else {\n\t\tpc.FillStyle.SetColorSpec(&bg)\n\t\t// no border -- fill only\n\t\tpc.DrawRoundedRectangle(rs, pos.X, pos.Y, sz.X, sz.Y, rad)\n\t\tpc.Fill(rs)\n\t}\n\n\t// pc.StrokeStyle.SetColor(&st.Border.Color)\n\t// pc.StrokeStyle.Width = st.Border.Width\n\t// pc.FillStyle.SetColorSpec(&st.BackgroundColor)\n\tpos.SetAdd(st.Border.Width.Dots().Pos().MulScalar(0.5))\n\tsz.SetSub(st.Border.Width.Dots().Size().MulScalar(0.5))\n\tpc.FillStyle.SetColor(nil)\n\t// now that we have drawn background color\n\t// above, we can draw the border\n\twb.RenderBoxImpl(pos, sz, st.Border)\n}", "title": "" }, { "docid": "9c95f4500ebc15f23e684c9ce48b8788", "score": "0.46793154", "text": "func BoxPlot(w vg.Length, loc float64, values plotter.Valuer, cfg BoxPlotConfig) PlotterFunc {\n\treturn func(plt *plot.Plot) (plot.Plotter, error) {\n\t\tpltr, err := plotter.NewBoxPlot(w, loc, values)\n\t\tif err != nil {\n\t\t\treturn nil, qerrors.Propagate(\"BoxPlot\", err)\n\t\t}\n\t\tif cfg != nil {\n\t\t\tcfg(plt, pltr)\n\t\t}\n\t\treturn pltr, nil\n\t}\n}", "title": "" }, { "docid": "6be32d175e1839b7a4bd1e0801f912a5", "score": "0.46787712", "text": "func (svg *SVG) ViewBox(x, y, width, height int) *SVG {\n\tsvg.vx = x\n\tsvg.vy = y\n\tsvg.vw = width\n\tsvg.vh = height\n\n\treturn svg\n}", "title": "" }, { "docid": "2674b0c9ba1820c87bd5dbb1b6d14ff2", "score": "0.46713996", "text": "func (ctx *Context) BookletFromPDF(selectedPages IntSet, nup *NUp) error {\n\tn := int(nup.Grid.Width * nup.Grid.Height)\n\tif !(n == 2 || n == 4) {\n\t\treturn fmt.Errorf(\"pdfcpu: booklet must have n={2,4} pages per sheet, got %d\", n)\n\t}\n\n\tvar mb *Rectangle\n\n\tif nup.PageDim == nil {\n\t\tnup.PageDim = PaperSize[nup.PageSize]\n\t}\n\n\tmb = RectForDim(nup.PageDim.Width, nup.PageDim.Height)\n\n\tpagesDict := Dict(\n\t\tmap[string]Object{\n\t\t\t\"Type\": Name(\"Pages\"),\n\t\t\t\"Count\": Integer(0),\n\t\t\t\"MediaBox\": mb.Array(),\n\t\t},\n\t)\n\n\tpagesIndRef, err := ctx.IndRefForNewObject(pagesDict)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnup.PageDim = &Dim{mb.Width(), mb.Height()}\n\n\tif nup.MultiFolio {\n\t\tpages := IntSet{}\n\t\tfor _, i := range sortSelectedPages(selectedPages) {\n\t\t\tpages[i] = true\n\t\t\tif len(pages) == 4*nup.FolioSize {\n\t\t\t\tif err = ctx.bookletPages(pages, nup, pagesDict, pagesIndRef); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tpages = IntSet{}\n\t\t\t}\n\t\t}\n\t\tif len(pages) > 0 {\n\t\t\tif err = ctx.bookletPages(pages, nup, pagesDict, pagesIndRef); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\tif err = ctx.bookletPages(selectedPages, nup, pagesDict, pagesIndRef); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Replace original pagesDict.\n\trootDict, err := ctx.Catalog()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trootDict.Update(\"Pages\", *pagesIndRef)\n\treturn nil\n}", "title": "" }, { "docid": "44b37c9da6d1ce430fc11b51212c27e1", "score": "0.46594188", "text": "func (box *Box) SetVersion(uint8) {\n}", "title": "" }, { "docid": "c69f7f9930ccff75533bb69f9e83252a", "score": "0.46522728", "text": "func BoxPlot(data plot.DataFrame, coef float64) []BoxPlotData {\n\n}", "title": "" }, { "docid": "c2326bfbdc0ae9617336b468a9153b35", "score": "0.46490258", "text": "func ExampleFpdf_PageSize() {\n\tpdf := gofpdf.NewCustom(&gofpdf.InitType{\n\t\tUnitStr: \"in\",\n\t\tSize: gofpdf.SizeType{Wd: 6, Ht: 6},\n\t\tFontDirStr: example.FontDir(),\n\t})\n\tpdf.SetMargins(0.5, 1, 0.5)\n\tpdf.SetFont(\"Times\", \"\", 14)\n\tpdf.AddPageFormat(\"L\", gofpdf.SizeType{Wd: 3, Ht: 12})\n\tpdf.SetXY(0.5, 1.5)\n\tpdf.CellFormat(11, 0.2, \"12 in x 3 in\", \"\", 0, \"C\", false, 0, \"\")\n\tpdf.AddPage() // Default size established in NewCustom()\n\tpdf.SetXY(0.5, 3)\n\tpdf.CellFormat(5, 0.2, \"6 in x 6 in\", \"\", 0, \"C\", false, 0, \"\")\n\tpdf.AddPageFormat(\"P\", gofpdf.SizeType{Wd: 3, Ht: 12})\n\tpdf.SetXY(0.5, 6)\n\tpdf.CellFormat(2, 0.2, \"3 in x 12 in\", \"\", 0, \"C\", false, 0, \"\")\n\tfor j := 0; j <= 3; j++ {\n\t\twd, ht, u := pdf.PageSize(j)\n\t\tfmt.Printf(\"%d: %6.2f %s, %6.2f %s\\n\", j, wd, u, ht, u)\n\t}\n\tfileStr := example.Filename(\"Fpdf_PageSize\")\n\terr := pdf.OutputFileAndClose(fileStr)\n\texample.Summary(err, fileStr)\n\t// Output:\n\t// 0: 6.00 in, 6.00 in\n\t// 1: 12.00 in, 3.00 in\n\t// 2: 6.00 in, 6.00 in\n\t// 3: 3.00 in, 12.00 in\n\t// Successfully generated pdf/Fpdf_PageSize.pdf\n}", "title": "" }, { "docid": "8a472c901795055c6d061f2b10001db6", "score": "0.46371323", "text": "func NewBox(width, height, depth float64, widthSegments, heightSegments, depthSegments int) *Box {\n\n\tbox := new(Box)\n\tbox.Geometry.Init()\n\n\tbox.Width = width\n\tbox.Height = height\n\tbox.Depth = depth\n\tbox.WidthSegments = widthSegments\n\tbox.HeightSegments = heightSegments\n\tbox.DepthSegments = depthSegments\n\n\t// Create buffers\n\tpositions := math32.NewArrayF32(0, 16)\n\tnormals := math32.NewArrayF32(0, 16)\n\tuvs := math32.NewArrayF32(0, 16)\n\tindices := math32.NewArrayU32(0, 16)\n\n\twidth_half := width / 2\n\theight_half := height / 2\n\tdepth_half := depth / 2\n\n\t// Internal function to build each box plane\n\tbuildPlane := func(u, v string, udir, vdir int, width, height, depth float64, materialIndex uint) {\n\n\t\tgridX := widthSegments\n\t\tgridY := heightSegments\n\t\twidth_half := width / 2\n\t\theight_half := height / 2\n\t\toffset := positions.Len() / 3\n\t\tvar w string\n\n\t\tif (u == \"x\" && v == \"y\") || (u == \"y\" && v == \"x\") {\n\t\t\tw = \"z\"\n\t\t} else if (u == \"x\" && v == \"z\") || (u == \"z\" && v == \"x\") {\n\t\t\tw = \"y\"\n\t\t\tgridY = depthSegments\n\t\t} else if (u == \"z\" && v == \"y\") || (u == \"y\" && v == \"z\") {\n\t\t\tw = \"x\"\n\t\t\tgridX = depthSegments\n\t\t}\n\n\t\tgridX1 := gridX + 1\n\t\tgridY1 := gridY + 1\n\t\tsegment_width := width / float64(gridX)\n\t\tsegment_height := height / float64(gridY)\n\t\tvar normal math32.Vector3\n\t\tif depth > 0 {\n\t\t\tnormal.SetByName(w, 1)\n\t\t} else {\n\t\t\tnormal.SetByName(w, -1)\n\t\t}\n\n\t\t// Generates the plane vertices, normals and uv coordinates.\n\t\tfor iy := 0; iy < gridY1; iy++ {\n\t\t\tfor ix := 0; ix < gridX1; ix++ {\n\t\t\t\tvar vector math32.Vector3\n\t\t\t\tvector.SetByName(u, float32((float64(ix)*segment_width-width_half)*float64(udir)))\n\t\t\t\tvector.SetByName(v, float32((float64(iy)*segment_height-height_half)*float64(vdir)))\n\t\t\t\tvector.SetByName(w, float32(depth))\n\t\t\t\tpositions.AppendVector3(&vector)\n\t\t\t\tnormals.AppendVector3(&normal)\n\t\t\t\tuvs.Append(float32(float64(ix)/float64(gridX)), float32(float64(1)-(float64(iy)/float64(gridY))))\n\t\t\t}\n\t\t}\n\n\t\tgstart := indices.Size()\n\t\tmatIndex := materialIndex\n\t\t// Generates the indices for the vertices, normals and uvs\n\t\tfor iy := 0; iy < gridY; iy++ {\n\t\t\tfor ix := 0; ix < gridX; ix++ {\n\t\t\t\ta := ix + gridX1*iy\n\t\t\t\tb := ix + gridX1*(iy+1)\n\t\t\t\tc := (ix + 1) + gridX1*(iy+1)\n\t\t\t\td := (ix + 1) + gridX1*iy\n\t\t\t\tindices.Append(uint32(a+offset), uint32(b+offset), uint32(d+offset), uint32(b+offset), uint32(c+offset), uint32(d+offset))\n\t\t\t}\n\t\t}\n\t\tgcount := indices.Size() - gstart\n\t\tbox.AddGroup(gstart, gcount, int(matIndex))\n\t}\n\n\tbuildPlane(\"z\", \"y\", -1, -1, depth, height, width_half, 0) // px\n\tbuildPlane(\"z\", \"y\", 1, -1, depth, height, -width_half, 1) // nx\n\tbuildPlane(\"x\", \"z\", 1, 1, width, depth, height_half, 2) // py\n\tbuildPlane(\"x\", \"z\", 1, -1, width, depth, -height_half, 3) // ny\n\tbuildPlane(\"x\", \"y\", 1, -1, width, height, depth_half, 4) // pz\n\tbuildPlane(\"x\", \"y\", -1, -1, width, height, -depth_half, 5) // nz\n\n\tbox.SetIndices(indices)\n\tbox.AddVBO(gls.NewVBO().AddAttrib(\"VertexPosition\", 3).SetBuffer(positions))\n\tbox.AddVBO(gls.NewVBO().AddAttrib(\"VertexNormal\", 3).SetBuffer(normals))\n\tbox.AddVBO(gls.NewVBO().AddAttrib(\"VertexTexcoord\", 2).SetBuffer(uvs))\n\n\treturn box\n}", "title": "" }, { "docid": "5cbf584a6625c269ca987f0515acb45e", "score": "0.4621595", "text": "func NewBox(repo BoxRepository) *Box {\n\tbox := &Box{\n\t\trepo: repo,\n\t\tpasswords: map[string]*Password{},\n\t}\n\treturn box\n}", "title": "" }, { "docid": "5d4d5131a00948e612672bd43df7cbb1", "score": "0.46109736", "text": "func (m *OnenoteSection) SetPages(value []OnenotePageable)() {\n err := m.GetBackingStore().Set(\"pages\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "23f13370b8a29d8341a0dd1c9eae2238", "score": "0.46101433", "text": "func (sc *Scene) ManipBox() {\n\tsc.CurManipPt = nil\n\tif sc.CurSel == nil {\n\t\treturn\n\t}\n\tsc.RenderMu.Lock()\n\tupdt := sc.UpdateStart()\n\tdefer sc.UpdateEnd(updt)\n\n\tnm := ManipBoxName\n\n\tnb := sc.CurSel.AsNode3D()\n\tsc.DeleteChildByName(nm, ki.DestroyKids) // get rid of existing\n\tclr, _ := gist.ColorFromName(string(sc.SelParams.Color))\n\n\tbbox := nb.WorldBBox.BBox\n\tmb := AddNewLineBox(sc, sc, nm, nm, bbox, sc.SelParams.Width, clr, Inactive)\n\n\tmbspm := AddNewSphere(sc, nm+\"-pt\", sc.SelParams.Radius, 16)\n\n\tbbox.Min.SetSub(mb.Pose.Pos)\n\tbbox.Max.SetSub(mb.Pose.Pos)\n\tAddNewManipPt(sc, mb, nm+\"-lll\", mbspm.Name(), clr, bbox.Min)\n\tAddNewManipPt(sc, mb, nm+\"-llu\", mbspm.Name(), clr, mat32.Vec3{bbox.Min.X, bbox.Min.Y, bbox.Max.Z})\n\tAddNewManipPt(sc, mb, nm+\"-lul\", mbspm.Name(), clr, mat32.Vec3{bbox.Min.X, bbox.Max.Y, bbox.Min.Z})\n\tAddNewManipPt(sc, mb, nm+\"-ull\", mbspm.Name(), clr, mat32.Vec3{bbox.Max.X, bbox.Min.Y, bbox.Min.Z})\n\tAddNewManipPt(sc, mb, nm+\"-luu\", mbspm.Name(), clr, mat32.Vec3{bbox.Min.X, bbox.Max.Y, bbox.Max.Z})\n\tAddNewManipPt(sc, mb, nm+\"-ulu\", mbspm.Name(), clr, mat32.Vec3{bbox.Max.X, bbox.Min.Y, bbox.Max.Z})\n\tAddNewManipPt(sc, mb, nm+\"-uul\", mbspm.Name(), clr, mat32.Vec3{bbox.Max.X, bbox.Max.Y, bbox.Min.Z})\n\tAddNewManipPt(sc, mb, nm+\"-uuu\", mbspm.Name(), clr, bbox.Max)\n\n\tsc.RenderMu.Unlock()\n\tsc.ReconfigMeshes()\n\tsc.Render()\n}", "title": "" }, { "docid": "245cbf4de39d60f659a3d825c6576a66", "score": "0.4605247", "text": "func (el *Element) Box() *Box {\n\tbox, err := el.BoxE()\n\tkit.E(err)\n\treturn box\n}", "title": "" }, { "docid": "7f955fe77b1e0901e4911305e7015d90", "score": "0.45993054", "text": "func (o *Theme) SetStylebox(name string, aType string, texture *StyleBox) {\n\tlog.Println(\"Calling Theme.SetStylebox()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 3, 3)\n\tgoArguments[0] = reflect.ValueOf(name)\n\tgoArguments[1] = reflect.ValueOf(aType)\n\tgoArguments[2] = reflect.ValueOf(texture)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"set_stylebox\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "a90ae6b1f86c8c520c509e8274354936", "score": "0.4597782", "text": "func Drawbox(x, y, w, h int, title string) {\n\n\tfor i := 0; i < w; i++ {\n\t\ttermbox.SetCell(x+i, y, '─', termbox.ColorWhite, termbox.ColorDefault)\n\t\ttermbox.SetCell(x+i, y+h-1, '─', termbox.ColorWhite, termbox.ColorDefault)\n\t}\n\tfor i := 0; i < h; i++ {\n\t\ttermbox.SetCell(x, y+i, '│', termbox.ColorWhite, termbox.ColorDefault)\n\t\ttermbox.SetCell(x+w-1, y+i, '│', termbox.ColorWhite, termbox.ColorDefault)\n\t}\n\tif title != \"\" {\n\t\tPrint(x+1, y, termbox.ColorWhite, termbox.ColorDefault, \"[\"+title+\"]\")\n\t}\n\tif w > 1 {\n\t\ttermbox.SetCell(x, y, '┌', termbox.ColorWhite, termbox.ColorDefault)\n\t\ttermbox.SetCell(x, y+h-1, '└', termbox.ColorWhite, termbox.ColorDefault)\n\t\ttermbox.SetCell(x+w-1, y, '┐', termbox.ColorWhite, termbox.ColorDefault)\n\t\ttermbox.SetCell(x+w-1, y+h-1, '┘', termbox.ColorWhite, termbox.ColorDefault)\n\t}\n}", "title": "" }, { "docid": "46de67884f5646d249b238a177a2b7f1", "score": "0.45906097", "text": "func Xsqlite3BtreeSetPageSize(tls *libc.TLS, p uintptr, pageSize int32, nReserve int32, iFix int32) int32 {\n\tvar rc int32 = SQLITE_OK\n\tvar x int32\n\tvar pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt\n\n\tXsqlite3BtreeEnter(tls, p)\n\t(*BtShared)(unsafe.Pointer(pBt)).FnReserveWanted = U8(nReserve)\n\tx = int32((*BtShared)(unsafe.Pointer(pBt)).FpageSize - (*BtShared)(unsafe.Pointer(pBt)).FusableSize)\n\tif nReserve < x {\n\t\tnReserve = x\n\t}\n\tif int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags)&BTS_PAGESIZE_FIXED != 0 {\n\t\tXsqlite3BtreeLeave(tls, p)\n\t\treturn SQLITE_READONLY\n\t}\n\n\tif pageSize >= 512 && pageSize <= SQLITE_MAX_PAGE_SIZE && (pageSize-1)&pageSize == 0 {\n\t\tif nReserve > 32 && pageSize == 512 {\n\t\t\tpageSize = 1024\n\t\t}\n\t\t(*BtShared)(unsafe.Pointer(pBt)).FpageSize = U32(pageSize)\n\t\tfreeTempSpace(tls, pBt)\n\t}\n\trc = Xsqlite3PagerSetPagesize(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, pBt+52, nReserve)\n\t(*BtShared)(unsafe.Pointer(pBt)).FusableSize = (*BtShared)(unsafe.Pointer(pBt)).FpageSize - U32(U16(nReserve))\n\tif iFix != 0 {\n\t\t*(*U16)(unsafe.Pointer(pBt + 40)) |= U16(BTS_PAGESIZE_FIXED)\n\t}\n\tXsqlite3BtreeLeave(tls, p)\n\treturn rc\n}", "title": "" }, { "docid": "2a39b7bdad784d51421dcc0fb76819f4", "score": "0.45687583", "text": "func (i *Importer) ImportPageFromStream(f gofpdiPdf, rs *io.ReadSeeker, pageno int, box string) int {\n\t// Set source stream for fpdi\n\ti.fpdi.SetSourceStream(rs)\n\t// return template id\n\treturn i.getTemplateID(f, pageno, box)\n}", "title": "" }, { "docid": "ab8bc58cd36df5686c64b159222b45fb", "score": "0.45528564", "text": "func ModifyMailBox(c gotransip.Client, domainName string, mailBox MailBox) error {\n\tsr := gotransip.SoapRequest{\n\t\tService: serviceName,\n\t\tMethod: \"modifyMailBox\",\n\t}\n\tsr.AddArgument(\"domainName\", domainName)\n\tsr.AddArgument(\"mailBox\", mailBox)\n\n\treturn c.Call(sr, nil)\n}", "title": "" }, { "docid": "48dd67558b1f5878656db740d21ac53b", "score": "0.45528418", "text": "func (box *Box) SetFlags(uint32) {\n}", "title": "" }, { "docid": "6629b5b5165a9896a154f815deefba58", "score": "0.4547527", "text": "func (b *Box) SetDrawFunc(handler func(screen tcell.Screen, x, y, width, height int) (int, int, int, int)) {\n\tb.l.Lock()\n\tdefer b.l.Unlock()\n\n\tb.draw = handler\n}", "title": "" }, { "docid": "0a954b29676b3dfe2d7119f8005adc43", "score": "0.45465738", "text": "func (m *PrintDocument) SetSize(value *int64)() {\n err := m.GetBackingStore().Set(\"size\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0a954b29676b3dfe2d7119f8005adc43", "score": "0.45465738", "text": "func (m *PrintDocument) SetSize(value *int64)() {\n err := m.GetBackingStore().Set(\"size\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f3466f756a4b9b792b125518c1a6c74f", "score": "0.4533259", "text": "func ExampleFpdf_MultiCell() {\n\t pdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\t titleStr := \"20000 Leagues Under the Seas\"\n\t pdf.SetTitle(titleStr, false)\n\t pdf.SetAuthor(\"Jules Verne\", false)\n\t pdf.SetHeaderFunc(func() {\n\t\t // Arial bold 15\n\t\t pdf.SetFont(\"Arial\", \"B\", 15)\n\t\t // Calculate width of title and position\n\t\t wd := pdf.GetStringWidth(titleStr) + 6\n\t\t pdf.SetX((210 - wd) / 2)\n\t\t // Colors of frame, background and text\n\t\t pdf.SetDrawColor(0, 80, 180)\n\t\t pdf.SetFillColor(230, 230, 0)\n\t\t pdf.SetTextColor(220, 50, 50)\n\t\t // Thickness of frame (1 mm)\n\t\t pdf.SetLineWidth(1)\n\t\t // Title\n\t\t pdf.CellFormat(wd, 9, titleStr, \"1\", 1, \"C\", true, 0, \"\")\n\t\t // Line break\n\t\t pdf.Ln(10)\n\t })\n\t pdf.SetFooterFunc(func() {\n\t\t // Position at 1.5 cm from bottom\n\t\t pdf.SetY(-15)\n\t\t // Arial italic 8\n\t\t pdf.SetFont(\"Arial\", \"I\", 8)\n\t\t // Text color in gray\n\t\t pdf.SetTextColor(128, 128, 128)\n\t\t // Page number\n\t\t pdf.CellFormat(0, 10, fmt.Sprintf(\"Page %d\", pdf.PageNo()),\n\t\t\t \"\", 0, \"C\", false, 0, \"\")\n\t })\n\t chapterTitle := func(chapNum int, titleStr string) {\n\t\t // \t// Arial 12\n\t\t pdf.SetFont(\"Arial\", \"\", 12)\n\t\t // Background color\n\t\t pdf.SetFillColor(200, 220, 255)\n\t\t // Title\n\t\t pdf.CellFormat(0, 6, fmt.Sprintf(\"Chapter %d : %s\", chapNum, titleStr),\n\t\t\t \"\", 1, \"L\", true, 0, \"\")\n\t\t // Line break\n\t\t pdf.Ln(4)\n\t }\n\t chapterBody := func(fileStr string) {\n\t\t // Read text file\n\t\t txtStr, err := ioutil.ReadFile(fileStr)\n\t\t if err != nil {\n\t\t\t pdf.SetError(err)\n\t\t }\n\t\t // Times 12\n\t\t pdf.SetFont(\"Times\", \"\", 12)\n\t\t // Output justified text\n\t\t pdf.MultiCell(0, 5, string(txtStr), \"\", \"\", false)\n\t\t // Line break\n\t\t pdf.Ln(-1)\n\t\t // Mention in italics\n\t\t pdf.SetFont(\"\", \"I\", 0)\n\t\t pdf.Cell(0, 5, \"(end of excerpt)\")\n\t }\n\t printChapter := func(chapNum int, titleStr, fileStr string) {\n\t\t pdf.AddPage()\n\t\t chapterTitle(chapNum, titleStr)\n\t\t chapterBody(fileStr)\n\t }\n\t printChapter(1, \"A RUNAWAY REEF\", TextFile(\"20k_c1.txt\"))\n\t printChapter(2, \"THE PROS AND CONS\", TextFile(\"20k_c2.txt\"))\n\t fileStr := Filename(\"Fpdf_MultiCell\")\n\t err := pdf.OutputFileAndClose(fileStr)\n\t Summary(err, fileStr)\n\t // Output:\n\t // Successfully generated pdf/Fpdf_MultiCell.pdf\n }", "title": "" }, { "docid": "b8b96277ecb85a5f50d93fcde5263cef", "score": "0.45329863", "text": "func BoxDiv(ctx context.Context, db DB, p0 pgtypes.Box, p1 pgtypes.Point) (pgtypes.Box, error) {\n\t// call pg_catalog.box_div\n\tconst sqlstr = `SELECT * FROM pg_catalog.box_div($1, $2)`\n\t// run\n\tvar r0 pgtypes.Box\n\tlogf(sqlstr, p0, p1)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0, p1).Scan(&r0); err != nil {\n\t\treturn pgtypes.Box{}, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "ab5df9ab14da8b25c3fe3df8a36f6100", "score": "0.45273098", "text": "func dumpBox(boxPath string, box interface{}) {\n\tif debugMode {\n\t\tlog.Printf(\"[ %s Box data ] %+v\", boxPath, box)\n\t}\n}", "title": "" }, { "docid": "075109d8b1c966cae3309993aae4af6d", "score": "0.45260116", "text": "func NewBox(opts ...BoxOption) *Box {\n\tb := &Box{\n\t\t//default surface is \"minecraft:sandstone\"\n\t\tsurface: \"minecraft:sandstone\",\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(b)\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "5bebc7766b2752535952fea51b1cbfb2", "score": "0.45167914", "text": "func InitEmptyBox(box *Box) *Box {\n\tif box == nil {\n\t\tbox = &Box{}\n\t}\n\tbox.Padding[Top] = css.SomeDimen(0)\n\tbox.Padding[Right] = css.SomeDimen(0)\n\tbox.Padding[Bottom] = css.SomeDimen(0)\n\tbox.Padding[Left] = css.SomeDimen(0)\n\tbox.BorderWidth[Top] = css.SomeDimen(0)\n\tbox.BorderWidth[Right] = css.SomeDimen(0)\n\tbox.BorderWidth[Bottom] = css.SomeDimen(0)\n\tbox.BorderWidth[Left] = css.SomeDimen(0)\n\tbox.Margins[Top] = css.SomeDimen(0)\n\tbox.Margins[Right] = css.SomeDimen(0)\n\tbox.Margins[Bottom] = css.SomeDimen(0)\n\tbox.Margins[Left] = css.SomeDimen(0)\n\t//\n\tbox.W = css.DimenOption(\"auto\")\n\treturn box\n}", "title": "" }, { "docid": "d1c9e9e61cf4fd02e6ed4f9de1111d72", "score": "0.45016253", "text": "func (self *DOM) SetDocumentBoundsA(member *Rectangle) {\n self.Object.Set(\"documentBounds\", member)\n}", "title": "" }, { "docid": "19b4afff81bb8fe743a6168a2e9d15a1", "score": "0.44935012", "text": "func ExampleFpdf_ClipRect() {\n\t marginCell := 2. // margin of top/bottom of cell\n\t pdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\t pdf.SetFont(\"Arial\", \"\", 12)\n\t pdf.AddPage()\n\t pagew, pageh := pdf.GetPageSize()\n\t mleft, mright, _, mbottom := pdf.GetMargins()\n \n\t cols := []float64{60, 100, pagew - mleft - mright - 100 - 60}\n\t rows := [][]string{}\n\t for i := 1; i <= 50; i++ {\n\t\t word := fmt.Sprintf(\"%d:%s\", i, strings.Repeat(\"A\", i%100))\n\t\t rows = append(rows, []string{word, word, word})\n\t }\n \n\t for _, row := range rows {\n\t\t _, lineHt := pdf.GetFontSize()\n\t\t height := lineHt + marginCell\n \n\t\t x, y := pdf.GetXY()\n\t\t // add a new page if the height of the row doesn't fit on the page\n\t\t if y+height >= pageh-mbottom {\n\t\t\t pdf.AddPage()\n\t\t\t x, y = pdf.GetXY()\n\t\t }\n\t\t for i, txt := range row {\n\t\t\t width := cols[i]\n\t\t\t pdf.Rect(x, y, width, height, \"\")\n\t\t\t pdf.ClipRect(x, y, width, height, false)\n\t\t\t pdf.Cell(width, height, txt)\n\t\t\t pdf.ClipEnd()\n\t\t\t x += width\n\t\t }\n\t\t pdf.Ln(-1)\n\t }\n\t fileStr := Filename(\"Fpdf_ClippedTableCells\")\n\t err := pdf.OutputFileAndClose(fileStr)\n\t Summary(err, fileStr)\n\t // Output:\n\t // Successfully generated pdf/Fpdf_ClippedTableCells.pdf\n }", "title": "" }, { "docid": "3b1f596526272e4b058292907be53530", "score": "0.44931522", "text": "func BoxCenter(ctx context.Context, db DB, p0 pgtypes.Box) (pgtypes.Point, error) {\n\t// call pg_catalog.box_center\n\tconst sqlstr = `SELECT * FROM pg_catalog.box_center($1)`\n\t// run\n\tvar r0 pgtypes.Point\n\tlogf(sqlstr, p0)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0).Scan(&r0); err != nil {\n\t\treturn pgtypes.Point{}, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "adce5888d0e058771a0052c8619c333b", "score": "0.4467047", "text": "func (p pager) pages() int {\n\t_, docHeight := p.size()\n\t_, viewHeight := termbox.Size()\n\treturn docHeight / viewHeight\n}", "title": "" }, { "docid": "8624068b01e0b95a7abe37e7cf145e7f", "score": "0.44537655", "text": "func (m *AddFooter) SetMargin(value *int32)() {\n err := m.GetBackingStore().Set(\"margin\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "17dc21935cb34a6da89b452d288002f1", "score": "0.44409847", "text": "func ExampleFpdf_SetAlpha() {\n\tconst (\n\t\tgapX = 10.0\n\t\tgapY = 9.0\n\t\trectW = 40.0\n\t\trectH = 58.0\n\t\tpageW = 210\n\t\tpageH = 297\n\t)\n\tmodeList := []string{\"Normal\", \"Multiply\", \"Screen\", \"Overlay\",\n\t\t\"Darken\", \"Lighten\", \"ColorDodge\", \"ColorBurn\", \"HardLight\", \"SoftLight\",\n\t\t\"Difference\", \"Exclusion\", \"Hue\", \"Saturation\", \"Color\", \"Luminosity\"}\n\tpdf := gofpdf.New(\"\", \"\", \"\", \"\")\n\tpdf.SetLineWidth(2)\n\tpdf.SetAutoPageBreak(false, 0)\n\tpdf.AddPage()\n\tpdf.SetFont(\"Helvetica\", \"\", 18)\n\tpdf.SetXY(0, gapY)\n\tpdf.SetTextColor(0, 0, 0)\n\tpdf.CellFormat(pageW, gapY, \"Alpha Blending Modes\", \"\", 0, \"C\", false, 0, \"\")\n\tj := 0\n\ty := 3 * gapY\n\tfor col := 0; col < 4; col++ {\n\t\tx := gapX\n\t\tfor row := 0; row < 4; row++ {\n\t\t\tpdf.Rect(x, y, rectW, rectH, \"D\")\n\t\t\tpdf.SetFont(\"Helvetica\", \"B\", 12)\n\t\t\tpdf.SetFillColor(0, 0, 0)\n\t\t\tpdf.SetTextColor(250, 250, 230)\n\t\t\tpdf.SetXY(x, y+rectH-4)\n\t\t\tpdf.CellFormat(rectW, 5, modeList[j], \"\", 0, \"C\", true, 0, \"\")\n\t\t\tpdf.SetFont(\"Helvetica\", \"I\", 150)\n\t\t\tpdf.SetTextColor(80, 80, 120)\n\t\t\tpdf.SetXY(x, y+2)\n\t\t\tpdf.CellFormat(rectW, rectH, \"A\", \"\", 0, \"C\", false, 0, \"\")\n\t\t\tpdf.SetAlpha(0.5, modeList[j])\n\t\t\tpdf.Image(example.ImageFile(\"golang-gopher.png\"),\n\t\t\t\tx-gapX, y, rectW+2*gapX, 0, false, \"\", 0, \"\")\n\t\t\tpdf.SetAlpha(1.0, \"Normal\")\n\t\t\tx += rectW + gapX\n\t\t\tj++\n\t\t}\n\t\ty += rectH + gapY\n\t}\n\tfileStr := example.Filename(\"Fpdf_SetAlpha_transparency\")\n\terr := pdf.OutputFileAndClose(fileStr)\n\texample.Summary(err, fileStr)\n\t// Output:\n\t// Successfully generated pdf/Fpdf_SetAlpha_transparency.pdf\n}", "title": "" }, { "docid": "bfd84452fd1c9f77321646643a070e2c", "score": "0.4439431", "text": "func Split(rows, cols int, pdfReader *pdf.PdfReader, pdfWriter *pdf.PdfWriter) {\n\tnumPages, err := pdfReader.GetNumPages()\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"error getting number of pages: %v\", err))\n\t}\n\n\tfor i := 1; i <= numPages; i++ {\n\t\tpage, err := pdfReader.GetPage(i)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"error getting page %d: %v\", i, err))\n\t\t}\n\n\t\tmbox, err := page.GetMediaBox()\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"error reading page %d: %v\", i, err))\n\t\t}\n\n\t\twidth := (*mbox).Urx - (*mbox).Llx\n\t\theight := (*mbox).Ury - (*mbox).Lly\n\n\t\tcroppedWidth := width / float64(cols)\n\t\tcroppedHeight := height / float64(rows)\n\n\t\txs := make([]float64, cols+1) // x coordinates of every corner\n\t\tys := make([]float64, rows+1) // y coordinates of every corner\n\n\t\tfor j := 0; j <= cols; j++ {\n\t\t\txs[j] = croppedWidth * float64(j)\n\t\t}\n\n\t\tfor j := 0; j <= rows; j++ {\n\t\t\tys[j] = croppedHeight * float64(j)\n\t\t}\n\n\t\tfor y := rows - 1; y >= 0; y-- {\n\t\t\tfor x := 0; x < cols; x++ {\n\t\t\t\t// every (x,y) is a lower-left coordinate\n\n\t\t\t\t// duplicate the page for every cut-out section because we are passing by reference\n\t\t\t\t// so if the mediabox moves, every section of the page will be affected\n\t\t\t\tp := page.Duplicate()\n\n\t\t\t\tmmbox, err := p.GetMediaBox()\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(fmt.Sprintf(\"error processing page %d: %v\", i, err))\n\t\t\t\t}\n\t\t\t\t(*mmbox).Llx = xs[x]\n\t\t\t\t(*mmbox).Lly = ys[y]\n\t\t\t\t(*mmbox).Urx = xs[x+1]\n\t\t\t\t(*mmbox).Ury = ys[y+1]\n\n\t\t\t\t// crop the page\n\t\t\t\tp.MediaBox = mmbox\n\n\t\t\t\terr = pdfWriter.AddPage(p)\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(fmt.Sprintf(\"error cropping page %d: %v\", i, err))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e2ea4c7512fcc0af407565468f9e04f8", "score": "0.44245192", "text": "func (s *Flange1) BoundingBox() Box2 {\n\treturn s.bb\n}", "title": "" }, { "docid": "e2ea4c7512fcc0af407565468f9e04f8", "score": "0.44245192", "text": "func (s *Flange1) BoundingBox() Box2 {\n\treturn s.bb\n}", "title": "" }, { "docid": "e24969ba4f4b8f44b5219bd33f7bc854", "score": "0.44153288", "text": "func _1398editPage(tls *crt.TLS, _pPg uintptr /* *TMemPage */, _iOld int32, _iNew int32, _nNew int32, _pCArray uintptr /* *TCellArray */) (r int32) {\n\tesc := crt.MustMalloc(4)\n\tvar (\n\t\t_aData uintptr // *Tu8\n\t\t_hdr int32\n\t\t_pBegin uintptr // *Tu8\n\t\t_nCell int32\n\t\t_pData = esc // **Tu8\n\t\t_pCellptr uintptr // *Tu8\n\t\t_i int32\n\t\t_iOldEnd int32\n\t\t_iNewEnd int32\n\t\t_nShift int32\n\t\t_nAdd int32\n\t\t_iCell int32\n\t)\n\tdefer crt.Free(esc)\n\t_aData = *(*uintptr)(unsafe.Pointer(_pPg + 56))\n\t_hdr = int32(*(*Tu8)(unsafe.Pointer(_pPg + 9)))\n\t_pBegin = (*(*uintptr)(unsafe.Pointer(_pPg + 64))) + uintptr(_nNew*int32(2))\n\t_nCell = int32(*(*Tu16)(unsafe.Pointer(_pPg + 22)))\n\t_iOldEnd = (_iOld + int32(*(*Tu16)(unsafe.Pointer(_pPg + 22)))) + int32(*(*Tu8)(unsafe.Pointer(_pPg + 12)))\n\t_iNewEnd = _iNew + _nNew\n\tif _iOld >= _iNew {\n\t\tgoto _1\n\t}\n\n\t_nShift = _1683pageFreeArray(tls, _pPg, _iOld, _iNew-_iOld, _pCArray)\n\tcrt.Xmemmove(tls, *(*uintptr)(unsafe.Pointer(_pPg + 64)), (*(*uintptr)(unsafe.Pointer(_pPg + 64)))+uintptr(_nShift*int32(2)), uint32(_nCell*int32(2)))\n\t_nCell = int32(_nCell - _nShift)\n_1:\n\tif _iNewEnd >= _iOldEnd {\n\t\tgoto _2\n\t}\n\n\t_nCell = int32(_nCell - _1683pageFreeArray(tls, _pPg, _iNewEnd, _iOldEnd-_iNewEnd, _pCArray))\n_2:\n\t*(*uintptr)(unsafe.Pointer(_pData)) = _aData + uintptr((((int32(*(*Tu8)(unsafe.Pointer(_aData + uintptr(_hdr+int32(5)))))<<(uint(8)%32))|int32(*(*Tu8)(unsafe.Pointer((_aData + uintptr(_hdr+int32(5))) + 1)))-int32(1))&int32(0xffff))+int32(1))\n\tif (*(*uintptr)(unsafe.Pointer(_pData))) >= _pBegin {\n\t\tgoto _3\n\t}\n\n\tgoto _editpage_fail\n\n_3:\n\tif _iNew >= _iOld {\n\t\tgoto _4\n\t}\n\n\t_nAdd = func() int32 {\n\t\tif _nNew < (_iOld - _iNew) {\n\t\t\treturn _nNew\n\t\t}\n\t\treturn _iOld - _iNew\n\t}()\n\n\t_pCellptr = *(*uintptr)(unsafe.Pointer(_pPg + 64))\n\tcrt.Xmemmove(tls, _pCellptr+uintptr(_nAdd*int32(2)), _pCellptr, uint32(_nCell*int32(2)))\n\tif _1684pageInsertArray(tls, _pPg, _pBegin, _pData, _pCellptr, _iNew, _nAdd, _pCArray) == 0 {\n\t\tgoto _5\n\t}\n\n\tgoto _editpage_fail\n\n_5:\n\t_nCell = int32(_nCell + _nAdd)\n_4:\n\t_i = int32(0)\n_6:\n\tif _i >= int32(*(*Tu8)(unsafe.Pointer(_pPg + 12))) {\n\t\tgoto _8\n\t}\n\n\t_iCell = (_iOld + int32(*(*Tu16)(unsafe.Pointer((_pPg + 26) + 2*uintptr(_i))))) - _iNew\n\tif _iCell < int32(0) || _iCell >= _nNew {\n\t\tgoto _9\n\t}\n\n\t_pCellptr = (*(*uintptr)(unsafe.Pointer(_pPg + 64))) + uintptr(_iCell*int32(2))\n\tcrt.Xmemmove(tls, _pCellptr+2, _pCellptr, uint32((_nCell-_iCell)*int32(2)))\n\t_nCell++\n\tif _1684pageInsertArray(tls, _pPg, _pBegin, _pData, _pCellptr, _iCell+_iNew, int32(1), _pCArray) == 0 {\n\t\tgoto _10\n\t}\n\n\tgoto _editpage_fail\n\n_10:\n_9:\n\t_i++\n\tgoto _6\n\n_8:\n\t_pCellptr = (*(*uintptr)(unsafe.Pointer(_pPg + 64))) + uintptr(_nCell*int32(2))\n\tif _1684pageInsertArray(tls, _pPg, _pBegin, _pData, _pCellptr, _iNew+_nCell, _nNew-_nCell, _pCArray) == 0 {\n\t\tgoto _11\n\t}\n\n\tgoto _editpage_fail\n\n_11:\n\t*(*Tu16)(unsafe.Pointer(_pPg + 22)) = Tu16(_nNew)\n\t*(*Tu8)(unsafe.Pointer(_pPg + 12)) = Tu8(0)\n\t*(*Tu8)(unsafe.Pointer(_aData + uintptr(_hdr+int32(3)))) = Tu8(int32(*(*Tu16)(unsafe.Pointer(_pPg + 22))) >> (uint(8) % 32))\n\t*(*Tu8)(unsafe.Pointer((_aData + uintptr(_hdr+int32(3))) + 1)) = Tu8(*(*Tu16)(unsafe.Pointer(_pPg + 22)))\n\t*(*Tu8)(unsafe.Pointer(_aData + uintptr(_hdr+int32(5)))) = Tu8(int32((*(*uintptr)(unsafe.Pointer(_pData)))-_aData) >> (uint(8) % 32))\n\t*(*Tu8)(unsafe.Pointer((_aData + uintptr(_hdr+int32(5))) + 1)) = Tu8(int32((*(*uintptr)(unsafe.Pointer(_pData))) - _aData))\n\treturn int32(0)\n\n_editpage_fail:\n\t_1685populateCellCache(tls, _pCArray, _iNew, _nNew)\n\treturn _1395rebuildPage(tls, _pPg, _nNew, (*(*uintptr)(unsafe.Pointer(_pCArray + 8)))+4*uintptr(_iNew), (*(*uintptr)(unsafe.Pointer(_pCArray + 12)))+2*uintptr(_iNew))\n}", "title": "" }, { "docid": "f92ac9847fd356f69e0d3b27673361b5", "score": "0.44152853", "text": "func CenterByBox(ctx context.Context, db DB, p0 pgtypes.Box) (pgtypes.Point, error) {\n\t// call pg_catalog.center\n\tconst sqlstr = `SELECT * FROM pg_catalog.center($1)`\n\t// run\n\tvar r0 pgtypes.Point\n\tlogf(sqlstr, p0)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0).Scan(&r0); err != nil {\n\t\treturn pgtypes.Point{}, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "525b5fc842cdeb59850ce16fb5dbcae2", "score": "0.44123417", "text": "func ParamBox(parent Ihandle, params []Ihandle) Ihandle {\n\t//Ihandle* IupParamBox(Ihandle* parent, Ihandle** params, int count);\n\treturn mkih(C.IupParamBox(parent.ptr(), (**C.struct_Ihandle_)(unsafe.Pointer(&params[0])), C.int(len(params))))\n}", "title": "" }, { "docid": "7a6166426b582ff9734363a79337dc1a", "score": "0.4411388", "text": "func (irefBoxFactory) New(box bmfcommon.Box) (cb bmfcommon.CommonBox, childBoxSeriesOffset int, err error) {\n\tdefer func() {\n\t\tif errRaw := recover(); errRaw != nil {\n\t\t\terr = log.Wrap(errRaw.(error))\n\t\t}\n\t}()\n\n\tdata, err := box.Data()\n\tlog.PanicIf(err)\n\n\tversion := data[0]\n\n\t// TODO(dustin): Circle back to this when we have sample data.\n\n\tiref := &IrefBox{\n\t\tBox: box,\n\t\tversion: version,\n\t}\n\n\treturn iref, 4, nil\n}", "title": "" }, { "docid": "c962293f54e87dff11f38f06bdd2310d", "score": "0.44103748", "text": "func (p *Pages) AddPage(name string, item Primitive, resize, visible bool) {\n\tp.AddPanel(name, item, resize, visible)\n}", "title": "" }, { "docid": "94ed5037975c77fc041044c9f5770efd", "score": "0.44083807", "text": "func (s *Sphere) SetFromBox(box Box3) {\n\ts.Center = box.Center()\n\ts.Radius = 0.5 * box.Size().Length()\n}", "title": "" }, { "docid": "c1771c5376c84e5d65c2f7e8cfe2ff7f", "score": "0.4391423", "text": "func importBox() {\n\tvbox(\"import\", \"--vsys\", \"0\",\n\t\t\"--ostype\", \"Windows10_64\",\n\t\t\"--vmname\", *name,\n\t\t\"--cpus\", strconv.Itoa(*cpus),\n\t\t\"--memory\", strconv.Itoa(*mem),\n\t\twin10Ova)\n}", "title": "" }, { "docid": "9f84a1b7947938440266bb8f6dbe7f25", "score": "0.4383217", "text": "func (ly *Layout) ScrollToBox(box image.Rectangle) bool {\n\tdid := false\n\tif ly.HasScroll[mat32.Y] && ly.HasScroll[mat32.X] {\n\t\tdid = ly.ScrollToBoxDim(mat32.Y, box.Min.Y, box.Max.Y)\n\t\tdid = did || ly.ScrollToBoxDim(mat32.X, box.Min.X, box.Max.X)\n\t} else if ly.HasScroll[mat32.Y] {\n\t\tdid = ly.ScrollToBoxDim(mat32.Y, box.Min.Y, box.Max.Y)\n\t} else if ly.HasScroll[mat32.X] {\n\t\tdid = ly.ScrollToBoxDim(mat32.X, box.Min.X, box.Max.X)\n\t}\n\treturn did\n}", "title": "" }, { "docid": "232120dcbc8048150d139c33cfa705ec", "score": "0.4380093", "text": "func (suite *TestReflectSuite) TestSetValueOfField(c *C) {\n\ttype blueBox struct {\n\t\tAge int\n\t}\n\ttype sampleBox struct {\n\t\tAge int\n\t\tName string\n\t\tChildBox *sampleBox\n\t\tChildBoxL2 **sampleBox\n\n\t\tBlueBox blueBox\n\t}\n\n\tbox1 := &sampleBox{Age: 35}\n\tbox2 := &sampleBox{Age: 77}\n\tbox3 := &sampleBox{Age: 491}\n\n\t/**\n\t * Sets the field value by pointer\n\t */\n\tSetValueOfField(box1, 77, \"Age\")\n\tc.Assert(box1.Age, Equals, 77)\n\n\tSetValueOfField(box1, blueBox{Age: 62}, \"BlueBox\")\n\tc.Assert(box1.BlueBox.Age, Equals, 62)\n\n\tSetValueOfField(box1, 53, \"BlueBox\", \"Age\")\n\tc.Assert(box1.BlueBox.Age, Equals, 53)\n\n\tSetValueOfField(box1, box2, \"ChildBox\")\n\tc.Assert(box1.ChildBox.Age, Equals, 77)\n\n\tSetValueOfField(box1, &box3, \"ChildBoxL2\")\n\tc.Assert((*(box1.ChildBoxL2)).Age, Equals, 491)\n\t// :~)\n}", "title": "" }, { "docid": "5447e70e01b18688ee9f28530f79ed47", "score": "0.43738914", "text": "func (p Point) BBox() (float64, float64, float64, float64) {\n\treturn p.X, p.Y, p.X, p.Y\n}", "title": "" }, { "docid": "91bff0d9606032c01def3f34fd604f82", "score": "0.4370392", "text": "func NewPage(fm *FileManager) *Page {\n\tcontent := make([]byte, BlockSize, BlockSize)\n\n\treturn &Page{\n\t\tcontent: content,\n\t\tfm: fm,\n\t}\n}", "title": "" }, { "docid": "032da710bc40fe8614d391c86aa8ed3f", "score": "0.4370206", "text": "func (i *Importer) ImportPage(f gofpdiPdf, sourceFile string, pageno int, box string) int {\n\t// Set source file for fpdi\n\ti.fpdi.SetSourceFile(sourceFile)\n\t// return template id\n\treturn i.getTemplateID(f, pageno, box)\n}", "title": "" }, { "docid": "3734731598f6407e162c96a387087564", "score": "0.43688524", "text": "func BoxNew(orientation Orientation, spacing int) *Box {\n\tc := C.gtk_box_new(C.GtkOrientation(orientation), C.gint(spacing))\n\treturn wrapBox(unsafe.Pointer(c))\n}", "title": "" }, { "docid": "9c0097cebc9d3286d0b066e2c8daaa91", "score": "0.43614247", "text": "func NewBuilder(mb, cb *Box) *Builder {\n\tb := &Builder{\n\t\tversion: pdfVersion,\n\t\tdc: newDocumentCatalog(mb, cb),\n\t\tc: newCounter(),\n\t\tfnm: newFontNameManager(),\n\t\tinm: newImageNameManager(),\n\t\torder: pageTreeOrder,\n\t}\n\tb.dc.pages.resource = newResource()\n\treturn b\n}", "title": "" }, { "docid": "f36f83412ad544f3da1e0f59d50276f5", "score": "0.43608487", "text": "func (tl *TileList) expireBox(b bbox) {\n\ttl.mu.Lock()\n\tdefer tl.mu.Unlock()\n\tx1, y1 := tileCoord(b.minx, b.maxy, tl.zoom)\n\tx2, y2 := tileCoord(b.maxx, b.miny, tl.zoom)\n\tfor x := uint32(x1); x <= uint32(x2); x++ {\n\t\tfor y := uint32(y1); y <= uint32(y2); y++ {\n\t\t\ttl.tiles[tileKey{x, y}] = struct{}{}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0ae05e5246739b8162296469527890c8", "score": "0.43600878", "text": "func (p *Pages) AddAndSwitchToPage(name string, item Primitive, resize bool) {\n\tp.AddPanel(name, item, resize, true)\n\tp.SetCurrentPanel(name)\n}", "title": "" }, { "docid": "c2c73da417bb7009e44f10094b8699c0", "score": "0.4350787", "text": "func (table *Table) DrawOnPages(pdf *PDF, pages *[]*Page, pageSize [2]float32) [2]float32 {\n\tvar xy [2]float32\n\tfor table.HasMoreData() {\n\t\tpage := NewPage(pdf, pageSize, false)\n\t\t*pages = append(*pages, page)\n\t\txy = table.drawTableRows(page, table.drawHeaderRows(page))\n\t}\n\t// Allow the table to be drawn again later:\n\ttable.ResetRenderedPagesCount()\n\treturn xy\n}", "title": "" }, { "docid": "9ce7135444f45002e3aa63969bf7ba12", "score": "0.43501356", "text": "func main() {\n\t// initial PDF\n\t// TODO fewer constants, brittle to specific sizing, fonts, etc.\n\tpdf := gofpdf.NewCustom(&gofpdf.InitType{\n\t\tUnitStr: \"in\",\n\t\tSize: gofpdf.SizeType{Wd: 6, Ht: 4},\n\t})\n\tpdf.SetFont(\"Helvetica\", \"\", 14)\n\tpdf.SetAutoPageBreak(false, 0)\n\tpdf.AddPage()\n\n\t// read config and write each line\n\tfile, err := os.Open(\"./config.txt\")\n\tif err != nil {\n\t\tfmt.Printf(\"error reading file %s\", err)\n\t\tos.Exit(1)\n\t}\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tpdf.SetX(2)\n\t\tpdf.WriteAligned(3, 3, scanner.Text(), \"L\")\n\t\tpdf.Ln(0.25)\n\t}\n\n\t// New page for your random image\n\tpdf.AddPage()\n\terr = drawRandomBar(pdf)\n\tif err != nil {\n\t\tfmt.Printf(\"error generating rectangle %s\", err)\n\t\tos.Exit(1)\n\t}\n\n\tfileStr := \"random-postcard.pdf\"\n\terr = pdf.OutputFileAndClose(fileStr)\n\tif err == nil {\n\t\tfmt.Printf(\"Successfully generated %s\\n\", fileStr)\n\t} else {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "eb87c2357572aaeeaf4167bb6d3d30fa", "score": "0.4339685", "text": "func NewBox(width, height, depth float32) *Box {\n\tbox := Box{\n\t\twidth: width,\n\t\theight: height,\n\t\tdepth: depth,\n\t}\n\n\thalfWidth := width / 2.0\n\thalfHeight := height / 2.0\n\thalfDepth := depth / 2.0\n\n\tvertices := []mgl32.Vec3{\n\t\t// front\n\t\tmgl32.Vec3{-halfWidth, -halfHeight, halfDepth},\n\t\tmgl32.Vec3{halfWidth, -halfHeight, halfDepth},\n\t\tmgl32.Vec3{halfWidth, halfHeight, halfDepth},\n\t\tmgl32.Vec3{-halfWidth, halfHeight, halfDepth},\n\t\t// top\n\t\tmgl32.Vec3{-halfWidth, halfHeight, halfDepth},\n\t\tmgl32.Vec3{halfWidth, halfHeight, halfDepth},\n\t\tmgl32.Vec3{halfWidth, halfHeight, -halfDepth},\n\t\tmgl32.Vec3{-halfWidth, halfHeight, -halfDepth},\n\t\t// back\n\t\tmgl32.Vec3{halfWidth, -halfHeight, -halfDepth},\n\t\tmgl32.Vec3{-halfWidth, -halfHeight, -halfDepth},\n\t\tmgl32.Vec3{-halfWidth, halfHeight, -halfDepth},\n\t\tmgl32.Vec3{halfWidth, halfHeight, -halfDepth},\n\t\t//bottom\n\t\tmgl32.Vec3{-halfWidth, -halfHeight, -halfDepth},\n\t\tmgl32.Vec3{halfWidth, -halfHeight, -halfDepth},\n\t\tmgl32.Vec3{halfWidth, -halfHeight, halfDepth},\n\t\tmgl32.Vec3{-halfWidth, -halfHeight, halfDepth},\n\t\t// left\n\t\tmgl32.Vec3{-halfWidth, -halfHeight, -halfDepth},\n\t\tmgl32.Vec3{-halfWidth, -halfHeight, halfDepth},\n\t\tmgl32.Vec3{-halfWidth, halfHeight, halfDepth},\n\t\tmgl32.Vec3{-halfWidth, halfHeight, -halfDepth},\n\t\t// right\n\t\tmgl32.Vec3{halfWidth, -halfHeight, halfDepth},\n\t\tmgl32.Vec3{halfWidth, -halfHeight, -halfDepth},\n\t\tmgl32.Vec3{halfWidth, halfHeight, -halfDepth},\n\t\tmgl32.Vec3{halfWidth, halfHeight, halfDepth},\n\t}\n\n\tvar uvs []mgl32.Vec2\n\n\tfor i := 0; i < 6; i++ {\n\t\tuvs = append(uvs,\n\t\t\tmgl32.Vec2{1.0, 1.0},\n\t\t\tmgl32.Vec2{0.0, 1.0},\n\t\t\tmgl32.Vec2{0.0, 0.0},\n\t\t\tmgl32.Vec2{1.0, 0.0},\n\t\t)\n\t}\n\n\tfaces := []*three.Face{\n\t\t// front\n\t\tthree.NewFace(0, 1, 2),\n\t\tthree.NewFace(2, 3, 0),\n\t\t// top\n\t\tthree.NewFace(4, 5, 6),\n\t\tthree.NewFace(6, 7, 4),\n\t\t// back\n\t\tthree.NewFace(8, 9, 10),\n\t\tthree.NewFace(10, 11, 8),\n\t\t// bottom\n\t\tthree.NewFace(12, 13, 14),\n\t\tthree.NewFace(14, 15, 12),\n\t\t// left\n\t\tthree.NewFace(16, 17, 18),\n\t\tthree.NewFace(18, 19, 16),\n\t\t// right\n\t\tthree.NewFace(20, 21, 22),\n\t\tthree.NewFace(22, 23, 20),\n\t}\n\n\tbox.SetVertices(vertices)\n\tbox.SetUVs(uvs)\n\tbox.SetFaces(faces)\n\n\treturn &box\n}", "title": "" }, { "docid": "c1aa1d7f8d5842fa95a54b0f50a8c662", "score": "0.4338324", "text": "func (s *FlatFlankCamSDF2) BoundingBox() Box2 {\n\treturn s.bb\n}", "title": "" }, { "docid": "b8827ae8d48ebc927c54bcbb4cf115e8", "score": "0.43376374", "text": "func TestPrepareBox(t *testing.T) {\n\ta := area{x: 1, y: 1, w: 3, l: 1}\n\tb := box{id: 0, x: 0, y: 0, w: 3, l: 1}\n\texpected := box{id: 0, x: 1, y: 1, w: 3, l: 1}\n\tb = prepareBox(a, b)\n\tif b != expected {\n\t\tt.Errorf(\"box %v, expected %v\", b, expected)\n\t}\n\n\ta = area{x: 1, y: 1, w: 1, l: 3}\n\tb = box{id: 0, x: 0, y: 0, w: 3, l: 1}\n\texpected = box{id: 0, x: 1, y: 1, w: 1, l: 3}\n\tb = prepareBox(a, b)\n\tif b != expected {\n\t\tt.Errorf(\"box %v, expected %v\", b, expected)\n\t}\n}", "title": "" }, { "docid": "fb0af5992a0edb6382e65fb20f1c08de", "score": "0.43341824", "text": "func PressPage(tF string, v interface{}) (string, error) {\n //TODO:(hopley) - need a better way to get docRoot, assume heaer and footer .tmpl with tF else a default ...\n tPath := filepath.Dir(tF)\n log.Printf(\" ~~ in PressPage() where tPath=%s\\n\", tPath)\n heade := tPath + \"/\" + \"header.tmpl\" //TODO:(hopley) - press.init() check for footer, header ; some help notes ...\n foote := tPath + \"/\" + \"footer.tmpl\"\n c, err := Press(heade, \"/head\")\n chk(err)\n h := c\n c, err = Press(tF, v)\n chk(err)\n h += c\n c, err = Press(foote, \"/login\")\n chk(err)\n h += c\n return h, nil\n}", "title": "" }, { "docid": "e6bccac43155885a73d9bb624f81ca8d", "score": "0.43339774", "text": "func ScrollBox(child Ihandle) Ihandle {\n\t//Ihandle* IupScrollBox (Ihandle* child);\n\treturn mkih(C.IupScrollBox(child.ptr()))\n}", "title": "" }, { "docid": "62ffbdb9c463470d0c15aafbaf306cfc", "score": "0.4327603", "text": "func (b *Box) SetRect(x, y, width, height int) {\n\tb.x = x\n\tb.y = y\n\tb.width = width\n\tb.height = height\n\tb.innerX = -1 // Mark inner rect as uninitialized.\n}", "title": "" }, { "docid": "f008279678e82808ab170f1fcb859727", "score": "0.43178168", "text": "func (b *AtomicBox) Set(val interface{}) {\n\tb.Lock()\n\tdefer b.Unlock()\n\n\tb.object = val\n}", "title": "" }, { "docid": "7fb1ceda50d9650796e5302dcd09d97b", "score": "0.43095937", "text": "func Xsqlite3PagerSetPagesize(tls *libc.TLS, pPager uintptr, pPageSize uintptr, nReserve int32) int32 {\n\tbp := tls.Alloc(8)\n\tdefer tls.Free(8)\n\n\tvar rc int32 = SQLITE_OK\n\n\tvar pageSize U32 = *(*U32)(unsafe.Pointer(pPageSize))\n\n\tif (int32((*Pager)(unsafe.Pointer(pPager)).FmemDb) == 0 || (*Pager)(unsafe.Pointer(pPager)).FdbSize == Pgno(0)) &&\n\t\tXsqlite3PcacheRefCount(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) == 0 &&\n\t\tpageSize != 0 && pageSize != U32((*Pager)(unsafe.Pointer(pPager)).FpageSize) {\n\t\tvar pNew uintptr = uintptr(0)\n\t\t*(*I64)(unsafe.Pointer(bp)) = int64(0)\n\n\t\tif int32((*Pager)(unsafe.Pointer(pPager)).FeState) > PAGER_OPEN && (*Sqlite3_file)(unsafe.Pointer((*Pager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) {\n\t\t\trc = Xsqlite3OsFileSize(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, bp)\n\t\t}\n\t\tif rc == SQLITE_OK {\n\t\t\tpNew = Xsqlite3PageMalloc(tls, int32(pageSize+U32(8)))\n\t\t\tif !(pNew != 0) {\n\t\t\t\trc = SQLITE_NOMEM\n\t\t\t} else {\n\t\t\t\tlibc.Xmemset(tls, pNew+uintptr(pageSize), 0, uint64(8))\n\t\t\t}\n\t\t}\n\n\t\tif rc == SQLITE_OK {\n\t\t\tpager_reset(tls, pPager)\n\t\t\trc = Xsqlite3PcacheSetPageSize(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache, int32(pageSize))\n\t\t}\n\t\tif rc == SQLITE_OK {\n\t\t\tXsqlite3PageFree(tls, (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace)\n\t\t\t(*Pager)(unsafe.Pointer(pPager)).FpTmpSpace = pNew\n\t\t\t(*Pager)(unsafe.Pointer(pPager)).FdbSize = Pgno((*(*I64)(unsafe.Pointer(bp)) + I64(pageSize) - int64(1)) / I64(pageSize))\n\t\t\t(*Pager)(unsafe.Pointer(pPager)).FpageSize = I64(pageSize)\n\t\t\t(*Pager)(unsafe.Pointer(pPager)).FlckPgno = U32(Xsqlite3PendingByte)/pageSize + Pgno(1)\n\t\t} else {\n\t\t\tXsqlite3PageFree(tls, pNew)\n\t\t}\n\t}\n\n\t*(*U32)(unsafe.Pointer(pPageSize)) = U32((*Pager)(unsafe.Pointer(pPager)).FpageSize)\n\tif rc == SQLITE_OK {\n\t\tif nReserve < 0 {\n\t\t\tnReserve = int32((*Pager)(unsafe.Pointer(pPager)).FnReserve)\n\t\t}\n\n\t\t(*Pager)(unsafe.Pointer(pPager)).FnReserve = I16(nReserve)\n\t\tpagerFixMaplimit(tls, pPager)\n\t}\n\treturn rc\n}", "title": "" } ]
e7121e19f216f7b5973ee88aede50520
Approvable returns the result if the given identify (username or group name) can approve this input
[ { "docid": "4a6305723b322902f2c6ebe40c1c2610", "score": "0.7226848", "text": "func (i *Input) Approvable(identify string) (ok bool) {\n\tsubmitters := i.GetSubmitters()\n\n\tfor _, submitter := range submitters {\n\t\tif submitter == identify {\n\t\t\tok = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "f5c9dbdd3928d5787cc09847614c9a45", "score": "0.59763455", "text": "func (_Dai *Dai) Approve(opts *bind.TransactOpts, usr common.Address, wad *big.Int) (*types.Transaction, error) {\n\treturn _Dai.Transact(opts, \"approve\", usr, wad)\n}", "title": "" }, { "docid": "cf485b69e7963ecbdc587334e771c808", "score": "0.5695044", "text": "func (_Mkr *Mkr) Approve(opts *bind.TransactOpts, guy common.Address, wad *big.Int) (*types.Transaction, error) {\n\treturn _Mkr.Transact(opts, \"approve\", guy, wad)\n}", "title": "" }, { "docid": "cf55d61b10063997959b3dfe45f35f21", "score": "0.5551977", "text": "func (_ITellor *ITellorTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _ITellor.contract.Transact(opts, \"approve\", _spender, _amount)\n}", "title": "" }, { "docid": "10bdf823e249180e99a07bed23ea42ec", "score": "0.5524183", "text": "func (tokenReviewAuthorizer) Authorize(ctx context.Context, a authorizer.Attributes) (authorized authorizer.Decision, reason string, err error) {\n\tif a.GetUser().GetName() != \"system:serviceaccount:openshift-oauth-apiserver:openshift-authenticator\" {\n\t\treturn authorizer.DecisionNoOpinion, \"\", nil\n\t}\n\tif a.IsResourceRequest() &&\n\t\ta.GetVerb() == \"create\" &&\n\t\ta.GetAPIGroup() == \"oauth.openshift.io\" &&\n\t\ta.GetResource() == \"tokenreviews\" &&\n\t\tlen(a.GetSubresource()) == 0 &&\n\t\tlen(a.GetNamespace()) == 0 {\n\t\treturn authorizer.DecisionAllow, \"requesting tokenreviews is allowed\", nil\n\t}\n\n\treturn authorizer.DecisionNoOpinion, \"\", nil\n}", "title": "" }, { "docid": "450306d4ed1a792ca0d578f92818b4ce", "score": "0.55179745", "text": "func (_ICash *ICashTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ICash.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "4a8180f12a34b1b07dab6e6275b36f6e", "score": "0.5475529", "text": "func (profile *PartnerProfile) Approve(currentUser IUser) error {\n\tif !currentUser.IsAdmin() {\n\t\treturn errors.New(\"only admins are allowed to approve users\")\n\t}\n\tprofile.Approved = true\n\treturn nil\n}", "title": "" }, { "docid": "a1f69c9a36e922113a53e612ba2dade9", "score": "0.54608804", "text": "func (t *MAGNIT_CC) approveAgreement(APIstub shim.ChaincodeStubInterface, args []string) peer.Response {\n\n\tvar err error\n\t// check args\n\tif len(args) != 2 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 2\")\n\t}\n\tif len(args[0]) <= 0 {\n\t\treturn shim.Error(\"AgreementID must be a non-empty string\")\n\t}\n\tif len(args[1]) <= 0 {\n\t\treturn shim.Error(\"Status of agreement must be a non-empty string\")\n\t}\n\n\tAgreementID := args[0]\n\tstatus := args[1]\n\n\tupdate_time, errTx := t.GetTxTimestampChannel(APIstub)\n\tif errTx != nil {\n\t\treturn shim.Error(\"Returning error\")\n\t}\n\n\tvalAsbytes, err := APIstub.GetState(AgreementID) //get the Agreement from chaincode state\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t} else if valAsbytes == nil {\n\t\treturn shim.Error(\"Agreement not exist\")\n\t}\n\n\tAgreement := &Agreement{}\n\terr = json.Unmarshal([]byte(valAsbytes), &Agreement)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tAgreement.Agreement_status = status\n\tAgreement.Agreement_update_time = update_time\n\n\tvalAsbytes, err = json.Marshal(Agreement)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\terr = APIstub.PutState(AgreementID, valAsbytes)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tfmt.Println(\"update success\")\n\treturn shim.Success(nil)\n\n}", "title": "" }, { "docid": "aed7d4981060303a75af3cb0473a02e4", "score": "0.5417492", "text": "func (_Lobster *LobsterTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) {\n\treturn _Lobster.contract.Transact(opts, \"approve\", to, tokenId)\n}", "title": "" }, { "docid": "c478aceb3a4b3a1aa50db12fd594b851", "score": "0.5417456", "text": "func (d *DefaultAuthorizer) Authorize(ctx context.Context, subject *Subject, object PolicyResource, action string) (bool, error) {\n\tinput := map[string]interface{}{\n\t\t\"group\": subject.Group,\n\t\t\"user\": subject.User,\n\t\t\"object\": object.Item,\n\t\t\"contexts\": object.Contexts,\n\t\t\"action\": action,\n\t}\n\n\tevaluator := d.partialResult.Rego(rego.Input(input))\n\n\tresult, err := evaluator.Eval(ctx)\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif len(result) != 1 {\n\t\treturn false, fmt.Errorf(\"Expected rego to produce exactly 1 result, but got %d\", len(result))\n\t}\n\n\tauthorized := result[0].Expressions[0].Value.(bool)\n\n\treturn authorized, nil\n}", "title": "" }, { "docid": "224f03fd2d9c2a691a35e8ca88ec454f", "score": "0.54059845", "text": "func (_StakingContract *StakingContractCaller) IsApproved(opts *bind.CallOpts, user common.Address, agent common.Address) (bool, error) {\n\tvar out []interface{}\n\terr := _StakingContract.contract.Call(opts, &out, \"isApproved\", user, agent)\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "3028f92cddc5c875a9b05b31f76462f4", "score": "0.5367898", "text": "func (c *AppAccessAuthoricationController) PostApproval() datamodels.DbResult {\n\tvar m map[string]interface{}\n\t// var m KeyJson\n\terr := c.Ctx.ReadJSON(&m)\n\tif err != nil {\n\t\tfmt.Println(\"ReadJSON Error:\", err)\n\t}\n\tfmt.Println(m)\n\n\t//query user name\n\t// result := c.Service.GetByID(c.getCurrentUserID())\n\t// user := result.Data.(datamodels.User)\n\t// if user.ID == 0 {\n\t// \treturn *datamodels.NewDbResult(\"\", -2, \"no user\")\n\t// }\n\t// if user.RoleType != 1 {\n\t// \treturn *datamodels.NewDbResult(\"\", -3, \"no permission\")\n\t// }\n\tresult2 := c.Service.GetByName(m[\"appName\"].(string))\n\tapp := result2.Data.(datamodels.AppAccessAuthorication)\n\tapp.Secret = utils.GenerateSecret()\n\treturn *c.Service.UpdateByAppName(app)\n\n}", "title": "" }, { "docid": "f19705c78b2e8050301fde37672fd38b", "score": "0.5330834", "text": "func (_IDisputeCrowdsourcer *IDisputeCrowdsourcerTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _IDisputeCrowdsourcer.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "233bc69d0987b84f30b0f94bf13be42c", "score": "0.5325383", "text": "func (_ERC677 *ERC677Transactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC677.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "937a0a3515c7d0ee00b791d6da2acfd6", "score": "0.53179073", "text": "func (c ConditionHash) Approve(k PrivKey) ConditionProof {\n\th := sha256.New()\n\th.Write(k)\n\th.Write(c)\n\th.Write(k)\n\tv := h.Sum(nil)\n\treturn ConditionProof(v[:])\n}", "title": "" }, { "docid": "c5d57d56268f37c1504bc52ff71ab69f", "score": "0.5317886", "text": "func (h AuthByEmailHandler) serveApprove(w http.ResponseWriter, r *http.Request) (int, error) {\n\t// Parse the form data in the request body\n\tr.ParseForm()\n\n\tif r.Method == \"POST\" {\n\t\t// The admin confirmed the form\n\t\treturn h.serveApproveByExecutingAction(w, r)\n\t} else {\n\t\t// The admin clicked the link in their e-mail\n\t\treturn h.serveApproveByAskingConfirmation(w, r)\n\t}\n\n}", "title": "" }, { "docid": "61aee6f45dc793a43b6f743645ed62fd", "score": "0.5316335", "text": "func (_ICash *ICashTransactorSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ICash.Contract.Approve(&_ICash.TransactOpts, _spender, _value)\n}", "title": "" }, { "docid": "8580e9a7080be2439c157762bef36521", "score": "0.5314714", "text": "func (h AuthByEmailHandler) serveApproveByExecutingAction(w http.ResponseWriter, r *http.Request) (int, error) {\n\t// Check sanity of the request\n\tif len(r.PostForm[\"action\"]) == 0 || len(r.PostForm[\"email\"]) == 0 {\n\t\th.logger.Printf(\"Approve-execute attempted with missing action or email data\")\n\t\treturn h.serveBadRequest(w)\n\t}\n\n\t// Decrypt the e-mail given in the link\n\temail, err := h.mailer.DecryptEmail(r.PostForm[\"email\"][0])\n\tif err != nil {\n\t\th.logger.Printf(\"Could not decrypt email %v. Error %v\", r.PostForm[\"email\"][0], err)\n\t\treturn h.serveBadRequest(w)\n\t}\n\n\tuserID := CRYPTO.UserIDfromEmail(email)\n\n\tswitch r.PostForm[\"action\"][0] {\n\tcase \"approve\":\n\t\t// Add user to the database\n\t\th.database.AddUser(userID)\n\t\t// Send user a login link\n\t\ttoken, err := h.database.NewLinkToken(LinkToken{UserID: userID, CorrespondingCookie: \"\"}, 48*time.Hour)\n\t\tif err != nil {\n\t\t\th.logger.Printf(\"Database error trying to approve a user from an admin link, %v\", err)\n\t\t\treturn 500, err\n\t\t}\n\n\t\terr = h.mailer.SendLoginLink(email, token)\n\t\tif err != nil {\n\t\t\th.logger.Printf(\"Error mailing user %v a login link, %v\", email.String(), err)\n\t\t\treturn 500, err\n\t\t}\n\n\t\treturn h.serveStaticPage(w, r, 200, TplAckApprove)\n\n\tcase \"revoke\":\n\t\t// Delete user and invalidate all links and cookies\n\t\th.database.DelUser(userID)\n\t\treturn h.serveStaticPage(w, r, 200, TplAckRemove)\n\n\tdefault:\n\t\treturn h.serveBadRequest(w)\n\t}\n}", "title": "" }, { "docid": "48061f0694f8b1d9f631f00207a467d2", "score": "0.5314372", "text": "func checkAndApprove(repo string, pr PullRequest) bool {\n\tbuf, err := sendRequest(\"GET\", fmt.Sprintf(\"%s/repos/%s/pulls/%d/files\", GITHUB_APIBASE, repo, pr.Number), nil, nil)\n\tif err != nil {\n\t\tlogger.Error(\"[ERROR] \" + err.Error())\n\t\treturn false\n\t}\n\n\tprFiles := make([]PullRequestFile, 0)\n\tif err := json.Unmarshal(buf, &prFiles); err != nil {\n\t\tlogger.Error(\"[ERROR] \" + err.Error())\n\t\treturn false\n\t}\n\n\tif !checkAutoApproveFiles(prFiles) {\n\t\tlogger.Passive(\"PR doesn't bump version only. Skipped\")\n\t\treturn false\n\t}\n\n\t// Approve automatically\n\tif err := sendApproveRequest(repo, pr); err != nil {\n\t\tlogger.Error(\"[ERROR] \" + err.Error())\n\t\treturn false\n\t}\n\n\t// Update assignee\n\tif err := updatePullRequestAssignee(repo, pr); err != nil {\n\t\tlogger.Error(\"[ERROR] \" + err.Error())\n\t\treturn false\n\t}\n\n\tlogger.Notify(fmt.Sprintf(\"Automatic PR approved #%d\", pr.Number))\n\tgo notifyAutomaticApprove(pr)\n\treturn true\n}", "title": "" }, { "docid": "57d350cee8f994df43bcee21a8b6c670", "score": "0.5302849", "text": "func (_AloAgriOnion *AloAgriOnionTransactor) Approved(opts *bind.TransactOpts, docId string, docmimeType string, docHash [32]byte) (*types.Transaction, error) {\n\treturn _AloAgriOnion.contract.Transact(opts, \"approved\", docId, docmimeType, docHash)\n}", "title": "" }, { "docid": "9e479cd3080ab266a711f0cb5df2d315", "score": "0.529133", "text": "func (a Admin) Approve(w http.ResponseWriter, r *http.Request) {\n\ts, _ := GetNamed(r, \"current-session\")\n\tvar msg = Command{}\n\tprintln(r.FormValue(\"title\"))\n\tdecoder := json.NewDecoder(r.Body)\n\tdecoder.DisallowUnknownFields()\n\tencoder := json.NewEncoder(w)\n\terr := decoder.Decode(&msg)\n\tif err != nil {\n\t\tw.Header().Set(\"content-type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\terr = encoder.Encode(&Res{Success: false, Message: \"Malformed Request: \" + errors.Cause(err).Error(), Time: time.Now().Local().Format(time.Stamp)})\n\t\tif err != nil {\n\t\t\thelpers.HandleError(err)\n\t\t}\n\t\thttp.Redirect(w, r, \"/bd-admin\", 300)\n\t\treturn\n\t}\n\tuser := helpers.GetCurrentUser(\"user-id\", s)\n\n\tn := models.Detail{\n\t\tApprovalTime: time.Now(),\n\t\tUserID: user.ID,\n\t\tReviewerID: user.ID,\n\t\tReviewID: uint(msg.ReviewID),\n\t\tTitle: msg.Title,\n\t\tBody: msg.Body,\n\t}\n\n\tdetail := models.CreateDetail(n)\n\treview := models.GetReview(fmt.Sprintf(\"id = '%d'\", msg.ReviewID))\n\treviews := models.GetReviews()\n\tfor _, rev := range reviews {\n\t\tif rev.ID == review.ID {\n\t\t\tfmt.Println(rev.ID, review.ID)\n\t\t\treview.Pending = false\n\t\t\tfmt.Println(len(review.Details))\n\t\t\treview.Details = append(review.Details, detail)\n\t\t\tfmt.Println(len(review.Details))\n\t\t}\n\t}\n\n\terr = models.UpdateReview(review)\n\tif err != nil {\n\t\thelpers.HandleError(err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tif err := encoder.Encode(&Res{Success: true, Message: \"Approval Accepted\", Time: time.Now().Local().Format(time.Stamp)}); err != nil {\n\t\thelpers.HandleError(err)\n\t}\n}", "title": "" }, { "docid": "8cd555236d97242c0ded50f09146ac26", "score": "0.5278228", "text": "func (_ERC20Pausable *ERC20PausableTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Pausable.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "5be289b428fdeff8ca0b972ce3e45b88", "score": "0.5274997", "text": "func (_IOption *IOptionTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _IOption.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "cf9b15c0f2272622d86cf00c7eb80969", "score": "0.5273387", "text": "func (_NeutralToken *NeutralTokenTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _NeutralToken.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "488cdb3fcbc1dae2853d757c34bd741e", "score": "0.52691907", "text": "func (_Poolbindings *PoolbindingsTransactor) Approve(opts *bind.TransactOpts, dst common.Address, amt *big.Int) (*types.Transaction, error) {\n\treturn _Poolbindings.contract.Transact(opts, \"approve\", dst, amt)\n}", "title": "" }, { "docid": "67e63110d9abc55d188ffca48ea85322", "score": "0.5269045", "text": "func (_ICash *ICashSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ICash.Contract.Approve(&_ICash.TransactOpts, _spender, _value)\n}", "title": "" }, { "docid": "df48b34f3c43c6c77f3df147b2c1b7cb", "score": "0.52629733", "text": "func (_ERC20 *ERC20Transactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "8c61fbd42e0e7db6b1bdab07b808efe6", "score": "0.5261169", "text": "func (_ITellor *ITellorTransactorSession) Approve(_spender common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _ITellor.Contract.Approve(&_ITellor.TransactOpts, _spender, _amount)\n}", "title": "" }, { "docid": "8348969a3bef0c4c6bcd400ea92e290f", "score": "0.52562284", "text": "func (this *Dirent) CanExecute(user *identity.User, group *identity.Group) bool {\n if (this.Group != group.Id) {\n return false;\n }\n\n // Root can do anything.\n if (user.Id == identity.ROOT_USER_ID) {\n return true;\n }\n\n if (user.Id == this.Owner) {\n return this.Permissions.Has(PERM_UX);\n }\n\n if (group.HasMember(user.Id)) {\n return this.Permissions.Has(PERM_GX);\n }\n\n return this.Permissions.Has(PERM_OX);\n}", "title": "" }, { "docid": "9c2d100f5c7325e99b401b8edbbcc5a2", "score": "0.5255745", "text": "func (_PausableToken *PausableTokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _PausableToken.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "7a53d16dd57d18bf6a6cfd80e8de372d", "score": "0.5252166", "text": "func (_ITellor *ITellorSession) Approve(_spender common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _ITellor.Contract.Approve(&_ITellor.TransactOpts, _spender, _amount)\n}", "title": "" }, { "docid": "8659fa50d8d5c2f64893c5f87fe528cd", "score": "0.5251696", "text": "func (impl *SupermanDetectorImpl) Authorize(action string, resource string, principal rdl.Principal) (bool, error) {\n\treturn true, nil\n}", "title": "" }, { "docid": "016e4c1cf34181d8777db7eaaa1feee8", "score": "0.524254", "text": "func (_Exchange *ExchangeTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Exchange.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "d22e943071f85589ab379a2b87a99243", "score": "0.5241653", "text": "func (_Bnb *BnbTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Bnb.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "089e71569eb3b19dcfbe81b4f7ab91f1", "score": "0.5238132", "text": "func (_Token *TokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "089e71569eb3b19dcfbe81b4f7ab91f1", "score": "0.5238132", "text": "func (_Token *TokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "089e71569eb3b19dcfbe81b4f7ab91f1", "score": "0.5238132", "text": "func (_Token *TokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "089e71569eb3b19dcfbe81b4f7ab91f1", "score": "0.5238132", "text": "func (_Token *TokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "7a54706769681e4d8433b78eb71f0fcf", "score": "0.5232679", "text": "func (s *Song) Approve(res http.ResponseWriter, req *http.Request) error {\n\treturn nil\n}", "title": "" }, { "docid": "53c794fd629e418a5b72c2b23580d865", "score": "0.52306", "text": "func (_Erc721 *Erc721Transactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) {\n\treturn _Erc721.contract.Transact(opts, \"approve\", to, tokenId)\n}", "title": "" }, { "docid": "cca182a807b118baab6d1296309413f0", "score": "0.5226718", "text": "func (_Contract *ContractTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "88f769c588311820f35d50ffc82abe3e", "score": "0.5223976", "text": "func _isApprovedForAll(ctx contractapi.TransactionContextInterface, account string, operator string) (bool, error) {\n\n\t// Check if contract has been intilized first\n\tinitialized, err := checkInitialized(ctx)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to check if contract is already initialized: %v\", err)\n\t}\n\tif !initialized {\n\t\treturn false, fmt.Errorf(\"Contract options need to be set before calling any function, call Initialize() to initialize contract\")\n\t}\n\n\tapprovalKey, err := ctx.GetStub().CreateCompositeKey(approvalPrefix, []string{account, operator})\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to create the composite key for prefix %s: %v\", approvalPrefix, err)\n\t}\n\n\tapprovalBytes, err := ctx.GetStub().GetState(approvalKey)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to read approval of operator %s for account %s from world state: %v\", operator, account, err)\n\t}\n\n\tif approvalBytes == nil {\n\t\treturn false, nil\n\t}\n\n\tvar approved bool\n\terr = json.Unmarshal(approvalBytes, &approved)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to decode approval JSON of operator %s for account %s: %v\", operator, account, err)\n\t}\n\n\treturn approved, nil\n}", "title": "" }, { "docid": "ec9b55baece84795d7c21476d44b7de1", "score": "0.522051", "text": "func (_ERC20 *ERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "ec9b55baece84795d7c21476d44b7de1", "score": "0.522051", "text": "func (_ERC20 *ERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "ec9b55baece84795d7c21476d44b7de1", "score": "0.522051", "text": "func (_ERC20 *ERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "bd59b3d079e215291b9cd813f5fa69d2", "score": "0.5217375", "text": "func (_WindMineToken *WindMineTokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _WindMineToken.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "41307c4ce2d76df547ceaa1e86398258", "score": "0.521461", "text": "func (_Token *TokenTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "41307c4ce2d76df547ceaa1e86398258", "score": "0.521461", "text": "func (_Token *TokenTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "80c275c839f08fb52907a1481e60ba23", "score": "0.521342", "text": "func (_SmartToken *SmartTokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _SmartToken.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "2cd0c4b7105c9dd8f0d3d0638945f26e", "score": "0.5190693", "text": "func (_WETH *WETHTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _WETH.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "d14fb834d8e093ec50bec93a7dcee64f", "score": "0.51887786", "text": "func Approval(studentID int64, ministryID int64) error {\n\tdb, err := dbConn()\n\tif err != nil {\n\t\tlog.Println(\"[Approval] Error to open database \")\n\t\treturn err\n\t}\n\tdefer db.Close()\n\tstmt, err := db.Prepare(updateStatus)\n\tif err != nil {\n\t\tlog.Println(\"[Approval] Error to prepare query \")\n\t\treturn err\n\t}\n\tdefer stmt.Close()\n\t_, err = stmt.Exec(statusApproved, ministryID, studentID)\n\tif err != nil {\n\t\tlog.Println(\"[Approval] Error execute query \")\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8b5f8a2a26ae5c20e3cac5779b6e2f0", "score": "0.5187745", "text": "func (_Erc721 *Erc721Caller) IsApprovedOrOwner(opts *bind.CallOpts, _spender common.Address, _tokenId *big.Int) (bool, error) {\n\tvar out []interface{}\n\terr := _Erc721.contract.Call(opts, &out, \"isApprovedOrOwner\", _spender, _tokenId)\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "464d5c3ec246899da3e1828469b63f98", "score": "0.5181438", "text": "func (_SUSD *SUSDTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _SUSD.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "5a8ad7019a7575d44f966d10bd19e764", "score": "0.51804113", "text": "func (_Cash *CashTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Cash.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "fe6aab204d752d08e8542de2adb70e7a", "score": "0.5179086", "text": "func (_StandaloneERC20 *StandaloneERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _StandaloneERC20.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "8b66b75c15e5f18d7f23b7b629223e99", "score": "0.5178516", "text": "func (_Zap *ZapTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _amount *big.Int) (*types.Transaction, error) {\r\n\treturn _Zap.contract.Transact(opts, \"approve\", _spender, _amount)\r\n}", "title": "" }, { "docid": "7579415ca63dec1ec0fb5a87d2197927", "score": "0.51721716", "text": "func (_IERC20 *IERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _IERC20.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "7579415ca63dec1ec0fb5a87d2197927", "score": "0.5171745", "text": "func (_IERC20 *IERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _IERC20.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "7579415ca63dec1ec0fb5a87d2197927", "score": "0.5171745", "text": "func (_IERC20 *IERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _IERC20.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "7579415ca63dec1ec0fb5a87d2197927", "score": "0.5171745", "text": "func (_IERC20 *IERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _IERC20.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "7579415ca63dec1ec0fb5a87d2197927", "score": "0.5171745", "text": "func (_IERC20 *IERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _IERC20.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "6ff2aaac5bf5d83a4aa6ed61821d438b", "score": "0.5166754", "text": "func (_MonsterAuction *MonsterAuctionTransactor) Approve(opts *bind.TransactOpts, _to common.Address, _tokenId *big.Int) (*types.Transaction, error) {\n\treturn _MonsterAuction.contract.Transact(opts, \"approve\", _to, _tokenId)\n}", "title": "" }, { "docid": "0b554091277ee5ed5b8ef91dbb98f051", "score": "0.5159194", "text": "func (_SMTToken *SMTTokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _SMTToken.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "7c36ee2d59f7abec3f162ee89f59cdcb", "score": "0.5151452", "text": "func (_StandardToken *StandardTokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _StandardToken.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "7c36ee2d59f7abec3f162ee89f59cdcb", "score": "0.5151452", "text": "func (_StandardToken *StandardTokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _StandardToken.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "7c36ee2d59f7abec3f162ee89f59cdcb", "score": "0.5151452", "text": "func (_StandardToken *StandardTokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _StandardToken.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "4070de5536a165f70bc23851cc5333f3", "score": "0.5148099", "text": "func (p *permissionsImpl) allowID(bidder openrtb_ext.BidderName, consentMeta tcf2.ConsentMetadata, vendorInfo VendorInfo) bool {\n\tfor i := 2; i <= 10; i++ {\n\t\tpurpose := consentconstants.Purpose(i)\n\t\tenforcer := p.purposeEnforcerBuilder(purpose, bidder)\n\n\t\toverrides := Overrides{enforcePurpose: true, enforceVendors: true}\n\t\tif _, ok := enforcer.(*BasicEnforcement); ok && purpose == consentconstants.Purpose(2) {\n\t\t\toverrides.allowLITransparency = true\n\t\t}\n\t\tif enforcer.LegalBasis(vendorInfo, bidder, consentMeta, overrides) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4070de5536a165f70bc23851cc5333f3", "score": "0.5148099", "text": "func (p *permissionsImpl) allowID(bidder openrtb_ext.BidderName, consentMeta tcf2.ConsentMetadata, vendorInfo VendorInfo) bool {\n\tfor i := 2; i <= 10; i++ {\n\t\tpurpose := consentconstants.Purpose(i)\n\t\tenforcer := p.purposeEnforcerBuilder(purpose, bidder)\n\n\t\toverrides := Overrides{enforcePurpose: true, enforceVendors: true}\n\t\tif _, ok := enforcer.(*BasicEnforcement); ok && purpose == consentconstants.Purpose(2) {\n\t\t\toverrides.allowLITransparency = true\n\t\t}\n\t\tif enforcer.LegalBasis(vendorInfo, bidder, consentMeta, overrides) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8d320cc10a08739c257a7f70e259f97c", "score": "0.51469904", "text": "func (group *Group) Authorize(ctx aero.Context, action string) error {\n\tuser := GetUserFromContext(ctx)\n\n\tif user == nil {\n\t\treturn errors.New(\"Not logged in\")\n\t}\n\n\tif action == \"edit\" && group.CreatedBy != user.ID {\n\t\treturn errors.New(\"Can't edit groups from other people\")\n\t}\n\n\tif action == \"join\" && group.Restricted {\n\t\treturn errors.New(\"Can't join restricted groups\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "30ee77c6cbfdb76c676700aa6a336330", "score": "0.5143413", "text": "func (px *Paxos) AcceptRevoke(args *AcceptRevokeArgs, reply *AcceptRevokeReply) error {\n px.mu.Lock()\n defer px.mu.Unlock()\n SeqNo := args.SeqNo\n ProposalNo := args.ProposalNo\n Value := args.Value\n px.UpdateMax(SeqNo)\n\n if SeqNo >= px.min {\n //status, exist := px.statusMap[SeqNo] //added\n state, ok := px.acceptorStateMap[SeqNo]\n if (ok && ProposalNo < state.N_p){// || (exist && status.Done)\n reply.Ok = false\n } else {\n px.acceptorStateMap[SeqNo] = AcceptorState{ProposalNo, ProposalNo, Value}\n reply.Ok = true\n }\n } \n return nil\n}", "title": "" }, { "docid": "ae4eaeb076c51da1f15b0aef72f76984", "score": "0.51383466", "text": "func (h AuthByEmailHandler) serveApproveByAskingConfirmation(w http.ResponseWriter, r *http.Request) (int, error) {\n\t// Check sanity of the request\n\tif len(r.Form[\"email\"]) == 0 {\n\t\th.logger.Printf(\"Approve-confirm attempted with missing email data, %v\", r.URL)\n\t\treturn h.serveBadRequest(w)\n\t}\n\n\t// Decrypt the e-mail given in the link\n\temail, err := h.mailer.DecryptEmail(r.Form[\"email\"][0])\n\tif err != nil {\n\t\th.logger.Printf(\"Could not decrypt email %v. Error %v\", r.Form[\"email\"][0], err)\n\t\treturn h.serveBadRequest(w)\n\t}\n\n\t// Collect data for the approval template\n\tdata := struct {\n\t\tUser, EncEmail string\n\t\tExists, SafeAddress bool\n\t}{\n\t\tUser: email.String(),\n\t\tEncEmail: r.Form[\"email\"][0],\n\t\tExists: h.database.IsKnownUser(CRYPTO.UserIDfromEmail(email)),\n\t\tSafeAddress: email.LocalPartIsASCII(),\n\t}\n\n\treturn h.serveTemplate(w, TplApprove, &data)\n}", "title": "" }, { "docid": "c02f889f6fc7a893b8631d1848cc7b4f", "score": "0.51346165", "text": "func (tfc *TFC) Approve(ctx context.Context, spender Address, amount *big.Int, sender *Account) (doneCh chan interface{}, errCh chan error) {\n\tpanic(UnimplementedError)\n}", "title": "" }, { "docid": "8a0850a8616d9480aed316aa46943efd", "score": "0.513185", "text": "func (_RarityGold *RarityGoldTransactor) Approve(opts *bind.TransactOpts, from *big.Int, spender *big.Int, amount *big.Int) (*types.Transaction, error) {\n\treturn _RarityGold.contract.Transact(opts, \"approve\", from, spender, amount)\n}", "title": "" }, { "docid": "d868ecd8aab3ee7b7e9ba715db2dfdac", "score": "0.51310474", "text": "func (_OToken *OTokenTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _OToken.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "98d663f416a04b01c6d682e6d4d2c7fd", "score": "0.5109367", "text": "func (_ERC20 *ERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "98d663f416a04b01c6d682e6d4d2c7fd", "score": "0.51091784", "text": "func (_ERC20 *ERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "a8f83796c425dfd60c0b6ae471dd8351", "score": "0.5105041", "text": "func (_PausableTokenMock *PausableTokenMockTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _PausableTokenMock.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "4c4c18d17b7dddb6e4a21a90d4abf674", "score": "0.51033527", "text": "func (_AastraVault *AastraVaultTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _AastraVault.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "68bab29cad3cbd157d3ceac54f36f21c", "score": "0.5101249", "text": "func (_ERC677Token *ERC677TokenTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC677Token.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "9cbd46270395450f73e7eec51bcf2282", "score": "0.5098084", "text": "func (_ERC20Pausable *ERC20PausableSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Pausable.Contract.Approve(&_ERC20Pausable.TransactOpts, spender, value)\n}", "title": "" }, { "docid": "cf94ee228bb8ddf0c677c3046aba836f", "score": "0.5097781", "text": "func (_QLCChain *QLCChainTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _QLCChain.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "5d0c39d974875c8ce2e92c309f514d45", "score": "0.5088805", "text": "func (_BCB *BCBTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _BCB.contract.Transact(opts, \"approve\", spender, value)\n}", "title": "" }, { "docid": "fa2cb76cbe36cf52d6edcc8dc76ec79a", "score": "0.50806653", "text": "func (_StakingContract *StakingContractCallerSession) IsApproved(user common.Address, agent common.Address) (bool, error) {\n\treturn _StakingContract.Contract.IsApproved(&_StakingContract.CallOpts, user, agent)\n}", "title": "" }, { "docid": "8c68f8cb36a00e219b65be305da26627", "score": "0.50637704", "text": "func (_Levtoken *LevtokenTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Levtoken.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "38b2a94d2f4100dd58f95024c63fcef3", "score": "0.5060787", "text": "func (s service) ApproveCclaWhitelistRequest(ctx context.Context, companyID, claGroupID, requestID string) error {\n\terr := s.repo.ApproveCclaWhitelistRequest(requestID)\n\tif err != nil {\n\t\tlog.Warnf(\"ApproveCclaWhitelistRequest - problem updating approved list with 'approved' status for request: %s, error: %+v\",\n\t\t\trequestID, err)\n\t\treturn err\n\t}\n\n\trequestModel, err := s.repo.GetCclaWhitelistRequest(requestID)\n\tif err != nil {\n\t\tlog.Warnf(\"ApproveCclaWhitelistRequest - unable to lookup request by id: %s, error: %+v\", requestID, err)\n\t\treturn err\n\t}\n\n\tcompanyModel, err := s.companyRepo.GetCompany(ctx, companyID)\n\tif err != nil {\n\t\tlog.Warnf(\"ApproveCclaWhitelistRequest - unable to lookup company by id: %s, error: %+v\", companyID, err)\n\t\treturn err\n\t}\n\tclaGroupModel, err := s.projectRepo.GetCLAGroupByID(ctx, claGroupID, DontLoadRepoDetails)\n\tif err != nil {\n\t\tlog.Warnf(\"ApproveCclaWhitelistRequest - unable to lookup project by id: %s, error: %+v\", claGroupID, err)\n\t\treturn err\n\t}\n\n\tif requestModel.UserEmails == nil {\n\t\tmsg := fmt.Sprintf(\"ApproveCclaWhitelistRequest - unable to send approval email - email missing for request: %+v, error: %+v\",\n\t\t\trequestModel, err)\n\t\tlog.Warnf(msg)\n\t\treturn errors.New(msg)\n\t}\n\n\t// Send the email\n\tsendRequestApprovedEmailToRecipient(companyModel, claGroupModel, requestModel.UserName, requestModel.UserEmails[0])\n\n\treturn nil\n}", "title": "" }, { "docid": "05d44e66e2d49dfc641c047e1560667a", "score": "0.5057447", "text": "func (_ERC20WithPermit *ERC20WithPermitTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _ERC20WithPermit.contract.Transact(opts, \"approve\", spender, amount)\n}", "title": "" }, { "docid": "368c5c69e64f5dc51fd6d42dfac5e20f", "score": "0.50569636", "text": "func (_IDisputeCrowdsourcer *IDisputeCrowdsourcerTransactorSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _IDisputeCrowdsourcer.Contract.Approve(&_IDisputeCrowdsourcer.TransactOpts, _spender, _value)\n}", "title": "" }, { "docid": "0911deb3ba1b0a41a8dec697387f937b", "score": "0.5052668", "text": "func (_DebtEngine *DebtEngineTransactor) Approve(opts *bind.TransactOpts, _operator common.Address, _assetId *big.Int) (*types.Transaction, error) {\n\treturn _DebtEngine.contract.Transact(opts, \"approve\", _operator, _assetId)\n}", "title": "" }, { "docid": "eef03aae406690b57433c5bd08a7f35b", "score": "0.505095", "text": "func (_StakingContract *StakingContractSession) IsApproved(user common.Address, agent common.Address) (bool, error) {\n\treturn _StakingContract.Contract.IsApproved(&_StakingContract.CallOpts, user, agent)\n}", "title": "" }, { "docid": "43ddcdb743c80df8d6825f393ab9c3be", "score": "0.5050648", "text": "func (_ERC20Pausable *ERC20PausableTransactorSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Pausable.Contract.Approve(&_ERC20Pausable.TransactOpts, spender, value)\n}", "title": "" }, { "docid": "37a3a252253084f6a18eb7cc21942f9d", "score": "0.5049816", "text": "func (_AloAgriOnion *AloAgriOnionSession) Approved(docId string, docmimeType string, docHash [32]byte) (*types.Transaction, error) {\n\treturn _AloAgriOnion.Contract.Approved(&_AloAgriOnion.TransactOpts, docId, docmimeType, docHash)\n}", "title": "" }, { "docid": "eec29a87879e8b9ec5da14b130db6570", "score": "0.5049544", "text": "func (_NbcToken *NbcTokenTransactor) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) {\n\treturn _NbcToken.contract.Transact(opts, \"approve\", to, tokenId)\n}", "title": "" }, { "docid": "7081eb31358f16f770d97a5f1ad492ed", "score": "0.5048615", "text": "func Authorize(token, permis string, id int, action string, chkfunc func(string, int, string) (bool, error)) bool {\n\tif token == SystemToken || !authEnabled || permis == \"\" {\n\t\treturn true\n\t}\n\n\tif token == \"\" {\n\t\treturn false\n\t}\n\n\thasperm, err := checkTokenPermission(token, permis)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif hasperm {\n\t\treturn true\n\t} else {\n\t\t// check for own auth\n\t\tif id == 0 {\n\t\t\treturn false\n\t\t}\n\t\tif chkfunc != nil {\n\t\t\tchk, errc := chkfunc(token, id, action)\n\t\t\tif errc != nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn chk\n\t\t}\n\t\t// no chk func provided\n\t\treturn false\n\n\t}\n}", "title": "" }, { "docid": "b4d93dbc26a72ea9bcd45dc4f87966d5", "score": "0.50433105", "text": "func ontid(userName string) bool {\n\tinput := server.GenerateOntIdInput{ReqID: uuid.NewV4().String(), UserId: userName, Party: party}\n\tbytes, _ := json.Marshal(input)\n\tcode, _, _, err := forward.PostJSONRequest(domain+server.GenerateOntIdByUserIdURI, bytes, nil)\n\n\tfmt.Println(\"code\", code, \"err\", err)\n\treturn code == 200 && err == nil\n}", "title": "" }, { "docid": "dd9e1d9c39498610bed02705148dabf4", "score": "0.50433016", "text": "func (o LookupTargetResultOutput) RequireApproval() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v LookupTargetResult) bool { return v.RequireApproval }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "6c0d5fd102bb79e56ea998e99c0c66f6", "score": "0.50313723", "text": "func (_DisputeCrowdsourcer *DisputeCrowdsourcerTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _DisputeCrowdsourcer.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "3b300884f1550a8e6c22ba0003a64350", "score": "0.5031353", "text": "func isUserHaveAccessToCLAProject(ctx context.Context, authUser *auth.User, parentProjectSFID string, projectSFIDs []string, projectClaGroupsRepo projects_cla_groups.Repository) bool { // nolint\n\tf := logrus.Fields{\n\t\t\"functionName\": \"v2.cla_groups.handlers.isUserHaveAccessToCLAProject\",\n\t\tutils.XREQUESTID: ctx.Value(utils.XREQUESTID),\n\t\t\"parentProjectSFID\": parentProjectSFID,\n\t\t\"projectSFIDs\": strings.Join(projectSFIDs, \",\"),\n\t\t\"userName\": authUser.UserName,\n\t\t\"userEmail\": authUser.Email,\n\t}\n\n\t// Check the parent project SFID\n\tlog.WithFields(f).Debug(\"testing if user has access to the parent project SFID\")\n\tif utils.IsUserAuthorizedForProject(ctx, authUser, parentProjectSFID, utils.ALLOW_ADMIN_SCOPE) {\n\t\tlog.WithFields(f).Debugf(\"user has access to the parent project SFID: %s\", parentProjectSFID)\n\t\treturn true\n\t}\n\tlog.WithFields(f).Debugf(\"user does not have access to the parent project SFID: %s\", parentProjectSFID)\n\n\t// Check the project SFIDs\n\tlog.WithFields(f).Debug(\"testing if user has access to any of the provided project SFIDs\")\n\tif utils.IsUserAuthorizedForAnyProjects(ctx, authUser, projectSFIDs, utils.ALLOW_ADMIN_SCOPE) {\n\t\tlog.WithFields(f).Debugf(\"user has access at least one of the provided project SFIDs: %s\", strings.Join(projectSFIDs, \",\"))\n\t\treturn true\n\t}\n\tlog.WithFields(f).Debugf(\"user does not have access any of the provided project SFID: %s\", projectSFIDs)\n\n\tlog.WithFields(f).Debug(\"user doesn't have direct access to the parentProjectSFID or the provided projects SFIDs - loading CLA Group from project id...\")\n\tprojectCLAGroupModel, err := projectClaGroupsRepo.GetClaGroupIDForProject(ctx, parentProjectSFID)\n\tif err != nil {\n\t\tlog.WithFields(f).WithError(err).Warnf(\"problem loading project -> cla group mapping - returning false\")\n\t\treturn false\n\t}\n\tif projectCLAGroupModel == nil {\n\t\tlog.WithFields(f).WithError(err).Warnf(\"problem loading project -> cla group mapping - no mapping found - returning false\")\n\t\treturn false\n\t}\n\n\tf[\"foundationSFID\"] = projectCLAGroupModel.FoundationSFID\n\tlog.WithFields(f).Debug(\"testing if user has access to parent foundation...\")\n\tif utils.IsUserAuthorizedForProjectTree(ctx, authUser, projectCLAGroupModel.FoundationSFID, utils.ALLOW_ADMIN_SCOPE) {\n\t\tlog.WithFields(f).Debug(\"user has access to parent foundation tree...\")\n\t\treturn true\n\t}\n\tif utils.IsUserAuthorizedForProject(ctx, authUser, projectCLAGroupModel.FoundationSFID, utils.ALLOW_ADMIN_SCOPE) {\n\t\tlog.WithFields(f).Debug(\"user has access to parent foundation...\")\n\t\treturn true\n\t}\n\tlog.WithFields(f).Debug(\"user does not have access to parent foundation...\")\n\n\t// Lookup the other project IDs for the CLA Group\n\tlog.WithFields(f).Debug(\"looking up other projects associated with the CLA Group...\")\n\tprojectCLAGroupModels, err := projectClaGroupsRepo.GetProjectsIdsForClaGroup(ctx, projectCLAGroupModel.ClaGroupID)\n\tif err != nil {\n\t\tlog.WithFields(f).WithError(err).Warnf(\"problem loading project cla group mappings by CLA Group ID - returning false\")\n\t\treturn false\n\t}\n\n\tmappedProjectSFIDs := getProjectIDsFromModels(f, projectCLAGroupModel.FoundationSFID, projectCLAGroupModels)\n\tf[\"mappedProjectSFIDs\"] = strings.Join(mappedProjectSFIDs, \",\")\n\tlog.WithFields(f).Debug(\"testing if user has access to any projects\")\n\tif utils.IsUserAuthorizedForAnyProjects(ctx, authUser, mappedProjectSFIDs, utils.ALLOW_ADMIN_SCOPE) {\n\t\tlog.WithFields(f).Debug(\"user has access to at least of of the projects...\")\n\t\treturn true\n\t}\n\n\tlog.WithFields(f).Debug(\"exhausted project checks - user does not have access to project\")\n\treturn false\n}", "title": "" }, { "docid": "b1e4d0e1f4cf16d4ac6bfae85a46ebf9", "score": "0.5026425", "text": "func (_IDisputeCrowdsourcer *IDisputeCrowdsourcerSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _IDisputeCrowdsourcer.Contract.Approve(&_IDisputeCrowdsourcer.TransactOpts, _spender, _value)\n}", "title": "" }, { "docid": "5d37c918d72838bc6215af3405fead7f", "score": "0.502599", "text": "func (_Lobster *LobsterSession) Approve(to common.Address, tokenId *big.Int) (*types.Transaction, error) {\n\treturn _Lobster.Contract.Approve(&_Lobster.TransactOpts, to, tokenId)\n}", "title": "" }, { "docid": "2a7fe01494a686623252fa771cea8212", "score": "0.50211877", "text": "func determineUserCanGrantRolesToOthersInternal(ctx context.Context, bh BackgroundExec, ses *Session, fromRoles []*tree.Role) (bool, error) {\n\t//step1: normalize the names of roles and users\n\tvar err error\n\terr = normalizeNamesOfRoles(ctx, fromRoles)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t//step2: decide the current user\n\taccount := ses.GetTenantInfo()\n\n\t//step3: check the link: roleX -> roleA -> .... -> roleZ -> the current user. Every link has the with_grant_option.\n\tvar vr *verifiedRole\n\tvar ret = true\n\tvar granted bool\n\t//the temporal set of roles during the execution\n\tvar tempRoleSet *btree.Set[int64]\n\tvar sql string\n\t//the set of roles the (k+1) th iteration during the execution\n\troleSetOfKPlusOneThIteration := &btree.Set[int64]{}\n\t//the set of roles the k th iteration during the execution\n\troleSetOfKthIteration := &btree.Set[int64]{}\n\t//the set of roles of the current user that executes this statement or function\n\troleSetOfCurrentUser := &btree.Set[int64]{}\n\t//the set of roles visited by traversal algorithm\n\troleSetOfVisited := &btree.Set[int64]{}\n\tverifiedFromRoles := make([]*verifiedRole, len(fromRoles))\n\n\t//step 1 : add the primary role\n\troleSetOfCurrentUser.Insert(int64(account.GetDefaultRoleID()))\n\n\tfor i, role := range fromRoles {\n\t\tsql, err = getSqlForRoleIdOfRole(ctx, role.UserName)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tvr, err = verifyRoleFunc(ctx, bh, sql, role.UserName, roleType)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif vr == nil {\n\t\t\treturn false, moerr.NewInternalError(ctx, \"there is no role %s\", role.UserName)\n\t\t}\n\t\tverifiedFromRoles[i] = vr\n\t}\n\n\t//step 2: The Set R2 {the roleid granted to the userid}\n\t//If the user uses the all secondary roles, the secondary roles needed to be loaded\n\terr = loadAllSecondaryRoles(ctx, bh, account, roleSetOfCurrentUser)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tfor _, role := range verifiedFromRoles {\n\t\t//if it is the role in use, do the check\n\t\tif roleSetOfCurrentUser.Contains(role.id) {\n\t\t\t//check the direct relation between role and user\n\t\t\tgranted, err = isRoleGrantedToUserWGO(ctx, bh, role.id, int64(account.GetUserID()))\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tif granted {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\troleSetOfKthIteration.Clear()\n\t\troleSetOfVisited.Clear()\n\t\troleSetOfKthIteration.Insert(role.id)\n\n\t\triResult := goOn\n\t\t//It is kind of level traversal\n\t\tfor roleSetOfKthIteration.Len() != 0 && riResult == goOn {\n\t\t\troleSetOfKPlusOneThIteration.Clear()\n\t\t\tfor _, ri := range roleSetOfKthIteration.Keys() {\n\t\t\t\ttempRoleSet, err = getRoleSetThatRoleGrantedToWGO(ctx, bh, ri, roleSetOfVisited, roleSetOfKPlusOneThIteration)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\n\t\t\t\tif setIsIntersected(tempRoleSet, roleSetOfCurrentUser) {\n\t\t\t\t\triResult = successDone\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//swap Rk,R(k+1)\n\t\t\troleSetOfKthIteration, roleSetOfKPlusOneThIteration = roleSetOfKPlusOneThIteration, roleSetOfKthIteration\n\t\t}\n\n\t\tif riResult != successDone {\n\t\t\t//fail\n\t\t\tret = false\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ret, err\n}", "title": "" }, { "docid": "c065994990b7bf8b6650e69edc9ce7ca", "score": "0.5020427", "text": "func CanUserApproveComment(db *database.DB, u *CurrentUser, parentIDs []string) (bool, error) {\n\tvar domainID string\n\trow := database.NewQuery(`\n\t\tSELECT pi.editDomainId\n\t\tFROM pageInfos AS pi\n\t\tWHERE pi.pageId IN`).AddArgsGroupStr(parentIDs).Add(`\n\t\t\tAND pi.type!=?`, CommentPageType).Add(`\n\t\t\tAND`).AddPart(PageInfosFilter(u)).ToStatement(db).QueryRow()\n\texists, err := row.Scan(&domainID)\n\tif err != nil {\n\t\treturn false, err\n\t} else if !exists {\n\t\treturn false, nil\n\t}\n\tif dm, ok := u.DomainMembershipMap[domainID]; !ok {\n\t\treturn false, nil\n\t} else {\n\t\treturn dm.CanApproveComments, nil\n\t}\n}", "title": "" } ]
958a825268f9aff4c43fbe44fcb7329c
writeHeaders writes a block of encoded headers, splitting it into multiple frames if necessary.
[ { "docid": "1b69b2cbc8e4f7db6ba0120f0087b4e8", "score": "0.79243314", "text": "func (w *MuxWriter) writeHeaders(streamID uint32, headers []Header) error {\n\tencodedHeaders, err := w.encodeHeaders(headers)\n\tif err != nil || len(encodedHeaders) == 0 {\n\t\treturn err\n\t}\n\n\tblockSize := int(w.maxFrameSize)\n\t// CONTINUATION is unnecessary; the headers fit within the blockSize\n\tif len(encodedHeaders) < blockSize {\n\t\treturn w.f.WriteHeaders(http2.HeadersFrameParam{\n\t\t\tStreamID: streamID,\n\t\t\tEndHeaders: true,\n\t\t\tBlockFragment: encodedHeaders,\n\t\t})\n\t}\n\n\tchoppedHeaders := chopEncodedHeaders(encodedHeaders, blockSize)\n\t// len(choppedHeaders) is at least 2\n\tif err := w.f.WriteHeaders(http2.HeadersFrameParam{StreamID: streamID, EndHeaders: false, BlockFragment: choppedHeaders[0]}); err != nil {\n\t\treturn err\n\t}\n\tfor i := 1; i < len(choppedHeaders)-1; i++ {\n\t\tif err := w.f.WriteContinuation(streamID, false, choppedHeaders[i]); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := w.f.WriteContinuation(streamID, true, choppedHeaders[len(choppedHeaders)-1]); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "ea3d799a8b832b02cd57907ce45a70b7", "score": "0.6884699", "text": "func (sc *serverConn) writeHeaders(req headerWriteReq, tempCh chan error) {\n\tsc.serveG.checkNotOn() // NOT on\n\tvar errc chan error\n\tif req.h != nil {\n\t\t// If there's a header map (which we don't own), so we have to block on\n\t\t// waiting for this frame to be written, so an http.Flush mid-handler\n\t\t// writes out the correct value of keys, before a handler later potentially\n\t\t// mutates it.\n\t\terrc = tempCh\n\t}\n\tsc.writeFrameFromHandler(frameWriteMsg{\n\t\twrite: (*serverConn).writeHeadersFrame,\n\t\tv: req,\n\t\tstream: req.stream,\n\t\tdone: errc,\n\t\tendStream: req.endStream,\n\t})\n\tif errc != nil {\n\t\tselect {\n\t\tcase <-errc:\n\t\t\t// Ignore. Just for synchronization.\n\t\t\t// Any error will be handled in the writing goroutine.\n\t\tcase <-sc.doneServing:\n\t\t\t// Client has closed the connection.\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ff48693ac52068922b64d295099d3121", "score": "0.6664473", "text": "func (s *serverStream) writeHeader() {\n\tif len(s.header) == 0 {\n\t\treturn\n\t}\n\n\t// Create the HEADERS frame.\n\theader := new(headersFrame)\n\theader.StreamID = s.streamID\n\theader.Header = cloneHeader(s.header)\n\n\t// Clear the headers that have been sent.\n\tfor name := range header.Header {\n\t\ts.header.Del(name)\n\t}\n\n\ts.output <- header\n}", "title": "" }, { "docid": "ed77c1d2ff2cd56b93a7e98a017923fd", "score": "0.6336949", "text": "func (e *CsvFrameExporter) WriteHeaders() error {\n\tvar headers []string\n\tfor _, f := range e.frameDef.FieldsI {\n\t\theaders = append(headers, fieldWithUnit(f.Name))\n\t}\n\tif e.hasAmperageAdc {\n\t\theaders = append(headers, fieldWithUnit(blackbox.FieldEnergyCumulative))\n\t}\n\tfor _, f := range e.frameDef.FieldsS {\n\t\theaders = append(headers, fieldWithUnit(f.Name))\n\t}\n\treturn e.writeLn(strings.Join(headers, \", \"))\n}", "title": "" }, { "docid": "17eb815b512a3f41f6d471d829ea992e", "score": "0.6236962", "text": "func (ht *serverHandlerTransport) writeCommonHeaders(s *Stream) {\n\th := ht.rw.Header()\n\th[\"Date\"] = nil // suppress Date to make tests happy; TODO: restore\n\th.Set(\"Content-Type\", ht.contentType)\n\n\t// Predeclare trailers we'll set later in WriteStatus (after the body).\n\t// This is a SHOULD in the HTTP RFC, and the way you add (known)\n\t// Trailers per the net/http.ResponseWriter contract.\n\t// See https://golang.org/pkg/net/http/#ResponseWriter\n\t// and https://golang.org/pkg/net/http/#example_ResponseWriter_trailers\n\th.Add(\"Trailer\", \"Grpc-Status\")\n\th.Add(\"Trailer\", \"Grpc-Message\")\n\th.Add(\"Trailer\", \"Grpc-Status-Details-Bin\")\n\n\tif s.sendCompress != \"\" {\n\t\th.Set(\"Grpc-Encoding\", s.sendCompress)\n\t}\n}", "title": "" }, { "docid": "bf547ad4de91915de13aa43911be80ee", "score": "0.6130486", "text": "func (bw *blockWriter) writeHeader(w io.Writer) error {\n\th := blockHeader{\n\t\tcompressedSize: -1,\n\t\tuncompressedSize: -1,\n\t\tfilters: bw.filters,\n\t}\n\tif bw.closed {\n\t\th.compressedSize = bw.compressedSize()\n\t\th.uncompressedSize = bw.uncompressedSize()\n\t}\n\tdata, err := h.MarshalBinary()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err = w.Write(data); err != nil {\n\t\treturn err\n\t}\n\tbw.headerLen = len(data)\n\treturn nil\n}", "title": "" }, { "docid": "b8246164ebb1593c2b0a5dc860f345af", "score": "0.60724", "text": "func (ht *serverHandlerTransport) writeCustomHeaders(s *Stream) {\n\th := ht.rw.Header()\n\n\ts.hdrMu.Lock()\n\tfor k, vv := range s.header {\n\t\tif isReservedHeader(k) {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, v := range vv {\n\t\t\th.Add(k, encodeMetadataHeader(k, v))\n\t\t}\n\t}\n\n\ts.hdrMu.Unlock()\n}", "title": "" }, { "docid": "73dd28d04aa89ca7c8e864857c49e0a7", "score": "0.59737575", "text": "func encodeBlockHeader(bw *bitio.Writer, hdr *meta.Header) error {\n\t// 1 bit: IsLast.\n\tif err := bw.WriteBool(hdr.IsLast); err != nil {\n\t\treturn errutil.Err(err)\n\t}\n\t// 7 bits: Type.\n\tif err := bw.WriteBits(uint64(hdr.Type), 7); err != nil {\n\t\treturn errutil.Err(err)\n\t}\n\t// 24 bits: Length.\n\tif err := bw.WriteBits(uint64(hdr.Length), 24); err != nil {\n\t\treturn errutil.Err(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "961efbe123bcabf2aa600b67b4e87390", "score": "0.5918494", "text": "func writeHeader(b []byte, h header) []byte {\n\tif b == nil {\n\t\tb = makeWriteHeaderBuf()\n\t}\n\n\tb = b[:2]\n\tb[0] = 0\n\n\tif h.fin {\n\t\tb[0] |= 1 << 7\n\t}\n\tif h.rsv1 {\n\t\tb[0] |= 1 << 6\n\t}\n\tif h.rsv2 {\n\t\tb[0] |= 1 << 5\n\t}\n\tif h.rsv3 {\n\t\tb[0] |= 1 << 4\n\t}\n\n\tb[0] |= byte(h.opcode)\n\n\tswitch {\n\tcase h.payloadLength < 0:\n\t\tpanic(fmt.Sprintf(\"websocket: invalid header: negative length: %v\", h.payloadLength))\n\tcase h.payloadLength <= 125:\n\t\tb[1] = byte(h.payloadLength)\n\tcase h.payloadLength <= math.MaxUint16:\n\t\tb[1] = 126\n\t\tb = b[:len(b)+2]\n\t\tbinary.BigEndian.PutUint16(b[len(b)-2:], uint16(h.payloadLength))\n\tdefault:\n\t\tb[1] = 127\n\t\tb = b[:len(b)+8]\n\t\tbinary.BigEndian.PutUint64(b[len(b)-8:], uint64(h.payloadLength))\n\t}\n\n\tif h.masked {\n\t\tb[1] |= 1 << 7\n\t\tb = b[:len(b)+4]\n\t\tcopy(b[len(b)-4:], h.maskKey[:])\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "bd92d041f817dd35794a4661106faf4c", "score": "0.59001625", "text": "func (fil *FileInfoList) WriteHeaders(log logrus.FieldLogger, out io.Writer) (err error) {\n\n\tlog.Debug(\"writing file headers\")\n\tfor _, pair := range fil.FileList {\n\n\t\t// write path length\n\t\terr = binary.Write(out, binary.LittleEndian, pair.Info.ResPathSize)\n\t\tif !utils.CheckErrorWrite(log, err) {\n\t\t\treturn\n\t\t}\n\n\t\t// write filepath\n\t\terr = binary.Write(out, binary.LittleEndian, []byte(pair.Info.ResPath))\n\t\tif !utils.CheckErrorWrite(log, err) {\n\t\t\treturn\n\t\t}\n\n\t\t// write fileinfo\n\t\terr = pair.InfoBytes.Write(out)\n\t\tif !utils.CheckErrorWrite(log, err) {\n\t\t\treturn\n\t\t}\n\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "90493c6383631386127a4215271f2b9c", "score": "0.5861762", "text": "func (ht *serverHandlerTransport) writePendingHeaders(s *Stream) {\n\tht.writeCommonHeaders(s)\n\tht.writeCustomHeaders(s)\n}", "title": "" }, { "docid": "79ee814328a0b77cb6756ab22e7742e4", "score": "0.5743086", "text": "func (w *FrameWriter) WriteHeader(t FrameType, flags FrameFlags, length uint32, streamID uint32) error {\n\tw.buf[0] = byte(streamID >> 24)\n\tw.buf[1] = byte(streamID >> 16)\n\tw.buf[2] = byte(streamID >> 8)\n\tw.buf[3] = byte(streamID)\n\tw.buf[4] = byte(length >> 16)\n\tw.buf[5] = byte(length >> 8)\n\tw.buf[6] = byte(length)\n\tw.buf[7] = byte(flags)\n\tw.buf[8] = byte(t)\n\t_, err := w.Write(w.buf[:])\n\treturn err\n}", "title": "" }, { "docid": "2879f702f3b09503533a401f5bad0a86", "score": "0.56973374", "text": "func (p *Part) encodeHeader(b *bufio.Writer) error {\n\tkeys := make([]string, 0, len(p.Header))\n\tfor k := range p.Header {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\tfor _, k := range keys {\n\t\tfor _, v := range p.Header[k] {\n\t\t\tencv := v\n\t\t\tswitch selectTransferEncoding([]byte(v), true) {\n\t\t\tcase teBase64:\n\t\t\t\tencv = mime.BEncoding.Encode(utf8, v)\n\t\t\tcase teQuoted:\n\t\t\t\tencv = mime.QEncoding.Encode(utf8, v)\n\t\t\t}\n\t\t\t// _ used to prevent early wrapping\n\t\t\twb := stringutil.Wrap(76, k, \":_\", encv, \"\\r\\n\")\n\t\t\twb[len(k)+1] = ' '\n\t\t\tif _, err := b.Write(wb); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "58785fa51058fe1db03d04c9a5506184", "score": "0.56754196", "text": "func (msg *MsgHeaders) BtcEncode(w io.Writer, pver uint32) error {\n\tconst op = \"MsgHeaders.BtcEncode\"\n\n\t// Limit to max block headers per message.\n\tcount := len(msg.Headers)\n\tif count > MaxBlockHeadersPerMsg {\n\t\tmsg := fmt.Sprintf(\"too many block headers for message \"+\n\t\t\t\"[count %v, max %v]\", count, MaxBlockHeadersPerMsg)\n\t\treturn messageError(op, ErrTooManyHeaders, msg)\n\t}\n\n\terr := WriteVarInt(w, pver, uint64(count))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, bh := range msg.Headers {\n\t\terr := writeBlockHeader(w, pver, bh)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// The wire protocol encoding always includes a 0 for the number\n\t\t// of transactions on header messages. This is really just an\n\t\t// artifact of the way the original implementation serializes\n\t\t// block headers, but it is required.\n\t\terr = WriteVarInt(w, pver, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "09593f3aad20d20aefea2076fb74c4c7", "score": "0.56516623", "text": "func (w *Writer3) WriteHeader() error {\n\tif w.HeaderWritten {\n\t\treturn errors.New(\"header already written\")\n\t}\n\th := Header{Frameperiod: w.Timebase, Format: \"LJH3\", FormatVersion: \"3.0.0\",\n\t\tTDM: HeaderTDM{NumberOfRows: w.NumberOfRows, NumberOfColumns: w.NumberOfColumns,\n\t\t\tRow: w.Row, Column: w.Column}}\n\ts, err := json.MarshalIndent(h, \"\", \" \")\n\tif err != nil {\n\t\tpanic(\"MarshallIndent error\")\n\t}\n\n\tif _, err := w.writer.Write(s); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := w.writer.WriteString(\"\\n\"); err != nil {\n\t\treturn err\n\t}\n\tw.HeaderWritten = true\n\treturn nil\n}", "title": "" }, { "docid": "722d4df5624270c4cbdbb73bc1b1ede4", "score": "0.5637388", "text": "func (sc *serverConn) write100ContinueHeaders(st *stream) {\n\tsc.serveG.checkNotOn() // NOT\n\tsc.writeFrameFromHandler(frameWriteMsg{\n\t\twrite: (*serverConn).write100ContinueHeadersFrame,\n\t\tstream: st,\n\t})\n}", "title": "" }, { "docid": "8dcb531b00a3d06ad633d1292fb48ba7", "score": "0.5572704", "text": "func WriteHeader(w io.Writer, h Header) error {\n\tfor i := len(h.l) - 1; i >= 0; i-- {\n\t\tf := h.l[i]\n\t\tif rawField, err := f.raw(); err == nil {\n\t\t\tif _, err := w.Write(rawField); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"failed to write header field #%v (%q): %w\", len(h.l)-i, f.k, err)\n\t\t}\n\t}\n\n\t_, err := w.Write([]byte{'\\r', '\\n'})\n\treturn err\n}", "title": "" }, { "docid": "034dee1ad69e682622c45cfb9ebd0694", "score": "0.5567901", "text": "func (w *requestWriter) encodeHeaders(req *http.Request, addGzipHeader bool, trailers string, contentLength int64, dumps []*dump.Dumper) error {\n\thost := req.Host\n\tif host == \"\" {\n\t\thost = req.URL.Host\n\t}\n\thost, err := httpguts.PunycodeHostPort(host)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !httpguts.ValidHostHeader(host) {\n\t\treturn errors.New(\"http3: invalid Host header\")\n\t}\n\n\t// http.NewRequest sets this field to HTTP/1.1\n\tisExtendedConnect := req.Method == http.MethodConnect && req.Proto != \"\" && req.Proto != \"HTTP/1.1\"\n\n\tvar path string\n\tif req.Method != http.MethodConnect || isExtendedConnect {\n\t\tpath = req.URL.RequestURI()\n\t\tif !validPseudoPath(path) {\n\t\t\torig := path\n\t\t\tpath = strings.TrimPrefix(path, req.URL.Scheme+\"://\"+host)\n\t\t\tif !validPseudoPath(path) {\n\t\t\t\tif req.URL.Opaque != \"\" {\n\t\t\t\t\treturn fmt.Errorf(\"invalid request :path %q from URL.Opaque = %q\", orig, req.URL.Opaque)\n\t\t\t\t} else {\n\t\t\t\t\treturn fmt.Errorf(\"invalid request :path %q\", orig)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check for any invalid headers and return an error before we\n\t// potentially pollute our hpack state. (We want to be able to\n\t// continue to reuse the hpack encoder for future requests)\n\tfor k, vv := range req.Header {\n\t\tif !httpguts.ValidHeaderFieldName(k) {\n\t\t\treturn fmt.Errorf(\"invalid HTTP header name %q\", k)\n\t\t}\n\t\tfor _, v := range vv {\n\t\t\tif !httpguts.ValidHeaderFieldValue(v) {\n\t\t\t\treturn fmt.Errorf(\"invalid HTTP header value %q for header %q\", v, k)\n\t\t\t}\n\t\t}\n\t}\n\n\tenumerateHeaders := func(f func(name, value string)) {\n\t\tvar writeHeader func(name string, value ...string)\n\t\tvar kvs []header.KeyValues\n\t\tsort := false\n\t\tif req.Header != nil && len(req.Header[header.PseudoHeaderOderKey]) > 0 {\n\t\t\twriteHeader = func(name string, value ...string) {\n\t\t\t\tkvs = append(kvs, header.KeyValues{\n\t\t\t\t\tKey: name,\n\t\t\t\t\tValues: value,\n\t\t\t\t})\n\t\t\t}\n\t\t\tsort = true\n\t\t} else {\n\t\t\twriteHeader = func(name string, value ...string) {\n\t\t\t\tfor _, v := range value {\n\t\t\t\t\tf(name, v)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// 8.1.2.3 Request Pseudo-Header Fields\n\t\t// The :path pseudo-header field includes the path and query parts of the\n\t\t// target URI (the path-absolute production and optionally a '?' character\n\t\t// followed by the query production (see Sections 3.3 and 3.4 of\n\t\t// [RFC3986]).\n\t\twriteHeader(\":authority\", host)\n\t\twriteHeader(\":method\", req.Method)\n\t\tif req.Method != http.MethodConnect || isExtendedConnect {\n\t\t\twriteHeader(\":path\", path)\n\t\t\twriteHeader(\":scheme\", req.URL.Scheme)\n\t\t}\n\t\tif isExtendedConnect {\n\t\t\twriteHeader(\":protocol\", req.Proto)\n\t\t}\n\n\t\tif sort {\n\t\t\theader.SortKeyValues(kvs, req.Header[header.PseudoHeaderOderKey])\n\t\t\tfor _, kv := range kvs {\n\t\t\t\tfor _, v := range kv.Values {\n\t\t\t\t\tf(kv.Key, v)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif req.Header != nil && len(req.Header[header.HeaderOderKey]) > 0 {\n\t\t\tsort = true\n\t\t\tkvs = nil\n\t\t\twriteHeader = func(name string, value ...string) {\n\t\t\t\tkvs = append(kvs, header.KeyValues{\n\t\t\t\t\tKey: name,\n\t\t\t\t\tValues: value,\n\t\t\t\t})\n\t\t\t}\n\t\t} else {\n\t\t\tsort = false\n\t\t\twriteHeader = func(name string, value ...string) {\n\t\t\t\tfor _, v := range value {\n\t\t\t\t\tf(name, v)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif trailers != \"\" {\n\t\t\twriteHeader(\"trailer\", trailers)\n\t\t}\n\n\t\tvar didUA bool\n\t\tfor k, vv := range req.Header {\n\t\t\tif header.IsExcluded(k) {\n\t\t\t\tcontinue\n\t\t\t} else if strings.EqualFold(k, \"user-agent\") {\n\t\t\t\t// Match Go's http1 behavior: at most one\n\t\t\t\t// User-Agent. If set to nil or empty string,\n\t\t\t\t// then omit it. Otherwise if not mentioned,\n\t\t\t\t// include the default (below).\n\t\t\t\tdidUA = true\n\t\t\t\tif len(vv) < 1 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tvv = vv[:1]\n\t\t\t\tif vv[0] == \"\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfor _, v := range vv {\n\t\t\t\twriteHeader(k, v)\n\t\t\t}\n\t\t}\n\t\tif shouldSendReqContentLength(req.Method, contentLength) {\n\t\t\twriteHeader(\"content-length\", strconv.FormatInt(contentLength, 10))\n\t\t}\n\t\tif addGzipHeader {\n\t\t\twriteHeader(\"accept-encoding\", \"gzip\")\n\t\t}\n\t\tif !didUA {\n\t\t\twriteHeader(\"user-agent\", header.DefaultUserAgent)\n\t\t}\n\n\t\tif sort {\n\t\t\theader.SortKeyValues(kvs, req.Header[header.HeaderOderKey])\n\t\t\tfor _, kv := range kvs {\n\t\t\t\tfor _, v := range kv.Values {\n\t\t\t\t\tf(kv.Key, v)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Do a first pass over the headers counting bytes to ensure\n\t// we don't exceed cc.peerMaxHeaderListSize. This is done as a\n\t// separate pass before encoding the headers to prevent\n\t// modifying the hpack state.\n\thlSize := uint64(0)\n\tenumerateHeaders(func(name, value string) {\n\t\thf := hpack.HeaderField{Name: name, Value: value}\n\t\thlSize += uint64(hf.Size())\n\t})\n\n\t// TODO: check maximum header list size\n\t// if hlSize > cc.peerMaxHeaderListSize {\n\t// \treturn errRequestHeaderListSize\n\t// }\n\n\ttrace := httptrace.ContextClientTrace(req.Context())\n\ttraceHeaders := traceHasWroteHeaderField(trace)\n\n\t// Header list size is ok. Write the headers.\n\tenumerateHeaders(func(name, value string) {\n\t\tname = strings.ToLower(name)\n\t\tfor _, dump := range dumps {\n\t\t\tdump.DumpRequestHeader([]byte(fmt.Sprintf(\"%s: %s\\r\\n\", name, value)))\n\t\t}\n\t\tw.encoder.WriteField(qpack.HeaderField{Name: name, Value: value})\n\t\tif traceHeaders {\n\t\t\ttrace.WroteHeaderField(name, []string{value})\n\t\t}\n\t})\n\n\tfor _, dump := range dumps {\n\t\tdump.DumpRequestHeader([]byte(\"\\r\\n\"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9a3a317a6f7612f832aeaa8b2ee68a7f", "score": "0.5544227", "text": "func writeHeader(w io.Writer, h textproto.MIMEHeader) {\n\tvar keys = make([]string, 0, len(h))\n\tfor k := range h {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\tfor _, k := range keys {\n\t\tfor _, v := range h[k] {\n\t\t\tfmt.Fprintf(w, \"%s: %s\\r\\n\", k, v)\n\t\t}\n\t}\n\tfmt.Fprintf(w, \"\\r\\n\") // add the offset from the header\n}", "title": "" }, { "docid": "4f1ed95045e1e7ef9108106b9e157eae", "score": "0.5527486", "text": "func (w *Writer) writeHeader(action uint32) {\n\tbinary.Write(w.buf, binary.BigEndian, action)\n\tw.buf.Write(w.transactionID)\n}", "title": "" }, { "docid": "0cbdd3cf8866509e28a4b4e300018344", "score": "0.552341", "text": "func (p *logPolicy) writeHeader(b *bytes.Buffer, header http.Header) {\n\tif len(header) == 0 {\n\t\tb.WriteString(\" (no headers)\\n\")\n\t\treturn\n\t}\n\tkeys := make([]string, 0, len(header))\n\t// Alphabetize the headers\n\tfor k := range header {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\tfor _, k := range keys {\n\t\tvalue := header.Get(k)\n\t\t// sanitize or redact certain headers\n\t\t// redact all header values in the disallow-list\n\t\tif _, ok := p.disallowedHeaders[strings.ToLower(k)]; ok {\n\t\t\tvalue = redactedValue\n\t\t} else if _, ok := p.sanitizedUrlHeaders[strings.ToLower(k)]; ok {\n\t\t\tu, err := url.Parse(value)\n\t\t\tif err == nil {\n\t\t\t\trawQuery := u.RawQuery\n\t\t\t\tsigRedacted, rawQuery := common.RedactSecretQueryParam(rawQuery, common.SigAzure)\n\t\t\t\txAmzSignatureRedacted, rawQuery := common.RedactSecretQueryParam(rawQuery, common.SigXAmzForAws)\n\n\t\t\t\tif sigRedacted || xAmzSignatureRedacted {\n\t\t\t\t\tu.RawQuery = rawQuery\n\t\t\t\t}\n\t\t\t\tvalue = u.String()\n\t\t\t}\n\t\t}\n\t\tfmt.Fprintf(b, \" %s: %+v\\n\", k, value)\n\t}\n}", "title": "" }, { "docid": "028e656dbafa5071e7dea257f163a55f", "score": "0.55196154", "text": "func writeMIMEHeader(wr io.Writer, hdr textproto.MIMEHeader) (err error) {\n // write headers\n for k, vals := range(hdr) {\n for _, val := range(vals) {\n _, err = io.WriteString(wr, fmt.Sprintf(\"%s: %s\\n\", k, val))\n }\n }\n // end of headers\n _, err = io.WriteString(wr, \"\\n\")\n return\n}", "title": "" }, { "docid": "51b40235f58a984f78c4c846e496698e", "score": "0.54713064", "text": "func WriteHeader(db lvldb.Putter, header *protocol.Header) error {\n\tdata, err := rlp.EncodeToBytes(header)\n\tif err != nil {\n\t\treturn err\n\t}\n\thash := header.Hash().Bytes()\n\tnum := header.Number.Uint64()\n\tencNum := encodeBlockNumber(num)\n\tkey := append(blockHashPrefix, hash...)\n\tif err := db.Put(key, encNum); err != nil {\n\t\tlog.Crit(\"Failed to store hash to number mapping\", \"err\", err)\n\t}\n\tkey = append(append(headerPrefix, encNum...), hash...)\n\tif err := db.Put(key, data); err != nil {\n\t\tlog.Crit(\"Failed to store header\", \"err\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "35a97a12fa2bd308d55844512a7db9ca", "score": "0.5441188", "text": "func (h *Header) writeHeader(b *bytes.Buffer) error {\n\tif h.IsLongHeader {\n\t\treturn h.writeLongHeader(b)\n\t}\n\treturn h.writeShortHeader(b)\n}", "title": "" }, { "docid": "087d4fa94d18cc1ebbdf66b17ff3908d", "score": "0.540611", "text": "func (s *Stats) WriteHeader(w io.Writer) {\n\ts.Lock()\n\tdefer s.Unlock()\n\t// write static fields\n\tvar fields []string\n\tfor _, k := range s.staticKeys {\n\t\t// verify if we wellhave a value for it\n\t\tif _, ok := s.static[k]; ok {\n\t\t\tfields = append(fields, k)\n\t\t}\n\t}\n\t// Write the values header\n\tfor _, k := range s.keys {\n\t\tv := s.values[k]\n\t\tfields = append(fields, v.HeaderFields()...)\n\t}\n\tfmt.Fprintf(w, \"%s\", strings.Join(fields, \",\"))\n\tfmt.Fprintf(w, \"\\n\")\n}", "title": "" }, { "docid": "72bfd91556b7d1fa051c21460c6f0c9b", "score": "0.5362612", "text": "func SetHeaders(headers map[string]string) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tctx, span := trace.StartSpan(r.Context(), \"middleware.SetHeaders\")\n\t\t\tdefer span.End()\n\t\t\tfor key, val := range headers {\n\t\t\t\tw.Header().Set(key, val)\n\t\t\t}\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "c0f6b9024d4ac2bb910198137a8ae03b", "score": "0.5356651", "text": "func (t *Table) WriteHeaders() error {\n\theaders := make([]interface{}, len(t.columns))\n\tfor i, column := range t.columns {\n\t\theaders[i] = column.header\n\t}\n\treturn t.WriteColumns(headers)\n}", "title": "" }, { "docid": "3c1ccddcb5528d4867d278a4a276d494", "score": "0.5314931", "text": "func (w *mossResponseWriter) Flush() {\n\thdr := w.w.Header()\n\tfor k, vs := range w.headers {\n\t\thdr[k] = vs\n\t}\n}", "title": "" }, { "docid": "6bae37994f95b668eeaec405609d563d", "score": "0.53144985", "text": "func HeadersHandler(w http.ResponseWriter, r *http.Request) {\n\tvar resp helpers.Response\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Headers = &r.Header\n\n\tdata := helpers.MarshalResponseToString(resp)\n\t_, err := io.WriteString(w, data)\n\tif err != nil {\n\t\tlog.Fatal(\"error writing to ResponseWriter: \", err)\n\t}\n}", "title": "" }, { "docid": "db7d687437655a036eb15571316c527c", "score": "0.5314193", "text": "func (w *Writer) WriteBlockHeader(l, s int64) {\n\tif s > 0 && !w.cfg.config.DisableBlockSizeHeader {\n\t\tw.WriteLong(-l)\n\t\tw.WriteLong(s)\n\t\treturn\n\t}\n\tw.WriteLong(l)\n}", "title": "" }, { "docid": "64db6e8cb4c25801c46fc196daa5e047", "score": "0.5301783", "text": "func (sr *Recorder) WriteHeader(statusCode int) {\n\tif sr.status == 0 {\n\t\tsr.status = statusCode\n\t}\n\tsr.rw.WriteHeader(statusCode)\n}", "title": "" }, { "docid": "f7f6e41d5787e6e8b6a6ba496abbbf8f", "score": "0.53015965", "text": "func setHeaders(ctx *gin.Context, headers map[string]string) {\n\tfor key, val := range headers {\n\t\tctx.Header(key, val)\n\t}\n}", "title": "" }, { "docid": "b2e96199367d0cd3975e170a08ed345a", "score": "0.5270145", "text": "func (f *Frame) writeFrame(w *bufio.Writer, l string) error {\n\t// Write the frame Command\n\tif _, e := w.WriteString(f.Command + \"\\n\"); e != nil {\n\t\treturn e\n\t}\n\t// Content length - Always add it if client does not suppress it and\n\t// does not supply it.\n\tif _, ok := f.Headers.Contains(\"suppress-content-length\"); !ok {\n\t\tif _, clok := f.Headers.Contains(\"content-length\"); !clok {\n\t\t\tf.Headers = append(f.Headers, \"content-length\", strconv.Itoa(len(f.Body)))\n\t\t}\n\t}\n\t// Write the frame Headers\n\tfor i := 0; i < len(f.Headers); i += 2 {\n\t\tif l > SPL_10 && f.Command != CONNECT {\n\t\t\tf.Headers[i] = encode(f.Headers[i])\n\t\t\tf.Headers[i+1] = encode(f.Headers[i+1])\n\t\t}\n\t\t_, e := w.WriteString(f.Headers[i] + \":\" + f.Headers[i+1] + \"\\n\")\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t}\n\t// Write the last Header LF\n\tif e := w.WriteByte('\\n'); e != nil {\n\t\treturn e\n\t}\n\t// Write the body\n\tif len(f.Body) != 0 { // Foolish to write 0 length data\n\t\tif _, e := w.Write(f.Body); e != nil {\n\t\t\treturn e\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "765f22ac3e59b5d43bc6b209a599e4d2", "score": "0.52661073", "text": "func SerializeHeaders(h1Headers http.Header) string {\n\t// compute size of the fully serialized value and largest temp buffer we will need\n\tserializedLen := 0\n\tmaxTempLen := 0\n\tfor headerName, headerValues := range h1Headers {\n\t\tfor _, headerValue := range headerValues {\n\t\t\tnameLen := headerEncoding.EncodedLen(len(headerName))\n\t\t\tvalueLen := headerEncoding.EncodedLen(len(headerValue))\n\t\t\tconst delims = 2\n\t\t\tserializedLen += delims + nameLen + valueLen\n\t\t\tif nameLen > maxTempLen {\n\t\t\t\tmaxTempLen = nameLen\n\t\t\t}\n\t\t\tif valueLen > maxTempLen {\n\t\t\t\tmaxTempLen = valueLen\n\t\t\t}\n\t\t}\n\t}\n\tvar buf strings.Builder\n\tbuf.Grow(serializedLen)\n\n\ttemp := make([]byte, maxTempLen)\n\twriteB64 := func(s string) {\n\t\tn := headerEncoding.EncodedLen(len(s))\n\t\tif n > len(temp) {\n\t\t\ttemp = make([]byte, n)\n\t\t}\n\t\theaderEncoding.Encode(temp[:n], []byte(s))\n\t\tbuf.Write(temp[:n])\n\t}\n\n\tfor headerName, headerValues := range h1Headers {\n\t\tfor _, headerValue := range headerValues {\n\t\t\tif buf.Len() > 0 {\n\t\t\t\tbuf.WriteByte(';')\n\t\t\t}\n\t\t\twriteB64(headerName)\n\t\t\tbuf.WriteByte(':')\n\t\t\twriteB64(headerValue)\n\t\t}\n\t}\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "eae3a230d6a1da3bdf38e72b0281c97c", "score": "0.5250317", "text": "func (options *CreateLogicalReplicationSlotOptions) SetHeaders(param map[string]string) *CreateLogicalReplicationSlotOptions {\n\toptions.Headers = param\n\treturn options\n}", "title": "" }, { "docid": "d5d337642969586ba6fe9ef4f4ce34b5", "score": "0.52483904", "text": "func WriterWriteHeader(tw *tar.Writer, hdr *tar.Header,) error", "title": "" }, { "docid": "ad481a8e4ace5eb2c804f60d777da1e7", "score": "0.52459913", "text": "func SetHeaders(securityHeaders map[string]string) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tctx, span := trace.StartSpan(r.Context(), \"middleware.SetHeaders\")\n\t\t\tdefer span.End()\n\t\t\tfor key, val := range securityHeaders {\n\t\t\t\tw.Header().Set(key, val)\n\t\t\t}\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "60d93e4c1b5249b26c265f84027ebc33", "score": "0.5231731", "text": "func (c *requestContext) Write(w http.ResponseWriter) {\n\tc.RLock()\n\tdefer c.RUnlock()\n\n\theaders := w.Header()\n\tfor h, v := range c.headers {\n\t\theaders[h] = v\n\t}\n}", "title": "" }, { "docid": "4d0b07068c0aabedb3ded70f2bccd3f3", "score": "0.52133864", "text": "func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error {\n\ts.hdrMu.Lock()\n\tdefer s.hdrMu.Unlock()\n\tif s.getState() == streamDone {\n\t\treturn t.streamContextErr(s)\n\t}\n\n\tif s.updateHeaderSent() {\n\t\treturn ErrIllegalHeaderWrite\n\t}\n\n\tif md.Len() > 0 {\n\t\tif s.header.Len() > 0 {\n\t\t\ts.header = metadata.Join(s.header, md)\n\t\t} else {\n\t\t\ts.header = md\n\t\t}\n\t}\n\tif err := t.writeHeaderLocked(s); err != nil {\n\t\treturn status.Convert(err).Err()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed9878d509d80a2d0a0c67873f626665", "score": "0.520161", "text": "func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) error {\n\t// Acquire max stream ID lock for entire duration\n\tt.maxStreamMu.Lock()\n\tdefer t.maxStreamMu.Unlock()\n\n\tstreamID := frame.Header().StreamID\n\n\t// frame.Truncated is set to true when framer detects that the current header\n\t// list size hits MaxHeaderListSize limit.\n\tif frame.Truncated {\n\t\tt.controlBuf.put(&cleanupStream{\n\t\t\tstreamID: streamID,\n\t\t\trst: true,\n\t\t\trstCode: http2.ErrCodeFrameSize,\n\t\t\tonWrite: func() {},\n\t\t})\n\t\treturn nil\n\t}\n\n\tif streamID%2 != 1 || streamID <= t.maxStreamID {\n\t\t// illegal gRPC stream id.\n\t\treturn fmt.Errorf(\"received an illegal stream id: %v. headers frame: %+v\", streamID, frame)\n\t}\n\tt.maxStreamID = streamID\n\n\tbuf := newRecvBuffer()\n\ts := &Stream{\n\t\tid: streamID,\n\t\tst: t,\n\t\tbuf: buf,\n\t\tfc: &inFlow{limit: uint32(t.initialWindowSize)},\n\t}\n\tvar (\n\t\t// if false, content-type was missing or invalid\n\t\tisGRPC = false\n\t\tcontentType = \"\"\n\t\tmdata = make(metadata.MD, len(frame.Fields))\n\t\thttpMethod string\n\t\t// these are set if an error is encountered while parsing the headers\n\t\tprotocolError bool\n\t\theaderError *status.Status\n\n\t\ttimeoutSet bool\n\t\ttimeout time.Duration\n\t)\n\n\tfor _, hf := range frame.Fields {\n\t\tswitch hf.Name {\n\t\tcase \"content-type\":\n\t\t\tcontentSubtype, validContentType := grpcutil.ContentSubtype(hf.Value)\n\t\t\tif !validContentType {\n\t\t\t\tcontentType = hf.Value\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tmdata[hf.Name] = append(mdata[hf.Name], hf.Value)\n\t\t\ts.contentSubtype = contentSubtype\n\t\t\tisGRPC = true\n\n\t\tcase \"grpc-accept-encoding\":\n\t\t\tmdata[hf.Name] = append(mdata[hf.Name], hf.Value)\n\t\t\tif hf.Value == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcompressors := hf.Value\n\t\t\tif s.clientAdvertisedCompressors != \"\" {\n\t\t\t\tcompressors = s.clientAdvertisedCompressors + \",\" + compressors\n\t\t\t}\n\t\t\ts.clientAdvertisedCompressors = compressors\n\t\tcase \"grpc-encoding\":\n\t\t\ts.recvCompress = hf.Value\n\t\tcase \":method\":\n\t\t\thttpMethod = hf.Value\n\t\tcase \":path\":\n\t\t\ts.method = hf.Value\n\t\tcase \"grpc-timeout\":\n\t\t\ttimeoutSet = true\n\t\t\tvar err error\n\t\t\tif timeout, err = decodeTimeout(hf.Value); err != nil {\n\t\t\t\theaderError = status.Newf(codes.Internal, \"malformed grpc-timeout: %v\", err)\n\t\t\t}\n\t\t// \"Transports must consider requests containing the Connection header\n\t\t// as malformed.\" - A41\n\t\tcase \"connection\":\n\t\t\tif logger.V(logLevel) {\n\t\t\t\tlogger.Errorf(\"transport: http2Server.operateHeaders parsed a :connection header which makes a request malformed as per the HTTP/2 spec\")\n\t\t\t}\n\t\t\tprotocolError = true\n\t\tdefault:\n\t\t\tif isReservedHeader(hf.Name) && !isWhitelistedHeader(hf.Name) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tv, err := decodeMetadataHeader(hf.Name, hf.Value)\n\t\t\tif err != nil {\n\t\t\t\theaderError = status.Newf(codes.Internal, \"malformed binary metadata %q in header %q: %v\", hf.Value, hf.Name, err)\n\t\t\t\tlogger.Warningf(\"Failed to decode metadata header (%q, %q): %v\", hf.Name, hf.Value, err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tmdata[hf.Name] = append(mdata[hf.Name], v)\n\t\t}\n\t}\n\n\t// \"If multiple Host headers or multiple :authority headers are present, the\n\t// request must be rejected with an HTTP status code 400 as required by Host\n\t// validation in RFC 7230 §5.4, gRPC status code INTERNAL, or RST_STREAM\n\t// with HTTP/2 error code PROTOCOL_ERROR.\" - A41. Since this is a HTTP/2\n\t// error, this takes precedence over a client not speaking gRPC.\n\tif len(mdata[\":authority\"]) > 1 || len(mdata[\"host\"]) > 1 {\n\t\terrMsg := fmt.Sprintf(\"num values of :authority: %v, num values of host: %v, both must only have 1 value as per HTTP/2 spec\", len(mdata[\":authority\"]), len(mdata[\"host\"]))\n\t\tif logger.V(logLevel) {\n\t\t\tlogger.Errorf(\"transport: %v\", errMsg)\n\t\t}\n\t\tt.controlBuf.put(&earlyAbortStream{\n\t\t\thttpStatus: http.StatusBadRequest,\n\t\t\tstreamID: streamID,\n\t\t\tcontentSubtype: s.contentSubtype,\n\t\t\tstatus: status.New(codes.Internal, errMsg),\n\t\t\trst: !frame.StreamEnded(),\n\t\t})\n\t\treturn nil\n\t}\n\n\tif protocolError {\n\t\tt.controlBuf.put(&cleanupStream{\n\t\t\tstreamID: streamID,\n\t\t\trst: true,\n\t\t\trstCode: http2.ErrCodeProtocol,\n\t\t\tonWrite: func() {},\n\t\t})\n\t\treturn nil\n\t}\n\tif !isGRPC {\n\t\tt.controlBuf.put(&earlyAbortStream{\n\t\t\thttpStatus: http.StatusUnsupportedMediaType,\n\t\t\tstreamID: streamID,\n\t\t\tcontentSubtype: s.contentSubtype,\n\t\t\tstatus: status.Newf(codes.InvalidArgument, \"invalid gRPC request content-type %q\", contentType),\n\t\t\trst: !frame.StreamEnded(),\n\t\t})\n\t\treturn nil\n\t}\n\tif headerError != nil {\n\t\tt.controlBuf.put(&earlyAbortStream{\n\t\t\thttpStatus: http.StatusBadRequest,\n\t\t\tstreamID: streamID,\n\t\t\tcontentSubtype: s.contentSubtype,\n\t\t\tstatus: headerError,\n\t\t\trst: !frame.StreamEnded(),\n\t\t})\n\t\treturn nil\n\t}\n\n\t// \"If :authority is missing, Host must be renamed to :authority.\" - A41\n\tif len(mdata[\":authority\"]) == 0 {\n\t\t// No-op if host isn't present, no eventual :authority header is a valid\n\t\t// RPC.\n\t\tif host, ok := mdata[\"host\"]; ok {\n\t\t\tmdata[\":authority\"] = host\n\t\t\tdelete(mdata, \"host\")\n\t\t}\n\t} else {\n\t\t// \"If :authority is present, Host must be discarded\" - A41\n\t\tdelete(mdata, \"host\")\n\t}\n\n\tif frame.StreamEnded() {\n\t\t// s is just created by the caller. No lock needed.\n\t\ts.state = streamReadDone\n\t}\n\tif timeoutSet {\n\t\ts.ctx, s.cancel = context.WithTimeout(t.ctx, timeout)\n\t} else {\n\t\ts.ctx, s.cancel = context.WithCancel(t.ctx)\n\t}\n\n\t// Attach the received metadata to the context.\n\tif len(mdata) > 0 {\n\t\ts.ctx = metadata.NewIncomingContext(s.ctx, mdata)\n\t\tif statsTags := mdata[\"grpc-tags-bin\"]; len(statsTags) > 0 {\n\t\t\ts.ctx = stats.SetIncomingTags(s.ctx, []byte(statsTags[len(statsTags)-1]))\n\t\t}\n\t\tif statsTrace := mdata[\"grpc-trace-bin\"]; len(statsTrace) > 0 {\n\t\t\ts.ctx = stats.SetIncomingTrace(s.ctx, []byte(statsTrace[len(statsTrace)-1]))\n\t\t}\n\t}\n\tt.mu.Lock()\n\tif t.state != reachable {\n\t\tt.mu.Unlock()\n\t\ts.cancel()\n\t\treturn nil\n\t}\n\tif uint32(len(t.activeStreams)) >= t.maxStreams {\n\t\tt.mu.Unlock()\n\t\tt.controlBuf.put(&cleanupStream{\n\t\t\tstreamID: streamID,\n\t\t\trst: true,\n\t\t\trstCode: http2.ErrCodeRefusedStream,\n\t\t\tonWrite: func() {},\n\t\t})\n\t\ts.cancel()\n\t\treturn nil\n\t}\n\tif httpMethod != http.MethodPost {\n\t\tt.mu.Unlock()\n\t\terrMsg := fmt.Sprintf(\"http2Server.operateHeaders parsed a :method field: %v which should be POST\", httpMethod)\n\t\tif logger.V(logLevel) {\n\t\t\tlogger.Infof(\"transport: %v\", errMsg)\n\t\t}\n\t\tt.controlBuf.put(&earlyAbortStream{\n\t\t\thttpStatus: 405,\n\t\t\tstreamID: streamID,\n\t\t\tcontentSubtype: s.contentSubtype,\n\t\t\tstatus: status.New(codes.Internal, errMsg),\n\t\t\trst: !frame.StreamEnded(),\n\t\t})\n\t\ts.cancel()\n\t\treturn nil\n\t}\n\tif t.inTapHandle != nil {\n\t\tvar err error\n\t\tif s.ctx, err = t.inTapHandle(s.ctx, &tap.Info{FullMethodName: s.method}); err != nil {\n\t\t\tt.mu.Unlock()\n\t\t\tif logger.V(logLevel) {\n\t\t\t\tlogger.Infof(\"transport: http2Server.operateHeaders got an error from InTapHandle: %v\", err)\n\t\t\t}\n\t\t\tstat, ok := status.FromError(err)\n\t\t\tif !ok {\n\t\t\t\tstat = status.New(codes.PermissionDenied, err.Error())\n\t\t\t}\n\t\t\tt.controlBuf.put(&earlyAbortStream{\n\t\t\t\thttpStatus: 200,\n\t\t\t\tstreamID: s.id,\n\t\t\t\tcontentSubtype: s.contentSubtype,\n\t\t\t\tstatus: stat,\n\t\t\t\trst: !frame.StreamEnded(),\n\t\t\t})\n\t\t\treturn nil\n\t\t}\n\t}\n\tt.activeStreams[streamID] = s\n\tif len(t.activeStreams) == 1 {\n\t\tt.idle = time.Time{}\n\t}\n\tt.mu.Unlock()\n\tif channelz.IsOn() {\n\t\tatomic.AddInt64(&t.czData.streamsStarted, 1)\n\t\tatomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano())\n\t}\n\ts.requestRead = func(n int) {\n\t\tt.adjustWindow(s, uint32(n))\n\t}\n\ts.ctx = traceCtx(s.ctx, s.method)\n\tfor _, sh := range t.stats {\n\t\ts.ctx = sh.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method})\n\t\tinHeader := &stats.InHeader{\n\t\t\tFullMethod: s.method,\n\t\t\tRemoteAddr: t.remoteAddr,\n\t\t\tLocalAddr: t.localAddr,\n\t\t\tCompression: s.recvCompress,\n\t\t\tWireLength: int(frame.Header().Length),\n\t\t\tHeader: mdata.Copy(),\n\t\t}\n\t\tsh.HandleRPC(s.ctx, inHeader)\n\t}\n\ts.ctxDone = s.ctx.Done()\n\ts.wq = newWriteQuota(defaultWriteQuota, s.ctxDone)\n\ts.trReader = &transportReader{\n\t\treader: &recvBufferReader{\n\t\t\tctx: s.ctx,\n\t\t\tctxDone: s.ctxDone,\n\t\t\trecv: s.buf,\n\t\t\tfreeBuffer: t.bufferPool.put,\n\t\t},\n\t\twindowHandler: func(n int) {\n\t\t\tt.updateWindow(s, uint32(n))\n\t\t},\n\t}\n\t// Register the stream with loopy.\n\tt.controlBuf.put(&registerStream{\n\t\tstreamID: s.id,\n\t\twq: s.wq,\n\t})\n\thandle(s)\n\treturn nil\n}", "title": "" }, { "docid": "000eee09544ccf03d73cae94a23fc2d1", "score": "0.5201436", "text": "func chopEncodedHeaders(headers []byte, chunkSize int) [][]byte {\n\tvar divided [][]byte\n\n\tfor i := 0; i < len(headers); i += chunkSize {\n\t\tend := i + chunkSize\n\n\t\tif end > len(headers) {\n\t\t\tend = len(headers)\n\t\t}\n\n\t\tdivided = append(divided, headers[i:end])\n\t}\n\n\treturn divided\n}", "title": "" }, { "docid": "8dd9e139c0827a16b28ece5b148f69d4", "score": "0.51964456", "text": "func setHeaders(req *http.Request, headers []C.Header) {\n\tfor _, v := range headers {\n\t\tsetHeader(req, v)\n\t}\n}", "title": "" }, { "docid": "d3715989a3050760d71bf7fc0b817f51", "score": "0.5189037", "text": "func (h *Header) Write(b []byte) []byte {\n\tvar b0, b1 byte\n\tb0 = (Version & mask2) << 6\n\tif h.Pad {\n\t\tb0 |= (1 & mask1) << 5\n\t}\n\t// if extend { b0 |= (1 & mask1) << 4 }\n\t// b0 |= (csrcCount & mask4) << 0\n\tb1 = (h.PT & mask7) << 0\n\tif h.Mark {\n\t\tb1 |= (1 & mask1) << 7\n\t}\n\treturn append(b, b0, b1,\n\t\tbyte(h.Seq>>8),\n\t\tbyte(h.Seq),\n\t\tbyte(h.TS>>24),\n\t\tbyte(h.TS>>16),\n\t\tbyte(h.TS>>8),\n\t\tbyte(h.TS),\n\t\tbyte(h.Ssrc>>24),\n\t\tbyte(h.Ssrc>>16),\n\t\tbyte(h.Ssrc>>8),\n\t\tbyte(h.Ssrc))\n}", "title": "" }, { "docid": "22130a46f9043b40fd094c32085dea1e", "score": "0.5182996", "text": "func SetHeaders(w http.ResponseWriter) http.ResponseWriter {\n\tw.Header().Set(\"Content-Type\", \"application/json; encoding=utf-8\")\n\t//w.WriteHeader(http.StatusOK)\n\treturn w\n}", "title": "" }, { "docid": "18b407525f1ee9421eb26f0cc76e333c", "score": "0.5180515", "text": "func (w *Writer) WriteHeader(firstRecord time.Time) error {\n\tstarttime := w.TimestampOffset.Format(\"02 Jan 2006, 15:04:05 MST\")\n\ttimestamp := float64(w.TimestampOffset.UnixNano()) / 1e9\n\tfirstrec := firstRecord.Format(\"02 Jan 2006, 15:04:05 MST\")\n\n\trowColText := fmt.Sprintf(`Number of rows: %d\nNumber of columns: %d\nRow number (from 0-%d inclusive): %d\nColumn number (from 0-%d inclusive): %d`,\n\t\tw.NumberOfRows, w.NumberOfColumns,\n\t\tw.NumberOfRows-1, w.RowNum,\n\t\tw.NumberOfColumns-1, w.ColumnNum,\n\t)\n\ts := fmt.Sprintf(`#LJH Memorial File Format\nSave File Format Version: 2.2.1\nSoftware Version: DASTARD version %s\nSoftware Git Hash: %s\nData source: %s\n%s\nNumber of channels: %d\nChannel name: %s\nChannel: %d\nChannelIndex (in dastard): %d\nDigitized Word Size In Bytes: 2\nPresamples: %d\nTotal Samples: %d\nNumber of samples per point: %d\nTimestamp offset (s): %.6f\nServer Start Time: %s\nFirst Record Time: %s\nPixel X Position: %d\nPixel Y Position: %d\nPixel Name: %s\nTimebase: %e\n#End of Header\n`, w.DastardVersion, w.GitHash, w.SourceName, rowColText, w.NumberOfChans,\n\t\tw.ChanName, w.ChannelNumberMatchingName, w.ChannelIndex, w.Presamples, w.Samples, w.FramesPerSample,\n\t\ttimestamp, starttime, firstrec, w.PixelXPosition, w.PixelYPosition, w.PixelName, w.Timebase,\n\t)\n\t_, err := w.writer.WriteString(s)\n\tw.HeaderWritten = true\n\treturn err\n}", "title": "" }, { "docid": "98e7523693105774accb653dcb3029ab", "score": "0.51732534", "text": "func (b *Blaster) WriteLogHeaders() error {\n\tfields := []string{\"hash\", \"result\"}\n\tfields = append(fields, b.LogData...)\n\tfields = append(fields, b.LogOutput...)\n\tif err := b.logWriter.Write(fields); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2da7b3dde13b6943a7abfd5faf3a9f6d", "score": "0.5170224", "text": "func setHeaders(resp http.ResponseWriter, headers map[string]string) {\n\tfor field, value := range headers {\n\t\tresp.Header().Set(http.CanonicalHeaderKey(field), value)\n\t}\n}", "title": "" }, { "docid": "6a42e31c05783dd9bb608081059fbb6f", "score": "0.5160703", "text": "func (h *HttpResponseWriter) WriteHeader(code int) {\n\tfmt.Fprintln(h.conn, \"HTTP/1.1\", code, http.StatusText(code))\n\tif h.headers.Get(\"Content-Length\") == \"\" {\n\t\th.headers.Set(\"Content-Length\", \"0\")\n\t\th.noContent = true\n\t}\n\tlog.Println(\"Writing headers\")\n\tfor name, value := range h.headers {\n\t\tvaluestr := \"\"\n\t\tfor _, singlevalue := range value {\n\t\t\tvaluestr += singlevalue + \"; \"\n\t\t}\n\t\tvaluestr = valuestr[:len(valuestr)-2]\n\t\tfmt.Fprintf(h.conn, \"%s: %s\\n\", name, valuestr)\n\t}\n\tfmt.Fprintln(h.conn)\n\th.wroteHeaders = true\n}", "title": "" }, { "docid": "2d61201da068842d2eb9c300553f1671", "score": "0.5152919", "text": "func ScanHeaders(headerList []string) reportResult {\n\tvar repResult reportResult\n\trepResult.Technique = \"Headers\"\n\n\tsem := make(chan int, Config.Threads)\n\tvar wg sync.WaitGroup\n\twg.Add(len(headerList))\n\tvar m sync.Mutex\n\n\tmsg := fmt.Sprintf(\"Testing %d headers\\n\", len(headerList))\n\tPrintVerbose(msg, NoColor, 1)\n\n\tfor i, header := range headerList {\n\t\theader = strings.Trim(header, \"\\r\")\n\t\tif header == \"\" {\n\t\t\tmsg := fmt.Sprintf(\"Skipping empty header (%d/%d)\\n\", i+1, len(headerList))\n\t\t\tPrintVerbose(msg, NoColor, 1)\n\n\t\t\twg.Done()\n\t\t\tcontinue\n\t\t}\n\n\t\theader = http.CanonicalHeaderKey(header)\n\n\t\tgo func(i int, header string) {\n\t\t\tdefer wg.Done()\n\t\t\tsem <- 1\n\n\t\t\t//msg := fmt.Sprintf(\"Testing now (%d/%d) %s\\n\", i+1, len(headerList), header)\n\t\t\t//PrintVerbose(msg, NoColor, 2)\n\t\t\trUrl := Config.Website.Url.String()\n\t\t\tpoison := randInt()\n\t\t\tcb := randInt()\n\t\t\tsuccess := fmt.Sprintf(\"------- Header %s was successfully poisoned!!! cb: %s poison: %s -------\\n\", header, cb, poison)\n\t\t\tidentifier := fmt.Sprintf(\"header %s\", header)\n\n\t\t\trp := requestParams{\n\t\t\t\trepResult: &repResult,\n\t\t\t\theaders: []string{header},\n\t\t\t\tvalues: []string{poison},\n\t\t\t\tidentifier: identifier,\n\t\t\t\tpoison: poison,\n\t\t\t\turl: rUrl,\n\t\t\t\tcb: cb,\n\t\t\t\tsuccess: success,\n\t\t\t\tbodyString: \"\",\n\t\t\t\tforcePost: false,\n\t\t\t\tduplicateHeaders: false,\n\t\t\t\tm: &m,\n\t\t\t\tnewCookie: http.Cookie{},\n\t\t\t}\n\t\t\tresponseSplitting, _ := issueRequest(rp)\n\n\t\t\t// check for response splitting, if poison was reflected in a header\n\t\t\tif responseSplitting {\n\t\t\t\tmsg := fmt.Sprintf(\"Testing now (%d/%d) %s for response splitting\\n\", i+1, len(headerList), header)\n\t\t\t\tPrint(msg, NoColor)\n\n\t\t\t\trp.url = rUrl\n\t\t\t\trp.cb = randInt()\n\t\t\t\trp.poison += getRespSplit()\n\t\t\t\trp.success = fmt.Sprintf(\"------- Header %s was successfully poisoned with response splitting!!! cb: %s poison: %s -------\\n\", header, rp.cb, rp.poison)\n\t\t\t\trp.identifier += \" response splitting\"\n\n\t\t\t\tissueRequest(rp)\n\t\t\t}\n\n\t\t\t<-sem\n\t\t}(i, header)\n\n\t}\n\twg.Wait()\n\n\treturn repResult\n}", "title": "" }, { "docid": "71c9c4b3ceb8ae0e7d3a97912bd9e17e", "score": "0.5145753", "text": "func WriteHeader(db xordb.Writer, header *types.Header) {\n\t// Write the hash -> number mapping\n\tvar (\n\t\thash = header.Hash()\n\t\tnumber = header.Number\n\t\tencoded = encodeBlockNumber(number)\n\t)\n\tkey := headerNumberKey(hash)\n\tif err := db.Put(key, encoded); err != nil {\n\t\tlog.Crit(\"Failed to store hash to number mapping\", \"err\", err)\n\t}\n\t// Write the encoded header\n\tdata, err := rlp.EncodeToBytes(header)\n\tif err != nil {\n\t\tlog.Crit(\"Failed to RLP encode header\", \"err\", err)\n\t}\n\n\tkey = headerKey(number, hash)\n\n\tif err := db.Put(key, data); err != nil {\n\t\tlog.Crit(\"Failed to store header\", \"err\", err)\n\t}\n\n}", "title": "" }, { "docid": "11feb8bdfb9c195b77ef61fc457dedb4", "score": "0.51233774", "text": "func (crw *customResponseWriter) WriteHeader(code int) {\n\tif crw.written == false {\n\t\tcrw.statusCode = code\n\t\tcrw.ResponseWriter.WriteHeader(code)\n\t\treturn\n\t}\n\n\tl.Println(errMultiHeaderWrite)\n}", "title": "" }, { "docid": "2232cd749205e795b62ab3ccad7b5cda", "score": "0.5121116", "text": "func (r *ResponseBuffer) WriteHeader(statusCode int) {\n\tif r.wroteHeader {\n\t\treturn\n\t}\n\tr.wroteHeader = true\n\tr.code = statusCode\n}", "title": "" }, { "docid": "0972ba65e2cad67b597260f68187f47a", "score": "0.5119431", "text": "func (c *Context) WriteHeader(code int) {\n\tif c.response.committed {\n\t\tLog.Warn(\"response already committed\")\n\t\treturn\n\t}\n\tc.freeSession()\n\tc.response.status = code\n\tc.response.writer.WriteHeader(code)\n\tc.response.committed = true\n}", "title": "" }, { "docid": "e1555eb0b43a3f3fde55e8b36ccbbb04", "score": "0.51059633", "text": "func (rw *ResponseRecorder) WriteHeader(code int) {\n\tif rw.wroteHeader {\n\t\treturn\n\t}\n\trw.Code = code\n\trw.wroteHeader = true\n\tif rw.HeaderMap == nil {\n\t\trw.HeaderMap = make(http.Header)\n\t}\n\trw.snapHeader = cloneHeader(rw.HeaderMap)\n}", "title": "" }, { "docid": "2a0e8b559af4bc5c041555f45acec22d", "score": "0.51044893", "text": "func (r *RPCHeaderHandler) WriteHeader(w io.Writer, req []byte, writeAuth bool) error {\n\tvar (\n\t\ttoken string\n\t\terr error\n\t\terr2 error\n\t)\n\tbinary.Write(w, byteOrder, RPCMagicNumber)\n\tif writeAuth {\n\t\tbinary.Write(w, byteOrder, uint8(1))\n\t\t// get current host token\n\t\tvar signer Signer = &delegateKeys\n\t\ttoken, err = AuthTokenNonBlocking()\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Debug(\"Unable to retrieve delegate token\")\n\t\t\t// We may be an un-added master\n\t\t\ttoken, err2 = MasterToken()\n\t\t\tif err2 != nil {\n\t\t\t\tlog.WithError(err2).Debug(\"Unable to retrieve master token\")\n\t\t\t\t// Return the original error message\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tsigner = &masterKeys\n\t\t}\n\t\th := NewAuthHeaderWriterTo([]byte(token), req, signer)\n\t\t_, err = h.WriteTo(w)\n\t} else {\n\t\tbinary.Write(w, byteOrder, uint8(0))\n\t\tWriteLengthAndBytes(req, w)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c2fa006f5046cf789bc6668e8313ad58", "score": "0.5100589", "text": "func (cc *BlogClient) SubscribeHeaders(out chan<- *tmtypes.Header) (func(), error) {\n\tquery := tmtypes.EventQueryNewBlockHeader\n\tpipe, cancel, err := cc.Subscribe(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo func() {\n\t\tfor msg := range pipe {\n\t\t\tevt, ok := msg.Data.(tmtypes.EventDataNewBlockHeader)\n\t\t\tif !ok {\n\t\t\t\t// TODO: something else?\n\t\t\t\tpanic(\"Unexpected event type\")\n\t\t\t}\n\t\t\tout <- &evt.Header\n\t\t}\n\t\tclose(out)\n\t}()\n\treturn cancel, nil\n}", "title": "" }, { "docid": "dfd65a29d9efbe44609e7ae33276fec1", "score": "0.5086619", "text": "func (s *serverStream) WriteHeader(code int) {\n\tif s.wroteHeader {\n\t\tlog.Println(\"Error: Multiple calls to ResponseWriter.WriteHeader.\")\n\t\treturn\n\t}\n\ts.wroteHeader = true\n\n\ts.WriteResponse(httpToWpResponseCode(code))\n}", "title": "" }, { "docid": "04a05e03b7748fdf5cba3ed79cd79ea6", "score": "0.5085953", "text": "func (s *ServerStream) SendHeaders(headers Headers) error {\n\treturn SendStreamHeaders(s.stream, headers)\n}", "title": "" }, { "docid": "ddfe7047f1453c1239486e295184c77f", "score": "0.5074041", "text": "func (w *BackupStreamWriter) WriteHeader(hdr *BackupHeader) error {\n\tif w.bytesLeft != 0 {\n\t\treturn fmt.Errorf(\"missing %d bytes\", w.bytesLeft)\n\t}\n\tname := utf16.Encode([]rune(hdr.Name))\n\twsi := win32StreamID{\n\t\tStreamID: hdr.Id,\n\t\tAttributes: hdr.Attributes,\n\t\tSize: uint64(hdr.Size),\n\t\tNameSize: uint32(len(name) * 2),\n\t}\n\tif hdr.Id == BackupSparseBlock {\n\t\t// Include space for the int64 block offset\n\t\twsi.Size += 8\n\t}\n\tif err := binary.Write(w.w, binary.LittleEndian, &wsi); err != nil {\n\t\treturn err\n\t}\n\tif len(name) != 0 {\n\t\tif err := binary.Write(w.w, binary.LittleEndian, name); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif hdr.Id == BackupSparseBlock {\n\t\tif err := binary.Write(w.w, binary.LittleEndian, hdr.Offset); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tw.bytesLeft = hdr.Size\n\treturn nil\n}", "title": "" }, { "docid": "e76a28a9fbaad24ffcdf731620d3cf93", "score": "0.50728625", "text": "func writePersistHeader(fh *os.File, latestSyncedOffset uint64, nextPayoutHeight types.BlockHeight) error {\n\tencodedHeader := encoding.Marshal(PersistHeader{\n\t\tMetadata: persist.Metadata{\n\t\t\tHeader: MetadataHeader,\n\t\t\tVersion: MetadataVersion,\n\t\t},\n\t\tNextPayoutHeight: nextPayoutHeight,\n\t\tLatestSyncedOffset: latestSyncedOffset,\n\t})\n\tif len(encodedHeader) > diskSectorSize {\n\t\treturn errors.New(\"encoded header is too large\")\n\t}\n\n\t// Write the file header.\n\t_, err := fh.WriteAt(encodedHeader, 0)\n\tif err != nil {\n\t\treturn errors.AddContext(err, \"header write failed\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d1efe28b730e0baa4ad6eeb4a96a97be", "score": "0.50674003", "text": "func (params *APIParams) WritePaginationHeaders(w http.ResponseWriter, total int64) {\n\tw.Header().Set(ResultsPage, fmt.Sprintf(\"%d\", params.Page))\n\tw.Header().Set(ResultsLimit, fmt.Sprintf(\"%d\", params.Limit))\n\tw.Header().Set(ResultsTotal, fmt.Sprintf(\"%d\", total))\n}", "title": "" }, { "docid": "c6a792817a5b23ecb479b096e5cfa1fd", "score": "0.5064793", "text": "func (w *WaveHeader) WriteHeader(writer io.Writer) (int, error) {\n\tcopy(w.header[0:], stringToBytes(w.ChunkID[:4]))\n\tcopy(w.header[4:], int32ToBytes(w.ChunkSize))\n\tcopy(w.header[8:], stringToBytes(w.Format[:4]))\n\tcopy(w.header[12:], stringToBytes(w.Subchunk1ID[:4]))\n\tcopy(w.header[16:], int32ToBytes(w.Subchunk1Size))\n\tcopy(w.header[20:], int16ToBytes(w.AudioFormat))\n\tcopy(w.header[22:], int16ToBytes(w.NumChannels))\n\tcopy(w.header[24:], int32ToBytes(w.SampleRate))\n\tcopy(w.header[28:], int32ToBytes(w.ByteRate))\n\tcopy(w.header[32:], int16ToBytes(w.BlockAlign))\n\tcopy(w.header[34:], int16ToBytes(w.BitsPerSample))\n\tcopy(w.header[36:], stringToBytes(w.Subchunk2ID[:4]))\n\tcopy(w.header[40:], int32ToBytes(w.Subchunk2Size))\n\treturn writer.Write(w.header[:])\n}", "title": "" }, { "docid": "90875a88f3e776dbf052720ddc69d370", "score": "0.5058223", "text": "func (self *RtmpStream) WriteHeader(streams []av.CodecData) error {\n\n\tself.streams = streams\n\n\tfor _, stream := range streams {\n\t\tif stream.Type() == av.H264 {\n\t\t\th264Codec := stream.(h264.CodecData)\n\t\t\tself.videoCodecData = h264Codec\n\n\t\t\tvideoMediaInfo := sdp.MediaInfoCreate(\"video\", self.videoCapability)\n\n\t\t\tself.videoSession = mediaserver.NewStreamerSession(videoMediaInfo)\n\n\t\t\tvideo2rtpstr := fmt.Sprintf(video2rtp, videoMediaInfo.GetCodec(\"h264\").GetType(), self.videoSession.GetLocalPort())\n\n\t\t\tvideoPipeline, err := gst.ParseLaunch(video2rtpstr)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tself.videoPipeline = videoPipeline\n\t\t\tself.videosrc = videoPipeline.GetByName(\"appsrc\")\n\n\t\t\tvideoPipeline.SetState(gst.StatePlaying)\n\n\t\t}\n\t\tif stream.Type() == av.AAC {\n\t\t\taacCodec := stream.(aac.CodecData)\n\t\t\tself.audioCodecData = aacCodec\n\n\t\t\taudioMediaInfo := sdp.MediaInfoCreate(\"audio\", self.audioCapability)\n\n\t\t\tself.audioSession = mediaserver.NewStreamerSession(audioMediaInfo)\n\n\t\t\taudio2rtpstr := fmt.Sprintf(audio2rtp, audioMediaInfo.GetCodec(\"opus\").GetType(), self.audioSession.GetLocalPort())\n\t\t\t//audio2rtpstr = audio2rtp\n\t\t\taudioPipeline, err := gst.ParseLaunch(audio2rtpstr)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tself.adtsheader = make([]byte, 7)\n\n\t\t\tself.audioPipeline = audioPipeline\n\t\t\tself.audiosrc = audioPipeline.GetByName(\"appsrc\")\n\t\t\taudioPipeline.SetState(gst.StatePlaying)\n\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d3b15e3136f8d4a66c106d90d31e00ae", "score": "0.505796", "text": "func WriteLastBlockHeader(header *protocol.Block) (err error) {\n\tdb.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(\"lastblockheader\"))\n\t\tb.ForEach(func(k, v []byte) error {\n\t\t\tb.Delete(k)\n\n\t\t\treturn nil\n\t\t})\n\n\t\treturn nil\n\t})\n\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(\"lastblockheader\"))\n\t\terr := b.Put(header.Hash[:], header.EncodeHeader())\n\n\t\treturn err\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "d4817b9ed37bb06b33c5fc847b584627", "score": "0.50554323", "text": "func (b *nonFlushingBadResponseLoggingWriter) WriteHeader(statusCode int) {\n\tb.statusCode = statusCode\n\tif statusCode >= 500 {\n\t\tb.logBody = true\n\t}\n\tb.rw.WriteHeader(statusCode)\n}", "title": "" }, { "docid": "ca5e80ec6ef870624e71873e804b9c8a", "score": "0.505096", "text": "func (b *HeaderFormatter) Headers() {\n\tif len(b.headers) == 0 {\n\t\treturn\n\t}\n\n\th := [][]string{b.headers}\n\tb.recalculateFlexibleColumns()\n\tif len(b.DividingLine) > 0 {\n\t\th = append(h, b.outputDivider())\n\t}\n\tif b.Buffer {\n\t\tb._buffer = append(h, b._buffer...)\n\t} else {\n\t\tb.output(h[0])\n\t\tif len(h) == 2 {\n\t\t\tb.output(h[1])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "95d87f8bf748d3249c96297c9b98c9dc", "score": "0.504766", "text": "func (options *DeleteLogicalReplicationSlotOptions) SetHeaders(param map[string]string) *DeleteLogicalReplicationSlotOptions {\n\toptions.Headers = param\n\treturn options\n}", "title": "" }, { "docid": "1ff62cc0496b5f165ee954a6aa800bff", "score": "0.5038618", "text": "func (aw *Writer) writeHeader(hdr *Header) error {\n\tif aw.closed {\n\t\treturn ErrWriteAfterClose\n\t}\n\tif aw.err == nil {\n\t\taw.Flush()\n\t}\n\tif aw.err != nil {\n\t\treturn aw.err\n\t}\n\tfmodTimestamp := fmt.Sprintf(\"%d\", hdr.ModTime.Unix())\n\t//use root by default (this is particularly useful for debs).\n\tuid := fmt.Sprintf(\"%d\", hdr.Uid)\n\tif len(uid) > 6 {\n\t\treturn fmt.Errorf(\"UID too long\")\n\t}\n\tgid := fmt.Sprintf(\"%d\", hdr.Gid)\n\tif len(gid) > 6 {\n\t\treturn fmt.Errorf(\"GID too long\")\n\t}\n\t//Files only atm (not dirs)\n\tmode := fmt.Sprintf(\"100%d\", hdr.Mode)\n\tsize := fmt.Sprintf(\"%d\", hdr.Size)\n\tname := hdr.Name\n\tif aw.TerminateFilenamesSlash {\n\t\tname += \"/\"\n\t}\n\tline := fmt.Sprintf(\"%s%s%s%s%s%s`\\n\", pad(name, 16), pad(fmodTimestamp, 12), pad(gid, 6), pad(uid, 6), pad(mode, 8), pad(size, 10))\n\tif _, err := aw.Write([]byte(line)); err != nil {\n\t\treturn err\n\t}\n\t// data section is 2-byte aligned.\n\tif hdr.Size%2 == 1 {\n\t\taw.pad = true\n\t}\n\taw.nb = hdr.Size\n\treturn nil\n}", "title": "" }, { "docid": "00ca5a7e13d78c2dc9eaa77110e4f2af", "score": "0.503762", "text": "func (client *Client) setHeaders(req *http.Request, headers http.Header) {\n\tfor k, v := range headers {\n\t\tfor x, hv := range v {\n\t\t\tif x == 0 {\n\t\t\t\treq.Header.Set(k, hv)\n\t\t\t} else {\n\t\t\t\treq.Header.Add(k, hv)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c44c0294f6fd5291f21a013c6a9bb60e", "score": "0.5033261", "text": "func (r *hijackRecorder) WriteHeader(code int) {\n\tresp := http.Response{StatusCode: code, Header: r.Header()}\n\t_ = resp.Write(r.conn)\n}", "title": "" }, { "docid": "533c95450e45e63db50075c79bcd36d4", "score": "0.50211334", "text": "func (c *Conn) writeFrame(ctx context.Context, fin bool, opcode opcode, p []byte) (int, error) {\n\th := header{\n\t\tfin: fin,\n\t\topcode: opcode,\n\t\tmasked: c.client,\n\t\tpayloadLength: int64(len(p)),\n\t}\n\n\tif c.client {\n\t\t_, err := io.ReadFull(cryptorand.Reader, h.maskKey[:])\n\t\tif err != nil {\n\t\t\treturn 0, xerrors.Errorf(\"failed to generate masking key: %w\", err)\n\t\t}\n\t}\n\n\tb2 := marshalHeader(h)\n\n\terr := c.acquireLock(ctx, c.writeFrameLock)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer c.releaseLock(c.writeFrameLock)\n\n\tselect {\n\tcase <-c.closed:\n\t\treturn 0, c.closeErr\n\tcase c.setWriteTimeout <- ctx:\n\t}\n\n\twriteErr := func(err error) error {\n\t\tselect {\n\t\tcase <-c.closed:\n\t\t\treturn c.closeErr\n\t\tcase <-ctx.Done():\n\t\t\terr = ctx.Err()\n\t\tdefault:\n\t\t}\n\n\t\terr = xerrors.Errorf(\"failed to write to connection: %w\", err)\n\t\t// We need to release the lock first before closing the connection to ensure\n\t\t// the lock can be acquired inside close to ensure no one can access c.bw.\n\t\tc.releaseLock(c.writeFrameLock)\n\t\tc.close(err)\n\n\t\treturn err\n\t}\n\n\t_, err = c.bw.Write(b2)\n\tif err != nil {\n\t\treturn 0, writeErr(err)\n\t}\n\n\tvar n int\n\tif c.client {\n\t\tvar keypos int\n\t\tfor len(p) > 0 {\n\t\t\tif c.bw.Available() == 0 {\n\t\t\t\terr = c.bw.Flush()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn n, writeErr(err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Start of next write in the buffer.\n\t\t\ti := c.bw.Buffered()\n\n\t\t\tp2 := p\n\t\t\tif len(p) > c.bw.Available() {\n\t\t\t\tp2 = p[:c.bw.Available()]\n\t\t\t}\n\n\t\t\tn2, err := c.bw.Write(p2)\n\t\t\tif err != nil {\n\t\t\t\treturn n, writeErr(err)\n\t\t\t}\n\n\t\t\tkeypos = fastXOR(h.maskKey, keypos, c.writeBuf[i:i+n2])\n\n\t\t\tp = p[n2:]\n\t\t\tn += n2\n\t\t}\n\t} else {\n\t\tn, err = c.bw.Write(p)\n\t\tif err != nil {\n\t\t\treturn n, writeErr(err)\n\t\t}\n\t}\n\n\tif fin {\n\t\terr = c.bw.Flush()\n\t\tif err != nil {\n\t\t\treturn n, writeErr(err)\n\t\t}\n\t}\n\n\t// We already finished writing, no need to potentially brick the connection if\n\t// the context expires.\n\tselect {\n\tcase <-c.closed:\n\t\treturn n, c.closeErr\n\tcase c.setWriteTimeout <- context.Background():\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "26bafaf88cf0d31948b4e9691628f208", "score": "0.50191146", "text": "func SendStreamHeaders(s Stream, headers Headers) error {\n\tif w, ok := s.(StreamHeadersSender); ok {\n\t\treturn w.SendHeaders(headers)\n\t}\n\treturn yarpcerrors.UnimplementedErrorf(\"stream does not support sending headers\")\n}", "title": "" }, { "docid": "e14e0f8d3882b3f7e40c134ef96d8449", "score": "0.5004817", "text": "func (w *Writer) WriteHeader(hdr *Header) (err error) {\n\tif w.closed {\n\t\treturn ErrWriteAfterClose\n\t}\n\tif w.err == nil {\n\t\tw.Flush()\n\t}\n\tif w.err != nil {\n\t\treturn w.err\n\t}\n\tif hdr.Name != headerEOF {\n\t\t// TODO: should we be mutating hdr here?\n\t\t// ensure all inodes are unique\n\t\tw.inode++\n\t\tif hdr.Inode == 0 {\n\t\t\thdr.Inode = w.inode\n\t\t}\n\n\t\t// ensure file type is set\n\t\tif hdr.Mode&^ModePerm == 0 {\n\t\t\thdr.Mode |= ModeRegular\n\t\t}\n\n\t\t// ensure regular files have at least 1 inbound link\n\t\tif hdr.Links < 1 && hdr.Mode.IsRegular() {\n\t\t\thdr.Links = 1\n\t\t}\n\t}\n\n\tw.nb = hdr.Size\n\tw.pad, w.err = writeSVR4Header(w.w, hdr)\n\treturn\n}", "title": "" }, { "docid": "3a2fde77cfb5fd77ed5d6c2a68630c9a", "score": "0.5002868", "text": "func (r *R) WriteHeader(code int, contentType string) {\n\tif len(contentType) > 0 {\n\t\tr.rw.Header().Set(\"Content-Type\", contentType)\n\t}\n\tif code >= 0 {\n\t\tr.rw.WriteHeader(code)\n\t}\n}", "title": "" }, { "docid": "25f78cbec76d046e6f97202512b0fe0a", "score": "0.50028586", "text": "func (l *HeaderHashList) Write(bw *io.BinWriter, start, n int) error {\n\tbw.WriteArray(l.hashes[start : start+n])\n\treturn bw.Err\n}", "title": "" }, { "docid": "4b327fe02daa28396d88bf2e91cae30b", "score": "0.50018907", "text": "func writeResponseHeader(HTTP HTTP, code errorCode) {\n\tHTTP.Write.Header().Set(\"Content-Type\", \"application/json\")\n\tHTTP.Write.WriteHeader(int(code))\n}", "title": "" }, { "docid": "48ffadf0437efa6ce3cd74a9469a66c0", "score": "0.4999387", "text": "func setHeaders(c *Ctx, override bool) {\n\tfor key, vals := range options(c.With).DefaultHeaders {\n\t\tfor _, val := range vals {\n\t\t\tc.W.Header().Add(key, val)\n\t\t}\n\t}\n\tfor key, vals := range c.With.Headers {\n\t\tif override {\n\t\t\tc.W.Header().Del(key)\n\t\t}\n\t\tfor _, val := range vals {\n\t\t\tc.W.Header().Add(key, val)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1f92948ea304989ad5b5f47e3c02e91b", "score": "0.49931896", "text": "func (rf *ResponseForwarder) WriteHeader(code int) {\n\t// As in net/http, ignore multiple calls to WriteHeader.\n\tif rf.wroteHeader {\n\t\treturn\n\t}\n\trf.wroteHeader = true\n\tfor k, v := range rf.header {\n\t\tif _, ok := hopHeaders[k]; ok {\n\t\t\tcontinue\n\t\t}\n\t\trf.response.Header[k] = v\n\t}\n\trf.response.StatusCode = code\n\trf.response.Status = http.StatusText(rf.response.StatusCode)\n\trf.response.TransferEncoding = []string{\"chunked\"}\n\t// This will write the status and headers immediately and stream the\n\t// body using the pipes we've wired.\n\tgo func() {\n\t\tdefer rf.proxyWriter.Close()\n\t\tif err := rf.response.Write(rf.proxyWriter); err != nil {\n\t\t\trf.forwardingErrors <- err\n\n\t\t\t// Normally, the end of this goroutine indicates\n\t\t\t// that the response.Body reader has returned an EOF,\n\t\t\t// which means that the corresponding writer has been\n\t\t\t// closed. However, that is not necessarily the case\n\t\t\t// if we hit an error in the call to `Write`.\n\t\t\t//\n\t\t\t// In this case, there may still be someone writing\n\t\t\t// to the pipe writer, but we will no longer be reading\n\t\t\t// anything from the corresponding reader. As such,\n\t\t\t// we signal that issue to any remaining writers.\n\t\t\trf.response.Body.(*io.PipeReader).CloseWithError(err)\n\t\t}\n\t\trf.metricHandler.WriteResponseCodeMetric(rf.response.StatusCode)\n\t\tclose(rf.forwardingErrors)\n\t}()\n}", "title": "" }, { "docid": "505f66493b4407ebf86e8807cb509bbb", "score": "0.49740303", "text": "func PublishHeaders(keyPairs ...interface{}) PublishOption {\n\treturn func(pub *amqp.Publishing) {\n\t\tpub.Headers = make(map[string]interface{})\n\t\tkeyPairsLen := len(keyPairs)\n\t\tif keyPairsLen%2 == 1 {\n\t\t\tkeyPairs = append(keyPairs, \"\")\n\t\t\tkeyPairsLen++\n\t\t}\n\t\tfor i := 0; i < keyPairsLen; i += 2 {\n\t\t\tpub.Headers[fmt.Sprintf(\"%v\", keyPairs[i])] = keyPairs[i+1]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3a0222644ddb6044c47e815e467c7ea7", "score": "0.49699846", "text": "func (h Header) Marshall(writer io.Writer) error {\n\tvar buff bytes.Buffer\n\n\tif err := binary.Write(&buff, binary.BigEndian, h.Type); err != nil {\n\t\treturn err\n\t}\n\n\tif err := binary.Write(&buff, binary.BigEndian, h.NumberOfTracks); err != nil {\n\t\treturn err\n\t}\n\n\tif err := binary.Write(&buff, binary.BigEndian, h.Division); err != nil {\n\t\treturn err\n\t}\n\n\tbody := buff.Bytes()\n\n\t// write header\n\tif _, err := writer.Write([]byte(\"MThd\")); err != nil {\n\t\treturn err\n\t}\n\n\t// write body length\n\tif err := binary.Write(writer, binary.BigEndian, uint32(len(body))); err != nil {\n\t\treturn err\n\t}\n\n\t// write body\n\t_, err := writer.Write(body)\n\treturn err\n}", "title": "" }, { "docid": "dd07304af43b095af32193788c6016c3", "score": "0.49686575", "text": "func Headers(yamlPayload **C.char) {\n\th := util.HTTPHeaders()\n\n\tdata, err := yaml.Marshal(h)\n\tif err != nil {\n\t\tlog.Errorf(\"datadog_agent: could not Marshal headers: %s\", err)\n\t\t*yamlPayload = nil\n\t\treturn\n\t}\n\t// yamlPayload will be free by rtloader when it's done with it\n\t*yamlPayload = TrackedCString(string(data))\n}", "title": "" }, { "docid": "12118bab680445b4a9355a22420d5706", "score": "0.4957139", "text": "func MarkHeaders(ctx context.Context, in *v1.Route, out *envoyroute.Route, headers HeadersToAddFunc) error {\n\tinAction, outAction, err := getRouteActions(in, out)\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch dest := inAction.Destination.(type) {\n\tcase *v1.RouteAction_Multi:\n\t\tmultiClusterSpecifier, ok := outAction.ClusterSpecifier.(*envoyroute.RouteAction_WeightedClusters)\n\t\tif !ok {\n\t\t\treturn errors.Errorf(\"input destination Multi but output destination was not\")\n\t\t}\n\t\treturn configureHeadersMultiDest(dest.Multi, multiClusterSpecifier.WeightedClusters, headers)\n\tcase *v1.RouteAction_Single:\n\t\treturn configureHeadersSingleDest(dest.Single, &out.RequestHeadersToAdd, headers)\n\t}\n\n\terr = errors.Errorf(\"unexpected destination type %v\", reflect.TypeOf(inAction.Destination).Name())\n\tlogger := contextutils.LoggerFrom(ctx)\n\tlogger.DPanic(\"error: %v\", err)\n\treturn err\n}", "title": "" }, { "docid": "9c669a6482ddbe9115126e90dde2f99b", "score": "0.49472755", "text": "func (b *blockManager) QueueHeaders(headers *wire.MsgHeaders, peer *peerpkg.Peer) {\n\t// No channel handling here because peers do not need to block on\n\t// headers messages.\n\tif atomic.LoadInt32(&b.shutdown) != 0 {\n\t\treturn\n\t}\n\n\tb.msgChan <- &headersMsg{headers: headers, peer: peer}\n}", "title": "" }, { "docid": "35dcf1edee65b4733c20da43cc54535c", "score": "0.49417624", "text": "func (dw Writer) WriteHeader() error {\n\treturn dw.Writer.Write(dw.Fieldnames)\n}", "title": "" }, { "docid": "5932c3bd9a3e853b48a0ff78c68c4f33", "score": "0.4940401", "text": "func WrapHeaders(h http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST,GET,OPTIONS,PUT,DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(rfc.Vary, rfc.AcceptEncoding)\n\t\tw.Header().Set(\"X-Server-Name\", ServerName)\n\t\tw.Header().Set(rfc.PermissionsPolicy, \"interest-cohort=()\")\n\t\tiw := &util.BodyInterceptor{W: w}\n\t\th(iw, r)\n\n\t\tsha := sha512.Sum512(iw.Body())\n\t\tw.Header().Set(\"Whole-Content-SHA512\", base64.StdEncoding.EncodeToString(sha[:]))\n\n\t\tGzipResponse(w, r, iw.Body())\n\n\t}\n}", "title": "" }, { "docid": "b0e7262c8bae12d08ac1cb5f365c5c1e", "score": "0.49360964", "text": "func (msg *MsgCFHeaders) BtcEncode(w io.Writer, pver uint32, _ MessageEncoding) error {\n\t// Write filter type\n\terr := writeElement(w, msg.FilterType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write stop hash\n\terr = writeElement(w, msg.StopHash)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write prev filter header\n\terr = writeElement(w, msg.PrevFilterHeader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Limit to max committed headers per message.\n\tcount := len(msg.FilterHashes)\n\tif count > MaxCFHeadersPerMsg {\n\t\tstr := fmt.Sprintf(\"too many committed filter headers for \"+\n\t\t\t\"message [count %v, max %v]\", count,\n\t\t\tMaxBlockHeadersPerMsg)\n\t\treturn messageError(\"MsgCFHeaders.BtcEncode\", str)\n\t}\n\n\terr = WriteVarInt(w, pver, uint64(count))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, cfh := range msg.FilterHashes {\n\t\terr := writeElement(w, cfh)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "47b52a25121a2b807eb89effb5c6faf6", "score": "0.49330857", "text": "func (w *mossResponseWriter) WriteHeader(statusCode int) {\n\tif statusCode > 0 && w.status != statusCode {\n\t\tif w.Written() {\n\t\t\tfmt.Fprintf(os.Stderr, \"[Moss-Writer][WARNING] Headers were already written. Wanted to override status code %d with %d\", w.status, statusCode)\n\t\t}\n\t\tw.status = statusCode\n\t}\n\tw.status = statusCode\n}", "title": "" }, { "docid": "0ff4c1e0841003ea0c680e031e9f249f", "score": "0.4919603", "text": "func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {\n\tif !rws.wroteHeader {\n\t\trws.writeHeader(200)\n\t}\n\tif !rws.sentHeader {\n\t\trws.sentHeader = true\n\t\tvar ctype, clen string // implicit ones, if we can calculate it\n\t\tif rws.handlerDone && rws.snapHeader.Get(\"Content-Length\") == \"\" {\n\t\t\tclen = strconv.Itoa(len(p))\n\t\t}\n\t\tif rws.snapHeader.Get(\"Content-Type\") == \"\" {\n\t\t\tctype = http.DetectContentType(p)\n\t\t}\n\t\tendStream := rws.handlerDone && len(p) == 0\n\t\trws.stream.conn.writeHeaders(headerWriteReq{\n\t\t\tstream: rws.stream,\n\t\t\thttpResCode: rws.status,\n\t\t\th: rws.snapHeader,\n\t\t\tendStream: endStream,\n\t\t\tcontentType: ctype,\n\t\t\tcontentLength: clen,\n\t\t}, rws.frameWriteCh)\n\t\tif endStream {\n\t\t\treturn\n\t\t}\n\t}\n\tif len(p) == 0 {\n\t\tif rws.handlerDone {\n\t\t\terr = rws.writeData(nil, true)\n\t\t}\n\t\treturn\n\t}\n\tfor len(p) > 0 {\n\t\tchunk := p\n\t\tif len(chunk) > handlerChunkWriteSize {\n\t\t\tchunk = chunk[:handlerChunkWriteSize]\n\t\t}\n\t\tallowedSize := rws.stream.flow.wait(int32(len(chunk)))\n\t\tif allowedSize == 0 {\n\t\t\treturn n, errStreamBroken\n\t\t}\n\t\tchunk = chunk[:allowedSize]\n\t\tp = p[len(chunk):]\n\t\tisFinal := rws.handlerDone && len(p) == 0\n\t\terr = rws.writeData(chunk, isFinal)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tn += len(chunk)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b45e5d26d35818ccce3bef071e9cf5a1", "score": "0.49190012", "text": "func (p *Context) WriteHeader(statusCode int, h http.Header) {\n\tif h != nil {\n\t\thto := p.W.Header()\n\t\tfor k, v := range h {\n\t\t\thto[k] = v\n\t\t}\n\t}\n\tp.W.WriteHeader(statusCode)\n}", "title": "" }, { "docid": "ceae27b44bb0bc1ebe7f3ebd39cd0572", "score": "0.49083656", "text": "func (s *Signer) SetHeaders(header ...string){\n\ts.Headers = List(header)\n}", "title": "" }, { "docid": "268b1ec2cbe8f111c461e6c29b8fa68f", "score": "0.4887657", "text": "func (c *Client) NotifyBlockHeaders(ctx context.Context) (<-chan *BlockHeader, error) {\n\theaders := make(chan *BlockHeader)\n\tsub := &subscription{\n\t\tctx: ctx,\n\t\tmethod: \"blockchain.headers.subscribe\",\n\t\tmessages: make(chan *response),\n\t\thandler: func(m *response) {\n\t\t\tif m.Result != nil {\n\t\t\t\th := &BlockHeader{}\n\t\t\t\tvar b []byte\n\t\t\t\tvar err error\n\t\t\t\tif b, err = json.Marshal(m.Result); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif err = json.Unmarshal(b, h); err == nil {\n\t\t\t\t\theaders <- h\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif m.Params != nil {\n\t\t\t\tfor _, i := range m.Params.([]interface{}) {\n\t\t\t\t\th := &BlockHeader{}\n\t\t\t\t\tvar b []byte\n\t\t\t\t\tvar err error\n\t\t\t\t\tif b, err = json.Marshal(i); err != nil {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif err = json.Unmarshal(b, h); err == nil {\n\t\t\t\t\t\theaders <- h\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}\n\tif err := c.startSubscription(sub); err != nil {\n\t\tclose(headers)\n\t\treturn nil, err\n\t}\n\treturn headers, nil\n}", "title": "" }, { "docid": "81491a2e70dc6c9b1f56260d9949a628", "score": "0.48833013", "text": "func serializeHeaders(headerMap http.Header) string {\n\tvar buffer bytes.Buffer\n\tfor key := range headerMap {\n\t\tvalues := headerMap[key]\n\t\tvar valuesBuffer bytes.Buffer\n\t\tfor i := 0; i < len(values); i++ {\n\t\t\tif values[i] != \"\" {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tvaluesBuffer.WriteString(\",\")\n\t\t\t\t}\n\t\t\t\tvaluesBuffer.WriteString(values[i])\n\t\t\t}\n\t\t}\n\t\tval := valuesBuffer.String()\n\t\tbuffer.WriteString(key)\n\t\tbuffer.WriteString(\": \")\n\t\tbuffer.WriteString(val)\n\t\tbuffer.WriteString(\"\\n\")\n\t}\n\tserializedHeaders := buffer.String()\n\n\treturn serializedHeaders\n}", "title": "" }, { "docid": "b68b9d2b23b9162e6056cc84af240437", "score": "0.48624066", "text": "func (e *Encoder) EncodeHeader(fields []string, v interface{}) error {\n\tif err := e.buildHeader(fields, reflect.ValueOf(v)); err != nil {\n\t\treturn err\n\t}\n\tif !e.writeHeader {\n\t\treturn nil\n\t}\n\treturn e.output(e.headerKeys)\n}", "title": "" }, { "docid": "c8774042398ca25bdf8ce309505c964a", "score": "0.4861914", "text": "func EncodeBlockHeader(header bookkeeping.BlockHeader) []byte {\n\treturn encodeJSON(convertBlockHeader(header))\n}", "title": "" }, { "docid": "c163904fd5e2c4e6c368739a87a7cdbd", "score": "0.48520076", "text": "func (_m *RPCHeaderBuilder) WriteHeader(_a0 io.Writer, _a1 []byte, _a2 bool) error {\n\tret := _m.Called(_a0, _a1, _a2)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(io.Writer, []byte, bool) error); ok {\n\t\tr0 = rf(_a0, _a1, _a2)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "cdac033720c3d9321e36ecbf38810f80", "score": "0.48420197", "text": "func (c *Conn) writeFrame(ctx context.Context, fin bool, opcode opcode, p []byte) (int, error) {\n\terr := c.acquireLock(ctx, c.writeFrameLock)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer c.releaseLock(c.writeFrameLock)\n\n\tselect {\n\tcase <-c.closed:\n\t\treturn 0, c.closeErr\n\tcase c.setWriteTimeout <- ctx:\n\t}\n\n\tc.writeHeader.fin = fin\n\tc.writeHeader.opcode = opcode\n\tc.writeHeader.masked = c.client\n\tc.writeHeader.payloadLength = int64(len(p))\n\n\tif c.client {\n\t\t_, err := io.ReadFull(cryptorand.Reader, c.writeHeader.maskKey[:])\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"failed to generate masking key: %w\", err)\n\t\t}\n\t}\n\n\tn, err := c.realWriteFrame(ctx, *c.writeHeader, p)\n\tif err != nil {\n\t\treturn n, err\n\t}\n\n\t// We already finished writing, no need to potentially brick the connection if\n\t// the context expires.\n\tselect {\n\tcase <-c.closed:\n\t\treturn n, c.closeErr\n\tcase c.setWriteTimeout <- context.Background():\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "731c762e11efa585407c7829b3a94573", "score": "0.4833709", "text": "func (h *NeutrinoDBStore) addBlockHeaders(tx walletdb.ReadWriteTx, batch headerWithHeightBatch, isGenesis bool) er.R {\n\t// If we're writing a 0-length batch, make no changes and return.\n\tif len(batch) == 0 {\n\t\treturn nil\n\t}\n\n\trootBucket, err := h.rwBucket(tx)\n\tif err != nil {\n\t\treturn err\n\t}\n\theaderBucket := rootBucket.NestedReadWriteBucket(bucketNameHeaderByHeight)\n\n\tsort.Sort(batch)\n\tvar tip *headerEntryWithHeight\n\tif !isGenesis {\n\t\the, err := h.chainTip(tx, bucketNameBlockTip)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttip = he\n\t} else {\n\t\ttip = &headerEntryWithHeight{}\n\t}\n\tvar heightBytes []byte\n\tfor _, header := range batch {\n\t\tif !isGenesis && header.Height != tip.Height+1 {\n\t\t\tlog.Warnf(\"Unable to add block header at height %v because tip is %v\", header.Height, tip.Height)\n\t\t\treturn er.Errorf(\"Unable to add block header at height %v because tip is %v\", header.Height, tip.Height)\n\t\t}\n\t\the := headerEntry{blockHeader: header.Header.blockHeader, filterHeader: nil}\n\t\tvalue := he.Bytes()\n\t\theightBytes = heightBin(header.Height)\n\t\tif err := headerBucket.Put(heightBytes, value); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tblockHash := header.Header.blockHeader.BlockHash()\n\t\tif err := h.modifyHeightsByHashPfx(tx, &blockHash, header.Height, false); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttip.Height = header.Height\n\t\ttip.Header = header.Header\n\t}\n\treturn rootBucket.Put(bucketNameBlockTip, heightBytes)\n}", "title": "" }, { "docid": "e616e6ca6490aea7e94c59cfd149e68c", "score": "0.48328897", "text": "func (recv *gzipResponseWriter) WriteHeader(status int) {\n\tif !recv.wroteHeader {\n\t\trecv.wroteHeader = true\n\t\trecv.w.Header().Set(\"Content-Encoding\", \"gzip\")\n\t}\n\trecv.w.WriteHeader(status)\n}", "title": "" }, { "docid": "77670d61fcd1fbbeb091ce57cb9c815d", "score": "0.48282102", "text": "func (h *Helper) splitSend(header, msg []byte) error {\n\tvar err error\n\tln, lnh := len(msg), len(header)\n\tmsgMax := IRC_MAX_LENGTH - lnh\n\tif ln <= msgMax {\n\t\t_, err = h.Write(append(header, msg...))\n\t\treturn err\n\t}\n\n\tvar size int\n\tbuf := make([]byte, IRC_MAX_LENGTH)\n\tfor ln > 0 {\n\t\tsize = msgMax\n\t\tif ln < msgMax {\n\t\t\tsize = ln\n\t\t}\n\t\tcopy(buf, header)\n\t\tcopy(buf[lnh:], msg[:size])\n\t\t_, err = h.Write(buf[:lnh+size])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmsg = msg[size:]\n\t\tln, lnh = len(msg), len(header)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a0c4846485d766b8550f598a4a1e825e", "score": "0.4822881", "text": "func (rr *responseRecorder) WriteHeader(statusCode int) {\n\trr.statusCode = statusCode\n\trr.ResponseWriter.WriteHeader(statusCode)\n}", "title": "" }, { "docid": "f1b310b69d451156388c452d6ce22a1b", "score": "0.48134312", "text": "func (h Header) writableHeader(name string) error {\n\t// TODO(@mattiasgrenfeldt, @kele, @empijei): Think about how this should\n\t// work during legacy conversions.\n\tif name == \"Set-Cookie\" {\n\t\treturn errors.New(\"can't write to Set-Cookie header\")\n\t}\n\tif h.claimed[name] {\n\t\treturn fmt.Errorf(\"claimed header: %s\", name)\n\t}\n\treturn nil\n}", "title": "" } ]
38a246db0f679f38575e4dc24e3a1906
GetOperator obtains the operator definition with the operand name.
[ { "docid": "6f860adc509853cdd6795f9fa917b785", "score": "0.822018", "text": "func (r *OperandRegistry) GetOperator(operandName string) *Operator {\n\tfor _, o := range r.Spec.Operators {\n\t\tif o.Name == operandName {\n\t\t\treturn &o\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "69348d39ef1d4932853b688bfec65837", "score": "0.81271213", "text": "func GetOperator(literal string) *Operator {\n\n\tif o, ok := operators[literal]; ok {\n\t\treturn o\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "58d7dcd2181a8c894db251f15cb574b9", "score": "0.71992046", "text": "func (_BridgeRegistry *BridgeRegistryCaller) GetOperator(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BridgeRegistry.contract.Call(opts, out, \"getOperator\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f6e65e5967c8b13fbde858094abfe8b4", "score": "0.70629466", "text": "func (a *Arith) GetOperator() string {\n\toperators := []string{\"+\", \"-\", \"*\", \"/\"}\n\treturn operators[rand.Intn(len(operators))]\n}", "title": "" }, { "docid": "8f076eed33346300bad846fd5d2989f8", "score": "0.6986932", "text": "func (_BridgeRegistry *BridgeRegistrySession) GetOperator() (common.Address, error) {\n\treturn _BridgeRegistry.Contract.GetOperator(&_BridgeRegistry.CallOpts)\n}", "title": "" }, { "docid": "9f27a1309a9970d9a58ffc09df3ee4d3", "score": "0.6942791", "text": "func (_BridgeRegistry *BridgeRegistryCallerSession) GetOperator() (common.Address, error) {\n\treturn _BridgeRegistry.Contract.GetOperator(&_BridgeRegistry.CallOpts)\n}", "title": "" }, { "docid": "4d58b46a34d492f21f5f9806eb1ce365", "score": "0.6829283", "text": "func (o *AlertingCustomTextFilter) GetOperator() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Operator\n}", "title": "" }, { "docid": "934f3d5a99a9af52ffefa3ffaef448ec", "score": "0.68242717", "text": "func GetOperator(c *gin.Context) {\n\tvar operator entity.Operator\n\tid := c.Param(\"id\")\n\tif err := entity.DB().Raw(\"SELECT * FROM operators WHERE id = ?\", id).Scan(&operator).Error; err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": operator})\n}", "title": "" }, { "docid": "6fc41e03b5dc0fd9b56ee1465aaa0619", "score": "0.68158275", "text": "func (m *Win32LobAppFileSystemRule) GetOperator()(*Win32LobAppRuleOperator) {\n val, err := m.GetBackingStore().Get(\"operator\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*Win32LobAppRuleOperator)\n }\n return nil\n}", "title": "" }, { "docid": "0de2dc760a7a3c8abdf2a1697a204c25", "score": "0.6756225", "text": "func GetOperator() *OperatorConfig {\n\tif operatorConfigInstance == nil {\n\t\toperatorConfigInstance = &OperatorConfig{}\n\t\terr := env.Parse(operatorConfigInstance)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"error initializing config: %s\", err)\n\t\t}\n\t}\n\treturn operatorConfigInstance\n}", "title": "" }, { "docid": "55936ee6f4fa1eadc570f2bdccbd048a", "score": "0.6752432", "text": "func GetOperatorName() (string, error) {\n\toperatorName, found := os.LookupEnv(constant.OperatorNameEnvVar)\n\tif !found {\n\t\treturn \"\", fmt.Errorf(\"%s must be set\", constant.OperatorNameEnvVar)\n\t}\n\tif len(operatorName) == 0 {\n\t\treturn \"\", fmt.Errorf(\"%s must not be empty\", constant.OperatorNameEnvVar)\n\t}\n\treturn operatorName, nil\n}", "title": "" }, { "docid": "487b88d32eaa61e7a51adfa0ba6e1d46", "score": "0.6690781", "text": "func GetOperatorKind(lexeme string) TokenCode {\n\tif kind, ok := OperatorMap[lexeme]; ok {\n\t\treturn kind\n\t}\n\treturn tcNone\n}", "title": "" }, { "docid": "e8f2d6e4733ee798a8f3cd8191e2c37c", "score": "0.6607065", "text": "func (response NumberLookupResponse) GetOperator() *string {\n\treturn response.operator\n}", "title": "" }, { "docid": "72accf249e5db011293a790e235041aa", "score": "0.6509513", "text": "func getOperator(str *string, prefix *string) string {\n\treturn string((*str)[len((*prefix))])\n}", "title": "" }, { "docid": "313d8d7e2e313b903c73a85779c75f93", "score": "0.64942753", "text": "func ToOperator(s string) (Operator, error) {\n\tswitch s {\n\tcase \"+\": //, \"add\", \"plus\":\n\t\treturn Add, nil\n\tcase \"-\": //, \"sub\", \"minus\":\n\t\treturn Sub, nil\n\t}\n\treturn Undefined, fmt.Errorf(\"%w: '%v'\", ErrUnkownOperator, s)\n}", "title": "" }, { "docid": "cdee211a646c970109db9ecaf6a57bc5", "score": "0.64735615", "text": "func (o ChannelSpecGatesLabelSelectorMatchExpressionsOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ChannelSpecGatesLabelSelectorMatchExpressions) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "db290ef3b79c39a917a20ebfcf4653e6", "score": "0.64645994", "text": "func (o *operator) GetName() string {\n\treturn Operator.Name\n}", "title": "" }, { "docid": "2123d89a5fe48e7a41c0c337818bc2c3", "score": "0.646171", "text": "func (v *BadBinaryInfo) GetOperator() (o string) {\n\tif v != nil {\n\t\treturn v.Operator\n\t}\n\treturn\n}", "title": "" }, { "docid": "5c4540afc2f21fe651861a9dcb047bc2", "score": "0.63971996", "text": "func (o LabelSelectorRequirementPatchOutput) Operator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LabelSelectorRequirementPatch) *string { return v.Operator }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0cd2ec52993ac1c6dc79534cac93dc35", "score": "0.6366426", "text": "func (o DataSourceCustomDocumentEnrichmentConfigurationPostExtractionHookConfigurationInvocationConditionPtrOutput) Operator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DataSourceCustomDocumentEnrichmentConfigurationPostExtractionHookConfigurationInvocationCondition) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Operator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2e05f0cb53478fa5b0abc0df75e29c8f", "score": "0.6364869", "text": "func OperatorName() (string, error) {\n\toperatorName, found := os.LookupEnv(OperatorNameEnvVar)\n\tif !found {\n\t\treturn \"\", fmt.Errorf(\"environment variable %s is not set\", OperatorNameEnvVar)\n\t}\n\tif len(operatorName) == 0 {\n\t\treturn \"\", fmt.Errorf(\"environment variable %s is empty\", OperatorNameEnvVar)\n\t}\n\treturn operatorName, nil\n}", "title": "" }, { "docid": "bbe800a171a1b4abce30b4e8158bc6d5", "score": "0.6337058", "text": "func (o DataSourceCustomDocumentEnrichmentConfigurationPostExtractionHookConfigurationInvocationConditionOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DataSourceCustomDocumentEnrichmentConfigurationPostExtractionHookConfigurationInvocationCondition) string {\n\t\treturn v.Operator\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6484cea257e7ea240e1e47468ae028bb", "score": "0.6289924", "text": "func (o SubscriptionSpecPackageFilterLabelSelectorMatchExpressionsOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SubscriptionSpecPackageFilterLabelSelectorMatchExpressions) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c0a0566eb08d0da23b3dea57e90f2c26", "score": "0.62774277", "text": "func (me *sift) Operator() string {\n\treturn me.operator\n}", "title": "" }, { "docid": "8fb373b868c133b213d2fc7c0bd7c113", "score": "0.6255528", "text": "func (o DataSourceCustomDocumentEnrichmentConfigurationInlineConfigurationConditionPtrOutput) Operator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DataSourceCustomDocumentEnrichmentConfigurationInlineConfigurationCondition) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Operator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "817ef55b429cd04b196205f307c3f056", "score": "0.62530404", "text": "func (m *comparisonBasic) Operator() Enum {\n\treturn m.operatorField\n}", "title": "" }, { "docid": "f1666de4517431e3088e44b635c394b4", "score": "0.6250767", "text": "func (o LabelSelectorRequirementOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LabelSelectorRequirement) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "596ae457a2553377b6a910c28fe09703", "score": "0.6250573", "text": "func (o DataSourceCustomDocumentEnrichmentConfigurationPreExtractionHookConfigurationInvocationConditionPtrOutput) Operator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DataSourceCustomDocumentEnrichmentConfigurationPreExtractionHookConfigurationInvocationCondition) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Operator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a47fe3492fa593a16a5648073ad6f7a7", "score": "0.62496173", "text": "func (s exampleOperatorNamespaceLister) Get(name string) (*v1alpha1.ExampleOperator, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"exampleoperator\"), name)\n\t}\n\treturn obj.(*v1alpha1.ExampleOperator), nil\n}", "title": "" }, { "docid": "557dfb0d92c1606eab8472a228fde127", "score": "0.62327886", "text": "func GetOperatorNamespace() (string, error) {\n\tnsBytes, err := readNamespace()\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn \"\", errors.New(\"cannot find namespace of the operator\")\n\t\t}\n\t\treturn \"\", err\n\t}\n\tns := strings.TrimSpace(string(nsBytes))\n\treturn ns, nil\n}", "title": "" }, { "docid": "bb66397557289351d185d767d63bab20", "score": "0.62029725", "text": "func (o DataSourceCustomDocumentEnrichmentConfigurationPreExtractionHookConfigurationInvocationConditionOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DataSourceCustomDocumentEnrichmentConfigurationPreExtractionHookConfigurationInvocationCondition) string {\n\t\treturn v.Operator\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1e4616054a2d0e27a3e6a852a2d79a39", "score": "0.616338", "text": "func getOperator(condition string) string{\n operators := []string{OPERATOR_NE,\n OPERATOR_LE, OPERATOR_LT,\n OPERATOR_GE, OPERATOR_GT, OPERATOR_EQ}\n\n for _, op := range operators {\n index := strings.Index(condition, op)\n // operator shouldn't be at the head or the tail\n if index > 0 && index < len(condition) - len(op) {\n return op\n }\n }\n \n panic(&ConditionError{\"Unsupported operator of condition [\" + condition + \"].\"})\n}", "title": "" }, { "docid": "9b8a45a69d5e36cfc9438e86c8a2afdc", "score": "0.6162063", "text": "func (o DataSourceCustomDocumentEnrichmentConfigurationInlineConfigurationConditionOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DataSourceCustomDocumentEnrichmentConfigurationInlineConfigurationCondition) string {\n\t\treturn v.Operator\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "95c579dc02a19ac97729cc2edf08e857", "score": "0.6159038", "text": "func GetOperatorType() OperatorType {\n\t// Assuming that if Gopkg.toml exists then this is a Go operator\n\t_, err := os.Stat(gopkgToml)\n\tif err != nil && os.IsNotExist(err) {\n\t\treturn OperatorTypeAnsible\n\t}\n\treturn OperatorTypeGo\n}", "title": "" }, { "docid": "011159429030d463d04d4ebf1b4e252e", "score": "0.61212844", "text": "func (o DeployableSpecPlacementClusterSelectorMatchExpressionsOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DeployableSpecPlacementClusterSelectorMatchExpressions) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c48c321707ac0fceb73e9a0e410dd343", "score": "0.6116642", "text": "func (o *CountDistinctQuery) getOperator() string {\n\tif o.ExceptedResult.Operator == \"\" {\n\t\treturn OPERATOR_EQ\n\t} else {\n\t\treturn o.ExceptedResult.Operator\n\t}\n}", "title": "" }, { "docid": "32e8d4bca80550f98cfbd5190c4b2c8e", "score": "0.61072904", "text": "func (o KeycloakBackupSpecInstanceSelectorMatchExpressionsOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v KeycloakBackupSpecInstanceSelectorMatchExpressions) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5822931efdb4b52e90aecd64772f6243", "score": "0.6104113", "text": "func (o SubscriptionSpecPlacementClusterSelectorMatchExpressionsOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SubscriptionSpecPlacementClusterSelectorMatchExpressions) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c1dbfcfe1171ba6de7458c63a3500107", "score": "0.60844654", "text": "func (o KeycloakRealmSpecInstanceSelectorMatchExpressionsOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v KeycloakRealmSpecInstanceSelectorMatchExpressions) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "06ab34a2d9e41d171fdef9ebb27fdcc0", "score": "0.6084212", "text": "func Calculator_OperatorFromString(c string) Calculator_Operator {\n\tswitch c {\n\tcase \"add\":\n\t\treturn Calculator_Operator_add\n\tcase \"subtract\":\n\t\treturn Calculator_Operator_subtract\n\tcase \"multiply\":\n\t\treturn Calculator_Operator_multiply\n\tcase \"divide\":\n\t\treturn Calculator_Operator_divide\n\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "31b3335f5a2cb4805f70512c1368445e", "score": "0.60751724", "text": "func (o KeycloakClientSpecRealmSelectorMatchExpressionsOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v KeycloakClientSpecRealmSelectorMatchExpressions) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c669ee5fc4d178e70b4c510edc1b2ae4", "score": "0.60640466", "text": "func (o PlacementRuleSpecClusterSelectorMatchExpressionsOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PlacementRuleSpecClusterSelectorMatchExpressions) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2916b03e66b4c7f7c27e8001490b88b7", "score": "0.60409045", "text": "func (Calc) Operator(entrada string, operador string) int {\n\t//Separa un string dado un separador\n\tentradaLimpia := strings.Split(entrada, operador)\n\toperador1 := parsear(entradaLimpia[0])\n\toperador2 := parsear(entradaLimpia[1])\n\n\tswitch operador {\n\tcase \"+\":\n\t\tfmt.Println(operador1 + operador2)\n\t\treturn operador1 + operador2\n\tcase \"-\":\n\t\tfmt.Println(operador1 - operador2)\n\t\treturn operador1 - operador2\n\tcase \"*\":\n\t\tfmt.Println(operador1 * operador2)\n\t\treturn operador1 * operador2\n\tcase \"/\":\n\t\tfmt.Println(operador1 / operador2)\n\t\treturn operador1 / operador2\n\tdefault:\n\t\tfmt.Println(\"Operación no soportada\")\n\t\treturn 0\n\t}\n\n}", "title": "" }, { "docid": "1f37d719ad272d603e3ece8046b43513", "score": "0.6024928", "text": "func (w *Walker) lookupOperator(aop ast.Oper) (*depm.Operator, bool) {\n\t// TODO: local operators\n\n\tif op, ok := w.chFile.Parent.OperatorTable[aop.Kind]; ok {\n\t\treturn op, true\n\t}\n\n\t// TODO: get the operator name?\n\tw.reportError(aop.Pos, \"no defined overloads for operator: `%s`\", aop.Name)\n\treturn nil, false\n}", "title": "" }, { "docid": "d79a4eaf653243764c768a027708caab", "score": "0.6003716", "text": "func GetOp() *Operation {\n\treturn &Operation{OpType: READ, BinValue: NewNullValue()}\n}", "title": "" }, { "docid": "0c48a5be69e0f4b5e9be98caeae676cc", "score": "0.6001357", "text": "func (s aciIstioOperatorNamespaceLister) Get(name string) (*v1.AciIstioOperator, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"aciistiooperator\"), name)\n\t}\n\treturn obj.(*v1.AciIstioOperator), nil\n}", "title": "" }, { "docid": "a792058262c6405f21b0d5d3c3e8c578", "score": "0.6000685", "text": "func (o EnterpriseCrmEventbusProtoConditionResponseOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmEventbusProtoConditionResponse) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "449e730bbb36d0e03ab8bd662c036f63", "score": "0.59607697", "text": "func (o KeycloakUserSpecRealmSelectorMatchExpressionsOutput) Operator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v KeycloakUserSpecRealmSelectorMatchExpressions) string { return v.Operator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "37ba38e4e35b7a3b47e55901456d0a39", "score": "0.593036", "text": "func (o EnterpriseCrmEventbusProtoConditionOutput) Operator() EnterpriseCrmEventbusProtoConditionOperatorPtrOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmEventbusProtoCondition) *EnterpriseCrmEventbusProtoConditionOperator {\n\t\treturn v.Operator\n\t}).(EnterpriseCrmEventbusProtoConditionOperatorPtrOutput)\n}", "title": "" }, { "docid": "63b8e95609f5ebe77f2179e0dba2a5d5", "score": "0.5910305", "text": "func GetOperatorNamespace() (string, error) {\n\tns, found := os.LookupEnv(constant.OperatorNamespaceEnvVar)\n\tif !found {\n\t\tnsBytes, err := ioutil.ReadFile(\"/var/run/secrets/kubernetes.io/serviceaccount/namespace\")\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\treturn \"\", fmt.Errorf(\"namespace not found for current environment\")\n\t\t\t}\n\t\t\treturn \"\", err\n\t\t}\n\t\tns = strings.TrimSpace(string(nsBytes))\n\t}\n\tif len(ns) == 0 {\n\t\treturn \"\", fmt.Errorf(\"operator namespace is empty\")\n\t}\n\tklog.V(1).Info(\"Found namespace: \", ns)\n\treturn ns, nil\n}", "title": "" }, { "docid": "30bff8389d4b431151b11487265b9104", "score": "0.5904379", "text": "func NewOperator() Operator {\n\treturn &operator{}\n}", "title": "" }, { "docid": "efe0895c41e821b37da098b458adae77", "score": "0.5904236", "text": "func (c Condition) Operator() string {\n\treturn c.Sign\n}", "title": "" }, { "docid": "26419736225e7d85eba8d679beeec16a", "score": "0.5874614", "text": "func (r *ReconcilerBase) GetOperatorNamespace() (string, error) {\n\tvar namespaceFilePath = \"/var/run/secrets/kubernetes.io/serviceaccount/namespace\"\n\tb, err := ioutil.ReadFile(namespaceFilePath)\n\tif err != nil {\n\t\tnamespace, ok := os.LookupEnv(\"NAMESPACE\")\n\t\tif !ok {\n\t\t\treturn \"\", errors.New(\"unable to infer namespace in which operator is running\")\n\t\t}\n\t\treturn namespace, nil\n\t}\n\treturn string(b), nil\n}", "title": "" }, { "docid": "3f152870e763e12451619ce968b77771", "score": "0.5848729", "text": "func GetPrefixOp(opname string) (op UnaryOp, present bool) { op, present = prefixOps[opname]; return }", "title": "" }, { "docid": "6007e3d149cdbd152ff880b9ced567fd", "score": "0.58072424", "text": "func MatchOperator(s string) (Operator, error) {\n\toperators := []Operator{OperatorIn, OperatorNotIn, OperatorExists, OperatorExists}\n\tfor _, o := range operators {\n\t\tif string(o) == s {\n\t\t\treturn o, nil\n\t\t}\n\t}\n\n\treturn Operator(\"invalid\"), errors.Errorf(\"operator %q is not valid\", s)\n}", "title": "" }, { "docid": "4417d2cd5b250688e1f7f537aa2e892a", "score": "0.57526934", "text": "func FindOp(op string) postfix.Operator {\n\tfor i := 0; i < len(stOps); i++ {\n\t\tif stOps[i].GetToken() == op {\n\t\t\treturn stOps[i]\n\t\t}\n\t}\n\t//still here? might be a function\n\tif is, fn := postfix.IsFunction(op); is {\n\t\treturn fn\n\t}\n\t//still here? not an operator\n\treturn nil\n}", "title": "" }, { "docid": "7109eb4890efa928a1a7dc41a0072836", "score": "0.56698847", "text": "func GetOperatorNamespace() (string, error) {\n\tif isRunModeLocal() {\n\t\treturn \"\", ErrRunLocal\n\t}\n\tnsBytes, err := ioutil.ReadFile(\"/var/run/secrets/kubernetes.io/serviceaccount/namespace\")\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn \"\", ErrNoNamespace\n\t\t}\n\t\treturn \"\", err\n\t}\n\tns := strings.TrimSpace(string(nsBytes))\n\tlog.V(1).Info(\"Found namespace\", \"Namespace\", ns)\n\treturn ns, nil\n}", "title": "" }, { "docid": "2ddfd5c652a7713c8a525972225155d2", "score": "0.5662423", "text": "func (r *MetricAlarm) ComparisonOperator() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"comparisonOperator\"])\n}", "title": "" }, { "docid": "7cb9ace7c832ebcdb2a524ecf4a1c3de", "score": "0.5659458", "text": "func GetOperatorNamespace() (string, error) {\n\tnsBytes, err := readSAFile()\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn \"\", ErrNoNamespace\n\t\t}\n\t\treturn \"\", err\n\t}\n\tns := strings.TrimSpace(string(nsBytes))\n\treturn ns, nil\n}", "title": "" }, { "docid": "54e6b473094ee9bf3fd362354030b180", "score": "0.56157047", "text": "func (q *MatchQuery) Operator(operator string) *MatchQuery {\n\tq.operator = operator\n\treturn q\n}", "title": "" }, { "docid": "61e2f7b8b6c00159af257d92215f013b", "score": "0.55962217", "text": "func (this *CodeNode) Get_operator_pred() int64 {\n return this.operator_pred\n}", "title": "" }, { "docid": "08d0f1f1d85a0e731b6abf323e4be856", "score": "0.5586045", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementOrStatementStatementSizeConstraintStatementPtrOutput) ComparisonOperator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementOrStatementStatementSizeConstraintStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ComparisonOperator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "725db79d47c01f699705701601a81f59", "score": "0.5573354", "text": "func (_RootChain *RootChainSession) Operator() (common.Address, error) {\n\treturn _RootChain.Contract.Operator(&_RootChain.CallOpts)\n}", "title": "" }, { "docid": "960cfc965ba6511043098459d455ccca", "score": "0.55676764", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementPtrOutput) ComparisonOperator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ComparisonOperator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2d495eaa299c3caddecd8f370a748cba", "score": "0.55673385", "text": "func (m *ODLMOperator) GetOperatorNamespace(installMode, namespace string) string {\n\tif installMode == apiv1alpha1.InstallModeCluster {\n\t\treturn constant.ClusterOperatorNamespace\n\t}\n\treturn namespace\n}", "title": "" }, { "docid": "0e632d3accb63d38795f6fc1802d5e60", "score": "0.5556504", "text": "func (o *JsonPatch) GetOp() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Op\n}", "title": "" }, { "docid": "c73dd3c6ff4941a36ef18128e3f942e0", "score": "0.55474395", "text": "func (o *SIMOp) GetNetworkOperator(ctx context.Context, zone string, id types.ID) ([]*SIMNetworkOperatorConfig, error) {\n\turl, err := buildURL(\"{{.rootURL}}/{{.zone}}/{{.pathSuffix}}/{{.pathName}}/{{.id}}/sim/network_operator_config\", map[string]interface{}{\n\t\t\"rootURL\": SakuraCloudAPIRoot,\n\t\t\"pathSuffix\": o.PathSuffix,\n\t\t\"pathName\": o.PathName,\n\t\t\"zone\": zone,\n\t\t\"id\": id,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar body interface{}\n\n\tdata, err := o.Client.Do(ctx, \"GET\", url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnakedResponse := &simGetNetworkOperatorResponseEnvelope{}\n\tif err := json.Unmarshal(data, nakedResponse); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar payload0 []*SIMNetworkOperatorConfig\n\tfor _, v := range nakedResponse.NetworkOperationConfigs {\n\t\tpayload := &SIMNetworkOperatorConfig{}\n\t\tif err := payload.convertFrom(v); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload0 = append(payload0, payload)\n\t}\n\treturn payload0, nil\n}", "title": "" }, { "docid": "26c497789051bef0bc5099792eae1f0e", "score": "0.55176324", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementSizeConstraintStatementPtrOutput) ComparisonOperator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementSizeConstraintStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ComparisonOperator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b6c1b83020b36f96f4520ca549bafdb2", "score": "0.5489645", "text": "func (_RootChain *RootChainCallerSession) Operator() (common.Address, error) {\n\treturn _RootChain.Contract.Operator(&_RootChain.CallOpts)\n}", "title": "" }, { "docid": "6fd54ce8e1af83d20a5ff7d160d97b10", "score": "0.5483052", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementPtrOutput) ComparisonOperator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ComparisonOperator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3a2a6b2c453c909f9bb0b6e6557b79bc", "score": "0.5469147", "text": "func kapaOperator(operator string) (string, error) {\n\tswitch operator {\n\tcase greaterThan:\n\t\treturn \">\", nil\n\tcase lessThan:\n\t\treturn \"<\", nil\n\tcase lessThanEqual:\n\t\treturn \"<=\", nil\n\tcase greaterThanEqual:\n\t\treturn \">=\", nil\n\tcase equal:\n\t\treturn \"==\", nil\n\tcase notEqual:\n\t\treturn \"!=\", nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"invalid operator: %s is unknown\", operator)\n\t}\n}", "title": "" }, { "docid": "9c65519ae18f793cb74b250bab1fc33e", "score": "0.54675543", "text": "func (_VipnodePool *VipnodePoolSession) Operator() (common.Address, error) {\n\treturn _VipnodePool.Contract.Operator(&_VipnodePool.CallOpts)\n}", "title": "" }, { "docid": "d1f62036da40c85014f2dd322cbc9a03", "score": "0.545285", "text": "func (_BridgeRegistry *BridgeRegistryCaller) Operator(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BridgeRegistry.contract.Call(opts, out, \"operator\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "20ca474adc267456e724493cee133532", "score": "0.5452069", "text": "func (kco *kubeCoreOperator) Name() string {\n\treturn \"Kube Core Operator\"\n}", "title": "" }, { "docid": "b195ba02638549c90196f2199ffc0e34", "score": "0.5447831", "text": "func lexOperator(l *lexer) stateFn {\n matched := operatorRegexp.FindString(l.input[l.pos:])\n l.pos += len(matched)\n l.emit(tokenOperator)\n\n return lexData\n}", "title": "" }, { "docid": "d72653c5c79e6ab15ca637505a072b38", "score": "0.54457426", "text": "func (o *AlertingCustomTextFilter) GetOperatorOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Operator, true\n}", "title": "" }, { "docid": "a51d0361cf5df3d67e3511c0c3453889", "score": "0.54367584", "text": "func (d *dbBaseDm) OperatorSQL(operator string) string {\n\treturn dmOperators[operator]\n}", "title": "" }, { "docid": "b23e4be3951eb6af587f0d104d5ce8bf", "score": "0.5428227", "text": "func (mao *machineAPIOperator) Name() string {\n\treturn \"Machine API Operator\"\n}", "title": "" }, { "docid": "96b7f6612407f2cfe0a386bc0cab8eaf", "score": "0.54270625", "text": "func compareOperator(o1, o2 string) int {\n\t// + - * /\n\tvar o1Priority int\n\tif o1 == \"+\" || o1 == \"-\" {\n\t\to1Priority = 1\n\t} else {\n\t\to1Priority = 2\n\t}\n\tvar o2Priority int\n\tif o2 == \"+\" || o2 == \"-\" {\n\t\to2Priority = 1\n\t} else {\n\t\to2Priority = 2\n\t}\n\tif o1Priority > o2Priority {\n\t\treturn 1\n\t} else if o1Priority == o2Priority {\n\t\treturn 0\n\t} else {\n\t\treturn -1\n\t}\n}", "title": "" }, { "docid": "7343533a95f3d8889504b1a514f8da49", "score": "0.5423503", "text": "func (q *MatchQuery) Operator(operator MatchOperator) *MatchQuery {\n\t// q.options[\"operator\"] = string(operator)\n\tq.operator = &operator\n\treturn q\n}", "title": "" }, { "docid": "fb139322c112c627750e4cf05a3acfeb", "score": "0.54169554", "text": "func (_VipnodePool *VipnodePoolCallerSession) Operator() (common.Address, error) {\n\treturn _VipnodePool.Contract.Operator(&_VipnodePool.CallOpts)\n}", "title": "" }, { "docid": "7f351ff5e5a65a4e4e520cec22b57824", "score": "0.54027057", "text": "func GetOperatorDockerImage() string {\n\treturn operatorDockerImage\n}", "title": "" }, { "docid": "0f83ad6e697f5128bbf0467432dcc6a9", "score": "0.5400921", "text": "func IsOperator(literal string) bool {\n\n\tif _, ok := operators[literal]; ok {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b24e03b7efb948d8e8d7ce0d605a091d", "score": "0.53980756", "text": "func getConditionMethod(cond *Condition, op DomainPrefixOperator) func(string, string, interface{}) *Condition {\n\tswitch op {\n\tcase PREFIX_AND:\n\t\treturn cond.And\n\tcase PREFIX_OR:\n\t\treturn cond.Or\n\tdefault:\n\t\ttools.LogAndPanic(log, \"Unknown prefix operator\", \"operator\", op)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2914201574522d97c9de3df64a5de3d3", "score": "0.53785586", "text": "func (_BridgeRegistry *BridgeRegistryCallerSession) Operator() (common.Address, error) {\n\treturn _BridgeRegistry.Contract.Operator(&_BridgeRegistry.CallOpts)\n}", "title": "" }, { "docid": "4b5d277f81e678c6f4213b7ac34aeda4", "score": "0.53731304", "text": "func (_VipnodePool *VipnodePoolCaller) Operator(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _VipnodePool.contract.Call(opts, out, \"operator\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "23a4c0b6571b3ad4b44466b1d07b1a5b", "score": "0.5360397", "text": "func (o *SIMOp) GetNetworkOperator(ctx context.Context, id types.ID) ([]*SIMNetworkOperatorConfig, error) {\n\t// build request URL\n\tpathBuildParameter := map[string]interface{}{\n\t\t\"rootURL\": SakuraCloudAPIRoot,\n\t\t\"pathSuffix\": o.PathSuffix,\n\t\t\"pathName\": o.PathName,\n\t\t\"zone\": APIDefaultZone,\n\t\t\"id\": id,\n\t}\n\n\turl, err := buildURL(\"{{.rootURL}}/{{.zone}}/{{.pathSuffix}}/{{.pathName}}/{{.id}}/sim/network_operator_config\", pathBuildParameter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// build request body\n\tvar body interface{}\n\n\t// do request\n\tdata, err := o.Client.Do(ctx, \"GET\", url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// build results\n\tresults, err := o.transformGetNetworkOperatorResults(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn results.Configs, nil\n}", "title": "" }, { "docid": "7b1e7d3db12cf08fc9517f563c00725f", "score": "0.5359889", "text": "func (o WebAclRuleStatementOrStatementStatementAndStatementStatementOrStatementStatementSizeConstraintStatementPtrOutput) ComparisonOperator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementOrStatementStatementAndStatementStatementOrStatementStatementSizeConstraintStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ComparisonOperator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e4ba90f8963964d61516a0b7be6a728d", "score": "0.53368425", "text": "func (gce *GCEClient) getOp(c *gceconfig.GCEProviderConfig, op *compute.Operation) (*compute.Operation, error) {\n\treturn gce.service.ZoneOperations.Get(c.Project, path.Base(op.Zone), op.Name).Do()\n}", "title": "" }, { "docid": "d62e298b158751208269243fb99cca9e", "score": "0.5332708", "text": "func (m *ODLMOperator) GetOperandRegistry(ctx context.Context, key types.NamespacedName) (*apiv1alpha1.OperandRegistry, error) {\n\treg := &apiv1alpha1.OperandRegistry{}\n\tif err := m.Client.Get(ctx, key, reg); err != nil {\n\t\treturn nil, err\n\t}\n\tfor i, o := range reg.Spec.Operators {\n\t\tif o.Scope == \"\" {\n\t\t\treg.Spec.Operators[i].Scope = apiv1alpha1.ScopePrivate\n\t\t}\n\t\tif o.InstallMode == \"\" {\n\t\t\treg.Spec.Operators[i].InstallMode = apiv1alpha1.InstallModeNamespace\n\t\t}\n\t\tif o.InstallPlanApproval == \"\" {\n\t\t\treg.Spec.Operators[i].InstallPlanApproval = olmv1alpha1.ApprovalAutomatic\n\t\t}\n\t\tif o.SourceName == \"\" || o.SourceNamespace == \"\" {\n\t\t\tcatalogSourceName, catalogSourceNs, err := m.GetCatalogSourceFromPackage(ctx, o.PackageName, o.Namespace, o.Channel, key.Namespace)\n\t\t\tif err != nil {\n\t\t\t\treturn reg, err\n\t\t\t}\n\n\t\t\tif catalogSourceName == \"\" || catalogSourceNs == \"\" {\n\t\t\t\tklog.Warningf(\"no catalogsource found for %v\", o.PackageName)\n\t\t\t}\n\n\t\t\treg.Spec.Operators[i].SourceName, reg.Spec.Operators[i].SourceNamespace = catalogSourceName, catalogSourceNs\n\t\t}\n\t}\n\treturn reg, nil\n}", "title": "" }, { "docid": "87d063a0eb1b4ef886417c5e02709d9d", "score": "0.5332616", "text": "func (o AlarmOutput) ComparisonOperator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Alarm) pulumi.StringOutput { return v.ComparisonOperator }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4e783dbceb6ef4ac15eb49d4cdd15c52", "score": "0.5326442", "text": "func (o WebAclRuleStatementOrStatementStatementAndStatementStatementNotStatementStatementSizeConstraintStatementPtrOutput) ComparisonOperator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementOrStatementStatementAndStatementStatementNotStatementStatementSizeConstraintStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ComparisonOperator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "05708daf8f6c39d553642de2a3111034", "score": "0.5323585", "text": "func Op(customOperator string, value interface{}) *Comparison {\n\treturn &Comparison{adapter.NewCustomComparisonOperator(customOperator, value)}\n}", "title": "" }, { "docid": "16cbc5ee798cc518a5f30f4b4ba4a1c9", "score": "0.53156596", "text": "func getNumberOperator(input string) string {\n\tstr := strings.TrimSpace(input)\n\t// the order of operators in the range matters\n\tfor _, op := range []string{\">=\", \"<=\", \"<>\", \"=\", \">\", \"<\"} {\n\t\tif strings.HasPrefix(str, op) {\n\t\t\treturn op // the first match\n\t\t}\n\t}\n\treturn \"=\"\n}", "title": "" }, { "docid": "3d1910a6cdbbd77469ac1099aadc0862", "score": "0.53131163", "text": "func (o *operator) GetMonitoredOperator() *models.MonitoredOperator {\n\treturn &Operator\n}", "title": "" }, { "docid": "0b2709b16c90c41084600b49edd8a3a3", "score": "0.5309679", "text": "func (o WebAclRuleStatementOrStatementStatementNotStatementStatementAndStatementStatementSizeConstraintStatementPtrOutput) ComparisonOperator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementOrStatementStatementNotStatementStatementAndStatementStatementSizeConstraintStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ComparisonOperator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f055507399a909db92ef676406daf840", "score": "0.53078365", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementOrStatementStatementSizeConstraintStatementOutput) ComparisonOperator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementOrStatementStatementSizeConstraintStatement) string {\n\t\treturn v.ComparisonOperator\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "55f1b93091cc297da1f050850eaa6c95", "score": "0.5301996", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementOutput) ComparisonOperator() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatement) string {\n\t\treturn v.ComparisonOperator\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2981b2e409be769542c91a6607bb3b3e", "score": "0.5296519", "text": "func (p *Transformer) findOperator(operators []operator.Operator, operatorID string) (operator.Operator, error) {\n\tfor _, operator := range operators {\n\t\tif operator.ID() == operatorID {\n\t\t\treturn operator, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"operator %s does not exist\", operatorID)\n}", "title": "" }, { "docid": "39ea945500c57312b18177139e328da1", "score": "0.52951926", "text": "func (_BridgeRegistry *BridgeRegistrySession) Operator() (common.Address, error) {\n\treturn _BridgeRegistry.Contract.Operator(&_BridgeRegistry.CallOpts)\n}", "title": "" }, { "docid": "64b56ffa58119b6e9113b99a4047c2f4", "score": "0.52897966", "text": "func (o WebAclRuleStatementOrStatementStatementAndStatementStatementSizeConstraintStatementPtrOutput) ComparisonOperator() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementOrStatementStatementAndStatementStatementSizeConstraintStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ComparisonOperator\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" } ]
6699963a15f1322072772b93131957ba
TrimRight returns a slice of the string s, with all leading and trailing white space removed from right, as defined by Unicode.
[ { "docid": "1a546320288150b182723aff32734de0", "score": "0.8393976", "text": "func TrimRight(s string) string {\n\tif len(s) > 0 {\n\t\treturn str.TrimRightFunc(s, unicode.IsSpace)\n\t}\n\treturn s\n}", "title": "" } ]
[ { "docid": "c3544751fd1bbb75b13cbd6931e5fa3b", "score": "0.804866", "text": "func TrimRight(s string, cutset byte) string {\n\tlenStr := len(s)\n\tfor lenStr > 0 && s[lenStr-1] == cutset {\n\t\tlenStr--\n\t}\n\treturn s[:lenStr]\n}", "title": "" }, { "docid": "f9e0dd15eb47068669bf1337d2ae14a6", "score": "0.7802229", "text": "func (ns *Namespace) TrimRight(cutset, s any) (string, error) {\n\tss, err := cast.ToStringE(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsc, err := cast.ToStringE(cutset)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn strings.TrimRight(ss, sc), nil\n}", "title": "" }, { "docid": "c37596543fbde1605e8144037b084999", "score": "0.77504706", "text": "func trimRightSpace(s string) string {\n\treturn strings.TrimRightFunc(s, unicode.IsSpace)\n}", "title": "" }, { "docid": "063b133a11dd376c6f16374773f14402", "score": "0.69822425", "text": "func RightTrim(value string) string {\r\n\treturn strings.TrimRight(value, \" \")\r\n}", "title": "" }, { "docid": "5a6f1d1b8aa80a8e445c35f8095e0af4", "score": "0.68880385", "text": "func RemoveRight(s, substr string, caseSensitive bool) string {\n\tif EndsWith(s, substr, caseSensitive) {\n\t\treturn SubstrLen(s, 0, Length(s)-Length(substr))\n\t}\n\treturn s\n}", "title": "" }, { "docid": "1a19a2fd1359845bafa54ef2aa4c07da", "score": "0.68312335", "text": "func (s *TypeString) TrimRight(cutset string) *TypeString {\n\treturn s.Update(strings.TrimRight(s.Obj, cutset))\n}", "title": "" }, { "docid": "5fa2933d7da1a48259d714400f6c40ac", "score": "0.6734923", "text": "func stringTrimRight(args ...DataType) (DataType, error) {\n\tif len(args) != 2 {\n\t\treturn nil, fmt.Errorf(\"String.trimRight expects exactly 2 arguments\")\n\t}\n\n\tif args[0].Type() != STRING_TYPE {\n\t\treturn nil, fmt.Errorf(\"String.trimRight expects a String\")\n\t}\n\n\tif args[1].Type() != STRING_TYPE {\n\t\treturn nil, fmt.Errorf(\"String.trimRight expects a String as subset\")\n\t}\n\n\tobject := args[0].(*StringType).Value\n\tsubset := args[1].(*StringType).Value\n\n\treturn &StringType{Value: strings.TrimRight(object, subset)}, nil\n}", "title": "" }, { "docid": "0a0371370db28b8c74555ce9e5f934b5", "score": "0.6590788", "text": "func Rtrim(str string, chars ...string) string {\n\tif len(chars) == 0 {\n\t\treturn strings.TrimRightFunc(str, unicode.IsSpace)\n\t}\n\tvar cutset = \"\"\n\tfor _, c := range chars {\n\t\tcutset += c\n\t}\n\treturn strings.TrimRight(str, cutset)\n}", "title": "" }, { "docid": "7607949241beca017af95d733bf4acfc", "score": "0.6284421", "text": "func Right(str string, len int, pad string) string {\n\treturn str + times(pad, len-utf8.RuneCountInString(str))\n}", "title": "" }, { "docid": "e9e7b9d67e7184097e889dd00a78fad6", "score": "0.62166286", "text": "func TrimString(s string) string", "title": "" }, { "docid": "55d5e2e0dfd0a12f6d789f3795f52b16", "score": "0.6185906", "text": "func RightJustify(s string, w int) string {\n\tsw := len(s)\n\tdiff := w - sw\n\tif diff > 0 {\n\t\ts = strings.Repeat(\" \", diff) + s\n\t} else if diff < 0 {\n\t\ts = s[:w]\n\t}\n\treturn s\n}", "title": "" }, { "docid": "abfeeda9c9c0dd9593b7ceedf426c7f7", "score": "0.6078007", "text": "func PadRight(s string, l int) string {\n\treturn PadRightWith(s, l, \" \")\n}", "title": "" }, { "docid": "ba8a8c1c372b4a650f85c31dc13d0ea4", "score": "0.6063002", "text": "func Right(str string, length int, pad string) string {\n\treturn str + times(pad, length-len(str))\n}", "title": "" }, { "docid": "54417542d79bea661152905f6ecfd303", "score": "0.602592", "text": "func (s *StringProc) PaddingRight(str string, fill string, mx int) string {\n\treturn s.Padding(str, fill, PadRight, mx)\n}", "title": "" }, { "docid": "51ec59da49a8a5971dc15b4461195660", "score": "0.600315", "text": "func RemoveRight(value string, suffix string) string {\r\n\treturn RemoveRightWithCase(value, suffix, true)\r\n}", "title": "" }, { "docid": "04d99626582a8ec19d921714dc376caf", "score": "0.59989744", "text": "func runesTrimRightSpace(text []rune) []rune {\n\tj := len(text)\n\tfor j > 0 && unicode.IsSpace(text[j-1]) {\n\t\tj--\n\t}\n\treturn text[:j]\n}", "title": "" }, { "docid": "832eb51ae9992db5552a15914265f78e", "score": "0.5992603", "text": "func PaddingRight(s, pad string, length int) string {\n\tstrLen := Length(s)\n\tif length < 0 || length <= strLen {\n\t\treturn s\n\t}\n\treturn SurroundPad(s, pad, 0, length-strLen)\n}", "title": "" }, { "docid": "554b3be31bbc71aa93f4210d4f6727d9", "score": "0.59164584", "text": "func EnsureRight(s, substr string, caseSensitive bool) string {\n\tif !EndsWith(s, substr, caseSensitive) {\n\t\treturn s + substr\n\t}\n\treturn s\n}", "title": "" }, { "docid": "f224afd5b90eec19b7ab34e4e5ac642e", "score": "0.5908197", "text": "func PadRight(str string, length int, pad string) string {\n\tl := len(str)\n\n\tif l >= length || pad == \"\" {\n\t\treturn str\n\t}\n\n\tremains := length - l\n\tpadLen := len(pad)\n\n\toutput := &bytes.Buffer{}\n\toutput.Grow(len(str) + (remains/padLen+1)*len(pad))\n\twritePadString(output, pad, padLen, remains)\n\toutput.WriteString(str)\n\treturn output.String()\n}", "title": "" }, { "docid": "2c9f6bedd4132fd457c5dc1afdecb070", "score": "0.5770296", "text": "func PadRight(str string, length int, pad string) string {\n\treturn str + padTimes(pad, length-len(str))\n}", "title": "" }, { "docid": "b9b136436c2f1c7ae45f0dc92f295b48", "score": "0.5736685", "text": "func Trim(s string, cutset byte) string {\n\ti, j := 0, len(s)-1\n\tfor ; i <= j; i++ {\n\t\tif s[i] != cutset {\n\t\t\tbreak\n\t\t}\n\t}\n\tfor ; i < j; j-- {\n\t\tif s[j] != cutset {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn s[i : j+1]\n}", "title": "" }, { "docid": "1bfffe6058cef68fc0117b95070924f7", "score": "0.5731716", "text": "func trim(s string) string {\n\treturn strings.TrimFunc(s, isSpace)\n}", "title": "" }, { "docid": "02f4617354419154b560ca71da6c35a5", "score": "0.57094836", "text": "func rightPad(s string, length int, pad string) string {\n\tif len(s) >= length {\n\t\treturn s\n\t}\n\tpadding := strings.Repeat(pad, length-len(s))\n\treturn s + padding\n}", "title": "" }, { "docid": "2717a3300c4e16691dad7b843c057f41", "score": "0.56692904", "text": "func (ns *Namespace) Trim(s, cutset any) (string, error) {\n\tss, err := cast.ToStringE(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsc, err := cast.ToStringE(cutset)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn strings.Trim(ss, sc), nil\n}", "title": "" }, { "docid": "cf95e9fdb105f57df2a485dec73e917a", "score": "0.5640352", "text": "func Trim(s string) string {\n\treturn strings.Trim(s, Chars)\n}", "title": "" }, { "docid": "2a8c237f17f996dd55442e5bba1ddbe9", "score": "0.55781585", "text": "func TrimLeft(s string, cutset byte) string {\n\tlenStr, start := len(s), 0\n\tfor start < lenStr && s[start] == cutset {\n\t\tstart++\n\t}\n\treturn s[start:]\n}", "title": "" }, { "docid": "01c189e2fe8bb981db038cd31f29dda5", "score": "0.5559236", "text": "func PadRight(s string, padChar rune, length int) string {\n\tdiff := length - len([]rune(s))\n\tif diff <= 0 {\n\t\treturn s\n\t}\n\treturn s + strings.Repeat(string(padChar), diff)\n}", "title": "" }, { "docid": "aad4a6172641324b131fffd4d73d335a", "score": "0.555105", "text": "func TrimLeft(s string) string {\n\tif len(s) > 0 {\n\t\treturn str.TrimLeftFunc(s, unicode.IsSpace)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "716388326902549acbce70d0a08f30c9", "score": "0.5547116", "text": "func stripTrailingSpace(str string) string {\n\tbuf := bytes.NewBuffer(nil)\n\n\tscan := bufio.NewScanner(strings.NewReader(str))\n\tfor scan.Scan() {\n\t\tbuf.WriteString(strings.TrimRight(scan.Text(), \" \\t\\r\\n\"))\n\t\tbuf.WriteString(\"\\n\")\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "143c6af7892573a90d05f5f3ed9037ca", "score": "0.5537047", "text": "func removeRight(s string, last_j int, ans []string) []string {\n\tleft := 0\n\t// do not need to count i from 0, because duplicate work has been done\n\t// previous part has been validated\n\tfor i, c := range s {\n\t\tif c == '(' {\n\t\t\tleft++\n\t\t} else if c == ')' {\n\t\t\tleft--\n\t\t}\n\t\tif left >= 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor j := last_j; j <= i; j++ {\n\t\t\t// s[j-1] != ')' is necessary to remove duplcates\n\t\t\tif s[j] == ')' && (j == last_j || s[j-1] != ')') {\n\t\t\t\ts1 := s[0:j] + s[j+1:]\n\t\t\t\t// no need to pass in j-1, since a ')' already removed\n\t\t\t\tans = removeRight(s1, j, ans)\n\t\t\t}\n\t\t}\n\t\treturn ans\n\t}\n\tans = append(ans, s)\n\treturn ans\n}", "title": "" }, { "docid": "5b42c7425c57a90f62a82e0b82a93fb9", "score": "0.55345297", "text": "func TruncLeft(s string, w int, head string) string {\n\tif runewidth.StringWidth(s) <= w {\n\t\treturn s\n\t}\n\tr := []rune(s)\n\ttw := runewidth.StringWidth(head)\n\tw -= tw\n\twidth := 0\n\ti := len(r) - 1\n\tfor ; i >= 0; i-- {\n\t\tcw := runewidth.RuneWidth(r[i])\n\t\tif width+cw > w {\n\t\t\tbreak\n\t\t}\n\t\twidth += cw\n\t}\n\treturn head + string(r[i+1:])\n}", "title": "" }, { "docid": "a32f7c27624714448ecbb9fb7b8212b9", "score": "0.5517946", "text": "func clean(s string) string {\n\treturn strings.TrimRight(strings.TrimLeft(s, trimChars), trimChars)\n}", "title": "" }, { "docid": "60c13228e4b43d06a6f7bfc9707d6173", "score": "0.55095154", "text": "func (ns *Namespace) TrimLeft(cutset, s any) (string, error) {\n\tss, err := cast.ToStringE(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsc, err := cast.ToStringE(cutset)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn strings.TrimLeft(ss, sc), nil\n}", "title": "" }, { "docid": "50d2bd854d53358eb40fa9592089b845", "score": "0.5458844", "text": "func Trim(str string) string {\n\treturn strings.Map(func(r rune) rune {\n\t\tif unicode.IsSpace(r) {\n\n\t\t\treturn -1\n\t\t}\n\t\treturn r\n\t}, str)\n}", "title": "" }, { "docid": "3132dd838f86e2769714db4bad8b30f2", "score": "0.54215825", "text": "func trimChar(s string, r byte) string {\n\tsz := len(s)\n\n\tif sz > 0 && s[sz-1] == r {\n\t\ts = s[:sz-1]\n\t}\n\tsz = len(s)\n\tif sz > 0 && s[0] == r {\n\t\ts = s[1:sz]\n\t}\n\treturn s\n}", "title": "" }, { "docid": "913670699435b0ce389ee9149b184c11", "score": "0.5401754", "text": "func trimSlice(s []uint64, fn func(uint64) bool) []uint64 {\n\tn := 0\n\tfor i, v := range s {\n\t\tif fn(v) {\n\t\t\tcontinue\n\t\t} else {\n\t\t\ts[n] = s[i]\n\t\t\tn++\n\t\t}\n\t}\n\treturn s[:n]\n}", "title": "" }, { "docid": "47f8a28dd936517024bf008106b52d06", "score": "0.5327799", "text": "func RemoveRightWithCase(value string, suffix string, caseSensitive bool) string {\r\n\tresult := value\r\n\tends := EndsWithCase(value, suffix, caseSensitive)\r\n\tif ends {\r\n\t\t_value := strings.ToLower(value)\r\n\t\t_suffix := strings.ToLower(suffix)\r\n\t\t_index := LastIndexOf(_value, _suffix)\r\n\t\tresult = _value[0:_index]\r\n\t}\r\n\treturn result\r\n}", "title": "" }, { "docid": "1a78adcb89efb096a5db0758b57db429", "score": "0.53251344", "text": "func trim(s []byte) []byte {\n\tt := bytes.TrimSpace(s)\n\tif t == nil {\n\t\treturn s[0:0]\n\t}\n\treturn t\n}", "title": "" }, { "docid": "6b11d4b12f3667ddd7611767b032a0f1", "score": "0.5320032", "text": "func RuTrimmer(str string, slice []string) string{\n\n\tfor _, substr := range slice {\n\t\tif strings.Contains(str, substr) {\n\t\t\tvalue := strings.TrimPrefix(str, substr)\n\t\t\treturn strings.TrimPrefix(value, \" \")\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "3fbf8c07dec348aac283256a8562210d", "score": "0.530222", "text": "func Trim(str string, maxLen int) string {\n\tif maxLen <= 0 {\n\t\treturn \"\"\n\t}\n\n\tvar out strings.Builder\n\tout.Grow(maxLen)\n\n\toutLen, eSeq := 0, escSeq{}\n\tfor _, sChr := range str {\n\t\tif eSeq.isIn {\n\t\t\teSeq.InspectRune(sChr)\n\t\t\tout.WriteRune(sChr)\n\t\t\tcontinue\n\t\t}\n\t\teSeq.InspectRune(sChr)\n\t\tif eSeq.isIn {\n\t\t\tout.WriteRune(sChr)\n\t\t\tcontinue\n\t\t}\n\t\tif outLen < maxLen {\n\t\t\toutLen++\n\t\t\tout.WriteRune(sChr)\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn out.String()\n}", "title": "" }, { "docid": "3c3dd2368402b1906a9e50bc2a19b876", "score": "0.53009725", "text": "func (a *StrArray) PopRight() string {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\tindex := len(a.Array) - 1\n\tvalue := a.Array[index]\n\ta.Array = a.Array[:index]\n\treturn value\n}", "title": "" }, { "docid": "8d6283d8dba0f86ea95105c058a1a2ca", "score": "0.5287466", "text": "func RightPad(value string, pad string, length int) string {\r\n\tif len(value) > length {\r\n\t\treturn value\r\n\t}\r\n\tmySlice1 := make([]string, 0)\r\n\tmySlice1 = append(mySlice1, value)\r\n\tresult := append(mySlice1, Repeat(pad, length-len(value)))\r\n\treturn strings.Join(result, \"\")\r\n}", "title": "" }, { "docid": "1c42106339ba93daa886fcf48205dd06", "score": "0.52474433", "text": "func trimSpace(x []byte) []byte {\n\tfor len(x) > 0 && isSpace(x[0]) {\n\t\tx = x[1:]\n\t}\n\tfor len(x) > 0 && isSpace(x[len(x)-1]) {\n\t\tx = x[:len(x)-1]\n\t}\n\treturn x\n}", "title": "" }, { "docid": "1d266785da3e21069ab2624f86f99257", "score": "0.5239119", "text": "func TestParserBuf_TrimSpaceRight(t *testing.T) {\n\tbuf := newParserBuf([]byte(\" \"))\n\tbuf.trimBytesLeft(2)\n\tbuf.trimSpaceRight()\n\tif buf.location.Column != 2 || len(buf.bytes) != 0 {\n\t\tt.Errorf(\"column = %d, len = %d\", buf.location.Column, len(buf.bytes))\n\t}\n}", "title": "" }, { "docid": "db03ed2f22388007986d5430a8b3bcf5", "score": "0.52317464", "text": "func TrimEnd(value string, chars string) string {\r\n\treturn strings.TrimRight(value, chars)\r\n}", "title": "" }, { "docid": "256d0d957fe156072414883cd9ee355a", "score": "0.519333", "text": "func (opsMsg *OpsMsgDto) strRightJustify(strToJustify string, fieldLen int) (string, error) {\n\n\tstrLen := len(strToJustify)\n\n\tif fieldLen == strLen {\n\t\treturn strToJustify, nil\n\t}\n\n\tif fieldLen < strLen {\n\t\treturn strToJustify, fmt.Errorf(\"Length of string to right justify is '%v'. 'fieldLen' is less. 'fieldLen'= '%v'\", strLen, fieldLen)\n\t}\n\n\t// fieldLen must be greater than strLen\n\tlefPadCnt := fieldLen - strLen\n\n\tleftPadStr := strings.Repeat(\" \", lefPadCnt)\n\n\n\n\treturn leftPadStr + strToJustify, nil\n}", "title": "" }, { "docid": "67ef8ccf33d67ed687004277e2245bb3", "score": "0.5175683", "text": "func PadRightWith(s string, l int, p string) string {\n\tn := len(s) - l\n\tif n <= 0 {\n\t\treturn s\n\t}\n\treturn s + strings.Repeat(p, n)\n}", "title": "" }, { "docid": "38ddf0c9a9cc965e659b6e8cc0b740a7", "score": "0.51581985", "text": "func unpad(s string) string {\n\treturn strings.TrimRight(s, \"=\")\n}", "title": "" }, { "docid": "16ca9b315d1da1c8528a88c074ba9b35", "score": "0.515444", "text": "func Trim(s string, cutset ...string) string {\n\tif len(cutset) == 0 {\n\t\treturn strings.TrimSpace(s)\n\t}\n\treturn strings.Trim(s, cutset[0])\n}", "title": "" }, { "docid": "5b64d4c7bc06cc569ade604e3594ccc6", "score": "0.5144272", "text": "func Ltrim(str string, chars ...string) string {\n\tif len(chars) == 0 {\n\t\treturn strings.TrimLeftFunc(str, unicode.IsSpace)\n\t}\n\tvar cutset = \"\"\n\tfor _, c := range chars {\n\t\tcutset += c\n\t}\n\treturn strings.TrimLeft(str, cutset)\n}", "title": "" }, { "docid": "6ad89b3f4742cc2ccfbc159a1d11e1f7", "score": "0.513435", "text": "func (s String) Trim() String {\n\tif !s.IsPresent() {\n\t\treturn s\n\t}\n\n\treturn OfString(strings.TrimSpace(s.value))\n}", "title": "" }, { "docid": "a57c976350cfd391e4010efee799bc9a", "score": "0.51114213", "text": "func (b *StrBuf) Right() {\n\tif b.Pos < len(b.Buf) {\n\t\tb.Pos = b.Pos + 1\n\t\tb.Draw()\n\t}\n}", "title": "" }, { "docid": "adc4fda21359122adfe51aebe3b98718", "score": "0.51063037", "text": "func TrimWhitespace(b []byte) []byte {\n\tn := len(b)\n\tstart := n\n\tfor i := 0; i < n; i++ {\n\t\tif !IsWhitespace(b[i]) {\n\t\t\tstart = i\n\t\t\tbreak\n\t\t}\n\t}\n\tend := n\n\tfor i := n - 1; i >= start; i-- {\n\t\tif !IsWhitespace(b[i]) {\n\t\t\tend = i + 1\n\t\t\tbreak\n\t\t}\n\t}\n\treturn b[start:end]\n}", "title": "" }, { "docid": "fb03d1b918a8bfaecd4ff7b6b960e76d", "score": "0.5089402", "text": "func Truncate(s string, limit int) string {\n\tvar ts strings.Builder\n\tvar l int\n\tvar sgr ansi.Sequence\n\n\t_ = ansi.WalkString(s, func(advance int, c rune, esc string) error {\n\t\tif c > -1 {\n\t\t\tts.WriteRune(c)\n\t\t\tl += Runewidth(c)\n\t\t}\n\n\t\tif len(esc) > 0 {\n\t\t\tts.WriteString(esc)\n\t\t\tsgr.Combine(esc)\n\t\t}\n\n\t\tif l >= limit {\n\t\t\treturn ansi.ErrStopWalk\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tts.WriteString(sgr.Off())\n\treturn ts.String()\n}", "title": "" }, { "docid": "5ffac9b0eba26c9f9894a62b19ccaef6", "score": "0.5083592", "text": "func trim(s string) string {\n\treturn strings.TrimSpace(s)\n}", "title": "" }, { "docid": "6ed83bc742cf7a381e3288fc48d88794", "score": "0.507186", "text": "func UnshiftRuneSlice(rx []rune, shifter int) []rune {\n\tvar nrx []rune\n\n\tfor _, r := range rx {\n\t\trint := int(r)\n\t\tsftrOp := rint - shifter\n\n\t\tif sftrOp >= 0 {\n\t\t\tnrc := rune(sftrOp)\n\t\t\tnrx = append(nrx, nrc)\n\t\t} else {\n\t\t\tnewSftrOp := LIMITER + sftrOp\n\t\t\tnrc := rune(newSftrOp)\n\t\t\tnrx = append(nrx, nrc)\n\t\t}\n\t}\n\n\treturn nrx\n}", "title": "" }, { "docid": "d3e34be1286a20f497520855bf6875e6", "score": "0.5060351", "text": "func TrimStr(s string, n int) string {\n\tif n == 0 {\n\t\treturn s\n\t}\n\tif len(s) >= n {\n\t\ts = s[0:n] + \"...\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "52aa1e26b32aad5fb6988562260c599a", "score": "0.505584", "text": "func TrimString(s string) string {\n\tfor len(s) > 0 && isASCIISpace(s[0]) {\n\t\ts = s[1:]\n\t}\n\tfor len(s) > 0 && isASCIISpace(s[len(s)-1]) {\n\t\ts = s[:len(s)-1]\n\t}\n\treturn s\n}", "title": "" }, { "docid": "5327b8c7494ba401fdc63825b0b3d988", "score": "0.50374305", "text": "func trimHTTPSChar(s string, r byte) string {\n\tsz := len(s)\n\n\tif sz > 0 && s[sz-1] == r {\n\t\ts = s[:sz-1]\n\t}\n\tsz = len(s)\n\tif sz > 0 && s[0] == r {\n\t\ts = s[1:sz]\n\t}\n\treturn s\n}", "title": "" }, { "docid": "14dca9ec35fd18baa00c5933971657d6", "score": "0.50251", "text": "func reverseWords(s string) string {\n\tlength := len(s)\n\n\tif length <= 1 {\n\t\treturn s\n\t}\n\n\tindex := 0\n\tres := make([]byte, 0)\n\tfor index < length {\n\t\tstart := index\n\t\tfor index < length && s[index] != ' ' {\n\t\t\tindex++\n\t\t}\n\n\t\tfor j := start; j < index; j++ {\n\t\t\tres = append(res, s[start+index-j-1])\n\t\t}\n\n\t\tif index < length && s[index] == ' ' {\n\t\t\tindex++\n\t\t\tres = append(res, ' ')\n\t\t}\n\t}\n\treturn string(res)\n}", "title": "" }, { "docid": "80f9f2061a71d408d3dfd5f2c9637198", "score": "0.5007838", "text": "func (s *StringSlice) RemoveRange(from, to int) {\n\tif to <= from {\n\t\treturn\n\t} // if\n\n\tcopy((*s)[from:], (*s)[to:])\n\tn := len(*s)\n\tl := n - to + from\n\tfor i := l; i < n; i++ {\n\t\t(*s)[i] = \"\"\n\t} // for i\n\t*s = (*s)[:l]\n}", "title": "" }, { "docid": "734fbffad7e555787d448dcc95eced94", "score": "0.4977824", "text": "func EnsureRight(value string, suffix string) string {\r\n\r\n\treturn EnsureRightWithCase(value, suffix, true)\r\n}", "title": "" }, { "docid": "8d4516b32358607b18024b859f9cce1d", "score": "0.49758896", "text": "func trimTrailingDot(s string) string {\n\tif s == \"\" || s[len(s)-1] != '.' {\n\t\treturn s\n\t}\n\treturn s[:(len(s) - 1)]\n}", "title": "" }, { "docid": "fcdfb9382a6adc1604128230ac259d4a", "score": "0.49704975", "text": "func TrimSince(s string, since string) string {\n\tindex := strings.Index(s, since)\n\tif index == -1 {\n\t\treturn s\n\t}\n\n\treturn s[:index]\n}", "title": "" }, { "docid": "74fc3196af329e1f8303467d399162f5", "score": "0.4961947", "text": "func DropRight(data interface{}, size int) (interface{}, error) {\n\tvar err error\n\n\tresult := func(err *error) interface{} {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn nil\n\t\t}\n\n\t\tdataValue, dataType, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !isZeroOrPositiveNumber(err, \"size\", size) {\n\t\t\treturn data\n\t\t}\n\n\t\tif size == 0 {\n\t\t\treturn data\n\t\t}\n\n\t\tresult := makeSlice(dataType)\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn result.Interface()\n\t\t}\n\n\t\tforEachSlice(dataValue, dataValueLen, func(each reflect.Value, i int) {\n\t\t\tif i < (dataValueLen - size) {\n\t\t\t\tresult = reflect.Append(result, each)\n\t\t\t}\n\t\t})\n\n\t\treturn result.Interface()\n\t}(&err)\n\n\treturn result, err\n}", "title": "" }, { "docid": "b82fc4d6b619655262d5251ac6645be8", "score": "0.49379465", "text": "func SkipSpace(s string) string {\n\trem := s[len(s):]\n\tfor i, r := range s {\n\t\tif !unicode.IsSpace(r) {\n\t\t\trem = s[i:]\n\t\t\tbreak\n\t\t}\n\t}\n\treturn rem\n}", "title": "" }, { "docid": "3076db9dc3ca08d0fa97598e1bbb9aa5", "score": "0.49363512", "text": "func RightPad2Len(s interface{}, padStr string, overallLen int) string {\n\tvar padCountInt int\n\tpadCountInt = 1 + ((overallLen - len(padStr)) / len(padStr))\n\tvar retStr = parseString(s) + strings.Repeat(padStr, padCountInt)\n\treturn retStr[:overallLen]\n}", "title": "" }, { "docid": "9033d186ca9d66962373cd821684e204", "score": "0.49272993", "text": "func Trim(str string, chars ...string) string {\n\tif len(chars) == 0 {\n\t\treturn strings.TrimSpace(str)\n\t}\n\tvar cutset = \"\"\n\tfor _, c := range chars {\n\t\tcutset += c\n\t}\n\treturn strings.Trim(str, cutset)\n}", "title": "" }, { "docid": "4bb0398f17583935ce92296988ded4a1", "score": "0.49077013", "text": "func truncate(s string, n int) string {\n\trunes := []rune(s)\n\tif len(runes) > n {\n\t\treturn string(runes[:n])\n\t}\n\treturn s\n}", "title": "" }, { "docid": "bafdf5e1205b3ada0a5a7030cbf6b4ed", "score": "0.49017537", "text": "func UaTrimmer(str string, slice []string) string {\n\n\tfor _, substr := range slice {\n\t\tif strings.Contains(str, substr) {\n\t\t\tvalue := strings.TrimPrefix(str, substr)\n\t\t\treturn strings.ReplaceAll(value, \" \", \"\")\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "6243e33556fb3afea28c0ca0176e0ddb", "score": "0.48985252", "text": "func (t *terminal) wordRight() {\n\tif t.position < len(t.line) {\n\t\tfor {\n\t\t\tt.position++\n\n\t\t\t// Check for end of line\n\t\t\tif t.position == len(t.line) {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tspaceHere := isABlankSpace(t.line[t.position])\n\t\t\tspaceLeft := isABlankSpace(t.line[t.position-1])\n\n\t\t\tif spaceHere && !spaceLeft {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t} else {\n\t\tdoBeep()\n\t}\n}", "title": "" }, { "docid": "28cc75a3e682dbb4d3c35fbd22019ab8", "score": "0.4898352", "text": "func Reverse(s string) string {\n\tb := []byte(s)\n\trunes := make([]rune, len(b))\n\tx := 0\n\t// fmt.Printf(\"%s, Len: %d -- Runes: %d \\n\", s, len(s), utf8.RuneCountInString(s))\n\tfor len(b) > 0 {\n\t\tr, size := utf8.DecodeLastRune(b)\n\t\trunes[x] = r\n\t\tx++\n\t\tb = b[:len(b)-size]\n\t}\n\n\t// fmt.Printf(\"%s -> %s | runes: %d\\n\\n\", s, string(runes), len(runes))\n\treturn string(runes[:x])\n}", "title": "" }, { "docid": "0bdf443ae7d7d973f6cc0cd53bd1aab5", "score": "0.48965952", "text": "func trim(b []byte) []byte {\n if i := bytes.IndexByte(b, 0x00); i != -1 {\n b = b[:i]\n }\n return b\n}", "title": "" }, { "docid": "5ee5bc358ed77fce9015e9480bfb877e", "score": "0.48683876", "text": "func CopyRight(dst, src []byte) int {\n\t// Panic if dst is smaller than src.\n\treturn copy(dst[len(dst)-len(src):], src)\n}", "title": "" }, { "docid": "5ee5bc358ed77fce9015e9480bfb877e", "score": "0.48683876", "text": "func CopyRight(dst, src []byte) int {\n\t// Panic if dst is smaller than src.\n\treturn copy(dst[len(dst)-len(src):], src)\n}", "title": "" }, { "docid": "51a5685b82746716d51d34bb985c4f3a", "score": "0.4865211", "text": "func PasteRight(from, to byte, start uint8) byte {\n\tto = to >> (8 - start)\n\tto = to << (8 - start)\n\treturn to | from\n}", "title": "" }, { "docid": "a3529f33e5a1a8dbe638f7d271a8e51c", "score": "0.48639384", "text": "func RemoveEnd(s, remove string) string {\n\tif check.IsBlank(s) || check.IsBlank(remove) {\n\t\treturn s\n\t}\n\tif strings.HasSuffix(s, remove) {\n\t\treturn s[0 : len(s)-len(remove)]\n\t}\n\treturn s\n}", "title": "" }, { "docid": "65545fb2c500737965b56eb0dd4ad491", "score": "0.48367798", "text": "func SliceRemove(s []string, index int) []string {\n\tcopy(s[index:], s[index+1:])\n\t// Remove the reference\n\ts[len(s)-1] = \"\"\n\treturn s[:len(s)-1]\n}", "title": "" }, { "docid": "81cc88a4bb1b5de20adf5bdb7f05d9e6", "score": "0.48255876", "text": "func TruncateLeft(args ...interface{}) (ret string, err error) {\n\tif len(args) < 2 {\n\t\treturn ret, fmt.Errorf(common.WrongArgsCount)\n\t}\n\n\tn, err := strconv.Atoi(fmt.Sprint(args[1]))\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\trunes := []rune(fmt.Sprint(args[0]))\n\tif len(runes) <= n {\n\t\treturn string(runes), nil\n\t} else {\n\t\treturn string(runes[len(runes)-n:]), nil\n\t}\n}", "title": "" }, { "docid": "f69622d291aafd6b6ec4b0068dc6b5ad", "score": "0.48242092", "text": "func Trim(str string) string {\n\treturn strings.Trim(str, \" \\t\\r\\n\")\n}", "title": "" }, { "docid": "f73b6db13aaa7666ead3cb7a0e25f0ea", "score": "0.48204094", "text": "func stripSpaces(s string) string {\n\treturn strings.Map(func(r rune) rune {\n\t\tif unicode.IsSpace(r) {\n\t\t\treturn -1\n\t\t}\n\t\treturn r\n\t}, s)\n}", "title": "" }, { "docid": "f7107868d4bb7cb60d0e4acd8148fce7", "score": "0.4812012", "text": "func TrimSpaces(slice []string) {\n\tTrim(slice, \" \")\n}", "title": "" }, { "docid": "fd970f3bbe8fec1161904d3e436325ef", "score": "0.48096314", "text": "func TrimColorizedString(v string, maxRuneLength int) string {\n\treturn colorizeText(v, Raw, maxRuneLength)\n}", "title": "" }, { "docid": "1858ed1e7f051ac670b8f6d2f2867138", "score": "0.48070103", "text": "func lstrip(s string) string {\n\tvar b strings.Builder\n\tfor _, line := range strings.Split(s, \"\\n\") {\n\t\tb.WriteString(strings.TrimLeft(line, \" \"))\n\t\tb.WriteRune('\\n')\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "0f61f82ec98221bf18817f4f4c2f355a", "score": "0.48008004", "text": "func EuTrimmer(str string, slice []string) string {\n\n\tfor _, substr := range slice {\n\t\tif strings.Contains(str, substr) {\n\t\t\tvalue := strings.TrimPrefix(str, substr)\n\t\t\treturn strings.TrimPrefix(value, \" \")\n\t\t}\n\t}\n\n\treturn \"\"\n\n}", "title": "" }, { "docid": "b5edcca74db7ea84f5255d7918c90d27", "score": "0.47958505", "text": "func RemoveSpace(s string) string {\n\tif check.IsBlank(s) {\n\t\treturn s\n\t}\n\tsps := [...]string{\"\\t\", \"\\n\", \"\\v\", \"\\f\", \"\\r\", \" \"}\n\tfor _, sp := range sps {\n\t\ts = strings.Replace(s, sp, \"\", -1)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "2eba91a59779f65765dd632fbb1e6698", "score": "0.47948292", "text": "func trim(str string) string {\n\tif strings.HasSuffix(str, sep) {\n\t\tstr = str[:len(str)-len(sep)]\n\t}\n\treturn str\n}", "title": "" }, { "docid": "66bf1b0e65354df42fc23405443ec24e", "score": "0.47912556", "text": "func TruncateString(s string, maxRunes int) string {\n\t// This is a fast path (len(s) is an upper bound for RuneCountInString).\n\tif len(s) <= maxRunes {\n\t\treturn s\n\t}\n\tn := utf8.RuneCountInString(s)\n\tif n <= maxRunes {\n\t\treturn s\n\t}\n\t// Fast path for ASCII strings.\n\tif len(s) == n {\n\t\treturn s[:maxRunes]\n\t}\n\ti := 0\n\tfor pos := range s {\n\t\tif i == maxRunes {\n\t\t\treturn s[:pos]\n\t\t}\n\t\ti++\n\t}\n\t// This code should be unreachable.\n\treturn s\n}", "title": "" }, { "docid": "94c9ef548eb7ceed085c3435c2a3281d", "score": "0.47897837", "text": "func RemoveLeft(s, substr string, caseSensitive bool) string {\n\tif StartsWith(s, substr, caseSensitive) {\n\t\treturn Substr(s, Length(substr))\n\t}\n\treturn s\n}", "title": "" }, { "docid": "ef2850b83aacf26a42bcede99cfb60f7", "score": "0.47830775", "text": "func stringTrim(args ...DataType) (DataType, error) {\n\tif len(args) != 2 {\n\t\treturn nil, fmt.Errorf(\"String.trim expects exactly 2 arguments\")\n\t}\n\n\tif args[0].Type() != STRING_TYPE {\n\t\treturn nil, fmt.Errorf(\"String.trim expects a String\")\n\t}\n\n\tif args[1].Type() != STRING_TYPE {\n\t\treturn nil, fmt.Errorf(\"String.trim expects a String as subset\")\n\t}\n\n\tobject := args[0].(*StringType).Value\n\tsubset := args[1].(*StringType).Value\n\n\treturn &StringType{Value: strings.Trim(object, subset)}, nil\n}", "title": "" }, { "docid": "f241d678cf67163fc0b635b043af58d0", "score": "0.47709796", "text": "func trimEOL(s string) string {\n\tlns := len(s)\n\tif lns > 0 && s[lns-1] == '\\n' {\n\t\tlns--\n\t\tif lns > 0 && s[lns-1] == '\\r' {\n\t\t\tlns--\n\t\t}\n\t}\n\treturn s[0:lns]\n}", "title": "" }, { "docid": "c5d1bcbec4a279c25b2b707f81f3e8f8", "score": "0.47552797", "text": "func Reverse(s string) string {\n\trunes := []rune(s)\n\n\tfor i := len(runes)/2 - 1; i >= 0; i-- {\n\t\topp := len(runes) - 1 - i\n\t\trunes[i], runes[opp] = runes[opp], runes[i]\n\t}\n\n\treturn string(runes)\n}", "title": "" }, { "docid": "51d866becae14ea44c2f7b7ddb5a1030", "score": "0.4748346", "text": "func StringTrim(a string) string {\n\tif a == \"0\" {\n\t\treturn a\n\t}\n\tplace := 0\n\tfor i := 0; i < len(a) && string(a[i]) == \"0\"; i++ {\n\t\tplace = i + 1\n\t}\n\n\toutput := \"\"\n\n\tfor i := place; i < len(a); i++ {\n\t\toutput += string(a[i])\n\t}\n\n\treturn output\n}", "title": "" }, { "docid": "94f3eb73cd10309a194a3f079ce5e01c", "score": "0.47286063", "text": "func (s Seq) FoldRight(mapfn func(i int, v0, v float64) float64) (v0 float64) {\n\tif s.Len() == 0 {\n\t\treturn 0\n\t}\n\n\tif s.Len() == 1 {\n\t\treturn s.GetValue(0)\n\t}\n\n\tv0 = s.GetValue(s.Len() - 1)\n\tfor i := s.Len() - 2; i >= 0; i-- {\n\t\tv0 = mapfn(i, v0, s.GetValue(i))\n\t}\n\treturn\n}", "title": "" }, { "docid": "f251b44c786b05a5ac67e956b4b746f7", "score": "0.47239485", "text": "func Truncate(max int, s string) string {\n\tw := DisplayWidth(s)\n\tif w <= max {\n\t\treturn s\n\t}\n\n\tuseEllipsis := false\n\tif max >= minWidthForEllipsis {\n\t\tuseEllipsis = true\n\t\tmax -= ellipsisWidth\n\t}\n\n\tcw := 0\n\tri := 0\n\tfor _, r := range s {\n\t\trw := runeDisplayWidth(r)\n\t\tif cw+rw > max {\n\t\t\tbreak\n\t\t}\n\t\tcw += rw\n\t\tri++\n\t}\n\n\tres := string([]rune(s)[:ri])\n\tif useEllipsis {\n\t\tres += \"...\"\n\t}\n\tif cw < max {\n\t\t// compensate if truncating a wide character left an odd space\n\t\tres += \" \"\n\t}\n\treturn res\n}", "title": "" }, { "docid": "3f1fa087088ad345b49143de5c0d1331", "score": "0.47109923", "text": "func CTrim(str string) string {\n\tbstr := []byte(str)\n\tnullIndex := CLen(bstr)\n\tbstr = bstr[:nullIndex]\n\treturn string(bstr)\n}", "title": "" }, { "docid": "870cf3f070382d6bbdb1660eb2ab5fa6", "score": "0.47026476", "text": "func stringTrimLeft(args ...DataType) (DataType, error) {\n\tif len(args) != 2 {\n\t\treturn nil, fmt.Errorf(\"String.trimLeft expects exactly 2 arguments\")\n\t}\n\n\tif args[0].Type() != STRING_TYPE {\n\t\treturn nil, fmt.Errorf(\"String.trimLeft expects a String\")\n\t}\n\n\tif args[1].Type() != STRING_TYPE {\n\t\treturn nil, fmt.Errorf(\"String.trimLeft expects a String as subset\")\n\t}\n\n\tobject := args[0].(*StringType).Value\n\tsubset := args[1].(*StringType).Value\n\n\treturn &StringType{Value: strings.TrimLeft(object, subset)}, nil\n}", "title": "" }, { "docid": "a4eeb38e76248a88717401a8a44ab108", "score": "0.47025245", "text": "func (ls List) Trim(key string, start int64, end int64) error {\n\treturn ls.ops.LTrim(key, start, end)\n}", "title": "" }, { "docid": "fa5496caa50f4ff668d72d5d46efcda6", "score": "0.4680945", "text": "func removeLeft(s string, last_j int, ans []string) []string {\n\tright := 0\n\tfor i := len(s) - 1; i >= 0; i-- {\n\t\tif s[i] == ')' {\n\t\t\tright++\n\t\t} else if s[i] == '(' {\n\t\t\tright--\n\t\t}\n\t\tif right >= 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor j := last_j; j >= i; j-- {\n\t\t\tif s[j] == '(' && (j == last_j || s[j+1] != '(') {\n\t\t\t\ts1 := s[:j] + s[j+1:]\n\t\t\t\t// should be j-1, since ( removed on the right side\n\t\t\t\tans = removeLeft(s1, j-1, ans)\n\t\t\t}\n\t\t}\n\t\treturn ans\n\t}\n\tans = append(ans, s)\n\treturn ans\n}", "title": "" }, { "docid": "4278efd6596e11b23b5541aaea64e5e3", "score": "0.4679197", "text": "func CleanSpace(s string) string {\n\t// Replace twice if there is an odd number of spaces in a row.\n\ts = strings.Replace(s, \" \", \" \", -1)\n\ts = strings.Replace(s, \" \", \" \", -1)\n\n\t// Trim whatever spaces are left on either side.\n\ts = strings.TrimSpace(s)\n\n\treturn s\n}", "title": "" } ]
c9940e7d09ad3756d5cf1857944a7e8a
GetOrCreateUnconstrainedLsp retrieves the value of the UnconstrainedLsp field or returns the existing field if it already exists.
[ { "docid": "c7147658c6e1a1edc3d1936ea6531c4e", "score": "0.834051", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateUnconstrainedLsp() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_UnconstrainedLsp {\n\tif t.UnconstrainedLsp != nil {\n\t\treturn t.UnconstrainedLsp\n\t}\n\tt.UnconstrainedLsp = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_UnconstrainedLsp{}\n\treturn t.UnconstrainedLsp\n}", "title": "" } ]
[ { "docid": "361bc3a2998f4c6f4d9a1bb7d6ba0d44", "score": "0.82865494", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateUnconstrainedLsp() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_UnconstrainedLsp {\n\tif t.UnconstrainedLsp != nil {\n\t\treturn t.UnconstrainedLsp\n\t}\n\tt.UnconstrainedLsp = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_UnconstrainedLsp{}\n\treturn t.UnconstrainedLsp\n}", "title": "" }, { "docid": "f748542f1d972e04bb4465ea5b86e11b", "score": "0.8271079", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetOrCreateUnconstrainedLsp() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_UnconstrainedLsp {\n\tif t.UnconstrainedLsp != nil {\n\t\treturn t.UnconstrainedLsp\n\t}\n\tt.UnconstrainedLsp = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_UnconstrainedLsp{}\n\treturn t.UnconstrainedLsp\n}", "title": "" }, { "docid": "7537aa8e84f5f6a0a47254082342e5c1", "score": "0.8205025", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetOrCreateUnconstrainedLsp() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_UnconstrainedLsp {\n\tif t.UnconstrainedLsp != nil {\n\t\treturn t.UnconstrainedLsp\n\t}\n\tt.UnconstrainedLsp = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_UnconstrainedLsp{}\n\treturn t.UnconstrainedLsp\n}", "title": "" }, { "docid": "bf8bc78e2263f4a456b7e7c3c3af1af4", "score": "0.7206191", "text": "func (t *NetworkInstance_Mpls_Lsps) GetOrCreateUnconstrainedPath() *NetworkInstance_Mpls_Lsps_UnconstrainedPath {\n\tif t.UnconstrainedPath != nil {\n\t\treturn t.UnconstrainedPath\n\t}\n\tt.UnconstrainedPath = &NetworkInstance_Mpls_Lsps_UnconstrainedPath{}\n\treturn t.UnconstrainedPath\n}", "title": "" }, { "docid": "d5ed8aa95cfd00bfe109d782211da4cd", "score": "0.6910586", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetUnconstrainedLsp() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_UnconstrainedLsp {\n\tif t != nil && t.UnconstrainedLsp != nil {\n\t\treturn t.UnconstrainedLsp\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4d9270c30d12e45986ab681297e0fa0d", "score": "0.687426", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetUnconstrainedLsp() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_UnconstrainedLsp {\n\tif t != nil && t.UnconstrainedLsp != nil {\n\t\treturn t.UnconstrainedLsp\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c0f045245ee0a21899a8f6641cf1429c", "score": "0.6847161", "text": "func (t *NetworkInstance_Protocol_Isis_Level) GetOrCreateLsp(LspId string) *NetworkInstance_Protocol_Isis_Level_Lsp {\n\n\tkey := LspId\n\n\tif v, ok := t.Lsp[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewLsp(LspId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateLsp got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1d380fc2230ff969493feeecd38d6d6f", "score": "0.68061197", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetUnconstrainedLsp() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_UnconstrainedLsp {\n\tif t != nil && t.UnconstrainedLsp != nil {\n\t\treturn t.UnconstrainedLsp\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a5db26779e1a12d709659b4d72254f71", "score": "0.6726048", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetUnconstrainedLsp() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_UnconstrainedLsp {\n\tif t != nil && t.UnconstrainedLsp != nil {\n\t\treturn t.UnconstrainedLsp\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef101ddae4a8050513c4649bae7c88bf", "score": "0.6593869", "text": "func (t *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters) GetOrCreateLsp() *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Lsp {\n\tif t.Lsp != nil {\n\t\treturn t.Lsp\n\t}\n\tt.Lsp = &NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Lsp{}\n\treturn t.Lsp\n}", "title": "" }, { "docid": "702870f321a38d5313e8fc8656bc8c73", "score": "0.6339957", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv) GetOrCreateLspBufferSize() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_LspBufferSize {\n\tif t.LspBufferSize != nil {\n\t\treturn t.LspBufferSize\n\t}\n\tt.LspBufferSize = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_LspBufferSize{}\n\treturn t.LspBufferSize\n}", "title": "" }, { "docid": "30917bcdd00150606eeafcc00c5f3f9f", "score": "0.62876636", "text": "func (t *NetworkInstance_Mpls) GetOrCreateLsps() *NetworkInstance_Mpls_Lsps {\n\tif t.Lsps != nil {\n\t\treturn t.Lsps\n\t}\n\tt.Lsps = &NetworkInstance_Mpls_Lsps{}\n\treturn t.Lsps\n}", "title": "" }, { "docid": "5e180572a11f1d454478c09ce1ffb96c", "score": "0.61659545", "text": "func (t *NetworkInstance_Mpls_Lsps) GetOrCreateStaticLsp(Name string) *NetworkInstance_Mpls_Lsps_StaticLsp {\n\n\tkey := Name\n\n\tif v, ok := t.StaticLsp[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewStaticLsp(Name)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateStaticLsp got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "93d2fed4283f624f97a7aff485db3ef5", "score": "0.6119059", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv) GetOrCreateNlpid() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Nlpid {\n\tif t.Nlpid != nil {\n\t\treturn t.Nlpid\n\t}\n\tt.Nlpid = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Nlpid{}\n\treturn t.Nlpid\n}", "title": "" }, { "docid": "eef7d6da75f7700c7ced3768eb8fb4d1", "score": "0.61054593", "text": "func (t *NetworkInstance_Mpls_Lsps) GetOrCreateConstrainedPath() *NetworkInstance_Mpls_Lsps_ConstrainedPath {\n\tif t.ConstrainedPath != nil {\n\t\treturn t.ConstrainedPath\n\t}\n\tt.ConstrainedPath = &NetworkInstance_Mpls_Lsps_ConstrainedPath{}\n\treturn t.ConstrainedPath\n}", "title": "" }, { "docid": "3d8e294c7d69b5a8f236001962b441d9", "score": "0.6068314", "text": "func (t *NetworkInstance_Protocol_Isis_Global) GetOrCreateLspBit() *NetworkInstance_Protocol_Isis_Global_LspBit {\n\tif t.LspBit != nil {\n\t\treturn t.LspBit\n\t}\n\tt.LspBit = &NetworkInstance_Protocol_Isis_Global_LspBit{}\n\treturn t.LspBit\n}", "title": "" }, { "docid": "2f954bb762f9a8a1cdb3652e7e324ccb", "score": "0.6033699", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp) GetOrCreateUndefinedTlv(Type uint8) *NetworkInstance_Protocol_Isis_Level_Lsp_UndefinedTlv {\n\n\tkey := Type\n\n\tif v, ok := t.UndefinedTlv[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewUndefinedTlv(Type)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateUndefinedTlv got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "5f69c570474b3963a4d0d7e6ae66767d", "score": "0.59632015", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp) GetOrCreateTlv(Type E_OpenconfigIsisLsdbTypes_ISIS_TLV_TYPE) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv {\n\n\tkey := Type\n\n\tif v, ok := t.Tlv[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewTlv(Type)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateTlv got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1d0718765c001793411692b91708fd74", "score": "0.58903664", "text": "func (t *NetworkInstance_Protocol_Isis_Global_Timers) GetOrCreateLspGeneration() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration {\n\tif t.LspGeneration != nil {\n\t\treturn t.LspGeneration\n\t}\n\tt.LspGeneration = &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration{}\n\treturn t.LspGeneration\n}", "title": "" }, { "docid": "40f9b9a4117d3be8b81584c590e755b8", "score": "0.5762648", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area) GetOrCreateLsdb() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb {\n\tif t.Lsdb != nil {\n\t\treturn t.Lsdb\n\t}\n\tt.Lsdb = &NetworkInstance_Protocol_Ospfv2_Area_Lsdb{}\n\treturn t.Lsdb\n}", "title": "" }, { "docid": "adca89ef62f98b17560f19e1c3fbe872", "score": "0.5748069", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv) GetOrCreateIpv4Srlg(InstanceNumber uint32) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4Srlg {\n\n\tkey := InstanceNumber\n\n\tif v, ok := t.Ipv4Srlg[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewIpv4Srlg(InstanceNumber)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateIpv4Srlg got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f83a990bb2810fbb2c1139881a2519c4", "score": "0.5718616", "text": "func (t *NetworkInstance_Mpls_Lsps_UnconstrainedPath_PathSetupProtocol) GetOrCreateLdp() *NetworkInstance_Mpls_Lsps_UnconstrainedPath_PathSetupProtocol_Ldp {\n\tif t.Ldp != nil {\n\t\treturn t.Ldp\n\t}\n\tt.Ldp = &NetworkInstance_Mpls_Lsps_UnconstrainedPath_PathSetupProtocol_Ldp{}\n\treturn t.Ldp\n}", "title": "" }, { "docid": "9fd072b1aa1416863077321991926256", "score": "0.567356", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb) GetOrCreateLsaType(Type E_OpenconfigOspfTypes_OSPF_LSA_TYPE) *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType {\n\n\tkey := Type\n\n\tif v, ok := t.LsaType[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewLsaType(Type)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateLsaType got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "d45eaa06215dd5e6d7ffd8b5ef1baa38", "score": "0.5484792", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols) GetOrCreateLdp() *NetworkInstance_Mpls_SignalingProtocols_Ldp {\n\tif t.Ldp != nil {\n\t\treturn t.Ldp\n\t}\n\tt.Ldp = &NetworkInstance_Mpls_SignalingProtocols_Ldp{}\n\treturn t.Ldp\n}", "title": "" }, { "docid": "e99250066f7824bf5a273369f7d76d2d", "score": "0.5478838", "text": "func (t *NetworkInstance_Protocol_Isis_Level) GetLsp(LspId string) *NetworkInstance_Protocol_Isis_Level_Lsp {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := LspId\n\n\tif lm, ok := t.Lsp[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dc9c8a1f308cc35c677b4305278aa46e", "score": "0.54670054", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) GetOrCreateUnreservedBandwidth(Priority uint8) *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_UnreservedBandwidth {\n\n\tkey := Priority\n\n\tif v, ok := t.UnreservedBandwidth[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewUnreservedBandwidth(Priority)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateUnreservedBandwidth got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "0c27553542281515711a36c84db760a1", "score": "0.5435341", "text": "func (t *Bgp_Global_AfiSafi) GetOrCreateL2VpnVpls() *Bgp_Global_AfiSafi_L2VpnVpls {\n\tif t.L2VpnVpls != nil {\n\t\treturn t.L2VpnVpls\n\t}\n\tt.L2VpnVpls = &Bgp_Global_AfiSafi_L2VpnVpls{}\n\treturn t.L2VpnVpls\n}", "title": "" }, { "docid": "fcd5fb9beb8d6ec75c9f397328b1ee4b", "score": "0.5346008", "text": "func (t *Bgp_Neighbor_AfiSafi) GetOrCreateL2VpnVpls() *Bgp_Neighbor_AfiSafi_L2VpnVpls {\n\tif t.L2VpnVpls != nil {\n\t\treturn t.L2VpnVpls\n\t}\n\tt.L2VpnVpls = &Bgp_Neighbor_AfiSafi_L2VpnVpls{}\n\treturn t.L2VpnVpls\n}", "title": "" }, { "docid": "d68fc0ce67ff0d4e62d993f7e3b277ca", "score": "0.531331", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) GetOrCreateLsa(LinkStateId string) *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa {\n\n\tkey := LinkStateId\n\n\tif v, ok := t.Lsa[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewLsa(LinkStateId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateLsa got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "bfc775add4293a2959a00e94d25c4f82", "score": "0.5311162", "text": "func (t *NetworkInstance_Protocol_Bgp_Global_AfiSafi) GetOrCreateL2VpnVpls() *NetworkInstance_Protocol_Bgp_Global_AfiSafi_L2VpnVpls {\n\tif t.L2VpnVpls != nil {\n\t\treturn t.L2VpnVpls\n\t}\n\tt.L2VpnVpls = &NetworkInstance_Protocol_Bgp_Global_AfiSafi_L2VpnVpls{}\n\treturn t.L2VpnVpls\n}", "title": "" }, { "docid": "974cc49d5436040946f7c0af0e2feda8", "score": "0.5296242", "text": "func (t *Bgp_PeerGroup_AfiSafi) GetOrCreateL2VpnVpls() *Bgp_PeerGroup_AfiSafi_L2VpnVpls {\n\tif t.L2VpnVpls != nil {\n\t\treturn t.L2VpnVpls\n\t}\n\tt.L2VpnVpls = &Bgp_PeerGroup_AfiSafi_L2VpnVpls{}\n\treturn t.L2VpnVpls\n}", "title": "" }, { "docid": "10a0f5a369feaed6b994c87b75e4ab4c", "score": "0.5295786", "text": "func (t *Device) GetOrCreateLacp() *Lacp {\n\tif t.Lacp != nil {\n\t\treturn t.Lacp\n\t}\n\tt.Lacp = &Lacp{}\n\treturn t.Lacp\n}", "title": "" }, { "docid": "41a45a04fa924fdfb895165f524fec2e", "score": "0.5270877", "text": "func (t *Device) GetOrCreateLldp() *Lldp {\n\tif t.Lldp != nil {\n\t\treturn t.Lldp\n\t}\n\tt.Lldp = &Lldp{}\n\treturn t.Lldp\n}", "title": "" }, { "docid": "dfc6d4f4b809cae7cd78e75b3c0aaf9e", "score": "0.52260375", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv) GetOrCreateSidLabel() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_SidLabel {\n\tif t.SidLabel != nil {\n\t\treturn t.SidLabel\n\t}\n\tt.SidLabel = &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_SidLabel{}\n\treturn t.SidLabel\n}", "title": "" }, { "docid": "dcca11fff01aee7712cd5eae01ac275e", "score": "0.5224332", "text": "func (t *Device) GetOrCreateLldp() *OpenconfigLldp_Lldp {\n\tif t.Lldp != nil {\n\t\treturn t.Lldp\n\t}\n\tt.Lldp = &OpenconfigLldp_Lldp{}\n\treturn t.Lldp\n}", "title": "" }, { "docid": "dcca11fff01aee7712cd5eae01ac275e", "score": "0.5224332", "text": "func (t *Device) GetOrCreateLldp() *OpenconfigLldp_Lldp {\n\tif t.Lldp != nil {\n\t\treturn t.Lldp\n\t}\n\tt.Lldp = &OpenconfigLldp_Lldp{}\n\treturn t.Lldp\n}", "title": "" }, { "docid": "b672a43640b5ad81bf54178abf157e84", "score": "0.52212834", "text": "func (t *NetworkInstance_SegmentRouting) GetOrCreateSrlb(LocalId string) *NetworkInstance_SegmentRouting_Srlb {\n\n\tkey := LocalId\n\n\tif v, ok := t.Srlb[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewSrlb(LocalId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateSrlb got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "86df1e93518ff4f0027f197d0edd3614", "score": "0.52096176", "text": "func (t *NetworkInstance_PolicyForwarding_Policy_Rule) GetOrCreateL2() *NetworkInstance_PolicyForwarding_Policy_Rule_L2 {\n\tif t.L2 != nil {\n\t\treturn t.L2\n\t}\n\tt.L2 = &NetworkInstance_PolicyForwarding_Policy_Rule_L2{}\n\treturn t.L2\n}", "title": "" }, { "docid": "41774c721bda41b8ea5f8cb5094bdc75", "score": "0.52028954", "text": "func (c Constraints) LookupOrCreate(s, k string, v int64) int64 {\n\tif u, ok := c.Lookup(s, k); ok {\n\t\treturn u\n\t}\n\tif err := c.Set(s, k, v); err != nil {\n\t\tpanic(err) // should not happen, we already checked if it exists\n\t}\n\treturn v\n}", "title": "" }, { "docid": "c4eac43ec4b15e609fb9efffceff6f1a", "score": "0.5172069", "text": "func (t *NetworkInstance_Mpls_Lsps) GetUnconstrainedPath() *NetworkInstance_Mpls_Lsps_UnconstrainedPath {\n\tif t != nil && t.UnconstrainedPath != nil {\n\t\treturn t.UnconstrainedPath\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "65c0c7e9e60df88064c6cd025bd969a8", "score": "0.5168646", "text": "func (t *NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi) GetOrCreateL2VpnVpls() *NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_L2VpnVpls {\n\tif t.L2VpnVpls != nil {\n\t\treturn t.L2VpnVpls\n\t}\n\tt.L2VpnVpls = &NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_L2VpnVpls{}\n\treturn t.L2VpnVpls\n}", "title": "" }, { "docid": "f4f728cb037368588de5ef615718cc6b", "score": "0.51550937", "text": "func (t *Acl_AclSet_AclEntry) GetOrCreateL2() *Acl_AclSet_AclEntry_L2 {\n\tif t.L2 != nil {\n\t\treturn t.L2\n\t}\n\tt.L2 = &Acl_AclSet_AclEntry_L2{}\n\treturn t.L2\n}", "title": "" }, { "docid": "38cd85b648c0d5270409ea3288792418", "score": "0.51536757", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv) GetOrCreateIpv4InternalReachability() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability {\n\tif t.Ipv4InternalReachability != nil {\n\t\treturn t.Ipv4InternalReachability\n\t}\n\tt.Ipv4InternalReachability = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability{}\n\treturn t.Ipv4InternalReachability\n}", "title": "" }, { "docid": "19562eb55ce0b2cffd92edb9907f218c", "score": "0.51473445", "text": "func (t *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi) GetOrCreateL2VpnVpls() *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L2VpnVpls {\n\tif t.L2VpnVpls != nil {\n\t\treturn t.L2VpnVpls\n\t}\n\tt.L2VpnVpls = &NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L2VpnVpls{}\n\treturn t.L2VpnVpls\n}", "title": "" }, { "docid": "d2a574a5472740746cb8eade664e0170", "score": "0.51464546", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) GetOrCreateNetworkLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsa {\n\tif t.NetworkLsa != nil {\n\t\treturn t.NetworkLsa\n\t}\n\tt.NetworkLsa = &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsa{}\n\treturn t.NetworkLsa\n}", "title": "" }, { "docid": "faacd07d3c2b5b30e0faf864bbf30d3e", "score": "0.5125585", "text": "func (t *Bgp_Global_AfiSafi) GetOrCreateL3VpnIpv4Unicast() *Bgp_Global_AfiSafi_L3VpnIpv4Unicast {\n\tif t.L3VpnIpv4Unicast != nil {\n\t\treturn t.L3VpnIpv4Unicast\n\t}\n\tt.L3VpnIpv4Unicast = &Bgp_Global_AfiSafi_L3VpnIpv4Unicast{}\n\treturn t.L3VpnIpv4Unicast\n}", "title": "" }, { "docid": "803cc7f872ee785d146b22bb697c3b7c", "score": "0.51152325", "text": "func (t *NetworkInstance_Protocol_Isis_Level) NewLsp(LspId string) (*NetworkInstance_Protocol_Isis_Level_Lsp, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Lsp == nil {\n\t\tt.Lsp = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp)\n\t}\n\n\tkey := LspId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Lsp[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Lsp\", key)\n\t}\n\n\tt.Lsp[key] = &NetworkInstance_Protocol_Isis_Level_Lsp{\n\t\tLspId: &LspId,\n\t}\n\n\treturn t.Lsp[key], nil\n}", "title": "" }, { "docid": "23bb51149002365dcadd239bbf090233", "score": "0.5094696", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp) GetLspId() string {\n\tif t == nil || t.LspId == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.LspId\n}", "title": "" }, { "docid": "725930253a6b07533a7cd23a9d660a81", "score": "0.5049584", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Global) GetOrCreateMpls() *NetworkInstance_Protocol_Ospfv2_Global_Mpls {\n\tif t.Mpls != nil {\n\t\treturn t.Mpls\n\t}\n\tt.Mpls = &NetworkInstance_Protocol_Ospfv2_Global_Mpls{}\n\treturn t.Mpls\n}", "title": "" }, { "docid": "3158872b4b10e361ec499a76e2328c77", "score": "0.50476724", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) GetOrCreateSrlg(Name string) *NetworkInstance_Mpls_TeGlobalAttributes_Srlg {\n\n\tkey := Name\n\n\tif v, ok := t.Srlg[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewSrlg(Name)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateSrlg got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "0b09e692d1deeb77f36c259acd52cd58", "score": "0.50345045", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv) GetOrCreateMultiTopology() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MultiTopology {\n\tif t.MultiTopology != nil {\n\t\treturn t.MultiTopology\n\t}\n\tt.MultiTopology = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MultiTopology{}\n\treturn t.MultiTopology\n}", "title": "" }, { "docid": "8e3857590161e366a46e9c0557604d66", "score": "0.5034206", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_BandwidthConstraint) GetOrCreateConstraint(ConstraintId uint32) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_BandwidthConstraint_Constraint {\n\n\tkey := ConstraintId\n\n\tif v, ok := t.Constraint[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewConstraint(ConstraintId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateConstraint got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "6cb8125c91a7834947528fe4309b9544", "score": "0.5024377", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv) GetOrCreateMtIsn() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn {\n\tif t.MtIsn != nil {\n\t\treturn t.MtIsn\n\t}\n\tt.MtIsn = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn{}\n\treturn t.MtIsn\n}", "title": "" }, { "docid": "2bfdb39edf8610f4ccfd3f7d6903ced1", "score": "0.50230587", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv) GetOrCreateUnknownTlv() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_UnknownTlv {\n\tif t.UnknownTlv != nil {\n\t\treturn t.UnknownTlv\n\t}\n\tt.UnknownTlv = &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_UnknownTlv{}\n\treturn t.UnknownTlv\n}", "title": "" }, { "docid": "ea8c2ea53b97eedebbd2092bd4bcea86", "score": "0.49975663", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Capability) GetOrCreateUndefinedSubtlv(Type uint8) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Capability_UndefinedSubtlv {\n\n\tkey := Type\n\n\tif v, ok := t.UndefinedSubtlv[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewUndefinedSubtlv(Type)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateUndefinedSubtlv got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f1f1a9bcada806c653ed8fad974cb5bb", "score": "0.4991584", "text": "func (t *OpenconfigLldp_Lldp_Interfaces_Interface_Neighbors_Neighbor_CustomTlvs) GetOrCreateTlv(Type int32, Oui string, OuiSubtype string) *OpenconfigLldp_Lldp_Interfaces_Interface_Neighbors_Neighbor_CustomTlvs_Tlv {\n\n\tkey := OpenconfigLldp_Lldp_Interfaces_Interface_Neighbors_Neighbor_CustomTlvs_Tlv_Key{\n\t\tType: Type,\n\t\tOui: Oui,\n\t\tOuiSubtype: OuiSubtype,\n\t}\n\n\tif v, ok := t.Tlv[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewTlv(Type, Oui, OuiSubtype)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateTlv got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f1f1a9bcada806c653ed8fad974cb5bb", "score": "0.49895784", "text": "func (t *OpenconfigLldp_Lldp_Interfaces_Interface_Neighbors_Neighbor_CustomTlvs) GetOrCreateTlv(Type int32, Oui string, OuiSubtype string) *OpenconfigLldp_Lldp_Interfaces_Interface_Neighbors_Neighbor_CustomTlvs_Tlv {\n\n\tkey := OpenconfigLldp_Lldp_Interfaces_Interface_Neighbors_Neighbor_CustomTlvs_Tlv_Key{\n\t\tType: Type,\n\t\tOui: Oui,\n\t\tOuiSubtype: OuiSubtype,\n\t}\n\n\tif v, ok := t.Tlv[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewTlv(Type, Oui, OuiSubtype)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateTlv got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "245a302d7c51987df1157935a139ac51", "score": "0.49813348", "text": "func (t *Bgp_PeerGroup_AfiSafi) GetOrCreateL3VpnIpv4Unicast() *Bgp_PeerGroup_AfiSafi_L3VpnIpv4Unicast {\n\tif t.L3VpnIpv4Unicast != nil {\n\t\treturn t.L3VpnIpv4Unicast\n\t}\n\tt.L3VpnIpv4Unicast = &Bgp_PeerGroup_AfiSafi_L3VpnIpv4Unicast{}\n\treturn t.L3VpnIpv4Unicast\n}", "title": "" }, { "docid": "96863ca9074d67c362040a4d8d61a00e", "score": "0.49776867", "text": "func (t *NetworkInstance_Mpls_Lsps) GetStaticLsp(Name string) *NetworkInstance_Mpls_Lsps_StaticLsp {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := Name\n\n\tif lm, ok := t.StaticLsp[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7a12582297186bcc7f54466c982584a3", "score": "0.49749616", "text": "func (t *Bgp_Neighbor_AfiSafi) GetOrCreateL3VpnIpv4Unicast() *Bgp_Neighbor_AfiSafi_L3VpnIpv4Unicast {\n\tif t.L3VpnIpv4Unicast != nil {\n\t\treturn t.L3VpnIpv4Unicast\n\t}\n\tt.L3VpnIpv4Unicast = &Bgp_Neighbor_AfiSafi_L3VpnIpv4Unicast{}\n\treturn t.L3VpnIpv4Unicast\n}", "title": "" }, { "docid": "ce649d3be6eac7ab38202144c736b86e", "score": "0.49585992", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_BandwidthConstraint) GetOrCreateConstraint(ConstraintId uint32) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_BandwidthConstraint_Constraint {\n\n\tkey := ConstraintId\n\n\tif v, ok := t.Constraint[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewConstraint(ConstraintId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateConstraint got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ae6cda361cd99b19165eb4da689edc8c", "score": "0.49576396", "text": "func (t *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters) GetLsp() *NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Lsp {\n\tif t != nil && t.Lsp != nil {\n\t\treturn t.Lsp\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b7362f0abde08731d97067c10030ae8e", "score": "0.49563026", "text": "func (t *NetworkInstance_Protocol_Bgp_Global_AfiSafi) GetOrCreateL3VpnIpv4Unicast() *NetworkInstance_Protocol_Bgp_Global_AfiSafi_L3VpnIpv4Unicast {\n\tif t.L3VpnIpv4Unicast != nil {\n\t\treturn t.L3VpnIpv4Unicast\n\t}\n\tt.L3VpnIpv4Unicast = &NetworkInstance_Protocol_Bgp_Global_AfiSafi_L3VpnIpv4Unicast{}\n\treturn t.L3VpnIpv4Unicast\n}", "title": "" }, { "docid": "611883bf7792b92e481447198c0eaaaf", "score": "0.49552634", "text": "func (t *NetworkInstance_Mpls_Lsps) NewStaticLsp(Name string) (*NetworkInstance_Mpls_Lsps_StaticLsp, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.StaticLsp == nil {\n\t\tt.StaticLsp = make(map[string]*NetworkInstance_Mpls_Lsps_StaticLsp)\n\t}\n\n\tkey := Name\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.StaticLsp[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list StaticLsp\", key)\n\t}\n\n\tt.StaticLsp[key] = &NetworkInstance_Mpls_Lsps_StaticLsp{\n\t\tName: &Name,\n\t}\n\n\treturn t.StaticLsp[key], nil\n}", "title": "" }, { "docid": "7b909cf36bccfbb962b2e8e64b77deea", "score": "0.49465346", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv) GetOrCreateIpv6Srlg(InstanceNumber uint32) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv6Srlg {\n\n\tkey := InstanceNumber\n\n\tif v, ok := t.Ipv6Srlg[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewIpv6Srlg(InstanceNumber)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateIpv6Srlg got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ab3410f1117e8d809d6dbad41ac5c337", "score": "0.49430588", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_BandwidthConstraint) GetOrCreateConstraint(ConstraintId uint32) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_BandwidthConstraint_Constraint {\n\n\tkey := ConstraintId\n\n\tif v, ok := t.Constraint[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewConstraint(ConstraintId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateConstraint got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "237696932b0bc02d77421521efd8ac33", "score": "0.49382862", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_BandwidthConstraint) GetOrCreateConstraint(ConstraintId uint32) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_BandwidthConstraint_Constraint {\n\n\tkey := ConstraintId\n\n\tif v, ok := t.Constraint[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewConstraint(ConstraintId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateConstraint got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "58dcb94f22750ea2605b7325ed654563", "score": "0.49377808", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Global_Mpls) GetOrCreateIgpLdpSync() *NetworkInstance_Protocol_Ospfv2_Global_Mpls_IgpLdpSync {\n\tif t.IgpLdpSync != nil {\n\t\treturn t.IgpLdpSync\n\t}\n\tt.IgpLdpSync = &NetworkInstance_Protocol_Ospfv2_Global_Mpls_IgpLdpSync{}\n\treturn t.IgpLdpSync\n}", "title": "" }, { "docid": "63ce23cfbaaae2b2b16550a5a86688af", "score": "0.49337047", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv) GetOrCreateIpv4ExternalReachability() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability {\n\tif t.Ipv4ExternalReachability != nil {\n\t\treturn t.Ipv4ExternalReachability\n\t}\n\tt.Ipv4ExternalReachability = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability{}\n\treturn t.Ipv4ExternalReachability\n}", "title": "" }, { "docid": "643bfbee3cdb95bdcced681d730599e5", "score": "0.4914261", "text": "func (t *Stp) GetOrCreateMstp() *Stp_Mstp {\n\tif t.Mstp != nil {\n\t\treturn t.Mstp\n\t}\n\tt.Mstp = &Stp_Mstp{}\n\treturn t.Mstp\n}", "title": "" }, { "docid": "2573fc51358b9d7a077b187c6eceb249", "score": "0.49084398", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area) GetOrCreateMpls() *NetworkInstance_Protocol_Ospfv2_Area_Mpls {\n\tif t.Mpls != nil {\n\t\treturn t.Mpls\n\t}\n\tt.Mpls = &NetworkInstance_Protocol_Ospfv2_Area_Mpls{}\n\treturn t.Mpls\n}", "title": "" }, { "docid": "36790c093a67c334b844939669c5df91", "score": "0.49059907", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp) NewUndefinedTlv(Type uint8) (*NetworkInstance_Protocol_Isis_Level_Lsp_UndefinedTlv, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.UndefinedTlv == nil {\n\t\tt.UndefinedTlv = make(map[uint8]*NetworkInstance_Protocol_Isis_Level_Lsp_UndefinedTlv)\n\t}\n\n\tkey := Type\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.UndefinedTlv[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list UndefinedTlv\", key)\n\t}\n\n\tt.UndefinedTlv[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_UndefinedTlv{\n\t\tType: &Type,\n\t}\n\n\treturn t.UndefinedTlv[key], nil\n}", "title": "" }, { "docid": "0e7d827becc367e9276f138afd71f4be", "score": "0.49039245", "text": "func (t *NetworkInstance_Mpls_Global) GetOrCreateReservedLabelBlock(LocalId string) *NetworkInstance_Mpls_Global_ReservedLabelBlock {\n\n\tkey := LocalId\n\n\tif v, ok := t.ReservedLabelBlock[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewReservedLabelBlock(LocalId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateReservedLabelBlock got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "6e8d093804eb4d99860227ef2e189cd7", "score": "0.4888855", "text": "func (t *Stp) GetOrCreateRstp() *Stp_Rstp {\n\tif t.Rstp != nil {\n\t\treturn t.Rstp\n\t}\n\tt.Rstp = &Stp_Rstp{}\n\treturn t.Rstp\n}", "title": "" }, { "docid": "45912d297ad7623601e787aa9f997b5e", "score": "0.48873726", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Global_Timers) GetOrCreateLsaGeneration() *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration {\n\tif t.LsaGeneration != nil {\n\t\treturn t.LsaGeneration\n\t}\n\tt.LsaGeneration = &NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration{}\n\treturn t.LsaGeneration\n}", "title": "" }, { "docid": "9ab1783f7c60ec06482a0bb3e8045afa", "score": "0.4871262", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIpv4Reachability_Prefix) GetOrCreateUndefinedSubtlv(Type uint8) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIpv4Reachability_Prefix_UndefinedSubtlv {\n\n\tkey := Type\n\n\tif v, ok := t.UndefinedSubtlv[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewUndefinedSubtlv(Type)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateUndefinedSubtlv got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "73ec02361abb2e35378044ab8fb548db", "score": "0.4856357", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIpv4Reachability_Prefix) GetOrCreateUndefinedSubtlv(Type uint8) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIpv4Reachability_Prefix_UndefinedSubtlv {\n\n\tkey := Type\n\n\tif v, ok := t.UndefinedSubtlv[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewUndefinedSubtlv(Type)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateUndefinedSubtlv got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f2cab51d56a70cf488d6791eaacfdc1f", "score": "0.48512295", "text": "func (t *NetworkInstance_Protocol_Isis_Global_Timers) GetOrCreateSpf() *NetworkInstance_Protocol_Isis_Global_Timers_Spf {\n\tif t.Spf != nil {\n\t\treturn t.Spf\n\t}\n\tt.Spf = &NetworkInstance_Protocol_Isis_Global_Timers_Spf{}\n\treturn t.Spf\n}", "title": "" }, { "docid": "e91f943280ebc45a4db10f72419ac25f", "score": "0.4850489", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) GetOrCreateNssaExternalLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NssaExternalLsa {\n\tif t.NssaExternalLsa != nil {\n\t\treturn t.NssaExternalLsa\n\t}\n\tt.NssaExternalLsa = &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NssaExternalLsa{}\n\treturn t.NssaExternalLsa\n}", "title": "" }, { "docid": "e95e3c375db2308df8afed4f86610786", "score": "0.48483878", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Interface_Mpls) GetOrCreateIgpLdpSync() *NetworkInstance_Protocol_Ospfv2_Area_Interface_Mpls_IgpLdpSync {\n\tif t.IgpLdpSync != nil {\n\t\treturn t.IgpLdpSync\n\t}\n\tt.IgpLdpSync = &NetworkInstance_Protocol_Ospfv2_Area_Interface_Mpls_IgpLdpSync{}\n\treturn t.IgpLdpSync\n}", "title": "" }, { "docid": "fa0268c8bb32b260f93c28de479be6a7", "score": "0.4847849", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetOrCreateBandwidthConstraint(ModelId uint8) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_BandwidthConstraint {\n\n\tkey := ModelId\n\n\tif v, ok := t.BandwidthConstraint[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewBandwidthConstraint(ModelId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateBandwidthConstraint got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3f86df65c9dc3b97edf629bd5f8b8973", "score": "0.4845924", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet) GetOrCreateLldp() *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp {\n\tif t.Lldp != nil {\n\t\treturn t.Lldp\n\t}\n\tt.Lldp = &OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp{}\n\treturn t.Lldp\n}", "title": "" }, { "docid": "3f86df65c9dc3b97edf629bd5f8b8973", "score": "0.48456988", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet) GetOrCreateLldp() *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp {\n\tif t.Lldp != nil {\n\t\treturn t.Lldp\n\t}\n\tt.Lldp = &OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp{}\n\treturn t.Lldp\n}", "title": "" }, { "docid": "50f52358007cd961891aec8e234a3a66", "score": "0.4834778", "text": "func (t *NetworkInstance_Mpls_Lsps_ConstrainedPath) GetOrCreateTunnel(Name string) *NetworkInstance_Mpls_Lsps_ConstrainedPath_Tunnel {\n\n\tkey := Name\n\n\tif v, ok := t.Tunnel[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewTunnel(Name)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateTunnel got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "66f6c8967eb0d0ce99700321be9d926a", "score": "0.48289496", "text": "func (t *NetworkInstance) GetOrCreateMpls() *NetworkInstance_Mpls {\n\tif t.Mpls != nil {\n\t\treturn t.Mpls\n\t}\n\tt.Mpls = &NetworkInstance_Mpls{}\n\treturn t.Mpls\n}", "title": "" }, { "docid": "f8cbe25e4af6ab032807434f1d0a45af", "score": "0.48278525", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) GetOrCreateAsExternalLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa {\n\tif t.AsExternalLsa != nil {\n\t\treturn t.AsExternalLsa\n\t}\n\tt.AsExternalLsa = &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa{}\n\treturn t.AsExternalLsa\n}", "title": "" }, { "docid": "53ca73fab4e47443f43d387c509a772f", "score": "0.4817628", "text": "func (t *NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi) GetOrCreateL3VpnIpv4Unicast() *NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_L3VpnIpv4Unicast {\n\tif t.L3VpnIpv4Unicast != nil {\n\t\treturn t.L3VpnIpv4Unicast\n\t}\n\tt.L3VpnIpv4Unicast = &NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_L3VpnIpv4Unicast{}\n\treturn t.L3VpnIpv4Unicast\n}", "title": "" }, { "docid": "26197ca32f4236927154841bc684d3e2", "score": "0.48142326", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp_Neighbors_Neighbor_CustomTlvs) GetOrCreateTlv(Type int32, Oui string, OuiSubtype string) *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp_Neighbors_Neighbor_CustomTlvs_Tlv {\n\n\tkey := OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp_Neighbors_Neighbor_CustomTlvs_Tlv_Key{\n\t\tType: Type,\n\t\tOui: Oui,\n\t\tOuiSubtype: OuiSubtype,\n\t}\n\n\tif v, ok := t.Tlv[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewTlv(Type, Oui, OuiSubtype)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateTlv got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "26197ca32f4236927154841bc684d3e2", "score": "0.48138788", "text": "func (t *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp_Neighbors_Neighbor_CustomTlvs) GetOrCreateTlv(Type int32, Oui string, OuiSubtype string) *OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp_Neighbors_Neighbor_CustomTlvs_Tlv {\n\n\tkey := OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp_Neighbors_Neighbor_CustomTlvs_Tlv_Key{\n\t\tType: Type,\n\t\tOui: Oui,\n\t\tOuiSubtype: OuiSubtype,\n\t}\n\n\tif v, ok := t.Tlv[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewTlv(Type, Oui, OuiSubtype)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateTlv got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "70c050385a6901fb0fa7a7a44e01a7cf", "score": "0.47959164", "text": "func (t *NetworkInstance_Protocol_Isis_Global_Mpls) GetOrCreateIgpLdpSync() *NetworkInstance_Protocol_Isis_Global_Mpls_IgpLdpSync {\n\tif t.IgpLdpSync != nil {\n\t\treturn t.IgpLdpSync\n\t}\n\tt.IgpLdpSync = &NetworkInstance_Protocol_Isis_Global_Mpls_IgpLdpSync{}\n\treturn t.IgpLdpSync\n}", "title": "" }, { "docid": "2abf1e5fc208f94b4dd01f3789c63136", "score": "0.47943667", "text": "func (t *Bgp_Global_AfiSafi) GetOrCreateSrtePolicyIpv4() *Bgp_Global_AfiSafi_SrtePolicyIpv4 {\n\tif t.SrtePolicyIpv4 != nil {\n\t\treturn t.SrtePolicyIpv4\n\t}\n\tt.SrtePolicyIpv4 = &Bgp_Global_AfiSafi_SrtePolicyIpv4{}\n\treturn t.SrtePolicyIpv4\n}", "title": "" }, { "docid": "2a62fb8db1fe53efcb0794ec7e5d31ae", "score": "0.47900733", "text": "func (t *NetworkInstance_Protocol_Isis_Global) GetOrCreateMpls() *NetworkInstance_Protocol_Isis_Global_Mpls {\n\tif t.Mpls != nil {\n\t\treturn t.Mpls\n\t}\n\tt.Mpls = &NetworkInstance_Protocol_Isis_Global_Mpls{}\n\treturn t.Mpls\n}", "title": "" }, { "docid": "7f31a2830af8d32bd06122e0760bb0ba", "score": "0.4763616", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) GetOrCreateSummaryLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa {\n\tif t.SummaryLsa != nil {\n\t\treturn t.SummaryLsa\n\t}\n\tt.SummaryLsa = &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa{}\n\treturn t.SummaryLsa\n}", "title": "" }, { "docid": "5f03502f09d4821da276c125c8274201", "score": "0.47507092", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetOrCreateBandwidthConstraint(ModelId uint8) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_BandwidthConstraint {\n\n\tkey := ModelId\n\n\tif v, ok := t.BandwidthConstraint[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewBandwidthConstraint(ModelId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateBandwidthConstraint got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "457fcd0b5877b22e7b8d058a039e8c01", "score": "0.4748686", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_UnconstrainedLsp) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_UnconstrainedLsp\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "847b2b083ef91c25494a9a12a407668d", "score": "0.47465557", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global) GetOrCreateSoftPreemption() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_SoftPreemption {\n\tif t.SoftPreemption != nil {\n\t\treturn t.SoftPreemption\n\t}\n\tt.SoftPreemption = &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_SoftPreemption{}\n\treturn t.SoftPreemption\n}", "title": "" }, { "docid": "9c333e14ea734ccaf786a173cf249e90", "score": "0.47425172", "text": "func (t *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi) GetOrCreateL3VpnIpv4Unicast() *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L3VpnIpv4Unicast {\n\tif t.L3VpnIpv4Unicast != nil {\n\t\treturn t.L3VpnIpv4Unicast\n\t}\n\tt.L3VpnIpv4Unicast = &NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L3VpnIpv4Unicast{}\n\treturn t.L3VpnIpv4Unicast\n}", "title": "" }, { "docid": "07a1f3ad5db4629b1acd5439724c08e7", "score": "0.47383517", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_UnconstrainedLsp) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_UnconstrainedLsp\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8b18d3feb9c230f7b8f1c98f1be9bbb0", "score": "0.4737573", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateBandwidthConstraint(ModelId uint8) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_BandwidthConstraint {\n\n\tkey := ModelId\n\n\tif v, ok := t.BandwidthConstraint[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewBandwidthConstraint(ModelId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateBandwidthConstraint got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "02462ad5419a877ee9df24a80ef2fb93", "score": "0.47289512", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateBandwidthConstraint(ModelId uint8) *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_BandwidthConstraint {\n\n\tkey := ModelId\n\n\tif v, ok := t.BandwidthConstraint[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewBandwidthConstraint(ModelId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateBandwidthConstraint got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" } ]
b0d7c5c07005b40c5d6c4d2e4ad4e12e
This test runs the SQLAlchemy dialect test suite against a single Cockroach node.
[ { "docid": "e2ae1e5c3d684d9ae7f1b4dfd2ce373d", "score": "0.5428143", "text": "func registerSQLAlchemy(r *testRegistry) {\n\tr.Add(testSpec{\n\t\tName: \"sqlalchemy\",\n\t\tOwner: OwnerSQLExperience,\n\t\tCluster: makeClusterSpec(1),\n\t\tMinVersion: \"v20.1.0\",\n\t\tTags: []string{`default`, `orm`},\n\t\tRun: func(ctx context.Context, t *test, c *cluster) {\n\t\t\trunSQLAlchemy(ctx, t, c)\n\t\t},\n\t})\n}", "title": "" } ]
[ { "docid": "f4acc27f8557499238c28451d6373576", "score": "0.62152123", "text": "func RequireDatabaseToFunction(t *testing.T, crdbCluster CockroachCluster, rotate bool) {\n\tsqlPort := int32(26257)\n\tconn := &database.DBConnection{\n\t\tCtx: context.TODO(),\n\t\tClient: crdbCluster.K8sClient,\n\t\tPort: &sqlPort,\n\t\tUseSSL: true,\n\n\t\tRestConfig: crdbCluster.Cfg,\n\t\tServiceName: fmt.Sprintf(\"%s-0.%s\", crdbCluster.StatefulSetName, crdbCluster.StatefulSetName),\n\t\tNamespace: crdbCluster.Namespace,\n\t\tDatabaseName: \"system\",\n\n\t\tRunningInsideK8s: false,\n\t\tClientCertificateSecretName: crdbCluster.ClientSecret,\n\t\tRootCertificateSecretName: crdbCluster.NodeSecret,\n\t}\n\n\t// Create a new database connection for the update.\n\tdb, err := database.NewDbConnection(conn)\n\trequire.NoError(t, err)\n\tdefer db.Close()\n\n\tif rotate {\n\t\tt.Log(\"Verifying the existing data in the database after certificate rotation\")\n\t}\n\n\t// Create database only if we are testing crdb install\n\tif !rotate {\n\t\tif _, err := db.Exec(\"CREATE DATABASE test_db\"); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n\tif _, err := db.Exec(\"USE test_db\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Create and insert into table only for the crdb install\n\tif !rotate {\n\t\t// Create the \"accounts\" table.\n\t\tif _, err := db.Exec(\"CREATE TABLE IF NOT EXISTS accounts (id INT PRIMARY KEY, balance INT)\"); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\t// Insert two rows into the \"accounts\" table.\n\t\tif _, err := db.Exec(\n\t\t\t\"INSERT INTO accounts (id, balance) VALUES (1, 1000), (2, 250)\"); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n\t// Print out the balances.\n\trows, err := db.Query(\"SELECT id, balance FROM accounts\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer rows.Close()\n\tt.Log(\"Initial balances:\")\n\tfor rows.Next() {\n\t\tvar id, balance int\n\t\tif err := rows.Scan(&id, &balance); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tt.Log(\"balances\", id, balance)\n\t}\n\n\tcountRows, err := db.Query(\"SELECT COUNT(*) as count FROM accounts\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer countRows.Close()\n\tcount := getCount(t, countRows)\n\tif count != 2 {\n\t\tt.Fatal(fmt.Errorf(\"found incorrect number of rows. Expected 2 got %v\", count))\n\t}\n\n\tt.Log(\"finished testing database\")\n}", "title": "" }, { "docid": "99c665b090626fa80761798785170781", "score": "0.60543513", "text": "func (p *Cockroach) Setup() {\n\tif _, err := p.db.Exec(\"CREATE DATABASE IF NOT EXISTS dbbench\"); err != nil {\n\t\tlog.Fatalf(\"failed to create database: %v\\n\", err)\n\t}\n\tif _, err := p.db.Exec(\"CREATE TABLE IF NOT EXISTS dbbench.simple (id INT PRIMARY KEY, balance DECIMAL);\"); err != nil {\n\t\tlog.Fatalf(\"failed to create table: %v\\n\", err)\n\t}\n\tif _, err := p.db.Exec(\"CREATE TABLE IF NOT EXISTS dbbench.relational_one (oid INT PRIMARY KEY, balance_one DECIMAL);\"); err != nil {\n\t\tlog.Fatalf(\"failed to create table relational_one: %v\\n\", err)\n\t}\n\tif _, err := p.db.Exec(\"CREATE TABLE IF NOT EXISTS dbbench.relational_two (balance_two DECIMAL, relation INT PRIMARY KEY, FOREIGN KEY(relation) REFERENCES dbbench.relational_one(oid));\"); err != nil {\n\t\tlog.Fatalf(\"failed to create table relational_two: %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "491c1176801076753595079f593e5d2c", "score": "0.5961666", "text": "func Test() *Database {\n\tdatabase := \"testdb\"\n\tdb := connect(database)\n\td := postConnect(db)\n\treturn d\n}", "title": "" }, { "docid": "01207aa3ce784f4ccc33f67ac2c9f813", "score": "0.5948118", "text": "func main() {\n\t// code contains simple cockroachdb example with go\n\tcode.BasicCockroachdbCode()\n\t// code is done using GORM+Go+Cockroachdb and db.AutoMigrate method to auto create table\n\tGorm.CockroachdbWithGorm()\n\t// code is done using GORM+Go+Cockroachdb and db.CreateTable method to create table\n\tGorm.GORMWithCockroach()\n\t// this code has different function for different functionalities\n\tcode.Cockroachdb()\n\t// code contains the features like Go+Cockroachdb+postgresql_driver+function+struct\n\tcode.CockroachDbwithStruct()\n\t// code contains the features like Go+Cockroachdb+postgresql_driver+function with update function\n\tcode.UpdateDataFunc()\n\t//All cockroachdb operation\n\tcockroachdbfullcode.DbConnectionCreate()\n\tjson.CockroachJson()\n}", "title": "" }, { "docid": "f0661f7b4131f458d6bc3e18c2064065", "score": "0.59003526", "text": "func TestExecuteTx(t *testing.T) {\n\tts, err := testserver.NewTestServer()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\turl := ts.PGURL()\n\tdb, err := sqlx.Connect(\"postgres\", url.String())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := ts.WaitForInit(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tctx := context.Background()\n\tif err := crdb.ExecuteTxGenericTest(ctx, sqlxConnSkewTest{db: db}); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "7fe3d68f99ffdd977d1156b44b3b72af", "score": "0.58826613", "text": "func TestConnection() {\n\tConnect()\n\tDb.DropTableIfExists(&User{})\n\tDb.AutoMigrate(&User{})\n\tlog.Println(\"Connection to database was a success!\")\n}", "title": "" }, { "docid": "c3e1697aaa4762a570dbb9777f6fa914", "score": "0.58742315", "text": "func TestMigrate(t *testing.T) {\n\tt.Skip(\"TODO: fix test: neo4j_test.go:26: Get http://neo4j:test@/db/data/: http: no Host in request URL\")\n\n\thost := os.Getenv(\"NEO4J_PORT_7474_TCP_ADDR\")\n\tport := os.Getenv(\"NEO4J_PORT_7474_TCP_PORT\")\n\n\tdriverUrl := \"http://neo4j:test@\" + host + \":\" + port + \"/db/data\"\n\n\t// prepare clean database\n\tdb, err := neoism.Connect(driverUrl)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcq := neoism.CypherQuery{\n\t\tStatement: `DROP INDEX ON :Yolo(name)`,\n\t}\n\n\t// If an error dropping the index then ignore it\n\tdb.Cypher(&cq)\n\n\tdriverUrl = \"neo4j://neo4j:test@\" + host + \":\" + port + \"/db/data\"\n\n\td := &Driver{}\n\tif err := d.Initialize(driverUrl); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tfiles := []file.File{\n\t\t{\n\t\t\tPath: \"/foobar\",\n\t\t\tFileName: \"001_foobar.up.cql\",\n\t\t\tVersion: 1,\n\t\t\tName: \"foobar\",\n\t\t\tDirection: direction.Up,\n\t\t\tContent: []byte(`\n CREATE INDEX ON :Yolo(name)\n `),\n\t\t},\n\t\t{\n\t\t\tPath: \"/foobar\",\n\t\t\tFileName: \"001_foobar.down.cql\",\n\t\t\tVersion: 1,\n\t\t\tName: \"foobar\",\n\t\t\tDirection: direction.Down,\n\t\t\tContent: []byte(`\n DROP INDEX ON :Yolo(name)\n `),\n\t\t},\n\t\t{\n\t\t\tPath: \"/foobar\",\n\t\t\tFileName: \"002_foobar.up.cql\",\n\t\t\tVersion: 2,\n\t\t\tName: \"foobar\",\n\t\t\tDirection: direction.Up,\n\t\t\tContent: []byte(`\n CREATE INDEX :Yolo(name) THIS WILL CAUSE AN ERROR\n `),\n\t\t},\n\t}\n\n\tpipe := pipep.New()\n\tgo d.Migrate(files[0], pipe)\n\terrs := pipep.ReadErrors(pipe)\n\tif len(errs) > 0 {\n\t\tt.Fatal(errs)\n\t}\n\n\tpipe = pipep.New()\n\tgo d.Migrate(files[1], pipe)\n\terrs = pipep.ReadErrors(pipe)\n\tif len(errs) > 0 {\n\t\tt.Fatal(errs)\n\t}\n\n\tpipe = pipep.New()\n\tgo d.Migrate(files[2], pipe)\n\terrs = pipep.ReadErrors(pipe)\n\tif len(errs) == 0 {\n\t\tt.Error(\"Expected test case to fail\")\n\t}\n\n\tif err := d.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "11ac0ee1a1f9bf1573c6aae9059bb2e2", "score": "0.5797222", "text": "func TestCreateTables(cfg DBConfig, path string) error {\n\torgPwd, _ := os.Getwd()\n\tdefer func() {\n\t\tos.Chdir(orgPwd)\n\t}()\n\n\tos.Chdir(path)\n\tcmd := exec.Command(\"alembic\", \"upgrade\", \"head\", \"--sql\")\n\tvar stdout, stderr bytes.Buffer\n\tcmd.Stdout = &stdout\n\tcmd.Stderr = &stderr\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\tlog.Printf(\"failed to execute alembic:\\n %s\", stderr.String())\n\t\treturn err\n\t}\n\n\tpoolcfg := pgx.ConnPoolConfig{\n\t\tConnConfig: pgx.ConnConfig{\n\t\t\tHost: \"localhost\",\n\t\t\tUser: cfg.User,\n\t\t\tDatabase: cfg.DBName,\n\t\t\tPort: 5432,\n\t\t},\n\t}\n\tdb, err := pgx.NewConnPool(poolcfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = db.Exec(stdout.String())\n\tif err != nil {\n\t\tlog.Println(\"failed to create test tables\")\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd5321ae29ba3efe0e34bf104f59b1e3", "score": "0.5786322", "text": "func initTest(nameSuffix string) error {\n\tdbname := \"sourcegraph-test-\" + nameSuffix\n\n\tif os.Getenv(\"TEST_SKIP_DROP_DB_BEFORE_TESTS\") == \"\" {\n\t\t// When running the db-backcompat.sh tests, we need to *keep* the DB around because it has\n\t\t// the new schema produced by the new version. If we dropped the DB here, then we'd recreate\n\t\t// it at the OLD schema, which is not desirable because we need to run tests against the NEW\n\t\t// schema. Thus db-backcompat.sh sets TEST_SKIP_DROP_DB_BEFORE_TESTS=true.\n\t\tout, err := exec.Command(\"dropdb\", \"--if-exists\", dbname).CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"dropdb --if-exists failed: %v\\n%s\", err, string(out))\n\t\t}\n\t}\n\n\tout, err := exec.Command(\"createdb\", dbname).CombinedOutput()\n\tif err != nil {\n\t\tif strings.Contains(string(out), \"already exists\") {\n\t\t\tlog.Printf(\"DB %s exists already (run `dropdb %s` to delete and force re-creation)\", dbname, dbname)\n\t\t} else {\n\t\t\treturn errors.Errorf(\"createdb failed: %v\\n%s\", err, string(out))\n\t\t}\n\t}\n\n\treturn dbconn.ConnectToDB(\"dbname=\" + dbname)\n}", "title": "" }, { "docid": "4756dfd32f17d2a8e02a432e67d9e30b", "score": "0.5784876", "text": "func TestDatabaseAccessLeafCluster(t *testing.T) {\n\tpack := setupDatabaseTest(t)\n\tpack.waitForLeaf(t)\n\n\t// Connect to the database service in leaf cluster via root cluster.\n\tclient, err := postgres.MakeTestClient(context.Background(), postgres.TestClientConfig{\n\t\tAuthClient: pack.root.cluster.GetSiteAPI(pack.root.cluster.Secrets.SiteName),\n\t\tAuthServer: pack.root.cluster.Process.GetAuthServer(),\n\t\tAddress: fmt.Sprintf(\"%v:%v\", Loopback, pack.root.cluster.GetPortWeb()), // Connecting via root cluster.\n\t\tCluster: pack.leaf.cluster.Secrets.SiteName,\n\t\tUsername: pack.root.user.GetName(),\n\t\tRouteToDatabase: tlsca.RouteToDatabase{\n\t\t\tServiceName: pack.leaf.dbService.Name,\n\t\t\tProtocol: pack.leaf.dbService.Protocol,\n\t\t\tUsername: \"postgres\",\n\t\t\tDatabase: \"test\",\n\t\t},\n\t})\n\trequire.NoError(t, err)\n\n\t// Execute a query.\n\tresult, err := client.Exec(context.Background(), \"select 1\").ReadAll()\n\trequire.NoError(t, err)\n\trequire.Equal(t, []*pgconn.Result{postgres.TestQueryResponse}, result)\n\trequire.Equal(t, uint32(1), pack.leaf.postgres.QueryCount())\n\trequire.Equal(t, uint32(0), pack.root.postgres.QueryCount())\n\n\t// Disconnect.\n\terr = client.Close(context.Background())\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "62117476b420951c23c63904604f67f4", "score": "0.5750145", "text": "func TestMain(m *testing.M) {\n\tdb, err := sql.Open(\"postgres\", \"user=pgtest dbname=pgtest sslmode=disable\")\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to connect test db: %s\", err.Error())\n\t}\n\t_, err = db.Exec(`\n\tCREATE TABLE IF NOT EXISTS app_user (\n\t\tid serial\n\t\t, name text not null\n\t\t, status text not null\n\t\t, created_at timestamp with time zone not null\n\t);\n\tCREATE TABLE IF NOT EXISTS app_event (\n\t\tid serial\n\t\t, user_id int not null\n\t\t, category text not null\n\t\t, created_at timestamp with time zone not null\n\t);\n\tCREATE TABLE IF NOT EXISTS app_event_summary (\n\t\tid serial\n\t\t, user_id int not null\n\t\t, category text not null\n\t\t, count int not null\n\t\t, updated_at timestamp with time zone not null\n\t);\n\t`)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create test table: %s\", err.Error())\n\t}\n\tcode := m.Run()\n\t_, err = db.Exec(`\n\tDROP TABLE IF EXISTS app_user;\n\tDROP TABLE IF EXISTS app_event;\n\tDROP TABLE IF EXISTS app_event_summary;\n\t`)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create test table: %s\", err.Error())\n\t}\n\tos.Exit(code)\n}", "title": "" }, { "docid": "1e4cf4c268bdde8caef3355a6efebd21", "score": "0.57406694", "text": "func test(db *sql.DB, driver string, dbname string) {\n var err error\n switch driver {\n\tcase \"mysql\":\n _, err = db.Query(\"SELECT '1' FROM dual\")\n\tcase \"sqlite3\":\n _, err = os.Stat(dbname)\n\t}\n\n\tif err != nil {\n\t\tfmt.Println(\"Error connecting into the database\")\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "17c44b75061fcc0ec9e78a01e84632ba", "score": "0.56986517", "text": "func TestDatabaseAccessRootCluster(t *testing.T) {\n\tpack := setupDatabaseTest(t)\n\n\t// Connect to the database service in root cluster.\n\tclient, err := postgres.MakeTestClient(context.Background(), postgres.TestClientConfig{\n\t\tAuthClient: pack.root.cluster.GetSiteAPI(pack.root.cluster.Secrets.SiteName),\n\t\tAuthServer: pack.root.cluster.Process.GetAuthServer(),\n\t\tAddress: fmt.Sprintf(\"%v:%v\", Loopback, pack.root.cluster.GetPortWeb()),\n\t\tCluster: pack.root.cluster.Secrets.SiteName,\n\t\tUsername: pack.root.user.GetName(),\n\t\tRouteToDatabase: tlsca.RouteToDatabase{\n\t\t\tServiceName: pack.root.dbService.Name,\n\t\t\tProtocol: pack.root.dbService.Protocol,\n\t\t\tUsername: \"postgres\",\n\t\t\tDatabase: \"test\",\n\t\t},\n\t})\n\trequire.NoError(t, err)\n\n\t// Execute a query.\n\tresult, err := client.Exec(context.Background(), \"select 1\").ReadAll()\n\trequire.NoError(t, err)\n\trequire.Equal(t, []*pgconn.Result{postgres.TestQueryResponse}, result)\n\trequire.Equal(t, uint32(1), pack.root.postgres.QueryCount())\n\trequire.Equal(t, uint32(0), pack.leaf.postgres.QueryCount())\n\n\t// Disconnect.\n\terr = client.Close(context.Background())\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "dcfa0712d71200d560ee9f30a6ebd23c", "score": "0.5664013", "text": "func TestShardedDCPUpgrade(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"skipping in short mode\")\n\t}\n\tif !base.IsEnterpriseEdition() {\n\t\tt.Skip(\"EE-only test\")\n\t}\n\tif base.UnitTestUrlIsWalrus() {\n\t\tt.Skip(\"Heartbeat listener requires Couchbase Server\")\n\t}\n\n\t// Use default collection namespace since this will make sure we are upgrading from 3.0 -> post 3.0\n\ttb := base.GetTestBucket(t)\n\tdefer tb.Close()\n\n\tdataStore := tb.Bucket.DefaultDataStore()\n\tbucketUUID, err := tb.UUID()\n\trequire.NoError(t, err, \"get bucket UUID\")\n\n\tnumVBuckets, err := tb.GetMaxVbno()\n\trequire.NoError(t, err)\n\n\tconst (\n\t\tnumPartitions = 4\n\t\tindexName = \"db0x2d9928b7_index\"\n\t)\n\n\trequire.NoError(t, dataStore.SetRaw(base.SyncDocPrefix+\"cfgindexDefs\", 0, nil, []byte(fmt.Sprintf(indexDefs, tb.GetName(), bucketUUID))))\n\trequire.NoError(t, dataStore.SetRaw(base.SyncDocPrefix+\"cfgnodeDefs-known\", 0, nil, []byte(nodeDefs)))\n\trequire.NoError(t, dataStore.SetRaw(base.SyncDocPrefix+\"cfgnodeDefs-wanted\", 0, nil, []byte(nodeDefs)))\n\tplanPIndexesJSON := preparePlanPIndexesJSON(t, tb, numVBuckets, numPartitions)\n\trequire.NoError(t, dataStore.SetRaw(base.SyncDocPrefix+\"cfgplanPIndexes\", 0, nil, []byte(planPIndexesJSON)))\n\n\t// Write a doc before starting the dbContext to check that import works\n\tconst (\n\t\ttestDoc1 = \"testDoc1\"\n\t\ttestDoc2 = \"testDoc2\"\n\t)\n\trequire.NoError(t, dataStore.SetRaw(testDoc1, 0, nil, []byte(`{}`)))\n\n\tctx := base.TestCtx(t)\n\tdb, err := NewDatabaseContext(ctx, tb.GetName(), tb.NoCloseClone(), true, DatabaseContextOptions{\n\t\tGroupID: \"\",\n\t\tEnableXattr: true,\n\t\tUseViews: base.TestsDisableGSI(),\n\t\tImportOptions: ImportOptions{\n\t\t\tImportPartitions: numPartitions,\n\t\t},\n\t\t// Use default collection namespace since this will make sure we are upgrading from 3.0 -> post 3.0\n\t\tScopes: GetScopesOptionsDefaultCollectionOnly(t),\n\t})\n\trequire.NoError(t, err, \"NewDatabaseContext\")\n\tdefer db.Close(ctx)\n\tctx = db.AddDatabaseLogContext(ctx)\n\tcollection := GetSingleDatabaseCollection(t, db)\n\n\terr, _ = base.RetryLoop(\"wait for non-existent node to be removed\", func() (shouldRetry bool, err error, value interface{}) {\n\t\tnodes, _, err := cbgt.CfgGetNodeDefs(db.CfgSG, cbgt.NODE_DEFS_KNOWN)\n\t\tif err != nil {\n\t\t\treturn false, err, nil\n\t\t}\n\t\tfor uuid := range nodes.NodeDefs {\n\t\t\tif uuid != db.UUID {\n\t\t\t\treturn true, nil, nil\n\t\t\t}\n\t\t}\n\t\treturn false, nil, nil\n\t}, base.CreateSleeperFunc(100, 100))\n\trequire.NoError(t, err)\n\n\terr, _ = base.RetryLoop(\"wait for all pindexes to be reassigned\", func() (shouldRetry bool, err error, value interface{}) {\n\t\tpIndexes, _, err := cbgt.CfgGetPlanPIndexes(db.CfgSG)\n\t\tif err != nil {\n\t\t\treturn false, nil, err\n\t\t}\n\t\tfor _, plan := range pIndexes.PlanPIndexes {\n\t\t\tfor nodeUUID := range plan.Nodes {\n\t\t\t\tif nodeUUID != db.UUID {\n\t\t\t\t\treturn true, nil, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false, nil, nil\n\t}, base.CreateSleeperFunc(100, 100))\n\trequire.NoError(t, err)\n\n\t// assert that the doc we created before starting this node gets imported once all the pindexes are reassigned\n\trequire.NoError(t, collection.WaitForPendingChanges(ctx))\n\tdoc, err := collection.GetDocument(ctx, testDoc1, DocUnmarshalAll)\n\trequire.NoError(t, err, \"GetDocument 1\")\n\trequire.NotNil(t, doc, \"GetDocument 1\")\n\n\t// Write a doc to the test bucket to check that import still works\n\trequire.NoError(t, dataStore.SetRaw(testDoc2, 0, nil, []byte(`{}`)))\n\trequire.NoError(t, collection.WaitForPendingChanges(ctx))\n\tdoc, err = collection.GetDocument(ctx, testDoc2, DocUnmarshalAll)\n\trequire.NoError(t, err, \"GetDocument 2\")\n\trequire.NotNil(t, doc, \"GetDocument 2\")\n}", "title": "" }, { "docid": "13fa09c5fa4fc603d30b98e7e58a8bba", "score": "0.56465566", "text": "func TestGraphite(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\ts, rawDB, _ := serverutils.StartServer(t, base.TestServerArgs{})\n\tdefer s.Stopper().Stop(context.Background())\n\tctx := context.Background()\n\n\tconst setQ = `SET CLUSTER SETTING \"%s\" = \"%s\"`\n\tconst interval = 3 * time.Millisecond\n\tdb := sqlutils.MakeSQLRunner(rawDB)\n\tdb.Exec(t, fmt.Sprintf(setQ, graphiteIntervalKey, interval))\n\n\tlisten := func() {\n\t\tlis, err := net.Listen(\"tcp\", \"127.0.0.1:0\")\n\t\tif err != nil {\n\t\t\tt.Fatal(\"failed to open port\", err)\n\t\t}\n\t\tp := lis.Addr().String()\n\t\tlog.Infof(ctx, \"Open port %s and listening\", p)\n\n\t\tdefer func() {\n\t\t\tlog.Infof(ctx, \"Close port %s\", p)\n\t\t\tif err := lis.Close(); err != nil {\n\t\t\t\tt.Fatal(\"failed to close port\", err)\n\t\t\t}\n\t\t}()\n\n\t\tdb.Exec(t, fmt.Sprintf(setQ, \"external.graphite.endpoint\", p))\n\t\tif _, e := lis.Accept(); e != nil {\n\t\t\tt.Fatal(\"failed to receive connection\", e)\n\t\t} else {\n\t\t\tlog.Info(ctx, \"received connection\")\n\t\t}\n\t}\n\n\tlisten()\n\tlog.Info(ctx, \"Make sure things don't fall apart when endpoint goes away.\")\n\ttime.Sleep(5 * interval)\n\tlisten()\n}", "title": "" }, { "docid": "4a5b0c74e7b45d650eaa87ec7424d19c", "score": "0.56460774", "text": "func setupDatabase(t *testing.T) {\n\tmigration, err := ioutil.ReadFile(\"examples/casbin_rule.sql\")\n\tif err != nil {\n\t\tt.Fatalf(\"failed to load casbin_rule sql migration: %s\", err)\n\t}\n\n\tdb, err := sqlx.Connect(driverName, dataSourceName)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to connect to database: %s\", err)\n\t}\n\tdefer db.Close()\n\n\t_, err = db.Exec(string(migration))\n\tif err != nil {\n\t\tt.Fatalf(\"failed to run casbin_rule sql migration: %s\", err)\n\t}\n}", "title": "" }, { "docid": "ef6d4740c917164281bc7a3423fd6eaf", "score": "0.56034446", "text": "func (s *Suite) Test(c *spiffy.Connection, optionalTx ...*sql.Tx) (err error) {\n\tif s.logger != nil {\n\t\ts.logger.Phase = \"test\"\n\t}\n\n\tfor _, m := range s.migrations {\n\t\tif s.logger != nil {\n\t\t\tm.SetLogger(s.logger)\n\t\t}\n\n\t\terr = s.invokeMigration(true, m, c, optionalTx...)\n\t\tif err != nil && s.shouldAbortOnError {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b43c205df2cd104396be9881cc2c2fe4", "score": "0.55813545", "text": "func TestMigrate(t *testing.T) {\n\thost := getenvDefault(\"MYSQL_PORT_3306_TCP_ADDR\", \"localhost\")\n\tport := getenvDefault(\"MYSQL_PORT_3306_TCP_PORT\", \"3306\")\n\tdriverURL := \"mysql://root@tcp(\" + host + \":\" + port + \")/migratetest\"\n\n\t// prepare clean database\n\tconnection, err := sql.Open(\"mysql\", strings.SplitN(driverURL, \"mysql://\", 2)[1])\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdropTestTables(t, connection)\n\n\tmigrate(t, driverURL)\n\n\tdropTestTables(t, connection)\n\n\t// Make an old-style 32-bit int version column that we'll have to upgrade.\n\t_, err = connection.Exec(\"CREATE TABLE IF NOT EXISTS \" + versionsTableName + \" (version int not null primary key);\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tmigrate(t, driverURL)\n}", "title": "" }, { "docid": "2f10b6c3e78af3f79316af472024d242", "score": "0.5554453", "text": "func testDB(t *testing.T) (*sqlcipher.DB, func()) {\n\tpath := testPath()\n\tkey := keys.Rand32()\n\treturn testDBWithOpts(t, path, key)\n}", "title": "" }, { "docid": "610f5161984175c86d9d0a62b96903d2", "score": "0.5542997", "text": "func TestMain(m *testing.M) {\n\tvar err error\n\tdb, err = sql.Open(\"postgres\", postgresDSN)\n\tif err != nil {\n\t\tlog.Fatalf(\"creating_postgres_client: %v\", err)\n\t}\n\tdefer db.Close()\n\n\terr = db.PingContext(ctx)\n\tif err != nil {\n\t\tlog.Fatalf(\"ping_postgres: %v\", err)\n\t}\n\n\ts, err = store.New(postgresDSN)\n\tif err != nil {\n\t\tlog.Fatalf(\"initialising store: %v\", err)\n\t}\n\terr = s.Migrate(\"../../migrations\")\n\tif err != nil {\n\t\tlog.Fatalf(\"migrate: %v\", err)\n\t}\n\n\texitCode := m.Run()\n\tos.Exit(exitCode)\n}", "title": "" }, { "docid": "29502436116a7b1479f2d56dc9eacc17", "score": "0.5538569", "text": "func TestGetDatabaseFromInfluxQL(t *testing.T) {\n\tassertDatabase(t, `ALTER RETENTION POLICY \"1h.cpu\" ON \"mydb\" DEFAULT`, \"mydb\")\n\tassertDatabase(t, `ALTER RETENTION POLICY \"policy1\" ON \"somedb\" DURATION 1h REPLICATION 4`, \"somedb\")\n\tassertDatabase(t, `CREATE DATABASE \"foo\"`, \"foo\")\n\tassertDatabase(t, `CREATE DATABASE \"bar\" WITH DURATION 1d REPLICATION 1 SHARD DURATION 30m NAME \"myrp\"`, \"bar\")\n\tassertDatabase(t, `CREATE DATABASE \"mydb\" WITH NAME \"myrp\"`, \"mydb\")\n\tassertDatabase(t, `CREATE RETENTION POLICY \"10m.events\" ON \"somedb\" DURATION 60m REPLICATION 2 SHARD DURATION 30m`, \"somedb\")\n\tassertDatabase(t, `CREATE SUBSCRIPTION \"sub0\" ON \"mydb\".\"autogen\" DESTINATIONS ALL 'udp://example.com:9090'`, \"mydb\")\n\tassertDatabase(t, `CREATE SUBSCRIPTION \"sub0\" ON \"my.db\".autogen DESTINATIONS ALL 'udp://example.com:9090'`, \"my.db\")\n\tassertDatabase(t, `CREATE SUBSCRIPTION \"sub0\" ON mydb.autogen DESTINATIONS ALL 'udp://example.com:9090'`, \"mydb\")\n\tassertDatabase(t, `CREATE SUBSCRIPTION \"sub0\" ON mydb.\"autogen\" DESTINATIONS ALL 'udp://example.com:9090'`, \"mydb\")\n\n\tassertDatabase(t, `DROP CONTINUOUS QUERY \"myquery\" ON \"mydb\"`, \"mydb\")\n\tassertDatabase(t, `DROP DATABASE \"mydb\"`, \"mydb\")\n\tassertDatabase(t, `DROP RETENTION POLICY \"1h.cpu\" ON \"mydb\"`, \"mydb\")\n\tassertDatabase(t, `DROP SUBSCRIPTION \"sub0\" ON \"mydb\".\"autogen\"`, \"mydb\")\n\tassertDatabase(t, `GRANT READ ON \"mydb\" TO \"jdoe\"`, \"mydb\")\n\tassertDatabase(t, `REVOKE READ ON \"mydb\" FROM \"jdoe\"`, \"mydb\")\n\tassertDatabase(t, `SHOW FIELD KEY EXACT CARDINALITY ON mydb`, \"mydb\")\n\tassertDatabase(t, `SHOW MEASUREMENT EXACT CARDINALITY ON mydb`, \"mydb\")\n\tassertDatabase(t, `SHOW RETENTION POLICIES ON \"mydb\"`, \"mydb\")\n\tassertDatabase(t, `SHOW SERIES CARDINALITY ON mydb`, \"mydb\")\n\tassertDatabase(t, `SHOW SERIES EXACT CARDINALITY ON mydb`, \"mydb\")\n\n\tassertDatabase(t, `CREATE DATABASE foo;`, \"foo\")\n\tassertDatabase(t, `CREATE DATABASE \"f.oo\"`, \"f.oo\")\n\tassertDatabase(t, `CREATE DATABASE \"f,oo\"`, \"f,oo\")\n\tassertDatabase(t, `CREATE DATABASE \"f oo\"`, \"f oo\")\n\tassertDatabase(t, `CREATE DATABASE \"f\\\"oo\"`, \"f\\\"oo\")\n\n\tassertDatabase(t, `DROP SERIES FROM \"telegraf\"..\"cp u\" WHERE cpu = 'cpu8'`, \"telegraf\")\n\tassertDatabase(t, `DROP SERIES FROM \"telegraf\".\"autogen\".\"cp u\" WHERE cpu = 'cpu8'`, \"telegraf\")\n\n\tassertDatabase(t, `select * from db..cpu`, \"db\")\n\tassertDatabase(t, `select * from db.autogen.cpu`, \"db\")\n\tassertDatabase(t, `select * from db.\"auto.gen\".cpu`, \"db\")\n\tassertDatabase(t, `select * from test1.autogen.\"c\\\"pu.load\"`, \"test1\")\n\tassertDatabase(t, `select * from test1.\"auto.gen\".\"c\\\"pu.load\"`, \"test1\")\n\tassertDatabase(t, `select * from db.\"auto.gen\".\"cpu.load\"`, \"db\")\n\tassertDatabase(t, `select * from \"db\".\"autogen\".\"cpu.load\"`, \"db\")\n\tassertDatabase(t, `select * from \"d.b\".\"auto.gen\".\"cpu.load\"`, \"d.b\")\n\tassertDatabase(t, `select * from \"d\\\"b\"..\"cpu.load\"`, \"d\\\"b\")\n\tassertDatabase(t, `select * from \"d.b\"..\"cpu.load\"`, \"d.b\")\n\tassertDatabase(t, `select * from \"db\".autogen.cpu`, \"db\")\n\tassertDatabase(t, `select * from \"db\".\"auto.gen\".cpu`, \"db\")\n\tassertDatabase(t, `select * from \"d.b\"..cpu`, \"d.b\")\n\n\tassertDatabase(t, `select * from \"measurement with spaces, commas and 'quotes'\"`, \"\")\n\tassertDatabase(t, `select * from \"'measurement with spaces, commas and 'quotes''\"`, \"\")\n\tassertDatabase(t, `select * from autogen.\"measurement with spaces, commas and 'quotes'\"`, \"\")\n\tassertDatabase(t, `select * from \"auto\\\"gen\".\"'measurement with spaces, commas and 'quotes''\"`, \"\")\n\tassertDatabase(t, `select * from db1..\"measurement with spaces, commas and 'quotes'\"`, \"db1\")\n\tassertDatabase(t, `select * from \"db\\\"1\".\"auto\\\"gen\".\"'measurement with spaces, commas and 'quotes''\"`, \"db\\\"1\")\n\tassertDatabase(t, `select * from \"measurement with spaces, commas and \\\"quotes\\\"\"`, \"\")\n\tassertDatabase(t, `select * from \"\\\"measurement with spaces, commas and \\\"quotes\\\"\\\"\"`, \"\")\n\tassertDatabase(t, `select * from autogen.\"measurement with spaces, commas and \\\"quotes\\\"\"`, \"\")\n\tassertDatabase(t, `select * from \"auto\\\"gen\".\"\\\"measurement with spaces, commas and \\\"quotes\\\"\\\"\"`, \"\")\n\tassertDatabase(t, `select * from db2..\"measurement with spaces, commas and \\\"quotes\\\"\"`, \"db2\")\n\tassertDatabase(t, `select * from \"db\\\"2\".\"auto\\\"gen\".\"\\\"measurement with spaces, commas and \\\"quotes\\\"\\\"\"`, \"db\\\"2\")\n\n\tassertDatabase(t, `select time, \"/var/tmp\", \"D:\\\\work\\\\run\\\\log\" from host1 order by desc limit 1`, \"\")\n\tassertDatabase(t, `select \"time\", \"/var/tmp\", \"D:\\\\work\\\\run\\\\log\" from \"host1\" order by desc limit 1`, \"\")\n\n\tassertDatabase(t, `select * from db..`, \"db\")\n\tassertDatabase(t, `select * from \"db\"..`, \"db\")\n\tassertDatabase(t, `select * from db.autogen`, \"\")\n\tassertDatabase(t, `select * from \"db\".autogen`, \"\")\n\tassertDatabase(t, `select * from db.\"auto.gen\"`, \"\")\n\tassertDatabase(t, `select * from \"db\".\"auto.gen\"`, \"\")\n\tassertDatabase(t, `select * from db.`, \"\")\n\tassertDatabase(t, `select * from db`, \"\")\n\tassertDatabase(t, `select * from \"d.b\"`, \"\")\n\tassertDatabase(t, `select * from \"d.b\".`, \"\")\n\tassertDatabase(t, `select * from \"db\"`, \"\")\n\n\tassertDatabase(t, `select * from select_sth`, \"\")\n\tassertDatabase(t, `select * from \"select sth\"`, \"\")\n\tassertDatabase(t, `select * from db..select_sth`, \"db\")\n\tassertDatabase(t, `select * from db.rp.\"select sth\"`, \"db\")\n\tassertDatabase(t, `select * from \"select * from sth\"`, \"\")\n\tassertDatabase(t, `select * from \"(SELECT * FROM sth)\"`, \"\")\n\tassertDatabase(t, `select * from db..\"select * from sth\"`, \"db\")\n\tassertDatabase(t, `select * from db.rp.\"(SELECT * FROM sth)\"`, \"db\")\n\n\tassertDatabase(t, `SELECT SUM(\"max\") FROM (SELECT MAX(\"water_level\") FROM db.\"auto.gen\".\"h2o_feet\" GROUP BY \"location\")`, \"db\")\n\tassertDatabase(t, `SELECT SUM(\"max\") FROM ( SELECT MAX(\"water_level\") FROM ( SELECT \"water_total\" / \"water_unit\" AS \"water_level\" FROM \"db\".autogen.\"pet_daycare\" ) GROUP BY \"location\" )`, \"db\")\n\tassertDatabase(t, `select mean(kpi_3) from (select kpi_1+kpi_2 as kpi_3 from \"d.b\"..cpu where time < 1620877962) where time < 1620877962 group by time(1m),app`, \"d.b\")\n}", "title": "" }, { "docid": "75d974fe6e07e5f17ac868da1dbcf6e6", "score": "0.5505476", "text": "func TestDsunit_BigQuery(t *testing.T) {\n\n\tif dsunit.InitFromURL(t, \"config/init.json\") {\n\t\tif !dsunit.PrepareFor(t, \"mydb\", \"data\", \"use_case_1\") {\n\t\t\treturn\n\t\t}\n\t\t//some business logic\n\n\t\tdsunit.ExpectFor(t, \"mydb\", dsunit.FullTableDatasetCheckPolicy, \"data\", \"use_case_1\")\n\t}\n}", "title": "" }, { "docid": "63732150f06154536fabc8db3cf278cc", "score": "0.5486472", "text": "func runTests(c *C, overrider configOverrider, tests ...func(dbt *DBTest)) {\n\tdb, err := sql.Open(\"mysql\", getDSN(overrider))\n\tc.Assert(err, IsNil, Commentf(\"Error connecting\"))\n\tdefer db.Close()\n\n\tdb.Exec(\"DROP TABLE IF EXISTS test\")\n\n\tdbt := &DBTest{c, db}\n\tfor _, test := range tests {\n\t\ttest(dbt)\n\t\tdbt.db.Exec(\"DROP TABLE IF EXISTS test\")\n\t}\n}", "title": "" }, { "docid": "8bd77d667160f57a31e7cf0fdbb1577c", "score": "0.5484004", "text": "func ConnectTest() {\n\tif db != nil {\n\t\treturn\n\t}\n\n\tdsn := fmt.Sprintf(\"postgres://%s:%s@%s:%s/%s\", \"postgres\", \"postgres\", \"localhost\", \"5432\", \"mlabs_test\")\n\tlogrus.Debugf(\"Connecting to database with: %s\", dsn)\n\n\tvar err error\n\tdb, err = gorm.Open(postgres.New(postgres.Config{\n\t\tDSN: dsn,\n\t}), &gorm.Config{})\n\tif err != nil {\n\t\tlogrus.Panic(err.Error())\n\t}\n\n\tdb = db.Debug()\n\tmigrate()\n}", "title": "" }, { "docid": "3c7c58280056fe88d260edcea3087d1b", "score": "0.5476469", "text": "func TestAllDataTypes(t *testing.T) {\n\n\tvar expectArrayWrapper bool\n\tvar readBackQ string\n\tvar testcases []dataTypeTestCase\n\t{\n\t\tfixture, cancel, err := all.NewFixture()\n\t\trequire.NoError(t, err)\n\n\t\tswitch fixture.TargetPool.Product {\n\t\tcase types.ProductCockroachDB, types.ProductPostgreSQL:\n\t\t\ttestcases = pgDataTypeTests\n\t\t\treadBackQ = \"SELECT ifnull(to_json(val)::string, 'null') FROM %s\"\n\t\tcase types.ProductOracle:\n\t\t\ttestcases = oraDataTypeTests\n\t\t\t// JSON_QUERY in older versions refuses to return raw scalars.\n\t\t\treadBackQ = \"SELECT JSON_QUERY(JSON_ARRAY(val NULL ON NULL), '$[0]' WITH ARRAY WRAPPER) FROM %s\"\n\t\t\texpectArrayWrapper = true\n\t\tdefault:\n\t\t\tt.Fatal(\"unimplemented product\")\n\t\t}\n\t\tcancel()\n\t}\n\n\tfor _, tc := range testcases {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\ta := assert.New(t)\n\n\t\t\t// Creating a new database for each loop is, as of v22.2 and\n\t\t\t// v23.1 faster than dropping the table between iterations.\n\t\t\t// This is relevant because the fixture contains a test\n\t\t\t// timeout which was getting tripped due to performance\n\t\t\t// changes in v23.1.\n\t\t\t//\n\t\t\t// https://github.com/cockroachdb/cockroach/issues/102259\n\t\t\tfixture, cancel, err := all.NewFixture()\n\t\t\trequire.NoError(t, err)\n\t\t\tdefer cancel()\n\n\t\t\tctx := fixture.Context\n\n\t\t\t// Place the PK index on the data type under test, if allowable.\n\t\t\tvar create string\n\t\t\tif tc.indexable {\n\t\t\t\tcreate = fmt.Sprintf(\"CREATE TABLE %%s (val %s primary key, k int)\", tc.columnType)\n\t\t\t} else {\n\t\t\t\tcreate = fmt.Sprintf(\"CREATE TABLE %%s (k int primary key, val %s)\", tc.columnType)\n\t\t\t}\n\n\t\t\ttbl, err := fixture.CreateTargetTable(ctx, create)\n\t\t\tif !a.NoError(err) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttblName := sinktest.JumbleTable(tbl.Name())\n\n\t\t\tapp, err := fixture.Appliers.Get(ctx, tblName)\n\t\t\tif !a.NoError(err) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Use the staging connection to create a reasonable JSON blob.\n\t\t\tvar jsonValue string\n\t\t\tif tc.sqlValue == \"\" {\n\t\t\t\tjsonValue = \"null\"\n\t\t\t} else {\n\t\t\t\tsourceType := tc.columnType\n\t\t\t\tif tc.sourceType != \"\" {\n\t\t\t\t\tsourceType = tc.sourceType\n\t\t\t\t}\n\t\t\t\tq := fmt.Sprintf(\"SELECT to_json($1::%s)::string\", sourceType)\n\t\t\t\tif !a.NoError(fixture.StagingPool.QueryRow(ctx, q, tc.sqlValue).Scan(&jsonValue)) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Info(jsonValue)\n\n\t\t\tmut := types.Mutation{\n\t\t\t\tData: []byte(fmt.Sprintf(`{\"k\":1,\"val\":%s}`, jsonValue)),\n\t\t\t\tKey: []byte(`[1]`),\n\t\t\t}\n\t\t\ta.NoError(app.Apply(ctx, fixture.TargetPool, []types.Mutation{mut}))\n\n\t\t\tvar readBack string\n\t\t\ta.NoError(fixture.TargetPool.QueryRowContext(ctx,\n\t\t\t\tfmt.Sprintf(readBackQ, tbl),\n\t\t\t).Scan(&readBack))\n\n\t\t\t// See note in readBackQ\n\t\t\tif expectArrayWrapper {\n\t\t\t\treadBack = readBack[1 : len(readBack)-1]\n\t\t\t}\n\t\t\tif tc.expectJSON != \"\" {\n\t\t\t\ta.Equal(tc.expectJSON, readBack)\n\t\t\t} else {\n\t\t\t\ta.Equal(jsonValue, readBack)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "5883a0f582467b5bf75cf395bd7fc383", "score": "0.54729426", "text": "func TestDatabaseConfigConnectionString(t *testing.T) {\n\tt.Parallel() // marks table driven test execution function as capable of running in parallel with other tests\n\n\ttests := []struct {\n\t\tname string\n\t\tconfig DatabaseConfig\n\t\twant string\n\t}{\n\t\t{\n\t\t\tname: \"Simple\",\n\t\t\tconfig: DatabaseConfig{\n\t\t\t\tHost: \"localhost\",\n\t\t\t\tPort: 5432,\n\t\t\t\tUsername: \"simple\",\n\t\t\t\tPassword: \"database_config\",\n\t\t\t\tDatabase: \"simple_database_config\",\n\t\t\t},\n\t\t\twant: \"host=localhost port=5432 user=simple password=database_config dbname=simple_database_config sslmode=disable\",\n\t\t},\n\t\t{\n\t\t\tname: \"SSLMode\",\n\t\t\tconfig: DatabaseConfig{\n\t\t\t\tHost: \"localhost\",\n\t\t\t\tPort: 5432,\n\t\t\t\tUsername: \"simple\",\n\t\t\t\tPassword: \"database_config\",\n\t\t\t\tDatabase: \"simple_database_config\",\n\t\t\t\tAdditionalParams: map[string]string{\n\t\t\t\t\t\"sslmode\": \"prefer\",\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: \"host=localhost port=5432 user=simple password=database_config dbname=simple_database_config sslmode=prefer\",\n\t\t},\n\t\t{\n\t\t\tname: \"Complex\",\n\t\t\tconfig: DatabaseConfig{\n\t\t\t\tHost: \"localhost\",\n\t\t\t\tPort: 5432,\n\t\t\t\tUsername: \"simple\",\n\t\t\t\tPassword: \"database_config\",\n\t\t\t\tDatabase: \"simple_database_config\",\n\t\t\t\tAdditionalParams: map[string]string{\n\t\t\t\t\t\"connect_timeout\": \"10\",\n\t\t\t\t\t\"sslmode\": \"verify-full\",\n\t\t\t\t\t\"sslcert\": \"/app/certs/pg.pem\",\n\t\t\t\t\t\"sslkey\": \"/app/certs/pg.key\",\n\t\t\t\t\t\"sslrootcert\": \"/app/certs/pg_root.pem\",\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: \"host=localhost port=5432 user=simple password=database_config dbname=simple_database_config connect_timeout=10 sslcert=/app/certs/pg.pem sslkey=/app/certs/pg.key sslmode=verify-full sslrootcert=/app/certs/pg_root.pem\",\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\ttt := tt // NOTE: https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tt.Parallel() // marks each test case as capable of running in parallel with each other\n\n\t\t\tif got := tt.config.ConnectionString(); got != tt.want {\n\t\t\t\tt.Errorf(\"invalid connection string, got %q, want %q\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6ba86a265925e319a28539f99d9dd44a", "score": "0.5470693", "text": "func testDBConnect() error {\n\tfmt.Println(\"Testing Connection\")\n\n\terr := rdb.Set(ctx, \"Hello\", \"World\", 0).Err()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"redis error during write: %s\", err.Error())\n\t}\n\n\tval, err := rdb.Get(ctx, \"Hello\").Result()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"redis error durign GET: %s\", err.Error())\n\t}\n\n\tif val != \"World\" {\n\t\treturn fmt.Errorf(\"redis error, result not equal\")\n\t}\n\tfmt.Printf(\"%s Connection Succes\\n\", ck)\n\treturn nil\n}", "title": "" }, { "docid": "ffbbdd8c40dfe15bfbe23ad1498033d4", "score": "0.54584104", "text": "func Test_SingleNodeSQLInjection(t *testing.T) {\n\tnode := mustNewLeaderNode()\n\tdefer node.Deprovision()\n\n\ttests := []struct {\n\t\tstmt string\n\t\texpected string\n\t\texecute bool\n\t}{\n\t\t{\n\t\t\tstmt: `CREATE TABLE foo (id integer not null primary key, name text)`,\n\t\t\texpected: `{\"results\":[{}]}`,\n\t\t\texecute: true,\n\t\t},\n\t\t{\n\t\t\tstmt: `CREATE TABLE bar (id integer not null primary key, name text)`,\n\t\t\texpected: `{\"results\":[{}]}`,\n\t\t\texecute: true,\n\t\t},\n\t\t{\n\t\t\tstmt: `SELECT * FROM foo`,\n\t\t\texpected: `{\"results\":[{\"columns\":[\"id\",\"name\"],\"types\":[\"integer\",\"text\"]}]}`,\n\t\t\texecute: false,\n\t\t},\n\t\t{\n\t\t\tstmt: fmt.Sprintf(`INSERT INTO foo(name) VALUES(%s)`, `\"alice\");DROP TABLE foo;INSERT INTO bar(name) VALUES(\"bob\"`),\n\t\t\texpected: `{\"results\":[{\"last_insert_id\":1,\"rows_affected\":1}]}`,\n\t\t\texecute: true,\n\t\t},\n\t\t{\n\t\t\tstmt: `SELECT * FROM foo`,\n\t\t\texpected: `{\"results\":[{\"error\":\"no such table: foo\"}]}`,\n\t\t\texecute: false,\n\t\t},\n\t}\n\n\tfor i, tt := range tests {\n\t\tvar r string\n\t\tvar err error\n\t\tif tt.execute {\n\t\t\tr, err = node.Execute(tt.stmt)\n\t\t} else {\n\t\t\tr, err = node.Query(tt.stmt)\n\t\t}\n\t\tif err != nil {\n\t\t\tt.Fatalf(`test %d failed \"%s\": %s`, i, tt.stmt, err.Error())\n\t\t}\n\t\tif r != tt.expected {\n\t\t\tt.Fatalf(`test %d received wrong result \"%s\" got: %s exp: %s`, i, tt.stmt, r, tt.expected)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a426aa82a46db35e94a115703b11b471", "score": "0.54541194", "text": "func TestScenario(t *testing.T) {\n\tassert := asserts.NewTesting(t, asserts.FailStop)\n\tcdb, cleanup := prepareDeletedDatabase(assert, \"scenario\")\n\tdefer cleanup()\n\n\t// Create administrator.\n\terr := cdb.Manager().WriteAdministrator(\"nonode@nohost\", \"admin\", \"admin\")\n\tassert.NoError(err)\n\tsession, err := cdb.StartSession(\"admin\", \"admin\")\n\tassert.NoError(err)\n\tdefer func() {\n\t\t// Let the administator remove himself.\n\t\terr = cdb.Manager().DeleteAdministrator(\"nonode@nohost\", \"admin\", session.Cookie())\n\t\tassert.NoError(err)\n\t}()\n\n\t// Create users.\n\tuser := &couchdb.User{\n\t\tName: \"user\",\n\t\tPassword: \"user\",\n\t\tRoles: []string{\"developer\"},\n\t}\n\terr = cdb.Manager().CreateUser(user, session.Cookie())\n\tassert.NoError(err)\n\tuser = &couchdb.User{\n\t\tName: \"somebody\",\n\t\tPassword: \"somebody\",\n\t\tRoles: []string{\"visitors\"},\n\t}\n\terr = cdb.Manager().CreateUser(user, session.Cookie())\n\tassert.NoError(err)\n\tdefer func() {\n\t\tuser, err := cdb.Manager().ReadUser(\"user\", session.Cookie())\n\t\tassert.NoError(err)\n\t\terr = cdb.Manager().DeleteUser(user.Name, session.Cookie())\n\t\tassert.NoError(err)\n\t\tuser, err = cdb.Manager().ReadUser(\"somebody\", session.Cookie())\n\t\tassert.NoError(err)\n\t\terr = cdb.Manager().DeleteUser(user.Name, session.Cookie())\n\t\tassert.NoError(err)\n\t}()\n\n\t// Create database.\n\trs := cdb.Manager().CreateDatabase(session.Cookie())\n\tassert.NoError(rs.Error())\n\tassert.True(rs.IsOK())\n\tdefer func() {\n\t\trs := cdb.Manager().DeleteDatabase(session.Cookie())\n\t\tassert.True(rs.IsOK())\n\t}()\n\n\t// Add security.\n\tsec := couchdb.Security{\n\t\tAdmins: couchdb.NamesRoles{\n\t\t\tNames: []string{\"admin\"},\n\t\t},\n\t\tMembers: couchdb.NamesRoles{\n\t\t\tNames: []string{\"user\"},\n\t\t},\n\t}\n\terr = cdb.Manager().WriteSecurity(sec, session.Cookie())\n\tassert.NoError(err)\n\n\t// Add document.\n\tdoc := Worker{\n\t\tDocumentID: \"foo\",\n\t\tName: \"foo\",\n\t}\n\trs = cdb.CreateDocument(doc)\n\tassert.False(rs.IsOK())\n\trs = cdb.CreateDocument(doc, couchdb.BasicAuthentication(\"somebody\", \"somebody\"))\n\tassert.False(rs.IsOK())\n\trs = cdb.CreateDocument(doc, couchdb.BasicAuthentication(\"user\", \"user\"))\n\tassert.True(rs.IsOK())\n}", "title": "" }, { "docid": "1a4a106b7302727feef0198f09d85e36", "score": "0.5452213", "text": "func testDatabaseIntegrations(t *testing.T, manager *integrationTestManager) {\n\tt.Run(\"Redis\", func(t *testing.T) {\n\t\tdoDatabaseTest(t, manager, redisDatabaseTestParams)\n\t})\n\n\tt.Run(\"Redis with password\", func(t *testing.T) {\n\t\tdoDatabaseTest(t, manager, redisWithPasswordDatabaseTestParams)\n\t})\n\n\tt.Run(\"Redis with ACL (username + password)\", func(t *testing.T) {\n\t\tdoDatabaseTest(t, manager, redisWithACLDatabaseTestParams)\n\t})\n\n\tt.Run(\"Consul\", func(t *testing.T) {\n\t\tdoDatabaseTest(t, manager, consulDatabaseTestParams)\n\t})\n\n\tt.Run(\"DynamoDB\", func(t *testing.T) {\n\t\tdoDatabaseTest(t, manager, dynamoDBDatabaseTestParams)\n\t})\n}", "title": "" }, { "docid": "c951eb051d358f14ea7efc6f15bfe50f", "score": "0.5419725", "text": "func testQueries(t *testing.T, driver string) {\n\t// Bootstrapping\n\tt.Logf(\"connecting to %s\", *dbUrl)\n\tdb, err := sql.Open(driver, *dbUrl)\n\tif err != nil {\n\t\tt.Fatalf(\"connecting to database: %v\", err)\n\t}\n\n\t// create a context with a deadline if the test has a deadline.\n\tctx := context.Background()\n\tif ddl, hasDeadline := t.Deadline(); hasDeadline {\n\t\t// sub a second to give the pinger some time to cancel\n\t\tc, ccl := context.WithDeadline(ctx, ddl.Add(-time.Second))\n\t\tctx = c\n\t\tdefer ccl()\n\t}\n\n\t// wait for the database to wake up.\n\tif err := pgutil.Wait(ctx, db); err != nil {\n\t\tt.Fatalf(\"connecting to database: %v\", err)\n\t}\n\n\t// Actual testing starts here.\n\tq := querytest.New(db)\n\n\tt.Run(\"Insert various Foos\", func(t *testing.T) {\n\t\tdurs := []time.Duration{\n\t\t\ttime.Millisecond * 1,\n\t\t\ttime.Millisecond * 15,\n\t\t\ttime.Second * 1,\n\t\t\ttime.Second * 15,\n\t\t\ttime.Minute * 1,\n\t\t\ttime.Minute * 15,\n\t\t\ttime.Hour * 1,\n\t\t\ttime.Hour * 15,\n\t\t}\n\t\tfor _, d := range durs {\n\t\t\t// Create new rows in the Foo table using sqlc.\n\t\t\terr := q.Insert(ctx, querytest.InsertParams{\n\t\t\t\tBar: true,\n\t\t\t\tInterval: int64(d),\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"inserting Foo: %v\", err)\n\t\t\t}\n\t\t}\n\t})\n\n\tt.Run(\"List all Foos\", func(t *testing.T) {\n\t\t// List all the rows in the Foo table using sqlc.\n\t\tfs, err := q.Get(ctx, math.MaxInt32)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"fetching foos: %v\", err)\n\t\t}\n\t\t_ = fs\n\t})\n}", "title": "" }, { "docid": "bfe884d87379770c11ae98ba33b57dca", "score": "0.54160136", "text": "func TestDBInit() *gorm.DB {\n\ttestDB, err := gorm.Open(mysql.New(mysql.Config{\n\t\tDSN: \"root:root@tcp(localhost:3306)/go_api_test?parseTime=true&loc=Local\",\n\t\tSkipInitializeWithVersion: false,\n\t}), &gorm.Config{\n\t\tSkipDefaultTransaction: true,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsqlDB, err := testDB.DB()\n\tsqlDB.SetMaxIdleConns(5)\n\n\tDB = testDB\n\treturn DB\n}", "title": "" }, { "docid": "948595428e98c99670ab17463a25c0b8", "score": "0.5414005", "text": "func ConnectForTesting(t testing.TB, schemaPaths ...string) *sql.DB {\n\tif len(schemaPaths) == 0 {\n\t\tt.Error(\"no schemas provided\")\n\t}\n\n\turi := *dbTestURI\n\n\tdbc, err := Connect(uri)\n\tif err != nil {\n\t\tt.Fatalf(\"connect error: %v\", err)\n\t\treturn nil\n\t}\n\n\tctx := ContextWithFate(context.Background(), 0)\n\n\t// Multiple connections are problematic for unit tests since they\n\t// introduce concurrency issues.\n\tdbc.SetMaxOpenConns(1)\n\n\tif _, err := dbc.ExecContext(ctx, \"set time_zone='+00:00';\"); err != nil {\n\t\tt.Errorf(\"Error setting time_zone: %v\", err)\n\t}\n\t_, err = dbc.ExecContext(ctx, \"set sql_mode=if(@@version<'5.7', 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION', @@sql_mode);\")\n\tif err != nil {\n\t\tt.Errorf(\"Error setting strict mode: %v\", err)\n\t}\n\n\tfor _, schemaPath := range schemaPaths {\n\t\tschema, err := ioutil.ReadFile(schemaPath)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Error reading schema: %s\", err.Error())\n\t\t\treturn nil\n\t\t}\n\t\tfor _, q := range strings.Split(string(schema), \";\") {\n\t\t\tq = strings.TrimSpace(q)\n\t\t\tif q == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tq = strings.Replace(\n\t\t\t\tq, \"create table\", \"create temporary table\", 1)\n\n\t\t\t// Temporary tables don't support fulltext indexes.\n\t\t\tq = strings.Replace(\n\t\t\t\tq, \"fulltext\", \"index\", -1)\n\n\t\t\t_, err = dbc.ExecContext(ctx, q)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Error executing %s: %s\", q, err.Error())\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dbc\n}", "title": "" }, { "docid": "5aa2d272f1851f85427e336813148643", "score": "0.5400899", "text": "func (s *TestCluster) SetupTestDatabase(options *persistencetests.TestBaseOptions) {\n\ts.keyspace = options.DBName\n\tif s.keyspace == \"\" {\n\t\ts.keyspace = persistencetests.GenerateRandomDBName(10)\n\t}\n\n\ts.CreateSession(options)\n\ts.CreateDatabase(1, options.DropDatabase)\n\tschemaDir := options.SchemaDir + \"/\"\n\n\tif !strings.HasPrefix(schemaDir, \"/\") && !strings.HasPrefix(schemaDir, \"../\") {\n\t\tcadencePackageDir, err := getCadencePackageDir()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tschemaDir = cadencePackageDir + schemaDir\n\t}\n\n\ts.LoadSchema([]string{\"schema.cql\"}, schemaDir)\n\ts.LoadVisibilitySchema([]string{\"schema.cql\"}, schemaDir)\n}", "title": "" }, { "docid": "7842801fa2fd52738a536010a28a3c1b", "score": "0.53938115", "text": "func TestUpgrade(t *testing.T) {\n\tdefer clean(t)\n\n\t// V1 Migration\n\tif err := v1.Migrate(conn, \"./sql_upgrade\", 2); err != nil {\n\t\tt.Fatalf(\"Unable to run v1 migrations: %s\", err)\n\t}\n\n\tif err := tableExists(\"schema_migrations\"); err != nil {\n\t\tt.Fatal(\"The schema_migrations table wasn't created\")\n\t}\n\n\tif err := tableExists(\"users\"); err != nil {\n\t\tt.Fatal(\"Users table not found in database\")\n\t}\n\n\tif err := tableExists(\"roles\"); err != nil {\n\t\tt.Fatal(\"Roles table not found in database\")\n\t}\n\n\tif _, err := conn.Exec(\"insert into users (email, username) values ('jdoe@nowhere.com', 'jdoe')\"); err != nil {\n\t\tt.Errorf(\"Unable to insert record into users: %s\", err)\n\t}\n\n\trows, err := conn.Query(\"select email from users where username = 'jdoe'\")\n\tif err != nil {\n\t\tt.Errorf(\"Didn't find expected record in database: %s\", err)\n\t}\n\n\tvar email string\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&email); err != nil {\n\t\t\tt.Errorf(\"Failed to get email from database: %s\", err)\n\t\t}\n\n\t\tif email != \"jdoe@nowhere.com\" {\n\t\t\tt.Errorf(\"Expected name jdoe@nowhere.com, got %s\", email)\n\t\t}\n\t}\n\n\tif email == \"\" {\n\t\tt.Error(\"Email not found\")\n\t}\n\n\t// Upgrade to V2\n\ttx, err := conn.Begin()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to create a transaction: %s\", err)\n\t}\n\n\tif err := v2.Upgrade(tx, \"./sql_upgrade\"); err != nil {\n\t\tt.Errorf(\"Failed to upgrade database to v2: %s\", err)\n\t}\n\n\tif err := tx.Commit(); err != nil {\n\t\tt.Fatalf(\"Failed upgrade database: %s\", err)\n\t}\n\n\t// Did it work?\n\tif err := tableExists(\"migrations.applied\"); err != nil {\n\t\tt.Error(\"Migrations applied table not found in database\")\n\t}\n\n\tif err := tableExists(\"migrations.rollbacks\"); err != nil {\n\t\tt.Error(\"Migrations applied table not found in database\")\n\t}\n\n\tif err := tableExists(\"schema_migrations\"); err == nil {\n\t\tt.Error(\"The schema_migrations table was found in database; should have been removed\")\n\t}\n\n\tif err := migrationApplied(\"1-create-users.sql\"); err != nil {\n\t\tt.Error(\"Did not migration 1-create-users.sql\")\n\t}\n\n\tif err := migrationApplied(\"2-create-roles.sql\"); err != nil {\n\t\tt.Error(\"Did not migration 1-create-roles.sql\")\n\t}\n\n\tif err := migrationApplied(\"3-alter-users.sql\"); err == nil {\n\t\tt.Error(\"Migration 3-alter-users.sql was prematurely applied\")\n\t}\n\n\tif err := v2.WithDirectory(\"./sql_upgrade\").Apply(conn); err != nil {\n\t\tt.Errorf(\"Failed to run v2 migrations: %s\", err)\n\t}\n\n\tif err := migrationApplied(\"3-alter-users.sql\"); err != nil {\n\t\tt.Error(\"Did not migrate 3-alter-users.sql\")\n\t}\n\n\terr = os.Rename(\"./sql_upgrade/3-alter-users.sql\", \"./sql_upgrade/skip_3-alter-users.sql\")\n\tdefer func() {\n\t\t_ = os.Rename(\"./sql_upgrade/skip_3-alter-users.sql\", \"./sql_upgrade/3-alter-users.sql\")\n\t}()\n\n\tif err != nil {\n\t\tt.Fatalf(\"Could not move third migration out of the way: %s\", err)\n\t}\n\n\t// See if a rollback works\n\tif err := v2.WithDirectory(\"./sql_upgrade\").Apply(conn); err != nil {\n\t\tt.Errorf(\"Failed to run v2 migrations: %s\", err)\n\t}\n\n\tif err := migrationApplied(\"1-create-users.sql\"); err != nil {\n\t\tt.Error(\"Did not migration 1-create-users.sql\")\n\t}\n\n\tif err := migrationApplied(\"2-create-roles.sql\"); err != nil {\n\t\tt.Error(\"Did not migration 1-create-roles.sql\")\n\t}\n\n\tif err := migrationApplied(\"3-alter-users.sql\"); err == nil {\n\t\tt.Error(\"Migration 3-alter-users.sql remains\")\n\t}\n}", "title": "" }, { "docid": "174acad1a299cd949b7d79c508309063", "score": "0.53770864", "text": "func TestDBHost(cfg *config.Config) error {\n\tinfo := fmt.Sprintf(\"host=%s port=%s user=%s password=%s sslmode=disable\",\n\t\tcfg.Host, cfg.Port, cfg.Username, cfg.Password)\n\tdb, err := sql.Open(\"postgres\", info)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer db.Close()\n\treturn db.Ping()\n}", "title": "" }, { "docid": "754c1340f5afcedc52632b439db6241c", "score": "0.5369426", "text": "func TestGORM(t *testing.T) {\n\tif err := DB.AutoMigrate(&Transaction{}); err != nil {\n\t\tlog.Printf(\"Failed to auto migrate, but got error %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "401f556329369cce471a1008d08bd51b", "score": "0.5365171", "text": "func Test() bool {\n\terr := WithDb(func(db *sql.DB) {\n\t\terr := db.Ping()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tfmt.Println(\"Successfully connected!\")\n\t})\n\n\tif err != nil {\n\t\t// An error occurred\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c76c9040d965f5ea1df949b987963d7f", "score": "0.53638905", "text": "func main() {\n\tdataSourceName := fmt.Sprintf(\n\t\t\"%s:%s@tcp(%s:3306)/hello_db\",\n\t\t\"raka\",\n\t\t\"raka-is-not-used\",\n\t\t\"localhost\")\n\tsqlDB, err := sql.Open(\"mysql\", dataSourceName)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tif err := sqlDB.Ping(); err != nil {\n\t\tfmt.Println(err)\n\t} else {\n\t\tfmt.Println(\"Pong!\")\n\t}\n}", "title": "" }, { "docid": "8b1ad9d544b3bd1fe08efe6d47e1b684", "score": "0.53617734", "text": "func InitTest(t *testing.T) *database.Connection {\n\treturn InitTestWithOptions(t, TestOptions{})\n}", "title": "" }, { "docid": "a517f40d8143583d3f56eca23bfc492a", "score": "0.5348009", "text": "func TestRunner(t *testing.T) {\n\trunner := &sqlRun{make(chan struct{})}\n\tlogic := bl.New(briee.New)\n\tgo runner.Run(logic)\n\tdefer runner.Close()\n\ttime.Sleep(time.Second) //Wait for subscriptions to be setup.\n\terrorCh := logic.RootEmitter().Subscribe(\"storage:error\", string(\"\")).(<-chan string)\n\n\tlogic.RootEmitter().Dispatch(\"new:storage\", bl.Spec{1, \"database_test.db\"})\n\tselect {\n\tcase err := <-errorCh:\n\t\tt.Error(err)\n\tcase <-time.After(time.Second):\n\t}\n\tlogic.RootEmitter().Dispatch(\"storage:shutdown\", struct{}{})\n}", "title": "" }, { "docid": "1ebe5aade38cb42db411c71984a75412", "score": "0.53450495", "text": "func TestUnclCassandra(t *testing.T) {\n\tvalues := common.InmemoryCassandraStoreValues()\n\tvalues[\"image\"] = common.Unclcass\n\tvalues[\"cassconfigmap.cass_server\"] = common.Casshost\n\tvalues[\"cassconfigmap.cass_username\"] = common.Cassandraun\n\tvalues[\"cassconfigmap.cass_password\"] = common.Cassandrapwd\n\thelmOptions := &helm.Options{\n\t\tSetValues: values,\n\t}\n\toptions := &helm.Options{\n\t\tSetValues: common.CassChartValues,\n\t}\n\treleaseName := fmt.Sprintf(\"beapp-%s\", \"unclustercass-\"+strings.ToLower(random.UniqueId()))\n\t// Deploy the chart using `helm install`.\n\tdefer helm.Delete(t, options, common.CassandraRelease, true)\n\tdefer helm.Delete(t, helmOptions, releaseName, true)\n\tcommand(\"helm\", \"repo\", \"add\", \" bitnami\", \"https://charts.bitnami.com/bitnami\")\n\thelm.Install(t, options, common.CassandraChart, common.CassandraRelease)\n\tcassandraDeploy(t, releaseName)\n\thelm.Install(t, helmOptions, common.HelmChartPath, releaseName)\n\ttime.Sleep(50 * time.Second)\n\tcommand(\"/bin/bash\", \"./run.sh\", \"cassandra\")\n\ttime.Sleep(50 * time.Second)\n\tinferenceDeploy(t, releaseName)\n}", "title": "" }, { "docid": "7ffbc9c48ac577c458860191f8eec447", "score": "0.5334774", "text": "func runTestsOnNewDB(c *C, overrider configOverrider, dbName string, tests ...func(dbt *DBTest)) {\n\tdsn := getDSN(overrider, func(config *mysql.Config) {\n\t\tconfig.DBName = \"\"\n\t})\n\tdb, err := sql.Open(\"mysql\", dsn)\n\tc.Assert(err, IsNil, Commentf(\"Error connecting\"))\n\tdefer db.Close()\n\n\t_, err = db.Exec(fmt.Sprintf(\"DROP DATABASE IF EXISTS `%s`;\", dbName))\n\tc.Assert(err, IsNil, Commentf(\"Error drop database %s: %s\", dbName, err))\n\n\t_, err = db.Exec(fmt.Sprintf(\"CREATE DATABASE `%s`;\", dbName))\n\tc.Assert(err, IsNil, Commentf(\"Error create database %s: %s\", dbName, err))\n\n\tdefer func() {\n\t\t_, err = db.Exec(fmt.Sprintf(\"DROP DATABASE IF EXISTS `%s`;\", dbName))\n\t\tc.Assert(err, IsNil, Commentf(\"Error drop database %s: %s\", dbName, err))\n\t}()\n\n\t_, err = db.Exec(fmt.Sprintf(\"USE `%s`;\", dbName))\n\tc.Assert(err, IsNil, Commentf(\"Error use database %s: %s\", dbName, err))\n\n\tdbt := &DBTest{c, db}\n\tfor _, test := range tests {\n\t\ttest(dbt)\n\t\tdbt.db.Exec(\"DROP TABLE IF EXISTS test\")\n\t}\n}", "title": "" }, { "docid": "c5e817a4a5be35da3aaf27a6c1a044fe", "score": "0.5326654", "text": "func TestConnection() {\n\tif err := godotenv.Load(\"../.env\"); err != nil {\n\t\tlogging.Error(\"ENV\", err)\n\t}\n\tConnection()\n}", "title": "" }, { "docid": "81f5762429ee0e6bb8f26bdfa2d83866", "score": "0.53248984", "text": "func testDB(d *sql.DB) error {\n\terr := d.Ping()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b1c8833693086d41a0653fe5c5190c16", "score": "0.52919924", "text": "func (o *Operator) TestPostgresConnectivity() error {\n\treturn nil\n}", "title": "" }, { "docid": "099694e8629442ff44f1f164c09292e1", "score": "0.5286149", "text": "func EnsureDB(t *testing.T) (testdb *sql.DB, cleanup func()) {\n\tt.Helper()\n\n\tvar opts = struct {\n\t\tUser string\n\t\tPassword string\n\t\tPort string\n\t\tHost string\n\t\tSSLMode string\n\t\tDBName string\n\t}{\n\t\tUser: utils.Env(\"POSTGRES_TEST_USER\", \"postgres\"),\n\t\tPassword: utils.Env(\"POSTGRES_TEST_PASSWORD\", \"postgres\"),\n\t\tPort: utils.Env(\"POSTGRES_TEST_PORT\", \"5432\"),\n\t\tHost: utils.Env(\"POSTGRES_TEST_HOST\", \"localhost\"),\n\t\tSSLMode: utils.Env(\"POSTGRES_TEST_SSLMODE\", \"disable\"),\n\t\tDBName: utils.Env(\"POSTGRES_TEST_DATABASE\",\n\t\t\tfmt.Sprintf(\"test_database_%d\", time.Now().UnixNano())),\n\t}\n\n\trootDsn := fmt.Sprintf(\n\t\t\"host='%s' port='%s' user='%s' password=%s dbname='postgres' sslmode='%s'\",\n\t\topts.Host, opts.Port, opts.User, opts.Password, opts.SSLMode)\n\trootdb, err := sql.Open(\"postgres\", rootDsn)\n\tif err != nil {\n\t\tt.Skipf(\"cannot connect to postgres: %s\", err)\n\t}\n\tif err := rootdb.Ping(); err != nil {\n\t\tt.Skipf(\"cannot ping postgres: %s\", err)\n\t}\n\tif _, err := rootdb.Exec(\"CREATE DATABASE \" + opts.DBName); err != nil {\n\t\tt.Fatalf(\"cannot create database: %s\", err)\n\t\trootdb.Close()\n\t}\n\n\ttestDsn := fmt.Sprintf(\n\t\t\"host='%s' port='%s' user='%s' password='%s' dbname='%s' sslmode='%s'\",\n\t\topts.Host, opts.Port, opts.User, opts.Password, opts.DBName, opts.SSLMode)\n\ttestdb, err = sql.Open(\"postgres\", testDsn)\n\tif err != nil {\n\t\tt.Fatalf(\"cannot connect to created database: %s\", err)\n\t}\n\tif err := testdb.Ping(); err != nil {\n\t\tt.Fatalf(\"cannot ping test database: %s\", err)\n\t}\n\n\tif err := EnsureSchema(testdb); err != nil {\n\t\tt.Fatalf(\"cannot ensure schema: %s\", err)\n\t}\n\n\tcleanup = func() {\n\t\ttestdb.Close()\n\t\tif _, err := rootdb.Exec(\"DROP DATABASE \" + opts.DBName); err != nil {\n\t\t\tt.Logf(\"cannot delete test database %q: %s\", opts.DBName, err)\n\t\t}\n\t\trootdb.Close()\n\t}\n\treturn testdb, cleanup\n}", "title": "" }, { "docid": "06922ea16824eb1525253bcc5f303d09", "score": "0.52845585", "text": "func newCockroachDBFromConfig(instanceConfig *config.InstanceConfig) (*sql.DB, error) {\n\t// Note that the migrationsConnection is different from the sql.Open\n\t// connection string since migrations know about CockroachDB, but we use the\n\t// Postgres driver for the database/sql connection since there's no native\n\t// CockroachDB golang driver, and the suggested SQL drive for CockroachDB is\n\t// the Postgres driver since that's the underlying communication protocol it\n\t// uses.\n\tmigrationsConnection := strings.Replace(instanceConfig.DataStoreConfig.ConnectionString, \"postgresql://\", \"cockroach://\", 1)\n\n\tdb, err := sql.Open(\"postgres\", instanceConfig.DataStoreConfig.ConnectionString)\n\tif err != nil {\n\t\treturn nil, skerr.Wrap(err)\n\t}\n\tcockroachdbMigrations, err := cockroachdb.New()\n\tif err != nil {\n\t\treturn nil, skerr.Wrap(err)\n\t}\n\terr = migrations.Up(cockroachdbMigrations, migrationsConnection)\n\tif err != nil {\n\t\treturn nil, skerr.Wrap(err)\n\t}\n\tsklog.Infof(\"Finished applying migrations.\")\n\treturn db, nil\n}", "title": "" }, { "docid": "85a708d9d48215bb4ab63d1504885fd2", "score": "0.5283123", "text": "func TestClientWithDb(t *testing.T) {\n\tteardownSuite := teardownTest(t)\n\tdefer teardownSuite(t)\n\tctx := createContext(t, time.Second*common.DefaultTimeout)\n\n\t// connect with not existed db\n\t_, err := base.NewMilvusClient(ctx, client.Config{\n\t\tAddress: *addr,\n\t\tDBName: common.GenRandomString(4),\n\t})\n\tcommon.CheckErr(t, err, false, \"database not found\")\n\n\t// connect default db -> create a collection in default db\n\tmcDefault, errDefault := base.NewMilvusClient(ctx, client.Config{\n\t\tAddress: *addr,\n\t\tDBName: common.DefaultDb,\n\t})\n\tcommon.CheckErr(t, errDefault, true)\n\t_, _ = mcDefault.ListCollections(ctx)\n\tcollDefault := createDefaultCollection(ctx, t, mcDefault, true, common.DefaultShards)\n\n\t// create a db and create collection in db\n\tdbName := common.GenRandomString(5)\n\terr = mcDefault.CreateDatabase(ctx, dbName)\n\tcommon.CheckErr(t, err, true)\n\n\t// and connect with db\n\tmcDb, err := base.NewMilvusClient(ctx, client.Config{\n\t\tAddress: *addr,\n\t\tDBName: dbName,\n\t})\n\tcommon.CheckErr(t, err, true)\n\tcollDb := createDefaultCollection(ctx, t, mcDb, true, common.DefaultShards)\n\tcollections, _ := mcDb.ListCollections(ctx)\n\tcommon.CheckContainsCollection(t, collections, collDb)\n\n\t// using default db and collection not in\n\t_ = mcDb.UsingDatabase(ctx, common.DefaultDb)\n\tcollections, _ = mcDb.ListCollections(ctx)\n\tcommon.CheckNotContainsCollection(t, collections, collDb)\n\n\t// connect empty db (actually default db)\n\tmcEmpty, err := base.NewMilvusClient(ctx, client.Config{\n\t\tAddress: *addr,\n\t\tDBName: \"\",\n\t})\n\tcommon.CheckErr(t, err, true)\n\tcollections, _ = mcEmpty.ListCollections(ctx)\n\tcommon.CheckContainsCollection(t, collections, collDefault)\n}", "title": "" }, { "docid": "3405ff2eedb817b46fd7dd110a0daa60", "score": "0.52614516", "text": "func TestDBExistence(cfg *config.Config) error {\n\tinfo := fmt.Sprintf(\"host=%s port=%s user=%s password=%s dbname=%s sslmode=disable\",\n\t\tcfg.Host, cfg.Port, cfg.Username, cfg.Password, cfg.DBName)\n\tdb, err := sql.Open(\"postgres\", info)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer db.Close()\n\treturn db.Ping()\n}", "title": "" }, { "docid": "5413b5fde712920c881501531e2fdb5e", "score": "0.5261269", "text": "func CaseTrainSQL(t *testing.T) {\n\ta := assert.New(t)\n\ttrainSQL := fmt.Sprintf(`SELECT *\nFROM %s.%s\nTRAIN DNNClassifier\nWITH model.n_classes = 3, model.hidden_units = [10, 20]\nCOLUMN sepal_length, sepal_width, petal_length, petal_width\nLABEL class\nINTO sqlflow_models.my_dnn_model;`, caseDB, caseTrainTable)\n\n\tconn, err := createRPCConn()\n\ta.NoError(err)\n\tdefer conn.Close()\n\tcli := pb.NewSQLFlowClient(conn)\n\n\tctx, cancel := context.WithTimeout(context.Background(), 300*time.Second)\n\tdefer cancel()\n\n\tstream, err := cli.Run(ctx, sqlRequest(trainSQL))\n\tif err != nil {\n\t\ta.Fail(\"Check if the server started successfully. %v\", err)\n\t}\n\t// call ParseRow only to wait train finish\n\tParseRow(stream)\n\tpredSQL := fmt.Sprintf(`SELECT *\nFROM %s.%s\nPREDICT %s.%s.class\nUSING sqlflow_models.my_dnn_model;`, caseDB, caseTestTable, caseDB, casePredictTable)\n\n\tstream, err = cli.Run(ctx, sqlRequest(predSQL))\n\tif err != nil {\n\t\ta.Fail(\"Check if the server started successfully. %v\", err)\n\t}\n\t// call ParseRow only to wait predict finish\n\tParseRow(stream)\n\tshowPred := fmt.Sprintf(`SELECT *\nFROM %s.%s LIMIT 5;`, caseDB, casePredictTable)\n\n\tstream, err = cli.Run(ctx, sqlRequest(showPred))\n\tif err != nil {\n\t\ta.Fail(\"Check if the server started successfully. %v\", err)\n\t}\n\t_, rows := ParseRow(stream)\n\tfor _, row := range rows {\n\t\t// NOTE: predict result maybe random, only check predicted\n\t\t// class >=0, need to change to more flexible checks than\n\t\t// checking expectedPredClasses := []int64{2, 1, 0, 2, 0}\n\t\tAssertGreaterEqualAny(a, row[4], int64(0))\n\n\t\t// avoiding nil features in predict result\n\t\tnilCount := 0\n\t\tfor ; nilCount < 4 && row[nilCount] == nil; nilCount++ {\n\t\t}\n\t\ta.False(nilCount == 4)\n\t}\n}", "title": "" }, { "docid": "7397642792176aeba919db5d20b76d0d", "score": "0.5257166", "text": "func Test_TstMongo_consume_database_on_session(t *testing.T) {\n\tgiven := bdd.Sentences().Given()\n\n\tgiven(t, \"a new test MongoConnecter m, and DBCollecter(el){db = el}\", func(when bdd.When) {\n\t\tmc := NewTestable(\"\", \"internalTesting\", colIdFixtures)\n\n\t\tvar db *mgo.Database\n\t\tDBCollecter := func(el *mgo.Database) {\n\t\t\tdb = el\n\t\t}\n\n\t\tmc.ConsumeDatabaseOnSession(DBCollecter)\n\n\t\twhen(\"mc.ConsumeDatabaseOnSession(DBCollecter) is called before mc.Connect()\", func(it bdd.It) {\n\t\t\tit(\"db should still be nil\", func(assert bdd.Assert) {\n\t\t\t\tassert.Nil(db)\n\t\t\t})\n\t\t})\n\n\t\tmc.Connect()\n\t\tdefer mc.Disconnect()\n\n\t\tmc.ConsumeDatabaseOnSession(DBCollecter)\n\n\t\twhen(\"mc.ConsumeDatabaseOnSession(DBCollecter) is called after mc.Connect()\", func(it bdd.It) {\n\t\t\tit(\"db should partially equal to mc.Session().DB('test')\", func(assert bdd.Assert) {\n\t\t\t\texp := mc.Session().DB(\"test\")\n\t\t\t\tassert.Equal(exp.Name, db.Name)\n\t\t\t})\n\t\t})\n\t})\n}", "title": "" }, { "docid": "67c096b7118d0968a87639a7b50c0343", "score": "0.5241075", "text": "func TestCreateTableGameSession(t *testing.T) {\n\t// Connect to database created\n\tDB , err := Connect()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tt.Fail()\n\t}\n\tDB, err = CreateTables(DB)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tt.Fail()\n\t}\n\n\tDB.Scan(&GameSession{})\n\n}", "title": "" }, { "docid": "213ec1407d297e9feca38bbb76445752", "score": "0.523135", "text": "func runTest(m *testing.M) int {\n\tmongoURI := cfg.MustURL(\"MONGO_URI\")\n\n\t// Initialize MongoDB using the `tests.TestSession` as the name of the\n\t// master session.\n\tif err := db.RegMasterSession(tests.Context, tests.TestSession, mongoURI.String(), 0); err != nil {\n\t\tfmt.Println(\"Can't register master session: \" + err.Error())\n\t\treturn 1\n\t}\n\n\t// Setup the app for performing tests.\n\ta = routes.API()\n\n\t// Snatch the mongo session so we can create some test data.\n\tdb, err := db.NewMGO(tests.Context, tests.TestSession)\n\tif err != nil {\n\t\tfmt.Println(\"Unable to get Mongo session\")\n\t\treturn 1\n\t}\n\tdefer db.CloseMGO(tests.Context)\n\n\tif err := db.NewCayley(tests.Context, tests.TestSession); err != nil {\n\t\tfmt.Println(\"Unable to get Cayley support\")\n\t}\n\n\tstore, err := db.GraphHandle(tests.Context)\n\tif err != nil {\n\t\tfmt.Println(\"Unable to get Cayley handle\")\n\t\treturn 1\n\t}\n\tdefer store.Close()\n\n\tif err := tstdata.Generate(db); err != nil {\n\t\tfmt.Println(\"Could not generate test data.\")\n\t\treturn 1\n\t}\n\tdefer tstdata.Drop(db)\n\n\t// Load the queries.\n\tif err := loadQuery(db, \"basic.json\"); err != nil {\n\t\tfmt.Println(\"Could not load queries in basic.json\")\n\t\treturn 1\n\t}\n\n\tif err := loadQuery(db, \"basic_view.json\"); err != nil {\n\t\tfmt.Println(\"Could not load queries in basic.json\")\n\t\treturn 1\n\t}\n\tif err := loadQuery(db, \"basic_var.json\"); err != nil {\n\t\tfmt.Println(\"Could not load queries in basic_var.json\")\n\t\treturn 1\n\t}\n\tdefer qfix.Remove(db, \"QTEST_O\")\n\n\tif err := loadScript(db, \"basic_script_pre.json\"); err != nil {\n\t\tfmt.Println(\"Could not load scripts in basic_script_pre.json\")\n\t\treturn 1\n\t}\n\tif err := loadScript(db, \"basic_script_pst.json\"); err != nil {\n\t\tfmt.Println(\"Could not load scripts in basic_script_pst.json\")\n\t\treturn 1\n\t}\n\tdefer sfix.Remove(db, \"STEST_O\")\n\n\tif err := loadMasks(db, \"basic.json\"); err != nil {\n\t\tfmt.Println(\"Could not load masks.\")\n\t\treturn 1\n\t}\n\tdefer mfix.Remove(db, \"test_xenia_data\")\n\n\tif err := loadRelationships(\"context\", db); err != nil {\n\t\tfmt.Println(\"Could not load relationships.\")\n\t\treturn 1\n\t}\n\tdefer relationshipfix.Remove(\"context\", db, relPrefix)\n\n\tif err := loadViews(\"context\", db); err != nil {\n\t\tfmt.Println(\"Could not load views.\")\n\t\treturn 1\n\t}\n\tdefer viewfix.Remove(\"context\", db, viewPrefix)\n\n\tif err := loadPatterns(\"context\", db); err != nil {\n\t\tfmt.Println(\"Could not load patterns\")\n\t\treturn 1\n\t}\n\tdefer patternfix.Remove(\"context\", db, \"PTEST_\")\n\n\tif err := loadItems(\"context\", db, store); err != nil {\n\t\tfmt.Println(\"Could not import items\")\n\t\treturn 1\n\t}\n\tdefer unloadItems(\"context\", db, store)\n\n\treturn m.Run()\n}", "title": "" }, { "docid": "3e84faedd64d78b2933ef50e4c5479c7", "score": "0.5223251", "text": "func NewTestDB() *gorm.DB {\n\tvar (\n\t\terr error\n\t\tdb *gorm.DB\n\t\tcfg = &gorm.Config{DisableForeignKeyConstraintWhenMigrating: true} // 外键约束会在migrate的时候自动关联, 需要手动关闭\n\t\tdbuser = \"root\"\n\t\tdbpwd = \"root\"\n\t\tdbname = \"qor_test\"\n\t\tdbhost = \"localhost\"\n\t)\n\n\tif os.Getenv(\"DB_USER\") != \"\" {\n\t\tdbuser = os.Getenv(\"DB_USER\")\n\t}\n\n\tif os.Getenv(\"DB_PWD\") != \"\" {\n\t\tdbpwd = os.Getenv(\"DB_PWD\")\n\t}\n\n\tif os.Getenv(\"DB_NAME\") != \"\" {\n\t\tdbname = os.Getenv(\"DB_NAME\")\n\t}\n\n\tif os.Getenv(\"DB_HOST\") != \"\" {\n\t\tdbhost = os.Getenv(\"DB_HOST\")\n\t}\n\n\tswitch os.Getenv(\"TEST_DB\") {\n\tcase \"postgres\", \"pg\":\n\t\tdsn := fmt.Sprintf(\"postgres://%s:%s@%s/%s?sslmode=disable\",\n\t\t\tdbuser,\n\t\t\tdbpwd,\n\t\t\tdbhost,\n\t\t\tdbname,\n\t\t)\n\t\tdb, err = gorm.Open(postgres.Open(dsn), cfg)\n\tcase \"sqlite\", \"sqlite3\":\n\t\tdb, err = gorm.Open(sqlite.Open(dbname), cfg)\n\tdefault: // mysql\n\t\tdsn := fmt.Sprintf(\"%s:%s@/%s?charset=utf8&parseTime=True&loc=Local\",\n\t\t\tdbuser,\n\t\t\tdbpwd,\n\t\t\tdbname,\n\t\t)\n\t\t// CREATE USER 'qor'@'localhost' IDENTIFIED BY 'qor';\n\t\t// CREATE DATABASE qor_test;\n\t\t// GRANT ALL ON qor_test.* TO 'qor'@'localhost';\n\t\tdb, err = gorm.Open(mysql.Open(dsn), cfg)\n\t}\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif os.Getenv(\"DEBUG\") != \"\" {\n\t\tdb.Logger.LogMode(gorm.LogInfo)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "609d6d326f19520d668e6fd35744bdd2", "score": "0.5219941", "text": "func testDB(t *testing.T) (*sdb.DB, func()) {\n\tpath := testPath()\n\tkey := keys.Rand32()\n\treturn testDBWithOpts(t, path, key)\n}", "title": "" }, { "docid": "6b58748040251b4a912ff53f8d469c31", "score": "0.52085173", "text": "func initTestDb(db apid.DB) {\n\ttx, err := db.Begin()\n\tExpect(err).Should(Succeed())\n\tdefer tx.Rollback()\n\t_, err = tx.Exec(`\n\t\tCREATE TABLE metadata_runtime_entity_metadata (\n\t\tid text,\n\t\torganization_id text,\n\t\tenvironment_id text,\n\t\tbean_blob_id text,\n\t\tresource_blob_id text,\n\t\ttype text,\n\t\tname text,\n\t\trevision text,\n\t\tpath text,\n\t\tcreated_at blob,\n\t\tcreated_by text,\n\t\tupdated_at blob,\n\t\tupdated_by text,\n\t\t_change_selector text,\n\t\tprimary key (id));\n\t`)\n\tExpect(err).Should(Succeed())\n\n\t// ready blob, empty resource\n\t_, err = tx.Exec(`\n\t\tINSERT INTO \"metadata_runtime_entity_metadata\" VALUES(\n\t\t'1dc4895e-6494-4b59-979f-5f4c89c073b4',\n\t\t'73fcac6c-5d9f-44c1-8db0-333efda3e6e8',\n\t\t'',\n\t\t'gcs:SHA-512:39ca7ae89bb9468af34df8bc873748b4035210c91bcc01359c092c1d51364b5f3df06bc69a40621acfaa46791af9ea41bc0f3429a84738ba1a7c8d394859601a',\n\t\tNULL,\n\t\t'ENVIRONMENT',\n\t\t'Org1',\n\t\t'',\n\t\t'/organizations/edgex01//environments/prod/',\n\t\t'2017-06-27 03:14:45.748+00:00',\n\t\t'defaultUser',\n\t\t'2017-06-27 03:15:03.557+00:00',\n\t\t'defaultUser',\n\t\t'73fcac6c-5d9f-44c1-8db0-333efda3e6e8'\n\t\t);\n\t`)\n\tExpect(err).Should(Succeed())\n\n\t// ready blob, ready resource\n\t_, err = tx.Exec(`\n\t\tINSERT INTO \"metadata_runtime_entity_metadata\" VALUES(\n\t\t'319963ff-217e-4ecc-8d6e-c3665e962d1e',\n\t\t'73fcac6c-5d9f-44c1-8db0-333efda3e6e8',\n\t\t'',\n\t\t'gcs:SHA-512:39ca7ae89bb9468af34df8bc873748b4035210c91bcc01359c092c1d51364b5f3df06bc69a40621acfaa46791af9ea41bc0f3429a84738ba1a7c8d394859601a',\n\t\t'gcs:SHA-512:ddd64d03c365dde4bb175cabb7d84beeb81dae11f1e326b30c9035b74be3ecb537187bdf35568647aa1b2adb341499516ca2faf2d73b78b1b98cba038f2a9e3c',\n\t\t'ORGANIZATION',\n\t\t'Org1',\n\t\t'',\n\t\t'/organizations/Org1/',\n\t\t'2017-06-27 03:14:45.748+00:00',\n\t\t'defaultUser',\n\t\t'2017-06-27 03:15:03.557+00:00',\n\t\t'defaultUser',\n\t\t'73fcac6c-5d9f-44c1-8db0-333efda3e6e8'\n\t\t);\n\t`)\n\tExpect(err).Should(Succeed())\n\n\t// ready blob, unready resource\n\t_, err = tx.Exec(`\n\t\tINSERT INTO \"metadata_runtime_entity_metadata\" VALUES(\n\t\t'3af44bb7-0a74-4283-860c-3561e6c19132',\n\t\t'73fcac6c-5d9f-44c1-8db0-333efda3e6e8',\n\t\t'',\n\t\t'gcs:SHA-512:39ca7ae89bb9468af34df8bc873748b4035210c91bcc01359c092c1d51364b5f3df06bc69a40621acfaa46791af9ea41bc0f3429a84738ba1a7c8d394859601a',\n\t\t'gcs:SHA-512:0c648779da035bfe0ac21f6268049aa0ae74d9d6411dadefaec33991e55c2d66c807e06f7ef84e0947f7c7d63b8c9e97cf0684cbef9e0a86b947d73c74ae7455',\n\t\t'ORGANIZATION',\n\t\t'Org1',\n\t\t'',\n\t\t'/organizations/Org1/',\n\t\t'2017-06-27 03:14:45.748+00:00',\n\t\t'defaultUser',\n\t\t'2017-06-27 03:15:03.557+00:00',\n\t\t'defaultUser',\n\t\t'73fcac6c-5d9f-44c1-8db0-333efda3e6e8'\n\t\t);\n\t`)\n\tExpect(err).Should(Succeed())\n\n\t// unready blob, empty resource\n\t_, err = tx.Exec(`\n\t\tINSERT INTO \"metadata_runtime_entity_metadata\" VALUES(\n\t\t'd5ffd9db-4795-43eb-b645-d2a0b6c8ac6a',\n\t\t'73fcac6c-5d9f-44c1-8db0-333efda3e6e8',\n\t\t'ada76573-68e3-4f1a-a0f9-cbc201a97e80',\n\t\t'gcs:SHA-512:8fcc902465ccb32ceff25fa9f6fb28e3b314dbc2874c0f8add02f4e29c9e2798d344c51807aa1af56035cf09d39c800cf605d627ba65723f26d8b9c83c82d2f2',\n\t\t'',\n\t\t'ENVIRONMENT',\n\t\t'test',\n\t\t'',\n\t\t'/organizations/Org1//environments/test/',\n\t\t'2017-06-27 03:14:46.018+00:00',\n\t\t'defaultUser',\n\t\t'2017-06-27 03:14:46.018+00:00',\n\t\t'defaultUser',\n\t\t'ada76573-68e3-4f1a-a0f9-cbc201a97e80'\n\t\t);\n\t`)\n\tExpect(err).Should(Succeed())\n\n\t// unready blob, ready resource\n\t_, err = tx.Exec(`\n\t\tINSERT INTO \"metadata_runtime_entity_metadata\" VALUES(\n\t\t'84ac8d68-b3d1-4bcc-ad0d-c6a0ed67e16c',\n\t\t'73fcac6c-5d9f-44c1-8db0-333efda3e6e8',\n\t\t'ada76573-68e3-4f1a-a0f9-cbc201a97e80',\n\t\t'gcs:SHA-512:8fcc902465ccb32ceff25fa9f6fb28e3b314dbc2874c0f8add02f4e29c9e2798d344c51807aa1af56035cf09d39c800cf605d627ba65723f26d8b9c83c82d2f2',\n\t\t'gcs:SHA-512:ddd64d03c365dde4bb175cabb7d84beeb81dae11f1e326b30c9035b74be3ecb537187bdf35568647aa1b2adb341499516ca2faf2d73b78b1b98cba038f2a9e3c',\n\t\t'ENVIRONMENT',\n\t\t'test',\n\t\t'',\n\t\t'/organizations/Org1//environments/test/',\n\t\t'2017-06-27 03:14:46.018+00:00',\n\t\t'defaultUser',\n\t\t'2017-06-27 03:14:46.018+00:00',\n\t\t'defaultUser',\n\t\t'ada76573-68e3-4f1a-a0f9-cbc201a97e80'\n\t\t);\n\t`)\n\tExpect(err).Should(Succeed())\n\n\t// unready blob, unready resource\n\t_, err = tx.Exec(`\n\t\tINSERT INTO \"metadata_runtime_entity_metadata\" VALUES(\n\t\t'3ecd351c-1173-40bf-b830-c194e5ef9038',\n\t\t'73fcac6c-5d9f-44c1-8db0-333efda3e6e8',\n\t\t'ada76573-68e3-4f1a-a0f9-cbc201a97e80',\n\t\t'gcs:SHA-512:8fcc902465ccb32ceff25fa9f6fb28e3b314dbc2874c0f8add02f4e29c9e2798d344c51807aa1af56035cf09d39c800cf605d627ba65723f26d8b9c83c82d2f2',\n\t\t'gcs:SHA-512:0c648779da035bfe0ac21f6268049aa0ae74d9d6411dadefaec33991e55c2d66c807e06f7ef84e0947f7c7d63b8c9e97cf0684cbef9e0a86b947d73c74ae7455',\n\t\t'ENVIRONMENT',\n\t\t'test',\n\t\t'',\n\t\t'/organizations/Org1//environments/test/',\n\t\t'2017-06-27 03:14:46.018+00:00',\n\t\t'defaultUser',\n\t\t'2017-06-27 03:14:46.018+00:00',\n\t\t'defaultUser',\n\t\t'ada76573-68e3-4f1a-a0f9-cbc201a97e80'\n\t\t);\n\t`)\n\tExpect(err).Should(Succeed())\n\tExpect(tx.Commit()).Should(Succeed())\n}", "title": "" }, { "docid": "f48c2f369cd2a6a96758febfa80d92ee", "score": "0.5201621", "text": "func beforeAll() {\n\tcluster := gocql.NewCluster(\"localhost\")\n\tcluster.Consistency = gocql.LocalQuorum\n\tcluster.Keyspace = \"system\"\n\n\tsession, err := cluster.CreateSession()\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to connect to database during beforeAll, %v\", err)\n\t}\n\n\terr = session.Query(\n\t\tfmt.Sprintf(\n\t\t\t\"create keyspace if not exists %s with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }\",\n\t\t\tkeyspace,\n\t\t),\n\t).Exec()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tcluster.Keyspace = keyspace\n\tcluster.Timeout = time.Second * 2\n\tsession, err = cluster.CreateSession()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = session.Query(\n\t\tfmt.Sprintf(\"create table if not exists %s(id UUID, title text, PRIMARY KEY(id))\", tableName),\n\t).Exec()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "3908d2144ea9b54de6950f29468c0ef1", "score": "0.5186144", "text": "func TestConnect(t *testing.T) {\n\ttargets := []string{\"localhost\", \"localhost:161\"}\n\tfor _, target := range targets {\n\t\tclient, err := NewClient(target, \"public\", Version2c, 5)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Unable to connect to %s: %s\\n\", target, err)\n\t\t}\n\t\tclient.Close()\n\t}\n}", "title": "" }, { "docid": "d9f742e6414389783febe6e498739064", "score": "0.51853347", "text": "func TestConnect(t *testing.T) {\n\n\tt.Run(\"valid connection, no dependency mode\", func(t *testing.T) {\n\t\tt.Parallel()\n\n\t\tclient, err := Connect(\n\t\t\tcontext.Background(),\n\t\t\ttestLocalConnectionURL,\n\t\t\ttestMaxActiveConnections,\n\t\t\ttestMaxIdleConnections,\n\t\t\ttestMaxConnLifetime,\n\t\t\ttestIdleTimeout,\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t)\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, client)\n\t\tassert.NotNil(t, client.Pool)\n\t\tassert.Equal(t, \"\", client.DependencyScriptSha)\n\t\tassert.Equal(t, 0, len(client.ScriptsLoaded))\n\n\t\t// Close\n\t\tclient.Close()\n\t})\n\n\tt.Run(\"valid connection, new relic enabled\", func(t *testing.T) {\n\t\tt.Parallel()\n\n\t\tclient, err := Connect(\n\t\t\tcontext.Background(),\n\t\t\ttestLocalConnectionURL,\n\t\t\ttestMaxActiveConnections,\n\t\t\ttestMaxIdleConnections,\n\t\t\ttestMaxConnLifetime,\n\t\t\ttestIdleTimeout,\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t)\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, client)\n\t\tassert.NotNil(t, client.Pool)\n\t\tassert.Equal(t, \"\", client.DependencyScriptSha)\n\t\tassert.Equal(t, 0, len(client.ScriptsLoaded))\n\n\t\t// Close\n\t\tclient.Close()\n\t})\n\n\tt.Run(\"valid connection, with dependency mode\", func(t *testing.T) {\n\t\tif testing.Short() {\n\t\t\tt.Skip(\"skipping live local redis tests\")\n\t\t}\n\n\t\tclient, err := Connect(\n\t\t\tcontext.Background(),\n\t\t\ttestLocalConnectionURL,\n\t\t\ttestMaxActiveConnections,\n\t\t\ttestMaxIdleConnections,\n\t\t\ttestMaxConnLifetime,\n\t\t\ttestIdleTimeout,\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t)\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, client)\n\t\tassert.NotNil(t, client.Pool)\n\t\tassert.Equal(t, testKillDependencyHash, client.DependencyScriptSha)\n\t\tassert.Equal(t, 1, len(client.ScriptsLoaded))\n\n\t\t// Close\n\t\tclient.Close()\n\t})\n\n\tt.Run(\"valid connection, custom options\", func(t *testing.T) {\n\t\tt.Parallel()\n\n\t\tclient, err := Connect(\n\t\t\tcontext.Background(),\n\t\t\ttestLocalConnectionURL,\n\t\t\ttestMaxActiveConnections,\n\t\t\ttestMaxIdleConnections,\n\t\t\ttestMaxConnLifetime,\n\t\t\ttestIdleTimeout,\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\tredis.DialKeepAlive(10*time.Second),\n\t\t)\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, client)\n\t\tassert.NotNil(t, client.Pool)\n\t\tassert.Equal(t, \"\", client.DependencyScriptSha)\n\t\tassert.Equal(t, 0, len(client.ScriptsLoaded))\n\n\t\t// Close\n\t\tclient.Close()\n\t})\n\n\tt.Run(\"invalid connection\", func(t *testing.T) {\n\t\tt.Parallel()\n\n\t\tclient, err := Connect(\n\t\t\tcontext.Background(),\n\t\t\t\"\",\n\t\t\ttestMaxActiveConnections,\n\t\t\ttestMaxIdleConnections,\n\t\t\ttestMaxConnLifetime,\n\t\t\ttestIdleTimeout,\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t)\n\t\tassert.Error(t, err)\n\t\tassert.Nil(t, client)\n\t})\n}", "title": "" }, { "docid": "eb39747b6ed7367d882df653c1ddcf60", "score": "0.51822037", "text": "func initTests() {\n\tif db != nil {\n\t\treturn\n\t}\n\n\tdatabaseUser := os.Getenv(\"GORTH_TEST_DB_USER\")\n\tdatabasePassword := os.Getenv(\"GORTH_TEST_DB_PASSWORD\")\n\tdatabaseName := os.Getenv(\"GORTH_TEST_DB_NAME\")\n\n\tif len(databasePassword) > 0 {\n\t\tdatabasePassword = fmt.Sprintf(\":%s\", databasePassword)\n\t}\n\terr := Setup(\n\t\t\"mysql\",\n\t\tfmt.Sprintf(\"%s%s@/%s\", databaseUser, databasePassword, databaseName))\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"setup failed : %s\", err))\n\t}\n\n\t_, err = db.Exec(\"DROP TABLE Users\")\n\tif err != nil {\n\t\tfmt.Printf(\"setup failed to drop Users table : %s\", err)\n\t}\n\n\terr = CreateUsersTable()\n\tif err != nil {\n\t\tfmt.Printf(\"setup failed to create Users table : %s\", err)\n\t}\n}", "title": "" }, { "docid": "655bc613a83aa5ff2ce92b4cccf67de5", "score": "0.5179023", "text": "func TestParse(t *testing.T) {\n\ttestData := []struct {\n\t\tsql string\n\t}{\n\t\t{``},\n\t\t{`VALUES (\"\")`},\n\n\t\t{`BEGIN TRANSACTION`},\n\t\t{`BEGIN TRANSACTION READ ONLY`},\n\t\t{`BEGIN TRANSACTION READ WRITE`},\n\t\t{`BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE`},\n\t\t{`BEGIN TRANSACTION PRIORITY LOW`},\n\t\t{`BEGIN TRANSACTION PRIORITY NORMAL`},\n\t\t{`BEGIN TRANSACTION PRIORITY HIGH`},\n\t\t{`BEGIN TRANSACTION AS OF SYSTEM TIME '2018-12-18'`},\n\t\t{`BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE, AS OF SYSTEM TIME '2018-12-18'`},\n\t\t{`BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE, PRIORITY LOW, AS OF SYSTEM TIME '2018-12-18'`},\n\t\t{`BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE, PRIORITY LOW, READ ONLY, AS OF SYSTEM TIME '-1ns'`},\n\t\t{`BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE, PRIORITY HIGH`},\n\t\t{`BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE, PRIORITY HIGH, READ WRITE`},\n\t\t{`COMMIT TRANSACTION`},\n\t\t{`ROLLBACK TRANSACTION`},\n\t\t{`SAVEPOINT foo`},\n\t\t{`SAVEPOINT \"foo bar\"`},\n\n\t\t{`CREATE DATABASE a`},\n\t\t{`EXPLAIN CREATE DATABASE a`},\n\t\t{`CREATE DATABASE a TEMPLATE = 'template0'`},\n\t\t{`CREATE DATABASE a TEMPLATE = 'invalid'`},\n\t\t{`CREATE DATABASE a ENCODING = 'UTF8'`},\n\t\t{`CREATE DATABASE a ENCODING = 'INVALID'`},\n\t\t{`CREATE DATABASE a LC_COLLATE = 'C.UTF-8'`},\n\t\t{`CREATE DATABASE a LC_COLLATE = 'INVALID'`},\n\t\t{`CREATE DATABASE a LC_CTYPE = 'C.UTF-8'`},\n\t\t{`CREATE DATABASE a LC_CTYPE = 'INVALID'`},\n\t\t{`CREATE DATABASE a TEMPLATE = 'template0' ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'INVALID'`},\n\t\t{`CREATE DATABASE IF NOT EXISTS a`},\n\t\t{`CREATE DATABASE IF NOT EXISTS a TEMPLATE = 'template0'`},\n\t\t{`CREATE DATABASE IF NOT EXISTS a TEMPLATE = 'invalid'`},\n\t\t{`CREATE DATABASE IF NOT EXISTS a ENCODING = 'UTF8'`},\n\t\t{`CREATE DATABASE IF NOT EXISTS a ENCODING = 'INVALID'`},\n\t\t{`CREATE DATABASE IF NOT EXISTS a LC_COLLATE = 'C.UTF-8'`},\n\t\t{`CREATE DATABASE IF NOT EXISTS a LC_COLLATE = 'INVALID'`},\n\t\t{`CREATE DATABASE IF NOT EXISTS a LC_CTYPE = 'C.UTF-8'`},\n\t\t{`CREATE DATABASE IF NOT EXISTS a LC_CTYPE = 'INVALID'`},\n\t\t{`CREATE DATABASE IF NOT EXISTS a TEMPLATE = 'template0' ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'INVALID'`},\n\t\t{`CREATE SCHEMA IF NOT EXISTS foo`},\n\t\t{`CREATE SCHEMA foo`},\n\n\t\t{`CREATE INDEX a ON b (c)`},\n\t\t{`CREATE INDEX CONCURRENTLY a ON b (c)`},\n\t\t{`EXPLAIN CREATE INDEX a ON b (c)`},\n\t\t{`CREATE INDEX a ON b.c (d)`},\n\t\t{`CREATE INDEX ON a (b)`},\n\t\t{`CREATE INDEX ON a (b) STORING (c)`},\n\t\t{`CREATE INDEX ON a (b) WHERE c > 3`},\n\t\t{`CREATE INDEX ON a (b) INTERLEAVE IN PARENT c (d)`},\n\t\t{`CREATE INDEX ON a (b) INTERLEAVE IN PARENT c.d (e)`},\n\t\t{`CREATE INDEX ON a (b ASC, c DESC)`},\n\t\t{`CREATE INDEX ON a (b NULLS FIRST, c ASC NULLS FIRST, d DESC NULLS LAST)`},\n\t\t{`CREATE INDEX IF NOT EXISTS i ON a (b) WHERE c > 3`},\n\t\t{`CREATE UNIQUE INDEX a ON b (c)`},\n\t\t{`CREATE UNIQUE INDEX a ON b (c) STORING (d)`},\n\t\t{`CREATE UNIQUE INDEX a ON b (c) WHERE d > 3`},\n\t\t{`CREATE UNIQUE INDEX a ON b (c) INTERLEAVE IN PARENT d (e, f)`},\n\t\t{`CREATE UNIQUE INDEX a ON b (c) INTERLEAVE IN PARENT d.e (f, g)`},\n\t\t{`CREATE UNIQUE INDEX a ON b.c (d)`},\n\t\t{`CREATE INVERTED INDEX a ON b (c)`},\n\t\t{`CREATE INVERTED INDEX a ON b.c (d)`},\n\t\t{`CREATE INVERTED INDEX a ON b (c) STORING (d)`},\n\t\t{`CREATE INVERTED INDEX a ON b (c) WHERE d > 3`},\n\t\t{`CREATE INVERTED INDEX a ON b (c) INTERLEAVE IN PARENT d (e)`},\n\t\t{`CREATE INVERTED INDEX IF NOT EXISTS a ON b (c) WHERE d > 3`},\n\n\t\t{`CREATE TABLE a ()`},\n\t\t{`CREATE TEMPORARY TABLE a (b INT8)`},\n\t\t{`EXPLAIN CREATE TABLE a ()`},\n\t\t{`CREATE TABLE a (b INT8)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8)`},\n\t\t{`CREATE TABLE a (b CHAR)`},\n\t\t{`CREATE TABLE a (b CHAR(3))`},\n\t\t{`CREATE TABLE a (b VARCHAR)`},\n\t\t{`CREATE TABLE a (b VARCHAR(3))`},\n\t\t{`CREATE TABLE a (b STRING)`},\n\t\t{`CREATE TABLE a (b STRING(3))`},\n\t\t{`CREATE TABLE a (b FLOAT4)`},\n\t\t{`CREATE TABLE a (b FLOAT8)`},\n\t\t{`CREATE TABLE a (b SERIAL8)`},\n\t\t{`CREATE TABLE a (b TIME)`},\n\t\t{`CREATE TABLE a (b TIMETZ)`},\n\t\t{`CREATE TABLE a (b TIME(3))`},\n\t\t{`CREATE TABLE a (b TIMETZ(3))`},\n\t\t{`CREATE TABLE a (b GEOGRAPHY)`},\n\t\t{`CREATE TABLE a (b GEOGRAPHY(POINT))`},\n\t\t{`CREATE TABLE a (b GEOGRAPHY(POINT,4326))`},\n\t\t{`CREATE TABLE a (b GEOGRAPHY(LINESTRING,4326))`},\n\t\t{`CREATE TABLE a (b GEOGRAPHY(POLYGON,4326))`},\n\t\t{`CREATE TABLE a (b GEOGRAPHY(MULTIPOINT,4326))`},\n\t\t{`CREATE TABLE a (b GEOGRAPHY(MULTILINESTRING,4326))`},\n\t\t{`CREATE TABLE a (b GEOGRAPHY(MULTIPOLYGON,4326))`},\n\t\t{`CREATE TABLE a (b GEOGRAPHY(GEOMETRY,4326))`},\n\t\t{`CREATE TABLE a (b GEOGRAPHY(GEOMETRYCOLLECTION,4326))`},\n\t\t{`CREATE TABLE a (b GEOMETRY)`},\n\t\t{`CREATE TABLE a (b GEOMETRY(POINT))`},\n\t\t{`CREATE TABLE a (b GEOMETRY(POINT,4326))`},\n\t\t{`CREATE TABLE a (b UUID)`},\n\t\t{`CREATE TABLE a (b INET)`},\n\t\t{`CREATE TABLE a (b \"char\")`},\n\t\t{`CREATE TABLE a (b INT8 NULL)`},\n\t\t{`CREATE TABLE a (b INT8 CONSTRAINT maybe NULL)`},\n\t\t{`CREATE TABLE a (b INT8 NOT NULL)`},\n\t\t{`CREATE TABLE a (b INT8 CONSTRAINT always NOT NULL)`},\n\t\t{`CREATE TABLE a (b INT8 PRIMARY KEY)`},\n\t\t{`CREATE TABLE a (b INT8 UNIQUE)`},\n\t\t{`CREATE TABLE a (b INT8 NULL PRIMARY KEY)`},\n\t\t{`CREATE TABLE a (b INT8 DEFAULT 1)`},\n\t\t{`CREATE TABLE a (b INT8 CONSTRAINT one DEFAULT 1)`},\n\t\t{`CREATE TABLE a (b INT8 DEFAULT now())`},\n\t\t{`CREATE TABLE a (a INT8 CHECK (a > 0))`},\n\t\t{`CREATE TABLE a (a INT8 CONSTRAINT positive CHECK (a > 0))`},\n\t\t{`CREATE TABLE a (a INT8 DEFAULT 1 CHECK (a > 0))`},\n\t\t{`CREATE TABLE a (a INT8 CONSTRAINT one DEFAULT 1 CHECK (a > 0))`},\n\t\t{`CREATE TABLE a (a INT8 DEFAULT 1 CONSTRAINT positive CHECK (a > 0))`},\n\t\t{`CREATE TABLE a (a INT8 CONSTRAINT one DEFAULT 1 CONSTRAINT positive CHECK (a > 0))`},\n\t\t{`CREATE TABLE a (a INT8 CONSTRAINT one CHECK (a > 0) CONSTRAINT two CHECK (a < 10))`},\n\t\t// \"0\" lost quotes previously.\n\t\t{`CREATE TABLE a (b INT8, c STRING, PRIMARY KEY (b, c, \"0\"))`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON UPDATE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE RESTRICT ON UPDATE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON UPDATE CASCADE)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE CASCADE)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE CASCADE ON UPDATE CASCADE)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON UPDATE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE SET NULL ON UPDATE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON UPDATE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE SET DEFAULT ON UPDATE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE RESTRICT ON UPDATE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE SET DEFAULT ON UPDATE CASCADE)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE CASCADE ON UPDATE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other ON DELETE SET NULL ON UPDATE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other MATCH FULL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other MATCH FULL ON DELETE RESTRICT ON UPDATE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other MATCH FULL ON DELETE SET DEFAULT ON UPDATE CASCADE)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other MATCH FULL ON DELETE CASCADE ON UPDATE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b) REFERENCES other MATCH FULL ON DELETE SET NULL ON UPDATE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b, c) REFERENCES other MATCH FULL)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b, c) REFERENCES other (x, y) MATCH FULL)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b, c) REFERENCES other)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FOREIGN KEY (b, c) REFERENCES other (x, y))`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, CONSTRAINT s FOREIGN KEY (b, c) REFERENCES other (x, y))`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, CONSTRAINT s FOREIGN KEY (b, c) REFERENCES other (x, y) MATCH FULL)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, CONSTRAINT s FOREIGN KEY (b, c) REFERENCES other (x, y) MATCH FULL ON UPDATE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, CONSTRAINT s FOREIGN KEY (b, c) REFERENCES other (x, y) MATCH FULL ON DELETE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, CONSTRAINT s FOREIGN KEY (b, c) REFERENCES other (x, y) MATCH FULL ON DELETE SET DEFAULT ON UPDATE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, INDEX (b, c))`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, INDEX d (b, c))`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, CONSTRAINT d UNIQUE (b, c))`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, CONSTRAINT d UNIQUE (b, c) INTERLEAVE IN PARENT d (e, f))`},\n\t\t{`CREATE TABLE a (b INT8, UNIQUE (b))`},\n\t\t{`CREATE TABLE a (b INT8, UNIQUE (b) STORING (c))`},\n\t\t{`CREATE TABLE a (b INT8, INDEX (b))`},\n\t\t{`CREATE TABLE a (b INT8, INVERTED INDEX (b))`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON UPDATE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE RESTRICT ON UPDATE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON UPDATE CASCADE)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE CASCADE)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE CASCADE ON UPDATE CASCADE)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON UPDATE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE SET NULL ON UPDATE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON UPDATE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE SET DEFAULT ON UPDATE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE RESTRICT ON UPDATE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE SET DEFAULT ON UPDATE CASCADE)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE CASCADE ON UPDATE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON DELETE SET NULL ON UPDATE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON UPDATE CASCADE)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON UPDATE SET NULL)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo ON UPDATE SET DEFAULT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo (bar))`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo MATCH FULL)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo MATCH FULL ON UPDATE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo MATCH FULL ON DELETE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo MATCH FULL ON DELETE RESTRICT ON UPDATE RESTRICT)`},\n\t\t{`CREATE TABLE a (b INT8, c INT8 REFERENCES foo (bar) MATCH FULL)`},\n\t\t{`CREATE TABLE a (b INT8, INDEX (b) STORING (c))`},\n\t\t{`CREATE TABLE a (b INT8, INDEX (b) WHERE b > 3)`},\n\t\t{`CREATE TABLE a (b INT8, INVERTED INDEX (b) WHERE b > 3)`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, INDEX (b ASC, c DESC) STORING (c))`},\n\t\t{`CREATE TABLE a (b INT8, INDEX (b) INTERLEAVE IN PARENT c (d, e))`},\n\t\t{`CREATE TABLE a (b INT8, FAMILY (b))`},\n\t\t{`CREATE TABLE a (b INT8, c STRING, FAMILY foo (b), FAMILY (c))`},\n\t\t{`CREATE TABLE a (b INT8) INTERLEAVE IN PARENT foo (c, d)`},\n\t\t{`CREATE TABLE a (b INT8) INTERLEAVE IN PARENT foo (c) CASCADE`},\n\t\t{`CREATE TABLE a.b (b INT8)`},\n\t\t{`CREATE TABLE IF NOT EXISTS a (b INT8)`},\n\t\t{`CREATE TABLE a (b INT8 AS (a + b) STORED)`},\n\t\t{`CREATE TABLE view (view INT8)`},\n\n\t\t{`CREATE TABLE a (b INT8 CONSTRAINT c PRIMARY KEY)`},\n\t\t{`CREATE TABLE a (b INT8 CONSTRAINT c NULL)`},\n\t\t{`CREATE TABLE a (b INT8 CONSTRAINT c UNIQUE)`},\n\t\t{`CREATE TABLE a (b INT8 CONSTRAINT c DEFAULT d)`},\n\t\t{`CREATE TABLE a (b INT8 CONSTRAINT c CHECK (d))`},\n\t\t{`CREATE TABLE a (b INT8 CONSTRAINT c REFERENCES d)`},\n\n\t\t{`CREATE TABLE a (b INT8) PARTITION BY LIST (b) (PARTITION p1 VALUES IN (1, DEFAULT), PARTITION p2 VALUES IN ((1, 2), (3, 4)))`},\n\t\t// This monstrosity was added on the assumption that it's more readable\n\t\t// than all on one line. Feel free to rip it out if you come across it\n\t\t// and disagree.\n\t\t{regexp.MustCompile(`\\n\\s*`).ReplaceAllLiteralString(\n\t\t\t`CREATE TABLE a (b INT8, c INT8, d INT8) PARTITION BY LIST (b) (\n\t\t\t\tPARTITION p1 VALUES IN (1) PARTITION BY LIST (c) (\n\t\t\t\t\tPARTITION p1_1 VALUES IN (3), PARTITION p1_2 VALUES IN (4, 5)\n\t\t\t\t), PARTITION p2 VALUES IN (6) PARTITION BY RANGE (c) (\n\t\t\t\t\tPARTITION p2_1 VALUES FROM (7) TO (8) PARTITION BY LIST (d) (\n\t\t\t\t\t\tPARTITION p2_1_1 VALUES IN (8)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)`, ``),\n\t\t},\n\t\t{`CREATE TABLE a () INTERLEAVE IN PARENT b (c) PARTITION BY LIST (d) (PARTITION e VALUES IN (1))`},\n\t\t{`CREATE TABLE IF NOT EXISTS a () PARTITION BY LIST (b) (PARTITION c VALUES IN (1))`},\n\t\t{`CREATE TABLE a (INDEX (b) PARTITION BY LIST (c) (PARTITION d VALUES IN (1)))`},\n\t\t{`CREATE TABLE a (UNIQUE (b) PARTITION BY LIST (c) (PARTITION d VALUES IN (1)))`},\n\t\t{`CREATE INDEX ON a (b) PARTITION BY LIST (c) (PARTITION d VALUES IN (1))`},\n\t\t{`CREATE INDEX IF NOT EXISTS a ON b (c) PARTITION BY LIST (d) (PARTITION e VALUES IN (1))`},\n\t\t{`ALTER TABLE a PARTITION BY LIST (b) (PARTITION p1 VALUES IN (1))`},\n\t\t{`ALTER INDEX a@idx PARTITION BY LIST (b) (PARTITION p1 VALUES IN (1))`},\n\n\t\t{`CREATE TABLE a AS SELECT * FROM b`},\n\t\t{`CREATE TABLE IF NOT EXISTS a AS SELECT * FROM b`},\n\t\t{`CREATE TABLE a AS SELECT * FROM b ORDER BY c`},\n\t\t{`CREATE TABLE IF NOT EXISTS a AS SELECT * FROM b ORDER BY c`},\n\t\t{`CREATE TABLE a AS SELECT * FROM b LIMIT 3`},\n\t\t{`CREATE TABLE IF NOT EXISTS a AS SELECT * FROM b LIMIT 3`},\n\t\t{`CREATE TABLE a AS VALUES ('one', 1), ('two', 2), ('three', 3)`},\n\t\t{`CREATE TABLE IF NOT EXISTS a AS VALUES ('one', 1), ('two', 2), ('three', 3)`},\n\t\t{`CREATE TABLE a (str, num) AS VALUES ('one', 1), ('two', 2), ('three', 3)`},\n\t\t{`CREATE TABLE IF NOT EXISTS a (str, num) AS VALUES ('one', 1), ('two', 2), ('three', 3)`},\n\t\t{`CREATE TABLE a AS SELECT * FROM b UNION SELECT * FROM c`},\n\t\t{`CREATE TABLE IF NOT EXISTS a AS SELECT * FROM b UNION SELECT * FROM c`},\n\t\t{`CREATE TABLE a AS SELECT * FROM b UNION VALUES ('one', 1) ORDER BY c LIMIT 5`},\n\t\t{`CREATE TABLE IF NOT EXISTS a AS SELECT * FROM b UNION VALUES ('one', 1) ORDER BY c LIMIT 5`},\n\t\t{`CREATE TABLE a (z PRIMARY KEY) AS SELECT * FROM b`},\n\t\t{`CREATE TABLE IF NOT EXISTS a (z PRIMARY KEY) AS SELECT * FROM b`},\n\t\t{`CREATE TABLE a (x, y, z, PRIMARY KEY (x, y, z)) AS SELECT * FROM b`},\n\t\t{`CREATE TABLE IF NOT EXISTS a (x, y, z, PRIMARY KEY (x, y, z)) AS SELECT * FROM b`},\n\t\t{`CREATE TABLE a (x, FAMILY (x)) AS SELECT * FROM b`},\n\t\t{`CREATE TABLE IF NOT EXISTS a (x, FAMILY (x)) AS SELECT * FROM b`},\n\t\t{`CREATE TABLE a (x, y FAMILY f1) AS SELECT * FROM b`},\n\t\t{`CREATE TABLE IF NOT EXISTS a (x, y FAMILY f1) AS SELECT * FROM b`},\n\n\t\t{`CREATE TABLE a (b STRING COLLATE de)`},\n\t\t{`CREATE TABLE a (b STRING(3) COLLATE de)`},\n\t\t{`CREATE TABLE a (b STRING[] COLLATE de)`},\n\t\t{`CREATE TABLE a (b STRING(3)[] COLLATE de)`},\n\n\t\t{`CREATE TABLE a (LIKE b)`},\n\t\t{`CREATE TABLE a (LIKE b, c INT8)`},\n\t\t{`CREATE TABLE a (LIKE b EXCLUDING INDEXES INCLUDING INDEXES)`},\n\t\t{`CREATE TABLE a (LIKE b INCLUDING ALL EXCLUDING INDEXES, c INT8)`},\n\n\t\t{`CREATE VIEW a AS SELECT * FROM b`},\n\t\t{`CREATE OR REPLACE VIEW a AS SELECT * FROM b`},\n\t\t{`EXPLAIN CREATE VIEW a AS SELECT * FROM b`},\n\t\t{`CREATE VIEW a AS SELECT b.* FROM b LIMIT 5`},\n\t\t{`CREATE VIEW a AS (SELECT c, d FROM b WHERE c > 0 ORDER BY c)`},\n\t\t{`CREATE VIEW a (x, y) AS SELECT c, d FROM b`},\n\t\t{`CREATE VIEW a AS VALUES (1, 'one'), (2, 'two')`},\n\t\t{`CREATE VIEW a (x, y) AS VALUES (1, 'one'), (2, 'two')`},\n\t\t{`CREATE VIEW a AS TABLE b`},\n\t\t{`CREATE TEMPORARY VIEW a AS SELECT b`},\n\n\t\t{`CREATE SEQUENCE a`},\n\t\t{`EXPLAIN CREATE SEQUENCE a`},\n\t\t{`CREATE SEQUENCE IF NOT EXISTS a`},\n\t\t{`CREATE SEQUENCE a CYCLE`},\n\t\t{`CREATE SEQUENCE a NO CYCLE`},\n\t\t{`CREATE SEQUENCE a CACHE 0`},\n\t\t{`CREATE SEQUENCE a CACHE 1`},\n\t\t{`CREATE SEQUENCE a CACHE 2`},\n\t\t{`CREATE SEQUENCE a INCREMENT 5`},\n\t\t{`CREATE SEQUENCE a INCREMENT BY 5`},\n\t\t{`CREATE SEQUENCE a NO MAXVALUE`},\n\t\t{`CREATE SEQUENCE a MAXVALUE 1000`},\n\t\t{`CREATE SEQUENCE a NO MINVALUE`},\n\t\t{`CREATE SEQUENCE a MINVALUE 1000`},\n\t\t{`CREATE SEQUENCE a START 1000`},\n\t\t{`CREATE SEQUENCE a START WITH 1000`},\n\t\t{`CREATE SEQUENCE a INCREMENT 5 NO MAXVALUE MINVALUE 1 START 3`},\n\t\t{`CREATE SEQUENCE a INCREMENT 5 NO CYCLE NO MAXVALUE MINVALUE 1 START 3 CACHE 1`},\n\t\t{`CREATE SEQUENCE a VIRTUAL`},\n\t\t{`CREATE TEMPORARY SEQUENCE a`},\n\t\t{`CREATE SEQUENCE a OWNED BY b`},\n\t\t{`CREATE SEQUENCE a OWNED BY NONE`},\n\n\t\t{`CREATE STATISTICS a ON col1 FROM t`},\n\t\t{`EXPLAIN CREATE STATISTICS a ON col1 FROM t`},\n\t\t{`CREATE STATISTICS a FROM t`},\n\t\t{`CREATE STATISTICS a FROM [53]`},\n\t\t{`CREATE STATISTICS a ON col1, col2 FROM t`},\n\t\t{`CREATE STATISTICS a ON col1 FROM d.t`},\n\t\t{`CREATE STATISTICS a ON col1 FROM t`},\n\t\t{`CREATE STATISTICS a ON col1 FROM t WITH OPTIONS THROTTLING 0.9`},\n\t\t{`CREATE STATISTICS a ON col1 FROM t WITH OPTIONS AS OF SYSTEM TIME '2016-01-01'`},\n\t\t{`CREATE STATISTICS a ON col1 FROM t WITH OPTIONS THROTTLING 0.1 AS OF SYSTEM TIME '2016-01-01'`},\n\n\t\t{`ANALYZE t`},\n\t\t{`ANALYZE db.sc.t`},\n\n\t\t{`CREATE TYPE a AS ENUM ()`},\n\t\t{`CREATE TYPE a AS ENUM ('a')`},\n\t\t{`CREATE TYPE a AS ENUM ('a', 'b', 'c')`},\n\t\t{`CREATE TYPE a.b AS ENUM ('a', 'b', 'c')`},\n\t\t{`CREATE TYPE a.b.c AS ENUM ('a', 'b', 'c')`},\n\n\t\t{`DROP TYPE a`},\n\t\t{`DROP TYPE a, b, c`},\n\t\t{`DROP TYPE db.sc.a, sc.a`},\n\t\t{`DROP TYPE IF EXISTS db.sc.a, sc.a`},\n\t\t{`DROP TYPE db.sc.a, sc.a CASCADE`},\n\t\t{`DROP TYPE IF EXISTS db.sc.a, sc.a CASCADE`},\n\t\t{`DROP TYPE IF EXISTS db.sc.a, sc.a RESTRICT`},\n\n\t\t{`DELETE FROM a`},\n\t\t{`EXPLAIN DELETE FROM a`},\n\t\t{`DELETE FROM a.b`},\n\t\t{`DELETE FROM a.b@c`},\n\t\t{`DELETE FROM a WHERE a = b`},\n\t\t{`DELETE FROM a WHERE a = b LIMIT c`},\n\t\t{`DELETE FROM a WHERE a = b ORDER BY c`},\n\t\t{`DELETE FROM a WHERE a = b ORDER BY c LIMIT d`},\n\t\t{`DELETE FROM a WHERE a = b RETURNING a, b`},\n\t\t{`DELETE FROM a WHERE a = b RETURNING 1, 2`},\n\t\t{`DELETE FROM a WHERE a = b RETURNING a + b`},\n\t\t{`DELETE FROM a WHERE a = b RETURNING NOTHING`},\n\t\t{`DELETE FROM a WHERE a = b ORDER BY c LIMIT d RETURNING e`},\n\n\t\t{`DISCARD ALL`},\n\n\t\t{`DROP DATABASE a`},\n\t\t{`EXPLAIN DROP DATABASE a`},\n\t\t{`DROP DATABASE IF EXISTS a`},\n\t\t{`DROP DATABASE a CASCADE`},\n\t\t{`DROP DATABASE a RESTRICT`},\n\t\t{`DROP TABLE a`},\n\t\t{`EXPLAIN DROP TABLE a`},\n\t\t{`DROP TABLE a.b`},\n\t\t{`DROP TABLE a, b`},\n\t\t{`DROP TABLE IF EXISTS a`},\n\t\t{`DROP TABLE a RESTRICT`},\n\t\t{`DROP TABLE a.b RESTRICT`},\n\t\t{`DROP TABLE a, b RESTRICT`},\n\t\t{`DROP TABLE IF EXISTS a RESTRICT`},\n\t\t{`DROP TABLE a CASCADE`},\n\t\t{`DROP TABLE a.b CASCADE`},\n\t\t{`DROP TABLE a, b CASCADE`},\n\t\t{`DROP TABLE IF EXISTS a CASCADE`},\n\t\t{`DROP INDEX a.b@c`},\n\t\t{`DROP INDEX a`},\n\t\t{`DROP INDEX a.b`},\n\t\t{`DROP INDEX IF EXISTS a.b@c`},\n\t\t{`DROP INDEX a.b@c, d@f`},\n\t\t{`DROP INDEX IF EXISTS a.b@c, d@f`},\n\t\t{`DROP INDEX a.b@c CASCADE`},\n\t\t{`DROP INDEX IF EXISTS a.b@c RESTRICT`},\n\t\t{`DROP VIEW a`},\n\t\t{`DROP VIEW a.b`},\n\t\t{`DROP VIEW a, b`},\n\t\t{`DROP VIEW IF EXISTS a`},\n\t\t{`DROP VIEW a RESTRICT`},\n\t\t{`DROP VIEW IF EXISTS a, b RESTRICT`},\n\t\t{`DROP VIEW a.b CASCADE`},\n\t\t{`DROP VIEW a, b CASCADE`},\n\t\t{`DROP SEQUENCE a`},\n\t\t{`EXPLAIN DROP SEQUENCE a`},\n\t\t{`DROP SEQUENCE a.b`},\n\t\t{`DROP SEQUENCE a, b`},\n\t\t{`DROP SEQUENCE IF EXISTS a`},\n\t\t{`DROP SEQUENCE a RESTRICT`},\n\t\t{`DROP SEQUENCE IF EXISTS a, b RESTRICT`},\n\t\t{`DROP SEQUENCE a.b CASCADE`},\n\t\t{`DROP SEQUENCE a, b CASCADE`},\n\n\t\t{`CANCEL JOBS SELECT a`},\n\t\t{`EXPLAIN CANCEL JOBS SELECT a`},\n\t\t{`CANCEL QUERIES SELECT a`},\n\t\t{`EXPLAIN CANCEL QUERIES SELECT a`},\n\t\t{`CANCEL SESSIONS SELECT a`},\n\t\t{`EXPLAIN CANCEL SESSIONS SELECT a`},\n\t\t{`CANCEL QUERIES IF EXISTS SELECT a`},\n\t\t{`CANCEL SESSIONS IF EXISTS SELECT a`},\n\t\t{`RESUME JOBS SELECT a`},\n\t\t{`EXPLAIN RESUME JOBS SELECT a`},\n\t\t{`PAUSE JOBS SELECT a`},\n\t\t{`EXPLAIN PAUSE JOBS SELECT a`},\n\t\t{`SHOW JOBS SELECT a`},\n\t\t{`EXPLAIN SHOW JOBS SELECT a`},\n\t\t{`SHOW JOBS WHEN COMPLETE SELECT a`},\n\t\t{`EXPLAIN SHOW JOBS WHEN COMPLETE SELECT a`},\n\n\t\t{`EXPLAIN SELECT 1`},\n\t\t{`EXPLAIN EXPLAIN SELECT 1`},\n\t\t{`EXPLAIN (OPT, VERBOSE) SELECT 1`},\n\t\t{`EXPLAIN ANALYZE (DISTSQL) SELECT 1`},\n\t\t{`EXPLAIN ANALYZE (DEBUG) SELECT 1`},\n\t\t{`SELECT * FROM [EXPLAIN SELECT 1]`},\n\t\t{`SELECT * FROM [SHOW TRANSACTION STATUS]`},\n\n\t\t{`SHOW barfoo`},\n\t\t{`EXPLAIN SHOW barfoo`},\n\t\t{`SHOW database`},\n\t\t{`SHOW timezone`},\n\t\t{`SHOW \"BLAH\"`},\n\n\t\t{`SHOW CLUSTER SETTING a`},\n\t\t{`EXPLAIN SHOW CLUSTER SETTING a`},\n\t\t{`SHOW ALL CLUSTER SETTINGS`},\n\t\t{`SHOW PUBLIC CLUSTER SETTINGS`},\n\n\t\t{`SHOW DATABASES`},\n\t\t{`EXPLAIN SHOW DATABASES`},\n\t\t{`SHOW SCHEMAS`},\n\t\t{`EXPLAIN SHOW SCHEMAS`},\n\t\t{`SHOW SCHEMAS FROM a`},\n\t\t{`SHOW SEQUENCES`},\n\t\t{`EXPLAIN SHOW SEQUENCES`},\n\t\t{`SHOW SEQUENCES FROM a`},\n\t\t{`SHOW TABLES`},\n\t\t{`SHOW TABLES WITH COMMENT`},\n\t\t{`EXPLAIN SHOW TABLES`},\n\t\t{`SHOW TABLES FROM a`},\n\t\t{`SHOW TABLES FROM a WITH COMMENT`},\n\t\t{`SHOW TABLES FROM a.b`},\n\t\t{`SHOW TABLES FROM a.b WITH COMMENT`},\n\t\t{`SHOW COLUMNS FROM a`},\n\t\t{`EXPLAIN SHOW COLUMNS FROM a`},\n\t\t{`SHOW COLUMNS FROM a.b.c`},\n\t\t{`SHOW INDEXES FROM a`},\n\t\t{`EXPLAIN SHOW INDEXES FROM a`},\n\t\t{`SHOW INDEXES FROM a WITH COMMENT`},\n\t\t{`EXPLAIN SHOW INDEXES FROM a WITH COMMENT`},\n\t\t{`SHOW INDEXES FROM a.b.c`},\n\t\t{`SHOW INDEXES FROM a.b.c WITH COMMENT`},\n\t\t{`SHOW INDEXES FROM DATABASE a`},\n\t\t{`SHOW INDEXES FROM DATABASE a WITH COMMENT`},\n\t\t{`SHOW CONSTRAINTS FROM a`},\n\t\t{`SHOW CONSTRAINTS FROM a.b.c`},\n\t\t{`EXPLAIN SHOW CONSTRAINTS FROM a.b.c`},\n\t\t{`SHOW TABLES FROM a.b; SHOW COLUMNS FROM b`},\n\t\t{`EXPLAIN SHOW TABLES FROM a`},\n\t\t{`SHOW ROLES`},\n\t\t{`EXPLAIN SHOW ROLES`},\n\t\t{`SHOW USERS`},\n\t\t{`EXPLAIN SHOW USERS`},\n\t\t{`SHOW JOBS`},\n\t\t{`EXPLAIN SHOW JOBS`},\n\t\t{`SHOW AUTOMATIC JOBS`},\n\t\t{`EXPLAIN SHOW AUTOMATIC JOBS`},\n\t\t{`SHOW CLUSTER QUERIES`},\n\t\t{`EXPLAIN SHOW CLUSTER QUERIES`},\n\t\t{`SHOW ALL CLUSTER QUERIES`},\n\t\t{`EXPLAIN SHOW ALL CLUSTER QUERIES`},\n\t\t{`SHOW LOCAL QUERIES`},\n\t\t{`EXPLAIN SHOW LOCAL QUERIES`},\n\t\t{`SHOW ALL LOCAL QUERIES`},\n\t\t{`EXPLAIN SHOW ALL LOCAL QUERIES`},\n\t\t{`SHOW CLUSTER SESSIONS`},\n\t\t{`EXPLAIN SHOW CLUSTER SESSIONS`},\n\t\t{`SHOW ALL CLUSTER SESSIONS`},\n\t\t{`EXPLAIN SHOW ALL CLUSTER SESSIONS`},\n\t\t{`SHOW LOCAL SESSIONS`},\n\t\t{`EXPLAIN SHOW LOCAL SESSIONS`},\n\t\t{`SHOW ALL LOCAL SESSIONS`},\n\t\t{`EXPLAIN SHOW ALL LOCAL SESSIONS`},\n\t\t{`SHOW TRACE FOR SESSION`},\n\t\t{`EXPLAIN SHOW TRACE FOR SESSION`},\n\t\t{`SHOW KV TRACE FOR SESSION`},\n\t\t{`EXPLAIN SHOW KV TRACE FOR SESSION`},\n\t\t{`SHOW EXPERIMENTAL_REPLICA TRACE FOR SESSION`},\n\t\t{`EXPLAIN SHOW EXPERIMENTAL_REPLICA TRACE FOR SESSION`},\n\t\t{`SHOW STATISTICS FOR TABLE t`},\n\t\t{`SHOW STATISTICS USING JSON FOR TABLE t`},\n\t\t{`EXPLAIN SHOW STATISTICS FOR TABLE t`},\n\t\t{`SHOW STATISTICS FOR TABLE d.t`},\n\t\t{`SHOW HISTOGRAM 123`},\n\t\t{`EXPLAIN SHOW HISTOGRAM 123`},\n\t\t{`SHOW RANGE FROM TABLE t FOR ROW (1, 2)`},\n\t\t{`SHOW RANGE FROM TABLE d.t FOR ROW (1, 2)`},\n\t\t{`SHOW RANGE FROM INDEX d.t@i FOR ROW (1, 2)`},\n\t\t{`SHOW RANGE FROM INDEX t@i FOR ROW (1, 2)`},\n\t\t{`SHOW RANGE FROM INDEX i FOR ROW (1, 2)`},\n\t\t{`SHOW RANGES FROM TABLE d.t`},\n\t\t{`EXPLAIN SHOW RANGES FROM TABLE d.t`},\n\t\t{`SHOW RANGES FROM TABLE t`},\n\t\t{`SHOW RANGES FROM INDEX d.t@i`},\n\t\t{`SHOW RANGES FROM INDEX t@i`},\n\t\t{`SHOW RANGES FROM INDEX d.i`},\n\t\t{`SHOW RANGES FROM INDEX i`},\n\t\t{`SHOW EXPERIMENTAL_FINGERPRINTS FROM TABLE d.t`},\n\t\t{`SHOW ZONE CONFIGURATIONS`},\n\t\t{`EXPLAIN SHOW ZONE CONFIGURATIONS`},\n\t\t{`SHOW ZONE CONFIGURATION FOR RANGE default`},\n\t\t{`SHOW ZONE CONFIGURATION FOR RANGE meta`},\n\t\t{`SHOW ZONE CONFIGURATION FOR DATABASE db`},\n\t\t{`SHOW ZONE CONFIGURATION FOR TABLE db.t`},\n\t\t{`SHOW ZONE CONFIGURATION FOR PARTITION p OF TABLE db.t`},\n\t\t{`SHOW ZONE CONFIGURATION FOR TABLE t`},\n\t\t{`SHOW ZONE CONFIGURATION FOR PARTITION p OF TABLE t`},\n\t\t{`SHOW ZONE CONFIGURATION FOR INDEX db.t@i`},\n\t\t{`SHOW ZONE CONFIGURATION FOR INDEX t@i`},\n\t\t{`SHOW ZONE CONFIGURATION FOR INDEX i`},\n\n\t\t// Tables are the default, but can also be specified with\n\t\t// GRANT x ON TABLE y. However, the stringer does not output TABLE.\n\t\t{`SHOW GRANTS`},\n\t\t{`EXPLAIN SHOW GRANTS`},\n\t\t{`SHOW GRANTS ON TABLE foo`},\n\t\t{`SHOW GRANTS ON TABLE foo, db.foo`},\n\t\t{`SHOW GRANTS ON DATABASE foo, bar`},\n\t\t{`SHOW GRANTS ON DATABASE foo FOR bar`},\n\t\t{`SHOW GRANTS FOR bar, baz`},\n\n\t\t{`SHOW GRANTS ON ROLE`},\n\t\t{`SHOW GRANTS ON ROLE foo`},\n\t\t{`SHOW GRANTS ON ROLE foo, bar`},\n\t\t{`SHOW GRANTS ON ROLE foo FOR bar`},\n\t\t{`SHOW GRANTS ON ROLE FOR bar, baz`},\n\n\t\t{`SHOW TRANSACTION STATUS`},\n\t\t{`EXPLAIN SHOW TRANSACTION STATUS`},\n\t\t{`SHOW SAVEPOINT STATUS`},\n\t\t{`EXPLAIN SHOW SAVEPOINT STATUS`},\n\t\t{`SHOW LAST QUERY STATISTICS`},\n\n\t\t{`SHOW SYNTAX 'select 1'`},\n\t\t{`EXPLAIN SHOW SYNTAX 'select 1'`},\n\n\t\t{`PREPARE a AS SELECT 1`},\n\t\t{`PREPARE a AS EXPLAIN SELECT 1`},\n\t\t{`PREPARE a (INT8) AS SELECT $1`},\n\t\t{`PREPARE a (STRING, STRING) AS SELECT $1, $2`},\n\t\t{`PREPARE a AS INSERT INTO a VALUES (1)`},\n\t\t{`PREPARE a (INT8) AS INSERT INTO a VALUES ($1)`},\n\t\t{`PREPARE a AS UPDATE a SET b = 1`},\n\t\t{`PREPARE a (INT8) AS UPDATE a SET b = $1`},\n\t\t{`PREPARE a AS UPSERT INTO a VALUES (1)`},\n\t\t{`PREPARE a (INT8) AS UPSERT INTO a VALUES ($1)`},\n\t\t{`PREPARE a AS DELETE FROM a`},\n\t\t{`PREPARE a (INT8) AS DELETE FROM a WHERE b = $1`},\n\t\t{`PREPARE a AS BACKUP DATABASE a TO 'b'`},\n\t\t{`PREPARE a (STRING) AS BACKUP DATABASE a TO $1`},\n\t\t{`PREPARE a AS RESTORE DATABASE a FROM 'b'`},\n\t\t{`PREPARE a (STRING) AS RESTORE DATABASE a FROM $1`},\n\t\t{`PREPARE a AS CANCEL QUERIES SELECT 1`},\n\t\t{`PREPARE a (STRING) AS CANCEL QUERIES SELECT $1`},\n\t\t{`PREPARE a AS CANCEL QUERIES IF EXISTS SELECT 1`},\n\t\t{`PREPARE a (STRING) AS CANCEL QUERIES IF EXISTS SELECT $1`},\n\t\t{`PREPARE a AS CANCEL SESSIONS SELECT 1`},\n\t\t{`PREPARE a (STRING) AS CANCEL SESSIONS SELECT $1`},\n\t\t{`PREPARE a AS CANCEL SESSIONS IF EXISTS SELECT 1`},\n\t\t{`PREPARE a (STRING) AS CANCEL SESSIONS IF EXISTS SELECT $1`},\n\t\t{`PREPARE a AS CANCEL JOBS SELECT 1`},\n\t\t{`PREPARE a (INT8) AS CANCEL JOBS SELECT $1`},\n\t\t{`PREPARE a AS PAUSE JOBS SELECT 1`},\n\t\t{`PREPARE a (INT8) AS PAUSE JOBS SELECT $1`},\n\t\t{`PREPARE a AS RESUME JOBS SELECT 1`},\n\t\t{`PREPARE a (INT8) AS RESUME JOBS SELECT $1`},\n\t\t{`PREPARE a AS IMPORT TABLE a CREATE USING 'b' CSV DATA ('c') WITH temp = 'd'`},\n\t\t{`PREPARE a (STRING, STRING, STRING) AS IMPORT TABLE a CREATE USING $1 CSV DATA ($2) WITH temp = $3`},\n\n\t\t{`PREPARE a AS OPT PLAN 'some-string'`},\n\t\t{`PREPARE a (STRING, INT8) AS OPT PLAN 'some-string'`},\n\n\t\t{`EXECUTE a`},\n\t\t{`EXECUTE a DISCARD ROWS`},\n\t\t{`EXECUTE a (1)`},\n\t\t{`EXECUTE a (1, 1)`},\n\t\t{`EXECUTE a (1, 1) DISCARD ROWS`},\n\t\t{`EXECUTE a (1 + 1)`},\n\n\t\t{`DEALLOCATE a`},\n\t\t{`DEALLOCATE ALL`},\n\n\t\t// Tables are the default, but can also be specified with\n\t\t// GRANT x ON TABLE y. However, the stringer does not output TABLE.\n\t\t{`GRANT SELECT ON TABLE foo TO root`},\n\t\t{`GRANT SELECT, DELETE, UPDATE ON TABLE foo, db.foo TO root, bar`},\n\t\t{`GRANT DROP ON DATABASE foo TO root`},\n\t\t{`GRANT ALL ON DATABASE foo TO root, test`},\n\t\t{`GRANT SELECT, INSERT ON DATABASE bar TO foo, bar, baz`},\n\t\t{`GRANT SELECT, INSERT ON DATABASE db1, db2 TO foo, bar, baz`},\n\t\t{`GRANT SELECT, INSERT ON DATABASE db1, db2 TO \"test-user\"`},\n\t\t{`GRANT rolea, roleb TO usera, userb`},\n\t\t{`GRANT rolea, roleb TO usera, userb WITH ADMIN OPTION`},\n\n\t\t// Tables are the default, but can also be specified with\n\t\t// REVOKE x ON TABLE y. However, the stringer does not output TABLE.\n\t\t{`REVOKE SELECT ON TABLE foo FROM root`},\n\t\t{`REVOKE UPDATE, DELETE ON TABLE foo, db.foo FROM root, bar`},\n\t\t{`REVOKE INSERT ON DATABASE foo FROM root`},\n\t\t{`REVOKE ALL ON DATABASE foo FROM root, test`},\n\t\t{`REVOKE SELECT, INSERT ON DATABASE bar FROM foo, bar, baz`},\n\t\t{`REVOKE SELECT, INSERT ON DATABASE db1, db2 FROM foo, bar, baz`},\n\t\t{`REVOKE rolea, roleb FROM usera, userb`},\n\t\t{`REVOKE ADMIN OPTION FOR rolea, roleb FROM usera, userb`},\n\n\t\t{`INSERT INTO a VALUES (1)`},\n\t\t{`EXPLAIN INSERT INTO a VALUES (1)`},\n\t\t{`INSERT INTO a.b VALUES (1)`},\n\t\t{`INSERT INTO a VALUES (1, 2)`},\n\t\t{`INSERT INTO a VALUES (1, DEFAULT)`},\n\t\t{`INSERT INTO a VALUES (1, 2), (3, 4)`},\n\t\t{`INSERT INTO a VALUES (a + 1, 2 * 3)`},\n\t\t{`INSERT INTO a(a, b) VALUES (1, 2)`},\n\t\t{`INSERT INTO a SELECT b, c FROM d`},\n\t\t{`INSERT INTO a DEFAULT VALUES`},\n\t\t{`INSERT INTO a VALUES (1) RETURNING a, b`},\n\t\t{`INSERT INTO a VALUES (1, 2) RETURNING 1, 2`},\n\t\t{`INSERT INTO a VALUES (1, 2) RETURNING a + b, c`},\n\t\t{`INSERT INTO a VALUES (1, 2) RETURNING NOTHING`},\n\n\t\t{`UPSERT INTO a VALUES (1)`},\n\t\t{`EXPLAIN UPSERT INTO a VALUES (1)`},\n\t\t{`UPSERT INTO a.b VALUES (1)`},\n\t\t{`UPSERT INTO a VALUES (1, 2)`},\n\t\t{`UPSERT INTO a VALUES (1, DEFAULT)`},\n\t\t{`UPSERT INTO a VALUES (1, 2), (3, 4)`},\n\t\t{`UPSERT INTO a VALUES (a + 1, 2 * 3)`},\n\t\t{`UPSERT INTO a(a, b) VALUES (1, 2)`},\n\t\t{`UPSERT INTO a SELECT b, c FROM d`},\n\t\t{`UPSERT INTO a DEFAULT VALUES`},\n\t\t{`UPSERT INTO a DEFAULT VALUES RETURNING a, b`},\n\t\t{`UPSERT INTO a DEFAULT VALUES RETURNING 1, 2`},\n\t\t{`UPSERT INTO a DEFAULT VALUES RETURNING a + b`},\n\t\t{`UPSERT INTO a DEFAULT VALUES RETURNING NOTHING`},\n\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT DO NOTHING`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a) DO NOTHING`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT DO UPDATE SET a = 1`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a) DO UPDATE SET a = 1`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a, b) DO UPDATE SET a = 1`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a) DO UPDATE SET a = 1, b = excluded.a`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a) DO UPDATE SET a = 1 WHERE b > 2`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a) DO UPDATE SET a = DEFAULT`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a) DO UPDATE SET (a, b) = (SELECT 1, 2)`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a) DO UPDATE SET (a, b) = (SELECT 1, 2) RETURNING a, b`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a) DO UPDATE SET (a, b) = (SELECT 1, 2) RETURNING 1, 2`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a) DO UPDATE SET (a, b) = (SELECT 1, 2) RETURNING a + b`},\n\t\t{`INSERT INTO a VALUES (1) ON CONFLICT (a) DO UPDATE SET (a, b) = (SELECT 1, 2) RETURNING NOTHING`},\n\n\t\t{`SELECT 1 + 1`},\n\t\t{`SELECT -1`},\n\t\t{`SELECT .1`},\n\t\t{`SELECT 1.2e1`},\n\t\t{`SELECT 1.2e+1`},\n\t\t{`SELECT 1.2e-1`},\n\t\t{`SELECT true AND false`},\n\t\t{`SELECT true AND NULL`},\n\t\t{`SELECT true = false`},\n\t\t{`SELECT (true = false)`},\n\t\t{`SELECT (ARRAY['a', 'b'])[2]`},\n\t\t{`SELECT (ARRAY (VALUES (1), (2)))[1]`},\n\t\t{`SELECT (SELECT 1)`},\n\t\t{`SELECT ((SELECT 1))`},\n\t\t{`SELECT (SELECT ARRAY['a', 'b'])[2]`},\n\t\t{`SELECT ((SELECT ARRAY['a', 'b']))[2]`},\n\t\t{`SELECT ((((VALUES (1)))))`},\n\t\t{`SELECT EXISTS (SELECT 1)`},\n\t\t{`SELECT (VALUES (1))`},\n\t\t{`SELECT (1, 2, 3)`},\n\t\t{`SELECT ((1, 2, 3) AS a, b, c)`},\n\t\t{`SELECT ((1, 2, 3))`},\n\t\t{`SELECT ((1, 2, 3) AS a, b, c)`},\n\t\t{`SELECT (((1, 2, 3) AS a, b, c)).a`},\n\t\t{`SELECT (((1, 2, 3) AS a, b, c)).*`},\n\t\t{`SELECT ()`},\n\t\t{`SELECT (() AS a)`},\n\t\t{`SELECT ((() AS a)).a`},\n\t\t{`SELECT ((() AS a)).*`},\n\t\t{`SELECT ((() AS a)).@1`},\n\t\t{`SELECT (TABLE a)`},\n\t\t{`SELECT 0x1`},\n\t\t{`SELECT 'Deutsch' COLLATE de`},\n\t\t{`SELECT a @> b`},\n\t\t{`SELECT a <@ b`},\n\t\t{`SELECT a ? b`},\n\t\t{`SELECT a ?| b`},\n\t\t{`SELECT a ?& b`},\n\t\t{`SELECT a->'x'`},\n\t\t{`SELECT a#>'{x}'`},\n\t\t{`SELECT a#>>'{x}'`},\n\t\t{`SELECT (a->'x')->'y'`},\n\t\t{`SELECT (a->'x')->>'y'`},\n\t\t{`SELECT b && c`},\n\t\t{`SELECT |/a`},\n\t\t{`SELECT ||/a`},\n\n\t\t{`SELECT 1 FROM t`},\n\t\t{`SELECT 1, 2 FROM t`},\n\t\t{`SELECT * FROM t`},\n\t\t{`SELECT \"*\" FROM t`},\n\t\t{`SELECT a, b FROM t`},\n\t\t{`SELECT a AS b FROM t`},\n\t\t{`SELECT a.* FROM t`},\n\t\t{`SELECT a = b FROM t`},\n\t\t{`SELECT $1 FROM t`},\n\t\t{`SELECT $1, $2 FROM t`},\n\t\t{`SELECT NULL FROM t`},\n\t\t{`SELECT 0.1 FROM t`},\n\t\t{`SELECT a FROM t`},\n\t\t{`SELECT a.b FROM t`},\n\t\t{`SELECT a.b.* FROM t`},\n\t\t{`SELECT a.b[1] FROM t`},\n\t\t{`SELECT a.b[1 + 1:4][3] FROM t`},\n\t\t{`SELECT a.b[:4][3] FROM t`},\n\t\t{`SELECT a.b[1 + 1:][3] FROM t`},\n\t\t{`SELECT a.b[:][3] FROM t`},\n\t\t{`SELECT 'a' FROM t`},\n\t\t{`SELECT 'a' FROM t@bar`},\n\t\t{`SELECT 'a' FROM t@primary`},\n\t\t{`SELECT 'a' FROM t@like`},\n\t\t{`SELECT 'a' FROM t@{NO_INDEX_JOIN}`},\n\t\t{`SELECT 'a' FROM t@{IGNORE_FOREIGN_KEYS}`},\n\t\t{`SELECT 'a' FROM t@{FORCE_INDEX=idx,ASC}`},\n\t\t{`SELECT 'a' FROM t@{FORCE_INDEX=idx,DESC,IGNORE_FOREIGN_KEYS}`},\n\t\t{`SELECT * FROM t AS \"of\" AS OF SYSTEM TIME '2016-01-01'`},\n\n\t\t{`SELECT BOOL 'foo', 'foo'::BOOL`},\n\t\t{`SELECT BIT '10', '10'::BIT`},\n\t\t{`SELECT VARBIT '1', '1'::VARBIT`},\n\t\t{`SELECT INT2 'foo', 'foo'::INT2`},\n\t\t{`SELECT INT4 'foo', 'foo'::INT4`},\n\t\t{`SELECT INT8 'foo', 'foo'::INT8`},\n\t\t{`SELECT FLOAT4 'foo', 'foo'::FLOAT4`},\n\t\t{`SELECT DECIMAL 'foo', 'foo'::DECIMAL`},\n\t\t{`SELECT CHAR 'foo', 'foo'::CHAR`},\n\t\t{`SELECT VARCHAR 'foo', 'foo'::VARCHAR`},\n\t\t{`SELECT STRING 'foo', 'foo'::STRING`},\n\t\t{`SELECT BYTES 'foo', 'foo'::BYTES`},\n\t\t{`SELECT DATE 'foo', 'foo'::DATE`},\n\t\t{`SELECT TIME 'foo', 'foo'::TIME`},\n\t\t{`SELECT TIMESTAMP 'foo', 'foo'::TIMESTAMP`},\n\t\t{`SELECT TIMESTAMPTZ 'foo', 'foo'::TIMESTAMPTZ`},\n\t\t{`SELECT JSONB 'foo', 'foo'::JSONB`},\n\n\t\t{`SELECT 'foo'::DECIMAL(1)`},\n\t\t{`SELECT 'foo'::DECIMAL(2,1)`},\n\t\t{`SELECT 'foo'::BIT(3)`},\n\t\t{`SELECT 'foo'::VARBIT(3)`},\n\t\t{`SELECT 'foo'::CHAR(3)`},\n\t\t{`SELECT 'foo'::VARCHAR(3)`},\n\t\t{`SELECT 'foo'::STRING(3)`},\n\t\t{`SELECT 'foo'::TIMESTAMP(6)`},\n\t\t{`SELECT 'foo'::TIMESTAMPTZ(6)`},\n\t\t{`SELECT 'foo'::TIME(6)`},\n\t\t{`SELECT '0'::INTERVAL`},\n\n\t\t{`SELECT 'foo'::GEOGRAPHY`},\n\t\t{`SELECT 'foo'::GEOGRAPHY(POINT,4326)`},\n\t\t{`SELECT 'foo'::GEOGRAPHY(POINT)`},\n\t\t{`SELECT 'foo'::GEOMETRY`},\n\t\t{`SELECT 'foo'::GEOMETRY(POINT)`},\n\t\t{`SELECT 'foo'::GEOMETRY(POINT,4326)`},\n\n\t\t{`SELECT '192.168.0.1'::INET`},\n\t\t{`SELECT '192.168.0.1':::INET`},\n\t\t{`SELECT INET '192.168.0.1'`},\n\n\t\t{`SELECT 1:::REGTYPE`},\n\t\t{`SELECT 1:::REGPROC`},\n\t\t{`SELECT 1:::REGPROCEDURE`},\n\t\t{`SELECT 1:::REGCLASS`},\n\t\t{`SELECT 1:::REGNAMESPACE`},\n\n\t\t{`SELECT 'a' AS \"12345\"`},\n\t\t{`SELECT 'a' AS clnm`},\n\t\t{`SELECT 'a' AS primary`},\n\t\t{`SELECT 'a' AS like`},\n\n\t\t{`SELECT 0xf0 FROM t`},\n\t\t{`SELECT 0xF0 FROM t`},\n\n\t\t// Test various cases of qualified and not statically known types.\n\t\t{`SELECT 1::notatype`},\n\t\t{`SELECT 1::schem.typ`},\n\t\t{`SELECT 1::int4.typ`},\n\t\t{`SELECT 1::db.schem.typ`},\n\t\t{`SELECT 1::db.int4.typ[]`},\n\t\t{`CREATE TABLE t (x special.type)`},\n\t\t{`CREATE TABLE t (x int4.type)`},\n\t\t{`CREATE TABLE t (x notatype)`},\n\t\t{`SELECT 1 IS OF (my.type, int4.type)`},\n\t\t{`SELECT my.type ''`},\n\t\t{`SELECT int4.type ''`},\n\t\t{`SELECT foo ''`},\n\t\t{`SELECT CAST(1.2 + 2.3 AS notatype)`},\n\t\t{`SELECT ANNOTATE_TYPE(1.2 + 2.3, notatype)`},\n\t\t{`SELECT 'f'::blah`},\n\n\t\t// Escaping may change since the scanning process loses information\n\t\t// (you can write e'\\'' or ''''), but these are the idempotent cases.\n\t\t// Generally, anything that needs to escape plus \\ and ' leads to an\n\t\t// escaped string.\n\t\t{`SELECT e'a\\'a' FROM t`},\n\t\t{`SELECT e'a\\\\\\\\na' FROM t`},\n\t\t{`SELECT e'\\\\\\\\n' FROM t`},\n\t\t{`SELECT \"a\"\"a\" FROM t`},\n\t\t{`SELECT a FROM \"t\\n\"`}, // no escaping in sql identifiers\n\t\t{`SELECT a FROM \"t\"\"\"`}, // no escaping in sql identifiers\n\t\t{`SELECT \"full\" FROM t`}, // must quote column name keyword\n\n\t\t{`SELECT \"FROM\" FROM t`},\n\t\t{`SELECT CAST(1 AS STRING)`},\n\t\t{`SELECT ANNOTATE_TYPE(1, STRING)`},\n\t\t{`SELECT a FROM t AS bar`},\n\t\t{`SELECT a FROM t AS bar (bar1)`},\n\t\t{`SELECT a FROM t AS bar (bar1, bar2, bar3)`},\n\t\t{`SELECT a FROM t WITH ORDINALITY`},\n\t\t{`SELECT a FROM t WITH ORDINALITY AS bar`},\n\t\t{`SELECT a FROM (SELECT 1 FROM t)`},\n\t\t{`SELECT a FROM (SELECT 1 FROM t) AS bar`},\n\t\t{`SELECT a FROM (SELECT 1 FROM t) AS bar (bar1)`},\n\t\t{`SELECT a FROM (SELECT 1 FROM t) AS bar (bar1, bar2, bar3)`},\n\t\t{`SELECT a FROM (SELECT 1 FROM t) WITH ORDINALITY`},\n\t\t{`SELECT a FROM (SELECT 1 FROM t) WITH ORDINALITY AS bar`},\n\t\t{`SELECT a FROM ROWS FROM (a(x), b(y), c(z))`},\n\t\t{`SELECT a FROM t1, t2`},\n\t\t{`SELECT a FROM t1, LATERAL (SELECT * FROM t2 WHERE a = b)`},\n\t\t{`SELECT a FROM t1, LATERAL ROWS FROM (generate_series(1, t1.x))`},\n\t\t{`SELECT a FROM t AS t1`},\n\t\t{`SELECT a FROM t AS t1 (c1)`},\n\t\t{`SELECT a FROM t AS t1 (c1, c2, c3, c4)`},\n\t\t{`SELECT a FROM s.t`},\n\n\t\t{`SELECT count(DISTINCT a) FROM t`},\n\t\t{`SELECT count(ALL a) FROM t`},\n\n\t\t{`SELECT a FROM t WHERE a = b`},\n\t\t{`SELECT a FROM t WHERE NOT (a = b)`},\n\t\t{`SELECT a FROM t WHERE EXISTS (SELECT 1 FROM t)`},\n\t\t{`SELECT a FROM t WHERE NOT true`},\n\t\t{`SELECT a FROM t WHERE NOT false`},\n\t\t{`SELECT a FROM t WHERE a IN (b,)`},\n\t\t{`SELECT a FROM t WHERE a IN (b, c)`},\n\t\t{`SELECT a FROM t WHERE a IN (SELECT a FROM t)`},\n\t\t{`SELECT a FROM t WHERE a NOT IN (b, c)`},\n\t\t{`SELECT a FROM t WHERE a = ANY (ARRAY[b, c])`},\n\t\t{`SELECT a FROM t WHERE a = ANY ARRAY[b, c]`},\n\t\t{`SELECT a FROM t WHERE a != SOME (ARRAY[b, c])`},\n\t\t{`SELECT a FROM t WHERE a != SOME ARRAY[b, c]`},\n\t\t{`SELECT a FROM t WHERE a = ANY (SELECT 1)`},\n\t\t{`SELECT a FROM t WHERE a LIKE ALL (ARRAY[b, c])`},\n\t\t{`SELECT a FROM t WHERE a LIKE ALL ARRAY[b, c]`},\n\t\t{`SELECT a FROM t WHERE a LIKE b`},\n\t\t{`SELECT a FROM t WHERE a NOT LIKE b`},\n\t\t{`SELECT a FROM t WHERE a ILIKE b`},\n\t\t{`SELECT a FROM t WHERE a NOT ILIKE b`},\n\t\t{`SELECT a FROM t WHERE a SIMILAR TO b`},\n\t\t{`SELECT a FROM t WHERE a NOT SIMILAR TO b`},\n\t\t{`SELECT a FROM t WHERE a ~ b`},\n\t\t{`SELECT a FROM t WHERE a !~ b`},\n\t\t{`SELECT a FROM t WHERE a ~* c`},\n\t\t{`SELECT a FROM t WHERE a !~* c`},\n\t\t{`SELECT a FROM t WHERE a BETWEEN b AND c`},\n\t\t{`SELECT a FROM t WHERE a BETWEEN SYMMETRIC b AND c`},\n\t\t{`SELECT a FROM t WHERE a NOT BETWEEN b AND c`},\n\t\t{`SELECT a FROM t WHERE a NOT BETWEEN SYMMETRIC b AND c`},\n\t\t{`SELECT a FROM t WHERE a IS NULL`},\n\t\t{`SELECT a FROM t WHERE a IS NOT NULL`},\n\t\t{`SELECT a FROM t WHERE (a, b) IS NULL`},\n\t\t{`SELECT a FROM t WHERE (a, b) IS NOT NULL`},\n\t\t{`SELECT a FROM t WHERE a IS true`},\n\t\t{`SELECT a FROM t WHERE a IS NOT true`},\n\t\t{`SELECT a FROM t WHERE a IS false`},\n\t\t{`SELECT a FROM t WHERE a IS NOT false`},\n\t\t{`SELECT a FROM t WHERE a IS OF (INT8)`},\n\t\t{`SELECT a FROM t WHERE a IS NOT OF (FLOAT8, STRING)`},\n\t\t{`SELECT a FROM t WHERE a IS DISTINCT FROM b`},\n\t\t{`SELECT a FROM t WHERE a IS NOT DISTINCT FROM b`},\n\t\t{`SELECT a FROM t WHERE (a, b) IS NOT DISTINCT FROM NULL`},\n\t\t{`SELECT a FROM t WHERE (a, b) IS DISTINCT FROM NULL`},\n\t\t{`SELECT a FROM t WHERE a < b`},\n\t\t{`SELECT a FROM t WHERE a <= b`},\n\t\t{`SELECT a FROM t WHERE a >= b`},\n\t\t{`SELECT a FROM t WHERE a != b`},\n\t\t{`SELECT a FROM t WHERE a = (SELECT a FROM t)`},\n\t\t{`SELECT a FROM t WHERE a = (b)`},\n\t\t{`SELECT a FROM t WHERE CASE WHEN a = b THEN c END`},\n\t\t{`SELECT a FROM t WHERE CASE WHEN a = b THEN c ELSE d END`},\n\t\t{`SELECT a FROM t WHERE CASE WHEN a = b THEN c WHEN b = d THEN d ELSE d END`},\n\t\t{`SELECT a FROM t WHERE CASE aa WHEN a = b THEN c END`},\n\t\t{`SELECT a FROM t WHERE a = b()`},\n\t\t{`SELECT a FROM t WHERE a = b(c)`},\n\t\t{`SELECT a FROM t WHERE a = b(c, d)`},\n\t\t{`SELECT a FROM t WHERE a = count(*)`},\n\t\t{`SELECT a FROM t WHERE a = IF(b, c, d)`},\n\t\t{`SELECT a FROM t WHERE a = IFERROR(b, c, d)`},\n\t\t{`SELECT a FROM t WHERE a = IFERROR(b, c)`},\n\t\t{`SELECT a FROM t WHERE a = ISERROR(b)`},\n\t\t{`SELECT a FROM t WHERE a = ISERROR(b, c)`},\n\t\t{`SELECT a FROM t WHERE a = IFNULL(b, c)`},\n\t\t{`SELECT a FROM t WHERE a = NULLIF(b, c)`},\n\t\t{`SELECT a FROM t WHERE a = COALESCE(a, b, c, d, e)`},\n\t\t{`SELECT (a.b) FROM t WHERE (b.c) = 2`},\n\n\t\t{`SELECT a FROM t ORDER BY a`},\n\t\t{`SELECT a FROM t ORDER BY a ASC`},\n\t\t{`SELECT a FROM t ORDER BY a DESC`},\n\t\t{`SELECT a FROM t ORDER BY PRIMARY KEY t`},\n\t\t{`SELECT a FROM t ORDER BY PRIMARY KEY t ASC`},\n\t\t{`SELECT a FROM t ORDER BY PRIMARY KEY t DESC`},\n\t\t{`SELECT a FROM t ORDER BY INDEX t@foo`},\n\t\t{`SELECT a FROM t ORDER BY INDEX t@foo ASC`},\n\t\t{`SELECT a FROM t ORDER BY INDEX t@foo DESC`},\n\t\t{`SELECT a FROM t ORDER BY INDEX t@primary`},\n\t\t{`SELECT a FROM t ORDER BY INDEX t@like`},\n\t\t{`SELECT a FROM t ORDER BY a NULLS FIRST`},\n\t\t{`SELECT a FROM t ORDER BY a ASC NULLS FIRST`},\n\t\t{`SELECT a FROM t ORDER BY a DESC NULLS LAST`},\n\n\t\t{`SELECT 1 FROM t GROUP BY a`},\n\t\t{`SELECT 1 FROM t GROUP BY a, b`},\n\t\t{`SELECT sum(x ORDER BY y) FROM t`},\n\t\t{`SELECT sum(x ORDER BY y, z) FROM t`},\n\n\t\t{`SELECT a FROM t HAVING a = b`},\n\n\t\t{`SELECT a FROM t WINDOW w AS ()`},\n\t\t{`SELECT a FROM t WINDOW w AS (w2)`},\n\t\t{`SELECT a FROM t WINDOW w AS (PARTITION BY b)`},\n\t\t{`SELECT a FROM t WINDOW w AS (PARTITION BY b, 1 + 2)`},\n\t\t{`SELECT a FROM t WINDOW w AS (ORDER BY c)`},\n\t\t{`SELECT a FROM t WINDOW w AS (ORDER BY c, 1 + 2)`},\n\t\t{`SELECT a FROM t WINDOW w AS (PARTITION BY b ORDER BY c)`},\n\n\t\t{`SELECT avg(1) OVER w FROM t`},\n\t\t{`SELECT avg(1) OVER () FROM t`},\n\t\t{`SELECT avg(1) OVER (w) FROM t`},\n\t\t{`SELECT avg(1) OVER (PARTITION BY b) FROM t`},\n\t\t{`SELECT avg(1) OVER (ORDER BY c) FROM t`},\n\t\t{`SELECT avg(1) OVER (PARTITION BY b ORDER BY c) FROM t`},\n\t\t{`SELECT avg(1) OVER (w PARTITION BY b ORDER BY c) FROM t`},\n\n\t\t{`SELECT avg(1) OVER (ROWS UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS 1 PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN CURRENT ROW AND CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (w ROWS UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (PARTITION BY b ROWS UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ORDER BY c ROWS UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (PARTITION BY b ORDER BY c ROWS UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (w PARTITION BY b ORDER BY c ROWS UNBOUNDED PRECEDING) FROM t`},\n\n\t\t{`SELECT avg(1) OVER (RANGE UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE 1 PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN 1 PRECEDING AND 1 PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN 1 PRECEDING AND CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN CURRENT ROW AND CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (RANGE BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (w RANGE UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (PARTITION BY b RANGE UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ORDER BY c RANGE UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (PARTITION BY b ORDER BY c RANGE UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (w PARTITION BY b ORDER BY c RANGE UNBOUNDED PRECEDING) FROM t`},\n\n\t\t{`SELECT avg(1) OVER (GROUPS UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS 1 PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN 1 PRECEDING AND 1 PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN 1 PRECEDING AND CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN CURRENT ROW AND CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (GROUPS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t`},\n\t\t{`SELECT avg(1) OVER (w GROUPS UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (PARTITION BY b GROUPS UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (ORDER BY c GROUPS UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (PARTITION BY b ORDER BY c GROUPS UNBOUNDED PRECEDING) FROM t`},\n\t\t{`SELECT avg(1) OVER (w PARTITION BY b ORDER BY c GROUPS UNBOUNDED PRECEDING) FROM t`},\n\n\t\t{`SELECT avg(1) OVER (ROWS UNBOUNDED PRECEDING EXCLUDE CURRENT ROW) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS UNBOUNDED PRECEDING EXCLUDE GROUP) FROM t`},\n\t\t{`SELECT avg(1) OVER (ROWS UNBOUNDED PRECEDING EXCLUDE TIES) FROM t`},\n\n\t\t{`SELECT percentile_disc(0.50) WITHIN GROUP (ORDER BY c) FROM t`},\n\t\t{`SELECT percentile_disc(0.50) WITHIN GROUP (ORDER BY c DESC) FROM t`},\n\t\t{`SELECT percentile_cont(0.50) WITHIN GROUP (ORDER BY c) FROM t`},\n\t\t{`SELECT percentile_disc(ARRAY[0.95, 0.90]) WITHIN GROUP (ORDER BY c) FROM t`},\n\t\t{`SELECT percentile_cont(ARRAY[0.95, 0.90]) WITHIN GROUP (ORDER BY c) FROM t`},\n\n\t\t{`SELECT avg(1) FILTER (WHERE a > b)`},\n\t\t{`SELECT avg(1) FILTER (WHERE a > b) OVER (ORDER BY c)`},\n\n\t\t{`SELECT a FROM t UNION SELECT 1 FROM t`},\n\t\t{`SELECT a FROM t UNION SELECT 1 FROM t UNION SELECT 1 FROM t`},\n\t\t{`SELECT a FROM t UNION ALL SELECT 1 FROM t`},\n\t\t{`SELECT a FROM t EXCEPT SELECT 1 FROM t`},\n\t\t{`SELECT a FROM t EXCEPT ALL SELECT 1 FROM t`},\n\t\t{`SELECT a FROM t INTERSECT SELECT 1 FROM t`},\n\t\t{`SELECT a FROM t INTERSECT ALL SELECT 1 FROM t`},\n\n\t\t{`SELECT a FROM t1 JOIN t2 ON a = b`},\n\t\t{`SELECT a FROM t1 JOIN t2 USING (a)`},\n\t\t{`SELECT a FROM t1 INNER MERGE JOIN t2 USING (a)`},\n\t\t{`SELECT a FROM t1 LEFT JOIN t2 ON a = b`},\n\t\t{`SELECT a FROM t1 LEFT LOOKUP JOIN t2 ON a = b`},\n\t\t{`SELECT a FROM t1 RIGHT JOIN t2 ON a = b`},\n\t\t{`SELECT a FROM t1 INNER JOIN t2 ON a = b`},\n\t\t{`SELECT a FROM t1 INNER HASH JOIN t2 ON a = b`},\n\t\t{`SELECT a FROM t1 CROSS JOIN t2`},\n\t\t{`SELECT a FROM t1 CROSS LOOKUP JOIN t2`},\n\t\t{`SELECT a FROM t1 NATURAL JOIN t2`},\n\t\t{`SELECT a FROM t1 NATURAL INNER MERGE JOIN t2`},\n\t\t{`SELECT a FROM t1 INNER JOIN t2 USING (a)`},\n\t\t{`SELECT a FROM t1 FULL JOIN t2 USING (a)`},\n\t\t{`SELECT a FROM t1 FULL MERGE JOIN t2 USING (a)`},\n\t\t{`SELECT * FROM (t1 WITH ORDINALITY AS o1 CROSS JOIN t2 WITH ORDINALITY AS o2) WITH ORDINALITY AS o3`},\n\n\t\t{`SELECT a FROM t1 AS OF SYSTEM TIME '2016-01-01'`},\n\t\t{`SELECT a FROM t1, t2 AS OF SYSTEM TIME '2016-01-01'`},\n\t\t{`SELECT a FROM t1 AS OF SYSTEM TIME -('a' || 'b')::INTERVAL`},\n\n\t\t{`SELECT * FROM t LIMIT ALL`},\n\t\t{`SELECT EXISTS ((((TABLE error FOR KEY SHARE)) LIMIT ALL FOR KEY SHARE)) AS is FROM ident`},\n\n\t\t{`SELECT a FROM t LIMIT a`},\n\t\t{`SELECT a FROM t OFFSET b`},\n\t\t{`SELECT a FROM t LIMIT a OFFSET b`},\n\t\t{`SELECT DISTINCT * FROM t`},\n\t\t{`SELECT DISTINCT a, b FROM t`},\n\t\t{`SELECT DISTINCT ON (a, b) c FROM t`},\n\n\t\t{`SET a = 3`},\n\t\t{`EXPLAIN SET a = 3`},\n\t\t{`SET a = 3, 4`},\n\t\t{`SET a = '3'`},\n\t\t{`SET a = 3.0`},\n\t\t{`SET a = $1`},\n\t\t{`SET a = off`},\n\t\t{`SET TRANSACTION READ ONLY`},\n\t\t{`SET TRANSACTION READ WRITE`},\n\t\t{`SET TRANSACTION ISOLATION LEVEL SERIALIZABLE`},\n\t\t{`SET TRANSACTION PRIORITY LOW`},\n\t\t{`SET TRANSACTION PRIORITY NORMAL`},\n\t\t{`SET TRANSACTION PRIORITY HIGH`},\n\t\t{`SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, PRIORITY HIGH`},\n\n\t\t{`SET TRACING = off`},\n\t\t{`EXPLAIN SET TRACING = off`},\n\t\t{`SET TRACING = 'cluster', 'kv'`},\n\n\t\t{`SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE`},\n\n\t\t{`SET CLUSTER SETTING a = 3`},\n\t\t{`EXPLAIN SET CLUSTER SETTING a = 3`},\n\t\t{`SET CLUSTER SETTING a = '3s'`},\n\t\t{`SET CLUSTER SETTING a = '3'`},\n\t\t{`SET CLUSTER SETTING a = 3.0`},\n\t\t{`SET CLUSTER SETTING a = $1`},\n\t\t{`SET CLUSTER SETTING a = off`},\n\n\t\t{`SELECT * FROM (VALUES (1, 2)) AS foo`},\n\t\t{`SELECT * FROM (VALUES (1, 2)) AS foo (a, b)`},\n\n\t\t{`SELECT * FROM [123 AS t]`},\n\t\t{`SELECT * FROM [123(1, 2, 3) AS t]`},\n\t\t{`SELECT * FROM [123() AS t]`},\n\t\t{`SELECT * FROM t@[123]`},\n\t\t{`SELECT * FROM [123 AS t]@[456]`},\n\n\t\t{`INSERT INTO [123 AS t] VALUES (1)`},\n\t\t{`INSERT INTO [123(1, 2) AS t] VALUES (1, 2)`},\n\t\t{`INSERT INTO [123 AS t](col1, col2) VALUES (1, 2)`},\n\t\t{`UPSERT INTO [123 AS t] VALUES (1)`},\n\t\t{`UPDATE [123 AS t] SET b = 3`},\n\t\t{`UPDATE [123 AS t]@idx SET b = 3`},\n\t\t{`DELETE FROM [123 AS t]`},\n\t\t{`DELETE FROM [123 AS t]@idx`},\n\n\t\t{`SELECT (1 + 2).*`},\n\t\t{`SELECT (1 + 2).@1`},\n\t\t{`SELECT (1 + 2).col`},\n\t\t{`SELECT (abc.def).col`},\n\t\t{`SELECT (i.keys).col`},\n\t\t{`SELECT (i.keys).*`},\n\t\t{`SELECT (i.keys).@1`},\n\t\t{`SELECT (ARRAY['a', 'b', 'c']).name`},\n\n\t\t{`SELECT 1 FOR UPDATE`},\n\t\t{`SELECT 1 FOR NO KEY UPDATE`},\n\t\t{`SELECT 1 FOR SHARE`},\n\t\t{`SELECT 1 FOR KEY SHARE`},\n\t\t{`SELECT 1 FOR UPDATE OF a`},\n\t\t{`SELECT 1 FOR NO KEY UPDATE OF a, b`},\n\t\t{`SELECT 1 FOR UPDATE SKIP LOCKED`},\n\t\t{`SELECT 1 FOR NO KEY UPDATE OF a, b NOWAIT`},\n\t\t{`SELECT 1 ORDER BY 1 FOR UPDATE`},\n\t\t{`SELECT 1 LIMIT 1 FOR UPDATE`},\n\t\t{`SELECT 1 ORDER BY 1 LIMIT 1 FOR UPDATE`},\n\t\t{`SELECT 1 FOR UPDATE FOR UPDATE`},\n\t\t{`SELECT 1 FOR SHARE OF a FOR KEY SHARE SKIP LOCKED`},\n\n\t\t{`TABLE a`}, // Shorthand for: SELECT * FROM a; used e.g. in CREATE VIEW v AS TABLE t\n\t\t{`EXPLAIN TABLE a`},\n\t\t{`TABLE [123 AS a]`},\n\n\t\t{`TRUNCATE TABLE a`},\n\t\t{`EXPLAIN TRUNCATE TABLE a`},\n\t\t{`TRUNCATE TABLE a, b.c`},\n\t\t{`TRUNCATE TABLE a CASCADE`},\n\n\t\t{`UPDATE a SET b = 3`},\n\t\t{`EXPLAIN UPDATE a SET b = 3`},\n\t\t{`UPDATE a.b SET b = 3`},\n\t\t{`UPDATE a.b@c SET b = 3`},\n\t\t{`UPDATE a SET b = 3, c = DEFAULT`},\n\t\t{`UPDATE a SET b = 3, c = DEFAULT FROM b`},\n\t\t{`UPDATE a SET b = 3, c = DEFAULT FROM a AS other`},\n\t\t{`UPDATE a SET b = 3, c = DEFAULT FROM a AS other, b`},\n\t\t{`UPDATE a SET b = 3 + 4`},\n\t\t{`UPDATE a SET (b, c) = (3, DEFAULT)`},\n\t\t{`UPDATE a SET (b, c) = (SELECT 3, 4)`},\n\t\t{`UPDATE a SET b = 3 WHERE a = b`},\n\t\t{`UPDATE a SET b = 3 WHERE a = b LIMIT c`},\n\t\t{`UPDATE a SET b = 3 WHERE a = b ORDER BY c`},\n\t\t{`UPDATE a SET b = 3 WHERE a = b ORDER BY c LIMIT d`},\n\t\t{`UPDATE a SET b = 3 WHERE a = b RETURNING a`},\n\t\t{`UPDATE a SET b = 3 WHERE a = b RETURNING 1, 2`},\n\t\t{`UPDATE a SET b = 3 WHERE a = b RETURNING a, a + b`},\n\t\t{`UPDATE a SET b = 3 WHERE a = b RETURNING NOTHING`},\n\t\t{`UPDATE a SET b = 3 WHERE a = b ORDER BY c LIMIT d RETURNING e`},\n\t\t{`UPDATE a SET b = 3 FROM other WHERE a = b ORDER BY c LIMIT d RETURNING e`},\n\n\t\t{`UPDATE t AS \"0\" SET k = ''`}, // \"0\" lost its quotes\n\t\t{`SELECT * FROM \"0\" JOIN \"0\" USING (id, \"0\")`}, // last \"0\" lost its quotes.\n\n\t\t{`ALTER DATABASE a RENAME TO b`},\n\t\t{`EXPLAIN ALTER DATABASE a RENAME TO b`},\n\n\t\t{`ALTER INDEX b RENAME TO b`},\n\t\t{`EXPLAIN ALTER INDEX b RENAME TO b`},\n\t\t{`ALTER INDEX a@b RENAME TO b`},\n\t\t{`ALTER INDEX a@primary RENAME TO like`},\n\t\t{`ALTER INDEX IF EXISTS b RENAME TO b`},\n\t\t{`ALTER INDEX IF EXISTS a@b RENAME TO b`},\n\t\t{`ALTER INDEX IF EXISTS a@primary RENAME TO like`},\n\n\t\t{`ALTER TABLE a RENAME TO b`},\n\t\t{`EXPLAIN ALTER TABLE a RENAME TO b`},\n\t\t{`ALTER TABLE IF EXISTS a RENAME TO b`},\n\t\t{`ALTER TABLE a RENAME COLUMN c1 TO c2`},\n\t\t{`ALTER TABLE IF EXISTS a RENAME COLUMN c1 TO c2`},\n\t\t{`ALTER TABLE a RENAME CONSTRAINT c1 TO c2`},\n\t\t{`ALTER TABLE IF EXISTS a RENAME CONSTRAINT c1 TO c2`},\n\t\t{`ALTER TABLE a RENAME CONSTRAINT c TO d, RENAME COLUMN e TO f`},\n\n\t\t{`ALTER TABLE a ADD COLUMN b INT8, ADD CONSTRAINT a_idx UNIQUE (a)`},\n\t\t{`EXPLAIN ALTER TABLE a ADD COLUMN b INT8`},\n\t\t{`ALTER TABLE a ADD COLUMN IF NOT EXISTS b INT8, ADD CONSTRAINT a_idx UNIQUE (a)`},\n\t\t{`ALTER TABLE IF EXISTS a ADD COLUMN b INT8, ADD CONSTRAINT a_idx UNIQUE (a)`},\n\t\t{`ALTER TABLE IF EXISTS a ADD COLUMN IF NOT EXISTS b INT8, ADD CONSTRAINT a_idx UNIQUE (a)`},\n\t\t{`ALTER TABLE a ADD COLUMN b INT8, ADD CONSTRAINT a_idx UNIQUE (a)`},\n\t\t{`ALTER TABLE a ADD COLUMN IF NOT EXISTS b INT8, ADD CONSTRAINT a_idx UNIQUE (a) NOT VALID`},\n\t\t{`ALTER TABLE IF EXISTS a ADD COLUMN b INT8, ADD CONSTRAINT a_idx UNIQUE (a)`},\n\t\t{`ALTER TABLE IF EXISTS a ADD COLUMN IF NOT EXISTS b INT8, ADD CONSTRAINT a_idx UNIQUE (a)`},\n\t\t{`ALTER TABLE a ADD COLUMN b INT8 FAMILY fam_a`},\n\t\t{`ALTER TABLE a ADD COLUMN b INT8 CREATE FAMILY`},\n\t\t{`ALTER TABLE a ADD COLUMN b INT8 CREATE FAMILY fam_b`},\n\t\t{`ALTER TABLE a ADD COLUMN b INT8 CREATE IF NOT EXISTS FAMILY fam_b`},\n\n\t\t{`ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (a, b, c)`},\n\n\t\t{`ALTER TABLE a DROP COLUMN b, DROP CONSTRAINT a_idx`},\n\t\t{`ALTER TABLE a DROP COLUMN IF EXISTS b, DROP CONSTRAINT a_idx`},\n\t\t{`ALTER TABLE IF EXISTS a DROP COLUMN b, DROP CONSTRAINT a_idx`},\n\t\t{`ALTER TABLE IF EXISTS a DROP COLUMN IF EXISTS b, DROP CONSTRAINT a_idx`},\n\t\t{`ALTER TABLE a DROP COLUMN b, DROP CONSTRAINT a_idx`},\n\t\t{`ALTER TABLE a DROP COLUMN IF EXISTS b, DROP CONSTRAINT a_idx`},\n\t\t{`ALTER TABLE IF EXISTS a DROP COLUMN b, DROP CONSTRAINT a_idx`},\n\t\t{`ALTER TABLE IF EXISTS a DROP COLUMN IF EXISTS b, DROP CONSTRAINT a_idx`},\n\t\t{`ALTER TABLE a DROP COLUMN b CASCADE`},\n\t\t{`ALTER TABLE a DROP COLUMN b RESTRICT`},\n\t\t{`ALTER TABLE a DROP CONSTRAINT b CASCADE`},\n\t\t{`ALTER TABLE a DROP CONSTRAINT IF EXISTS b RESTRICT`},\n\t\t{`ALTER TABLE a VALIDATE CONSTRAINT a`},\n\t\t{`ALTER TABLE a ADD PRIMARY KEY (x, y, z)`},\n\t\t{`ALTER TABLE a ADD PRIMARY KEY (x, y, z) USING HASH WITH BUCKET_COUNT = 10 INTERLEAVE IN PARENT b (x, y)`},\n\t\t{`ALTER TABLE a ADD CONSTRAINT \"primary\" PRIMARY KEY (x, y, z)`},\n\t\t{`ALTER TABLE a ADD CONSTRAINT \"primary\" PRIMARY KEY (x, y, z) USING HASH WITH BUCKET_COUNT = 10 INTERLEAVE IN PARENT b (x, y)`},\n\n\t\t{`ALTER TABLE a ALTER COLUMN b SET DEFAULT 42`},\n\t\t{`ALTER TABLE a ALTER COLUMN b SET DEFAULT NULL`},\n\t\t{`ALTER TABLE a ALTER COLUMN b DROP DEFAULT`},\n\t\t{`ALTER TABLE a ALTER COLUMN b DROP NOT NULL`},\n\t\t{`ALTER TABLE a ALTER COLUMN b DROP STORED`},\n\n\t\t{`ALTER TABLE a ALTER COLUMN b SET DATA TYPE INT8`},\n\t\t{`ALTER TABLE a ALTER COLUMN b SET DATA TYPE STRING COLLATE en USING b::STRING`},\n\t\t{`ALTER TABLE a ALTER COLUMN b SET DATA TYPE DECIMAL(10)[]`},\n\n\t\t{`COPY t FROM STDIN`},\n\t\t{`COPY t (a, b, c) FROM STDIN`},\n\t\t{`COPY crdb_internal.file_upload FROM STDIN WITH destination = 'filename'`},\n\n\t\t{`ALTER TABLE a SPLIT AT VALUES (1)`},\n\t\t{`EXPLAIN ALTER TABLE a SPLIT AT VALUES (1)`},\n\t\t{`ALTER TABLE a SPLIT AT SELECT * FROM t`},\n\t\t{`ALTER TABLE d.a SPLIT AT VALUES ('b', 2)`},\n\t\t{`ALTER INDEX a@i SPLIT AT VALUES (1)`},\n\t\t{`ALTER INDEX d.a@i SPLIT AT VALUES (2)`},\n\t\t{`ALTER INDEX i SPLIT AT VALUES (1)`},\n\t\t{`ALTER INDEX d.i SPLIT AT VALUES (2)`},\n\t\t{`ALTER INDEX \"primary\" SPLIT AT VALUES (2)`},\n\t\t{`ALTER INDEX public.public.\"primary\" SPLIT AT VALUES (2)`},\n\t\t{`ALTER TABLE a SPLIT AT VALUES (1) WITH EXPIRATION '1 day'`},\n\t\t{`ALTER TABLE a SPLIT AT VALUES (1) WITH EXPIRATION '1 day':::INTERVAL`},\n\t\t{`ALTER TABLE a SPLIT AT VALUES (1) WITH EXPIRATION '7258118400000000.0'`},\n\t\t{`ALTER TABLE a SPLIT AT VALUES (1) WITH EXPIRATION '2200-01-01 00:00:00.0'`},\n\t\t{`ALTER TABLE a SPLIT AT VALUES (1) WITH EXPIRATION TIMESTAMP '2200-01-01 00:00:00.0'`},\n\t\t{`ALTER TABLE a SPLIT AT VALUES (1) WITH EXPIRATION '2200-01-01 00:00:00.0':::TIMESTAMP`},\n\t\t{`ALTER TABLE a SPLIT AT VALUES (1) WITH EXPIRATION TIMESTAMPTZ '2200-01-01 00:00:00.0'`},\n\n\t\t{`ALTER TABLE a UNSPLIT AT VALUES (1)`},\n\t\t{`EXPLAIN ALTER TABLE a UNSPLIT AT VALUES (1)`},\n\t\t{`ALTER TABLE a UNSPLIT AT SELECT * FROM t`},\n\t\t{`ALTER TABLE d.a UNSPLIT AT VALUES ('b', 2)`},\n\t\t{`ALTER INDEX a@i UNSPLIT AT VALUES (1)`},\n\t\t{`ALTER INDEX d.a@i UNSPLIT AT VALUES (2)`},\n\t\t{`ALTER INDEX i UNSPLIT AT VALUES (1)`},\n\t\t{`ALTER INDEX d.i UNSPLIT AT VALUES (2)`},\n\t\t{`ALTER INDEX \"primary\" UNSPLIT AT VALUES (2)`},\n\t\t{`ALTER INDEX public.public.\"primary\" UNSPLIT AT VALUES (2)`},\n\n\t\t{`ALTER TABLE a EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 1)`},\n\t\t{`EXPLAIN ALTER TABLE a EXPERIMENTAL_RELOCATE TABLE b`},\n\t\t{`ALTER TABLE a EXPERIMENTAL_RELOCATE SELECT * FROM t`},\n\t\t{`ALTER TABLE d.a EXPERIMENTAL_RELOCATE VALUES (ARRAY[1, 2, 3], 'b', 2)`},\n\t\t{`ALTER INDEX d.i EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 2)`},\n\n\t\t{`ALTER TABLE a EXPERIMENTAL_RELOCATE LEASE VALUES (1, 1)`},\n\t\t{`ALTER TABLE a EXPERIMENTAL_RELOCATE LEASE SELECT * FROM t`},\n\t\t{`ALTER TABLE d.a EXPERIMENTAL_RELOCATE LEASE VALUES (1, 'b', 2)`},\n\t\t{`ALTER INDEX d.i EXPERIMENTAL_RELOCATE LEASE VALUES (1, 2)`},\n\n\t\t{`ALTER TABLE a SCATTER`},\n\t\t{`EXPLAIN ALTER TABLE a SCATTER`},\n\t\t{`ALTER TABLE a SCATTER FROM (1, 2, 3) TO (4, 5, 6)`},\n\t\t{`ALTER TABLE d.a SCATTER`},\n\t\t{`ALTER INDEX d.i SCATTER FROM (1) TO (2)`},\n\n\t\t{`ALTER RANGE default CONFIGURE ZONE = 'foo'`},\n\t\t{`EXPLAIN ALTER RANGE default CONFIGURE ZONE = 'foo'`},\n\t\t{`ALTER RANGE meta CONFIGURE ZONE = 'foo'`},\n\n\t\t{`ALTER DATABASE db CONFIGURE ZONE = 'foo'`},\n\t\t{`EXPLAIN ALTER DATABASE db CONFIGURE ZONE = 'foo'`},\n\n\t\t{`ALTER TABLE db.t CONFIGURE ZONE = 'foo'`},\n\t\t{`EXPLAIN ALTER TABLE db.t CONFIGURE ZONE = 'foo'`},\n\n\t\t{`ALTER PARTITION p OF TABLE db.t CONFIGURE ZONE = 'foo'`},\n\t\t{`EXPLAIN ALTER PARTITION p OF TABLE db.t CONFIGURE ZONE = 'foo'`},\n\n\t\t{`ALTER TABLE t CONFIGURE ZONE = 'foo'`},\n\t\t{`ALTER PARTITION p OF TABLE t CONFIGURE ZONE = 'foo'`},\n\n\t\t{`ALTER INDEX i CONFIGURE ZONE = 'foo'`},\n\t\t{`EXPLAIN ALTER INDEX i CONFIGURE ZONE = 'foo'`},\n\t\t{`ALTER INDEX db.t@i CONFIGURE ZONE = 'foo'`},\n\t\t{`ALTER INDEX t@i CONFIGURE ZONE = 'foo'`},\n\n\t\t{`ALTER PARTITION p OF INDEX db.t@idx CONFIGURE ZONE = 'foo'`},\n\t\t{`EXPLAIN ALTER PARTITION p OF INDEX db.t@idx CONFIGURE ZONE = 'foo'`},\n\n\t\t{`ALTER TABLE t CONFIGURE ZONE = b'foo'`},\n\t\t{`ALTER TABLE t CONFIGURE ZONE = a || b`},\n\n\t\t{`ALTER RANGE default CONFIGURE ZONE USING foo = bar, baz = yay`},\n\t\t{`ALTER RANGE meta CONFIGURE ZONE USING foo = bar, baz = yay`},\n\t\t{`ALTER DATABASE db CONFIGURE ZONE USING foo = bar, baz = yay`},\n\t\t{`ALTER TABLE db.t CONFIGURE ZONE USING foo = bar, baz = yay`},\n\t\t{`ALTER PARTITION p OF TABLE db.t CONFIGURE ZONE USING foo = bar, baz = yay`},\n\t\t{`ALTER TABLE t CONFIGURE ZONE USING foo = bar, baz = yay`},\n\t\t{`ALTER PARTITION p OF TABLE t CONFIGURE ZONE USING foo = bar, baz = yay`},\n\t\t{`ALTER INDEX db.t@i CONFIGURE ZONE USING foo = bar, baz = yay`},\n\t\t{`ALTER INDEX t@i CONFIGURE ZONE USING foo = bar, baz = yay`},\n\t\t{`ALTER INDEX i CONFIGURE ZONE USING foo = bar, baz = yay`},\n\t\t{`ALTER INDEX i CONFIGURE ZONE USING foo = COPY FROM PARENT`},\n\t\t{`ALTER INDEX i CONFIGURE ZONE USING foo = bar, baz = COPY FROM PARENT`},\n\t\t{`ALTER INDEX i CONFIGURE ZONE USING foo = COPY FROM PARENT, baz = COPY FROM PARENT`},\n\t\t{`ALTER INDEX i CONFIGURE ZONE USING foo = bar, other = COPY FROM PARENT, baz = yay`},\n\n\t\t{`ALTER RANGE default CONFIGURE ZONE DISCARD`},\n\t\t{`ALTER RANGE meta CONFIGURE ZONE DISCARD`},\n\t\t{`ALTER DATABASE db CONFIGURE ZONE DISCARD`},\n\t\t{`ALTER TABLE db.t CONFIGURE ZONE DISCARD`},\n\t\t{`ALTER PARTITION p OF TABLE db.t CONFIGURE ZONE DISCARD`},\n\t\t{`ALTER TABLE t CONFIGURE ZONE DISCARD`},\n\t\t{`ALTER PARTITION p OF TABLE t CONFIGURE ZONE DISCARD`},\n\t\t{`ALTER INDEX db.t@i CONFIGURE ZONE DISCARD`},\n\t\t{`ALTER INDEX t@i CONFIGURE ZONE DISCARD`},\n\t\t{`ALTER INDEX i CONFIGURE ZONE DISCARD`},\n\n\t\t{`ALTER RANGE default CONFIGURE ZONE USING DEFAULT`},\n\t\t{`ALTER RANGE meta CONFIGURE ZONE USING DEFAULT`},\n\t\t{`ALTER DATABASE db CONFIGURE ZONE USING DEFAULT`},\n\t\t{`ALTER TABLE db.t CONFIGURE ZONE USING DEFAULT`},\n\t\t{`ALTER PARTITION p OF TABLE db.t CONFIGURE ZONE USING DEFAULT`},\n\t\t{`ALTER TABLE t CONFIGURE ZONE USING DEFAULT`},\n\t\t{`ALTER PARTITION p OF TABLE t CONFIGURE ZONE USING DEFAULT`},\n\t\t{`ALTER INDEX db.t@i CONFIGURE ZONE USING DEFAULT`},\n\t\t{`ALTER INDEX t@i CONFIGURE ZONE USING DEFAULT`},\n\t\t{`ALTER INDEX i CONFIGURE ZONE USING DEFAULT`},\n\n\t\t{`ALTER TABLE t EXPERIMENTAL_AUDIT SET READ WRITE`},\n\t\t{`EXPLAIN ALTER TABLE t EXPERIMENTAL_AUDIT SET READ WRITE`},\n\t\t{`ALTER TABLE t EXPERIMENTAL_AUDIT SET OFF`},\n\n\t\t{`ALTER TYPE db.s.t ADD VALUE 'hi'`},\n\t\t{`ALTER TYPE s.t ADD VALUE 'hi' BEFORE 'hello'`},\n\t\t{`ALTER TYPE t ADD VALUE 'hi' AFTER 'howdy'`},\n\t\t{`ALTER TYPE s.t ADD VALUE IF NOT EXISTS 'hi' BEFORE 'hello'`},\n\t\t{`ALTER TYPE t RENAME VALUE 'value1' TO 'value2'`},\n\t\t{`ALTER TYPE t RENAME TO t2`},\n\t\t{`ALTER TYPE t SET SCHEMA newschema`},\n\n\t\t{`COMMENT ON COLUMN a.b IS 'a'`},\n\t\t{`COMMENT ON COLUMN a.b IS NULL`},\n\t\t{`COMMENT ON COLUMN a.b.c IS 'a'`},\n\t\t{`COMMENT ON COLUMN a.b.c.d IS 'a'`},\n\t\t{`COMMENT ON DATABASE foo IS 'a'`},\n\t\t{`COMMENT ON DATABASE foo IS NULL`},\n\t\t{`COMMENT ON INDEX foo IS 'a'`},\n\t\t{`COMMENT ON INDEX foo IS NULL`},\n\t\t{`COMMENT ON TABLE foo IS 'a'`},\n\t\t{`COMMENT ON TABLE foo IS NULL`},\n\n\t\t{`ALTER SEQUENCE a RENAME TO b`},\n\t\t{`EXPLAIN ALTER SEQUENCE a RENAME TO b`},\n\t\t{`ALTER SEQUENCE IF EXISTS a RENAME TO b`},\n\n\t\t{`ALTER SEQUENCE a INCREMENT BY 5 START WITH 1000`},\n\t\t{`EXPLAIN ALTER SEQUENCE a INCREMENT BY 5 START WITH 1000`},\n\t\t{`ALTER SEQUENCE IF EXISTS a INCREMENT BY 5 START WITH 1000`},\n\t\t{`ALTER SEQUENCE IF EXISTS a NO CYCLE CACHE 1`},\n\t\t{`ALTER SEQUENCE a OWNED BY b`},\n\t\t{`ALTER SEQUENCE a OWNED BY NONE`},\n\n\t\t{`EXPERIMENTAL SCRUB DATABASE x`},\n\t\t{`EXPLAIN EXPERIMENTAL SCRUB DATABASE x`},\n\t\t{`EXPERIMENTAL SCRUB DATABASE x AS OF SYSTEM TIME 1`},\n\t\t{`EXPERIMENTAL SCRUB TABLE x`},\n\t\t{`EXPLAIN EXPERIMENTAL SCRUB TABLE x`},\n\t\t{`EXPERIMENTAL SCRUB TABLE x AS OF SYSTEM TIME 1`},\n\t\t{`EXPERIMENTAL SCRUB TABLE x AS OF SYSTEM TIME 1 WITH OPTIONS INDEX ALL`},\n\t\t{`EXPERIMENTAL SCRUB TABLE x WITH OPTIONS INDEX (index_name)`},\n\t\t{`EXPERIMENTAL SCRUB TABLE x WITH OPTIONS PHYSICAL`},\n\t\t{`EXPERIMENTAL SCRUB TABLE x WITH OPTIONS CONSTRAINT ALL`},\n\t\t{`EXPERIMENTAL SCRUB TABLE x WITH OPTIONS CONSTRAINT (cst_name)`},\n\t\t{`EXPERIMENTAL SCRUB TABLE x WITH OPTIONS PHYSICAL, INDEX (index_name), CONSTRAINT (cst_name)`},\n\t\t{`EXPERIMENTAL SCRUB TABLE x WITH OPTIONS PHYSICAL, INDEX ALL, CONSTRAINT ALL`},\n\n\t\t{`BACKUP TABLE foo TO 'bar'`},\n\t\t{`CREATE SCHEDULE FOR BACKUP TABLE foo TO 'bar' RECURRING NEVER`},\n\t\t{`CREATE SCHEDULE 'my schedule' FOR BACKUP TABLE foo TO 'bar' RECURRING NEVER`},\n\t\t{`CREATE SCHEDULE FOR BACKUP TABLE foo TO 'bar' RECURRING '@daily'`},\n\t\t{`CREATE SCHEDULE FOR BACKUP TABLE foo, bar, buz TO 'bar' RECURRING '@daily' FULL BACKUP ALWAYS`},\n\t\t{`CREATE SCHEDULE FOR BACKUP TABLE foo, bar, buz TO 'bar' RECURRING '@daily' FULL BACKUP '@weekly'`},\n\t\t{`CREATE SCHEDULE FOR BACKUP TABLE foo, bar, buz TO 'bar' WITH revision_history RECURRING '@daily' FULL BACKUP '@weekly'`},\n\t\t{`CREATE SCHEDULE FOR BACKUP TO 'bar' WITH revision_history RECURRING '@daily' FULL BACKUP '@weekly' WITH EXPERIMENTAL SCHEDULE OPTIONS foo = 'bar'`},\n\t\t{`EXPLAIN BACKUP TABLE foo TO 'bar'`},\n\t\t{`BACKUP TABLE foo.foo, baz.baz TO 'bar'`},\n\n\t\t{`SHOW BACKUP 'bar'`},\n\t\t{`SHOW BACKUP 'bar' WITH foo = 'bar'`},\n\t\t{`EXPLAIN SHOW BACKUP 'bar'`},\n\t\t{`SHOW BACKUP RANGES 'bar'`},\n\t\t{`SHOW BACKUP FILES 'bar'`},\n\t\t{`SHOW BACKUP FILES 'bar' WITH foo = 'bar'`},\n\n\t\t{`BACKUP TABLE foo TO 'bar' AS OF SYSTEM TIME '1' INCREMENTAL FROM 'baz'`},\n\t\t{`BACKUP TABLE foo TO $1 INCREMENTAL FROM 'bar', $2, 'baz'`},\n\n\t\t{`BACKUP DATABASE foo TO 'bar'`},\n\t\t{`EXPLAIN BACKUP DATABASE foo TO 'bar'`},\n\t\t{`BACKUP DATABASE foo, baz TO 'bar'`},\n\t\t{`BACKUP DATABASE foo TO 'bar' AS OF SYSTEM TIME '1' INCREMENTAL FROM 'baz'`},\n\n\t\t{`BACKUP DATABASE foo TO ($1, $2)`},\n\t\t{`BACKUP DATABASE foo TO ($1, $2) INCREMENTAL FROM 'baz'`},\n\n\t\t{`BACKUP TENANT 36 TO 'bar'`},\n\n\t\t{`RESTORE TABLE foo FROM 'bar'`},\n\t\t{`EXPLAIN RESTORE TABLE foo FROM 'bar'`},\n\t\t{`RESTORE TABLE foo FROM $1`},\n\t\t{`RESTORE TABLE foo FROM $1, $2, 'bar'`},\n\t\t{`RESTORE TABLE foo, baz FROM 'bar'`},\n\t\t{`RESTORE TABLE foo, baz FROM 'bar' AS OF SYSTEM TIME '1'`},\n\n\t\t{`RESTORE DATABASE foo FROM 'bar'`},\n\t\t{`EXPLAIN RESTORE DATABASE foo FROM 'bar'`},\n\t\t{`RESTORE DATABASE foo, baz FROM 'bar'`},\n\t\t{`RESTORE DATABASE foo, baz FROM 'bar' AS OF SYSTEM TIME '1'`},\n\n\t\t{`RESTORE DATABASE foo FROM ($1, $2)`},\n\t\t{`RESTORE DATABASE foo FROM ($1, $2), $3`},\n\t\t{`RESTORE DATABASE foo FROM $1, ($2, $3)`},\n\t\t{`RESTORE DATABASE foo FROM ($1, $2), ($3, $4)`},\n\t\t{`RESTORE DATABASE foo FROM ($1, $2), ($3, $4) AS OF SYSTEM TIME '1'`},\n\n\t\t{`RESTORE TENANT 36 FROM ($1, $2) AS OF SYSTEM TIME '1'`},\n\n\t\t{`BACKUP TABLE foo TO 'bar' WITH revision_history, detached`},\n\t\t{`RESTORE TABLE foo FROM 'bar' WITH key1, key2 = 'value'`},\n\n\t\t{`IMPORT TABLE foo CREATE USING 'nodelocal://0/some/file' CSV DATA ('path/to/some/file', $1) WITH temp = 'path/to/temp'`},\n\t\t{`EXPLAIN IMPORT TABLE foo CREATE USING 'nodelocal://0/some/file' CSV DATA ('path/to/some/file', $1) WITH temp = 'path/to/temp'`},\n\t\t{`IMPORT TABLE foo CREATE USING 'nodelocal://0/some/file' DELIMITED DATA ('path/to/some/file', $1)`},\n\t\t{`IMPORT TABLE foo (id INT8 PRIMARY KEY, email STRING, age INT8) CSV DATA ('path/to/some/file', $1) WITH temp = 'path/to/temp'`},\n\t\t{`IMPORT TABLE foo (id INT8, email STRING, age INT8) CSV DATA ('path/to/some/file', $1) WITH comma = ',', \"nullif\" = 'n/a', temp = $2`},\n\t\t{`IMPORT TABLE foo FROM PGDUMPCREATE 'nodelocal://0/foo/bar' WITH temp = 'path/to/temp'`},\n\t\t{`IMPORT INTO foo(id, email) CSV DATA ('path/to/some/file', $1) WITH temp = 'path/to/temp'`},\n\t\t{`IMPORT INTO foo CSV DATA ('path/to/some/file', $1) WITH temp = 'path/to/temp'`},\n\n\t\t{`IMPORT PGDUMP 'nodelocal://0/foo/bar' WITH temp = 'path/to/temp'`},\n\t\t{`EXPLAIN IMPORT PGDUMP 'nodelocal://0/foo/bar' WITH temp = 'path/to/temp'`},\n\n\t\t{`EXPORT INTO CSV 'a' FROM TABLE a`}, // TODO(knz): Make this explainable.\n\t\t{`EXPORT INTO CSV 'a' FROM SELECT * FROM a`},\n\t\t{`EXPORT INTO CSV 's3://my/path/%part%.csv' WITH delimiter = '|' FROM TABLE a`},\n\t\t{`EXPORT INTO CSV 's3://my/path/%part%.csv' WITH delimiter = '|' FROM SELECT a, sum(b) FROM c WHERE d = 1 ORDER BY sum(b) DESC LIMIT 10`},\n\n\t\t{`SET ROW (1, true, NULL)`},\n\n\t\t{`EXPERIMENTAL CHANGEFEED FOR TABLE foo`},\n\t\t{`EXPLAIN CREATE CHANGEFEED FOR TABLE foo INTO 'sink'`},\n\t\t{`CREATE CHANGEFEED FOR TABLE foo, db.bar, schema.db.foo INTO 'sink'`},\n\t\t{`CREATE CHANGEFEED FOR TABLE foo INTO 'sink'`},\n\t\t// TODO(dan): Implement.\n\t\t// {`CREATE CHANGEFEED FOR TABLE foo VALUES FROM (1) TO (2) INTO 'sink'`},\n\t\t// {`CREATE CHANGEFEED FOR TABLE foo PARTITION bar, baz INTO 'sink'`},\n\t\t// {`CREATE CHANGEFEED FOR DATABASE foo INTO 'sink'`},\n\t\t{`CREATE CHANGEFEED FOR TABLE foo INTO 'sink' WITH bar = 'baz'`},\n\n\t\t// Regression for #15926\n\t\t{`SELECT * FROM ((t1 NATURAL JOIN t2 WITH ORDINALITY AS o1)) WITH ORDINALITY AS o2`},\n\n\t\t{`WITH cte AS (SELECT 1) SELECT * FROM cte`},\n\t\t{`WITH cte (x) AS (INSERT INTO abc VALUES (1, 2)), cte2 (y) AS (SELECT x + 1 FROM cte) SELECT * FROM cte, cte2`},\n\t\t{`WITH RECURSIVE cte (x) AS (SELECT 1), cte2 (y) AS (SELECT x + 1 FROM cte) SELECT 1`},\n\t\t{`WITH cte AS MATERIALIZED (SELECT 1) SELECT * FROM cte`},\n\t\t{`WITH RECURSIVE cte AS MATERIALIZED (SELECT 1) SELECT * FROM cte`},\n\t\t{`WITH cte AS NOT MATERIALIZED (SELECT 1) SELECT * FROM cte`},\n\t\t{`WITH cte (x) AS MATERIALIZED (INSERT INTO abc VALUES (1, 2)), cte2 (y) AS NOT MATERIALIZED (SELECT x + 1 FROM cte) SELECT * FROM cte, cte2`},\n\t\t{`WITH RECURSIVE cte (x) AS MATERIALIZED (INSERT INTO abc VALUES (1, 2)), cte2 (y) AS NOT MATERIALIZED (SELECT x + 1 FROM cte) SELECT * FROM cte, cte2`},\n\t}\n\tvar p parser.Parser // Verify that the same parser can be reused.\n\tfor _, d := range testData {\n\t\tstmts, err := p.Parse(d.sql)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s: expected success, but found %s\", d.sql, err)\n\t\t}\n\t\ts := stmts.String()\n\t\tif d.sql != s {\n\t\t\tt.Errorf(\"expected \\n%q\\n, but found \\n%q\", d.sql, s)\n\t\t}\n\t\tsqlutils.VerifyStatementPrettyRoundtrip(t, d.sql)\n\t}\n}", "title": "" }, { "docid": "b9ab839bb25cd2623d35a765e3d9d092", "score": "0.5176764", "text": "func TestPerDBCredsOverride(t *testing.T) {\n\tif base.UnitTestUrlIsWalrus() {\n\t\tt.Skip(\"This test only works against Couchbase Server\")\n\t}\n\n\t// Get test bucket\n\ttb1 := base.GetTestBucket(t)\n\tdefer tb1.Close()\n\n\tconfig := rest.BootstrapStartupConfigForTest(t)\n\tconfig.BucketCredentials = map[string]*base.CredentialsConfig{\n\t\ttb1.GetName(): {\n\t\t\tUsername: base.TestClusterUsername(),\n\t\t\tPassword: base.TestClusterPassword(),\n\t\t},\n\t}\n\tconfig.DatabaseCredentials = map[string]*base.CredentialsConfig{\n\t\t\"db\": {\n\t\t\tUsername: \"invalid\",\n\t\t\tPassword: \"invalid\",\n\t\t},\n\t}\n\n\tctx := base.TestCtx(t)\n\tsc, err := rest.SetupServerContext(ctx, &config, true)\n\trequire.NoError(t, err)\n\n\tserverErr := make(chan error, 0)\n\tdefer func() {\n\t\tsc.Close(ctx)\n\t\trequire.NoError(t, <-serverErr)\n\t}()\n\n\tgo func() {\n\t\tserverErr <- rest.StartServer(ctx, &config, sc)\n\t}()\n\trequire.NoError(t, sc.WaitForRESTAPIs())\n\n\tcouchbaseCluster, err := rest.CreateCouchbaseClusterFromStartupConfig(sc.Config, base.PerUseClusterConnections)\n\trequire.NoError(t, err)\n\tsc.BootstrapContext.Connection = couchbaseCluster\n\n\tdbConfig := `{\n\t\t\"bucket\": \"` + tb1.GetName() + `\",\n\t\t\"enable_shared_bucket_access\": ` + strconv.FormatBool(base.TestUseXattrs()) + `,\n\t\t\"use_views\": ` + strconv.FormatBool(base.TestsDisableGSI()) + `,\n\t\t\"num_index_replicas\": 0\n\t}`\n\n\tres := rest.BootstrapAdminRequest(t, http.MethodPut, \"/db/\", dbConfig)\n\t// Make sure request failed as it could authenticate with the bucket\n\tassert.Equal(t, http.StatusForbidden, res.StatusCode)\n\n\t// Allow database to be created sucessfully\n\tsc.Config.DatabaseCredentials = map[string]*base.CredentialsConfig{}\n\tres = rest.BootstrapAdminRequest(t, http.MethodPut, \"/db/\", dbConfig)\n\tassert.Equal(t, http.StatusCreated, res.StatusCode)\n\n\t// Confirm fetch configs causes bucket credentials to be overrode\n\tsc.Config.DatabaseCredentials = map[string]*base.CredentialsConfig{\n\t\t\"db\": {\n\t\t\tUsername: \"invalidUsername\",\n\t\t\tPassword: \"invalidPassword\",\n\t\t},\n\t}\n\tconfigs, err := sc.FetchConfigs(ctx, false)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, configs[\"db\"])\n\tassert.Equal(t, \"invalidUsername\", configs[\"db\"].BucketConfig.Username)\n\tassert.Equal(t, \"invalidPassword\", configs[\"db\"].BucketConfig.Password)\n}", "title": "" }, { "docid": "ca119ff6a17216d723de9b1ff8b1b1f7", "score": "0.5175546", "text": "func TestUserGraphQLWithN1QL(t *testing.T) {\n\n\tbase.DisableTestWithCollections(t)\n\n\tif base.UnitTestUrlIsWalrus() {\n\t\tt.Skip(\"This test is Couchbase Server only (requires N1QL)\")\n\t}\n\n\tdb, ctx := setupTestDBWithFunctions(t, nil, &kTestGraphQLConfigWithN1QL)\n\tdefer db.Close(ctx)\n\n\tcollection, err := db.GetDefaultDatabaseCollectionWithUser()\n\trequire.NoError(t, err)\n\t_, _, _ = collection.Put(ctx, \"a\", Body{\"type\": \"task\", \"title\": \"Applesauce\", \"done\": true, \"tags\": []string{\"fruit\", \"soft\"}, \"channels\": \"wonderland\"})\n\t_, _, _ = collection.Put(ctx, \"b\", Body{\"type\": \"task\", \"title\": \"Beer\", \"description\": \"Bass ale please\", \"channels\": \"wonderland\"})\n\t_, _, _ = collection.Put(ctx, \"m\", Body{\"type\": \"task\", \"title\": \"Mangoes\", \"channels\": \"wonderland\"})\n\n\tn1qlStore, ok := base.AsN1QLStore(db.Bucket.DefaultDataStore())\n\trequire.True(t, ok)\n\n\tcreatedPrimaryIdx := createPrimaryIndex(t, n1qlStore)\n\n\tif createdPrimaryIdx {\n\t\tdefer func() {\n\t\t\terr := n1qlStore.DropIndex(base.PrimaryIndexName)\n\t\t\trequire.NoError(t, err)\n\t\t}()\n\n\t}\n\t// First run the tests as an admin:\n\tt.Run(\"AsAdmin\", func(t *testing.T) { testUserGraphQLAsAdmin(t, ctx, db) })\n\n\t// Now create a user and make it current:\n\tdb.SetUser(addUserAlice(t, db))\n\trequire.True(t, db.User().RoleNames().Contains(\"hero\"))\n\n\t// Repeat the tests as user \"alice\":\n\tt.Run(\"AsUser\", func(t *testing.T) { testUserGraphQLAsUser(t, ctx, db) })\n\n\t// Test the N1QL resolver that uses $parent:\n\tresult, err := db.UserGraphQLQuery(`query{ task(id:\"b\") {description,title} }`, \"\", nil, false, ctx)\n\tassertGraphQLResult(t, `{\"task\":{\"description\":\"Bass ale please\",\"title\":\"Beer\"}}`, result, err)\n}", "title": "" }, { "docid": "60002a7fd78ee540c7f7110ade1352b3", "score": "0.5167729", "text": "func ExampleUsage() {\n // You'll generally want a single driver instance per Neo4j database used\n // by your application.\n drive, _ := neo4j.NewDriver(\"http://localhost:7474\")\n\n // The driver allows you to create database Sessions\n // Sessions can, if you want, be pooled and re-used, although we use TCP \n // connection pooling by default even if you don't reuse sessions. That \n // is not guaranteed in future versions though.\n sess,_ := drive.NewSession()\n\n // Sessions allow you to create transactions\n tx,_ := sess.NewTransaction()\n \n // Run a Cypher statement like this\n res,_ := tx.Execute(\"CREATE (n) RETURN id(n)\")\n\n // Loop through the result like below. Next() forwards the result cursor, \n // which starts at -1. It returns true if there was another row in the result.\n var id int64\n for res.Next() {\n // Once we're on a row, we can read the columns in it\n id = res.GetInt(\"id(n)\")\n }\n\n // And it's considered good form to close the result when you're done.\n res.Close()\n\n // However, you will generally not want raw cypher statement, you'll want\n // to use parameters. This allows re-use of query plans, and gets rid of \n // issues of SQL-injection style vulnerabilities. {id} is the name of a\n // parameter in thie example\n res,_ = tx.ExecuteWithParams(\"START n=node({id}) RETURN id(n)\", map[string]interface{}{ \"id\":id })\n res.Close()\n\n // Finally, we commit our changes (or tx.Rollback() if we're unhappy with them)\n tx.Commit()\n}", "title": "" }, { "docid": "b3015d42677dd42d90ce131dddbc75cf", "score": "0.5164593", "text": "func (c *CockroachDB) Initialize(ctx context.Context) error {\n\tcreateDatabaseCMD := \"./cockroach sql --certs-dir=/cockroach/cockroach-client-certs -e 'CREATE DATABASE bank; CREATE TABLE bank.accounts (id INT, balance DECIMAL);'\"\n\tcreateDatabase := []string{\"sh\", \"-c\", createDatabaseCMD}\n\t_, stderr, err := c.execCommand(ctx, createDatabase)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Error while initializing: %s\", stderr)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "687a50899b583714500d8a13f3020038", "score": "0.5161324", "text": "func cassandraSetup() {\n\tvar err error\n\n\tif cdb != nil {\n\t\treturn\n\t}\n\n\tcluster := gocql.NewCluster(Config.Cassandra.ClusterAddr)\n\tcluster.ProtoVersion = Config.Cassandra.ProtoVersion\n\tcluster.Consistency = gocql.ParseConsistency(Config.Cassandra.Consistency)\n\t// each try is this long and you get 10 retries\n\tcluster.Timeout = time.Duration(Config.Cassandra.TimeoutMsec) * time.Millisecond\n\n\t// session for creating the keyspace\n\tcdb, err = cluster.CreateSession()\n\tif err != nil {\n\t\tlog.Fatalln(\"dbSetup - \" + err.Error())\n\t}\n\tcdb.Query(`CREATE KEYSPACE IF NOT EXISTS ` + Config.Cassandra.KeySpace + ` WITH REPLICATION = \n\t\t{ 'class' : 'SimpleStrategy', 'replication_factor' : 1 };`).Exec()\n\tcdb.Close()\n\n\t// session for the rest of setup and for on-going operation\n\tcluster.Keyspace = Config.Cassandra.KeySpace\n\tcdb, err = cluster.CreateSession()\n}", "title": "" }, { "docid": "55b9311979b0187cab21eb6f1e8d95cc", "score": "0.5149661", "text": "func TestCassandraSuite(t *testing.T) {\n\tif installer.SkipTestSuite(installer.CassandraTestSuite) {\n\t\tt.Skip()\n\t}\n\tif os.Getenv(\"SKIP_CASSANDRA_TESTS\") == \"true\" {\n\t\tt.Skip()\n\t}\n\n\ts := new(CassandraSuite)\n\tdefer func(s *CassandraSuite) {\n\t\tr := recover()\n\t\tif r != nil {\n\t\t\tlogger.Infof(\"unexpected panic occurred during test %s, --> %v\", t.Name(), r)\n\t\t\tt.Fail()\n\t\t\ts.Teardown()\n\t\t\tt.FailNow()\n\t\t}\n\t}(s)\n\tsuite.Run(t, s)\n}", "title": "" }, { "docid": "630d6d30bbc936b638ac354f07815a84", "score": "0.5149152", "text": "func TestSetupDB(t *testing.T) (DBer, func()) {\n\tdb, err := sql.Open(\"txdb\", \"dummy\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcleanup := func() {\n\t\tdb.Close()\n\t}\n\treturn db, cleanup\n}", "title": "" }, { "docid": "840ca27ba046c0e9e9b2b001c8bdf817", "score": "0.5142861", "text": "func TestDB() *gorm.DB {\n\tdb, err := gorm.Open(\"sqlite3\", \"./data/test/products_test.db\")\n\tif err != nil {\n\t\tfmt.Println(\"Storage Error: \", err)\n\t}\n\tdb.DB().SetMaxIdleConns(3)\n\tdb.LogMode(false)\n\tdb.Debug()\n\treturn db\n}", "title": "" }, { "docid": "df5d4dcf9a20767f4f56ae6687b3aadb", "score": "0.51389223", "text": "func OpenTestConnection(opts ...Option) (*Connection, error) {\n\tdefaultOptions := []Option{OptConfigFromEnv(), OptSSLMode(SSLModeDisable)}\n\tconn, err := Open(New(append(defaultOptions, opts...)...))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = conn.Exec(\"CREATE EXTENSION IF NOT EXISTS pgcrypto;\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn conn, nil\n}", "title": "" }, { "docid": "e73f283b9ce85db44a0469612ffe040b", "score": "0.513612", "text": "func InitTestWithName(t *testing.T, dbname string) *database.Connection {\n\treturn InitTestWithOptions(t, TestOptions{DatabaseName: &dbname})\n}", "title": "" }, { "docid": "164a8e8d855b519462d2f85edd2a58b5", "score": "0.51348364", "text": "func CreateTestDatabase() abstraction.Database {\n\tdb, err := sqlx.Open(\"mysql\", \"root:@(localhost:3306)/mouthful_test?parseTime=true\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdb.MapperFunc(func(s string) string { return strings.Title(s) })\n\tdb.DB.SetMaxOpenConns(1)\n\tDB := sqlxDriver.Database{\n\t\tDB: db,\n\t\tQueries: MysqlQueries,\n\t\tDialect: \"mysql\",\n\t\tIsTest: true,\n\t}\n\terr = DB.InitializeDatabase()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &DB\n}", "title": "" }, { "docid": "539adc90e7a2d917844ed78b0fa93934", "score": "0.5134702", "text": "func TestConnectivity(t *testing.T) {\n\tt.Skip(\"manual test\")\n\tctx := context.Background()\n\tkillStats = stats.NewCounters(\"TestKills\")\n\tinternalErrors = stats.NewCounters(\"TestInternalErrors\")\n\tmysqlStats = stats.NewTimings(\"TestMySQLStats\")\n\tpool := NewConnPool(\"p1\", 1, 30*time.Second)\n\tpool.Open(appParams, dbaParams)\n\n\tconn, err := pool.Get(ctx)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tconn.Kill()\n\n\tnewctx, cancel := withTimeout(ctx, 2*time.Second)\n\t_, err = conn.Exec(newctx, \"select * from a\", 1000, true)\n\tcancel()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tconn.Close()\n\n\tnewctx, cancel = withTimeout(ctx, 2*time.Second)\n\t_, err = conn.Exec(newctx, \"select * from a\", 1000, true)\n\tcancel()\n\t// You'll get a timedout error in slow mode. Otherwise, this should succeed.\n\ttimedout := \"error: setDeadline: timed out\"\n\tif err != nil && err.Error() != timedout {\n\t\tt.Errorf(\"got: %v, want nil or %s\", err, timedout)\n\t}\n\tconn.Recycle()\n\n\tconn, err = pool.Get(ctx)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tch := make(chan bool)\n\tgo func() {\n\t\tnewctx, cancel = withTimeout(ctx, 2*time.Millisecond)\n\t\t_, err = conn.Exec(newctx, \"select sleep(1) from dual\", 1000, true)\n\t\tcancel()\n\t\tlostConn := \"error: Lost connection to MySQL server during query (errno 2013) during query: select sleep(1) from dual\"\n\t\tif err == nil || err.Error() != lostConn {\n\t\t\tt.Errorf(\"got: %v, want %s\", err, lostConn)\n\t\t}\n\t\tch <- true\n\t}()\n\ttime.Sleep(40 * time.Millisecond)\n\tconn.Kill()\n\t<-ch\n\tconn.Recycle()\n\n\tconn, err = pool.Get(ctx)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tch = make(chan bool)\n\tgo func() {\n\t\tnewctx, cancel = withTimeout(ctx, 2*time.Millisecond)\n\t\terr = conn.Stream(newctx, \"select sleep(1) from dual\", func(*mproto.QueryResult) error {\n\t\t\treturn nil\n\t\t}, 4096)\n\t\tcancel()\n\t\tlostConn := \"Lost connection to MySQL server during query (errno 2013) during query: select sleep(1) from dual\"\n\t\tif err == nil || err.Error() != lostConn {\n\t\t\tt.Errorf(\"got: %v, want %s\", err, lostConn)\n\t\t}\n\t\tch <- true\n\t}()\n\ttime.Sleep(40 * time.Millisecond)\n\tconn.Kill()\n\t<-ch\n\tconn.Recycle()\n\n\tpool.Close()\n}", "title": "" }, { "docid": "0d43acf237db2b634f7d375837ff3c1d", "score": "0.5130657", "text": "func SetupDBForTesting() {\n\tconnectionDSN = os.Getenv(\"LCAPI_TEST_POSTGRES_DSN\")\n\tdb, err := CreateConnection()\n\tif err != nil {\n\t\tfmt.Printf(\"Error connecting to test DB:\\n %v\\n\", err)\n\t}\n\tpgdb = db\n}", "title": "" }, { "docid": "f14eb9c5d588fa7919379f35b1517e60", "score": "0.5126151", "text": "func TestCreateSchema(cfg DBConfig, schema, user string) error {\n\tpoolcfg := pgx.ConnPoolConfig{\n\t\tConnConfig: pgx.ConnConfig{\n\t\t\tHost: \"localhost\",\n\t\t\tUser: cfg.User,\n\t\t\tDatabase: cfg.DBName,\n\t\t\tPort: 5432,\n\t\t},\n\t}\n\tdb, err := pgx.NewConnPool(poolcfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\n\t_, err = db.Exec(fmt.Sprintf(\"CREATE SCHEMA %s AUTHORIZATION %s\", schema, user))\n\tif err != nil {\n\t\tlog.Printf(\"failed to create test schema: %s\", schema)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2a310706eb757dce1ad2d41145daa5db", "score": "0.5106059", "text": "func TestRequests(t *testing.T) {\n\tdb := New().LoggerOptions(false, false, false).Connect(\"http://arangodb:8000\", \"dbName\", \"foo\", \"bar\")\n\n\t// DATABASE\n\tdb.Run(&CreateDatabase{})\n\tdb.Run(&DropDatabase{})\n\n\t// COLLECTION\n\tdb.Run(&CreateCollection{})\n\tdb.Run(&DropCollection{})\n\tdb.Run(&TruncateCollection{})\n\n\t// INDEX\n\tdb.Run(&CreateHashIndex{})\n\n\t// CACHE\n\tdb.Run(&SetCacheProperties{})\n\tdb.Run(&GetCacheProperties{})\n}", "title": "" }, { "docid": "05cead5e0b64ae9aca91516dbb855240", "score": "0.51047546", "text": "func NewTest(t *testing.T, c *docker.Container) *Test {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tdbM, err := db.Open(db.Config{\n\t\tUser: \"postgres\",\n\t\tPassword: \"postgres\",\n\t\tHost: c.Host,\n\t\tName: \"postgres\",\n\t\tDisableTLS: true,\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"Opening database connection: %v\", err)\n\t}\n\n\tt.Log(\"Waiting for database to be ready ...\")\n\n\tif err := db.StatusCheck(ctx, dbM); err != nil {\n\t\tt.Fatalf(\"status check database: %v\", err)\n\t}\n\n\tconst letterBytes = \"abcdefghijklmnopqrstuvwxyz\"\n\tb := make([]byte, 4)\n\tfor i := range b {\n\t\tb[i] = letterBytes[rand.Intn(len(letterBytes))]\n\t}\n\tdbName := string(b)\n\n\tif _, err := dbM.ExecContext(context.Background(), \"CREATE DATABASE \"+dbName); err != nil {\n\t\tt.Fatalf(\"creating database %s: %v\", dbName, err)\n\t}\n\tdbM.Close()\n\n\tt.Log(\"Database ready\")\n\n\t// -------------------------------------------------------------------------\n\n\tdb, err := db.Open(db.Config{\n\t\tUser: \"postgres\",\n\t\tPassword: \"postgres\",\n\t\tHost: c.Host,\n\t\tName: dbName,\n\t\tDisableTLS: true,\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"Opening database connection: %v\", err)\n\t}\n\n\tt.Log(\"Migrate and seed database ...\")\n\n\tif err := dbmigrate.Migrate(ctx, db); err != nil {\n\t\tt.Logf(\"Logs for %s\\n%s:\", c.ID, docker.DumpContainerLogs(c.ID))\n\t\tt.Fatalf(\"Migrating error: %s\", err)\n\t}\n\n\tif err := dbmigrate.Seed(ctx, db); err != nil {\n\t\tt.Logf(\"Logs for %s\\n%s:\", c.ID, docker.DumpContainerLogs(c.ID))\n\t\tt.Fatalf(\"Seeding error: %s\", err)\n\t}\n\n\t// -------------------------------------------------------------------------\n\n\tvar buf bytes.Buffer\n\tlog := logger.New(&buf, logger.LevelInfo, \"TEST\", func(context.Context) string { return web.GetTraceID(ctx) })\n\n\tcoreAPIs := newCoreAPIs(log, db)\n\n\tt.Log(\"Ready for testing ...\")\n\n\t// -------------------------------------------------------------------------\n\n\tcfg := auth.Config{\n\t\tLog: log,\n\t\tDB: db,\n\t\tKeyLookup: &keyStore{},\n\t}\n\ta, err := auth.New(cfg)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// -------------------------------------------------------------------------\n\n\t// teardown is the function that should be invoked when the caller is done\n\t// with the database.\n\tteardown := func() {\n\t\tt.Helper()\n\t\tdb.Close()\n\n\t\tfmt.Println(\"******************** LOGS ********************\")\n\t\tfmt.Print(buf.String())\n\t\tfmt.Println(\"******************** LOGS ********************\")\n\t}\n\n\ttest := Test{\n\t\tDB: db,\n\t\tLog: log,\n\t\tAuth: a,\n\t\tCoreAPIs: coreAPIs,\n\t\tTeardown: teardown,\n\t\tt: t,\n\t}\n\n\treturn &test\n}", "title": "" }, { "docid": "3031b524d407e421f8b1e3c007522406", "score": "0.51030827", "text": "func CreateTestDatabase(t *testing.T) (*redis.Client, func()) {\n\tconnStr := \"addr=localhost:6378 pass=password db=0\"\n\tif env.RedisTestingSource() != \"\" {\n\t\tconnStr = env.RedisTestingSource()\n\t}\n\n\taddr, pass, db := parseRedisConfig(connStr)\n\n\tclient := redis.NewClient(&redis.Options{\n\t\tAddr: addr,\n\t\tPassword: pass,\n\t\tDB: db,\n\t})\n\tctx := context.Background()\n\tif _, err := client.Ping(ctx).Result(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\treturn client, func() {\n\t\tif err := client.FlushAll(ctx).Err(); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif err := client.Close(); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c2bc4075bce90caccd4fd08dd5b3f40", "score": "0.50996614", "text": "func TestConnString(t *testing.T) {\n\tconst (\n\t\thost = \"localhost\"\n\t\tport = 5432\n\t\tcaPath = \"/tmp/ca\"\n\t\tcertPath = \"/tmp/cert\"\n\t\tkeyPath = \"/tmp/key\"\n\t)\n\n\ttests := []struct {\n\t\tname string\n\t\tuser string\n\t\tdatabase string\n\t\tinsecure bool\n\t\tout string\n\t}{\n\t\t{\n\t\t\tname: \"default settings\",\n\t\t\tout: \"postgres://localhost:5432?sslrootcert=/tmp/ca&sslcert=/tmp/cert&sslkey=/tmp/key&sslmode=verify-full\",\n\t\t},\n\t\t{\n\t\t\tname: \"insecure\",\n\t\t\tinsecure: true,\n\t\t\tout: \"postgres://localhost:5432?sslrootcert=/tmp/ca&sslcert=/tmp/cert&sslkey=/tmp/key&sslmode=verify-ca\",\n\t\t},\n\t\t{\n\t\t\tname: \"user set\",\n\t\t\tuser: \"alice\",\n\t\t\tout: \"postgres://alice@localhost:5432?sslrootcert=/tmp/ca&sslcert=/tmp/cert&sslkey=/tmp/key&sslmode=verify-full\",\n\t\t},\n\t\t{\n\t\t\tname: \"user with special characters\",\n\t\t\tuser: \"postgres@google-project-id.iam\",\n\t\t\tout: \"postgres://postgres%40google-project-id.iam@localhost:5432?sslrootcert=/tmp/ca&sslcert=/tmp/cert&sslkey=/tmp/key&sslmode=verify-full\",\n\t\t},\n\t\t{\n\t\t\tname: \"database set\",\n\t\t\tdatabase: \"test\",\n\t\t\tout: \"postgres://localhost:5432/test?sslrootcert=/tmp/ca&sslcert=/tmp/cert&sslkey=/tmp/key&sslmode=verify-full\",\n\t\t},\n\t\t{\n\t\t\tname: \"user and database set\",\n\t\t\tuser: \"alice\",\n\t\t\tdatabase: \"test\",\n\t\t\tout: \"postgres://alice@localhost:5432/test?sslrootcert=/tmp/ca&sslcert=/tmp/cert&sslkey=/tmp/key&sslmode=verify-full\",\n\t\t},\n\t}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\trequire.Equal(t, test.out, GetConnString(&profile.ConnectProfile{\n\t\t\t\tHost: host,\n\t\t\t\tPort: port,\n\t\t\t\tUser: test.user,\n\t\t\t\tDatabase: test.database,\n\t\t\t\tInsecure: test.insecure,\n\t\t\t\tCACertPath: caPath,\n\t\t\t\tCertPath: certPath,\n\t\t\t\tKeyPath: keyPath,\n\t\t\t}, false, false))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "c69b18e50a60c00e45b5a208aa759d47", "score": "0.5099156", "text": "func main() {\n dbinfo := fmt.Sprintf(\"user=malik dbname=iims sslmode=disable\")\n db, err := sql.Open(\"postgres\", dbinfo)\n checkErr(err)\n defer db.Close()\n migrator, err := gomigrate.NewMigrator(db, gomigrate.Postgres{}, \"../migrations\")\n checkErr(err)\n migrator.Migrate()\n // migrator.Rollback()\n}", "title": "" }, { "docid": "1d896201944810041a88183ef0fb098f", "score": "0.50890756", "text": "func (t *testCheckPointSuite) TestForDB(c *C) {\n\tcases := []struct {\n\t\tfilename string\n\t\tendPos int64\n\t}{\n\t\t{\"db1.tbl1.sql\", 123},\n\t\t{\"db1.tbl2.sql\", 456},\n\t\t{\"db1.tbl3.sql\", 789},\n\t}\n\n\tallFiles := map[string]Tables2DataFiles{\n\t\t\"db1\": {\n\t\t\t\"tbl1\": {cases[0].filename},\n\t\t\t\"tbl2\": {cases[1].filename},\n\t\t\t\"tbl3\": {cases[2].filename},\n\t\t},\n\t}\n\n\tmock := conn.InitMockDB(c)\n\t// mock for cp prepare\n\tmock.ExpectBegin()\n\tmock.ExpectExec(schemaCreateSQL).WillReturnResult(sqlmock.NewResult(0, 1))\n\tmock.ExpectCommit()\n\tmock.ExpectBegin()\n\tmock.ExpectExec(tableCreateSQL).WillReturnResult(sqlmock.NewResult(0, 1))\n\tmock.ExpectCommit()\n\n\tid := \"test_for_db\"\n\ttctx := tcontext.Background()\n\tcp, err := newRemoteCheckPoint(tctx, t.cfg, id)\n\tc.Assert(err, IsNil)\n\tdefer cp.Close()\n\n\t// mock cp clear\n\tmock.ExpectBegin()\n\tmock.ExpectExec(clearCheckPointSQL).WillReturnResult(sqlmock.NewResult(0, 1))\n\tmock.ExpectCommit()\n\tc.Assert(cp.Clear(tctx), IsNil)\n\n\t// mock cp load\n\tmock.ExpectQuery(loadCheckPointSQL).WillReturnRows(sqlmock.NewRows(nil))\n\t// no checkpoint exist\n\terr = cp.Load(tctx)\n\tc.Assert(err, IsNil)\n\n\tinfos := cp.GetAllRestoringFileInfo()\n\tc.Assert(len(infos), Equals, 0)\n\n\t// mock cp count\n\tmock.ExpectQuery(countCheckPointSQL).WillReturnRows(sqlmock.NewRows([]string{\"COUNT(id)\"}).AddRow(0))\n\tcount, err := cp.Count(tctx)\n\tc.Assert(err, IsNil)\n\tc.Assert(count, Equals, 0)\n\n\tc.Assert(cp.IsTableCreated(\"db1\", \"\"), IsFalse)\n\tc.Assert(cp.IsTableCreated(\"db1\", \"tbl1\"), IsFalse)\n\tc.Assert(cp.CalcProgress(allFiles), IsNil)\n\tc.Assert(cp.IsTableFinished(\"db1\", \"tbl1\"), IsFalse)\n\n\t// insert default checkpoints\n\tfor _, cs := range cases {\n\t\t// mock init\n\t\tmock.ExpectBegin()\n\t\tmock.ExpectExec(flushCheckPointSQL).WillReturnResult(sqlmock.NewResult(0, 1))\n\t\tmock.ExpectCommit()\n\t\terr = cp.Init(tctx, cs.filename, cs.endPos)\n\t\tc.Assert(err, IsNil)\n\t}\n\n\tc.Assert(cp.IsTableCreated(\"db1\", \"\"), IsTrue)\n\tc.Assert(cp.IsTableCreated(\"db1\", \"tbl1\"), IsTrue)\n\tc.Assert(cp.CalcProgress(allFiles), IsNil)\n\tc.Assert(cp.IsTableFinished(\"db1\", \"tbl1\"), IsFalse)\n\n\tinfo := cp.GetRestoringFileInfo(\"db1\", \"tbl1\")\n\tc.Assert(info, HasLen, 1)\n\tc.Assert(info[cases[0].filename], DeepEquals, []int64{0, cases[0].endPos})\n\n\t// mock cp load\n\trows := sqlmock.NewRows([]string{\"filename\", \"cp_schema\", \"cp_table\", \"offset\", \"end_pos\"})\n\tfor i, cs := range cases {\n\t\trows = rows.AddRow(cs.filename, \"db1\", fmt.Sprintf(\"tbl%d\", i+1), 0, cs.endPos)\n\t}\n\tmock.ExpectQuery(loadCheckPointSQL).WillReturnRows(rows)\n\terr = cp.Load(tctx)\n\tc.Assert(err, IsNil)\n\tinfos = cp.GetAllRestoringFileInfo()\n\tc.Assert(len(infos), Equals, len(cases))\n\tfor _, cs := range cases {\n\t\tinfo, ok := infos[cs.filename]\n\t\tc.Assert(ok, IsTrue)\n\t\tc.Assert(len(info), Equals, 2)\n\t\tc.Assert(info[0], Equals, int64(0))\n\t\tc.Assert(info[1], Equals, cs.endPos)\n\t}\n\n\tmock.ExpectQuery(countCheckPointSQL).WillReturnRows(sqlmock.NewRows([]string{\"COUNT(id)\"}).AddRow(3))\n\tcount, err = cp.Count(tctx)\n\tc.Assert(err, IsNil)\n\tc.Assert(count, Equals, len(cases))\n\n\t// update checkpoint to finished\n\trows = sqlmock.NewRows([]string{\"filename\", \"cp_schema\", \"cp_table\", \"offset\", \"end_pos\"})\n\tfor i, cs := range cases {\n\t\trows = rows.AddRow(cs.filename, \"db1\", fmt.Sprintf(\"tbl%d\", i+1), cs.endPos, cs.endPos)\n\t}\n\tmock.ExpectQuery(loadCheckPointSQL).WillReturnRows(rows)\n\terr = cp.Load(tctx)\n\tc.Assert(err, IsNil)\n\tc.Assert(cp.IsTableCreated(\"db1\", \"\"), IsTrue)\n\tc.Assert(cp.IsTableCreated(\"db1\", \"tbl1\"), IsTrue)\n\tc.Assert(cp.CalcProgress(allFiles), IsNil)\n\tc.Assert(cp.IsTableFinished(\"db1\", \"tbl1\"), IsTrue)\n\n\tinfo = cp.GetRestoringFileInfo(\"db1\", \"tbl1\")\n\tc.Assert(info, HasLen, 1)\n\tc.Assert(info[cases[0].filename], DeepEquals, []int64{cases[0].endPos, cases[0].endPos})\n\n\tinfos = cp.GetAllRestoringFileInfo()\n\tc.Assert(len(infos), Equals, len(cases))\n\tfor _, cs := range cases {\n\t\tinfo, ok := infos[cs.filename]\n\t\tc.Assert(ok, IsTrue)\n\t\tc.Assert(len(info), Equals, 2)\n\t\tc.Assert(info[0], Equals, cs.endPos)\n\t\tc.Assert(info[1], Equals, cs.endPos)\n\t}\n\n\tmock.ExpectQuery(countCheckPointSQL).WillReturnRows(sqlmock.NewRows([]string{\"COUNT(id)\"}).AddRow(3))\n\tcount, err = cp.Count(tctx)\n\tc.Assert(err, IsNil)\n\tc.Assert(count, Equals, len(cases))\n\n\t// clear all\n\tmock.ExpectBegin()\n\tmock.ExpectExec(deleteCheckPointSQL).WillReturnResult(sqlmock.NewResult(0, 3))\n\tmock.ExpectCommit()\n\tc.Assert(cp.Clear(tctx), IsNil)\n\n\t// no checkpoint exist\n\tmock.ExpectQuery(loadCheckPointSQL).WillReturnRows(sqlmock.NewRows(nil))\n\terr = cp.Load(tctx)\n\tc.Assert(err, IsNil)\n\n\tc.Assert(cp.IsTableCreated(\"db1\", \"\"), IsFalse)\n\tc.Assert(cp.IsTableCreated(\"db1\", \"tbl1\"), IsFalse)\n\tc.Assert(cp.CalcProgress(allFiles), IsNil)\n\tc.Assert(cp.IsTableFinished(\"db1\", \"tbl1\"), IsFalse)\n\n\tinfos = cp.GetAllRestoringFileInfo()\n\tc.Assert(len(infos), Equals, 0)\n\n\t// obtain count again\n\tmock.ExpectQuery(countCheckPointSQL).WillReturnRows(sqlmock.NewRows([]string{\"COUNT(id)\"}).AddRow(0))\n\tcount, err = cp.Count(tctx)\n\tc.Assert(err, IsNil)\n\tc.Assert(count, Equals, 0)\n\tc.Assert(mock.ExpectationsWereMet(), IsNil)\n}", "title": "" }, { "docid": "89a3db170c5efef347941b4687a249b3", "score": "0.50868917", "text": "func Test_SingleNodeNoSQLInjection(t *testing.T) {\n\tnode := mustNewLeaderNode()\n\tdefer node.Deprovision()\n\n\ttests := []struct {\n\t\tstmt []interface{}\n\t\texpected string\n\t\texecute bool\n\t}{\n\t\t{\n\t\t\tstmt: []interface{}{\"CREATE TABLE foo (id integer not null primary key, name text)\"},\n\t\t\texpected: `{\"results\":[{}]}`,\n\t\t\texecute: true,\n\t\t},\n\t\t{\n\t\t\tstmt: []interface{}{`SELECT * FROM foo WHERE name=\"baz\"`},\n\t\t\texpected: `{\"results\":[{\"columns\":[\"id\",\"name\"],\"types\":[\"integer\",\"text\"]}]}`,\n\t\t\texecute: false,\n\t\t},\n\t\t{\n\t\t\tstmt: []interface{}{`SELECT * FROM foo WHERE name=?`, `\"baz\";DROP TABLE FOO`},\n\t\t\texpected: `{\"results\":[{\"columns\":[\"id\",\"name\"],\"types\":[\"integer\",\"text\"]}]}`,\n\t\t\texecute: false,\n\t\t},\n\t\t{\n\t\t\tstmt: []interface{}{`SELECT * FROM foo`},\n\t\t\texpected: `{\"results\":[{\"columns\":[\"id\",\"name\"],\"types\":[\"integer\",\"text\"]}]}`,\n\t\t\texecute: false,\n\t\t},\n\t}\n\n\tfor i, tt := range tests {\n\t\tvar r string\n\t\tvar err error\n\t\tif tt.execute {\n\t\t\tr, err = node.ExecuteParameterized(tt.stmt)\n\t\t} else {\n\t\t\tr, err = node.QueryParameterized(tt.stmt)\n\t\t}\n\t\tif err != nil {\n\t\t\tt.Fatalf(`test %d failed \"%s\": %s`, i, tt.stmt, err.Error())\n\t\t}\n\t\tif r != tt.expected {\n\t\t\tt.Fatalf(`test %d received wrong result \"%s\" got: %s exp: %s`, i, tt.stmt, r, tt.expected)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "492df7335309ccdbcb91631b02f56058", "score": "0.50807047", "text": "func TestUsers(t *testing.T) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\t// Check the environment for a configured port value.\n\tdbHost := os.Getenv(\"DB_HOST\")\n\tif dbHost == \"\" {\n\t\tdbHost = \"got:got2015@ds039441.mongolab.com:39441/gotraining\"\n\t}\n\n\t// Register the Master Session for the database.\n\tlog.Println(\"main : Started : Capturing Master DB...\")\n\tmasterDB, err := db.NewMGO(dbHost, 25*time.Second)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer masterDB.MGOClose()\n\n\tu := user.CreateUser{\n\t\tUserType: 1,\n\t\tFirstName: \"Bill\",\n\t\tLastName: \"Kennedy\",\n\t\tEmail: \"bill@ardanstudios.com\",\n\t\tCompany: \"Ardan Labs\",\n\t\tAddresses: []user.CreateAddress{\n\t\t\t{\n\t\t\t\tType: 1,\n\t\t\t\tLineOne: \"12973 SW 112th ST\",\n\t\t\t\tLineTwo: \"Suite 153\",\n\t\t\t\tCity: \"Miami\",\n\t\t\t\tState: \"FL\",\n\t\t\t\tZipcode: \"33172\",\n\t\t\t\tPhone: \"305-527-3353\",\n\t\t\t},\n\t\t},\n\t}\n\n\tt.Log(\"Given the need to add a new user, retrieve and remove that user from the system.\")\n\t{\n\t\tt.Log(\"\\tTest 0:\\tWhen using a valid CreateUser value\")\n\t\t{\n\t\t\tcu, err := user.Create(ctx, masterDB, &u)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould be able to create a user in the system : %v\", Failed, err)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould be able to create a user in the system.\", Succeed)\n\n\t\t\tru, err := user.Retrieve(ctx, masterDB, cu.UserID)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould be able to retrieve the user back from the system : %v\", Failed, err)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould be able to retrieve the user back from the system.\", Succeed)\n\n\t\t\tif ru == nil || cu.UserID != ru.UserID {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould have a match between the created user and the one retrieved : %v\", Failed, err)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould have a match between the created user and the one retrieved.\", Succeed)\n\n\t\t\tif err := user.Delete(ctx, masterDB, ru.UserID); err != nil {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould be able to remove the user from the system : %v\", Failed, err)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould be able to remove the user from the system.\", Succeed)\n\n\t\t\tif _, err := user.Retrieve(ctx, masterDB, ru.UserID); err == nil {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould NOT be able to retrieve the user back from the system : %v\", Failed, err)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould NOT be able to retrieve the user back from the system.\", Succeed)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d837e342b639d7fda26c973d3d1d7754", "score": "0.5080327", "text": "func CreateTestDatabase(t *testing.T) (*gorm.DB, string, func()) {\n\ttestingHost := fmt.Sprintf(\"%s\", dbHost)\n\ttestingPort := fmt.Sprintf(\"%d\", dbPort)\n\tif os.Getenv(\"POSTGRES_TESTING_HOST\") != \"\" {\n\t\ttestingHost = os.Getenv(\"POSTGRES_TESTING_HOST\")\n\t}\n\tif os.Getenv(\"POSTGRES_TESTING_PORT\") != \"\" {\n\t\ttestingPort = os.Getenv(\"POSTGRES_TESTING_PORT\")\n\t}\n\tconnectionString := fmt.Sprintf(\"host=%s port=%s user=%s password=%s dbname=%s sslmode=disable\", testingHost, testingPort, dbUser, dbPassword, dbName)\n\tdb, dbErr := gorm.Open(\"postgres\", connectionString)\n\tif dbErr != nil {\n\t\tt.Fatalf(\"Fail to create database. %s\", dbErr.Error())\n\t}\n\n\trand.Seed(time.Now().UnixNano())\n\tschemaName := \"test\" + strconv.FormatInt(rand.Int63(), 10)\n\n\terr := db.Exec(\"CREATE SCHEMA \" + schemaName).Error\n\tif err != nil {\n\t\tt.Fatalf(\"Fail to create schema. %s\", err.Error())\n\t}\n\n\t// set schema for current db connection\n\terr = db.Exec(\"SET search_path TO \" + schemaName).Error\n\tif err != nil {\n\t\tt.Fatalf(\"Fail to set search_path to created schema. %s\", err.Error())\n\t}\n\n\treturn db, schemaName, func() {\n\t\terr := db.Exec(\"DROP SCHEMA \" + schemaName + \" CASCADE\").Error\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Fail to drop database. %s\", err.Error())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2405837b37c746ebd4e95d69b19e4128", "score": "0.50768185", "text": "func (p *Cockroach) Exec(stmt string) {\n\t_, err := p.db.Exec(stmt)\n\tif err != nil {\n\t\tlog.Printf(\"%v failed: %v\", stmt, err)\n\t}\n}", "title": "" }, { "docid": "10afaf44a6d82d7da77dc34917af0746", "score": "0.50723314", "text": "func RunTest(src *sql.DB, dst *sql.DB, schema string, writeSrc func(src *sql.DB)) {\n\twriteSrc(src)\n\n\ttick := time.NewTicker(time.Second * 5)\n\tdefer tick.Stop()\n\ttimeout := time.After(time.Second * 240)\n\n\tfor {\n\t\tselect {\n\t\tcase <-tick.C:\n\t\t\tif util.CheckSyncState(src, dst, schema) {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-timeout:\n\t\t\t// check last time\n\t\t\tif !util.CheckSyncState(src, dst, schema) {\n\t\t\t\tlog.S().Fatal(\"sourceDB don't equal targetDB\")\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1184a90393565e9ef6dce679f0fb83de", "score": "0.50699437", "text": "func TestCreateTables(t *testing.T) {\n\t_, dbh := setup(t)\n\tdefer teardown(dbh, t)\n\tdbh.createTables()\n\n\tdb, _ := sql.Open(\"sqlite3\", \"database_test.db\")\n\tdefer db.Close()\n\t_, err := db.Query(\"Select * from ETDATA;\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "53907210bde709f22e77f150ff98d33c", "score": "0.5049529", "text": "func testResetaDatabase() {\r\n\t// Deleta o banco de dados\r\n\ttempDSN := usuarioDb + \":\" + senhaDb + \"@tcp(\" + enderecoDb + \")/\"\r\n\tdb, err := sql.Open(\"mysql\", tempDSN)\r\n\tdefer db.Close()\r\n\tif err != nil {\r\n\t\tlog.Fatalf(\"%v\", err)\r\n\t}\r\n\tsqlCode := `DROP DATABASE IF EXISTS ` + testDbNome + `;`\r\n\tif _, err = db.Exec(sqlCode); err != nil {\r\n\t\tlog.Fatalf(\"%v\", err)\r\n\t}\r\n\r\n\t// Cria o banco de dados\r\n\tsqlCode = `CREATE DATABASE ` + testDbNome + ` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`\r\n\tif _, err := db.Exec(sqlCode); err != nil {\r\n\t\tlog.Fatalf(\"%v\", err)\r\n\t}\r\n\r\n\t// Cria as tabelas\r\n\tif err := criaTabelas(); err != nil {\r\n\t\tlog.Fatalf(\"%v\", err)\r\n\t}\r\n}", "title": "" }, { "docid": "fdc7c1efb55f8a18d34dd04e7a61899c", "score": "0.50470376", "text": "func main() {\n\tmh.Run(func(tx mh.Mtx) {\n\t\ttx.Exec(`\n\t\tCREATE TABLE users (\n\t\t\tId Int,\n\t\t\tName Varchar\n\t\t );\n\t\t`)\n\t\ttx.Exec(\"INSERT INTO users (Id, Name) VALUES (1, 'Gabs');\")\n\t})\n}", "title": "" }, { "docid": "819173fd5dd3af332bd22d9486cc63dd", "score": "0.5044456", "text": "func TestUpgradeHappensAfterMigrations(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\n\tctx := context.Background()\n\tst := cluster.MakeTestingClusterSettingsWithVersions(\n\t\tclusterversion.TestingBinaryVersion,\n\t\tclusterversion.TestingBinaryMinSupportedVersion,\n\t\tfalse, /* initializeVersion */\n\t)\n\ts, _, _ := serverutils.StartServer(t, base.TestServerArgs{\n\t\tSettings: st,\n\t\tKnobs: base.TestingKnobs{\n\t\t\tServer: &TestingKnobs{\n\t\t\t\tBinaryVersionOverride: clusterversion.TestingBinaryMinSupportedVersion,\n\t\t\t},\n\t\t\tSQLMigrationManager: &sqlmigrations.MigrationManagerTestingKnobs{\n\t\t\t\tAfterEnsureMigrations: func() {\n\t\t\t\t\t// Try to encourage other goroutines to run.\n\t\t\t\t\tconst N = 100\n\t\t\t\t\tfor i := 0; i < N; i++ {\n\t\t\t\t\t\truntime.Gosched()\n\t\t\t\t\t}\n\t\t\t\t\trequire.True(t, st.Version.ActiveVersion(ctx).Less(clusterversion.TestingBinaryVersion))\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t})\n\ts.Stopper().Stop(context.Background())\n}", "title": "" }, { "docid": "3e76371fa1dd9319654f7615a5625a5d", "score": "0.50401646", "text": "func TestFuncWithPopConnection(db *pop.Connection) {}", "title": "" }, { "docid": "3e76371fa1dd9319654f7615a5625a5d", "score": "0.50401646", "text": "func TestFuncWithPopConnection(db *pop.Connection) {}", "title": "" }, { "docid": "93b0d3ce8e4c7edcb6ce4f5c987a4bc3", "score": "0.5037694", "text": "func TestBadConnection1(t *testing.T) {\n\tt.Skip()\n\t// XXX: Skip this test if running under travis. tmpmysqld isn't playing\n\t// well for some reason\n\t// TODO(syamp): figure this out\n\tif os.Getenv(\"TRAVIS\") == \"true\" {\n\t\treturn\n\t}\n\ttestdb := initDB(t)\n\tdefer testdb.db.Close()\n\n\t_, _, err := testdb.QueryDb(\"SELECT * FROM people;\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\t//close the connection to the db to ~simulate (kinda)~ a lost connection\n\ttestdb.db.Close()\n\n\t_, _, err = testdb.QueryDb(\"SELECT * FROM people;\")\n\tif err != nil {\n\t\tt.Errorf(\"failed to reconnect: %v\", err)\n\t}\n}", "title": "" }, { "docid": "f8535afd965ea934ba7b46e925efd10a", "score": "0.50305337", "text": "func initDatabase() {\n\tdbConfig := DatabaseConfig{Host: \"localhost\", Port: \"5432\", Username: \"sample\", DbName: \"sample\", Password: \"sample\", SslMode: \"disable\"}\n\tif os.Getenv(\"SAMPLE_HOST\") != \"\" {\n\t\tdbConfig.Host = os.Getenv(\"SAMPLE_HOST\")\n\t}\n\tif os.Getenv(\"SAMPLE_PORT\") != \"\" {\n\t\tdbConfig.Host = os.Getenv(\"SAMPLE_PORT\")\n\t}\n\tif os.Getenv(\"SAMPLE_DBNAME\") != \"\" {\n\t\tdbConfig.Host = os.Getenv(\"SAMPLE_DBNAME\")\n\t}\n\tif os.Getenv(\"SAMPLE_USER\") != \"\" {\n\t\tdbConfig.Host = os.Getenv(\"SAMPLE_USER\")\n\t}\n\tif os.Getenv(\"SAMPLE_PASS\") != \"\" {\n\t\tdbConfig.Host = os.Getenv(\"SAMPLE_PASS\")\n\t}\n\tif os.Getenv(\"SAMPLE_SSLMODE\") != \"\" {\n\t\tdbConfig.Host = os.Getenv(\"SAMPLE_SSLMODE\")\n\t}\n\tvar err error\n\tcxn := \"host=\" + dbConfig.Host + \" port=\" + dbConfig.Port + \" user=\" + dbConfig.Username +\n\t\t\" dbname=\" + dbConfig.DbName + \" password=\" + dbConfig.Password + \" sslmode=\" + dbConfig.SslMode\n\tdb.DBConn, err = gorm.Open(\"postgres\", cxn)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Println(\"Database connection opened successfully...\")\n\tdb.DBConn.AutoMigrate(&model.User{}, &model.Group{}, &model.Association{})\n\tlog.Println(\"Database migrated User, Group, Association\")\n}", "title": "" }, { "docid": "a6d3cfd4e14209ecf81ecde00db73970", "score": "0.5029894", "text": "func TestUserGraphQL(t *testing.T) {\n\t// FIXME : this test doesn't work because the access view does not exist on the collection ???\n\tt.Skip(\"Skipping test until access view is available with collections\")\n\n\t// base.SetUpTestLogging(t, base.LevelDebug, base.KeyAll)\n\tdb, ctx := setupTestDBWithFunctions(t, &kTestGraphQLUserFunctionsConfig, &kTestGraphQLConfig)\n\tdefer db.Close(ctx)\n\n\t// First run the tests as an admin:\n\tt.Run(\"AsAdmin\", func(t *testing.T) { testUserGraphQLAsAdmin(t, ctx, db) })\n\n\t// Now create a user and make it current:\n\tdb.SetUser(addUserAlice(t, db))\n\tassert.True(t, db.User().RoleNames().Contains(\"hero\"))\n\n\t// Repeat the tests as user \"alice\":\n\tt.Run(\"AsUser\", func(t *testing.T) { testUserGraphQLAsUser(t, ctx, db) })\n}", "title": "" }, { "docid": "082806d02c26bdff6a7599996c192ea1", "score": "0.50161666", "text": "func CaseTrainElasticDL(t *testing.T) {\n\ta := assert.New(t)\n\ttrainSQL := fmt.Sprintf(`SELECT sepal_length, sepal_width, petal_length, petal_width, class\nFROM %s.%s\nTRAIN ElasticDLDNNClassifier\nWITH\n\t\t\tmodel.optimizer = \"optimizer\",\n\t\t\tmodel.loss = \"loss\",\n\t\t\tmodel.eval_metrics_fn = \"eval_metrics_fn\",\n\t\t\tmodel.num_classes = 10,\n\t\t\tmodel.dataset_fn = \"dataset_fn\",\n\t\t\ttrain.shuffle = 120,\n\t\t\ttrain.epoch = 2,\n\t\t\ttrain.grads_to_wait = 2,\n\t\t\ttrain.tensorboard_log_dir = \"\",\n\t\t\ttrain.checkpoint_steps = 0,\n\t\t\ttrain.checkpoint_dir = \"\",\n\t\t\ttrain.keep_checkpoint_max = 0,\n\t\t\teval.steps = 0,\n\t\t\teval.start_delay_secs = 100,\n\t\t\teval.throttle_secs = 0,\n\t\t\teval.checkpoint_filename_for_init = \"\",\n\t\t\tengine.docker_image_prefix = \"\",\n\t\t\tengine.master_resource_request = \"cpu=400m,memory=1024Mi\",\n\t\t\tengine.master_resource_limit = \"cpu=400m,memory=1024Mi\",\n\t\t\tengine.worker_resource_request = \"cpu=400m,memory=2048Mi\",\n\t\t\tengine.worker_resource_limit = \"cpu=1,memory=3072Mi\",\n\t\t\tengine.num_workers = 2,\n\t\t\tengine.volume = \"\",\n\t\t\tengine.image_pull_policy = \"Always\",\n\t\t\tengine.restart_policy = \"Never\",\n\t\t\tengine.extra_pypi_index = \"\",\n\t\t\tengine.namespace = \"default\",\n\t\t\tengine.minibatch_size = 64,\n\t\t\tengine.master_pod_priority = \"\",\n\t\t\tengine.cluster_spec = \"\",\n\t\t\tengine.records_per_task = 100\nLABEL class\nINTO trained_elasticdl_keras_classifier;`, caseDB, caseTrainTable)\n\n\tconn, err := createRPCConn()\n\ta.NoError(err)\n\tdefer conn.Close()\n\tcli := pb.NewSQLFlowClient(conn)\n\n\tctx, cancel := context.WithTimeout(context.Background(), 300*time.Second)\n\tdefer cancel()\n\n\tstream, err := cli.Run(ctx, sqlRequest(trainSQL))\n\tif err != nil {\n\t\ta.Fail(\"Check if the server started successfully. %v\", err)\n\t}\n\t// wait train finish\n\tParseRow(stream)\n}", "title": "" }, { "docid": "16e5cc48935eb8acb5b56e649c12355e", "score": "0.50154734", "text": "func TestCreate(t *testing.T) {\n\texpect := NewTester(t, &defaultDialect{})\n\n\texpect.SQL(\n\t\tusers.Create(),\n\t\t`CREATE TABLE users (\n id INTEGER,\n email VARCHAR(256) NOT NULL,\n name VARCHAR(32) NOT NULL,\n password VARCHAR,\n created_at TIMESTAMP,\n PRIMARY KEY (id),\n UNIQUE (email)\n);`,\n\t)\n}", "title": "" }, { "docid": "f74d012c11c4ad0eb569838c5e37cbbd", "score": "0.5007312", "text": "func Test_GraphQLNetworkBuild(t *testing.T) {\n\ttests := testCases{\n\n\t\t// This tests asserts that an action-only schema doesn't lead to errors.\n\t\ttestCase{\n\t\t\tname: \"with only objects locally\",\n\t\t\tlocalSchema: schema.Schema{\n\t\t\t\tObjects: &models.Schema{\n\t\t\t\t\tClasses: []*models.Class{\n\t\t\t\t\t\t&models.Class{\n\t\t\t\t\t\t\tClass: \"BestLocalAction\",\n\t\t\t\t\t\t\tProperties: []*models.Property{\n\t\t\t\t\t\t\t\t&models.Property{\n\t\t\t\t\t\t\t\t\tDataType: []string{\"string\"},\n\t\t\t\t\t\t\t\t\tName: \"myStringProp\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// This tests asserts that a things-only schema doesn't lead to errors.\n\t\ttestCase{\n\t\t\tname: \"with only objects locally\",\n\t\t\tlocalSchema: schema.Schema{\n\t\t\t\tObjects: &models.Schema{\n\t\t\t\t\tClasses: []*models.Class{\n\t\t\t\t\t\t&models.Class{\n\t\t\t\t\t\t\tClass: \"BestLocalThing\",\n\t\t\t\t\t\t\tProperties: []*models.Property{\n\t\t\t\t\t\t\t\t&models.Property{\n\t\t\t\t\t\t\t\t\tDataType: []string{\"string\"},\n\t\t\t\t\t\t\t\t\tName: \"myStringProp\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// This tests asserts that a class without any properties doesn't lead to\n\t\t// errors.\n\t\ttestCase{\n\t\t\tname: \"with things without properties locally\",\n\t\t\tlocalSchema: schema.Schema{\n\t\t\t\tObjects: &models.Schema{\n\t\t\t\t\tClasses: []*models.Class{\n\t\t\t\t\t\t&models.Class{\n\t\t\t\t\t\t\tClass: \"BestLocalThing\",\n\t\t\t\t\t\t\tProperties: []*models.Property{},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\ttestCase{\n\t\t\tname: \"without any peers\",\n\t\t\tlocalSchema: validSchema(),\n\t\t},\n\t}\n\n\ttests.AssertNoError(t)\n}", "title": "" }, { "docid": "b8104c72a199eca7a2dc5fae075f157c", "score": "0.49903792", "text": "func RPCTestSetup(t *testing.T) *Engine {\n\tt.Helper()\n\tvar err error\n\tdbConf := database.Config{\n\t\tEnabled: true,\n\t\tDriver: database.DBSQLite3,\n\t\tConnectionDetails: drivers.ConnectionDetails{\n\t\t\tHost: \"localhost\",\n\t\t\tDatabase: \"test123.db\",\n\t\t},\n\t}\n\tengerino := new(Engine)\n\tdbm, err := SetupDatabaseConnectionManager(&dbConf)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdbm.dbConn.DataPath = t.TempDir()\n\tengerino.DatabaseManager = dbm\n\tvar wg sync.WaitGroup\n\terr = dbm.Start(&wg)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tt.Cleanup(func() {\n\t\terr = dbm.Stop()\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t})\n\n\tengerino.Config = &config.Config{}\n\tem := NewExchangeManager()\n\texch, err := em.NewExchangeByName(testExchange)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\texch.SetDefaults()\n\tb := exch.GetBase()\n\tcp := currency.NewPair(currency.BTC, currency.USD)\n\tb.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)\n\tb.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{\n\t\tAvailable: currency.Pairs{cp},\n\t\tEnabled: currency.Pairs{cp},\n\t\tAssetEnabled: convert.BoolPtr(true),\n\t\tConfigFormat: &currency.PairFormat{Uppercase: true},\n\t\tRequestFormat: &currency.PairFormat{Uppercase: true}}\n\terr = em.Add(exch)\n\tif !errors.Is(err, nil) {\n\t\tt.Fatalf(\"received: '%v' but expected: '%v'\", err, nil)\n\t}\n\n\texch, err = em.NewExchangeByName(\"Binance\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\texch.SetDefaults()\n\tb = exch.GetBase()\n\tcp = currency.NewPair(currency.BTC, currency.USDT)\n\tb.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)\n\tb.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{\n\t\tAvailable: currency.Pairs{cp},\n\t\tEnabled: currency.Pairs{cp},\n\t\tAssetEnabled: convert.BoolPtr(true),\n\t\tConfigFormat: &currency.PairFormat{Uppercase: true},\n\t\tRequestFormat: &currency.PairFormat{Uppercase: true}}\n\terr = em.Add(exch)\n\tif !errors.Is(err, nil) {\n\t\tt.Fatalf(\"received: '%v' but expected: '%v'\", err, nil)\n\t}\n\tengerino.ExchangeManager = em\n\n\tengerino.Config.Database = dbConf\n\tengerino.DatabaseManager, err = SetupDatabaseConnectionManager(&engerino.Config.Database)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\terr = engerino.DatabaseManager.Start(&engerino.ServicesWG)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tpath := filepath.Join(\"..\", databaseFolder, migrationsFolder)\n\terr = goose.Run(\"up\", database.DB.SQL, repository.GetSQLDialect(), path, \"\")\n\tif err != nil {\n\t\tt.Fatalf(\"failed to run migrations %v\", err)\n\t}\n\tuuider, err := uuid.NewV4()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tuuider2, err := uuid.NewV4()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\terr = dbexchange.InsertMany([]dbexchange.Details{{Name: testExchange, UUID: uuider}, {Name: \"Binance\", UUID: uuider2}})\n\tif err != nil {\n\t\tt.Fatalf(\"failed to insert exchange %v\", err)\n\t}\n\n\treturn engerino\n}", "title": "" } ]
433aefab9fb093b5d6e5e5b7e3207340
Close terminates the iteration process, releasing any pending underlying resources.
[ { "docid": "b026fd62a2393a81903eb1fede963e62", "score": "0.0", "text": "func (it *OwnableOwnershipRenouncedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" } ]
[ { "docid": "5334d6b12fac4a41d8f60f423bb575c0", "score": "0.74082893", "text": "func (it *StandardBridgeERC20BridgeFinalizedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "4c63b2af8e49ad9e75b704035cdf7f6c", "score": "0.7299998", "text": "func (it *iterator) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "7661e8e8e080c5645e0139687d7655e4", "score": "0.7239246", "text": "func (it *StandardBridgeETHBridgeFinalizedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "376b4a2388c454106b37b7f560dd2bb7", "score": "0.723879", "text": "func (i *Iterator) Close() error {\n\ti.iter.Release()\n\treturn i.iter.Error()\n}", "title": "" }, { "docid": "3c5ce7c204d5a3e3e296d3275f20844c", "score": "0.72376543", "text": "func (it *RgyShareSoldIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "7f35622e5feb5ed142a3d92f30d2271b", "score": "0.72366655", "text": "func (it *DefiLiquidityPoolRepayIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "3739f7ce5176d1ea9d973fc3be381669", "score": "0.7190905", "text": "func (it *OysterPearlBuryIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e1cd8ac06e5c0855c52726d93e0f9696", "score": "0.7176621", "text": "func (it *LiquidityPoolMintIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "59b189a02a3457e80efcb38e60ddaa16", "score": "0.7162786", "text": "func (it *DefiLiquidityPoolOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "6603f30db90a2e33ef9388b063f66c5b", "score": "0.7152888", "text": "func (it *LiquidityPoolBurnIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "c4a463befd814089bf2fcf78bc322252", "score": "0.71500194", "text": "func (it *LiquidityPoolTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2432a3fa7c7422d247ef63c234b2e419", "score": "0.7135189", "text": "func (it *OysterPearlTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "cd50f6811fead2abab1e6f6bd0dd9642", "score": "0.7109933", "text": "func (it *GasRefunderRefundedGasCostsIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2052589e8af08ce64e4ddb8476522086", "score": "0.7109641", "text": "func (it *AugurUniverseForkedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "cc5c881cd4f9f98cc758bfd1c87425e6", "score": "0.71055126", "text": "func (it *AugurMarketFinalizedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "0107eb280f3969521edf231fa49816c1", "score": "0.71033114", "text": "func (it *LiquidityPoolSyncIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "32b5f9d2af5a3c9f814795b8a0a43b50", "score": "0.7097587", "text": "func (it *PoolOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "cb3276b592bf4647e207290f23a1855c", "score": "0.7093679", "text": "func (it *GodsTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "71a0adc891fa90e5ddda08a8ead4eb0e", "score": "0.7088869", "text": "func (it *PoolNewPoolLimitIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "79dc66376da4ce9e5cad5cc010fd8e26", "score": "0.7084482", "text": "func (it *GovernanceProposalExecutedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "bde90c4a9a619a0eb820c7605b90daaa", "score": "0.70796317", "text": "func (it *GodsUnpauseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "b0b73783f721ba727f84acf799389c12", "score": "0.70763487", "text": "func (it *OysterPearlBurnIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "9dea27eb1ce2b1a83084d81243d3e5fc", "score": "0.70647734", "text": "func (it *GodsPauseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "c2b528daa43fbbfed932f58054954a81", "score": "0.7053509", "text": "func (it *PoolRewardsStopIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "3b044866acf0fd090107e28385c99094", "score": "0.704786", "text": "func (it *StandardBridgeERC20BridgeInitiatedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "f2bef0929013eb576dc87cc75e15477d", "score": "0.704119", "text": "func (it *BikeBikeRentedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "87040d319c322e90bccfda481995a2c8", "score": "0.7031465", "text": "func (itr *seriesPointIterator) Close() error {\n\titr.once.Do(func() { itr.fs.Release() })\n\treturn nil\n}", "title": "" }, { "docid": "13f40abac393a4dd4e75c54341fafaa3", "score": "0.7029842", "text": "func (it *SwappairSyncIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "d982bb3549e3021343d7f0bd79730310", "score": "0.70283765", "text": "func (itr *Iterator) Close() error {\n\titr.bi.Close()\n\treturn itr.t.DecrRef()\n}", "title": "" }, { "docid": "b6385e9e37c9d69648d0420b15822131", "score": "0.70267564", "text": "func (it *GovernanceAbrogationProposalExecutedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "b43bb95c73cdeb005215e8ee2a939596", "score": "0.70191735", "text": "func (it *decodingResultsIterator) Close() {\n\tit.target.Close()\n}", "title": "" }, { "docid": "48ae8d61a44bc6e6b3a7d15c10e7e188", "score": "0.7018435", "text": "func (it *PausableOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "1365ec0645cfa608c588aa7380a3b86e", "score": "0.70178187", "text": "func (it *ERC20TransferIterator) Close() error {\r\n\tit.sub.Unsubscribe()\r\n\treturn nil\r\n}", "title": "" }, { "docid": "e87a9fe59c753149d0d5ece837fca5f7", "score": "0.7015892", "text": "func (it *ERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e87a9fe59c753149d0d5ece837fca5f7", "score": "0.7015892", "text": "func (it *ERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e87a9fe59c753149d0d5ece837fca5f7", "score": "0.7015107", "text": "func (it *ERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "dbed80c6ed8f5a26fc6d33908cc22d4d", "score": "0.70049375", "text": "func (it *CivilPLCRVotingContractTokensRescuedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "0387f0033ce5cf1aa3f55bb3dc960062", "score": "0.7002712", "text": "func (si *ItemIterator) Close() {\n\treturn\n}", "title": "" }, { "docid": "b528b43bfd9423cd2f5a0b69aef82a96", "score": "0.7001533", "text": "func (i CQLIterator) Close() error {\n\treturn i.iter.Close()\n}", "title": "" }, { "docid": "1f44bc80f04cbde89e39f47b7b0ab151", "score": "0.7000119", "text": "func (it *CivilPLCRVotingContractVoteRevealedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "d5c87ad23d25c154987fa53a11718ef1", "score": "0.6998017", "text": "func (it *DefiLiquidityPoolBorrowIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "7729908a673f05a6e7771a9895c6d6f1", "score": "0.6995934", "text": "func (it *ZapDisputeNewDisputeIterator) Close() error {\r\n\tit.sub.Unsubscribe()\r\n\treturn nil\r\n}", "title": "" }, { "docid": "f31398194ec796e435fc0a44b843ca68", "score": "0.69938135", "text": "func (it *FarmOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "948e1296e25d2d2e01abfe9601a20e95", "score": "0.6993571", "text": "func (it *PlasmaAssetsERC20DepositedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ddd6256ceecea7428e9842d7f959d813", "score": "0.69932944", "text": "func (it *PausableUnpauseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "79f64151deafb4e1777366676a0dfef6", "score": "0.6988108", "text": "func (it *GasRefunderDepositedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "1238b116cc888830116f4e5cea02531e", "score": "0.6984214", "text": "func (it *GasRefunderOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "d6f87a1997dd50ac2af22ada927f195d", "score": "0.69840425", "text": "func (it *OpsTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "43dbf7c2ef5bde066cefa678786bfd57", "score": "0.6978956", "text": "func (i *mergedLibIter) Close() {\n\ti.mu.Lock()\n\tdefer i.mu.Unlock()\n\n\tfor _, iter := range i.iters {\n\t\titer.Close()\n\t}\n}", "title": "" }, { "docid": "aee507b5946bcc5ed0d0cd17acfa1d7d", "score": "0.69778055", "text": "func (it *PoolNewStartAndEndBlocksIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2c0b2ae08ade6180f1c4d6f5356308d4", "score": "0.6973867", "text": "func (p *pebbleIterator) Close() {\n\tif !p.inuse {\n\t\tpanic(\"closing idle iterator\")\n\t}\n\tp.inuse = false\n\n\tif p.reusable {\n\t\treturn\n\t}\n\n\tp.destroy()\n\n\tpebbleIterPool.Put(p)\n}", "title": "" }, { "docid": "4b1c4b031e471091d327aa3f782fb89b", "score": "0.69711167", "text": "func (it *BridgeOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "527c4a46fa7f45f160bbe66ba3a6843a", "score": "0.6970201", "text": "func (it *SwappairBurnIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "1dc6b5f6f9a91e5f9fe90a1c16bc88ed", "score": "0.6966177", "text": "func (it *SwappairMintIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "80c14e29df6844e211c049af61bc55de", "score": "0.69649404", "text": "func (it *resultsIterator) Close() {\n}", "title": "" }, { "docid": "720834a680b2a72b4b4edabc1135f818", "score": "0.6964679", "text": "func (it *GovernanceProposalQueuedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e373bf0251df0e029486da50a5269348", "score": "0.6957969", "text": "func (it *InstallmentsChangedFinalTimeIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "6cda2c7e1eb9ce94d14f03807cc862a1", "score": "0.69481796", "text": "func (it *PoolNewRewardPerBlockIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "400105ec4e435d7221564a787ee56dc2", "score": "0.69471216", "text": "func (it *OpsOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "0117292fb21b78d5879c71312dee0dd7", "score": "0.6946418", "text": "func (it *BridgeMintIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "8522e519ff782f04caf5b26bda1983b2", "score": "0.6944557", "text": "func (it *OperatorOracleResponseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "5264fb9bb62630a8a9410d9d94eaeb7f", "score": "0.6942631", "text": "func (it *SwappairTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "795878d35e73cfb8da269455c29e7490", "score": "0.69419813", "text": "func (it *PlasmaAssetsOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "fe4ee74e8c99fc545cb248d3335644df", "score": "0.6938933", "text": "func (it *PausablePauseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2102cd9f64bae6a4db4e015612f0d770", "score": "0.69354445", "text": "func (it *ERC20BasicTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2102cd9f64bae6a4db4e015612f0d770", "score": "0.6933494", "text": "func (it *ERC20BasicTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2102cd9f64bae6a4db4e015612f0d770", "score": "0.6933494", "text": "func (it *ERC20BasicTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2102cd9f64bae6a4db4e015612f0d770", "score": "0.6933494", "text": "func (it *ERC20BasicTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2d978f636d3eb4af05336a6921bd2dae", "score": "0.6932705", "text": "func (it *McdflopKickIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "beb86158e32fd086bd4a059637148c93", "score": "0.69259596", "text": "func (it *ERC20BasicTransferIterator) Close() error {\r\n\tit.sub.Unsubscribe()\r\n\treturn nil\r\n}", "title": "" }, { "docid": "9d04a46451133879f377becce81533be", "score": "0.6925939", "text": "func (r *ResultsIterator) Close() {\n\tr.ri.Close()\n}", "title": "" }, { "docid": "75a218f181af386d61850017e9da1e25", "score": "0.6924091", "text": "func (it *BikeBikeReturnedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "163933d1879472e2216c13856411e118", "score": "0.6921477", "text": "func (it *ERC1155MintableURIIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "68d7df5b18c10c9c35f77cceb106d630", "score": "0.6920696", "text": "func (it *RenExSettlementLogSubmissionGasPriceLimitUpdatedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "1bd5ecf6dd8deea56d906d55286b4706", "score": "0.6916951", "text": "func (it *LiquidityPoolSwapIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "c00af67079e333137fc11caf272958a8", "score": "0.69150424", "text": "func (it *VbnbReservesReducedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2d688de262d88d0a7addbbcd0419231f", "score": "0.69120276", "text": "func (it *StandardBridgeETHBridgeInitiatedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "6854ac94a504045fb5fecb07561197a4", "score": "0.6910003", "text": "func (it *DefiLiquidityPoolSellIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ef191e7cef16dc913ef267189ab3d832", "score": "0.6908941", "text": "func (it *IERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ef191e7cef16dc913ef267189ab3d832", "score": "0.6908941", "text": "func (it *IERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "f3182b14d18e574e456d9c425a4e6a46", "score": "0.69075507", "text": "func (m *ResultsIterator) Close() {\n}", "title": "" }, { "docid": "8a1f7a7ac2d4e0b238d6dbf4b42b595e", "score": "0.6905304", "text": "func (p *payloadsForTraceGenerator) Close(_ context.Context) {\n\terr := p.it.Close()\n\tif err != nil {\n\t\t// TODO(angelapwen, yuzefovich): The iterator's error should be surfaced here.\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "39e44ccccec41e4023e69be905a60867", "score": "0.6904605", "text": "func (it *KyberFeeHandlerV2KncBurnedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "22b188190dda4a508e126b5cdecd660c", "score": "0.68948025", "text": "func (a Iterators) Close() error {\n\tfor _, itr := range a {\n\t\titr.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d9178ff7b910b62268e56a38ef838d86", "score": "0.6888476", "text": "func (it *InvoiceUnpaidContractInvoiceUnpaidMintedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "23a59979575e7d442cd70155d739aee0", "score": "0.6879753", "text": "func (it *FluxAggregatorNewRoundIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "a8c50158d1abe82140f6790fb15b1438", "score": "0.68793654", "text": "func (it *BikeNewCostIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "743a1208e947a933e0b2e80fbd01e875", "score": "0.68787545", "text": "func (it *InstallmentsSetPaidBaseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "b73417485fdc5af1d9ca8194eddbedf1", "score": "0.6875874", "text": "func (it *ERC1155MintableTransferBatchIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "8ed5a9e3cf87a6da5cb6519a2711a13a", "score": "0.6872967", "text": "func (it *BikeBikeTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2d1c0df6ee3cb9262611c5f894d71ef0", "score": "0.6870818", "text": "func (it *ContractAdvanceEpochsIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "0b551c98e7e4e8ac58718afe53cb7e4f", "score": "0.6870128", "text": "func (it *RgyAvailableToTransferChangeIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e21a99f62f8ca63f3d72355f4ef603c7", "score": "0.6864557", "text": "func (it *ERC20GatewayERC20ReceivedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "dc20b7bf45ad1c03419960573ab1b41e", "score": "0.6863663", "text": "func (it *OwnedOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "458b14587a01ddff5d2a1fa512f326e6", "score": "0.6857673", "text": "func (it *BikeOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e082bd661f1e97c37dfc243f59c8c113", "score": "0.68567204", "text": "func (it *WalletRegistryDkgResultChallengedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "4902dc80862f907caf1f3f38dd774d68", "score": "0.6853029", "text": "func (it *PausableOwnershipRenouncedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "a1c3700e4229a3cfbf68b29b9e252be0", "score": "0.6849826", "text": "func (it *InternalNetworkEtherReceivalIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ec0894bd61a096b4e5c536527f063243", "score": "0.68496937", "text": "func (it *DefiLiquidityPoolBuyIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "1de580bdd9575ae7b8c3f4da14861fc0", "score": "0.6838944", "text": "func (it *InstallmentsCreatedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "7a3742cb909e6d3317ae2b774c1c110b", "score": "0.6838115", "text": "func (it *GasRefunderDisallowerSetIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" } ]
f00c4e01d1fe652d50121330df032374
SetDealocationSafetyPeriod sets the dealocation_safety_period field.
[ { "docid": "cddba714061f70c3bfcbcb4fa066d214", "score": "0.8937698", "text": "func (m *ResourcePoolMutation) SetDealocationSafetyPeriod(i int) {\n\tm.dealocation_safety_period = &i\n\tm.adddealocation_safety_period = nil\n}", "title": "" } ]
[ { "docid": "b38a641ae27d7a84a93ddfed64bac2b3", "score": "0.6520391", "text": "func (m *ResourcePoolMutation) DealocationSafetyPeriod() (r int, exists bool) {\n\tv := m.dealocation_safety_period\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "ea92dca959e21f3b02fe5c2f1df83111", "score": "0.5884373", "text": "func (o *ServiceBillingReservations) SetPeriod(v string) {\n\to.Period = &v\n}", "title": "" }, { "docid": "df3f5f366b53a035a0999511608c740a", "score": "0.58325315", "text": "func (m *ResourcePoolMutation) AddDealocationSafetyPeriod(i int) {\n\tif m.adddealocation_safety_period != nil {\n\t\t*m.adddealocation_safety_period += i\n\t} else {\n\t\tm.adddealocation_safety_period = &i\n\t}\n}", "title": "" }, { "docid": "c6a5d8519327cc14cbc5d8f851013938", "score": "0.57719827", "text": "func (o *BudgetLimit) SetPeriod(v string) {\n\to.Period.Set(&v)\n}", "title": "" }, { "docid": "76bc97ccd31083f558fd40e045a27598", "score": "0.55446136", "text": "func (ch *Base) SetPeriod(period uint64) {\n\tch.Period = period\n}", "title": "" }, { "docid": "4e5fe7fb55aa9c3638975c86a8e67d03", "score": "0.55431753", "text": "func (o *DhcpLeaseDataData) SetLeasePeriod(v string) {\n\to.LeasePeriod = &v\n}", "title": "" }, { "docid": "d417164ffc5eb382cf936d92daae5749", "score": "0.546834", "text": "func (o *RecommendationTrend) SetPeriod(v string) {\n\to.Period = &v\n}", "title": "" }, { "docid": "b57e3050674c63b6b29c4c21ad0d8e29", "score": "0.54050505", "text": "func (m *ResourcePoolMutation) AddedDealocationSafetyPeriod() (r int, exists bool) {\n\tv := m.adddealocation_safety_period\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "9ac003e399cefffa58bf9fe8e9b7caf9", "score": "0.5388949", "text": "func (m *RuleMutation) SetGracePeriod(i int) {\n\tm.gracePeriod = &i\n\tm.addgracePeriod = nil\n}", "title": "" }, { "docid": "4e328dc41957d1843c235bf8d9b0eddb", "score": "0.5368844", "text": "func (s *GetProfileInput) SetPeriod(v string) *GetProfileInput {\n\ts.Period = &v\n\treturn s\n}", "title": "" }, { "docid": "8bab1353cf4cad7285f12e24f5a5900d", "score": "0.5310861", "text": "func (t *ThresholdCount) SetPeriod(v Period) {\n\tt.Period = &v\n}", "title": "" }, { "docid": "88202dfd0a8499ff03327d99215fdded", "score": "0.5310447", "text": "func (s *AggregatedProfileTime) SetPeriod(v string) *AggregatedProfileTime {\n\ts.Period = &v\n\treturn s\n}", "title": "" }, { "docid": "dce6d2c6cf25c9e237a8d7a79dc3166b", "score": "0.53029895", "text": "func (m *ResourcePoolMutation) ResetDealocationSafetyPeriod() {\n\tm.dealocation_safety_period = nil\n\tm.adddealocation_safety_period = nil\n}", "title": "" }, { "docid": "1a44f66a6f0d5905139b174dbc3b0f98", "score": "0.529987", "text": "func (s *ListProfileTimesInput) SetPeriod(v string) *ListProfileTimesInput {\n\ts.Period = &v\n\treturn s\n}", "title": "" }, { "docid": "79224fca22ff126efc87cd3d2e9953c7", "score": "0.5194412", "text": "func (o *GetMarketdataHistoryParams) SetPeriod(period string) {\n\to.Period = period\n}", "title": "" }, { "docid": "624a9cbe562f6060150f74790d5e82c7", "score": "0.5184773", "text": "func (o *LicenseLicenseInfoAllOf) SetEvaluationPeriod(v int64) {\n\to.EvaluationPeriod = &v\n}", "title": "" }, { "docid": "ac6315561d85899477acf5bd27f6008a", "score": "0.5166317", "text": "func (m *endpointCertificate) SetPeriodOfValidity(val CertificateValidity) {\n\tm.periodOfValidityField = val\n}", "title": "" }, { "docid": "6926f541306004e67bd3704d35f80c6f", "score": "0.5112693", "text": "func (r *Recurrence) SetPeriod(v int) {\n\tr.Period = &v\n}", "title": "" }, { "docid": "19fa7931920f8dabebc3f2e33f1f342e", "score": "0.50551134", "text": "func (o *GetInvoicesParams) SetPeriodEnd(periodEnd *string) {\n\to.PeriodEnd = periodEnd\n}", "title": "" }, { "docid": "1e97b11d27f68901f0ef31170e77c4d3", "score": "0.49467215", "text": "func (pwm *PWM) SetPeriod(period uint64) error {\n\treturn pwm.setPeriod(period, false)\n}", "title": "" }, { "docid": "ec89f901a721c92eeb077e47e872f16c", "score": "0.48655668", "text": "func (m *ResourcePoolMutation) OldDealocationSafetyPeriod(ctx context.Context) (v int, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldDealocationSafetyPeriod is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldDealocationSafetyPeriod requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldDealocationSafetyPeriod: %w\", err)\n\t}\n\treturn oldValue.DealocationSafetyPeriod, nil\n}", "title": "" }, { "docid": "5e8fb7d9bfc5da02372ec46a296567a9", "score": "0.48530233", "text": "func (p *Poll) SetClosePeriod(value int) {\n\tp.Flags.Set(4)\n\tp.ClosePeriod = value\n}", "title": "" }, { "docid": "5136b8b686e633ed20a123c22b827161", "score": "0.483886", "text": "func (opt *Option) SetPeriod(period uint) error {\n\tif opt == nil {\n\t\treturn ErrTOTPOptionIsNil\n\t}\n\tif period == 0 {\n\t\treturn errors.New(\"invalid period. please pass greater than 0\")\n\t}\n\n\topt.period = period\n\treturn nil\n}", "title": "" }, { "docid": "59e18c3a094f2bbe302474e5a706342d", "score": "0.48385128", "text": "func (c *CommandLabelV2) SetPeriod(p time.Duration) {\n\tc.Period = Duration(p)\n}", "title": "" }, { "docid": "c1a03444db43e7226035278535b66fd0", "score": "0.47256646", "text": "func (m *RuleSchedule) SetPeriod(value *string)() {\n err := m.GetBackingStore().Set(\"period\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "eff82770d6ff1b1fe74c8867649bf3b9", "score": "0.47143894", "text": "func (o *GetResourcesIDMeasuresParams) SetPeriodEnd(periodEnd *strfmt.DateTime) {\n\to.PeriodEnd = periodEnd\n}", "title": "" }, { "docid": "29e41f319ef7fd86e2624c0be02f98e3", "score": "0.47111198", "text": "func WithGracePeriod(p time.Duration) Option {\n\treturn func(cfg *config) error {\n\t\tif p < 0 {\n\t\t\treturn errors.New(\"grace period must be non-negative\")\n\t\t}\n\t\tcfg.gracePeriod = p\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "17dac9b9cb24d7e0f663586f2294d96b", "score": "0.46537712", "text": "func (s *Group) SetHealthCheckGracePeriod(v int64) *Group {\n\ts.HealthCheckGracePeriod = &v\n\treturn s\n}", "title": "" }, { "docid": "6537205bc6d3315e4996dae046efa88b", "score": "0.46257213", "text": "func WithTerminationWaitPeriod(d time.Duration) Option {\n\treturn func(s *SVC) error {\n\t\ts.TerminationWaitPeriod = d\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "d188a70466ff0368666606ccec929900", "score": "0.4585357", "text": "func (o *DhcpLeaseDataData) GetLeasePeriod() string {\n\tif o == nil || o.LeasePeriod == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LeasePeriod\n}", "title": "" }, { "docid": "2e4480cce8c1ce6d7ba98423661edb01", "score": "0.45300993", "text": "func (s *GetResourceMetricsInput) SetPeriodAlignment(v string) *GetResourceMetricsInput {\n\ts.PeriodAlignment = &v\n\treturn s\n}", "title": "" }, { "docid": "711e2b746d4365944fbd16c8a04cc7e8", "score": "0.44938257", "text": "func (p *PwmPin) SetPeriod(period int) (err error) {\n\t_, err = writeFile(p.attr(\"period\"), period)\n\treturn\n}", "title": "" }, { "docid": "13daacf28cbb7075b0263919dd92ee20", "score": "0.44929272", "text": "func (o *AwsKmsCollectionGetParams) SetPollingPeriod(pollingPeriod *int64) {\n\to.PollingPeriod = pollingPeriod\n}", "title": "" }, { "docid": "c5d06d9b4b048997fb70c29b6107d03b", "score": "0.44900167", "text": "func (m *Office365GroupsActivityDetail) SetReportPeriod(value *string)() {\n err := m.GetBackingStore().Set(\"reportPeriod\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1e681dbca70626a806aaa7e3e7863e74", "score": "0.44649333", "text": "func (o *BudgetLimit) HasPeriod() bool {\n\tif o != nil && o.Period.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b2215920d81badeff6411590d92c4b07", "score": "0.44566998", "text": "func (_SwapMining *SwapMiningSession) SetHalvingPeriod(_block *big.Int) (*types.Transaction, error) {\n\treturn _SwapMining.Contract.SetHalvingPeriod(&_SwapMining.TransactOpts, _block)\n}", "title": "" }, { "docid": "73d7a826fa378ca096fb18d9f438044f", "score": "0.44550568", "text": "func (device *MoistureBricklet) SetDebouncePeriod(debounce uint32) (err error) {\n\tvar buf bytes.Buffer\n\tbinary.Write(&buf, binary.LittleEndian, debounce)\n\n\tresultBytes, err := device.device.Set(uint8(FunctionSetDebouncePeriod), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "54d43a873627142f3162dc0d64f70604", "score": "0.44308028", "text": "func (o *CreditBankStatementUploadBankAccount) SetPeriods(v []CreditBankStatementUploadBankAccountPeriod) {\n\to.Periods = v\n}", "title": "" }, { "docid": "5c79f87483a52e8ba146f3a01e3aa459", "score": "0.44164246", "text": "func (rec *PayrollRecord) PayPeriod() string {\n\treturn rec.PaymentDate\n}", "title": "" }, { "docid": "cd74ed1220239a81e2bafe7a9d272b9e", "score": "0.43903232", "text": "func (o *BudgetLimit) UnsetPeriod() {\n\to.Period.Unset()\n}", "title": "" }, { "docid": "ebcca31b4f386279f622112522e3182d", "score": "0.43852195", "text": "func typhaAutoscalerPeriod(syncPeriod time.Duration) typhaAutoscalerOption {\n\treturn func(t *typhaAutoscaler) {\n\t\tt.syncPeriod = syncPeriod\n\t}\n}", "title": "" }, { "docid": "5466dfef46ecbbd163b6731e1d626aec", "score": "0.4383473", "text": "func WithTerminationGracePeriod(d time.Duration) Option {\n\treturn func(s *SVC) error {\n\t\ts.TerminationGracePeriod = d\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "3105ac99bec0d13f6ca5e9b9502caeed", "score": "0.43724573", "text": "func GracePeriod(v int) predicate.Rule {\n\treturn predicate.Rule(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldGracePeriod), v))\n\t})\n}", "title": "" }, { "docid": "fde78eb5dea5ce7e5298b142acb25b41", "score": "0.4360026", "text": "func (k Keeper) VotePeriod(ctx sdk.Context) (res int64) {\n\tk.paramSpace.Get(ctx, types.ParamStoreKeyVotePeriod, &res)\n\treturn\n}", "title": "" }, { "docid": "7cbaf8b4181c1f433c96fac3e45457e7", "score": "0.4350447", "text": "func (device *CO2Bricklet) SetDebouncePeriod(debounce uint32) (err error) {\n\tvar buf bytes.Buffer\n\tbinary.Write(&buf, binary.LittleEndian, debounce)\n\n\tresultBytes, err := device.device.Set(uint8(FunctionSetDebouncePeriod), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6d7333b40fab1f92f0563cf77f8742e7", "score": "0.43498686", "text": "func (_SwapMining *SwapMiningTransactorSession) SetHalvingPeriod(_block *big.Int) (*types.Transaction, error) {\n\treturn _SwapMining.Contract.SetHalvingPeriod(&_SwapMining.TransactOpts, _block)\n}", "title": "" }, { "docid": "0125cbb9cd15923d1dda10644c8ca03d", "score": "0.43242234", "text": "func (o *ServiceBillingReservations) GetPeriod() string {\n\tif o == nil || o.Period == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Period\n}", "title": "" }, { "docid": "692f23954488e0f77049bc0e17c2983e", "score": "0.43081674", "text": "func (o *BudgetLimit) SetPeriodNil() {\n\to.Period.Set(nil)\n}", "title": "" }, { "docid": "de802d580f9edd8fc17b203083b8fe7e", "score": "0.42988926", "text": "func (_Governoralpha *GovernoralphaCallerSession) SetVotingPeriodAfter() (*big.Int, error) {\n\treturn _Governoralpha.Contract.SetVotingPeriodAfter(&_Governoralpha.CallOpts)\n}", "title": "" }, { "docid": "8edd41f2ebb9d1b74af856ddc2dcae4e", "score": "0.42982826", "text": "func (mg *IOTHubDPS) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "564b2cc82042691b808333a4e9f29b57", "score": "0.4298203", "text": "func (m *Office365GroupsActivityStorage) SetReportPeriod(value *string)() {\n err := m.GetBackingStore().Set(\"reportPeriod\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ca429a9555a075a99c8a59d17d85a878", "score": "0.42954195", "text": "func (o *ApplicationCollectionGetParams) SetProtectionGranularity(protectionGranularity *string) {\n\to.ProtectionGranularity = protectionGranularity\n}", "title": "" }, { "docid": "4742bc14f4cccc769304d2615bf5abc1", "score": "0.429505", "text": "func (_LivepeerETHTicketBroker *LivepeerETHTicketBrokerCaller) UnlockPeriod(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _LivepeerETHTicketBroker.contract.Call(opts, out, \"unlockPeriod\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "14c2643acb6a9d1aa5ef3557c5f3ce1c", "score": "0.42891315", "text": "func (_Governoralpha *GovernoralphaCallerSession) VotingPeriod() (*big.Int, error) {\n\treturn _Governoralpha.Contract.VotingPeriod(&_Governoralpha.CallOpts)\n}", "title": "" }, { "docid": "e5cff864e42cf5d53c74108df7723be3", "score": "0.42763576", "text": "func (q *Queue) SetPersistencePeriod(p time.Duration) {\n\tq.Mutex.Lock()\n\tdefer q.Mutex.Unlock()\n\n\tq.PersistencePeriod = p\n}", "title": "" }, { "docid": "629fe645405bab7533127c6eb4390114", "score": "0.42697114", "text": "func (s *MicrosoftSQLServerSettings) SetSafeguardPolicy(v string) *MicrosoftSQLServerSettings {\n\ts.SafeguardPolicy = &v\n\treturn s\n}", "title": "" }, { "docid": "024ec0799f572f9aca9754593ffac8f1", "score": "0.42654148", "text": "func (_Validators *ValidatorsSession) SetDowntimeGracePeriod(value *big.Int) (*types.Transaction, error) {\n\treturn _Validators.Contract.SetDowntimeGracePeriod(&_Validators.TransactOpts, value)\n}", "title": "" }, { "docid": "9b6cbae52269ee46aba1c7214f5cedfd", "score": "0.42533758", "text": "func (p *Pinger) SetTimePeriod(timePeriod time.Duration) *Pinger {\n\tp.timePeriod = timePeriod\n\n\treturn p\n}", "title": "" }, { "docid": "de17361da507492445d7423a0e40193d", "score": "0.42429608", "text": "func MaxGracePeriod(m time.Duration) APICordonDrainerOption {\n\treturn func(d *APICordonDrainer) {\n\t\td.maxGracePeriod = m\n\t}\n}", "title": "" }, { "docid": "5726ab6a97393b739b90742dd9cb2d18", "score": "0.4230271", "text": "func (m *AospDeviceOwnerCertificateProfileBase) SetCertificateValidityPeriodValue(value *int32)() {\n err := m.GetBackingStore().Set(\"certificateValidityPeriodValue\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "67bcc9689cd8be637487ac795ca2354a", "score": "0.42287692", "text": "func (_Governoralpha *GovernoralphaSession) SetVotingPeriodAfter() (*big.Int, error) {\n\treturn _Governoralpha.Contract.SetVotingPeriodAfter(&_Governoralpha.CallOpts)\n}", "title": "" }, { "docid": "0898d3dbe19dc2305486cd4e4cc38ac5", "score": "0.4222984", "text": "func WithSilencePeriod(p time.Duration) Option {\n\treturn lconnmgr.WithSilencePeriod(p)\n}", "title": "" }, { "docid": "503c23b62f2117e1087e5570a3dddbf0", "score": "0.4220655", "text": "func (device *LoadCellBricklet) SetDebouncePeriod(debounce uint32) (err error) {\n\tvar buf bytes.Buffer\n\tbinary.Write(&buf, binary.LittleEndian, debounce)\n\n\tresultBytes, err := device.device.Set(uint8(FunctionSetDebouncePeriod), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "453943d66c8834beb3862130cf3952e9", "score": "0.42202955", "text": "func (_SwapMining *SwapMiningTransactor) SetHalvingPeriod(opts *bind.TransactOpts, _block *big.Int) (*types.Transaction, error) {\n\treturn _SwapMining.contract.Transact(opts, \"setHalvingPeriod\", _block)\n}", "title": "" }, { "docid": "7d56e29e44cfe7c7b2780e1168359adc", "score": "0.42184374", "text": "func (u *AccountUpdateDeviceLockedRequest) GetPeriod() (value int) {\n\treturn u.Period\n}", "title": "" }, { "docid": "e1f9c275cbde69fe2450e8a3355822ea", "score": "0.42123002", "text": "func (_LivepeerETHTicketBroker *LivepeerETHTicketBrokerTransactor) SetSignerRevocationPeriod(opts *bind.TransactOpts, _signerRevocationPeriod *big.Int) (*types.Transaction, error) {\n\treturn _LivepeerETHTicketBroker.contract.Transact(opts, \"setSignerRevocationPeriod\", _signerRevocationPeriod)\n}", "title": "" }, { "docid": "9b241cb75e821ab5e93d91f494b3114f", "score": "0.42046717", "text": "func (p *PWMPin) SetPeriod(period uint32) error {\n\tif p.period != 0 {\n\t\treturn errors.New(\"Cannot set the period of individual PWM pins on Raspi\")\n\t}\n\tp.period = period\n\treturn nil\n}", "title": "" }, { "docid": "9b3f10308324f79b4d6a76a883a0984a", "score": "0.4203152", "text": "func (mg *IOTHubDPSCertificate) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "6765c816f135293fc511ceab63ebd267", "score": "0.4202178", "text": "func (m *ItemItemsItemWorkbookFunctionsDbPostRequestBody) SetPeriod(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Jsonable)() {\n err := m.GetBackingStore().Set(\"period\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8295d1470f5272b3c8c7482500c17951", "score": "0.4199375", "text": "func WithSilencePeriod(p time.Duration) Option {\n\treturn func(cfg *config) error {\n\t\tif p <= 0 {\n\t\t\treturn errors.New(\"silence period must be non-zero\")\n\t\t}\n\t\tcfg.silencePeriod = p\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "95f9d3e87a3a4d05f596cb2c8cc84c23", "score": "0.41934362", "text": "func (_Validators *ValidatorsTransactorSession) SetDowntimeGracePeriod(value *big.Int) (*types.Transaction, error) {\n\treturn _Validators.Contract.SetDowntimeGracePeriod(&_Validators.TransactOpts, value)\n}", "title": "" }, { "docid": "ec625a51b1e409364c8f257cb18d045e", "score": "0.41810343", "text": "func (_Governoralpha *GovernoralphaSession) VotingPeriod() (*big.Int, error) {\n\treturn _Governoralpha.Contract.VotingPeriod(&_Governoralpha.CallOpts)\n}", "title": "" }, { "docid": "8f0bf0251732d64ec99c755210da6b39", "score": "0.41766018", "text": "func (o ManagedStorageAccountSasTokenDefinitionOutput) ValidityPeriod() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ManagedStorageAccountSasTokenDefinition) pulumi.StringOutput { return v.ValidityPeriod }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ce2b7fa1d2ed4e8cfbd076c7feb3fecb", "score": "0.41740286", "text": "func (m *AospDeviceOwnerCertificateProfileBase) SetCertificateValidityPeriodScale(value *CertificateValidityPeriodScale)() {\n err := m.GetBackingStore().Set(\"certificateValidityPeriodScale\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "57677870e31bb768e88d624bda3cbfed", "score": "0.41648236", "text": "func (_LivepeerETHTicketBroker *LivepeerETHTicketBrokerTransactor) SetUnlockPeriod(opts *bind.TransactOpts, _unlockPeriod *big.Int) (*types.Transaction, error) {\n\treturn _LivepeerETHTicketBroker.contract.Transact(opts, \"setUnlockPeriod\", _unlockPeriod)\n}", "title": "" }, { "docid": "01c3d4de290062d77e2283d75cca7a87", "score": "0.41592342", "text": "func (mg *Logtail) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "b7f83793d36a787ed67af76d652c751f", "score": "0.41564888", "text": "func (_LivepeerETHTicketBroker *LivepeerETHTicketBrokerSession) UnlockPeriod() (*big.Int, error) {\n\treturn _LivepeerETHTicketBroker.Contract.UnlockPeriod(&_LivepeerETHTicketBroker.CallOpts)\n}", "title": "" }, { "docid": "b2a9dd00f51cb28049a8fc44d15b1f64", "score": "0.41555685", "text": "func (m *ManagedAppProtection) SetPeriodOfflineBeforeWipeIsEnforced(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n err := m.GetBackingStore().Set(\"periodOfflineBeforeWipeIsEnforced\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "58db0f4c62cba87534a419a2014a3aa7", "score": "0.41537243", "text": "func WithEnforcementPolicy(enforcementPolicy *keepalive.EnforcementPolicy) Option {\n\treturn func(opt *option) {\n\t\topt.enforcementPolicy = enforcementPolicy\n\t}\n}", "title": "" }, { "docid": "83b323fc05e65b468fdae33bc7e18aba", "score": "0.41523477", "text": "func (o *CreditCardPeriodInfo) SetPeriodAmount(v int) {\n\to.PeriodAmount = v\n}", "title": "" }, { "docid": "08939ebc9274374ce5341a5cae08fc98", "score": "0.4147842", "text": "func (o *BudgetLimit) GetPeriod() string {\n\tif o == nil || o.Period.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Period.Get()\n}", "title": "" }, { "docid": "fd71ad847650a9cc0abbaf7062137719", "score": "0.4141517", "text": "func (o BasicAutoscalingAlgorithmOutput) CooldownPeriod() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BasicAutoscalingAlgorithm) *string { return v.CooldownPeriod }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d7ada8fefbaab1a3bf2cbf6176be5796", "score": "0.4138881", "text": "func (_LivepeerETHTicketBroker *LivepeerETHTicketBrokerCallerSession) UnlockPeriod() (*big.Int, error) {\n\treturn _LivepeerETHTicketBroker.Contract.UnlockPeriod(&_LivepeerETHTicketBroker.CallOpts)\n}", "title": "" }, { "docid": "c3b16db8f898ec2ff47fbf5cf5220fd4", "score": "0.4135052", "text": "func (m *ManagedDevice) SetComplianceGracePeriodExpirationDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n m.complianceGracePeriodExpirationDateTime = value\n}", "title": "" }, { "docid": "a395b8e87abe5991bf785927e5afdef5", "score": "0.41280872", "text": "func (mg *FlowLog) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "c68069eb73e168addcaa61318150f916", "score": "0.41080117", "text": "func (_Validators *ValidatorsTransactor) SetDowntimeGracePeriod(opts *bind.TransactOpts, value *big.Int) (*types.Transaction, error) {\n\treturn _Validators.contract.Transact(opts, \"setDowntimeGracePeriod\", value)\n}", "title": "" }, { "docid": "ee5b8c43924c3f7775e73c35a73e8225", "score": "0.4106669", "text": "func (mg *MachineGroupBinding) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "8a0cce2c863b7cd8be763f1397a88e46", "score": "0.41010028", "text": "func (o *LicenseLicenseInfoAllOf) GetEvaluationPeriod() int64 {\n\tif o == nil || o.EvaluationPeriod == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.EvaluationPeriod\n}", "title": "" }, { "docid": "f7b93a2d3098e5f786548f5f5e1a8886", "score": "0.40970263", "text": "func (o *DhcpLeaseDataData) HasLeasePeriod() bool {\n\tif o != nil && o.LeasePeriod != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "080f7809ddb5b4fdce511b763c8a2cbb", "score": "0.40943867", "text": "func (l *keepAliveConn) SetKeepAlivePeriod(d time.Duration) error {\n\treturn l.TCPConn.SetKeepAlivePeriod(d)\n}", "title": "" }, { "docid": "3c429fd798652946ca75eb1410b0da4c", "score": "0.40937942", "text": "func (_SwapMining *SwapMiningCallerSession) HalvingPeriod() (*big.Int, error) {\n\treturn _SwapMining.Contract.HalvingPeriod(&_SwapMining.CallOpts)\n}", "title": "" }, { "docid": "edff188e3eaab6d27279149317bb9fdb", "score": "0.4091983", "text": "func (o BasicAutoscalingAlgorithmPtrOutput) CooldownPeriod() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BasicAutoscalingAlgorithm) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CooldownPeriod\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2c59aa24f139945401ca84e185be7d82", "score": "0.4083423", "text": "func (o BasicAutoscalingAlgorithmResponseOutput) CooldownPeriod() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BasicAutoscalingAlgorithmResponse) string { return v.CooldownPeriod }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f1eb343d5771c5f89646eda08b4d6e42", "score": "0.40833592", "text": "func WithGracePeriod(p time.Duration) Option {\n\treturn lconnmgr.WithGracePeriod(p)\n}", "title": "" }, { "docid": "993817f10f4ec6a4c8287e269da297ab", "score": "0.4080016", "text": "func (o *ServiceBillingReservations) HasPeriod() bool {\n\tif o != nil && o.Period != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ffcea1945f11212eacdc978b3166928a", "score": "0.40774643", "text": "func (module *BBPWMModule) SetPeriod(pin Pin, ns int64) error {\n\topenPin := module.openPins[pin]\n\tif openPin == nil {\n\t\treturn fmt.Errorf(\"PWM pin is being written but is not enabled. Have you called EnablePin?\")\n\t}\n\n\treturn openPin.setPeriod(ns)\n}", "title": "" }, { "docid": "868231bd10011ecd5c935c90d84b807e", "score": "0.40723735", "text": "func (o *CreditCardPeriodInfo) SetPeriodType(v CreditPeriodTypeEnum) {\n\to.PeriodType = v\n}", "title": "" }, { "docid": "7e406c6582ec765fcdad8ea635c0c62e", "score": "0.40689772", "text": "func (mg *ServiceAccount) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "74f995049718d3ac852624bc4a4a8795", "score": "0.40663403", "text": "func ResyncPeriod(d time.Duration) Option {\n\treturn func(o *options) {\n\t\to.resyncPeriod = d\n\t}\n}", "title": "" }, { "docid": "1df41c30fe2fa423a870db8435d9ebe1", "score": "0.4058132", "text": "func (b BlockPeriod) Validate() error {\n\tif b.StartDate.IsZero() {\n\t\treturn apierrors.NewValidationError(\"start_date\", \"required\")\n\t}\n\tif b.EndDate.IsZero() {\n\t\treturn apierrors.NewValidationError(\"end_date\", \"required\")\n\t}\n\tif b.EndDate.Before(b.StartDate) {\n\t\treturn apierrors.NewValidationError(\"end_date\", \"invalid period\")\n\t}\n\treturn nil\n}", "title": "" } ]
12a453482b0de349e01afac8bc27757c
Exported names begin with capital letters.
[ { "docid": "7a39233b581e53d967349aac0b3aeb33", "score": "0.0", "text": "func Hello() {\n\t...\n}", "title": "" } ]
[ { "docid": "2618fc97c4f88ab76bad57edecc1dce2", "score": "0.7261903", "text": "func export(name string) string {\n\tif name == \"\" {\n\t\treturn \"\"\n\t}\n\tr, sz := utf8.DecodeRuneInString(name)\n\tif unicode.IsUpper(r) {\n\t\t// Foo -> Foo\n\t\treturn name\n\t}\n\t// fooBar -> FooBar\n\tsbuf := new(strings.Builder)\n\tsbuf.WriteRune(unicode.ToUpper(r))\n\tsbuf.WriteString(name[sz:])\n\treturn sbuf.String()\n}", "title": "" }, { "docid": "6b5ed7c6bbd49f12750b378dd7367cb4", "score": "0.7195787", "text": "func isExported(name string) bool {\n\treturn name != \"\" && name[0:1] == strings.ToUpper(name[0:1])\n}", "title": "" }, { "docid": "1802502637f84d90058a9631b665c186", "score": "0.69923913", "text": "func isExported(name string) bool {\n\trune, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(rune)\n}", "title": "" }, { "docid": "1802502637f84d90058a9631b665c186", "score": "0.69923913", "text": "func isExported(name string) bool {\n\trune, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(rune)\n}", "title": "" }, { "docid": "1802502637f84d90058a9631b665c186", "score": "0.69923913", "text": "func isExported(name string) bool {\n\trune, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(rune)\n}", "title": "" }, { "docid": "ecd9d6fd4d949af00dc759b7408ce452", "score": "0.6940322", "text": "func main() {\n\t// 28thBirthDay := \"2021/07/29\" // Variable name can't start with numbers.\n\t// Bday28th := \"2021/07/29\"\n\t// mypkg.lowercase() // cannot refer to unexported name mypkg.lowercase\n\t// mypkg.Uppercase() // Export name should starts with uppercase letter.\n\t// in_python_we_use_underbar := \"but\"\n\t// InGoLangWeSeperateWordByUppercase := \":)\"\n}", "title": "" }, { "docid": "207a56479b5235d64f7412d84b796865", "score": "0.6803015", "text": "func unexport(name string) string {\n\tif name == \"\" {\n\t\treturn \"\"\n\t}\n\tr, sz := utf8.DecodeRuneInString(name)\n\tif !unicode.IsUpper(r) {\n\t\t// foo -> foo\n\t\treturn name\n\t}\n\tr2, sz2 := utf8.DecodeRuneInString(name[sz:])\n\tif !unicode.IsUpper(r2) {\n\t\t// Foo -> foo\n\t\treturn string(unicode.ToLower(r)) + name[sz:]\n\t}\n\t// UPPERWord -> upperWord\n\tsbuf := new(strings.Builder)\n\tsbuf.WriteRune(unicode.ToLower(r))\n\ti := sz\n\tr, sz = r2, sz2\n\tfor unicode.IsUpper(r) && sz > 0 {\n\t\tr2, sz2 := utf8.DecodeRuneInString(name[i+sz:])\n\t\tif sz2 > 0 && unicode.IsLower(r2) {\n\t\t\tbreak\n\t\t}\n\t\ti += sz\n\t\tsbuf.WriteRune(unicode.ToLower(r))\n\t\tr, sz = r2, sz2\n\t}\n\tsbuf.WriteString(name[i:])\n\treturn sbuf.String()\n}", "title": "" }, { "docid": "3e90dff3551c6e779141c3c797b26f94", "score": "0.6699656", "text": "func IsExported(name string) bool {\n\tch, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(ch)\n}", "title": "" }, { "docid": "c2182f00d448462c33f4c458d3c50ff9", "score": "0.66414535", "text": "func unexport(s string) string {\n\treturn strings.ToLower(s[0:1]) + s[1:]\n}", "title": "" }, { "docid": "671ba1c9e9bb9dc1ef9fe2971cdd63a0", "score": "0.65641713", "text": "func IsExported(name string) bool {\n\tfor _, r := range name {\n\t\treturn unicode.IsUpper(r)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1ce11d2fb835e389a17740cea9ee1c40", "score": "0.6489145", "text": "func (e *ExportedCaller) Exported(s string) (string, error) {\n\treturn strings.ToUpper(string(s)[:1]) + string(s)[1:], nil\n}", "title": "" }, { "docid": "aa58f48f7bf522e4231e3f74543899a3", "score": "0.6323424", "text": "func main() {\r\n\tfmt.Println(\"exported name\")\r\n}", "title": "" }, { "docid": "75a4b2e8e776e1c44e2d1c977d78292f", "score": "0.63193345", "text": "func IsExported(name string) bool {\n\treturn name[0] >= 'A' && name[0] <= 'Z'\n}", "title": "" }, { "docid": "6dd8e61933f8c6420537007092579e7e", "score": "0.6293161", "text": "func IsExported(ident string) bool {\n\tfirst, _ := utf8.DecodeRuneInString(ident)\n\treturn first != utf8.RuneError && unicode.IsUpper(first)\n}", "title": "" }, { "docid": "904596108a98a87f14d0871e9ebbfcdd", "score": "0.62790304", "text": "func IsExported(name string) bool {\n\tif len(name) == 0 {\n\t\treturn false\n\t}\n\treturn unicode.IsUpper([]rune(name)[0])\n}", "title": "" }, { "docid": "8381e07cece382ab80c7ba992201b368", "score": "0.6214204", "text": "func NewFoo(foo string) *Foo {\n return &Foo{\n Foo: foo, //capitalized export\n baz: 12, //lower case not exported\n }\n}", "title": "" }, { "docid": "336cf98e3c82d9ac90826b19b4dff46f", "score": "0.6109984", "text": "func upper(name string) string {\n\treturn strings.ToUpper(name)\n}", "title": "" }, { "docid": "7ef7b8f6d4714b4b0449d9bf8014006d", "score": "0.59796065", "text": "func IsExported(fieldName string) bool {\n\treturn fieldName != \"\" && strings.ToUpper(fieldName)[0] == fieldName[0]\n}", "title": "" }, { "docid": "059f2c52fc9385240d049812daeca137", "score": "0.59398437", "text": "func typeName(char *gen.CharacteristicMetadata) string {\n\treturn camelCased(char.Name)\n}", "title": "" }, { "docid": "9fe6fd358598384b7e4727003eee8b10", "score": "0.5851677", "text": "func Unexport(name string) (string, error) {\n\treturn LowerFirstRune(name), nil\n}", "title": "" }, { "docid": "92f9f7cb8d6d64efb828081a33b45c26", "score": "0.5847935", "text": "func Suman() string {\n\t// The exported variables functions all the objects should start with Uppercase\n\treturn string(a)\n}", "title": "" }, { "docid": "928800f79eb59f96bb015d90f5002f6c", "score": "0.58161205", "text": "func isMethodExported(m reflect.Method) bool {\n\treturn unicode.IsUpper(rune(m.Name[0]))\n}", "title": "" }, { "docid": "135678c203e00d280dc7e35494931746", "score": "0.5781888", "text": "func (g *exportDesc) Name() string {\n\treturn \"desc\"\n}", "title": "" }, { "docid": "cac5eebec8cd91a1feb9bba91cfc7ecc", "score": "0.57767725", "text": "func Name() string {\n\treturn \"meng lin\"\n}", "title": "" }, { "docid": "041fc0828ca556445709322bffd724ec", "score": "0.57537556", "text": "func camel(name string) string {\n\t// replace each underscore followed by [a-z] with [A-Z]\n\treturn snakePart.ReplaceAllStringFunc(name, func(sub string) string {\n\t\treturn strings.ToUpper(sub[1:])\n\t})\n}", "title": "" }, { "docid": "ca5c76ce61fceee99f5985ae71cdbbac", "score": "0.57175225", "text": "func (s Strings) TitleCasedName() string {\n\tnewstr := make([]rune, 0)\n\tupNextChar := true\n\n\tfor _, chr := range string(s) {\n\t\tswitch {\n\t\tcase upNextChar:\n\t\t\tupNextChar = false\n\t\t\tchr -= ('a' - 'A')\n\t\tcase chr == '_':\n\t\t\tupNextChar = true\n\t\t\tcontinue\n\t\t}\n\n\t\tnewstr = append(newstr, chr)\n\t}\n\n\treturn string(newstr)\n}", "title": "" }, { "docid": "ebfd9ed2f9a00702fb1c72226d91746c", "score": "0.5716246", "text": "func (g *gkiApex) Name() string {\n\treturn g.moduleName() + \"_all\"\n}", "title": "" }, { "docid": "d980a679317ebb16e4af9e8e249c72cb", "score": "0.57124484", "text": "func (suite *ArtifactHandlerTestSuite) TestName() {\n\tsuite.Equal(\"InternalArtifact\", suite.handler.Name())\n}", "title": "" }, { "docid": "7bfbd83b3d348cd6729a4c905e8b0579", "score": "0.57120097", "text": "func isFieldExported(field reflect.StructField) bool {\n\treturn unicode.IsUpper(rune(field.Name[0]))\n}", "title": "" }, { "docid": "5bc01651caf5609ebe87a92577ae9e26", "score": "0.56775", "text": "func externalModuleName(s string) string {\n\treturn fmt.Sprintf(\"pulumi%s\", pascal(s))\n}", "title": "" }, { "docid": "983df65f5cf8253be1772673a90b8503", "score": "0.55959386", "text": "func fromCamelcase(s string) string {\n\tsplit := camelcase.Split(s)\n\tname := \"\"\n\tfor i := range split {\n\t\tname = name + strings.ToLower(split[i]) + \"_\"\n\t}\n\tname = strings.TrimSuffix(name, \"_\")\n\treturn name\n}", "title": "" }, { "docid": "2288e38a274f87c086a42e6310902325", "score": "0.5587864", "text": "func newName() string {\n\tr1 := random.Intn(26) + 'A'\n\tr2 := random.Intn(26) + 'A'\n\tnum := random.Intn(1000)\n\treturn fmt.Sprintf(\"%c%c%03d\", r1, r2, num)\n}", "title": "" }, { "docid": "b28319e4cd3ed8745c8f49627f62a19d", "score": "0.5584919", "text": "func MapEntryName(s string) string {\n\tvar b []byte\n\tupperNext := true\n\tfor _, c := range s {\n\t\tswitch {\n\t\tcase c == '_':\n\t\t\tupperNext = true\n\t\tcase upperNext:\n\t\t\tb = append(b, byte(unicode.ToUpper(c)))\n\t\t\tupperNext = false\n\t\tdefault:\n\t\t\tb = append(b, byte(c))\n\t\t}\n\t}\n\tb = append(b, \"Entry\"...)\n\treturn string(b)\n}", "title": "" }, { "docid": "31d67329a535b76c5b1173c1bc756425", "score": "0.5568579", "text": "func JSONName(name string) string {\n\tvar js []rune\n\tnextUpper := false\n\tfor _, r := range name {\n\t\tif r == '_' {\n\t\t\tnextUpper = true\n\t\t\tcontinue\n\t\t}\n\t\tif nextUpper {\n\t\t\tnextUpper = false\n\t\t\tjs = append(js, unicode.ToUpper(r))\n\t\t} else {\n\t\t\tjs = append(js, r)\n\t\t}\n\t}\n\treturn string(js)\n}", "title": "" }, { "docid": "c82e18ba1baec13e7cf2bc6afc1233e1", "score": "0.5562864", "text": "func main() {\n\tfmt.Println(pkg.Name)\n}", "title": "" }, { "docid": "452f244a8b1ddb6a37f9bb2a8f153593", "score": "0.5561618", "text": "func (ServiceAccountAdmissionControllerMigrationTest) Name() string {\n\treturn \"[sig-auth] serviceaccount-admission-controller-migration\"\n}", "title": "" }, { "docid": "0927a2a5b7a6a3c352230f1b3f519bc8", "score": "0.5551055", "text": "func PackageNameToShort(packageName string) string {\n\tname := filepath.Base(packageName)\n\tname = strings.TrimPrefix(name, \"go-\")\n\tname = strings.TrimSuffix(name, \"go-\")\n\tname = strings.ReplaceAll(name, \"-\", \"\")\n\tname = strings.ToLower(name)\n\treturn name\n}", "title": "" }, { "docid": "703e0de0296dfe1d34bcec8580ea4f14", "score": "0.55373526", "text": "func (tool * RemoveDuplicates) Name() string {\n return \"remove-duplicates\"\n}", "title": "" }, { "docid": "1c3d98b31beaace63ff64a7c061f321c", "score": "0.55225277", "text": "func DotCasedName(name string) string {\r\n\tnewstr := make([]rune, 0)\r\n\tfirstTime := true\r\n\r\n\tfor _, chr := range name {\r\n\t\tif isUpper := 'A' <= chr && chr <= 'Z'; isUpper {\r\n\t\t\tif firstTime == true {\r\n\t\t\t\tfirstTime = false\r\n\t\t\t} else {\r\n\t\t\t\tnewstr = append(newstr, '.')\r\n\t\t\t}\r\n\t\t\tchr -= ('A' - 'a')\r\n\t\t}\r\n\t\tnewstr = append(newstr, chr)\r\n\t}\r\n\r\n\treturn string(newstr)\r\n}", "title": "" }, { "docid": "2f0e7b2e3b5242dd12f0b30e00f8dea3", "score": "0.55202055", "text": "func upperKebabCase(s string) string {\n\ts = xstrings.ToSnakeCase(s)\n\ts = strings.Replace(s, \"_\", \"-\", -1)\n\treturn strings.ToUpper(s)\n}", "title": "" }, { "docid": "79307efb0abe707fc6f8fb41159313dd", "score": "0.55175835", "text": "func capitalize(name string) string {\n\tr, z := utf8.DecodeRuneInString(name)\n\tif z > 0 && !unicode.IsUpper(r) {\n\t\tname = string(unicode.ToUpper(r)) + name[z:]\n\t}\n\treturn name\n}", "title": "" }, { "docid": "8f63b82cf1f85f3b262f3f2f2edd992b", "score": "0.5491652", "text": "func (p *Pam) Name() string {\n\treturn moduleName\n}", "title": "" }, { "docid": "6f73eb124c81e7f4cc13c5aa96e86cae", "score": "0.5486668", "text": "func upperSnakeCaseToCamelCase(s string) string {\n\twords := strings.Split(s, \"_\")\n\tfor i, word := range words {\n\t\tif i == 0 {\n\t\t\twords[i] = strings.ToLower(word)\n\t\t} else if !isWellKnownAbbreviation(word) {\n\t\t\twords[i] = titleFirst(strings.ToLower(word))\n\t\t}\n\t}\n\treturn strings.Join(words, \"\")\n}", "title": "" }, { "docid": "ee0078ff2645fd385d0b9c0c55a974a9", "score": "0.54792875", "text": "func aberrantMapEntryName(s pref.Name) pref.Name {\n\tvar b []byte\n\tupperNext := true\n\tfor _, c := range s {\n\t\tswitch {\n\t\tcase c == '_':\n\t\t\tupperNext = true\n\t\tcase upperNext:\n\t\t\tb = append(b, byte(unicode.ToUpper(c)))\n\t\t\tupperNext = false\n\t\tdefault:\n\t\t\tb = append(b, byte(c))\n\t\t}\n\t}\n\tb = append(b, \"Entry\"...)\n\treturn pref.Name(b)\n}", "title": "" }, { "docid": "75f0830228878738738531c5e5997d21", "score": "0.54787683", "text": "func (z *ZenGen) Name() string { return \"zengen\" }", "title": "" }, { "docid": "e881c4ae322f9ac83b2526ac03827139", "score": "0.54772514", "text": "func nameStart(c byte) bool {\n\treturn 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || c == '_' || c > 127\n}", "title": "" }, { "docid": "e881c4ae322f9ac83b2526ac03827139", "score": "0.54772514", "text": "func nameStart(c byte) bool {\n\treturn 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || c == '_' || c > 127\n}", "title": "" }, { "docid": "782387b5e8e58feaf82b64397a66571f", "score": "0.54702103", "text": "func (this *ConsoleLog) Name() string {\n return CL_MOD_NAME\n}", "title": "" }, { "docid": "ef38ea38a38b74fc7e4a1b748edc9312", "score": "0.5461646", "text": "func UpperName(input string) string {\n\tarr := strings.Split(input, \"_\")\n\tfor i := range arr {\n\t\tarr[i] = strings.Title(arr[i])\n\t}\n\treturn strings.Join(arr, \"\")\n}", "title": "" }, { "docid": "4e6ac01144254f8b2560933ea1cd5d3c", "score": "0.5447312", "text": "func SnakeCasedName(name string) string {\r\n\tnewstr := make([]rune, 0)\r\n\tfirstTime := true\r\n\r\n\tfor _, chr := range name {\r\n\t\tif isUpper := 'A' <= chr && chr <= 'Z'; isUpper {\r\n\t\t\tif firstTime == true {\r\n\t\t\t\tfirstTime = false\r\n\t\t\t} else {\r\n\t\t\t\tnewstr = append(newstr, '_')\r\n\t\t\t}\r\n\t\t\tchr -= ('A' - 'a')\r\n\t\t}\r\n\t\tnewstr = append(newstr, chr)\r\n\t}\r\n\r\n\treturn string(newstr)\r\n}", "title": "" }, { "docid": "e265300cba62c4a9e6c74eb8fe429019", "score": "0.5440955", "text": "func convertName(jsonName string) string {\n\tnameArr := strings.Split(jsonName, \"_\")\n\n\t// Convert numbers to words according to Golang naming convention\n\tif strings.Index(nameArr[0], \"2\") == 0 {\n\t\tnameArr[0] = strings.ReplaceAll(nameArr[0], \"2\", \"two\")\n\t}\n\n\tfor k, v := range nameArr {\n\t\tnameArr[k] = strings.Title(strings.ToLower(v))\n\t}\n\n\treturn strings.Join(nameArr, \"\")\n}", "title": "" }, { "docid": "1b864be25122785dfb06d4f01157905a", "score": "0.54314125", "text": "func PackageName(str string) (string, error) {\n\tformatStr, err := serviceNameHelper(str)\n\treturn strings.ToLower(formatStr), err\n}", "title": "" }, { "docid": "dfa6b4f0dbfe8836e1d1c1ec8d8c08c9", "score": "0.5379997", "text": "func IsUnexported(name string) bool {\n\tif name[0] == '_' {\n\t\treturn true\n\t}\n\treturn name[0] >= 'a' && name[0] <= 'z'\n}", "title": "" }, { "docid": "dd015f1a9079bc890304861ef70f649b", "score": "0.537786", "text": "func inverseCapitalize(name string) string {\n\tr, z := utf8.DecodeRuneInString(name)\n\tif z > 0 && !unicode.IsLower(r) {\n\t\tname = string(unicode.ToLower(r)) + name[z:]\n\t}\n\treturn name\n}", "title": "" }, { "docid": "a8e4fc2c02fec7c6735f77ba21fcac1f", "score": "0.5375922", "text": "func (tc testcase) Name() string {\n\tvar b strings.Builder\n\tfor i, n := range tc.Packages {\n\t\tif i != 0 {\n\t\t\tb.WriteByte(':')\n\t\t}\n\t\tfmt.Fprint(&b, n)\n\t}\n\treturn fmt.Sprintf(\"%dlayer_%spackage_%dscanner\", tc.Layers, b.String(), tc.Scanners)\n}", "title": "" }, { "docid": "653f6108feae0d91051c3602a8c96776", "score": "0.53613317", "text": "func HelloName(name string) string {\n\treturn \"Hello \" + name\n}", "title": "" }, { "docid": "faae4588c50dc9f7719d920b215badda", "score": "0.53521913", "text": "func printName()string{\n\treturn \"Hello, world!\"\n}", "title": "" }, { "docid": "57f3f70340ab8a8cf9650fb294f320cc", "score": "0.5351729", "text": "func upperPascalCase(s string) string {\n\ts = strings.Replace(xstrings.ToSnakeCase(s), \"-\", \"_\", -1)\n\tif len(s) > 1 {\n\t\treturn xstrings.ToCamelCase(s)\n\t}\n\n\treturn strings.ToUpper(s[:1])\n}", "title": "" }, { "docid": "2caf3df6e2d1866591521e2a756c2085", "score": "0.53449804", "text": "func isUpper(name string) bool {\n\tch, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(ch)\n}", "title": "" }, { "docid": "60f71c01695f867936744a9bcf69054c", "score": "0.5340119", "text": "func capitalize(s string) string {\n\treturn strings.Title(strings.ToLower(s))\n}", "title": "" }, { "docid": "9e82009d14d29dccfe7c15c3c8c1e880", "score": "0.53311527", "text": "func (g *gkiApex) moduleName() string {\n\treturn g.BaseModuleName()\n}", "title": "" }, { "docid": "55ba9581639bcabe6fa9fcbd72cde00a", "score": "0.5323182", "text": "func titleizeAggrMethod(aggr string) string {\n\treturn strings.ToUpper(aggr[:1]) + aggr[1:]\n}", "title": "" }, { "docid": "c549b557612671682a04cdd3315ecc59", "score": "0.5316419", "text": "func fetchName() string {\n\treturn \"RabbitName\"\n}", "title": "" }, { "docid": "30fa0128e66f6a8dbf6794e1e015a56a", "score": "0.5315231", "text": "func (s *GoLangMapper) PackageName(*yang.Entry, genutil.CompressBehaviour, bool) (string, error) {\n\treturn \"\", nil\n}", "title": "" }, { "docid": "d7d4b1b0b1b5449f377cfa69ba086b42", "score": "0.53128177", "text": "func IsExported(name string) bool { return token.IsExported(name) }", "title": "" }, { "docid": "8f8a279c89fd50f9dd4eb2e53d4b69cf", "score": "0.53123987", "text": "func (unexp *unexporter) GenerateRenameCommands() []string {\n\tcommands := make([]string, 0)\n\n\tfor _, identifier := range unexp.UsageStats.Identifiers {\n\t\tif !identifier.IsUsed() {\n\t\t\tpkg_path := unexp.UsageStats.PackageInfo.Pkg.Path()\n\t\t\tcommands = append(commands, fmt.Sprintf(\"gorename -from '\\\"%s\\\".%s' -to %s\", pkg_path, unexp.GetRenameIdentifier(identifier), identifier.GetUnexportedName()))\n\t\t}\n\t}\n\n\treturn commands\n}", "title": "" }, { "docid": "69102f455c705cf6448b3e313f9486aa", "score": "0.530863", "text": "func TitleCasedName(name string, lower bool) string {\n\tnewstr := make([]rune, 0, len(name))\n\tupNextChar := true\n\n\tfor _, chr := range name {\n\t\tif chr == '-' || chr == '_' || chr == '.' {\n\t\t\tupNextChar = true\n\t\t\tcontinue\n\t\t}\n\n\t\tif chr >= 'a' && chr <= 'z' && upNextChar {\n\t\t\tchr -= alphaDelta\n\t\t}\n\n\t\tnewstr = append(newstr, chr)\n\t\tupNextChar = false\n\t}\n\n\tif lower && newstr[0] >= 'A' && newstr[0] <= 'Z' {\n\t\tnewstr[0] += alphaDelta\n\t}\n\n\treturn string(newstr)\n}", "title": "" }, { "docid": "15573fa61d0cc64a4a15cd44439b2f37", "score": "0.52984077", "text": "func GetCExportName (NameSpace string, ClassName string, method ComponentDefinitionMethod, isGlobal bool) (string) {\n\tCMethodName := \"\";\n\tif isGlobal {\n\t\tCMethodName = fmt.Sprintf(\"%s_%s%s\", strings.ToLower(NameSpace), strings.ToLower(method.MethodName), method.DLLSuffix)\n\t} else {\n\t\tCMethodName = fmt.Sprintf(\"%s_%s_%s%s\", strings.ToLower(NameSpace), strings.ToLower(ClassName), strings.ToLower(method.MethodName), method.DLLSuffix)\n\t}\n\t\n\treturn CMethodName;\n}", "title": "" }, { "docid": "c7fb58e6c4be644dc14aaf131c95a213", "score": "0.5287967", "text": "func FromCamelCase(name string) string {\n\tstr := \"\"\n\tif name != \"\" {\n\t\tfor _, letter := range name {\n\t\t\tif !unicode.IsLower(letter) {\n\t\t\t\tstr += \"_\"\n\t\t\t}\n\t\t\tstr += string(unicode.ToUpper(letter))\n\t\t}\n\t}\n\n\treturn str\n}", "title": "" }, { "docid": "bf08d10e1fd5b8e6e28c5183fce1f639", "score": "0.5286089", "text": "func (c *NamesCalculator) FileName(version *concepts.Version) string {\n\tservice := version.Owner()\n\treturn filepath.Join(service.Name().Snake(), version.Name().Snake(), \"openapi.json\")\n}", "title": "" }, { "docid": "916e789753172f87a5216cfc68faecd3", "score": "0.5285176", "text": "func (this *EnvProvider) Name() string {\n return this.moduleName\n}", "title": "" }, { "docid": "482233c6c8534c1ea08f9ac33076d26b", "score": "0.5273393", "text": "func (pm ProtoMessage) MethodName() ExtString {\n\tv := pm.Verb.Downcase()\n\tswitch v {\n\tcase \"list\":\n\t\treturn pm.Verb.Titlecase() + pm.Noun.Titlecase().Pluralize()\n\t}\n\n\treturn pm.Verb.Titlecase() + pm.Noun.Titlecase()\n}", "title": "" }, { "docid": "53f607f19edd8826101df6fa1ffe3f35", "score": "0.527001", "text": "func NameOut(fileName string) string {\n\tvar outFileName strings.Builder\n\toutFileName.WriteString(fileName[:strings.Index(fileName,\".\")])\n\toutFileName.WriteString(\"out\")\n\toutFileName.WriteString(fileName[strings.Index(fileName,\".\"):])\n\treturn outFileName.String()\n}", "title": "" }, { "docid": "0d29811aa6b5377147316bfb115b70cd", "score": "0.5263235", "text": "func (*VBM) Name() string { return \"github.com/kraken-hpc/kraken-layercake/modules/vboxmanage\" }", "title": "" }, { "docid": "490ec8ff295076c98637bcc61672200a", "score": "0.52632004", "text": "func nameChar(c byte) bool {\n\treturn 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || c == '_' || c > 127 ||\n\t\tc == '-' || '0' <= c && c <= '9'\n}", "title": "" }, { "docid": "4c4a785f6c65b2b67fceb3b8a8b94b5c", "score": "0.52599275", "text": "func normalizeName(name string) string {\n\tname = dashAndSpaceMatcher.ReplaceAllString(name, \"_\")\n\tvar a []string\n\tfor _, sub := range camelCaseMatcher.FindAllStringSubmatch(name, -1) {\n\t\tif sub[1] != \"\" {\n\t\t\ta = append(a, sub[1])\n\t\t}\n\t\tif sub[2] != \"\" {\n\t\t\ta = append(a, sub[2])\n\t\t}\n\t}\n\treturn strings.ToLower(strings.Join(a, \"_\"))\n}", "title": "" }, { "docid": "794b8ec182388fe5f1029721382f5ed1", "score": "0.52582586", "text": "func (c *Keys) Name() string {\n\treturn \"KEYS\"\n}", "title": "" }, { "docid": "3f6e194ed69179770ddb328ab5762084", "score": "0.52566266", "text": "func (cmd ImportCmd) Name() string {\n\treturn \"import\"\n}", "title": "" }, { "docid": "70a52f16a9fa261ad76b35e3ae8d1654", "score": "0.5255714", "text": "func ModuleName(name string) string {\n\treturn \"s3.\" + name\n}", "title": "" }, { "docid": "2ee240230219d8cdef3310f1f09ae8ca", "score": "0.52520293", "text": "func FromConstCase(s string) string {\n\treturn strings.Replace(s, \"_\", \" \", -1)\n}", "title": "" }, { "docid": "2830470c7c787502be513246815c579c", "score": "0.5246737", "text": "func toFileName(name string) string {\n\tret := \"\"\n\ttmp := []rune(name)\n\tisPrevLc := true\n\tisCurrentLc := tmp[0] == unicode.ToLower(tmp[0])\n\tisNextLc := false\n\n\tfor i := range tmp {\n\t\tlc := unicode.ToLower(tmp[i])\n\n\t\tif i == len(name)-1 {\n\t\t\tisNextLc = false\n\t\t} else {\n\t\t\tisNextLc = (tmp[i+1] == unicode.ToLower(tmp[i+1]))\n\t\t}\n\n\t\tif i != 0 && !isCurrentLc && (isPrevLc || isNextLc) {\n\t\t\tret += \"_\"\n\t\t}\n\t\tret += string(lc)\n\n\t\tisPrevLc = isCurrentLc\n\t\tisCurrentLc = isNextLc\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "aaf6278abc58ea3f1362f7841e8e1875", "score": "0.52445763", "text": "func TitleCasedName(name string) string {\r\n\treturn titleCasedName(name, false)\r\n}", "title": "" }, { "docid": "5d00ac9536e33d800b9a9fc5b7589707", "score": "0.52339995", "text": "func varName(file string) string {\n\tmapping := func(r rune) rune {\n\t\tif r == '-' || r == '.' || r == '+' {\n\t\t\treturn '_'\n\t\t}\n\t\treturn r\n\t}\n\treturn \"license_\" + strings.Map(mapping, filepath.Base(file))\n}", "title": "" }, { "docid": "d486680822dda08c8e6086f0d3450a27", "score": "0.5231194", "text": "func Name(name string) string {\n\tname = strings.TrimSpace(name)\n\tname = strings.Title(name)\n\treturn name\n}", "title": "" }, { "docid": "30b6a2ac79ec5d66c15a39e9e2ce0569", "score": "0.5225072", "text": "func pickupUpperCase() string {\n\treturn pickup(26, 65)\n}", "title": "" }, { "docid": "c403144a98fceb47713f70ece57b6d5d", "score": "0.5224715", "text": "func UPPER(s string) string {\n\treturn strings.ToUpper(s)\n}", "title": "" }, { "docid": "19f1096247b906f68b1fde62c134f1ec", "score": "0.52242076", "text": "func (ScrapeCsUnloads) Name() string {\n\treturn csUnloads\n}", "title": "" }, { "docid": "259d78c058ee02acb774207e99b7f52f", "score": "0.5221357", "text": "func snakePluralToUpperCamel(s string) string {\n\tbuf := new(bytes.Buffer)\n\tfirst := true\n\tfor i := 0; i < len(s); i++ {\n\t\tc := s[i]\n\t\tif c >= 'a' && c <= 'z' && first {\n\t\t\tbuf.WriteByte(c - 32)\n\t\t\tfirst = false\n\t\t} else if c == '_' {\n\t\t\tfirst = true\n\t\t\tcontinue\n\t\t} else {\n\t\t\tif i != len(s)-1 || c != 's' {\n\t\t\t\tbuf.WriteByte(c)\n\t\t\t}\n\t\t}\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "f84b09d52f7db8c5cc0541b4e11daa02", "score": "0.5212529", "text": "func assetName(module string) string {\n\tkey := sourceKey(module)\n\tassets := AssetNames()\n\tfor _, a := range assets {\n\t\tif key == sourceKey(a) {\n\t\t\treturn a\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "db2836a8e1defa77c797754382837ff3", "score": "0.5206368", "text": "func upper(s string) string {\n\treturn strings.ToUpper(s)\n}", "title": "" }, { "docid": "91b5756778415dff0dc57142a1040b2d", "score": "0.5206258", "text": "func capitalise(input string) string {\n\tfor len(input) > 0 && input[0] == '_' {\n\t\tinput = input[1:]\n\t}\n\tif len(input) == 0 {\n\t\treturn \"\"\n\t}\n\treturn strings.ToUpper(input[:1]) + input[1:]\n}", "title": "" }, { "docid": "b4e5f14fae7baa0fa83d9e66c349a955", "score": "0.52022195", "text": "func Capitalize(s string) string {\n\treturn strings.Title(s)\n}", "title": "" }, { "docid": "17976cfa1f59227f6ce39cabfede665e", "score": "0.5191638", "text": "func TrimCasedName(name string) string {\r\n\tvar newstr []rune\r\n\tupNextChar := true\r\n\r\n\tfor _, chr := range name {\r\n\t\tif 'A' <= chr && chr <= 'Z' {\r\n\t\t\tupNextChar = false\r\n\t\t} else if upNextChar {\r\n\t\t\tupNextChar = false\r\n\t\t} else if chr == '_' || chr == '.' {\r\n\t\t\tupNextChar = true\r\n\t\t\tcontinue\r\n\t\t} else {\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tnewstr = append(newstr, chr)\r\n\r\n\t}\r\n\r\n\treturn string(newstr)\r\n}", "title": "" }, { "docid": "74e2a3a3db49f00190a330ea95709c93", "score": "0.51903456", "text": "func titleCase(s string) string {\n\treturn strings.Title(s)\n}", "title": "" }, { "docid": "ef3127d2dafb173b190bef0cecb2a615", "score": "0.51897967", "text": "func (Main) Name() compiler.String {\n\treturn compiler.String{\n\t\tcompiler.English: `main`,\n\t}\n}", "title": "" }, { "docid": "5c47159bf48ebdb27e344cc60b662873", "score": "0.5185279", "text": "func (s Strings) SnakeCasedName() string {\n\tnewstr := make([]rune, 0)\n\tfirstTime := true\n\n\tfor _, chr := range string(s) {\n\t\tif isUpper := 'A' <= chr && chr <= 'Z'; isUpper {\n\t\t\tif firstTime == true {\n\t\t\t\tfirstTime = false\n\t\t\t} else {\n\t\t\t\tnewstr = append(newstr, '_')\n\t\t\t}\n\t\t\tchr -= ('A' - 'a')\n\t\t}\n\t\tnewstr = append(newstr, chr)\n\t}\n\n\treturn string(newstr)\n}", "title": "" }, { "docid": "fd51c1be4f9f5d88b445268b77bc91d9", "score": "0.5180688", "text": "func (AppModuleBasic) Name() string {\n\treturn types.ModuleName\n}", "title": "" }, { "docid": "fd51c1be4f9f5d88b445268b77bc91d9", "score": "0.5180688", "text": "func (AppModuleBasic) Name() string {\n\treturn types.ModuleName\n}", "title": "" }, { "docid": "82be6d28a02d88e972cb190567e6785a", "score": "0.51803476", "text": "func (b *Basic) Name() string { return b.name }", "title": "" }, { "docid": "5528ea88f478b75504b316d77c489d16", "score": "0.5173498", "text": "func (m *Admin) Name() string {\n\tswitch m.Config.Operation {\n\tcase upload:\n\t\treturn UploadModuleName\n\tcase download:\n\t\treturn DownloadModuleName\n\tdefault:\n\t\treturn \"unimplemented\"\n\t}\n}", "title": "" }, { "docid": "e33620d7a08777755bdeee869d4fac30", "score": "0.51709616", "text": "func (fs *FsNotify) Name() string {\n\treturn moduleName\n}", "title": "" } ]
9ceead516f2ab3f13f433d5868796326
SendListResponse sends the list devices command response
[ { "docid": "e64aaa3a1012e1f4c923651b8f44117e", "score": "0.7955482", "text": "func (cs *commandSender) SendListResponse(things []*entities.Thing, replyTo, corrID string, err error) error {\n\terrMsg := getErrMsg(err)\n\tresp := &network.DeviceListResponse{Things: things, Error: errMsg}\n\theaders := map[string]interface{}{\n\t\t\"correlation_id\": corrID,\n\t}\n\tmsg, err := json.Marshal(resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn cs.amqp.PublishPersistentMessage(exchangeDevices, exchangeDevicesType, replyTo, msg, headers)\n}", "title": "" } ]
[ { "docid": "3756bb62f249ef429b550eabbdbf2d79", "score": "0.679064", "text": "func (f *fakeAPI) listDevicesHandler(w http.ResponseWriter, r *http.Request) {\n\tdevices := []*packngo.Device{\n\t\t{DeviceRaw: packngo.DeviceRaw{\n\t\t\tID: uuid.New().String(),\n\t\t\tHostname: nodeName,\n\t\t\tState: \"active\",\n\t\t}},\n\t}\n\tvar resp = struct {\n\t\tDevices []*packngo.Device `json:\"devices\"`\n\t}{\n\t\tDevices: devices,\n\t}\n\terr := json.NewEncoder(w).Encode(&resp)\n\tif err != nil {\n\t\tf.t.Fatal(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "9b11c8be66d17b3b3dee32f9364a8b2d", "score": "0.66775954", "text": "func (c *client) List(ctx context.Context, installStatus pb.InstallStatus) (*pb.DeviceListResponse, error) {\n\tcli := c.getDeviceClient()\n\n\treq := pb.DeviceListRequest{\n\t\tInstallStatus: installStatus,\n\t}\n\tresp, err := cli.List(ctx, &req)\n\n\treturn resp, err\n}", "title": "" }, { "docid": "e51cbbfea1e06e77d0a57e44bf5dfec9", "score": "0.65919167", "text": "func (r ListDevicesRequest) Send() (*ListDevicesOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*ListDevicesOutput), nil\n}", "title": "" }, { "docid": "6e34d2803f2fdcdaa52e87eff4d071cb", "score": "0.65867263", "text": "func (f *FakeController) ListDevices(authorization string, replyTo, corrID string) error {\n\tret := f.Called()\n\treturn ret.Error(0)\n}", "title": "" }, { "docid": "a585b847c34d7c388441aa456217cf52", "score": "0.6421006", "text": "func (c *deviceManagerRESTClient) ListDevices(ctx context.Context, req *iotpb.ListDevicesRequest, opts ...gax.CallOption) *DeviceIterator {\n\tit := &DeviceIterator{}\n\treq = proto.Clone(req).(*iotpb.ListDevicesRequest)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tit.InternalFetch = func(pageSize int, pageToken string) ([]*iotpb.Device, string, error) {\n\t\tresp := &iotpb.ListDevicesResponse{}\n\t\tif pageToken != \"\" {\n\t\t\treq.PageToken = pageToken\n\t\t}\n\t\tif pageSize > math.MaxInt32 {\n\t\t\treq.PageSize = math.MaxInt32\n\t\t} else if pageSize != 0 {\n\t\t\treq.PageSize = int32(pageSize)\n\t\t}\n\t\tbaseUrl, err := url.Parse(c.endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v/devices\", req.GetParent())\n\n\t\tparams := url.Values{}\n\t\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\t\tif items := req.GetDeviceIds(); len(items) > 0 {\n\t\t\tfor _, item := range items {\n\t\t\t\tparams.Add(\"deviceIds\", fmt.Sprintf(\"%v\", item))\n\t\t\t}\n\t\t}\n\t\tif items := req.GetDeviceNumIds(); len(items) > 0 {\n\t\t\tfor _, item := range items {\n\t\t\t\tparams.Add(\"deviceNumIds\", fmt.Sprintf(\"%v\", item))\n\t\t\t}\n\t\t}\n\t\tif req.GetFieldMask() != nil {\n\t\t\tfieldMask, err := protojson.Marshal(req.GetFieldMask())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, \"\", err\n\t\t\t}\n\t\t\tparams.Add(\"fieldMask\", string(fieldMask[1:len(fieldMask)-1]))\n\t\t}\n\t\tif req.GetGatewayListOptions().GetAssociationsDeviceId() != \"\" {\n\t\t\tparams.Add(\"gatewayListOptions.associationsDeviceId\", fmt.Sprintf(\"%v\", req.GetGatewayListOptions().GetAssociationsDeviceId()))\n\t\t}\n\t\tif req.GetGatewayListOptions().GetAssociationsGatewayId() != \"\" {\n\t\t\tparams.Add(\"gatewayListOptions.associationsGatewayId\", fmt.Sprintf(\"%v\", req.GetGatewayListOptions().GetAssociationsGatewayId()))\n\t\t}\n\t\tif req.GetGatewayListOptions().GetGatewayType() != 0 {\n\t\t\tparams.Add(\"gatewayListOptions.gatewayType\", fmt.Sprintf(\"%v\", req.GetGatewayListOptions().GetGatewayType()))\n\t\t}\n\t\tif req.GetPageSize() != 0 {\n\t\t\tparams.Add(\"pageSize\", fmt.Sprintf(\"%v\", req.GetPageSize()))\n\t\t}\n\t\tif req.GetPageToken() != \"\" {\n\t\t\tparams.Add(\"pageToken\", fmt.Sprintf(\"%v\", req.GetPageToken()))\n\t\t}\n\n\t\tbaseUrl.RawQuery = params.Encode()\n\n\t\t// Build HTTP headers from client and context metadata.\n\t\thds := append(c.xGoogHeaders, \"Content-Type\", \"application/json\")\n\t\theaders := gax.BuildHeaders(ctx, hds...)\n\t\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\t\tif settings.Path != \"\" {\n\t\t\t\tbaseUrl.Path = settings.Path\n\t\t\t}\n\t\t\thttpReq, err := http.NewRequest(\"GET\", baseUrl.String(), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\thttpReq.Header = headers\n\n\t\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer httpRsp.Body.Close()\n\n\t\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}, opts...)\n\t\tif e != nil {\n\t\t\treturn nil, \"\", e\n\t\t}\n\t\tit.Response = resp\n\t\treturn resp.GetDevices(), resp.GetNextPageToken(), nil\n\t}\n\n\tfetch := func(pageSize int, pageToken string) (string, error) {\n\t\titems, nextPageToken, err := it.InternalFetch(pageSize, pageToken)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tit.items = append(it.items, items...)\n\t\treturn nextPageToken, nil\n\t}\n\n\tit.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)\n\tit.pageInfo.MaxSize = int(req.GetPageSize())\n\tit.pageInfo.Token = req.GetPageToken()\n\n\treturn it\n}", "title": "" }, { "docid": "a7caca12b11457732d92749696092682", "score": "0.6412505", "text": "func (b Bullet) ListDevices() (*Devices, error) {\n\tbody, err := b.get(b.baseURL + \"/devices\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer body.Close()\n\n\tvar result Devices\n\tdecoder := json.NewDecoder(body)\n\terrJSON := decoder.Decode(&result)\n\tif errJSON != nil {\n\t\treturn nil, errJSON\n\t}\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "557c07ce51fddbea6de2fa193d51886b", "score": "0.6348103", "text": "func (c *IotHubHTTPClient) ListDeviceIDs() (string, string) {\n\turl := fmt.Sprintf(\"%s/devices/query?api-version=%s\", c.hostName, apiVersion)\n\treturn c.performRequest(\"GET\", url, \"\")\n}", "title": "" }, { "docid": "78a0292169d6706164745c01e486b949", "score": "0.6344379", "text": "func listDevices(svc *devicefarm.DeviceFarm) {\n\n\tinput := &devicefarm.ListDevicesInput{}\n\tresp, err := svc.ListDevices(input)\n\n\tfailOnErr(err, \"error listing devices\")\n\t//fmt.Println(awsutil.Prettify(resp))\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Name\", \"Os\", \"Platform\", \"Form\", \"ARN\"})\n\ttable.SetAlignment(tablewriter.ALIGN_LEFT)\n\ttable.SetColWidth(50)\n\n\tfor _, m := range resp.Devices {\n\t\tline := []string{*m.Name, *m.Os, *m.Platform, *m.FormFactor, *m.ARN}\n\t\ttable.Append(line)\n\t}\n\ttable.Render() // Send output\n\n\t/*\n\t \t {\n\t ARN: \"arn:aws:devicefarm:us-west-2::device:A0E6E6E1059E45918208DF75B2B7EF6C\",\n\t CPU: {\n\t Architecture: \"ARMv7\",\n\t Clock: 2265,\n\t Frequency: \"MHz\"\n\t },\n\t FormFactor: \"PHONE\",\n\t HeapSize: 0,\n\t Image: \"NA\",\n\t Manufacturer: \"LG\",\n\t Memory: 17179869184,\n\t Model: \"G2\",\n\t Name: \"LG G2 (Sprint)\",\n\t Os: \"4.2.2\",\n\t Platform: \"ANDROID\",\n\t Resolution: {\n\t Height: 1920,\n\t Width: 1080\n\t }\n\t }\n\t*/\n\n}", "title": "" }, { "docid": "11639d801d6dcf2489ba82fc8a1d5d1e", "score": "0.6307724", "text": "func (*ListDevicesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_iot_v1_device_manager_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "2f4f206905759da292e7f0fd63522cb5", "score": "0.6305295", "text": "func Test_getAllDevices(t *testing.T) {\n\tserver, _, _ := setUpForGetSetTests(t)\n\n\tallDevicesPath := gnmi.Path{Elem: make([]*gnmi.PathElem, 0), Target: \"*\"}\n\n\trequest := gnmi.GetRequest{\n\t\tPath: []*gnmi.Path{&allDevicesPath},\n\t}\n\n\tresult, err := server.Get(context.TODO(), &request)\n\tassert.NoError(t, err)\n\n\tassert.Equal(t, len(result.Notification), 1)\n\tassert.Equal(t, len(result.Notification[0].Update), 1)\n\n\tassert.Equal(t, result.Notification[0].Update[0].Path.Target, \"*\")\n\n\tdeviceListStr := utils.StrVal(result.Notification[0].Update[0].Val)\n\tassert.Contains(t, deviceListStr, `{\n \"targets\": [\n \"Device1\",\n \"Device2\",\n \"Device3\"\n ]\n}`)\n}", "title": "" }, { "docid": "46f218f5011541b1cf7495b80e71a2e7", "score": "0.62999606", "text": "func (s *DevicesService) Devices(headers map[string]string, log logger.Logger) (response models.OperationResponseOfListOfDeviceTypeObject, err error) {\n\terr = s.client.apiReq(http.MethodPost, \"/devices\", nil, nil, &response, &headers, log)\n\treturn\n}", "title": "" }, { "docid": "d832b655bd9de11a3a2c1ffd804d13c3", "score": "0.61466384", "text": "func (r ListDeviceEventsRequest) Send() (*ListDeviceEventsOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*ListDeviceEventsOutput), nil\n}", "title": "" }, { "docid": "d2f32b36e3a48c0277abade65f52fb0f", "score": "0.6105067", "text": "func (c *Client) ListDevices() (devs []*Device, err error) {\n\tlines, err := c.roundTripSingleResponse(\"host:devices\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdevs = make([]*Device, 0)\n\tfor _, line := range strings.Split(lines, \"\\n\") {\n\t\tparts := strings.SplitN(line, \"\\t\", 2)\n\t\tif len(parts) != 2 {\n\t\t\tcontinue\n\t\t}\n\t\tdevs = append(devs, c.Device(DeviceWithSerial(parts[0])))\n\t}\n\treturn\n}", "title": "" }, { "docid": "d78ca25517d1195fc943bace9f9cb7da", "score": "0.6059886", "text": "func (ui *UI) ListDevices(getter device.DevicesInfoGetter) error {\n\treturn errors.New(\"Exporting devices list is not supported\")\n}", "title": "" }, { "docid": "64067bddffd8d55ec7c2b14c6ebc5021", "score": "0.6023974", "text": "func List(domain device.Interactor) func(*fiber.Ctx) {\n\treturn func(ctx *fiber.Ctx) {\n\t\trecords, err := domain.Read()\n\t\tif err != nil {\n\t\t\terrHTTP := ErrResponse(err)\n\t\t\tctx.Status(errHTTP.Status).JSON(errHTTP)\n\t\t\treturn\n\t\t}\n\t\tctx.Status(fiber.StatusOK).JSON(device.ListResponse(records))\n\t}\n}", "title": "" }, { "docid": "c71c7a8a1f3dcc0d28b13f97b11198f6", "score": "0.6019638", "text": "func GetDevices(client *http.Client, endpoint string) ([]DeviceInfo, error) {\n\tret := []DeviceInfo{}\n\n\tcontents, err := issueCommand(client, endpoint, \"/devices\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := json.Unmarshal(contents, &ret); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "1560646fd68c90f4634d617199ef2d4b", "score": "0.60046047", "text": "func (c *Client) GetDevices() (*http.Response, error) {\n\treturn c.GetWithAuth(\"/enduserAPI/setup/devices\")\n}", "title": "" }, { "docid": "28ab4ebf47017f1630e1f63624b81d50", "score": "0.5994096", "text": "func (o *GetV1DevicesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\t// return empty array\n\t\tpayload = make([]*models.Device, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "d531b559df21460d5d80ceae95e0352f", "score": "0.597992", "text": "func Devices(w http.ResponseWriter, req *http.Request) {\n\tvar d []pcap.Interface\n\td, err := pcap.FindAllDevs()\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"An error has been occurred while retrieving devices list: %s\", err.Error())\n\t\tlog.Println(msg)\n\t\thttp.Error(w, \"Cannot retrieve devices list.\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tdevices := models.Devices{d}\n\n\tsort.Slice(devices.Devices, func(i, j int) bool {\n\t\treturn devices.Devices[i].Name < devices.Devices[j].Name\n\t})\n\n\tjs, _ := json.Marshal(devices)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(js)\n}", "title": "" }, { "docid": "ed3125f979723987a19e66ebbb8796e0", "score": "0.59567016", "text": "func (client *DevicesClient) listByDeviceGroupHandleResponse(resp *http.Response) (DevicesClientListByDeviceGroupResponse, error) {\n\tresult := DevicesClientListByDeviceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.DeviceListResult); err != nil {\n\t\treturn DevicesClientListByDeviceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "a1054d19c9396350bbb9c6a9f472d235", "score": "0.5909026", "text": "func (a *ainBasedClient) listDevices() (*Devicelist, error) {\n\turl := a.homeAutoSwitch().\n\t\tquery(\"switchcmd\", \"getdevicelistinfos\").\n\t\tbuild()\n\tvar deviceList Devicelist\n\terrRead := httpread.XML(a.client.getf(url), &deviceList)\n\treturn &deviceList, errRead\n}", "title": "" }, { "docid": "d3cf3fd8b61891955dd1618bbda398e2", "score": "0.5879909", "text": "func (*ListDevicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_iot_v1_device_manager_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "72a855a338c3b41b69920ccf6b7d1950", "score": "0.5857002", "text": "func (r ListInputDevicesRequest) Send(ctx context.Context) (*ListInputDevicesResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &ListInputDevicesResponse{\n\t\tListInputDevicesOutput: r.Request.Data.(*ListInputDevicesOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "7970dacad7ffcc79d3bc573eb83db75f", "score": "0.583373", "text": "func ListDevices() {\n}", "title": "" }, { "docid": "5d3b86c600364645075755696f94d5d7", "score": "0.5822667", "text": "func (a *DefaultApiService) GetBoundDevicesExecute(r ApiGetBoundDevicesRequest) ([]GetBoundDevices200Response, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []GetBoundDevices200Response\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DefaultApiService.GetBoundDevices\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/{apiVersion}/reg/{sourceDeviceId}/account/devices\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"sourceDeviceId\"+\"}\", _neturl.PathEscape(parameterToString(r.sourceDeviceId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"apiVersion\"+\"}\", _neturl.PathEscape(parameterToString(r.apiVersion, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "142a960d7e421be6485e6afe63608c48", "score": "0.5820983", "text": "func (h *DataAPI) GetDevices(w http.ResponseWriter, r *http.Request) {\n\t// validate request\n\t// query := \"SELECT * FROM `%s` WHERE CreatedAt >= Timestamp(DATE_ADD(CURRENT_DATE(), INTERVAL -7 DAY)) ORDER BY CreatedAt;\"\n\t// iterator, err := h.bqClient.QueryTable(context.Background, query)\n\t// if err != nil {\n\t// \t// write error response\n\t// }\n\n\t// iterate through results\n\t// calculate values for dashboard\n\t// write response\n\n\t// success response\n\tresponse := ResponseMany{\n\t\tData: []*Data{\n\t\t\t{\n\t\t\t\tID: \"1\",\n\t\t\t\tAttributes: Summary{\n\t\t\t\t\tCategory: \"testCategory\",\n\t\t\t\t\tController: \"testController\",\n\t\t\t\t\tCurrentVolts: 1.5,\n\t\t\t\t\tStatus: \"down\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tjson.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "214b5a5f94e7319f48d0db57483427ed", "score": "0.5793459", "text": "func (*ListDeviceRegistriesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_iot_v1_device_manager_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "ea71215683437cf00becb0dfff79ca27", "score": "0.5755553", "text": "func (app *App) apiViewDevices(w http.ResponseWriter, r *http.Request) {\n\t// TODO better error handling in api\n\t// TODO better json objects\n\tdevices, err := app.Mongo.GetAllDevices()\n\tif err != nil {\n\t\tapp.APIServerError(w, err)\n\t\treturn\n\t}\n\n\t//renderTemplate(w, r, \"templates/devices.html\",\n\tdata := &APIData{Devices: devices}\n\n\tapp.ReturnAPI(w, r, data)\n}", "title": "" }, { "docid": "a4f77953c9061cd0e0b7b2c355da5b0f", "score": "0.5749619", "text": "func (c *Client) getDevices(action int) (*http.Response, error) {\n\treq, err := http.NewRequest(http.MethodGet, c.APIURL+\"/devices.json\", nil)\n\treq.Header.Add(\"Content-Type\", \"\\\"application/json\\\"\")\n\treq.Header.Add(\"Authorization\", c.Token)\n\n\tif action == Stream {\n\t\treq.Header.Set(\"Accept\", \"text/event-stream\")\n\t}\n\n\tresponse, err := httpClient.Do(req)\n\n\treturn response, err\n}", "title": "" }, { "docid": "6d6895d8d62c893dac95a043e6800fca", "score": "0.57369363", "text": "func (a *Client) GetDeviceList(params *GetDeviceListParams) (*GetDeviceListOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetDeviceListParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getDeviceList\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/device/devices\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetDeviceListReader{formats: a.formats},\n\t\tAuthInfo: a.authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetDeviceListOK), nil\n\n}", "title": "" }, { "docid": "82d8668c0a1606bd5e9f011aca833e17", "score": "0.57368606", "text": "func listDevices(volumeGroups ...string) (map[string]PmemDeviceInfo, error) {\n\targs := append(lvsArgs, volumeGroups...)\n\toutput, err := pmemexec.RunCommand(\"lvs\", args...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list volumes failed : %s(lvs output: %s)\", err.Error(), output)\n\t}\n\treturn parseLVSOuput(output)\n}", "title": "" }, { "docid": "908c06d7b476760b392e81161a6fcba5", "score": "0.5727473", "text": "func (s *DeviceService) ListDevices(channel string) ([]*Device, error) {\n\tu := fmt.Sprintf(\"channels/%s/devices\", url.PathEscape(channel))\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar devices []*Device\n\tif err = s.client.Do(req, &devices); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn devices, nil\n}", "title": "" }, { "docid": "917d260635089f30835deb92e2a64a5c", "score": "0.57216585", "text": "func (dl *deviceLister) List() (ret []*v1alpha1.Device, err error){\n\n\tfor _, obj :=range dl.indexer.List() {\n\t\tmeta, err := meta.Accessor(obj)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif len(meta.GetNamespace()) > 0 {\n\t\t\tif meta.GetNamespace() == dl.namespace {\n\t\t\t\tret= append(ret, obj.(*v1alpha1.Device))\n\t\t\t}\n\t\t}\n }\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "16d5ef185a4c743239aa0323aa2c85c7", "score": "0.5701982", "text": "func (d devices) List() []string {\n\tlist := make([]string, d.len)\n\n\tfor id, i := range d.lookup {\n\t\tlist[i] = id\n\t}\n\n\treturn list\n}", "title": "" }, { "docid": "fc821a554449331675d7a83eb085bb98", "score": "0.5680317", "text": "func (w *Web) getDevices(c *gin.Context) {\n\tskip, err := strconv.Atoi(c.Param(\"skip\"))\n\tlimit, err := strconv.Atoi(c.Param(\"limit\"))\n\tif err != nil {\n\t\tutils.Log().Infoln(\"web err\", err)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\tc.Abort()\n\t}\n\ttotal, err := w.ms.GetDevicesCount()\n\tif err != nil {\n\t\tinternalError(c, \"databse error\", \"web err \"+err.Error())\n\t}\n\tdevices, err := w.ms.GetAllDevices(skip, limit)\n\tjDev := model.Devices{}\n\tif err != nil {\n\t\tinternalError(c, \"databse error\", \"web err \"+err.Error())\n\t}\n\tjDev.Devices = devices\n\tjDev.Total = total\n\tjsonM, err := json.Marshal(&jDev)\n\tif err != nil {\n\t\tinternalError(c, \"marshaling error\",\n\t\t\t\"marshaling error \"+err.Error())\n\t}\n\tc.String(http.StatusOK, string(jsonM))\n}", "title": "" }, { "docid": "f047f9825089ba04a9f4e65c68de51e9", "score": "0.5662043", "text": "func (d *DeviceQueueAPI) List(ctx context.Context, req *pb.ListDeviceQueueItemsRequest) (*pb.ListDeviceQueueItemsResponse, error) {\n\tvar devEUI lorawan.EUI64\n\tif err := devEUI.UnmarshalText([]byte(req.DevEUI)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"devEUI: %s\", err)\n\t}\n\n\tif err := d.validator.Validate(ctx,\n\t\tauth.ValidateDeviceQueueAccess(devEUI, auth.List)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\tdevice, err := storage.GetDevice(common.DB, devEUI)\n\tif err != nil {\n\t\treturn nil, errToRPCError(err)\n\t}\n\n\titems, err := storage.GetDeviceQueueItems(common.DB, device.DevEUI)\n\tif err != nil {\n\t\treturn nil, errToRPCError(err)\n\t}\n\n\tvar resp pb.ListDeviceQueueItemsResponse\n\tfor _, item := range items {\n\t\tqi := pb.DeviceQueueItem{\n\t\t\tId: item.ID,\n\t\t\tReference: item.Reference,\n\t\t\tDevEUI: device.DevEUI.String(),\n\t\t\tConfirmed: item.Confirmed,\n\t\t\tPending: item.Pending,\n\t\t\tFPort: uint32(item.FPort),\n\t\t\tData: item.Data,\n\t\t}\n\t\tresp.Items = append(resp.Items, &qi)\n\t}\n\n\treturn &resp, nil\n}", "title": "" }, { "docid": "2d4fed26c255b965d3d068871a5ae68f", "score": "0.5659456", "text": "func (s *AppEngineService) ListGroupDevices(realm string, groupName string) ([]string, error) {\n\tcallURL, _ := url.Parse(s.appEngineURL.String())\n\tcallURL.Path = path.Join(callURL.Path, fmt.Sprintf(\"/v1/%s/groups/%s/devices\", realm, url.PathEscape(groupName)))\n\tdecoder, err := s.client.genericJSONDataAPIGET(callURL.String(), 200)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar responseBody struct {\n\t\tData []string `json:\"data\"`\n\t}\n\terr = decoder.Decode(&responseBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn responseBody.Data, nil\n}", "title": "" }, { "docid": "b61e03c350597b02d3cb233620422a67", "score": "0.56521356", "text": "func (client NamespacesClient) ListSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tazure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "8440e8ff5c504698bb4047dcb704939a", "score": "0.56452894", "text": "func (p *SyncSessionAPI) List(c *gin.Context) {\n\tresp := response.New(p.Engine, c)\n\n\tif resp.CheckAccess(resource.SyncSessionWrite) {\n\t\tresp.Status(http.StatusForbidden).Error(term.You_dont_have_permission).JSON()\n\t\treturn\n\t}\n\n\tparams := param.Get(c, p.Engine, thisSyncSessions)\n\n\tdata, err := p.Service.List(params)\n\tp.Engine.Debug(err)\n\tif err != nil {\n\t\tresp.Error(err).JSON()\n\t\treturn\n\t}\n\n\tresp.Status(http.StatusOK).\n\t\tMessageT(term.List_of_V, thisSyncSessions).\n\t\tJSON(data)\n}", "title": "" }, { "docid": "ac01c284f2ee68008938c62b79d19bc4", "score": "0.564227", "text": "func ListDevices(executor exec.Executor) ([]string, error) {\n\tdevices, err := executor.ExecuteCommandWithOutput(\"lsblk\", \"--all\", \"--noheadings\", \"--list\", \"--output\", \"KNAME\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list all devices: %+v\", err)\n\t}\n\n\treturn strings.Split(devices, \"\\n\"), nil\n}", "title": "" }, { "docid": "150d12fe86b3561afa84a88e853bd12a", "score": "0.56261915", "text": "func Test_getAllDevicesInPrefixPROTO(t *testing.T) {\n\tserver, _, _ := setUpForGetSetTests(t)\n\n\trequest := gnmi.GetRequest{\n\t\tPrefix: &gnmi.Path{Target: \"*\"},\n\t\tEncoding: gnmi.Encoding_PROTO,\n\t}\n\n\tresult, err := server.Get(context.TODO(), &request)\n\tassert.NoError(t, err)\n\n\tassert.Equal(t, len(result.Notification), 1)\n\tassert.Equal(t, len(result.Notification[0].Update), 1)\n\n\tdeviceListStr := utils.StrVal(result.Notification[0].Update[0].Val)\n\n\tassert.Contains(t, deviceListStr, \"Device1, Device2, Device3\")\n}", "title": "" }, { "docid": "158d4f48cbc377812d26ea244a2c3d4d", "score": "0.56198585", "text": "func GetDevices(db *sql.DB, req *message.DevicesRequest) (*sql.Rows, error) {\n\n\tdeviceStatus := req.GetStatus()\n\tlimit := req.GetLimit()\n\toffset := req.GetOffset()\n\n\tif limit > 100 || limit < 1 {\n\t\tlimit = 20\n\t}\n\tif offset < 0 {\n\t\toffset = 0\n\t}\n\n\tsql := `\n\t\tSELECT\n\t\t\tid,\n\t\t\tname,\n\t\t\tactive\n\t\tFROM\n\t\t\tpublic.devices\n\t\tORDER BY\n\t\t\tid\n\t\tLIMIT\n\t\t\t$1\n\t\tOFFSET\n\t\t\t$2\n\t`\n\n\tif deviceStatus == message.Status_ACTIVE {\n\t\tsql = `\n\t\tSELECT\n\t\t\tid,\n\t\t\tname,\n\t\t\tactive\n\t\tFROM\n\t\t\tpublic.devices\n\t\tWHERE\n\t\t\tdevices.active = true\n\t\tORDER BY\n\t\t\tid\n\t\tLIMIT\n\t\t\t$1\n\t\tOFFSET\n\t\t\t$2\n\t`\n\t\trow, err := db.Query(sql, limit, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn row, nil\n\t}\n\n\tif deviceStatus == message.Status_INACTIVE {\n\t\tsql = `\n\t\tSELECT\n\t\t\tid,\n\t\t\tname,\n\t\t\tactive\n\t\tFROM\n\t\t\tpublic.devices\n\t\tWHERE\n\t\t\tdevices.active = false\n\t\tORDER BY\n\t\t\tid\n\t\tLIMIT\n\t\t\t$1\n\t\tOFFSET\n\t\t\t$2\n\t`\n\t\trow, err := db.Query(sql, limit, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn row, nil\n\t}\n\n\trow, err := db.Query(sql, limit, offset)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn row, nil\n}", "title": "" }, { "docid": "6c2a29fdb6ee7a6a7f067fa1e1b1ed42", "score": "0.56194246", "text": "func webAPIListDeviceModels(w http.ResponseWriter, r *http.Request) {\n\tlistDeviceModels(w, r)\n}", "title": "" }, { "docid": "328a172e7d32fc849ad6dfd452f1c12c", "score": "0.5615953", "text": "func (t *targetDevices) List(targetId string) ([]models.SimulationTargetDevice, error) {\n\titems := make([]models.SimulationTargetDevice, 0)\n\tprefix := []byte(fmt.Sprintf(\"targetDevices-%s-\", targetId))\n\terr := t.store.list(prefix, func(k []byte, v []byte) error {\n\t\tvar device models.SimulationTargetDevice\n\t\terr := json.Unmarshal(v, &device)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to deserialize device %s: %w\", k, err)\n\t\t}\n\n\t\titems = append(items, device)\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "765e37efd610903ce88ad4f281ce0ffc", "score": "0.561277", "text": "func (client ServiceTagInformationClient) ListResponder(resp *http.Response) (result ServiceTagInformationListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "d120c3eda87d5a0e1cd8a4c11767a434", "score": "0.56083983", "text": "func (client WorkspacesClient) ListSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "88134629a3460172d9005c8352d65866", "score": "0.56078684", "text": "func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "8083555ed7aa572860d7de5047473a3d", "score": "0.560477", "text": "func (client Client) ListResponder(resp *http.Response) (result Limits, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "4ad5502abb0f492df96655760f373ba3", "score": "0.559539", "text": "func Test_getAllDevicesInPrefixJSON(t *testing.T) {\n\tserver, _, _ := setUpForGetSetTests(t)\n\n\trequest := gnmi.GetRequest{\n\t\tPrefix: &gnmi.Path{Target: \"*\"},\n\t}\n\n\tresult, err := server.Get(context.TODO(), &request)\n\tassert.NoError(t, err)\n\n\tassert.Equal(t, len(result.Notification), 1)\n\tassert.Equal(t, len(result.Notification[0].Update), 1)\n\n\tdeviceListStr := utils.StrVal(result.Notification[0].Update[0].Val)\n\n\tassert.Contains(t, deviceListStr, `{\n \"targets\": [\n \"Device1\",\n \"Device2\",\n \"Device3\"\n ]\n}`)\n}", "title": "" }, { "docid": "9a05bb919d2f1b0a67b2b9045b07367f", "score": "0.55906385", "text": "func (client Client) ListSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tazure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "f9ebc12c4f2e70030be004f32fae89a1", "score": "0.5574085", "text": "func (s *Server) List(messages *comm.EmptyMessage, stream comm.CommService_ListServer) error {\n\tlog.Infof(\"[Server List()]\\n\")\n\n\t// returning error will cause endless loop?\n\tdata, _ := s.storage.GetAll()\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\n\tfor _, d := range data {\n\t\tif err := stream.Send(&comm.Data{Body: d}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "baeca75444a4366f8b82c42a109790c9", "score": "0.5570422", "text": "func (client VaultsClient) ListResponder(resp *http.Response) (result ResourceListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "e9838c2e2aea4da85cdc04c87eed3729", "score": "0.55689436", "text": "func (client TransfersClient) ListResponder(resp *http.Response) (result TransferDetailsListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "fe6305639d856a7f7b41d2dc57d3a0ce", "score": "0.5565745", "text": "func (client AliasClient) ListResponder(resp *http.Response) (result AliasListResponse, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "f88255adc5840e593fa3bb15b9f346db", "score": "0.5560239", "text": "func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client,\n\t\treq,\n\t\tazure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "8d89ddb099d656ab077d2e20704da27d", "score": "0.5554799", "text": "func GetSNMPDevices(ctx *macaron.Context) {\n\tdevcfgarray, err := cfg.Database.GetSnmpDeviceCfgArray(\"\")\n\tif err != nil {\n\t\tctx.JSON(404, err)\n\t\tlog.Errorf(\"Error on get Devices :%+s\", err)\n\t\treturn\n\t}\n\tctx.JSON(200, &devcfgarray)\n\tlog.Debugf(\"Getting DEVICEs %+v\", &devcfgarray)\n}", "title": "" }, { "docid": "a4b1dda4fb0a19897ffd53ef7fa18744", "score": "0.5535916", "text": "func OnDeviceRegistration(message *api.DeviceRegistration, devices *device.DeviceCollection) *api.Response {\n var err error\n var response *api.Response\n\n dev, err := device.CreateDevice(device.NewDeviceInfo(message.DeviceName(), message.DeviceModel(), message.DeviceProtocol(), message.DeviceAddress(), message.DeviceExtra()))\n\n if err != nil {\n response = api.NewResponse([]error{err})\n log.Printf(\"Error registering device: %s\", err.Error())\n return response\n }\n\n if err = devices.Add(dev); err != nil {\n log.Printf(\"Error registering device: %s\", err.Error())\n response = api.NewResponse([]error{err})\n return response\n }\n\n if !dev.SupportsNetwork() {\n log.Printf(\"Successfully registered device: %s\", dev.Info().String())\n return api.NewResponse([]error{})\n }\n\n if err = dev.Connect(); err != nil {\n log.Printf(\"Error connecting to device %s: '%s'.\", dev.Info().String(), err.Error())\n return api.NewResponse([]error{err})\n }\n\n log.Printf(\"Device is connected %s\", dev.Info().String())\n return api.NewResponse([]error{})\n}", "title": "" }, { "docid": "f82e062faa5c6f70ec2afa5d1951cf11", "score": "0.55300903", "text": "func (client Client) ListSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "9ceca3659bd9978db6caa57a232feb49", "score": "0.5500135", "text": "func allDevices(c *gin.Context) {\n\t/*session, err := mgo.Dial(\"172.16.2.204\")\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t}*/\n\tsession := getSession()\n\tdefer session.Close()\n\tvar list []electronics\n\tpc := session.DB(\"inventory\").C(\"electronics\")\n\terr := pc.Find(bson.M{}).All(&list)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t} else {\n\t\tsort.Slice(list, func(i, j int) bool {\n\t\t\treturn list[i].Manufacturer < list[j].Manufacturer\n\t\t})\n\t\tc.HTML(http.StatusOK, \"devlist.html\", gin.H{\"devices\": list})\n\t}\n}", "title": "" }, { "docid": "ca2a7e1a51688cb65d6d4abed7eca11a", "score": "0.5492141", "text": "func (client ServiceTagInformationClient) ListSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "1cea956ab10c311bf13c46124681d55e", "score": "0.5486306", "text": "func (ph *PacketHelper) GetDevices(id string) (*packngo.Device, *packngo.Response, error) {\n\treturn ph.Client.Devices.Get(id, &packngo.GetOptions{})\n}", "title": "" }, { "docid": "5974c3a8c12e838bf7dc30a00909b4f4", "score": "0.54696786", "text": "func (client ServicesClient) ListMonitoringConfigurationsResponder(resp *http.Response) (result Items, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "6e2bc7b82b6c05d614a0a6f83786460a", "score": "0.54689306", "text": "func (client NetworkInterfaceClient) GetListResponder(resp *http.Response) (result NetworkInterfaceListResponse, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "cbda84e353659489c2e9f965758a8ced", "score": "0.54683334", "text": "func (client RecordSetsClient) ListResponder(resp *http.Response) (result RecordSetListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "17247cb787dcc83fbbc5dafa227eb025", "score": "0.54639393", "text": "func (c *DeviceController) Index(w http.ResponseWriter, r *http.Request) {\n\tc.SendJSON(\n\t\tw,\n\t\tr,\n\t\t[]*Device{NewDevice(\"host\", \"192.168.0.1\", \"80.80.80.80\")},\n\t\thttp.StatusOK,\n\t)\n}", "title": "" }, { "docid": "1fc8a38f3a5eb1a11bd782b8a4b29b2b", "score": "0.5461986", "text": "func NewDevicesListOK() *DevicesListOK {\n\treturn &DevicesListOK{}\n}", "title": "" }, { "docid": "b039d90c0bd3439ce05a2b9723dbd0d3", "score": "0.5460004", "text": "func (client ReportsClient) ListByProductSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "b46ae4a7524d6f278d8590733fe640fa", "score": "0.5455585", "text": "func (client VaultsClient) ListSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "a087079bfc519b99ecaac1e532a65225", "score": "0.5454407", "text": "func (client *IscsiDisksClient) listByDeviceHandleResponse(resp *http.Response) (IscsiDisksClientListByDeviceResponse, error) {\n\tresult := IscsiDisksClientListByDeviceResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ISCSIDiskList); err != nil {\n\t\treturn IscsiDisksClientListByDeviceResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "694a03b9b47b9aa51d5b4e2fcbf39a0a", "score": "0.5448843", "text": "func (gw *Gateway) ListDeviceIDs() ([]int, error) {\n\t// Get the /15001-route on the gateway, which corresponds to a route\n\t// that lists device ids for all the connected entities.\n\tresp, err := gw.client.send(\"/15001\", &coap.Message{\n\t\tType: coap.Confirmable,\n\t\tCode: coap.GET,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The response is an array of integers, so we do not need to specifiy\n\t// a special struct for this route.\n\tvar r []int\n\tif err = jsonDecode(resp.Payload, &r); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "20938480e872ed651013755ae15dba15", "score": "0.54455096", "text": "func (client WorkspacesClient) ListResponder(resp *http.Response) (result WorkspaceListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "94f1561fb082b4bf2ee7ccc1391eb7ae", "score": "0.5439252", "text": "func (client AliasClient) ListSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "f86f354df33ec2a39cedfb4d68afd4bc", "score": "0.5437407", "text": "func (b *Builder) List(res interface{}) error {\n\treturn b.driver.Query(&b.data, res)\n}", "title": "" }, { "docid": "f561d21355cff2f73e4126f8ece3f584", "score": "0.54296905", "text": "func (r ListDeploymentGroupsRequest) Send(ctx context.Context) (*ListDeploymentGroupsResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &ListDeploymentGroupsResponse{\n\t\tListDeploymentGroupsOutput: r.Request.Data.(*ListDeploymentGroupsOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "accd76b8f81233e35480249d8c39e99d", "score": "0.54225856", "text": "func (discoveryImpl) GetDeviceList() (ExportDeviceMap, error) {\n\tdiscoverymgrInfo.mapMTX.Lock()\n\tdefer discoverymgrInfo.mapMTX.Unlock()\n\n\tret := make(ExportDeviceMap)\n\tfor key, value := range discoverymgrInfo.orchestrationMap {\n\t\tret[key] = *value\n\t}\n\tif len(ret) == 0 {\n\t\terr := errors.NotFound{Message: errormsg.ToString(errormsg.ErrorNoDeviceReturn)}\n\t\treturn nil, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "256852cc3591ac5cba705212ee867251", "score": "0.54218584", "text": "func List(db *bolt.DB) (udids []string, err error) {\n\terr = db.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(\"device_serial\"))\n\t\tif b == nil {\n\t\t\treturn nil\n\t\t}\n\t\tb.ForEach(func(k, _ []byte) error {\n\t\t\tudids = append(udids, string(k))\n\t\t\treturn nil\n\t\t})\n\t\treturn nil\n\t})\n\tif len(udids) == 0 {\n\t\terr = errors.New(\"no devices in database\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "d95a7315972ed2e22da446bb0a9ba440", "score": "0.5420578", "text": "func (dm *DeviceManager) ListDevices() DeviceInfoMap {\n\tif klog.V(5) {\n\t\tdefer klog.Info(common.Etrace(\"-> \") + \" ->\")\n\t}\n\treturn devManager.devicesByDeviceID\n}", "title": "" }, { "docid": "a79ca4911285e5f3bbfb47be7318222e", "score": "0.54203546", "text": "func (client ReportsClient) ListByProductResponder(resp *http.Response) (result ReportCollection, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "8d1c36db63e7b1cc2e65c0ea56d2635a", "score": "0.54169524", "text": "func (c *listCmd) Execute(_ context.Context, _ *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {\n\t// Scan for the available drives. Warn that this may take a while.\n\tif c.json {\n\t\t// Turning on verbose will silence console output\n\t\tconsole.Verbose = true\n\t}\n\n\tconsole.Print(\"Searching for devices. This may take up to one minute...\\n\")\n\tdeck.InfoA(\"Searching for devices.\").With(deck.V(1)).Go()\n\tdevices, err := search(\"\", uint64(c.minSize*oneGB), uint64(c.maxSize*oneGB), !c.listFixed)\n\tif err != nil {\n\t\tdeck.Errorf(\"storage.Search(%d, %d, %t) returned %v\", c.minSize, c.maxSize, !c.listFixed, err)\n\t\treturn subcommands.ExitFailure\n\t}\n\t// Wrap devices in an []console.TargetDevice.\n\tavailable := []console.TargetDevice{}\n\tfor _, d := range devices {\n\t\tavailable = append(available, d)\n\t}\n\n\tconsole.PrintDevices(available, os.Stdout, c.json)\n\n\t// Provide contextual help for next steps.\n\tconsole.Printf(`\nUse the 'windows' subcommand to provision an installer on one, several, or all flash drives.\nExample #1 (Windows): Use '%s windows 1 2' to write a windows installer image to disk 1 and 2.\nExample #2 (Linux): Use '%s windows --all' to write a windows installer image to all suitable drives.\n\nFor additional examples, see the help for the windows subcommand, '%s help windows'.`, binaryName, binaryName, binaryName)\n\n\treturn subcommands.ExitSuccess\n}", "title": "" }, { "docid": "ccba33831742504fcf270edb929c960f", "score": "0.540759", "text": "func (client ServicesClient) ListResponder(resp *http.Response) (result Services, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "9ef69f3a5672b0e962fbb535a495c18e", "score": "0.53947896", "text": "func (c *client) FilterList(ctx context.Context, f *pb.DeviceFilterListRequest) ([]*pb.Device, error) {\n\tcli := c.getDeviceClient()\n\n\tclient, err := cli.FilterList(ctx, f)\n\n\tretDevs := make([]*pb.Device, 0)\n\n\tfor {\n\t\tdev, err := client.Recv()\n\t\tif err == io.EOF {\n\t\t\terr = nil\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn []*pb.Device{}, err\n\t\t}\n\n\t\tretDevs = append(retDevs, dev)\n\t}\n\n\treturn retDevs, err\n}", "title": "" }, { "docid": "565195a22eda7d26eb8b6241cc79dea4", "score": "0.5392497", "text": "func (*ListDeviceMsgResponse) Descriptor() ([]byte, []int) {\n\treturn file_src_grpc_ipam_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "8c981bbc6dd9c180fc57a71e48fe05f6", "score": "0.53902745", "text": "func (client ServicesClient) ListSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "b3c2912135a11ed82991f7e83666f8f5", "score": "0.5377139", "text": "func (client RecordSetsClient) ListSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "b28c9a908c6e9571530fc1e666673c67", "score": "0.53717744", "text": "func (client ComputeNodeClient) ListResponder(resp *http.Response) (result ComputeNodeListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "6c0529da024b0abaea5b1f1c3f39513f", "score": "0.5369801", "text": "func (t *Apron) ListDevices() []ApronDeviceGroup {\n\targs := []string{\"-l\"}\n\trunnable := exec.Command(\"aprontest\", args...)\n\tstdout, err := runnable.Output()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tstdout = []byte{}\n\t}\n\n\tdevices := []ApronDeviceGroup{}\n\tlines := strings.Split(string(stdout), \"\\n\")\n\tfor i, line := range lines {\n\t\t// Skip the first two lines of the output\n\t\tif i < 2 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check for correct number of fields\n\t\tdeviceInfo := strings.Split(line, \"|\")\n\t\tif len(deviceInfo) < 2 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Parse the id, and select the name\n\t\tid, err := strconv.ParseInt(strings.TrimSpace(deviceInfo[0]), 10, 64)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tname := strings.TrimSpace(deviceInfo[2])\n\t\tdevices = append(devices, ApronDeviceGroup{ID: id, Name: name})\n\t}\n\n\treturn devices\n}", "title": "" }, { "docid": "e80812e67b849c26a8d302c912e9f40b", "score": "0.5369161", "text": "func (client WorkspacesClient) ListUsagesResponder(resp *http.Response) (result WorkspaceListUsagesResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "15a52859b4f8cc8195dcfbabf608178f", "score": "0.5366093", "text": "func (h *Hub) listRequest(userID int32, conn net.Conn) {\n\th.lock.RLock()\n\tids := make([]int32, 0, len(h.subscribers))\n\tfor id := range h.subscribers {\n\t\tif id != userID {\n\t\t\tids = append(ids, id)\n\t\t}\n\t}\n\th.lock.RUnlock()\n\n\tlistResp := &messages.ListResponse{\n\t\tIds: ids,\n\t}\n\n\tbytes, err := messages.Encode(listResp, messages.MsgTypeListResponse)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"ListResponse marshalling failed, %s\", err))\n\t}\n\tconn.Write(bytes)\n\n}", "title": "" }, { "docid": "40d4cbb8b7a98244e4cd1b49800d006e", "score": "0.53643066", "text": "func (d *openebsDriver) List(req volumeplugin.Request) volumeplugin.Response {\n\tvar res volumeplugin.Response\n\tls, err := d.d.List()\n\tif err != nil {\n\t\tres.Err = err.Error()\n\t\treturn res\n\t}\n\tvols := make([]*volumeplugin.Volume, len(ls))\n\n\tfor i, v := range ls {\n\t\tvol := &volumeplugin.Volume{\n\t\t\tName: v.Name(),\n\t\t\tMountpoint: v.Path(),\n\t\t}\n\t\tvols[i] = vol\n\t}\n\tres.Volumes = vols\n\treturn res\n}", "title": "" }, { "docid": "84d6cc446e1aecaa5417337cfaff2b05", "score": "0.53519845", "text": "func (s *Conn) SendList(nodeType fields.NodeType, quantity int, timeoutChan <-chan time.Time) (Response, error) {\n\top := ListVerb\n\tresultChan, messageID, err := s.SendListAsync(nodeType, quantity)\n\treturn s.handleExpectedResponse(op, resultChan, messageID, err, timeoutChan)\n}", "title": "" }, { "docid": "5fc96ce58a83486b3c83477bc57b90e3", "score": "0.5350948", "text": "func (client ReportsClient) ListByAPISender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "938ea083bf37db2159652006d24eb533", "score": "0.53506637", "text": "func (rd *RbdDriver) List() (*volume.ListResponse, error) {\n\tlog.Debug(\"List\")\n\tlog := log.WithField(\"pool\", rd.pool.Name())\n\n\tmutexMapMutex.Lock()\n\tdefer mutexMapMutex.Unlock()\n\timgs, err := rd.pool.Images()\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"error in driver list\")\n\t\treturn nil, fmt.Errorf(\"error in driver list for %v: %w\", rd.pool.Name(), err)\n\t}\n\tvols := make([]*volume.Volume, 0, len(imgs))\n\tfor _, img := range imgs {\n\t\tvols = append(vols, &volume.Volume{Name: img.Name()})\n\t}\n\n\treturn &volume.ListResponse{Volumes: vols}, nil\n}", "title": "" }, { "docid": "6c0500abf04e7e5b3e524f99228db4a4", "score": "0.5349359", "text": "func (ngm *nvidiaGPUManager) ListAndWatch(emtpy *pluginapi.Empty, stream pluginapi.DevicePlugin_ListAndWatchServer) error {\n\tglog.Infoln(\"device-plugin: ListAndWatch start\")\n\tchanged := true\n\tfor {\n\t\tfor id, dev := range ngm.devices {\n\t\t\tstate := ngm.GetDeviceState(id)\n\t\t\tif dev.Health != state {\n\t\t\t\tchanged = true\n\t\t\t\tdev.Health = state\n\t\t\t\tngm.devices[id] = dev\n\t\t\t}\n\t\t}\n\t\tif changed {\n\t\t\tresp := new(pluginapi.ListAndWatchResponse)\n\t\t\tfor _, dev := range ngm.devices {\n\t\t\t\tresp.Devices = append(resp.Devices, &pluginapi.Device{dev.ID, dev.Health})\n\t\t\t}\n\t\t\tglog.Infof(\"ListAndWatch: send devices %v\\n\", resp)\n\t\t\tif err := stream.Send(resp); err != nil {\n\t\t\t\tglog.Errorf(\"device-plugin: cannot update device states: %v\\n\", err)\n\t\t\t\tngm.grpcServer.Stop()\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tchanged = false\n\t\ttime.Sleep(5 * time.Second)\n\t}\n}", "title": "" }, { "docid": "a113bafb45ad67b39332bbce4ca42f0f", "score": "0.534851", "text": "func (w *WebboxClient) GetDevices() (DevicesResponse, error) {\n\n\tvar deviceRequest = w.newGenericRequest(\"GetDevices\")\n\n\tresponse, _, err := w.ApiClient.DeviceApi.GetDevices(nil, *deviceRequest)\n\n\treturn response, err\n}", "title": "" }, { "docid": "64806301d143f514eda678be9151b6d7", "score": "0.53467524", "text": "func (client WorkspacesClient) ListUsagesSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "2a5743170a51e7667437a222830c0c5e", "score": "0.5333712", "text": "func (client NamespacesClient) ListAllSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tazure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "4a76137e374722d3f0a9dc75f93fa99f", "score": "0.53317124", "text": "func (*CHIDMessageFromRemote_UpdateDeviceList) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_hiddevices_proto_rawDescGZIP(), []int{3, 0}\n}", "title": "" }, { "docid": "1142d520a5adcefb8aae956a979d409d", "score": "0.5318359", "text": "func (client Client) ListSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "24ad3e07e6aed4ae6137044d4750df5e", "score": "0.5316952", "text": "func (client NamespacesClient) ListResponder(resp *http.Response) (result NamespaceListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "84debfcb0a60d7e6689ca0a6616db9f8", "score": "0.5316188", "text": "func (b *DriveRequestBuilder) List() *ListRequestBuilder {\n\tbb := &ListRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/list\"\n\treturn bb\n}", "title": "" } ]
f0893bbcf14170b1331f84866d7a3e8a
MarshalJSON converts Time to a RFC3339 byte arry
[ { "docid": "fd31184d24990bf33cbb10781f57540a", "score": "0.73568684", "text": "func (t *Time) MarshalJSON() ([]byte, error) {\n\treturn []byte(`\"` + t.Time.Format(time.RFC3339) + `\"`), nil\n}", "title": "" } ]
[ { "docid": "0dffbc4341a13221d081a8f52bd2c42d", "score": "0.772729", "text": "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", time.Time(t).Format(\"2006-01-02T15:04:05.999999\"))\n\treturn []byte(stamp), nil\n}", "title": "" }, { "docid": "9b0099b7a33d81c544994580d13d57a7", "score": "0.771563", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\ttm := time.Time(t)\n\tsecond := tm.Unix()\n\tmillis := int64(tm.Nanosecond()) / int64(time.Millisecond)\n\ttimestamp := millis + (second * 1000)\n\treturn []byte(fmt.Sprintf(\"%d\", timestamp)), nil\n}", "title": "" }, { "docid": "3ccb7fb0a3c42980066c06946f5869b8", "score": "0.76318085", "text": "func (t *Time) MarshalJSON() ([]byte, error) {\n\tsecs := time.Time(*t).Unix()\n\treturn []byte(strconv.FormatInt(secs, 10)), nil\n}", "title": "" }, { "docid": "4d4b6241a99aa8da28e34577ef02601b", "score": "0.762592", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn []byte(time.Time(t).Format(\"\\\"2006-01-02T15:04:05.000-0700\\\"\")), nil\n}", "title": "" }, { "docid": "ad9e13d66b08928ccce5275d42141f50", "score": "0.75869924", "text": "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", time.Time(t).Format(time.RFC3339))\n\treturn []byte(stamp), nil\n}", "title": "" }, { "docid": "1dbebb06f37a2740bdd8c87d6a40029f", "score": "0.75675076", "text": "func (t *Time) MarshalJSON() ([]byte, error) {\n\tstr := t.Format(jsonRFC1123Z)\n\treturn []byte(str), nil\n}", "title": "" }, { "docid": "2734fd31b9143684688e827ecdc124e2", "score": "0.754948", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(t.Time().Unix())\n}", "title": "" }, { "docid": "05a3ed98d162bd7def33c854868293ca", "score": "0.75030625", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn []byte(`\"` + t.Time.Format(time.RFC3339) + `\"`), nil\n}", "title": "" }, { "docid": "1a75ccbb59f0f9043d35b50185ed61b6", "score": "0.7481187", "text": "func (t *JSONTime) MarshalJSON() ([]byte, error) {\n\t//do your serializing here\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", time.Now().Format(\"2006-01-02T15:04:05Z07:00\"))\n\treturn []byte(stamp), nil\n}", "title": "" }, { "docid": "bd521cfb9ed42336bb894281668045c9", "score": "0.743439", "text": "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\tformatted := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(\"2006-01-02 15:04:05\"))\n\treturn []byte(formatted), nil\n}", "title": "" }, { "docid": "c09871c736ab56bfe4e381675ebcff67", "score": "0.74243814", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\tif t.IsZero() {\n\t\t// Encode unset/nil objects as JSON's \"null\".\n\t\treturn []byte(\"null\"), nil\n\t}\n\n\treturn json.Marshal(t.UTC().Format(time.RFC3339))\n}", "title": "" }, { "docid": "3cc21837cac490a47cdf1767836355df", "score": "0.74207413", "text": "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\tif int64(t) <= 0 {\n\t\treturn []byte(`\"\"`), nil\n\t}\n\treturn []byte(fmt.Sprintf(`\"%s\"`, time.Unix(int64(t), 0).Format(\"2006-01-02 15:04:05\"))), nil\n}", "title": "" }, { "docid": "828a72dd758ea561039b3ac3c6772d91", "score": "0.7407511", "text": "func (nt Time) MarshalJSON() ([]byte, error) {\n\tt := time.Time(nt).Local()\n\n\tif y := t.Year(); y < 0 || y >= 10000 {\n\t\t// RFC 3339 is clear that years are 4 digits exactly.\n\t\t// See golang.org/issue/4556#c15 for more discussion.\n\t\treturn nil, errors.New(\"Time.MarshalJSON: year outside of range [0,9999]\")\n\t}\n\n\tb := make([]byte, 0, len(time.RFC3339)+2)\n\tb = append(b, '\"')\n\tif !t.IsZero() {\n\t\tb = t.AppendFormat(b, time.RFC3339)\n\t}\n\tb = append(b, '\"')\n\treturn b, nil\n}", "title": "" }, { "docid": "0a5cfb5705208b15476351ab3fee830a", "score": "0.7375341", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(t.Time)\n}", "title": "" }, { "docid": "9bac81a841ffe0ccbfa21729439f25d9", "score": "0.73543495", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn []byte(`\"` + t.String() + `\"`), nil\n}", "title": "" }, { "docid": "c0d06128837a478494dfbce6612b5bb1", "score": "0.7352272", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn time.Time(t).MarshalJSON()\n}", "title": "" }, { "docid": "2be6456b0001ac44320c25fed1466a6d", "score": "0.7351696", "text": "func (t *Time) MarshalJSON() ([]byte, error) {\n\tif t == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn json.Marshal(time.Time(*t).Format(time.RFC3339))\n}", "title": "" }, { "docid": "bc0516a1e1026976d0905c8da4c6b2d6", "score": "0.7335654", "text": "func (t *Time) MarshalJSON() ([]byte, error) {\n\tif *t == Time(time.Time{}) {\n\t\treturn []byte(\"null\"), nil\n\t}\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", time.Time(*t).Format(zohoTimeLayout))\n\treturn []byte(stamp), nil\n}", "title": "" }, { "docid": "c241394f1aa8130473ecaa44460e422c", "score": "0.7324115", "text": "func (t *ISO8601Time) MarshalJSON() ([]byte, error) {\n\tstamp := fmt.Sprintf(`\"%s\"`, time.Time(*t).Format(Layout))\n\treturn []byte(stamp), nil\n}", "title": "" }, { "docid": "177ba753043b6c8daa0bd08970ca3615", "score": "0.73227704", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn []byte(t.String()), nil\n}", "title": "" }, { "docid": "177ba753043b6c8daa0bd08970ca3615", "score": "0.73227704", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn []byte(t.String()), nil\n}", "title": "" }, { "docid": "ec36a594d3df27c973df2511778a247c", "score": "0.7277736", "text": "func (t Time) MarshalJSON() ([]byte, error) {\n\tif !t.Valid {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn t.Time.MarshalJSON()\n}", "title": "" }, { "docid": "86247793f1f796711ff1a9532a30f67e", "score": "0.7259551", "text": "func (t *Time) MarshalJSON() ([]byte, error) {\n\tswitch t.format {\n\tcase \"\": return nil, nil\n\tcase \"Unix\": return json.Marshal(t.time.Unix())\n\tcase \"Absolute\": return json.Marshal(t.AbsoluteTime())\n\tcase \"Relative\": return json.Marshal(t.string)\n\tdefault: return json.Marshal(t.time.Unix())\n\t}\n}", "title": "" }, { "docid": "012aaf31f67e0a1ac16ea5f5c3dcbfe8", "score": "0.72156703", "text": "func (t *Time) MarshalJSON() ([]byte, error) {\n\tvar buildbotFormat *float64\n\tif !t.Time.IsZero() {\n\t\tusec := t.Time.Nanosecond() / 1e3\n\t\t// avoid dividing big floating numbers\n\t\tv := float64(t.Time.Unix()) + float64(usec)/1e6\n\t\tbuildbotFormat = &v\n\t}\n\treturn json.Marshal(&buildbotFormat)\n}", "title": "" }, { "docid": "3211cccac5a7e98bc06deed991d41655", "score": "0.71690863", "text": "func (t *TimeAPI) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(t.S.UNIX())\n}", "title": "" }, { "docid": "99adfcc3cf610b8412c994abc5f676c5", "score": "0.70541817", "text": "func (t JSONMiddleTime) MarshalJSON() ([]byte, error) {\n\tif int64(t) <= 0 {\n\t\treturn []byte(`\"\"`), nil\n\t}\n\treturn []byte(fmt.Sprintf(`\"%s\"`, time.Unix(int64(t), 0).Format(\"2006-01-02 15:04\"))), nil\n}", "title": "" }, { "docid": "ff8702b90f44153f1bd612a5bfd0cc17", "score": "0.70061815", "text": "func (t ISOTime) MarshalJSON() ([]byte, error) {\n\tvar nilTime = (time.Time{}).UnixNano()\n\tif time.Time(t).UnixNano() == nilTime {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn []byte(fmt.Sprintf(\"\\\"%s\\\"\", time.Time(t).UTC().Format(ISOTimeFormat))), nil\n}", "title": "" }, { "docid": "811ee966b33553cf5ec0a5d0e89471e5", "score": "0.70004267", "text": "func (t QueryTime) MarshalJSON() ([]byte, error) {\n\tstamp := fmt.Sprintf(\"\\\"%.3fms\\\"\", t)\n\treturn []byte(stamp), nil\n}", "title": "" }, { "docid": "c807b5cfc6795016f5433908ea513728", "score": "0.69844294", "text": "func (t *FormattedTime) MarshalJSON() ([]byte, error) {\n\tif t.Time.UnixNano() == nilTime {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn []byte(fmt.Sprintf(\"\\\"%s\\\"\", t.Time.Format(DatePattern))), nil\n}", "title": "" }, { "docid": "21e242caed9f71e9eec0cdb7129f98f7", "score": "0.6903803", "text": "func (t *SuriTime) MarshalJSON() ([]byte, error) {\n\treturn []byte(\"\\\"\" + t.Time.Format(SuricataTimestampFormat) + \"\\\"\"), nil\n}", "title": "" }, { "docid": "6568ab971dff38c64f7f67fe5d9c337a", "score": "0.6847811", "text": "func (t DateTime) MarshalJSON() ([]byte, error) {\n\tval := time.Time(t).Format(JSTimeFormat)\n\treturn json.Marshal(val)\n}", "title": "" }, { "docid": "7b658bafd0a8e9fbb93992d458f1a4ec", "score": "0.6799561", "text": "func (dbt DBTime) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(time.Time(dbt).Format(DateFormat))\n}", "title": "" }, { "docid": "37bc9de7a20b553b9c9c644ae958727e", "score": "0.6756157", "text": "func (nt *NullTime) MarshalJSON() ([]byte, error) {\n\tif !nt.Valid {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn json.Marshal(nt.Time)\n}", "title": "" }, { "docid": "2c4d60b3c45e0f60b07c86ac3a7ced8f", "score": "0.67255914", "text": "func (t NullTime) MarshalJSON() ([]byte, error) {\n\tif !t.Valid {\n\t\treturn nil, nil\n\t}\n\n\treturn t.Time.MarshalJSON()\n}", "title": "" }, { "docid": "31ae7177141127fc8e0c25ec2c869f3f", "score": "0.671481", "text": "func (t NanoTime) MarshalJSON() ([]byte, error) {\n\treturn []byte(strconv.Quote(t.String())), nil\n}", "title": "" }, { "docid": "c586bd0730c65fc947383183f209471f", "score": "0.6694413", "text": "func (l LocalTime) MarshalJSON() ([]byte, error) {\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", time.Time(l).Format(\"2006-01-02 15:04:05\"))\n\treturn []byte(stamp), nil\n}", "title": "" }, { "docid": "b20c2a43a3057de35ab1e47696dbb7c3", "score": "0.6689797", "text": "func (j JSONLastPassTime) MarshalJSON() ([]byte, error) {\n\treturn []byte(`\"` + j.Format() + `\"`), nil\n}", "title": "" }, { "docid": "76c1d36d317043fe3c2d8e966be6ca59", "score": "0.668265", "text": "func TestTimeAPI_MarshalJSON(t *testing.T) {\n\ttests := []struct {\n\t\ttestName string\n\t\ttimeAPI TimeAPI\n\t\twant []byte\n\t\twantErr bool\n\t}{\n\t\t{\n\t\t\ttestName: \"ok\",\n\t\t\ttimeAPI: NewTimeAPIFromUNIX(1454954400),\n\t\t\twant: []byte(`1454954400`),\n\t\t\twantErr: false,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.testName, func(t *testing.T) {\n\t\t\tgot, err := tt.timeAPI.MarshalJSON()\n\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\tt.Errorf(\"TimeAPI.MarshalJSON() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(got, tt.want) {\n\t\t\t\tt.Errorf(\"TimeAPI.MarshalJSON() = %v, want %v\", string(got), string(tt.want))\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e8de96874ba91ee6f57c771ed6492a8c", "score": "0.6662159", "text": "func (t JSONTime) MarshalText() ([]byte, error) {\n\tif time.Time(t).IsZero() || time.Time(t).Unix() == 0 {\n\t\treturn []byte{}, nil\n\t}\n\tstamp := time.Time(t).UTC().Format(time.RFC3339Nano)\n\treturn []byte(stamp), nil\n}", "title": "" }, { "docid": "59c8b34edd644c84e9d4f3624a388ffa", "score": "0.663133", "text": "func (v Timesync) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonFa90ddaeEncodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsUalberta8(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "b0568db37a20cad1c6b09fa92b92c431", "score": "0.6609928", "text": "func (nt NullTime) MarshalJSON() ([]byte, error) {\n\tif nt.Valid {\n\t\treturn json.Marshal(nt.Time)\n\t}\n\treturn []byte(\"null\"), nil\n}", "title": "" }, { "docid": "96ef936ed6914c74a3a7ccd4b13c6d82", "score": "0.6603227", "text": "func (v SystemTime) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonFa90ddaeEncodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsUalberta13(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "c836dbb6913a27a3ff72bed90445b54c", "score": "0.6600071", "text": "func (t JSONShortTime) MarshalJSON() ([]byte, error) {\n\tif int64(t) <= 0 {\n\t\treturn []byte(`\"\"`), nil\n\t}\n\treturn []byte(fmt.Sprintf(`\"%s\"`, time.Unix(int64(t), 0).Format(\"2006-01-02\"))), nil\n}", "title": "" }, { "docid": "d12bcde29f9d5047612ba1d2130abeed", "score": "0.6583147", "text": "func (t DatabaseTime) MarshalJSON() ([]byte, error) {\n\tformatted := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(defaultDateTimeFormat))\n\treturn []byte(formatted), nil\n}", "title": "" }, { "docid": "261c5e3a47f2ba0f97255bcdd4ad3065", "score": "0.6557321", "text": "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\treturn []byte(t.FormatTime()), nil\n}", "title": "" }, { "docid": "014368396ff7788f1dd2d1255efb3321", "score": "0.65178746", "text": "func (v Timesync) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonFa90ddaeEncodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsUalberta8(w, v)\n}", "title": "" }, { "docid": "b48279252f2206be433f39ab19b004e5", "score": "0.6483524", "text": "func (v Timestamp) MarshalJSON() ([]byte, error) {\n\tif !v.Valid() {\n\t\treturn json.Marshal(nil)\n\t}\n\treturn []byte(strconv.FormatInt(v.Time.Unix(), 10)), nil\n}", "title": "" }, { "docid": "4c484d38ffc9e2383c2b28facf688046", "score": "0.6444748", "text": "func RFC3369TimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) {\n\tenc.AppendString(t.Format(time.RFC3339))\n}", "title": "" }, { "docid": "c27d5915988b10ebc61d8024f6fb5bf7", "score": "0.64384365", "text": "func timeEncoder() zapcore.TimeEncoder {\n\treturn func(t time.Time, enc zapcore.PrimitiveArrayEncoder) {\n\t\tenc.AppendString(t.Format(time.RFC3339Nano))\n\t}\n}", "title": "" }, { "docid": "17160cdf43bb9f2e619721be9d1a69a1", "score": "0.6427978", "text": "func (n *NullTime) MarshalJSON() ([]byte, error) {\n\tif n.Valid {\n\t\tj, e := json.Marshal(n.Time)\n\t\treturn j, e\n\t}\n\treturn nullString, nil\n}", "title": "" }, { "docid": "54d6ed86bfe742942865095ce2e03ecf", "score": "0.64249617", "text": "func (pt *PoolerTime) MarshalJSON() ([]byte, error) {\n\tif pt.Time.UnixNano() == nilTime {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn []byte(fmt.Sprintf(\"\\\"%s\\\"\", pt.Time.Format(poolerTimeLayout))), nil\n}", "title": "" }, { "docid": "d2f82aa06965b00f92cf73e1a20541d2", "score": "0.639939", "text": "func JSONUtcTimestampFromTime(t time.Time) string {\n\treturn t.Format(time.RFC3339)\n}", "title": "" }, { "docid": "623b32386c07ec2f939ca3fd1b8b4d44", "score": "0.639883", "text": "func (t TimestampOrNow) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(t.Value)\n}", "title": "" }, { "docid": "9d1243f12608dd46c2790bcab8dc732c", "score": "0.63926977", "text": "func (o WidgetTime) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.UnparsedObject != nil {\n\t\treturn json.Marshal(o.UnparsedObject)\n\t}\n\tif o.LiveSpan != nil {\n\t\ttoSerialize[\"live_span\"] = o.LiveSpan\n\t}\n\n\tfor key, value := range o.AdditionalProperties {\n\t\ttoSerialize[key] = value\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "3024ef3917fff4236e831e205c82b254", "score": "0.63900733", "text": "func (v SystemTime) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonFa90ddaeEncodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsUalberta13(w, v)\n}", "title": "" }, { "docid": "d7fbb3436d6587ce6c0fca3e7371947b", "score": "0.6322944", "text": "func (d *DateTime) MarshalJSON() ([]byte, error) {\n\tif SchemaVersion == 1 {\n\t\treturn json.Marshal(d.Sub(AppleEpochTime).Seconds())\n\t}\n\treturn json.Marshal(d.Format(ISO8601))\n}", "title": "" }, { "docid": "82d9f7bffcba97da620f37b59fd2d620", "score": "0.6298792", "text": "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\tstdTime, err := types.TimestampFromProto(&t.Timestamp)\n\tif err != nil {\n\t\treturn []byte(\"null\"), err\n\t}\n\tif stdTime.Equal(time.Unix(0, 0)) {\n\t\treturn json.Marshal(\"\")\n\t}\n\treturn json.Marshal(stdTime.Format(time.RFC3339Nano))\n}", "title": "" }, { "docid": "26ebfdc21096299692d58da39a998c0f", "score": "0.6296661", "text": "func (b BCTime) MarshalJSON() (text []byte, err error) {\n\tif b.t == nil || b.t.IsZero() {\n\t\treturn []byte(`\"\"`), nil\n\t}\n\ts := b.t.Format(time.RFC1123Z)\n\treturn []byte(strconv.Quote(s)), nil\n}", "title": "" }, { "docid": "e6f9df38e7c4f7265cd56033d3728f47", "score": "0.62850744", "text": "func MarshalTimeRFC3339Nano(tt time.Time) graphql.Marshaler {\n\treturn graphql.WriterFunc(func(w io.Writer) {\n\t\tts := utils.FormatTimeRFC3339(&tt)\n\t\t_, _ = w.Write([]byte(fmt.Sprintf(`\"%s\"`, ts)))\n\t})\n}", "title": "" }, { "docid": "7f2da74f9122a160891d769ecd4602a7", "score": "0.62517303", "text": "func (t Date) MarshalJSON() ([]byte, error) {\n\ttime := time.Time(t)\n\treturn []byte(time.Format(\"\\\"2006-01-02\\\"\")), nil\n}", "title": "" }, { "docid": "a3f17dd911ab26627063a9075ef41ee7", "score": "0.62494606", "text": "func (t NaiveDateTime) MarshalJSON() ([]byte, error) {\n\tif _, offset := t.Zone(); offset != 0 {\n\t\treturn nil, fmt.Errorf(\"time offset %d not allowed. You can call .UTC() on the time provided to reset the offset\", offset)\n\t}\n\n\treturn json.Marshal(t.Format(\"2006-01-02T15:04:05\"))\n}", "title": "" }, { "docid": "715ef1b5dfda528b63523630d3411d34", "score": "0.6187147", "text": "func (t QueryStart) MarshalJSON() ([]byte, error) {\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", time.Time(t).Format(\"15:04:05\"))\n\treturn []byte(stamp), nil\n}", "title": "" }, { "docid": "6b3bf00be2c28e8157e4d2e0d2730a07", "score": "0.61823076", "text": "func (t Epoch) MarshalJSON() ([]byte, error) {\n\treturn []byte(strconv.FormatInt(t.Unix(), 10)), nil\n}", "title": "" }, { "docid": "9bcc1084a0e33c73a35e2559ec88ecc0", "score": "0.6166364", "text": "func (ts snsTimestamp) MarshalJSON() ([]byte, error) {\n\ttimestamp := int64(ts)\n\tmillis := time.Unix(0, timestamp).UnixNano()\n\tb := []byte(strconv.FormatInt(millis, 10))\n\treturn b, nil\n}", "title": "" }, { "docid": "06dfe2ab6ba75198146c5b56d76ed44a", "score": "0.6148648", "text": "func MarshalTime(t time.Time) int64 {\n\tif t.IsZero() {\n\t\treturn 0\n\t}\n\treturn t.UnixNano()\n}", "title": "" }, { "docid": "918dc41d5df7fef0cc115bad92a1f61e", "score": "0.6122575", "text": "func (t RuntimeTimestamp) MarshalJSON() ([]byte, error) {\n\tif t == 0 {\n\t\treturn []byte(\"null\"), nil\n\t}\n\tf := float64(t)\n\treturn json.Marshal(&f)\n}", "title": "" }, { "docid": "ba9a8735e966b81948ea87b1077f9d6d", "score": "0.61203325", "text": "func (c *Clock) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(int64(time.Duration(*c) / time.Millisecond))\n}", "title": "" }, { "docid": "bb7783f1aec5b42af8fc263cda64bc5f", "score": "0.61117285", "text": "func (t *DateRFC2822) MarshalJSON() ([]byte, error) {\n\tepoch := time.Time(*t).Unix()\n\tif (epoch < 0) || t == nil {\n\t\treturn []byte(`\",omitempty\"`), nil\n\t}\n\n\tstamp := fmt.Sprint(epoch)\n\treturn []byte(stamp), nil\n}", "title": "" }, { "docid": "b0a9419213936b312e325fa5245cc9ac", "score": "0.6111673", "text": "func (d Date) MarshalJSON() ([]byte, error) {\n\tresult, err := d.Time.MarshalJSON()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "69c1f618a6a8cff593a4cd4a4b20de01", "score": "0.6110179", "text": "func (n DateTime) MarshalJSON() ([]byte, error) {\r\n\tif n.Int64 == 0 {\r\n\t\treturn []byte(strconv.Quote(\"\")), nil\r\n\t}\r\n\tnsec := int64(n.TimezoneOffset * 6E10)\r\n\tt := time.Unix(0, n.Int64-nsec).In(time.FixedZone(\"\", -n.TimezoneOffset))\r\n\tif n.Relative {\r\n\t\tx := n.formatRelative(t)\r\n\t\treturn []byte(strconv.Quote(x)), nil\r\n\t}\r\n\ts := strconv.Quote(t.Format(n.dateTimeFormat()))\r\n\treturn []byte(s), nil\r\n}", "title": "" }, { "docid": "57d86de3130ff141bfb7a6979d5df82e", "score": "0.6108527", "text": "func (this *Timestamp) MarshalJSON() ([]byte, error) {\n\tstr, err := ServiceFenceMarshaler.MarshalToString(this)\n\treturn []byte(str), err\n}", "title": "" }, { "docid": "f1d10157a8f11c1f2026e671014d0bcf", "score": "0.6094022", "text": "func (obj NotebookCellTime) MarshalJSON() ([]byte, error) {\n\tif obj.NotebookRelativeTime != nil {\n\t\treturn json.Marshal(&obj.NotebookRelativeTime)\n\t}\n\n\tif obj.NotebookAbsoluteTime != nil {\n\t\treturn json.Marshal(&obj.NotebookAbsoluteTime)\n\t}\n\n\tif obj.UnparsedObject != nil {\n\t\treturn json.Marshal(obj.UnparsedObject)\n\t}\n\treturn nil, nil // no data in oneOf schemas\n}", "title": "" }, { "docid": "c01d691e066264334b541b5d47acb8fb", "score": "0.6082075", "text": "func TimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) {\n\tenc.AppendString(strconv.FormatInt(time.Now().Unix(), 10))\n}", "title": "" }, { "docid": "a6d0f2851e220533648ce05c04b9e80b", "score": "0.6068319", "text": "func TestAminoJSONTimeEncodeDecodeRoundTrip(t *testing.T) {\n\tloc, err := time.LoadLocation(\"America/Los_Angeles\")\n\trequire.NoError(t, err)\n\tdin := time.Date(2008, 9, 15, 14, 13, 12, 11109876, loc).Round(time.Millisecond).UTC()\n\n\tcdc := amino.NewCodec()\n\tblobAmino, err := cdc.MarshalJSON(din)\n\trequire.Nil(t, err, \"amino.Codec.MarshalJSON should succeed\")\n\tvar tAminoOut time.Time\n\trequire.Nil(t, cdc.UnmarshalJSON(blobAmino, &tAminoOut), \"amino.Codec.UnmarshalJSON should succeed\")\n\trequire.NotEqual(t, tAminoOut, time.Time{}, \"amino.marshaled definitely isn't equal to zero time\")\n\trequire.Equal(t, tAminoOut, din, \"expecting marshaled in to be equal to marshaled out\")\n\n\tblobStdlib, err := json.Marshal(din)\n\trequire.Nil(t, err, \"json.Marshal should succeed\")\n\tvar tStdlibOut time.Time\n\trequire.Nil(t, json.Unmarshal(blobStdlib, &tStdlibOut), \"json.Unmarshal should succeed\")\n\trequire.NotEqual(t, tStdlibOut, time.Time{}, \"stdlib.marshaled definitely isn't equal to zero time\")\n\trequire.Equal(t, tStdlibOut, din, \"expecting stdlib.marshaled to be equal to time in\")\n\n\trequire.Equal(t, tAminoOut, tStdlibOut, \"expecting amino.unmarshaled to be equal to json.unmarshaled\")\n}", "title": "" }, { "docid": "df073fc1f5b8e9f739d98c4e1527ceee", "score": "0.6045178", "text": "func TimeRepr(t time.Time) (string, error) {\n\tnotification := TimeNotification{\n\t\tTime: t.String(),\n\t}\n\trepr, err := json.Marshal(notification)\n\treturn string(repr), err\n}", "title": "" }, { "docid": "8ae4fa49cf4b1ce7edb98ffcf3340d0b", "score": "0.6010745", "text": "func ISO8601TimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) {\n\tencodeTimeLayout(t, \"2006-01-02T15:04:05.000-07:00\", enc)\n}", "title": "" }, { "docid": "270ba5935b050c0c2cd12246b4f4b07f", "score": "0.6006787", "text": "func (t NetworkTimestamp) MarshalJSON() ([]byte, error) {\n\tif t == 0 {\n\t\treturn []byte(\"null\"), nil\n\t}\n\tf := float64(t)\n\treturn json.Marshal(&f)\n}", "title": "" }, { "docid": "d0fb239d996b763ef4992f5778d9897a", "score": "0.5979177", "text": "func timeToBytes(input interface{}) ([]byte, error) {\n\ttypedInput, ok := input.(time.Time)\n\tif !ok {\n\t\treturn nil, ErrWrongType\n\t}\n\n\treturn typedInput.MarshalBinary()\n}", "title": "" }, { "docid": "d8a62b704721eec6ce708cc6918481ae", "score": "0.59715784", "text": "func JSTTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) {\n\tconst layout = \"2006-01-02 15:04:05\"\n\tjst := time.FixedZone(\"Asia/Tokyo\", 9*60*60)\n\tenc.AppendString(t.In(jst).Format(layout))\n}", "title": "" }, { "docid": "68d91ead45160242073041bac2bd4568", "score": "0.5966388", "text": "func (t JSONTime) String() string {\n\ttm := t.Time()\n\treturn fmt.Sprintf(\"\\\"%s\\\"\", tm.Format(\"Mon Jan _2\"))\n}", "title": "" }, { "docid": "f73f41061d45535b1129a621e97bb7e9", "score": "0.59466964", "text": "func (t TimeWindow) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"end\", t.End)\n\tpopulateTimeRFC3339(objectMap, \"start\", t.Start)\n\tpopulate(objectMap, \"timeZone\", t.TimeZone)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2a97f15eb3884f0fbd4b1a7f4d2c3f6f", "score": "0.59355384", "text": "func (t Date) MarshalJSON() ([]byte, error) {\n\tif y := t.Year(); y < 0 || y >= 10000 {\n\t\t// RFC 3339 is clear that years are 4 digits exactly.\n\t\t// See golang.org/issue/4556#c15 for more discussion.\n\t\treturn nil, errors.New(\"Time.MarshalJSON: year outside of range [0,9999]\")\n\t}\n\n\tb := make([]byte, 0, len(DateTimeFormat)+2)\n\tb = append(b, '\"')\n\tb = t.AppendFormat(b, DateTimeFormat)\n\tb = append(b, '\"')\n\treturn b, nil\n}", "title": "" }, { "docid": "81e4affeaf34a2df6e784c6e8c398eac", "score": "0.5915475", "text": "func (v NullableNotebookCellTime) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(v.value)\n}", "title": "" }, { "docid": "40b8dc9384dbb21fe660453c1c968b94", "score": "0.58983886", "text": "func (a AbnormalTimePeriod) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"endTime\", a.EndTime)\n\tpopulate(objectMap, \"events\", a.Events)\n\tpopulate(objectMap, \"solutions\", a.Solutions)\n\tpopulateTimeRFC3339(objectMap, \"startTime\", a.StartTime)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f374674822234813eea808c648bf9255", "score": "0.5897618", "text": "func TestTSTime_JSON(t *testing.T) {\n\n\tgett := func(s string) *WorkingTime {\n\t\tif s == \"00:00:00\" {\n\t\t\treturn nil\n\t\t}\n\t\treturn NewWorkingTime(s)\n\t}\n\n\ttst := func(f func(v *TSTime, s string)) bool {\n\t\treturn runHHMMSS_TimeSeries(t, func(s string) bool {\n\t\t\tv := &TSTime{}\n\t\t\tf(v, s)\n\t\t\treturn tstime_test(t, v)\n\t\t})\n\t}\n\n\ttst(func(v *TSTime, s string) {\n\t\tv.ET = gett(s)\n\t})\n\ttst(func(v *TSTime, s string) {\n\t\tv.ETMin = gett(s)\n\t})\n\ttst(func(v *TSTime, s string) {\n\t\tv.WET = gett(s)\n\t})\n\ttst(func(v *TSTime, s string) {\n\t\tv.AT = gett(s)\n\t})\n}", "title": "" }, { "docid": "1de31c2cb9997a81ae9cc5bfd0fc369f", "score": "0.58881027", "text": "func (m *MicroTime) Marshal() (data []byte, err error) {\n\tif m == nil || m.Time.IsZero() {\n\t\treturn nil, nil\n\t}\n\treturn m.ProtoMicroTime().Marshal()\n}", "title": "" }, { "docid": "76ad6afd9949f6d5a927fe595d999ad1", "score": "0.5878764", "text": "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\tif t == 0 {\n\t\treturn []byte(\"null\"), nil\n\t}\n\tf := float64(t)\n\treturn json.Marshal(&f)\n}", "title": "" }, { "docid": "6d12649c5981763a22b02a99eecb4f74", "score": "0.5872971", "text": "func (d Date) MarshalJSON() ([]byte, error) {\n\treturn []byte(\"\\\"\" + d.Time.Format(timeFmt) + \"\\\"\"), nil\n}", "title": "" }, { "docid": "8a90f4a706dec0d2a00d1b4566275297", "score": "0.58263135", "text": "func (plot Plot) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal([2]interface{}{int(plot.Time.Unix()), plot.Value})\n}", "title": "" }, { "docid": "563a292cf7f9a35f0cbcc22448298374", "score": "0.57917434", "text": "func (p PointInTimeRange) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulateTimeRFC3339(objectMap, \"endTime\", p.EndTime)\n\tpopulateTimeRFC3339(objectMap, \"startTime\", p.StartTime)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cde7631d622c8108f03e5607138bf69d", "score": "0.5772135", "text": "func (this *Time) EncodeToBytes(buffer []byte) (bytesEncoded int) {\n\tswitch this.Type {\n\tcase TimeTypeDate:\n\t\treturn this.encodeDate(buffer)\n\tcase TimeTypeTime:\n\t\treturn this.encodeTime(buffer)\n\tcase TimeTypeTimestamp:\n\t\treturn this.encodeTimestamp(buffer)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"%v: Unknown time type\", this.Type))\n\t}\n}", "title": "" }, { "docid": "5e7086dd5944c73b8e664973daa3bc4f", "score": "0.5769774", "text": "func (s *MarshalState) WriteTime(x time.Time) {\n\tif s.Err() != nil {\n\t\treturn\n\t}\n\tv := x.UTC().Format(\"2006-01-02T15:04:05.000000000\")\n\t// According to the protobuf spec, nanoseconds in timestamps should be written as 3, 6 or 9 digits.\n\tv = strings.TrimSuffix(v, \"000\")\n\tv = strings.TrimSuffix(v, \"000\")\n\tv = strings.TrimSuffix(v, \".000\")\n\ts.inner.WriteString(v + \"Z\")\n}", "title": "" }, { "docid": "2e86dd8f39c763760db58196f00c23b9", "score": "0.57684296", "text": "func DotNetJSONTimeToRFC3339(jsonTime string, isUTC bool) (string, error) {\n\t//If jsonTime is empty we don't need to convert anything\n\tif jsonTime == \"\" {\n\t\treturn \"\", nil\n\t}\n\t//The format returned looks like: /Date(1494201600000+0000)/\n\t//so first we need to strip out the unnecessary /'s, brackets, and letters\n\tnumbersAndPlusSymbol := regexp.MustCompile(\"[0-9+-]\")\n\tjsonSlice := numbersAndPlusSymbol.FindAllString(jsonTime, -1)\n\t//Then we join the resulting array into a string\n\tjsonTimeString := strings.Join(jsonSlice[:], \"\")\n\t//if the offset (the bit after the Unix timestamp) is positive (signalled by a + symbol)\n\t//then we need to add it to the timestamp and return the result\n\tvar golangTime time.Time\n\tif strings.Contains(jsonTimeString, \"+\") {\n\t\tplusSymbol := regexp.MustCompile(\"\\\\+\")\n\t\ttimestamp, offset, err := getTimestampAndOffset(plusSymbol, jsonTimeString)\n\t\tif err != nil {\n\t\t\treturn time.Now().Format(time.RFC3339), err\n\t\t}\n\t\tgolangTime = time.Unix((timestamp/1000)+offset, 0)\n\t} else\n\t//if the offset (the bit after the Unix timestamp) is negative (signalled by a - symbol)\n\t//then we need to subtract it from the timestamp and return the result\n\tif strings.Contains(jsonTimeString, \"-\") {\n\t\tminusSymbol := regexp.MustCompile(\"\\\\-\")\n\t\ttimestamp, offset, err := getTimestampAndOffset(minusSymbol, jsonTimeString)\n\t\tif err != nil {\n\t\t\treturn time.Now().Format(time.RFC3339), err\n\t\t}\n\t\tgolangTime = time.Unix((timestamp/1000)-offset, 0)\n\t} else {\n\t\t//If there is no offset then we just return the converted timestamp\n\t\ttimestamp, err := strconv.ParseInt(jsonTimeString, 10, 64)\n\t\tif err != nil {\n\t\t\treturn time.Now().Format(time.RFC3339), err\n\t\t}\n\t\tgolangTime = time.Unix((timestamp / 1000), 0)\n\t}\n\tformattedTime := golangTime.UTC().Format(time.RFC3339)\n\t//The Xero API does not expect an offset. We either need to supply the local time\n\t//or the UTC time. If we designate the time format as local golang will add the offset\n\t//but if we designate it as UTC it adds a Z suffix. To satisfy the API requirements we\n\t//will remove the Z from local times so they aren't seen as UTC times.\n\tif isUTC {\n\t\treturn formattedTime, nil\n\t} else {\n\t\treturn strings.TrimSuffix(formattedTime, \"Z\"), nil\n\t}\n}", "title": "" }, { "docid": "dd93dee6b7c308cf75ec3643376bb69e", "score": "0.57636476", "text": "func (t JSONTime) Time() time.Time {\n\treturn time.Unix(int64(t), 0)\n}", "title": "" }, { "docid": "5aafe52b577aeb6b23a64c573b28c12c", "score": "0.5760719", "text": "func (tsb TimeSequenceBase) MarshalJSON() ([]byte, error) {\n\ttsb.Type = TypeBasicTimeSequenceBaseTypeTimeSequenceBase\n\tobjectMap := make(map[string]interface{})\n\tif tsb.Type != \"\" {\n\t\tobjectMap[\"@type\"] = tsb.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4bb919c1218509284e0269a1c3ab602e", "score": "0.5759268", "text": "func (t NullTime) MarshalBinary() ([]byte, error) {\n\tif !t.Valid {\n\t\treturn nil, nil\n\t}\n\n\treturn t.Time.MarshalBinary()\n}", "title": "" }, { "docid": "19403a5d4cb956253913f24805c94c5b", "score": "0.57529885", "text": "func (d DetectorAbnormalTimePeriod) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"endTime\", d.EndTime)\n\tpopulate(objectMap, \"message\", d.Message)\n\tpopulate(objectMap, \"metaData\", d.MetaData)\n\tpopulate(objectMap, \"priority\", d.Priority)\n\tpopulate(objectMap, \"solutions\", d.Solutions)\n\tpopulate(objectMap, \"source\", d.Source)\n\tpopulateTimeRFC3339(objectMap, \"startTime\", d.StartTime)\n\tpopulate(objectMap, \"type\", d.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ea1d320c8cf616f3740a86eecb6c8f17", "score": "0.57426167", "text": "func TimeToBytes(t time.Time) []byte {\n\tb := make([]byte, TimeSliceLength)\n\tbinary.LittleEndian.PutUint64(b, uint64(t.UnixNano()))\n\treturn b\n}", "title": "" }, { "docid": "320183ca510df685e3fca40dba4d900a", "score": "0.57419294", "text": "func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) {\n\tenc.AppendString(t.Format(\"2006-01-02 15:04:05.000\"))\n}", "title": "" }, { "docid": "9d2fd7b507ca53e394579d782a6f1af4", "score": "0.5714091", "text": "func (d ReleaseDate) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(time.Time(d).Format(\"2006-01-02\"))\n}", "title": "" } ]
dee0b4db1ed15d1d18f1d9905e3fef93
SetTo stores value for selected field for object BatchGetRolesResponse
[ { "docid": "64701ec628fd11c6e77cab7d3676bb21", "score": "0.7632841", "text": "func (fpv *BatchGetRolesResponse_FieldTerminalPathValue) SetTo(target **BatchGetRolesResponse) {\n\tif *target == nil {\n\t\t*target = new(BatchGetRolesResponse)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetRolesResponse_FieldPathSelectorRoles:\n\t\t(*target).Roles = fpv.value.([]*role.Role)\n\tcase BatchGetRolesResponse_FieldPathSelectorMissing:\n\t\t(*target).Missing = fpv.value.([]*role.Reference)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetRolesResponse: %d\", fpv.selector))\n\t}\n}", "title": "" } ]
[ { "docid": "e3bdea7bb54f6d0b4f11c3af18ff97e5", "score": "0.7716282", "text": "func (fpv *ListRolesResponse_FieldTerminalPathValue) SetTo(target **ListRolesResponse) {\n\tif *target == nil {\n\t\t*target = new(ListRolesResponse)\n\t}\n\tswitch fpv.selector {\n\tcase ListRolesResponse_FieldPathSelectorRoles:\n\t\t(*target).Roles = fpv.value.([]*role.Role)\n\tcase ListRolesResponse_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*role.PagerCursor)\n\tcase ListRolesResponse_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*role.PagerCursor)\n\tcase ListRolesResponse_FieldPathSelectorCurrentOffset:\n\t\t(*target).CurrentOffset = fpv.value.(int32)\n\tcase ListRolesResponse_FieldPathSelectorTotalResultsCount:\n\t\t(*target).TotalResultsCount = fpv.value.(int32)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListRolesResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "31bde4968a03167459dc8dec0cc02b94", "score": "0.7376191", "text": "func (fpv *ListRolesRequest_FieldTerminalPathValue) SetTo(target **ListRolesRequest) {\n\tif *target == nil {\n\t\t*target = new(ListRolesRequest)\n\t}\n\tswitch fpv.selector {\n\tcase ListRolesRequest_FieldPathSelectorPageSize:\n\t\t(*target).PageSize = fpv.value.(int32)\n\tcase ListRolesRequest_FieldPathSelectorPageToken:\n\t\t(*target).PageToken = fpv.value.(*role.PagerCursor)\n\tcase ListRolesRequest_FieldPathSelectorOrderBy:\n\t\t(*target).OrderBy = fpv.value.(*role.OrderBy)\n\tcase ListRolesRequest_FieldPathSelectorFilter:\n\t\t(*target).Filter = fpv.value.(*role.Filter)\n\tcase ListRolesRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*role.Role_FieldMask)\n\tcase ListRolesRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tcase ListRolesRequest_FieldPathSelectorIncludePagingInfo:\n\t\t(*target).IncludePagingInfo = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListRolesRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "d7bb8a9000d7f8d1b9745ea1d89cb1eb", "score": "0.71447414", "text": "func (fpv *BatchGetRolesRequest_FieldTerminalPathValue) SetTo(target **BatchGetRolesRequest) {\n\tif *target == nil {\n\t\t*target = new(BatchGetRolesRequest)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetRolesRequest_FieldPathSelectorNames:\n\t\t(*target).Names = fpv.value.([]*role.Reference)\n\tcase BatchGetRolesRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*role.Role_FieldMask)\n\tcase BatchGetRolesRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetRolesRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "ff1c48b3fda1c58ac5245f3323c47daf", "score": "0.6896108", "text": "func (fpv *WatchRolesResponse_FieldTerminalPathValue) SetTo(target **WatchRolesResponse) {\n\tif *target == nil {\n\t\t*target = new(WatchRolesResponse)\n\t}\n\tswitch fpv.selector {\n\tcase WatchRolesResponse_FieldPathSelectorRoleChanges:\n\t\t(*target).RoleChanges = fpv.value.([]*role.RoleChange)\n\tcase WatchRolesResponse_FieldPathSelectorIsCurrent:\n\t\t(*target).IsCurrent = fpv.value.(bool)\n\tcase WatchRolesResponse_FieldPathSelectorPageTokenChange:\n\t\t(*target).PageTokenChange = fpv.value.(*WatchRolesResponse_PageTokenChange)\n\tcase WatchRolesResponse_FieldPathSelectorResumeToken:\n\t\t(*target).ResumeToken = fpv.value.(string)\n\tcase WatchRolesResponse_FieldPathSelectorSnapshotSize:\n\t\t(*target).SnapshotSize = fpv.value.(int64)\n\tcase WatchRolesResponse_FieldPathSelectorIsSoftReset:\n\t\t(*target).IsSoftReset = fpv.value.(bool)\n\tcase WatchRolesResponse_FieldPathSelectorIsHardReset:\n\t\t(*target).IsHardReset = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchRolesResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "4ba60be55e26cb9f13414000ff11383c", "score": "0.6704585", "text": "func (fpv *GetRoleRequest_FieldTerminalPathValue) SetTo(target **GetRoleRequest) {\n\tif *target == nil {\n\t\t*target = new(GetRoleRequest)\n\t}\n\tswitch fpv.selector {\n\tcase GetRoleRequest_FieldPathSelectorName:\n\t\t(*target).Name = fpv.value.(*role.Reference)\n\tcase GetRoleRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*role.Role_FieldMask)\n\tcase GetRoleRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for GetRoleRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "850b33aea9be145ca3bbf277b04f52c2", "score": "0.65754414", "text": "func (fpv *CreateRoleRequest_FieldTerminalPathValue) SetTo(target **CreateRoleRequest) {\n\tif *target == nil {\n\t\t*target = new(CreateRoleRequest)\n\t}\n\tswitch fpv.selector {\n\tcase CreateRoleRequest_FieldPathSelectorRole:\n\t\t(*target).Role = fpv.value.(*role.Role)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for CreateRoleRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "654f9bd2a3791cfc056cff7513f34123", "score": "0.6517048", "text": "func (fpv *WatchRolesRequest_FieldTerminalPathValue) SetTo(target **WatchRolesRequest) {\n\tif *target == nil {\n\t\t*target = new(WatchRolesRequest)\n\t}\n\tswitch fpv.selector {\n\tcase WatchRolesRequest_FieldPathSelectorType:\n\t\t(*target).Type = fpv.value.(watch_type.WatchType)\n\tcase WatchRolesRequest_FieldPathSelectorPageSize:\n\t\t(*target).PageSize = fpv.value.(int32)\n\tcase WatchRolesRequest_FieldPathSelectorPageToken:\n\t\t(*target).PageToken = fpv.value.(*role.PagerCursor)\n\tcase WatchRolesRequest_FieldPathSelectorOrderBy:\n\t\t(*target).OrderBy = fpv.value.(*role.OrderBy)\n\tcase WatchRolesRequest_FieldPathSelectorResumeToken:\n\t\t(*target).ResumeToken = fpv.value.(string)\n\tcase WatchRolesRequest_FieldPathSelectorStartingTime:\n\t\t(*target).StartingTime = fpv.value.(*timestamp.Timestamp)\n\tcase WatchRolesRequest_FieldPathSelectorFilter:\n\t\t(*target).Filter = fpv.value.(*role.Filter)\n\tcase WatchRolesRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*role.Role_FieldMask)\n\tcase WatchRolesRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tcase WatchRolesRequest_FieldPathSelectorMaxChunkSize:\n\t\t(*target).MaxChunkSize = fpv.value.(int32)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchRolesRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "c3459a37ad8a7f53e375b6c1d1de43cb", "score": "0.6461747", "text": "func (fpv *UpdateRoleRequest_FieldTerminalPathValue) SetTo(target **UpdateRoleRequest) {\n\tif *target == nil {\n\t\t*target = new(UpdateRoleRequest)\n\t}\n\tswitch fpv.selector {\n\tcase UpdateRoleRequest_FieldPathSelectorRole:\n\t\t(*target).Role = fpv.value.(*role.Role)\n\tcase UpdateRoleRequest_FieldPathSelectorUpdateMask:\n\t\t(*target).UpdateMask = fpv.value.(*role.Role_FieldMask)\n\tcase UpdateRoleRequest_FieldPathSelectorCas:\n\t\t(*target).Cas = fpv.value.(*UpdateRoleRequest_CAS)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateRoleRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "da63c5dcd5e2db2b5bfb36d4ee6dce8f", "score": "0.6301097", "text": "func (fpv *UpdateRoleRequestCAS_FieldTerminalPathValue) SetTo(target **UpdateRoleRequest_CAS) {\n\tif *target == nil {\n\t\t*target = new(UpdateRoleRequest_CAS)\n\t}\n\tswitch fpv.selector {\n\tcase UpdateRoleRequestCAS_FieldPathSelectorConditionalState:\n\t\t(*target).ConditionalState = fpv.value.(*role.Role)\n\tcase UpdateRoleRequestCAS_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*role.Role_FieldMask)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateRoleRequest_CAS: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "990be27d90c562fedff8a50715ac6c30", "score": "0.61423737", "text": "func (fpv *WatchRoleResponse_FieldTerminalPathValue) SetTo(target **WatchRoleResponse) {\n\tif *target == nil {\n\t\t*target = new(WatchRoleResponse)\n\t}\n\tswitch fpv.selector {\n\tcase WatchRoleResponse_FieldPathSelectorChange:\n\t\t(*target).Change = fpv.value.(*role.RoleChange)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchRoleResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "719109c6fdcf039142675b4491ee8f83", "score": "0.60544086", "text": "func (fpv *WatchRolesResponsePageTokenChange_FieldTerminalPathValue) SetTo(target **WatchRolesResponse_PageTokenChange) {\n\tif *target == nil {\n\t\t*target = new(WatchRolesResponse_PageTokenChange)\n\t}\n\tswitch fpv.selector {\n\tcase WatchRolesResponsePageTokenChange_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*role.PagerCursor)\n\tcase WatchRolesResponsePageTokenChange_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*role.PagerCursor)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchRolesResponse_PageTokenChange: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "a37c598850d027cf99e931bc4e6787b4", "score": "0.6026958", "text": "func (fpv *DeleteRoleRequest_FieldTerminalPathValue) SetTo(target **DeleteRoleRequest) {\n\tif *target == nil {\n\t\t*target = new(DeleteRoleRequest)\n\t}\n\tswitch fpv.selector {\n\tcase DeleteRoleRequest_FieldPathSelectorName:\n\t\t(*target).Name = fpv.value.(*role.Reference)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for DeleteRoleRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "303540e40a30c2edc83fefbc5cd84b57", "score": "0.5971402", "text": "func (fpv *BatchGetPermissionsResponse_FieldTerminalPathValue) SetTo(target **BatchGetPermissionsResponse) {\n\tif *target == nil {\n\t\t*target = new(BatchGetPermissionsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetPermissionsResponse_FieldPathSelectorPermissions:\n\t\t(*target).Permissions = fpv.value.([]*permission.Permission)\n\tcase BatchGetPermissionsResponse_FieldPathSelectorMissing:\n\t\t(*target).Missing = fpv.value.([]*permission.Reference)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetPermissionsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "77ec60bdbd4be77376d983f00af26b24", "score": "0.5910051", "text": "func (fpv *WatchRoleRequest_FieldTerminalPathValue) SetTo(target **WatchRoleRequest) {\n\tif *target == nil {\n\t\t*target = new(WatchRoleRequest)\n\t}\n\tswitch fpv.selector {\n\tcase WatchRoleRequest_FieldPathSelectorName:\n\t\t(*target).Name = fpv.value.(*role.Reference)\n\tcase WatchRoleRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*role.Role_FieldMask)\n\tcase WatchRoleRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchRoleRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "4a3987e89d347401e2766d2e070d0a02", "score": "0.58424664", "text": "func (fpv *BatchGetOrganizationInvitationsResponse_FieldTerminalPathValue) SetTo(target **BatchGetOrganizationInvitationsResponse) {\n\tif *target == nil {\n\t\t*target = new(BatchGetOrganizationInvitationsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetOrganizationInvitationsResponse_FieldPathSelectorOrganizationInvitations:\n\t\t(*target).OrganizationInvitations = fpv.value.([]*organization_invitation.OrganizationInvitation)\n\tcase BatchGetOrganizationInvitationsResponse_FieldPathSelectorMissing:\n\t\t(*target).Missing = fpv.value.([]*organization_invitation.Reference)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetOrganizationInvitationsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "169ce326e059fd0e79b9b12c1378a45b", "score": "0.5770128", "text": "func (fpv *ListPermissionsResponse_FieldTerminalPathValue) SetTo(target **ListPermissionsResponse) {\n\tif *target == nil {\n\t\t*target = new(ListPermissionsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase ListPermissionsResponse_FieldPathSelectorPermissions:\n\t\t(*target).Permissions = fpv.value.([]*permission.Permission)\n\tcase ListPermissionsResponse_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*permission.PagerCursor)\n\tcase ListPermissionsResponse_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*permission.PagerCursor)\n\tcase ListPermissionsResponse_FieldPathSelectorCurrentOffset:\n\t\t(*target).CurrentOffset = fpv.value.(int32)\n\tcase ListPermissionsResponse_FieldPathSelectorTotalResultsCount:\n\t\t(*target).TotalResultsCount = fpv.value.(int32)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListPermissionsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "b8a4f318e5f3562f6b09fd6ef9bbc7a4", "score": "0.57499725", "text": "func ToRoles(roles []m.Role) *am.UserRoles {\n\tif roles == nil {\n\t\treturn nil\n\t}\n\n\trs := make([]string, len(roles))\n\tfor i, role := range roles {\n\t\trs[i] = role.String()\n\t}\n\n\treturn &am.UserRoles{rs}\n}", "title": "" }, { "docid": "dfe157e62e5b967dd199dbd6f6bce42d", "score": "0.5746923", "text": "func (fpv *ListOrganizationInvitationsResponse_FieldTerminalPathValue) SetTo(target **ListOrganizationInvitationsResponse) {\n\tif *target == nil {\n\t\t*target = new(ListOrganizationInvitationsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase ListOrganizationInvitationsResponse_FieldPathSelectorOrganizationInvitations:\n\t\t(*target).OrganizationInvitations = fpv.value.([]*organization_invitation.OrganizationInvitation)\n\tcase ListOrganizationInvitationsResponse_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*organization_invitation.PagerCursor)\n\tcase ListOrganizationInvitationsResponse_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*organization_invitation.PagerCursor)\n\tcase ListOrganizationInvitationsResponse_FieldPathSelectorCurrentOffset:\n\t\t(*target).CurrentOffset = fpv.value.(int32)\n\tcase ListOrganizationInvitationsResponse_FieldPathSelectorTotalResultsCount:\n\t\t(*target).TotalResultsCount = fpv.value.(int32)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListOrganizationInvitationsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "fa4bed57ac0e8bb7f1e84c84cc1efc0a", "score": "0.5698058", "text": "func (fpv *BatchGetPlansResponse_FieldTerminalPathValue) SetTo(target **BatchGetPlansResponse) {\n\tif *target == nil {\n\t\t*target = new(BatchGetPlansResponse)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetPlansResponse_FieldPathSelectorPlans:\n\t\t(*target).Plans = fpv.value.([]*plan.Plan)\n\tcase BatchGetPlansResponse_FieldPathSelectorMissing:\n\t\t(*target).Missing = fpv.value.([]*plan.Reference)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetPlansResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "9fa0164bbecae907761799ca3c634c8e", "score": "0.562441", "text": "func (fpv *BatchGetPermissionsRequest_FieldTerminalPathValue) SetTo(target **BatchGetPermissionsRequest) {\n\tif *target == nil {\n\t\t*target = new(BatchGetPermissionsRequest)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetPermissionsRequest_FieldPathSelectorNames:\n\t\t(*target).Names = fpv.value.([]*permission.Reference)\n\tcase BatchGetPermissionsRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*permission.Permission_FieldMask)\n\tcase BatchGetPermissionsRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetPermissionsRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "d50072dbcb32b7dde49027a902794073", "score": "0.5587598", "text": "func (m *ServicePrincipal) SetAppRoleAssignedTo(value []AppRoleAssignmentable)() {\n err := m.GetBackingStore().Set(\"appRoleAssignedTo\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4335f6e560906b870d31e64334320b86", "score": "0.55804926", "text": "func (fpv *BatchGetOrganizationInvitationsRequest_FieldTerminalPathValue) SetTo(target **BatchGetOrganizationInvitationsRequest) {\n\tif *target == nil {\n\t\t*target = new(BatchGetOrganizationInvitationsRequest)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetOrganizationInvitationsRequest_FieldPathSelectorNames:\n\t\t(*target).Names = fpv.value.([]*organization_invitation.Reference)\n\tcase BatchGetOrganizationInvitationsRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*organization_invitation.OrganizationInvitation_FieldMask)\n\tcase BatchGetOrganizationInvitationsRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetOrganizationInvitationsRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "138eb0a61b616181d4cafbb8c1ffecbe", "score": "0.5560392", "text": "func (rr *RoleRequest) WriteTo(w io.Writer) (int64, error) {\n\treturn encoding.WriteTo(w, rr.Role, pad4{}, rr.GenerationID)\n}", "title": "" }, { "docid": "10eeefcb45c5d95c99720a78f883a5d1", "score": "0.55593663", "text": "func (m *ServiceUserAgent) SetRole(value *ServiceRole)() {\n m.role = value\n}", "title": "" }, { "docid": "696c67bbca238311352628a2f3b35878", "score": "0.554076", "text": "func (fpv *BatchGetServicesResponse_FieldTerminalPathValue) SetTo(target **BatchGetServicesResponse) {\n\tif *target == nil {\n\t\t*target = new(BatchGetServicesResponse)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetServicesResponse_FieldPathSelectorServices:\n\t\t(*target).Services = fpv.value.([]*service.Service)\n\tcase BatchGetServicesResponse_FieldPathSelectorMissing:\n\t\t(*target).Missing = fpv.value.([]*service.Reference)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetServicesResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "e4cee85bce8730e0e6fa34b125b09687", "score": "0.5515087", "text": "func (fpv *BatchGetPlanAssignmentsResponse_FieldTerminalPathValue) SetTo(target **BatchGetPlanAssignmentsResponse) {\n\tif *target == nil {\n\t\t*target = new(BatchGetPlanAssignmentsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetPlanAssignmentsResponse_FieldPathSelectorPlanAssignments:\n\t\t(*target).PlanAssignments = fpv.value.([]*plan_assignment.PlanAssignment)\n\tcase BatchGetPlanAssignmentsResponse_FieldPathSelectorMissing:\n\t\t(*target).Missing = fpv.value.([]*plan_assignment.Reference)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetPlanAssignmentsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "f22512a4c16fd147c2e21478d47beb3a", "score": "0.5485201", "text": "func (fpv *BatchGetConfigMapsResponse_FieldTerminalPathValue) SetTo(target **BatchGetConfigMapsResponse) {\n\tif *target == nil {\n\t\t*target = new(BatchGetConfigMapsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetConfigMapsResponse_FieldPathSelectorConfigMaps:\n\t\t(*target).ConfigMaps = fpv.value.([]*config_map.ConfigMap)\n\tcase BatchGetConfigMapsResponse_FieldPathSelectorMissing:\n\t\t(*target).Missing = fpv.value.([]*config_map.Reference)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetConfigMapsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "d0f6971c9915c6b865b056b48ef46d74", "score": "0.5457731", "text": "func (fpv *ListServicesResponse_FieldTerminalPathValue) SetTo(target **ListServicesResponse) {\n\tif *target == nil {\n\t\t*target = new(ListServicesResponse)\n\t}\n\tswitch fpv.selector {\n\tcase ListServicesResponse_FieldPathSelectorServices:\n\t\t(*target).Services = fpv.value.([]*service.Service)\n\tcase ListServicesResponse_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*service.PagerCursor)\n\tcase ListServicesResponse_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*service.PagerCursor)\n\tcase ListServicesResponse_FieldPathSelectorCurrentOffset:\n\t\t(*target).CurrentOffset = fpv.value.(int32)\n\tcase ListServicesResponse_FieldPathSelectorTotalResultsCount:\n\t\t(*target).TotalResultsCount = fpv.value.(int32)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListServicesResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "d3e5f6f6f45ed556580be6eb898222ef", "score": "0.54509306", "text": "func (o *GetForResourceGroupParams) SetTo(to *strfmt.DateTime) {\n\to.To = to\n}", "title": "" }, { "docid": "b5c4b47b3a87cec8b360af9035568b94", "score": "0.54499954", "text": "func (m *PlannerRelationshipBasedUserType) SetRole(value *PlannerRelationshipUserRoles)() {\n err := m.GetBackingStore().Set(\"role\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "22ca3a1fce6659f2764268758b18112a", "score": "0.5419049", "text": "func (fpv *ListConfigMapsResponse_FieldTerminalPathValue) SetTo(target **ListConfigMapsResponse) {\n\tif *target == nil {\n\t\t*target = new(ListConfigMapsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase ListConfigMapsResponse_FieldPathSelectorConfigMaps:\n\t\t(*target).ConfigMaps = fpv.value.([]*config_map.ConfigMap)\n\tcase ListConfigMapsResponse_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*config_map.PagerCursor)\n\tcase ListConfigMapsResponse_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*config_map.PagerCursor)\n\tcase ListConfigMapsResponse_FieldPathSelectorCurrentOffset:\n\t\t(*target).CurrentOffset = fpv.value.(int32)\n\tcase ListConfigMapsResponse_FieldPathSelectorTotalResultsCount:\n\t\t(*target).TotalResultsCount = fpv.value.(int32)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListConfigMapsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "4eb759018c094721089396b17336cf2c", "score": "0.541286", "text": "func (fpv *UpdatePermissionRequestCAS_FieldTerminalPathValue) SetTo(target **UpdatePermissionRequest_CAS) {\n\tif *target == nil {\n\t\t*target = new(UpdatePermissionRequest_CAS)\n\t}\n\tswitch fpv.selector {\n\tcase UpdatePermissionRequestCAS_FieldPathSelectorConditionalState:\n\t\t(*target).ConditionalState = fpv.value.(*permission.Permission)\n\tcase UpdatePermissionRequestCAS_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*permission.Permission_FieldMask)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdatePermissionRequest_CAS: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "0677a48fb613626404fbdcc176a754f9", "score": "0.54087", "text": "func (fpmv *Organization_FieldPathMapValue) SetTo(target **Organization) {\n\tif *target == nil {\n\t\t*target = new(Organization)\n\t}\n\tswitch fpmv.selector {\n\tcase Organization_FieldPathSelectorServiceErrors:\n\t\tif (*target).ServiceErrors == nil {\n\t\t\t(*target).ServiceErrors = make(map[string]*iam_common.ServiceErrors)\n\t\t}\n\t\t(*target).ServiceErrors[fpmv.key] = fpmv.value.(*iam_common.ServiceErrors)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for Organization: %d\", fpmv.selector))\n\t}\n}", "title": "" }, { "docid": "2d06d689aaf62324c336f759b3497a50", "score": "0.540126", "text": "func (r *apiV2Router) SetRole(ctx *gin.Context) {\n\tvar err error\n\n\troleReq := ctx.PostForm(\"role\")\n\tif len(roleReq) == 0 {\n\t\tr.logger.Debug(\"role not provided\")\n\t\tmodels.SendAPIError(ctx, http.StatusBadRequest, \"user role must be provided\")\n\t\treturn\n\t}\n\n\tvar userRole role.UserRole\n\terr = json.Unmarshal([]byte(strconv.Quote(roleReq)), &userRole)\n\tif err != nil {\n\t\tr.logger.Debug(\"invalid role\", zap.Error(err))\n\t\tmodels.SendAPIError(ctx, http.StatusBadRequest, \"role does not exist\")\n\t\treturn\n\t}\n\n\terr = r.userService.UpdateUserWithID(ctx, ctx.Param(\"id\"), services.UserUpdateParams{\n\t\tentities.UserRole: userRole,\n\t})\n\tif err != nil {\n\t\tswitch err {\n\t\tcase services.ErrInvalidID:\n\t\t\tr.logger.Debug(\"invalid user id\")\n\t\t\tmodels.SendAPIError(ctx, http.StatusBadRequest, \"invalid user id provided\")\n\t\tcase services.ErrNotFound:\n\t\t\tr.logger.Debug(\"user not found\")\n\t\t\tmodels.SendAPIError(ctx, http.StatusNotFound, \"user not found\")\n\t\tdefault:\n\t\t\tr.logger.Error(\"could not update user with id\", zap.Error(err))\n\t\t\tmodels.SendAPIError(ctx, http.StatusInternalServerError, \"there was a problem when updating the user\")\n\t\t}\n\t\treturn\n\t}\n\n\tctx.Status(http.StatusNoContent)\n}", "title": "" }, { "docid": "5373b3b4360460a6fb6584b09df5f58e", "score": "0.5394459", "text": "func SetValidRoles(rs map[string]string) {\n\t// iterate ValidRoles\n\tfor k := range ValidRoles {\n\t\tif v, ok := rs[k]; ok {\n\t\t\tValidRoles[k] = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9717f731ec5fd0745ae17bdea998991a", "score": "0.5389099", "text": "func (fpv *ListPlansResponse_FieldTerminalPathValue) SetTo(target **ListPlansResponse) {\n\tif *target == nil {\n\t\t*target = new(ListPlansResponse)\n\t}\n\tswitch fpv.selector {\n\tcase ListPlansResponse_FieldPathSelectorPlans:\n\t\t(*target).Plans = fpv.value.([]*plan.Plan)\n\tcase ListPlansResponse_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*plan.PagerCursor)\n\tcase ListPlansResponse_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*plan.PagerCursor)\n\tcase ListPlansResponse_FieldPathSelectorCurrentOffset:\n\t\t(*target).CurrentOffset = fpv.value.(int32)\n\tcase ListPlansResponse_FieldPathSelectorTotalResultsCount:\n\t\t(*target).TotalResultsCount = fpv.value.(int32)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListPlansResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "38164d30034bf00b778207f153fff04c", "score": "0.5372496", "text": "func (fpv *WatchOrganizationInvitationsResponse_FieldTerminalPathValue) SetTo(target **WatchOrganizationInvitationsResponse) {\n\tif *target == nil {\n\t\t*target = new(WatchOrganizationInvitationsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase WatchOrganizationInvitationsResponse_FieldPathSelectorOrganizationInvitationChanges:\n\t\t(*target).OrganizationInvitationChanges = fpv.value.([]*organization_invitation.OrganizationInvitationChange)\n\tcase WatchOrganizationInvitationsResponse_FieldPathSelectorIsCurrent:\n\t\t(*target).IsCurrent = fpv.value.(bool)\n\tcase WatchOrganizationInvitationsResponse_FieldPathSelectorPageTokenChange:\n\t\t(*target).PageTokenChange = fpv.value.(*WatchOrganizationInvitationsResponse_PageTokenChange)\n\tcase WatchOrganizationInvitationsResponse_FieldPathSelectorResumeToken:\n\t\t(*target).ResumeToken = fpv.value.(string)\n\tcase WatchOrganizationInvitationsResponse_FieldPathSelectorSnapshotSize:\n\t\t(*target).SnapshotSize = fpv.value.(int64)\n\tcase WatchOrganizationInvitationsResponse_FieldPathSelectorIsSoftReset:\n\t\t(*target).IsSoftReset = fpv.value.(bool)\n\tcase WatchOrganizationInvitationsResponse_FieldPathSelectorIsHardReset:\n\t\t(*target).IsHardReset = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchOrganizationInvitationsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "5cbf4e82054225620516f1729e4d600f", "score": "0.53468627", "text": "func (fpv *BatchGetPlansRequest_FieldTerminalPathValue) SetTo(target **BatchGetPlansRequest) {\n\tif *target == nil {\n\t\t*target = new(BatchGetPlansRequest)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetPlansRequest_FieldPathSelectorNames:\n\t\t(*target).Names = fpv.value.([]*plan.Reference)\n\tcase BatchGetPlansRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*plan.Plan_FieldMask)\n\tcase BatchGetPlansRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetPlansRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "a834208a40e96d70cf190ac2e2f3046e", "score": "0.53367513", "text": "func (fpv *ListPermissionsRequest_FieldTerminalPathValue) SetTo(target **ListPermissionsRequest) {\n\tif *target == nil {\n\t\t*target = new(ListPermissionsRequest)\n\t}\n\tswitch fpv.selector {\n\tcase ListPermissionsRequest_FieldPathSelectorPageSize:\n\t\t(*target).PageSize = fpv.value.(int32)\n\tcase ListPermissionsRequest_FieldPathSelectorPageToken:\n\t\t(*target).PageToken = fpv.value.(*permission.PagerCursor)\n\tcase ListPermissionsRequest_FieldPathSelectorOrderBy:\n\t\t(*target).OrderBy = fpv.value.(*permission.OrderBy)\n\tcase ListPermissionsRequest_FieldPathSelectorFilter:\n\t\t(*target).Filter = fpv.value.(*permission.Filter)\n\tcase ListPermissionsRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*permission.Permission_FieldMask)\n\tcase ListPermissionsRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tcase ListPermissionsRequest_FieldPathSelectorIncludePagingInfo:\n\t\t(*target).IncludePagingInfo = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListPermissionsRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "af9abe3d6de2702189e9569aa8e73269", "score": "0.53257", "text": "func (fpv *GetPermissionRequest_FieldTerminalPathValue) SetTo(target **GetPermissionRequest) {\n\tif *target == nil {\n\t\t*target = new(GetPermissionRequest)\n\t}\n\tswitch fpv.selector {\n\tcase GetPermissionRequest_FieldPathSelectorName:\n\t\t(*target).Name = fpv.value.(*permission.Reference)\n\tcase GetPermissionRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*permission.Permission_FieldMask)\n\tcase GetPermissionRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for GetPermissionRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "82ff4eb41a9aed29ad9761624e670116", "score": "0.53224254", "text": "func (fpv *ListOrganizationInvitationsRequest_FieldTerminalPathValue) SetTo(target **ListOrganizationInvitationsRequest) {\n\tif *target == nil {\n\t\t*target = new(ListOrganizationInvitationsRequest)\n\t}\n\tswitch fpv.selector {\n\tcase ListOrganizationInvitationsRequest_FieldPathSelectorParent:\n\t\t(*target).Parent = fpv.value.(*organization_invitation.ParentName)\n\tcase ListOrganizationInvitationsRequest_FieldPathSelectorPageSize:\n\t\t(*target).PageSize = fpv.value.(int32)\n\tcase ListOrganizationInvitationsRequest_FieldPathSelectorPageToken:\n\t\t(*target).PageToken = fpv.value.(*organization_invitation.PagerCursor)\n\tcase ListOrganizationInvitationsRequest_FieldPathSelectorOrderBy:\n\t\t(*target).OrderBy = fpv.value.(*organization_invitation.OrderBy)\n\tcase ListOrganizationInvitationsRequest_FieldPathSelectorFilter:\n\t\t(*target).Filter = fpv.value.(*organization_invitation.Filter)\n\tcase ListOrganizationInvitationsRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*organization_invitation.OrganizationInvitation_FieldMask)\n\tcase ListOrganizationInvitationsRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tcase ListOrganizationInvitationsRequest_FieldPathSelectorIncludePagingInfo:\n\t\t(*target).IncludePagingInfo = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListOrganizationInvitationsRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "bc9dc6122e749d7b16c07063096f4681", "score": "0.53021747", "text": "func (fpv *WatchOrganizationInvitationResponse_FieldTerminalPathValue) SetTo(target **WatchOrganizationInvitationResponse) {\n\tif *target == nil {\n\t\t*target = new(WatchOrganizationInvitationResponse)\n\t}\n\tswitch fpv.selector {\n\tcase WatchOrganizationInvitationResponse_FieldPathSelectorChange:\n\t\t(*target).Change = fpv.value.(*organization_invitation.OrganizationInvitationChange)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchOrganizationInvitationResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "f9d6be00bfe72ccaa06ec9fae164fbb8", "score": "0.52931213", "text": "func (rc RoleController) ToAssign(c *gin.Context) {\n\troleID := c.Param(\"roleId\")\n\tid, err := strconv.ParseInt(roleID, 10, 64)\n\tif err != nil {\n\t\tr.JSON(c.Writer, http.StatusBadRequest, gin.H{\n\t\t\t\"message\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\trole, err := rc.RoleDao.Get(id)\n\tif err != nil {\n\t\tr.JSON(c.Writer, http.StatusInternalServerError, gin.H{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tr.HTML(c.Writer, http.StatusOK, \"system/role/role_assign.html\", gin.H{\n\t\t\"role\": role,\n\t})\n}", "title": "" }, { "docid": "a5e562d7423acb80d53c0dfa113f47c9", "score": "0.52851045", "text": "func (fpv *WatchPermissionResponse_FieldTerminalPathValue) SetTo(target **WatchPermissionResponse) {\n\tif *target == nil {\n\t\t*target = new(WatchPermissionResponse)\n\t}\n\tswitch fpv.selector {\n\tcase WatchPermissionResponse_FieldPathSelectorChange:\n\t\t(*target).Change = fpv.value.(*permission.PermissionChange)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchPermissionResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "a27304f37bfa4c9ea38838c2f215f29b", "score": "0.5280187", "text": "func (_e *RootCoord_Expecter) SelectRole(ctx interface{}, req interface{}) *RootCoord_SelectRole_Call {\n\treturn &RootCoord_SelectRole_Call{Call: _e.mock.On(\"SelectRole\", ctx, req)}\n}", "title": "" }, { "docid": "5e6cf631e36f5a969ce17266a2bcd27f", "score": "0.52664113", "text": "func (fpv *BatchGetMetricDescriptorsResponse_FieldTerminalPathValue) SetTo(target **BatchGetMetricDescriptorsResponse) {\n\tif *target == nil {\n\t\t*target = new(BatchGetMetricDescriptorsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetMetricDescriptorsResponse_FieldPathSelectorMetricDescriptors:\n\t\t(*target).MetricDescriptors = fpv.value.([]*metric_descriptor.MetricDescriptor)\n\tcase BatchGetMetricDescriptorsResponse_FieldPathSelectorMissing:\n\t\t(*target).Missing = fpv.value.([]*metric_descriptor.Reference)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetMetricDescriptorsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "4142505df6fee9e5e27932a4b7d032de", "score": "0.5264692", "text": "func (fpv *GetOrganizationInvitationRequest_FieldTerminalPathValue) SetTo(target **GetOrganizationInvitationRequest) {\n\tif *target == nil {\n\t\t*target = new(GetOrganizationInvitationRequest)\n\t}\n\tswitch fpv.selector {\n\tcase GetOrganizationInvitationRequest_FieldPathSelectorName:\n\t\t(*target).Name = fpv.value.(*organization_invitation.Reference)\n\tcase GetOrganizationInvitationRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*organization_invitation.OrganizationInvitation_FieldMask)\n\tcase GetOrganizationInvitationRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for GetOrganizationInvitationRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "b2f973c89eac31a66a99aca208771484", "score": "0.5262648", "text": "func (o *GetItinerariesParams) SetTo(to *string) {\n\to.To = to\n}", "title": "" }, { "docid": "2b9daed110c9f13ecd4e7dd70c713504", "score": "0.52608", "text": "func (fpv *BatchGetServicesRequest_FieldTerminalPathValue) SetTo(target **BatchGetServicesRequest) {\n\tif *target == nil {\n\t\t*target = new(BatchGetServicesRequest)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetServicesRequest_FieldPathSelectorNames:\n\t\t(*target).Names = fpv.value.([]*service.Reference)\n\tcase BatchGetServicesRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*service.Service_FieldMask)\n\tcase BatchGetServicesRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetServicesRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "c1a8560acffd17338f343e9989031397", "score": "0.5259559", "text": "func (a *Client) SetRole(params *SetRoleParams, authInfo runtime.ClientAuthInfoWriter) error {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewSetRoleParams()\n\t}\n\n\t_, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"setRole\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/users/{userId}/role\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &SetRoleReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "449bd33e3571c711103106a572301cab", "score": "0.52565277", "text": "func (fpv *WatchPermissionsResponse_FieldTerminalPathValue) SetTo(target **WatchPermissionsResponse) {\n\tif *target == nil {\n\t\t*target = new(WatchPermissionsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase WatchPermissionsResponse_FieldPathSelectorPermissionChanges:\n\t\t(*target).PermissionChanges = fpv.value.([]*permission.PermissionChange)\n\tcase WatchPermissionsResponse_FieldPathSelectorIsCurrent:\n\t\t(*target).IsCurrent = fpv.value.(bool)\n\tcase WatchPermissionsResponse_FieldPathSelectorPageTokenChange:\n\t\t(*target).PageTokenChange = fpv.value.(*WatchPermissionsResponse_PageTokenChange)\n\tcase WatchPermissionsResponse_FieldPathSelectorResumeToken:\n\t\t(*target).ResumeToken = fpv.value.(string)\n\tcase WatchPermissionsResponse_FieldPathSelectorSnapshotSize:\n\t\t(*target).SnapshotSize = fpv.value.(int64)\n\tcase WatchPermissionsResponse_FieldPathSelectorIsSoftReset:\n\t\t(*target).IsSoftReset = fpv.value.(bool)\n\tcase WatchPermissionsResponse_FieldPathSelectorIsHardReset:\n\t\t(*target).IsHardReset = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchPermissionsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "6936b78a23bd25511c92fcdd71ad822e", "score": "0.5246424", "text": "func (fpv *UpdateOrganizationInvitationRequestCAS_FieldTerminalPathValue) SetTo(target **UpdateOrganizationInvitationRequest_CAS) {\n\tif *target == nil {\n\t\t*target = new(UpdateOrganizationInvitationRequest_CAS)\n\t}\n\tswitch fpv.selector {\n\tcase UpdateOrganizationInvitationRequestCAS_FieldPathSelectorConditionalState:\n\t\t(*target).ConditionalState = fpv.value.(*organization_invitation.OrganizationInvitation)\n\tcase UpdateOrganizationInvitationRequestCAS_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*organization_invitation.OrganizationInvitation_FieldMask)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateOrganizationInvitationRequest_CAS: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "03d0675daf38e77379e87ab694a4a47c", "score": "0.52381635", "text": "func (fpv *DeclinePlanAssignmentResponse_FieldTerminalPathValue) SetTo(target **DeclinePlanAssignmentResponse) {\n\tif *target == nil {\n\t\t*target = new(DeclinePlanAssignmentResponse)\n\t}\n\tswitch fpv.selector {\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for DeclinePlanAssignmentResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "46adc811d44ec22810cbadb510172899", "score": "0.52287436", "text": "func (rc RoleController) ToEdit(c *gin.Context) {\n\troleID := c.Param(\"roleId\")\n\tid, err := strconv.ParseInt(roleID, 10, 64)\n\tif err != nil {\n\t\tr.JSON(c.Writer, http.StatusBadRequest, gin.H{\n\t\t\t\"message\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\trole, err := rc.RoleDao.Get(id)\n\tif err != nil {\n\t\tr.JSON(c.Writer, http.StatusInternalServerError, gin.H{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tr.HTML(c.Writer, http.StatusOK, \"system/role/role_edit.html\", gin.H{\n\t\t\"role\": role,\n\t})\n}", "title": "" }, { "docid": "ebbab933d7ff4cd166d265859d6a6d18", "score": "0.5228449", "text": "func (fpv *CreatePermissionRequest_FieldTerminalPathValue) SetTo(target **CreatePermissionRequest) {\n\tif *target == nil {\n\t\t*target = new(CreatePermissionRequest)\n\t}\n\tswitch fpv.selector {\n\tcase CreatePermissionRequest_FieldPathSelectorPermission:\n\t\t(*target).Permission = fpv.value.(*permission.Permission)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for CreatePermissionRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "23d82293adee729f24e31d25dfe3dc34", "score": "0.5223504", "text": "func (fpv *ListPlanAssignmentsResponse_FieldTerminalPathValue) SetTo(target **ListPlanAssignmentsResponse) {\n\tif *target == nil {\n\t\t*target = new(ListPlanAssignmentsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase ListPlanAssignmentsResponse_FieldPathSelectorPlanAssignments:\n\t\t(*target).PlanAssignments = fpv.value.([]*plan_assignment.PlanAssignment)\n\tcase ListPlanAssignmentsResponse_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*plan_assignment.PagerCursor)\n\tcase ListPlanAssignmentsResponse_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*plan_assignment.PagerCursor)\n\tcase ListPlanAssignmentsResponse_FieldPathSelectorCurrentOffset:\n\t\t(*target).CurrentOffset = fpv.value.(int32)\n\tcase ListPlanAssignmentsResponse_FieldPathSelectorTotalResultsCount:\n\t\t(*target).TotalResultsCount = fpv.value.(int32)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListPlanAssignmentsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "5a57ffb400e8d613c3027122f67cf06a", "score": "0.5204522", "text": "func (fpv *AcceptPlanAssignmentResponse_FieldTerminalPathValue) SetTo(target **AcceptPlanAssignmentResponse) {\n\tif *target == nil {\n\t\t*target = new(AcceptPlanAssignmentResponse)\n\t}\n\tswitch fpv.selector {\n\tcase AcceptPlanAssignmentResponse_FieldPathSelectorAcceptedPlan:\n\t\t(*target).AcceptedPlan = fpv.value.(*accepted_plan.AcceptedPlan)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for AcceptPlanAssignmentResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "b2e830b03d6962f2d822b9c26613361a", "score": "0.52045155", "text": "func (o *GetDeploymentExpenseHistoryByIDUsingGETParams) SetTo(to *strfmt.DateTime) {\n\to.To = to\n}", "title": "" }, { "docid": "2e3dcd7b59d901edb0634aa604ad9b1e", "score": "0.52033854", "text": "func (fpv *ProvisionServiceAccountToDeviceResponse_FieldTerminalPathValue) SetTo(target **ProvisionServiceAccountToDeviceResponse) {\n\tif *target == nil {\n\t\t*target = new(ProvisionServiceAccountToDeviceResponse)\n\t}\n\tswitch fpv.selector {\n\tcase ProvisionServiceAccountToDeviceResponse_FieldPathSelectorServiceAccount:\n\t\t(*target).ServiceAccount = fpv.value.(*api.ServiceAccount)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ProvisionServiceAccountToDeviceResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "f408299c098cc2f478cdf45780b5f784", "score": "0.5201937", "text": "func (o AccessSelectorResponseOutput) Roles() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AccessSelectorResponse) []string { return v.Roles }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "96956163f74e11de91583edcb779e972", "score": "0.5198205", "text": "func (fpv *BatchGetConfigMapsRequest_FieldTerminalPathValue) SetTo(target **BatchGetConfigMapsRequest) {\n\tif *target == nil {\n\t\t*target = new(BatchGetConfigMapsRequest)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetConfigMapsRequest_FieldPathSelectorNames:\n\t\t(*target).Names = fpv.value.([]*config_map.Reference)\n\tcase BatchGetConfigMapsRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*config_map.ConfigMap_FieldMask)\n\tcase BatchGetConfigMapsRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetConfigMapsRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "35d3e9e32cff3e108fc39923eb00871c", "score": "0.5196645", "text": "func (fpv *WatchOrganizationInvitationsResponsePageTokenChange_FieldTerminalPathValue) SetTo(target **WatchOrganizationInvitationsResponse_PageTokenChange) {\n\tif *target == nil {\n\t\t*target = new(WatchOrganizationInvitationsResponse_PageTokenChange)\n\t}\n\tswitch fpv.selector {\n\tcase WatchOrganizationInvitationsResponsePageTokenChange_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*organization_invitation.PagerCursor)\n\tcase WatchOrganizationInvitationsResponsePageTokenChange_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*organization_invitation.PagerCursor)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchOrganizationInvitationsResponse_PageTokenChange: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "9259d104ea624001c9604745c74ffc02", "score": "0.51955205", "text": "func (fpv *BatchGetPlanAssignmentsRequest_FieldTerminalPathValue) SetTo(target **BatchGetPlanAssignmentsRequest) {\n\tif *target == nil {\n\t\t*target = new(BatchGetPlanAssignmentsRequest)\n\t}\n\tswitch fpv.selector {\n\tcase BatchGetPlanAssignmentsRequest_FieldPathSelectorNames:\n\t\t(*target).Names = fpv.value.([]*plan_assignment.Reference)\n\tcase BatchGetPlanAssignmentsRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*plan_assignment.PlanAssignment_FieldMask)\n\tcase BatchGetPlanAssignmentsRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetPlanAssignmentsRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "f0b77980103aa5004e0ea3fa1462ff5f", "score": "0.51928073", "text": "func (fpv *WatchPermissionsResponsePageTokenChange_FieldTerminalPathValue) SetTo(target **WatchPermissionsResponse_PageTokenChange) {\n\tif *target == nil {\n\t\t*target = new(WatchPermissionsResponse_PageTokenChange)\n\t}\n\tswitch fpv.selector {\n\tcase WatchPermissionsResponsePageTokenChange_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*permission.PagerCursor)\n\tcase WatchPermissionsResponsePageTokenChange_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*permission.PagerCursor)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchPermissionsResponse_PageTokenChange: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "58b571a19fe2e86e33dff6de851228ae", "score": "0.5186079", "text": "func (fpv *ResourceChangeLog_FieldTerminalPathValue) SetTo(target **ResourceChangeLog) {\n\tif *target == nil {\n\t\t*target = new(ResourceChangeLog)\n\t}\n\tswitch fpv.selector {\n\tcase ResourceChangeLog_FieldPathSelectorName:\n\t\t(*target).Name = fpv.value.(*Name)\n\tcase ResourceChangeLog_FieldPathSelectorScope:\n\t\t(*target).Scope = fpv.value.(string)\n\tcase ResourceChangeLog_FieldPathSelectorRequestId:\n\t\t(*target).RequestId = fpv.value.(uint64)\n\tcase ResourceChangeLog_FieldPathSelectorTimestamp:\n\t\t(*target).Timestamp = fpv.value.(*timestamp.Timestamp)\n\tcase ResourceChangeLog_FieldPathSelectorAuthentication:\n\t\t(*target).Authentication = fpv.value.(*audit_common.Authentication)\n\tcase ResourceChangeLog_FieldPathSelectorService:\n\t\t(*target).Service = fpv.value.(*audit_common.ServiceData)\n\tcase ResourceChangeLog_FieldPathSelectorResource:\n\t\t(*target).Resource = fpv.value.(*ResourceChangeLog_ResourceChange)\n\tcase ResourceChangeLog_FieldPathSelectorTransaction:\n\t\t(*target).Transaction = fpv.value.(*ResourceChangeLog_TransactionInfo)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ResourceChangeLog: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "3df926e9a73749803ae8d4b020291dfc", "score": "0.5183199", "text": "func (m *GovernanceRoleAssignmentRequest) SetResourceId(value *string)() {\n err := m.GetBackingStore().Set(\"resourceId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "005c800a63fb0db44f819b41c666dd00", "score": "0.518225", "text": "func (fpv *UpdateConfigMapRequestCAS_FieldTerminalPathValue) SetTo(target **UpdateConfigMapRequest_CAS) {\n\tif *target == nil {\n\t\t*target = new(UpdateConfigMapRequest_CAS)\n\t}\n\tswitch fpv.selector {\n\tcase UpdateConfigMapRequestCAS_FieldPathSelectorConditionalState:\n\t\t(*target).ConditionalState = fpv.value.(*config_map.ConfigMap)\n\tcase UpdateConfigMapRequestCAS_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*config_map.ConfigMap_FieldMask)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateConfigMapRequest_CAS: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "35401d0e8b8e16c26c9c8e874b2ca72d", "score": "0.51713026", "text": "func (fpv *ListenForConnectionsResponseChannelRequested_FieldTerminalPathValue) SetTo(target **ListenForConnectionsResponse_ChannelRequested) {\n\tif *target == nil {\n\t\t*target = new(ListenForConnectionsResponse_ChannelRequested)\n\t}\n\tswitch fpv.selector {\n\tcase ListenForConnectionsResponseChannelRequested_FieldPathSelectorChannel:\n\t\t(*target).Channel = fpv.value.(string)\n\tcase ListenForConnectionsResponseChannelRequested_FieldPathSelectorService:\n\t\t(*target).Service = fpv.value.(BrokerServiceType)\n\tcase ListenForConnectionsResponseChannelRequested_FieldPathSelectorArg:\n\t\t(*target).Arg = fpv.value.(string)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListenForConnectionsResponse_ChannelRequested: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "6d17fafecec160c185d11acb03a8a98e", "score": "0.51559746", "text": "func (fpv *ListApproverPlanAssignmentRequestsRequest_FieldTerminalPathValue) SetTo(target **ListApproverPlanAssignmentRequestsRequest) {\n\tif *target == nil {\n\t\t*target = new(ListApproverPlanAssignmentRequestsRequest)\n\t}\n\tswitch fpv.selector {\n\tcase ListApproverPlanAssignmentRequestsRequest_FieldPathSelectorApprover:\n\t\t(*target).Approver = fpv.value.(*iam_organization.Reference)\n\tcase ListApproverPlanAssignmentRequestsRequest_FieldPathSelectorPageSize:\n\t\t(*target).PageSize = fpv.value.(int32)\n\tcase ListApproverPlanAssignmentRequestsRequest_FieldPathSelectorPageToken:\n\t\t(*target).PageToken = fpv.value.(*plan_assignment_request.PagerCursor)\n\tcase ListApproverPlanAssignmentRequestsRequest_FieldPathSelectorOrderBy:\n\t\t(*target).OrderBy = fpv.value.(*plan_assignment_request.OrderBy)\n\tcase ListApproverPlanAssignmentRequestsRequest_FieldPathSelectorFilter:\n\t\t(*target).Filter = fpv.value.(*plan_assignment_request.Filter)\n\tcase ListApproverPlanAssignmentRequestsRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*plan_assignment_request.PlanAssignmentRequest_FieldMask)\n\tcase ListApproverPlanAssignmentRequestsRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListApproverPlanAssignmentRequestsRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "97497013497c8cb084a99235f02a67f4", "score": "0.5155406", "text": "func (fpv *UpdatePlanRequestCAS_FieldTerminalPathValue) SetTo(target **UpdatePlanRequest_CAS) {\n\tif *target == nil {\n\t\t*target = new(UpdatePlanRequest_CAS)\n\t}\n\tswitch fpv.selector {\n\tcase UpdatePlanRequestCAS_FieldPathSelectorConditionalState:\n\t\t(*target).ConditionalState = fpv.value.(*plan.Plan)\n\tcase UpdatePlanRequestCAS_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*plan.Plan_FieldMask)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdatePlanRequest_CAS: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "e88c628ad3fcf7a42d31016a0e96880a", "score": "0.511365", "text": "func (fpv *ListenForConnectionsResponse_FieldTerminalPathValue) SetTo(target **ListenForConnectionsResponse) {\n\tif *target == nil {\n\t\t*target = new(ListenForConnectionsResponse)\n\t}\n\tswitch fpv.selector {\n\tcase ListenForConnectionsResponse_FieldPathSelectorChannelRequested:\n\t\tif _, ok := (*target).Msg.(*ListenForConnectionsResponse_ChannelRequested_); !ok {\n\t\t\t(*target).Msg = &ListenForConnectionsResponse_ChannelRequested_{}\n\t\t}\n\t\t(*target).Msg.(*ListenForConnectionsResponse_ChannelRequested_).ChannelRequested = fpv.value.(*ListenForConnectionsResponse_ChannelRequested)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListenForConnectionsResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "6aac6bb6c60d4e0f8eec9f4bdb23fb9b", "score": "0.5113649", "text": "func (o *GetActivityLogsParams) SetTo(to *strfmt.DateTime) {\n\to.To = to\n}", "title": "" }, { "docid": "83d2a3c6012dca4921baf768a6fdd164", "score": "0.511006", "text": "func (fpv *ListServicesRequest_FieldTerminalPathValue) SetTo(target **ListServicesRequest) {\n\tif *target == nil {\n\t\t*target = new(ListServicesRequest)\n\t}\n\tswitch fpv.selector {\n\tcase ListServicesRequest_FieldPathSelectorPageSize:\n\t\t(*target).PageSize = fpv.value.(int32)\n\tcase ListServicesRequest_FieldPathSelectorPageToken:\n\t\t(*target).PageToken = fpv.value.(*service.PagerCursor)\n\tcase ListServicesRequest_FieldPathSelectorOrderBy:\n\t\t(*target).OrderBy = fpv.value.(*service.OrderBy)\n\tcase ListServicesRequest_FieldPathSelectorFilter:\n\t\t(*target).Filter = fpv.value.(*service.Filter)\n\tcase ListServicesRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*service.Service_FieldMask)\n\tcase ListServicesRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tcase ListServicesRequest_FieldPathSelectorIncludePagingInfo:\n\t\t(*target).IncludePagingInfo = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListServicesRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "e6cead9ddc8138bc8fb9502e1071ca36", "score": "0.5107601", "text": "func (fpv *WatchConfigMapResponse_FieldTerminalPathValue) SetTo(target **WatchConfigMapResponse) {\n\tif *target == nil {\n\t\t*target = new(WatchConfigMapResponse)\n\t}\n\tswitch fpv.selector {\n\tcase WatchConfigMapResponse_FieldPathSelectorChange:\n\t\t(*target).Change = fpv.value.(*config_map.ConfigMapChange)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchConfigMapResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "c75b84f4a6a9f16b793dd249748932c0", "score": "0.5105926", "text": "func (m *ServicePrincipal) SetAppRoles(value []AppRoleable)() {\n err := m.GetBackingStore().Set(\"appRoles\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e2bf8fcde694b910d790da2682e8a414", "score": "0.5104524", "text": "func (fpmv *ResourceChangeLogResourceChange_FieldPathMapValue) SetTo(target **ResourceChangeLog_ResourceChange) {\n\tif *target == nil {\n\t\t*target = new(ResourceChangeLog_ResourceChange)\n\t}\n\tswitch fpmv.selector {\n\tcase ResourceChangeLogResourceChange_FieldPathSelectorLabels:\n\t\tif (*target).Labels == nil {\n\t\t\t(*target).Labels = make(map[string]string)\n\t\t}\n\t\t(*target).Labels[fpmv.key] = fpmv.value.(string)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ResourceChangeLog_ResourceChange: %d\", fpmv.selector))\n\t}\n}", "title": "" }, { "docid": "d98bf2761ee6ba77b4ff3ea993299f49", "score": "0.5099528", "text": "func (fpv *UpdateServiceRequestCAS_FieldTerminalPathValue) SetTo(target **UpdateServiceRequest_CAS) {\n\tif *target == nil {\n\t\t*target = new(UpdateServiceRequest_CAS)\n\t}\n\tswitch fpv.selector {\n\tcase UpdateServiceRequestCAS_FieldPathSelectorConditionalState:\n\t\t(*target).ConditionalState = fpv.value.(*service.Service)\n\tcase UpdateServiceRequestCAS_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*service.Service_FieldMask)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateServiceRequest_CAS: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "796313176f31f0a225d97445e7b40b33", "score": "0.50988525", "text": "func (m *BookingStaffMember) SetRole(value *BookingStaffRole)() {\n err := m.GetBackingStore().Set(\"role\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4228e9cc2d41bb60ce02eec9ee4025fb", "score": "0.5098703", "text": "func (fpv *UpdatePlanAssignmentRequestCAS_FieldTerminalPathValue) SetTo(target **UpdatePlanAssignmentRequest_CAS) {\n\tif *target == nil {\n\t\t*target = new(UpdatePlanAssignmentRequest_CAS)\n\t}\n\tswitch fpv.selector {\n\tcase UpdatePlanAssignmentRequestCAS_FieldPathSelectorConditionalState:\n\t\t(*target).ConditionalState = fpv.value.(*plan_assignment.PlanAssignment)\n\tcase UpdatePlanAssignmentRequestCAS_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*plan_assignment.PlanAssignment_FieldMask)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdatePlanAssignmentRequest_CAS: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "e428830ca58f8f16c97f4051c908cd5b", "score": "0.5095503", "text": "func (m *UnifiedRoleEligibilityScheduleCollectionResponse) SetValue(value []UnifiedRoleEligibilityScheduleable)() {\n m.value = value\n}", "title": "" }, { "docid": "cbd7e6de84d44b6254b71def413a2939", "score": "0.5094831", "text": "func (fpv *ListConfigMapsRequest_FieldTerminalPathValue) SetTo(target **ListConfigMapsRequest) {\n\tif *target == nil {\n\t\t*target = new(ListConfigMapsRequest)\n\t}\n\tswitch fpv.selector {\n\tcase ListConfigMapsRequest_FieldPathSelectorParent:\n\t\t(*target).Parent = fpv.value.(*config_map.ParentName)\n\tcase ListConfigMapsRequest_FieldPathSelectorPageSize:\n\t\t(*target).PageSize = fpv.value.(int32)\n\tcase ListConfigMapsRequest_FieldPathSelectorPageToken:\n\t\t(*target).PageToken = fpv.value.(*config_map.PagerCursor)\n\tcase ListConfigMapsRequest_FieldPathSelectorOrderBy:\n\t\t(*target).OrderBy = fpv.value.(*config_map.OrderBy)\n\tcase ListConfigMapsRequest_FieldPathSelectorFilter:\n\t\t(*target).Filter = fpv.value.(*config_map.Filter)\n\tcase ListConfigMapsRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*config_map.ConfigMap_FieldMask)\n\tcase ListConfigMapsRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tcase ListConfigMapsRequest_FieldPathSelectorIncludePagingInfo:\n\t\t(*target).IncludePagingInfo = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListConfigMapsRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "1b5f25ffe2d5ecefcb5b4fd326bc3bd5", "score": "0.5092546", "text": "func (fpv *RemoveServiceAccountFromDeviceResponse_FieldTerminalPathValue) SetTo(target **RemoveServiceAccountFromDeviceResponse) {\n\tif *target == nil {\n\t\t*target = new(RemoveServiceAccountFromDeviceResponse)\n\t}\n\tswitch fpv.selector {\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for RemoveServiceAccountFromDeviceResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "7deeaa5f9d81cfbc321d2f7d427d4327", "score": "0.50843936", "text": "func (fpv *SecurityContext_FieldTerminalPathValue) SetTo(target **SecurityContext) {\n\tif *target == nil {\n\t\t*target = new(SecurityContext)\n\t}\n\tswitch fpv.selector {\n\tcase SecurityContext_FieldPathSelectorPrivileged:\n\t\t(*target).Privileged = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for SecurityContext: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "fd2f82e57fd99cd60e0668fa31755f1d", "score": "0.507822", "text": "func (o ScriptActionResponseOutput) Roles() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v ScriptActionResponse) interface{} { return v.Roles }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "82f468d709716546fb90dc371cc5c625", "score": "0.5067126", "text": "func (fpv *GetPlanAssignmentRequest_FieldTerminalPathValue) SetTo(target **GetPlanAssignmentRequest) {\n\tif *target == nil {\n\t\t*target = new(GetPlanAssignmentRequest)\n\t}\n\tswitch fpv.selector {\n\tcase GetPlanAssignmentRequest_FieldPathSelectorName:\n\t\t(*target).Name = fpv.value.(*plan_assignment.Reference)\n\tcase GetPlanAssignmentRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*plan_assignment.PlanAssignment_FieldMask)\n\tcase GetPlanAssignmentRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for GetPlanAssignmentRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "a55f1abd284e3c6cde9dc9c0fe8b5b75", "score": "0.5057378", "text": "func (fpv *CreateConfigMapRequest_FieldTerminalPathValue) SetTo(target **CreateConfigMapRequest) {\n\tif *target == nil {\n\t\t*target = new(CreateConfigMapRequest)\n\t}\n\tswitch fpv.selector {\n\tcase CreateConfigMapRequest_FieldPathSelectorParent:\n\t\t(*target).Parent = fpv.value.(*config_map.ParentReference)\n\tcase CreateConfigMapRequest_FieldPathSelectorConfigMap:\n\t\t(*target).ConfigMap = fpv.value.(*config_map.ConfigMap)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for CreateConfigMapRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "e71ad6435dcf2e67771187f508f23ef4", "score": "0.50513345", "text": "func (m *SecureScoreControlStateUpdate) SetAssignedTo(value *string)() {\n m.assignedTo = value\n}", "title": "" }, { "docid": "e84473565d1a10084eeaf1b4bafbd73e", "score": "0.5049352", "text": "func (fpv *ListPlansRequest_FieldTerminalPathValue) SetTo(target **ListPlansRequest) {\n\tif *target == nil {\n\t\t*target = new(ListPlansRequest)\n\t}\n\tswitch fpv.selector {\n\tcase ListPlansRequest_FieldPathSelectorPageSize:\n\t\t(*target).PageSize = fpv.value.(int32)\n\tcase ListPlansRequest_FieldPathSelectorPageToken:\n\t\t(*target).PageToken = fpv.value.(*plan.PagerCursor)\n\tcase ListPlansRequest_FieldPathSelectorOrderBy:\n\t\t(*target).OrderBy = fpv.value.(*plan.OrderBy)\n\tcase ListPlansRequest_FieldPathSelectorFilter:\n\t\t(*target).Filter = fpv.value.(*plan.Filter)\n\tcase ListPlansRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*plan.Plan_FieldMask)\n\tcase ListPlansRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tcase ListPlansRequest_FieldPathSelectorIncludePagingInfo:\n\t\t(*target).IncludePagingInfo = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListPlansRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "2a3e97a8835662d50b3e2e73d03fa463", "score": "0.50477135", "text": "func (uuo *UserUpdateOne) SetRoles(s []string) *UserUpdateOne {\n\tuuo.mutation.SetRoles(s)\n\treturn uuo\n}", "title": "" }, { "docid": "cdafa63c80dd6ed204e02d7b4661eece", "score": "0.5046324", "text": "func (fpv *WatchPlansResponsePageTokenChange_FieldTerminalPathValue) SetTo(target **WatchPlansResponse_PageTokenChange) {\n\tif *target == nil {\n\t\t*target = new(WatchPlansResponse_PageTokenChange)\n\t}\n\tswitch fpv.selector {\n\tcase WatchPlansResponsePageTokenChange_FieldPathSelectorPrevPageToken:\n\t\t(*target).PrevPageToken = fpv.value.(*plan.PagerCursor)\n\tcase WatchPlansResponsePageTokenChange_FieldPathSelectorNextPageToken:\n\t\t(*target).NextPageToken = fpv.value.(*plan.PagerCursor)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchPlansResponse_PageTokenChange: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "da1fb990ab56adaa395fea22a78fcef5", "score": "0.5035269", "text": "func (fpv *GetPlanRequest_FieldTerminalPathValue) SetTo(target **GetPlanRequest) {\n\tif *target == nil {\n\t\t*target = new(GetPlanRequest)\n\t}\n\tswitch fpv.selector {\n\tcase GetPlanRequest_FieldPathSelectorName:\n\t\t(*target).Name = fpv.value.(*plan.Reference)\n\tcase GetPlanRequest_FieldPathSelectorFieldMask:\n\t\t(*target).FieldMask = fpv.value.(*plan.Plan_FieldMask)\n\tcase GetPlanRequest_FieldPathSelectorView:\n\t\t(*target).View = fpv.value.(view.View)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for GetPlanRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "cf46565cbbf3863487d359f92a4eabcb", "score": "0.5034182", "text": "func (p *MockPeer) SetRoles(roles []string) {\r\n\tp.MockRoles = roles\r\n}", "title": "" }, { "docid": "eb06ae513a3a9ec2dc132a7f5c3c0df8", "score": "0.50327843", "text": "func (fpv *UpdatePermissionRequest_FieldTerminalPathValue) SetTo(target **UpdatePermissionRequest) {\n\tif *target == nil {\n\t\t*target = new(UpdatePermissionRequest)\n\t}\n\tswitch fpv.selector {\n\tcase UpdatePermissionRequest_FieldPathSelectorPermission:\n\t\t(*target).Permission = fpv.value.(*permission.Permission)\n\tcase UpdatePermissionRequest_FieldPathSelectorUpdateMask:\n\t\t(*target).UpdateMask = fpv.value.(*permission.Permission_FieldMask)\n\tcase UpdatePermissionRequest_FieldPathSelectorCas:\n\t\t(*target).Cas = fpv.value.(*UpdatePermissionRequest_CAS)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdatePermissionRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "b3ba84be133c37d1f3e919249f31604f", "score": "0.50252706", "text": "func (fpv *ResourceChangeLogResourceChange_FieldTerminalPathValue) SetTo(target **ResourceChangeLog_ResourceChange) {\n\tif *target == nil {\n\t\t*target = new(ResourceChangeLog_ResourceChange)\n\t}\n\tswitch fpv.selector {\n\tcase ResourceChangeLogResourceChange_FieldPathSelectorName:\n\t\t(*target).Name = fpv.value.(string)\n\tcase ResourceChangeLogResourceChange_FieldPathSelectorType:\n\t\t(*target).Type = fpv.value.(string)\n\tcase ResourceChangeLogResourceChange_FieldPathSelectorAction:\n\t\t(*target).Action = fpv.value.(ResourceChangeLog_ResourceChange_Action)\n\tcase ResourceChangeLogResourceChange_FieldPathSelectorUpdatedFields:\n\t\t(*target).UpdatedFields = fpv.value.(*field_mask.FieldMask)\n\tcase ResourceChangeLogResourceChange_FieldPathSelectorPrevious:\n\t\t(*target).Previous = fpv.value.(*any.Any)\n\tcase ResourceChangeLogResourceChange_FieldPathSelectorCurrent:\n\t\t(*target).Current = fpv.value.(*any.Any)\n\tcase ResourceChangeLogResourceChange_FieldPathSelectorLabels:\n\t\t(*target).Labels = fpv.value.(map[string]string)\n\tcase ResourceChangeLogResourceChange_FieldPathSelectorPre:\n\t\t(*target).Pre = fpv.value.(*audit_common.ObjectState)\n\tcase ResourceChangeLogResourceChange_FieldPathSelectorPost:\n\t\t(*target).Post = fpv.value.(*audit_common.ObjectState)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ResourceChangeLog_ResourceChange: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "3ef4c990909adcfa5fa6ed296a03bc52", "score": "0.5011063", "text": "func (rc RoleController) SetAuthority(c *gin.Context) {\n\troleID := c.PostForm(\"roleId\")\n\tids := c.PostForm(\"ids\")\n\tid, err := strconv.ParseInt(roleID, 10, 64)\n\tif err != nil {\n\t\tr.JSON(c.Writer, http.StatusBadRequest, gin.H{\n\t\t\t\"message\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\terr = rc.RoleDao.SetAuthority(id, ids)\n\tif err != nil {\n\t\tr.JSON(c.Writer, http.StatusInternalServerError, gin.H{\n\t\t\t\"message\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tr.JSON(c.Writer, http.StatusOK, gin.H{\n\t\t\"message\": \"success\",\n\t})\n}", "title": "" }, { "docid": "94a5e87717dfbcfed7a969a4414518ba", "score": "0.5003029", "text": "func (fpv *ResourceChangeLogTransactionInfo_FieldTerminalPathValue) SetTo(target **ResourceChangeLog_TransactionInfo) {\n\tif *target == nil {\n\t\t*target = new(ResourceChangeLog_TransactionInfo)\n\t}\n\tswitch fpv.selector {\n\tcase ResourceChangeLogTransactionInfo_FieldPathSelectorIdentifier:\n\t\t(*target).Identifier = fpv.value.(string)\n\tcase ResourceChangeLogTransactionInfo_FieldPathSelectorTryCounter:\n\t\t(*target).TryCounter = fpv.value.(int32)\n\tcase ResourceChangeLogTransactionInfo_FieldPathSelectorState:\n\t\t(*target).State = fpv.value.(ResourceChangeLog_TransactionInfo_State)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ResourceChangeLog_TransactionInfo: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "cbe304185d5a2ea28b9b6d5d859b5df8", "score": "0.50003594", "text": "func (fpv *AcceptPlanAssignmentRequest_FieldTerminalPathValue) SetTo(target **AcceptPlanAssignmentRequest) {\n\tif *target == nil {\n\t\t*target = new(AcceptPlanAssignmentRequest)\n\t}\n\tswitch fpv.selector {\n\tcase AcceptPlanAssignmentRequest_FieldPathSelectorName:\n\t\t(*target).Name = fpv.value.(*plan_assignment_request.Reference)\n\tcase AcceptPlanAssignmentRequest_FieldPathSelectorApprover:\n\t\t(*target).Approver = fpv.value.(*iam_organization.Reference)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for AcceptPlanAssignmentRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "943886ae626cc116eaceadff0d521539", "score": "0.499196", "text": "func (fpv *WatchPlansResponse_FieldTerminalPathValue) SetTo(target **WatchPlansResponse) {\n\tif *target == nil {\n\t\t*target = new(WatchPlansResponse)\n\t}\n\tswitch fpv.selector {\n\tcase WatchPlansResponse_FieldPathSelectorPlanChanges:\n\t\t(*target).PlanChanges = fpv.value.([]*plan.PlanChange)\n\tcase WatchPlansResponse_FieldPathSelectorIsCurrent:\n\t\t(*target).IsCurrent = fpv.value.(bool)\n\tcase WatchPlansResponse_FieldPathSelectorPageTokenChange:\n\t\t(*target).PageTokenChange = fpv.value.(*WatchPlansResponse_PageTokenChange)\n\tcase WatchPlansResponse_FieldPathSelectorResumeToken:\n\t\t(*target).ResumeToken = fpv.value.(string)\n\tcase WatchPlansResponse_FieldPathSelectorSnapshotSize:\n\t\t(*target).SnapshotSize = fpv.value.(int64)\n\tcase WatchPlansResponse_FieldPathSelectorIsSoftReset:\n\t\t(*target).IsSoftReset = fpv.value.(bool)\n\tcase WatchPlansResponse_FieldPathSelectorIsHardReset:\n\t\t(*target).IsHardReset = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchPlansResponse: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "729cae458fc1a8a941a363e13e24ba81", "score": "0.49901655", "text": "func (fpv *CreateOrganizationInvitationRequest_FieldTerminalPathValue) SetTo(target **CreateOrganizationInvitationRequest) {\n\tif *target == nil {\n\t\t*target = new(CreateOrganizationInvitationRequest)\n\t}\n\tswitch fpv.selector {\n\tcase CreateOrganizationInvitationRequest_FieldPathSelectorParent:\n\t\t(*target).Parent = fpv.value.(*organization_invitation.ParentReference)\n\tcase CreateOrganizationInvitationRequest_FieldPathSelectorOrganizationInvitation:\n\t\t(*target).OrganizationInvitation = fpv.value.(*organization_invitation.OrganizationInvitation)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for CreateOrganizationInvitationRequest: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "61c74fba65770b073fbeb3d594040f78", "score": "0.49869895", "text": "func (fpv *WatchPlanAssignmentResponse_FieldTerminalPathValue) SetTo(target **WatchPlanAssignmentResponse) {\n\tif *target == nil {\n\t\t*target = new(WatchPlanAssignmentResponse)\n\t}\n\tswitch fpv.selector {\n\tcase WatchPlanAssignmentResponse_FieldPathSelectorChange:\n\t\t(*target).Change = fpv.value.(*plan_assignment.PlanAssignmentChange)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchPlanAssignmentResponse: %d\", fpv.selector))\n\t}\n}", "title": "" } ]
14c4603b2923fe48bc13f2971a2d875b
GetLevelOk returns a tuple with the Level field value and a boolean to check if the value has been set.
[ { "docid": "2a0729b6065b893fa767b3883434f9bb", "score": "0.80681396", "text": "func (o *CreateEventPayloadActions) GetLevelOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Level, true\n}", "title": "" } ]
[ { "docid": "1e39a7bb84d82209ab12d30c5777dcaa", "score": "0.79733896", "text": "func (o *BulletinDTO) GetLevelOk() (*string, bool) {\n\tif o == nil || o.Level == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Level, true\n}", "title": "" }, { "docid": "4cbae1087c8a9ba0ee1511eb4f9e25d2", "score": "0.6548693", "text": "func (o *IpamNetworkDataData) GetNetworkLevelOk() (*string, bool) {\n\tif o == nil || o.NetworkLevel == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetworkLevel, true\n}", "title": "" }, { "docid": "54f63efab6ae35b66ad49d52a908d305", "score": "0.6410322", "text": "func (o *TransactionResult) GetDebugLevelOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DebugLevel.Get(), o.DebugLevel.IsSet()\n}", "title": "" }, { "docid": "23857f612ac42dbe6886767a12e11afa", "score": "0.6270755", "text": "func (o *TagModelStore) GetZoomLevelOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ZoomLevel.Get(), o.ZoomLevel.IsSet()\n}", "title": "" }, { "docid": "cbd8756d9947fc2ee65ec0f5247600d0", "score": "0.6220894", "text": "func (o *AUMPortfolioRisk) GetRiskLevelOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RiskLevel, true\n}", "title": "" }, { "docid": "ad43c23ffff8b365ec1c14c5d76821b6", "score": "0.6208221", "text": "func (o *Global) GetLogLevOk() (*string, bool) {\n\tif o == nil || o.LogLev == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LogLev, true\n}", "title": "" }, { "docid": "d4e4454e35541cc66bf736ce0c19065a", "score": "0.59754306", "text": "func (o *LastMileAccelerationOptions) GetCompressionLevelOk() (*int32, bool) {\n\tif o == nil || o.CompressionLevel == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CompressionLevel, true\n}", "title": "" }, { "docid": "4a005bb8e2c6838f4602d6f0f30567ba", "score": "0.5960179", "text": "func (g *group) GetLevel() Level {\n\treturn g.level\n}", "title": "" }, { "docid": "0a8b1d3e1ad7ef46ac6587731364778a", "score": "0.5905079", "text": "func GetLevel() (level Level) {\n\treturn filterLevel\n}", "title": "" }, { "docid": "5815ef4eb3616833334742a9e45a437f", "score": "0.58124566", "text": "func (o *VisuallyComplete2Settings) GetThresholdOk() (*int32, bool) {\n\tif o == nil || o.Threshold == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Threshold, true\n}", "title": "" }, { "docid": "e27b4435d204572624b46976dc37455a", "score": "0.57909197", "text": "func (m *OrgUnitPositionMutation) AddedLevel() (r int, exists bool) {\n\tv := m.addlevel\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "0b7f27d82ab2175aac923816c903087a", "score": "0.5789459", "text": "func (o *BulletinDTO) HasLevel() bool {\n\tif o != nil && o.Level != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2827d3e5ee979c9344583765788ca3dd", "score": "0.57454234", "text": "func (m *CompetenceMutation) AddedLevel() (r int, exists bool) {\n\tv := m.addlevel\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "c5355dc90fdd3c39d4ed43e11b1bb805", "score": "0.57284695", "text": "func (o *ShowSystem) GetServiceLevelPreferenceOk() (*string, bool) {\n\tif o == nil || IsNil(o.ServiceLevelPreference) {\n\t\treturn nil, false\n\t}\n\treturn o.ServiceLevelPreference, true\n}", "title": "" }, { "docid": "bef991352e88caa9897b1e0b86859327", "score": "0.5666904", "text": "func (m *CompetenceMutation) Level() (r int, exists bool) {\n\tv := m.level\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "e6674007c15821637683735eda041642", "score": "0.5662132", "text": "func (o *User) GetAgeGroupOk() (string, bool) {\n\tif o == nil || o.AgeGroup == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.AgeGroup, true\n}", "title": "" }, { "docid": "f6b90c5dabc50e33a3a4f33e631d1571", "score": "0.56612563", "text": "func GetLevel() Level {\n\treturn DefaultLevel\n}", "title": "" }, { "docid": "2b0afd4ae33ab2237385aff7e458d750", "score": "0.56445366", "text": "func (m *OrgUnitPositionMutation) Level() (r int, exists bool) {\n\tv := m.level\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "98e2463b95ce9182e60300f864858e2a", "score": "0.5623055", "text": "func (m *LevelManager) GetLevel(name string) (Map, bool) {\n\tlvl, ok := m.levels[name]\n\treturn lvl, ok\n}", "title": "" }, { "docid": "4c09a9f2c7aef075e1c58853fe037379", "score": "0.55971885", "text": "func (l *Logger) checkLevel (formatptr *string, v ...interface{}) bool {\n\tif strings.Index(*formatptr, \"%LVL\") > -1 && len(v) > 0 {\n\t\t*formatptr = strings.Replace(*formatptr, \"%LVL\", \"%v\", 1)\n\t\tswitch v[0].(type) { case int:\n\t\t\tif l.level != -1 && l.level < v[0].(int) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ce0412de3413c2e73ec48200cf0d362c", "score": "0.55961955", "text": "func GetLevel(levelName string) (level, bool) {\n\tlevelName = strings.ToUpper(levelName)\n\n\tswitch (levelName) {\n\tcase \"NOLOG\":\n\t\treturn NOLOG, true\n\n\tcase \"ERROR\":\n\t\treturn ERROR, true\n\n\tcase \"WARN\":\n\t\treturn WARN, true\n\n\tcase \"VERBOSE\":\n\t\treturn VERBOSE, true\n\n\tcase \"INFO\":\n\t\treturn INFO, true\n\n\tcase \"DEBUG\":\n\t\treturn DEBUG, true\n\t}\n\n\treturn NOLOG, false\n}", "title": "" }, { "docid": "02708db50c87e4ae998b168beab13ff6", "score": "0.55887806", "text": "func GetLevel() (level Level) {\n\treturn lconf.FilterLevel\n}", "title": "" }, { "docid": "6ca0b9f2530a7d81e7b74e424728aa0d", "score": "0.5580431", "text": "func (o *RumMetricUpdate) GetEnabledOk() (*bool, bool) {\n\tif o == nil || o.Enabled == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Enabled, true\n}", "title": "" }, { "docid": "6c2e0936e87cb0de7a9636c346f86e60", "score": "0.55106664", "text": "func (l *Config) GetLevel() string {\n\tif l.Level == \"\" {\n\t\treturn defaultLevel\n\t}\n\n\treturn l.Level\n}", "title": "" }, { "docid": "b25cd9f8c877e3d1045e3cfc9592a107", "score": "0.5507121", "text": "func (this *resultStruct) Level() int32 {\n\tvalue := this.level\n\treturn value\n}", "title": "" }, { "docid": "3970afb4ac18725bbcae5c234e43b3ed", "score": "0.5505984", "text": "func (o *IpamNetworkDataData) GetParentNetworkLevelOk() (*string, bool) {\n\tif o == nil || o.ParentNetworkLevel == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentNetworkLevel, true\n}", "title": "" }, { "docid": "64d302e209618c8256f95f85b1f2145f", "score": "0.5504518", "text": "func (o *Member) GetStatusOk() (*int32, bool) {\n\tif o == nil || o.Status == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Status, true\n}", "title": "" }, { "docid": "f893924a49fa47e9b5876e15fb6859b8", "score": "0.5500036", "text": "func (o *Dig) GetDepthOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Depth, true\n}", "title": "" }, { "docid": "8c23d44b5b3e741a29137cb44ee1a210", "score": "0.5445258", "text": "func (o *SyntheticMonitorUpdate) GetEnabledOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Enabled, true\n}", "title": "" }, { "docid": "bb5368880257bfd3d7a70d4eb914fc63", "score": "0.541509", "text": "func (o *RoleWithAccess) GetModifiedOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Modified, true\n}", "title": "" }, { "docid": "be014d416715c62f19d35f5f26c6fe90", "score": "0.54103255", "text": "func validateLevel(p *field.Path, value string) field.ErrorList {\n\terrs := field.ErrorList{}\n\t_, err := api.ParseLevel(value)\n\tif err != nil {\n\t\terrs = append(errs, field.Invalid(p, value, err.Error()))\n\t}\n\treturn errs\n}", "title": "" }, { "docid": "357d4f46fdf6c44e5d0a15ecf16cde8f", "score": "0.54063416", "text": "func (ll *LogLevel) Get() logrus.Level {\n\tswitch *ll {\n\tcase \"trace\":\n\t\treturn logrus.TraceLevel\n\tcase \"debug\":\n\t\treturn logrus.DebugLevel\n\tcase \"info\":\n\t\treturn logrus.InfoLevel\n\tcase \"warn\":\n\t\treturn logrus.WarnLevel\n\tcase \"error\":\n\t\treturn logrus.ErrorLevel\n\tcase \"fatal\":\n\t\treturn logrus.FatalLevel\n\tcase \"panic\":\n\t\treturn logrus.PanicLevel\n\tdefault:\n\t\treturn logrus.TraceLevel\n\t}\n}", "title": "" }, { "docid": "db02f227f91d5c6ea2ede47431d5a812", "score": "0.53883404", "text": "func (o *FileversionFileversion) GetPrivacyOk() (*PayloadUserGroups, bool) {\n\tif o == nil || o.Privacy == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Privacy, true\n}", "title": "" }, { "docid": "35ef089fe4175b70455b58626e263775", "score": "0.53827536", "text": "func (o *NormalizedProjectRevisionHook) GetHookOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Hook, true\n}", "title": "" }, { "docid": "b8fc42a3c0c208f8a994d658ca6b7cbc", "score": "0.5381799", "text": "func (o *ViewMilestone) GetPrivateOk() (*bool, bool) {\n\tif o == nil || o.Private == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Private, true\n}", "title": "" }, { "docid": "676bbbc580f1307bfb7113695051d66a", "score": "0.5378598", "text": "func (o *MicrosoftGraphModifiedProperty) GetNewValueOk() (string, bool) {\n\tif o == nil || o.NewValue == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.NewValue, true\n}", "title": "" }, { "docid": "de0bbec0837778caba5a537877e062e2", "score": "0.53730863", "text": "func (o *TeamPermissionSettingAttributes) GetValueOk() (*TeamPermissionSettingValue, bool) {\n\tif o == nil || o.Value == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Value, true\n}", "title": "" }, { "docid": "9af4f42819a80c073a805c230a621cbe", "score": "0.53706217", "text": "func (lm *LevelManager) HasNextLevel() bool {\n\t// Note: len(levels) is a safer way to achieve this, but the hard coded approach better suits the Jack OS API\n\treturn lm.currentLevelNumber < lm.GetFinalLevelNumber()\n}", "title": "" }, { "docid": "12b226cbd2ff1ac403f10e3064f86b52", "score": "0.53698844", "text": "func (o *VulnUpdateNotification) GetRecordStateValOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RecordStateVal.Get(), o.RecordStateVal.IsSet()\n}", "title": "" }, { "docid": "f0e72b20f479f7681d91c0778220f0aa", "score": "0.53575623", "text": "func GetLevel() Level {\n\treturn currentLevel\n}", "title": "" }, { "docid": "4fdef6c3bbb07b89e64137a054d0089a", "score": "0.53508556", "text": "func TestLevelFlags(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tlevel Level\n\t\tmethod func(*Level) bool\n\t\tcontain bool\n\t}{\n\t\t{\n\t\t\tname: \"Panic Flag in Panic Level\",\n\t\t\tlevel: Panic,\n\t\t\tmethod: (*Level).Panic,\n\t\t\tcontain: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Panic Flag in Error Level\",\n\t\t\tlevel: Error,\n\t\t\tmethod: (*Level).Panic,\n\t\t\tcontain: false,\n\t\t},\n\t\t{\n\t\t\tname: \"Fatal Flag in Fatal Level\",\n\t\t\tlevel: Fatal,\n\t\t\tmethod: (*Level).Fatal,\n\t\t\tcontain: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Fatal Flag in Error Level\",\n\t\t\tlevel: Error,\n\t\t\tmethod: (*Level).Fatal,\n\t\t\tcontain: false,\n\t\t},\n\t\t{\n\t\t\tname: \"Error Flag in Error Level\",\n\t\t\tlevel: Error,\n\t\t\tmethod: (*Level).Error,\n\t\t\tcontain: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Error Flag in Info Level\",\n\t\t\tlevel: Info,\n\t\t\tmethod: (*Level).Error,\n\t\t\tcontain: false,\n\t\t},\n\t\t{\n\t\t\tname: \"Info Flag in Info Level\",\n\t\t\tlevel: Info,\n\t\t\tmethod: (*Level).Info,\n\t\t\tcontain: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Info Flag in Debug Level\",\n\t\t\tlevel: Debug,\n\t\t\tmethod: (*Level).Info,\n\t\t\tcontain: false,\n\t\t},\n\t\t{\n\t\t\tname: \"Debug Flag in Debug Level\",\n\t\t\tlevel: Debug,\n\t\t\tmethod: (*Level).Debug,\n\t\t\tcontain: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Debug Flag in Trace Level\",\n\t\t\tlevel: Trace,\n\t\t\tmethod: (*Level).Debug,\n\t\t\tcontain: false,\n\t\t},\n\t\t{\n\t\t\tname: \"Trace Flag in Trace Level\",\n\t\t\tlevel: Trace,\n\t\t\tmethod: (*Level).Trace,\n\t\t\tcontain: true,\n\t\t},\n\t\t{\n\t\t\tname: \"Trace Flag in Panic Level\",\n\t\t\tlevel: Panic,\n\t\t\tmethod: (*Level).Trace,\n\t\t\tcontain: false,\n\t\t},\n\t}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tif got := test.method(&test.level); got != test.contain {\n\t\t\t\tt.Errorf(\"%s got = %v; want %v\", test.name, got, test.contain)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "4de920fc3792f0ae07991c899dbf4c1c", "score": "0.534479", "text": "func (o *StatusDescriptorDTO) GetFieldOk() (*string, bool) {\n\tif o == nil || o.Field == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Field, true\n}", "title": "" }, { "docid": "9b1e7c5f8d0aadf12501d908c3038ab2", "score": "0.5344621", "text": "func (o *DeviceStatusTrigger) GetVersionOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Version, true\n}", "title": "" }, { "docid": "5598bd655d50abb0c245a0f76c1e0868", "score": "0.53377074", "text": "func (o *VlanRangeEditInput) GetWarningsOk() (*string, bool) {\n\tif o == nil || o.Warnings == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Warnings, true\n}", "title": "" }, { "docid": "09d28d9e293974b624bc5a3ab31c06bb", "score": "0.53241944", "text": "func (o *SLOOverallStatuses) GetStatusOk() (*float64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Status.Get(), o.Status.IsSet()\n}", "title": "" }, { "docid": "43c2bfa220d471484b1a934a6956a091", "score": "0.5319493", "text": "func (o *EquipmentFanModule) GetStatusOk() (*string, bool) {\n\tif o == nil || o.Status == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Status, true\n}", "title": "" }, { "docid": "1d803771eb36b8d983813995a471842d", "score": "0.5314957", "text": "func (o *ViewMilestone) GetLockdownOk() (*ViewRelationship, bool) {\n\tif o == nil || o.Lockdown == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Lockdown, true\n}", "title": "" }, { "docid": "48d82793f906b47e99124a24ebc9f4d0", "score": "0.53110355", "text": "func (o *ViewMilestone) GetStatusOk() (*string, bool) {\n\tif o == nil || o.Status == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Status, true\n}", "title": "" }, { "docid": "2a64c5ac39c5c9cb1039b0eda156fff3", "score": "0.5308628", "text": "func (o *CreateRiskRulesData) GetFieldOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Field, true\n}", "title": "" }, { "docid": "dc9b7336f17196d2aeb2fda224c6c141", "score": "0.5303768", "text": "func (manager *Manager) IsLevelLoaded(levelName string) bool {\n\tmanager.mutex.RLock()\n\tvar _, ok = manager.levels[levelName]\n\tmanager.mutex.RUnlock()\n\treturn ok\n}", "title": "" }, { "docid": "fd883cdb04a2f35d59c3fe7aea0b1b9f", "score": "0.5266131", "text": "func (o *CreateEventPayloadActions) GetLevel() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Level\n}", "title": "" }, { "docid": "944784cc52d43a95b53c1af330b2c430", "score": "0.5257816", "text": "func (o *BulletinDTO) GetLevel() string {\n\tif o == nil || o.Level == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Level\n}", "title": "" }, { "docid": "3b939712b441265c6ca1def3f87bb554", "score": "0.5252673", "text": "func GetPlayerLevel(L *lua.LState) int {\n\t// Get player struct\n\tplayer := getPlayerObject(L)\n\n\t// Push player level as number\n\tL.Push(lua.LNumber(player.Level))\n\n\treturn 1\n}", "title": "" }, { "docid": "f9d3e015b53b78bd7790f703886d6582", "score": "0.5247845", "text": "func (lb *Leaderboard) Level(embeds string) (*Level, *Error) {\n\tif lb.LevelData == nil {\n\t\treturn nil, nil\n\t}\n\n\t// we only have the level ID at hand\n\tasserted, okay := lb.LevelData.(string)\n\tif okay {\n\t\treturn LevelByID(asserted, embeds)\n\t}\n\n\treturn toLevel(lb.LevelData, true), nil\n}", "title": "" }, { "docid": "685466f58987a399243850c7054b98a9", "score": "0.52453315", "text": "func (o *PatchedAccount) GetLanguageOk() (*string, bool) {\n\tif o == nil || IsNil(o.Language) {\n\t\treturn nil, false\n\t}\n\treturn o.Language, true\n}", "title": "" }, { "docid": "17e8c24372c0377ed8841cc7a0a6c9f2", "score": "0.52383226", "text": "func (o *CatalogEntry) GetFlagsOk() (*string, bool) {\n\tif o == nil || o.Flags == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Flags, true\n}", "title": "" }, { "docid": "562ea41a2e5c126cd7204fa03cea4ade", "score": "0.5221578", "text": "func (v Verbosity) GetLevel() log.Level {\n\tswitch v {\n\tcase FATAL:\n\t\treturn log.FatalLevel\n\tcase ERROR:\n\t\treturn log.ErrorLevel\n\tcase WARNING:\n\t\treturn log.WarnLevel\n\tcase INFO:\n\t\treturn log.InfoLevel\n\tcase DEBUG:\n\t\treturn log.DebugLevel\n\tcase TRACE:\n\t\treturn log.TraceLevel\n\tdefault:\n\t\t// this is never reached, but in case, return INFO as the default\n\t\treturn log.InfoLevel\n\t}\n}", "title": "" }, { "docid": "19eed97cbc52c575f48c3fa8364fcfa6", "score": "0.52136964", "text": "func GetLevel() Level {\n\treturn std.Level()\n}", "title": "" }, { "docid": "2051130bb0e1fcec0aa2acf90948de34", "score": "0.5208947", "text": "func (o *ViewMilestone) GetLockdownIdOk() (*int32, bool) {\n\tif o == nil || o.LockdownId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LockdownId, true\n}", "title": "" }, { "docid": "50a62e07a31d40b354ec2f5bfa12aa95", "score": "0.52035594", "text": "func (l *ModuleLevels) GetLevel(module string) api.Level {\n\tlevel, exists := l.levels[module]\n\tif !exists {\n\t\tlevel, exists = l.levels[\"\"]\n\t\t// no configuration exists, default to info\n\t\tif !exists {\n\t\t\tlevel = api.INFO\n\t\t}\n\t}\n\treturn level\n}", "title": "" }, { "docid": "04672a491b1efff1b02c2a8949aa04d1", "score": "0.5186691", "text": "func (o *BulletinDTO) GetGroupIdOk() (*string, bool) {\n\tif o == nil || o.GroupId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.GroupId, true\n}", "title": "" }, { "docid": "d81d571115b7e1818a118d5862646e38", "score": "0.51651436", "text": "func (o *Account) GetLanguageOk() (*string, bool) {\n\tif o == nil || IsNil(o.Language) {\n\t\treturn nil, false\n\t}\n\treturn o.Language, true\n}", "title": "" }, { "docid": "b5eee94c38aeb703374d1199146b124f", "score": "0.51642257", "text": "func (o *User) GetStateOk() (string, bool) {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.State, true\n}", "title": "" }, { "docid": "19a2aa7b69218c870f2e4b60042fe27e", "score": "0.5162947", "text": "func (o *Volume) GetStateOk() (string, bool) {\n\tif o == nil || o.State == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.State, true\n}", "title": "" }, { "docid": "d4a485869df33a7c8a4615b5df193ea8", "score": "0.51593155", "text": "func (o *Volume) GetStateOk() (*string, bool) {\n\tif o == nil || o.State == nil {\n\t\treturn nil, false\n\t}\n\treturn o.State, true\n}", "title": "" }, { "docid": "66a9559618dad15813d79033a368f65b", "score": "0.5158374", "text": "func (o *LoraNetworkTrigger) GetVersionOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Version, true\n}", "title": "" }, { "docid": "e5a926d3cfc362941f00492e0d0937de", "score": "0.51561135", "text": "func (o *V0037Node) GetStateFlagsOk() (*[]string, bool) {\n\tif o == nil || o.StateFlags == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StateFlags, true\n}", "title": "" }, { "docid": "3dd9dd608f659e229f2ed72da530060f", "score": "0.5152261", "text": "func (o *MicrosoftGraphListItem) GetFieldsOk() (AnyOfmicrosoftGraphFieldValueSet, bool) {\n\tif o == nil || o.Fields == nil {\n\t\tvar ret AnyOfmicrosoftGraphFieldValueSet\n\t\treturn ret, false\n\t}\n\treturn *o.Fields, true\n}", "title": "" }, { "docid": "2557ee1884f7acd0476a6e7d68d6f53b", "score": "0.51520747", "text": "func (o *LabelProperties) GetValueOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Value, true\n}", "title": "" }, { "docid": "d245b5399766ee4ae1fb1218dc1779a9", "score": "0.5135582", "text": "func (o *FeatureFlag) GetModifiedOk() (time.Time, bool) {\n\tif o == nil || o.Modified == nil {\n\t\tvar ret time.Time\n\t\treturn ret, false\n\t}\n\treturn *o.Modified, true\n}", "title": "" }, { "docid": "c9d358f2a12e22e559f5f44a2a948bff", "score": "0.5129459", "text": "func (o *TeamConfiguration) GetVersionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Version, true\n}", "title": "" }, { "docid": "a3921a7361c6fe012ef0563142c743c5", "score": "0.5122976", "text": "func (o *Cause) GetStatusOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Status.Get(), o.Status.IsSet()\n}", "title": "" }, { "docid": "738571473645bb86f6d1c4d395bd58c3", "score": "0.51174057", "text": "func (o *LoadingTimeThresholdsPolicyDto) GetEnabledOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Enabled, true\n}", "title": "" }, { "docid": "063881065cb0705bfd024dfbc14e1873", "score": "0.51127964", "text": "func InfoLevel() Level {\n\treturn infoLevel\n}", "title": "" }, { "docid": "d44275dc8c4705d2e8e442557a6cdf5f", "score": "0.5112036", "text": "func (o *GetMessagesAllOf) GetFlagsOk() (*[]string, bool) {\n\tif o == nil || o.Flags == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Flags, true\n}", "title": "" }, { "docid": "6e6069b538f820c985225139304336ad", "score": "0.51117194", "text": "func (o *Ga4ghTumourboard) GetLevelOfEvidenceForExpressionTargetAgentMatchOk() (string, bool) {\n\tif o == nil || o.LevelOfEvidenceForExpressionTargetAgentMatch == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.LevelOfEvidenceForExpressionTargetAgentMatch, true\n}", "title": "" }, { "docid": "da6a921dee7d7848e4086c31f89517a1", "score": "0.51112306", "text": "func (o *RuleActionStore) GetValueOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Value.Get(), o.Value.IsSet()\n}", "title": "" }, { "docid": "54a95856d6c5ce8ed458793b67ee4c41", "score": "0.51096904", "text": "func (o *MicrosoftGraphWindows10CompliancePolicy) GetVersionOk() (int32, bool) {\n\tif o == nil || o.Version == nil {\n\t\tvar ret int32\n\t\treturn ret, false\n\t}\n\treturn *o.Version, true\n}", "title": "" }, { "docid": "4781e107b70079be5086a5ce332e5bde", "score": "0.51028824", "text": "func (o *DKSharesInfo) GetThresholdOk() (*uint32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Threshold, true\n}", "title": "" }, { "docid": "951e1b256dd523fe5077567e9836f9c9", "score": "0.51012444", "text": "func (manager *Manager) IsLevelGenerated(levelName string) bool {\n\tif manager.IsLevelLoaded(levelName) {\n\t\treturn true\n\t}\n\tvar path = manager.serverPath + \"worlds/\" + levelName\n\tvar _, err = os.Stat(path)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5b25d834499eb773e014d0344b85835e", "score": "0.5097457", "text": "func (o *TokenResponse) GetLivemodeOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Livemode, true\n}", "title": "" }, { "docid": "1451b3d7798fdbaae6c7f3d43040b5a1", "score": "0.5091233", "text": "func (o *MicrosoftGraphWindows10CompliancePolicy) GetBitLockerEnabledOk() (bool, bool) {\n\tif o == nil || o.BitLockerEnabled == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.BitLockerEnabled, true\n}", "title": "" }, { "docid": "eae7aaa78e0d1dba0767ee0b181cb22b", "score": "0.5086383", "text": "func Level() int {\n\treturn level\n}", "title": "" }, { "docid": "d78469c3917744c9a832791fdf318c66", "score": "0.5077567", "text": "func (o *V0037Node) GetStateOk() (*string, bool) {\n\tif o == nil || o.State == nil {\n\t\treturn nil, false\n\t}\n\treturn o.State, true\n}", "title": "" }, { "docid": "7fd507868f80081713e989b862ec37fd", "score": "0.50775427", "text": "func (o *RiskRulesListAllOfData) GetFieldOk() (*string, bool) {\n\tif o == nil || IsNil(o.Field) {\n\t\treturn nil, false\n\t}\n\treturn o.Field, true\n}", "title": "" }, { "docid": "d4b6bddf15e618575d6fbc172044d59b", "score": "0.5075886", "text": "func (o *MzPermissionsForGroup) GetGroupIdOk() (*string, bool) {\n\tif o == nil || o.GroupId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.GroupId, true\n}", "title": "" }, { "docid": "8e52185d65a657542a004ad1f0ada0ec", "score": "0.50725794", "text": "func (o *IamLdapBasePropertiesAllOf) GetNestedGroupSearchDepthOk() (*int64, bool) {\n\tif o == nil || o.NestedGroupSearchDepth == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NestedGroupSearchDepth, true\n}", "title": "" }, { "docid": "60ca30ade3f2fbea2246cdb3b441332c", "score": "0.50675154", "text": "func (n *TreeNode) Level() (byte, error) {\n\tif n == nil {\n\t\treturn 0, errors.New(errors.KsiInvalidArgumentError)\n\t}\n\treturn n.level, nil\n}", "title": "" }, { "docid": "ab1d94cd994680b833f6fcff64220ed1", "score": "0.506537", "text": "func (o *Permissao) GetIsGroupOk() (*bool, bool) {\n\tif o == nil || o.IsGroup == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsGroup, true\n}", "title": "" }, { "docid": "bb05cf919f452a235aa269aab290e81b", "score": "0.5045242", "text": "func (o *DisplayInfo) GetLanguageOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Language, true\n}", "title": "" }, { "docid": "f33c78f13a7b027f94e6600e36e270f8", "score": "0.50447106", "text": "func (o *OnpremUpgradePhase) GetStatusOk() (*string, bool) {\n\tif o == nil || o.Status == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Status, true\n}", "title": "" }, { "docid": "9cb2a01a931d2e4df6df97226ffd0498", "score": "0.504199", "text": "func (g Group) IsOk() bool {\n\tpaw.Logger.Debug(\"checking Group...\" + paw.Caller(1))\n\tif g > 0 && g < 4 {\n\t\treturn true\n\t}\n\treturn false\n\t// switch g {\n\t// case Grouped, GroupedR, GroupNone:\n\t// \treturn true\n\t// default:\n\t// \treturn false\n\t// }\n}", "title": "" }, { "docid": "614456f04a7a02f9bf35878b3d5d5705", "score": "0.5037388", "text": "func (l *Level) Get() interface{} {\n\treturn *l\n}", "title": "" }, { "docid": "bd539fcf9b6a7877d07ba45ade6f00b1", "score": "0.5036576", "text": "func (o *CheckoutResponse) GetLivemodeOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Livemode, true\n}", "title": "" }, { "docid": "40118a582a3843068c9ba753ded2bb57", "score": "0.5035381", "text": "func (o *InlineResponse20034Milestone) GetPrivateOk() (*bool, bool) {\n\tif o == nil || o.Private == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Private, true\n}", "title": "" }, { "docid": "fefe1e06294873851e45d8bb16a0b8ba", "score": "0.5028771", "text": "func (o *LocalDatabaseProvider) GetUserLockoutThresholdOk() (*int32, bool) {\n\tif o == nil || o.UserLockoutThreshold == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserLockoutThreshold, true\n}", "title": "" }, { "docid": "2e31e6db26916fe9fad620791c8c40c5", "score": "0.5011855", "text": "func GetLevel(module string) Level {\n\treturn defaultBackend.GetLevel(module)\n}", "title": "" }, { "docid": "7eb659626728540d82f412b010af4493", "score": "0.5009975", "text": "func parseLevel(lvl string) (Level, error) {\n\tswitch strings.ToLower(lvl) {\n\tcase \"info\":\n\t\treturn InfoLevel, nil\n\tcase \"error\":\n\t\treturn ErrorLevel, nil\n\tcase \"debug\":\n\t\treturn DebugLevel, nil\n\t}\n\n\tvar l Level\n\treturn l, fmt.Errorf(\"not a valid Level: %q\", lvl)\n}", "title": "" }, { "docid": "6626c644875fd9df9280e4952c6a4eec", "score": "0.50082314", "text": "func (o *ViewProjectBudget) GetStatusOk() (*string, bool) {\n\tif o == nil || o.Status == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Status, true\n}", "title": "" }, { "docid": "482a37e43f1d311206ea94b716bc401a", "score": "0.50075865", "text": "func (o *MuteFindingRequestProperties) GetMutedOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Muted, true\n}", "title": "" } ]